vite-plugin-mock-dev-server 0.3.17 → 0.3.18
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/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -39,11 +39,12 @@ var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
|
39
39
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
40
40
|
var import_esbuild = require("esbuild");
|
|
41
41
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
42
|
+
var import_is_core_module = __toESM(require("is-core-module"), 1);
|
|
42
43
|
var import_vite = require("vite");
|
|
43
44
|
|
|
44
45
|
// package.json
|
|
45
46
|
var name = "vite-plugin-mock-dev-server";
|
|
46
|
-
var version = "0.3.
|
|
47
|
+
var version = "0.3.18";
|
|
47
48
|
|
|
48
49
|
// src/esbuildPlugin.ts
|
|
49
50
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
@@ -184,7 +185,7 @@ function getMockDependencies(deps) {
|
|
|
184
185
|
Object.keys(deps).forEach((mPath) => {
|
|
185
186
|
const imports = deps[mPath].imports.filter((_) => _.external).map((_) => _.path);
|
|
186
187
|
imports.forEach((dep) => {
|
|
187
|
-
if (!excludeDeps.includes(dep)) {
|
|
188
|
+
if (!excludeDeps.includes(dep) && !(0, import_is_core_module.default)(dep)) {
|
|
188
189
|
list.add(dep);
|
|
189
190
|
}
|
|
190
191
|
});
|
|
@@ -216,7 +217,10 @@ function generatorServerEntryCode(proxy = {}, port = 8080) {
|
|
|
216
217
|
import { baseMiddleware } from 'vite-plugin-mock-dev-server'
|
|
217
218
|
import mockData from './mock-data.js'
|
|
218
219
|
const app = connect()
|
|
219
|
-
app.use(baseMiddleware(mockData, {
|
|
220
|
+
app.use(baseMiddleware(mockData, {
|
|
221
|
+
formidableOptions: { multiples: true },
|
|
222
|
+
proxies: ${JSON.stringify(proxies)}
|
|
223
|
+
}))
|
|
220
224
|
app.listen(${port})
|
|
221
225
|
console.log('listen: http://localhost:${port}')
|
|
222
226
|
`;
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,12 @@ import fsp2 from "fs/promises";
|
|
|
4
4
|
import path3 from "path";
|
|
5
5
|
import { build } from "esbuild";
|
|
6
6
|
import fg from "fast-glob";
|
|
7
|
+
import isCore from "is-core-module";
|
|
7
8
|
import { createFilter } from "vite";
|
|
8
9
|
|
|
9
10
|
// package.json
|
|
10
11
|
var name = "vite-plugin-mock-dev-server";
|
|
11
|
-
var version = "0.3.
|
|
12
|
+
var version = "0.3.18";
|
|
12
13
|
|
|
13
14
|
// src/esbuildPlugin.ts
|
|
14
15
|
import fsp from "fs/promises";
|
|
@@ -149,7 +150,7 @@ function getMockDependencies(deps) {
|
|
|
149
150
|
Object.keys(deps).forEach((mPath) => {
|
|
150
151
|
const imports = deps[mPath].imports.filter((_) => _.external).map((_) => _.path);
|
|
151
152
|
imports.forEach((dep) => {
|
|
152
|
-
if (!excludeDeps.includes(dep)) {
|
|
153
|
+
if (!excludeDeps.includes(dep) && !isCore(dep)) {
|
|
153
154
|
list.add(dep);
|
|
154
155
|
}
|
|
155
156
|
});
|
|
@@ -181,7 +182,10 @@ function generatorServerEntryCode(proxy = {}, port = 8080) {
|
|
|
181
182
|
import { baseMiddleware } from 'vite-plugin-mock-dev-server'
|
|
182
183
|
import mockData from './mock-data.js'
|
|
183
184
|
const app = connect()
|
|
184
|
-
app.use(baseMiddleware(mockData, {
|
|
185
|
+
app.use(baseMiddleware(mockData, {
|
|
186
|
+
formidableOptions: { multiples: true },
|
|
187
|
+
proxies: ${JSON.stringify(proxies)}
|
|
188
|
+
}))
|
|
185
189
|
app.listen(${port})
|
|
186
190
|
console.log('listen: http://localhost:${port}')
|
|
187
191
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-mock-dev-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"vite",
|
|
6
6
|
"plugin",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"esbuild": "^0.16.9",
|
|
37
37
|
"fast-glob": "^3.2.12",
|
|
38
38
|
"formidable": "^2.1.1",
|
|
39
|
+
"is-core-module": "^2.11.0",
|
|
39
40
|
"json5": "^2.2.2",
|
|
40
41
|
"path-to-regexp": "^6.2.1"
|
|
41
42
|
},
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"@types/co-body": "^6.1.0",
|
|
46
47
|
"@types/debug": "^4.1.7",
|
|
47
48
|
"@types/formidable": "^2.0.5",
|
|
49
|
+
"@types/is-core-module": "^2.2.0",
|
|
48
50
|
"@types/node": "^18.11.7",
|
|
49
51
|
"bumpp": "^8.2.1",
|
|
50
52
|
"conventional-changelog-cli": "^2.2.2",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"scripts": {
|
|
81
83
|
"build": "tsup",
|
|
82
84
|
"dev": "DEBUG=vite:plugin-mock-dev-server vite example --config ./example/vite.config.ts",
|
|
85
|
+
"example:build": "DEBUG=vite:plugin-mock-dev-server vite build example --config ./example/vite.config.ts",
|
|
83
86
|
"docs:build": "vitepress build docs",
|
|
84
87
|
"docs:dev": "vitepress dev docs",
|
|
85
88
|
"docs:preview": "vitepress preview docs",
|