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
package/tslib/config/env.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const NODE_ENV = process.env.NODE_ENV;
|
|
2
|
-
const argv = process.argv;
|
|
3
|
-
const ENV = {
|
|
4
|
-
PROD: 'production',
|
|
5
|
-
TEST: 'test',
|
|
6
|
-
DEV: 'development',
|
|
7
|
-
SSR: 'server',
|
|
8
|
-
MP: 'miniprogram',
|
|
9
|
-
DESKTOP_APP: 'desktop-app'
|
|
10
|
-
};
|
|
11
|
-
const isProd = NODE_ENV === ENV.PROD ||
|
|
12
|
-
argv.includes(`--${ENV.PROD}`) ||
|
|
13
|
-
argv.includes('-p');
|
|
14
|
-
const isTest = NODE_ENV === ENV.TEST ||
|
|
15
|
-
argv.includes(`--${ENV.TEST}`) ||
|
|
16
|
-
argv.includes('-t');
|
|
17
|
-
const isDev = !isProd && !isTest;
|
|
18
|
-
if (!NODE_ENV) {
|
|
19
|
-
if (isProd) {
|
|
20
|
-
process.env.NODE_ENV = ENV.PROD;
|
|
21
|
-
}
|
|
22
|
-
else if (isTest) {
|
|
23
|
-
process.env.NODE_ENV = ENV.TEST;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
process.env.NODE_ENV = ENV.DEV;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const inSSR = NODE_ENV === ENV.SSR ||
|
|
30
|
-
argv.includes(`--${ENV.SSR}`) ||
|
|
31
|
-
argv.includes('-ssr');
|
|
32
|
-
const isMP = NODE_ENV === ENV.MP || argv.includes(`--${ENV.MP}`) || argv.includes('-mp');
|
|
33
|
-
const inDesktopApp = NODE_ENV === ENV.DESKTOP_APP ||
|
|
34
|
-
argv.includes(`--${ENV.DESKTOP_APP}`) ||
|
|
35
|
-
argv.includes('-electron');
|
|
36
|
-
export default {
|
|
37
|
-
isProd,
|
|
38
|
-
isTest,
|
|
39
|
-
isDev,
|
|
40
|
-
inSSR,
|
|
41
|
-
isMP,
|
|
42
|
-
inDesktopApp
|
|
43
|
-
};
|
package/tslib/config/extras.js
DELETED
package/tslib/config/ftp.js
DELETED
package/tslib/config/globals.js
DELETED
|
@@ -1,47 +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
|
-
process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
|
|
9
|
-
const gulpModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'gulp', 'index.js');
|
|
10
|
-
const localSassModule = path.join(process.env.BALM_CWD, 'node_modules', 'sass');
|
|
11
|
-
let isLegacySass = false;
|
|
12
|
-
try {
|
|
13
|
-
const sassPkg = requireModule(path.join(localSassModule, 'package.json'));
|
|
14
|
-
isLegacySass = semver.lt(sassPkg.version, '1.40.0');
|
|
15
|
-
}
|
|
16
|
-
catch (_) { }
|
|
17
|
-
const nodeLocalSassModule = path.join(localSassModule, 'sass.node.js');
|
|
18
|
-
const defaultLocalSassModule = path.join(localSassModule, 'sass.default.js');
|
|
19
|
-
const dartLocalSassModule = path.join(localSassModule, 'sass.dart.js');
|
|
20
|
-
const getSassModule = (sass) => fs.existsSync(nodeLocalSassModule)
|
|
21
|
-
? requireModule(nodeLocalSassModule)
|
|
22
|
-
: fs.existsSync(defaultLocalSassModule)
|
|
23
|
-
? requireModule(defaultLocalSassModule)
|
|
24
|
-
: fs.existsSync(dartLocalSassModule)
|
|
25
|
-
? requireModule(dartLocalSassModule)
|
|
26
|
-
: sass;
|
|
27
|
-
if (fs.existsSync(gulpModule)) {
|
|
28
|
-
if (process.cwd() !== process.env.BALM_CWD) {
|
|
29
|
-
process.chdir(process.env.BALM_CWD);
|
|
30
|
-
}
|
|
31
|
-
global.gulp = requireModule(gulpModule);
|
|
32
|
-
global.$ = requireModule('gulp-load-plugins')();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.error(colors.bgBlueBright('BalmJS'), colors.yellow('`balm` module not found :('));
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
global.node = {
|
|
39
|
-
path,
|
|
40
|
-
fs,
|
|
41
|
-
isLegacySass,
|
|
42
|
-
getSassModule
|
|
43
|
-
};
|
|
44
|
-
global.server = create();
|
|
45
|
-
global.through2 = through2;
|
|
46
|
-
global.PluginError = PluginError;
|
|
47
|
-
global.NOOP = () => { };
|
package/tslib/config/html.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const options = {
|
|
2
|
-
collapseWhitespace: true,
|
|
3
|
-
minifyCSS: true,
|
|
4
|
-
minifyJS: {
|
|
5
|
-
compress: {
|
|
6
|
-
drop_console: true
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
processConditionalComments: true,
|
|
10
|
-
removeComments: true,
|
|
11
|
-
removeEmptyAttributes: true,
|
|
12
|
-
removeScriptTypeAttributes: true,
|
|
13
|
-
removeStyleLinkTypeAttributes: true
|
|
14
|
-
};
|
|
15
|
-
export default {
|
|
16
|
-
options
|
|
17
|
-
};
|
package/tslib/config/images.js
DELETED
package/tslib/config/index.js
DELETED
|
@@ -1,56 +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;
|
|
16
|
-
(function (LogLevel) {
|
|
17
|
-
LogLevel[LogLevel["Trace"] = 0] = "Trace";
|
|
18
|
-
LogLevel[LogLevel["Debug"] = 1] = "Debug";
|
|
19
|
-
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
20
|
-
LogLevel[LogLevel["Warn"] = 3] = "Warn";
|
|
21
|
-
LogLevel[LogLevel["Error"] = 4] = "Error";
|
|
22
|
-
})(LogLevel || (LogLevel = {}));
|
|
23
|
-
var Bundler;
|
|
24
|
-
(function (Bundler) {
|
|
25
|
-
Bundler["webpack"] = "webpack";
|
|
26
|
-
Bundler["rollup"] = "rollup";
|
|
27
|
-
Bundler["esbuild"] = "esbuild";
|
|
28
|
-
})(Bundler || (Bundler = {}));
|
|
29
|
-
const vendors = [];
|
|
30
|
-
const workspace = process.env.BALM_CWD;
|
|
31
|
-
const inFrontend = true;
|
|
32
|
-
const useDefaults = true;
|
|
33
|
-
const config = {
|
|
34
|
-
env,
|
|
35
|
-
workspace,
|
|
36
|
-
inFrontend,
|
|
37
|
-
useDefaults,
|
|
38
|
-
roots,
|
|
39
|
-
paths,
|
|
40
|
-
html,
|
|
41
|
-
styles,
|
|
42
|
-
scripts,
|
|
43
|
-
images,
|
|
44
|
-
extras,
|
|
45
|
-
assets,
|
|
46
|
-
server,
|
|
47
|
-
ftp,
|
|
48
|
-
pwa,
|
|
49
|
-
logs
|
|
50
|
-
};
|
|
51
|
-
BalmJS.config = config;
|
|
52
|
-
BalmJS.LogLevel = LogLevel;
|
|
53
|
-
BalmJS.Bundler = Bundler;
|
|
54
|
-
BalmJS.vendors = vendors;
|
|
55
|
-
BalmJS.entries = [];
|
|
56
|
-
export default config;
|
package/tslib/config/logs.js
DELETED
package/tslib/config/paths.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const source = {
|
|
2
|
-
base: '',
|
|
3
|
-
html: '',
|
|
4
|
-
css: 'styles',
|
|
5
|
-
js: 'scripts',
|
|
6
|
-
img: 'images',
|
|
7
|
-
font: 'fonts',
|
|
8
|
-
media: 'media'
|
|
9
|
-
};
|
|
10
|
-
const tmp = {
|
|
11
|
-
base: '',
|
|
12
|
-
css: 'css',
|
|
13
|
-
js: 'js',
|
|
14
|
-
img: 'img',
|
|
15
|
-
font: 'fonts',
|
|
16
|
-
media: 'media'
|
|
17
|
-
};
|
|
18
|
-
const target = {
|
|
19
|
-
base: '',
|
|
20
|
-
css: 'css',
|
|
21
|
-
js: 'js',
|
|
22
|
-
img: 'img',
|
|
23
|
-
font: 'font',
|
|
24
|
-
media: 'media'
|
|
25
|
-
};
|
|
26
|
-
export default {
|
|
27
|
-
source,
|
|
28
|
-
tmp,
|
|
29
|
-
target
|
|
30
|
-
};
|
package/tslib/config/pwa.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const enabled = false;
|
|
2
|
-
const manifest = 'manifest.json';
|
|
3
|
-
const workboxSw = 'node_modules/workbox-sw/build/workbox-sw.js';
|
|
4
|
-
const mode = 'generateSW';
|
|
5
|
-
const options = {};
|
|
6
|
-
const swSrcFilename = 'service-worker.js';
|
|
7
|
-
const swDestFilename = 'sw.js';
|
|
8
|
-
const version = '';
|
|
9
|
-
export default {
|
|
10
|
-
enabled,
|
|
11
|
-
manifest,
|
|
12
|
-
workboxSw,
|
|
13
|
-
mode,
|
|
14
|
-
options,
|
|
15
|
-
swSrcFilename,
|
|
16
|
-
swDestFilename,
|
|
17
|
-
version
|
|
18
|
-
};
|
package/tslib/config/roots.js
DELETED
package/tslib/config/scripts.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const bundler = 'webpack';
|
|
2
|
-
const minify = false;
|
|
3
|
-
const minifyOptions = {
|
|
4
|
-
ecma: 5,
|
|
5
|
-
compress: {
|
|
6
|
-
comparisons: false,
|
|
7
|
-
inline: 2
|
|
8
|
-
},
|
|
9
|
-
mangle: {
|
|
10
|
-
safari10: true
|
|
11
|
-
},
|
|
12
|
-
format: {
|
|
13
|
-
comments: false,
|
|
14
|
-
ascii_only: true
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const entry = '';
|
|
18
|
-
const lint = false;
|
|
19
|
-
const library = '';
|
|
20
|
-
const loaders = [];
|
|
21
|
-
const defaultLoaders = {};
|
|
22
|
-
const includeJsResource = [];
|
|
23
|
-
const useEsModule = true;
|
|
24
|
-
const babelLoaderOptions = {};
|
|
25
|
-
const postcssLoaderOptions = {};
|
|
26
|
-
const htmlLoaderOptions = {};
|
|
27
|
-
const imageAssetType = 'asset';
|
|
28
|
-
const imageInlineSizeLimit = 8096;
|
|
29
|
-
const extensions = [];
|
|
30
|
-
const alias = {};
|
|
31
|
-
const plugins = [];
|
|
32
|
-
const nodeEnv = {};
|
|
33
|
-
const injectHtml = false;
|
|
34
|
-
const htmlPluginOptions = {};
|
|
35
|
-
const extractCss = false;
|
|
36
|
-
const sourceMap = false;
|
|
37
|
-
const target = ['web', 'es5'];
|
|
38
|
-
const externals = '';
|
|
39
|
-
const stats = {
|
|
40
|
-
colors: true,
|
|
41
|
-
assets: true,
|
|
42
|
-
children: false,
|
|
43
|
-
chunks: false,
|
|
44
|
-
modules: false
|
|
45
|
-
};
|
|
46
|
-
const webpackOptions = {};
|
|
47
|
-
const optimization = {};
|
|
48
|
-
const extractAllVendors = false;
|
|
49
|
-
const vendorName = 'vendor';
|
|
50
|
-
const ie8 = false;
|
|
51
|
-
const inputOptions = {};
|
|
52
|
-
const outputOptions = {};
|
|
53
|
-
const buildOptions = {};
|
|
54
|
-
const useTransform = false;
|
|
55
|
-
const transformOptions = {};
|
|
56
|
-
export default {
|
|
57
|
-
bundler,
|
|
58
|
-
minify,
|
|
59
|
-
minifyOptions,
|
|
60
|
-
entry,
|
|
61
|
-
lint,
|
|
62
|
-
library,
|
|
63
|
-
loaders,
|
|
64
|
-
defaultLoaders,
|
|
65
|
-
includeJsResource,
|
|
66
|
-
useEsModule,
|
|
67
|
-
babelLoaderOptions,
|
|
68
|
-
postcssLoaderOptions,
|
|
69
|
-
htmlLoaderOptions,
|
|
70
|
-
imageAssetType,
|
|
71
|
-
imageInlineSizeLimit,
|
|
72
|
-
extensions,
|
|
73
|
-
alias,
|
|
74
|
-
plugins,
|
|
75
|
-
nodeEnv,
|
|
76
|
-
injectHtml,
|
|
77
|
-
htmlPluginOptions,
|
|
78
|
-
extractCss,
|
|
79
|
-
sourceMap,
|
|
80
|
-
target,
|
|
81
|
-
externals,
|
|
82
|
-
stats,
|
|
83
|
-
webpackOptions,
|
|
84
|
-
optimization,
|
|
85
|
-
extractAllVendors,
|
|
86
|
-
vendorName,
|
|
87
|
-
ie8,
|
|
88
|
-
inputOptions,
|
|
89
|
-
outputOptions,
|
|
90
|
-
buildOptions,
|
|
91
|
-
useTransform,
|
|
92
|
-
transformOptions
|
|
93
|
-
};
|
package/tslib/config/server.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const port = 3000;
|
|
2
|
-
const host = null;
|
|
3
|
-
const https = undefined;
|
|
4
|
-
const open = false;
|
|
5
|
-
const proxy = false;
|
|
6
|
-
const serveStatic = [];
|
|
7
|
-
const options = {};
|
|
8
|
-
const next = NOOP;
|
|
9
|
-
const devOptions = {};
|
|
10
|
-
const hotOptions = {
|
|
11
|
-
reload: true,
|
|
12
|
-
noInfo: true
|
|
13
|
-
};
|
|
14
|
-
const proxyOptions = false;
|
|
15
|
-
const historyOptions = false;
|
|
16
|
-
const middlewares = [];
|
|
17
|
-
const extraWatchFiles = [];
|
|
18
|
-
export default {
|
|
19
|
-
port,
|
|
20
|
-
host,
|
|
21
|
-
https,
|
|
22
|
-
open,
|
|
23
|
-
proxy,
|
|
24
|
-
serveStatic,
|
|
25
|
-
options,
|
|
26
|
-
next,
|
|
27
|
-
devOptions,
|
|
28
|
-
hotOptions,
|
|
29
|
-
proxyOptions,
|
|
30
|
-
historyOptions,
|
|
31
|
-
middlewares,
|
|
32
|
-
extraWatchFiles
|
|
33
|
-
};
|
package/tslib/config/spinner.js
DELETED
package/tslib/config/styles.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const extname = 'css';
|
|
2
|
-
const minify = false;
|
|
3
|
-
const atImportPaths = [];
|
|
4
|
-
const entry = '';
|
|
5
|
-
const options = {
|
|
6
|
-
discardComments: {
|
|
7
|
-
removeAll: true
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
const sassOptions = {};
|
|
11
|
-
const lessOptions = {};
|
|
12
|
-
const postcssEnvOptions = {
|
|
13
|
-
autoprefixer: {
|
|
14
|
-
flexbox: 'no-2009'
|
|
15
|
-
},
|
|
16
|
-
stage: 3
|
|
17
|
-
};
|
|
18
|
-
const postcssPlugins = [];
|
|
19
|
-
const imageBasePath = '../';
|
|
20
|
-
const sprites = [];
|
|
21
|
-
const spriteRetina = false;
|
|
22
|
-
const spriteParams = {};
|
|
23
|
-
export default {
|
|
24
|
-
extname,
|
|
25
|
-
minify,
|
|
26
|
-
atImportPaths,
|
|
27
|
-
entry,
|
|
28
|
-
options,
|
|
29
|
-
sassOptions,
|
|
30
|
-
lessOptions,
|
|
31
|
-
postcssEnvOptions,
|
|
32
|
-
postcssPlugins,
|
|
33
|
-
imageBasePath,
|
|
34
|
-
sprites,
|
|
35
|
-
spriteRetina,
|
|
36
|
-
spriteParams
|
|
37
|
-
};
|
package/tslib/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/tslib/hooks/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import Maker from './maker.js';
|
|
2
|
-
class BaseHooks {
|
|
3
|
-
get env() {
|
|
4
|
-
return BalmJS.config.env;
|
|
5
|
-
}
|
|
6
|
-
html(input, output) {
|
|
7
|
-
Maker.generate('html', [input, output]);
|
|
8
|
-
}
|
|
9
|
-
css(input, output) {
|
|
10
|
-
Maker.generate('postcss', [input, output]);
|
|
11
|
-
}
|
|
12
|
-
sass(input, output, options) {
|
|
13
|
-
Maker.generate('sass', [input, output, options]);
|
|
14
|
-
}
|
|
15
|
-
less(input, output, options) {
|
|
16
|
-
Maker.generate('less', [input, output, options]);
|
|
17
|
-
}
|
|
18
|
-
url(input, output) {
|
|
19
|
-
Maker.generate('url', [input, output]);
|
|
20
|
-
}
|
|
21
|
-
js() {
|
|
22
|
-
BalmJS.logger.warn('balm api', '`mix.js` is deprecated, please use `mix.webpack`/`mix.rollup`/`mix.esbuild` instead.');
|
|
23
|
-
}
|
|
24
|
-
webpack(input, output, options, fn) {
|
|
25
|
-
Maker.generate('webpack', [input, output, options, fn]);
|
|
26
|
-
}
|
|
27
|
-
esbuild(input, output, options) {
|
|
28
|
-
Maker.generate('esbuild', [input, output, options]);
|
|
29
|
-
}
|
|
30
|
-
rollup(input, output) {
|
|
31
|
-
Maker.generate('rollup', [input, output]);
|
|
32
|
-
}
|
|
33
|
-
jsmin(input, output, options) {
|
|
34
|
-
Maker.generate('jsmin', [input, output, options]);
|
|
35
|
-
}
|
|
36
|
-
copy(input, output, options) {
|
|
37
|
-
Maker.generate('copy', [input, output, options]);
|
|
38
|
-
}
|
|
39
|
-
remove(paths) {
|
|
40
|
-
Maker.generate('remove', [paths]);
|
|
41
|
-
}
|
|
42
|
-
version(input, output, assetsOptions) {
|
|
43
|
-
Maker.generate('version', [input, output, assetsOptions]);
|
|
44
|
-
}
|
|
45
|
-
serve(handler) {
|
|
46
|
-
Maker.generate('serve', [handler]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
class BalmHooks extends BaseHooks {
|
|
50
|
-
sprite(input, output, spriteOptions) {
|
|
51
|
-
Maker.generate('sprite', [input, output, spriteOptions]);
|
|
52
|
-
}
|
|
53
|
-
replace(input, output, options) {
|
|
54
|
-
Maker.generate('replace', [input, output, options]);
|
|
55
|
-
}
|
|
56
|
-
publish(input, output, renameOptions) {
|
|
57
|
-
Maker.generate('publish', [input, output, renameOptions]);
|
|
58
|
-
}
|
|
59
|
-
zip(input = '', output = '', filename = 'archive.zip') {
|
|
60
|
-
Maker.generate('zip', [input, output, filename]);
|
|
61
|
-
}
|
|
62
|
-
ftp(localFiles, options) {
|
|
63
|
-
Maker.generate('ftp', [localFiles, options]);
|
|
64
|
-
}
|
|
65
|
-
generateSW(pwaOptions) {
|
|
66
|
-
Maker.generate('pwa', ['generateSW', pwaOptions]);
|
|
67
|
-
}
|
|
68
|
-
injectManifest(pwaOptions) {
|
|
69
|
-
Maker.generate('pwa', ['injectManifest', pwaOptions]);
|
|
70
|
-
}
|
|
71
|
-
modernizr() {
|
|
72
|
-
Maker.generate('modernizr');
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export default BalmHooks;
|
package/tslib/hooks/maker.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const BLOCKLIST_IN_PROD = ['serve'];
|
|
2
|
-
let compiling = false;
|
|
3
|
-
function ban(name) {
|
|
4
|
-
const BLOCKLIST_IN_DEV = [
|
|
5
|
-
'publish',
|
|
6
|
-
...(BalmJS.config.useDefaults ? BLOCKLIST_IN_PROD : [])
|
|
7
|
-
];
|
|
8
|
-
const banInProd = BalmJS.config.env.isProd && BLOCKLIST_IN_PROD.includes(name);
|
|
9
|
-
const banInDev = BalmJS.config.env.isDev && BLOCKLIST_IN_DEV.includes(name);
|
|
10
|
-
const isBan = banInProd || banInDev;
|
|
11
|
-
const api = name === 'postcss' ? 'css' : name;
|
|
12
|
-
if (isBan) {
|
|
13
|
-
const message = BalmJS.config.useDefaults &&
|
|
14
|
-
BalmJS.config.env.isDev &&
|
|
15
|
-
BLOCKLIST_IN_PROD.includes(name)
|
|
16
|
-
? `'mix.${api}()' can only be used for 'balm.config.useDefaults = false;'`
|
|
17
|
-
: `There is no 'mix.${api}()' hook in ${banInProd ? 'production' : 'development'} mode`;
|
|
18
|
-
BalmJS.logger.warn('balm hook', message);
|
|
19
|
-
}
|
|
20
|
-
return isBan;
|
|
21
|
-
}
|
|
22
|
-
class Maker {
|
|
23
|
-
static generate(name, args = []) {
|
|
24
|
-
if (ban(name)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const customTask = BalmJS.tasks.get(name);
|
|
28
|
-
const taskName = ['sprite', ...BLOCKLIST_IN_PROD].includes(customTask.name)
|
|
29
|
-
? customTask.name
|
|
30
|
-
: `${customTask.name}:${BalmJS.recipeIndex}`;
|
|
31
|
-
let balmTask = (callback) => {
|
|
32
|
-
callback();
|
|
33
|
-
};
|
|
34
|
-
switch (customTask.name) {
|
|
35
|
-
case 'sprite':
|
|
36
|
-
customTask.recipe(...args);
|
|
37
|
-
if (customTask.deps.length) {
|
|
38
|
-
balmTask = gulp.series(...BalmJS.toNamespace(customTask.deps));
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
BalmJS.logger.warn('balm hook', '`mix.sprite()` is missing `input` parameters');
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
case 'modernizr':
|
|
45
|
-
balmTask = customTask.fn;
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
balmTask = customTask.recipe(...args);
|
|
49
|
-
}
|
|
50
|
-
if (BalmJS.watching) {
|
|
51
|
-
if (!compiling) {
|
|
52
|
-
compiling = true;
|
|
53
|
-
gulp.series(balmTask, (done) => {
|
|
54
|
-
compiling = false;
|
|
55
|
-
done();
|
|
56
|
-
})();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
gulp.task(BalmJS.toNamespace(taskName), balmTask);
|
|
61
|
-
BalmJS.recipes.push(taskName);
|
|
62
|
-
BalmJS.recipeIndex++;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export default Maker;
|
package/tslib/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import history from 'connect-history-api-fallback';
|
|
2
|
-
function historyMiddleware() {
|
|
3
|
-
const historyOptions = BalmJS.config.server.historyOptions;
|
|
4
|
-
return historyOptions
|
|
5
|
-
? [
|
|
6
|
-
BalmJS.utils.isObject(historyOptions)
|
|
7
|
-
? history(historyOptions)
|
|
8
|
-
: history()
|
|
9
|
-
]
|
|
10
|
-
: [];
|
|
11
|
-
}
|
|
12
|
-
export default historyMiddleware;
|
|
@@ -1,18 +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 [
|
|
10
|
-
...(BalmJS.config.scripts.bundler === BalmJS.Bundler.webpack
|
|
11
|
-
? webpackMiddleware()
|
|
12
|
-
: []),
|
|
13
|
-
...httpProxyMiddleware(),
|
|
14
|
-
...historyMiddleware(),
|
|
15
|
-
...(canOverride ? BalmJS.config.server.middlewares : [])
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
export default getMiddlewares;
|
|
@@ -1,27 +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
|
-
const options = proxyOptions;
|
|
9
|
-
middleware.push(createProxyMiddleware(options));
|
|
10
|
-
}
|
|
11
|
-
else if (BalmJS.utils.isArray(proxyOptions)) {
|
|
12
|
-
for (const options of proxyOptions) {
|
|
13
|
-
middleware.push(createProxyMiddleware(options));
|
|
14
|
-
}
|
|
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
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
const { message } = error;
|
|
22
|
-
BalmJS.logger.error('proxy middleware', message);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return middleware;
|
|
26
|
-
}
|
|
27
|
-
export default httpProxyMiddleware;
|