Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sass breaking changes #4528

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 107 additions & 103 deletions build/Bundler.mjs
Original file line number Diff line number Diff line change
@@ -1,155 +1,159 @@
import { createRequire } from 'node:module';
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);

import { nodeResolve } from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";

import license from 'rollup-plugin-license';
import {globbySync} from 'globby';
import fs from 'fs-extra';
import license from "rollup-plugin-license";
import { globbySync } from "globby";
import fs from "fs-extra";

import postcss from "rollup-plugin-postcss";
import sass from "rollup-plugin-sass";

export default class Bundler{

constructor(version, env){
export default class Bundler {
constructor(version, env) {
this.bundles = [];

this.env = env;
this.version = "/* Tabulator v" + version + " (c) Oliver Folkerd <%= moment().format('YYYY') %> */";
this.version =
"/* Tabulator v" +
version +
" (c) Oliver Folkerd <%= moment().format('YYYY') %> */";
}
_suppressUnnecessaryWarnings(warn, defaultHandler){

_suppressUnnecessaryWarnings(warn, defaultHandler) {
const ignoredCodes = {
"FILE_NAME_CONFLICT": true,
FILE_NAME_CONFLICT: true,
};

var suppressed = false,
codeHandler = ignoredCodes[warn.code];

if(codeHandler){
suppressed = typeof codeHandler === "function" ? codeHandler(warn) : codeHandler;

var suppressed = false,
codeHandler = ignoredCodes[warn.code];

if (codeHandler) {
suppressed =
typeof codeHandler === "function" ? codeHandler(warn) : codeHandler;
}
if(!suppressed){

if (!suppressed) {
defaultHandler(warn);
}
}

_suppressCircularDependencyWarnings(warn){
const ignoredCircularFiles = [
"Column.js",
"Tabulator.js",
];

return ignoredCircularFiles.some(file => warn.importer.includes(file));

_suppressCircularDependencyWarnings(warn) {
const ignoredCircularFiles = ["Column.js", "Tabulator.js"];

return ignoredCircularFiles.some((file) => warn.importer.includes(file));
}
bundle(){
if(this.env){

bundle() {
if (this.env) {
this.watch(this.env);
}else{
} else {
this.build();
}

return this.bundles;
}
watch(env){

watch(env) {
console.log("Building Dev Package Bundles: ", env);
switch(env){
switch (env) {
case "css":
this.bundleCSS(false);
break;
this.bundleCSS(false);
break;

case "esm":
this.bundleESM(false);
break;
this.bundleESM(false);
break;

case "umd":
this.bundleUMD(false);
break;
this.bundleUMD(false);
break;

case "wrappers":
this.buildWrappers();
break;
this.buildWrappers();
break;

default:
this.bundleCSS(false);
this.bundleESM(false);
break;
this.bundleCSS(false);
this.bundleESM(false);
break;
}
}
build(){

build() {
console.log("Clearing Dist Files");

this.clearDist();

console.log("Building Wrappers");

this.buildWrappers();

console.log("Building Production Package Bundles");

this.bundleCSS(false);
this.bundleCSS(true);

this.bundleESM(false);
this.bundleESM(true);

this.bundleUMD(false);
this.bundleUMD(true);
}
clearDist(){

clearDist() {
fs.emptyDirSync("./dist");
}
buildWrappers(){

buildWrappers() {
var builds = ["jquery_wrapper.js"];

builds.forEach((build) => {
fs.copySync("./src/js/builds/" + build, "./dist/js/" + build);
});
}

bundleCSS(minify){
this.bundles = this.bundles.concat(globbySync("./src/scss/**/tabulator*.scss").map(inputFile => {

var file = inputFile.split("/");
file = file.pop().replace(".scss", (minify ? ".min" : "") + ".css");

return {
input: inputFile,
output: {
file: "./dist/css/" + file,
format: "es",
},
plugins: [
postcss({
modules: false,
extract: true,
minimize: minify,
sourceMap: true,
plugins: [require('postcss-prettify')]
}),
],
onwarn:this._suppressUnnecessaryWarnings.bind(this),
};
}));

bundleCSS(minify) {
this.bundles = this.bundles.concat(
globbySync("./src/scss/**/tabulator*.scss").map((inputFile) => {
var file = inputFile.split("/");
file = file.pop().replace(".scss", (minify ? ".min" : "") + ".css");

return {
input: inputFile,
output: {
file: "./dist/css/" + file,
format: "es",
},
plugins: [
sass({
processor: postcss({
modules: false,
extract: true,
minimize: minify,
sourceMap: true,
plugins: [require("postcss-prettify")],
}),
}),
],
onwarn: this._suppressUnnecessaryWarnings.bind(this),
};
})
);
}
bundleESM(minify){

bundleESM(minify) {
this.bundles.push({
input:"src/js/builds/esm.js",
input: "src/js/builds/esm.js",
plugins: [
nodeResolve(),
minify ? terser() : null,
license({
banner: {
commentStyle:"none",
content:this.version,
commentStyle: "none",
content: this.version,
},
}),
],
Expand All @@ -161,20 +165,20 @@ export default class Bundler{
sourcemap: true,
},
],
onwarn:this._suppressUnnecessaryWarnings.bind(this),
onwarn: this._suppressUnnecessaryWarnings.bind(this),
});
}
bundleUMD(minify){

bundleUMD(minify) {
this.bundles.push({
input:"src/js/builds/usd.js",
input: "src/js/builds/usd.js",
plugins: [
nodeResolve(),
minify ? terser() : null,
license({
banner: {
commentStyle:"none",
content:this.version,
commentStyle: "none",
content: this.version,
},
}),
],
Expand All @@ -186,7 +190,7 @@ export default class Bundler{
exports: "default",
sourcemap: true,
},
onwarn:this._suppressUnnecessaryWarnings.bind(this),
onwarn: this._suppressUnnecessaryWarnings.bind(this),
});
}
}
}
1,358 changes: 2 additions & 1,356 deletions dist/css/tabulator.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator.css.map

Large diffs are not rendered by default.

1,571 changes: 2 additions & 1,569 deletions dist/css/tabulator_bootstrap3.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_bootstrap3.css.map

Large diffs are not rendered by default.

1,841 changes: 2 additions & 1,839 deletions dist/css/tabulator_bootstrap4.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_bootstrap4.css.map

Large diffs are not rendered by default.

1,868 changes: 2 additions & 1,866 deletions dist/css/tabulator_bootstrap5.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_bootstrap5.css.map

Large diffs are not rendered by default.

1,547 changes: 2 additions & 1,545 deletions dist/css/tabulator_bulma.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_bulma.css.map

Large diffs are not rendered by default.

1,578 changes: 2 additions & 1,576 deletions dist/css/tabulator_materialize.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_materialize.css.map

Large diffs are not rendered by default.

1,476 changes: 2 additions & 1,474 deletions dist/css/tabulator_midnight.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_midnight.css.map

Large diffs are not rendered by default.

1,535 changes: 2 additions & 1,533 deletions dist/css/tabulator_modern.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_modern.css.map

Large diffs are not rendered by default.

2,195 changes: 2 additions & 2,193 deletions dist/css/tabulator_semanticui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_semanticui.css.map

Large diffs are not rendered by default.

1,415 changes: 2 additions & 1,413 deletions dist/css/tabulator_simple.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_simple.css.map

Large diffs are not rendered by default.

1,514 changes: 2 additions & 1,512 deletions dist/css/tabulator_site.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_site.css.map

Large diffs are not rendered by default.

1,733 changes: 2 additions & 1,731 deletions dist/css/tabulator_site_dark.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tabulator_site_dark.css.map

Large diffs are not rendered by default.

Loading
Loading