@module-federation/esbuild 0.0.0-perf-devtools-20260108034446 → 0.0.0-perf-website-code-usage-20260914033703

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 (62) hide show
  1. package/dist/adapters/lib/collect-exports.js +153 -0
  2. package/dist/adapters/lib/collect-exports.mjs +80 -0
  3. package/dist/adapters/lib/commonjs.js +258 -0
  4. package/dist/adapters/lib/commonjs.mjs +182 -0
  5. package/dist/adapters/lib/containerPlugin.js +233 -0
  6. package/dist/adapters/lib/containerPlugin.mjs +179 -0
  7. package/dist/adapters/lib/containerReference.js +257 -0
  8. package/dist/adapters/lib/containerReference.mjs +188 -0
  9. package/dist/adapters/lib/lexer.js +187 -0
  10. package/dist/adapters/lib/lexer.mjs +136 -0
  11. package/dist/adapters/lib/linkRemotesPlugin.js +117 -0
  12. package/dist/adapters/lib/linkRemotesPlugin.mjs +48 -0
  13. package/dist/adapters/lib/manifest.js +227 -0
  14. package/dist/adapters/lib/manifest.mjs +159 -0
  15. package/dist/adapters/lib/plugin.js +340 -0
  16. package/dist/adapters/lib/plugin.mjs +247 -0
  17. package/dist/adapters/lib/react-replacements.js +86 -0
  18. package/dist/adapters/lib/react-replacements.mjs +34 -0
  19. package/dist/adapters/lib/transform.js +171 -0
  20. package/dist/adapters/lib/transform.mjs +116 -0
  21. package/dist/adapters/lib/utils.js +87 -0
  22. package/dist/adapters/lib/utils.mjs +31 -0
  23. package/dist/build.js +132 -473
  24. package/dist/build.mjs +12 -380
  25. package/dist/index.js +45 -26
  26. package/dist/index.mjs +3 -2
  27. package/dist/lib/config/configuration-context.js +73 -0
  28. package/dist/lib/config/configuration-context.mjs +18 -0
  29. package/dist/lib/config/federation-config.js +29 -0
  30. package/dist/lib/config/federation-config.mjs +3 -0
  31. package/dist/lib/config/share-utils.js +340 -0
  32. package/dist/lib/config/share-utils.mjs +245 -0
  33. package/dist/lib/config/with-native-federation.js +120 -0
  34. package/dist/lib/config/with-native-federation.mjs +66 -0
  35. package/dist/lib/core/build-adapter.js +72 -0
  36. package/dist/lib/core/build-adapter.mjs +16 -0
  37. package/dist/lib/core/createContainerTemplate.js +235 -0
  38. package/dist/lib/core/createContainerTemplate.mjs +183 -0
  39. package/dist/lib/core/default-skip-list.js +103 -0
  40. package/dist/lib/core/default-skip-list.mjs +45 -0
  41. package/dist/lib/core/federation-options.js +29 -0
  42. package/dist/lib/core/federation-options.mjs +3 -0
  43. package/dist/lib/core/get-externals.js +68 -0
  44. package/dist/lib/core/get-externals.mjs +17 -0
  45. package/dist/lib/core/load-federation-config.js +71 -0
  46. package/dist/lib/core/load-federation-config.mjs +16 -0
  47. package/dist/lib/core/write-federation-info.js +67 -0
  48. package/dist/lib/core/write-federation-info.mjs +12 -0
  49. package/dist/lib/utils/logger.js +113 -0
  50. package/dist/lib/utils/logger.mjs +44 -0
  51. package/dist/lib/utils/mapped-paths.js +95 -0
  52. package/dist/lib/utils/mapped-paths.mjs +40 -0
  53. package/dist/lib/utils/normalize.js +66 -0
  54. package/dist/lib/utils/normalize.mjs +15 -0
  55. package/dist/lib/utils/package-info.js +325 -0
  56. package/dist/lib/utils/package-info.mjs +259 -0
  57. package/dist/plugin.d.ts +1 -0
  58. package/dist/plugin.js +82 -1233
  59. package/dist/plugin.mjs +2 -1188
  60. package/dist/resolve/esm-resolver.mjs +15 -22
  61. package/dist/rslib-runtime.mjs +31 -0
  62. package/package.json +20 -11
