@module-federation/vite 1.1.7 → 1.1.8
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/lib/index.cjs +23 -6
- package/lib/index.esm.js +23 -6
- package/lib/index.modern.js +19 -8
- package/lib/index.umd.js +23 -6
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -30,6 +30,11 @@ var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
|
30
30
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
31
31
|
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
32
32
|
|
|
33
|
+
function getFirstHtmlEntryFile(entryFiles) {
|
|
34
|
+
return entryFiles.find(function (file) {
|
|
35
|
+
return file.endsWith('.html');
|
|
36
|
+
});
|
|
37
|
+
}
|
|
33
38
|
var addEntry = function addEntry(_ref) {
|
|
34
39
|
var entryName = _ref.entryName,
|
|
35
40
|
entryPath = _ref.entryPath,
|
|
@@ -42,6 +47,12 @@ var addEntry = function addEntry(_ref) {
|
|
|
42
47
|
var _command;
|
|
43
48
|
var emitFileId;
|
|
44
49
|
var viteConfig;
|
|
50
|
+
function injectHtml() {
|
|
51
|
+
return inject === 'html' && htmlFilePath;
|
|
52
|
+
}
|
|
53
|
+
function injectEntry() {
|
|
54
|
+
return inject === 'entry' || !htmlFilePath;
|
|
55
|
+
}
|
|
45
56
|
return [{
|
|
46
57
|
name: 'add-entry',
|
|
47
58
|
apply: 'serve',
|
|
@@ -71,7 +82,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
71
82
|
});
|
|
72
83
|
},
|
|
73
84
|
transformIndexHtml: function transformIndexHtml(c) {
|
|
74
|
-
if (
|
|
85
|
+
if (!injectHtml()) return;
|
|
75
86
|
return c.replace('<head>', "<head><script type=\"module\" src=" + JSON.stringify(devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/')) + "></script>");
|
|
76
87
|
}
|
|
77
88
|
}, {
|
|
@@ -84,13 +95,13 @@ var addEntry = function addEntry(_ref) {
|
|
|
84
95
|
htmlFilePath = path__namespace.resolve(config.root, 'index.html');
|
|
85
96
|
} else if (typeof inputOptions === 'string') {
|
|
86
97
|
entryFiles = [inputOptions];
|
|
87
|
-
htmlFilePath = path__namespace.resolve(config.root, inputOptions);
|
|
88
98
|
} else if (Array.isArray(inputOptions)) {
|
|
89
99
|
entryFiles = inputOptions;
|
|
90
|
-
htmlFilePath = path__namespace.resolve(config.root, inputOptions[0]);
|
|
91
100
|
} else if (typeof inputOptions === 'object') {
|
|
92
101
|
entryFiles = Object.values(inputOptions);
|
|
93
|
-
|
|
102
|
+
}
|
|
103
|
+
if (entryFiles && entryFiles.length > 0) {
|
|
104
|
+
htmlFilePath = getFirstHtmlEntryFile(entryFiles);
|
|
94
105
|
}
|
|
95
106
|
},
|
|
96
107
|
buildStart: function buildStart() {
|
|
@@ -116,7 +127,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
116
127
|
}
|
|
117
128
|
},
|
|
118
129
|
generateBundle: function generateBundle(options, bundle) {
|
|
119
|
-
if (
|
|
130
|
+
if (!injectHtml()) return;
|
|
120
131
|
var file = this.getFileName(emitFileId);
|
|
121
132
|
var scriptContent = "\n <script type=\"module\" src=\"" + (viteConfig.base + file) + "\"></script>\n ";
|
|
122
133
|
for (var _fileName in bundle) {
|
|
@@ -130,7 +141,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
130
141
|
}
|
|
131
142
|
},
|
|
132
143
|
transform: function transform(code, id) {
|
|
133
|
-
if (
|
|
144
|
+
if (injectEntry() && entryFiles.some(function (file) {
|
|
134
145
|
return id.endsWith(file);
|
|
135
146
|
})) {
|
|
136
147
|
var injection = "\n import " + JSON.stringify(entryPath) + ";\n ";
|
|
@@ -630,10 +641,16 @@ function generateLocalSharedImportMap() {
|
|
|
630
641
|
return "\n " + JSON.stringify(pkg) + ": async () => {\n let pkg = await import(\"" + getPreBuildLibImportId(pkg) + "\")\n return pkg\n }\n ";
|
|
631
642
|
}).join(',') + "\n }\n const usedShared = {\n " + Array.from(getUsedShares()).map(function (key) {
|
|
632
643
|
var shareItem = getNormalizeShareItem(key);
|
|
644
|
+
if (!shareItem) return null;
|
|
633
645
|
return "\n " + JSON.stringify(key) + ": {\n name: " + JSON.stringify(key) + ",\n version: " + JSON.stringify(shareItem.version) + ",\n scope: [" + JSON.stringify(shareItem.scope) + "],\n loaded: false,\n from: " + JSON.stringify(options.name) + ",\n async get () {\n usedShared[" + JSON.stringify(key) + "].loaded = true\n const {" + JSON.stringify(key) + ": pkgDynamicImport} = importMap \n const res = await pkgDynamicImport()\n const exportModule = {...res}\n // All npm packages pre-built by vite will be converted to esm\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return function () {\n return exportModule\n }\n },\n shareConfig: {\n singleton: " + shareItem.shareConfig.singleton + ",\n requiredVersion: " + JSON.stringify(shareItem.shareConfig.requiredVersion) + "\n }\n }\n ";
|
|
646
|
+
}).filter(function (x) {
|
|
647
|
+
return x !== null;
|
|
634
648
|
}).join(',') + "\n }\n const usedRemotes = [" + Object.keys(getUsedRemotesMap()).map(function (key) {
|
|
635
649
|
var remote = options.remotes[key];
|
|
650
|
+
if (!remote) return null;
|
|
636
651
|
return "\n {\n entryGlobalName: " + JSON.stringify(remote.entryGlobalName) + ",\n name: " + JSON.stringify(remote.name) + ",\n type: " + JSON.stringify(remote.type) + ",\n entry: " + JSON.stringify(remote.entry) + ",\n }\n ";
|
|
652
|
+
}).filter(function (x) {
|
|
653
|
+
return x !== null;
|
|
637
654
|
}).join(',') + "\n ]\n export {\n usedShared,\n usedRemotes\n }\n ";
|
|
638
655
|
}
|
|
639
656
|
var REMOTE_ENTRY_ID = 'virtual:mf-REMOTE_ENTRY_ID';
|
package/lib/index.esm.js
CHANGED
|
@@ -7,6 +7,11 @@ import { walk } from 'estree-walker';
|
|
|
7
7
|
import MagicString from 'magic-string';
|
|
8
8
|
import { defu } from 'defu';
|
|
9
9
|
|
|
10
|
+
function getFirstHtmlEntryFile(entryFiles) {
|
|
11
|
+
return entryFiles.find(function (file) {
|
|
12
|
+
return file.endsWith('.html');
|
|
13
|
+
});
|
|
14
|
+
}
|
|
10
15
|
var addEntry = function addEntry(_ref) {
|
|
11
16
|
var entryName = _ref.entryName,
|
|
12
17
|
entryPath = _ref.entryPath,
|
|
@@ -19,6 +24,12 @@ var addEntry = function addEntry(_ref) {
|
|
|
19
24
|
var _command;
|
|
20
25
|
var emitFileId;
|
|
21
26
|
var viteConfig;
|
|
27
|
+
function injectHtml() {
|
|
28
|
+
return inject === 'html' && htmlFilePath;
|
|
29
|
+
}
|
|
30
|
+
function injectEntry() {
|
|
31
|
+
return inject === 'entry' || !htmlFilePath;
|
|
32
|
+
}
|
|
22
33
|
return [{
|
|
23
34
|
name: 'add-entry',
|
|
24
35
|
apply: 'serve',
|
|
@@ -48,7 +59,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
48
59
|
});
|
|
49
60
|
},
|
|
50
61
|
transformIndexHtml: function transformIndexHtml(c) {
|
|
51
|
-
if (
|
|
62
|
+
if (!injectHtml()) return;
|
|
52
63
|
return c.replace('<head>', "<head><script type=\"module\" src=" + JSON.stringify(devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/')) + "></script>");
|
|
53
64
|
}
|
|
54
65
|
}, {
|
|
@@ -61,13 +72,13 @@ var addEntry = function addEntry(_ref) {
|
|
|
61
72
|
htmlFilePath = path.resolve(config.root, 'index.html');
|
|
62
73
|
} else if (typeof inputOptions === 'string') {
|
|
63
74
|
entryFiles = [inputOptions];
|
|
64
|
-
htmlFilePath = path.resolve(config.root, inputOptions);
|
|
65
75
|
} else if (Array.isArray(inputOptions)) {
|
|
66
76
|
entryFiles = inputOptions;
|
|
67
|
-
htmlFilePath = path.resolve(config.root, inputOptions[0]);
|
|
68
77
|
} else if (typeof inputOptions === 'object') {
|
|
69
78
|
entryFiles = Object.values(inputOptions);
|
|
70
|
-
|
|
79
|
+
}
|
|
80
|
+
if (entryFiles && entryFiles.length > 0) {
|
|
81
|
+
htmlFilePath = getFirstHtmlEntryFile(entryFiles);
|
|
71
82
|
}
|
|
72
83
|
},
|
|
73
84
|
buildStart: function buildStart() {
|
|
@@ -93,7 +104,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
93
104
|
}
|
|
94
105
|
},
|
|
95
106
|
generateBundle: function generateBundle(options, bundle) {
|
|
96
|
-
if (
|
|
107
|
+
if (!injectHtml()) return;
|
|
97
108
|
var file = this.getFileName(emitFileId);
|
|
98
109
|
var scriptContent = "\n <script type=\"module\" src=\"" + (viteConfig.base + file) + "\"></script>\n ";
|
|
99
110
|
for (var _fileName in bundle) {
|
|
@@ -107,7 +118,7 @@ var addEntry = function addEntry(_ref) {
|
|
|
107
118
|
}
|
|
108
119
|
},
|
|
109
120
|
transform: function transform(code, id) {
|
|
110
|
-
if (
|
|
121
|
+
if (injectEntry() && entryFiles.some(function (file) {
|
|
111
122
|
return id.endsWith(file);
|
|
112
123
|
})) {
|
|
113
124
|
var injection = "\n import " + JSON.stringify(entryPath) + ";\n ";
|
|
@@ -607,10 +618,16 @@ function generateLocalSharedImportMap() {
|
|
|
607
618
|
return "\n " + JSON.stringify(pkg) + ": async () => {\n let pkg = await import(\"" + getPreBuildLibImportId(pkg) + "\")\n return pkg\n }\n ";
|
|
608
619
|
}).join(',') + "\n }\n const usedShared = {\n " + Array.from(getUsedShares()).map(function (key) {
|
|
609
620
|
var shareItem = getNormalizeShareItem(key);
|
|
621
|
+
if (!shareItem) return null;
|
|
610
622
|
return "\n " + JSON.stringify(key) + ": {\n name: " + JSON.stringify(key) + ",\n version: " + JSON.stringify(shareItem.version) + ",\n scope: [" + JSON.stringify(shareItem.scope) + "],\n loaded: false,\n from: " + JSON.stringify(options.name) + ",\n async get () {\n usedShared[" + JSON.stringify(key) + "].loaded = true\n const {" + JSON.stringify(key) + ": pkgDynamicImport} = importMap \n const res = await pkgDynamicImport()\n const exportModule = {...res}\n // All npm packages pre-built by vite will be converted to esm\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return function () {\n return exportModule\n }\n },\n shareConfig: {\n singleton: " + shareItem.shareConfig.singleton + ",\n requiredVersion: " + JSON.stringify(shareItem.shareConfig.requiredVersion) + "\n }\n }\n ";
|
|
623
|
+
}).filter(function (x) {
|
|
624
|
+
return x !== null;
|
|
611
625
|
}).join(',') + "\n }\n const usedRemotes = [" + Object.keys(getUsedRemotesMap()).map(function (key) {
|
|
612
626
|
var remote = options.remotes[key];
|
|
627
|
+
if (!remote) return null;
|
|
613
628
|
return "\n {\n entryGlobalName: " + JSON.stringify(remote.entryGlobalName) + ",\n name: " + JSON.stringify(remote.name) + ",\n type: " + JSON.stringify(remote.type) + ",\n entry: " + JSON.stringify(remote.entry) + ",\n }\n ";
|
|
629
|
+
}).filter(function (x) {
|
|
630
|
+
return x !== null;
|
|
614
631
|
}).join(',') + "\n ]\n export {\n usedShared,\n usedRemotes\n }\n ";
|
|
615
632
|
}
|
|
616
633
|
var REMOTE_ENTRY_ID = 'virtual:mf-REMOTE_ENTRY_ID';
|
package/lib/index.modern.js
CHANGED
|
@@ -7,6 +7,9 @@ import { walk } from 'estree-walker';
|
|
|
7
7
|
import MagicString from 'magic-string';
|
|
8
8
|
import { defu } from 'defu';
|
|
9
9
|
|
|
10
|
+
function getFirstHtmlEntryFile(entryFiles) {
|
|
11
|
+
return entryFiles.find(file => file.endsWith('.html'));
|
|
12
|
+
}
|
|
10
13
|
const addEntry = ({
|
|
11
14
|
entryName,
|
|
12
15
|
entryPath,
|
|
@@ -19,6 +22,12 @@ const addEntry = ({
|
|
|
19
22
|
let _command;
|
|
20
23
|
let emitFileId;
|
|
21
24
|
let viteConfig;
|
|
25
|
+
function injectHtml() {
|
|
26
|
+
return _inject === 'html' && htmlFilePath;
|
|
27
|
+
}
|
|
28
|
+
function injectEntry() {
|
|
29
|
+
return _inject === 'entry' || !htmlFilePath;
|
|
30
|
+
}
|
|
22
31
|
return [{
|
|
23
32
|
name: 'add-entry',
|
|
24
33
|
apply: 'serve',
|
|
@@ -51,7 +60,7 @@ const addEntry = ({
|
|
|
51
60
|
});
|
|
52
61
|
},
|
|
53
62
|
transformIndexHtml(c) {
|
|
54
|
-
if (
|
|
63
|
+
if (!injectHtml()) return;
|
|
55
64
|
return c.replace('<head>', `<head><script type="module" src=${JSON.stringify(devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/'))}></script>`);
|
|
56
65
|
}
|
|
57
66
|
}, {
|
|
@@ -64,13 +73,13 @@ const addEntry = ({
|
|
|
64
73
|
htmlFilePath = path.resolve(config.root, 'index.html');
|
|
65
74
|
} else if (typeof inputOptions === 'string') {
|
|
66
75
|
entryFiles = [inputOptions];
|
|
67
|
-
htmlFilePath = path.resolve(config.root, inputOptions);
|
|
68
76
|
} else if (Array.isArray(inputOptions)) {
|
|
69
77
|
entryFiles = inputOptions;
|
|
70
|
-
htmlFilePath = path.resolve(config.root, inputOptions[0]);
|
|
71
78
|
} else if (typeof inputOptions === 'object') {
|
|
72
79
|
entryFiles = Object.values(inputOptions);
|
|
73
|
-
|
|
80
|
+
}
|
|
81
|
+
if (entryFiles && entryFiles.length > 0) {
|
|
82
|
+
htmlFilePath = getFirstHtmlEntryFile(entryFiles);
|
|
74
83
|
}
|
|
75
84
|
},
|
|
76
85
|
buildStart() {
|
|
@@ -96,7 +105,7 @@ const addEntry = ({
|
|
|
96
105
|
}
|
|
97
106
|
},
|
|
98
107
|
generateBundle(options, bundle) {
|
|
99
|
-
if (
|
|
108
|
+
if (!injectHtml()) return;
|
|
100
109
|
const file = this.getFileName(emitFileId);
|
|
101
110
|
const scriptContent = `
|
|
102
111
|
<script type="module" src="${viteConfig.base + file}"></script>
|
|
@@ -112,7 +121,7 @@ const addEntry = ({
|
|
|
112
121
|
}
|
|
113
122
|
},
|
|
114
123
|
transform(code, id) {
|
|
115
|
-
if (
|
|
124
|
+
if (injectEntry() && entryFiles.some(file => id.endsWith(file))) {
|
|
116
125
|
const injection = `
|
|
117
126
|
import ${JSON.stringify(entryPath)};
|
|
118
127
|
`;
|
|
@@ -624,6 +633,7 @@ function generateLocalSharedImportMap() {
|
|
|
624
633
|
const usedShared = {
|
|
625
634
|
${Array.from(getUsedShares()).map(key => {
|
|
626
635
|
const shareItem = getNormalizeShareItem(key);
|
|
636
|
+
if (!shareItem) return null;
|
|
627
637
|
return `
|
|
628
638
|
${JSON.stringify(key)}: {
|
|
629
639
|
name: ${JSON.stringify(key)},
|
|
@@ -651,10 +661,11 @@ function generateLocalSharedImportMap() {
|
|
|
651
661
|
}
|
|
652
662
|
}
|
|
653
663
|
`;
|
|
654
|
-
}).join(',')}
|
|
664
|
+
}).filter(x => x !== null).join(',')}
|
|
655
665
|
}
|
|
656
666
|
const usedRemotes = [${Object.keys(getUsedRemotesMap()).map(key => {
|
|
657
667
|
const remote = options.remotes[key];
|
|
668
|
+
if (!remote) return null;
|
|
658
669
|
return `
|
|
659
670
|
{
|
|
660
671
|
entryGlobalName: ${JSON.stringify(remote.entryGlobalName)},
|
|
@@ -663,7 +674,7 @@ function generateLocalSharedImportMap() {
|
|
|
663
674
|
entry: ${JSON.stringify(remote.entry)},
|
|
664
675
|
}
|
|
665
676
|
`;
|
|
666
|
-
}).join(',')}
|
|
677
|
+
}).filter(x => x !== null).join(',')}
|
|
667
678
|
]
|
|
668
679
|
export {
|
|
669
680
|
usedShared,
|
package/lib/index.umd.js
CHANGED
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
29
29
|
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
30
30
|
|
|
31
|
+
function getFirstHtmlEntryFile(entryFiles) {
|
|
32
|
+
return entryFiles.find(function (file) {
|
|
33
|
+
return file.endsWith('.html');
|
|
34
|
+
});
|
|
35
|
+
}
|
|
31
36
|
var addEntry = function addEntry(_ref) {
|
|
32
37
|
var entryName = _ref.entryName,
|
|
33
38
|
entryPath = _ref.entryPath,
|
|
@@ -40,6 +45,12 @@
|
|
|
40
45
|
var _command;
|
|
41
46
|
var emitFileId;
|
|
42
47
|
var viteConfig;
|
|
48
|
+
function injectHtml() {
|
|
49
|
+
return inject === 'html' && htmlFilePath;
|
|
50
|
+
}
|
|
51
|
+
function injectEntry() {
|
|
52
|
+
return inject === 'entry' || !htmlFilePath;
|
|
53
|
+
}
|
|
43
54
|
return [{
|
|
44
55
|
name: 'add-entry',
|
|
45
56
|
apply: 'serve',
|
|
@@ -69,7 +80,7 @@
|
|
|
69
80
|
});
|
|
70
81
|
},
|
|
71
82
|
transformIndexHtml: function transformIndexHtml(c) {
|
|
72
|
-
if (
|
|
83
|
+
if (!injectHtml()) return;
|
|
73
84
|
return c.replace('<head>', "<head><script type=\"module\" src=" + JSON.stringify(devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/')) + "></script>");
|
|
74
85
|
}
|
|
75
86
|
}, {
|
|
@@ -82,13 +93,13 @@
|
|
|
82
93
|
htmlFilePath = path__namespace.resolve(config.root, 'index.html');
|
|
83
94
|
} else if (typeof inputOptions === 'string') {
|
|
84
95
|
entryFiles = [inputOptions];
|
|
85
|
-
htmlFilePath = path__namespace.resolve(config.root, inputOptions);
|
|
86
96
|
} else if (Array.isArray(inputOptions)) {
|
|
87
97
|
entryFiles = inputOptions;
|
|
88
|
-
htmlFilePath = path__namespace.resolve(config.root, inputOptions[0]);
|
|
89
98
|
} else if (typeof inputOptions === 'object') {
|
|
90
99
|
entryFiles = Object.values(inputOptions);
|
|
91
|
-
|
|
100
|
+
}
|
|
101
|
+
if (entryFiles && entryFiles.length > 0) {
|
|
102
|
+
htmlFilePath = getFirstHtmlEntryFile(entryFiles);
|
|
92
103
|
}
|
|
93
104
|
},
|
|
94
105
|
buildStart: function buildStart() {
|
|
@@ -114,7 +125,7 @@
|
|
|
114
125
|
}
|
|
115
126
|
},
|
|
116
127
|
generateBundle: function generateBundle(options, bundle) {
|
|
117
|
-
if (
|
|
128
|
+
if (!injectHtml()) return;
|
|
118
129
|
var file = this.getFileName(emitFileId);
|
|
119
130
|
var scriptContent = "\n <script type=\"module\" src=\"" + (viteConfig.base + file) + "\"></script>\n ";
|
|
120
131
|
for (var _fileName in bundle) {
|
|
@@ -128,7 +139,7 @@
|
|
|
128
139
|
}
|
|
129
140
|
},
|
|
130
141
|
transform: function transform(code, id) {
|
|
131
|
-
if (
|
|
142
|
+
if (injectEntry() && entryFiles.some(function (file) {
|
|
132
143
|
return id.endsWith(file);
|
|
133
144
|
})) {
|
|
134
145
|
var injection = "\n import " + JSON.stringify(entryPath) + ";\n ";
|
|
@@ -628,10 +639,16 @@
|
|
|
628
639
|
return "\n " + JSON.stringify(pkg) + ": async () => {\n let pkg = await import(\"" + getPreBuildLibImportId(pkg) + "\")\n return pkg\n }\n ";
|
|
629
640
|
}).join(',') + "\n }\n const usedShared = {\n " + Array.from(getUsedShares()).map(function (key) {
|
|
630
641
|
var shareItem = getNormalizeShareItem(key);
|
|
642
|
+
if (!shareItem) return null;
|
|
631
643
|
return "\n " + JSON.stringify(key) + ": {\n name: " + JSON.stringify(key) + ",\n version: " + JSON.stringify(shareItem.version) + ",\n scope: [" + JSON.stringify(shareItem.scope) + "],\n loaded: false,\n from: " + JSON.stringify(options.name) + ",\n async get () {\n usedShared[" + JSON.stringify(key) + "].loaded = true\n const {" + JSON.stringify(key) + ": pkgDynamicImport} = importMap \n const res = await pkgDynamicImport()\n const exportModule = {...res}\n // All npm packages pre-built by vite will be converted to esm\n Object.defineProperty(exportModule, \"__esModule\", {\n value: true,\n enumerable: false\n })\n return function () {\n return exportModule\n }\n },\n shareConfig: {\n singleton: " + shareItem.shareConfig.singleton + ",\n requiredVersion: " + JSON.stringify(shareItem.shareConfig.requiredVersion) + "\n }\n }\n ";
|
|
644
|
+
}).filter(function (x) {
|
|
645
|
+
return x !== null;
|
|
632
646
|
}).join(',') + "\n }\n const usedRemotes = [" + Object.keys(getUsedRemotesMap()).map(function (key) {
|
|
633
647
|
var remote = options.remotes[key];
|
|
648
|
+
if (!remote) return null;
|
|
634
649
|
return "\n {\n entryGlobalName: " + JSON.stringify(remote.entryGlobalName) + ",\n name: " + JSON.stringify(remote.name) + ",\n type: " + JSON.stringify(remote.type) + ",\n entry: " + JSON.stringify(remote.entry) + ",\n }\n ";
|
|
650
|
+
}).filter(function (x) {
|
|
651
|
+
return x !== null;
|
|
635
652
|
}).join(',') + "\n ]\n export {\n usedShared,\n usedRemotes\n }\n ";
|
|
636
653
|
}
|
|
637
654
|
var REMOTE_ENTRY_ID = 'virtual:mf-REMOTE_ENTRY_ID';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -46,13 +46,12 @@
|
|
|
46
46
|
"homepage": "https://github.com/module-federation/vite#readme",
|
|
47
47
|
"packageManager": "pnpm@9.1.3",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@module-federation/runtime": "^0.
|
|
49
|
+
"@module-federation/runtime": "^0.8.0",
|
|
50
50
|
"@rollup/pluginutils": "^5.1.0",
|
|
51
51
|
"defu": "^6.1.4",
|
|
52
52
|
"estree-walker": "^2",
|
|
53
53
|
"magic-string": "^0.30.11",
|
|
54
|
-
"pathe": "^1.1.2"
|
|
55
|
-
"vitest": "^2.1.1"
|
|
54
|
+
"pathe": "^1.1.2"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
57
|
"@playwright/test": "^1.47.2",
|
|
@@ -64,6 +63,7 @@
|
|
|
64
63
|
"pretty-quick": "^4.0.0",
|
|
65
64
|
"rimraf": "^6.0.1",
|
|
66
65
|
"vite": "^5.4.3",
|
|
66
|
+
"vitest": "^2.1.1",
|
|
67
67
|
"wait-on": "^8.0.1"
|
|
68
68
|
}
|
|
69
69
|
}
|