weboptimizer 2.0.1477 → 2.0.1479
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/browser.js +3 -3
- package/configurator.js +23 -21
- package/ejsLoader.d.ts +1 -1
- package/ejsLoader.js +10 -14
- package/eslint.config.mjs +2 -2
- package/helper.d.ts +1 -1
- package/helper.js +19 -22
- package/index.js +26 -26
- package/jestSetup.js +0 -4
- package/package.json +11 -11
- package/plugins/HTMLTransformation.js +2 -2
- package/readme.md +1 -1
- package/type.d.ts +1 -1
- package/webpackConfigurator.js +47 -47
package/browser.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.getInitializedBrowser = exports["default"] = exports.browser = void 0;
|
|
|
25
25
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
26
26
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
27
27
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
28
|
-
var _clientnode =
|
|
28
|
+
var _clientnode = require("clientnode");
|
|
29
29
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
30
30
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
31
31
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -72,7 +72,7 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
72
72
|
VirtualConsoleImplementation = _yield$Promise$all2$.VirtualConsole;
|
|
73
73
|
path = _yield$Promise$all2[1];
|
|
74
74
|
virtualConsole = new VirtualConsoleImplementation();
|
|
75
|
-
_iterator = _createForOfIteratorHelper(_clientnode.
|
|
75
|
+
_iterator = _createForOfIteratorHelper(_clientnode.CONSOLE_METHODS);
|
|
76
76
|
try {
|
|
77
77
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
78
78
|
name = _step.value;
|
|
@@ -195,7 +195,7 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
195
195
|
window.addEventListener('load', function () {
|
|
196
196
|
browser.windowLoaded = true;
|
|
197
197
|
});
|
|
198
|
-
void _clientnode
|
|
198
|
+
void (0, _clientnode.timeout)(function () {
|
|
199
199
|
var _iterator4 = _createForOfIteratorHelper(onCreatedListener),
|
|
200
200
|
_step4;
|
|
201
201
|
try {
|
package/configurator.js
CHANGED
|
@@ -22,9 +22,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
22
22
|
value: true
|
|
23
23
|
});
|
|
24
24
|
exports.loadedConfiguration = exports.load = exports.get = exports["default"] = void 0;
|
|
25
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
26
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
26
27
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
27
|
-
var _clientnode =
|
|
28
|
+
var _clientnode = require("clientnode");
|
|
28
29
|
var _fs = _interopRequireWildcard(require("fs"));
|
|
29
30
|
var _path2 = _interopRequireWildcard(require("path"));
|
|
30
31
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
@@ -32,6 +33,8 @@ var _package = _interopRequireWildcard(require("./package.json"));
|
|
|
32
33
|
var _type4 = require("./type");
|
|
33
34
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
35
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
36
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
38
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
36
39
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
37
40
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -113,10 +116,10 @@ var load = exports.load = function load(context) {
|
|
|
113
116
|
// environment.
|
|
114
117
|
var libraryConfiguration = _package.configuration.library;
|
|
115
118
|
var configuration;
|
|
116
|
-
if (debug) configuration = _clientnode
|
|
119
|
+
if (debug) configuration = (0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(_package.configuration["default"], _package.configuration.debug), _package.configuration.debug);else configuration = _package.configuration["default"];
|
|
117
120
|
configuration.debug = debug;
|
|
118
|
-
if ((0, _typeof2["default"])(configuration.library) === 'object') _clientnode
|
|
119
|
-
if (configuration.library && ((_specificConfiguratio3 = specificConfiguration) === null || _specificConfiguratio3 === void 0 ? void 0 : _specificConfiguratio3.library) !== false) configuration = _clientnode
|
|
121
|
+
if ((0, _typeof2["default"])(configuration.library) === 'object') (0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(libraryConfiguration, configuration.library), configuration.library);
|
|
122
|
+
if (configuration.library && ((_specificConfiguratio3 = specificConfiguration) === null || _specificConfiguratio3 === void 0 ? void 0 : _specificConfiguratio3.library) !== false) configuration = (0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(configuration, libraryConfiguration), libraryConfiguration);
|
|
120
123
|
// endregion
|
|
121
124
|
// region merging and evaluating task specific and dynamic configurations
|
|
122
125
|
/// region load additional dynamically given configuration
|
|
@@ -124,7 +127,7 @@ var load = exports.load = function load(context) {
|
|
|
124
127
|
var filePath = null;
|
|
125
128
|
while (true) {
|
|
126
129
|
var newFilePath = "".concat(configuration.path.context, ".dynamicConfiguration-").concat(count, ".json");
|
|
127
|
-
if (!_clientnode
|
|
130
|
+
if (!(0, _clientnode.isFileSync)(newFilePath)) break;
|
|
128
131
|
filePath = newFilePath;
|
|
129
132
|
count += 1;
|
|
130
133
|
}
|
|
@@ -148,7 +151,7 @@ var load = exports.load = function load(context) {
|
|
|
148
151
|
var type = _step.value;
|
|
149
152
|
if (runtimeInformation.givenCommandLineArguments[2] === type || debug && type === 'debug' || type === 'test' && runtimeInformation.givenCommandLineArguments[2].startsWith('test:') && runtimeInformation.givenCommandLineArguments[2] !== 'test:browser') for (var _i = 0, _arr = [configuration, specificConfiguration]; _i < _arr.length; _i++) {
|
|
150
153
|
var configurationTarget = _arr[_i];
|
|
151
|
-
if (_clientnode
|
|
154
|
+
if ((0, _clientnode.isPlainObject)(configurationTarget[type])) (0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(configurationTarget, configurationTarget[type]), configurationTarget[type]);
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
} catch (err) {
|
|
@@ -177,9 +180,9 @@ var load = exports.load = function load(context) {
|
|
|
177
180
|
} finally {
|
|
178
181
|
_iterator2.f();
|
|
179
182
|
}
|
|
180
|
-
_clientnode
|
|
183
|
+
(0, _clientnode.extend)(true, (0, _clientnode.modifyObject)((0, _clientnode.modifyObject)(configuration, specificConfiguration), runtimeInformation), specificConfiguration, runtimeInformation);
|
|
181
184
|
var result = null;
|
|
182
|
-
if (runtimeInformation.givenCommandLineArguments.length > 3) result = _clientnode
|
|
185
|
+
if (runtimeInformation.givenCommandLineArguments.length > 3) result = (0, _clientnode.parseEncodedObject)(runtimeInformation.givenCommandLineArguments[runtimeInformation.givenCommandLineArguments.length - 1], configuration, 'configuration');
|
|
183
186
|
if (result !== null && (0, _typeof2["default"])(result) === 'object') {
|
|
184
187
|
if (Object.prototype.hasOwnProperty.call(result, '__reference__')) {
|
|
185
188
|
var referenceNames = [].concat(result.__reference__);
|
|
@@ -189,7 +192,7 @@ var load = exports.load = function load(context) {
|
|
|
189
192
|
try {
|
|
190
193
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
191
194
|
var _name = _step3.value;
|
|
192
|
-
if (Object.prototype.hasOwnProperty.call(configuration, _name)) _clientnode
|
|
195
|
+
if (Object.prototype.hasOwnProperty.call(configuration, _name)) (0, _clientnode.extend)(true, result, configuration[_name]);else if ((0, _clientnode.isFileSync)(_name)) (0, _clientnode.extend)(true, result, JSON.parse((0, _fs.readFileSync)(_name, configuration.encoding)));else console.warn("Given dynamic referenced configuration \"".concat(_name, "\" ") + 'could not be resolved.');
|
|
193
196
|
}
|
|
194
197
|
} catch (err) {
|
|
195
198
|
_iterator3.e(err);
|
|
@@ -197,10 +200,10 @@ var load = exports.load = function load(context) {
|
|
|
197
200
|
_iterator3.f();
|
|
198
201
|
}
|
|
199
202
|
}
|
|
200
|
-
_clientnode
|
|
203
|
+
(0, _clientnode.extend)(true, (0, _clientnode.modifyObject)(configuration, result), result);
|
|
201
204
|
}
|
|
202
205
|
// Removing comments (default key name to delete is "#").
|
|
203
|
-
configuration = _clientnode
|
|
206
|
+
configuration = (0, _clientnode.removeKeyPrefixes)(configuration);
|
|
204
207
|
// endregion
|
|
205
208
|
/// region build absolute paths
|
|
206
209
|
configuration.path.base = (0, _path2.resolve)(configuration.path.context, configuration.path.base);
|
|
@@ -208,13 +211,13 @@ var load = exports.load = function load(context) {
|
|
|
208
211
|
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i2], 2),
|
|
209
212
|
key = _Object$entries$_i[0],
|
|
210
213
|
_path = _Object$entries$_i[1];
|
|
211
|
-
if (!['base', 'configuration'].includes(key)) if (typeof _path === 'string') configuration.path[key] = (0, _path2.resolve)(configuration.path.base, _path) + '/';else if (_clientnode
|
|
214
|
+
if (!['base', 'configuration'].includes(key)) if (typeof _path === 'string') configuration.path[key] = (0, _path2.resolve)(configuration.path.base, _path) + '/';else if ((0, _clientnode.isPlainObject)(_path)) {
|
|
212
215
|
if (Object.prototype.hasOwnProperty.call(_path, 'base')) configuration.path[key].base = (0, _path2.resolve)(configuration.path.base, _path.base);
|
|
213
216
|
for (var _i3 = 0, _Object$entries2 = Object.entries(_path); _i3 < _Object$entries2.length; _i3++) {
|
|
214
217
|
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i3], 2),
|
|
215
218
|
subKey = _Object$entries2$_i[0],
|
|
216
219
|
subPath = _Object$entries2$_i[1];
|
|
217
|
-
if (!['base', 'public'].includes(subKey) && typeof subPath === 'string') _path[subKey] = (0, _path2.resolve)(_path.base, subPath) + '/';else if (subKey !== 'options' && _clientnode
|
|
220
|
+
if (!['base', 'public'].includes(subKey) && typeof subPath === 'string') _path[subKey] = (0, _path2.resolve)(_path.base, subPath) + '/';else if (subKey !== 'options' && (0, _clientnode.isPlainObject)(subPath)) {
|
|
218
221
|
subPath.base = (0, _path2.resolve)(_path.base, subPath.base);
|
|
219
222
|
for (var _i4 = 0, _Object$entries3 = Object.entries(subPath); _i4 < _Object$entries3.length; _i4++) {
|
|
220
223
|
var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i4], 2),
|
|
@@ -233,7 +236,7 @@ var load = exports.load = function load(context) {
|
|
|
233
236
|
NOTE: The configuration is not yet fully resolved but will be
|
|
234
237
|
transformed in place in the following lines of code.
|
|
235
238
|
*/
|
|
236
|
-
var resolvedConfiguration = _clientnode
|
|
239
|
+
var resolvedConfiguration = (0, _clientnode.evaluateDynamicData)(configuration, _objectSpread(_objectSpread({}, _clientnode.UTILITY_SCOPE), {}, {
|
|
237
240
|
currentPath: currentWorkingDirectory,
|
|
238
241
|
fileSystem: _fs["default"],
|
|
239
242
|
Helper: _helper["default"],
|
|
@@ -241,11 +244,10 @@ var load = exports.load = function load(context) {
|
|
|
241
244
|
optionalRequire: _clientnode.optionalRequire,
|
|
242
245
|
path: _path2["default"],
|
|
243
246
|
require: _clientnode.currentRequire,
|
|
244
|
-
Tools: _clientnode["default"],
|
|
245
247
|
webOptimizerPath: webOptimizerPath,
|
|
246
248
|
now: now,
|
|
247
|
-
nowUTCTimestamp: _clientnode
|
|
248
|
-
});
|
|
249
|
+
nowUTCTimestamp: (0, _clientnode.getUTCTimestamp)(now)
|
|
250
|
+
}));
|
|
249
251
|
// endregion
|
|
250
252
|
// region consolidate file specific build configuration
|
|
251
253
|
// Apply default file level build configurations to all file type specific
|
|
@@ -256,7 +258,7 @@ var load = exports.load = function load(context) {
|
|
|
256
258
|
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
|
|
257
259
|
_type = _Object$entries4$_i[0],
|
|
258
260
|
_context = _Object$entries4$_i[1];
|
|
259
|
-
resolvedConfiguration.buildContext.types[_type] = _clientnode
|
|
261
|
+
resolvedConfiguration.buildContext.types[_type] = (0, _clientnode.extend)(true, (0, _clientnode.copy)(defaultConfiguration), (0, _clientnode.extend)(true, {
|
|
260
262
|
extension: _type
|
|
261
263
|
}, _context, {
|
|
262
264
|
type: _type
|
|
@@ -326,7 +328,7 @@ var load = exports.load = function load(context) {
|
|
|
326
328
|
var loader = _step5.value;
|
|
327
329
|
if (resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader) resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader += '!';
|
|
328
330
|
resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader += loader.loader;
|
|
329
|
-
if (loader.options) resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader += '?' + _clientnode
|
|
331
|
+
if (loader.options) resolvedConfiguration.loader.aliases.webOptimizerDefaultTemplateFileLoader += '?' + (0, _clientnode.convertCircularObjectToJSON)(loader.options);
|
|
330
332
|
}
|
|
331
333
|
} catch (err) {
|
|
332
334
|
_iterator5.e(err);
|
|
@@ -345,10 +347,10 @@ var load = exports.load = function load(context) {
|
|
|
345
347
|
try {
|
|
346
348
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
347
349
|
var htmlConfiguration = _step6.value;
|
|
348
|
-
_clientnode
|
|
350
|
+
(0, _clientnode.extend)(true, htmlConfiguration, resolvedConfiguration.files.defaultHTML);
|
|
349
351
|
htmlConfiguration.template.request = htmlConfiguration.template.filePath;
|
|
350
352
|
if (htmlConfiguration.template.filePath !== resolvedConfiguration.files.defaultHTML.template.filePath && htmlConfiguration.template.options) {
|
|
351
|
-
var requestString = new String(htmlConfiguration.template.request + _clientnode
|
|
353
|
+
var requestString = new String(htmlConfiguration.template.request + (0, _clientnode.convertCircularObjectToJSON)(htmlConfiguration.template.options));
|
|
352
354
|
requestString.replace = function (value) {
|
|
353
355
|
return function () {
|
|
354
356
|
return value;
|
package/ejsLoader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Encoding, Mapping } from 'clientnode
|
|
1
|
+
import { Encoding, Mapping } from 'clientnode';
|
|
2
2
|
import { Options, TemplateFunction as EJSTemplateFunction } from 'ejs';
|
|
3
3
|
import { LoaderContext } from 'webpack';
|
|
4
4
|
import { Extensions, Replacements } from './type';
|
package/ejsLoader.js
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
// region imports
|
|
19
19
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
21
20
|
Object.defineProperty(exports, "__esModule", {
|
|
22
21
|
value: true
|
|
23
22
|
});
|
|
@@ -27,15 +26,13 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
27
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
27
|
var _core = require("@babel/core");
|
|
29
28
|
var _babelPresetMinify = _interopRequireDefault(require("babel-preset-minify"));
|
|
30
|
-
var _clientnode =
|
|
29
|
+
var _clientnode = require("clientnode");
|
|
31
30
|
var _ejs = _interopRequireDefault(require("ejs"));
|
|
32
31
|
var _fs = require("fs");
|
|
33
32
|
var _htmlMinifier = require("html-minifier");
|
|
34
33
|
var _path = require("path");
|
|
35
34
|
var _configurator = _interopRequireDefault(require("./configurator"));
|
|
36
35
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
37
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
38
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
39
36
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
40
37
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
41
38
|
// endregion
|
|
@@ -51,7 +48,7 @@ var configuration = (0, _configurator["default"])();
|
|
|
51
48
|
var loader = exports.loader = function loader(source) {
|
|
52
49
|
var _ref,
|
|
53
50
|
_this = this;
|
|
54
|
-
var givenOptions = _clientnode
|
|
51
|
+
var givenOptions = (0, _clientnode.convertSubstringInPlainObject)((0, _clientnode.extend)(true, {
|
|
55
52
|
compiler: {},
|
|
56
53
|
compileSteps: 2,
|
|
57
54
|
compress: {
|
|
@@ -85,18 +82,18 @@ var loader = exports.loader = function loader(source) {
|
|
|
85
82
|
var template = request.replace(/^(.+)\?[^?]+$/, '$1');
|
|
86
83
|
var queryMatch = /^[^?]+\?(.+)$/.exec(request);
|
|
87
84
|
if (queryMatch) {
|
|
88
|
-
var evaluated = _clientnode
|
|
85
|
+
var evaluated = (0, _clientnode.evaluate)(queryMatch[1], {
|
|
89
86
|
compile: compile,
|
|
90
87
|
locals: locals,
|
|
91
88
|
request: request,
|
|
92
89
|
source: source,
|
|
93
90
|
template: template
|
|
94
91
|
});
|
|
95
|
-
if (evaluated.error) console.warn('Error occurred during processing given query: ' + evaluated.error);else _clientnode
|
|
92
|
+
if (evaluated.error) console.warn('Error occurred during processing given query: ' + evaluated.error);else (0, _clientnode.extend)(true, nestedLocals, evaluated.result);
|
|
96
93
|
}
|
|
97
|
-
var nestedOptions = _clientnode
|
|
94
|
+
var nestedOptions = (0, _clientnode.copy)(options);
|
|
98
95
|
delete nestedOptions.client;
|
|
99
|
-
nestedOptions = _clientnode
|
|
96
|
+
nestedOptions = (0, _clientnode.extend)(true, {
|
|
100
97
|
encoding: configuration.encoding
|
|
101
98
|
}, nestedOptions, nestedLocals.options || {}, options);
|
|
102
99
|
if (nestedOptions.isString) return compile(template, nestedOptions)(nestedLocals);
|
|
@@ -119,7 +116,7 @@ var loader = exports.loader = function loader(source) {
|
|
|
119
116
|
};
|
|
120
117
|
var compressHTML = function compressHTML(content) {
|
|
121
118
|
var _givenOptions$compres;
|
|
122
|
-
return (_givenOptions$compres = givenOptions.compress) !== null && _givenOptions$compres !== void 0 && _givenOptions$compres.html ? (0, _htmlMinifier.minify)(content, _clientnode
|
|
119
|
+
return (_givenOptions$compres = givenOptions.compress) !== null && _givenOptions$compres !== void 0 && _givenOptions$compres.html ? (0, _htmlMinifier.minify)(content, (0, _clientnode.extend)(true, {
|
|
123
120
|
caseSensitive: true,
|
|
124
121
|
collapseInlineTagWhitespace: true,
|
|
125
122
|
collapseWhitespace: true,
|
|
@@ -156,16 +153,15 @@ var loader = exports.loader = function loader(source) {
|
|
|
156
153
|
var localsIndex = Math.round(step / 2) - 1;
|
|
157
154
|
stepLocals = localsIndex < givenLocals.length ? givenLocals[localsIndex] : {};
|
|
158
155
|
scope = {};
|
|
159
|
-
if (step < 3 && 1 < compileSteps) scope = _objectSpread({
|
|
156
|
+
if (step < 3 && 1 < compileSteps) scope = _objectSpread(_objectSpread({}, _clientnode.UTILITY_SCOPE), {}, {
|
|
160
157
|
configuration: configuration,
|
|
161
158
|
Helper: _helper["default"],
|
|
162
159
|
include: require,
|
|
163
|
-
require: require
|
|
164
|
-
Tools: _clientnode["default"]
|
|
160
|
+
require: require
|
|
165
161
|
}, Array.isArray(stepLocals) ? {} : stepLocals);else if (!Array.isArray(stepLocals)) scope = stepLocals;
|
|
166
162
|
originalScopeNames = Array.isArray(stepLocals) ? stepLocals : Object.keys(scope);
|
|
167
163
|
scopeNames = originalScopeNames.map(function (name) {
|
|
168
|
-
return _clientnode
|
|
164
|
+
return (0, _clientnode.convertToValidVariableName)(name);
|
|
169
165
|
});
|
|
170
166
|
// endregion
|
|
171
167
|
}
|
package/eslint.config.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
|
|
|
11
11
|
import typescriptParser from '@typescript-eslint/parser';
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
const
|
|
14
|
+
const isFile = clientnode.isFile;
|
|
15
15
|
|
|
16
16
|
// Remove unsupported rules.
|
|
17
17
|
const unsuportedRules = ['require-jsdoc', 'valid-jsdoc'];
|
|
@@ -23,7 +23,7 @@ const isLibrary = JSON.parse(await readFile(resolve(cwd(), './package.json'), {
|
|
|
23
23
|
encoding: 'utf-8'
|
|
24
24
|
})).default?.webOptimizer?.library ?? false;
|
|
25
25
|
let tsConfigFilePath = '';
|
|
26
|
-
for (const filePath of ['./tsconfig.json', './node_modules/weboptimizer/tsconfig.' + `${isLibrary ? 'library' : 'application'}.json`]) if (await
|
|
26
|
+
for (const filePath of ['./tsconfig.json', './node_modules/weboptimizer/tsconfig.' + `${isLibrary ? 'library' : 'application'}.json`]) if (await isFile(filePath)) {
|
|
27
27
|
tsConfigFilePath = filePath;
|
|
28
28
|
break;
|
|
29
29
|
}
|
package/helper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Encoding, Mapping } from 'clientnode
|
|
1
|
+
import { Encoding, Mapping } from 'clientnode';
|
|
2
2
|
import { BuildConfiguration, Extensions, GivenInjection, GivenInjectionConfiguration, NormalizedGivenInjection, PathConfiguration, PackageDescriptor, Replacements, ResolvedBuildConfiguration, SpecificExtensions } from './type';
|
|
3
3
|
export declare const KNOWN_FILE_EXTENSIONS: Array<string>;
|
|
4
4
|
/**
|
package/helper.js
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
// region imports
|
|
19
19
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
20
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
21
20
|
Object.defineProperty(exports, "__esModule", {
|
|
22
21
|
value: true
|
|
23
22
|
});
|
|
@@ -26,11 +25,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
26
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
26
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
28
27
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
29
|
-
var _clientnode =
|
|
28
|
+
var _clientnode = require("clientnode");
|
|
30
29
|
var _fs = require("fs");
|
|
31
30
|
var _path = require("path");
|
|
32
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
33
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
34
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
32
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
33
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -130,7 +127,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
130
127
|
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
131
128
|
placeholderName = _Object$entries$_i[0],
|
|
132
129
|
value = _Object$entries$_i[1];
|
|
133
|
-
filePath = filePath.replace(new RegExp(_clientnode
|
|
130
|
+
filePath = filePath.replace(new RegExp((0, _clientnode.escapeRegularExpressions)(placeholderName), 'g'), "".concat(value));
|
|
134
131
|
}
|
|
135
132
|
return filePath;
|
|
136
133
|
}
|
|
@@ -254,7 +251,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
254
251
|
referencePath = (0, _path.resolve)(referencePath);
|
|
255
252
|
// NOTE: We apply alias on externals additionally.
|
|
256
253
|
var resolvedRequest = Helper.applyModuleReplacements(Helper.applyAliases(request.substring(request.lastIndexOf('!') + 1), aliases), moduleReplacements);
|
|
257
|
-
if (resolvedRequest === false || _clientnode
|
|
254
|
+
if (resolvedRequest === false || (0, _clientnode.isAnyMatching)(resolvedRequest, excludePattern)) return null;
|
|
258
255
|
/*
|
|
259
256
|
NOTE: Aliases and module replacements doesn't have to be forwarded
|
|
260
257
|
since we pass an already resolved request.
|
|
@@ -266,7 +263,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
266
263
|
NOTE: We mark dependencies as external if there file couldn't be
|
|
267
264
|
resolved or are specified to be external explicitly.
|
|
268
265
|
*/
|
|
269
|
-
if (!(filePath || inPlaceNormalLibrary) || _clientnode
|
|
266
|
+
if (!(filePath || inPlaceNormalLibrary) || (0, _clientnode.isAnyMatching)(resolvedRequest, includePattern)) return Helper.applyContext(resolvedRequest, requestContext, referencePath, aliases, moduleReplacements, relativeModuleLocations) || null;
|
|
270
267
|
for (var _i2 = 0, _Object$values = Object.values(normalizedGivenInjection); _i2 < _Object$values.length; _i2++) {
|
|
271
268
|
var chunk = _Object$values[_i2];
|
|
272
269
|
var _iterator3 = _createForOfIteratorHelper(chunk),
|
|
@@ -358,10 +355,10 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
358
355
|
var buildConfiguration = [];
|
|
359
356
|
for (var _i5 = 0, _Object$values2 = Object.values(configuration); _i5 < _Object$values2.length; _i5++) {
|
|
360
357
|
var value = _Object$values2[_i5];
|
|
361
|
-
var newItem = _clientnode
|
|
358
|
+
var newItem = (0, _clientnode.extend)(true, {
|
|
362
359
|
filePaths: []
|
|
363
360
|
}, value);
|
|
364
|
-
var _iterator5 = _createForOfIteratorHelper(_clientnode
|
|
361
|
+
var _iterator5 = _createForOfIteratorHelper((0, _clientnode.walkDirectoryRecursivelySync)(entryPath, function (file) {
|
|
365
362
|
if (Helper.isFilePathInLocation(file.path, pathsToIgnore)) return false;
|
|
366
363
|
})),
|
|
367
364
|
_step5;
|
|
@@ -486,11 +483,11 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
486
483
|
var referencePath = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
|
|
487
484
|
var pathsToIgnore = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ['.git'];
|
|
488
485
|
if (referencePath.startsWith('/')) referencePath = (0, _path.relative)(context, referencePath);
|
|
489
|
-
var result = _clientnode
|
|
486
|
+
var result = (0, _clientnode.copy)(normalizedGivenInjection);
|
|
490
487
|
for (var _i7 = 0, _Object$values4 = Object.values(result); _i7 < _Object$values4.length; _i7++) {
|
|
491
488
|
var chunk = _Object$values4[_i7];
|
|
492
489
|
var index = 0;
|
|
493
|
-
var _iterator7 = _createForOfIteratorHelper(_clientnode
|
|
490
|
+
var _iterator7 = _createForOfIteratorHelper((0, _clientnode.copy)(chunk)),
|
|
494
491
|
_step7;
|
|
495
492
|
try {
|
|
496
493
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
@@ -501,9 +498,9 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
501
498
|
continue;
|
|
502
499
|
}
|
|
503
500
|
var resolvedPath = (0, _path.resolve)(referencePath, resolvedModuleID);
|
|
504
|
-
if (_clientnode
|
|
501
|
+
if ((0, _clientnode.isDirectorySync)(resolvedPath)) {
|
|
505
502
|
chunk.splice(index, 1);
|
|
506
|
-
var _iterator8 = _createForOfIteratorHelper(_clientnode
|
|
503
|
+
var _iterator8 = _createForOfIteratorHelper((0, _clientnode.walkDirectoryRecursivelySync)(resolvedPath, function (file) {
|
|
507
504
|
if (Helper.isFilePathInLocation(file.path, pathsToIgnore)) return false;
|
|
508
505
|
})),
|
|
509
506
|
_step8;
|
|
@@ -544,7 +541,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
544
541
|
index: givenInjection
|
|
545
542
|
};else if (typeof givenInjection === 'string') result = {
|
|
546
543
|
index: [givenInjection]
|
|
547
|
-
};else if (_clientnode
|
|
544
|
+
};else if ((0, _clientnode.isPlainObject)(givenInjection)) {
|
|
548
545
|
var hasContent = false;
|
|
549
546
|
var chunkNamesToDelete = [];
|
|
550
547
|
for (var _i8 = 0, _Object$entries3 = Object.entries(givenInjection); _i8 < _Object$entries3.length; _i8++) {
|
|
@@ -613,7 +610,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
613
610
|
var context = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : './';
|
|
614
611
|
var referencePath = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
615
612
|
var pathsToIgnore = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ['.git'];
|
|
616
|
-
var injection = _clientnode
|
|
613
|
+
var injection = (0, _clientnode.copy)(givenInjection);
|
|
617
614
|
var moduleFilePathsToExclude = Helper.determineModuleLocations(givenInjection.autoExclude.paths, aliases, moduleReplacements, {
|
|
618
615
|
file: extensions.file.internal
|
|
619
616
|
}, context, referencePath, pathsToIgnore).filePaths;
|
|
@@ -623,7 +620,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
623
620
|
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
624
621
|
var name = _step10.value;
|
|
625
622
|
var injectionType = injection[name];
|
|
626
|
-
if (_clientnode
|
|
623
|
+
if ((0, _clientnode.isPlainObject)(injectionType)) {
|
|
627
624
|
for (var _i9 = 0, _Object$entries4 = Object.entries(injectionType); _i9 < _Object$entries4.length; _i9++) {
|
|
628
625
|
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i9], 2),
|
|
629
626
|
chunkName = _Object$entries4$_i[0],
|
|
@@ -677,7 +674,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
677
674
|
try {
|
|
678
675
|
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
679
676
|
var moduleFilePath = _step12.value;
|
|
680
|
-
if (!(moduleFilePathsToExclude.includes(moduleFilePath) || _clientnode
|
|
677
|
+
if (!(moduleFilePathsToExclude.includes(moduleFilePath) || (0, _clientnode.isAnyMatching)(moduleFilePath.substring(context.length), moduleFilePathPatternToExclude))) {
|
|
681
678
|
var relativeModuleFilePath = "./".concat((0, _path.relative)(context, moduleFilePath));
|
|
682
679
|
var directoryPath = (0, _path.dirname)(relativeModuleFilePath);
|
|
683
680
|
var baseName = (0, _path.basename)(relativeModuleFilePath, ".".concat(buildConfiguration.extension));
|
|
@@ -736,16 +733,16 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
736
733
|
fileName: null,
|
|
737
734
|
packageAliases: null
|
|
738
735
|
};
|
|
739
|
-
if (_clientnode
|
|
736
|
+
if ((0, _clientnode.isDirectorySync)(packagePath)) {
|
|
740
737
|
var pathToPackageJSON = (0, _path.resolve)(packagePath, 'package.json');
|
|
741
|
-
if (_clientnode
|
|
738
|
+
if ((0, _clientnode.isFileSync)(pathToPackageJSON)) {
|
|
742
739
|
var localConfiguration = {};
|
|
743
740
|
try {
|
|
744
741
|
localConfiguration = JSON.parse((0, _fs.readFileSync)(pathToPackageJSON, {
|
|
745
742
|
encoding: encoding
|
|
746
743
|
}));
|
|
747
744
|
} catch (error) {
|
|
748
|
-
console.warn("Package configuration file \"".concat(pathToPackageJSON, "\" ") + "could not parsed: ".concat(_clientnode
|
|
745
|
+
console.warn("Package configuration file \"".concat(pathToPackageJSON, "\" ") + "could not parsed: ".concat((0, _clientnode.represent)(error)));
|
|
749
746
|
}
|
|
750
747
|
var _iterator13 = _createForOfIteratorHelper(packageMainPropertyNames),
|
|
751
748
|
_step13;
|
|
@@ -767,7 +764,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
767
764
|
try {
|
|
768
765
|
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
769
766
|
var _propertyName = _step14.value;
|
|
770
|
-
if (Object.prototype.hasOwnProperty.call(localConfiguration, _propertyName) && _clientnode
|
|
767
|
+
if (Object.prototype.hasOwnProperty.call(localConfiguration, _propertyName) && (0, _clientnode.isPlainObject)(localConfiguration[_propertyName])) {
|
|
771
768
|
result.packageAliases = localConfiguration[_propertyName];
|
|
772
769
|
break;
|
|
773
770
|
}
|
|
@@ -876,7 +873,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
876
873
|
if (resolvedFileName === false) continue;
|
|
877
874
|
if (resolvedFileName) currentModuleFilePath = (0, _path.resolve)(currentModuleFilePath, "".concat(resolvedFileName).concat(fileExtension));else currentModuleFilePath += "".concat(resolvedFileName).concat(fileExtension);
|
|
878
875
|
if (Helper.isFilePathInLocation(currentModuleFilePath, pathsToIgnore)) continue;
|
|
879
|
-
if (_clientnode
|
|
876
|
+
if ((0, _clientnode.isFileSync)(currentModuleFilePath)) return currentModuleFilePath;
|
|
880
877
|
}
|
|
881
878
|
} catch (err) {
|
|
882
879
|
_iterator18.e(err);
|
package/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
29
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
30
30
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
31
31
|
var _child_process = require("child_process");
|
|
32
|
-
var _clientnode =
|
|
32
|
+
var _clientnode = require("clientnode");
|
|
33
33
|
var _fs = require("fs");
|
|
34
34
|
var _promises = require("fs/promises");
|
|
35
35
|
var _globAll = require("glob-all");
|
|
@@ -70,7 +70,7 @@ var main = function main(context) {
|
|
|
70
70
|
case 0:
|
|
71
71
|
if (environment.PATH && !environment.PATH.includes(':node_modules/.bin')) environment.PATH += ':node_modules/.bin';else environment.PATH = 'node_modules/.bin';
|
|
72
72
|
configuration = (0, _configurator.load)(context, currentWorkingDirectory, commandLineArguments, webOptimizerPath, environment);
|
|
73
|
-
clear = _clientnode
|
|
73
|
+
clear = (0, _clientnode.NOOP)();
|
|
74
74
|
_context3.prev = 3;
|
|
75
75
|
// region controller
|
|
76
76
|
processOptions = {
|
|
@@ -94,7 +94,7 @@ var main = function main(context) {
|
|
|
94
94
|
dynamicConfiguration = {
|
|
95
95
|
givenCommandLineArguments: configuration.givenCommandLineArguments.slice()
|
|
96
96
|
};
|
|
97
|
-
if (configuration.givenCommandLineArguments.length > 3 && _clientnode
|
|
97
|
+
if (configuration.givenCommandLineArguments.length > 3 && (0, _clientnode.parseEncodedObject)(configuration.givenCommandLineArguments[configuration.givenCommandLineArguments.length - 1], configuration, 'configuration')) configuration.givenCommandLineArguments.pop();
|
|
98
98
|
count = 0;
|
|
99
99
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
100
100
|
case 15:
|
|
@@ -104,7 +104,7 @@ var main = function main(context) {
|
|
|
104
104
|
}
|
|
105
105
|
filePath = (0, _path.resolve)(configuration.path.context, ".dynamicConfiguration-".concat(count, ".json"));
|
|
106
106
|
_context3.next = 19;
|
|
107
|
-
return _clientnode
|
|
107
|
+
return (0, _clientnode.isFile)(filePath);
|
|
108
108
|
case 19:
|
|
109
109
|
if (_context3.sent) {
|
|
110
110
|
_context3.next = 21;
|
|
@@ -122,7 +122,7 @@ var main = function main(context) {
|
|
|
122
122
|
additionalArguments = commandLineArguments.splice(3); /// region register exit handler to tidy up
|
|
123
123
|
clear = function clear(error) {
|
|
124
124
|
// NOTE: Close handler have to be synchronous.
|
|
125
|
-
if (_clientnode
|
|
125
|
+
if ((0, _clientnode.isFileSync)(filePath)) (0, _fs.unlinkSync)(filePath);
|
|
126
126
|
if (error) throw error;
|
|
127
127
|
};
|
|
128
128
|
closeEventHandlers.push(clear);
|
|
@@ -145,7 +145,7 @@ var main = function main(context) {
|
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
147
|
_context3.next = 33;
|
|
148
|
-
return _clientnode
|
|
148
|
+
return (0, _clientnode.walkDirectoryRecursively)(configuration.path.target.base, /*#__PURE__*/function () {
|
|
149
149
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
150
150
|
var type, _file$stats;
|
|
151
151
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
@@ -201,7 +201,7 @@ var main = function main(context) {
|
|
|
201
201
|
case 33:
|
|
202
202
|
_context3.t0 = _createForOfIteratorHelper;
|
|
203
203
|
_context3.next = 36;
|
|
204
|
-
return _clientnode
|
|
204
|
+
return (0, _clientnode.walkDirectoryRecursively)(configuration.path.target.base, function () {
|
|
205
205
|
return false;
|
|
206
206
|
}, configuration.encoding);
|
|
207
207
|
case 36:
|
|
@@ -243,7 +243,7 @@ var main = function main(context) {
|
|
|
243
243
|
return (0, _rimraf.rimraf)(configuration.path.target.base);
|
|
244
244
|
case 59:
|
|
245
245
|
_context3.next = 61;
|
|
246
|
-
return _clientnode
|
|
246
|
+
return (0, _clientnode.isDirectory)(configuration.path.apiDocumentation);
|
|
247
247
|
case 61:
|
|
248
248
|
if (!_context3.sent) {
|
|
249
249
|
_context3.next = 64;
|
|
@@ -256,9 +256,9 @@ var main = function main(context) {
|
|
|
256
256
|
try {
|
|
257
257
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
258
258
|
_filePath = _step2.value;
|
|
259
|
-
if (_filePath) if (_clientnode
|
|
259
|
+
if (_filePath) if ((0, _clientnode.isFileSync)(_filePath))
|
|
260
260
|
// NOTE: Close handler have to be synchronous.
|
|
261
|
-
(0, _fs.unlinkSync)(_filePath);else if (_clientnode
|
|
261
|
+
(0, _fs.unlinkSync)(_filePath);else if ((0, _clientnode.isDirectorySync)(_filePath)) (0, _rimraf.sync)(_filePath);
|
|
262
262
|
}
|
|
263
263
|
} catch (err) {
|
|
264
264
|
_iterator2.e(err);
|
|
@@ -308,7 +308,7 @@ var main = function main(context) {
|
|
|
308
308
|
NOTE: Close handler have to be
|
|
309
309
|
synchronous.
|
|
310
310
|
*/
|
|
311
|
-
if (configuration.buildContext.types[type].outputExtension === 'js' && _clientnode
|
|
311
|
+
if (configuration.buildContext.types[type].outputExtension === 'js' && (0, _clientnode.isFileSync)(_filePath3)) (0, _fs.chmodSync)(_filePath3, '755');
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
} catch (err) {
|
|
@@ -322,9 +322,9 @@ var main = function main(context) {
|
|
|
322
322
|
try {
|
|
323
323
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
324
324
|
var _filePath4 = _step4.value;
|
|
325
|
-
if (_filePath4) if (_clientnode
|
|
325
|
+
if (_filePath4) if ((0, _clientnode.isFileSync)(_filePath4))
|
|
326
326
|
// NOTE: Close handler have to be synchronous.
|
|
327
|
-
(0, _fs.unlinkSync)(_filePath4);else if (_clientnode
|
|
327
|
+
(0, _fs.unlinkSync)(_filePath4);else if ((0, _clientnode.isDirectorySync)(_filePath4)) (0, _rimraf.sync)(_filePath4);
|
|
328
328
|
}
|
|
329
329
|
} catch (err) {
|
|
330
330
|
_iterator4.e(err);
|
|
@@ -359,10 +359,10 @@ var main = function main(context) {
|
|
|
359
359
|
var targetPath = (0, _path.join)(configuration.path.target.base, _filePath5);
|
|
360
360
|
|
|
361
361
|
// NOTE: Close handler have to be synchronous.
|
|
362
|
-
if (_clientnode
|
|
363
|
-
if (_clientnode
|
|
364
|
-
_clientnode
|
|
365
|
-
} else if (_clientnode
|
|
362
|
+
if ((0, _clientnode.isDirectorySync)(sourcePath)) {
|
|
363
|
+
if ((0, _clientnode.isDirectorySync)(targetPath)) (0, _rimraf.sync)(targetPath);
|
|
364
|
+
(0, _clientnode.copyDirectoryRecursiveSync)(sourcePath, targetPath);
|
|
365
|
+
} else if ((0, _clientnode.isFileSync)(sourcePath)) (0, _clientnode.copyFileSync)(sourcePath, targetPath);
|
|
366
366
|
}
|
|
367
367
|
} catch (err) {
|
|
368
368
|
_iterator5.e(err);
|
|
@@ -371,8 +371,8 @@ var main = function main(context) {
|
|
|
371
371
|
}
|
|
372
372
|
tidyUp();
|
|
373
373
|
};
|
|
374
|
-
var closeHandler = _clientnode
|
|
375
|
-
var _iterator6 = _createForOfIteratorHelper(_clientnode.
|
|
374
|
+
var closeHandler = (0, _clientnode.getProcessCloseHandler)(resolve, reject, null, commandLineArguments[2] === 'build' ? copyAdditionalFilesAndTidyUp : tidyUp);
|
|
375
|
+
var _iterator6 = _createForOfIteratorHelper(_clientnode.CLOSE_EVENT_NAMES),
|
|
376
376
|
_step6;
|
|
377
377
|
try {
|
|
378
378
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
@@ -398,7 +398,7 @@ var main = function main(context) {
|
|
|
398
398
|
}
|
|
399
399
|
// Perform all file specific preprocessing stuff.
|
|
400
400
|
testModuleFilePaths = [];
|
|
401
|
-
if (_clientnode
|
|
401
|
+
if ((0, _clientnode.isPlainObject)(configuration['test:browser'].injection) && configuration['test:browser'].injection.entry) testModuleFilePaths = _helper["default"].determineModuleLocations(configuration['test:browser'].injection.entry, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
402
402
|
file: configuration.extensions.file.internal
|
|
403
403
|
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore).filePaths;
|
|
404
404
|
_iterator7 = _createForOfIteratorHelper(buildConfigurations);
|
|
@@ -423,7 +423,7 @@ var main = function main(context) {
|
|
|
423
423
|
_context2.next = 7;
|
|
424
424
|
break;
|
|
425
425
|
}
|
|
426
|
-
evaluated = _clientnode
|
|
426
|
+
evaluated = (0, _clientnode.evaluate)("`".concat(expression, "`"), {
|
|
427
427
|
global: global,
|
|
428
428
|
self: configuration,
|
|
429
429
|
buildConfiguration: buildConfiguration,
|
|
@@ -439,7 +439,7 @@ var main = function main(context) {
|
|
|
439
439
|
case 5:
|
|
440
440
|
console.info("Running \"".concat(evaluated.result, "\""));
|
|
441
441
|
processPromises.push(new Promise(function (resolve, reject) {
|
|
442
|
-
return [_clientnode
|
|
442
|
+
return [(0, _clientnode.handleChildProcess)((0, _child_process.exec)(evaluated.result, _objectSpread({
|
|
443
443
|
encoding: configuration.encoding
|
|
444
444
|
}, processOptions), function (error) {
|
|
445
445
|
return error ? reject(error) : resolve({
|
|
@@ -499,7 +499,7 @@ var main = function main(context) {
|
|
|
499
499
|
try {
|
|
500
500
|
var _loop2 = function _loop2() {
|
|
501
501
|
var task = _step9.value;
|
|
502
|
-
var evaluated = _clientnode
|
|
502
|
+
var evaluated = (0, _clientnode.evaluate)(Object.prototype.hasOwnProperty.call(task, 'indicator') ? task.indicator : 'true', {
|
|
503
503
|
global: global,
|
|
504
504
|
self: configuration,
|
|
505
505
|
path: _path["default"]
|
|
@@ -509,8 +509,8 @@ var main = function main(context) {
|
|
|
509
509
|
var commandLineArguments = (task.arguments || []).concat(additionalArguments);
|
|
510
510
|
console.info('Running "' + ("".concat(task.command, " ") + commandLineArguments.join(' ')).trim() + '"');
|
|
511
511
|
var childProcess = (0, _child_process.spawn)(task.command, commandLineArguments, childProcessOptions);
|
|
512
|
-
var closeHandler = _clientnode
|
|
513
|
-
var _iterator10 = _createForOfIteratorHelper(_clientnode.
|
|
512
|
+
var closeHandler = (0, _clientnode.getProcessCloseHandler)(resolve, reject);
|
|
513
|
+
var _iterator10 = _createForOfIteratorHelper(_clientnode.CLOSE_EVENT_NAMES),
|
|
514
514
|
_step10;
|
|
515
515
|
try {
|
|
516
516
|
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
@@ -556,7 +556,7 @@ var main = function main(context) {
|
|
|
556
556
|
}
|
|
557
557
|
finished = true;
|
|
558
558
|
};
|
|
559
|
-
_iterator11 = _createForOfIteratorHelper(_clientnode.
|
|
559
|
+
_iterator11 = _createForOfIteratorHelper(_clientnode.CLOSE_EVENT_NAMES);
|
|
560
560
|
try {
|
|
561
561
|
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
562
562
|
closeEventName = _step11.value;
|
package/jestSetup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1479",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"babel-loader": "^9.1.3",
|
|
101
101
|
"babel-plugin-transform-modern-regexp": "^0.0.6",
|
|
102
102
|
"babel-preset-minify": "^0.5.2",
|
|
103
|
-
"clientnode": "3.0.
|
|
103
|
+
"clientnode": "3.0.1147",
|
|
104
104
|
"ejs": "^3.1.10",
|
|
105
105
|
"exports-loader": "^5.0.0",
|
|
106
106
|
"extract-loader": "^5.1.0",
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
"types": {
|
|
364
364
|
"default": {
|
|
365
365
|
"filePathPattern": {
|
|
366
|
-
"__evaluate__": "`^${
|
|
366
|
+
"__evaluate__": "`^${string.maskForRegularExpression(self.path.target.asset.javaScript)}.+(?:\\\\.[^.]+(?:\\\\.map)?)?\\\\.js$`"
|
|
367
367
|
},
|
|
368
368
|
"outputExtension": "js",
|
|
369
369
|
"preinstall": {
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
"cascadingStyleSheet": {
|
|
389
389
|
"extension": "css",
|
|
390
390
|
"filePathPattern": {
|
|
391
|
-
"__evaluate__": "`^${
|
|
391
|
+
"__evaluate__": "`^${string.maskForRegularExpression(self.path.target.asset.cascadingStyleSheet)}.+${self.path.target.asset.cascadingStyleSheet === self.path.source.asset.cascadingStyleSheet ? '\\\\.compiled' : ''}(?:\\\\.[^.]+(?:\\\\.map)?)?$`"
|
|
392
392
|
},
|
|
393
393
|
"outputExtension": "css"
|
|
394
394
|
},
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
"--emitDeclarationOnly",
|
|
417
417
|
"--project",
|
|
418
418
|
{
|
|
419
|
-
"__evaluate__": "
|
|
419
|
+
"__evaluate__": "filesystem.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.application.json`"
|
|
420
420
|
}
|
|
421
421
|
],
|
|
422
422
|
"command": "tsc"
|
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
"--noEmit",
|
|
427
427
|
"--project",
|
|
428
428
|
{
|
|
429
|
-
"__evaluate__": "
|
|
429
|
+
"__evaluate__": "filesystem.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.application.json`"
|
|
430
430
|
}
|
|
431
431
|
],
|
|
432
432
|
"command": "tsc"
|
|
@@ -497,7 +497,7 @@
|
|
|
497
497
|
"--ignore-pattern",
|
|
498
498
|
"'*.d.ts'",
|
|
499
499
|
{
|
|
500
|
-
"__evaluate__": "
|
|
500
|
+
"__evaluate__": "filesystem.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? '--parser-options=project:tsconfig.json' : ''"
|
|
501
501
|
},
|
|
502
502
|
"'**/*.{jsx,ts,tsx}'"
|
|
503
503
|
],
|
|
@@ -683,7 +683,7 @@
|
|
|
683
683
|
},
|
|
684
684
|
"template": {
|
|
685
685
|
"filePath": {
|
|
686
|
-
"__evaluate__": "`${
|
|
686
|
+
"__evaluate__": "`${filesystem.isFileSync(path.resolve(self.path.source.base, `${self.files.defaultHTML.filename}.ejs`)) ? path.resolve(self.path.source.base, `${self.files.defaultHTML.filename}.ejs`) : path.resolve(webOptimizerPath, 'index.html.ejs')}`"
|
|
687
687
|
},
|
|
688
688
|
"postCompileOptions": {
|
|
689
689
|
"compileSteps": 0
|
|
@@ -1617,7 +1617,7 @@
|
|
|
1617
1617
|
"--emitDeclarationOnly",
|
|
1618
1618
|
"--project",
|
|
1619
1619
|
{
|
|
1620
|
-
"__evaluate__": "
|
|
1620
|
+
"__evaluate__": "filesystem.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.library.json`"
|
|
1621
1621
|
}
|
|
1622
1622
|
]
|
|
1623
1623
|
},
|
|
@@ -1626,7 +1626,7 @@
|
|
|
1626
1626
|
"--noEmit",
|
|
1627
1627
|
"--project",
|
|
1628
1628
|
{
|
|
1629
|
-
"__evaluate__": "
|
|
1629
|
+
"__evaluate__": "filesystem.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.library.json`"
|
|
1630
1630
|
}
|
|
1631
1631
|
]
|
|
1632
1632
|
},
|
|
@@ -1719,7 +1719,7 @@
|
|
|
1719
1719
|
"otherMaximumFileSizeLimitInByte": 1
|
|
1720
1720
|
},
|
|
1721
1721
|
"libraryName": {
|
|
1722
|
-
"__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2] === 'serve' ? [
|
|
1722
|
+
"__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2] === 'serve' ? [string.convertToValidVariableName(self.name), '[name]'] : '*'"
|
|
1723
1723
|
},
|
|
1724
1724
|
"offline": null,
|
|
1725
1725
|
"path": {
|
|
@@ -25,7 +25,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
25
25
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
26
26
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
27
27
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
|
-
var _clientnode =
|
|
28
|
+
var _clientnode = require("clientnode");
|
|
29
29
|
var _jsdom = require("jsdom");
|
|
30
30
|
var _ejsLoader = _interopRequireDefault(require("../ejsLoader"));
|
|
31
31
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -101,7 +101,7 @@ var HTMLTransformation = exports.HTMLTransformation = /*#__PURE__*/function () {
|
|
|
101
101
|
var _loaderConfiguration$;
|
|
102
102
|
var loaderConfiguration = _step2.value;
|
|
103
103
|
if ((_loaderConfiguration$ = loaderConfiguration.options) !== null && _loaderConfiguration$ !== void 0 && _loaderConfiguration$.compileSteps && typeof loaderConfiguration.options.compileSteps === 'number') data.html = _ejsLoader["default"].bind({
|
|
104
|
-
query: _clientnode
|
|
104
|
+
query: (0, _clientnode.extend)(true, (0, _clientnode.copy)(loaderConfiguration.options) || {}, htmlFileSpecification.template.postCompileOptions)
|
|
105
105
|
})(data.html);
|
|
106
106
|
}
|
|
107
107
|
} catch (err) {
|
package/readme.md
CHANGED
|
@@ -303,7 +303,7 @@ package.json (see the API-Documentation, link above, for more details):
|
|
|
303
303
|
...
|
|
304
304
|
"webOptimizer": {
|
|
305
305
|
...
|
|
306
|
-
"libraryName": {"__evaluate__":
|
|
306
|
+
"libraryName": {"__evaluate__": indicator.isPlainObject(self.name) ? helper.stripLoader(self.request) : 'random'},
|
|
307
307
|
...
|
|
308
308
|
},
|
|
309
309
|
...
|
package/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction, Encoding, Mapping, PlainObject, SecondParameter } from 'clientnode
|
|
1
|
+
import { AnyFunction, Encoding, Mapping, PlainObject, SecondParameter } from 'clientnode';
|
|
2
2
|
import FaviconWebpackPlugin from 'favicons-webpack-plugin';
|
|
3
3
|
import { FaviconWebpackPlugionOptions as FaviconWebpackPluginOptions } from 'favicons-webpack-plugin/src/options';
|
|
4
4
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
package/webpackConfigurator.js
CHANGED
|
@@ -26,7 +26,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
26
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
27
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
28
28
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
29
|
-
var _clientnode =
|
|
29
|
+
var _clientnode = require("clientnode");
|
|
30
30
|
var _path = require("path");
|
|
31
31
|
var _util = _interopRequireDefault(require("util"));
|
|
32
32
|
var _webpack = require("webpack");
|
|
@@ -91,10 +91,10 @@ var _module = configuration.module;
|
|
|
91
91
|
var libraryName;
|
|
92
92
|
if (configuration.libraryName) libraryName = configuration.libraryName;else if (Object.keys(configuration.injection.entry.normalized).length > 1) libraryName = '[name]';else {
|
|
93
93
|
libraryName = configuration.name;
|
|
94
|
-
if (['assign', 'global', 'this', 'var', 'window'].includes(configuration.exportFormat.self)) libraryName = _clientnode
|
|
94
|
+
if (['assign', 'global', 'this', 'var', 'window'].includes(configuration.exportFormat.self)) libraryName = (0, _clientnode.convertToValidVariableName)(libraryName);
|
|
95
95
|
}
|
|
96
96
|
if (libraryName === '*') libraryName = ['assign', 'global', 'this', 'var', 'window'].includes(configuration.exportFormat.self) ? Object.keys(configuration.injection.entry.normalized).map(function (name) {
|
|
97
|
-
return _clientnode
|
|
97
|
+
return (0, _clientnode.convertToValidVariableName)(name);
|
|
98
98
|
}) : undefined;
|
|
99
99
|
/// endregion
|
|
100
100
|
/// region plugins
|
|
@@ -136,7 +136,7 @@ var _iterator2 = _createForOfIteratorHelper(configuration.files.html),
|
|
|
136
136
|
try {
|
|
137
137
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
138
138
|
var htmlConfiguration = _step2.value;
|
|
139
|
-
if (_clientnode
|
|
139
|
+
if ((0, _clientnode.isFileSync)(htmlConfiguration.template.filePath)) {
|
|
140
140
|
pluginInstances.push(new plugins.HTML(_objectSpread(_objectSpread({}, htmlConfiguration), {}, {
|
|
141
141
|
template: htmlConfiguration.template.request
|
|
142
142
|
})));
|
|
@@ -150,7 +150,7 @@ try {
|
|
|
150
150
|
} finally {
|
|
151
151
|
_iterator2.f();
|
|
152
152
|
}
|
|
153
|
-
if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode
|
|
153
|
+
if (htmlAvailable && configuration.favicon && plugins.Favicon && (0, _clientnode.isFileSync)([].concat(configuration.favicon.logo)[0])) pluginInstances.push(new plugins.Favicon(configuration.favicon));
|
|
154
154
|
//// endregion
|
|
155
155
|
//// region provide offline functionality
|
|
156
156
|
if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
@@ -171,8 +171,8 @@ if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
if ([].concat(configuration.offline.use).includes('injectionManifest')) pluginInstances.push(new plugins.InjectManifest(_clientnode
|
|
175
|
-
if ([].concat(configuration.offline.use).includes('generateServiceWorker')) pluginInstances.push(new plugins.GenerateServiceWorker(_clientnode
|
|
174
|
+
if ([].concat(configuration.offline.use).includes('injectionManifest')) pluginInstances.push(new plugins.InjectManifest((0, _clientnode.extend)(true, configuration.offline.common, configuration.offline.injectionManifest)));
|
|
175
|
+
if ([].concat(configuration.offline.use).includes('generateServiceWorker')) pluginInstances.push(new plugins.GenerateServiceWorker((0, _clientnode.extend)(true, configuration.offline.common, configuration.offline.serviceWorker)));
|
|
176
176
|
}
|
|
177
177
|
//// endregion
|
|
178
178
|
//// region provide build environment
|
|
@@ -339,7 +339,7 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
339
339
|
} finally {
|
|
340
340
|
_iterator5.f();
|
|
341
341
|
}
|
|
342
|
-
} else if (configuration.injection.external.aliases[request] !== null && (0, _typeof2["default"])(configuration.injection.external.aliases[request]) === 'object') _clientnode
|
|
342
|
+
} else if (configuration.injection.external.aliases[request] !== null && (0, _typeof2["default"])(configuration.injection.external.aliases[request]) === 'object') (0, _clientnode.extend)(result, configuration.injection.external.aliases[request]);
|
|
343
343
|
if (Object.prototype.hasOwnProperty.call(result, 'default')) {
|
|
344
344
|
var _iterator6 = _createForOfIteratorHelper(keys),
|
|
345
345
|
_step6;
|
|
@@ -357,7 +357,7 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
357
357
|
// endregion
|
|
358
358
|
}
|
|
359
359
|
if (typeof result !== 'string' && Object.prototype.hasOwnProperty.call(result, 'root')) result.root = [].concat(result.root).map(function (name) {
|
|
360
|
-
return _clientnode
|
|
360
|
+
return (0, _clientnode.convertToValidVariableName)(name);
|
|
361
361
|
});
|
|
362
362
|
var exportFormat = configuration.exportFormat.external || configuration.exportFormat.self;
|
|
363
363
|
return callback(undefined, exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat], exportFormat);
|
|
@@ -380,7 +380,7 @@ try {
|
|
|
380
380
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
381
381
|
var contextReplacement = _step7.value;
|
|
382
382
|
pluginInstances.push((0, _construct2["default"])(_webpack.ContextReplacementPlugin, (0, _toConsumableArray2["default"])(contextReplacement.map(function (value) {
|
|
383
|
-
var evaluated = _clientnode
|
|
383
|
+
var evaluated = (0, _clientnode.evaluate)(value, {
|
|
384
384
|
configuration: configuration,
|
|
385
385
|
__dirname: __dirname,
|
|
386
386
|
__filename: __filename
|
|
@@ -406,7 +406,7 @@ if (_module.enforceDeduplication) {
|
|
|
406
406
|
var absoluteContextPath = (0, _path.resolve)(configuration.path.context);
|
|
407
407
|
var consolidator = function consolidator(result) {
|
|
408
408
|
var targetPath = result.createData.resource;
|
|
409
|
-
if (targetPath && /((?:^|\/)node_modules\/.+)/.test(targetPath) && (!targetPath.startsWith(absoluteContextPath) || /((?:^|\/)node_modules\/.+){2}/.test(targetPath)) && _clientnode
|
|
409
|
+
if (targetPath && /((?:^|\/)node_modules\/.+)/.test(targetPath) && (!targetPath.startsWith(absoluteContextPath) || /((?:^|\/)node_modules\/.+){2}/.test(targetPath)) && (0, _clientnode.isFileSync)(targetPath)) {
|
|
410
410
|
var packageDescriptor = _helper["default"].getClosestPackageDescriptor(targetPath);
|
|
411
411
|
if (packageDescriptor) {
|
|
412
412
|
var pathPrefixes;
|
|
@@ -449,7 +449,7 @@ if (_module.enforceDeduplication) {
|
|
|
449
449
|
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
450
450
|
var _pathPrefix = _step9.value;
|
|
451
451
|
var alternateTargetPath = (0, _path.resolve)(_pathPrefix, pathSuffix);
|
|
452
|
-
if (_clientnode
|
|
452
|
+
if ((0, _clientnode.isFileSync)(alternateTargetPath)) {
|
|
453
453
|
var otherPackageDescriptor = _helper["default"].getClosestPackageDescriptor(alternateTargetPath);
|
|
454
454
|
if (otherPackageDescriptor) {
|
|
455
455
|
if (packageDescriptor.configuration.version === otherPackageDescriptor.configuration.version) {
|
|
@@ -503,7 +503,7 @@ new NormalModuleReplacementPlugin(
|
|
|
503
503
|
if (
|
|
504
504
|
targetPath &&
|
|
505
505
|
/((?:^|\/)node_modules\/.+){2}/.test(targetPath) &&
|
|
506
|
-
|
|
506
|
+
isFileSync(targetPath)
|
|
507
507
|
) {
|
|
508
508
|
const packageDescriptor:null|PackageDescriptor =
|
|
509
509
|
Helper.getClosestPackageDescriptor(targetPath)
|
|
@@ -528,7 +528,7 @@ new NormalModuleReplacementPlugin(
|
|
|
528
528
|
for (const pathPrefix of pathPrefixes) {
|
|
529
529
|
const alternateTargetPath:string =
|
|
530
530
|
resolve(pathPrefix, pathSuffix)
|
|
531
|
-
if (
|
|
531
|
+
if (isFileSync(alternateTargetPath)) {
|
|
532
532
|
const otherPackageDescriptor:null|PackageDescriptor =
|
|
533
533
|
Helper.getClosestPackageDescriptor(
|
|
534
534
|
alternateTargetPath
|
|
@@ -588,10 +588,10 @@ var scope = {
|
|
|
588
588
|
loader: loader,
|
|
589
589
|
require: currentRequire
|
|
590
590
|
};
|
|
591
|
-
var
|
|
591
|
+
var evaluateAnThrow = function evaluateAnThrow(object) {
|
|
592
592
|
var filePath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : configuration.path.context;
|
|
593
593
|
if (typeof object === 'string') {
|
|
594
|
-
var evaluated = _clientnode
|
|
594
|
+
var evaluated = (0, _clientnode.evaluate)(object, _objectSpread({
|
|
595
595
|
filePath: filePath
|
|
596
596
|
}, scope));
|
|
597
597
|
if (evaluated.error) throw new Error('Error occurred during processing given expression: ' + evaluated.error);
|
|
@@ -600,16 +600,16 @@ var evaluate = function evaluate(object) {
|
|
|
600
600
|
return object;
|
|
601
601
|
};
|
|
602
602
|
var evaluateMapper = function evaluateMapper(value) {
|
|
603
|
-
return
|
|
603
|
+
return evaluateAnThrow(value);
|
|
604
604
|
};
|
|
605
605
|
var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderConfiguration(loaderConfiguration) {
|
|
606
606
|
return {
|
|
607
607
|
exclude: function exclude(filePath) {
|
|
608
|
-
return Boolean(
|
|
608
|
+
return Boolean(evaluateAnThrow(loaderConfiguration.exclude, filePath));
|
|
609
609
|
},
|
|
610
|
-
include: loaderConfiguration.include &&
|
|
611
|
-
test: new RegExp(
|
|
612
|
-
use:
|
|
610
|
+
include: loaderConfiguration.include && evaluateAnThrow(loaderConfiguration.include) || configuration.path.source.base,
|
|
611
|
+
test: new RegExp(evaluateAnThrow(loaderConfiguration.test)),
|
|
612
|
+
use: evaluateAnThrow(loaderConfiguration.use)
|
|
613
613
|
};
|
|
614
614
|
};
|
|
615
615
|
var getIncludingPaths = function getIncludingPaths(path) {
|
|
@@ -623,7 +623,7 @@ var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluat
|
|
|
623
623
|
options: _module.cascadingStyleSheet.options || {}
|
|
624
624
|
}, _module.preprocessor.cascadingStyleSheet.loader ? {
|
|
625
625
|
loader: _module.preprocessor.cascadingStyleSheet.loader,
|
|
626
|
-
options: _clientnode
|
|
626
|
+
options: (0, _clientnode.extend)(true, optionalRequire('postcss') ? {
|
|
627
627
|
postcssOptions: {
|
|
628
628
|
/*
|
|
629
629
|
NOTE: Some plugins like "postcss-import" are
|
|
@@ -688,12 +688,12 @@ var genericLoader = {
|
|
|
688
688
|
exclude: function exclude(filePath) {
|
|
689
689
|
return _helper["default"].normalizePaths(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
690
690
|
return htmlConfiguration.template.filePath;
|
|
691
|
-
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : Boolean(
|
|
691
|
+
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : Boolean(evaluateAnThrow(_module.preprocessor.ejs.exclude, filePath));
|
|
692
692
|
},
|
|
693
693
|
include: getIncludingPaths(configuration.path.source.asset.template),
|
|
694
694
|
test: /^(?!.+\.html\.ejs$).+\.ejs$/i,
|
|
695
695
|
use: _module.preprocessor.ejs.additional.pre.map(evaluateMapper).concat({
|
|
696
|
-
loader: 'file?name=[path][name]' + ((_clientnode
|
|
696
|
+
loader: 'file?name=[path][name]' + (((0, _clientnode.isPlainObject)(_module.preprocessor.ejs.options) ? _module.preprocessor.ejs.options : {
|
|
697
697
|
compileSteps: 2
|
|
698
698
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
699
699
|
}, {
|
|
@@ -707,10 +707,10 @@ var genericLoader = {
|
|
|
707
707
|
// region script
|
|
708
708
|
script: {
|
|
709
709
|
exclude: function exclude(filePath) {
|
|
710
|
-
return Boolean(
|
|
710
|
+
return Boolean(evaluateAnThrow(_module.preprocessor.javaScript.exclude, filePath));
|
|
711
711
|
},
|
|
712
712
|
include: function include(filePath) {
|
|
713
|
-
var result =
|
|
713
|
+
var result = evaluateAnThrow(_module.preprocessor.javaScript.include, filePath);
|
|
714
714
|
if ([null, undefined].includes(result)) {
|
|
715
715
|
var _iterator10 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.javaScript)),
|
|
716
716
|
_step10;
|
|
@@ -739,22 +739,22 @@ var genericLoader = {
|
|
|
739
739
|
html: {
|
|
740
740
|
// NOTE: This is only for the main entry template.
|
|
741
741
|
main: {
|
|
742
|
-
test: new RegExp('^' + _clientnode
|
|
742
|
+
test: new RegExp('^' + (0, _clientnode.escapeRegularExpressions)(configuration.files.defaultHTML.template.filePath) + '(?:\\?.*)?$'),
|
|
743
743
|
use: configuration.files.defaultHTML.template.use
|
|
744
744
|
},
|
|
745
745
|
ejs: {
|
|
746
746
|
exclude: function exclude(filePath) {
|
|
747
747
|
return _helper["default"].normalizePaths(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
748
748
|
return htmlConfiguration.template.filePath;
|
|
749
|
-
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : Boolean(
|
|
749
|
+
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : Boolean(evaluateAnThrow(_module.preprocessor.html.exclude, filePath)));
|
|
750
750
|
},
|
|
751
751
|
include: configuration.path.source.asset.template,
|
|
752
752
|
test: /\.html\.ejs(?:\?.*)?$/i,
|
|
753
753
|
use: _module.preprocessor.html.additional.pre.map(evaluateMapper).concat({
|
|
754
|
-
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.asset.base, configuration.path.target.asset.template), '[name]' + ((_clientnode
|
|
754
|
+
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.asset.base, configuration.path.target.asset.template), '[name]' + (((0, _clientnode.isPlainObject)(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
755
755
|
compileSteps: 2
|
|
756
756
|
}).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[contenthash]"))
|
|
757
|
-
}, (_clientnode
|
|
757
|
+
}, ((0, _clientnode.isPlainObject)(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
758
758
|
compileSteps: 2
|
|
759
759
|
}).compileSteps % 2 ? [] : [{
|
|
760
760
|
loader: 'extract'
|
|
@@ -770,7 +770,7 @@ var genericLoader = {
|
|
|
770
770
|
exclude: function exclude(filePath) {
|
|
771
771
|
return _helper["default"].normalizePaths(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
772
772
|
return htmlConfiguration.template.filePath;
|
|
773
|
-
})).includes(filePath) || (_module.html.exclude === null ? true : Boolean(
|
|
773
|
+
})).includes(filePath) || (_module.html.exclude === null ? true : Boolean(evaluateAnThrow(_module.html.exclude, filePath)));
|
|
774
774
|
},
|
|
775
775
|
include: configuration.path.source.asset.template,
|
|
776
776
|
test: /\.html(?:\?.*)?$/i,
|
|
@@ -789,10 +789,10 @@ var genericLoader = {
|
|
|
789
789
|
// region style
|
|
790
790
|
style: {
|
|
791
791
|
exclude: function exclude(filePath) {
|
|
792
|
-
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : Boolean(
|
|
792
|
+
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluateAnThrow(_module.cascadingStyleSheet.exclude, filePath));
|
|
793
793
|
},
|
|
794
794
|
include: function include(filePath) {
|
|
795
|
-
var result =
|
|
795
|
+
var result = evaluateAnThrow(_module.cascadingStyleSheet.include, filePath);
|
|
796
796
|
if ([null, undefined].includes(result)) {
|
|
797
797
|
var _iterator11 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.cascadingStyleSheet)),
|
|
798
798
|
_step11;
|
|
@@ -819,7 +819,7 @@ var genericLoader = {
|
|
|
819
819
|
font: {
|
|
820
820
|
eot: {
|
|
821
821
|
exclude: function exclude(filePath) {
|
|
822
|
-
return _module.optimizer.font.eot.exclude === null ? false : Boolean(
|
|
822
|
+
return _module.optimizer.font.eot.exclude === null ? false : Boolean(evaluateAnThrow(_module.optimizer.font.eot.exclude, filePath));
|
|
823
823
|
},
|
|
824
824
|
generator: {
|
|
825
825
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -835,7 +835,7 @@ var genericLoader = {
|
|
|
835
835
|
},
|
|
836
836
|
svg: {
|
|
837
837
|
exclude: function exclude(filePath) {
|
|
838
|
-
return _module.optimizer.font.svg.exclude === null ? false : Boolean(
|
|
838
|
+
return _module.optimizer.font.svg.exclude === null ? false : Boolean(evaluateAnThrow(_module.optimizer.font.svg.exclude, filePath));
|
|
839
839
|
},
|
|
840
840
|
include: configuration.path.source.asset.font,
|
|
841
841
|
generator: {
|
|
@@ -853,7 +853,7 @@ var genericLoader = {
|
|
|
853
853
|
},
|
|
854
854
|
ttf: {
|
|
855
855
|
exclude: function exclude(filePath) {
|
|
856
|
-
return _module.optimizer.font.ttf.exclude === null ? false : Boolean(
|
|
856
|
+
return _module.optimizer.font.ttf.exclude === null ? false : Boolean(evaluateAnThrow(_module.optimizer.font.ttf.exclude, filePath));
|
|
857
857
|
},
|
|
858
858
|
generator: {
|
|
859
859
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -870,7 +870,7 @@ var genericLoader = {
|
|
|
870
870
|
},
|
|
871
871
|
woff: {
|
|
872
872
|
exclude: function exclude(filePath) {
|
|
873
|
-
return _module.optimizer.font.woff.exclude === null ? false : Boolean(
|
|
873
|
+
return _module.optimizer.font.woff.exclude === null ? false : Boolean(evaluateAnThrow(_module.optimizer.font.woff.exclude, filePath));
|
|
874
874
|
},
|
|
875
875
|
generator: {
|
|
876
876
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -889,7 +889,7 @@ var genericLoader = {
|
|
|
889
889
|
// region image
|
|
890
890
|
image: {
|
|
891
891
|
exclude: function exclude(filePath) {
|
|
892
|
-
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : Boolean(
|
|
892
|
+
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluateAnThrow(_module.optimizer.image.exclude, filePath));
|
|
893
893
|
},
|
|
894
894
|
generator: {
|
|
895
895
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.image), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -909,7 +909,7 @@ var genericLoader = {
|
|
|
909
909
|
data: {
|
|
910
910
|
exclude: function exclude(filePath) {
|
|
911
911
|
if (typeof filePath !== 'string') return false;
|
|
912
|
-
return configuration.extensions.file.internal.includes((0, _path.extname)(_helper["default"].stripLoader(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : Boolean(
|
|
912
|
+
return configuration.extensions.file.internal.includes((0, _path.extname)(_helper["default"].stripLoader(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluateAnThrow(_module.optimizer.data.exclude, filePath)));
|
|
913
913
|
},
|
|
914
914
|
generator: {
|
|
915
915
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.data), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -925,7 +925,7 @@ var genericLoader = {
|
|
|
925
925
|
}
|
|
926
926
|
// endregion
|
|
927
927
|
};
|
|
928
|
-
_clientnode
|
|
928
|
+
(0, _clientnode.extend)(loader, genericLoader);
|
|
929
929
|
if (configuration.files.compose.cascadingStyleSheet && plugins.MiniCSSExtract) {
|
|
930
930
|
/*
|
|
931
931
|
NOTE: We have to remove the client side javascript hmr style loader
|
|
@@ -983,7 +983,7 @@ if (!_module.optimizer.minimizer) {
|
|
|
983
983
|
extractComments: false,
|
|
984
984
|
parallel: true
|
|
985
985
|
}));
|
|
986
|
-
if (plugins.ImageMinimizer) _module.optimizer.minimizer.push(new plugins.ImageMinimizer(_clientnode
|
|
986
|
+
if (plugins.ImageMinimizer) _module.optimizer.minimizer.push(new plugins.ImageMinimizer((0, _clientnode.extend)(true, {
|
|
987
987
|
minimizer: {
|
|
988
988
|
implementation: plugins.ImageMinimizer.imageminMinify
|
|
989
989
|
}
|
|
@@ -997,12 +997,12 @@ if ((_configuration$path$c = configuration.path.configuration) !== null && _conf
|
|
|
997
997
|
try {
|
|
998
998
|
customConfiguration = currentRequire(configuration.path.configuration.json);
|
|
999
999
|
} catch (error) {
|
|
1000
|
-
console.debug('Importing provided json webpack configuration file path ' + "under \"".concat(configuration.path.configuration.json, "\" failed: ") + _clientnode
|
|
1000
|
+
console.debug('Importing provided json webpack configuration file path ' + "under \"".concat(configuration.path.configuration.json, "\" failed: ") + (0, _clientnode.represent)(error));
|
|
1001
1001
|
}
|
|
1002
1002
|
} catch (error) {
|
|
1003
1003
|
console.debug('Optional configuration file "' + "".concat(configuration.path.configuration.json, "\" not available."));
|
|
1004
1004
|
}
|
|
1005
|
-
var webpackConfiguration = exports.webpackConfiguration = _clientnode
|
|
1005
|
+
var webpackConfiguration = exports.webpackConfiguration = (0, _clientnode.extend)(true, {
|
|
1006
1006
|
bail: !configuration.givenCommandLineArguments.includes('--watch'),
|
|
1007
1007
|
context: configuration.path.context,
|
|
1008
1008
|
devtool: configuration.development.tool,
|
|
@@ -1064,7 +1064,7 @@ var webpackConfiguration = exports.webpackConfiguration = _clientnode["default"]
|
|
|
1064
1064
|
chunkIds: configuration.debug ? 'named' : 'total-size',
|
|
1065
1065
|
moduleIds: configuration.debug ? 'named' : 'size',
|
|
1066
1066
|
// region common chunks
|
|
1067
|
-
splitChunks: _clientnode
|
|
1067
|
+
splitChunks: (0, _clientnode.extend)(true, !configuration.injection.chunks || configuration.targetTechnology.payload === 'node' || configuration.givenCommandLineArguments[2] === 'test' ? {
|
|
1068
1068
|
cacheGroups: {
|
|
1069
1069
|
"default": false,
|
|
1070
1070
|
defaultVendors: false
|
|
@@ -1086,7 +1086,7 @@ var webpackConfiguration = exports.webpackConfiguration = _clientnode["default"]
|
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
1088
|
}, configuration.injection.chunks)
|
|
1089
|
-
}, _clientnode
|
|
1089
|
+
}, (0, _clientnode.mask)(_module.optimizer, {
|
|
1090
1090
|
exclude: {
|
|
1091
1091
|
babelMinify: true,
|
|
1092
1092
|
cssnano: true,
|
|
@@ -1105,8 +1105,8 @@ if (!Array.isArray(_module.skipParseRegularExpressions) || _module.skipParseRegu
|
|
|
1105
1105
|
if ((_configuration$path$c2 = configuration.path.configuration) !== null && _configuration$path$c2 !== void 0 && _configuration$path$c2.javaScript) try {
|
|
1106
1106
|
require.resolve(configuration.path.configuration.javaScript);
|
|
1107
1107
|
var result = optionalRequire(configuration.path.configuration.javaScript);
|
|
1108
|
-
if (_clientnode
|
|
1109
|
-
if (Object.prototype.hasOwnProperty.call(result, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = result.replaceWebOptimizer;else _clientnode
|
|
1108
|
+
if ((0, _clientnode.isPlainObject)(result)) {
|
|
1109
|
+
if (Object.prototype.hasOwnProperty.call(result, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = result.replaceWebOptimizer;else (0, _clientnode.extend)(true, webpackConfiguration, result);
|
|
1110
1110
|
} else console.debug('Failed to load given JavaScript configuration file path "' + "".concat(configuration.path.configuration.javaScript, "\"."));
|
|
1111
1111
|
} catch (error) {
|
|
1112
1112
|
console.debug('Optional configuration file script "' + "".concat(configuration.path.configuration.javaScript, "\" not available."));
|