weboptimizer 2.0.1471 → 2.0.1472
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 +4 -3
- package/helper.js +8 -7
- package/package.json +21 -14
- package/type.d.ts +4 -1
- package/webpackConfigurator.js +1 -1
package/helper.d.ts
CHANGED
|
@@ -184,12 +184,13 @@ export declare class Helper {
|
|
|
184
184
|
* Determines all module file paths.
|
|
185
185
|
* @param buildConfigurations - Resolved build configuration.
|
|
186
186
|
* @param moduleFilePathsToExclude - A list of modules file paths to
|
|
187
|
-
* exclude (specified by path or id)
|
|
188
|
-
*
|
|
187
|
+
* exclude (specified by path or id).
|
|
188
|
+
* @param moduleFilePathPatternToExclude - A list of modules file paths
|
|
189
|
+
* pattern to exclude (specified by path or id).
|
|
189
190
|
* @param context - File path to use as starting point.
|
|
190
191
|
* @returns All determined module file paths.
|
|
191
192
|
*/
|
|
192
|
-
static getAutoInjection(this: void, buildConfigurations: ResolvedBuildConfiguration, moduleFilePathsToExclude: Array<string>, context: string): Mapping;
|
|
193
|
+
static getAutoInjection(this: void, buildConfigurations: ResolvedBuildConfiguration, moduleFilePathsToExclude: Array<string>, moduleFilePathPatternToExclude: Array<RegExp | string>, context: string): Mapping;
|
|
193
194
|
/**
|
|
194
195
|
* Determines a resolved module file path in given package path.
|
|
195
196
|
* @param packagePath - Path to package to resolve in.
|
package/helper.js
CHANGED
|
@@ -614,7 +614,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
614
614
|
var referencePath = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
615
615
|
var pathsToIgnore = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ['.git'];
|
|
616
616
|
var injection = _clientnode["default"].copy(givenInjection);
|
|
617
|
-
var moduleFilePathsToExclude = Helper.determineModuleLocations(givenInjection.autoExclude, aliases, moduleReplacements, {
|
|
617
|
+
var moduleFilePathsToExclude = Helper.determineModuleLocations(givenInjection.autoExclude.paths, aliases, moduleReplacements, {
|
|
618
618
|
file: extensions.file.internal
|
|
619
619
|
}, context, referencePath, pathsToIgnore).filePaths;
|
|
620
620
|
var _iterator10 = _createForOfIteratorHelper(['entry', 'external']),
|
|
@@ -630,7 +630,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
630
630
|
chunk = _Object$entries4$_i[1];
|
|
631
631
|
if (chunk === '__auto__') {
|
|
632
632
|
chunk = injectionType[chunkName] = [];
|
|
633
|
-
var modules = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, referencePath);
|
|
633
|
+
var modules = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, givenInjection.autoExclude.pattern, referencePath);
|
|
634
634
|
for (var _i10 = 0, _Object$values5 = Object.values(modules); _i10 < _Object$values5.length; _i10++) {
|
|
635
635
|
var subChunk = _Object$values5[_i10];
|
|
636
636
|
chunk.push(subChunk);
|
|
@@ -642,7 +642,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
642
642
|
chunk.reverse();
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
} else if (injectionType === '__auto__') injection[name] = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, referencePath);
|
|
645
|
+
} else if (injectionType === '__auto__') injection[name] = Helper.getAutoInjection(buildConfigurations, moduleFilePathsToExclude, givenInjection.autoExclude.pattern, referencePath);
|
|
646
646
|
}
|
|
647
647
|
} catch (err) {
|
|
648
648
|
_iterator10.e(err);
|
|
@@ -655,14 +655,15 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
655
655
|
* Determines all module file paths.
|
|
656
656
|
* @param buildConfigurations - Resolved build configuration.
|
|
657
657
|
* @param moduleFilePathsToExclude - A list of modules file paths to
|
|
658
|
-
* exclude (specified by path or id)
|
|
659
|
-
*
|
|
658
|
+
* exclude (specified by path or id).
|
|
659
|
+
* @param moduleFilePathPatternToExclude - A list of modules file paths
|
|
660
|
+
* pattern to exclude (specified by path or id).
|
|
660
661
|
* @param context - File path to use as starting point.
|
|
661
662
|
* @returns All determined module file paths.
|
|
662
663
|
*/
|
|
663
664
|
}, {
|
|
664
665
|
key: "getAutoInjection",
|
|
665
|
-
value: function getAutoInjection(buildConfigurations, moduleFilePathsToExclude, context) {
|
|
666
|
+
value: function getAutoInjection(buildConfigurations, moduleFilePathsToExclude, moduleFilePathPatternToExclude, context) {
|
|
666
667
|
var result = {};
|
|
667
668
|
var injectedModuleIDs = {};
|
|
668
669
|
var _iterator11 = _createForOfIteratorHelper(buildConfigurations),
|
|
@@ -676,7 +677,7 @@ var Helper = exports.Helper = /*#__PURE__*/function () {
|
|
|
676
677
|
try {
|
|
677
678
|
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
678
679
|
var moduleFilePath = _step12.value;
|
|
679
|
-
if (!moduleFilePathsToExclude.includes(moduleFilePath)) {
|
|
680
|
+
if (!(moduleFilePathsToExclude.includes(moduleFilePath) || _clientnode["default"].isAnyMatching(moduleFilePath, moduleFilePathPatternToExclude))) {
|
|
680
681
|
var relativeModuleFilePath = "./".concat((0, _path.relative)(context, moduleFilePath));
|
|
681
682
|
var directoryPath = (0, _path.dirname)(relativeModuleFilePath);
|
|
682
683
|
var baseName = (0, _path.basename)(relativeModuleFilePath, ".".concat(buildConfiguration.extension));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1472",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"documentation-website": "^1.0.326",
|
|
138
138
|
"eslint": "^9.4.0",
|
|
139
139
|
"eslint-config-google": "^0.14.0",
|
|
140
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
140
|
+
"eslint-plugin-jsdoc": "^48.2.12",
|
|
141
141
|
"favicons": "^7.2.0",
|
|
142
142
|
"favicons-webpack-plugin": "^6.0.1",
|
|
143
143
|
"globals": "^15.4.0",
|
|
@@ -752,18 +752,25 @@
|
|
|
752
752
|
"givenCommandLineArguments": [],
|
|
753
753
|
"hashAlgorithm": "md5",
|
|
754
754
|
"injection": {
|
|
755
|
-
"autoExclude":
|
|
756
|
-
"
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
755
|
+
"autoExclude": {
|
|
756
|
+
"paths": [
|
|
757
|
+
"./declarations.d.ts",
|
|
758
|
+
"./dummy",
|
|
759
|
+
"./dummyPlugin",
|
|
760
|
+
"./test",
|
|
761
|
+
"./test.js",
|
|
762
|
+
"./test.ts",
|
|
763
|
+
"./type",
|
|
764
|
+
"./type.js",
|
|
765
|
+
"./type.ts",
|
|
766
|
+
".coverage"
|
|
767
|
+
],
|
|
768
|
+
"pattern": [
|
|
769
|
+
{
|
|
770
|
+
"__evaluate__": "./test/.+"
|
|
771
|
+
}
|
|
772
|
+
]
|
|
773
|
+
},
|
|
767
774
|
"chunks": {},
|
|
768
775
|
"entry": {
|
|
769
776
|
"index": "__auto__"
|
package/type.d.ts
CHANGED
|
@@ -45,7 +45,10 @@ export type ExternalAliases = Mapping<Mapping | string | ((_request: string, _ke
|
|
|
45
45
|
export type GivenInjection = AnyFunction | string | Array<string> | Mapping<string | Array<string>>;
|
|
46
46
|
export type NormalizedGivenInjection = Mapping<Array<string>>;
|
|
47
47
|
export interface GivenInjectionConfiguration {
|
|
48
|
-
autoExclude:
|
|
48
|
+
autoExclude: {
|
|
49
|
+
paths: Array<string>;
|
|
50
|
+
pattern: Array<RegExp | string>;
|
|
51
|
+
};
|
|
49
52
|
entry: GivenInjection;
|
|
50
53
|
external: GivenInjection;
|
|
51
54
|
}
|
package/webpackConfigurator.js
CHANGED
|
@@ -248,7 +248,7 @@ if (configuration.injection.external.modules === '__implicit__')
|
|
|
248
248
|
We only want to process modules from local context in library mode,
|
|
249
249
|
since a concrete project using this library should combine all assets
|
|
250
250
|
(and de-duplicate them) for optimal bundling results.
|
|
251
|
-
NOTE: Only native
|
|
251
|
+
NOTE: Only native javascript and json modules will be marked as
|
|
252
252
|
external dependency.
|
|
253
253
|
*/
|
|
254
254
|
configuration.injection.external.modules = function (_ref, callback) {
|