balm-core 3.26.3 → 3.28.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 (114) hide show
  1. package/lib/balm.js +0 -22
  2. package/lib/bootstrap/check_config.js +4 -10
  3. package/lib/bootstrap/index.js +17 -28
  4. package/lib/bundler/esbuild/build.js +0 -4
  5. package/lib/bundler/esbuild/index.js +0 -5
  6. package/lib/bundler/esbuild/transform.js +0 -33
  7. package/lib/bundler/rollup/build.js +2 -17
  8. package/lib/bundler/rollup/entry.js +2 -6
  9. package/lib/bundler/rollup/index.js +0 -32
  10. package/lib/bundler/rollup/output.js +0 -6
  11. package/lib/bundler/rollup/plugins.js +0 -11
  12. package/lib/bundler/webpack/config/common.js +3 -26
  13. package/lib/bundler/webpack/config/dev.js +2 -6
  14. package/lib/bundler/webpack/config/index.js +0 -5
  15. package/lib/bundler/webpack/config/prod.js +2 -17
  16. package/lib/bundler/webpack/entry.js +12 -23
  17. package/lib/bundler/webpack/index.js +5 -14
  18. package/lib/bundler/webpack/loaders.js +0 -10
  19. package/lib/bundler/webpack/output.js +0 -7
  20. package/lib/bundler/webpack/rules/babel.js +3 -7
  21. package/lib/bundler/webpack/rules/css.js +2 -7
  22. package/lib/bundler/webpack/rules/html.js +0 -3
  23. package/lib/bundler/webpack/rules/url.js +2 -6
  24. package/lib/config/assets.js +0 -5
  25. package/lib/config/env.js +0 -2
  26. package/lib/config/globals.js +3 -10
  27. package/lib/config/html.js +0 -1
  28. package/lib/config/index.js +0 -21
  29. package/lib/config/logs.js +0 -1
  30. package/lib/config/paths.js +2 -3
  31. package/lib/config/pwa.js +0 -3
  32. package/lib/config/roots.js +0 -3
  33. package/lib/config/scripts.js +24 -32
  34. package/lib/config/server.js +4 -11
  35. package/lib/config/styles.js +2 -10
  36. package/lib/config/version.js +0 -3
  37. package/lib/hello.js +0 -5
  38. package/lib/hooks/index.js +20 -27
  39. package/lib/hooks/maker.js +2 -22
  40. package/lib/index.js +0 -5
  41. package/lib/middlewares/history.js +0 -3
  42. package/lib/middlewares/index.js +0 -9
  43. package/lib/middlewares/proxy.js +1 -9
  44. package/lib/middlewares/webpack.js +0 -6
  45. package/lib/plugins/htmlmin.js +1 -7
  46. package/lib/plugins/imagemin.js +1 -29
  47. package/lib/plugins/index.js +0 -12
  48. package/lib/plugins/jsmin.js +0 -20
  49. package/lib/plugins/less.js +7 -19
  50. package/lib/plugins/plumber.js +5 -24
  51. package/lib/plugins/postcss-plugins.js +0 -9
  52. package/lib/plugins/postcss.js +9 -27
  53. package/lib/plugins/rename.js +3 -16
  54. package/lib/plugins/replace.js +4 -26
  55. package/lib/plugins/sass.js +31 -45
  56. package/lib/plugins/sftp.js +36 -69
  57. package/lib/tasks/default.js +2 -23
  58. package/lib/tasks/foundation/balm.js +0 -19
  59. package/lib/tasks/foundation/balm_style.js +2 -27
  60. package/lib/tasks/foundation/index.js +0 -5
  61. package/lib/tasks/index.js +7 -16
  62. package/lib/tasks/private/build.js +0 -17
  63. package/lib/tasks/private/cache.js +0 -19
  64. package/lib/tasks/private/clean.js +0 -33
  65. package/lib/tasks/private/end.js +0 -23
  66. package/lib/tasks/private/extra.js +4 -29
  67. package/lib/tasks/private/font.js +0 -17
  68. package/lib/tasks/private/image.js +1 -28
  69. package/lib/tasks/private/lint.js +0 -17
  70. package/lib/tasks/private/media.js +0 -17
  71. package/lib/tasks/private/modernizr.js +0 -39
  72. package/lib/tasks/private/pwa-cache.js +0 -21
  73. package/lib/tasks/private/script.js +0 -13
  74. package/lib/tasks/private/sprite.js +3 -37
  75. package/lib/tasks/private/start.js +0 -23
  76. package/lib/tasks/private/style.js +0 -14
  77. package/lib/tasks/private/workbox-sw.js +0 -17
  78. package/lib/tasks/public/copy.js +0 -17
  79. package/lib/tasks/public/esbuild.js +0 -19
  80. package/lib/tasks/public/ftp.js +1 -22
  81. package/lib/tasks/public/html.js +0 -31
  82. package/lib/tasks/public/jsmin.js +0 -17
  83. package/lib/tasks/public/less.js +0 -17
  84. package/lib/tasks/public/postcss.js +0 -16
  85. package/lib/tasks/public/publish.js +3 -29
  86. package/lib/tasks/public/pwa.js +1 -30
  87. package/lib/tasks/public/remove.js +2 -34
  88. package/lib/tasks/public/replace.js +0 -18
  89. package/lib/tasks/public/rollup.js +0 -20
  90. package/lib/tasks/public/sass.js +0 -17
  91. package/lib/tasks/public/server.js +5 -44
  92. package/lib/tasks/public/url.js +0 -24
  93. package/lib/tasks/public/version.js +0 -17
  94. package/lib/tasks/public/webpack.js +2 -27
  95. package/lib/tasks/public/zip.js +0 -18
  96. package/lib/utilities/address.js +5 -21
  97. package/lib/utilities/cache-core.js +5 -21
  98. package/lib/utilities/color.js +0 -8
  99. package/lib/utilities/compiling.js +0 -15
  100. package/lib/utilities/detect-port.js +6 -26
  101. package/lib/utilities/escape-string-regexp.js +3 -5
  102. package/lib/utilities/file.js +3 -23
  103. package/lib/utilities/index.js +0 -5
  104. package/lib/utilities/loading.js +0 -23
  105. package/lib/utilities/logger.js +0 -21
  106. package/lib/utilities/merge-stream.js +0 -11
  107. package/lib/utilities/namespace.js +0 -4
  108. package/lib/utilities/public-url.js +9 -12
  109. package/lib/utilities/replacestream.js +5 -31
  110. package/lib/utilities/typeof.js +0 -2
  111. package/lib/utilities/utils.js +2 -12
  112. package/package.json +12 -12
  113. package/tslib/bundler/esbuild/transform.js +26 -19
  114. package/tslib/bundler/rollup/index.js +12 -5
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _plugins = require("./plugins");
9
-
10
8
  function setOutput(outputOptions) {
11
9
  var outputPlugins = (0, _plugins.getOutputPlugins)(outputOptions);
12
10
  outputOptions = Object.assign({}, BalmJS.config.scripts.outputOptions, outputOptions);
13
11
  outputOptions.plugins = outputPlugins;
14
-
15
12
  if (outputOptions.dir) {
16
13
  outputOptions.dir = BalmJS.file.absPath(outputOptions.dir);
17
14
  } else {
18
15
  outputOptions.file = BalmJS.file.absPath(outputOptions.file);
19
16
  }
20
-
21
17
  return outputOptions;
22
18
  }
