balm-core 3.26.2 → 3.27.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 +9 -9
  113. package/tslib/bundler/esbuild/transform.js +26 -19
  114. package/tslib/bundler/rollup/index.js +12 -5
@@ -1,66 +1,53 @@
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 _escapeStringRegexp = _interopRequireDefault(require("./escape-string-regexp"));
11
-
12
9
  function createReplaceFn(replace, isRegEx) {
13
10
  function regexReplaceFunction() {
14
- var newReplace = replace; // ability to us $1 with captures
11
+ var newReplace = replace;
12
+
13
+ // ability to us $1 with captures
15
14
  // Start at 1 and end at length - 2 to avoid the match parameter and offset
16
15
  // And string parameters
17
-
18
16
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
17
  args[_key] = arguments[_key];
20
18
  }
21
-
22
19
  var paramLength = [].concat(args).length - 2;
23
-
24
20
  for (var i = 1; i < paramLength; i++) {
25
21
  newReplace = newReplace.replace(new RegExp("\\$".concat(i), 'g'), [].concat(args)[i] || '');
26
22
  }
27
-
28
23
  return newReplace;
29
24
  }
30
-
31
25
  if (!(replace instanceof Function)) {
32
26
  return isRegEx ? regexReplaceFunction : function () {
33
27
  return replace;
34
28
  };
35
29
  }
36
-
37
30
  return replace;
38
31
  }
39
-
40
32
  function matchFromRegex(regex, options) {
41
33
  if (options.regExpFlags) {
42
34
  regex = new RegExp(regex.source, options.regExpFlags);
43
- } // If there is no global flag then there can only be one match
44
-
35
+ }
45
36
 
37
+ // If there is no global flag then there can only be one match
46
38
  if (!regex.global) {
47
39
  options.limit = 1;
48
40
  }
49
-
50
41
  return regex;
51
42
  }
52
-
53
43
  function matchFromString(str, options) {
54
44
  if (options.regExpFlags) {
55
45
  return new RegExp((0, _escapeStringRegexp["default"])(str), options.regExpFlags);
56
46
  }
57
-
58
47
  return new RegExp((0, _escapeStringRegexp["default"])(str), options.ignoreCase ? 'gmi' : 'gm');
59
48
  }
