@atlassian/webresource-webpack-plugin 7.0.6 → 7.1.1
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/CHANGELOG.md +18 -0
- package/README.md +11 -19
- package/dist/AppResources.d.ts +11 -6
- package/dist/AppResources.js +22 -22
- package/dist/AppResources.js.map +1 -1
- package/dist/WebpackHelpers.d.ts +8 -6
- package/dist/WebpackHelpers.js +70 -51
- package/dist/WebpackHelpers.js.map +1 -1
- package/dist/WebpackRuntimeHelpers.d.ts +0 -2
- package/dist/WebpackRuntimeHelpers.js +1 -12
- package/dist/WebpackRuntimeHelpers.js.map +1 -1
- package/dist/WrmPlugin.d.ts +18 -2
- package/dist/WrmPlugin.js +207 -58
- package/dist/WrmPlugin.js.map +1 -1
- package/dist/helpers/bundler-bridge.d.ts +8 -0
- package/dist/helpers/bundler-bridge.js +23 -0
- package/dist/helpers/bundler-bridge.js.map +1 -0
- package/dist/helpers/peer-dependency-checker.d.ts +1 -0
- package/dist/helpers/peer-dependency-checker.js +23 -0
- package/dist/helpers/peer-dependency-checker.js.map +1 -0
- package/dist/shims/empty-wrm-module.d.ts +1 -0
- package/dist/shims/empty-wrm-module.js +3 -0
- package/dist/shims/empty-wrm-module.js.map +1 -0
- package/dist/types/extracted-webpack-types.d.ts +2 -1
- package/dist/types/types.d.ts +2 -1
- package/jest.config.js +27 -3
- package/package.json +19 -14
- package/dist/webpack-modules/EmptyExportsModule.d.ts +0 -14
- package/dist/webpack-modules/EmptyExportsModule.js +0 -28
- package/dist/webpack-modules/EmptyExportsModule.js.map +0 -1
- package/dist/webpack-modules/ProvidedExternalDependencyModule.d.ts +0 -20
- package/dist/webpack-modules/ProvidedExternalDependencyModule.js +0 -36
- package/dist/webpack-modules/ProvidedExternalDependencyModule.js.map +0 -1
- package/dist/webpack-modules/WrmDependencyModule.d.ts +0 -6
- package/dist/webpack-modules/WrmDependencyModule.js +0 -17
- package/dist/webpack-modules/WrmDependencyModule.js.map +0 -1
- package/dist/webpack-modules/WrmResourceModule.d.ts +0 -10
- package/dist/webpack-modules/WrmResourceModule.js +0 -29
- package/dist/webpack-modules/WrmResourceModule.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [7.1.1](https://bitbucket.org/atlassianlabs/fe-server/branches/compare/@atlassian/webresource-webpack-plugin@7.1.1..@atlassian/webresource-webpack-plugin@7.1.0) (2025-12-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **@atlassian/webresource-webpack-plugin:** do not require webpack-sources ([e15e443](https://bitbucket.org/atlassianlabs/fe-server/commits/e15e443570090a63669b55a884789ad617cbe32a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [7.1.0](https://bitbucket.org/atlassianlabs/fe-server/branches/compare/@atlassian/webresource-webpack-plugin@7.1.0..@atlassian/webresource-webpack-plugin@7.0.6) (2025-12-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **@atlassian/webresource-webpack-plugin:** rspack support ([b66c5d8](https://bitbucket.org/atlassianlabs/fe-server/commits/b66c5d8be61d4c1a295c02cf9efaac940219eb7f))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
### [7.0.6](https://bitbucket.org/atlassianlabs/fe-server/branches/compare/@atlassian/webresource-webpack-plugin@7.0.6..@atlassian/webresource-webpack-plugin@7.0.5) (2025-09-12)
|
|
7
25
|
|
|
8
26
|
|
package/README.md
CHANGED
|
@@ -732,7 +732,7 @@ This plugin has been built to work with the following versions of the external b
|
|
|
732
732
|
- [Atlassian Maven Plugin Suite (AMPS)][atlassian-amps] 6.2.11+
|
|
733
733
|
- [Atlassian Web Resource Manager (WRM)][atlassian-wrm] 4.3.6+
|
|
734
734
|
|
|
735
|
-
This plugin is tested with webpack 5.0+.
|
|
735
|
+
This plugin is tested with webpack 5.0+ and rspack 1.5+.
|
|
736
736
|
|
|
737
737
|
### Recommended with webpack 5
|
|
738
738
|
|
|
@@ -759,29 +759,21 @@ The tool will ask you a few questions and guide you if it finds issues with your
|
|
|
759
759
|
|
|
760
760
|
You can read more about the troubleshooting tool on the [NPM page for the `@atlassian/wrm-troubleshooting` package][wrm-troubleshooting].
|
|
761
761
|
|
|
762
|
-
###
|
|
763
|
-
|
|
764
|
-
If you install `webpack-sources@3` along with `webpack@4`, you'll likely get this error:
|
|
762
|
+
### Runtime problems
|
|
765
763
|
|
|
766
764
|
```
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
TypeError: item.node is not a function
|
|
771
|
-
at /project/path/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:59:50
|
|
772
|
-
at Array.map (<anonymous>)
|
|
773
|
-
at ConcatSource.node (/project/path/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:58:63)
|
|
774
|
-
at proto.sourceAndMap (/project/path/node_modules/webpack/node_modules/webpack-sources/lib/SourceAndMapMixin.js:29:18)
|
|
775
|
-
at CachedSource.sourceAndMap (/project/path/node_modules/webpack/node_modules/webpack-sources/lib/CachedSource.js:58:31)
|
|
776
|
-
at getTaskForFile (/project/path/node_modules/webpack/lib/SourceMapDevToolPlugin.js:65:30)
|
|
777
|
-
at /project/path/node_modules/webpack/lib/SourceMapDevToolPlugin.js:215:20
|
|
778
|
-
at Array.forEach (<anonymous>)
|
|
779
|
-
at /project/path/node_modules/webpack/lib/SourceMapDevToolPlugin.js:186:12
|
|
780
|
-
at SyncHook.eval [as call] (eval at create (/project/path/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
|
|
765
|
+
e.O is not a function
|
|
766
|
+
```
|
|
781
767
|
|
|
768
|
+
OR (when minimize: false)
|
|
769
|
+
|
|
770
|
+
```
|
|
771
|
+
__webpack_require__.O is not a function
|
|
782
772
|
```
|
|
783
773
|
|
|
784
|
-
|
|
774
|
+
If you use bundle web-resources from an external plugin that uses `optimization.runtimeChunk: 'single'`
|
|
775
|
+
and `optimization.splitChunks.chunks: 'all'` you might need to configure your plugin to also use `runtime: 'single'`
|
|
776
|
+
so that webpack runtime object that is shared when loading chunks has the same signature.
|
|
785
777
|
|
|
786
778
|
### Other problems
|
|
787
779
|
|
package/dist/AppResources.d.ts
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
import type { Chunk, Compilation, Compiler } from 'webpack';
|
|
2
2
|
import type { Entrypoint } from './types/extracted-webpack-types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ChunkResourceDescriptor, ConsolidatedOptions, DependencyMap, WrmResourceMap } from './types/types';
|
|
4
4
|
type SplitChunkDependenciesKeyMap = Map<Chunk, {
|
|
5
5
|
key: string;
|
|
6
6
|
dependency: string;
|
|
7
7
|
}>;
|
|
8
8
|
export type AppResourceParams = {
|
|
9
9
|
assetsUUID: string;
|
|
10
|
-
assetNames: AssetNames;
|
|
11
10
|
options: ConsolidatedOptions;
|
|
12
11
|
compiler: Compiler;
|
|
13
12
|
compilation: Compilation;
|
|
13
|
+
dependencyModuleMap: DependencyMap;
|
|
14
|
+
resourceModuleMap: WrmResourceMap;
|
|
15
|
+
resourceAssetsMap: DependencyMap;
|
|
14
16
|
};
|
|
15
17
|
export default class AppResources {
|
|
16
18
|
private readonly assetsUUID;
|
|
17
19
|
private readonly compiler;
|
|
18
20
|
private readonly compilation;
|
|
19
|
-
private
|
|
21
|
+
private readonly dependencyModuleMap;
|
|
22
|
+
private readonly resourceModuleMap;
|
|
23
|
+
private readonly resourceAssetsMap;
|
|
20
24
|
private options;
|
|
21
25
|
/**
|
|
22
26
|
* @param assetsUUID unique hash to identify the assets web-resource
|
|
23
|
-
* @param assetNames full module filepaths -> relative filepath
|
|
24
27
|
* @param options WrmPlugin configuration
|
|
25
28
|
* @param compiler Webpack compiler
|
|
26
29
|
* @param compilation Webpack compilation
|
|
30
|
+
* @param dependencyModuleMap map of module identifier -> set of web-resource dependencies
|
|
31
|
+
* @param resourceModuleMap map of resource identifier -> set of web-resource external resources
|
|
32
|
+
* @param resourceAssetsMap map of resource identifier -> set of asset files referenced by that resource
|
|
27
33
|
*/
|
|
28
|
-
constructor({ assetsUUID,
|
|
34
|
+
constructor({ assetsUUID, options, compiler, compilation, dependencyModuleMap, resourceModuleMap, resourceAssetsMap, }: AppResourceParams);
|
|
29
35
|
getSingleRuntimeFiles(): string[];
|
|
30
36
|
getAssetResourceDescriptor(): ChunkResourceDescriptor;
|
|
31
|
-
getDependencyResourcesFromChunk(chunk: Chunk): string[];
|
|
32
37
|
getWebresourceKeyForChunk(chunk: Chunk, transform: (id: string, name: string) => string): string;
|
|
33
38
|
/**
|
|
34
39
|
* Every entrypoint has an attribute called "chunks".
|
package/dist/AppResources.js
CHANGED
|
@@ -14,17 +14,21 @@ const RUNTIME_WR_KEY = 'common-runtime';
|
|
|
14
14
|
class AppResources {
|
|
15
15
|
/**
|
|
16
16
|
* @param assetsUUID unique hash to identify the assets web-resource
|
|
17
|
-
* @param assetNames full module filepaths -> relative filepath
|
|
18
17
|
* @param options WrmPlugin configuration
|
|
19
18
|
* @param compiler Webpack compiler
|
|
20
19
|
* @param compilation Webpack compilation
|
|
20
|
+
* @param dependencyModuleMap map of module identifier -> set of web-resource dependencies
|
|
21
|
+
* @param resourceModuleMap map of resource identifier -> set of web-resource external resources
|
|
22
|
+
* @param resourceAssetsMap map of resource identifier -> set of asset files referenced by that resource
|
|
21
23
|
*/
|
|
22
|
-
constructor({ assetsUUID,
|
|
24
|
+
constructor({ assetsUUID, options, compiler, compilation, dependencyModuleMap, resourceModuleMap, resourceAssetsMap, }) {
|
|
23
25
|
this.assetsUUID = assetsUUID;
|
|
24
|
-
this.assetNames = assetNames;
|
|
25
26
|
this.options = options;
|
|
26
27
|
this.compiler = compiler;
|
|
27
28
|
this.compilation = compilation;
|
|
29
|
+
this.dependencyModuleMap = dependencyModuleMap;
|
|
30
|
+
this.resourceModuleMap = resourceModuleMap;
|
|
31
|
+
this.resourceAssetsMap = resourceAssetsMap;
|
|
28
32
|
}
|
|
29
33
|
getSingleRuntimeFiles() {
|
|
30
34
|
const files = this.getEntryPoints()
|
|
@@ -36,16 +40,12 @@ class AppResources {
|
|
|
36
40
|
return Array.from(files);
|
|
37
41
|
}
|
|
38
42
|
getAssetResourceDescriptor() {
|
|
39
|
-
|
|
40
|
-
const assetFiles = Object.keys(this.compilation.assets).filter((p) => !/\.(js|css|soy)(\.map)?$/.test(p));
|
|
43
|
+
const assetFiles = (0, WebpackHelpers_1.getAllAssetFiles)(this.compilation);
|
|
41
44
|
return {
|
|
42
45
|
attributes: { key: `assets-${this.assetsUUID}` },
|
|
43
46
|
resources: assetFiles,
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
|
-
getDependencyResourcesFromChunk(chunk) {
|
|
47
|
-
return Array.from(chunk.auxiliaryFiles);
|
|
48
|
-
}
|
|
49
49
|
getWebresourceKeyForChunk(chunk, transform) {
|
|
50
50
|
const chunkId = String(chunk.id);
|
|
51
51
|
const chunkName = chunk.name ? String(chunk.name) : chunkId;
|
|
@@ -99,27 +99,28 @@ class AppResources {
|
|
|
99
99
|
* These include - like other chunk-descriptors their assets and external resources etc.
|
|
100
100
|
*/
|
|
101
101
|
return syncSplitChunks.map((c) => {
|
|
102
|
-
const additionalFileDeps = this.getDependencyResourcesFromChunk(c);
|
|
103
102
|
return {
|
|
104
103
|
attributes: syncSplitChunkDependencyKeyMap.get(c),
|
|
105
|
-
externalResources: (0, WebpackHelpers_1.
|
|
106
|
-
resources: (0,
|
|
107
|
-
dependencies: (0, uniq_1.default)([
|
|
104
|
+
externalResources: (0, WebpackHelpers_1.getExternalResourcesForChunks)(this.compilation, c, this.resourceModuleMap),
|
|
105
|
+
resources: (0, WebpackHelpers_1.getResourcesForChunks)(this.compilation, [c], [c], this.resourceAssetsMap),
|
|
106
|
+
dependencies: (0, uniq_1.default)([
|
|
107
|
+
...(0, base_dependencies_1.getBaseDependencies)(),
|
|
108
|
+
...(0, WebpackHelpers_1.getDependenciesForChunks)(this.compilation, c, this.dependencyModuleMap, this.options.providedDependencies),
|
|
109
|
+
]),
|
|
108
110
|
};
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
113
|
getAsyncChunksResourceDescriptors() {
|
|
112
114
|
return (0, WebpackHelpers_1.getAllAsyncChunks)(this.getEntryPoints()).map((c) => {
|
|
113
|
-
const additionalFileDeps = this.getDependencyResourcesFromChunk(c);
|
|
114
115
|
// async chunk webresource key needs to be a chunk id so that it can be loaded correctly by webpack at runtime
|
|
115
116
|
const webresourceKey = this.getWebresourceKeyForChunk(c, (id) => id);
|
|
116
117
|
return {
|
|
117
118
|
attributes: { key: webresourceKey },
|
|
118
|
-
externalResources: (0, WebpackHelpers_1.
|
|
119
|
-
resources: (0,
|
|
119
|
+
externalResources: (0, WebpackHelpers_1.getExternalResourcesForChunks)(this.compilation, c, this.resourceModuleMap),
|
|
120
|
+
resources: (0, WebpackHelpers_1.getResourcesForChunks)(this.compilation, [c], [c], this.resourceAssetsMap),
|
|
120
121
|
dependencies: (0, uniq_1.default)([
|
|
121
122
|
...(0, base_dependencies_1.getBaseDependencies)(),
|
|
122
|
-
...(0, WebpackHelpers_1.getDependenciesForChunks)(this.compilation, c),
|
|
123
|
+
...(0, WebpackHelpers_1.getDependenciesForChunks)(this.compilation, c, this.dependencyModuleMap, this.options.providedDependencies),
|
|
123
124
|
...(0, WebpackHelpers_1.getDependencyForCompiledCss)(this.compilation, c, this.options.pluginKey),
|
|
124
125
|
]),
|
|
125
126
|
contexts: this.options.addAsyncNameAsContext && c.name ? [`async-chunk-${c.name}`] : undefined,
|
|
@@ -145,18 +146,17 @@ class AppResources {
|
|
|
145
146
|
.map((c) => syncSplitChunkDependencyKeyMap.get(c))
|
|
146
147
|
.filter(Boolean)
|
|
147
148
|
.map((val) => val?.dependency);
|
|
148
|
-
// Construct the list of resources to add to this web-resource
|
|
149
|
-
const resourceList = (0, flatMap_1.default)(entrypointChunks, (c) => this.getDependencyResourcesFromChunk(c));
|
|
150
149
|
const dependencyList = [
|
|
151
150
|
...(0, base_dependencies_1.getBaseDependencies)(),
|
|
152
|
-
...(0, WebpackHelpers_1.getDependenciesForChunks)(this.compilation, runtimeChunk),
|
|
151
|
+
...(0, WebpackHelpers_1.getDependenciesForChunks)(this.compilation, runtimeChunk, this.dependencyModuleMap, this.options.providedDependencies),
|
|
153
152
|
...sharedSplitDeps,
|
|
154
153
|
];
|
|
154
|
+
let additionalChunks = [];
|
|
155
155
|
if (singleRuntime) {
|
|
156
156
|
dependencyList.unshift(`${this.options.pluginKey}:${singleRuntimeWebResourceKey}`);
|
|
157
157
|
}
|
|
158
158
|
else {
|
|
159
|
-
|
|
159
|
+
additionalChunks = [runtimeChunk];
|
|
160
160
|
}
|
|
161
161
|
return {
|
|
162
162
|
attributes: webResourceAttrs,
|
|
@@ -164,8 +164,8 @@ class AppResources {
|
|
|
164
164
|
conditions: (0, web_resource_entrypoints_1.getConditionForEntry)(name, this.options.conditionMap),
|
|
165
165
|
dataProviders: (0, web_resource_entrypoints_1.getDataProvidersForEntry)(name, this.options.dataProvidersMap),
|
|
166
166
|
deprecationInfo: (0, web_resource_entrypoints_1.getDeprecationInfoForEntry)(name, this.options.deprecatedEntrypoints),
|
|
167
|
-
externalResources: (0, WebpackHelpers_1.
|
|
168
|
-
resources: (0,
|
|
167
|
+
externalResources: (0, WebpackHelpers_1.getExternalResourcesForChunks)(this.compilation, runtimeChunk, this.resourceModuleMap),
|
|
168
|
+
resources: (0, WebpackHelpers_1.getResourcesForChunks)(this.compilation, additionalChunks, entrypointChunks, this.resourceAssetsMap),
|
|
169
169
|
dependencies: (0, uniq_1.default)(dependencyList).filter(Boolean),
|
|
170
170
|
};
|
|
171
171
|
});
|
package/dist/AppResources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppResources.js","sourceRoot":"","sources":["../src/AppResources.ts"],"names":[],"mappings":";;;;;AAAA,mCAAgC;AAChC,6DAAqC;AACrC,uDAA+B;AAG/B,gEAA+D;AAC/D,yDAAmE;AACnE,iFAM4C;AAG5C,
|
|
1
|
+
{"version":3,"file":"AppResources.js","sourceRoot":"","sources":["../src/AppResources.ts"],"names":[],"mappings":";;;;;AAAA,mCAAgC;AAChC,6DAAqC;AACrC,uDAA+B;AAG/B,gEAA+D;AAC/D,yDAAmE;AACnE,iFAM4C;AAG5C,qDAQ0B;AAE1B,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAcxC,MAAqB,YAAY;IAU/B;;;;;;;;OAQG;IACH,YAAY,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GACC;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,qBAAqB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE;aAChC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,KAAK,CAAC;aACxD,IAAI,CAAC,OAAO,CAAC,CAAC;QACjB,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAA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CAAC;IACJ,CAAC;CACF;AA9ND,+BA8NC"}
|
package/dist/WebpackHelpers.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { Chunk, Compilation, Compiler
|
|
1
|
+
import type { Chunk, Compilation, Compiler } from 'webpack';
|
|
2
2
|
import type { Entrypoint } from './types/extracted-webpack-types';
|
|
3
|
-
import type { WrmResource } from './types/types';
|
|
3
|
+
import type { DependencyMap, ProvidedDependenciesMap, WrmResource, WrmResourceMap } from './types/types';
|
|
4
4
|
export declare const getAllAsyncChunks: (entryPoints: Entrypoint[]) => Chunk[];
|
|
5
|
-
export declare const getChunkModules: (compilation: Compilation, chunk: Chunk) =>
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const getDependenciesForChunks: (compilation: Compilation, val: Chunk | Chunk[]) => string[];
|
|
5
|
+
export declare const getChunkModules: (compilation: Compilation, chunk: Chunk) => any[];
|
|
6
|
+
export declare const getDependenciesForChunks: (compilation: Compilation, val: Chunk | Chunk[], dependencyModuleMap: DependencyMap, providedDependencies: ProvidedDependenciesMap) => string[];
|
|
8
7
|
export declare const getDependencyForCompiledCss: (compilation: Compilation, chunk: Chunk, pluginKey: string) => string[];
|
|
8
|
+
export declare const getResourcesForChunks: (compilation: Compilation, chunks: Chunk[], auxiliaryChunks: Chunk[], resourceAssetsMap: DependencyMap) => string[];
|
|
9
|
+
export declare const getExternalResourcesForChunks: (compilation: Compilation, val: Chunk | Chunk[], resourceModuleMap: WrmResourceMap) => WrmResource[];
|
|
10
|
+
export declare const getAllAssetFiles: (compilation: Compilation) => string[];
|
|
9
11
|
export declare const isRunningInProductionMode: (compiler: Compiler) => boolean;
|
|
10
12
|
export declare const isSingleRuntime: (compiler: Compiler) => boolean;
|
|
11
13
|
export declare const extractLibraryDetailsFromWebpackConfig: (compiler: Compiler) => {
|
|
12
|
-
target: "module" | "import" | "var" | "
|
|
14
|
+
target: "module" | "import" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "promise" | "script" | "node-commonjs" | undefined;
|
|
13
15
|
name: undefined;
|
|
14
16
|
} | {
|
|
15
17
|
target: string;
|
package/dist/WebpackHelpers.js
CHANGED
|
@@ -3,70 +3,53 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractLibraryDetailsFromWebpackConfig = exports.isSingleRuntime = exports.isRunningInProductionMode = exports.
|
|
7
|
-
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
6
|
+
exports.extractLibraryDetailsFromWebpackConfig = exports.isSingleRuntime = exports.isRunningInProductionMode = exports.getAllAssetFiles = exports.getExternalResourcesForChunks = exports.getResourcesForChunks = exports.getDependencyForCompiledCss = exports.getDependenciesForChunks = exports.getChunkModules = exports.getAllAsyncChunks = void 0;
|
|
8
7
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
9
8
|
const compiled_css_1 = require("./helpers/compiled-css");
|
|
10
|
-
const ProvidedExternalDependencyModule_1 = __importDefault(require("./webpack-modules/ProvidedExternalDependencyModule"));
|
|
11
|
-
const WrmDependencyModule_1 = __importDefault(require("./webpack-modules/WrmDependencyModule"));
|
|
12
|
-
const WrmResourceModule_1 = __importDefault(require("./webpack-modules/WrmResourceModule"));
|
|
13
|
-
function isWrmResourceModule(m) {
|
|
14
|
-
return m instanceof WrmResourceModule_1.default;
|
|
15
|
-
}
|
|
16
|
-
function isProvidedDependencyOrWrmDependency(m) {
|
|
17
|
-
return m instanceof ProvidedExternalDependencyModule_1.default || m instanceof WrmDependencyModule_1.default;
|
|
18
|
-
}
|
|
19
|
-
const _getExternalResourceModules = (compilation, chunk) => {
|
|
20
|
-
return (0, exports.getChunkModules)(compilation, chunk)
|
|
21
|
-
.filter(isWrmResourceModule)
|
|
22
|
-
.map((m) => m.getResource());
|
|
23
|
-
};
|
|
24
|
-
const _getExternalDependencyModules = (compilation, chunk) => {
|
|
25
|
-
return (0, exports.getChunkModules)(compilation, chunk)
|
|
26
|
-
.filter(isProvidedDependencyOrWrmDependency)
|
|
27
|
-
.sort((a, b) => {
|
|
28
|
-
return (
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
-
require('webpack/lib/util/comparators.js').compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph)(a, b));
|
|
31
|
-
})
|
|
32
|
-
.map((m) => m.getDependency());
|
|
33
|
-
};
|
|
34
9
|
const getAllAsyncChunks = (entryPoints) => {
|
|
35
|
-
const
|
|
36
|
-
const recursivelyGetAllAsyncChunks = (
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
10
|
+
const seenAsyncChunks = new Set();
|
|
11
|
+
const recursivelyGetAllAsyncChunks = (chunk) => {
|
|
12
|
+
const asyncChunks = [...(chunk.getAllAsyncChunks() || [])];
|
|
13
|
+
const unseen = asyncChunks.filter((ac) => {
|
|
14
|
+
if (seenAsyncChunks.has(ac)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
seenAsyncChunks.add(ac);
|
|
18
|
+
return true;
|
|
43
19
|
});
|
|
44
|
-
return
|
|
20
|
+
return [...unseen, ...unseen.flatMap((ac) => recursivelyGetAllAsyncChunks(ac))];
|
|
45
21
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return (0, uniq_1.default)(allAsyncChunks);
|
|
22
|
+
return entryPoints.flatMap((ep) => {
|
|
23
|
+
return recursivelyGetAllAsyncChunks(ep.getEntrypointChunk());
|
|
24
|
+
});
|
|
50
25
|
};
|
|
51
26
|
exports.getAllAsyncChunks = getAllAsyncChunks;
|
|
52
27
|
const getChunkModules = (compilation, chunk) => {
|
|
53
|
-
return compilation.chunkGraph.getChunkModules(chunk)
|
|
28
|
+
return compilation.chunkGraph.getChunkModules(chunk).flatMap((module) => {
|
|
29
|
+
// unwind concatenated modules
|
|
30
|
+
if ('modules' in module && module.modules && Array.isArray(module.modules)) {
|
|
31
|
+
return [module, ...module.modules];
|
|
32
|
+
}
|
|
33
|
+
return module;
|
|
34
|
+
});
|
|
54
35
|
};
|
|
55
36
|
exports.getChunkModules = getChunkModules;
|
|
56
|
-
const
|
|
57
|
-
const externalResources = new Set();
|
|
58
|
-
for (const dep of _getExternalResourceModules(compilation, chunk)) {
|
|
59
|
-
externalResources.add(dep);
|
|
60
|
-
}
|
|
61
|
-
return Array.from(externalResources);
|
|
62
|
-
};
|
|
63
|
-
exports.getExternalResourcesForChunk = getExternalResourcesForChunk;
|
|
64
|
-
const getDependenciesForChunks = (compilation, val) => {
|
|
37
|
+
const getDependenciesForChunks = (compilation, val, dependencyModuleMap, providedDependencies) => {
|
|
65
38
|
const chunks = Array.isArray(val) ? val : [val];
|
|
66
39
|
const externalDeps = new Set();
|
|
67
40
|
for (const chunk of chunks) {
|
|
68
|
-
for (const
|
|
69
|
-
|
|
41
|
+
for (const module of (0, exports.getChunkModules)(compilation, chunk)) {
|
|
42
|
+
if (module.constructor.name === 'ExternalModule') {
|
|
43
|
+
const providedDependency = providedDependencies.get(module.userRequest);
|
|
44
|
+
if (providedDependency) {
|
|
45
|
+
externalDeps.add(providedDependency.dependency);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const moduleKey = module.identifier();
|
|
49
|
+
const dependenciesForModule = [...(dependencyModuleMap.get(moduleKey) || [])];
|
|
50
|
+
for (const dep of dependenciesForModule) {
|
|
51
|
+
externalDeps.add(dep);
|
|
52
|
+
}
|
|
70
53
|
}
|
|
71
54
|
// TODO: figure out how to pass this "properly" as a module
|
|
72
55
|
// @ts-expect-error See WrmPlugin.ts where this is set.
|
|
@@ -90,6 +73,42 @@ const getDependencyForCompiledCss = (compilation, chunk, pluginKey) => {
|
|
|
90
73
|
return !looksLikeCompiledCss && hasCompiledCss ? [`${pluginKey}:compiled-css`] : [];
|
|
91
74
|
};
|
|
92
75
|
exports.getDependencyForCompiledCss = getDependencyForCompiledCss;
|
|
76
|
+
const getResourcesForChunks = (compilation, chunks, auxiliaryChunks, resourceAssetsMap) => {
|
|
77
|
+
const resourceList = [];
|
|
78
|
+
for (const chunk of chunks) {
|
|
79
|
+
resourceList.push(...Array.from(chunk.files));
|
|
80
|
+
}
|
|
81
|
+
for (const chunk of auxiliaryChunks) {
|
|
82
|
+
resourceList.push(...Array.from(chunk.auxiliaryFiles));
|
|
83
|
+
}
|
|
84
|
+
const allAssetFiles = (0, exports.getAllAssetFiles)(compilation);
|
|
85
|
+
const resourceAssets = resourceList.flatMap((resource) => {
|
|
86
|
+
return Array.from(resourceAssetsMap.get(resource) || []).filter((assetFile) => allAssetFiles.includes(assetFile));
|
|
87
|
+
});
|
|
88
|
+
resourceList.push(...resourceAssets);
|
|
89
|
+
return (0, uniq_1.default)(resourceList);
|
|
90
|
+
};
|
|
91
|
+
exports.getResourcesForChunks = getResourcesForChunks;
|
|
92
|
+
const getExternalResourcesForChunks = (compilation, val, resourceModuleMap) => {
|
|
93
|
+
const chunks = Array.isArray(val) ? val : [val];
|
|
94
|
+
const additionalResources = new Set();
|
|
95
|
+
for (const chunk of chunks) {
|
|
96
|
+
for (const module of (0, exports.getChunkModules)(compilation, chunk)) {
|
|
97
|
+
const moduleKey = module.identifier();
|
|
98
|
+
const resourcesForModule = [...(resourceModuleMap.get(moduleKey) || [])];
|
|
99
|
+
for (const resource of resourcesForModule) {
|
|
100
|
+
additionalResources.add(resource);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return Array.from(additionalResources);
|
|
105
|
+
};
|
|
106
|
+
exports.getExternalResourcesForChunks = getExternalResourcesForChunks;
|
|
107
|
+
const getAllAssetFiles = (compilation) => {
|
|
108
|
+
// remove anything that we know is handled differently
|
|
109
|
+
return Object.keys(compilation.assets).filter((p) => !/\.(js|css|soy)(\.map)?$/.test(p));
|
|
110
|
+
};
|
|
111
|
+
exports.getAllAssetFiles = getAllAssetFiles;
|
|
93
112
|
const isRunningInProductionMode = (compiler) => {
|
|
94
113
|
const { mode } = compiler.options;
|
|
95
114
|
return mode === 'production' || (mode === 'none' && process.env.NODE_ENV === 'production');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpackHelpers.js","sourceRoot":"","sources":["../src/WebpackHelpers.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"WebpackHelpers.js","sourceRoot":"","sources":["../src/WebpackHelpers.ts"],"names":[],"mappings":";;;;;;AAAA,uDAA+B;AAG/B,yDAA8G;AAIvG,MAAM,iBAAiB,GAAG,CAAC,WAAyB,EAAE,EAAE;IAC7D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IAClC,MAAM,4BAA4B,GAAG,CAAC,KAAY,EAAW,EAAE;QAC7D,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE;YACvC,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAChC,OAAO,4BAA4B,CAAC,EAA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QAAQ,CAAC;IAC7B,MAAM,eAAe,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC;IAClF,IAAI,eAAe,EAAE,CAAC;QACpB,IAAI,eAAe,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,GAAG,eAAiF,CAAC;QACnG,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACtC,OAAO,OAAO,KAAK,OAAO,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAnBW,QAAA,eAAe,mBAmB1B;AAEK,MAAM,sCAAsC,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC3E,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACrE,CAAC;IAED,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,IAAI,EAAE,OAAO,CAAC,IAAc;KAC7B,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,sCAAsC,0CAUjD"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { Compilation, Compiler } from 'webpack';
|
|
2
|
-
import type { FactoryHandler } from './types/extracted-webpack-types';
|
|
3
|
-
export declare const hookIntoNormalModuleFactory: (stageName: string, compiler: Compiler, cb: FactoryHandler) => void;
|
|
4
2
|
export declare const hookIntoCompileDoneToGenerateReports: (stageName: string, compiler: Compiler, cb: (compilation: Compilation, callback: () => void) => void) => void;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hookIntoCompileDoneToGenerateReports =
|
|
4
|
-
const hookIntoNormalModuleFactory = (stageName, compiler, cb) => {
|
|
5
|
-
compiler.hooks.compile.tap(stageName, (params) => {
|
|
6
|
-
const hooks = params.normalModuleFactory.hooks;
|
|
7
|
-
const passThruFactory = (data, callback) => callback();
|
|
8
|
-
hooks.factorize.tapAsync({
|
|
9
|
-
name: stageName,
|
|
10
|
-
stage: 99,
|
|
11
|
-
}, cb(passThruFactory));
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
exports.hookIntoNormalModuleFactory = hookIntoNormalModuleFactory;
|
|
3
|
+
exports.hookIntoCompileDoneToGenerateReports = void 0;
|
|
15
4
|
const hookIntoCompileDoneToGenerateReports = (stageName, compiler, cb) => {
|
|
16
5
|
compiler.hooks.done.tapAsync(stageName, (stats, callback) => {
|
|
17
6
|
cb(stats.compilation, callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpackRuntimeHelpers.js","sourceRoot":"","sources":["../src/WebpackRuntimeHelpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"WebpackRuntimeHelpers.js","sourceRoot":"","sources":["../src/WebpackRuntimeHelpers.ts"],"names":[],"mappings":";;;AAEO,MAAM,oCAAoC,GAAG,CAClD,SAAiB,EACjB,QAAkB,EAClB,EAA4D,EAC5D,EAAE;IACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC1D,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,oCAAoC,wCAQ/C"}
|
package/dist/WrmPlugin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './shims/empty-wrm-module.js';
|
|
1
2
|
import type { Compiler } from 'webpack';
|
|
2
3
|
import type { DataProvidersMap, Options, ProvidedDependenciesMap, ResourceParamMap, TransformationMap } from './types/types';
|
|
3
4
|
type TransformerExtensions = {
|
|
@@ -6,6 +7,11 @@ type TransformerExtensions = {
|
|
|
6
7
|
declare class WrmPlugin {
|
|
7
8
|
static extendTransformations(values: TransformerExtensions): Map<any, any>;
|
|
8
9
|
private options;
|
|
10
|
+
private dependencyModuleMap;
|
|
11
|
+
private resourceModuleMap;
|
|
12
|
+
private dependencyIssuerMap;
|
|
13
|
+
private resourceIssuerMap;
|
|
14
|
+
private resourceAssetsMap;
|
|
9
15
|
/**
|
|
10
16
|
* A Webpack plugin that takes the compilation tree and creates <web-resource> XML definitions that mirror the
|
|
11
17
|
* dependency graph.
|
|
@@ -32,14 +38,24 @@ declare class WrmPlugin {
|
|
|
32
38
|
ensureDataProvidersMapIsValid(dataProvidersMap: DataProvidersMap): DataProvidersMap;
|
|
33
39
|
checkConfig(compiler: Compiler): void;
|
|
34
40
|
overwritePublicPath(compiler: Compiler): void;
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
private storeMapEntryInValueSet;
|
|
42
|
+
private storeModuleDependency;
|
|
43
|
+
hookUpModuleDependencies(compiler: Compiler): void;
|
|
44
|
+
hookUpWrInlineLoaders(compiler: Compiler): void;
|
|
45
|
+
/**
|
|
46
|
+
* We need to handle CSS url(...) assets so that we can include them as resources in the web-resource,
|
|
47
|
+
* and so they can be correctly relativized by a transformer from WRM.
|
|
48
|
+
* In a very specific setup (see `test/test-cases/asset-loading-via-css`), we can't rely on chunk.auxiliaryFiles
|
|
49
|
+
* and need to track these assets manually.
|
|
50
|
+
*/
|
|
51
|
+
hookUpCssUrlAssets(compiler: Compiler): void;
|
|
37
52
|
/**
|
|
38
53
|
* Ensure the WRM.require function is available at runtime and is used to load any code-split chunks.
|
|
39
54
|
*/
|
|
40
55
|
enableAsyncLoadingWithWRM(compiler: Compiler): void;
|
|
41
56
|
shouldOverwritePublicPath(): boolean;
|
|
42
57
|
shouldEnableAsyncLoadingWithWRM(): boolean;
|
|
58
|
+
private clearInternalMaps;
|
|
43
59
|
apply(compiler: Compiler): void;
|
|
44
60
|
}
|
|
45
61
|
export = WrmPlugin;
|