balm-core 5.2.0 → 6.0.0-alpha.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/dist/index.cjs +2191 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +559 -0
- package/dist/index.js +2098 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -123
- package/src/balm.ts +103 -0
- package/src/bundler/esbuild.ts +47 -0
- package/src/bundler/index.ts +3 -0
- package/src/bundler/rollup.ts +39 -0
- package/src/bundler/webpack.ts +82 -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 +192 -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 +132 -0
- package/src/pipeline/transforms/cache.ts +96 -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 +58 -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 +78 -0
- package/src/tasks/index.ts +13 -0
- package/src/tasks/publish.ts +71 -0
- package/src/tasks/pwa.ts +49 -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 +89 -0
- package/src/tasks/style.ts +57 -0
- package/src/tasks/zip.ts +65 -0
- package/src/types/index.ts +200 -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
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import TerserPlugin from 'terser-webpack-plugin';
|
|
2
|
-
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
3
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
4
|
-
import webpackBundleAnalyzer from 'webpack-bundle-analyzer';
|
|
5
|
-
import { merge } from 'webpack-merge';
|
|
6
|
-
import getCommonConfig from './common.js';
|
|
7
|
-
import { CHUNK } from '../../../config/constants.js';
|
|
8
|
-
// Run the build command with an extra argument to
|
|
9
|
-
// View the bundle analyzer report after build finishes:
|
|
10
|
-
// `npm run prod --report`
|
|
11
|
-
// Set to `true` or `false` to always turn it on or off
|
|
12
|
-
const bundleAnalyzerReport = process.env.npm_config_report || false;
|
|
13
|
-
const getCssFilename = () => `${BalmJS.config.paths.target.css}/${CHUNK.dir}/[name].${CHUNK.hash}.css`;
|
|
14
|
-
function getProdConfig(webpack, scripts) {
|
|
15
|
-
const shouldUseSourceMap = scripts.sourceMap;
|
|
16
|
-
const terserOptions = scripts.minifyOptions;
|
|
17
|
-
if (scripts.ie8) {
|
|
18
|
-
terserOptions.ie8 = true;
|
|
19
|
-
}
|
|
20
|
-
return merge(getCommonConfig(webpack, scripts), {
|
|
21
|
-
mode: 'production',
|
|
22
|
-
optimization: {
|
|
23
|
-
minimizer: [new TerserPlugin({
|
|
24
|
-
terserOptions,
|
|
25
|
-
extractComments: false
|
|
26
|
-
}), new CssMinimizerPlugin()]
|
|
27
|
-
},
|
|
28
|
-
plugins: [
|
|
29
|
-
// Extract css into its own file
|
|
30
|
-
...(scripts.extractCss ? [new MiniCssExtractPlugin({
|
|
31
|
-
filename: BalmJS.file.assetsPath(getCssFilename()),
|
|
32
|
-
chunkFilename: BalmJS.file.assetsPath(getCssFilename())
|
|
33
|
-
})] : []),
|
|
34
|
-
// View the bundle analyzer report
|
|
35
|
-
...(bundleAnalyzerReport ? [new webpackBundleAnalyzer.BundleAnalyzerPlugin()] : [])],
|
|
36
|
-
devtool: shouldUseSourceMap ? 'source-map' : false
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
export default getProdConfig;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const htmlRegex = /\.html$/;
|
|
2
|
-
const cssRegex = /\.css$/;
|
|
3
|
-
const cssModuleRegex = /\.module\.css$/;
|
|
4
|
-
const sassRegex = /\.(scss|sass)$/;
|
|
5
|
-
const sassModuleRegex = /\.module\.(scss|sass)$/;
|
|
6
|
-
const jsRegex = /\.(js|mjs|jsx|ts|tsx)$/;
|
|
7
|
-
const imgRegex = /\.(bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/;
|
|
8
|
-
const fontRegex = /\.(woff2?|eot|ttf|otf)(\?.*)?$/;
|
|
9
|
-
const mediaRegex = /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/;
|
|
10
|
-
export { htmlRegex, cssRegex, cssModuleRegex, sassRegex, sassModuleRegex, jsRegex, imgRegex, fontRegex, mediaRegex };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { HMR_PATH } from '../../config/constants.js';
|
|
2
|
-
const FILENAME_REGEX = new RegExp('[^/]+$', 'i');
|
|
3
|
-
const HOT_CLIENT = 'webpack-hot-middleware/client';
|
|
4
|
-
function initVendors(entries) {
|
|
5
|
-
const jsVendors = [];
|
|
6
|
-
const jsEntries = [];
|
|
7
|
-
for (const [key, value] of Object.entries(entries)) {
|
|
8
|
-
if (BalmJS.utils.isArray(value)) {
|
|
9
|
-
jsVendors.push({
|
|
10
|
-
key,
|
|
11
|
-
value: value
|
|
12
|
-
});
|
|
13
|
-
} else {
|
|
14
|
-
jsEntries.push({
|
|
15
|
-
key,
|
|
16
|
-
value: value
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
BalmJS.vendors = jsVendors;
|
|
21
|
-
BalmJS.entries = jsEntries;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Relative path
|
|
25
|
-
function getEntry(input, scripts) {
|
|
26
|
-
let webpackEntries = {};
|
|
27
|
-
const hotOptions = Object.assign({}, BalmJS.config.server.hotOptions, {
|
|
28
|
-
path: HMR_PATH
|
|
29
|
-
});
|
|
30
|
-
const HMR = `${HOT_CLIENT}?` + Object.entries(hotOptions).map(option => option.join('=')).join('&');
|
|
31
|
-
const useHMR = BalmJS.config.server.useHMR;
|
|
32
|
-
if (BalmJS.utils.isObject(input)) {
|
|
33
|
-
initVendors(input);
|
|
34
|
-
for (const [key, value] of Object.entries(input)) {
|
|
35
|
-
const isVendor = BalmJS.utils.isArray(value);
|
|
36
|
-
|
|
37
|
-
// Key
|
|
38
|
-
const entryKey = isVendor ? node.path.join(scripts.vendorName, key) : node.path.join(key);
|
|
39
|
-
|
|
40
|
-
// Value
|
|
41
|
-
const hotValue = BalmJS.utils.isString(value) ? [value, HMR] : [...value, HMR];
|
|
42
|
-
const entryValue = useHMR ? hotValue : value;
|
|
43
|
-
|
|
44
|
-
// Result
|
|
45
|
-
if (!isVendor) {
|
|
46
|
-
webpackEntries[entryKey] = entryValue;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
} else if (BalmJS.utils.isArray(input) && input.length) {
|
|
50
|
-
for (const value of input) {
|
|
51
|
-
const matchResult = FILENAME_REGEX.exec(value)[0];
|
|
52
|
-
const key = matchResult.split('.')[0];
|
|
53
|
-
webpackEntries[key] = useHMR ? [value, HMR] : value;
|
|
54
|
-
}
|
|
55
|
-
} else if (BalmJS.utils.isString(input) && input.trim().length) {
|
|
56
|
-
webpackEntries = useHMR ? [input, HMR] : input;
|
|
57
|
-
} else {
|
|
58
|
-
BalmJS.logger.warn('webpack entry', '`scripts.entry` must be `string | array | object`');
|
|
59
|
-
}
|
|
60
|
-
BalmJS.logger.debug('webpack entry', webpackEntries, {
|
|
61
|
-
pre: true
|
|
62
|
-
});
|
|
63
|
-
return webpackEntries;
|
|
64
|
-
}
|
|
65
|
-
export default getEntry;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { merge } from 'webpack-merge';
|
|
2
|
-
import getEntry from './entry.js';
|
|
3
|
-
import getOutput from './output.js';
|
|
4
|
-
import getDefaultConfig from './config/index.js';
|
|
5
|
-
const webpackModule = process.env.WEBPACK || requireModule.resolve('webpack');
|
|
6
|
-
const webpack = requireModule(webpackModule);
|
|
7
|
-
function webpackConfig(input, output, customWebpackOptions = {}, isHook = false) {
|
|
8
|
-
const scripts = BalmJS.config.scripts;
|
|
9
|
-
const defaultEntry = `./${BalmJS.file.defaultEntry}`;
|
|
10
|
-
const baseConfig = {
|
|
11
|
-
entry: input ? getEntry(input, scripts) : defaultEntry,
|
|
12
|
-
output: getOutput(output, scripts, isHook)
|
|
13
|
-
};
|
|
14
|
-
BalmJS.logger.debug('webpack bundler', {
|
|
15
|
-
input: baseConfig.entry,
|
|
16
|
-
output: baseConfig.output.path
|
|
17
|
-
}, {
|
|
18
|
-
pre: true
|
|
19
|
-
});
|
|
20
|
-
if (scripts.externals) {
|
|
21
|
-
baseConfig.externals = scripts.externals;
|
|
22
|
-
}
|
|
23
|
-
const defaultConfig = getDefaultConfig(webpack, scripts);
|
|
24
|
-
const configuration = merge(baseConfig, defaultConfig, scripts.webpackOptions, customWebpackOptions);
|
|
25
|
-
BalmJS.logger.success('webpack configuration', configuration, {
|
|
26
|
-
pre: true
|
|
27
|
-
});
|
|
28
|
-
return configuration;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// export default webpackConfig;
|
|
32
|
-
export { webpack, webpackConfig };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { mergeWithRules, CustomizeRule } from 'webpack-merge';
|
|
2
|
-
import LOADERS from './rules/index.js';
|
|
3
|
-
function getLoaders(customLoaders) {
|
|
4
|
-
const enableDefaultLoaders = Object.assign({
|
|
5
|
-
js: true,
|
|
6
|
-
css: true,
|
|
7
|
-
html: true,
|
|
8
|
-
asset: true
|
|
9
|
-
}, BalmJS.config.scripts.defaultLoaders);
|
|
10
|
-
const useDefaultLoaders = Object.values(enableDefaultLoaders).some(value => value);
|
|
11
|
-
let defaultLoaders = [];
|
|
12
|
-
if (useDefaultLoaders) {
|
|
13
|
-
Object.values(LOADERS).forEach(Loader => {
|
|
14
|
-
const key = Loader.name.replace('Loader', '');
|
|
15
|
-
if (enableDefaultLoaders[key]) {
|
|
16
|
-
const loader = Loader();
|
|
17
|
-
if (BalmJS.utils.isArray(loader)) {
|
|
18
|
-
defaultLoaders = defaultLoaders.concat(loader);
|
|
19
|
-
} else {
|
|
20
|
-
defaultLoaders.push(loader);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const result = mergeWithRules({
|
|
26
|
-
module: {
|
|
27
|
-
rules: {
|
|
28
|
-
test: CustomizeRule.Match,
|
|
29
|
-
use: {
|
|
30
|
-
loader: CustomizeRule.Match,
|
|
31
|
-
options: CustomizeRule.Replace
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
})({
|
|
36
|
-
module: {
|
|
37
|
-
rules: defaultLoaders
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
module: {
|
|
41
|
-
rules: customLoaders
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const defaultModule = result.module;
|
|
45
|
-
BalmJS.logger.debug('webpack loaders', defaultModule.rules, {
|
|
46
|
-
pre: true
|
|
47
|
-
});
|
|
48
|
-
return defaultModule.rules;
|
|
49
|
-
}
|
|
50
|
-
export default getLoaders;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CHUNK, ASSET } from '../../config/constants.js';
|
|
2
|
-
function getJsFilename(scripts, isChunk = false) {
|
|
3
|
-
let filename;
|
|
4
|
-
if (isChunk) {
|
|
5
|
-
filename = BalmJS.config.env.isProd ? `[name].${CHUNK.hash}` : '[name]';
|
|
6
|
-
} else {
|
|
7
|
-
filename = scripts.useCache ? `[name].${CHUNK.hash}` : '[name]';
|
|
8
|
-
}
|
|
9
|
-
return `${filename}.js`;
|
|
10
|
-
}
|
|
11
|
-
function getOutput(output, scripts, isHook = false) {
|
|
12
|
-
const outputDirectory = output || BalmJS.config.dest.base;
|
|
13
|
-
const jsFolder = BalmJS.config.paths.target.js;
|
|
14
|
-
const bundleFilename = getJsFilename(scripts);
|
|
15
|
-
const chunkFilename = getJsFilename(scripts, true);
|
|
16
|
-
const customLibraryConfig = scripts.library ? {
|
|
17
|
-
library: scripts.library
|
|
18
|
-
} : {};
|
|
19
|
-
const miniprogramConfig = BalmJS.config.env.isMP ? {
|
|
20
|
-
path: BalmJS.file.absPath(node.path.join(BalmJS.config.dest.base, ASSET.mpDir)),
|
|
21
|
-
library: {
|
|
22
|
-
name: 'createApp',
|
|
23
|
-
type: 'window',
|
|
24
|
-
export: 'default'
|
|
25
|
-
}
|
|
26
|
-
} : {};
|
|
27
|
-
return Object.assign({
|
|
28
|
-
// The build folder.
|
|
29
|
-
path: BalmJS.file.absPath(outputDirectory),
|
|
30
|
-
// There will be one main bundle, and one file per asynchronous chunk.
|
|
31
|
-
// In development, it does not produce real files.
|
|
32
|
-
filename: isHook ? bundleFilename : BalmJS.file.assetsPath(`${jsFolder}/${bundleFilename}`),
|
|
33
|
-
// There are also additional JS chunk files if you use code splitting.
|
|
34
|
-
chunkFilename: isHook ? chunkFilename : BalmJS.file.assetsPath(`${jsFolder}/${CHUNK.dir}/${chunkFilename}`),
|
|
35
|
-
// webpack uses `publicPath` to determine where the app is being served from.
|
|
36
|
-
// It requires a trailing slash, or the file assets will get an incorrect path.
|
|
37
|
-
// We inferred the "public path" (such as / or /my-project) from homepage.
|
|
38
|
-
publicPath: BalmJS.file.publicUrlOrPath
|
|
39
|
-
}, customLibraryConfig, miniprogramConfig);
|
|
40
|
-
}
|
|
41
|
-
export default getOutput;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { imgRegex, fontRegex, mediaRegex } from '../config/regex.js';
|
|
2
|
-
import { ASSET } from '../../../config/constants.js';
|
|
3
|
-
function assetLoader() {
|
|
4
|
-
return [
|
|
5
|
-
// "url" loader works like "file" loader except that it embeds assets
|
|
6
|
-
// smaller than specified limit in bytes as data URLs to avoid requests.
|
|
7
|
-
// A missing `test` is equivalent to a match.
|
|
8
|
-
{
|
|
9
|
-
test: imgRegex,
|
|
10
|
-
type: BalmJS.config.scripts.imageAssetType,
|
|
11
|
-
parser: {
|
|
12
|
-
dataUrlCondition: {
|
|
13
|
-
maxSize: BalmJS.config.scripts.imageInlineSizeLimit
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
generator: {
|
|
17
|
-
filename: BalmJS.file.assetsPath(`${ASSET.dir}/${BalmJS.config.paths.target.img}/[name].${ASSET.hash}[ext]`)
|
|
18
|
-
}
|
|
19
|
-
}, {
|
|
20
|
-
test: fontRegex,
|
|
21
|
-
type: 'asset/resource',
|
|
22
|
-
generator: {
|
|
23
|
-
filename: BalmJS.file.assetsPath(`${ASSET.dir}/${BalmJS.config.paths.target.font}/[name].${ASSET.hash}[ext]`)
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
test: mediaRegex,
|
|
27
|
-
type: 'asset/resource',
|
|
28
|
-
generator: {
|
|
29
|
-
filename: BalmJS.file.assetsPath(`${ASSET.dir}/${BalmJS.config.paths.target.media}/[name].${ASSET.hash}[ext]`)
|
|
30
|
-
}
|
|
31
|
-
}];
|
|
32
|
-
}
|
|
33
|
-
export default assetLoader;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsRegex } from '../config/regex.js';
|
|
2
|
-
function jsLoader() {
|
|
3
|
-
const options = Object.assign({
|
|
4
|
-
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
|
5
|
-
// It enables caching results in ./node_modules/.cache/babel-loader/
|
|
6
|
-
// directory for faster rebuilds.
|
|
7
|
-
cacheDirectory: true
|
|
8
|
-
}, BalmJS.config.scripts.babelLoaderOptions);
|
|
9
|
-
|
|
10
|
-
// Process application JS with Babel.
|
|
11
|
-
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
|
|
12
|
-
return {
|
|
13
|
-
test: jsRegex,
|
|
14
|
-
include: [BalmJS.file.absPaths(BalmJS.config.src.js), ...BalmJS.config.scripts.includeJsResource],
|
|
15
|
-
loader: requireModule.resolve('babel-loader'),
|
|
16
|
-
options
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export default jsLoader;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
3
|
-
import { cssRegex, cssModuleRegex, sassRegex, sassModuleRegex } from '../config/regex.js';
|
|
4
|
-
// Check if Tailwind config exists
|
|
5
|
-
const useTailwind = fs.existsSync(node.path.join(BalmJS.config.workspace, 'tailwind.config.js'));
|
|
6
|
-
|
|
7
|
-
// common function to get style loaders
|
|
8
|
-
function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions = {}) {
|
|
9
|
-
const {
|
|
10
|
-
sourceMap
|
|
11
|
-
} = cssOptions;
|
|
12
|
-
const loaders = [BalmJS.config.env.isProd && BalmJS.config.scripts.extractCss ? {
|
|
13
|
-
loader: MiniCssExtractPlugin.loader,
|
|
14
|
-
options: {
|
|
15
|
-
esModule: BalmJS.config.scripts.useEsModule
|
|
16
|
-
}
|
|
17
|
-
} : styleLoader, {
|
|
18
|
-
loader: requireModule.resolve('css-loader'),
|
|
19
|
-
options: cssOptions
|
|
20
|
-
}, {
|
|
21
|
-
loader: requireModule.resolve('postcss-loader'),
|
|
22
|
-
options: Object.assign({
|
|
23
|
-
postcssOptions: {
|
|
24
|
-
plugins: BalmJS.plugins.postcssPlugins(true, useTailwind)
|
|
25
|
-
},
|
|
26
|
-
sourceMap
|
|
27
|
-
}, BalmJS.config.scripts.postcssLoaderOptions)
|
|
28
|
-
}].filter(Boolean);
|
|
29
|
-
if (preProcessor) {
|
|
30
|
-
loaders.push({
|
|
31
|
-
loader: requireModule.resolve(preProcessor),
|
|
32
|
-
options: Object.assign({
|
|
33
|
-
sourceMap: true
|
|
34
|
-
}, sassOptions)
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return loaders;
|
|
38
|
-
}
|
|
39
|
-
function cssLoader() {
|
|
40
|
-
let styleLoader = {
|
|
41
|
-
loader: requireModule.resolve('style-loader'),
|
|
42
|
-
options: {
|
|
43
|
-
esModule: BalmJS.config.scripts.useEsModule
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
if (BalmJS.config.env.inSSR) {
|
|
47
|
-
const loadersCount = BalmJS.config.scripts.loaders.length;
|
|
48
|
-
for (let i = 0; i < loadersCount; i++) {
|
|
49
|
-
if (BalmJS.config.scripts.loaders[i].loader === 'vue-loader') {
|
|
50
|
-
styleLoader = 'vue-style-loader';
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const sourceMap = BalmJS.config.env.isProd ? BalmJS.config.scripts.sourceMap : BalmJS.config.env.isDev;
|
|
56
|
-
|
|
57
|
-
// "postcss" loader applies autoprefixer to our CSS.
|
|
58
|
-
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
59
|
-
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
60
|
-
// In production, we use MiniCSSExtractPlugin to extract that CSS
|
|
61
|
-
// to a file, but in development "style" loader enables hot editing
|
|
62
|
-
// of CSS.
|
|
63
|
-
// By default we support CSS Modules with the extension .module.css
|
|
64
|
-
return [{
|
|
65
|
-
test: cssRegex,
|
|
66
|
-
exclude: cssModuleRegex,
|
|
67
|
-
use: getStyleLoaders(styleLoader, {
|
|
68
|
-
importLoaders: 1,
|
|
69
|
-
sourceMap,
|
|
70
|
-
modules: {
|
|
71
|
-
mode: 'icss'
|
|
72
|
-
},
|
|
73
|
-
esModule: BalmJS.config.scripts.useEsModule
|
|
74
|
-
}),
|
|
75
|
-
// Don't consider CSS imports dead code even if the
|
|
76
|
-
// containing package claims to have no side effects.
|
|
77
|
-
// Remove this when webpack adds a warning or an error for this.
|
|
78
|
-
// See https://github.com/webpack/webpack/issues/6571
|
|
79
|
-
sideEffects: true
|
|
80
|
-
},
|
|
81
|
-
// Opt-in support for SASS (using .scss or .sass extensions).
|
|
82
|
-
// By default we support SASS Modules with the
|
|
83
|
-
// extensions .module.scss or .module.sass
|
|
84
|
-
{
|
|
85
|
-
test: sassRegex,
|
|
86
|
-
exclude: sassModuleRegex,
|
|
87
|
-
use: getStyleLoaders(styleLoader, {
|
|
88
|
-
importLoaders: 3,
|
|
89
|
-
sourceMap,
|
|
90
|
-
modules: {
|
|
91
|
-
mode: 'icss'
|
|
92
|
-
}
|
|
93
|
-
}, 'sass-loader', {
|
|
94
|
-
// Prefer `dart-sass`
|
|
95
|
-
implementation: requireModule.resolve('sass'),
|
|
96
|
-
sassOptions: Object.assign({
|
|
97
|
-
loadPaths: BalmJS.file.stylePaths,
|
|
98
|
-
sourceMap: true,
|
|
99
|
-
quietDeps: BalmJS.config.logs.level < BalmJS.LogLevel.Warn
|
|
100
|
-
}, BalmJS.config.styles.sassOptions)
|
|
101
|
-
}),
|
|
102
|
-
// Don't consider CSS imports dead code even if the
|
|
103
|
-
// containing package claims to have no side effects.
|
|
104
|
-
// Remove this when webpack adds a warning or an error for this.
|
|
105
|
-
// See https://github.com/webpack/webpack/issues/6571
|
|
106
|
-
sideEffects: true
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
export default cssLoader;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { htmlRegex } from '../config/regex.js';
|
|
2
|
-
function htmlLoader() {
|
|
3
|
-
const options = Object.assign({
|
|
4
|
-
minimize: {
|
|
5
|
-
removeAttributeQuotes: false
|
|
6
|
-
},
|
|
7
|
-
esModule: BalmJS.config.scripts.useEsModule
|
|
8
|
-
}, BalmJS.config.scripts.htmlLoaderOptions);
|
|
9
|
-
return {
|
|
10
|
-
test: `${htmlRegex}i`,
|
|
11
|
-
loader: requireModule.resolve('html-loader'),
|
|
12
|
-
options
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export default htmlLoader;
|
package/lib/config/assets.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const root = 'assets'; // Remote project root simulation
|
|
2
|
-
const mainDir = 'public'; // The `public` directory contains the front controller and your assets (images, JavaScript, CSS, etc.)
|
|
3
|
-
const subDir = ''; // Public subdirectory
|
|
4
|
-
const buildDir = 'build'; // The suffix of the `subDir`: for dynamic language project
|
|
5
|
-
const virtualDir = ''; // The prefix of the `subDir`: for non-standard dynamic language project
|
|
6
|
-
|
|
7
|
-
const cache = false;
|
|
8
|
-
/**
|
|
9
|
-
* Static asset revisioning
|
|
10
|
-
*
|
|
11
|
-
* @reference https://github.com/smysnk/gulp-rev-all#options
|
|
12
|
-
*/
|
|
13
|
-
const options = {
|
|
14
|
-
fileNameManifest: 'rev-manifest.json',
|
|
15
|
-
dontRenameFile: ['.html'],
|
|
16
|
-
dontUpdateReference: ['.html']
|
|
17
|
-
};
|
|
18
|
-
const includes = [];
|
|
19
|
-
const excludes = [];
|
|
20
|
-
export default {
|
|
21
|
-
root,
|
|
22
|
-
mainDir,
|
|
23
|
-
subDir,
|
|
24
|
-
buildDir,
|
|
25
|
-
virtualDir,
|
|
26
|
-
cache,
|
|
27
|
-
options,
|
|
28
|
-
includes,
|
|
29
|
-
excludes
|
|
30
|
-
};
|
package/lib/config/constants.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const DOMAIN = 'https://balm.js.org';
|
|
2
|
-
const HMR_PATH = '/__balm_hmr';
|
|
3
|
-
const PUBLIC_URL = '%PUBLIC_URL%';
|
|
4
|
-
const ASSETS_TYPES = ['css', 'js', 'img', 'font', 'media'];
|
|
5
|
-
const CHUNK = {
|
|
6
|
-
dir: 'chunk',
|
|
7
|
-
hash: '[contenthash:8]'
|
|
8
|
-
};
|
|
9
|
-
const ASSET = {
|
|
10
|
-
dir: 'asset',
|
|
11
|
-
hash: '[hash:8]',
|
|
12
|
-
mpDir: 'common'
|
|
13
|
-
};
|
|
14
|
-
export { DOMAIN, HMR_PATH, PUBLIC_URL, ASSETS_TYPES, CHUNK, ASSET };
|
package/lib/config/env.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const NODE_ENV = process.env.NODE_ENV;
|
|
2
|
-
const argv = process.argv;
|
|
3
|
-
const ENV = {
|
|
4
|
-
// standard
|
|
5
|
-
PROD: 'production',
|
|
6
|
-
TEST: 'test',
|
|
7
|
-
DEV: 'development',
|
|
8
|
-
// plus
|
|
9
|
-
SSR: 'server',
|
|
10
|
-
MP: 'miniprogram',
|
|
11
|
-
DESKTOP_APP: 'desktop-app'
|
|
12
|
-
};
|
|
13
|
-
const isProd = NODE_ENV === ENV.PROD || argv.includes(`--${ENV.PROD}`) || argv.includes('-p');
|
|
14
|
-
const isTest = NODE_ENV === ENV.TEST || argv.includes(`--${ENV.TEST}`) || argv.includes('-t');
|
|
15
|
-
const isDev = !isProd && !isTest;
|
|
16
|
-
if (!NODE_ENV) {
|
|
17
|
-
if (isProd) {
|
|
18
|
-
process.env.NODE_ENV = ENV.PROD;
|
|
19
|
-
} else if (isTest) {
|
|
20
|
-
process.env.NODE_ENV = ENV.TEST;
|
|
21
|
-
} else {
|
|
22
|
-
process.env.NODE_ENV = ENV.DEV;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const inSSR = NODE_ENV === ENV.SSR || argv.includes(`--${ENV.SSR}`) || argv.includes('-ssr');
|
|
26
|
-
const isMP = NODE_ENV === ENV.MP || argv.includes(`--${ENV.MP}`) || argv.includes('-mp');
|
|
27
|
-
const inDesktopApp = NODE_ENV === ENV.DESKTOP_APP || argv.includes(`--${ENV.DESKTOP_APP}`) || argv.includes('-electron');
|
|
28
|
-
export default {
|
|
29
|
-
isProd,
|
|
30
|
-
isTest,
|
|
31
|
-
isDev,
|
|
32
|
-
inSSR,
|
|
33
|
-
isMP,
|
|
34
|
-
inDesktopApp
|
|
35
|
-
};
|
package/lib/config/extras.js
DELETED
package/lib/config/ftp.js
DELETED
package/lib/config/globals.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import colors from 'ansi-colors';
|
|
4
|
-
import { create } from 'browser-sync';
|
|
5
|
-
import through2 from 'through2';
|
|
6
|
-
import PluginError from 'plugin-error';
|
|
7
|
-
import semver from 'semver';
|
|
8
|
-
|
|
9
|
-
// Set env var for ORIGINAL cwd before anything touches it
|
|
10
|
-
process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
|
|
11
|
-
const gulpModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'gulp', 'index.js');
|
|
12
|
-
const localSassModule = path.join(process.env.BALM_CWD, 'node_modules', 'sass');
|
|
13
|
-
let isLegacySass = false;
|
|
14
|
-
try {
|
|
15
|
-
const sassPkg = requireModule(path.join(localSassModule, 'package.json'));
|
|
16
|
-
isLegacySass = semver.lt(sassPkg.version, '1.40.0');
|
|
17
|
-
} catch (_) {}
|
|
18
|
-
const nodeLocalSassModule = path.join(localSassModule, 'sass.node.js');
|
|
19
|
-
const defaultLocalSassModule = path.join(localSassModule, 'sass.default.js'); // For `npm i -D sass <= 1.62.1`
|
|
20
|
-
const dartLocalSassModule = path.join(localSassModule, 'sass.dart.js'); // For `npm i -D sass <= 1.39.2`
|
|
21
|
-
const getSassModule = sass => fs.existsSync(nodeLocalSassModule) ? requireModule(nodeLocalSassModule) : fs.existsSync(defaultLocalSassModule) ? requireModule(defaultLocalSassModule) : fs.existsSync(dartLocalSassModule) ? requireModule(dartLocalSassModule) : sass;
|
|
22
|
-
if (fs.existsSync(gulpModule)) {
|
|
23
|
-
// Chdir before requiring balm config to make sure
|
|
24
|
-
// we let them chdir as needed
|
|
25
|
-
if (process.cwd() !== process.env.BALM_CWD) {
|
|
26
|
-
process.chdir(process.env.BALM_CWD);
|
|
27
|
-
}
|
|
28
|
-
global.gulp = requireModule(gulpModule);
|
|
29
|
-
global.$ = requireModule('gulp-load-plugins')();
|
|
30
|
-
} else {
|
|
31
|
-
console.error(colors.bgBlueBright('BalmJS'), colors.yellow('`balm` module not found :('));
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
global.node = {
|
|
35
|
-
path,
|
|
36
|
-
fs,
|
|
37
|
-
isLegacySass,
|
|
38
|
-
getSassModule
|
|
39
|
-
};
|
|
40
|
-
global.server = create();
|
|
41
|
-
global.through2 = through2;
|
|
42
|
-
global.PluginError = PluginError;
|
|
43
|
-
global.NOOP = () => {};
|
package/lib/config/html.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTMLMinifier options
|
|
3
|
-
*
|
|
4
|
-
* @reference https://github.com/kangax/html-minifier#options-quick-reference
|
|
5
|
-
*/
|
|
6
|
-
const options = {
|
|
7
|
-
collapseWhitespace: true,
|
|
8
|
-
minifyCSS: true,
|
|
9
|
-
minifyJS: {
|
|
10
|
-
compress: {
|
|
11
|
-
drop_console: true
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
processConditionalComments: true,
|
|
15
|
-
removeComments: true,
|
|
16
|
-
removeEmptyAttributes: true,
|
|
17
|
-
removeScriptTypeAttributes: true,
|
|
18
|
-
removeStyleLinkTypeAttributes: true
|
|
19
|
-
};
|
|
20
|
-
export default {
|
|
21
|
-
options
|
|
22
|
-
};
|
package/lib/config/images.js
DELETED
package/lib/config/index.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import './globals.js';
|
|
2
|
-
import env from './env.js';
|
|
3
|
-
import roots from './roots.js';
|
|
4
|
-
import paths from './paths.js';
|
|
5
|
-
import html from './html.js';
|
|
6
|
-
import styles from './styles.js';
|
|
7
|
-
import scripts from './scripts.js';
|
|
8
|
-
import images from './images.js';
|
|
9
|
-
import extras from './extras.js';
|
|
10
|
-
import assets from './assets.js';
|
|
11
|
-
import server from './server.js';
|
|
12
|
-
import ftp from './ftp.js';
|
|
13
|
-
import pwa from './pwa.js';
|
|
14
|
-
import logs from './logs.js';
|
|
15
|
-
var LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
16
|
-
LogLevel[LogLevel["Trace"] = 0] = "Trace";
|
|
17
|
-
LogLevel[LogLevel["Debug"] = 1] = "Debug";
|
|
18
|
-
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
19
|
-
LogLevel[LogLevel["Warn"] = 3] = "Warn";
|
|
20
|
-
LogLevel[LogLevel["Error"] = 4] = "Error";
|
|
21
|
-
return LogLevel;
|
|
22
|
-
}(LogLevel || {});
|
|
23
|
-
var Bundler = /*#__PURE__*/function (Bundler) {
|
|
24
|
-
Bundler["webpack"] = "webpack";
|
|
25
|
-
Bundler["rollup"] = "rollup";
|
|
26
|
-
Bundler["esbuild"] = "esbuild";
|
|
27
|
-
return Bundler;
|
|
28
|
-
}(Bundler || {});
|
|
29
|
-
const vendors = [];
|
|
30
|
-
const workspace = process.env.BALM_CWD;
|
|
31
|
-
/**
|
|
32
|
-
* Project type
|
|
33
|
-
*
|
|
34
|
-
* set `true` for a static HTML project
|
|
35
|
-
* set `false` for a dynamic language project (e.g. PHP framework)
|
|
36
|
-
*/
|
|
37
|
-
const inFrontend = true;
|
|
38
|
-
const useDefaults = true; // Use balm default task
|
|
39
|
-
|
|
40
|
-
const config = {
|
|
41
|
-
env,
|
|
42
|
-
workspace,
|
|
43
|
-
inFrontend,
|
|
44
|
-
useDefaults,
|
|
45
|
-
roots,
|
|
46
|
-
paths,
|
|
47
|
-
html,
|
|
48
|
-
styles,
|
|
49
|
-
scripts,
|
|
50
|
-
images,
|
|
51
|
-
extras,
|
|
52
|
-
assets,
|
|
53
|
-
server,
|
|
54
|
-
ftp,
|
|
55
|
-
pwa,
|
|
56
|
-
logs
|
|
57
|
-
};
|
|
58
|
-
BalmJS.config = config;
|
|
59
|
-
BalmJS.LogLevel = LogLevel;
|
|
60
|
-
BalmJS.Bundler = Bundler;
|
|
61
|
-
BalmJS.vendors = vendors;
|
|
62
|
-
BalmJS.entries = [];
|
|
63
|
-
export default config;
|