weboptimizer 2.0.1138 → 2.0.1141

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 CHANGED
@@ -142,7 +142,7 @@ var load = function load(context) {
142
142
  if ((0, _typeof2["default"])(configuration.library) === 'object') _clientnode["default"].extend(true, _clientnode["default"].modifyObject(libraryConfiguration, configuration.library), configuration.library);
143
143
  if (configuration.library && ((_specificConfiguratio3 = specificConfiguration) === null || _specificConfiguratio3 === void 0 ? void 0 : _specificConfiguratio3.library) !== false) configuration = _clientnode["default"].extend(true, _clientnode["default"].modifyObject(configuration, libraryConfiguration), libraryConfiguration); // endregion
144
144
  // region merging and evaluating task specific and dynamic configurations
145
- // / region load additional dynamically given configuration
145
+ /// region load additional dynamically given configuration
146
146
 
147
147
  var count = 0;
148
148
  var filePath = null;
@@ -165,8 +165,8 @@ var load = function load(context) {
165
165
  (0, _fs.unlink)(filePath, function (error) {
166
166
  if (error) throw error;
167
167
  });
168
- } // // region task specific configuration
169
- // /// region apply task type specific configuration
168
+ } //// region task specific configuration
169
+ ///// region apply task type specific configuration
170
170
 
171
171
 
172
172
  if (runtimeInformation.givenCommandLineArguments.length > 2) {
@@ -186,8 +186,8 @@ var load = function load(context) {
186
186
  } finally {
187
187
  _iterator.f();
188
188
  }
189
- } // /// endregion
190
- // /// region clear task type specific configurations
189
+ } ///// endregion
190
+ ///// region clear task type specific configurations
191
191
 
192
192
 
193
193
  var _iterator2 = _createForOfIteratorHelper(_type4.SubConfigurationTypes),
@@ -201,9 +201,9 @@ var load = function load(context) {
201
201
  var _configurationTarget = _arr2[_i2];
202
202
  if (Object.prototype.hasOwnProperty.call(_configurationTarget, _type3) && (0, _typeof2["default"])(_configurationTarget[_type3]) === 'object') delete _configurationTarget[_type3];
203
203
  }
204
- } // /// endregion
205
- // // endregion
206
- // / endregion
204
+ } ///// endregion
205
+ //// endregion
206
+ /// endregion
207
207
 
208
208
  } catch (err) {
209
209
  _iterator2.e(err);
@@ -242,7 +242,7 @@ var load = function load(context) {
242
242
 
243
243
 
244
244
  configuration = _clientnode["default"].removeKeyPrefixes(configuration); // endregion
245
- // / region build absolute paths
245
+ /// region build absolute paths
246
246
 
247
247
  configuration.path.base = (0, _path.resolve)(configuration.path.context, configuration.path.base);
248
248
 
@@ -260,7 +260,7 @@ var load = function load(context) {
260
260
  }
261
261
  }
262
262
  }
263
- } // / endregion
263
+ } /// endregion
264
264
  // region evaluate dynamic configuration structures
265
265
 
266
266
 
@@ -319,7 +319,7 @@ var load = function load(context) {
319
319
  };
320
320
  resolvedConfiguration.needed = {
321
321
  javaScript: configuration.debug && ['serve', 'test:browser'].includes(resolvedConfiguration.givenCommandLineArguments[2])
322
- }; // / region determine which asset types are needed
322
+ }; /// region determine which asset types are needed
323
323
 
324
324
  for (var chunkName in resolvedConfiguration.injection.entry.normalized) {
325
325
  if (Object.prototype.hasOwnProperty.call(resolvedConfiguration.injection.entry.normalized, chunkName)) {
@@ -350,7 +350,7 @@ var load = function load(context) {
350
350
  _iterator4.f();
351
351
  }
352
352
  }
353
- } // / endregion
353
+ } /// endregion
354
354
  // endregion
355
355
  // region adding special aliases
356
356
 
package/ejsLoader.js CHANGED
@@ -19,6 +19,8 @@
19
19
 
20
20
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
21
21
 
