weboptimizer 2.0.1155 → 2.0.1158
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/configurator.js +67 -49
- package/helper.js +140 -120
- package/index.js +34 -30
- package/package.json +2 -2
- package/webpackConfigurator.js +48 -39
package/configurator.js
CHANGED
|
@@ -26,13 +26,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
26
26
|
});
|
|
27
27
|
exports.loadedConfiguration = exports.load = exports.get = exports["default"] = void 0;
|
|
28
28
|
|
|
29
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
30
|
+
|
|
29
31
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
30
32
|
|
|
31
33
|
var _clientnode = _interopRequireWildcard(require("clientnode"));
|
|
32
34
|
|
|
33
35
|
var _fs = _interopRequireWildcard(require("fs"));
|
|
34
36
|
|
|
35
|
-
var
|
|
37
|
+
var _path2 = _interopRequireWildcard(require("path"));
|
|
36
38
|
|
|
37
39
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
38
40
|
|
|
@@ -85,11 +87,11 @@ var load = function load(context) {
|
|
|
85
87
|
_package.configuration["default"].path.context = webOptimizerPath;
|
|
86
88
|
|
|
87
89
|
while (true) {
|
|
88
|
-
_package.configuration["default"].path.context = (0,
|
|
89
|
-
if ((0,
|
|
90
|
+
_package.configuration["default"].path.context = (0, _path2.resolve)(_package.configuration["default"].path.context, '../../');
|
|
91
|
+
if ((0, _path2.basename)((0, _path2.dirname)(_package.configuration["default"].path.context)) !== 'node_modules') break;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
if ((0,
|
|
94
|
+
if ((0, _path2.basename)((0, _path2.dirname)(currentWorkingDirectory)) === 'node_modules' || (0, _path2.basename)((0, _path2.dirname)(currentWorkingDirectory)) === '.staging' && (0, _path2.basename)((0, _path2.dirname)((0, _path2.dirname)(currentWorkingDirectory))) === 'node_modules') {
|
|
93
95
|
/*
|
|
94
96
|
NOTE: If we are dealing was a dependency project use current
|
|
95
97
|
directory as context.
|
|
@@ -104,7 +106,7 @@ var load = function load(context) {
|
|
|
104
106
|
hierarchy.
|
|
105
107
|
*/
|
|
106
108
|
try {
|
|
107
|
-
if ((0, _fs.lstatSync)((0,
|
|
109
|
+
if ((0, _fs.lstatSync)((0, _path2.join)(currentWorkingDirectory, 'node_modules')).isSymbolicLink()) _package.configuration["default"].path.context = currentWorkingDirectory;
|
|
108
110
|
} catch (error) {// Continue regardless of error.
|
|
109
111
|
}
|
|
110
112
|
} // endregion
|
|
@@ -113,7 +115,7 @@ var load = function load(context) {
|
|
|
113
115
|
var specificConfiguration = {};
|
|
114
116
|
|
|
115
117
|
try {
|
|
116
|
-
specificConfiguration = (0, _clientnode.currentRequire)((0,
|
|
118
|
+
specificConfiguration = (0, _clientnode.currentRequire)((0, _path2.join)(_package.configuration["default"].path.context, 'package'));
|
|
117
119
|
} catch (error) {
|
|
118
120
|
_package.configuration["default"].path.context = currentWorkingDirectory;
|
|
119
121
|
} // endregion
|
|
@@ -197,8 +199,8 @@ var load = function load(context) {
|
|
|
197
199
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
198
200
|
var _type3 = _step2.value;
|
|
199
201
|
|
|
200
|
-
for (var
|
|
201
|
-
var _configurationTarget = _arr2[
|
|
202
|
+
for (var _i7 = 0, _arr2 = [configuration, specificConfiguration]; _i7 < _arr2.length; _i7++) {
|
|
203
|
+
var _configurationTarget = _arr2[_i7];
|
|
202
204
|
if (Object.prototype.hasOwnProperty.call(_configurationTarget, _type3) && (0, _typeof2["default"])(_configurationTarget[_type3]) === 'object') delete _configurationTarget[_type3];
|
|
203
205
|
}
|
|
204
206
|
} ///// endregion
|
|
@@ -244,18 +246,30 @@ var load = function load(context) {
|
|
|
244
246
|
configuration = _clientnode["default"].removeKeyPrefixes(configuration); // endregion
|
|
245
247
|
/// region build absolute paths
|
|
246
248
|
|
|
247
|
-
configuration.path.base = (0,
|
|
249
|
+
configuration.path.base = (0, _path2.resolve)(configuration.path.context, configuration.path.base);
|
|
250
|
+
|
|
251
|
+
for (var _i2 = 0, _Object$entries = Object.entries(configuration.path); _i2 < _Object$entries.length; _i2++) {
|
|
252
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i2], 2),
|
|
253
|
+
key = _Object$entries$_i[0],
|
|
254
|
+
_path = _Object$entries$_i[1];
|
|
255
|
+
|
|
256
|
+
if (!['base', 'configuration'].includes(key)) if (typeof _path === 'string') configuration.path[key] = (0, _path2.resolve)(configuration.path.base, _path) + '/';else if (_clientnode["default"].isPlainObject(_path)) {
|
|
257
|
+
if (Object.prototype.hasOwnProperty.call(_path, 'base')) configuration.path[key].base = (0, _path2.resolve)(configuration.path.base, _path.base);
|
|
258
|
+
|
|
259
|
+
for (var _i3 = 0, _Object$entries2 = Object.entries(_path); _i3 < _Object$entries2.length; _i3++) {
|
|
260
|
+
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i3], 2),
|
|
261
|
+
subKey = _Object$entries2$_i[0],
|
|
262
|
+
subPath = _Object$entries2$_i[1];
|
|
248
263
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (Object.prototype.hasOwnProperty.call(configuration.path[key], 'base')) configuration.path[key].base = (0, _path.resolve)(configuration.path.base, configuration.path[key].base);
|
|
264
|
+
if (!['base', 'public'].includes(subKey) && typeof subPath === 'string') _path[subKey] = (0, _path2.resolve)(_path.base, subPath) + '/';else if (subKey !== 'options' && _clientnode["default"].isPlainObject(subPath)) {
|
|
265
|
+
subPath.base = (0, _path2.resolve)(_path.base, subPath.base);
|
|
252
266
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
267
|
+
for (var _i4 = 0, _Object$entries3 = Object.entries(subPath); _i4 < _Object$entries3.length; _i4++) {
|
|
268
|
+
var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i4], 2),
|
|
269
|
+
subSubKey = _Object$entries3$_i[0],
|
|
270
|
+
subSubPath = _Object$entries3$_i[1];
|
|
256
271
|
|
|
257
|
-
|
|
258
|
-
if (Object.prototype.hasOwnProperty.call(configuration.path[key][subKey], subSubKey) && subSubKey !== 'base' && typeof configuration.path[key][subKey][subSubKey] === 'string') configuration.path[key][subKey][subSubKey] = (0, _path.resolve)(configuration.path[key][subKey].base, configuration.path[key][subKey][subSubKey]) + '/';
|
|
272
|
+
if (subSubKey !== 'base' && typeof subSubPath === 'string') subPath[subSubKey] = (0, _path2.resolve)(subPath.base, subSubPath) + '/';
|
|
259
273
|
}
|
|
260
274
|
}
|
|
261
275
|
}
|
|
@@ -275,7 +289,7 @@ var load = function load(context) {
|
|
|
275
289
|
fileSystem: _fs["default"],
|
|
276
290
|
Helper: _helper["default"],
|
|
277
291
|
optionalRequire: _clientnode.optionalRequire,
|
|
278
|
-
path:
|
|
292
|
+
path: _path2["default"],
|
|
279
293
|
require: _clientnode.currentRequire,
|
|
280
294
|
Tools: _clientnode["default"],
|
|
281
295
|
webOptimizerPath: webOptimizerPath,
|
|
@@ -290,10 +304,14 @@ var load = function load(context) {
|
|
|
290
304
|
var defaultConfiguration = resolvedConfiguration.buildContext.types["default"];
|
|
291
305
|
delete resolvedConfiguration.buildContext.types["default"];
|
|
292
306
|
|
|
293
|
-
for (var
|
|
294
|
-
|
|
307
|
+
for (var _i5 = 0, _Object$entries4 = Object.entries(resolvedConfiguration.buildContext.types); _i5 < _Object$entries4.length; _i5++) {
|
|
308
|
+
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
|
|
309
|
+
_type = _Object$entries4$_i[0],
|
|
310
|
+
_context = _Object$entries4$_i[1];
|
|
311
|
+
|
|
312
|
+
resolvedConfiguration.buildContext.types[_type] = _clientnode["default"].extend(true, _clientnode["default"].copy(defaultConfiguration), _clientnode["default"].extend(true, {
|
|
295
313
|
extension: _type
|
|
296
|
-
},
|
|
314
|
+
}, _context, {
|
|
297
315
|
type: _type
|
|
298
316
|
}));
|
|
299
317
|
} // endregion
|
|
@@ -304,7 +322,7 @@ var load = function load(context) {
|
|
|
304
322
|
file: resolvedConfiguration.extensions.file.internal
|
|
305
323
|
}, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base);
|
|
306
324
|
resolvedConfiguration.injection = _helper["default"].resolveAutoInjection(resolvedConfiguration.injection, _helper["default"].resolveBuildConfigurationFilePaths(resolvedConfiguration.buildContext.types, resolvedConfiguration.path.source.asset.base, _helper["default"].normalizePaths(resolvedConfiguration.path.ignore.concat(resolvedConfiguration.module.directoryNames, resolvedConfiguration.loader.directoryNames).map(function (filePath) {
|
|
307
|
-
return (0,
|
|
325
|
+
return (0, _path2.resolve)(resolvedConfiguration.path.context, filePath);
|
|
308
326
|
}).filter(function (filePath) {
|
|
309
327
|
return !resolvedConfiguration.path.context.startsWith(filePath);
|
|
310
328
|
})), resolvedConfiguration["package"].main.fileNames), resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, resolvedConfiguration.extensions, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base, resolvedConfiguration.path.ignore);
|
|
@@ -312,7 +330,7 @@ var load = function load(context) {
|
|
|
312
330
|
resolvedConfiguration.injection.entry = {
|
|
313
331
|
given: givenInjection,
|
|
314
332
|
normalized: _helper["default"].resolveModulesInFolders(_helper["default"].normalizeGivenInjection(givenInjection), resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, resolvedConfiguration.path.context, resolvedConfiguration.path.source.asset.base, resolvedConfiguration.path.ignore.concat(resolvedConfiguration.module.directoryNames, resolvedConfiguration.loader.directoryNames).map(function (filePath) {
|
|
315
|
-
return (0,
|
|
333
|
+
return (0, _path2.resolve)(resolvedConfiguration.path.context, filePath);
|
|
316
334
|
}).filter(function (filePath) {
|
|
317
335
|
return !resolvedConfiguration.path.context.startsWith(filePath);
|
|
318
336
|
}))
|
|
@@ -321,34 +339,34 @@ var load = function load(context) {
|
|
|
321
339
|
javaScript: configuration.debug && ['serve', 'test:browser'].includes(resolvedConfiguration.givenCommandLineArguments[2])
|
|
322
340
|
}; /// region determine which asset types are needed
|
|
323
341
|
|
|
324
|
-
for (var
|
|
325
|
-
|
|
326
|
-
var _iterator4 = _createForOfIteratorHelper(resolvedConfiguration.injection.entry.normalized[chunkName]),
|
|
327
|
-
_step4;
|
|
342
|
+
for (var _i6 = 0, _Object$values = Object.values(resolvedConfiguration.injection.entry.normalized); _i6 < _Object$values.length; _i6++) {
|
|
343
|
+
var chunk = _Object$values[_i6];
|
|
328
344
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
} finally {
|
|
350
|
-
_iterator4.f();
|
|
345
|
+
var _iterator4 = _createForOfIteratorHelper(chunk),
|
|
346
|
+
_step4;
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
350
|
+
var moduleID = _step4.value;
|
|
351
|
+
|
|
352
|
+
var _filePath = _helper["default"].determineModuleFilePath(moduleID, resolvedConfiguration.module.aliases, resolvedConfiguration.module.replacements.normal, {
|
|
353
|
+
file: resolvedConfiguration.extensions.file.internal
|
|
354
|
+
}, resolvedConfiguration.path.context,
|
|
355
|
+
/*
|
|
356
|
+
NOTE: We doesn't use
|
|
357
|
+
"resolvedConfiguration.path.source.asset.base" because
|
|
358
|
+
we already have resolved all module ids.
|
|
359
|
+
*/
|
|
360
|
+
'./', resolvedConfiguration.path.ignore, resolvedConfiguration.module.directoryNames, resolvedConfiguration["package"].main.fileNames, resolvedConfiguration["package"].main.propertyNames, resolvedConfiguration["package"].aliasPropertyNames, resolvedConfiguration.encoding);
|
|
361
|
+
|
|
362
|
+
var _type2 = null;
|
|
363
|
+
if (_filePath) _type2 = _helper["default"].determineAssetType(_filePath, resolvedConfiguration.buildContext.types, resolvedConfiguration.path);else throw new Error("Given request \"".concat(moduleID, "\" couldn't be resolved."));
|
|
364
|
+
if (_type2) resolvedConfiguration.needed[_type2] = true;
|
|
351
365
|
}
|
|
366
|
+
} catch (err) {
|
|
367
|
+
_iterator4.e(err);
|
|
368
|
+
} finally {
|
|
369
|
+
_iterator4.f();
|
|
352
370
|
}
|
|
353
371
|
} /// endregion
|
|
354
372
|
// endregion
|
package/helper.js
CHANGED
|
@@ -162,8 +162,12 @@ var Helper = /*#__PURE__*/function () {
|
|
|
162
162
|
}, scope);
|
|
163
163
|
var filePath = template;
|
|
164
164
|
|
|
165
|
-
for (var
|
|
166
|
-
|
|
165
|
+
for (var _i = 0, _Object$entries = Object.entries(scope); _i < _Object$entries.length; _i++) {
|
|
166
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
167
|
+
placeholderName = _Object$entries$_i[0],
|
|
168
|
+
value = _Object$entries$_i[1];
|
|
169
|
+
|
|
170
|
+
filePath = filePath.replace(new RegExp(_clientnode["default"].stringEscapeRegularExpressions(placeholderName), 'g'), "".concat(value));
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
return filePath;
|
|
@@ -316,23 +320,23 @@ var Helper = /*#__PURE__*/function () {
|
|
|
316
320
|
|
|
317
321
|
if (!(filePath || inPlaceNormalLibrary) || _clientnode["default"].isAnyMatching(resolvedRequest, includePattern)) return Helper.applyContext(resolvedRequest, requestContext, referencePath, aliases, moduleReplacements, relativeModuleLocations) || null;
|
|
318
322
|
|
|
319
|
-
for (var
|
|
320
|
-
|
|
321
|
-
var _iterator3 = _createForOfIteratorHelper(normalizedGivenInjection[chunkName]),
|
|
322
|
-
_step3;
|
|
323
|
+
for (var _i2 = 0, _Object$values = Object.values(normalizedGivenInjection); _i2 < _Object$values.length; _i2++) {
|
|
324
|
+
var chunk = _Object$values[_i2];
|
|
323
325
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
} finally {
|
|
334
|
-
_iterator3.f();
|
|
326
|
+
var _iterator3 = _createForOfIteratorHelper(chunk),
|
|
327
|
+
_step3;
|
|
328
|
+
|
|
329
|
+
try {
|
|
330
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
331
|
+
var moduleID = _step3.value;
|
|
332
|
+
if (Helper.determineModuleFilePath(moduleID, aliases, moduleReplacements, {
|
|
333
|
+
file: extensions.file.internal
|
|
334
|
+
}, context, requestContext, pathsToIgnore, relativeModuleLocations, packageEntryFileNames, packageMainPropertyNames, packageAliasPropertyNames, encoding) === filePath) return null;
|
|
335
335
|
}
|
|
336
|
+
} catch (err) {
|
|
337
|
+
_iterator3.e(err);
|
|
338
|
+
} finally {
|
|
339
|
+
_iterator3.f();
|
|
336
340
|
}
|
|
337
341
|
}
|
|
338
342
|
|
|
@@ -391,11 +395,15 @@ var Helper = /*#__PURE__*/function () {
|
|
|
391
395
|
}
|
|
392
396
|
}
|
|
393
397
|
|
|
394
|
-
if (!result) for (var
|
|
395
|
-
var _type = _arr[
|
|
398
|
+
if (!result) for (var _i3 = 0, _arr = [paths.source, paths.target]; _i3 < _arr.length; _i3++) {
|
|
399
|
+
var _type = _arr[_i3];
|
|
396
400
|
|
|
397
|
-
for (var
|
|
398
|
-
|
|
401
|
+
for (var _i4 = 0, _Object$entries2 = Object.entries(_type.asset); _i4 < _Object$entries2.length; _i4++) {
|
|
402
|
+
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i4], 2),
|
|
403
|
+
assetType = _Object$entries2$_i[0],
|
|
404
|
+
assetConfiguration = _Object$entries2$_i[1];
|
|
405
|
+
|
|
406
|
+
if (assetType !== 'base' && assetConfiguration && filePath.startsWith(assetConfiguration)) return assetType;
|
|
399
407
|
}
|
|
400
408
|
}
|
|
401
409
|
return result;
|
|
@@ -422,39 +430,39 @@ var Helper = /*#__PURE__*/function () {
|
|
|
422
430
|
var mainFileBasenames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ['index', 'main'];
|
|
423
431
|
var buildConfiguration = [];
|
|
424
432
|
|
|
425
|
-
for (var
|
|
426
|
-
|
|
427
|
-
var newItem = _clientnode["default"].extend(true, {
|
|
428
|
-
filePaths: []
|
|
429
|
-
}, configuration[type]);
|
|
433
|
+
for (var _i5 = 0, _Object$values2 = Object.values(configuration); _i5 < _Object$values2.length; _i5++) {
|
|
434
|
+
var value = _Object$values2[_i5];
|
|
430
435
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
_step5;
|
|
436
|
+
var newItem = _clientnode["default"].extend(true, {
|
|
437
|
+
filePaths: []
|
|
438
|
+
}, value);
|
|
435
439
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
440
|
+
var _iterator5 = _createForOfIteratorHelper(_clientnode["default"].walkDirectoryRecursivelySync(entryPath, function (file) {
|
|
441
|
+
if (Helper.isFilePathInLocation(file.path, pathsToIgnore)) return false;
|
|
442
|
+
})),
|
|
443
|
+
_step5;
|
|
439
444
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
_iterator5.f();
|
|
445
|
+
try {
|
|
446
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
447
|
+
var _file$stats;
|
|
448
|
+
|
|
449
|
+
var file = _step5.value;
|
|
450
|
+
if ((_file$stats = file.stats) !== null && _file$stats !== void 0 && _file$stats.isFile() && file.path.endsWith(".".concat(newItem.extension)) && !(newItem.ignoredExtension && file.path.endsWith(".".concat(newItem.ignoredExtension))) && !new RegExp(newItem.filePathPattern).test(file.path)) newItem.filePaths.push(file.path);
|
|
447
451
|
}
|
|
452
|
+
} catch (err) {
|
|
453
|
+
_iterator5.e(err);
|
|
454
|
+
} finally {
|
|
455
|
+
_iterator5.f();
|
|
456
|
+
}
|
|
448
457
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
458
|
+
newItem.filePaths.sort(function (firstFilePath, secondFilePath) {
|
|
459
|
+
if (mainFileBasenames.includes((0, _path.basename)(firstFilePath, (0, _path.extname)(firstFilePath)))) {
|
|
460
|
+
if (mainFileBasenames.includes((0, _path.basename)(secondFilePath, (0, _path.extname)(secondFilePath)))) return 0;
|
|
461
|
+
} else if (mainFileBasenames.includes((0, _path.basename)(secondFilePath, (0, _path.extname)(secondFilePath)))) return 1;
|
|
453
462
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
463
|
+
return 0;
|
|
464
|
+
});
|
|
465
|
+
buildConfiguration.push(newItem);
|
|
458
466
|
}
|
|
459
467
|
|
|
460
468
|
return buildConfiguration.sort(function (first, second) {
|
|
@@ -517,27 +525,27 @@ var Helper = /*#__PURE__*/function () {
|
|
|
517
525
|
var directoryPaths = [];
|
|
518
526
|
var normalizedGivenInjection = Helper.resolveModulesInFolders(Helper.normalizeGivenInjection(givenInjection), aliases, moduleReplacements, context, referencePath, pathsToIgnore);
|
|
519
527
|
|
|
520
|
-
for (var
|
|
521
|
-
|
|
522
|
-
var _iterator6 = _createForOfIteratorHelper(normalizedGivenInjection[chunkName]),
|
|
523
|
-
_step6;
|
|
528
|
+
for (var _i6 = 0, _Object$values3 = Object.values(normalizedGivenInjection); _i6 < _Object$values3.length; _i6++) {
|
|
529
|
+
var chunk = _Object$values3[_i6];
|
|
524
530
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
531
|
+
var _iterator6 = _createForOfIteratorHelper(chunk),
|
|
532
|
+
_step6;
|
|
533
|
+
|
|
534
|
+
try {
|
|
535
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
536
|
+
var moduleID = _step6.value;
|
|
537
|
+
var filePath = Helper.determineModuleFilePath(moduleID, aliases, moduleReplacements, extensions, context, referencePath, pathsToIgnore, relativeModuleLocations, packageEntryFileNames, packageMainPropertyNames, packageAliasPropertyNames, encoding);
|
|
538
|
+
|
|
539
|
+
if (filePath) {
|
|
540
|
+
filePaths.push(filePath);
|
|
541
|
+
var directoryPath = (0, _path.dirname)(filePath);
|
|
542
|
+
if (!directoryPaths.includes(directoryPath)) directoryPaths.push(directoryPath);
|
|
535
543
|
}
|
|
536
|
-
} catch (err) {
|
|
537
|
-
_iterator6.e(err);
|
|
538
|
-
} finally {
|
|
539
|
-
_iterator6.f();
|
|
540
544
|
}
|
|
545
|
+
} catch (err) {
|
|
546
|
+
_iterator6.e(err);
|
|
547
|
+
} finally {
|
|
548
|
+
_iterator6.f();
|
|
541
549
|
}
|
|
542
550
|
}
|
|
543
551
|
|
|
@@ -572,54 +580,53 @@ var Helper = /*#__PURE__*/function () {
|
|
|
572
580
|
var pathsToIgnore = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ['.git'];
|
|
573
581
|
if (referencePath.startsWith('/')) referencePath = (0, _path.relative)(context, referencePath);
|
|
574
582
|
|
|
575
|
-
for (var
|
|
576
|
-
|
|
577
|
-
|
|
583
|
+
for (var _i7 = 0, _Object$values4 = Object.values(normalizedGivenInjection); _i7 < _Object$values4.length; _i7++) {
|
|
584
|
+
var chunk = _Object$values4[_i7];
|
|
585
|
+
var index = 0;
|
|
578
586
|
|
|
579
|
-
|
|
580
|
-
|
|
587
|
+
var _iterator7 = _createForOfIteratorHelper(chunk),
|
|
588
|
+
_step7;
|
|
581
589
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
590
|
+
try {
|
|
591
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
592
|
+
var moduleID = _step7.value;
|
|
593
|
+
var resolvedModuleID = Helper.applyModuleReplacements(Helper.applyAliases(Helper.stripLoader(moduleID), aliases), moduleReplacements);
|
|
586
594
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
595
|
+
if (resolvedModuleID === false) {
|
|
596
|
+
chunk.splice(index, 1);
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
591
599
|
|
|
592
|
-
|
|
600
|
+
var resolvedPath = (0, _path.resolve)(referencePath, resolvedModuleID);
|
|
593
601
|
|
|
594
|
-
|
|
595
|
-
|
|
602
|
+
if (_clientnode["default"].isDirectorySync(resolvedPath)) {
|
|
603
|
+
chunk.splice(index, 1);
|
|
596
604
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
605
|
+
var _iterator8 = _createForOfIteratorHelper(_clientnode["default"].walkDirectoryRecursivelySync(resolvedPath, function (file) {
|
|
606
|
+
if (Helper.isFilePathInLocation(file.path, pathsToIgnore)) return false;
|
|
607
|
+
})),
|
|
608
|
+
_step8;
|
|
601
609
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
610
|
+
try {
|
|
611
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
612
|
+
var _file$stats2;
|
|
605
613
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
609
|
-
} catch (err) {
|
|
610
|
-
_iterator8.e(err);
|
|
611
|
-
} finally {
|
|
612
|
-
_iterator8.f();
|
|
614
|
+
var file = _step8.value;
|
|
615
|
+
if ((_file$stats2 = file.stats) !== null && _file$stats2 !== void 0 && _file$stats2.isFile()) chunk.push('./' + (0, _path.relative)(referencePath, (0, _path.resolve)(resolvedPath, file.path)));
|
|
613
616
|
}
|
|
614
|
-
}
|
|
617
|
+
} catch (err) {
|
|
618
|
+
_iterator8.e(err);
|
|
619
|
+
} finally {
|
|
620
|
+
_iterator8.f();
|
|
621
|
+
}
|
|
622
|
+
} else if (resolvedModuleID.startsWith('./') && !resolvedModuleID.startsWith("./".concat((0, _path.relative)(context, referencePath)))) chunk[index] = "./".concat((0, _path.relative)(context, resolvedPath));
|
|
615
623
|
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
} catch (err) {
|
|
619
|
-
_iterator7.e(err);
|
|
620
|
-
} finally {
|
|
621
|
-
_iterator7.f();
|
|
624
|
+
index += 1;
|
|
622
625
|
}
|
|
626
|
+
} catch (err) {
|
|
627
|
+
_iterator7.e(err);
|
|
628
|
+
} finally {
|
|
629
|
+
_iterator7.f();
|
|
623
630
|
}
|
|
624
631
|
}
|
|
625
632
|
|
|
@@ -647,15 +654,19 @@ var Helper = /*#__PURE__*/function () {
|
|
|
647
654
|
var hasContent = false;
|
|
648
655
|
var chunkNamesToDelete = [];
|
|
649
656
|
|
|
650
|
-
for (var
|
|
651
|
-
|
|
652
|
-
|
|
657
|
+
for (var _i8 = 0, _Object$entries3 = Object.entries(givenInjection); _i8 < _Object$entries3.length; _i8++) {
|
|
658
|
+
var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i8], 2),
|
|
659
|
+
chunkName = _Object$entries3$_i[0],
|
|
660
|
+
chunk = _Object$entries3$_i[1];
|
|
661
|
+
|
|
662
|
+
if (Array.isArray(chunk)) {
|
|
663
|
+
if (chunk.length > 0) {
|
|
653
664
|
hasContent = true;
|
|
654
|
-
result[chunkName] =
|
|
665
|
+
result[chunkName] = chunk;
|
|
655
666
|
} else chunkNamesToDelete.push(chunkName);
|
|
656
667
|
} else {
|
|
657
668
|
hasContent = true;
|
|
658
|
-
result[chunkName] = [
|
|
669
|
+
result[chunkName] = [chunk];
|
|
659
670
|
}
|
|
660
671
|
}
|
|
661
672
|
|
|
@@ -732,17 +743,18 @@ var Helper = /*#__PURE__*/function () {
|
|
|
732
743
|
/* eslint-disable curly */
|
|
733
744
|
|
|
734
745
|
if (_clientnode["default"].isPlainObject(injectionType)) {
|
|
735
|
-
for (var
|
|
736
|
-
var _Object$
|
|
737
|
-
chunkName = _Object$
|
|
738
|
-
chunk = _Object$
|
|
746
|
+
for (var _i9 = 0, _Object$entries4 = Object.entries(injectionType); _i9 < _Object$entries4.length; _i9++) {
|
|
747
|
+
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i9], 2),
|
|
748
|
+
chunkName = _Object$entries4$_i[0],
|
|
749
|
+
chunk = _Object$entries4$_i[1];
|
|
739
750
|
|
|
740
751
|
if (chunk === '__auto__') {
|
|
741
752
|
chunk = injectionType[chunkName] = [];
|
|
742
753
|
var modules = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, referencePath);
|
|
743
754
|
|
|
744
|
-
for (var
|
|
745
|
-
|
|
755
|
+
for (var _i10 = 0, _Object$values5 = Object.values(modules); _i10 < _Object$values5.length; _i10++) {
|
|
756
|
+
var subChunk = _Object$values5[_i10];
|
|
757
|
+
chunk.push(subChunk);
|
|
746
758
|
}
|
|
747
759
|
/*
|
|
748
760
|
Reverse array to let javaScript and main files be
|
|
@@ -1060,10 +1072,14 @@ var Helper = /*#__PURE__*/function () {
|
|
|
1060
1072
|
}, {
|
|
1061
1073
|
key: "applyAliases",
|
|
1062
1074
|
value: function applyAliases(moduleID, aliases) {
|
|
1063
|
-
for (var
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1075
|
+
for (var _i11 = 0, _Object$entries5 = Object.entries(aliases); _i11 < _Object$entries5.length; _i11++) {
|
|
1076
|
+
var _Object$entries5$_i = (0, _slicedToArray2["default"])(_Object$entries5[_i11], 2),
|
|
1077
|
+
name = _Object$entries5$_i[0],
|
|
1078
|
+
alias = _Object$entries5$_i[1];
|
|
1079
|
+
|
|
1080
|
+
if (name.endsWith('$')) {
|
|
1081
|
+
if (moduleID === name.substring(0, name.length - 1)) moduleID = alias;
|
|
1082
|
+
} else if (typeof moduleID === 'string') moduleID = moduleID.replace(name, alias);
|
|
1067
1083
|
}
|
|
1068
1084
|
|
|
1069
1085
|
return moduleID;
|
|
@@ -1083,8 +1099,12 @@ var Helper = /*#__PURE__*/function () {
|
|
|
1083
1099
|
value: function applyModuleReplacements(moduleID, replacements) {
|
|
1084
1100
|
if (moduleID === false) return moduleID;
|
|
1085
1101
|
|
|
1086
|
-
for (var
|
|
1087
|
-
|
|
1102
|
+
for (var _i12 = 0, _Object$entries6 = Object.entries(replacements); _i12 < _Object$entries6.length; _i12++) {
|
|
1103
|
+
var _Object$entries6$_i = (0, _slicedToArray2["default"])(_Object$entries6[_i12], 2),
|
|
1104
|
+
search = _Object$entries6$_i[0],
|
|
1105
|
+
replacement = _Object$entries6$_i[1];
|
|
1106
|
+
|
|
1107
|
+
moduleID = moduleID.replace(new RegExp(search), replacement);
|
|
1088
1108
|
}
|
|
1089
1109
|
|
|
1090
1110
|
return moduleID;
|
package/index.js
CHANGED
|
@@ -30,6 +30,8 @@ exports["default"] = void 0;
|
|
|
30
30
|
|
|
31
31
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
32
32
|
|
|
33
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
34
|
+
|
|
33
35
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
34
36
|
|
|
35
37
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -408,44 +410,46 @@ var main = /*#__PURE__*/function () {
|
|
|
408
410
|
if (tidiedUp) return;
|
|
409
411
|
tidiedUp = true;
|
|
410
412
|
|
|
411
|
-
for (var
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
for (var _i = 0, _Object$entries = Object.entries(configuration.injection.entry.normalized); _i < _Object$entries.length; _i++) {
|
|
414
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
415
|
+
chunkName = _Object$entries$_i[0],
|
|
416
|
+
chunk = _Object$entries$_i[1];
|
|
415
417
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
var moduleID = _step4.value;
|
|
418
|
+
var _iterator4 = _createForOfIteratorHelper(chunk),
|
|
419
|
+
_step4;
|
|
419
420
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
try {
|
|
422
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
423
|
+
var moduleID = _step4.value;
|
|
423
424
|
|
|
424
|
-
|
|
425
|
-
|
|
425
|
+
var _filePath2 = _helper["default"].determineModuleFilePath(moduleID, configuration.module.aliases, configuration.module.replacements.normal, {
|
|
426
|
+
file: configuration.extensions.file.internal
|
|
427
|
+
}, configuration.path.context, configuration.path.source.asset.base, configuration.path.ignore, configuration.module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
426
428
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
'[name]': chunkName
|
|
430
|
-
});
|
|
431
|
-
/*
|
|
432
|
-
NOTE: Close handler have to be
|
|
433
|
-
synchronous.
|
|
434
|
-
*/
|
|
429
|
+
var type = null;
|
|
430
|
+
if (_filePath2) type = _helper["default"].determineAssetType(_filePath2, configuration.buildContext.types, configuration.path);
|
|
435
431
|
|
|
432
|
+
if (typeof type === 'string' && configuration.buildContext.types[type]) {
|
|
433
|
+
var _filePath3 = _helper["default"].renderFilePathTemplate(_helper["default"].stripLoader(configuration.files.compose.javaScript), {
|
|
434
|
+
'[name]': chunkName
|
|
435
|
+
});
|
|
436
|
+
/*
|
|
437
|
+
NOTE: Close handler have to be
|
|
438
|
+
synchronous.
|
|
439
|
+
*/
|
|
436
440
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
|
|
442
|
+
/*
|
|
443
|
+
NOTE: Close handler have to be
|
|
444
|
+
synchronous.
|
|
445
|
+
*/
|
|
446
|
+
if (configuration.buildContext.types[type].outputExtension === 'js' && _clientnode["default"].isFileSync(_filePath3)) (0, _fs.chmodSync)(_filePath3, '755');
|
|
443
447
|
}
|
|
444
|
-
} catch (err) {
|
|
445
|
-
_iterator4.e(err);
|
|
446
|
-
} finally {
|
|
447
|
-
_iterator4.f();
|
|
448
448
|
}
|
|
449
|
+
} catch (err) {
|
|
450
|
+
_iterator4.e(err);
|
|
451
|
+
} finally {
|
|
452
|
+
_iterator4.f();
|
|
449
453
|
}
|
|
450
454
|
}
|
|
451
455
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1158",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"test:watch": "yarn test --watch",
|
|
78
78
|
"test:watch:all": "yarn test --watchAll",
|
|
79
79
|
"update": "yarn version --patch && yarn publish",
|
|
80
|
-
"update:documentation": "
|
|
80
|
+
"update:documentation": "documentation-website"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@babel/core": "*",
|
package/webpackConfigurator.js
CHANGED
|
@@ -89,11 +89,13 @@ var pluginNameResourceMapping = {
|
|
|
89
89
|
};
|
|
90
90
|
var plugins = {};
|
|
91
91
|
|
|
92
|
-
for (var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
for (var _i = 0, _Object$entries = Object.entries(pluginNameResourceMapping); _i < _Object$entries.length; _i++) {
|
|
93
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
94
|
+
name = _Object$entries$_i[0],
|
|
95
|
+
alias = _Object$entries$_i[1];
|
|
96
|
+
|
|
97
|
+
var plugin = (0, _clientnode.optionalRequire)(alias);
|
|
98
|
+
if (plugin) plugins[name] = plugin;else console.debug("Optional webpack plugin \"".concat(name, "\" not available."));
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
if (plugins.Offline) {
|
|
@@ -133,17 +135,19 @@ try {
|
|
|
133
135
|
_iterator.f();
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
var _loop = function _loop(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
var _loop = function _loop() {
|
|
139
|
+
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i2], 2),
|
|
140
|
+
source = _Object$entries2$_i[0],
|
|
141
|
+
replacement = _Object$entries2$_i[1];
|
|
142
|
+
|
|
143
|
+
var search = new RegExp(source);
|
|
144
|
+
pluginInstances.push(new _webpack.NormalModuleReplacementPlugin(search, function (resource) {
|
|
145
|
+
resource.request = resource.request.replace(search, replacement);
|
|
146
|
+
}));
|
|
143
147
|
};
|
|
144
148
|
|
|
145
|
-
for (var
|
|
146
|
-
_loop(
|
|
149
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(_module.replacements.normal); _i2 < _Object$entries2.length; _i2++) {
|
|
150
|
+
_loop();
|
|
147
151
|
} //// endregion
|
|
148
152
|
//// region generate html file
|
|
149
153
|
|
|
@@ -176,13 +180,13 @@ if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode["de
|
|
|
176
180
|
//// region provide offline functionality
|
|
177
181
|
|
|
178
182
|
if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
179
|
-
if (!['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) for (var
|
|
183
|
+
if (!['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) for (var _i3 = 0, _Object$entries3 = Object.entries({
|
|
180
184
|
cascadingStyleSheet: 'css',
|
|
181
185
|
javaScript: 'js'
|
|
182
|
-
});
|
|
183
|
-
var _Object$
|
|
184
|
-
_name = _Object$
|
|
185
|
-
extension = _Object$
|
|
186
|
+
}); _i3 < _Object$entries3.length; _i3++) {
|
|
187
|
+
var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i3], 2),
|
|
188
|
+
_name = _Object$entries3$_i[0],
|
|
189
|
+
extension = _Object$entries3$_i[1];
|
|
186
190
|
|
|
187
191
|
var type = _name;
|
|
188
192
|
|
|
@@ -190,8 +194,8 @@ if (htmlAvailable && configuration.offline && plugins.Offline) {
|
|
|
190
194
|
var matches = Object.keys(configuration.inPlace[type]);
|
|
191
195
|
if (!Array.isArray(configuration.offline.common.excludeChunks)) configuration.offline.common.excludeChunks = [];
|
|
192
196
|
|
|
193
|
-
for (var
|
|
194
|
-
var _name2 = _matches[
|
|
197
|
+
for (var _i4 = 0, _matches = matches; _i4 < _matches.length; _i4++) {
|
|
198
|
+
var _name2 = _matches[_i4];
|
|
195
199
|
configuration.offline.common.excludeChunks.push((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset[type]) + "".concat(_name2, ".").concat(extension, "?").concat(configuration.hashAlgorithm, "=*"));
|
|
196
200
|
}
|
|
197
201
|
}
|
|
@@ -210,17 +214,18 @@ if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.pro
|
|
|
210
214
|
pluginInstances.push({
|
|
211
215
|
apply: function apply(compiler) {
|
|
212
216
|
compiler.hooks.emit.tap('applyModulePattern', function (compilation) {
|
|
213
|
-
for (var
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
for (var _i5 = 0, _Object$entries4 = Object.entries(compilation.assets); _i5 < _Object$entries4.length; _i5++) {
|
|
218
|
+
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
|
|
219
|
+
request = _Object$entries4$_i[0],
|
|
220
|
+
asset = _Object$entries4$_i[1];
|
|
216
221
|
|
|
217
|
-
|
|
222
|
+
var filePath = request.replace(/\?[^?]+$/, '');
|
|
218
223
|
|
|
219
|
-
|
|
220
|
-
var _source = compilation.assets[request].source();
|
|
224
|
+
var _type2 = _helper["default"].determineAssetType(filePath, configuration.buildContext.types, configuration.path);
|
|
221
225
|
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
if (_type2 && configuration.assetPattern[_type2] && new RegExp(configuration.assetPattern[_type2].includeFilePathRegularExpression).test(filePath) && !new RegExp(configuration.assetPattern[_type2].excludeFilePathRegularExpression).test(filePath)) {
|
|
227
|
+
var source = asset.source();
|
|
228
|
+
if (typeof source === 'string') compilation.assets[request] = new _webpackSources.RawSource(configuration.assetPattern[_type2].pattern.replace(/\{1\}/g, source.replace(/\$/g, '$$$')));
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
231
|
});
|
|
@@ -364,10 +369,10 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
364
369
|
file: configuration.extensions.file.external
|
|
365
370
|
}, configuration.path.context, context, configuration.path.ignore, _module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.encoding);
|
|
366
371
|
|
|
367
|
-
if (filePath) for (var
|
|
368
|
-
var _Object$
|
|
369
|
-
pattern = _Object$
|
|
370
|
-
targetConfiguration = _Object$
|
|
372
|
+
if (filePath) for (var _i6 = 0, _Object$entries5 = Object.entries(configuration.injection.external.aliases); _i6 < _Object$entries5.length; _i6++) {
|
|
373
|
+
var _Object$entries5$_i = (0, _slicedToArray2["default"])(_Object$entries5[_i6], 2),
|
|
374
|
+
pattern = _Object$entries5$_i[0],
|
|
375
|
+
targetConfiguration = _Object$entries5$_i[1];
|
|
371
376
|
|
|
372
377
|
if (pattern.startsWith('^')) {
|
|
373
378
|
var regularExpression = new RegExp(pattern);
|
|
@@ -499,16 +504,20 @@ if (htmlAvailable) pluginInstances.push({
|
|
|
499
504
|
script: 'src'
|
|
500
505
|
};
|
|
501
506
|
|
|
502
|
-
for (var
|
|
503
|
-
|
|
504
|
-
|
|
507
|
+
for (var _i7 = 0, _Object$entries6 = Object.entries(linkables); _i7 < _Object$entries6.length; _i7++) {
|
|
508
|
+
var _Object$entries6$_i = (0, _slicedToArray2["default"])(_Object$entries6[_i7], 2),
|
|
509
|
+
tagName = _Object$entries6$_i[0],
|
|
510
|
+
attributeName = _Object$entries6$_i[1];
|
|
511
|
+
|
|
512
|
+
for (var _i8 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(attributeName, "*=\"?") + "".concat(configuration.hashAlgorithm, "=\"]"))); _i8 < _Array$from.length; _i8++) {
|
|
513
|
+
var domNode = _Array$from[_i8];
|
|
505
514
|
|
|
506
515
|
/*
|
|
507
516
|
NOTE: Removing symbols after a "&" in hash
|
|
508
517
|
string is necessary to match the generated
|
|
509
518
|
request strings in offline plugin.
|
|
510
519
|
*/
|
|
511
|
-
domNode.setAttribute(
|
|
520
|
+
domNode.setAttribute(attributeName, domNode.getAttribute(attributeName).replace(new RegExp('(\\?' + "".concat(configuration.hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
|
|
512
521
|
}
|
|
513
522
|
}
|
|
514
523
|
/*
|
|
@@ -1308,8 +1317,8 @@ var webpackConfiguration = _clientnode["default"].extend(true, {
|
|
|
1308
1317
|
cacheGroups: {
|
|
1309
1318
|
defaultVendors: {
|
|
1310
1319
|
chunks: function chunks(chunk) {
|
|
1311
|
-
if ((0, _typeof2["default"])(configuration.inPlace.javaScript) === 'object' && configuration.inPlace.javaScript !== null) for (var
|
|
1312
|
-
var _name4 = _Object$keys[
|
|
1320
|
+
if ((0, _typeof2["default"])(configuration.inPlace.javaScript) === 'object' && configuration.inPlace.javaScript !== null) for (var _i9 = 0, _Object$keys = Object.keys(configuration.inPlace.javaScript); _i9 < _Object$keys.length; _i9++) {
|
|
1321
|
+
var _name4 = _Object$keys[_i9];
|
|
1313
1322
|
if (_name4 === '*' || _name4 === chunk.name) return false;
|
|
1314
1323
|
}
|
|
1315
1324
|
return true;
|