balm-core 4.11.0 → 4.13.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.
Files changed (108) hide show
  1. package/lib/balm.js +0 -20
  2. package/lib/bootstrap/check_config.js +6 -9
  3. package/lib/bootstrap/index.js +16 -22
  4. package/lib/bundler/esbuild/build.js +0 -2
  5. package/lib/bundler/esbuild/index.js +0 -2
  6. package/lib/bundler/esbuild/transform.js +0 -4
  7. package/lib/bundler/rollup/build.js +2 -4
  8. package/lib/bundler/rollup/entry.js +2 -5
  9. package/lib/bundler/rollup/index.js +0 -3
  10. package/lib/bundler/rollup/output.js +0 -5
  11. package/lib/bundler/rollup/plugins.js +0 -10
  12. package/lib/bundler/webpack/config/common.js +4 -15
  13. package/lib/bundler/webpack/config/dev.js +2 -3
  14. package/lib/bundler/webpack/config/env.js +12 -14
  15. package/lib/bundler/webpack/config/index.js +0 -2
  16. package/lib/bundler/webpack/config/prod.js +4 -7
  17. package/lib/bundler/webpack/entry.js +8 -12
  18. package/lib/bundler/webpack/index.js +2 -5
  19. package/lib/bundler/webpack/loaders.js +0 -6
  20. package/lib/bundler/webpack/output.js +0 -5
  21. package/lib/bundler/webpack/rules/asset.js +2 -3
  22. package/lib/bundler/webpack/rules/babel.js +3 -4
  23. package/lib/bundler/webpack/rules/css.js +4 -10
  24. package/lib/bundler/webpack/rules/html.js +0 -2
  25. package/lib/config/assets.js +0 -5
  26. package/lib/config/env.js +0 -2
  27. package/lib/config/globals.js +2 -5
  28. package/lib/config/index.js +0 -5
  29. package/lib/config/logs.js +0 -1
  30. package/lib/config/paths.js +3 -3
  31. package/lib/config/pwa.js +0 -3
  32. package/lib/config/roots.js +0 -2
  33. package/lib/config/scripts.js +20 -28
  34. package/lib/config/server.js +4 -10
  35. package/lib/config/styles.js +2 -10
  36. package/lib/hello.js +0 -2
  37. package/lib/hooks/index.js +18 -35
  38. package/lib/hooks/maker.js +0 -14
  39. package/lib/middlewares/history.js +0 -2
  40. package/lib/middlewares/index.js +0 -4
  41. package/lib/middlewares/proxy.js +0 -6
  42. package/lib/middlewares/webpack.js +0 -5
  43. package/lib/plugins/htmlmin.js +1 -7
  44. package/lib/plugins/imagemin.js +1 -18
  45. package/lib/plugins/jsmin.js +0 -10
  46. package/lib/plugins/less.js +7 -14
  47. package/lib/plugins/plumber.js +4 -21
  48. package/lib/plugins/postcss-plugins.js +0 -2
  49. package/lib/plugins/postcss.js +8 -21
  50. package/lib/plugins/rename.js +2 -13
  51. package/lib/plugins/replace.js +4 -22
  52. package/lib/plugins/sass.js +30 -39
  53. package/lib/plugins/sftp.js +33 -62
  54. package/lib/tasks/default.js +10 -19
  55. package/lib/tasks/foundation/balm.js +0 -25
  56. package/lib/tasks/foundation/balm_style.js +2 -15
  57. package/lib/tasks/foundation/index.js +0 -2
  58. package/lib/tasks/index.js +8 -7
  59. package/lib/tasks/private/build.js +0 -5
  60. package/lib/tasks/private/cache.js +0 -6
  61. package/lib/tasks/private/clean.js +0 -20
  62. package/lib/tasks/private/end.js +0 -6
  63. package/lib/tasks/private/extra.js +4 -11
  64. package/lib/tasks/private/font.js +0 -5
  65. package/lib/tasks/private/image.js +0 -11
  66. package/lib/tasks/private/lint.js +0 -5
  67. package/lib/tasks/private/media.js +0 -5
  68. package/lib/tasks/private/modernizr.js +0 -19
  69. package/lib/tasks/private/pwa-cache.js +0 -7
  70. package/lib/tasks/private/script.js +0 -3
  71. package/lib/tasks/private/sprite.js +3 -25
  72. package/lib/tasks/private/start.js +0 -6
  73. package/lib/tasks/private/style.js +0 -3
  74. package/lib/tasks/private/workbox-sw.js +0 -5
  75. package/lib/tasks/public/copy.js +0 -5
  76. package/lib/tasks/public/esbuild.js +0 -6
  77. package/lib/tasks/public/ftp.js +0 -11
  78. package/lib/tasks/public/html.js +0 -20
  79. package/lib/tasks/public/jsmin.js +0 -6
  80. package/lib/tasks/public/less.js +0 -6
  81. package/lib/tasks/public/postcss.js +0 -5
  82. package/lib/tasks/public/publish.js +3 -15
  83. package/lib/tasks/public/pwa.js +0 -13
  84. package/lib/tasks/public/remove.js +2 -18
  85. package/lib/tasks/public/replace.js +0 -7
  86. package/lib/tasks/public/rollup.js +0 -6
  87. package/lib/tasks/public/sass.js +0 -6
  88. package/lib/tasks/public/server.js +4 -32
  89. package/lib/tasks/public/url.js +0 -13
  90. package/lib/tasks/public/version.js +0 -6
  91. package/lib/tasks/public/webpack.js +2 -12
  92. package/lib/tasks/public/zip.js +0 -5
  93. package/lib/utilities/address.js +5 -16
  94. package/lib/utilities/cache-core.js +5 -13
  95. package/lib/utilities/color.js +0 -5
  96. package/lib/utilities/compiling.js +0 -14
  97. package/lib/utilities/detect-port.js +6 -22
  98. package/lib/utilities/escape-string-regexp.js +3 -4
  99. package/lib/utilities/file.js +2 -18
  100. package/lib/utilities/loading.js +0 -23
  101. package/lib/utilities/logger.js +0 -19
  102. package/lib/utilities/merge-stream.js +0 -8
  103. package/lib/utilities/namespace.js +0 -4
  104. package/lib/utilities/public-url.js +10 -10
  105. package/lib/utilities/replacestream.js +5 -27
  106. package/lib/utilities/typeof.js +0 -2
  107. package/lib/utilities/utils.js +2 -9
  108. package/package.json +31 -31
