weboptimizer 4.0.76 → 4.0.78

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/helper.d.ts CHANGED
@@ -75,13 +75,13 @@ export declare const applyContext: (request: string, context?: string, reference
75
75
  * internal dependency.
76
76
  * @param inPlaceNormalLibrary - Indicates whether normal libraries should be
77
77
  * external or not.
78
- * @param inPlaceDynamicLibrary - Indicates whether requests with integrated
78
+ * @param inPlaceSpecialImports - Indicates whether requests with integrated
79
79
  * loader configurations should be marked as external or not.
80
80
  * @param encoding - Encoding for file names to use during file traversing.
81
81
  * @returns A new resolved request indicating whether given request is an
82
82
  * external one.
83
83
  */
84
- export declare const determineExternalRequest: (request: string, context?: string, requestContext?: string, normalizedGivenInjection?: NormalizedGivenInjection, relativeExternalModuleLocations?: Array<string>, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, includePattern?: Array<string | RegExp>, excludePattern?: Array<string | RegExp>, inPlaceNormalLibrary?: boolean, inPlaceDynamicLibrary?: boolean, encoding?: Encoding) => null | string;
84
+ export declare const determineExternalRequest: (request: string, context?: string, requestContext?: string, normalizedGivenInjection?: NormalizedGivenInjection, relativeExternalModuleLocations?: Array<string>, aliases?: Mapping, moduleReplacements?: Replacements, extensions?: Extensions, referencePath?: string, pathsToIgnore?: Array<string>, relativeModuleLocations?: Array<string>, packageEntryFileNames?: Array<string>, packageMainPropertyNames?: Array<string>, packageAliasPropertyNames?: Array<string>, includePattern?: Array<string | RegExp>, excludePattern?: Array<string | RegExp>, inPlaceNormalLibrary?: boolean, inPlaceSpecialImports?: boolean, encoding?: Encoding) => null | string;
85
85
  /**
86
86
  * Determines asset type of given file.
87
87
  * @param filePath - Path to file to analyze.
package/helper.js CHANGED
@@ -148,7 +148,7 @@ export const applyContext = (request, context = './', referencePath = './', alia
148
148
  * internal dependency.
149
149
  * @param inPlaceNormalLibrary - Indicates whether normal libraries should be
150
150
  * external or not.
151
- * @param inPlaceDynamicLibrary - Indicates whether requests with integrated
151
+ * @param inPlaceSpecialImports - Indicates whether requests with integrated
152
152
  * loader configurations should be marked as external or not.
153
153
  * @param encoding - Encoding for file names to use during file traversing.
154
154
  * @returns A new resolved request indicating whether given request is an
@@ -162,7 +162,7 @@ export const determineExternalRequest = (request, context = './', requestContext
162
162
  external: ['.compiled.js', '.js', '.json'],
163
163
  internal: KNOWN_FILE_EXTENSIONS.map(suffix => `.${suffix}`)
164
164
  }
165
- }, referencePath = './', pathsToIgnore = KNOWN_PATHS_TO_IGNORE, relativeModuleLocations = ['node_modules'], packageEntryFileNames = ['index', 'main'], packageMainPropertyNames = ['main', 'module'], packageAliasPropertyNames = [], includePattern = [], excludePattern = [], inPlaceNormalLibrary = false, inPlaceDynamicLibrary = true, encoding = 'utf-8') => {
165
+ }, referencePath = './', pathsToIgnore = KNOWN_PATHS_TO_IGNORE, relativeModuleLocations = ['node_modules'], packageEntryFileNames = ['index', 'main'], packageMainPropertyNames = ['main', 'module'], packageAliasPropertyNames = [], includePattern = [], excludePattern = [], inPlaceNormalLibrary = false, inPlaceSpecialImports = true, encoding = 'utf-8') => {
166
166
  context = resolve(context);
167
167
  requestContext = resolve(requestContext);
168
168
  referencePath = resolve(referencePath);
@@ -195,7 +195,7 @@ export const determineExternalRequest = (request, context = './', requestContext
195
195
  in their request and aren't part of the current main package or have a
196
196
  file extension other than JavaScript aware.
197
197
  */
198
- if (!inPlaceNormalLibrary && (extensions.file.external.length === 0 || filePath && extensions.file.external.includes(extname(filePath)) || !filePath && extensions.file.external.includes('')) && !(inPlaceDynamicLibrary && request.includes('!')) && (!filePath && inPlaceDynamicLibrary || filePath && (!filePath.startsWith(context) || isFilePathInLocation(filePath, externalModuleLocations)))) return applyContext(resolvedRequest, requestContext, referencePath, aliases, moduleReplacements, relativeModuleLocations) || null;
198
+ if (!inPlaceNormalLibrary && (extensions.file.external.length === 0 || filePath && extensions.file.external.includes(extname(filePath)) || !filePath && extensions.file.external.includes('')) && !(inPlaceSpecialImports && request.includes('!')) && (!filePath && inPlaceSpecialImports || filePath && (!filePath.startsWith(context) || isFilePathInLocation(filePath, externalModuleLocations)))) return applyContext(resolvedRequest, requestContext, referencePath, aliases, moduleReplacements, relativeModuleLocations) || null;
199
199
  return null;
200
200
  };
201
201
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "4.0.76",
3
+ "version": "4.0.78",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -106,7 +106,7 @@
106
106
  "babel-loader": "^10.1.1",
