balm-core 4.7.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/balm.js +3 -5
- package/lib/bundler/webpack/config/common.js +2 -2
- package/lib/bundler/webpack/loaders.js +0 -5
- package/lib/plugins/postcss-plugins.js +1 -3
- package/lib/tasks/private/clean.js +2 -2
- package/lib/tasks/private/pwa-cache.js +2 -2
- package/lib/tasks/public/pwa.js +3 -2
- package/lib/tasks/public/remove.js +2 -2
- package/package.json +27 -27
- package/tslib/balm.js +2 -4
- package/tslib/bundler/webpack/config/common.js +2 -2
- package/tslib/bundler/webpack/loaders.js +0 -5
- package/tslib/plugins/postcss-plugins.js +1 -5
- package/tslib/tasks/private/clean.js +2 -2
- package/tslib/tasks/private/pwa-cache.js +2 -2
- package/tslib/tasks/public/pwa.js +5 -2
- package/tslib/tasks/public/remove.js +2 -2
- package/lib/bundler/webpack/rules/file.js +0 -20
- package/tslib/bundler/webpack/rules/file.js +0 -8
package/lib/balm.js
CHANGED
|
@@ -28,12 +28,10 @@ class Balm {
|
|
|
28
28
|
value: void 0
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
BalmJS.loading = false;
|
|
32
|
+
loading.succeed();
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
BalmJS.loading = false;
|
|
35
|
-
loading.succeed();
|
|
36
|
-
}
|
|
34
|
+
_classPrivateFieldSet(this, _config, setConfig({}));
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
get config() {
|
|
@@ -37,7 +37,7 @@ function getDefaultPlugins(webpack, scripts) {
|
|
|
37
37
|
|
|
38
38
|
BalmJS.entries.forEach((entry, index) => {
|
|
39
39
|
const entryName = isSPA ? 'index' : entry.key;
|
|
40
|
-
const chunks = isSPA ? '
|
|
40
|
+
const chunks = isSPA ? 'all' : [entryName];
|
|
41
41
|
const title = titles[index];
|
|
42
42
|
const options = Object.assign({
|
|
43
43
|
filename: BalmJS.file.absPath(`${BalmJS.config.src.base}/${entryName}.html`),
|
|
@@ -63,7 +63,7 @@ function getSplitChunks() {
|
|
|
63
63
|
cacheGroups = {
|
|
64
64
|
allVendors: {
|
|
65
65
|
name: 'vendors',
|
|
66
|
-
chunks: '
|
|
66
|
+
chunks: 'initial',
|
|
67
67
|
test: /[\\/](node_modules|bower_components)[\\/]/,
|
|
68
68
|
filename: BalmJS.file.assetsPath(`${jsFolder}/${vendorsFilename}`) // Output: `js/vendors.js`
|
|
69
69
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mergeWithRules, CustomizeRule } from 'webpack-merge';
|
|
2
2
|
import LOADERS from './rules/index.js';
|
|
3
|
-
import fileLoader from './rules/file.js';
|
|
4
3
|
|
|
5
4
|
function getLoaders(customLoaders) {
|
|
6
5
|
const enableDefaultLoaders = Object.assign({
|
|
@@ -46,10 +45,6 @@ function getLoaders(customLoaders) {
|
|
|
46
45
|
module: {
|
|
47
46
|
rules: customLoaders
|
|
48
47
|
}
|
|
49
|
-
}, {
|
|
50
|
-
module: {
|
|
51
|
-
rules: [fileLoader()]
|
|
52
|
-
}
|
|
53
48
|
});
|
|
54
49
|
const defaultModule = result.module;
|
|
55
50
|
BalmJS.logger.debug('webpack loaders', defaultModule.rules, {
|
|
@@ -8,9 +8,7 @@ function getDefaultPostcssPlugins(isPostCSS = false) {
|
|
|
8
8
|
const defaultPostcssPlugins = isPostCSS || BalmJS.config.styles.extname === 'css' ? [atImport({
|
|
9
9
|
path: BalmJS.file.stylePaths
|
|
10
10
|
}), postcssFlexbugsFixes(), postcssPresetEnv(BalmJS.config.styles.postcssEnvOptions)] : [];
|
|
11
|
-
const cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify ? [cssnano(
|
|
12
|
-
autoprefixer: false
|
|
13
|
-
}))] : [];
|
|
11
|
+
const cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify ? [cssnano(BalmJS.config.styles.options)] : [];
|
|
14
12
|
return defaultPostcssPlugins.concat([autoprefixer(), ...cssnanoPlugin, ...BalmJS.config.styles.postcssPlugins]);
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -10,7 +10,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
|
10
10
|
|
|
11
11
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import { deleteAsync } from 'del';
|
|
14
14
|
import { ASSETS_TYPES } from '../../config/constants.js';
|
|
15
15
|
|
|
16
16
|
function unique(arr) {
|
|
@@ -53,7 +53,7 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
53
53
|
}, {
|
|
54
54
|
pre: true
|
|
55
55
|
});
|
|
56
|
-
const deletedPaths = await
|
|
56
|
+
const deletedPaths = await deleteAsync(directories, {
|
|
57
57
|
force: true
|
|
58
58
|
});
|
|
59
59
|
BalmJS.logger.warn(taskName, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { deleteAsync } from 'del';
|
|
4
4
|
|
|
5
5
|
class PwaCacheTask extends BalmJS.BalmTask {
|
|
6
6
|
constructor() {
|
|
@@ -21,7 +21,7 @@ class PwaCacheTask extends BalmJS.BalmTask {
|
|
|
21
21
|
|
|
22
22
|
clear() {
|
|
23
23
|
const swOrigin = BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, BalmJS.config.pwa.swSrcFilename));
|
|
24
|
-
|
|
24
|
+
deleteAsync(swOrigin, {
|
|
25
25
|
force: true
|
|
26
26
|
});
|
|
27
27
|
}
|
package/lib/tasks/public/pwa.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { generateSW, injectManifest } from 'workbox-build';
|
|
2
2
|
|
|
3
3
|
class PwaTask extends BalmJS.BalmTask {
|
|
4
4
|
constructor() {
|
|
@@ -53,7 +53,8 @@ class PwaTask extends BalmJS.BalmTask {
|
|
|
53
53
|
BalmJS.logger.debug(`pwa - ${mode}`, options, {
|
|
54
54
|
pre: true
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
const workboxBuild = mode === 'generateSW' ? generateSW(options) : injectManifest(options);
|
|
57
|
+
await workboxBuild.then(({
|
|
57
58
|
count,
|
|
58
59
|
size
|
|
59
60
|
}) => {
|
|
@@ -8,7 +8,7 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
|
8
8
|
|
|
9
9
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import { deleteAsync } from 'del';
|
|
12
12
|
|
|
13
13
|
var _getFiles = /*#__PURE__*/new WeakMap();
|
|
14
14
|
|
|
@@ -39,7 +39,7 @@ class RemoveTask extends BalmJS.BalmTask {
|
|
|
39
39
|
}, {
|
|
40
40
|
pre: true
|
|
41
41
|
});
|
|
42
|
-
const deletedPaths = await
|
|
42
|
+
const deletedPaths = await deleteAsync(files, {
|
|
43
43
|
force: true
|
|
44
44
|
});
|
|
45
45
|
BalmJS.logger.warn(`${this.name} task`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balm-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "BalmJS compiler core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"balm",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"ansi-colors": "^4.1.3",
|
|
45
|
-
"async": "^3.2.
|
|
45
|
+
"async": "^3.2.4",
|
|
46
46
|
"autoprefixer": "^10.4.7",
|
|
47
47
|
"babel-loader": "^8.2.5",
|
|
48
48
|
"browser-sync": "^2.27.10",
|
|
49
|
-
"connect-history-api-fallback": "^
|
|
49
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
50
50
|
"css-loader": "^6.7.1",
|
|
51
51
|
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
52
|
-
"cssnano": "^5.1.
|
|
53
|
-
"del": "^
|
|
52
|
+
"cssnano": "^5.1.12",
|
|
53
|
+
"del": "^7.0.0",
|
|
54
54
|
"dotenv": "^16.0.1",
|
|
55
55
|
"dotenv-expand": "^8.0.3",
|
|
56
|
-
"esbuild": "^0.14",
|
|
56
|
+
"esbuild": "^0.14.0",
|
|
57
57
|
"fancy-log": "^2.0.0",
|
|
58
58
|
"gulp-eslint": "^6.0.0",
|
|
59
59
|
"gulp-if": "^3.0.0",
|
|
@@ -63,41 +63,41 @@
|
|
|
63
63
|
"gulp-size": "^4.0.1",
|
|
64
64
|
"gulp-useref": "^5.0.0",
|
|
65
65
|
"gulp-zip": "^5.1.0",
|
|
66
|
-
"gulp.spritesmith": "^6.
|
|
67
|
-
"html-loader": "^
|
|
66
|
+
"gulp.spritesmith": "^6.13.0",
|
|
67
|
+
"html-loader": "^4.1.0",
|
|
68
68
|
"html-minifier": "^4.0.0",
|
|
69
69
|
"html-webpack-plugin": "^5.5.0",
|
|
70
70
|
"http-proxy-middleware": "^2.0.6",
|
|
71
71
|
"imagemin": "^8.0.1",
|
|
72
72
|
"istextorbinary": "^6.0.0",
|
|
73
|
-
"less": "^4.1.
|
|
74
|
-
"mini-css-extract-plugin": "2.
|
|
73
|
+
"less": "^4.1.3",
|
|
74
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
75
75
|
"modernizr": "^3.12.0",
|
|
76
76
|
"parents": "^1.0.1",
|
|
77
|
-
"plugin-error": "^
|
|
77
|
+
"plugin-error": "^2.0.0",
|
|
78
78
|
"postcss": "^8.4.14",
|
|
79
79
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
80
80
|
"postcss-import": "^14.1.0",
|
|
81
|
-
"postcss-load-config": "^
|
|
82
|
-
"postcss-loader": "7.0.
|
|
83
|
-
"postcss-preset-env": "^7.
|
|
81
|
+
"postcss-load-config": "^4.0.1",
|
|
82
|
+
"postcss-loader": "7.0.1",
|
|
83
|
+
"postcss-preset-env": "^7.7.2",
|
|
84
84
|
"pretty-bytes": "^6.0.0",
|
|
85
|
-
"readable-stream": "^
|
|
85
|
+
"readable-stream": "^4.1.0",
|
|
86
86
|
"replace-ext": "^2.0.0",
|
|
87
|
-
"rollup": "^2.
|
|
87
|
+
"rollup": "^2.77.0",
|
|
88
88
|
"rollup-plugin-terser": "^7.0.2",
|
|
89
|
-
"sass": "^1.
|
|
90
|
-
"sass-loader": "^13.0.
|
|
91
|
-
"ssh2": "^1.
|
|
89
|
+
"sass": "^1.53.0",
|
|
90
|
+
"sass-loader": "^13.0.2",
|
|
91
|
+
"ssh2": "^1.11.0",
|
|
92
92
|
"strip-ansi": "^7.0.1",
|
|
93
93
|
"style-loader": "^3.3.1",
|
|
94
|
-
"terser": "^5.
|
|
95
|
-
"terser-webpack-plugin": "^5.3.
|
|
94
|
+
"terser": "^5.14.2",
|
|
95
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
96
96
|
"through2": "^4.0.2",
|
|
97
97
|
"through2-concurrent": "^2.0.0",
|
|
98
98
|
"tslib": "^2.4.0",
|
|
99
99
|
"vinyl-sourcemaps-apply": "^0.2.1",
|
|
100
|
-
"webpack": "^5.
|
|
100
|
+
"webpack": "^5.73.0",
|
|
101
101
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
102
102
|
"webpack-dev-middleware": "^5.3.3",
|
|
103
103
|
"webpack-hot-middleware": "^2.25.1",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@swc/core": "^1.2",
|
|
109
|
-
"@types/express": "
|
|
110
|
-
"@types/node": "
|
|
111
|
-
"@types/uglify-js": "
|
|
112
|
-
"@types/webpack": "
|
|
109
|
+
"@types/express": "4",
|
|
110
|
+
"@types/node": "18",
|
|
111
|
+
"@types/uglify-js": "3",
|
|
112
|
+
"@types/webpack": "5"
|
|
113
113
|
},
|
|
114
114
|
"optionalDependencies": {
|
|
115
115
|
"imagemin-gifsicle": "^7.0.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"engines": {
|
|
121
121
|
"node": ">=14.15.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "53947df2bdca620a2a915c4b055bf26a52600583"
|
|
124
124
|
}
|
package/tslib/balm.js
CHANGED
|
@@ -9,11 +9,9 @@ import loading from './utilities/loading.js';
|
|
|
9
9
|
class Balm {
|
|
10
10
|
constructor() {
|
|
11
11
|
_Balm_config.set(this, void 0);
|
|
12
|
+
BalmJS.loading = false;
|
|
13
|
+
loading.succeed();
|
|
12
14
|
__classPrivateFieldSet(this, _Balm_config, setConfig({}), "f");
|
|
13
|
-
if (!BalmJS.useCacache) {
|
|
14
|
-
BalmJS.loading = false;
|
|
15
|
-
loading.succeed();
|
|
16
|
-
}
|
|
17
15
|
}
|
|
18
16
|
get config() {
|
|
19
17
|
return __classPrivateFieldGet(this, _Balm_config, "f");
|
|
@@ -22,7 +22,7 @@ function getDefaultPlugins(webpack, scripts) {
|
|
|
22
22
|
}
|
|
23
23
|
BalmJS.entries.forEach((entry, index) => {
|
|
24
24
|
const entryName = isSPA ? 'index' : entry.key;
|
|
25
|
-
const chunks = isSPA ? '
|
|
25
|
+
const chunks = isSPA ? 'all' : [entryName];
|
|
26
26
|
const title = titles[index];
|
|
27
27
|
const options = Object.assign({
|
|
28
28
|
filename: BalmJS.file.absPath(`${BalmJS.config.src.base}/${entryName}.html`),
|
|
@@ -46,7 +46,7 @@ function getSplitChunks() {
|
|
|
46
46
|
cacheGroups = {
|
|
47
47
|
allVendors: {
|
|
48
48
|
name: 'vendors',
|
|
49
|
-
chunks: '
|
|
49
|
+
chunks: 'initial',
|
|
50
50
|
test: /[\\/](node_modules|bower_components)[\\/]/,
|
|
51
51
|
filename: BalmJS.file.assetsPath(`${jsFolder}/${vendorsFilename}`)
|
|
52
52
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { mergeWithRules, CustomizeRule } from 'webpack-merge';
|
|
2
2
|
import LOADERS from './rules/index.js';
|
|
3
|
-
import fileLoader from './rules/file.js';
|
|
4
3
|
function getLoaders(customLoaders) {
|
|
5
4
|
const enableDefaultLoaders = Object.assign({
|
|
6
5
|
js: true,
|
|
@@ -42,10 +41,6 @@ function getLoaders(customLoaders) {
|
|
|
42
41
|
module: {
|
|
43
42
|
rules: customLoaders
|
|
44
43
|
}
|
|
45
|
-
}, {
|
|
46
|
-
module: {
|
|
47
|
-
rules: [fileLoader()]
|
|
48
|
-
}
|
|
49
44
|
});
|
|
50
45
|
const defaultModule = result.module;
|
|
51
46
|
BalmJS.logger.debug('webpack loaders', defaultModule.rules, {
|
|
@@ -12,11 +12,7 @@ function getDefaultPostcssPlugins(isPostCSS = false) {
|
|
|
12
12
|
]
|
|
13
13
|
: [];
|
|
14
14
|
const cssnanoPlugin = BalmJS.config.env.isProd || BalmJS.config.styles.minify
|
|
15
|
-
? [
|
|
16
|
-
cssnano(Object.assign(BalmJS.config.styles.options, {
|
|
17
|
-
autoprefixer: false
|
|
18
|
-
}))
|
|
19
|
-
]
|
|
15
|
+
? [cssnano(BalmJS.config.styles.options)]
|
|
20
16
|
: [];
|
|
21
17
|
return defaultPostcssPlugins.concat([
|
|
22
18
|
autoprefixer(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _CleanTask_getAssetsDir;
|
|
2
2
|
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
-
import
|
|
3
|
+
import { deleteAsync } from 'del';
|
|
4
4
|
import { ASSETS_TYPES } from '../../config/constants.js';
|
|
5
5
|
function unique(arr) {
|
|
6
6
|
const obj = {};
|
|
@@ -32,7 +32,7 @@ class CleanTask extends BalmJS.BalmTask {
|
|
|
32
32
|
}, {
|
|
33
33
|
pre: true
|
|
34
34
|
});
|
|
35
|
-
const deletedPaths = await
|
|
35
|
+
const deletedPaths = await deleteAsync(directories, {
|
|
36
36
|
force: true
|
|
37
37
|
});
|
|
38
38
|
BalmJS.logger.warn(taskName, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { deleteAsync } from 'del';
|
|
2
2
|
class PwaCacheTask extends BalmJS.BalmTask {
|
|
3
3
|
constructor() {
|
|
4
4
|
super('pwa-cache');
|
|
@@ -18,7 +18,7 @@ class PwaCacheTask extends BalmJS.BalmTask {
|
|
|
18
18
|
}
|
|
19
19
|
clear() {
|
|
20
20
|
const swOrigin = BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, BalmJS.config.pwa.swSrcFilename));
|
|
21
|
-
|
|
21
|
+
deleteAsync(swOrigin, { force: true });
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export default PwaCacheTask;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { generateSW, injectManifest } from 'workbox-build';
|
|
2
2
|
class PwaTask extends BalmJS.BalmTask {
|
|
3
3
|
constructor() {
|
|
4
4
|
super('pwa');
|
|
@@ -43,7 +43,10 @@ class PwaTask extends BalmJS.BalmTask {
|
|
|
43
43
|
BalmJS.logger.debug(`pwa - ${mode}`, options, {
|
|
44
44
|
pre: true
|
|
45
45
|
});
|
|
46
|
-
|
|
46
|
+
const workboxBuild = mode === 'generateSW'
|
|
47
|
+
? generateSW(options)
|
|
48
|
+
: injectManifest(options);
|
|
49
|
+
await workboxBuild
|
|
47
50
|
.then(({ count, size }) => {
|
|
48
51
|
BalmJS.logger.info(`pwa - ${mode}`, `Generated '${swDest}', which will precache ${count} files, totaling ${size} bytes`);
|
|
49
52
|
gulp.parallel(BalmJS.toNamespace('pwa-cache'))();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _RemoveTask_getFiles;
|
|
2
2
|
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
-
import
|
|
3
|
+
import { deleteAsync } from 'del';
|
|
4
4
|
class RemoveTask extends BalmJS.BalmTask {
|
|
5
5
|
constructor() {
|
|
6
6
|
super('remove');
|
|
@@ -23,7 +23,7 @@ class RemoveTask extends BalmJS.BalmTask {
|
|
|
23
23
|
}, {
|
|
24
24
|
pre: true
|
|
25
25
|
});
|
|
26
|
-
const deletedPaths = await
|
|
26
|
+
const deletedPaths = await deleteAsync(files, {
|
|
27
27
|
force: true
|
|
28
28
|
});
|
|
29
29
|
BalmJS.logger.warn(`${this.name} task`, {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsRegex, htmlRegex } from '../config/regex.js';
|
|
2
|
-
|
|
3
|
-
function fileLoader() {
|
|
4
|
-
// "file" loader makes sure those assets get served by WebpackDevServer.
|
|
5
|
-
// When you `import` an asset, you get its (virtual) filename.
|
|
6
|
-
// In production, they would get copied to the `build` folder.
|
|
7
|
-
// This loader doesn't use a "test" so it will catch all modules
|
|
8
|
-
// that fall through the other loaders.
|
|
9
|
-
return {
|
|
10
|
-
// Exclude `js` files to keep "css" loader working as it injects
|
|
11
|
-
// its runtime that would otherwise be processed through "file" loader.
|
|
12
|
-
// Also exclude `html` and `json` extensions so they get processed
|
|
13
|
-
// by webpacks internal loaders.
|
|
14
|
-
exclude: [/^$/, jsRegex, htmlRegex, /\.json$/],
|
|
15
|
-
type: 'asset/resource'
|
|
16
|
-
}; // ** STOP ** Are you adding a new loader?
|
|
17
|
-
// Make sure to add the new loader(s) before the "file" loader.
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default fileLoader;
|