@@ -1,11 +1,9 @@
1
1
  import { HMR_PATH } from '../../config/constants.js';
2
2
  const FILENAME_REGEX = new RegExp('[^/]+$', 'i');
3
3
  const HOT_CLIENT = 'webpack-hot-middleware/client';
4
-
5
4
  function initVendors(entries) {
6
5
  const jsVendors = [];
7
6
  const jsEntries = [];
8
-
9
7
  for (const [key, value] of Object.entries(entries)) {
10
8
  if (BalmJS.utils.isArray(value)) {
11
9
  jsVendors.push({
@@ -19,12 +17,11 @@ function initVendors(entries) {
19
17
  });
20
18
  }
21
19
  }
22
-
23
20
  BalmJS.vendors = jsVendors;
24
21
  BalmJS.entries = jsEntries;
25
- } // Relative path
26
-
22
+ }
27
23
 
24
+ // Relative path
28
25
  function getEntry(input, scripts) {
29
26
  let webpackEntries = {};
30
27
  const hotOptions = Object.assign({}, BalmJS.config.server.hotOptions, {
@@ -32,18 +29,19 @@ function getEntry(input, scripts) {
32
29
  });
33
30
  const HMR = `${HOT_CLIENT}?` + Object.entries(hotOptions).map(option => option.join('=')).join('&');
34
31
  const useHMR = BalmJS.config.server.useHMR;
35
-
36
32
  if (BalmJS.utils.isObject(input)) {
37
33
  initVendors(input);
38
-
39
34
  for (const [key, value] of Object.entries(input)) {
40
- const isVendor = BalmJS.utils.isArray(value); // Key
35
+ const isVendor = BalmJS.utils.isArray(value);
41
36
 
42
- const entryKey = isVendor ? node.path.join(scripts.vendorName, key) : node.path.join(key); // Value
37
+ // Key
38
+ const entryKey = isVendor ? node.path.join(scripts.vendorName, key) : node.path.join(key);
43
39
 
40
+ // Value
44
41
  const hotValue = BalmJS.utils.isString(value) ? [value, HMR] : [...value, HMR];
45
- const entryValue = useHMR ? hotValue : value; // Result
42
+ const entryValue = useHMR ? hotValue : value;
46
43
 
44
+ // Result
47
45
  if (!isVendor) {
48
46
  webpackEntries[entryKey] = entryValue;
49
47
  }
@@ -59,11 +57,9 @@ function getEntry(input, scripts) {
59
57
  } else {
60
58
  BalmJS.logger.warn('webpack entry', '`scripts.entry` must be `string | array | object`');
61
59
  }
62
-
63
60
  BalmJS.logger.debug('webpack entry', webpackEntries, {
64
61
  pre: true
65
62
  });
66
63
  return webpackEntries;
67
64
  }
68
-
69
65
  export default getEntry;
@@ -4,7 +4,6 @@ import getOutput from './output.js';
4
4
  import getDefaultConfig from './config/index.js';
5
5
  const webpackModule = process.env.WEBPACK || requireModule.resolve('webpack');
6
6
  const webpack = requireModule(webpackModule);
7
-
8
7
  function webpackConfig(input, output, customWebpackOptions = {}, isHook = false) {
9
8
  const scripts = BalmJS.config.scripts;
10
9
  const defaultEntry = `./${BalmJS.file.defaultEntry}`;
@@ -18,18 +17,16 @@ function webpackConfig(input, output, customWebpackOptions = {}, isHook = false)
18
17
  }, {
19
18
  pre: true
20
19
  });
21
-
22
20
  if (scripts.externals) {
23
21
  baseConfig.externals = scripts.externals;
24
22
  }
25
-
26
23
  const defaultConfig = getDefaultConfig(webpack, scripts);
27
24
  const configuration = merge(baseConfig, defaultConfig, scripts.webpackOptions, customWebpackOptions);
28
25
  BalmJS.logger.success('webpack configuration', configuration, {
29
26
  pre: true
30
27
  });
31
28
  return configuration;
32
- } // export default webpackConfig;
33
-
29
+ }
34
30
 