107
107
  "babel-plugin-polyfill-corejs3": "^1.0.0",
108
108
  "babel-plugin-transform-rewrite-imports": "^1.5.4",
109
- "clientnode": "4.0.1506",
109
+ "clientnode": "4.0.1508",
110
110
  "core-js": "^3.50.0",
111
111
  "ejs": "^6.0.1",
112
112
  "exports-loader": "^5.0.0",
@@ -120,7 +120,7 @@
120
120
  "rimraf": "^6.1.3",
121
121
  "script-loader": "^0.7.2",
122
122
  "typescript": "npm:@typescript/typescript6@^6.0.2",
123
- "webpack": "^5.110.3",
123
+ "webpack": "5.110.3",
124
124
  "webpack-cli": "^7.2.3",
125
125
  "webpack-sources": "^3.5.1"
126
126
  },
@@ -141,10 +141,10 @@
141
141
  "@types/webpack-sources": "^3.2.3",
142
142
  "@typescript-eslint/parser": "^8.69.0",
143
143
  "css-loader": "^7.1.5",
144
- "cssnano": "^9.0.2",
144
+ "cssnano": "^9.0.3",
145
145
  "eslint": "^10.10.0",
146
146
  "eslint-config-google": "^0.14.0",
147
- "eslint-plugin-jsdoc": "^64.3.5",
147
+ "eslint-plugin-jsdoc": "^64.3.6",
148
148
  "favicons": "^7.3.1",
149
149
  "favicons-webpack-plugin": "^6.0.1",
150
150
  "globals": "^17.12.0",
@@ -653,12 +653,13 @@
653
653
  },
654
654
  "extensions": {
655
655
  "file": {
656
+ "#": "NOTE: Sources have to win over already emitted build artifacts since a build output may share its directory with its sources. Otherwise a rebuild silently bundles the previous build result instead of the current sources.",
656
657
  "alias": {
657
658
  ".js": [
658
- ".ejs",
659
- ".js",
660
659
  ".ts",
661
660
  ".tsx",
661
+ ".ejs",
662
+ ".js",
662
663
  ".jsx"
663
664
  ]
664
665
  },
@@ -666,13 +667,13 @@
666
667
  "__evaluate__": "self.generic.isWeb ? self.extensions.file.internal : ['.compiled.js', '.cjs', '.js', '.json', '.mjs']"
667
668
  },
668
669
  "internal": [
669
- ".compiled.js",
670
+ ".ts",
671
+ ".tsx",
670
672
  ".cjs",
671
673
  ".mjs",
672
674
  ".js",
673
675
  ".jsx",
674
- ".ts",
675
- ".tsx",
676
+ ".compiled.js",
676
677
  ".json",
677
678
  ".sass",
678
679
  ".scss",
@@ -884,8 +885,9 @@
884
885
  "head": ".+"
885
886
  },
886
887
  "externalLibrary": {
887
- "dynamic": true,
888
- "normal": true
888
+ "dynamic": false,
889
+ "normal": false,
890
+ "special": true
889
891
  },
890
892
  "javaScript": {
891
893
  "head": "(^|/)errorreporter(/index)?\\.js([?#]|$)"
@@ -1551,6 +1553,11 @@
1551
1553
  "generic": {
1552
1554
  "isWeb": false
1553
1555
  },
1556
+ "inPlace": {
1557
+ "externalLibrary": {
1558
+ "dynamic": true
1559
+ }
1560
+ },
1554
1561
  "module": {
1555
1562
  "optimizer": {
1556
1563
  "terser": {
@@ -1570,16 +1577,6 @@
1570
1577
  "targetTechnology": {
1571
1578
  "boilerplate": "node",
1572
1579
  "payload": "node"
1573
- },
1574
- "#: webpack -> module -> parser -> javascript -> dynamicImportMode": "NOTE: Tells webpack to include dynamically-imported modules in the current chunk (returning an already-resolved promise) rather than emitting a separate [id].js. Result: only testBundle.js.",
1575
- "webpack": {
1576
- "module": {
1577
- "parser": {
1578
- "javascript": {
1579
- "dynamicImportMode": "eager"
1580
- }
1581
- }
1582
- }
1583
1580
  }
1584
1581
  },
1585
1582
  "test:browser": {
package/type.d.ts CHANGED
@@ -246,6 +246,7 @@ export interface InPlaceAssetConfiguration {
246
246
  export interface InPlaceConfiguration {
247
247
  cascadingStyleSheet: InPlaceAssetConfiguration | null;
248
248
  externalLibrary: {
249
+ special: boolean;
249
250
  normal: boolean;
250
251
  dynamic: boolean;
251
252
  };
@@ -236,7 +236,7 @@ if (configuration.injection.external.modules === '__implicit__')
236
236
  }
237
237
  }
238
238
  // endregion
239
- const resolvedRequest = 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);
239
+ const resolvedRequest = 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.special, configuration.encoding);
240
240
  if (resolvedRequest) {
241
241
  const keys = ['amd', 'commonjs', 'commonjs2', 'root'];
242
242
  let result = resolvedRequest;
@@ -913,6 +913,7 @@ export let webpackConfiguration = extend(true, {
913
913
  module: {
914
914
  parser: {
915
915
  javascript: {
916
+ dynamicImportMode: configuration.inPlace.externalLibrary.dynamic ? 'eager' : 'lazy',
916
917
  /*
917
918
  Avoids to overwrite "import.meta.url" with a static
918
919
  build time url.