@module-federation/node 2.1.5 → 2.1.6
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/dist/jest.config.d.ts +11 -0
- package/dist/jest.config.js +19 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/package.json +95 -0
- package/dist/src/filesystem/stratagies.d.ts +18 -0
- package/dist/src/filesystem/stratagies.js +117 -0
- package/dist/src/filesystem/stratagies.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +17 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.js +38 -0
- package/dist/src/plugins/AutomaticPublicPathPlugin.js.map +1 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.d.ts +61 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.js +442 -0
- package/dist/src/plugins/ChunkCorrelationPlugin.js.map +1 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.ts +17 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.js +121 -0
- package/dist/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +39 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +119 -0
- package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.d.ts +13 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.js +41 -0
- package/dist/src/plugins/EntryChunkTrackerPlugin.js.map +1 -0
- package/dist/src/plugins/NodeFederationPlugin.d.ts +46 -0
- package/dist/src/plugins/NodeFederationPlugin.js +81 -0
- package/dist/src/plugins/NodeFederationPlugin.js.map +1 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.d.ts +10 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.js +132 -0
- package/dist/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -0
- package/dist/src/plugins/StreamingTargetPlugin.d.ts +28 -0
- package/dist/src/plugins/StreamingTargetPlugin.js +59 -0
- package/dist/src/plugins/StreamingTargetPlugin.js.map +1 -0
- package/dist/src/plugins/UniversalFederationPlugin.d.ts +43 -0
- package/dist/src/plugins/UniversalFederationPlugin.js +53 -0
- package/dist/src/plugins/UniversalFederationPlugin.js.map +1 -0
- package/dist/src/plugins/webpackChunkUtilities.d.ts +50 -0
- package/dist/src/plugins/webpackChunkUtilities.js +305 -0
- package/dist/src/plugins/webpackChunkUtilities.js.map +1 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/index.js +3 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/flush-chunks.d.ts +11 -0
- package/dist/src/utils/flush-chunks.js +172 -0
- package/dist/src/utils/flush-chunks.js.map +1 -0
- package/dist/src/utils/hot-reload.d.ts +7 -0
- package/dist/src/utils/hot-reload.js +184 -0
- package/dist/src/utils/hot-reload.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.js +19 -0
- package/dist/src/utils/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export let displayName: string;
|
|
2
|
+
export let preset: string;
|
|
3
|
+
export let globals: {};
|
|
4
|
+
export let testEnvironment: string;
|
|
5
|
+
export let transform: {
|
|
6
|
+
'^.+\\.[tj]s$': (string | {
|
|
7
|
+
tsconfig: string;
|
|
8
|
+
})[];
|
|
9
|
+
};
|
|
10
|
+
export let moduleFileExtensions: string[];
|
|
11
|
+
export let coverageDirectory: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
module.exports = {
|
|
4
|
+
displayName: 'node',
|
|
5
|
+
preset: '../../jest.preset.js',
|
|
6
|
+
globals: {},
|
|
7
|
+
testEnvironment: 'node',
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.[tj]s$': [
|
|
10
|
+
'ts-jest',
|
|
11
|
+
{
|
|
12
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
17
|
+
coverageDirectory: '../../coverage/packages/node',
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=jest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.js"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,MAAM,CAAC,OAAO,GAAG;IACf,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE,sBAAsB;IAC9B,OAAO,EAAE,EAAE;IACX,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE;QACT,cAAc,EAAE;YACd,SAAS;YACT;gBACE,QAAQ,EAAE,8BAA8B;aACzC;SACF;KACF;IACD,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;IAC1C,iBAAiB,EAAE,8BAA8B;CAClD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"public": true,
|
|
3
|
+
"name": "@module-federation/node",
|
|
4
|
+
"version": "2.1.6",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/src/index.js",
|
|
10
|
+
"require": "./dist/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json",
|
|
13
|
+
"./utils": {
|
|
14
|
+
"import": "./dist/src/utils/index.js",
|
|
15
|
+
"require": "./dist/src/utils/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./src/plugins/RemotePublicPathPlugin.js": "./dist/src/plugins/RemotePublicPathPlugin.js",
|
|
18
|
+
"./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js",
|
|
19
|
+
"./src/": "./dist/src/"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"tags": [
|
|
29
|
+
"module-federation",
|
|
30
|
+
"node",
|
|
31
|
+
"webpack",
|
|
32
|
+
"node-federation",
|
|
33
|
+
"node-module-federation",
|
|
34
|
+
"ssr"
|
|
35
|
+
],
|
|
36
|
+
"types": "src/index.d.ts",
|
|
37
|
+
"description": "Module Federation helper for Node",
|
|
38
|
+
"repository": "https://github.com/module-federation/universe/tree/main/packages/node",
|
|
39
|
+
"author": "Zack Jackson <zackary.l.jackson@gmail.com>",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@module-federation/enhanced": "workspace:*",
|
|
43
|
+
"@module-federation/runtime": "workspace:*",
|
|
44
|
+
"@module-federation/runtime-tools": "0.0.8",
|
|
45
|
+
"@module-federation/sdk": "workspace:*",
|
|
46
|
+
"@module-federation/utilities": "workspace:*",
|
|
47
|
+
"@module-federation/webpack-bundler-runtime": "0.0.8",
|
|
48
|
+
"@types/koa": "2.11.2",
|
|
49
|
+
"@types/node-schedule": "1.3.2",
|
|
50
|
+
"@types/ws": "8.5.3",
|
|
51
|
+
"adm-zip": "0.5.10",
|
|
52
|
+
"ansi-colors": "4.1.3",
|
|
53
|
+
"axios": "1.6.7",
|
|
54
|
+
"chalk": "3.0.0",
|
|
55
|
+
"encoding": "^0.1.13",
|
|
56
|
+
"find-pkg": "2.0.0",
|
|
57
|
+
"fs-extra": "9.1.0",
|
|
58
|
+
"isomorphic-ws": "5.0.0",
|
|
59
|
+
"koa": "2.11.0",
|
|
60
|
+
"lodash.clonedeepwith": "4.5.0",
|
|
61
|
+
"log4js": "6.9.1",
|
|
62
|
+
"node-fetch": "2.7.0",
|
|
63
|
+
"node-schedule": "2.1.0",
|
|
64
|
+
"process": "0.11.10",
|
|
65
|
+
"rambda": "7.5.0",
|
|
66
|
+
"resolve": "1.22.8",
|
|
67
|
+
"tapable": "2.2.1",
|
|
68
|
+
"upath": "2.0.1",
|
|
69
|
+
"url": "0.11.3",
|
|
70
|
+
"webpack-sources": "3.2.3",
|
|
71
|
+
"ws": "8.5.0",
|
|
72
|
+
"@module-federation/dts-plugin": "0.1.6",
|
|
73
|
+
"@module-federation/managers": "0.1.6",
|
|
74
|
+
"@module-federation/manifest": "0.1.6",
|
|
75
|
+
"@module-federation/rspack": "0.1.6",
|
|
76
|
+
"@module-federation/third-party-dts-extractor": "0.1.6"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"next": "^12||^13",
|
|
80
|
+
"react": "^16||^17||^18",
|
|
81
|
+
"react-dom": "^16||^17||^18",
|
|
82
|
+
"webpack": "^5.40.0"
|
|
83
|
+
},
|
|
84
|
+
"peerDependenciesMeta": {
|
|
85
|
+
"next": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"react": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"react-dom": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function fileSystemRunInContextStrategy(chunkId: string, rootOutputDir: string, remotes: Remotes, callback: CallbackFunction): Promise<void>;
|
|
2
|
+
export declare function httpEvalStrategy(chunkName: string, remoteName: string, remotes: Remotes, callback: CallbackFunction): Promise<void>;
|
|
3
|
+
interface Remotes {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
entry: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
type CallbackFunction = (error: Error | null, chunk?: any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* HttpVmStrategy
|
|
11
|
+
* This function is used to execute a chunk of code in a VM using HTTP or HTTPS based on the protocol.
|
|
12
|
+
* @param {string} chunkName - The name of the chunk to be executed.
|
|
13
|
+
* @param {string} remoteName - The name of the remote server.
|
|
14
|
+
* @param {Remotes} remotes - An object containing the remote servers.
|
|
15
|
+
* @param {CallbackFunction} callback - A callback function to be executed after the chunk is executed.
|
|
16
|
+
*/
|
|
17
|
+
export declare function httpVmStrategy(chunkName: string, remoteName: string, remotes: Remotes, callback: CallbackFunction): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpVmStrategy = exports.httpEvalStrategy = exports.fileSystemRunInContextStrategy = void 0;
|
|
4
|
+
//@ts-nocheck
|
|
5
|
+
async function fileSystemRunInContextStrategy(chunkId, rootOutputDir, remotes, callback) {
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const vm = require('vm');
|
|
9
|
+
const filename = path.join(__dirname, rootOutputDir + __webpack_require__.u(chunkId));
|
|
10
|
+
if (fs.existsSync(filename)) {
|
|
11
|
+
fs.readFile(filename, 'utf-8', (err, content) => {
|
|
12
|
+
if (err) {
|
|
13
|
+
callback(err, null);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const chunk = {};
|
|
17
|
+
try {
|
|
18
|
+
vm.runInThisContext('(function(exports, require, __dirname, __filename) {' +
|
|
19
|
+
content +
|
|
20
|
+
'\n})', filename)(chunk, require, path.dirname(filename), filename);
|
|
21
|
+
callback(null, chunk);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.log("'runInThisContext threw'", e);
|
|
25
|
+
callback(e, null);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const err = new Error(`File ${filename} does not exist`);
|
|
31
|
+
callback(err, null);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.fileSystemRunInContextStrategy = fileSystemRunInContextStrategy;
|
|
35
|
+
// HttpEvalStrategy
|
|
36
|
+
async function httpEvalStrategy(chunkName, remoteName, remotes, callback) {
|
|
37
|
+
let url;
|
|
38
|
+
try {
|
|
39
|
+
url = new URL(chunkName, __webpack_require__.p);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
console.error('module-federation: failed to construct absolute chunk path of', remoteName, 'for', chunkName);
|
|
43
|
+
url = new URL(remotes[remoteName]);
|
|
44
|
+
const getBasenameFromUrl = (url) => {
|
|
45
|
+
const urlParts = url.split('/');
|
|
46
|
+
return urlParts[urlParts.length - 1];
|
|
47
|
+
};
|
|
48
|
+
const fileToReplace = getBasenameFromUrl(url.pathname);
|
|
49
|
+
url.pathname = url.pathname.replace(fileToReplace, chunkName);
|
|
50
|
+
}
|
|
51
|
+
const data = await fetch(url).then((res) => res.text());
|
|
52
|
+
const chunk = {};
|
|
53
|
+
try {
|
|
54
|
+
const urlDirname = url.pathname.split('/').slice(0, -1).join('/');
|
|
55
|
+
eval('(function(exports, require, __dirname, __filename) {' + data + '\n})')(chunk, require, urlDirname, chunkName);
|
|
56
|
+
callback(null, chunk);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
callback(e, null);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.httpEvalStrategy = httpEvalStrategy;
|
|
63
|
+
/**
|
|
64
|
+
* HttpVmStrategy
|
|
65
|
+
* This function is used to execute a chunk of code in a VM using HTTP or HTTPS based on the protocol.
|
|
66
|
+
* @param {string} chunkName - The name of the chunk to be executed.
|
|
67
|
+
* @param {string} remoteName - The name of the remote server.
|
|
68
|
+
* @param {Remotes} remotes - An object containing the remote servers.
|
|
69
|
+
* @param {CallbackFunction} callback - A callback function to be executed after the chunk is executed.
|
|
70
|
+
*/
|
|
71
|
+
async function httpVmStrategy(chunkName, remoteName, remotes, callback) {
|
|
72
|
+
const http = require('http');
|
|
73
|
+
const https = require('https');
|
|
74
|
+
const vm = require('vm');
|
|
75
|
+
const path = require('path');
|
|
76
|
+
let url;
|
|
77
|
+
const globalThisVal = new Function('return globalThis')();
|
|
78
|
+
try {
|
|
79
|
+
url = new URL(chunkName, __webpack_require__.p);
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.error('module-federation: failed to construct absolute chunk path of', remoteName, 'for', chunkName);
|
|
83
|
+
// search all instances to see if any have the remote
|
|
84
|
+
const container = globalThisVal['__FEDERATION__']['__INSTANCES__'].find((instance) => {
|
|
85
|
+
if (!instance.moduleCache.has(remoteName))
|
|
86
|
+
return;
|
|
87
|
+
const container = instance.moduleCache.get(remoteName);
|
|
88
|
+
if (!container.remoteInfo)
|
|
89
|
+
return;
|
|
90
|
+
return container.remoteInfo.entry;
|
|
91
|
+
});
|
|
92
|
+
if (!container) {
|
|
93
|
+
throw new Error('Container not found');
|
|
94
|
+
}
|
|
95
|
+
url = new URL(container.moduleCache.get(remoteName).remoteInfo.entry);
|
|
96
|
+
const fileToReplace = path.basename(url.pathname);
|
|
97
|
+
url.pathname = url.pathname.replace(fileToReplace, chunkName);
|
|
98
|
+
}
|
|
99
|
+
const protocol = url.protocol === 'https:' ? https : http;
|
|
100
|
+
protocol.get(url.href, (res) => {
|
|
101
|
+
let data = '';
|
|
102
|
+
res.on('data', (chunk) => {
|
|
103
|
+
data += chunk.toString();
|
|
104
|
+
});
|
|
105
|
+
res.on('end', () => {
|
|
106
|
+
const chunk = {};
|
|
107
|
+
const urlDirname = url.pathname.split('/').slice(0, -1).join('/');
|
|
108
|
+
vm.runInThisContext(`(function(exports, require, __dirname, __filename) {${data}\n})`, chunkName)(chunk, require, urlDirname, chunkName);
|
|
109
|
+
callback(null, chunk);
|
|
110
|
+
});
|
|
111
|
+
res.on('error', (err) => {
|
|
112
|
+
callback(err, null);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
exports.httpVmStrategy = httpVmStrategy;
|
|
117
|
+
//# sourceMappingURL=stratagies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stratagies.js","sourceRoot":"","sources":["../../../src/filesystem/stratagies.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACN,KAAK,UAAU,8BAA8B,CAClD,OAAe,EACf,aAAqB,EACrB,OAAgB,EAChB,QAA0B;IAE1B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,SAAS,EACT,aAAa,GAAG,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAC/C,CAAC;IACF,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAU,EAAE,OAAe,EAAE,EAAE;YAC7D,IAAI,GAAG,EAAE,CAAC;gBACR,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACpB,OAAO;YACT,CAAC;YACD,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC;gBACH,EAAE,CAAC,gBAAgB,CACjB,sDAAsD;oBACpD,OAAO;oBACP,MAAM,EACR,QAAQ,CACT,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;gBACpD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC;gBAC3C,QAAQ,CAAC,CAAU,EAAE,IAAI,CAAC,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C,IAAI,CAAC,GAAG,CAAC,CAAC;YAElE,EAAE,CAAC,gBAAgB,CACjB,uDAAuD,IAAI,MAAM,EACjE,SAAS,CACV,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;YACzC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACtB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA7DD,wCA6DC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as StreamingTargetPlugin } from './plugins/StreamingTargetPlugin';
|
|
2
|
+
export { default as NodeFederationPlugin } from './plugins/NodeFederationPlugin';
|
|
3
|
+
export { default as UniversalFederationPlugin } from './plugins/UniversalFederationPlugin';
|
|
4
|
+
export { default as ChunkCorrelationPlugin } from './plugins/ChunkCorrelationPlugin';
|
|
5
|
+
export { default as RemotePublicPathPlugin } from './plugins/RemotePublicPathRuntimeModule';
|
|
@@ -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
|
+
exports.RemotePublicPathPlugin = exports.ChunkCorrelationPlugin = exports.UniversalFederationPlugin = exports.NodeFederationPlugin = exports.StreamingTargetPlugin = void 0;
|
|
7
|
+
var StreamingTargetPlugin_1 = require("./plugins/StreamingTargetPlugin");
|
|
8
|
+
Object.defineProperty(exports, "StreamingTargetPlugin", { enumerable: true, get: function () { return __importDefault(StreamingTargetPlugin_1).default; } });
|
|
9
|
+
var NodeFederationPlugin_1 = require("./plugins/NodeFederationPlugin");
|
|
10
|
+
Object.defineProperty(exports, "NodeFederationPlugin", { enumerable: true, get: function () { return __importDefault(NodeFederationPlugin_1).default; } });
|
|
11
|
+
var UniversalFederationPlugin_1 = require("./plugins/UniversalFederationPlugin");
|
|
12
|
+
Object.defineProperty(exports, "UniversalFederationPlugin", { enumerable: true, get: function () { return __importDefault(UniversalFederationPlugin_1).default; } });
|
|
13
|
+
var ChunkCorrelationPlugin_1 = require("./plugins/ChunkCorrelationPlugin");
|
|
14
|
+
Object.defineProperty(exports, "ChunkCorrelationPlugin", { enumerable: true, get: function () { return __importDefault(ChunkCorrelationPlugin_1).default; } });
|
|
15
|
+
var RemotePublicPathRuntimeModule_1 = require("./plugins/RemotePublicPathRuntimeModule");
|
|
16
|
+
Object.defineProperty(exports, "RemotePublicPathPlugin", { enumerable: true, get: function () { return __importDefault(RemotePublicPathRuntimeModule_1).default; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,yEAAmF;AAA1E,+IAAA,OAAO,OAAyB;AACzC,uEAAiF;AAAxE,6IAAA,OAAO,OAAwB;AACxC,iFAA2F;AAAlF,uJAAA,OAAO,OAA6B;AAC7C,2EAAqF;AAA5E,iJAAA,OAAO,OAA0B;AAC1C,yFAA4F;AAAnF,wJAAA,OAAO,OAA0B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 RemotePublicPathRuntimeModule_1 = __importDefault(require("./RemotePublicPathRuntimeModule"));
|
|
7
|
+
class RemotePublicPathPlugin {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
apply(compiler) {
|
|
12
|
+
const { RuntimeGlobals } = compiler.webpack;
|
|
13
|
+
compiler.hooks.thisCompilation.tap('RemotePublicPathPlugin', (compilation) => {
|
|
14
|
+
compilation.hooks.runtimeRequirementInTree
|
|
15
|
+
.for(RuntimeGlobals.publicPath)
|
|
16
|
+
.tap('RuntimePlugin', (chunk, set) => {
|
|
17
|
+
const { outputOptions } = compilation;
|
|
18
|
+
const { publicPath: globalPublicPath, scriptType } = outputOptions;
|
|
19
|
+
const entryOptions = chunk.getEntryOptions();
|
|
20
|
+
const publicPath = entryOptions && entryOptions.publicPath !== undefined
|
|
21
|
+
? entryOptions.publicPath
|
|
22
|
+
: globalPublicPath;
|
|
23
|
+
const module = new RemotePublicPathRuntimeModule_1.default(this.options);
|
|
24
|
+
if (publicPath === 'auto' && scriptType !== 'module') {
|
|
25
|
+
set.add(RuntimeGlobals.global);
|
|
26
|
+
}
|
|
27
|
+
else if (typeof publicPath !== 'string' ||
|
|
28
|
+
/\[(full)?hash\]/.test(publicPath)) {
|
|
29
|
+
module.fullHash = true;
|
|
30
|
+
}
|
|
31
|
+
compilation.addRuntimeModule(chunk, module);
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = RemotePublicPathPlugin;
|
|
38
|
+
//# sourceMappingURL=AutomaticPublicPathPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutomaticPublicPathPlugin.js","sourceRoot":"","sources":["../../../src/plugins/AutomaticPublicPathPlugin.ts"],"names":[],"mappings":";;;;;AAEA,oGAA4E;AAI5E,MAAM,sBAAsB;IAG1B,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;QAC5C,QAAQ,CAAC,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filename or an array of filenames in the `output.path` directory to write stats to.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Writes relevant federation stats to a file for further consumption.
|
|
8
|
+
*/
|
|
9
|
+
declare class FederationStatsPlugin {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {FederationStatsPluginOptions} options
|
|
13
|
+
*/
|
|
14
|
+
constructor(options: FederationStatsPluginOptions);
|
|
15
|
+
_options: FederationStatsPluginOptions;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {import("webpack").Compiler} compiler
|
|
19
|
+
*/
|
|
20
|
+
apply(compiler: import("webpack").Compiler): void;
|
|
21
|
+
}
|
|
22
|
+
declare namespace FederationStatsPlugin {
|
|
23
|
+
export { WebpackStats, WebpackStatsChunk, WebpackStatsModule, SharedDependency, SharedModule, Exposed, FederatedContainer, FederatedStats, FederationStatsPluginOptions };
|
|
24
|
+
}
|
|
25
|
+
type WebpackStats = any;
|
|
26
|
+
type WebpackStatsChunk = any;
|
|
27
|
+
type WebpackStatsModule = any;
|
|
28
|
+
type SharedDependency = {
|
|
29
|
+
shareScope: string;
|
|
30
|
+
shareKey: string;
|
|
31
|
+
requiredVersion: string;
|
|
32
|
+
strictVersion: boolean;
|
|
33
|
+
singleton: boolean;
|
|
34
|
+
eager: boolean;
|
|
35
|
+
};
|
|
36
|
+
type SharedModule = {
|
|
37
|
+
chunks: string[];
|
|
38
|
+
provides: SharedDependency[];
|
|
39
|
+
};
|
|
40
|
+
type Exposed = {
|
|
41
|
+
chunks: string[];
|
|
42
|
+
sharedModules: SharedModule[];
|
|
43
|
+
};
|
|
44
|
+
type FederatedContainer = {
|
|
45
|
+
remote: string;
|
|
46
|
+
entry: string;
|
|
47
|
+
sharedModules: SharedModule[];
|
|
48
|
+
exposes: {
|
|
49
|
+
[key: string]: Exposed;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type FederatedStats = {
|
|
53
|
+
sharedModules: SharedModule[];
|
|
54
|
+
federatedModules: FederatedContainer[];
|
|
55
|
+
};
|
|
56
|
+
type FederationStatsPluginOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* The filename or an array of filenames in the `output.path` directory to write stats to.
|
|
59
|
+
*/
|
|
60
|
+
filename: string | string[];
|
|
61
|
+
};
|