22
+ var _typeof = require("@babel/runtime/helpers/typeof");
23
+
22
24
  Object.defineProperty(exports, "__esModule", {
23
25
  value: true
24
26
  });
@@ -34,7 +36,7 @@ var _core = require("@babel/core");
34
36
 
35
37
  var _babelPresetMinify = _interopRequireDefault(require("babel-preset-minify"));
36
38
 
37
- var _clientnode = _interopRequireDefault(require("clientnode"));
39
+ var _clientnode = _interopRequireWildcard(require("clientnode"));
38
40
 
39
41
  var _ejs = _interopRequireDefault(require("ejs"));
40
42
 
@@ -48,6 +50,10 @@ var _configurator = _interopRequireDefault(require("./configurator"));
48
50
 
49
51
  var _helper = _interopRequireDefault(require("./helper"));
50
52
 
53
+ 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); }
54
+
55
+ 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; }
56
+
51
57
  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; }
52
58
 
53
59
  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; }
@@ -201,7 +207,7 @@ var loader = function loader(source) {
201
207
 
202
208
  if (typeof result === 'string') {
203
209
  var filePath = isString ? options.filename : result;
204
- if (filePath && (0, _path.extname)(filePath) === '.js') result = eval('require')(filePath);else {
210
+ if (filePath && (0, _path.extname)(filePath) === '.js') result = (0, _clientnode.currentRequire)(filePath);else {
205
211
  if (!isString) {
206
212
  var encoding = configuration.encoding;
207
213
  if (typeof options.encoding === 'string') encoding = options.encoding;
package/helper.js CHANGED
@@ -19,6 +19,8 @@
19
19
 
20
20
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
21
21
 
22
+ var _typeof = require("@babel/runtime/helpers/typeof");
23
+
22
24
  Object.defineProperty(exports, "__esModule", {
23
25
  value: true
24
26
  });
@@ -32,12 +34,16 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
32
34
 
33
35
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
34
36
 
35
- var _clientnode = _interopRequireDefault(require("clientnode"));
37
+ var _clientnode = _interopRequireWildcard(require("clientnode"));
36
38
 
37
39
  var _fs = require("fs");
38
40
 
39
41
  var _path = require("path");
40
42
 
43
+ 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); }
44
+
45
+ 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; }
46
+
41
47
  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; }
42
48
 
43
49
  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; }
@@ -1133,7 +1139,7 @@ var Helper = /*#__PURE__*/function () {
1133
1139
  var fileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'package.json';
1134
1140
  var filePath = Helper.findPackageDescriptorFilePath(modulePath, fileName);
1135
1141
  if (!filePath) return null;
1136
- var configuration = eval('require')(filePath);
1142
+ var configuration = (0, _clientnode.currentRequire)(filePath);
1137
1143
  /*
1138
1144
  If the package.json does not have a name property, try again from
1139
1145
  one level higher.
package/index.js CHANGED
@@ -166,16 +166,16 @@ var main = /*#__PURE__*/function () {
166
166
  return (0, _promises.writeFile)(filePath, JSON.stringify(dynamicConfiguration));
167
167
 
168
168
  case 22:
169
- additionalArguments = commandLineArguments.splice(3); // / region register exit handler to tidy up
169
+ additionalArguments = commandLineArguments.splice(3); /// region register exit handler to tidy up
170
170
 
171
- // / region register exit handler to tidy up
171
+ /// region register exit handler to tidy up
172
172
  clear = function clear(error) {
173
173
  // NOTE: Close handler have to be synchronous.
174
174
  if (_clientnode["default"].isFileSync(filePath)) (0, _fs.unlinkSync)(filePath);
175
175
  if (error) throw error;
176
176
  };
177
177
 
178
- closeEventHandlers.push(clear); // / endregion
178
+ closeEventHandlers.push(clear); /// endregion
179
179
  // endregion
180
180
  // region handle clear
181
181
 
@@ -666,7 +666,7 @@ var main = /*#__PURE__*/function () {
666
666
  } finally {
667
667
  _iterator11.f();
668
668
  }
669
- }; // / region a-/synchronous
669
+ }; /// region a-/synchronous
670
670
 
