weboptimizer 4.0.76 → 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 +2 -2
- package/helper.js +3 -3
- package/package.json +10 -14
- package/type.d.ts +1 -0
- package/webpackConfigurator.js +2 -1
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
|
|
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,
|
|
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
|
|
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,
|
|
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('')) && !(
|
|
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.
|
|
3
|
+
"version": "4.0.77",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"cssnano": "^9.0.2",
|
|
145
145
|
"eslint": "^10.10.0",
|
|
146
146
|
"eslint-config-google": "^0.14.0",
|
|
147
|
-
"eslint-plugin-jsdoc": "^64.3.
|
|
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",
|
|
@@ -884,8 +884,9 @@
|
|
|
884
884
|
"head": ".+"
|
|
885
885
|
},
|
|
886
886
|
"externalLibrary": {
|
|
887
|
-
"dynamic":
|
|
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
package/webpackConfigurator.js
CHANGED
|
@@ -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.
|
|
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.
|