60
-
61
49
  function replaceStream(search, replace, opts) {
62
50
  var readableStream = require('readable-stream');
63
-
64
51
  var options = Object.assign({
65
52
  limit: Infinity,
66
53
  encoding: 'utf8',
@@ -71,33 +58,27 @@ function replaceStream(search, replace, opts) {
71
58
  var isRegex = search instanceof RegExp;
72
59
  var replaceFn = createReplaceFn(replace, isRegex);
73
60
  var match;
74
-
75
61
  if (isRegex) {
76
62
  match = matchFromRegex(search, options);
77
63
  } else {
78
64
  match = matchFromString(search, options);
79
65
  options.maxMatchLen = search.length;
80
66
  }
81
-
82
67
  function getDataToAppend(before, match) {
83
68
  var dataToAppend = before;
84
69
  totalMatches++;
85
70
  dataToAppend += isRegex ? replaceFn.apply(this, match.concat([match.index.toString(), match.input])) : replaceFn(match[0]);
86
71
  return dataToAppend;
87
72
  }
88
-
89
73
  function getDataToQueue(matchCount, haystack, rewritten, lastPos) {
90
74
  if (matchCount > 0) {
91
75
  if (haystack.length > tail.length) {
92
76
  return rewritten + haystack.slice(lastPos, haystack.length - tail.length);
93
77
  }
94
-
95
78
  return rewritten;
96
79
  }
97
-
98
80
  return haystack.slice(0, haystack.length - tail.length);
99
81
  }
100
-
101
82
  function transform(chunk, encoding, callback) {
102
83
  var matches;
103
84
  var lastPos = 0;
@@ -105,13 +86,11 @@ function replaceStream(search, replace, opts) {
105
86
  var rewritten = '';
106
87
  var haystack = "".concat(tail).concat(chunk.toString(options.encoding));
107
88
  tail = '';
108
-
109
89
  while (totalMatches < options.limit && (matches = match.exec(haystack)) !== null) {
110
90
  matchCount++;
111
91
  var before = haystack.slice(lastPos, matches.index);
112
92
  var regexMatch = matches;
113
93
  lastPos = matches.index + regexMatch[0].length;
114
-
115
94
  if (lastPos > haystack.length && regexMatch[0].length < options.maxMatchLen) {
116
95
  tail = regexMatch[0];
117
96
  } else {
@@ -119,25 +98,20 @@ function replaceStream(search, replace, opts) {
119
98
  rewritten += dataToAppend;
120
99
  }
121
100
  }
122
-
123
101
  if (tail.length < 1) tail = haystack.slice(lastPos).length > options.maxMatchLen ? haystack.slice(lastPos).slice(0 - options.maxMatchLen) : haystack.slice(lastPos);
124
102
  var dataToQueue = getDataToQueue(matchCount, haystack, rewritten, lastPos);
125
103
  callback(null, dataToQueue);
126
104
  }
127
-
128
105
  function flush(callback) {
129
106
  if (tail) {
130
107
  this.push(tail);
131
108
  }
132
-
133
109
  callback();
134
110
  }
135
-
136
111
  return new readableStream.Transform({
137
112
  transform: transform,
138
113
  flush: flush
139
114
  });
140
115
  }
141
-
142
116
  var _default = replaceStream;
143
117
  exports["default"] = _default;
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var reTypeOf = /(?:^\[object\s(.*?)\]$)/;
8
-
9
8
  function getType(obj) {
10
9
  return Object.prototype.toString.call(obj).replace(reTypeOf, '$1').toLowerCase();
11
10
  }
12
-
13
11
  var _default = getType;
14
12
  exports["default"] = _default;
@@ -1,34 +1,27 @@
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _typeof = _interopRequireDefault(require("./typeof"));
13
-
14
10
  function isString(str) {
15
11
  return (0, _typeof["default"])(str) === 'string';
16
12
  }
17
-
18
13
  function isObject(obj) {
19
14
  return (0, _typeof["default"])(obj) === 'object';
20
15
  }
21
-
22
16
  function isArray(arr) {
23
17
  return Array.isArray(arr);
24
18
  }
25
-
26
19
  function isFunction(fn) {
27
20
  var type = (0, _typeof["default"])(fn);
28
21
  return type === 'function' || type === 'generatorfunction';
29
- } // Deep merge two objects
30
-
22
+ }
31
23
 
24
+ // Deep merge two objects
32
25
  function deepMerge(target, source) {
33
26
  if (isObject(target) && isObject(source)) {
34
27
  Object.keys(source).forEach(function (key) {
@@ -36,17 +29,14 @@ function deepMerge(target, source) {
36
29
  if (!target[key]) {
37
30
  Object.assign(target, (0, _defineProperty2["default"])({}, key, {}));
38
31
  }
39
-
40
32
  deepMerge(target[key], source[key]);
41
33
  } else {
42
34
  Object.assign(target, (0, _defineProperty2["default"])({}, key, source[key]));
43
35
  }
44
36
  });
45
37
  }
46
-
47
38
  return target;
48
39
  }
49
-
50
40
  var _default = {
51
41
  getType: _typeof["default"],
52
42
  isString: isString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balm-core",
3
- "version": "3.26.2",
3
+ "version": "3.27.0",
4
4
  "description": "BalmJS compiler core",
5
5
  "keywords": [
6
6
  "balm",
@@ -43,7 +43,7 @@
43
43
  "ansi-colors": "^4.1.3",
44
44
  "async": "^3.2.4",
45
45
  "autoprefixer": "9",
46
- "babel-loader": "^8.2.5",
46
+ "babel-loader": "8",
47
47
  "browser-sync": "^2.27.10",
48
48
  "connect-history-api-fallback": "^2.0.0",
49
49
  "css-loader": "5",
@@ -54,7 +54,7 @@
54
54
  "file-loader": "^6.2.0",
55
55
  "gulp-eslint": "^6.0.0",
56
56
  "gulp-if": "^3.0.0",
57
- "gulp-load-plugins": "^2.0.7",
57
+ "gulp-load-plugins": "^2.0.8",
58
58
  "gulp-rev-all": "^3.0.0",
59
59
  "gulp-rev-delete-original": "^0.2.3",
60
60
  "gulp-size": "3",
@@ -83,23 +83,23 @@
83
83
  "readable-stream": "3",
84
84
  "replace-ext": "^2.0.0",
85
85
  "require-dir": "^1.2.0",
86
- "rollup": "^2.68.0",
86
+ "rollup": "2",
87
87
  "rollup-plugin-terser": "^7.0.2",
88
88
  "sass": "1.39.2",
89
89
  "ssh2": "0.8.9",
90
90
  "strip-ansi": "6",
91
91
  "style-loader": "2",
92
- "terser": "^5.14.2",
92
+ "terser": "^5.15.1",
93
93
  "terser-webpack-plugin": "4",
94
94
  "through2": "^4.0.2",
95
95
  "through2-concurrent": "^2.0.0",
96
- "tslib": "^2.4.0",
96
+ "tslib": "^2.4.1",
97
97
  "url-loader": "^4.1.1",
98
98
  "vinyl-sourcemaps-apply": "^0.2.1",
99
99
  "webpack": "4",
100
- "webpack-bundle-analyzer": "^4.5.0",
100
+ "webpack-bundle-analyzer": "^4.7.0",
101
101
  "webpack-dev-middleware": "3",
102
- "webpack-hot-middleware": "^2.25.2",
102
+ "webpack-hot-middleware": "^2.25.3",
103
103
  "webpack-merge": "^5.8.0",
104
104
  "workbox-build": "^6.5.4"
105
105
  },
@@ -117,5 +117,5 @@
117
117
  "engines": {
118
118
  "node": ">=10.13.0"
119
119
  },
120
- "gitHead": "234b36e71614347fa6357dbd0c69b38a7823b0c7"
120
+ "gitHead": "3c686da4cd110e6984debbd6c1708a3d9de66d27"
121
121
  }
@@ -12,34 +12,41 @@ const esTransform = (entryPoints, output, customTransformOptions, callback) => {
12
12
  : {};
13
13
  const options = Object.assign(transformOptions, BalmJS.config.scripts.transformOptions, customTransformOptions);
14
14
  (async () => {
15
- var e_1, _a;
15
+ var _a, e_1, _b, _c;
16
16
  try {
17
17
  try {
18
- for (var entryPoints_1 = tslib_1.__asyncValues(entryPoints), entryPoints_1_1; entryPoints_1_1 = await entryPoints_1.next(), !entryPoints_1_1.done;) {
19
- const entryPoint = entryPoints_1_1.value;
20
- build.input = BalmJS.file.absPath(entryPoint);
21
- BalmJS.logger.debug('esbuild bundler - transform', {
22
- input: build.input,
23
- output: build.output
24
- }, {
25
- pre: true
26
- });
27
- const filename = entryPoint.split('/').pop();
28
- if (filename && fs_1.default.existsSync(build.input)) {
29
- const inputCode = fs_1.default.readFileSync(build.input, 'utf8');
30
- const result = await require('esbuild').transform(inputCode, options);
31
- fs_1.default.mkdirSync(build.output, { recursive: true });
32
- fs_1.default.writeFileSync(path.join(build.output, filename), result.code);
18
+ for (var _d = true, entryPoints_1 = tslib_1.__asyncValues(entryPoints), entryPoints_1_1; entryPoints_1_1 = await entryPoints_1.next(), _a = entryPoints_1_1.done, !_a;) {
19
+ _c = entryPoints_1_1.value;
20
+ _d = false;
21
+ try {
22
+ const entryPoint = _c;
23
+ build.input = BalmJS.file.absPath(entryPoint);
24
+ BalmJS.logger.debug('esbuild bundler - transform', {
25
+ input: build.input,
26
+ output: build.output
27
+ }, {
28
+ pre: true
29
+ });
30
+ const filename = entryPoint.split('/').pop();
31
+ if (filename && fs_1.default.existsSync(build.input)) {
32
+ const inputCode = fs_1.default.readFileSync(build.input, 'utf8');
33
+ const result = await require('esbuild').transform(inputCode, options);
34
+ fs_1.default.mkdirSync(build.output, { recursive: true });
35
+ fs_1.default.writeFileSync(path.join(build.output, filename), result.code);
36
+ }
37
+ else {
38
+ BalmJS.logger.warn('esbuild', `Invalid entry point: ${entryPoint}`);
39
+ }
33
40
  }
34
- else {
35
- BalmJS.logger.warn('esbuild', `Invalid entry point: ${entryPoint}`);
41
+ finally {
42
+ _d = true;
36
43
  }
37
44
  }
38
45
  }
39
46
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
40
47
  finally {
41
48
  try {
42
- if (entryPoints_1_1 && !entryPoints_1_1.done && (_a = entryPoints_1.return)) await _a.call(entryPoints_1);
49
+ if (!_d && !_a && (_b = entryPoints_1.return)) await _b.call(entryPoints_1);
43
50
  }
44
51
  finally { if (e_1) throw e_1.error; }
45
52
  }
@@ -5,7 +5,7 @@ const entry_1 = tslib_1.__importDefault(require("./entry"));
5
5
  const output_1 = tslib_1.__importDefault(require("./output"));
6
6
  const build_1 = tslib_1.__importDefault(require("./build"));
7
7
  const buildLibrary = async (inputOptions, outputOptions) => {
8
- var e_1, _a;
8
+ var _a, e_1, _b, _c;
9
9
  const rollup = require('rollup');
10
10
  inputOptions = (0, entry_1.default)(inputOptions);
11
11
  outputOptions = (0, output_1.default)(outputOptions);
@@ -15,15 +15,22 @@ const buildLibrary = async (inputOptions, outputOptions) => {
15
15
  const bundle = await rollup.rollup(rollupOptions);
16
16
  if (Array.isArray(outputOptions)) {
17
17
  try {
18
- for (var outputOptions_1 = tslib_1.__asyncValues(outputOptions), outputOptions_1_1; outputOptions_1_1 = await outputOptions_1.next(), !outputOptions_1_1.done;) {
19
- const outputOption = outputOptions_1_1.value;
20
- await (0, build_1.default)(bundle, outputOption);
18
+ for (var _d = true, outputOptions_1 = tslib_1.__asyncValues(outputOptions), outputOptions_1_1; outputOptions_1_1 = await outputOptions_1.next(), _a = outputOptions_1_1.done, !_a;) {
19
+ _c = outputOptions_1_1.value;
20
+ _d = false;
21
+ try {
22
+ const outputOption = _c;
23
+ await (0, build_1.default)(bundle, outputOption);
24
+ }
25
+ finally {
26
+ _d = true;
27
+ }
21
28
  }
22
29
  }
23
30
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
24
31
  finally {
25
32
  try {
26
- if (outputOptions_1_1 && !outputOptions_1_1.done && (_a = outputOptions_1.return)) await _a.call(outputOptions_1);
33
+ if (!_d && !_a && (_b = outputOptions_1.return)) await _b.call(outputOptions_1);
27
34
  }
28
35
  finally { if (e_1) throw e_1.error; }
29
36
  }