weboptimizer 2.0.1310 → 2.0.1312
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 +2 -0
- package/ejsLoader.js +2 -0
- package/package.json +1 -1
- package/type.js +9 -0
- package/webpackConfigurator.js +18 -11
package/browser.js
CHANGED
|
@@ -31,6 +31,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
31
31
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
34
|
+
// endregion
|
|
35
|
+
// region declaration
|
|
34
36
|
// endregion
|
|
35
37
|
// region variables
|
|
36
38
|
var onCreatedListener = [];
|
package/ejsLoader.js
CHANGED
|
@@ -39,6 +39,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
39
39
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
40
40
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
// endregion
|
|
42
|
+
// region types
|
|
43
|
+
// endregion
|
|
42
44
|
var configuration = (0, _configurator["default"])();
|
|
43
45
|
/**
|
|
44
46
|
* Main transformation function.
|
package/package.json
CHANGED
package/type.js
CHANGED
|
@@ -36,6 +36,15 @@ var TaskTypes = ['build', 'serve'].concat(SubConfigurationTypes);
|
|
|
36
36
|
//// endregion
|
|
37
37
|
//// region loader
|
|
38
38
|
|
|
39
|
+
//// endregion
|
|
40
|
+
|
|
41
|
+
/* eslint-disable max-len */
|
|
42
|
+
|
|
43
|
+
/* eslint-enable max-len */
|
|
44
|
+
|
|
45
|
+
/// endregion
|
|
46
|
+
// NOTE: Not yet defined in webpack types.
|
|
47
|
+
|
|
39
48
|
// endregion
|
|
40
49
|
// region vim modline
|
|
41
50
|
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
package/webpackConfigurator.js
CHANGED
|
@@ -189,18 +189,25 @@ if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.pro
|
|
|
189
189
|
///// region apply module pattern
|
|
190
190
|
pluginInstances.push({
|
|
191
191
|
apply: function apply(compiler) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
|
|
192
|
+
var name = 'ApplyModulePattern';
|
|
193
|
+
compiler.hooks.compilation.tap(name, function (compilation) {
|
|
194
|
+
compilation.hooks.processAssets.tap({
|
|
195
|
+
name: name,
|
|
196
|
+
additionalAssets: true,
|
|
197
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
|
|
198
|
+
}, function (assets) {
|
|
199
|
+
for (var _i5 = 0, _Object$entries4 = Object.entries(assets); _i5 < _Object$entries4.length; _i5++) {
|
|
200
|
+
var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
|
|
201
|
+
request = _Object$entries4$_i[0],
|
|
202
|
+
asset = _Object$entries4$_i[1];
|
|
203
|
+
var filePath = request.replace(/\?[^?]+$/, '');
|
|
204
|
+
var _type2 = _helper["default"].determineAssetType(filePath, configuration.buildContext.types, configuration.path);
|
|
205
|
+
if (_type2 && configuration.assetPattern[_type2] && new RegExp(configuration.assetPattern[_type2].includeFilePathRegularExpression).test(filePath) && !new RegExp(configuration.assetPattern[_type2].excludeFilePathRegularExpression).test(filePath)) {
|
|
206
|
+
var source = asset.source();
|
|
207
|
+
if (typeof source === 'string') compilation.assets[request] = new _webpackSources.RawSource(configuration.assetPattern[_type2].pattern.replace(/\{1\}/g, source.replace(/\$/g, '$$$')));
|
|
208
|
+
}
|
|
202
209
|
}
|
|
203
|
-
}
|
|
210
|
+
});
|
|
204
211
|
});
|
|
205
212
|
}
|
|
206
213
|
});
|