weboptimizer 2.0.1311 → 2.0.1313

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 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/index.js CHANGED
@@ -34,7 +34,7 @@ var _fs = require("fs");
34
34
  var _promises = require("fs/promises");
35
35
  var _globAll = require("glob-all");
36
36
  var _path = _interopRequireWildcard(require("path"));
37
- var _rimraf = _interopRequireWildcard(require("rimraf"));
37
+ var _rimraf = require("rimraf");
38
38
  var _configurator = require("./configurator");
39
39
  var _helper = _interopRequireDefault(require("./helper"));
40
40
  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); }
@@ -177,7 +177,7 @@ var main = function main(context) {
177
177
  break;
178
178
  }
179
179
  _context.next = 9;
180
- return (0, _rimraf["default"])(file.path);
180
+ return (0, _rimraf.rimraf)(file.path);
181
181
  case 9:
182
182
  return _context.abrupt("return", false);
183
183
  case 10:
@@ -240,7 +240,7 @@ var main = function main(context) {
240
240
  break;
241
241
  case 56:
242
242
  _context3.next = 58;
243
- return (0, _rimraf["default"])(configuration.path.target.base);
243
+ return (0, _rimraf.rimraf)(configuration.path.target.base);
244
244
  case 58:
245
245
  _context3.next = 60;
246
246
  return _clientnode["default"].isDirectory(configuration.path.apiDocumentation);
@@ -250,7 +250,7 @@ var main = function main(context) {
250
250
  break;
251
251
  }
252
252
  _context3.next = 63;
253
- return (0, _rimraf["default"])(configuration.path.apiDocumentation);
253
+ return (0, _rimraf.rimraf)(configuration.path.apiDocumentation);
254
254
  case 63:
255
255
  _iterator2 = _createForOfIteratorHelper(configuration.path.tidyUpOnClear);
256
256
  try {
@@ -258,14 +258,14 @@ var main = function main(context) {
258
258
  _filePath = _step2.value;
259
259
  if (_filePath) if (_clientnode["default"].isFileSync(_filePath))
260
260
  // NOTE: Close handler have to be synchronous.
261
- (0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.sync)(_filePath);
261
+ (0, _fs.unlinkSync)(_filePath);else if (_clientnode["default"].isDirectorySync(_filePath)) (0, _rimraf.rimrafSync)(_filePath);
262
262
  }
263
263
  } catch (err) {
264
264
  _iterator2.e(err);
265
265
  } finally {
266
266
  _iterator2.f();
267
267
  }
268
- (0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
268
+ (0, _rimraf.rimrafSync)((0, _globAll.sync)(configuration.path.tidyUpOnClearGlobs));
269
269
  case 66:
270
270
  // endregion
271
271
  // region handle build
@@ -324,14 +324,14 @@ var main = function main(context) {
324
324
  var _filePath4 = _step4.value;
325
325
  if (_filePath4) if (_clientnode["default"].isFileSync(_filePath4))
326
326
  // NOTE: Close handler have to be synchronous.
327
- (0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.sync)(_filePath4);
327
+ (0, _fs.unlinkSync)(_filePath4);else if (_clientnode["default"].isDirectorySync(_filePath4)) (0, _rimraf.rimrafSync)(_filePath4);
328
328
  }
329
329
  } catch (err) {
330
330
  _iterator4.e(err);
331
331
  } finally {
332
332
  _iterator4.f();
333
333
  }
334
- (0, _rimraf.sync)((0, _globAll.sync)(configuration.path.tidyUpGlobs));
334
+ (0, _rimraf.rimrafSync)((0, _globAll.sync)(configuration.path.tidyUpGlobs));
335
335
  };
336
336
  closeEventHandlers.push(tidyUp);
337
337
 
@@ -360,7 +360,7 @@ var main = function main(context) {
360
360
 
361
361
  // NOTE: Close handler have to be synchronous.
362
362
  if (_clientnode["default"].isDirectorySync(sourcePath)) {
363
- if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.sync)(targetPath);
363
+ if (_clientnode["default"].isDirectorySync(targetPath)) (0, _rimraf.rimrafSync)(targetPath);
364
364
  _clientnode["default"].copyDirectoryRecursiveSync(sourcePath, targetPath);
365
365
  } else if (_clientnode["default"].isFileSync(sourcePath)) _clientnode["default"].copyFileSync(sourcePath, targetPath);
366
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "2.0.1311",
3
+ "version": "2.0.1313",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
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:
@@ -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
- compiler.hooks.emit.tap('applyModulePattern', function (compilation) {
193
- for (var _i5 = 0, _Object$entries4 = Object.entries(compilation.assets); _i5 < _Object$entries4.length; _i5++) {
194
- var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i5], 2),
195
- request = _Object$entries4$_i[0],
196
- asset = _Object$entries4$_i[1];
197
- var filePath = request.replace(/\?[^?]+$/, '');
198
- var _type2 = _helper["default"].determineAssetType(filePath, configuration.buildContext.types, configuration.path);
199
- if (_type2 && configuration.assetPattern[_type2] && new RegExp(configuration.assetPattern[_type2].includeFilePathRegularExpression).test(filePath) && !new RegExp(configuration.assetPattern[_type2].excludeFilePathRegularExpression).test(filePath)) {
200
- var source = asset.source();
201
- if (typeof source === 'string') compilation.assets[request] = new _webpackSources.RawSource(configuration.assetPattern[_type2].pattern.replace(/\{1\}/g, source.replace(/\$/g, '$$$')));
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
  });