671
671
 
672
672
  if (!['document', 'test', 'test:coverage', 'test:coverage:report'].includes(configuration.givenCommandLineArguments[2])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "2.0.1138",
3
+ "version": "2.0.1141",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -1823,14 +1823,6 @@
1823
1823
  10
1824
1824
  ],
1825
1825
  "no-invalid-this": 0,
1826
- "no-this-assignment": [
1827
- true,
1828
- {
1829
- "allowed-names": [
1830
- "^self$"
1831
- ]
1832
- }
1833
- ],
1834
1826
  "no-unused-vars": [
1835
1827
  "error",
1836
1828
  {
@@ -1879,7 +1871,12 @@
1879
1871
  "exceptions": [
1880
1872
  "/usr/bin/env node"
1881
1873
  ]
1882
- }
1874
+ },
1875
+ "markers": [
1876
+ "/",
1877
+ "//",
1878
+ "///"
1879
+ ]
1883
1880
  }
1884
1881
  ],
1885
1882
  "space-infix-ops": 0,
package/type.js CHANGED
@@ -23,18 +23,18 @@ Object.defineProperty(exports, "__esModule", {
23
23
  exports.TaskTypes = exports.SubConfigurationTypes = void 0;
24
24
  // endregion
25
25
  // region exports
26
- // / region generic
27
- // / endregion
28
- // / region injection
29
- // / endregion
30
- // / region configuration
31
- // // region path
32
- // // endregion
33
- // // region build
26
+ /// region generic
27
+ /// endregion
28
+ /// region injection
29
+ /// endregion
30
+ /// region configuration
31
+ //// region path
32
+ //// endregion
33
+ //// region build
34
34
  var SubConfigurationTypes = ['debug', 'document', 'test', 'test:browser'];
35
35
  exports.SubConfigurationTypes = SubConfigurationTypes;
36
- var TaskTypes = ['build', 'serve'].concat(SubConfigurationTypes); // // endregion
37
- // // region loader
36
+ var TaskTypes = ['build', 'serve'].concat(SubConfigurationTypes); //// endregion
37
+ //// region loader
38
38
  // endregion
39
39
  // region vim modline
40
40
  // vim: set tabstop=4 shiftwidth=4 expandtab:
@@ -104,16 +104,16 @@ if (plugins.Offline) {
104
104
 
105
105
  var configuration = (0, _configurator["default"])();
106
106
  var _module = configuration.module; // region initialisation
107
- // / region determine library name
107
+ /// region determine library name
108
108
 
109
109
  var libraryName;
110
110
  if (configuration.libraryName) libraryName = configuration.libraryName;else if (Object.keys(configuration.injection.entry.normalized).length > 1) libraryName = '[name]';else {
111
111
  libraryName = configuration.name;
112
112
  if (['assign', 'global', 'this', 'var', 'window'].includes(configuration.exportFormat.self)) libraryName = _clientnode["default"].stringConvertToValidVariableName(libraryName);
113
- } // / endregion
114
- // / region plugins
113
+ } /// endregion
114
+ /// region plugins
115
115
 
116
- var pluginInstances = []; // // region define modules to ignore
116
+ var pluginInstances = []; //// region define modules to ignore
117
117
 
118
118
  var _iterator = _createForOfIteratorHelper([].concat(configuration.injection.ignorePattern)),
119
119
  _step;
@@ -124,8 +124,8 @@ try {
124
124
  if (typeof pattern.contextRegExp === 'string') pattern.contextRegExp = new RegExp(pattern.contextRegExp);
125
125
  if (typeof pattern.resourceRegExp === 'string') pattern.resourceRegExp = new RegExp(pattern.resourceRegExp);
126
126
  pluginInstances.push(new _webpack.IgnorePlugin(pattern));
127
- } // // endregion
128
- // // region define modules to replace
127
+ } //// endregion
128
+ //// region define modules to replace
129
129
 
130
130
  } catch (err) {
131
131
  _iterator.e(err);
@@ -144,8 +144,8 @@ var _loop = function _loop(source) {
144
144
 
145
145
  for (var source in _module.replacements.normal) {
146
146
  _loop(source);
147
- } // // endregion
148
- // // region generate html file
147
+ } //// endregion
148
+ //// region generate html file
149
149
 
150
150
 
151
151
  var htmlAvailable = false;
@@ -163,8 +163,8 @@ try {
163
163
  })));
