weboptimizer 4.0.75 → 4.0.77

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.75",
3
+ "version": "4.0.77",
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.1502",
109
+ "clientnode": "4.0.1506",
110
110
  "core-js": "^3.50.0",
111
111
  "ejs": "^6.0.1",
112
112
  "exports-loader": "^5.0.0",
@@ -142,9 +142,9 @@
142
142
  "@typescript-eslint/parser": "^8.69.0",
143
143
  "css-loader": "^7.1.5",
144
144
  "cssnano": "^9.0.2",
145
- "eslint": "^10.9.1",
145
+ "eslint": "^10.10.0",
146
146
  "eslint-config-google": "^0.14.0",
147
- "eslint-plugin-jsdoc": "^64.3.4",
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",
@@ -154,7 +154,7 @@
154
154
  "mini-css-extract-plugin": "^2.10.2",
155
155
  "mkdirp": "^3.0.1",
156
156
  "node-fetch": "^3.3.2",
157
- "postcss": "^8.5.27",
157
+ "postcss": "^8.5.28",
158
158
  "postcss-fontpath": "^1.0.0",
159
159
  "postcss-import": "^17.0.0",
160
160
  "postcss-loader": "^8.2.1",
@@ -163,7 +163,7 @@
163
163
  "postcss-url": "^10.1.4",
164
164
  "shx": "^0.4.0",
165
165
  "style-loader": "^4.0.0",
166
- "stylelint": "^17.14.1",
166
+ "stylelint": "^17.15.0",
167
167
  "stylelint-config-standard": "^40.0.0",
168
168
  "stylelint-config-standard-scss": "^17.0.0",
169
169
  "terser-webpack-plugin": "^5.6.1",
@@ -884,8 +884,9 @@
884
884
  "head": ".+"
885
885
  },
886
886
  "externalLibrary": {
887
- "dynamic": true,
888
- "normal": true
887
+ "dynamic": false,
888
+ "normal": true,
889
+ "special": true
889
890
  },
890
891
  "javaScript": {
891
892
  "head": "(^|/)errorreporter(/index)?\\.js([?#]|$)"
@@ -1551,6 +1552,11 @@
1551
1552
  "generic": {
1552
1553
  "isWeb": false
1553
1554
  },
1555
+ "inPlace": {
1556
+ "externalLibrary": {
1557
+ "dynamic": true
1558
+ }
1559
+ },
1554
1560
  "module": {
1555
1561
  "optimizer": {
1556
1562
  "terser": {
@@ -1570,16 +1576,6 @@
1570
1576
  "targetTechnology": {
1571
1577
  "boilerplate": "node",
1572
1578
  "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
1579
  }
1584
1580
  },
1585
1581
  "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;
@@ -911,6 +911,16 @@ export let webpackConfiguration = extend(true, {
911
911
  // endregion
912
912
  mode: configuration.debug ? 'development' : 'production',
913
913
  module: {
914
+ parser: {
915
+ javascript: {
916
+ dynamicImportMode: configuration.inPlace.externalLibrary.dynamic ? 'eager' : 'lazy',
917
+ /*
918
+ Avoids to overwrite "import.meta.url" with a static
919
+ build time url.
920
+ */
921
+ importMeta: false
922
+ }
923
+ },
914
924
  rules:
915
925
  /*
916
926
  Force the generated barrel entry modules and every module