31
+ // export default webpackConfig;
35
32
  export { webpack, webpackConfig };
@@ -1,6 +1,5 @@
1
1
  import { mergeWithRules, CustomizeRule } from 'webpack-merge';
2
2
  import LOADERS from './rules/index.js';
3
-
4
3
  function getLoaders(customLoaders) {
5
4
  const enableDefaultLoaders = Object.assign({
6
5
  js: true,
@@ -10,14 +9,11 @@ function getLoaders(customLoaders) {
10
9
  }, BalmJS.config.scripts.defaultLoaders);
11
10
  const useDefaultLoaders = Object.values(enableDefaultLoaders).some(value => value);
12
11
  let defaultLoaders = [];
13
-
14
12
  if (useDefaultLoaders) {
15
13
  Object.values(LOADERS).forEach(Loader => {
16
14
  const key = Loader.name.replace('Loader', '');
17
-
18
15
  if (enableDefaultLoaders[key]) {
19
16
  const loader = Loader();
20
-
21
17
  if (BalmJS.utils.isArray(loader)) {
22
18
  defaultLoaders = defaultLoaders.concat(loader);
23
19
  } else {
@@ -26,7 +22,6 @@ function getLoaders(customLoaders) {
26
22
  }
27
23
  });
28
24
  }
29
-
30
25
  const result = mergeWithRules({
31
26
  module: {
32
27
  rules: {
@@ -52,5 +47,4 @@ function getLoaders(customLoaders) {
52
47
  });
53
48
  return defaultModule.rules;
54
49
  }
55
-
56
50
  export default getLoaders;
@@ -1,17 +1,13 @@
1
1
  import { CHUNK, ASSET } from '../../config/constants.js';
2
-
3
2
  function getJsFilename(scripts, isChunk = false) {
4
3
  let filename;
5
-
6
4
  if (isChunk) {
7
5
  filename = BalmJS.config.env.isProd ? `[name].${CHUNK.hash}` : '[name]';
8
6
  } else {
9
7
  filename = scripts.useCache ? `[name].${CHUNK.hash}` : '[name]';
10
8
  }
11
-
12
9
  return `${filename}.js`;
13
10
  }
14
-
15
11
  function getOutput(output, scripts, isHook = false) {
16
12
  const outputDirectory = output || BalmJS.config.dest.base;
17
13
  const jsFolder = BalmJS.config.paths.target.js;
@@ -42,5 +38,4 @@ function getOutput(output, scripts, isHook = false) {
42
38
  publicPath: BalmJS.file.publicUrlOrPath
43
39
  }, customLibraryConfig, miniprogramConfig);
44
40
  }
45
-
46
41
  export default getOutput;
@@ -1,8 +1,8 @@
1
1
  import { imgRegex, fontRegex, mediaRegex } from '../config/regex.js';
2
2
  import { ASSET } from '../../../config/constants.js';
3
-
4
3
  function assetLoader() {
5
- return [// "url" loader works like "file" loader except that it embeds assets
4
+ return [
5
+ // "url" loader works like "file" loader except that it embeds assets
6
6
  // smaller than specified limit in bytes as data URLs to avoid requests.
7
7
  // A missing `test` is equivalent to a match.
8
8
  {
@@ -30,5 +30,4 @@ function assetLoader() {
30
30
  }
31
31
  }];
32
32
  }
33
-
34
33
  export default assetLoader;
@@ -1,14 +1,14 @@
1
1
  import { jsRegex } from '../config/regex.js';
2
-
3
2
  function jsLoader() {
4
3
  const options = Object.assign({
5
4
  // This is a feature of `babel-loader` for webpack (not Babel itself).
6
5
  // It enables caching results in ./node_modules/.cache/babel-loader/
7
6
  // directory for faster rebuilds.
8
7
  cacheDirectory: true
9
- }, BalmJS.config.scripts.babelLoaderOptions); // Process application JS with Babel.
10
- // The preset includes JSX, Flow, TypeScript, and some ESnext features.
8
+ }, BalmJS.config.scripts.babelLoaderOptions);
11
9
 
10
+ // Process application JS with Babel.
11
+ // The preset includes JSX, Flow, TypeScript, and some ESnext features.
12
12
  return {
13
13
  test: jsRegex,
14
14
  include: [BalmJS.file.absPaths(BalmJS.config.src.js), ...BalmJS.config.scripts.includeJsResource],
@@ -16,5 +16,4 @@ function jsLoader() {
16
16
  options
17
17
  };
18
18
  }
19
-
20
19
  export default jsLoader;
@@ -1,6 +1,5 @@
1
1
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2
2
  import { cssRegex, cssModuleRegex, sassRegex, sassModuleRegex } from '../config/regex.js';
3
-
4
3
  // common function to get style loaders
5
4
  function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions = {}) {
6
5
  const {
@@ -23,7 +22,6 @@ function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions
23
22
  sourceMap
24
23
  }, BalmJS.config.scripts.postcssLoaderOptions)
25
24
  }].filter(Boolean);
26
-
27
25
  if (preProcessor) {
28
26
  loaders.push({
29
27
  loader: requireModule.resolve(preProcessor),
@@ -32,10 +30,8 @@ function getStyleLoaders(styleLoader, cssOptions, preProcessor = '', sassOptions
32
30
  }, sassOptions)
33
31
  });
34
32
  }
35
-
36
33
  return loaders;
37
34
  }
