@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,62 @@
1
+ "use strict";
2
+ /**
3
+ Method signature is:
4
+ ```
5
+ var inProgress[url] = [done];
6
+ var dataWebpackPrefix = "...";
7
+ // loadScript function to load a script via script tag
8
+ __webpack_require__.l = (url, done, key) => {
9
+ ```
10
+ The variables are:
11
+ 'done' - callback function
12
+ 'key' - should be in the form "chunk-" + chunkId
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const runtimeLoadShim = (pluginKey, watchMode, publicPath) => {
16
+ const watchModeShim = watchMode
17
+ ? `
18
+ function waitForScriptsLoaded(done) {
19
+ // scripts that are showing up in the performance stats are already loaded, not including scripts in the dom that still load
20
+ const loadedScriptsSrc = performance.getEntriesByType('resource')
21
+ .filter(r => r.initiatorType === 'script' && r.name.startsWith('${publicPath}'))
22
+ .map(r => r.name);
23
+ const domScripts = Array.from(document.querySelectorAll('script')).filter(s => s.src.startsWith('${publicPath}'));
24
+ const deltaScripts = domScripts.filter(s => !loadedScriptsSrc.includes(s.src));
25
+ const promises = deltaScripts.map(deltaScript => {
26
+ return new Promise(res => {
27
+ deltaScript.addEventListener('load', res);
28
+ deltaScript.addEventListener('error', res);
29
+ deltaScript.addEventListener('abort', res);
30
+ });
31
+ });
32
+ Promise.all(promises).then(done);
33
+ }
34
+ `
35
+ : '';
36
+ return `
37
+ // the raw chunkId is used as a web-resource key.
38
+ // webpack5's jsonp loader will call the load function with a prefixed chunkId.
39
+ // see https://github.com/webpack/webpack/blob/master/lib/web/JsonpChunkLoadingRuntimeModule.js#L181
40
+ const chunkId = (key || '').replace(/^chunk-/,'');
41
+ // use WRM.require instead of webpack's url-based lookup.
42
+ // since WRM.require can handle in-progress loads itself, we don't need to worry about
43
+ // registering the 'done' callback in the inProgress array; we just call it after WRM does its thing.
44
+ // ------
45
+ // WATCHMODE - In watch mode a batch file is loaded that contains a script that loads the actual contents from a webpack dev server.
46
+ // This means we cant execute the "done" callback for webpack before the second script is loaded.
47
+ // The solution is to check for all scripts to the dev-server in "performance" as this will only contain already fully loaded scripts and
48
+ // calculate the diff to all scripts in the body. Any script that is not showing up in "performance" will be listened to for a load event.
49
+ // Only once all those load events are successfully returned do we call the "done" callback to webpack and prevent a range of errors that
50
+ // would be triggered otherwise.
51
+ ${watchModeShim}
52
+ WRM.require('wrc!${pluginKey}:' + chunkId).then(() => ${watchMode ? 'waitForScriptsLoaded(done)' : 'done()'}, (data) => {
53
+ var e = new Event('missing');
54
+ e.data = data;
55
+ done(e);
56
+ });
57
+ // we don't want the rest of the normal load function to run.
58
+ return;
59
+ `;
60
+ };
61
+ exports.default = runtimeLoadShim;
62
+ //# sourceMappingURL=runtime-load-shim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-load-shim.js","sourceRoot":"","sources":["../../src/shims/runtime-load-shim.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAEH,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,SAAkB,EAAE,UAAkB,EAAE,EAAE;IACpF,MAAM,aAAa,GAAG,SAAS;QAC7B,CAAC,CAAC;;;;wEAIkE,UAAU;;sGAEoB,UAAU;;;;;;;;;;;CAW/G;QACG,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;;;;;;;;;;;EAeP,aAAa;mBACI,SAAS,4BACxB,SAAS,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,QAC7C;;;;;;;CAOD,CAAC;AACF,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Compilation, Compiler } from 'webpack';
2
+ import type { ArrayBaseType } from './types';
3
+ export type Entrypoint = Compilation['entrypoints'] extends Map<string, infer U> ? U : never;
4
+ export type PathData = Parameters<Compilation['getAssetPath']>[1];
5
+ type NormalModuleFactory = Parameters<Parameters<InstanceType<typeof Compiler>['hooks']['normalModuleFactory']['tap']>[1]>[0];
6
+ type FactorizeHandlerParameters = Parameters<Parameters<NormalModuleFactory['hooks']['factorize']['tapAsync']>[1]>;
7
+ type FactorizeHandlerCallback = FactorizeHandlerParameters[1];
8
+ type ResolveData = FactorizeHandlerParameters[0];
9
+ export type ResolveDataHandler = (data: ResolveData, cb: FactorizeHandlerCallback) => void;
10
+ export type FactoryHandler = (fn: ResolveDataHandler) => ResolveDataHandler;
11
+ export type ChunkGroup = ArrayBaseType<Compilation['chunkGroups']>;
12
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=extracted-webpack-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extracted-webpack-types.js","sourceRoot":"","sources":["../../src/types/extracted-webpack-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,132 @@
1
+ export type ArrayBaseType<T> = T extends Array<infer U> ? U : never;
2
+ export type Callable = (...args: any[]) => any;
3
+ export type ObjectOrMap = Record<string, unknown> | Map<string, unknown>;
4
+ export type ConditionParam = {
5
+ attributes?: {
6
+ [key: string]: string;
7
+ };
8
+ value?: string;
9
+ };
10
+ export type ConditionClass = {
11
+ class: string;
12
+ invert?: boolean;
13
+ params?: ConditionParam[];
14
+ };
15
+ export type Conditions = {
16
+ type: string;
17
+ conditions: Array<Conditions | ConditionClass>;
18
+ };
19
+ export type Condition = Conditions | ConditionClass | Array<Conditions | Condition>;
20
+ export type DeprecationInfo = {
21
+ sinceVersion?: string;
22
+ removeInVersion?: string;
23
+ alternative?: string;
24
+ extraInfo?: string;
25
+ } | true;
26
+ export type ProvidedDependency = {
27
+ dependency: string;
28
+ import: {
29
+ var: string;
30
+ amd?: string;
31
+ } | string;
32
+ };
33
+ export type DataProvider = {
34
+ key: string;
35
+ class: string;
36
+ };
37
+ export type ResourceParam = {
38
+ name: string;
39
+ value: string;
40
+ };
41
+ export type WebresourceObject = {
42
+ key?: string;
43
+ name?: string;
44
+ state?: string | boolean;
45
+ };
46
+ export type WebresourceType = string | WebresourceObject;
47
+ type MapOrObject<T> = Map<string, T> | {
48
+ [key: string]: T;
49
+ };
50
+ export type ContextMap = Map<string, string[]>;
51
+ export type TransformationMap = Map<string, string[]>;
52
+ export type ProvidedDependenciesMap = Map<string, ProvidedDependency>;
53
+ export type ConditionsMap = Map<string, Condition>;
54
+ export type DataProvidersMap = Map<string, DataProvider[]>;
55
+ export type DeprecationMap = Map<string, DeprecationInfo>;
56
+ export type ResourceParamMap = Map<string, ResourceParam[]>;
57
+ export type WebresourceMap = Map<string, WebresourceType>;
58
+ export type Options = {
59
+ /** @property pluginKey - The fully qualified plugin key. e.g.: com.atlassian.jira.plugins.my-jira-plugin */
60
+ pluginKey: string;
61
+ /** @property xmlDescriptors - Path to the directory where this plugin stores the descriptors about this plugin, used by the WRM to load your frontend code. */
62
+ xmlDescriptors: string;
63
+ /** @property packageName - Name of frontend package to associate all output JS files with. */
64
+ packageName?: string;
65
+ /** @property devAssetsHash - Custom hash used in development environment resources name. */
66
+ devAssetsHash?: string;
67
+ /** @property locationPrefix - Specify the sub-directory for all web-resource location values. */
68
+ locationPrefix?: string;
69
+ /** @property wrmManifestPath - Path to the WRM manifest file where this plugin stores the mapping of modules to generated web-resources. e.g.: `{"my-entry": "com.example.app:entrypoint-my-entry"}`. Useful if you set { output: { library, libraryTarget } } in your webpack config, to use your build result as provided dependencies for other builds. */
70
+ wrmManifestPath?: string;
71
+ /** @property singleRuntimeWebResourceKey - Ensure all web-resources depend on a single runtime shared amongst them */
72
+ singleRuntimeWebResourceKey?: string;
73
+ /** @property conditionMap - Conditions to be applied to the specified entry-point */
74
+ conditionMap?: MapOrObject<Condition>;
75
+ /** @property contextMap - One or more "context"s to which an entrypoint will be added. e.g.: `{"my-entry": ["my-plugin-context", "another-context"]}` */
76
+ contextMap?: MapOrObject<string[]>;
77
+ /** @property dataProvidersMap - A list of data providers that will be added to the entry point e.g.: `{"my-entry": [{ key: "data-provider-key", class: "my.data.provider.JavaClass" }]}` */
78
+ dataProvidersMap?: MapOrObject<DataProvider[]>;
79
+ /** @property deprecatedEntrypoints - Map of entrypoints that are deprecated to more detailed information about the deprecation including the affected versions, alternatives and reason. e.g.: `{"outdated-entrypoint": { sinceVersion: "2.0.0", removeInVersion: "3.0.0", alternative: "rewritten-endpoint", extraInfo: "outdated-endpoint does not support dark mode" }}` */
80
+ deprecatedEntrypoints?: MapOrObject<DeprecationInfo>;
81
+ /** @property providedDependencies - Map of ES6/AMD module identifiers to their related WRM module keys and JavaScript import values (read: webpack external dependency definition). If this module identifier is imported or required somewhere in the compiled code, it will not be bundled, but instead replaced with the specified external dependency placeholder. */
82
+ providedDependencies?: MapOrObject<ProvidedDependency>;
83
+ /** @property resourceParamMap - Parameters to be added to specific file types. */
84
+ resourceParamMap?: MapOrObject<ResourceParam[]>;
85
+ /** @property transformationMap - Transformations to be applied to the specified file-types. */
86
+ transformationMap?: MapOrObject<string[]> | false;
87
+ /** @property webresourceKeyMap - An explicit name for the web-resource generated per entry point. e.g.: `{"my-entry": "legacy-webresource-name"}`. */
88
+ webresourceKeyMap?: MapOrObject<WebresourceType>;
89
+ /** @property addAsyncNameAsContext - Adds the name of the async chunk as a context prefixed by `async-chunk-`. Will only do so if a webpackChunkName is set. */
90
+ addAsyncNameAsContext?: boolean;
91
+ /** @property addEntrypointNameAsContext - Guarantees each entrypoint will be given a context matching its name. Use with caution; this can adversely affect page weight and may conflict with other plugins and feature code. */
92
+ addEntrypointNameAsContext?: boolean;
93
+ /** @property noWRM - Do not add any WRM specifics to the webpack runtime to allow development on a greenfield. */
94
+ noWRM?: boolean;
95
+ /** @property useDocumentWriteInWatchMode - Use document.write when possible in "watch-mode" to ensure scripts are loaded "blocking" as they would be in a production environment */
96
+ useDocumentWriteInWatchMode?: boolean;
97
+ /** @property verbose - Indicate if log output should be verbose. */
98
+ verbose?: boolean;
99
+ /** @property watch - Trigger watch mode - this requires webpack-dev-server and will redirect requests to the entrypoints to the dev-server that must be running under webpack's `options.output.publicPath`. */
100
+ watch?: boolean;
101
+ /** @property watchPrepare - In conjunction with watch mode - indicates that only "redirects" to a webserver should be build in this run. */
102
+ watchPrepare?: boolean;
103
+ };
104
+ export type ConsolidatedOptions = Options & Required<Omit<Options, 'wrmManifestPath' | 'singleRuntimeWebResourceKey' | 'packageName'>> & {
105
+ conditionMap: ConditionsMap;
106
+ contextMap: ContextMap;
107
+ dataProvidersMap: DataProvidersMap;
108
+ deprecatedEntrypoints: DeprecationMap;
109
+ providedDependencies: ProvidedDependenciesMap;
110
+ resourceParamMap: ResourceParamMap;
111
+ transformationMap: TransformationMap;
112
+ webresourceKeyMap: WebresourceMap;
113
+ };
114
+ export type WrmResource = {
115
+ name: string;
116
+ location: string;
117
+ };
118
+ export type ChunkResourceDescriptor = {
119
+ attributes: {
120
+ key: string;
121
+ moduleId?: string;
122
+ };
123
+ resources: string[];
124
+ dependencies?: string[];
125
+ deprecationInfo?: DeprecationInfo;
126
+ contexts?: string[];
127
+ conditions?: Condition;
128
+ dataProviders?: DataProvider[];
129
+ externalResources?: WrmResource[];
130
+ };
131
+ export type AssetNames = Map<string, string>;
132
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { sources } from 'webpack';
2
+ import DllModule from 'webpack/lib/DllModule';
3
+ /**
4
+ * This module type allows inclusion of special dependencies in the webpack compilation process
5
+ * that ultimately output nothing in the compiled bundles.
6
+ *
7
+ * This is of use when including certain file types with no associated loader in the compilation process,
8
+ * as is the case with things like Atlassian Soy templates.
9
+ */
10
+ export default class EmptyExportsModule extends DllModule {
11
+ constructor(dependency: string, type: string);
12
+ chunkCondition(): boolean;
13
+ source(): sources.RawSource;
14
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const DllModule_1 = __importDefault(require("webpack/lib/DllModule"));
7
+ const webpack_sources_1 = require("webpack-sources");
8
+ /**
9
+ * This module type allows inclusion of special dependencies in the webpack compilation process
10
+ * that ultimately output nothing in the compiled bundles.
11
+ *
12
+ * This is of use when including certain file types with no associated loader in the compilation process,
13
+ * as is the case with things like Atlassian Soy templates.
14
+ */
15
+ class EmptyExportsModule extends DllModule_1.default {
16
+ constructor(dependency, type) {
17
+ super(null, [], dependency, type);
18
+ }
19
+ chunkCondition() {
20
+ return true;
21
+ }
22
+ source() {
23
+ // eslint-disable-next-line prettier/prettier
24
+ return new webpack_sources_1.RawSource('module.exports = undefined;');
25
+ }
26
+ }
27
+ exports.default = EmptyExportsModule;
28
+ //# sourceMappingURL=EmptyExportsModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyExportsModule.js","sourceRoot":"","sources":["../../src/webpack-modules/EmptyExportsModule.ts"],"names":[],"mappings":";;;;;AACA,sEAA8C;AAC9C,qDAA4C;AAE5C;;;;;;GAMG;AACH,MAAqB,kBAAmB,SAAQ,mBAAS;IACvD,YAAY,UAAkB,EAAE,IAAY;QAC1C,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,6CAA6C;QAC7C,OAAO,IAAI,2BAAS,CAAC,6BAA6B,CAAiC,CAAC;IACtF,CAAC;CACF;AAbD,qCAaC"}
@@ -0,0 +1,20 @@
1
+ import ExternalModule from 'webpack/lib/ExternalModule';
2
+ import type { ProvidedDependency } from '../types/types';
3
+ /**
4
+ * ProvidedExternalModule ensures that the `chunkCondition` is true to allow proper asyncChunk context handling
5
+ * ExternalModules can be defined in different ways. Some of them require the external module to be loaded in the entry point.
6
+ * This is generally not bad as it doesnt cost anything. However the WRM Plugin relies on ExternalModules to specify provided dependencies.
7
+ * These provided dependencies are then added to the context of the chunk in which they occur. Async chunks should therefore
8
+ * have their own dependencies to make the entrypoint as small as possible.
9
+ * ProvidedExternalModule ensures that.
10
+ */
11
+ export default class ProvidedExternalDependencyModule extends ExternalModule {
12
+ private _wrmDependency;
13
+ private _request;
14
+ private _target;
15
+ constructor(request: ProvidedDependency['import'], dependency: string, target: 'var' | 'amd');
16
+ libIdent(): string;
17
+ chunkCondition(): boolean;
18
+ getDependency(): string;
19
+ getConcatenationBailoutReason(): string;
20
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ExternalModule_1 = __importDefault(require("webpack/lib/ExternalModule"));
7
+ /**
8
+ * ProvidedExternalModule ensures that the `chunkCondition` is true to allow proper asyncChunk context handling
9
+ * ExternalModules can be defined in different ways. Some of them require the external module to be loaded in the entry point.
10
+ * This is generally not bad as it doesnt cost anything. However the WRM Plugin relies on ExternalModules to specify provided dependencies.
11
+ * These provided dependencies are then added to the context of the chunk in which they occur. Async chunks should therefore
12
+ * have their own dependencies to make the entrypoint as small as possible.
13
+ * ProvidedExternalModule ensures that.
14
+ */
15
+ class ProvidedExternalDependencyModule extends ExternalModule_1.default {
16
+ constructor(request, dependency, target) {
17
+ super(request, target);
18
+ this._request = request;
19
+ this._wrmDependency = dependency;
20
+ this._target = target;
21
+ }
22
+ libIdent() {
23
+ return `${this._wrmDependency}/${typeof this._request === 'string' ? this._request : this._request[this._target]}`;
24
+ }
25
+ chunkCondition() {
26
+ return true;
27
+ }
28
+ getDependency() {
29
+ return this._wrmDependency;
30
+ }
31
+ getConcatenationBailoutReason() {
32
+ return `Provided external dependencies can't be concatenated`;
33
+ }
34
+ }
35
+ exports.default = ProvidedExternalDependencyModule;
36
+ //# sourceMappingURL=ProvidedExternalDependencyModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProvidedExternalDependencyModule.js","sourceRoot":"","sources":["../../src/webpack-modules/ProvidedExternalDependencyModule.ts"],"names":[],"mappings":";;;;;AAAA,gFAAwD;AAIxD;;;;;;;GAOG;AACH,MAAqB,gCAAiC,SAAQ,wBAAc;IAK1E,YAAY,OAAqC,EAAE,UAAkB,EAAE,MAAqB;QAC1F,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,cAAc,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACrH,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,6BAA6B;QAC3B,OAAO,sDAAsD,CAAC;IAChE,CAAC;CACF;AA3BD,mDA2BC"}
@@ -0,0 +1,6 @@
1
+ import EmptyExportsModule from './EmptyExportsModule';
2
+ export default class WrmDependencyModule extends EmptyExportsModule {
3
+ private _wrmDependency;
4
+ constructor(dependency: string, type: string, pluginKey: string);
5
+ getDependency(): string;
6
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const EmptyExportsModule_1 = __importDefault(require("./EmptyExportsModule"));
7
+ class WrmDependencyModule extends EmptyExportsModule_1.default {
8
+ constructor(dependency, type, pluginKey) {
9
+ super(dependency, type);
10
+ this._wrmDependency = dependency.includes(':') ? dependency : `${pluginKey}:${dependency}`;
11
+ }
12
+ getDependency() {
13
+ return this._wrmDependency;
14
+ }
15
+ }
16
+ exports.default = WrmDependencyModule;
17
+ //# sourceMappingURL=WrmDependencyModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WrmDependencyModule.js","sourceRoot":"","sources":["../../src/webpack-modules/WrmDependencyModule.ts"],"names":[],"mappings":";;;;;AAAA,8EAAsD;AAEtD,MAAqB,mBAAoB,SAAQ,4BAAkB;IAGjE,YAAY,UAAkB,EAAE,IAAY,EAAE,SAAiB;QAC7D,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;IAC7F,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAXD,sCAWC"}
@@ -0,0 +1,10 @@
1
+ import EmptyExportsModule from './EmptyExportsModule';
2
+ export default class WrmResourceModule extends EmptyExportsModule {
3
+ private _resource;
4
+ constructor(resourceNameAndLocationPair: string, target: string, requestContext: string, rootContext: string);
5
+ getResourcePair(): [string, string];
6
+ getResource(): {
7
+ name: string;
8
+ location: string;
9
+ };
10
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const EmptyExportsModule_1 = __importDefault(require("./EmptyExportsModule"));
8
+ class WrmResourceModule extends EmptyExportsModule_1.default {
9
+ constructor(resourceNameAndLocationPair, target, requestContext, rootContext) {
10
+ super(resourceNameAndLocationPair, target);
11
+ const resourcePair = resourceNameAndLocationPair.split('!');
12
+ let resPath = resourcePair[1];
13
+ // enable relative resource-paths. Still requires that this resource is correctly copied to the right location in target.
14
+ if (resPath.startsWith('./') || resPath.startsWith('../')) {
15
+ const fullResourcePath = path_1.default.join(requestContext, resPath);
16
+ resPath = path_1.default.relative(rootContext, fullResourcePath);
17
+ }
18
+ this._resource = [resourcePair[0], resPath];
19
+ }
20
+ getResourcePair() {
21
+ return this._resource;
22
+ }
23
+ getResource() {
24
+ const [name, location] = this._resource;
25
+ return { name, location };
26
+ }
27
+ }
28
+ exports.default = WrmResourceModule;
29
+ //# sourceMappingURL=WrmResourceModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WrmResourceModule.js","sourceRoot":"","sources":["../../src/webpack-modules/WrmResourceModule.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,8EAAsD;AAEtD,MAAqB,iBAAkB,SAAQ,4BAAkB;IAG/D,YAAY,2BAAmC,EAAE,MAAc,EAAE,cAAsB,EAAE,WAAmB;QAC1G,KAAK,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAC3C,MAAM,YAAY,GAAG,2BAA2B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAE9B,yHAAyH;QACzH,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1D,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YAC5D,OAAO,GAAG,cAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,WAAW;QACT,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACxC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC;CACF;AAzBD,oCAyBC"}
package/jest.config.js CHANGED
@@ -1,8 +1,23 @@
1
1
  const pkg = require('./package.json');
2
2
  const baseConfig = require('../../jest.config.js');
3
3
 
4
+ /**
5
+ * @type {import('jest').Config}
6
+ */
4
7
  module.exports = {
5
8
  ...baseConfig,
6
- projects: ['.'],
9
+ projects: [
10
+ {
11
+ preset: 'ts-jest',
12
+ displayName: 'webpack',
13
+ transform: baseConfig.transform,
14
+ },
15
+ {
16
+ preset: 'ts-jest',
17
+ displayName: 'rspack',
18
+ transform: baseConfig.transform,
19
+ setupFilesAfterEnv: ['./test/util/setup-rspack.ts'],
20
+ },
21
+ ],
7
22
  displayName: pkg.name,
8
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/webresource-webpack-plugin",
3
- "version": "7.0.2",
3
+ "version": "7.0.4-efd4a11",
4
4
  "description": "Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.",
5
5
  "main": "dist/WrmPlugin.js",
6
6
  "types": "dist/WrmPlugin.d.ts",
@@ -60,7 +60,7 @@
60
60
  "dependencies": {
61
61
  "lodash": "4.17.21",
62
62
  "pretty-data": "0.40.0",
63
- "tapable": "2.2.1",
63
+ "tapable": "2.2.2",
64
64
  "url-join": "4.0.1",
65
65
  "uuid": "8.3.2"
66
66
  },
@@ -69,29 +69,30 @@
69
69
  "webpack-sources": "^1 || ^2"
70
70
  },
71
71
  "devDependencies": {
72
+ "@rspack/core": "^1.4.11",
72
73
  "@types/glob": "7.2.0",
73
- "@types/lodash": "4.14.177",
74
- "@types/node": "16.11.11",
74
+ "@types/lodash": "4.14.202",
75
+ "@types/node": "22.17.2",
75
76
  "@types/pretty-data": "0.40.3",
76
- "@types/url-join": "4.0.1",
77
- "@types/uuid": "8.3.3",
78
- "@types/webpack-sources": "3.2.0",
79
- "@types/xml-parser": "1.2.30",
77
+ "@types/url-join": "4.0.3",
78
+ "@types/uuid": "8.3.4",
79
+ "@types/webpack-sources": "3.2.3",
80
+ "@types/xml-parser": "1.2.33",
80
81
  "css-loader": "5.2.7",
81
- "del": "6.0.0",
82
- "esbuild": "0.14.1",
83
- "esbuild-register": "3.2.0",
82
+ "del": "6.1.1",
83
+ "esbuild": "0.25.9",
84
+ "esbuild-register": "3.6.0",
84
85
  "file-loader": "6.2.0",
85
- "glob": "7.2.0",
86
- "jest": "27.4.3",
86
+ "glob": "7.2.3",
87
+ "jest": "29.7.0",
87
88
  "jquery": "3.6.0",
88
89
  "mini-css-extract-plugin": "2.8.1",
89
90
  "style-loader": "2.0.0",
90
91
  "ts-node": "10.4.0",
91
- "typescript": "4.5.2",
92
- "underscore": "1.13.1",
92
+ "typescript": "5.9.2",
93
+ "underscore": "1.13.7",
93
94
  "webpack": "5.90.3",
94
- "webpack-cli": "4.9.1",
95
+ "webpack-cli": "4.9.2",
95
96
  "webpack-sources": "2.3.1",
96
97
  "xml-parser": "1.2.1"
97
98
  },
@@ -114,7 +115,9 @@
114
115
  "build": "tsc -p tsconfig.json",
115
116
  "verify": "tsc -p tsconfig.json --noEmit",
116
117
  "test": "jest",
118
+ "test:webpack": "jest --selectProjects=webpack",
119
+ "test:rspack": "jest --selectProjects=rspack",
117
120
  "test:watch": "jest --watch"
118
121
  },
119
- "gitHead": "622a7f318cc99f3760df5c1c90a5598b202526fd"
122
+ "gitHead": "fa43ff58de567f17ff53662043552e231a773c6d"
120
123
  }