@@ -0,0 +1,34 @@
1
+ "use strict"
2
+
3
+ const reactReplacements = {
4
+ dev: {
5
+ 'node_modules/react/index.js': {
6
+ file: 'node_modules/react/cjs/react.development.js'
7
+ },
8
+ 'node_modules/react/jsx-dev-runtime.js': {
9
+ file: 'node_modules/react/cjs/react-jsx-dev-runtime.development.js'
10
+ },
11
+ 'node_modules/react/jsx-runtime.js': {
12
+ file: 'node_modules/react/cjs/react-jsx-runtime.development.js'
13
+ },
14
+ 'node_modules/react-dom/index.js': {
15
+ file: 'node_modules/react-dom/cjs/react-dom.development.js'
16
+ }
17
+ },
18
+ prod: {
19
+ 'node_modules/react/index.js': {
20
+ file: 'node_modules/react/cjs/react.production.min.js'
21
+ },
22
+ 'node_modules/react/jsx-dev-runtime.js': {
23
+ file: 'node_modules/react/cjs/react-jsx-dev-runtime.production.min.js'
24
+ },
25
+ 'node_modules/react/jsx-runtime.js': {
26
+ file: 'node_modules/react/cjs/react-jsx-runtime.production.min.js'
27
+ },
28
+ 'node_modules/react-dom/index.js': {
29
+ file: 'node_modules/react-dom/cjs/react-dom.production.min.js'
30
+ }
31
+ }
32
+ };
33
+
34
+ export { reactReplacements };
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ // ESM COMPAT FLAG
42
+ __webpack_require__.r(__webpack_exports__);
43
+
44
+ // EXPORTS
45
+ __webpack_require__.d(__webpack_exports__, {
46
+ transform: () => (/* binding */ transform)
47
+ });
48
+
49
+ ;// CONCATENATED MODULE: external "esbuild"
50
+ const external_esbuild_namespaceObject = require("esbuild");
51
+ ;// CONCATENATED MODULE: external "path"
52
+ const external_path_namespaceObject = require("path");
53
+ ;// CONCATENATED MODULE: ./src/adapters/lib/transform.ts
54
+
55
+
56
+ const targets = {
57
+ esnext: 'esnext',
58
+ es2015: 'es2015',
59
+ es2016: 'es2016',
60
+ es2017: 'es2017',
61
+ es2018: 'es2018',
62
+ es2019: 'es2019',
63
+ es2020: 'es2020',
64
+ es2021: 'es2021',
65
+ es2022: 'es2022'
66
+ };
67
+ async function transform(input) {
68
+ let target = 'esnext';
69
+ if (input.target && targets[input.target]) {
70
+ target = targets[input.target];
71
+ } else if (input.target) {
72
+ throw new Error('<400> invalid target');
73
+ }
74
+ let loader = 'js';
75
+ const extname = external_path_namespaceObject.extname(input.filename);
76
+ switch(extname){
77
+ case '.jsx':
78
+ loader = 'jsx';
79
+ break;
80
+ case '.ts':
81
+ loader = 'ts';
82
+ break;
83
+ case '.tsx':
84
+ loader = 'tsx';
85
+ break;
86
+ }
87
+ const imports = {};
88
+ const trailingSlashImports = {};
89
+ let jsxImportSource = '';
90
+ if (input.importMap) {
91
+ const im = JSON.parse(input.importMap);
92
+ if (im.imports) {
93
+ for (const [key, value] of Object.entries(im.imports)){
94
+ if (typeof value === 'string' && value !== '') {
95
+ if (key.endsWith('/')) {
96
+ trailingSlashImports[key] = value;
97
+ } else {
98
+ if (key === '@jsxImportSource') {
99
+ jsxImportSource = value;
100
+ }
101
+ imports[key] = value;
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ const onResolver = (args)=>{
108
+ let resolvedPath = args.path;
109
+ if (imports[resolvedPath]) {
110
+ resolvedPath = imports[resolvedPath];
111
+ } else {
112
+ for (const [key, value] of Object.entries(trailingSlashImports)){
113
+ if (resolvedPath.startsWith(key)) {
114
+ resolvedPath = value + resolvedPath.slice(key.length);
115
+ break;
116
+ }
117
+ }
118
+ }
119
+ return {
120
+ path: resolvedPath,
121
+ external: true
122
+ };
123
+ };
124
+ const stdin = {
125
+ contents: input.code,
126
+ resolveDir: '/',
127
+ sourcefile: input.filename,
128
+ loader: loader
129
+ };
130
+ const jsx = jsxImportSource ? 'automatic' : 'transform';
131
+ const opts = {
132
+ outdir: '/esbuild',
133
+ stdin: stdin,
134
+ platform: 'browser',
135
+ format: 'esm',
136
+ target: target,
137
+ jsx: jsx,
138
+ jsxImportSource: jsxImportSource,
139
+ bundle: true,
140
+ treeShaking: false,
141
+ minifyWhitespace: false,
142
+ minifySyntax: false,
143
+ write: false,
144
+ plugins: [
145
+ {
146
+ name: 'resolver',
147
+ setup (build) {
148
+ build.onResolve({
149
+ filter: /.*/
150
+ }, onResolver);
151
+ }
152
+ }
153
+ ]
154
+ };
155
+ const ret = await external_esbuild_namespaceObject.build(opts);
156
+ if (ret.errors.length > 0) {
157
+ throw new Error('<400> failed to validate code: ' + ret.errors[0].text);
158
+ }
159
+ if (!ret.outputFiles || ret.outputFiles.length === 0) {
160
+ throw new Error('<400> failed to validate code: no output files');
161
+ }
162
+ return ret.outputFiles[0].text;
163
+ }
164
+
165
+ exports.transform = __webpack_exports__.transform;
166
+ for(var __rspack_i in __webpack_exports__) {
167
+ if(["transform"].indexOf(__rspack_i) === -1) {
168
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
169
+ }
170
+ }
171
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,116 @@
1
+ import * as __rspack_external_esbuild from "esbuild";
2
+ import * as __rspack_external_path from "path";
3
+
4
+
5
+
6
+
7
+ const targets = {
8
+ esnext: 'esnext',
9
+ es2015: 'es2015',
10
+ es2016: 'es2016',
11
+ es2017: 'es2017',
12
+ es2018: 'es2018',
13
+ es2019: 'es2019',
14
+ es2020: 'es2020',
15
+ es2021: 'es2021',
16
+ es2022: 'es2022'
17
+ };
18
+ async function transform(input) {
19
+ let target = 'esnext';
20
+ if (input.target && targets[input.target]) {
21
+ target = targets[input.target];
22
+ } else if (input.target) {
23
+ throw new Error('<400> invalid target');
24
+ }
25
+ let loader = 'js';
26
+ const extname = __rspack_external_path.extname(input.filename);
27
+ switch(extname){
28
+ case '.jsx':
29
+ loader = 'jsx';
30
+ break;
31
+ case '.ts':
32
+ loader = 'ts';
33
+ break;
34
+ case '.tsx':
35
+ loader = 'tsx';
36
+ break;
37
+ }
38
+ const imports = {};
39
+ const trailingSlashImports = {};
40
+ let jsxImportSource = '';
41
+ if (input.importMap) {
42
+ const im = JSON.parse(input.importMap);
43
+ if (im.imports) {
44
+ for (const [key, value] of Object.entries(im.imports)){
45
+ if (typeof value === 'string' && value !== '') {
46
+ if (key.endsWith('/')) {
47
+ trailingSlashImports[key] = value;
48
+ } else {
49
+ if (key === '@jsxImportSource') {
50
+ jsxImportSource = value;
51
+ }
52
+ imports[key] = value;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ const onResolver = (args)=>{
59
+ let resolvedPath = args.path;
60
+ if (imports[resolvedPath]) {
61
+ resolvedPath = imports[resolvedPath];
62
+ } else {
63
+ for (const [key, value] of Object.entries(trailingSlashImports)){
64
+ if (resolvedPath.startsWith(key)) {
65
+ resolvedPath = value + resolvedPath.slice(key.length);
66
+ break;
67
+ }
68
+ }
69
+ }
70
+ return {
71
+ path: resolvedPath,
72
+ external: true
73
+ };
74
+ };
75
+ const stdin = {
76
+ contents: input.code,
77
+ resolveDir: '/',
78
+ sourcefile: input.filename,
79
+ loader: loader
80
+ };
81
+ const jsx = jsxImportSource ? 'automatic' : 'transform';
82
+ const opts = {
83
+ outdir: '/esbuild',
84
+ stdin: stdin,
85
+ platform: 'browser',
86
+ format: 'esm',
87
+ target: target,
88
+ jsx: jsx,
89
+ jsxImportSource: jsxImportSource,
90
+ bundle: true,
91
+ treeShaking: false,
92
+ minifyWhitespace: false,
93
+ minifySyntax: false,
94
+ write: false,
95
+ plugins: [
96
+ {
97
+ name: 'resolver',
98
+ setup (build) {
99
+ build.onResolve({
100
+ filter: /.*/
101
+ }, onResolver);
102
+ }
103
+ }
104
+ ]
105
+ };
106
+ const ret = await __rspack_external_esbuild.build(opts);
107
+ if (ret.errors.length > 0) {
108
+ throw new Error('<400> failed to validate code: ' + ret.errors[0].text);
109
+ }
110
+ if (!ret.outputFiles || ret.outputFiles.length === 0) {
111
+ throw new Error('<400> failed to validate code: no output files');
112
+ }
113
+ return ret.outputFiles[0].text;
114
+ }
115
+
116
+ export { transform };
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ __webpack_require__.r(__webpack_exports__);
42
+ function orderedUniq(array) {
43
+ // prettier-ignore
44
+ const ret = [], visited = new Set();
45
+ for (const val of array)if (!visited.has(val)) visited.add(val), ret.push(val);
46
+ return ret;
47
+ }
48
+ function cachedReduce(array, reducer, s) {
49
+ // prettier-ignore
50
+ const cache = [
51
+ s
52
+ ];
53
+ let cacheLen = 1, last = s;
54
+ return (len)=>{
55
+ while(cacheLen <= len)cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
56
+ return cache[len];
57
+ };
58
+ }
59
+ // from @rollup/pluginutils
60
+ const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
61
+ const builtin = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
62
+ const forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(' '));
63
+ forbiddenIdentifiers.add('');
64
+ const makeLegalIdentifier = function makeLegalIdentifier(str) {
65
+ let identifier = str.replace(/-(\w)/g, (_, letter)=>letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, '_');
66
+ if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
67
+ identifier = `_${identifier}`;
68
+ }
69
+ return identifier || '_';
70
+ };
71
+
72
+ __webpack_require__.d(__webpack_exports__, {
73
+ cachedReduce: () => (cachedReduce),
74
+ orderedUniq: () => (orderedUniq)
75
+ }, {
76
+ makeLegalIdentifier: makeLegalIdentifier
77
+ });
78
+
79
+ exports.cachedReduce = __webpack_exports__.cachedReduce;
80
+ exports.makeLegalIdentifier = __webpack_exports__.makeLegalIdentifier;
81
+ exports.orderedUniq = __webpack_exports__.orderedUniq;
82
+ for(var __rspack_i in __webpack_exports__) {
83
+ if(["cachedReduce","makeLegalIdentifier","orderedUniq"].indexOf(__rspack_i) === -1) {
84
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
85
+ }
86
+ }
87
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,31 @@
1
+ function orderedUniq(array) {
2
+ // prettier-ignore
3
+ const ret = [], visited = new Set();
4
+ for (const val of array)if (!visited.has(val)) visited.add(val), ret.push(val);
5
+ return ret;
6
+ }
7
+ function cachedReduce(array, reducer, s) {
8
+ // prettier-ignore
9
+ const cache = [
10
+ s
11
+ ];
12
+ let cacheLen = 1, last = s;
13
+ return (len)=>{
14
+ while(cacheLen <= len)cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
15
+ return cache[len];
16
+ };
17
+ }
18
+ // from @rollup/pluginutils
19
+ const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
20
+ const builtin = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
21
+ const forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(' '));
22
+ forbiddenIdentifiers.add('');
23
+ const utils_makeLegalIdentifier = function makeLegalIdentifier(str) {
24
+ let identifier = str.replace(/-(\w)/g, (_, letter)=>letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, '_');
25
+ if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
26
+ identifier = `_${identifier}`;
27
+ }
28
+ return identifier || '_';
29
+ };
30
+
31
+ export { cachedReduce, orderedUniq, utils_makeLegalIdentifier as makeLegalIdentifier };