23
-
24
19
  function getOutput(outputOptions) {
25
20
  var options = Array.isArray(outputOptions) ? outputOptions.map(function (outputOption) {
26
21
  return setOutput(outputOption);
@@ -30,6 +25,5 @@ function getOutput(outputOptions) {
30
25
  });
31
26
  return options;
32
27
  }
33
-
34
28
  var _default = getOutput;
35
29
  exports["default"] = _default;
@@ -1,45 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.getInputPlugins = getInputPlugins;
9
8
  exports.getOutputPlugins = getOutputPlugins;
10
-
11
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
-
13
10
  function getInputPlugins(customInputOptions) {
14
11
  var inputOptions = BalmJS.config.scripts.inputOptions;
15
12
  var inputPlugins = [];
16
-
17
13
  if (inputOptions.plugins) {
18
14
  inputPlugins.push.apply(inputPlugins, (0, _toConsumableArray2["default"])(inputOptions.plugins));
19
15
  }
20
-
21
16
  if (customInputOptions.plugins) {
22
17
  inputPlugins.push.apply(inputPlugins, (0, _toConsumableArray2["default"])(customInputOptions.plugins));
23
18
  }
24
-
25
19
  return inputPlugins;
26
20
  }
27
-
28
21
  function getOutputPlugins(customOutputOptions) {
29
22
  var outputOptions = BalmJS.config.scripts.outputOptions;
30
23
  var outputPlugins = [];
31
-
32
24
  if (outputOptions.plugins) {
33
25
  outputPlugins.push.apply(outputPlugins, (0, _toConsumableArray2["default"])(outputOptions.plugins));
34
26
  }
35
-
36
27
  if (BalmJS.config.env.isProd) {
37
28
  outputPlugins.push(require('rollup-plugin-terser').terser(BalmJS.config.scripts.minifyOptions));
38
29
  }
39
-
40
30
  if (customOutputOptions.plugins) {
41
31
  outputPlugins.push.apply(outputPlugins, (0, _toConsumableArray2["default"])(customOutputOptions.plugins));
42
32
  }
43
-
44
33
  return outputPlugins;
45
34
  }
@@ -1,45 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _loaders = _interopRequireDefault(require("../loaders"));
13
-
14
10
  var _constants = require("../../../config/constants");
15
-
16
11
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
17
-
18
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
22
14
  function getDefaultPlugins(webpack, scripts) {
23
- var plugins = [// Moment.js is an extremely popular library that bundles large locale files
15
+ var plugins = [
16
+ // Moment.js is an extremely popular library that bundles large locale files
24
17
  // by default due to how webpack interprets its code. This is a practical
25
18
  // solution that requires the user to opt into importing specific locales.
26
19
  // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
27
20
  // You can remove this if you don't use Moment.js:
28
21
  new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)];
29
-
30
22
  if (scripts.injectHtml) {
31
23
  var HtmlWebpackPlugin = require('html-webpack-plugin');
32
-
33
24
  var isSPA = BalmJS.entries.length < 2;
34
25
  var titles = scripts.htmlPluginOptions.title || ['BalmJS App'];
35
-
36
26
  if (!BalmJS.entries.length) {
37
27
  BalmJS.entries.push({
38
28
  key: 'main',
39
29
  value: "./".concat(BalmJS.file.defaultEntry)
40
30
  });
41
31
  }
42
-
43
32
  BalmJS.entries.forEach(function (entry, index) {
44
33
  var entryName = isSPA ? 'index' : entry.key;
45
34
  var chunks = isSPA ? '?' : [entryName];
@@ -53,15 +42,12 @@ function getDefaultPlugins(webpack, scripts) {
53
42
  plugins.push(new HtmlWebpackPlugin(options));
54
43
  });
55
44
  }
56
-
57
45
  return plugins;
58
46
  }
59
-
60
47
  function getSplitChunks() {
61
48
  var scripts = BalmJS.config.scripts;
62
49
  var jsFolder = BalmJS.config.paths.target.js;
63
50
  var cacheGroups = {};
64
-
65
51
  if (scripts.extractAllVendors) {
66
52
  // All vendors
67
53
  var jsFilename = scripts.useCache ? "".concat(scripts.vendorName, ".").concat(_constants.HASH_NAME_PROD, ".js") : "".concat(scripts.vendorName, ".js");
@@ -71,24 +57,19 @@ function getSplitChunks() {
71
57
  chunks: 'initial',
72
58
  test: /[\\/](node_modules|bower_components)[\\/]/,
73
59
  filename: BalmJS.file.assetsPath("".concat(jsFolder, "/").concat(jsFilename)) // Output: `js/vendor.js`
74
-
75
60
  }
76
61
  };
77
62
  } else if (BalmJS.vendors.length) {
78
63
  // Custom vendors
79
64
  cacheGroups = {};
80
-
81
65
  var _iterator = _createForOfIteratorHelper(BalmJS.vendors),
82
- _step;
83
-
66
+ _step;
84
67
  try {
85
68
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
86
69
  var vendor = _step.value;
87
70
  var cacheGroupKey = vendor.key;
88
71
  var cacheGroupModules = vendor.value.join('|');
89
-
90
72
  var _jsFilename = scripts.useCache ? "".concat(cacheGroupKey, ".").concat(_constants.HASH_NAME_PROD, ".js") : "".concat(cacheGroupKey, ".js");
91
-
92
73
  cacheGroups[cacheGroupKey] = {
93
74
  name: cacheGroupKey,
94
75
  chunks: 'initial',
@@ -104,7 +85,6 @@ function getSplitChunks() {
104
85
  _iterator.f();
105
86
  }
106
87
  }
107
-
108
88
  if (BalmJS.config.env.isProd && BalmJS.config.scripts.extractCss) {
109
89
  // Custom styles in scripts
110
90
  cacheGroups.css = {
@@ -114,12 +94,10 @@ function getSplitChunks() {
114
94
  enforce: true
115
95
  };
116
96
  }
117
-
118
97
  return Object.keys(cacheGroups).length ? {
119
98
  cacheGroups: cacheGroups
120
99
  } : false;
121
100
  }
122
-
123
101
  function getCommonConfig(webpack, scripts) {
124
102
  var splitChunks = getSplitChunks();
125
103
  var optimization = splitChunks ? BalmJS.utils.deepMerge({
@@ -154,6 +132,5 @@ function getCommonConfig(webpack, scripts) {
154
132
  stats: scripts.stats
155
133
  };
156
134
  }
157
-
158
135
  var _default = getCommonConfig;
159
136
  exports["default"] = _default;
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _webpackMerge = _interopRequireDefault(require("webpack-merge"));
11
-
12
9
  var _common = _interopRequireDefault(require("./common"));
13
-
14
10
  function getDevConfig(webpack, scripts) {
15
11
  return (0, _webpackMerge["default"])((0, _common["default"])(webpack, scripts), {
16
12
  mode: 'development',
17
- plugins: [// This is necessary to emit hot updates
13
+ plugins: [
14
+ // This is necessary to emit hot updates
18
15
  new webpack.HotModuleReplacementPlugin()],
19
16
  devtool: scripts.sourceMap || 'cheap-module-eval-source-map'
20
17
  });
21
18
  }
22
-
23
19
  var _default = getDevConfig;
24
20
  exports["default"] = _default;
@@ -1,19 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _dev = _interopRequireDefault(require("./dev"));
11
-
12
9
  var _prod = _interopRequireDefault(require("./prod"));
13
-
14
10
  function getDefaultConfig(webpack, scripts) {
15
11
  return BalmJS.config.env.isProd || scripts.minify || scripts.ie8 ? (0, _prod["default"])(webpack, scripts) : (0, _dev["default"])(webpack, scripts);
16
12
  }
17
-
18
13
  var _default = getDefaultConfig;
19
14
  exports["default"] = _default;
@@ -1,48 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _webpackMerge = _interopRequireDefault(require("webpack-merge"));
13
-
14
10
  var _common = _interopRequireDefault(require("./common"));
15
-
16
11
  var _constants = require("../../../config/constants");
17
-
18
12
  // Run the build command with an extra argument to
19
13
  // View the bundle analyzer report after build finishes:
20
14
  // `npm run prod --report`
21
15
  // Set to `true` or `false` to always turn it on or off
22
16
  var bundleAnalyzerReport = process.env.npm_config_report || false;
23
-
24
17
  var getCssFilename = function getCssFilename() {
25
18
  return "".concat(BalmJS.config.paths.target.css, "/").concat(_constants.ASYNC_SCRIPTS, "/[name].").concat(_constants.HASH_NAME_PROD, ".css");
26
19
  };
27
-
28
20
  function getProdConfig(webpack, scripts) {
29
21
  var TerserPlugin = require('terser-webpack-plugin');
30
-
31
22
  var OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
32
-
33
23
  var safePostCssParser = require('postcss-safe-parser');
34
-
35
24
  var MiniCssExtractPlugin = require('mini-css-extract-plugin');
36
-
37
25
  var webpackBundleAnalyzer = require('webpack-bundle-analyzer');
38
-
39
26
  var shouldUseSourceMap = scripts.sourceMap;
40
27
  var terserOptions = scripts.minifyOptions;
41
-
42
28
  if (scripts.ie8) {
43
29
  terserOptions.ie8 = true;
44
30
  }
45
-
46
31
  return (0, _webpackMerge["default"])((0, _common["default"])(webpack, scripts), {
47
32
  mode: 'production',
48
33
  optimization: {
@@ -70,7 +55,8 @@ function getProdConfig(webpack, scripts) {
70
55
  }
71
56
  })]
72
57
  },
73
- plugins: [// Keep module.id stable when vendor modules does not change
58
+ plugins: [
59
+ // Keep module.id stable when vendor modules does not change
74
60
  new webpack.HashedModuleIdsPlugin()].concat((0, _toConsumableArray2["default"])(scripts.extractCss ? [new MiniCssExtractPlugin({
75
61
  filename: BalmJS.file.assetsPath(getCssFilename()),
76
62
  chunkFilename: BalmJS.file.assetsPath(getCssFilename())
@@ -78,6 +64,5 @@ function getProdConfig(webpack, scripts) {
78
64
  devtool: shouldUseSourceMap ? 'source-map' : false
79
65
  });
80
66
  }
81
-
82
67
  var _default = getProdConfig;
83
68
  exports["default"] = _default;
@@ -1,30 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
10
  var _constants = require("../../config/constants");
15
-
16
11
  var FILENAME_REGEX = new RegExp('[^/]+$', 'i');
17
12
  var HOT_CLIENT = 'webpack-hot-middleware/client';
18
-
19
13
  function initVendors(entries) {
20
14
  var jsVendors = [];
21
15
  var jsEntries = [];
22
-
23
16
  for (var _i = 0, _Object$entries = Object.entries(entries); _i < _Object$entries.length; _i++) {
24
17
  var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
25
- key = _Object$entries$_i[0],
26
- value = _Object$entries$_i[1];
27
-
18
+ key = _Object$entries$_i[0],
19
+ value = _Object$entries$_i[1];
28
20
  if (BalmJS.utils.isArray(value)) {
29
21
  jsVendors.push({
30
22
  key: key,
@@ -37,12 +29,11 @@ function initVendors(entries) {
37
29
  });
38
30
  }
39
31
  }
40
-
41
32
  BalmJS.vendors = jsVendors;
42
33
  BalmJS.entries = jsEntries;
43
- } // Relative path
44
-
34
+ }
45
35
 
36
+ // Relative path
46
37
  function getEntry(input, scripts) {
47
38
  var webpackEntries = {};
48
39
  var hotOptions = Object.assign({}, BalmJS.config.server.hotOptions, {
@@ -52,22 +43,22 @@ function getEntry(input, scripts) {
52
43
  return option.join('=');
53
44
  }).join('&');
54
45
  var useHMR = BalmJS.config.server.useHMR;
55
-
56
46
  if (BalmJS.utils.isObject(input)) {
57
47
  initVendors(input);
58
-
59
48
  for (var _i2 = 0, _Object$entries2 = Object.entries(input); _i2 < _Object$entries2.length; _i2++) {
60
49
  var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i2], 2),
61
- key = _Object$entries2$_i[0],
62
- value = _Object$entries2$_i[1];
63
-
64
- var isVendor = BalmJS.utils.isArray(value); // Key
50
+ key = _Object$entries2$_i[0],
51
+ value = _Object$entries2$_i[1];
52
+ var isVendor = BalmJS.utils.isArray(value);
65
53
 
66
- var entryKey = isVendor ? path.join(scripts.vendorName, key) : path.join(key); // Value
54
+ // Key
55
+ var entryKey = isVendor ? path.join(scripts.vendorName, key) : path.join(key);
67
56
 
57
+ // Value
68
58
  var hotValue = BalmJS.utils.isString(value) ? [value, HMR] : [].concat((0, _toConsumableArray2["default"])(value), [HMR]);
69
- var entryValue = useHMR ? hotValue : value; // Result
59
+ var entryValue = useHMR ? hotValue : value;
70
60
 
61
+ // Result
71
62
  if (!isVendor) {
72
63
  webpackEntries[entryKey] = entryValue;
73
64
  }
@@ -84,12 +75,10 @@ function getEntry(input, scripts) {
84
75
  } else {
85
76
  BalmJS.logger.warn('webpack entry', '`scripts.entry` must be `string | array | object`');
86
77
  }
87
-
88
78
  BalmJS.logger.debug('webpack entry', webpackEntries, {
89
79
  pre: true
90
80
  });
91
81
  return webpackEntries;
92
82
  }
93
-
94
83
  var _default = getEntry;
95
84
  exports["default"] = _default;
@@ -1,27 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.webpack = void 0;
9
8
  exports.webpackConfig = webpackConfig;
10
-
11
9
  var _webpackMerge = _interopRequireDefault(require("webpack-merge"));
12
-
13
10
  var _entry = _interopRequireDefault(require("./entry"));
14
-
15
11
  var _output = _interopRequireDefault(require("./output"));
16
-
17
12
  var _config = _interopRequireDefault(require("./config"));
18
-
19
13
  var webpackModule = process.env.WEBPACK || require.resolve('webpack');
20
-
21
14
  var webpack = require(webpackModule);
22
-
23
15
  exports.webpack = webpack;
24
-
25
16
  function webpackConfig(input, output) {
26
17
  var customWebpackOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27
18
  var isHook = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -37,14 +28,13 @@ function webpackConfig(input, output) {
37
28
  }, {
38
29
  pre: true
39
30
  });
40
-
41
31
  if (scripts.externals) {
42
32
  baseConfig.externals = scripts.externals;
43
33
  }
34
+ var defaultConfig = (0, _config["default"])(webpack, scripts);
44
35
 
45
- var defaultConfig = (0, _config["default"])(webpack, scripts); // Some libraries import Node modules but don't use them in the browser.
36
+ // Some libraries import Node modules but don't use them in the browser.
46
37
  // Tell webpack to provide empty mocks for them so importing them works.
47
-
48
38
  if (defaultConfig.target === 'web') {
49
39
  defaultConfig.node = {
50
40
  module: 'empty',
@@ -57,10 +47,11 @@ function webpackConfig(input, output) {
57
47
  child_process: 'empty'
58
48
  };
59
49
  }
60
-
61
50
  var configuration = (0, _webpackMerge["default"])(baseConfig, defaultConfig, scripts.webpackOptions, customWebpackOptions);
62
51
  BalmJS.logger.success('webpack configuration', configuration, {
63
52
  pre: true
64
53
  });
65
54
  return configuration;
66
- } // export default webpackConfig;
55
+ }
56
+
57
+ // export default webpackConfig;
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _webpackMerge = _interopRequireDefault(require("webpack-merge"));
11
-
12
9
  var _requireDir = _interopRequireDefault(require("require-dir"));
13
-
14
10
  var LOADERS = (0, _requireDir["default"])('./rules');
15
-
16
11
  function getLoaders(customLoaders) {
17
12
  var enableDefaultLoaders = Object.assign({
18
13
  html: true,
@@ -24,15 +19,12 @@ function getLoaders(customLoaders) {
24
19
  return value;
25
20
  });
26
21
  var defaultLoaders = [];
27
-
28
22
  if (useDefaultLoaders) {
29
23
  Object.values(LOADERS).forEach(function (Loader) {
30
24
  var DefaultLoader = Loader["default"];
31
25
  var key = DefaultLoader.name.replace('Loader', '');
32
-
33
26
  if (enableDefaultLoaders[key]) {
34
27
  var loader = DefaultLoader();
35
-
36
28
  if (BalmJS.utils.isArray(loader)) {
37
29
  defaultLoaders = defaultLoaders.concat(loader);
38
30
  } else {
@@ -41,7 +33,6 @@ function getLoaders(customLoaders) {
41
33
  }
42
34
  });
43
35
  }
44
-
45
36
  var result = (0, _webpackMerge["default"])({
46
37
  module: {
47
38
  rules: defaultLoaders
@@ -57,6 +48,5 @@ function getLoaders(customLoaders) {
57
48
  });
58
49
  return defaultModule.rules;
59
50
  }
60
-
61
51
  var _default = getLoaders;
62
52
  exports["default"] = _default;
@@ -4,26 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _constants = require("../../config/constants");
9
-
10
8
  function getFilename(scripts) {
11
9
  var isChunk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12
10
  var filename;
13
-
14
11
  if (isChunk) {
15
12
  filename = BalmJS.config.env.isProd ? "[name].".concat(_constants.HASH_NAME_PROD) : '[name]';
16
13
  } else {
17
14
  filename = scripts.useCache ? "[name].".concat(_constants.HASH_NAME_PROD) : '[name]';
18
15
  }
19
-
20
16
  return "".concat(filename, ".js");
21
17
  }
22
-
23
18
  function getOutput(output, scripts) {
24
19
  var isHook = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
25
20
  var outputPath = output || BalmJS.config.dest.base; // Absolute path
26
-
27
21
  var jsFolder = BalmJS.config.paths.target.js;
28
22
  var jsFilename = getFilename(scripts);
29
23
  var jsChunkFilename = getFilename(scripts, true);
@@ -44,6 +38,5 @@ function getOutput(output, scripts) {
44
38
  libraryTarget: scripts.libraryTarget
45
39
  }, customLibraryConfig, miniprogramConfig);
46
40
  }
47
-
48
41
  var _default = getOutput;
49
42
  exports["default"] = _default;
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _regex = require("../config/regex");
13
-
14
10
  function jsLoader() {
15
- var options = Object.assign({}, BalmJS.config.scripts.babelLoaderOptions); // Process application JS with Babel.
16
- // The preset includes JSX, Flow, TypeScript, and some ESnext features.
11
+ var options = Object.assign({}, BalmJS.config.scripts.babelLoaderOptions);
17
12
 
13
+ // Process application JS with Babel.
14
+ // The preset includes JSX, Flow, TypeScript, and some ESnext features.
18
15
  return {
19
16
  test: _regex.jsRegex,
20
17
  include: [BalmJS.file.absPaths(BalmJS.config.src.js)].concat((0, _toConsumableArray2["default"])(BalmJS.config.scripts.includeJsResource)),
@@ -22,6 +19,5 @@ function jsLoader() {
22
19
  options: options
23
20
  };
24
21
  }
25
-
26
22
  var _default = jsLoader;
27
23
  exports["default"] = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _regex = require("../config/regex");
9
-
10
8
  function cssLoader() {
11
9
  var styleLoader = {
12
10
  loader: require.resolve('style-loader'),
@@ -14,10 +12,8 @@ function cssLoader() {
14
12
  esModule: BalmJS.config.scripts.useEsModule
15
13
  }
16
14
  };
17
-
18
15
  if (BalmJS.config.env.inSSR) {
19
16
  var loadersCount = BalmJS.config.scripts.loaders.length;
20
-
21
17
  for (var i = 0; i < loadersCount; i++) {
22
18
  if (BalmJS.config.scripts.loaders[i].loader === 'vue-loader') {
23
19
  styleLoader = 'vue-style-loader';
@@ -25,15 +21,15 @@ function cssLoader() {
25
21
  }
26
22
  }
27
23
  }
24
+ var sourceMap = BalmJS.config.env.isProd ? BalmJS.config.scripts.sourceMap : BalmJS.config.env.isDev;
28
25
 
29
- var sourceMap = BalmJS.config.env.isProd ? BalmJS.config.scripts.sourceMap : BalmJS.config.env.isDev; // "postcss" loader applies autoprefixer to our CSS.
26
+ // "postcss" loader applies autoprefixer to our CSS.
30
27
  // "css" loader resolves paths in CSS and adds assets as dependencies.
31
28
  // "style" loader turns CSS into JS modules that inject <style> tags.
32
29
  // In production, we use MiniCSSExtractPlugin to extract that CSS
33
30
  // to a file, but in development "style" loader enables hot editing
34
31
  // of CSS.
35
32
  // By default we support CSS Modules with the extension .module.css
36
-
37
33
  return {
38
34
  test: _regex.cssRegex,
39
35
  exclude: _regex.cssModuleRegex,
@@ -68,6 +64,5 @@ function cssLoader() {
68
64
  sideEffects: true
69
65
  };
70
66
  }
71
-
72
67
  var _default = cssLoader;
73
68
  exports["default"] = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _regex = require("../config/regex");
9
-
10
8
  function htmlLoader() {
11
9
  var options = Object.assign({
12
10
  minimize: {
@@ -20,6 +18,5 @@ function htmlLoader() {
20
18
  options: options
21
19
  };
22
20
  }
23
-
24
21
  var _default = htmlLoader;
25
22
  exports["default"] = _default;
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _constants = require("../../../config/constants");
9
-
10
8
  var _regex = require("../config/regex");
11
-
12
9
  var imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');
13
-
14
10
  function urlLoader() {
15
11
  var PATHNAME = "".concat(BalmJS.config.paths.target.js, "/").concat(_constants.STATIC_ASSETS, "/");
16
12
  var FILENAME = "[name].".concat(_constants.HASH_NAME_DEV, ".[ext]");
@@ -20,7 +16,8 @@ function urlLoader() {
20
16
  name: BalmJS.file.assetsPath("".concat(PATHNAME).concat(FILENAME)),
21
17
  esModule: BalmJS.config.scripts.useEsModule
22
18
  }, BalmJS.config.scripts.urlLoaderOptions);
23
- return [// "url" loader works like "file" loader except that it embeds assets
19
+ return [
20
+ // "url" loader works like "file" loader except that it embeds assets
24
21
  // smaller than specified limit in bytes as data URLs to avoid requests.
25
22
  // A missing `test` is equivalent to a match.
26
23
  {
@@ -38,6 +35,5 @@ function urlLoader() {
38
35
  options: options
39
36
  }];
40
37
  }
41
-
42
38
  var _default = urlLoader;
43
39
  exports["default"] = _default;