@module-federation/vite 1.0.0-alpha-4a73cd4 → 1.0.0-alpha-def937d

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 CHANGED
@@ -299,7 +299,8 @@ function generateRemoteEntry(options) {
299
299
  return item[0] + "()";
300
300
  }).join(', ') + "]\n });\n initRes.initShareScopeMap('" + options.shareScope + "', shared);\n return initRes\n }\n\n function getExposes(moduleName) {\n if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)\n return (exposesMap[moduleName])().then(res => () => res)\n }\n export {\n init,\n getExposes as get\n }\n ";
301
301
  }
302
- var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?__mf__wrapRemoteEntry__';
302
+ var WRAP_REMOTE_ENTRY_QUERY_STR = "__mf__wrapRemoteEntry__";
303
+ var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?' + WRAP_REMOTE_ENTRY_QUERY_STR;
303
304
  function generateWrapRemoteEntry() {
304
305
  return "\n import {init, get} from \"" + REMOTE_ENTRY_ID + "\"\n export {init, get}\n ";
305
306
  }
@@ -307,7 +308,8 @@ function generateWrapRemoteEntry() {
307
308
  * Inject entry file, automatically init when used as host,
308
309
  * and will not inject remoteEntry
309
310
  */
310
- var HOST_AUTO_INIT = emptyPath + '?__mf__isHostInit';
311
+ var HOST_AUTO_INIT_QUERY_STR = "__mf__isHostInit";
312
+ var HOST_AUTO_INIT_PATH = emptyPath + '?' + HOST_AUTO_INIT_QUERY_STR;
311
313
  function generateWrapHostInit() {
312
314
  return "\n import {init} from \"" + REMOTE_ENTRY_ID + "\"\n init()\n ";
313
315
  }
@@ -330,13 +332,13 @@ function pluginProxyRemoteEntry () {
330
332
  transform: function transform(code, id) {
331
333
  try {
332
334
  if (!filter$1(id)) return Promise.resolve();
333
- if (id === REMOTE_ENTRY_ID) {
335
+ if (id.includes(REMOTE_ENTRY_ID)) {
334
336
  return Promise.resolve(generateRemoteEntry(getNormalizeModuleFederationOptions()));
335
337
  }
336
- if (id.includes(WRAP_REMOTE_ENTRY_PATH)) {
338
+ if (id.includes(WRAP_REMOTE_ENTRY_QUERY_STR)) {
337
339
  return Promise.resolve(generateWrapRemoteEntry());
338
340
  }
339
- if (id.includes(HOST_AUTO_INIT)) {
341
+ if (id.includes(HOST_AUTO_INIT_QUERY_STR)) {
340
342
  return Promise.resolve(generateWrapHostInit());
341
343
  }
342
344
  return Promise.resolve();
@@ -591,7 +593,7 @@ function federation(mfUserOptions) {
591
593
  fileName: filename
592
594
  }), addEntry({
593
595
  entryName: 'hostInit',
594
- entryPath: HOST_AUTO_INIT
596
+ entryPath: HOST_AUTO_INIT_PATH
595
597
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], proxySharedModule({
596
598
  shared: shared
597
599
  }), [{
package/lib/index.esm.js CHANGED
@@ -277,7 +277,8 @@ function generateRemoteEntry(options) {
277
277
  return item[0] + "()";
278
278
  }).join(', ') + "]\n });\n initRes.initShareScopeMap('" + options.shareScope + "', shared);\n return initRes\n }\n\n function getExposes(moduleName) {\n if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)\n return (exposesMap[moduleName])().then(res => () => res)\n }\n export {\n init,\n getExposes as get\n }\n ";
279
279
  }
280
- var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?__mf__wrapRemoteEntry__';
280
+ var WRAP_REMOTE_ENTRY_QUERY_STR = "__mf__wrapRemoteEntry__";
281
+ var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?' + WRAP_REMOTE_ENTRY_QUERY_STR;
281
282
  function generateWrapRemoteEntry() {
282
283
  return "\n import {init, get} from \"" + REMOTE_ENTRY_ID + "\"\n export {init, get}\n ";
283
284
  }
@@ -285,7 +286,8 @@ function generateWrapRemoteEntry() {
285
286
  * Inject entry file, automatically init when used as host,
286
287
  * and will not inject remoteEntry
287
288
  */
288
- var HOST_AUTO_INIT = emptyPath + '?__mf__isHostInit';
289
+ var HOST_AUTO_INIT_QUERY_STR = "__mf__isHostInit";
290
+ var HOST_AUTO_INIT_PATH = emptyPath + '?' + HOST_AUTO_INIT_QUERY_STR;
289
291
  function generateWrapHostInit() {
290
292
  return "\n import {init} from \"" + REMOTE_ENTRY_ID + "\"\n init()\n ";
291
293
  }
@@ -308,13 +310,13 @@ function pluginProxyRemoteEntry () {
308
310
  transform: function transform(code, id) {
309
311
  try {
310
312
  if (!filter$1(id)) return Promise.resolve();
311
- if (id === REMOTE_ENTRY_ID) {
313
+ if (id.includes(REMOTE_ENTRY_ID)) {
312
314
  return Promise.resolve(generateRemoteEntry(getNormalizeModuleFederationOptions()));
313
315
  }
314
- if (id.includes(WRAP_REMOTE_ENTRY_PATH)) {
316
+ if (id.includes(WRAP_REMOTE_ENTRY_QUERY_STR)) {
315
317
  return Promise.resolve(generateWrapRemoteEntry());
316
318
  }
317
- if (id.includes(HOST_AUTO_INIT)) {
319
+ if (id.includes(HOST_AUTO_INIT_QUERY_STR)) {
318
320
  return Promise.resolve(generateWrapHostInit());
319
321
  }
320
322
  return Promise.resolve();
@@ -569,7 +571,7 @@ function federation(mfUserOptions) {
569
571
  fileName: filename
570
572
  }), addEntry({
571
573
  entryName: 'hostInit',
572
- entryPath: HOST_AUTO_INIT
574
+ entryPath: HOST_AUTO_INIT_PATH
573
575
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], proxySharedModule({
574
576
  shared: shared
575
577
  }), [{
@@ -367,7 +367,8 @@ function generateRemoteEntry(options) {
367
367
  }
368
368
  `;
369
369
  }
370
- const WRAP_REMOTE_ENTRY_PATH = emptyPath + '?__mf__wrapRemoteEntry__';
370
+ const WRAP_REMOTE_ENTRY_QUERY_STR = "__mf__wrapRemoteEntry__";
371
+ const WRAP_REMOTE_ENTRY_PATH = emptyPath + '?' + WRAP_REMOTE_ENTRY_QUERY_STR;
371
372
  function generateWrapRemoteEntry() {
372
373
  return `
373
374
  import {init, get} from "${REMOTE_ENTRY_ID}"
@@ -378,7 +379,8 @@ function generateWrapRemoteEntry() {
378
379
  * Inject entry file, automatically init when used as host,
379
380
  * and will not inject remoteEntry
380
381
  */
381
- const HOST_AUTO_INIT = emptyPath + '?__mf__isHostInit';
382
+ const HOST_AUTO_INIT_QUERY_STR = "__mf__isHostInit";
383
+ const HOST_AUTO_INIT_PATH = emptyPath + '?' + HOST_AUTO_INIT_QUERY_STR;
382
384
  function generateWrapHostInit() {
383
385
  return `
384
386
  import {init} from "${REMOTE_ENTRY_ID}"
@@ -403,13 +405,13 @@ function pluginProxyRemoteEntry () {
403
405
  },
404
406
  async transform(code, id) {
405
407
  if (!filter$1(id)) return;
406
- if (id === REMOTE_ENTRY_ID) {
408
+ if (id.includes(REMOTE_ENTRY_ID)) {
407
409
  return generateRemoteEntry(getNormalizeModuleFederationOptions());
408
410
  }
409
- if (id.includes(WRAP_REMOTE_ENTRY_PATH)) {
411
+ if (id.includes(WRAP_REMOTE_ENTRY_QUERY_STR)) {
410
412
  return generateWrapRemoteEntry();
411
413
  }
412
- if (id.includes(HOST_AUTO_INIT)) {
414
+ if (id.includes(HOST_AUTO_INIT_QUERY_STR)) {
413
415
  return generateWrapHostInit();
414
416
  }
415
417
  }
@@ -677,7 +679,7 @@ function federation(mfUserOptions) {
677
679
  fileName: filename
678
680
  }), ...addEntry({
679
681
  entryName: 'hostInit',
680
- entryPath: HOST_AUTO_INIT
682
+ entryPath: HOST_AUTO_INIT_PATH
681
683
  }), pluginProxyRemoteEntry(), pluginProxyRemotes(options), ...proxySharedModule({
682
684
  shared
683
685
  }), {
package/lib/index.umd.js CHANGED
@@ -298,7 +298,8 @@
298
298
  return item[0] + "()";
299
299
  }).join(', ') + "]\n });\n initRes.initShareScopeMap('" + options.shareScope + "', shared);\n return initRes\n }\n\n function getExposes(moduleName) {\n if (!(moduleName in exposesMap)) throw new Error(`Module ${moduleName} does not exist in container.`)\n return (exposesMap[moduleName])().then(res => () => res)\n }\n export {\n init,\n getExposes as get\n }\n ";
300
300
  }
301
- var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?__mf__wrapRemoteEntry__';
301
+ var WRAP_REMOTE_ENTRY_QUERY_STR = "__mf__wrapRemoteEntry__";
302
+ var WRAP_REMOTE_ENTRY_PATH = emptyPath + '?' + WRAP_REMOTE_ENTRY_QUERY_STR;
302
303
  function generateWrapRemoteEntry() {
303
304
  return "\n import {init, get} from \"" + REMOTE_ENTRY_ID + "\"\n export {init, get}\n ";
304
305
  }
@@ -306,7 +307,8 @@
306
307
  * Inject entry file, automatically init when used as host,
307
308
  * and will not inject remoteEntry
308
309
  */
309
- var HOST_AUTO_INIT = emptyPath + '?__mf__isHostInit';
310
+ var HOST_AUTO_INIT_QUERY_STR = "__mf__isHostInit";
311
+ var HOST_AUTO_INIT_PATH = emptyPath + '?' + HOST_AUTO_INIT_QUERY_STR;
310
312
  function generateWrapHostInit() {
311
313
  return "\n import {init} from \"" + REMOTE_ENTRY_ID + "\"\n init()\n ";
312
314
  }
@@ -329,13 +331,13 @@
329
331
  transform: function transform(code, id) {
330
332
  try {
331
333
  if (!filter$1(id)) return Promise.resolve();
332
- if (id === REMOTE_ENTRY_ID) {
334
+ if (id.includes(REMOTE_ENTRY_ID)) {
333
335
  return Promise.resolve(generateRemoteEntry(getNormalizeModuleFederationOptions()));
334
336
  }
335
- if (id.includes(WRAP_REMOTE_ENTRY_PATH)) {
337
+ if (id.includes(WRAP_REMOTE_ENTRY_QUERY_STR)) {
336
338
  return Promise.resolve(generateWrapRemoteEntry());
337
339
  }
338
- if (id.includes(HOST_AUTO_INIT)) {
340
+ if (id.includes(HOST_AUTO_INIT_QUERY_STR)) {
339
341
  return Promise.resolve(generateWrapHostInit());
340
342
  }
341
343
  return Promise.resolve();
@@ -590,7 +592,7 @@
590
592
  fileName: filename
591
593
  }), addEntry({
592
594
  entryName: 'hostInit',
593
- entryPath: HOST_AUTO_INIT
595
+ entryPath: HOST_AUTO_INIT_PATH
594
596
  }), [pluginProxyRemoteEntry(), pluginProxyRemotes(options)], proxySharedModule({
595
597
  shared: shared
596
598
  }), [{
@@ -1,11 +1,13 @@
1
1
  import { NormalizedModuleFederationOptions } from "../utils/normalizeModuleFederationOptions";
2
2
  export declare const REMOTE_ENTRY_ID = "REMOTE_ENTRY_ID";
3
3
  export declare function generateRemoteEntry(options: NormalizedModuleFederationOptions): string;
4
+ export declare const WRAP_REMOTE_ENTRY_QUERY_STR = "__mf__wrapRemoteEntry__";
4
5
  export declare const WRAP_REMOTE_ENTRY_PATH: string;
5
6
  export declare function generateWrapRemoteEntry(): string;
6
7
  /**
7
8
  * Inject entry file, automatically init when used as host,
8
9
  * and will not inject remoteEntry
9
10
  */
10
- export declare const HOST_AUTO_INIT: string;
11
+ export declare const HOST_AUTO_INIT_QUERY_STR = "__mf__isHostInit";
12
+ export declare const HOST_AUTO_INIT_PATH: string;
11
13
  export declare function generateWrapHostInit(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/vite",
3
- "version": "1.0.0-alpha-4a73cd4",
3
+ "version": "1.0.0-alpha-def937d",
4
4
  "description": "Vite plugin for Module Federation",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
@@ -38,19 +38,19 @@
38
38
  "homepage": "https://github.com/module-federation/vite#readme",
39
39
  "packageManager": "pnpm@9.1.3",
40
40
  "dependencies": {
41
- "@module-federation/runtime": "^0.2.8",
41
+ "@module-federation/runtime": "^0.3.5",
42
42
  "@rollup/pluginutils": "^5.1.0",
43
43
  "an-empty-js-file": "1.0.0",
44
44
  "estree-walker": "^2",
45
- "magic-string": "^0.30.10",
45
+ "magic-string": "^0.30.11",
46
46
  "pathe": "^1.1.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "husky": "^8.0.3",
50
50
  "microbundle": "^0.15.1",
51
51
  "mime-types": "^2.1.35",
52
- "pretty-quick": "^3.1.3",
53
- "rimraf": "^5.0.1",
54
- "vite": "^4.4.9"
52
+ "pretty-quick": "^4.0.0",
53
+ "rimraf": "^6.0.1",
54
+ "vite": "^5.4.0"
55
55
  }
56
56
  }