@atlassian/webresource-webpack-plugin 7.0.2 → 7.0.4-efd4a11

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -3
  3. package/dist/AppResources.d.ts +63 -0
  4. package/dist/AppResources.js +179 -0
  5. package/dist/AppResources.js.map +1 -0
  6. package/dist/AppResourcesFactory.d.ts +10 -0
  7. package/dist/AppResourcesFactory.js +16 -0
  8. package/dist/AppResourcesFactory.js.map +1 -0
  9. package/dist/WebpackHelpers.d.ts +16 -0
  10. package/dist/WebpackHelpers.js +97 -0
  11. package/dist/WebpackHelpers.js.map +1 -0
  12. package/dist/WebpackRuntimeHelpers.d.ts +2 -0
  13. package/dist/WebpackRuntimeHelpers.js +10 -0
  14. package/dist/WebpackRuntimeHelpers.js.map +1 -0
  15. package/dist/WrmManifestPlugin.d.ts +9 -0
  16. package/dist/WrmManifestPlugin.js +44 -0
  17. package/dist/WrmManifestPlugin.js.map +1 -0
  18. package/dist/WrmPlugin.d.ts +51 -0
  19. package/dist/WrmPlugin.js +566 -0
  20. package/dist/WrmPlugin.js.map +1 -0
  21. package/dist/deps/base-dependencies.d.ts +8 -0
  22. package/dist/deps/base-dependencies.js +38 -0
  23. package/dist/deps/base-dependencies.js.map +1 -0
  24. package/dist/deps/provided-dependencies.d.ts +3 -0
  25. package/dist/deps/provided-dependencies.js +22 -0
  26. package/dist/deps/provided-dependencies.js.map +1 -0
  27. package/dist/helpers/file-system.d.ts +2 -0
  28. package/dist/helpers/file-system.js +22 -0
  29. package/dist/helpers/file-system.js.map +1 -0
  30. package/dist/helpers/isRspackCompiler.d.ts +3 -0
  31. package/dist/helpers/isRspackCompiler.js +9 -0
  32. package/dist/helpers/isRspackCompiler.js.map +1 -0
  33. package/dist/helpers/options-parser.d.ts +3 -0
  34. package/dist/helpers/options-parser.js +31 -0
  35. package/dist/helpers/options-parser.js.map +1 -0
  36. package/dist/helpers/renderCondition.d.ts +3 -0
  37. package/dist/helpers/renderCondition.js +32 -0
  38. package/dist/helpers/renderCondition.js.map +1 -0
  39. package/dist/helpers/renderTransformations.d.ts +10 -0
  40. package/dist/helpers/renderTransformations.js +34 -0
  41. package/dist/helpers/renderTransformations.js.map +1 -0
  42. package/dist/helpers/string.d.ts +1 -0
  43. package/dist/helpers/string.js +9 -0
  44. package/dist/helpers/string.js.map +1 -0
  45. package/dist/helpers/web-resource-entrypoints.d.ts +9 -0
  46. package/dist/helpers/web-resource-entrypoints.js +44 -0
  47. package/dist/helpers/web-resource-entrypoints.js.map +1 -0
  48. package/dist/helpers/web-resource-generator.d.ts +2 -0
  49. package/dist/helpers/web-resource-generator.js +105 -0
  50. package/dist/helpers/web-resource-generator.js.map +1 -0
  51. package/dist/helpers/web-resource-parser.d.ts +2 -0
  52. package/dist/helpers/web-resource-parser.js +39 -0
  53. package/dist/helpers/web-resource-parser.js.map +1 -0
  54. package/dist/helpers/xml.d.ts +6 -0
  55. package/dist/helpers/xml.js +37 -0
  56. package/dist/helpers/xml.js.map +1 -0
  57. package/dist/logger.d.ts +4 -0
  58. package/dist/logger.js +26 -0
  59. package/dist/logger.js.map +1 -0
  60. package/dist/shims/require-ensure-shim.d.ts +2 -0
  61. package/dist/shims/require-ensure-shim.js +21 -0
  62. package/dist/shims/require-ensure-shim.js.map +1 -0
  63. package/dist/shims/runtime-load-shim.d.ts +14 -0
  64. package/dist/shims/runtime-load-shim.js +62 -0
  65. package/dist/shims/runtime-load-shim.js.map +1 -0
  66. package/dist/types/extracted-webpack-types.d.ts +12 -0
  67. package/dist/types/extracted-webpack-types.js +3 -0
  68. package/dist/types/extracted-webpack-types.js.map +1 -0
  69. package/dist/types/types.d.ts +132 -0
  70. package/dist/types/types.js +3 -0
  71. package/dist/types/types.js.map +1 -0
  72. package/dist/webpack-modules/EmptyExportsModule.d.ts +14 -0
  73. package/dist/webpack-modules/EmptyExportsModule.js +28 -0
  74. package/dist/webpack-modules/EmptyExportsModule.js.map +1 -0
  75. package/dist/webpack-modules/ProvidedExternalDependencyModule.d.ts +20 -0
  76. package/dist/webpack-modules/ProvidedExternalDependencyModule.js +36 -0
  77. package/dist/webpack-modules/ProvidedExternalDependencyModule.js.map +1 -0
  78. package/dist/webpack-modules/WrmDependencyModule.d.ts +6 -0
  79. package/dist/webpack-modules/WrmDependencyModule.js +17 -0
  80. package/dist/webpack-modules/WrmDependencyModule.js.map +1 -0
  81. package/dist/webpack-modules/WrmResourceModule.d.ts +10 -0
  82. package/dist/webpack-modules/WrmResourceModule.js +29 -0
  83. package/dist/webpack-modules/WrmResourceModule.js.map +1 -0
  84. package/jest.config.js +16 -1
  85. package/package.json +20 -17
