weboptimizer 2.0.1459 → 2.0.1461

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.d.ts CHANGED
@@ -4,7 +4,6 @@ export declare const browser: Browser;
4
4
  * Provides a generic browser api in node or web contexts.
5
5
  * @param replaceWindow - Indicates whether a potential existing window object
6
6
  * should be replaced or not.
7
- *
8
7
  * @returns Determined environment.
9
8
  */
10
9
  export declare const getInitializedBrowser: (replaceWindow?: boolean) => Promise<InitializedBrowser>;
package/browser.js CHANGED
@@ -215,7 +215,6 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
215
215
  * Provides a generic browser api in node or web contexts.
216
216
  * @param replaceWindow - Indicates whether a potential existing window object
217
217
  * should be replaced or not.
218
- *
219
218
  * @returns Determined environment.
220
219
  */
221
220
  var getInitializedBrowser = exports.getInitializedBrowser = /*#__PURE__*/function () {
package/configurator.d.ts CHANGED
@@ -14,7 +14,6 @@ export declare let loadedConfiguration: null | ResolvedConfiguration;
14
14
  * @param commandLineArguments - Arguments to take into account.
15
15
  * @param webOptimizerPath - Current optimizer context path.
16
16
  * @param environment - Environment variables to take into account.
17
- *
18
17
  * @returns Nothing.
19
18
  */
20
19
  export declare const load: (context?: string, currentWorkingDirectory?: string, commandLineArguments?: Array<string>, webOptimizerPath?: string, environment?: NodeJS.ProcessEnv) => ResolvedConfiguration;
package/configurator.js CHANGED
@@ -45,7 +45,6 @@ var loadedConfiguration = exports.loadedConfiguration = null;
45
45
  * @param commandLineArguments - Arguments to take into account.
46
46
  * @param webOptimizerPath - Current optimizer context path.
47
47
  * @param environment - Environment variables to take into account.
48
- *
49
48
  * @returns Nothing.
50
49
  */
51
50
  var load = exports.load = function load(context) {
@@ -83,7 +82,7 @@ var load = exports.load = function load(context) {
83
82
  */
84
83
  try {
85
84
  if ((0, _fs.lstatSync)((0, _path2.join)(currentWorkingDirectory, 'node_modules')).isSymbolicLink()) _package.configuration["default"].path.context = currentWorkingDirectory;
86
- } catch (error) {
85
+ } catch (_unused) {
87
86
  // Continue regardless of error.
88
87
  }
89
88
  }
@@ -92,7 +91,7 @@ var load = exports.load = function load(context) {
92
91
  var specificConfiguration = {};
93
92
  try {
94
93
  specificConfiguration = (0, _clientnode.currentRequire)((0, _path2.join)(_package.configuration["default"].path.context, 'package'));
95
- } catch (error) {
94
+ } catch (_unused2) {
96
95
  _package.configuration["default"].path.context = currentWorkingDirectory;
97
96
  }
98
97
  // endregion
@@ -350,13 +349,11 @@ var load = exports.load = function load(context) {
350
349
  htmlConfiguration.template.request = htmlConfiguration.template.filePath;
351
350
  if (htmlConfiguration.template.filePath !== resolvedConfiguration.files.defaultHTML.template.filePath && htmlConfiguration.template.options) {
352
351
  var requestString = new String(htmlConfiguration.template.request + _clientnode["default"].convertCircularObjectToJSON(htmlConfiguration.template.options));
353
- /* eslint-disable @typescript-eslint/unbound-method */
354
352
  requestString.replace = function (value) {
355
353
  return function () {
356
354
  return value;
357
355
  };
358
356
  }(htmlConfiguration.template.filePath);
359
- /* eslint-enable @typescript-eslint/unbound-method */
360
357
  htmlConfiguration.template.request = requestString;
361
358
  }
362
359
  }
package/declarations.d.ts CHANGED
@@ -13,7 +13,11 @@ interface PostcssTransformer {
13
13
  }
14
14
 
15
15
  /** @module declarations */
16
+ declare module '@eslint/eslintrc'
17
+ declare module '@eslint/js'
18
+ declare module '@typescript-eslint/parser'
16
19
  declare module 'babel-preset-minify'
20
+ declare module 'eslint-config-google'
17
21
  declare module 'glob-all' {
18
22
  export default function(globs:Array<string>):Promise<Array<string>>
19
23
  export function sync(globs:Array<string>):Array<string>
@@ -43,7 +47,7 @@ declare module 'postcss-sprites' {
43
47
  }>):PostcssTransformer
44
48
  }
45
49
  declare module 'svgo' {
46
- export type Options = any
50
+ export type Options = unknown
47
51
  }
48
52
  declare module 'webOptimizerDefaultTemplateFilePath'
49
53
  declare module '*.module' {
package/ejsLoader.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Encoding, Mapping } from 'clientnode/type';
2
2
  import { Options, TemplateFunction as EJSTemplateFunction } from 'ejs';
3
3
  import { LoaderContext } from 'webpack';
4
4
  import { Extensions, Replacements } from './type';
5
- export type PreCompiledTemplateFunction = ((...parameters: Array<unknown>) => string);
5
+ export type PreCompiledTemplateFunction = ((..._parameters: Array<unknown>) => string);
6
6
  export type TemplateFunction = EJSTemplateFunction | PreCompiledTemplateFunction;
7
7
  export type CompilerOptions = Options & {
8
8
  encoding: Encoding;
@@ -28,7 +28,6 @@ export type LoaderConfiguration = Mapping<unknown> & {
28
28
  /**
29
29
  * Main transformation function.
30
30
  * @param source - Input string to transform.
31
- *
32
31
  * @returns Transformed string.
33
32
  */
34
33
  export declare const loader: (this: LoaderContext<LoaderConfiguration>, source: string) => string;
package/ejsLoader.js CHANGED
@@ -46,7 +46,6 @@ var configuration = (0, _configurator["default"])();
46
46
  /**
47
47
  * Main transformation function.
48
48
  * @param source - Input string to transform.
49
- *
50
49
  * @returns Transformed string.
51
50
  */
52
51
  var loader = exports.loader = function loader(source) {
@@ -0,0 +1,2 @@
1
+ declare const _default: any[];
2
+ export default _default;
package/helper.d.ts CHANGED
@@ -10,7 +10,6 @@ export declare class Helper {
10
10
  * locations.
11
11
  * @param filePath - Path to file to check.
12
12
  * @param locationsToCheck - Locations to take into account.
13
- *
14
13
  * @returns Value "true" if given file path is within one of given
15
14
  * locations or "false" otherwise.
16
15
  */
@@ -19,14 +18,12 @@ export declare class Helper {
19
18
  * Strips loader informations form given module request including loader
20
19
  * prefix and query parameter.
21
20
  * @param moduleID - Module request to strip.
22
- *
23
21
  * @returns Given module id stripped.
24
22
  */
25
23
  static stripLoader(this: void, moduleID: string): string;
26
24
  /**
27
25
  * Converts given list of path to a normalized list with unique values.
28
26
  * @param paths - File paths.
29
- *
30
27
  * @returns The given file path list with normalized unique values.
31
28
  */
32
29
  static normalizePaths(this: void, paths: Array<string>): Array<string>;
@@ -35,7 +32,6 @@ export declare class Helper {
35
32
  * associated informations.
36
33
  * @param template - File path to process placeholder in.
37
34
  * @param scope - Scope to use for processing.
38
- *
39
35
  * @returns Processed file path.
40
36
  */
41
37
  static renderFilePathTemplate(this: void, template: string, scope?: Mapping<number | string>): string;
@@ -50,7 +46,6 @@ export declare class Helper {
50
46
  * account.
51
47
  * @param relativeModuleLocations - List of relative directory paths to
52
48
  * search for modules in.
53
- *
54
49
  * @returns A new resolved request.
55
50
  */
56
51
  static applyContext(this: void, request: string, context?: string, referencePath?: string, aliases?: Mapping, moduleReplacements?: Replacements, relativeModuleLocations?: Array<string>): false | string;
@@ -89,7 +84,6 @@ export declare class Helper {
89
84
  * @param inPlaceDynamicLibrary - Indicates whether requests with
90
85
  * integrated loader configurations should be marked as external or not.
91
86
  * @param encoding - Encoding for file names to use during file traversing.
92
- *
93
87
  * @returns A new resolved request indicating whether given request is an
94
88
  * external one.
95
89
  */
@@ -101,7 +95,6 @@ export declare class Helper {
101
95
  * types.
102
96
  * @param paths - List of paths to search if given path doesn't reference
103
97
  * a file directly.
104
- *
105
98
  * @returns Determined file type or "null" of given file couldn't be
106
99
  * determined.
107
100
  */
@@ -115,7 +108,6 @@ export declare class Helper {
115
108
  * @param entryPath - Path to analyse nested structure.
116
109
  * @param pathsToIgnore - Paths which marks location to ignore.
117
110
  * @param mainFileBasenames - File basenames to sort into the front.
118
- *
119
111
  * @returns Converted build configuration.
120
112
  */
121
113
  static resolveBuildConfigurationFilePaths(this: void, configuration: BuildConfiguration, entryPath?: string, pathsToIgnore?: Array<string>, mainFileBasenames?: Array<string>): ResolvedBuildConfiguration;
@@ -141,7 +133,6 @@ export declare class Helper {
141
133
  * @param packageAliasPropertyNames - List of package file alias property
142
134
  * names to search for package specific module aliases.
143
135
  * @param encoding - File name encoding to use during file traversing.
144
- *
145
136
  * @returns Object with a file path and directory path key mapping to
146
137
  * corresponding list of paths.
147
138
  */
@@ -160,7 +151,6 @@ export declare class Helper {
160
151
  * @param context - File path to determine relative to.
161
152
  * @param referencePath - Path to resolve local modules relative to.
162
153
  * @param pathsToIgnore - Paths which marks location to ignore.
163
- *
164
154
  * @returns Given injections with resolved folder pointing modules.
165
155
  */
166
156
  static resolveModulesInFolders(this: void, normalizedGivenInjection: NormalizedGivenInjection, aliases?: Mapping, moduleReplacements?: Replacements, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): NormalizedGivenInjection;
@@ -169,7 +159,6 @@ export declare class Helper {
169
159
  * (mapping from chunk name to array of module ids). This method converts
170
160
  * each representation into the normalized plain object notation.
171
161
  * @param givenInjection - Given entry injection to normalize.
172
- *
173
162
  * @returns Normalized representation of given entry injection.
174
163
  */
175
164
  static normalizeGivenInjection(this: void, givenInjection: GivenInjection): NormalizedGivenInjection;
@@ -188,7 +177,6 @@ export declare class Helper {
188
177
  * @param referencePath - Reference path from where local files should be
189
178
  * resolved.
190
179
  * @param pathsToIgnore - Paths which marks location to ignore.
191
- *
192
180
  * @returns Given injection with resolved marked indicators.
193
181
  */
194
182
  static resolveAutoInjection<T extends GivenInjectionConfiguration>(this: void, givenInjection: T, buildConfigurations: ResolvedBuildConfiguration, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, context?: string, referencePath?: string, pathsToIgnore?: Array<string>): T;
@@ -199,7 +187,6 @@ export declare class Helper {
199
187
  * exclude (specified by path or id) or a mapping from chunk names to
200
188
  * module ids.
201
189
  * @param context - File path to use as starting point.
202
- *
203
190
  * @returns All determined module file paths.
204
191
  */
205
192
  static getAutoInjection(this: void, buildConfigurations: ResolvedBuildConfiguration, moduleFilePathsToExclude: Array<string>, context: string): Mapping;
@@ -211,7 +198,6 @@ export declare class Helper {
211
198
  * @param packageAliasPropertyNames - List of package file alias property
212
199
  * names to search for package specific module aliases.
213
200
  * @param encoding - Encoding to use for file names during file traversing.
214
- *
215
201
  * @returns Path if found and / or additional package aliases to consider.
216
202
  */
217
203
  static determineModuleFilePathInPackage(this: void, packagePath: string, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, encoding?: Encoding): {
@@ -239,7 +225,6 @@ export declare class Helper {
239
225
  * @param packageAliasPropertyNames - List of package file alias property
240
226
  * names to search for package specific module aliases.
241
227
  * @param encoding - Encoding to use for file names during file traversing.
242
- *
243
228
  * @returns File path or given module id if determinations has failed or
244
229
  * wasn't necessary.
245
230
  */
@@ -248,7 +233,6 @@ export declare class Helper {
248
233
  * Determines a concrete file path for given module id.
249
234
  * @param moduleID - Module id to determine.
250
235
  * @param aliases - Mapping of aliases to take into account.
251
- *
252
236
  * @returns The alias applied given module id.
253
237
  */
254
238
  static applyAliases(this: void, moduleID: string, aliases: Mapping): string;
@@ -257,7 +241,6 @@ export declare class Helper {
257
241
  * @param moduleID - Module id to determine.
258
242
  * @param replacements - Mapping of regular expressions to their
259
243
  * corresponding replacements.
260
- *
261
244
  * @returns The replacement applied given module id.
262
245
  */
263
246
  static applyModuleReplacements(this: void, moduleID: false | string, replacements: Replacements): false | string;
@@ -265,7 +248,6 @@ export declare class Helper {
265
248
  * Determines the nearest package configuration file from given file path.
266
249
  * @param start - Reference location to search from.
267
250
  * @param fileName - Package configuration file name.
268
- *
269
251
  * @returns Determined file path.
270
252
  */
271
253
  static findPackageDescriptorFilePath(this: void, start: Array<string> | string, fileName?: string): null | string;
@@ -275,7 +257,6 @@ export declare class Helper {
275
257
  * @param modulePath - Module path to take as reference location (leaf in
276
258
  * tree).
277
259
  * @param fileName - Package configuration file name.
278
- *
279
260
  * @returns A object containing found parsed configuration an their
280
261
  * corresponding file path.
281
262
  */
package/helper.js CHANGED
@@ -57,7 +57,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
57
57
  * locations.
58
58
  * @param filePath - Path to file to check.
59
59
  * @param locationsToCheck - Locations to take into account.
60
- *
61
60
  * @returns Value "true" if given file path is within one of given
62
61
  * locations or "false" otherwise.
63
62
  */
@@ -82,7 +81,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
82
81
  * Strips loader informations form given module request including loader
83
82
  * prefix and query parameter.
84
83
  * @param moduleID - Module request to strip.
85
- *
86
84
  * @returns Given module id stripped.
87
85
  */
88
86
  }, {
@@ -96,7 +94,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
96
94
  /**
97
95
  * Converts given list of path to a normalized list with unique values.
98
96
  * @param paths - File paths.
99
- *
100
97
  * @returns The given file path list with normalized unique values.
101
98
  */
102
99
  }, {
@@ -115,7 +112,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
115
112
  * associated informations.
116
113
  * @param template - File path to process placeholder in.
117
114
  * @param scope - Scope to use for processing.
118
- *
119
115
  * @returns Processed file path.
120
116
  */
121
117
  }, {
@@ -149,7 +145,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
149
145
  * account.
150
146
  * @param relativeModuleLocations - List of relative directory paths to
151
147
  * search for modules in.
152
- *
153
148
  * @returns A new resolved request.
154
149
  */
155
150
  }, {
@@ -223,7 +218,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
223
218
  * @param inPlaceDynamicLibrary - Indicates whether requests with
224
219
  * integrated loader configurations should be marked as external or not.
225
220
  * @param encoding - Encoding for file names to use during file traversing.
226
- *
227
221
  * @returns A new resolved request indicating whether given request is an
228
222
  * external one.
229
223
  */
@@ -322,7 +316,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
322
316
  * types.
323
317
  * @param paths - List of paths to search if given path doesn't reference
324
318
  * a file directly.
325
- *
326
319
  * @returns Determined file type or "null" of given file couldn't be
327
320
  * determined.
328
321
  */
@@ -354,7 +347,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
354
347
  * @param entryPath - Path to analyse nested structure.
355
348
  * @param pathsToIgnore - Paths which marks location to ignore.
356
349
  * @param mainFileBasenames - File basenames to sort into the front.
357
- *
358
350
  * @returns Converted build configuration.
359
351
  */
360
352
  }, {
@@ -423,7 +415,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
423
415
  * @param packageAliasPropertyNames - List of package file alias property
424
416
  * names to search for package specific module aliases.
425
417
  * @param encoding - File name encoding to use during file traversing.
426
- *
427
418
  * @returns Object with a file path and directory path key mapping to
428
419
  * corresponding list of paths.
429
420
  */
@@ -484,7 +475,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
484
475
  * @param context - File path to determine relative to.
485
476
  * @param referencePath - Path to resolve local modules relative to.
486
477
  * @param pathsToIgnore - Paths which marks location to ignore.
487
- *
488
478
  * @returns Given injections with resolved folder pointing modules.
489
479
  */
490
480
  }, {
@@ -544,7 +534,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
544
534
  * (mapping from chunk name to array of module ids). This method converts
545
535
  * each representation into the normalized plain object notation.
546
536
  * @param givenInjection - Given entry injection to normalize.
547
- *
548
537
  * @returns Normalized representation of given entry injection.
549
538
  */
550
539
  }, {
@@ -606,7 +595,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
606
595
  * @param referencePath - Reference path from where local files should be
607
596
  * resolved.
608
597
  * @param pathsToIgnore - Paths which marks location to ignore.
609
- *
610
598
  * @returns Given injection with resolved marked indicators.
611
599
  */
612
600
  }, {
@@ -635,7 +623,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
635
623
  for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
636
624
  var name = _step10.value;
637
625
  var injectionType = injection[name];
638
- /* eslint-disable curly */
639
626
  if (_clientnode["default"].isPlainObject(injectionType)) {
640
627
  for (var _i9 = 0, _Object$entries4 = Object.entries(injectionType); _i9 < _Object$entries4.length; _i9++) {
641
628
  var _Object$entries4$_i = (0, _slicedToArray2["default"])(_Object$entries4[_i9], 2),
@@ -655,8 +642,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
655
642
  chunk.reverse();
656
643
  }
657
644
  }
658
- } else if (injectionType === '__auto__') /* eslint-enable curly */
659
- injection[name] = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, referencePath);
645
+ } else if (injectionType === '__auto__') injection[name] = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, referencePath);
660
646
  }
661
647
  } catch (err) {
662
648
  _iterator10.e(err);
@@ -672,7 +658,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
672
658
  * exclude (specified by path or id) or a mapping from chunk names to
673
659
  * module ids.
674
660
  * @param context - File path to use as starting point.
675
- *
676
661
  * @returns All determined module file paths.
677
662
  */
678
663
  }, {
@@ -738,7 +723,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
738
723
  * @param packageAliasPropertyNames - List of package file alias property
739
724
  * names to search for package specific module aliases.
740
725
  * @param encoding - Encoding to use for file names during file traversing.
741
- *
742
726
  * @returns Path if found and / or additional package aliases to consider.
743
727
  */
744
728
  }, {
@@ -817,7 +801,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
817
801
  * @param packageAliasPropertyNames - List of package file alias property
818
802
  * names to search for package specific module aliases.
819
803
  * @param encoding - Encoding to use for file names during file traversing.
820
- *
821
804
  * @returns File path or given module id if determinations has failed or
822
805
  * wasn't necessary.
823
806
  */
@@ -918,7 +901,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
918
901
  * Determines a concrete file path for given module id.
919
902
  * @param moduleID - Module id to determine.
920
903
  * @param aliases - Mapping of aliases to take into account.
921
- *
922
904
  * @returns The alias applied given module id.
923
905
  */
924
906
  }, {
@@ -939,7 +921,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
939
921
  * @param moduleID - Module id to determine.
940
922
  * @param replacements - Mapping of regular expressions to their
941
923
  * corresponding replacements.
942
- *
943
924
  * @returns The replacement applied given module id.
944
925
  */
945
926
  }, {
@@ -958,7 +939,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
958
939
  * Determines the nearest package configuration file from given file path.
959
940
  * @param start - Reference location to search from.
960
941
  * @param fileName - Package configuration file name.
961
- *
962
942
  * @returns Determined file path.
963
943
  */
964
944
  }, {
@@ -986,7 +966,6 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
986
966
  * @param modulePath - Module path to take as reference location (leaf in
987
967
  * tree).
988
968
  * @param fileName - Package configuration file name.
989
- *
990
969
  * @returns A object containing found parsed configuration an their
991
970
  * corresponding file path.
992
971
  */
package/index.d.ts CHANGED
@@ -13,7 +13,6 @@
13
13
  * @param commandLineArguments - Arguments to take into account.
14
14
  * @param webOptimizerPath - Current optimizer context path.
15
15
  * @param environment - Environment variables to take into account.
16
- *
17
16
  * @returns Nothing.
18
17
  */
19
18
  declare const main: (context?: string, currentWorkingDirectory?: string, commandLineArguments?: Array<string>, webOptimizerPath?: string, environment?: NodeJS.ProcessEnv) => Promise<() => void>;
package/index.js CHANGED
@@ -55,7 +55,6 @@ process.env.UV_THREADPOOL_SIZE = '128';
55
55
  * @param commandLineArguments - Arguments to take into account.
56
56
  * @param webOptimizerPath - Current optimizer context path.
57
57
  * @param environment - Environment variables to take into account.
58
- *
59
58
  * @returns Nothing.
60
59
  */
61
60
  var main = function main(context) {
@@ -2,17 +2,8 @@
2
2
  * Implements the default browser environment to run script context in.
3
3
  */
4
4
  export declare class BrowserEnvironment {
5
- /**
6
- * @returns Nothing.
7
- */
8
5
  setup(): Promise<void>;
9
- /**
10
- * @returns Nothing.
11
- */
12
6
  teardown(): void;
13
- /**
14
- * @returns Null.
15
- */
16
7
  runScript(): null;
17
8
  }
18
9
  export default BrowserEnvironment;
@@ -33,24 +33,12 @@ var BrowserEnvironment = exports.BrowserEnvironment = /*#__PURE__*/function () {
33
33
  }
34
34
  return (0, _createClass2["default"])(BrowserEnvironment, [{
35
35
  key: "setup",
36
- value:
37
- /**
38
- * @returns Nothing.
39
- */
40
- function setup() {
36
+ value: function setup() {
41
37
  return Promise.resolve();
42
38
  }
43
- /**
44
- * @returns Nothing.
45
- */
46
39
  }, {
47
40
  key: "teardown",
48
- value: function teardown() {
49
- return;
50
- }
51
- /**
52
- * @returns Null.
53
- */
41
+ value: function teardown() {}
54
42
  }, {
55
43
  key: "runScript",
56
44
  value: function runScript() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "2.0.1459",
3
+ "version": "2.0.1461",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -32,6 +32,8 @@
32
32
  "declarations.d.ts",
33
33
  "ejsLoader.d.ts",
34
34
  "ejsLoader.js",
35
+ "eslint.config.d.ts",
36
+ "eslint.config.js",
35
37
  "helper.d.ts",
36
38
  "helper.js",
37
39
  "index.d.ts",
@@ -49,8 +51,8 @@
49
51
  "stylelintConfigurator.d.ts",
50
52
  "stylelintConfigurator.js",
51
53
  "tsconfig.json",
52
- "tsconfigApplication.json",
53
- "tsconfigLibrary.json",
54
+ "tsconfig.application.json",
55
+ "tsconfig.library.json",
54
56
  "type.d.ts",
55
57
  "type.js",
56
58
  "webpackConfigurator.d.ts",
@@ -63,16 +65,17 @@
63
65
  },
64
66
  "scripts": {
65
67
  "build": "yarn build:types; yarn build:plain",
66
- "build:plain": "command=\"babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime,babel-plugin-transform-modern-regexp --presets @babel/preset-env,@babel/preset-typescript --out-file\" && $command plugins/HTMLTransformation.js plugins/HTMLTransformation.ts && $command plugins/InPlaceAssetsIntoHTML.js plugins/InPlaceAssetsIntoHTML.ts && $command browser.js browser.ts && $command configurator.js configurator.ts && $command ejsLoader.js ejsLoader.ts && $command helper.js helper.ts && $command index.js index.ts && $command jestEnvironmentBrowser.js jestEnvironmentBrowser.ts && $command jestSetup.js jestSetup.ts && $command stylelintConfigurator.js stylelintConfigurator.ts && $command type.js type.ts && $command webpackConfigurator.js webpackConfigurator.ts && shx chmod +x index.js && shx sed -i 's/(#!\\\\/usr\\\\/bin\\\\/env )babel-(node)/$1$2/' index.js 1>/dev/null",
68
+ "build:lint": "babel --extensions '.ts' --plugins @babel/plugin-syntax-top-level-await,babel-plugin-transform-modern-regexp --presets @babel/preset-typescript --out-file eslint.config.js eslint.config.ts",
69
+ "build:plain": "command=\"babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime,babel-plugin-transform-modern-regexp --presets @babel/preset-env,@babel/preset-typescript --out-file\" && $command browser.js browser.ts && $command configurator.js configurator.ts && $command ejsLoader.js ejsLoader.ts && $command helper.js helper.ts && $command index.js index.ts && $command jestEnvironmentBrowser.js jestEnvironmentBrowser.ts && $command jestSetup.js jestSetup.ts && $command plugins/HTMLTransformation.js plugins/HTMLTransformation.ts && $command plugins/InPlaceAssetsIntoHTML.js plugins/InPlaceAssetsIntoHTML.ts && $command stylelintConfigurator.js stylelintConfigurator.ts && $command type.js type.ts && $command webpackConfigurator.js webpackConfigurator.ts && shx chmod +x index.js && shx sed -i 's/(#!\\\\/usr\\\\/bin\\\\/env )babel-(node)/$1$2/' index.js 1>/dev/null",
67
70
  "build:test": " yarn clear && yarn build:plain && command='babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime --presets @babel/preset-env,@babel/preset-typescript --source-root ../ --out-file' && cd test/simple && shx touch yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && cd test/scss && shx touch yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && rimraf node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && shx mkdir -p node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && copyCommand='shx cp -r plugins *.ts *.js *.json *.ejs' && $copyCommand node_modules/weboptimizer/ && $copyCommand test/simple/node_modules/weboptimizer/ && $copyCommand test/scss/node_modules/weboptimizer/ && $command test/browser.js test/browser.ts && $command test/configurator.js test/configurator.ts && $command test/helper.js test/helper.ts && $command test/ejsLoader.js test/ejsLoader.ts && $command test/stylelintConfigurator.js test/stylelintConfigurator.ts && $command test/index.js test/index.ts && $command test/webpackConfigurator.js test/webpackConfigurator.ts",
68
71
  "build:test:source-map": "yarn clear && yarn build:plain && command='babel --extensions '.ts' --plugins @babel/plugin-proposal-class-properties,@babel/plugin-syntax-top-level-await,@babel/plugin-transform-runtime --presets @babel/preset-env,@babel/preset-typescript --source-maps inline --source-root ../ --out-file' && cd test/simple && shx touch yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && cd test/scss && shx touch yarn.lock && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install; cd ../../ && rimraf node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && shx mkdir -p node_modules/weboptimizer test/simple/node_modules/weboptimizer test/scss/node_modules/weboptimizer && copyCommand='shx cp -r plugins *.ts *.js *.json *.ejs' && $copyCommand node_modules/weboptimizer/ && $copyCommand test/simple/node_modules/weboptimizer/ && $copyCommand test/scss/node_modules/weboptimizer/ && $command test/browser.js test/browser.ts && $command test/configurator.js test/configurator.ts && $command test/helper.js test/helper.ts && $command test/ejsLoader.js test/ejsLoader.ts && $command test/stylelintConfigurator.js test/stylelintConfigurator.ts && $command test/index.js test/index.ts && $command test/webpackConfigurator.js test/webpackConfigurator.ts",
69
72
  "build:types": "tsc --declaration --emitDeclarationOnly",
70
73
  "check": "yarn check:types; yarn lint",
71
74
  "check:types": "tsc --noEmit",
72
- "clear": "rimraf --glob apiDocumentation 'plugins/*.d.ts' 'plugins/*.js' browser.d.ts configurator.d.ts ejsLoader.d.ts helper.d.ts index.d.ts jestSetup.d.ts jestEnvironmentBrowser.d.ts stylelintConfigurator.d.ts type.d.ts webpackConfigurator.d.ts '*.js' '*.compiled.*' '*.compiled' 'test/*.js' 'test/*.compiled.*' 'test/*.d.ts' 'test/**/.yarn' 'test/**/yarn.lock' 'test/**/node_modules' '*.html' '*.log' node_modules/weboptimizer .coverage .nyc_output",
75
+ "clear": "rimraf --glob apiDocumentation browser.d.ts configurator.d.ts ejsLoader.d.ts eslint.config.d.ts helper.d.ts index.d.ts jestSetup.d.ts jestEnvironmentBrowser.d.ts 'plugins/*.d.ts' 'plugins/*.js' stylelintConfigurator.d.ts 'test/*.js' 'test/*.compiled.*' 'test/*.d.ts' 'test/**/.yarn' 'test/**/yarn.lock' 'test/**/node_modules' type.d.ts webpackConfigurator.d.ts '*.js' '*.compiled.*' '*.compiled' '*.html' '*.log' node_modules/weboptimizer .coverage .nyc_output",
73
76
  "document": "yarn build:plain && jsdoc --package ./package.json --readme ./readme.md --destination apiDocumentation *.js",
74
- "lint": "yarn lint:base",
75
- "lint:base": "eslint --ignore-pattern '**/exclude/*' --ignore-pattern '*.compiled.*' --ignore-pattern '*.d.ts' --ignore-pattern '*.js' --parser-options=project:tsconfig.json '*.ts' 'test/*.ts'",
77
+ "lint": "yarn build:lint && yarn lint:base",
78
+ "lint:base": "eslint *.ts */*.ts test/*/*.ts",
76
79
  "prepare": "yarn build",
77
80
  "prettify": "yarn lint:base --fix || true",
78
81
  "test": "yarn build:test && jest --config ./jest.json --noStackTrace --root-dir './' --test-regex '/test/.+\\\\.js$' test/browser.js test/configurator.js test/helper.js test/ejsLoader.js test/stylelintConfigurator.js test/index.js test/webpackConfigurator.js",
@@ -85,19 +88,19 @@
85
88
  },
86
89
  "runkitExample": "require('@babel/runtime/package.json')\n\nconst {default: main} = require('weboptimizer')\n\nawait main('./', './', ['clear'])",
87
90
  "dependencies": {
88
- "@babel/core": "^7.24.3",
91
+ "@babel/core": "^7.24.5",
89
92
  "@babel/plugin-proposal-class-properties": "^7.18.6",
90
93
  "@babel/plugin-proposal-decorators": "^7.24.1",
91
94
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
92
95
  "@babel/plugin-transform-runtime": "^7.24.3",
93
- "@babel/preset-env": "^7.24.3",
96
+ "@babel/preset-env": "^7.24.5",
94
97
  "@babel/preset-typescript": "^7.24.1",
95
- "@babel/runtime": "^7.24.1",
98
+ "@babel/runtime": "^7.24.5",
96
99
  "babel-loader": "^9.1.3",
97
100
  "babel-plugin-transform-modern-regexp": "^0.0.6",
98
101
  "babel-preset-minify": "^0.5.2",
99
- "clientnode": "^3.0.1141",
100
- "ejs": "^3.1.9",
102
+ "clientnode": "^3.0.1143",
103
+ "ejs": "^3.1.10",
101
104
  "exports-loader": "^5.0.0",
102
105
  "extract-loader": "^5.1.0",
103
106
  "glob-all": "^3.3.1",
@@ -106,55 +109,58 @@
106
109
  "html-webpack-plugin": "^5.6.0",
107
110
  "imports-loader": "^5.0.0",
108
111
  "jest-environment-jsdom": "^29.7.0",
109
- "rimraf": "^5.0.5",
112
+ "rimraf": "^5.0.7",
110
113
  "script-loader": "^0.7.2",
111
- "typescript": "^5.4.3",
114
+ "typescript": "^5.4.5",
112
115
  "webpack": "^5.91.0",
113
116
  "webpack-cli": "^5.1.4",
114
117
  "webpack-sources": "^3.2.3"
115
118
  },
116
119
  "devDependencies": {
117
- "@babel/cli": "^7.24.1",
118
- "@babel/eslint-parser": "^7.24.1",
120
+ "@babel/cli": "^7.24.5",
121
+ "@babel/eslint-parser": "^7.24.5",
119
122
  "@types/ejs": "^3.1.5",
123
+ "@types/eslint": "^8.56.10",
120
124
  "@types/html-minifier": "^4.0.5",
121
125
  "@types/html-minifier-terser": "^7.0.2",
122
126
  "@types/imagemin": "^8.0.5",
123
- "@types/node": "^20.11.30",
127
+ "@types/node": "^20.12.12",
124
128
  "@types/postcss-import": "^14.0.3",
125
129
  "@types/postcss-url": "^10.0.4",
126
- "@types/webpack-env": "^1.18.4",
130
+ "@types/webpack-env": "^1.18.5",
127
131
  "@types/webpack-sources": "^3.2.3",
128
- "@typescript-eslint/eslint-plugin": "^7.4.0",
129
- "@typescript-eslint/parser": "^7.4.0",
130
- "css-loader": "^6.10.0",
131
- "cssnano": "^6.1.2",
132
+ "@typescript-eslint/eslint-plugin": "^7.9.0",
133
+ "@typescript-eslint/parser": "^7.9.0",
134
+ "css-loader": "^7.1.1",
135
+ "cssnano": "^7.0.1",
132
136
  "documentation-website": "^1.0.326",
133
- "eslint": "^8.57.0",
137
+ "eslint": "^9.3.0",
134
138
  "eslint-config-google": "^0.14.0",
135
- "eslint-plugin-jsdoc": "^48.2.1",
139
+ "eslint-plugin-jsdoc": "^48.2.5",
136
140
  "favicons": "^7.2.0",
137
141
  "favicons-webpack-plugin": "^6.0.1",
142
+ "globals": "^15.2.0",
138
143
  "image-minimizer-webpack-plugin": "^4.0.0",
139
144
  "jest": "^29.7.0",
140
- "jsdoc": "^4.0.2",
141
- "mini-css-extract-plugin": "^2.8.1",
145
+ "jsdoc": "^4.0.3",
146
+ "mini-css-extract-plugin": "^2.9.0",
142
147
  "mkdirp": "^3.0.1",
143
148
  "node-fetch": "^3.3.2",
144
149
  "postcss": "^8.4.38",
145
150
  "postcss-fontpath": "^1.0.0",
146
151
  "postcss-import": "^16.1.0",
147
152
  "postcss-loader": "^8.1.1",
148
- "postcss-preset-env": "^9.5.2",
153
+ "postcss-preset-env": "^9.5.13",
149
154
  "postcss-sprites": "^4.2.1",
150
155
  "postcss-url": "^10.1.3",
151
156
  "shx": "^0.3.4",
152
- "style-loader": "^3.3.4",
153
- "stylelint": "^16.3.1",
157
+ "style-loader": "^4.0.0",
158
+ "stylelint": "^16.5.0",
154
159
  "stylelint-config-standard": "^36.0.0",
155
- "stylelint-config-standard-scss": "^13.0.0",
160
+ "stylelint-config-standard-scss": "^13.1.0",
161
+ "typescript-eslint": "^7.9.0",
156
162
  "typescript-plugin-css-modules": "^5.1.0",
157
- "workbox-webpack-plugin": "^7.0.0"
163
+ "workbox-webpack-plugin": "^7.1.0"
158
164
  },
159
165
  "peerDependencies": {
160
166
  "@babel/eslint-parser": "*",
@@ -164,8 +170,6 @@
164
170
  "@types/imagemin": "*",
165
171
  "@types/node": "*",
166
172
  "@types/webpack-env": "*",
167
- "@typescript-eslint/eslint-plugin": "*",
168
- "@typescript-eslint/parser": "*",
169
173
  "css-loader": "*",
170
174
  "cssnano": "*",
171
175
  "eslint": "*",
@@ -410,7 +414,7 @@
410
414
  "--emitDeclarationOnly",
411
415
  "--project",
412
416
  {
413
- "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfigApplication.json`"
417
+ "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.application.json`"
414
418
  }
415
419
  ],
416
420
  "command": "tsc"
@@ -420,7 +424,7 @@
420
424
  "--noEmit",
421
425
  "--project",
422
426
  {
423
- "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfigApplication.json`"
427
+ "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.application.json`"
424
428
  }
425
429
  ],
426
430
  "command": "tsc"
@@ -460,7 +464,7 @@
460
464
  "arguments": [
461
465
  "--config",
462
466
  {
463
- "__evaluate__": "`'${webOptimizerPath}/package.json'`"
467
+ "__evaluate__": "`'${webOptimizerPath}/eslint.config.js'`"
464
468
  },
465
469
  "--ignore-pattern",
466
470
  {
@@ -1606,7 +1610,7 @@
1606
1610
  "--emitDeclarationOnly",
1607
1611
  "--project",
1608
1612
  {
1609
- "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfigLibrary.json`"
1613
+ "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.library.json`"
1610
1614
  }
1611
1615
  ]
1612
1616
  },
@@ -1615,7 +1619,7 @@
1615
1619
  "--noEmit",
1616
1620
  "--project",
1617
1621
  {
1618
- "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfigLibrary.json`"
1622
+ "__evaluate__": "Tools.isFileSync(path.resolve(currentPath, 'tsconfig.json')) ? path.resolve(currentPath, 'tsconfig.json') : `${webOptimizerPath}/tsconfig.library.json`"
1619
1623
  }
1620
1624
  ]
1621
1625
  },
@@ -1749,172 +1753,5 @@
1749
1753
  }
1750
1754
  }
1751
1755
  },
1752
- "eslintConfig": {
1753
- "env": {
1754
- "browser": true,
1755
- "node": true,
1756
- "jest": true
1757
- },
1758
- "extends": [
1759
- "eslint:recommended",
1760
- "plugin:@typescript-eslint/eslint-recommended",
1761
- "plugin:@typescript-eslint/recommended",
1762
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
1763
- "google"
1764
- ],
1765
- "parserOptions": {
1766
- "ecmaFeatures": {
1767
- "jsx": true
1768
- },
1769
- "ecmaVersion": "latest",
1770
- "impliedStrict": true,
1771
- "project": "node_modules/weboptimizer/tsconfigLibrary.json",
1772
- "sourceType": "module"
1773
- },
1774
- "parser": "@typescript-eslint/parser",
1775
- "plugins": [
1776
- "jsdoc",
1777
- "@typescript-eslint"
1778
- ],
1779
- "rules": {
1780
- "@typescript-eslint/no-non-null-assertion": 0,
1781
- "@typescript-eslint/no-this-alias": [
1782
- "error",
1783
- {
1784
- "allowedNames": [
1785
- "self"
1786
- ]
1787
- }
1788
- ],
1789
- "@typescript-eslint/no-unused-vars": [
1790
- "error",
1791
- {
1792
- "argsIgnorePattern": "^_",
1793
- "varsIgnorePattern": "^_"
1794
- }
1795
- ],
1796
- "@typescript-eslint/type-annotation-spacing": [
1797
- "error",
1798
- {
1799
- "after": false,
1800
- "before": false,
1801
- "overrides": {
1802
- "arrow": {
1803
- "after": true,
1804
- "before": true
1805
- }
1806
- }
1807
- }
1808
- ],
1809
- "arrow-parens": [
1810
- "error",
1811
- "always"
1812
- ],
1813
- "block-scoped-var": 0,
1814
- "camelcase": [
1815
- "error",
1816
- {
1817
- "properties": "always"
1818
- }
1819
- ],
1820
- "comma-dangle": [
1821
- "error",
1822
- "never"
1823
- ],
1824
- "curly": [
1825
- "error",
1826
- "multi"
1827
- ],
1828
- "indent": [
1829
- "error",
1830
- 4,
1831
- {
1832
- "ignoreComments": true
1833
- }
1834
- ],
1835
- "max-nested-callbacks": [
1836
- "error",
1837
- 10
1838
- ],
1839
- "no-invalid-this": 0,
1840
- "no-unused-vars": [
1841
- "error",
1842
- {
1843
- "argsIgnorePattern": "^_",
1844
- "varsIgnorePattern": "^_"
1845
- }
1846
- ],
1847
- "new-cap": 0,
1848
- "no-constant-condition": 0,
1849
- "no-new-func": 0,
1850
- "no-new-wrappers": 0,
1851
- "quote-props": [
1852
- "error",
1853
- "as-needed",
1854
- {
1855
- "numbers": true
1856
- }
1857
- ],
1858
- "require-jsdoc": [
1859
- "error",
1860
- {
1861
- "require": {
1862
- "FunctionDeclaration": true,
1863
- "MethodDefinition": true,
1864
- "ClassDeclaration": true
1865
- }
1866
- }
1867
- ],
1868
- "semi": [
1869
- "error",
1870
- "never"
1871
- ],
1872
- "space-before-function-paren": [
1873
- "error",
1874
- {
1875
- "anonymous": "never",
1876
- "asyncArrow": "always",
1877
- "named": "never"
1878
- }
1879
- ],
1880
- "spaced-comment": [
1881
- "error",
1882
- "always",
1883
- {
1884
- "line": {
1885
- "exceptions": [
1886
- "/usr/bin/env node"
1887
- ]
1888
- },
1889
- "markers": [
1890
- "/",
1891
- "//",
1892
- "///"
1893
- ]
1894
- }
1895
- ],
1896
- "space-infix-ops": 0,
1897
- "valid-jsdoc": [
1898
- 0,
1899
- {
1900
- "prefer": {
1901
- "return": "returns"
1902
- },
1903
- "requireParamDescription": false,
1904
- "requireReturnDescription": true,
1905
- "requireReturnType": false
1906
- }
1907
- ],
1908
- "jsdoc/check-param-names": "error",
1909
- "jsdoc/check-tag-names": "error",
1910
- "jsdoc/require-description-complete-sentence": "error",
1911
- "jsdoc/require-hyphen-before-param-description": "error",
1912
- "jsdoc/require-param": 0,
1913
- "jsdoc/require-param-description": "error",
1914
- "jsdoc/require-param-type": 0,
1915
- "jsdoc/require-returns-description": "error",
1916
- "jsdoc/require-returns-type": 0
1917
- }
1918
- },
1919
1756
  "packageManager": "yarn@4.1.0+sha256.81a00df816059803e6b5148acf03ce313cad36b7f6e5af6efa040a15981a6ffb"
1920
1757
  }
@@ -4,6 +4,7 @@ export declare class HTMLTransformation {
4
4
  private defaultOptions;
5
5
  private options;
6
6
  constructor(options?: Partial<HTMLTransformationOptions>);
7
+ private process;
7
8
  apply(compiler: Compiler): void;
8
9
  }
9
10
  export default HTMLTransformation;
@@ -42,90 +42,90 @@ var HTMLTransformation = exports.HTMLTransformation = /*#__PURE__*/function () {
42
42
  this.options = _objectSpread(_objectSpread({}, this.defaultOptions), options);
43
43
  }
44
44
  return (0, _createClass2["default"])(HTMLTransformation, [{
45
- key: "apply",
46
- value: function apply(compiler) {
47
- var _this = this;
48
- compiler.hooks.compilation.tap('WebOptimizer', function (compilation) {
49
- _this.options.htmlPlugin.getHooks(compilation).beforeEmit.tap('WebOptimizerPostProcessHTML', function (data) {
50
- /*
51
- NOTE: We have to prevent creating native "style" dom nodes
52
- to prevent jsdom from parsing the entire cascading style
53
- sheet. Which is error prune and very resource intensive.
54
- */
55
- var styleContents = [];
56
- data.html = data.html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style[^>]*>)/gi, function (match, startTag, content, endTag) {
57
- styleContents.push(content);
58
- return "".concat(startTag).concat(endTag);
59
- });
60
- var dom;
61
- try {
62
- /*
63
- NOTE: We have to translate template delimiter to html
64
- compatible sequences and translate it back later to
65
- avoid unexpected escape sequences in resulting html.
66
- */
67
- dom = new _jsdom.JSDOM(data.html.replace(/<%/g, '##+#+#+##').replace(/%>/g, '##-#-#-##'));
68
- } catch (error) {
69
- return data;
70
- }
71
- var linkables = {
72
- link: 'href',
73
- script: 'src'
74
- };
75
- for (var _i = 0, _Object$entries = Object.entries(linkables); _i < _Object$entries.length; _i++) {
76
- var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
77
- tagName = _Object$entries$_i[0],
78
- attributeName = _Object$entries$_i[1];
79
- for (var _i2 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(attributeName, "*=\"?") + "".concat(_this.options.hashAlgorithm, "=\"]"))); _i2 < _Array$from.length; _i2++) {
80
- var domNode = _Array$from[_i2];
81
- /*
82
- NOTE: Removing symbols after a "&" in hash
83
- string is necessary to match the generated
84
- request strings in offline plugin.
85
- */
86
- domNode.setAttribute(attributeName, domNode.getAttribute(attributeName).replace(new RegExp('(\\?' + "".concat(_this.options.hashAlgorithm, "=") + '[^&]+).*$'), '$1'));
87
- }
88
- }
45
+ key: "process",
46
+ value: function process(data) {
47
+ /*
48
+ NOTE: We have to prevent creating native "style" dom nodes to
49
+ prevent jsdom from parsing the entire cascading style sheet. Which
50
+ is error prune and very resource intensive.
51
+ */
52
+ var styleContents = [];
53
+ data.html = data.html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style[^>]*>)/gi, function (match, startTag, content, endTag) {
54
+ styleContents.push(content);
55
+ return "".concat(startTag).concat(endTag);
56
+ });
57
+ var dom;
58
+ try {
59
+ /*
60
+ NOTE: We have to translate template delimiter to html
61
+ compatible sequences and translate it back later to avoid
62
+ unexpected escape sequences in resulting html.
63
+ */
64
+ dom = new _jsdom.JSDOM(data.html.replace(/<%/g, '##+#+#+##').replace(/%>/g, '##-#-#-##'));
65
+ } catch (error) {
66
+ return data;
67
+ }
68
+ var linkables = {
69
+ link: 'href',
70
+ script: 'src'
71
+ };
72
+ for (var _i = 0, _Object$entries = Object.entries(linkables); _i < _Object$entries.length; _i++) {
73
+ var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
74
+ tagName = _Object$entries$_i[0],
75
+ attributeName = _Object$entries$_i[1];
76
+ for (var _i2 = 0, _Array$from = Array.from(dom.window.document.querySelectorAll("".concat(tagName, "[").concat(attributeName, "*=\"?") + "".concat(this.options.hashAlgorithm, "=\"]"))); _i2 < _Array$from.length; _i2++) {
77
+ var domNode = _Array$from[_i2];
89
78
  /*
90
- NOTE: We have to restore template delimiter and style
91
- contents.
79
+ NOTE: Removing symbols after a "&" in hash string is
80
+ necessary to match the generated request strings in offline
81
+ plugin.
92
82
  */
93
- data.html = dom.serialize().replace(/##\+#\+#\+##/g, '<%').replace(/##-#-#-##/g, '%>').replace(/(<style[^>]*>)[\s\S]*?(<\/style[^>]*>)/gi, function (match, startTag, endTag) {
94
- return "".concat(startTag).concat(styleContents.shift()) + endTag;
95
- });
96
- // region post compilation
97
- var _iterator = _createForOfIteratorHelper(_this.options.files),
98
- _step;
99
- try {
100
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
101
- var htmlFileSpecification = _step.value;
102
- if (htmlFileSpecification.filename === data.plugin.options.filename) {
103
- var _iterator2 = _createForOfIteratorHelper([].concat(htmlFileSpecification.template.use)),
104
- _step2;
105
- try {
106
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
107
- var _loaderConfiguration$;
108
- var loaderConfiguration = _step2.value;
109
- if ((_loaderConfiguration$ = loaderConfiguration.options) !== null && _loaderConfiguration$ !== void 0 && _loaderConfiguration$.compileSteps && typeof loaderConfiguration.options.compileSteps === 'number') data.html = _ejsLoader["default"].bind({
110
- query: _clientnode["default"].extend(true, _clientnode["default"].copy(loaderConfiguration.options) || {}, htmlFileSpecification.template.postCompileOptions)
111
- })(data.html);
112
- }
113
- } catch (err) {
114
- _iterator2.e(err);
115
- } finally {
116
- _iterator2.f();
117
- }
118
- break;
83
+ domNode.setAttribute(attributeName, domNode.getAttribute(attributeName).replace(new RegExp("(\\?".concat(this.options.hashAlgorithm, "=[^&]+).*$")), '$1'));
84
+ }
85
+ }
86
+ // NOTE: We have to restore template delimiter and style contents.
87
+ data.html = dom.serialize().replace(/##\+#\+#\+##/g, '<%').replace(/##-#-#-##/g, '%>').replace(/(<style[^>]*>)[\s\S]*?(<\/style[^>]*>)/gi, function (match, startTag, endTag) {
88
+ return "".concat(startTag).concat(styleContents.shift()).concat(endTag);
89
+ });
90
+ // region post compilation
91
+ var _iterator = _createForOfIteratorHelper(this.options.files),
92
+ _step;
93
+ try {
94
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
95
+ var htmlFileSpecification = _step.value;
96
+ if (htmlFileSpecification.filename === data.plugin.options.filename) {
97
+ var _iterator2 = _createForOfIteratorHelper([].concat(htmlFileSpecification.template.use)),
98
+ _step2;
99
+ try {
100
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
101
+ var _loaderConfiguration$;
102
+ var loaderConfiguration = _step2.value;
103
+ if ((_loaderConfiguration$ = loaderConfiguration.options) !== null && _loaderConfiguration$ !== void 0 && _loaderConfiguration$.compileSteps && typeof loaderConfiguration.options.compileSteps === 'number') data.html = _ejsLoader["default"].bind({
104
+ query: _clientnode["default"].extend(true, _clientnode["default"].copy(loaderConfiguration.options) || {}, htmlFileSpecification.template.postCompileOptions)
105
+ })(data.html);
119
106
  }
107
+ } catch (err) {
108
+ _iterator2.e(err);
109
+ } finally {
110
+ _iterator2.f();
120
111
  }
121
- // endregion
122
- } catch (err) {
123
- _iterator.e(err);
124
- } finally {
125
- _iterator.f();
112
+ break;
126
113
  }
127
- return data;
128
- });
114
+ }
115
+ // endregion
116
+ } catch (err) {
117
+ _iterator.e(err);
118
+ } finally {
119
+ _iterator.f();
120
+ }
121
+ return data;
122
+ }
123
+ }, {
124
+ key: "apply",
125
+ value: function apply(compiler) {
126
+ var _this = this;
127
+ compiler.hooks.compilation.tap('WebOptimizer', function (compilation) {
128
+ _this.options.htmlPlugin.getHooks(compilation).beforeEmit.tap('WebOptimizerPostProcessHTML', _this.process.bind(_this));
129
129
  });
130
130
  }
131
131
  }]);
@@ -0,0 +1,2 @@
1
+ export declare const main: () => void;
2
+ export default main;
@@ -0,0 +1,2 @@
1
+ export declare const main: () => void;
2
+ export default main;
@@ -19,9 +19,14 @@
19
19
  "include": [
20
20
  "../../*.ts", "../../*.tsx",
21
21
  "../../*/*.ts", "../../*/*.tsx",
22
+
22
23
  "../../assets/source/**/*.ts", "../../assets/source/**/*.tsx",
23
24
  "../../assets/src/**/*.ts", "../../assets/src/**/*.tsx",
25
+
24
26
  "../../source/**/*.ts", "../../source/**/*.tsx",
25
- "../../src/**/*.ts", "../../src/**/*.tsx"
27
+ "../../src/**/*.ts", "../../src/**/*.tsx",
28
+
29
+ "../../test/*.ts", "../../test/*.tsx",
30
+ "../../test/*/*.ts", "../../test/*/*.tsx"
26
31
  ]
27
32
  }
package/tsconfig.json CHANGED
@@ -27,9 +27,14 @@
27
27
  "include": [
28
28
  "*.ts", "*.tsx",
29
29
  "*/*.ts", "*/*.tsx",
30
+
30
31
  "assets/src/**/*.ts", "/assets/src/**/*.tsx",
31
32
  "assets/source/**/*.ts", "/assets/source/**/*.tsx",
33
+
32
34
  "source/**/*.ts", "source/**/*.tsx",
33
- "src/**/*.ts", "src/**/*.tsx"
35
+ "src/**/*.ts", "src/**/*.tsx",
36
+
37
+ "test/*.ts", "test/*.tsx",
38
+ "test/*/*.ts", "test/*/*.tsx"
34
39
  ]
35
40
  }
@@ -19,9 +19,14 @@
19
19
  "include": [
20
20
  "../../*.ts", "../../*.tsx",
21
21
  "../../*/*.ts", "../../*/*.tsx",
22
+
22
23
  "../../assets/source/**/*.ts", "../../assets/source/**/*.tsx",
23
24
  "../../assets/src/**/*.ts", "../../assets/src/**/*.tsx",
25
+
24
26
  "../../source/**/*.ts", "../../source/**/*.tsx",
25
- "../../src/**/*.ts", "../../src/**/*.tsx"
27
+ "../../src/**/*.ts", "../../src/**/*.tsx",
28
+
29
+ "../../test/*.ts", "../../test/*.tsx",
30
+ "../../test/*/*.ts", "../../test/*/*.tsx"
26
31
  ]
27
32
  }
@@ -161,13 +161,13 @@ if (htmlAvailable && configuration.offline && plugins.Offline) {
161
161
  var _Object$entries3$_i = (0, _slicedToArray2["default"])(_Object$entries3[_i3], 2),
162
162
  _name = _Object$entries3$_i[0],
163
163
  extension = _Object$entries3$_i[1];
164
- var _type = _name;
165
- if (configuration.inPlace[_type]) {
166
- var matches = Object.keys(configuration.inPlace[_type]);
164
+ var type = _name;
165
+ if (configuration.inPlace[type]) {
166
+ var matches = Object.keys(configuration.inPlace[type]);
167
167
  if (!Array.isArray(configuration.offline.common.excludeChunks)) configuration.offline.common.excludeChunks = [];
168
168
  for (var _i4 = 0, _matches = matches; _i4 < _matches.length; _i4++) {
169
169
  var _name2 = _matches[_i4];
170
- configuration.offline.common.excludeChunks.push((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset[_type]) + "".concat(_name2, ".").concat(extension, "?").concat(configuration.hashAlgorithm, "=*"));
170
+ configuration.offline.common.excludeChunks.push((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset[type]) + "".concat(_name2, ".").concat(extension, "?").concat(configuration.hashAlgorithm, "=*"));
171
171
  }
172
172
  }
173
173
  }
@@ -195,10 +195,10 @@ pluginInstances.push({
195
195
  request = _Object$entries4$_i[0],
196
196
  asset = _Object$entries4$_i[1];
197
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)) {
198
+ var _type = _helper["default"].determineAssetType(filePath, configuration.buildContext.types, configuration.path);
199
+ if (_type && configuration.assetPattern[_type] && new RegExp(configuration.assetPattern[_type].includeFilePathRegularExpression).test(filePath) && !new RegExp(configuration.assetPattern[_type].excludeFilePathRegularExpression).test(filePath)) {
200
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, '$$$')));
201
+ if (typeof source === 'string') compilation.assets[request] = new _webpackSources.RawSource(configuration.assetPattern[_type].pattern.replace(/\{1\}/g, source.replace(/\$/g, '$$$')));
202
202
  }
203
203
  }
204
204
  });
@@ -307,10 +307,10 @@ if (configuration.injection.external.modules === '__implicit__')
307
307
  var resolvedRequest = _helper["default"].determineExternalRequest(request, configuration.path.context, context, configuration.injection.entry.normalized, _module.directoryNames, _module.aliases, _module.replacements.normal, configuration.extensions, configuration.path.source.asset.base, configuration.path.ignore, _module.directoryNames, configuration["package"].main.fileNames, configuration["package"].main.propertyNames, configuration["package"].aliasPropertyNames, configuration.injection.external.implicit.pattern.include, configuration.injection.external.implicit.pattern.exclude, configuration.inPlace.externalLibrary.normal, configuration.inPlace.externalLibrary.dynamic, configuration.encoding);
308
308
  if (resolvedRequest) {
309
309
  var keys = ['amd', 'commonjs', 'commonjs2', 'root'];
310
- var _result2 = resolvedRequest;
310
+ var result = resolvedRequest;
311
311
  if (Object.prototype.hasOwnProperty.call(configuration.injection.external.aliases, request)) {
312
312
  // region normal alias replacement
313
- _result2 = {
313
+ result = {
314
314
  "default": request
315
315
  };
316
316
  if (typeof configuration.injection.external.aliases[request] === 'string') {
@@ -319,7 +319,7 @@ if (configuration.injection.external.modules === '__implicit__')
319
319
  try {
320
320
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
321
321
  var key = _step4.value;
322
- _result2[key] = configuration.injection.external.aliases[request];
322
+ result[key] = configuration.injection.external.aliases[request];
323
323
  }
324
324
  } catch (err) {
325
325
  _iterator4.e(err);
@@ -332,21 +332,21 @@ if (configuration.injection.external.modules === '__implicit__')
332
332
  try {
333
333
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
334
334
  var _key2 = _step5.value;
335
- _result2[_key2] = configuration.injection.external.aliases[request](request, _key2);
335
+ result[_key2] = configuration.injection.external.aliases[request](request, _key2);
336
336
  }
337
337
  } catch (err) {
338
338
  _iterator5.e(err);
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["default"].extend(_result2, configuration.injection.external.aliases[request]);
343
- if (Object.prototype.hasOwnProperty.call(_result2, 'default')) {
342
+ } else if (configuration.injection.external.aliases[request] !== null && (0, _typeof2["default"])(configuration.injection.external.aliases[request]) === 'object') _clientnode["default"].extend(result, configuration.injection.external.aliases[request]);
343
+ if (Object.prototype.hasOwnProperty.call(result, 'default')) {
344
344
  var _iterator6 = _createForOfIteratorHelper(keys),
345
345
  _step6;
346
346
  try {
347
347
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
348
348
  var _key3 = _step6.value;
349
- if (!Object.prototype.hasOwnProperty.call(_result2, _key3)) _result2[_key3] = _result2["default"];
349
+ if (!Object.prototype.hasOwnProperty.call(result, _key3)) result[_key3] = result["default"];
350
350
  }
351
351
  } catch (err) {
352
352
  _iterator6.e(err);
@@ -356,11 +356,11 @@ if (configuration.injection.external.modules === '__implicit__')
356
356
  }
357
357
  // endregion
358
358
  }
359
- if (typeof _result2 !== 'string' && Object.prototype.hasOwnProperty.call(_result2, 'root')) _result2.root = [].concat(_result2.root).map(function (name) {
359
+ if (typeof result !== 'string' && Object.prototype.hasOwnProperty.call(result, 'root')) result.root = [].concat(result.root).map(function (name) {
360
360
  return _clientnode["default"].stringConvertToValidVariableName(name);
361
361
  });
362
362
  var exportFormat = configuration.exportFormat.external || configuration.exportFormat.self;
363
- return callback(undefined, exportFormat === 'umd' || typeof _result2 === 'string' ? _result2 : _result2[exportFormat], exportFormat);
363
+ return callback(undefined, exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat], exportFormat);
364
364
  }
365
365
  return callback();
366
366
  };
@@ -1104,9 +1104,9 @@ if (configuration.nodeENV !== null) webpackConfiguration.optimization.nodeEnv =
1104
1104
  if (!Array.isArray(_module.skipParseRegularExpressions) || _module.skipParseRegularExpressions.length) webpackConfiguration.module.noParse = _module.skipParseRegularExpressions;
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
- var _result3 = optionalRequire(configuration.path.configuration.javaScript);
1108
- if (_clientnode["default"].isPlainObject(_result3)) {
1109
- if (Object.prototype.hasOwnProperty.call(_result3, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = _result3.replaceWebOptimizer;else _clientnode["default"].extend(true, webpackConfiguration, _result3);
1107
+ var result = optionalRequire(configuration.path.configuration.javaScript);
1108
+ if (_clientnode["default"].isPlainObject(result)) {
1109
+ if (Object.prototype.hasOwnProperty.call(result, 'replaceWebOptimizer')) exports.webpackConfiguration = webpackConfiguration = result.replaceWebOptimizer;else _clientnode["default"].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."));