164
164
  htmlAvailable = true;
165
165
  }
166
- } // // endregion
167
- // // region generate favicons
166
+ } //// endregion
167
+ //// region generate favicons
168
168
 
169
169
  } catch (err) {
170
170
  _iterator2.e(err);
@@ -172,8 +172,8 @@ try {
172
172
  _iterator2.f();
173
173
  }
174
174
 
175
- if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode["default"].isFileSync(configuration.favicon.logo)) pluginInstances.push(new plugins.Favicon(configuration.favicon)); // // endregion
176
- // // region provide offline functionality
175
+ if (htmlAvailable && configuration.favicon && plugins.Favicon && _clientnode["default"].isFileSync(configuration.favicon.logo)) pluginInstances.push(new plugins.Favicon(configuration.favicon)); //// endregion
176
+ //// region provide offline functionality
177
177
 
178
178
  if (htmlAvailable && configuration.offline && plugins.Offline) {
179
179
  if (!['serve', 'test:browser'].includes(configuration.givenCommandLineArguments[2])) for (var _i = 0, _Object$entries = Object.entries({
@@ -198,14 +198,14 @@ if (htmlAvailable && configuration.offline && plugins.Offline) {
198
198
  }
199
199
  if ([].concat(configuration.offline.use).includes('injectionManifest')) pluginInstances.push(new plugins.InjectManifest(_clientnode["default"].extend(true, configuration.offline.common, configuration.offline.injectionManifest)));
200
200
  if ([].concat(configuration.offline.use).includes('generateServiceWorker')) pluginInstances.push(new plugins.GenerateServiceWorker(_clientnode["default"].extend(true, configuration.offline.common, configuration.offline.serviceWorker)));
201
- } // // endregion
202
- // // region provide build environment
201
+ } //// endregion
202
+ //// region provide build environment
203
203
 
204
204
 
205
205
  if (configuration.buildContext.definitions) pluginInstances.push(new _webpack.DefinePlugin(configuration.buildContext.definitions));
206
- if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide)); // // endregion
207
- // // region modules/assets
208
- // /// region apply module pattern
206
+ if (_module.provide) pluginInstances.push(new _webpack.ProvidePlugin(_module.provide)); //// endregion
207
+ //// region modules/assets
208
+ ///// region apply module pattern
209
209
 
210
210
  pluginInstances.push({
211
211
  apply: function apply(compiler) {
@@ -225,8 +225,8 @@ pluginInstances.push({
225
225
  }
226
226
  });
227
227
  }
228
- }); // /// endregion
229
- // /// region in-place configured assets in the main html file
228
+ }); ///// endregion
229
+ ///// region in-place configured assets in the main html file
230
230
 