@@ -0,0 +1,566 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const assert_1 = __importDefault(require("assert"));
6
+ const crypto_1 = require("crypto");
7
+ const fs_1 = require("fs");
8
+ const flatMap_1 = __importDefault(require("lodash/flatMap"));
9
+ const isObject_1 = __importDefault(require("lodash/isObject"));
10
+ const once_1 = __importDefault(require("lodash/once"));
11
+ const unionBy_1 = __importDefault(require("lodash/unionBy"));
12
+ const uniq_1 = __importDefault(require("lodash/uniq"));
13
+ const path_1 = __importDefault(require("path"));
14
+ const pretty_data_1 = require("pretty-data");
15
+ const url_join_1 = __importDefault(require("url-join"));
16
+ const uuid_1 = require("uuid");
17
+ const webpack_1 = require("webpack");
18
+ const AppResourcesFactory_1 = __importDefault(require("./AppResourcesFactory"));
19
+ const base_dependencies_1 = require("./deps/base-dependencies");
20
+ const provided_dependencies_1 = require("./deps/provided-dependencies");
21
+ const file_system_1 = require("./helpers/file-system");
22
+ const isRspackCompiler_1 = require("./helpers/isRspackCompiler");
23
+ const options_parser_1 = require("./helpers/options-parser");
24
+ const web_resource_generator_1 = require("./helpers/web-resource-generator");
25
+ const logger_1 = require("./logger");
26
+ const runtime_load_shim_1 = __importDefault(require("./shims/runtime-load-shim"));
27
+ const WebpackHelpers_1 = require("./WebpackHelpers");
28
+ const WebpackRuntimeHelpers_1 = require("./WebpackRuntimeHelpers");
29
+ const WrmManifestPlugin_1 = __importDefault(require("./WrmManifestPlugin"));
30
+ const defaultResourceParams = new Map().set('svg', [
31
+ {
32
+ name: 'content-type',
33
+ value: 'image/svg+xml',
34
+ },
35
+ ]);
36
+ const defaultTransformations = new Map().set('js', ['jsI18n']).set('soy', ['soyTransformer', 'jsI18n']);
37
+ const DEFAULT_DEV_ASSETS_HASH = 'DEV_PSEUDO_HASH';
38
+ const ASSOCIATIONS_PATH_IN_BUNDLE = './META-INF/fe-manifest-associations';
39
+ class WrmPlugin {
40
+ static extendTransformations(values) {
41
+ return [defaultTransformations, (0, options_parser_1.toMap)(values)].reduce((acc, map) => {
42
+ for (const [key, val] of map.entries()) {
43
+ const oldVals = acc.get(key);
44
+ const newVals = [].concat(oldVals).concat(val).filter(Boolean);
45
+ acc.set(key, newVals);
46
+ }
47
+ return acc;
48
+ }, new Map());
49
+ }
50
+ /**
51
+ * A Webpack plugin that takes the compilation tree and creates <web-resource> XML definitions that mirror the
52
+ * dependency graph.
53
+ *
54
+ * This plugin will:
55
+ *
56
+ * - generate <web-resource> definitions for each entrypoint, along with additional <web-resource> definitions for
57
+ * and appropriate dependencies on all chunks generated during compilation.
58
+ * - Add <dependency> declarations to each generated <web-resource> as appropriate, both for internal and external
59
+ * dependencies in the graph.
60
+ * - Add appropriate metadata to the <web-resource> definition, such as appropriate <context>s,
61
+ * enabled/disabled state, and more.
62
+ * @param {Options} options
63
+ */
64
+ constructor(options) {
65
+ this.dependencyModuleMap = new Map();
66
+ this.resourceModuleMap = new Map();
67
+ this.dependencyIssuerMap = new Map();
68
+ this.resourceIssuerMap = new Map();
69
+ this.storeMapEntryInValueSet = (map, key, values) => {
70
+ if (!map.has(key)) {
71
+ map.set(key, new Set());
72
+ }
73
+ const iterable = Array.isArray(values) || values instanceof Set ? values : [values];
74
+ for (const value of iterable) {
75
+ map.get(key).add(value);
76
+ }
77
+ };
78
+ (0, assert_1.default)(options.pluginKey, `Option [String] "pluginKey" not specified. You must specify a valid fully qualified plugin key. e.g.: com.atlassian.jira.plugins.my-jira-plugin`);
79
+ (0, assert_1.default)(options.xmlDescriptors, `Option [String] "xmlDescriptors" not specified. You must specify the path to the directory where this plugin stores the descriptors about this plugin, used by the WRM to load your frontend code. This should point somewhere in the "target/classes" directory.`);
80
+ (0, assert_1.default)(path_1.default.isAbsolute(options.xmlDescriptors), `Option [String] "xmlDescriptors" must be absolute!`);
81
+ // pull out our options
82
+ this.options = Object.assign({
83
+ addAsyncNameAsContext: false,
84
+ addEntrypointNameAsContext: false,
85
+ noWRM: false,
86
+ useDocumentWriteInWatchMode: false,
87
+ verbose: false,
88
+ watch: false,
89
+ watchPrepare: false,
90
+ conditionMap: new Map(),
91
+ contextMap: new Map(),
92
+ dataProvidersMap: new Map(),
93
+ deprecatedEntrypoints: new Map(),
94
+ providedDependencies: new Map(),
95
+ webresourceKeyMap: new Map(),
96
+ resourceParamMap: defaultResourceParams,
97
+ transformationMap: defaultTransformations,
98
+ devAssetsHash: DEFAULT_DEV_ASSETS_HASH,
99
+ locationPrefix: '',
100
+ }, options);
101
+ (0, logger_1.setVerbose)(this.options.verbose);
102
+ this.options.locationPrefix = (0, options_parser_1.extractPathPrefixForXml)(this.options.locationPrefix);
103
+ // convert various maybe-objects to maps
104
+ this.options.conditionMap = (0, options_parser_1.toMap)(this.options.conditionMap);
105
+ this.options.contextMap = (0, options_parser_1.toMap)(this.options.contextMap);
106
+ this.options.webresourceKeyMap = (0, options_parser_1.toMap)(this.options.webresourceKeyMap);
107
+ // make sure various maps contain only unique items
108
+ this.options.resourceParamMap = this.ensureResourceParamsAreUnique((0, options_parser_1.toMap)(this.options.resourceParamMap));
109
+ this.options.transformationMap = this.ensureTransformationsAreUnique((0, options_parser_1.toMap)(this.options.transformationMap));
110
+ this.options.providedDependencies = this.ensureProvidedDependenciesAreUnique((0, options_parser_1.toMap)(this.options.providedDependencies));
111
+ this.options.dataProvidersMap = this.ensureDataProvidersMapIsValid((0, options_parser_1.toMap)(this.options.dataProvidersMap));
112
+ this.options.deprecatedEntrypoints = (0, options_parser_1.toMap)(this.options.deprecatedEntrypoints);
113
+ this.getAssetsUUID = (0, once_1.default)(this.getAssetsUUID.bind(this));
114
+ }
115
+ /**
116
+ * Generate an asset uuid per build - this is used to ensure we have a new "cache" for our assets per build.
117
+ * As JIRA-Server does not "rebuild" too often, this can be considered reasonable.
118
+ */
119
+ getAssetsUUID(isProduction) {
120
+ return isProduction ? (0, uuid_1.v4)() : this.options.devAssetsHash;
121
+ }
122
+ ensureTransformationsAreUnique(transformations) {
123
+ transformations.forEach((val, key, map) => {
124
+ const values = [].concat(val).filter(Boolean);
125
+ map.set(key, (0, uniq_1.default)(values));
126
+ });
127
+ return transformations;
128
+ }
129
+ ensureResourceParamsAreUnique(params) {
130
+ params.forEach((val, key, map) => {
131
+ const values = [].concat(val).filter(Boolean);
132
+ map.set(key, (0, unionBy_1.default)(values.reverse(), 'name').reverse());
133
+ });
134
+ return params;
135
+ }
136
+ ensureProvidedDependenciesAreUnique(providedDependencies) {
137
+ const result = new Map(provided_dependencies_1.builtInProvidedDependencies);
138
+ for (const [name, providedDependency] of providedDependencies) {
139
+ if (result.has(name)) {
140
+ continue;
141
+ }
142
+ result.set(name, providedDependency);
143
+ }
144
+ (0, logger_1.log)('Using provided dependencies', Array.from(result));
145
+ return result;
146
+ }
147
+ // eslint-disable-next-line sonarjs/cognitive-complexity
148
+ ensureDataProvidersMapIsValid(dataProvidersMap) {
149
+ const map = new Map();
150
+ const requiredKeys = ['key', 'class'];
151
+ for (const [entryPoint, dataProviders] of dataProvidersMap) {
152
+ if (!Array.isArray(dataProviders)) {
153
+ (0, logger_1.error)(`The value of data providers for "${entryPoint}" entry point should be an array of data providers.`, {
154
+ entryPoint,
155
+ dataProviders,
156
+ });
157
+ continue;
158
+ }
159
+ const validDataProviders = [];
160
+ for (const dataProvider of dataProviders) {
161
+ const keys = (0, isObject_1.default)(dataProvider) ? Object.keys(dataProvider) : [];
162
+ const isValidShape = requiredKeys.every((key) => keys.includes(key));
163
+ if (!isValidShape) {
164
+ (0, logger_1.error)(`The data provider shape for "${entryPoint}" entry point doesn't include required keys: ${requiredKeys.concat(', ')}.`, { entryPoint, dataProvider });
165
+ continue;
166
+ }
167
+ const { key, class: providerClass } = dataProvider;
168
+ if (!key || !providerClass) {
169
+ (0, logger_1.error)(`The data provider shape for "${entryPoint}" entry point contains missing or empty values.`, {
170
+ entryPoint,
171
+ key,
172
+ class: providerClass,
173
+ });
174
+ continue;
175
+ }
176
+ validDataProviders.push({
177
+ key,
178
+ class: providerClass,
179
+ });
180
+ }
181
+ if (validDataProviders.length) {
182
+ map.set(entryPoint, validDataProviders);
183
+ }
184
+ }
185
+ return map;
186
+ }
187
+ checkConfig(compiler) {
188
+ const ensureJsonPFunction = () => {
189
+ const outputOptions = compiler.options.output;
190
+ // @ts-expect-error TODO: Check if this is still valid with Webpack 5 as types suggest otherwise
191
+ const { jsonpFunction } = outputOptions;
192
+ if (!jsonpFunction || jsonpFunction === 'webpackJsonp') {
193
+ const generatedJsonpFunction = `atlassianWebpackJsonp${(0, crypto_1.createHash)('md5')
194
+ .update(this.options.pluginKey, 'utf8')
195
+ .digest('hex')}`;
196
+ (0, logger_1.warn)(`
197
+ *********************************************************************************
198
+ The output.jsonpFunction is not specified. This needs to be done to prevent clashes.
199
+ An automated jsonpFunction name for this plugin was created:
200
+
201
+ "${generatedJsonpFunction}"
202
+ *********************************************************************************
203
+
204
+ `);
205
+ // @ts-expect-error TODO: Check if this is still valid with Webpack 5 as types suggest otherwise
206
+ outputOptions.jsonpFunction = generatedJsonpFunction;
207
+ }
208
+ };
209
+ const ensureDevToolsAreDisabledForPrepare = () => {
210
+ const devToolOption = compiler.options.devtool;
211
+ if (this.options.watchPrepare && devToolOption) {
212
+ (0, logger_1.error)(`Having "devtool" option set to anything but "false" during the "watch-prepare" is invalid. It was set to: "${devToolOption}".`);
213
+ compiler.options.devtool = false;
214
+ // report issue to webpack
215
+ compiler.hooks.thisCompilation.tap('WarnNoDevToolInWatchPrepare', (compilation) => {
216
+ compilation.warnings.push(
217
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
218
+ new (require('webpack/lib/WebpackError'))(`Having "devtool" option set to anything but "false" during the "watch-prepare" is invalid. It was set to: "${devToolOption}".`));
219
+ });
220
+ }
221
+ };
222
+ const ensureOutputPath = () => {
223
+ const outputPath = compiler.options.output.path;
224
+ if (!outputPath) {
225
+ throw new Error(`No "output.path" specified in your webpack configuration. This is required! Stopping.`);
226
+ }
227
+ };
228
+ const ensurePackageName = () => {
229
+ if (!this.options.packageName) {
230
+ let packageName;
231
+ // Find package closest to context
232
+ let directory = compiler.context;
233
+ while (directory !== path_1.default.parse(directory).root) {
234
+ const packageJsonPath = path_1.default.join(directory, 'package.json');
235
+ if ((0, fs_1.existsSync)(packageJsonPath)) {
236
+ const packageJson = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, 'utf8'));
237
+ packageName = packageJson.name;
238
+ break;
239
+ }
240
+ directory = path_1.default.dirname(directory);
241
+ }
242
+ if (!packageName) {
243
+ throw new Error(`WrmPlugin expects Webpack context to be NPM package. Current context ${compiler.context} is not an NPM package.`);
244
+ }
245
+ this.options.packageName = packageName;
246
+ }
247
+ };
248
+ const ensureMiniCssExtractPluginHasDisabledRuntime = () => {
249
+ const plugins = compiler.options.plugins;
250
+ const miniCssExtractPlugin = plugins.find(
251
+ // we don't want to lock this check to a specific MiniCssExtractPlugin version
252
+ // so we can't use instanceof
253
+ (plugin) => plugin && plugin.constructor?.name === 'MiniCssExtractPlugin');
254
+ if (miniCssExtractPlugin && 'options' in miniCssExtractPlugin && miniCssExtractPlugin.options.runtime !== false) {
255
+ (0, logger_1.warn)(`
256
+ *********************************************************************************
257
+ MiniCssExtractPlugin runtime option needs to be disabled so that it doesn't
258
+ interfere with Web Resource Manager runtime.
259
+ *********************************************************************************
260
+
261
+ `);
262
+ // report issue to webpack
263
+ compiler.hooks.thisCompilation.tap('WarnMiniCssExtractPluginRuntimeEnabled', (compilation) => {
264
+ compilation.warnings.push(
265
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
266
+ new (require('webpack/lib/WebpackError'))(`MiniCssExtractPlugin runtime option needs to be disabled so that it doesn't interfere with Web Resource Manager runtime.`));
267
+ });
268
+ }
269
+ };
270
+ const ensureProvidedDependenciesInExternals = () => {
271
+ const providedDependenciesAsExternals = {};
272
+ for (const [key, value] of this.options.providedDependencies.entries()) {
273
+ providedDependenciesAsExternals[key] = value.import;
274
+ }
275
+ const externals = compiler.options.externals;
276
+ if (!externals) {
277
+ compiler.options.externals = providedDependenciesAsExternals;
278
+ return;
279
+ }
280
+ if (Array.isArray(externals)) {
281
+ compiler.options.externals = [...externals, providedDependenciesAsExternals];
282
+ return;
283
+ }
284
+ compiler.options.externals = [externals, providedDependenciesAsExternals];
285
+ };
286
+ compiler.hooks.afterEnvironment.tap('Check Config', () => {
287
+ ensureJsonPFunction();
288
+ ensureDevToolsAreDisabledForPrepare();
289
+ ensureOutputPath();
290
+ ensurePackageName();
291
+ ensureMiniCssExtractPluginHasDisabledRuntime();
292
+ ensureProvidedDependenciesInExternals();
293
+ });
294
+ }
295
+ overwritePublicPath(compiler) {
296
+ const isProductionMode = (0, WebpackHelpers_1.isRunningInProductionMode)(compiler);
297
+ const uuid = this.getAssetsUUID(isProductionMode);
298
+ const assetWebresource = `${this.options.pluginKey}:assets-${uuid}`;
299
+ const publicPathModule = new webpack_1.RuntimeModule('public_path');
300
+ publicPathModule.generate = () => {
301
+ // Ensure the `AJS.contextPath` function is available at runtime.
302
+ (0, base_dependencies_1.addBaseDependency)('com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path');
303
+ return `
304
+ if (typeof AJS !== "undefined") {
305
+ __webpack_require__.p = AJS.contextPath() + "/s/${uuid}/_/download/resources/${assetWebresource}/";
306
+ }
307
+ `;
308
+ };
309
+ compiler.hooks.compilation.tap('OverwritePublicPath Compilation', (compilation) => {
310
+ compilation.hooks.additionalTreeRuntimeRequirements.tap('OverwritePublicPath AdditionalTreeRuntimeRequirements', (chunk) => {
311
+ compilation.addRuntimeModule(chunk, publicPathModule);
312
+ });
313
+ });
314
+ }
315
+ storeModuleDependency(moduleKey, fileDependencies, dependencyRequest) {
316
+ // get globally available libraries through wrm
317
+ if (this.options.providedDependencies.has(dependencyRequest)) {
318
+ (0, logger_1.log)('plugging hole into request to %s, will be provided as a dependency through WRM', dependencyRequest);
319
+ const providedDependency = this.options.providedDependencies.get(dependencyRequest).dependency;
320
+ this.storeMapEntryInValueSet(this.dependencyModuleMap, moduleKey, providedDependency);
321
+ }
322
+ [...fileDependencies.keys()].forEach((fileDependency) => {
323
+ if (this.dependencyIssuerMap.has(fileDependency)) {
324
+ const dependencyRequests = this.dependencyIssuerMap.get(fileDependency);
325
+ this.storeMapEntryInValueSet(this.dependencyModuleMap, moduleKey, dependencyRequests);
326
+ }
327
+ if (this.resourceIssuerMap.has(fileDependency)) {
328
+ const resourceRequests = this.resourceIssuerMap.get(fileDependency);
329
+ this.storeMapEntryInValueSet(this.resourceModuleMap, moduleKey, resourceRequests);
330
+ }
331
+ });
332
+ }
333
+ hookUpModuleDependencies(compiler) {
334
+ compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
335
+ compilation.hooks.finishModules.tap('MyPlugin', (modules) => {
336
+ for (const module of modules) {
337
+ const moduleKey = module.identifier();
338
+ const moduleResource = module.resource;
339
+ const moduleFileDeps = module.buildInfo?.fileDependencies ||
340
+ new Set(moduleResource ? [moduleResource] : []);
341
+ for (const dep of module.dependencies) {
342
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
343
+ const dependencyRequest = dep.request;
344
+ if (dependencyRequest) {
345
+ this.storeModuleDependency(moduleKey, moduleFileDeps, dependencyRequest);
346
+ }
347
+ }
348
+ }
349
+ });
350
+ });
351
+ }
352
+ injectWRMSpecificRequestTypes(compiler) {
353
+ compiler.hooks.compilation.tap('MyPlugin', (_compilation, { normalModuleFactory }) => {
354
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
355
+ // @ts-ignore: rspack expects false or void and but eslint wants all branches to return a value
356
+ normalModuleFactory.hooks.beforeResolve.tap('MyPlugin', (resolveData) => {
357
+ // handle custom imports for resources and dependencies
358
+ const issuerKey = resolveData.contextInfo.issuer;
359
+ const request = resolveData.request;
360
+ if (request.startsWith('wr-dependency!')) {
361
+ (0, logger_1.log)('adding %s as a web-resource dependency through WRM', request);
362
+ const pluginKey = this.options.pluginKey;
363
+ const dependency = resolveData.request.slice('wr-dependency!'.length);
364
+ const dependencyKey = dependency.includes(':') ? dependency : `${pluginKey}:${dependency}`;
365
+ this.storeMapEntryInValueSet(this.dependencyIssuerMap, issuerKey, dependencyKey);
366
+ return false;
367
+ }
368
+ if (request.startsWith('wr-resource!')) {
369
+ (0, logger_1.log)('adding %s as a resource through WRM', request);
370
+ const requestContext = resolveData.context;
371
+ const rootContext = compiler.options.context;
372
+ const resource = resolveData.request.slice('wr-resource!'.length);
373
+ const parts = resource.split('!');
374
+ const name = parts[0];
375
+ let location = parts[1] || name;
376
+ if (location.startsWith('./') || location.startsWith('../')) {
377
+ const fullResourcePath = path_1.default.join(requestContext, location);
378
+ location = path_1.default.relative(rootContext, fullResourcePath);
379
+ }
380
+ this.storeMapEntryInValueSet(this.resourceIssuerMap, issuerKey, {
381
+ name,
382
+ location: location || name,
383
+ });
384
+ return false;
385
+ }
386
+ });
387
+ });
388
+ }
389
+ /**
390
+ * Ensure the WRM.require function is available at runtime and is used to load any code-split chunks.
391
+ */
392
+ enableAsyncLoadingWithWRM(compiler) {
393
+ compiler.hooks.compilation.tap('enable async loading with wrm - compilation', (compilation) => {
394
+ const hook = (0, isRspackCompiler_1.isRspackCompiler)(compiler)
395
+ ? compiler.rspack.RuntimePlugin.getCompilationHooks(compilation).createScript
396
+ : webpack_1.runtime.LoadScriptRuntimeModule.getCompilationHooks(compilation).createScript;
397
+ hook.tap('enable async loading with wrm - jsonp-script', (source, chunk) => {
398
+ // TODO: understand how to set this data on chunk "properly" so that
399
+ // our normalModuleFactory hook will pick it up and generate this dep for us.
400
+ // @ts-expect-error We know we shouldn't set a random attribute...
401
+ chunk.needsWrmRequire = true;
402
+ // Add the WRM async loader in to webpack's loader function.
403
+ return (0, runtime_load_shim_1.default)(this.options.pluginKey, this.options.watch, compiler.options.output.publicPath);
404
+ });
405
+ });
406
+ }
407
+ shouldOverwritePublicPath() {
408
+ if (this.options.watch) {
409
+ return false;
410
+ }
411
+ if (this.options.noWRM) {
412
+ return false;
413
+ }
414
+ return true;
415
+ }
416
+ shouldEnableAsyncLoadingWithWRM() {
417
+ return !this.options.noWRM;
418
+ }
419
+ // eslint-disable-next-line sonarjs/cognitive-complexity
420
+ apply(compiler) {
421
+ // ensure settings make sense
422
+ this.checkConfig(compiler);
423
+ // hook up external dependencies
424
+ this.hookUpModuleDependencies(compiler);
425
+ // allow `wr-dependency/wr-resource` require calls.
426
+ this.injectWRMSpecificRequestTypes(compiler);
427
+ if (this.shouldOverwritePublicPath()) {
428
+ this.overwritePublicPath(compiler);
429
+ }
430
+ if (this.shouldEnableAsyncLoadingWithWRM()) {
431
+ this.enableAsyncLoadingWithWRM(compiler);
432
+ }
433
+ const outputPath = compiler.options.output.path;
434
+ const isProductionMode = (0, WebpackHelpers_1.isRunningInProductionMode)(compiler);
435
+ const assetsUUID = this.getAssetsUUID(isProductionMode);
436
+ const assetNames = new Map();
437
+ // Generate a 1:1 mapping from original filenames to compiled filenames
438
+ compiler.hooks.compilation.tap('wrm plugin setup phase', (compilation) => {
439
+ const moduleLoader = (0, isRspackCompiler_1.isRspackCompiler)(compiler)
440
+ ? compiler.rspack.NormalModule.getCompilationHooks(compilation).loader
441
+ : // eslint-disable-next-line @typescript-eslint/no-var-requires
442
+ require('webpack/lib/NormalModule').getCompilationHooks(compilation).loader;
443
+ moduleLoader.tap('wrm plugin - normal module', (loaderContext, module) => {
444
+ const { emitFile } = loaderContext;
445
+ loaderContext.emitFile = (name, content, sourceMap) => {
446
+ const originalName = module.userRequest;
447
+ assetNames.set(originalName, name);
448
+ return emitFile.call(module, name, content, sourceMap);
449
+ };
450
+ });
451
+ });
452
+ const appResourcesFactory = new AppResourcesFactory_1.default({
453
+ assetsUUID,
454
+ assetNames,
455
+ options: this.options,
456
+ dependencyModuleMap: this.dependencyModuleMap,
457
+ resourceModuleMap: this.resourceModuleMap,
458
+ });
459
+ /**
460
+ * Given a completed compilation, determine where each file generated
461
+ * by webpack should be referenced in a web-resource.
462
+ *
463
+ * @param compilation the finalised compilation for the build
464
+ * @returns a list of {@see ChunkResourceDescriptor} objects which describe a web-resource bundle
465
+ */
466
+ const getWebResourceDescriptors = (compilation) => {
467
+ const appResourceGenerator = appResourcesFactory.build(compiler, compilation);
468
+ return appResourceGenerator.getResourceDescriptors();
469
+ };
470
+ /**
471
+ * Given a list of web-resource descriptors, write their definitions
472
+ * to XML, ready for the WRM to pick them up at product runtime.
473
+ *
474
+ * @param descriptors the list of web-resources to write definitions for
475
+ */
476
+ const generateWebResourceXmlReport = (descriptors) => {
477
+ const webResources = descriptors.map((descriptor) => (0, web_resource_generator_1.renderWebResource)(descriptor, descriptors, this.options));
478
+ const xmlDescriptorsFilepath = this.options.xmlDescriptors;
479
+ const xmlDescriptors = pretty_data_1.pd.xml(`<bundles>${webResources.join('')}</bundles>`);
480
+ (0, file_system_1.writeFileSync)(xmlDescriptorsFilepath, xmlDescriptors);
481
+ };
482
+ /**
483
+ * Given a list of web-resource descriptors, identify JS assets and list them in
484
+ * association report.
485
+ */
486
+ const generateAssociationReport = (buildOutputPath, descriptors) => {
487
+ const files = [...new Set(descriptors.map((descriptor) => descriptor.resources).flat()).values()];
488
+ const output = {
489
+ packageName: this.options.packageName,
490
+ outputDirectoryFiles: files,
491
+ };
492
+ const jsonOutput = JSON.stringify(output, null, 2);
493
+ const fullOutputPath = path_1.default.join(buildOutputPath, ASSOCIATIONS_PATH_IN_BUNDLE, `${this.options.pluginKey}-webpack.intermediary.json`);
494
+ (0, file_system_1.writeFileSync)(fullOutputPath, jsonOutput);
495
+ };
496
+ /**
497
+ * Given a list of web-resource descriptors, for each that
498
+ * references javascript files, overwrite them with new files that
499
+ * will request content from the webpack-dev-server after the WRM
500
+ * loads them at product runtime.
501
+ *
502
+ * @param descriptors the list of web-resources to scan and find
503
+ * javascript files within
504
+ */
505
+ const generateHotModuleRedirectFiles = (descriptors) => {
506
+ const redirectDescriptors = (0, flatMap_1.default)(descriptors, (c) => c.resources)
507
+ .filter((res) => path_1.default.extname(res) === '.js')
508
+ .map((r) => ({ fileName: r, writePath: path_1.default.join(outputPath, r) }));
509
+ const overwriteFiles = () => {
510
+ const generateAssetCall = (fileName) => {
511
+ // TODO: should we just pretend `publicPath` is a string here?
512
+ const pathName = (0, url_join_1.default)(compiler.options.output.publicPath, fileName);
513
+ const appendScript = `
514
+ var script = document.createElement('script');
515
+ script.src = '${pathName}';
516
+ script.async = false;
517
+ script.crossOrigin = 'anonymous';
518
+ document.head.appendChild(script);`.trim();
519
+ if (this.options.useDocumentWriteInWatchMode) {
520
+ return `
521
+ !function(){
522
+ if (document.readyState === "loading" && 'initiallyRendered' in document.currentScript.dataset) {
523
+ document.write('<script src="${pathName}"></script>')
524
+ } else {
525
+ ${appendScript}
526
+ }
527
+ }();
528
+ `;
529
+ }
530
+ return `!function() { ${appendScript} }();`;
531
+ };
532
+ for (const { fileName, writePath } of redirectDescriptors) {
533
+ (0, file_system_1.writeFileSync)(writePath, generateAssetCall(fileName));
534
+ }
535
+ };
536
+ compiler.hooks.afterDone.tap('wrm plugin - add watch mode modules', overwriteFiles);
537
+ };
538
+ /**
539
+ * After the compilation is complete, we analyse the result to produce our descriptors,
540
+ * which we then use to generate various metadata files in the build output.
541
+ */
542
+ (0, WebpackRuntimeHelpers_1.hookIntoCompileDoneToGenerateReports)('wrm plugin - generate descriptors', compiler, (compilation, cb) => {
543
+ const descriptors = getWebResourceDescriptors(compilation);
544
+ // write the xml for web-resource module descriptors
545
+ generateWebResourceXmlReport(descriptors);
546
+ // generate association report in case packageName is provided
547
+ if (this.options.packageName) {
548
+ generateAssociationReport(compiler.outputPath, descriptors);
549
+ }
550
+ // write javascript files to enable hot-reloading at dev time
551
+ if (this.options.watch && this.options.watchPrepare) {
552
+ generateHotModuleRedirectFiles(descriptors);
553
+ }
554
+ cb();
555
+ });
556
+ // Enable manifest output if provided
557
+ if (this.options.wrmManifestPath) {
558
+ const filename = path_1.default.isAbsolute(this.options.wrmManifestPath)
559
+ ? this.options.wrmManifestPath
560
+ : path_1.default.resolve(path_1.default.join(outputPath, this.options.wrmManifestPath));
561
+ new WrmManifestPlugin_1.default(appResourcesFactory, filename, this.options.pluginKey).apply(compiler);
562
+ }
563
+ }
564
+ }
565
+ module.exports = WrmPlugin;
566
+ //# sourceMappingURL=WrmPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WrmPlugin.js","sourceRoot":"","sources":["../src/WrmPlugin.ts"],"names":[],"mappings":";;;;AACA,oDAA4B;AAC5B,mCAAoC;AACpC,2BAA8C;AAC9C,6DAAqC;AACrC,+DAAuC;AACvC,uDAA+B;AAC/B,6DAAqC;AACrC,uDAA+B;AAC/B,gDAAwB;AACxB,6CAA+C;AAC/C,wDAA+B;AAC/B,+BAAuC;AAEvC,qCAAiD;AAEjD,gFAAwD;AACxD,gEAA6D;AAC7D,wEAA2E;AAC3E,uDAAsD;AACtD,iEAA8D;AAC9D,6DAA0E;AAC1E,6EAAqE;AACrE,qCAAwD;AACxD,kFAAwD;AAcxD,qDAA6D;AAC7D,mEAA+E;AAC/E,4EAAoD;AAEpD,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE;IACjD;QACE,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,eAAe;KACvB;CACF,CAAC,CAAC;AAEH,MAA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C,EAAE,cAAc,CAAC,CAAC;QACtF,CAAC,CAAC;QAEF;;;WAGG;QACH,IAAA,4DAAoC,EAAC,mCAAmC,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE;YACtG,MAAM,WAAW,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;YAE3D,oDAAoD;YACpD,4BAA4B,CAAC,WAAW,CAAC,CAAC;YAE1C,8DAA8D;YAC9D,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC7B,yBAAyB,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;YAC9D,CAAC;YAED,6DAA6D;YAC7D,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBACpD,8BAA8B,CAAC,WAAW,CAAC,CAAC;YAC9C,CAAC;YAED,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,qCAAqC;QACrC,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,cAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;gBAC5D,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe;gBAC9B,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;YACtE,IAAI,2BAAiB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;CACF;AAED,iBAAS,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @fileOverview
3
+ * Collects a set of web-resource dependencies that should be added
4
+ * to all the web-resources generated during compilation.
5
+ */
6
+ export declare const getBaseDependencies: () => string[];
7
+ export declare const setBaseDependencies: (dependencies: string[] | string | undefined) => void;
8
+ export declare const addBaseDependency: (dependency: string) => void;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * @fileOverview
4
+ * Collects a set of web-resource dependencies that should be added
5
+ * to all the web-resources generated during compilation.
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.addBaseDependency = exports.setBaseDependencies = exports.getBaseDependencies = void 0;
12
+ const uniq_1 = __importDefault(require("lodash/uniq"));
13
+ const CROSS_PLATFORM_BASE_DEPS = [];
14
+ const processStrings = (arr) => {
15
+ return (0, uniq_1.default)([...CROSS_PLATFORM_BASE_DEPS, ...arr].filter(Boolean));
16
+ };
17
+ let configuredContexts = [];
18
+ const getBaseDependencies = () => {
19
+ // defensively cloning so consumers can't accidentally add anything
20
+ return [...configuredContexts];
21
+ };
22
+ exports.getBaseDependencies = getBaseDependencies;
23
+ const setBaseDependencies = (dependencies) => {
24
+ const contexts = [];
25
+ if (Array.isArray(dependencies)) {
26
+ contexts.push(...dependencies);
27
+ }
28
+ else if (typeof dependencies === 'string') {
29
+ contexts.push(dependencies);
30
+ }
31
+ configuredContexts = processStrings(contexts);
32
+ };
33
+ exports.setBaseDependencies = setBaseDependencies;
34
+ const addBaseDependency = (dependency) => {
35
+ configuredContexts = processStrings([...configuredContexts, dependency]);
36
+ };
37
+ exports.addBaseDependency = addBaseDependency;
38
+ //# sourceMappingURL=base-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-dependencies.js","sourceRoot":"","sources":["../../src/deps/base-dependencies.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,uDAA+B;AAE/B,MAAM,wBAAwB,GAAa,EAAE,CAAC;AAE9C,MAAM,cAAc,GAAG,CAAC,GAAa,EAAE,EAAE;IACvC,OAAO,IAAA,cAAI,EAAC,CAAC,GAAG,wBAAwB,EAAE,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,IAAI,kBAAkB,GAAa,EAAE,CAAC;AAE/B,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,mEAAmE;IACnE,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAAC;AACjC,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEK,MAAM,mBAAmB,GAAG,CAAC,YAA2C,EAAE,EAAE;IACjF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC5C,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9B,CAAC;IAED,kBAAkB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAChD,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B;AAEK,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,EAAE;IACtD,kBAAkB,GAAG,cAAc,CAAC,CAAC,GAAG,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B"}