balm-core 5.2.0 → 6.0.0-alpha.1
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/CHANGELOG.md +16 -0
- package/dist/index.cjs +2625 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +569 -0
- package/dist/index.d.ts +569 -0
- package/dist/index.js +2527 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -123
- package/src/balm.ts +108 -0
- package/src/bundler/esbuild.ts +47 -0
- package/src/bundler/index.ts +3 -0
- package/src/bundler/rollup.ts +45 -0
- package/src/bundler/webpack.ts +124 -0
- package/src/config/constants.ts +12 -0
- package/src/config/defaults.ts +209 -0
- package/src/config/index.ts +112 -0
- package/src/hooks/index.ts +224 -0
- package/src/index.ts +16 -0
- package/src/pipeline/file.ts +69 -0
- package/src/pipeline/index.ts +10 -0
- package/src/pipeline/pipeline.ts +135 -0
- package/src/pipeline/transforms/cache.ts +146 -0
- package/src/pipeline/transforms/htmlmin.ts +18 -0
- package/src/pipeline/transforms/less.ts +75 -0
- package/src/pipeline/transforms/postcss.ts +43 -0
- package/src/pipeline/transforms/rename.ts +37 -0
- package/src/pipeline/transforms/replace.ts +30 -0
- package/src/pipeline/transforms/sass.ts +106 -0
- package/src/pipeline/transforms/terser.ts +20 -0
- package/src/runner/dag.ts +77 -0
- package/src/runner/task.ts +38 -0
- package/src/shims.d.ts +5 -0
- package/src/tasks/cache.ts +72 -0
- package/src/tasks/clean.ts +21 -0
- package/src/tasks/copy.ts +36 -0
- package/src/tasks/ftp.ts +90 -0
- package/src/tasks/html.ts +232 -0
- package/src/tasks/index.ts +14 -0
- package/src/tasks/publish.ts +71 -0
- package/src/tasks/pwa.ts +99 -0
- package/src/tasks/remove.ts +24 -0
- package/src/tasks/replace.ts +34 -0
- package/src/tasks/script.ts +28 -0
- package/src/tasks/server.ts +183 -0
- package/src/tasks/static.ts +104 -0
- package/src/tasks/style.ts +57 -0
- package/src/tasks/zip.ts +65 -0
- package/src/types/index.ts +202 -0
- package/src/utilities/file.ts +120 -0
- package/src/utilities/logger.ts +63 -0
- package/src/utilities/utils.ts +46 -0
- package/src/utilities/workspace.ts +38 -0
- package/src/watcher/index.ts +100 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +12 -0
- package/README.md +0 -196
- package/index.d.ts +0 -360
- package/lib/balm.js +0 -49
- package/lib/bootstrap/check_config.js +0 -43
- package/lib/bootstrap/index.js +0 -87
- package/lib/bundler/esbuild/build.js +0 -26
- package/lib/bundler/esbuild/index.js +0 -7
- package/lib/bundler/esbuild/options.js +0 -7
- package/lib/bundler/esbuild/transform.js +0 -36
- package/lib/bundler/rollup/build.js +0 -52
- package/lib/bundler/rollup/entry.js +0 -28
- package/lib/bundler/rollup/index.js +0 -20
- package/lib/bundler/rollup/output.js +0 -20
- package/lib/bundler/rollup/plugins.js +0 -31
- package/lib/bundler/webpack/config/common.js +0 -135
- package/lib/bundler/webpack/config/dev.js +0 -12
- package/lib/bundler/webpack/config/env.js +0 -67
- package/lib/bundler/webpack/config/index.js +0 -6
- package/lib/bundler/webpack/config/prod.js +0 -39
- package/lib/bundler/webpack/config/regex.js +0 -10
- package/lib/bundler/webpack/entry.js +0 -65
- package/lib/bundler/webpack/index.js +0 -32
- package/lib/bundler/webpack/loaders.js +0 -50
- package/lib/bundler/webpack/output.js +0 -41
- package/lib/bundler/webpack/rules/asset.js +0 -33
- package/lib/bundler/webpack/rules/babel.js +0 -19
- package/lib/bundler/webpack/rules/css.js +0 -109
- package/lib/bundler/webpack/rules/html.js +0 -15
- package/lib/bundler/webpack/rules/index.js +0 -10
- package/lib/config/assets.js +0 -30
- package/lib/config/constants.js +0 -14
- package/lib/config/env.js +0 -35
- package/lib/config/extras.js +0 -6
- package/lib/config/ftp.js +0 -6
- package/lib/config/globals.js +0 -43
- package/lib/config/html.js +0 -22
- package/lib/config/images.js +0 -4
- package/lib/config/index.js +0 -63
- package/lib/config/logs.js +0 -11
- package/lib/config/paths.js +0 -46
- package/lib/config/pwa.js +0 -24
- package/lib/config/roots.js +0 -9
- package/lib/config/scripts.js +0 -162
- package/lib/config/server.js +0 -84
- package/lib/config/spinner.js +0 -9
- package/lib/config/styles.js +0 -67
- package/lib/hello.js +0 -19
- package/lib/hooks/index.js +0 -94
- package/lib/hooks/maker.js +0 -59
- package/lib/index.js +0 -5
- package/lib/middlewares/history.js +0 -6
- package/lib/middlewares/index.js +0 -11
- package/lib/middlewares/proxy.js +0 -28
- package/lib/middlewares/webpack.js +0 -26
- package/lib/plugins/htmlmin.js +0 -39
- package/lib/plugins/imagemin.js +0 -95
- package/lib/plugins/index.js +0 -27
- package/lib/plugins/jsmin.js +0 -37
- package/lib/plugins/less.js +0 -97
- package/lib/plugins/plumber.js +0 -87
- package/lib/plugins/postcss-plugins.js +0 -13
- package/lib/plugins/postcss.js +0 -117
- package/lib/plugins/rename.js +0 -51
- package/lib/plugins/replace.js +0 -91
- package/lib/plugins/sass-legacy.js +0 -131
- package/lib/plugins/sass.js +0 -134
- package/lib/plugins/sftp.js +0 -288
- package/lib/tasks/default.js +0 -46
- package/lib/tasks/foundation/balm.js +0 -72
- package/lib/tasks/foundation/balm_style.js +0 -65
- package/lib/tasks/foundation/index.js +0 -10
- package/lib/tasks/index.js +0 -48
- package/lib/tasks/private/build.js +0 -18
- package/lib/tasks/private/cache.js +0 -31
- package/lib/tasks/private/clean.js +0 -69
- package/lib/tasks/private/end.js +0 -24
- package/lib/tasks/private/extra.js +0 -35
- package/lib/tasks/private/font.js +0 -15
- package/lib/tasks/private/image.js +0 -37
- package/lib/tasks/private/index.js +0 -34
- package/lib/tasks/private/lint.js +0 -20
- package/lib/tasks/private/media.js +0 -15
- package/lib/tasks/private/modernizr.js +0 -59
- package/lib/tasks/private/pwa-cache.js +0 -32
- package/lib/tasks/private/script.js +0 -9
- package/lib/tasks/private/sprite.js +0 -105
- package/lib/tasks/private/start.js +0 -16
- package/lib/tasks/private/style.js +0 -9
- package/lib/tasks/private/workbox-sw.js +0 -15
- package/lib/tasks/public/copy.js +0 -16
- package/lib/tasks/public/esbuild.js +0 -18
- package/lib/tasks/public/ftp.js +0 -39
- package/lib/tasks/public/html.js +0 -65
- package/lib/tasks/public/index.js +0 -38
- package/lib/tasks/public/jsmin.js +0 -23
- package/lib/tasks/public/less.js +0 -21
- package/lib/tasks/public/postcss.js +0 -16
- package/lib/tasks/public/publish.js +0 -51
- package/lib/tasks/public/pwa.js +0 -84
- package/lib/tasks/public/remove.js +0 -46
- package/lib/tasks/public/replace.js +0 -26
- package/lib/tasks/public/rollup.js +0 -17
- package/lib/tasks/public/sass.js +0 -27
- package/lib/tasks/public/server.js +0 -130
- package/lib/tasks/public/url.js +0 -35
- package/lib/tasks/public/version.js +0 -23
- package/lib/tasks/public/webpack.js +0 -39
- package/lib/tasks/public/zip.js +0 -19
- package/lib/utilities/address.js +0 -55
- package/lib/utilities/cache-core.js +0 -66
- package/lib/utilities/color.js +0 -27
- package/lib/utilities/compiling.js +0 -24
- package/lib/utilities/detect-port.js +0 -100
- package/lib/utilities/escape-string-regexp.js +0 -10
- package/lib/utilities/file.js +0 -70
- package/lib/utilities/index.js +0 -8
- package/lib/utilities/loading.js +0 -37
- package/lib/utilities/logger.js +0 -99
- package/lib/utilities/merge-stream.js +0 -38
- package/lib/utilities/namespace.js +0 -11
- package/lib/utilities/public-url.js +0 -37
- package/lib/utilities/replacestream.js +0 -106
- package/lib/utilities/typeof.js +0 -5
- package/lib/utilities/utils.js +0 -43
- package/tslib/balm.js +0 -44
- package/tslib/bootstrap/check_config.js +0 -36
- package/tslib/bootstrap/index.js +0 -82
- package/tslib/bundler/esbuild/build.js +0 -30
- package/tslib/bundler/esbuild/index.js +0 -11
- package/tslib/bundler/esbuild/options.js +0 -7
- package/tslib/bundler/esbuild/transform.js +0 -38
- package/tslib/bundler/rollup/build.js +0 -17
- package/tslib/bundler/rollup/entry.js +0 -24
- package/tslib/bundler/rollup/index.js +0 -21
- package/tslib/bundler/rollup/output.js +0 -23
- package/tslib/bundler/rollup/plugins.js +0 -27
- package/tslib/bundler/webpack/config/common.js +0 -130
- package/tslib/bundler/webpack/config/dev.js +0 -14
- package/tslib/bundler/webpack/config/env.js +0 -44
- package/tslib/bundler/webpack/config/index.js +0 -8
- package/tslib/bundler/webpack/config/prod.js +0 -43
- package/tslib/bundler/webpack/config/regex.js +0 -10
- package/tslib/bundler/webpack/entry.js +0 -68
- package/tslib/bundler/webpack/index.js +0 -30
- package/tslib/bundler/webpack/loaders.js +0 -51
- package/tslib/bundler/webpack/output.js +0 -41
- package/tslib/bundler/webpack/rules/asset.js +0 -33
- package/tslib/bundler/webpack/rules/babel.js +0 -16
- package/tslib/bundler/webpack/rules/css.js +0 -95
- package/tslib/bundler/webpack/rules/html.js +0 -15
- package/tslib/bundler/webpack/rules/index.js +0 -10
- package/tslib/config/assets.js +0 -24
- package/tslib/config/constants.js +0 -14
- package/tslib/config/env.js +0 -43
- package/tslib/config/extras.js +0 -6
- package/tslib/config/ftp.js +0 -6
- package/tslib/config/globals.js +0 -47
- package/tslib/config/html.js +0 -17
- package/tslib/config/images.js +0 -4
- package/tslib/config/index.js +0 -56
- package/tslib/config/logs.js +0 -6
- package/tslib/config/paths.js +0 -30
- package/tslib/config/pwa.js +0 -18
- package/tslib/config/roots.js +0 -8
- package/tslib/config/scripts.js +0 -93
- package/tslib/config/server.js +0 -33
- package/tslib/config/spinner.js +0 -10
- package/tslib/config/styles.js +0 -37
- package/tslib/hello.js +0 -19
- package/tslib/hooks/index.js +0 -75
- package/tslib/hooks/maker.js +0 -66
- package/tslib/index.js +0 -5
- package/tslib/middlewares/history.js +0 -12
- package/tslib/middlewares/index.js +0 -18
- package/tslib/middlewares/proxy.js +0 -27
- package/tslib/middlewares/webpack.js +0 -29
- package/tslib/plugins/htmlmin.js +0 -38
- package/tslib/plugins/imagemin.js +0 -97
- package/tslib/plugins/index.js +0 -27
- package/tslib/plugins/jsmin.js +0 -39
- package/tslib/plugins/less.js +0 -90
- package/tslib/plugins/plumber.js +0 -81
- package/tslib/plugins/postcss-plugins.js +0 -24
- package/tslib/plugins/postcss.js +0 -111
- package/tslib/plugins/rename.js +0 -51
- package/tslib/plugins/replace.js +0 -72
- package/tslib/plugins/sass-legacy.js +0 -95
- package/tslib/plugins/sass.js +0 -109
- package/tslib/plugins/sftp.js +0 -258
- package/tslib/tasks/default.js +0 -59
- package/tslib/tasks/foundation/balm.js +0 -75
- package/tslib/tasks/foundation/balm_style.js +0 -68
- package/tslib/tasks/foundation/index.js +0 -10
- package/tslib/tasks/index.js +0 -43
- package/tslib/tasks/private/build.js +0 -15
- package/tslib/tasks/private/cache.js +0 -48
- package/tslib/tasks/private/clean.js +0 -82
- package/tslib/tasks/private/end.js +0 -21
- package/tslib/tasks/private/extra.js +0 -34
- package/tslib/tasks/private/font.js +0 -12
- package/tslib/tasks/private/image.js +0 -42
- package/tslib/tasks/private/index.js +0 -34
- package/tslib/tasks/private/lint.js +0 -17
- package/tslib/tasks/private/media.js +0 -12
- package/tslib/tasks/private/modernizr.js +0 -54
- package/tslib/tasks/private/pwa-cache.js +0 -32
- package/tslib/tasks/private/script.js +0 -9
- package/tslib/tasks/private/sprite.js +0 -93
- package/tslib/tasks/private/start.js +0 -13
- package/tslib/tasks/private/style.js +0 -12
- package/tslib/tasks/private/workbox-sw.js +0 -15
- package/tslib/tasks/public/copy.js +0 -18
- package/tslib/tasks/public/esbuild.js +0 -18
- package/tslib/tasks/public/ftp.js +0 -39
- package/tslib/tasks/public/html.js +0 -75
- package/tslib/tasks/public/index.js +0 -38
- package/tslib/tasks/public/jsmin.js +0 -24
- package/tslib/tasks/public/less.js +0 -21
- package/tslib/tasks/public/postcss.js +0 -16
- package/tslib/tasks/public/publish.js +0 -50
- package/tslib/tasks/public/pwa.js +0 -87
- package/tslib/tasks/public/remove.js +0 -44
- package/tslib/tasks/public/replace.js +0 -27
- package/tslib/tasks/public/rollup.js +0 -17
- package/tslib/tasks/public/sass.js +0 -27
- package/tslib/tasks/public/server.js +0 -129
- package/tslib/tasks/public/url.js +0 -35
- package/tslib/tasks/public/version.js +0 -27
- package/tslib/tasks/public/webpack.js +0 -41
- package/tslib/tasks/public/zip.js +0 -19
- package/tslib/utilities/address.js +0 -48
- package/tslib/utilities/cache-core.js +0 -57
- package/tslib/utilities/color.js +0 -33
- package/tslib/utilities/compiling.js +0 -16
- package/tslib/utilities/detect-port.js +0 -91
- package/tslib/utilities/escape-string-regexp.js +0 -7
- package/tslib/utilities/file.js +0 -78
- package/tslib/utilities/index.js +0 -8
- package/tslib/utilities/loading.js +0 -25
- package/tslib/utilities/logger.js +0 -92
- package/tslib/utilities/merge-stream.js +0 -34
- package/tslib/utilities/namespace.js +0 -12
- package/tslib/utilities/public-url.js +0 -31
- package/tslib/utilities/replacestream.js +0 -112
- package/tslib/utilities/typeof.js +0 -8
- package/tslib/utilities/utils.js +0 -38
package/lib/config/logs.js
DELETED
package/lib/config/paths.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const source = {
|
|
2
|
-
base: '',
|
|
3
|
-
// Project directory
|
|
4
|
-
html: '',
|
|
5
|
-
// HTML template directory: `src`
|
|
6
|
-
css: 'styles',
|
|
7
|
-
// Stylesheet directory: `src/styles`
|
|
8
|
-
js: 'scripts',
|
|
9
|
-
// Javascript directory: `src/scripts`
|
|
10
|
-
img: 'images',
|
|
11
|
-
// Image directory: `src/images`
|
|
12
|
-
font: 'fonts',
|
|
13
|
-
// Font directory: `src/fonts`
|
|
14
|
-
media: 'media' // Media directory: `src/media`
|
|
15
|
-
};
|
|
16
|
-
const tmp = {
|
|
17
|
-
base: '',
|
|
18
|
-
// `.tmp`
|
|
19
|
-
css: 'css',
|
|
20
|
-
// `.tmp/css`
|
|
21
|
-
js: 'js',
|
|
22
|
-
// `.tmp/js`
|
|
23
|
-
img: 'img',
|
|
24
|
-
// `.tmp/img`
|
|
25
|
-
font: 'fonts',
|
|
26
|
-
// `.tmp/fonts`
|
|
27
|
-
media: 'media' // `.tmp/media`
|
|
28
|
-
};
|
|
29
|
-
const target = {
|
|
30
|
-
base: '',
|
|
31
|
-
// `dist`
|
|
32
|
-
css: 'css',
|
|
33
|
-
// `dist/css`
|
|
34
|
-
js: 'js',
|
|
35
|
-
// `dist/js`
|
|
36
|
-
img: 'img',
|
|
37
|
-
// `dist/img`
|
|
38
|
-
font: 'font',
|
|
39
|
-
// `dist/font`
|
|
40
|
-
media: 'media' // `dist/media`
|
|
41
|
-
};
|
|
42
|
-
export default {
|
|
43
|
-
source,
|
|
44
|
-
tmp,
|
|
45
|
-
target
|
|
46
|
-
};
|
package/lib/config/pwa.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const enabled = false;
|
|
2
|
-
const manifest = 'manifest.json'; // 'manifest.json' or 'manifest.webmanifest'
|
|
3
|
-
const workboxSw = 'node_modules/workbox-sw/build/workbox-sw.js';
|
|
4
|
-
const mode = 'generateSW'; // 'generateSW' or 'injectManifest'
|
|
5
|
-
/**
|
|
6
|
-
* Workbox Build options
|
|
7
|
-
*
|
|
8
|
-
* @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config
|
|
9
|
-
* @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_injectmanifest_config
|
|
10
|
-
*/
|
|
11
|
-
const options = {};
|
|
12
|
-
const swSrcFilename = 'service-worker.js';
|
|
13
|
-
const swDestFilename = 'sw.js';
|
|
14
|
-
const version = '';
|
|
15
|
-
export default {
|
|
16
|
-
enabled,
|
|
17
|
-
manifest,
|
|
18
|
-
workboxSw,
|
|
19
|
-
mode,
|
|
20
|
-
options,
|
|
21
|
-
swSrcFilename,
|
|
22
|
-
swDestFilename,
|
|
23
|
-
version
|
|
24
|
-
};
|
package/lib/config/roots.js
DELETED
package/lib/config/scripts.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
// Base options
|
|
2
|
-
const bundler = 'webpack';
|
|
3
|
-
const minify = false;
|
|
4
|
-
/**
|
|
5
|
-
* Terser minify options
|
|
6
|
-
*
|
|
7
|
-
* @reference https://github.com/terser/terser#minify-options
|
|
8
|
-
*/
|
|
9
|
-
const minifyOptions = {
|
|
10
|
-
ecma: 5,
|
|
11
|
-
compress: {
|
|
12
|
-
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
13
|
-
// https://github.com/facebook/create-react-app/issues/2376
|
|
14
|
-
// Pending further investigation:
|
|
15
|
-
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
16
|
-
comparisons: false,
|
|
17
|
-
// Disabled because of an issue with Terser breaking valid code:
|
|
18
|
-
// https://github.com/facebook/create-react-app/issues/5250
|
|
19
|
-
// Pending further investigation:
|
|
20
|
-
// https://github.com/terser-js/terser/issues/120
|
|
21
|
-
inline: 2
|
|
22
|
-
},
|
|
23
|
-
mangle: {
|
|
24
|
-
safari10: true
|
|
25
|
-
},
|
|
26
|
-
format: {
|
|
27
|
-
comments: false,
|
|
28
|
-
// Turned on because emoji and regex is not minified properly using default
|
|
29
|
-
// https://github.com/facebook/create-react-app/issues/2488
|
|
30
|
-
ascii_only: true
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
// Entry and Context (webpack/esbuild common options)
|
|
34
|
-
const entry = '';
|
|
35
|
-
const lint = false;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Webpack bundler
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
// Output
|
|
42
|
-
const library = '';
|
|
43
|
-
// Module
|
|
44
|
-
const loaders = [];
|
|
45
|
-
const defaultLoaders = {};
|
|
46
|
-
const includeJsResource = [];
|
|
47
|
-
const useEsModule = true;
|
|
48
|
-
/**
|
|
49
|
-
* Scripts: babel-loader options
|
|
50
|
-
*
|
|
51
|
-
* @reference https://github.com/babel/babel-loader#options
|
|
52
|
-
*/
|
|
53
|
-
const babelLoaderOptions = {};
|
|
54
|
-
/**
|
|
55
|
-
* Styling: postcss-loader options
|
|
56
|
-
*
|
|
57
|
-
* @reference https://github.com/postcss/postcss-loader#options
|
|
58
|
-
*/
|
|
59
|
-
const postcssLoaderOptions = {};
|
|
60
|
-
/**
|
|
61
|
-
* Template: html-loader options
|
|
62
|
-
*
|
|
63
|
-
* @reference https://github.com/webpack-contrib/html-loader#options
|
|
64
|
-
*/
|
|
65
|
-
const htmlLoaderOptions = {};
|
|
66
|
-
const imageAssetType = 'asset';
|
|
67
|
-
const imageInlineSizeLimit = 8096; // 8kb
|
|
68
|
-
// Resolve
|
|
69
|
-
const extensions = [];
|
|
70
|
-
const alias = {};
|
|
71
|
-
// Plugins
|
|
72
|
-
const plugins = [];
|
|
73
|
-
const nodeEnv = {};
|
|
74
|
-
const injectHtml = false;
|
|
75
|
-
const htmlPluginOptions = {};
|
|
76
|
-
const extractCss = false;
|
|
77
|
-
// Devtool
|
|
78
|
-
const sourceMap = false;
|
|
79
|
-
// Target
|
|
80
|
-
const target = ['web', 'es5'];
|
|
81
|
-
// Externals
|
|
82
|
-
const externals = '';
|
|
83
|
-
// Stats
|
|
84
|
-
const stats = {
|
|
85
|
-
colors: true,
|
|
86
|
-
assets: true,
|
|
87
|
-
children: false,
|
|
88
|
-
chunks: false,
|
|
89
|
-
modules: false
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Full custom webpack configuration
|
|
93
|
-
*
|
|
94
|
-
* @reference https://webpack.js.org/configuration/
|
|
95
|
-
*/
|
|
96
|
-
const webpackOptions = {};
|
|
97
|
-
// Optimization
|
|
98
|
-
/**
|
|
99
|
-
* Webpack optimizations for manual configuration and overrides
|
|
100
|
-
*
|
|
101
|
-
* @reference https://webpack.js.org/configuration/optimization/
|
|
102
|
-
*/
|
|
103
|
-
const optimization = {};
|
|
104
|
-
const extractAllVendors = false; // Extract all vendors (all in one)
|
|
105
|
-
const vendorName = 'vendor'; // AllInOne vendor filename or Vendors folder name
|
|
106
|
-
// IE8 compatibility
|
|
107
|
-
const ie8 = false;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Rollup bundler
|
|
111
|
-
*/
|
|
112
|
-
const inputOptions = {};
|
|
113
|
-
const outputOptions = {};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Esbuild bundler
|
|
117
|
-
*/
|
|
118
|
-
const buildOptions = {};
|
|
119
|
-
const useTransform = false;
|
|
120
|
-
const transformOptions = {};
|
|
121
|
-
export default {
|
|
122
|
-
// base
|
|
123
|
-
bundler,
|
|
124
|
-
minify,
|
|
125
|
-
minifyOptions,
|
|
126
|
-
entry,
|
|
127
|
-
lint,
|
|
128
|
-
// webpack
|
|
129
|
-
library,
|
|
130
|
-
loaders,
|
|
131
|
-
defaultLoaders,
|
|
132
|
-
includeJsResource,
|
|
133
|
-
useEsModule,
|
|
134
|
-
babelLoaderOptions,
|
|
135
|
-
postcssLoaderOptions,
|
|
136
|
-
htmlLoaderOptions,
|
|
137
|
-
imageAssetType,
|
|
138
|
-
imageInlineSizeLimit,
|
|
139
|
-
extensions,
|
|
140
|
-
alias,
|
|
141
|
-
plugins,
|
|
142
|
-
nodeEnv,
|
|
143
|
-
injectHtml,
|
|
144
|
-
htmlPluginOptions,
|
|
145
|
-
extractCss,
|
|
146
|
-
sourceMap,
|
|
147
|
-
target,
|
|
148
|
-
externals,
|
|
149
|
-
stats,
|
|
150
|
-
webpackOptions,
|
|
151
|
-
optimization,
|
|
152
|
-
extractAllVendors,
|
|
153
|
-
vendorName,
|
|
154
|
-
ie8,
|
|
155
|
-
// rollup
|
|
156
|
-
inputOptions,
|
|
157
|
-
outputOptions,
|
|
158
|
-
// esbuild
|
|
159
|
-
buildOptions,
|
|
160
|
-
useTransform,
|
|
161
|
-
transformOptions
|
|
162
|
-
};
|
package/lib/config/server.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const port = 3000;
|
|
2
|
-
const host = null;
|
|
3
|
-
const https = undefined;
|
|
4
|
-
const open = false;
|
|
5
|
-
const proxy = false; // Host: your.project.dev
|
|
6
|
-
const serveStatic = [
|
|
7
|
-
// {
|
|
8
|
-
// route: '/public',
|
|
9
|
-
// dir: '/path/to/public'
|
|
10
|
-
// }
|
|
11
|
-
];
|
|
12
|
-
/**
|
|
13
|
-
* Browsersync options
|
|
14
|
-
*
|
|
15
|
-
* @reference https://browsersync.io/docs/options
|
|
16
|
-
*/
|
|
17
|
-
const options = {};
|
|
18
|
-
const next = NOOP;
|
|
19
|
-
// Middleware
|
|
20
|
-
/**
|
|
21
|
-
* A development middleware for webpack
|
|
22
|
-
*
|
|
23
|
-
* @reference https://github.com/webpack/webpack-dev-middleware#options
|
|
24
|
-
*/
|
|
25
|
-
const devOptions = {};
|
|
26
|
-
/**
|
|
27
|
-
* Webpack hot reloading
|
|
28
|
-
*
|
|
29
|
-
* @reference https://github.com/webpack-contrib/webpack-hot-middleware#config
|
|
30
|
-
*/
|
|
31
|
-
const hotOptions = {
|
|
32
|
-
reload: true,
|
|
33
|
-
noInfo: true
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Http-proxy middleware
|
|
37
|
-
*
|
|
38
|
-
* @reference https://github.com/chimurai/http-proxy-middleware#options
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* Single proxy example
|
|
42
|
-
* {
|
|
43
|
-
* target: 'http://www.example.org',
|
|
44
|
-
* changeOrigin: true,
|
|
45
|
-
* pathFilter: '/api'
|
|
46
|
-
* }
|
|
47
|
-
* @example
|
|
48
|
-
* Multiple proxies example
|
|
49
|
-
* [{
|
|
50
|
-
* target: 'http://www.example.org',
|
|
51
|
-
* changeOrigin: true,
|
|
52
|
-
* pathFilter: '/api'
|
|
53
|
-
* }, {
|
|
54
|
-
* target: 'http://www.example2.org',
|
|
55
|
-
* changeOrigin: true,
|
|
56
|
-
* pathFilter: ['/api2', '/api3']
|
|
57
|
-
* }]
|
|
58
|
-
*/
|
|
59
|
-
const proxyOptions = false;
|
|
60
|
-
/**
|
|
61
|
-
* HTML 5 history API
|
|
62
|
-
*
|
|
63
|
-
* @reference https://github.com/bripkens/connect-history-api-fallback#options
|
|
64
|
-
*/
|
|
65
|
-
const historyOptions = false;
|
|
66
|
-
const middlewares = []; // Extra middlewares for server
|
|
67
|
-
const extraWatchFiles = []; // Just for `mix.serve`
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
port,
|
|
71
|
-
host,
|
|
72
|
-
https,
|
|
73
|
-
open,
|
|
74
|
-
proxy,
|
|
75
|
-
serveStatic,
|
|
76
|
-
options,
|
|
77
|
-
next,
|
|
78
|
-
devOptions,
|
|
79
|
-
hotOptions,
|
|
80
|
-
proxyOptions,
|
|
81
|
-
historyOptions,
|
|
82
|
-
middlewares,
|
|
83
|
-
extraWatchFiles
|
|
84
|
-
};
|
package/lib/config/spinner.js
DELETED
package/lib/config/styles.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const extname = 'css';
|
|
2
|
-
const minify = false;
|
|
3
|
-
const atImportPaths = [];
|
|
4
|
-
const entry = '';
|
|
5
|
-
/**
|
|
6
|
-
* Cssnano optimisations
|
|
7
|
-
*
|
|
8
|
-
* @reference https://cssnano.co/docs/optimisations/
|
|
9
|
-
*/
|
|
10
|
-
const options = {
|
|
11
|
-
discardComments: {
|
|
12
|
-
removeAll: true
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* LibSass options
|
|
17
|
-
*
|
|
18
|
-
* @reference https://github.com/sass/node-sass#options
|
|
19
|
-
*/
|
|
20
|
-
const sassOptions = {};
|
|
21
|
-
/**
|
|
22
|
-
* Less plugin for Gulp
|
|
23
|
-
*
|
|
24
|
-
* @reference https://github.com/gulp-community/gulp-less#options
|
|
25
|
-
*/
|
|
26
|
-
const lessOptions = {};
|
|
27
|
-
/**
|
|
28
|
-
* PostCSS Preset Env
|
|
29
|
-
*
|
|
30
|
-
* @reference https://github.com/csstools/postcss-preset-env#options
|
|
31
|
-
*/
|
|
32
|
-
const postcssEnvOptions = {
|
|
33
|
-
autoprefixer: {
|
|
34
|
-
flexbox: 'no-2009'
|
|
35
|
-
},
|
|
36
|
-
stage: 3
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* PostCSS plugins
|
|
40
|
-
*
|
|
41
|
-
* @reference https://www.postcss.parts/
|
|
42
|
-
*/
|
|
43
|
-
const postcssPlugins = [];
|
|
44
|
-
// CSS Sprites
|
|
45
|
-
const imageBasePath = '../'; // Relative to css file
|
|
46
|
-
const sprites = []; // Image folders
|
|
47
|
-
const spriteRetina = false;
|
|
48
|
-
/**
|
|
49
|
-
* Spritesmith parameters
|
|
50
|
-
* @reference https://github.com/twolfson/gulp.spritesmith#spritesmithparams
|
|
51
|
-
*/
|
|
52
|
-
const spriteParams = {};
|
|
53
|
-
export default {
|
|
54
|
-
extname,
|
|
55
|
-
minify,
|
|
56
|
-
atImportPaths,
|
|
57
|
-
entry,
|
|
58
|
-
options,
|
|
59
|
-
sassOptions,
|
|
60
|
-
lessOptions,
|
|
61
|
-
postcssEnvOptions,
|
|
62
|
-
postcssPlugins,
|
|
63
|
-
imageBasePath,
|
|
64
|
-
sprites,
|
|
65
|
-
spriteRetina,
|
|
66
|
-
spriteParams
|
|
67
|
-
};
|
package/lib/hello.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { versions } from 'node:process';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { URL } from 'node:url';
|
|
5
|
-
import { EventEmitter } from 'node:events';
|
|
6
|
-
import cacheBalmCore from './utilities/cache-core.js';
|
|
7
|
-
const requireModule = createRequire(import.meta.url);
|
|
8
|
-
const balmCorePkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
9
|
-
global.requireModule = requireModule;
|
|
10
|
-
global.BalmJS = {
|
|
11
|
-
version: balmCorePkg.version,
|
|
12
|
-
emitter: new EventEmitter(),
|
|
13
|
-
useCacache: +versions.node.split('.')[0] >= 18
|
|
14
|
-
};
|
|
15
|
-
if (!BalmJS.useCacache) {
|
|
16
|
-
BalmJS.loading = true;
|
|
17
|
-
cacheBalmCore();
|
|
18
|
-
}
|
|
19
|
-
export default balmCorePkg.version;
|
package/lib/hooks/index.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import Maker from './maker.js';
|
|
2
|
-
class BaseHooks {
|
|
3
|
-
get env() {
|
|
4
|
-
return BalmJS.config.env;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// HTML
|
|
8
|
-
html(input, output) {
|
|
9
|
-
Maker.generate('html', [input, output]);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Stylesheets
|
|
13
|
-
css(input, output) {
|
|
14
|
-
Maker.generate('postcss', [input, output]);
|
|
15
|
-
}
|
|
16
|
-
sass(input, output, options) {
|
|
17
|
-
Maker.generate('sass', [input, output, options]);
|
|
18
|
-
}
|
|
19
|
-
less(input, output, options) {
|
|
20
|
-
Maker.generate('less', [input, output, options]);
|
|
21
|
-
}
|
|
22
|
-
url(input, output) {
|
|
23
|
-
Maker.generate('url', [input, output]);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// JavaScript
|
|
27
|
-
js() {
|
|
28
|
-
BalmJS.logger.warn('balm api', '`mix.js` is deprecated, please use `mix.webpack`/`mix.rollup`/`mix.esbuild` instead.');
|
|
29
|
-
}
|
|
30
|
-
webpack(input, output, options, fn) {
|
|
31
|
-
Maker.generate('webpack', [input, output, options, fn]);
|
|
32
|
-
}
|
|
33
|
-
esbuild(input, output, options) {
|
|
34
|
-
Maker.generate('esbuild', [input, output, options]);
|
|
35
|
-
}
|
|
36
|
-
rollup(input, output) {
|
|
37
|
-
Maker.generate('rollup', [input, output]);
|
|
38
|
-
}
|
|
39
|
-
jsmin(input, output, options) {
|
|
40
|
-
Maker.generate('jsmin', [input, output, options]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Files & Directories
|
|
44
|
-
copy(input, output, options) {
|
|
45
|
-
Maker.generate('copy', [input, output, options]);
|
|
46
|
-
}
|
|
47
|
-
remove(paths) {
|
|
48
|
-
Maker.generate('remove', [paths]);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Cache
|
|
52
|
-
version(input, output, assetsOptions) {
|
|
53
|
-
Maker.generate('version', [input, output, assetsOptions]);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Server
|
|
57
|
-
serve(handler) {
|
|
58
|
-
Maker.generate('serve', [handler]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
class BalmHooks extends BaseHooks {
|
|
62
|
-
// Stylesheets
|
|
63
|
-
sprite(input, output, spriteOptions) {
|
|
64
|
-
Maker.generate('sprite', [input, output, spriteOptions]);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Assets
|
|
68
|
-
replace(input, output, options) {
|
|
69
|
-
Maker.generate('replace', [input, output, options]);
|
|
70
|
-
}
|
|
71
|
-
publish(input, output, renameOptions) {
|
|
72
|
-
Maker.generate('publish', [input, output, renameOptions]);
|
|
73
|
-
}
|
|
74
|
-
zip(input = '', output = '', filename = 'archive.zip') {
|
|
75
|
-
Maker.generate('zip', [input, output, filename]);
|
|
76
|
-
}
|
|
77
|
-
ftp(localFiles, options) {
|
|
78
|
-
Maker.generate('ftp', [localFiles, options]);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// PWA
|
|
82
|
-
generateSW(pwaOptions) {
|
|
83
|
-
Maker.generate('pwa', ['generateSW', pwaOptions]);
|
|
84
|
-
}
|
|
85
|
-
injectManifest(pwaOptions) {
|
|
86
|
-
Maker.generate('pwa', ['injectManifest', pwaOptions]);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Others
|
|
90
|
-
modernizr() {
|
|
91
|
-
Maker.generate('modernizr');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export default BalmHooks;
|
package/lib/hooks/maker.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const BLOCKLIST_IN_PROD = ['serve'];
|
|
2
|
-
let compiling = false;
|
|
3
|
-
function ban(name) {
|
|
4
|
-
const BLOCKLIST_IN_DEV = ['publish', ...(BalmJS.config.useDefaults ? BLOCKLIST_IN_PROD : [])];
|
|
5
|
-
const banInProd = BalmJS.config.env.isProd && BLOCKLIST_IN_PROD.includes(name);
|
|
6
|
-
const banInDev = BalmJS.config.env.isDev && BLOCKLIST_IN_DEV.includes(name);
|
|
7
|
-
const isBan = banInProd || banInDev;
|
|
8
|
-
const api = name === 'postcss' ? 'css' : name;
|
|
9
|
-
if (isBan) {
|
|
10
|
-
const message = BalmJS.config.useDefaults && BalmJS.config.env.isDev && BLOCKLIST_IN_PROD.includes(name) ? `'mix.${api}()' can only be used for 'balm.config.useDefaults = false;'` : `There is no 'mix.${api}()' hook in ${banInProd ? 'production' : 'development'} mode`;
|
|
11
|
-
BalmJS.logger.warn('balm hook', message);
|
|
12
|
-
}
|
|
13
|
-
return isBan;
|
|
14
|
-
}
|
|
15
|
-
class Maker {
|
|
16
|
-
// Register custom task
|
|
17
|
-
static generate(name, args = []) {
|
|
18
|
-
if (ban(name)) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const customTask = BalmJS.tasks.get(name);
|
|
22
|
-
const taskName = ['sprite', ...BLOCKLIST_IN_PROD].includes(customTask.name) ? customTask.name : `${customTask.name}:${BalmJS.recipeIndex}`;
|
|
23
|
-
let balmTask = callback => {
|
|
24
|
-
callback();
|
|
25
|
-
}; // NOTE: `balmTask` function name for `gulp.parallel`
|
|
26
|
-
|
|
27
|
-
switch (customTask.name) {
|
|
28
|
-
// private
|
|
29
|
-
case 'sprite':
|
|
30
|
-
customTask.recipe(...args);
|
|
31
|
-
if (customTask.deps.length) {
|
|
32
|
-
balmTask = gulp.series(...BalmJS.toNamespace(customTask.deps));
|
|
33
|
-
} else {
|
|
34
|
-
BalmJS.logger.warn('balm hook', '`mix.sprite()` is missing `input` parameters');
|
|
35
|
-
}
|
|
36
|
-
break;
|
|
37
|
-
case 'modernizr':
|
|
38
|
-
balmTask = customTask.fn;
|
|
39
|
-
break;
|
|
40
|
-
// public
|
|
41
|
-
default:
|
|
42
|
-
balmTask = customTask.recipe(...args);
|
|
43
|
-
}
|
|
44
|
-
if (BalmJS.watching) {
|
|
45
|
-
if (!compiling) {
|
|
46
|
-
compiling = true;
|
|
47
|
-
gulp.series(balmTask, done => {
|
|
48
|
-
compiling = false;
|
|
49
|
-
done();
|
|
50
|
-
})();
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
gulp.task(BalmJS.toNamespace(taskName), balmTask);
|
|
54
|
-
BalmJS.recipes.push(taskName);
|
|
55
|
-
BalmJS.recipeIndex++;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export default Maker;
|
package/lib/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import history from 'connect-history-api-fallback';
|
|
2
|
-
function historyMiddleware() {
|
|
3
|
-
const historyOptions = BalmJS.config.server.historyOptions;
|
|
4
|
-
return historyOptions ? [BalmJS.utils.isObject(historyOptions) ? history(historyOptions) : history()] : [];
|
|
5
|
-
}
|
|
6
|
-
export default historyMiddleware;
|
package/lib/middlewares/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import webpackMiddleware from './webpack.js';
|
|
2
|
-
import httpProxyMiddleware from './proxy.js';
|
|
3
|
-
import historyMiddleware from './history.js';
|
|
4
|
-
function getMiddlewares() {
|
|
5
|
-
const canOverride = BalmJS.config.server.middlewares.every(middleware => BalmJS.utils.isFunction(middleware) || BalmJS.utils.isObject(middleware));
|
|
6
|
-
if (!canOverride) {
|
|
7
|
-
BalmJS.logger.error('server middleware', 'Server middleware must be a function (`function (req, res, next) {}`) or object (`{ route: "/api", handle: function (req, res, next) {} }`)');
|
|
8
|
-
}
|
|
9
|
-
return [...(BalmJS.config.scripts.bundler === BalmJS.Bundler.webpack ? webpackMiddleware() : []), ...httpProxyMiddleware(), ...historyMiddleware(), ...(canOverride ? BalmJS.config.server.middlewares : [])];
|
|
10
|
-
}
|
|
11
|
-
export default getMiddlewares;
|
package/lib/middlewares/proxy.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
2
|
-
function httpProxyMiddleware() {
|
|
3
|
-
const middleware = [];
|
|
4
|
-
const proxyOptions = BalmJS.config.server.proxyOptions;
|
|
5
|
-
if (proxyOptions) {
|
|
6
|
-
try {
|
|
7
|
-
if (BalmJS.utils.isObject(proxyOptions)) {
|
|
8
|
-
// Single proxy
|
|
9
|
-
const options = proxyOptions;
|
|
10
|
-
middleware.push(createProxyMiddleware(options));
|
|
11
|
-
} else if (BalmJS.utils.isArray(proxyOptions)) {
|
|
12
|
-
// Multiple proxies
|
|
13
|
-
for (const options of proxyOptions) {
|
|
14
|
-
middleware.push(createProxyMiddleware(options));
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
BalmJS.logger.error('proxy middleware', `Proxy options (https://github.com/chimurai/http-proxy-middleware#options) must be an object or array`);
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
const {
|
|
21
|
-
message
|
|
22
|
-
} = error;
|
|
23
|
-
BalmJS.logger.error('proxy middleware', message);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return middleware;
|
|
27
|
-
}
|
|
28
|
-
export default httpProxyMiddleware;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import webpackDevMiddleware from 'webpack-dev-middleware';
|
|
2
|
-
import webpackHotMiddleware from 'webpack-hot-middleware';
|
|
3
|
-
import { HMR_PATH } from '../config/constants.js';
|
|
4
|
-
function webpackMiddleware() {
|
|
5
|
-
const middleware = [];
|
|
6
|
-
if (BalmJS.webpackCompiler) {
|
|
7
|
-
middleware.push(webpackDevMiddleware(BalmJS.webpackCompiler, Object.assign({}, BalmJS.config.server.devOptions, {
|
|
8
|
-
headers: [{
|
|
9
|
-
key: 'balm-core',
|
|
10
|
-
value: BalmJS.version
|
|
11
|
-
}],
|
|
12
|
-
publicPath: BalmJS.file.publicUrlOrPath,
|
|
13
|
-
stats: false
|
|
14
|
-
})));
|
|
15
|
-
if (BalmJS.config.server.useHMR) {
|
|
16
|
-
middleware.push(webpackHotMiddleware(BalmJS.webpackCompiler, {
|
|
17
|
-
log: false,
|
|
18
|
-
path: HMR_PATH
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
BalmJS.logger.warn('webpack middleware', 'Webpack compiler is not ready');
|
|
23
|
-
}
|
|
24
|
-
return middleware;
|
|
25
|
-
}
|
|
26
|
-
export default webpackMiddleware;
|