@module-federation/vite 1.0.0-alpha-f87d7d3 → 1.0.0-alpha-661e052
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 +16 -3
- package/lib/index.esm.js +18 -5
- package/lib/index.modern.js +15 -5
- package/lib/index.umd.js +16 -3
- package/package.json +4 -4
package/lib/index.cjs
CHANGED
|
@@ -309,11 +309,24 @@ function removePathFromNpmPackage(packageString) {
|
|
|
309
309
|
return match ? match[0] : packageString;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
var nodeModulesDir =
|
|
312
|
+
var nodeModulesDir = function findNodeModulesDir(startDir) {
|
|
313
|
+
if (startDir === void 0) {
|
|
314
|
+
startDir = process.cwd();
|
|
315
|
+
}
|
|
316
|
+
var currentDir = startDir;
|
|
317
|
+
while (currentDir !== path.parse(currentDir).root) {
|
|
318
|
+
var nodeModulesPath = path.join(currentDir, 'node_modules');
|
|
319
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
320
|
+
return nodeModulesPath;
|
|
321
|
+
}
|
|
322
|
+
currentDir = path.dirname(currentDir);
|
|
323
|
+
}
|
|
324
|
+
return "";
|
|
325
|
+
}();
|
|
313
326
|
var virtualPackageName = "__mf__virtual";
|
|
314
|
-
|
|
327
|
+
if (!fs.existsSync(path.resolve(nodeModulesDir, virtualPackageName))) {
|
|
315
328
|
fs.mkdirSync(path.resolve(nodeModulesDir, virtualPackageName));
|
|
316
|
-
}
|
|
329
|
+
}
|
|
317
330
|
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, "empty.js"), "");
|
|
318
331
|
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, "package.json"), JSON.stringify({
|
|
319
332
|
name: virtualPackageName,
|
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import { mkdirSync, writeFileSync, writeFile } from 'fs';
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync, writeFile } from 'fs';
|
|
3
3
|
import * as path from 'pathe';
|
|
4
|
-
import { resolve } from 'pathe';
|
|
4
|
+
import { parse, join, dirname, resolve } from 'pathe';
|
|
5
5
|
import { createFilter } from '@rollup/pluginutils';
|
|
6
6
|
import { defu } from 'defu';
|
|
7
7
|
import { walk } from 'estree-walker';
|
|
@@ -287,11 +287,24 @@ function removePathFromNpmPackage(packageString) {
|
|
|
287
287
|
return match ? match[0] : packageString;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
var nodeModulesDir =
|
|
290
|
+
var nodeModulesDir = function findNodeModulesDir(startDir) {
|
|
291
|
+
if (startDir === void 0) {
|
|
292
|
+
startDir = process.cwd();
|
|
293
|
+
}
|
|
294
|
+
var currentDir = startDir;
|
|
295
|
+
while (currentDir !== parse(currentDir).root) {
|
|
296
|
+
var nodeModulesPath = join(currentDir, 'node_modules');
|
|
297
|
+
if (existsSync(nodeModulesPath)) {
|
|
298
|
+
return nodeModulesPath;
|
|
299
|
+
}
|
|
300
|
+
currentDir = dirname(currentDir);
|
|
301
|
+
}
|
|
302
|
+
return "";
|
|
303
|
+
}();
|
|
291
304
|
var virtualPackageName = "__mf__virtual";
|
|
292
|
-
|
|
305
|
+
if (!existsSync(resolve(nodeModulesDir, virtualPackageName))) {
|
|
293
306
|
mkdirSync(resolve(nodeModulesDir, virtualPackageName));
|
|
294
|
-
}
|
|
307
|
+
}
|
|
295
308
|
writeFileSync(resolve(nodeModulesDir, virtualPackageName, "empty.js"), "");
|
|
296
309
|
writeFileSync(resolve(nodeModulesDir, virtualPackageName, "package.json"), JSON.stringify({
|
|
297
310
|
name: virtualPackageName,
|
package/lib/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import { mkdirSync, writeFileSync, writeFile } from 'fs';
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync, writeFile } from 'fs';
|
|
3
3
|
import * as path from 'pathe';
|
|
4
|
-
import { resolve } from 'pathe';
|
|
4
|
+
import { parse, join, dirname, resolve } from 'pathe';
|
|
5
5
|
import { createFilter } from '@rollup/pluginutils';
|
|
6
6
|
import { defu } from 'defu';
|
|
7
7
|
import { walk } from 'estree-walker';
|
|
@@ -292,11 +292,21 @@ function removePathFromNpmPackage(packageString) {
|
|
|
292
292
|
return match ? match[0] : packageString;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
const nodeModulesDir =
|
|
295
|
+
const nodeModulesDir = function findNodeModulesDir(startDir = process.cwd()) {
|
|
296
|
+
let currentDir = startDir;
|
|
297
|
+
while (currentDir !== parse(currentDir).root) {
|
|
298
|
+
const nodeModulesPath = join(currentDir, 'node_modules');
|
|
299
|
+
if (existsSync(nodeModulesPath)) {
|
|
300
|
+
return nodeModulesPath;
|
|
301
|
+
}
|
|
302
|
+
currentDir = dirname(currentDir);
|
|
303
|
+
}
|
|
304
|
+
return "";
|
|
305
|
+
}();
|
|
296
306
|
const virtualPackageName = "__mf__virtual";
|
|
297
|
-
|
|
307
|
+
if (!existsSync(resolve(nodeModulesDir, virtualPackageName))) {
|
|
298
308
|
mkdirSync(resolve(nodeModulesDir, virtualPackageName));
|
|
299
|
-
}
|
|
309
|
+
}
|
|
300
310
|
writeFileSync(resolve(nodeModulesDir, virtualPackageName, "empty.js"), "");
|
|
301
311
|
writeFileSync(resolve(nodeModulesDir, virtualPackageName, "package.json"), JSON.stringify({
|
|
302
312
|
name: virtualPackageName,
|
package/lib/index.umd.js
CHANGED
|
@@ -307,11 +307,24 @@
|
|
|
307
307
|
return match ? match[0] : packageString;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
var nodeModulesDir =
|
|
310
|
+
var nodeModulesDir = function findNodeModulesDir(startDir) {
|
|
311
|
+
if (startDir === void 0) {
|
|
312
|
+
startDir = process.cwd();
|
|
313
|
+
}
|
|
314
|
+
var currentDir = startDir;
|
|
315
|
+
while (currentDir !== path.parse(currentDir).root) {
|
|
316
|
+
var nodeModulesPath = path.join(currentDir, 'node_modules');
|
|
317
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
318
|
+
return nodeModulesPath;
|
|
319
|
+
}
|
|
320
|
+
currentDir = path.dirname(currentDir);
|
|
321
|
+
}
|
|
322
|
+
return "";
|
|
323
|
+
}();
|
|
311
324
|
var virtualPackageName = "__mf__virtual";
|
|
312
|
-
|
|
325
|
+
if (!fs.existsSync(path.resolve(nodeModulesDir, virtualPackageName))) {
|
|
313
326
|
fs.mkdirSync(path.resolve(nodeModulesDir, virtualPackageName));
|
|
314
|
-
}
|
|
327
|
+
}
|
|
315
328
|
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, "empty.js"), "");
|
|
316
329
|
fs.writeFileSync(path.resolve(nodeModulesDir, virtualPackageName, "package.json"), JSON.stringify({
|
|
317
330
|
name: virtualPackageName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/vite",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-661e052",
|
|
4
4
|
"description": "Vite plugin for Module Federation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"format": "pretty-quick",
|
|
15
15
|
"dev": "microbundle watch",
|
|
16
16
|
"build": "rimraf lib && microbundle --no-sourcemap --compress=false",
|
|
17
|
-
"dev-
|
|
18
|
-
"dev-
|
|
19
|
-
"preview-
|
|
17
|
+
"dev-rv": "pnpm -filter 'examples-rust-vite*' run dev",
|
|
18
|
+
"dev-vv": "pnpm -filter 'examples-vite-vite*' run dev",
|
|
19
|
+
"preview-vv": "pnpm -filter 'examples-vite-vite*' run preview"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|