38
-
39
35
  function cssLoader() {
40
36
  let styleLoader = {
41
37
  loader: requireModule.resolve('style-loader'),
@@ -43,10 +39,8 @@ function cssLoader() {
43
39
  esModule: BalmJS.config.scripts.useEsModule
44
40
  }
45
41
  };
46
-
47
42
  if (BalmJS.config.env.inSSR) {
48
43
  const loadersCount = BalmJS.config.scripts.loaders.length;
49
-
50
44
  for (let i = 0; i < loadersCount; i++) {
51
45
  if (BalmJS.config.scripts.loaders[i].loader === 'vue-loader') {
52
46
  styleLoader = 'vue-style-loader';
@@ -54,15 +48,15 @@ function cssLoader() {
54
48
  }
55
49
  }
56
50
  }
51
+ const sourceMap = BalmJS.config.env.isProd ? BalmJS.config.scripts.sourceMap : BalmJS.config.env.isDev;
57
52
 
58
- const sourceMap = BalmJS.config.env.isProd ? BalmJS.config.scripts.sourceMap : BalmJS.config.env.isDev; // "postcss" loader applies autoprefixer to our CSS.
53
+ // "postcss" loader applies autoprefixer to our CSS.
59
54
  // "css" loader resolves paths in CSS and adds assets as dependencies.
60
55
  // "style" loader turns CSS into JS modules that inject <style> tags.
61
56
  // In production, we use MiniCSSExtractPlugin to extract that CSS
62
57
  // to a file, but in development "style" loader enables hot editing
63
58
  // of CSS.
64
59
  // By default we support CSS Modules with the extension .module.css
65
-
66
60
  return [{
67
61
  test: cssRegex,
68
62
  exclude: cssModuleRegex,
@@ -79,7 +73,8 @@ function cssLoader() {
79
73
  // Remove this when webpack adds a warning or an error for this.
80
74
  // See https://github.com/webpack/webpack/issues/6571
81
75
  sideEffects: true
82
- }, // Opt-in support for SASS (using .scss or .sass extensions).
76
+ },
77
+ // Opt-in support for SASS (using .scss or .sass extensions).
83
78
  // By default we support SASS Modules with the
84
79
  // extensions .module.scss or .module.sass
85
80
  {
@@ -102,5 +97,4 @@ function cssLoader() {
102
97
  sideEffects: true
103
98
  }];
104
99
  }
105
-
106
100
  export default cssLoader;
@@ -1,5 +1,4 @@
1
1
  import { htmlRegex } from '../config/regex.js';
2
-
3
2
  function htmlLoader() {
4
3
  const options = Object.assign({
5
4
  minimize: {
@@ -13,5 +12,4 @@ function htmlLoader() {
13
12
  options
14
13
  };
15
14
  }
16
-
17
15
  export default htmlLoader;
@@ -1,11 +1,7 @@
1
1
  const root = 'assets'; // Remote project root simulation
2
-
3
2
  const mainDir = 'public'; // The `public` directory contains the front controller and your assets (images, JavaScript, CSS, etc.)
4
-
5
3
  const subDir = ''; // Public subdirectory
6
-
7
4
  const buildDir = 'build'; // The suffix of the `subDir`: for dynamic language project
8
-
9
5
  const virtualDir = ''; // The prefix of the `subDir`: for non-standard dynamic language project
10
6
 
11
7
  const cache = false;
@@ -14,7 +10,6 @@ const cache = false;
14
10
  *
15
11
  * @reference https://github.com/smysnk/gulp-rev-all#options
16
12
  */
17
-
18
13
  const options = {
19
14
  fileNameManifest: 'rev-manifest.json',
20
15
  dontRenameFile: ['.html'],
package/lib/config/env.js CHANGED
@@ -13,7 +13,6 @@ const ENV = {
13
13
  const isProd = NODE_ENV === ENV.PROD || argv.includes(`--${ENV.PROD}`) || argv.includes('-p');
14
14
  const isTest = NODE_ENV === ENV.TEST || argv.includes(`--${ENV.TEST}`) || argv.includes('-t');
15
15
  const isDev = !isProd && !isTest;
16
-
17
16
  if (!NODE_ENV) {
18
17
  if (isProd) {
19
18
  process.env.NODE_ENV = ENV.PROD;
@@ -23,7 +22,6 @@ if (!NODE_ENV) {
23
22
  process.env.NODE_ENV = ENV.DEV;
24
23
  }
25
24
  }
26
-
27
25
  const inSSR = NODE_ENV === ENV.SSR || argv.includes(`--${ENV.SSR}`) || argv.includes('-ssr');
28
26
  const isMP = NODE_ENV === ENV.MP || argv.includes(`--${ENV.MP}`) || argv.includes('-mp');
29
27
  const inDesktopApp = NODE_ENV === ENV.DESKTOP_APP || argv.includes(`--${ENV.DESKTOP_APP}`) || argv.includes('-electron');
@@ -3,25 +3,23 @@ import fs from 'node:fs';
3
3
  import colors from 'ansi-colors';
4
4
  import { create } from 'browser-sync';
5
5
  import through2 from 'through2';
6
- import PluginError from 'plugin-error'; // Set env var for ORIGINAL cwd before anything touches it
6
+ import PluginError from 'plugin-error';
7
7
 
8
+ // Set env var for ORIGINAL cwd before anything touches it
8
9
  process.env.BALM_CWD = process.env.INIT_CWD || process.cwd();
9
10
  const gulpModule = path.join(process.env.BALM_ROOT || process.env.BALM_CWD, 'node_modules', 'gulp', 'index.js');
10
-
11
11
  if (fs.existsSync(gulpModule)) {
12
12
  // Chdir before requiring balm config to make sure
13
13
  // we let them chdir as needed
14
14
  if (process.cwd() !== process.env.BALM_CWD) {
15
15
  process.chdir(process.env.BALM_CWD);
16
16
  }
17
-
18
17
  global.gulp = requireModule(gulpModule);
19
18
  global.$ = requireModule('gulp-load-plugins')();
20
19
  } else {
21
20
  console.error(colors.bgBlueBright('BalmJS'), colors.yellow('`balm` module not found :('));
22
21
  process.exit(1);
23
22
  }
24
-
25
23
  global.node = {
26
24
  path,
27
25
  fs
@@ -29,5 +27,4 @@ global.node = {
29
27
  global.server = create();
30
28
  global.through2 = through2;
31
29
  global.PluginError = PluginError;
32
-
33
30
  global.NOOP = () => {};
@@ -13,7 +13,6 @@ import ftp from './ftp.js';
13
13
  import pwa from './pwa.js';
14
14
  import logs from './logs.js';
15
15
  var LogLevel;
16
-
17
16
  (function (LogLevel) {
18
17
  LogLevel[LogLevel["Trace"] = 0] = "Trace";
19
18
  LogLevel[LogLevel["Debug"] = 1] = "Debug";
@@ -21,15 +20,12 @@ var LogLevel;
21
20
  LogLevel[LogLevel["Warn"] = 3] = "Warn";
22
21
  LogLevel[LogLevel["Error"] = 4] = "Error";
23
22
  })(LogLevel || (LogLevel = {}));
24
-
25
23
  var Bundler;
26
-
27
24
  (function (Bundler) {
28
25
  Bundler["webpack"] = "webpack";
29
26
  Bundler["rollup"] = "rollup";
30
27
  Bundler["esbuild"] = "esbuild";
31
28
  })(Bundler || (Bundler = {}));
32
-
33
29
  const vendors = [];
34
30
  const workspace = process.env.BALM_CWD;
35
31
  /**
@@ -38,7 +34,6 @@ const workspace = process.env.BALM_CWD;
38
34
  * set `true` for a static HTML project
39
35
  * set `false` for a dynamic language project (e.g. PHP framework)
40
36
  */
41
-
42
37
  const inFrontend = true;
43
38
  const useDefaults = true; // Use balm default task
44
39
 
@@ -4,7 +4,6 @@ const level = 3;
4
4
  *
5
5
  * @reference https://github.com/nodejs/node/blob/master/doc/api/util.md#utilinspectobject-options
6
6
  */
7
-
8
7
  const formatOptions = {};
9
8
  export default {
10
9
  level,
@@ -12,8 +12,8 @@ const source = {
12
12
  font: 'fonts',
13
13
  // Font directory: `src/fonts`
14
14
  media: 'media' // Media directory: `src/media`
15
-
16
15
  };
16
+
17
17
  const tmp = {
18
18
  base: '',
19
19
  // `.tmp`
@@ -26,8 +26,8 @@ const tmp = {
26
26
  font: 'fonts',
27
27
  // `.tmp/fonts`
28
28
  media: 'media' // `.tmp/media`
29
-
30
29
  };
30
+
31
31
  const target = {
32
32
  base: '',
33
33
  // `dist`
@@ -40,8 +40,8 @@ const target = {
40
40
  font: 'font',
41
41
  // `dist/font`
42
42
  media: 'media' // `dist/media`
43
-
44
43
  };
44
+
45
45
  export default {
46
46
  source,
47
47
  tmp,
package/lib/config/pwa.js CHANGED
@@ -1,16 +1,13 @@
1
1
  const enabled = false;
2
2
  const manifest = 'manifest.json'; // 'manifest.json' or 'manifest.webmanifest'
3
-
4
3
  const workboxSw = 'node_modules/workbox-sw/build/workbox-sw.js';
5
4
  const mode = 'generateSW'; // 'generateSW' or 'injectManifest'
6
-
7
5
  /**
8
6
  * Workbox Build options
9
7
  *
10
8
  * @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config
11
9
  * @reference https://developers.google.com/web/tools/workbox/modules/workbox-build#full_injectmanifest_config
12
10
  */
13
-
14
11
  const options = {};
15
12
  const swSrcFilename = 'service-worker.js';
16
13
  const swDestFilename = 'sw.js';
@@ -1,7 +1,5 @@
1
1
  const source = 'src'; // Source code
2
-
3
2
  const tmp = '.tmp'; // Temporary precompiled assets
4
-
5
3
  const target = 'dist'; // The final distribution folder
6
4
 
7
5
  export default {
@@ -6,7 +6,6 @@ const minify = false;
6
6
  *
7
7
  * @reference https://github.com/terser/terser#minify-options
8
8
  */
9
-
10
9
  const minifyOptions = {
11
10
  ecma: 5,
12
11
  parse: {
@@ -38,17 +37,18 @@ const minifyOptions = {
38
37
  // https://github.com/facebook/create-react-app/issues/2488
39
38
  ascii_only: true
40
39
  }
41
- }; // Entry and Context (webpack/esbuild common options)
42
-
40
+ };
41
+ // Entry and Context (webpack/esbuild common options)
43
42
  const entry = '';
44
43
  const lint = false;
44
+
45
45
  /**
46
46
  * Webpack bundler
47
47
  */
48
- // Output
49
-
50
- const library = ''; // Module
51
48
 
49
+ // Output
50
+ const library = '';
51
+ // Module
52
52
  const loaders = [];
53
53
  const defaultLoaders = {};
54
54
  const includeJsResource = [];
@@ -58,41 +58,37 @@ const useEsModule = true;
58
58
  *
59
59
  * @reference https://github.com/babel/babel-loader#options
60
60
  */
61
-
62
61
  const babelLoaderOptions = {};
63
62
  /**
64
63
  * Styling: postcss-loader options
65
64
  *
66
65
  * @reference https://github.com/postcss/postcss-loader#options
67
66
  */
68
-
69
67
  const postcssLoaderOptions = {};
70
68
  /**
71
69
  * Template: html-loader options
72
70
  *
73
71
  * @reference https://github.com/webpack-contrib/html-loader#options
74
72
  */
75
-
76
73
  const htmlLoaderOptions = {};
77
74
  const imageAssetType = 'asset';
78
75
  const imageInlineSizeLimit = 8096; // 8kb
79
76
  // Resolve
80
-
81
77
  const extensions = [];
82
- const alias = {}; // Plugins
83
-
78
+ const alias = {};
79
+ // Plugins
84
80
  const plugins = [];
85
81
  const nodeEnv = {};
86
82
  const injectHtml = false;
87
83
  const htmlPluginOptions = {};
88
- const extractCss = false; // Devtool
89
-
90
- const sourceMap = false; // Target
91
-
92
- const target = ['web', 'es5']; // Externals
93
-
94
- const externals = ''; // Stats
95
-
84
+ const extractCss = false;
85
+ // Devtool
86
+ const sourceMap = false;
87
+ // Target
88
+ const target = ['web', 'es5'];
89
+ // Externals
90
+ const externals = '';
91
+ // Stats
96
92
  const stats = {
97
93
  colors: true,
98
94
  assets: true,
@@ -105,32 +101,28 @@ const stats = {
105
101
  *
106
102
  * @reference https://webpack.js.org/configuration/
107
103
  */
108
-
109
- const webpackOptions = {}; // Optimization
110
-
104
+ const webpackOptions = {};
105
+ // Optimization
111
106
  /**
112
107
  * Webpack optimizations for manual configuration and overrides
113
108
  *
114
109
  * @reference https://webpack.js.org/configuration/optimization/
115
110
  */
116
-
117
111
  const optimization = {};
118
112
  const extractAllVendors = false; // Extract all vendors (all in one)
119
-
120
113
  const vendorName = 'vendor'; // AllInOne vendor filename or Vendors folder name
121
114
  // IE8 compatibility
122
-
123
115
  const ie8 = false;
116
+
124
117
  /**
125
118
  * Rollup bundler
126
119
  */
127
-
128
120
  const inputOptions = {};
129
121
  const outputOptions = {};
122
+
130
123
  /**
131
124
  * Esbuild bundler
132
125
  */
133
-
134
126
  const buildOptions = {};
135
127
  const useTransform = false;
136
128
  const transformOptions = {};
@@ -3,8 +3,8 @@ const host = null;
3
3
  const https = undefined;
4
4
  const open = false;
5
5
  const proxy = false; // Host: your.project.dev
6
-
7
- const serveStatic = [// {
6
+ const serveStatic = [
7
+ // {
8
8
  // route: '/public',
9
9
  // dir: '/path/to/public'
10
10
  // }
@@ -14,23 +14,20 @@ const serveStatic = [// {
14
14
  *
15
15
  * @reference https://browsersync.io/docs/options
16
16
  */
17
-
18
17
  const options = {};
19
- const next = NOOP; // Middleware
20
-
18
+ const next = NOOP;
19
+ // Middleware
21
20
  /**
22
21
  * A development middleware for webpack
23
22
  *
24
23
  * @reference https://github.com/webpack/webpack-dev-middleware#options
25
24
  */
26
-
27
25
  const devOptions = {};
28
26
  /**
29
27
  * Webpack hot reloading
30
28
  *
31
29
  * @reference https://github.com/webpack-contrib/webpack-hot-middleware#config
32
30
  */
33
-
34
31
  const hotOptions = {
35
32
  reload: true,
36
33
  noInfo: true
@@ -66,17 +63,14 @@ const hotOptions = {
66
63
  * }
67
64
  * }]
68
65
  */
69
-
70
66
  const proxyConfig = false;
71
67
  /**
72
68
  * HTML 5 history API
73
69
  *
74
70
  * @reference https://github.com/bripkens/connect-history-api-fallback#options
75
71
  */
76
-
77
72
  const historyOptions = false;
78
73
  const middlewares = []; // Extra middlewares for server
79
-
80
74
  const extraWatchFiles = []; // Just for `mix.serve`
81
75
 
82
76
  export default {
@@ -7,7 +7,6 @@ const entry = '';
7
7
  *
8
8
  * @reference https://cssnano.co/docs/optimisations/
9
9
  */
10
-
11
10
  const options = {
12
11
  discardComments: {
13
12
  removeAll: true
@@ -18,21 +17,18 @@ const options = {
18
17
  *
19
18
  * @reference https://github.com/sass/node-sass#options
20
19
  */
21
-
22
20
  const sassOptions = {};
23
21
  /**
24
22
  * Less plugin for Gulp
25
23
  *
26
24
  * @reference https://github.com/gulp-community/gulp-less#options
27
25
  */
28
-
29
26
  const lessOptions = {};
30
27
  /**
31
28
  * PostCSS Preset Env
32
29
  *
33
30
  * @reference https://github.com/csstools/postcss-preset-env#options
34
31
  */
35
-
36
32
  const postcssEnvOptions = {
37
33
  stage: 0,
38
34
  autoprefixer: {
@@ -44,19 +40,15 @@ const postcssEnvOptions = {
44
40
  *
45
41
  * @reference https://www.postcss.parts/
46
42
  */
47
-
48
- const postcssPlugins = []; // CSS Sprites
49
-
43
+ const postcssPlugins = [];
44
+ // CSS Sprites
50
45
  const imageBasePath = '../'; // Relative to css file
51
-
52
46
  const sprites = []; // Image folders
53
-
54
47
  const spriteRetina = false;
55
48
  /**
56
49
  * Spritesmith parameters
57
50
  * @reference https://github.com/twolfson/gulp.spritesmith#spritesmithparams
58
51
  */
59
-
60
52
  const spriteParams = {};
61
53
  export default {
62
54
  extname,
package/lib/hello.js CHANGED
@@ -12,10 +12,8 @@ global.BalmJS = {
12
12
  emitter: new EventEmitter(),
13
13
  useCacache: +versions.node.split('.')[0] >= 18
14
14
  };
15
-
16
15
  if (!BalmJS.useCacache) {
17
16
  BalmJS.loading = true;
18
17
  cacheBalmCore();
19
18
  }
20
-
21
19
  export default balmCorePkg.version;