231
231
  /*
232
232
  TODO
@@ -313,17 +313,17 @@ if (htmlAvailable && !['serve', 'test:browser'].includes(configuration.givenComm
313
313
  });
314
314
  });
315
315
  }
316
- }); // /// endregion
317
- // /// region mark empty javaScript modules as dummy
316
+ }); ///// endregion
317
+ ///// region mark empty javaScript modules as dummy
318
318
 
319
- if (!(configuration.needed.javaScript || configuration.needed.javaScriptExtension || configuration.needed.typeScript || configuration.needed.typeScriptExtension)) configuration.files.compose.javaScript = (0, _path.resolve)(configuration.path.target.asset.javaScript, '.__dummy__.compiled.js'); // /// endregion
320
- // /// region extract cascading style sheets
319
+ if (!(configuration.needed.javaScript || configuration.needed.javaScriptExtension || configuration.needed.typeScript || configuration.needed.typeScriptExtension)) configuration.files.compose.javaScript = (0, _path.resolve)(configuration.path.target.asset.javaScript, '.__dummy__.compiled.js'); ///// endregion
320
+ ///// region extract cascading style sheets
321
321
 
322
322
  var cssOutputPath = configuration.files.compose.cascadingStyleSheet;
323
323
  if (cssOutputPath && plugins.MiniCSSExtract) pluginInstances.push(new plugins.MiniCSSExtract({
324
324
  filename: typeof cssOutputPath === 'string' ? (0, _path.relative)(configuration.path.target.base, cssOutputPath) : cssOutputPath
325
- })); // /// endregion
326
- // /// region performs implicit external logic
325
+ })); ///// endregion
326
+ ///// region performs implicit external logic
327
327
 
328
328
  if (configuration.injection.external.modules === '__implicit__')
329
329
  /*
@@ -463,9 +463,9 @@ if (configuration.injection.external.modules === '__implicit__')
463
463
  }
464
464
 
465
465
  return callback();
466
- }; // /// endregion
467
- // // endregion
468
- // // region apply final cascadingStyleSheet/dom/javaScript modifications/fixes
466
+ }; ///// endregion
467
+ //// endregion
468
+ //// region apply final cascadingStyleSheet/dom/javaScript modifications/fixes
469
469
 
470
470
  if (htmlAvailable) pluginInstances.push({
471
471
  apply: function apply(compiler) {
@@ -561,8 +561,8 @@ if (htmlAvailable) pluginInstances.push({
561
561
  });
562
562
  });
563
563
  }
564
- }); // // endregion
565
- // // region context replacements
564
+ }); //// endregion
565
+ //// region context replacements
566
566
 
567
567
  var _iterator10 = _createForOfIteratorHelper(_module.replacements.context),
568
568
  _step10;
@@ -580,8 +580,8 @@ try {
580
580
  if (evaluated.error) throw new Error('Error occurred during processing given context ' + "replacement: ".concat(evaluated.error));
581
581
  return evaluated.result;
582
582
  }))));
583
- } // // endregion
584
- // // region consolidate duplicated module requests
583
+ } //// endregion
584
+ //// region consolidate duplicated module requests
585
585
 
586
586
  /*
587
587
  NOTE: Redundancies usually occur when symlinks aren't converted to their
@@ -786,9 +786,9 @@ new NormalModuleReplacementPlugin(
786
786
  }
787
787
  }
788
788
  ))*/
789
- // // endregion
790
- // / endregion
791
- // / region loader helper
789
+ //// endregion
790
+ /// endregion
791
+ /// region loader helper
792
792
 
793
793
 
794
794
  var isFilePathInDependencies = function isFilePathInDependencies(filePath) {
@@ -805,7 +805,7 @@ var scope = {
805
805
  configuration: configuration,
806
806
  isFilePathInDependencies: isFilePathInDependencies,
807
807
  loader: loader,
808
- require: eval('require')
808
+ require: _clientnode.currentRequire
809
809
  };
810
810
 
811
811
  var evaluate = function evaluate(object) {
@@ -1157,8 +1157,8 @@ if (configuration.files.compose.cascadingStyleSheet && plugins.MiniCSSExtract) {
1157
1157
  loader.style.use.unshift({
1158
1158
  loader: plugins.MiniCSSExtract.loader
1159
1159
  });
1160
- } // / endregion
1161
- // / region apply runtime dev helper
1160
+ } /// endregion
1161
+ /// region apply runtime dev helper
1162
1162
 
1163
1163
  /*
1164
1164
  NOTE: Disable automatic injection to avoid injection in all chunks and as
@@ -1175,7 +1175,7 @@ if (htmlAvailable && configuration.debug && configuration.development.server.liv
1175
1175
  configuration.development.server.hot = false;
1176
1176
  pluginInstances.push(new _webpack.HotModuleReplacementPlugin());
1177
1177
  }
1178
- } // / endregion
1178
+ } /// endregion
1179
1179
  // endregion
1180
1180
  // region plugins
1181
1181