vite 4.3.0-beta.0 → 4.3.0-beta.2
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/dist/client/client.mjs +41 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-7f82b32e.js → dep-281af434.js} +4111 -3892
- package/dist/node/chunks/{dep-be7bf3d1.js → dep-3b7a7ba2.js} +1 -1
- package/dist/node/cli.js +8 -8
- package/dist/node/index.d.ts +30 -10
- package/dist/node/index.js +6 -5
- package/dist/node-cjs/publicUtils.cjs +147 -212
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import require$$0__default from 'fs';
|
|
2
2
|
import require$$0 from 'postcss';
|
|
3
|
-
import {
|
|
3
|
+
import { D as commonjsGlobal } from './dep-281af434.js';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
5
5
|
import require$$5 from 'crypto';
|
|
6
6
|
import require$$0$2 from 'util';
|
package/dist/node/cli.js
CHANGED
|
@@ -2,8 +2,9 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
|
-
import {
|
|
5
|
+
import { B as picocolorsExports, C as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-281af434.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
|
+
import 'node:fs/promises';
|
|
7
8
|
import 'node:url';
|
|
8
9
|
import 'node:module';
|
|
9
10
|
import 'tty';
|
|
@@ -19,13 +20,13 @@ import 'stream';
|
|
|
19
20
|
import 'os';
|
|
20
21
|
import 'child_process';
|
|
21
22
|
import 'node:os';
|
|
23
|
+
import 'node:child_process';
|
|
22
24
|
import 'node:crypto';
|
|
23
|
-
import 'node:util';
|
|
24
25
|
import 'node:dns';
|
|
25
26
|
import 'resolve';
|
|
26
27
|
import 'crypto';
|
|
27
28
|
import 'node:buffer';
|
|
28
|
-
import 'node:
|
|
29
|
+
import 'node:util';
|
|
29
30
|
import 'module';
|
|
30
31
|
import 'node:assert';
|
|
31
32
|
import 'node:process';
|
|
@@ -40,7 +41,6 @@ import 'node:https';
|
|
|
40
41
|
import 'rollup';
|
|
41
42
|
import 'querystring';
|
|
42
43
|
import 'node:readline';
|
|
43
|
-
import 'node:child_process';
|
|
44
44
|
import 'node:zlib';
|
|
45
45
|
|
|
46
46
|
function toArr(any) {
|
|
@@ -729,7 +729,7 @@ cli
|
|
|
729
729
|
filterDuplicateOptions(options);
|
|
730
730
|
// output structure is preserved even after bundling so require()
|
|
731
731
|
// is ok here
|
|
732
|
-
const { createServer } = await import('./chunks/dep-
|
|
732
|
+
const { createServer } = await import('./chunks/dep-281af434.js').then(function (n) { return n.G; });
|
|
733
733
|
try {
|
|
734
734
|
const server = await createServer({
|
|
735
735
|
root,
|
|
@@ -807,7 +807,7 @@ cli
|
|
|
807
807
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
808
808
|
.action(async (root, options) => {
|
|
809
809
|
filterDuplicateOptions(options);
|
|
810
|
-
const { build } = await import('./chunks/dep-
|
|
810
|
+
const { build } = await import('./chunks/dep-281af434.js').then(function (n) { return n.F; });
|
|
811
811
|
const buildOptions = cleanOptions(options);
|
|
812
812
|
try {
|
|
813
813
|
await build({
|
|
@@ -835,7 +835,7 @@ cli
|
|
|
835
835
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
836
836
|
.action(async (root, options) => {
|
|
837
837
|
filterDuplicateOptions(options);
|
|
838
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
838
|
+
const { optimizeDeps } = await import('./chunks/dep-281af434.js').then(function (n) { return n.E; });
|
|
839
839
|
try {
|
|
840
840
|
const config = await resolveConfig({
|
|
841
841
|
root,
|
|
@@ -860,7 +860,7 @@ cli
|
|
|
860
860
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
861
861
|
.action(async (root, options) => {
|
|
862
862
|
filterDuplicateOptions(options);
|
|
863
|
-
const { preview } = await import('./chunks/dep-
|
|
863
|
+
const { preview } = await import('./chunks/dep-281af434.js').then(function (n) { return n.H; });
|
|
864
864
|
try {
|
|
865
865
|
const server = await preview({
|
|
866
866
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -680,6 +680,7 @@ export declare interface DepsOptimizer {
|
|
|
680
680
|
ensureFirstRun: () => void;
|
|
681
681
|
close: () => Promise<void>;
|
|
682
682
|
options: DepOptimizationOptions;
|
|
683
|
+
server?: ViteDevServer;
|
|
683
684
|
}
|
|
684
685
|
|
|
685
686
|
export { ErrorPayload }
|
|
@@ -736,8 +737,6 @@ export declare interface ExperimentalOptions {
|
|
|
736
737
|
export declare type ExportsData = {
|
|
737
738
|
hasImports: boolean;
|
|
738
739
|
exports: readonly string[];
|
|
739
|
-
facade: boolean;
|
|
740
|
-
hasReExports?: boolean;
|
|
741
740
|
jsxLoader?: boolean;
|
|
742
741
|
};
|
|
743
742
|
|
|
@@ -1316,6 +1315,8 @@ export declare class ModuleGraph {
|
|
|
1316
1315
|
idToModuleMap: Map<string, ModuleNode>;
|
|
1317
1316
|
fileToModulesMap: Map<string, Set<ModuleNode>>;
|
|
1318
1317
|
safeModulesPath: Set<string>;
|
|
1318
|
+
/* Excluded from this release type: _unresolvedUrlToModuleMap */
|
|
1319
|
+
/* Excluded from this release type: _ssrUnresolvedUrlToModuleMap */
|
|
1319
1320
|
constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
|
|
1320
1321
|
getModuleByUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode | undefined>;
|
|
1321
1322
|
getModuleById(id: string): ModuleNode | undefined;
|
|
@@ -1330,8 +1331,12 @@ export declare class ModuleGraph {
|
|
|
1330
1331
|
*/
|
|
1331
1332
|
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
|
|
1332
1333
|
ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
|
1334
|
+
/* Excluded from this release type: _ensureEntryFromUrl */
|
|
1333
1335
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
1334
1336
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
1337
|
+
/* Excluded from this release type: _getUnresolvedUrlToModule */
|
|
1338
|
+
/* Excluded from this release type: _setUnresolvedUrlToModule */
|
|
1339
|
+
/* Excluded from this release type: _resolveUrl */
|
|
1335
1340
|
}
|
|
1336
1341
|
|
|
1337
1342
|
export declare class ModuleNode {
|
|
@@ -1493,8 +1498,9 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1493
1498
|
*/
|
|
1494
1499
|
configureServer?: ObjectHook<ServerHook>;
|
|
1495
1500
|
/**
|
|
1496
|
-
* Configure the preview server. The hook receives the
|
|
1497
|
-
*
|
|
1501
|
+
* Configure the preview server. The hook receives the {@link PreviewServerForHook}
|
|
1502
|
+
* instance. This can also be used to store a reference to the server
|
|
1503
|
+
* for use in other hooks.
|
|
1498
1504
|
*
|
|
1499
1505
|
* The hooks are called before other middlewares are applied. A hook can
|
|
1500
1506
|
* return a post hook that will be called after other middlewares are
|
|
@@ -1601,11 +1607,24 @@ export declare function preview(inlineConfig?: InlineConfig): Promise<PreviewSer
|
|
|
1601
1607
|
export declare interface PreviewOptions extends CommonServerOptions {
|
|
1602
1608
|
}
|
|
1603
1609
|
|
|
1604
|
-
export declare interface PreviewServer {
|
|
1610
|
+
export declare interface PreviewServer extends PreviewServerForHook {
|
|
1611
|
+
resolvedUrls: ResolvedServerUrls;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
export declare interface PreviewServerForHook {
|
|
1605
1615
|
/**
|
|
1606
1616
|
* The resolved vite config object
|
|
1607
1617
|
*/
|
|
1608
1618
|
config: ResolvedConfig;
|
|
1619
|
+
/**
|
|
1620
|
+
* A connect app instance.
|
|
1621
|
+
* - Can be used to attach custom middlewares to the preview server.
|
|
1622
|
+
* - Can also be used as the handler function of a custom http server
|
|
1623
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
1624
|
+
*
|
|
1625
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
1626
|
+
*/
|
|
1627
|
+
middlewares: Connect.Server;
|
|
1609
1628
|
/**
|
|
1610
1629
|
* native Node http server instance
|
|
1611
1630
|
*/
|
|
@@ -1613,17 +1632,14 @@ export declare interface PreviewServer {
|
|
|
1613
1632
|
/**
|
|
1614
1633
|
* The resolved urls Vite prints on the CLI
|
|
1615
1634
|
*/
|
|
1616
|
-
resolvedUrls: ResolvedServerUrls;
|
|
1635
|
+
resolvedUrls: ResolvedServerUrls | null;
|
|
1617
1636
|
/**
|
|
1618
1637
|
* Print server urls
|
|
1619
1638
|
*/
|
|
1620
1639
|
printUrls(): void;
|
|
1621
1640
|
}
|
|
1622
1641
|
|
|
1623
|
-
export declare type PreviewServerHook = (this: void, server:
|
|
1624
|
-
middlewares: Connect.Server;
|
|
1625
|
-
httpServer: http.Server;
|
|
1626
|
-
}) => (() => void) | void | Promise<(() => void) | void>;
|
|
1642
|
+
export declare type PreviewServerHook = (this: void, server: PreviewServerForHook) => (() => void) | void | Promise<(() => void) | void>;
|
|
1627
1643
|
|
|
1628
1644
|
export declare interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
1629
1645
|
/**
|
|
@@ -3303,6 +3319,10 @@ export declare interface WebSocketClient {
|
|
|
3303
3319
|
export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
|
3304
3320
|
|
|
3305
3321
|
export declare interface WebSocketServer {
|
|
3322
|
+
/**
|
|
3323
|
+
* Listen on port and host
|
|
3324
|
+
*/
|
|
3325
|
+
listen(): void;
|
|
3306
3326
|
/**
|
|
3307
3327
|
* Get all connected clients.
|
|
3308
3328
|
*/
|
package/dist/node/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as isInNodeModules } from './chunks/dep-281af434.js';
|
|
2
|
+
export { b as build, e as buildErrorMessage, v as createFilter, x as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, k as getDepOptimizationConfig, m as isDepsOptimizerEnabled, l as loadConfigFromFile, z as loadEnv, u as mergeAlias, q as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, j as resolveBaseUrl, h as resolveConfig, A as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-281af434.js';
|
|
2
3
|
export { VERSION as version } from './constants.js';
|
|
3
4
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
5
|
export { VERSION as rollupVersion } from 'rollup';
|
|
5
6
|
import 'node:fs';
|
|
7
|
+
import 'node:fs/promises';
|
|
6
8
|
import 'node:path';
|
|
7
9
|
import 'node:url';
|
|
8
10
|
import 'node:perf_hooks';
|
|
@@ -20,13 +22,13 @@ import 'stream';
|
|
|
20
22
|
import 'os';
|
|
21
23
|
import 'child_process';
|
|
22
24
|
import 'node:os';
|
|
25
|
+
import 'node:child_process';
|
|
23
26
|
import 'node:crypto';
|
|
24
|
-
import 'node:util';
|
|
25
27
|
import 'node:dns';
|
|
26
28
|
import 'resolve';
|
|
27
29
|
import 'crypto';
|
|
28
30
|
import 'node:buffer';
|
|
29
|
-
import 'node:
|
|
31
|
+
import 'node:util';
|
|
30
32
|
import 'module';
|
|
31
33
|
import 'node:assert';
|
|
32
34
|
import 'node:process';
|
|
@@ -40,7 +42,6 @@ import 'node:http';
|
|
|
40
42
|
import 'node:https';
|
|
41
43
|
import 'querystring';
|
|
42
44
|
import 'node:readline';
|
|
43
|
-
import 'node:child_process';
|
|
44
45
|
import 'node:zlib';
|
|
45
46
|
|
|
46
47
|
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
@@ -67,7 +68,7 @@ class SplitVendorChunkCache {
|
|
|
67
68
|
function splitVendorChunk(options = {}) {
|
|
68
69
|
const cache = options.cache ?? new SplitVendorChunkCache();
|
|
69
70
|
return (id, { getModuleInfo }) => {
|
|
70
|
-
if (id
|
|
71
|
+
if (isInNodeModules(id) &&
|
|
71
72
|
!isCSSRequest(id) &&
|
|
72
73
|
staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
|
73
74
|
return 'vendor';
|
|
@@ -6,7 +6,6 @@ var fs$1 = require('node:fs');
|
|
|
6
6
|
var esbuild = require('esbuild');
|
|
7
7
|
var rollup = require('rollup');
|
|
8
8
|
var os$1 = require('node:os');
|
|
9
|
-
var node_util = require('node:util');
|
|
10
9
|
var node_module = require('node:module');
|
|
11
10
|
var require$$0 = require('tty');
|
|
12
11
|
var require$$1 = require('util');
|
|
@@ -25,113 +24,6 @@ const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
|
25
24
|
path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
26
25
|
path$3.dirname(CLIENT_ENTRY);
|
|
27
26
|
|
|
28
|
-
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
29
|
-
// copy from constants.ts
|
|
30
|
-
const CSS_LANGS_RE =
|
|
31
|
-
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
32
|
-
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
33
|
-
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
34
|
-
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
|
35
|
-
// We don't recommend using this strategy as a general solution moving forward
|
|
36
|
-
// splitVendorChunk is a simple index/vendor strategy that was used in Vite
|
|
37
|
-
// until v2.8. It is exposed to let people continue to use it in case it was
|
|
38
|
-
// working well for their setups.
|
|
39
|
-
// The cache needs to be reset on buildStart for watch mode to work correctly
|
|
40
|
-
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
|
41
|
-
class SplitVendorChunkCache {
|
|
42
|
-
constructor() {
|
|
43
|
-
this.cache = new Map();
|
|
44
|
-
}
|
|
45
|
-
reset() {
|
|
46
|
-
this.cache = new Map();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function splitVendorChunk(options = {}) {
|
|
50
|
-
const cache = options.cache ?? new SplitVendorChunkCache();
|
|
51
|
-
return (id, { getModuleInfo }) => {
|
|
52
|
-
if (id.includes('node_modules') &&
|
|
53
|
-
!isCSSRequest(id) &&
|
|
54
|
-
staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
|
55
|
-
return 'vendor';
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|
60
|
-
if (cache.has(id)) {
|
|
61
|
-
return cache.get(id);
|
|
62
|
-
}
|
|
63
|
-
if (importStack.includes(id)) {
|
|
64
|
-
// circular deps!
|
|
65
|
-
cache.set(id, false);
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
const mod = getModuleInfo(id);
|
|
69
|
-
if (!mod) {
|
|
70
|
-
cache.set(id, false);
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
if (mod.isEntry) {
|
|
74
|
-
cache.set(id, true);
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
|
|
78
|
-
cache.set(id, someImporterIs);
|
|
79
|
-
return someImporterIs;
|
|
80
|
-
}
|
|
81
|
-
function splitVendorChunkPlugin() {
|
|
82
|
-
const caches = [];
|
|
83
|
-
function createSplitVendorChunk(output, config) {
|
|
84
|
-
const cache = new SplitVendorChunkCache();
|
|
85
|
-
caches.push(cache);
|
|
86
|
-
const build = config.build ?? {};
|
|
87
|
-
const format = output?.format;
|
|
88
|
-
if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
|
|
89
|
-
return splitVendorChunk({ cache });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
name: 'vite:split-vendor-chunk',
|
|
94
|
-
config(config) {
|
|
95
|
-
let outputs = config?.build?.rollupOptions?.output;
|
|
96
|
-
if (outputs) {
|
|
97
|
-
outputs = Array.isArray(outputs) ? outputs : [outputs];
|
|
98
|
-
for (const output of outputs) {
|
|
99
|
-
const viteManualChunks = createSplitVendorChunk(output, config);
|
|
100
|
-
if (viteManualChunks) {
|
|
101
|
-
if (output.manualChunks) {
|
|
102
|
-
if (typeof output.manualChunks === 'function') {
|
|
103
|
-
const userManualChunks = output.manualChunks;
|
|
104
|
-
output.manualChunks = (id, api) => {
|
|
105
|
-
return userManualChunks(id, api) ?? viteManualChunks(id, api);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
// else, leave the object form of manualChunks untouched, as
|
|
109
|
-
// we can't safely replicate rollup handling.
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
output.manualChunks = viteManualChunks;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return {
|
|
119
|
-
build: {
|
|
120
|
-
rollupOptions: {
|
|
121
|
-
output: {
|
|
122
|
-
manualChunks: createSplitVendorChunk({}, config),
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
buildStart() {
|
|
130
|
-
caches.forEach((cache) => cache.reset());
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
27
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
136
28
|
const intToChar = new Uint8Array(64); // 64 possible chars.
|
|
137
29
|
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
|
@@ -1258,7 +1150,7 @@ function requireNode () {
|
|
|
1258
1150
|
}
|
|
1259
1151
|
} (src));
|
|
1260
1152
|
|
|
1261
|
-
var debug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
1153
|
+
var debug$1 = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
1262
1154
|
|
|
1263
1155
|
var picomatchExports = {};
|
|
1264
1156
|
var picomatch$1 = {
|
|
@@ -3403,29 +3295,41 @@ const builtins = 'arguments Infinity NaN undefined null true false eval uneval i
|
|
|
3403
3295
|
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
|
3404
3296
|
forbiddenIdentifiers.add('');
|
|
3405
3297
|
|
|
3298
|
+
if (process.versions.pnp) {
|
|
3299
|
+
try {
|
|
3300
|
+
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))('pnpapi');
|
|
3301
|
+
}
|
|
3302
|
+
catch { }
|
|
3303
|
+
}
|
|
3304
|
+
|
|
3406
3305
|
const createFilter = createFilter$1;
|
|
3407
3306
|
const windowsSlashRE = /\\/g;
|
|
3408
3307
|
function slash(p) {
|
|
3409
3308
|
return p.replace(windowsSlashRE, '/');
|
|
3410
3309
|
}
|
|
3310
|
+
function isInNodeModules(id) {
|
|
3311
|
+
return id.includes('node_modules');
|
|
3312
|
+
}
|
|
3411
3313
|
// TODO: use import()
|
|
3412
3314
|
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
|
|
3413
3315
|
// set in bin/vite.js
|
|
3414
3316
|
const filter = process.env.VITE_DEBUG_FILTER;
|
|
3415
3317
|
const DEBUG = process.env.DEBUG;
|
|
3416
3318
|
function createDebugger(namespace, options = {}) {
|
|
3417
|
-
const log = debug(namespace);
|
|
3319
|
+
const log = debug$1(namespace);
|
|
3418
3320
|
const { onlyWhenFocused } = options;
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3321
|
+
let enabled = log.enabled;
|
|
3322
|
+
if (enabled && onlyWhenFocused) {
|
|
3323
|
+
const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
|
|
3324
|
+
enabled = !!DEBUG?.includes(ns);
|
|
3325
|
+
}
|
|
3326
|
+
if (enabled) {
|
|
3327
|
+
return (msg, ...args) => {
|
|
3328
|
+
if (!filter || msg.includes(filter)) {
|
|
3329
|
+
log(msg, ...args);
|
|
3330
|
+
}
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3429
3333
|
}
|
|
3430
3334
|
function testCaseInsensitiveFS() {
|
|
3431
3335
|
if (!CLIENT_ENTRY.endsWith('client.mjs')) {
|
|
@@ -3445,26 +3349,21 @@ function normalizePath(id) {
|
|
|
3445
3349
|
function isObject(value) {
|
|
3446
3350
|
return Object.prototype.toString.call(value) === '[object Object]';
|
|
3447
3351
|
}
|
|
3448
|
-
function
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
if (fs$1.existsSync(fullPath) && fs$1.statSync(fullPath).isFile()) {
|
|
3452
|
-
const result = options?.pathOnly
|
|
3453
|
-
? fullPath
|
|
3454
|
-
: fs$1.readFileSync(fullPath, 'utf-8');
|
|
3455
|
-
if (!options?.predicate || options.predicate(result)) {
|
|
3456
|
-
return result;
|
|
3457
|
-
}
|
|
3458
|
-
}
|
|
3352
|
+
function tryStatSync(file) {
|
|
3353
|
+
try {
|
|
3354
|
+
return fs$1.statSync(file, { throwIfNoEntry: false });
|
|
3459
3355
|
}
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
(!options?.rootDir || parentDir.startsWith(options?.rootDir))) {
|
|
3463
|
-
return lookupFile(parentDir, formats, options);
|
|
3356
|
+
catch {
|
|
3357
|
+
// Ignore errors
|
|
3464
3358
|
}
|
|
3465
3359
|
}
|
|
3466
3360
|
function isFileReadable(filename) {
|
|
3467
3361
|
try {
|
|
3362
|
+
// The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
|
|
3363
|
+
if (!fs$1.statSync(filename, { throwIfNoEntry: false })) {
|
|
3364
|
+
return false;
|
|
3365
|
+
}
|
|
3366
|
+
// Check if current process has read permission to the file
|
|
3468
3367
|
fs$1.accessSync(filename, fs$1.constants.R_OK);
|
|
3469
3368
|
return true;
|
|
3470
3369
|
}
|
|
@@ -3472,17 +3371,6 @@ function isFileReadable(filename) {
|
|
|
3472
3371
|
return false;
|
|
3473
3372
|
}
|
|
3474
3373
|
}
|
|
3475
|
-
isWindows
|
|
3476
|
-
? node_util.promisify(gracefulRemoveDir)
|
|
3477
|
-
: function removeDirSync(dir) {
|
|
3478
|
-
// when removing `.vite/deps`, if it doesn't exist, nodejs may also remove
|
|
3479
|
-
// other directories within `.vite/`, including `.vite/deps_temp` (bug).
|
|
3480
|
-
// workaround by checking for directory existence before removing for now.
|
|
3481
|
-
if (fs$1.existsSync(dir)) {
|
|
3482
|
-
fs$1.rmSync(dir, { recursive: true, force: true });
|
|
3483
|
-
}
|
|
3484
|
-
};
|
|
3485
|
-
isWindows ? node_util.promisify(gracefulRename) : fs$1.renameSync;
|
|
3486
3374
|
function arraify(target) {
|
|
3487
3375
|
return Array.isArray(target) ? target : [target];
|
|
3488
3376
|
}
|
|
@@ -3500,63 +3388,7 @@ const usingDynamicImport = typeof jest === 'undefined';
|
|
|
3500
3388
|
usingDynamicImport
|
|
3501
3389
|
? new Function('file', 'return import(file)')
|
|
3502
3390
|
: _require;
|
|
3503
|
-
|
|
3504
|
-
// The ISC License
|
|
3505
|
-
// Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
|
|
3506
|
-
// https://github.com/isaacs/node-graceful-fs/blob/main/LICENSE
|
|
3507
|
-
// On Windows, A/V software can lock the directory, causing this
|
|
3508
|
-
// to fail with an EACCES or EPERM if the directory contains newly
|
|
3509
|
-
// created files. The original tried for up to 60 seconds, we only
|
|
3510
|
-
// wait for 5 seconds, as a longer time would be seen as an error
|
|
3511
|
-
const GRACEFUL_RENAME_TIMEOUT = 5000;
|
|
3512
|
-
function gracefulRename(from, to, cb) {
|
|
3513
|
-
const start = Date.now();
|
|
3514
|
-
let backoff = 0;
|
|
3515
|
-
fs$1.rename(from, to, function CB(er) {
|
|
3516
|
-
if (er &&
|
|
3517
|
-
(er.code === 'EACCES' || er.code === 'EPERM') &&
|
|
3518
|
-
Date.now() - start < GRACEFUL_RENAME_TIMEOUT) {
|
|
3519
|
-
setTimeout(function () {
|
|
3520
|
-
fs$1.stat(to, function (stater, st) {
|
|
3521
|
-
if (stater && stater.code === 'ENOENT')
|
|
3522
|
-
fs$1.rename(from, to, CB);
|
|
3523
|
-
else
|
|
3524
|
-
CB(er);
|
|
3525
|
-
});
|
|
3526
|
-
}, backoff);
|
|
3527
|
-
if (backoff < 100)
|
|
3528
|
-
backoff += 10;
|
|
3529
|
-
return;
|
|
3530
|
-
}
|
|
3531
|
-
if (cb)
|
|
3532
|
-
cb(er);
|
|
3533
|
-
});
|
|
3534
|
-
}
|
|
3535
|
-
const GRACEFUL_REMOVE_DIR_TIMEOUT = 5000;
|
|
3536
|
-
function gracefulRemoveDir(dir, cb) {
|
|
3537
|
-
const start = Date.now();
|
|
3538
|
-
let backoff = 0;
|
|
3539
|
-
fs$1.rm(dir, { recursive: true }, function CB(er) {
|
|
3540
|
-
if (er) {
|
|
3541
|
-
if ((er.code === 'ENOTEMPTY' ||
|
|
3542
|
-
er.code === 'EACCES' ||
|
|
3543
|
-
er.code === 'EPERM') &&
|
|
3544
|
-
Date.now() - start < GRACEFUL_REMOVE_DIR_TIMEOUT) {
|
|
3545
|
-
setTimeout(function () {
|
|
3546
|
-
fs$1.rm(dir, { recursive: true }, CB);
|
|
3547
|
-
}, backoff);
|
|
3548
|
-
if (backoff < 100)
|
|
3549
|
-
backoff += 10;
|
|
3550
|
-
return;
|
|
3551
|
-
}
|
|
3552
|
-
if (er.code === 'ENOENT') {
|
|
3553
|
-
er = null;
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3556
|
-
if (cb)
|
|
3557
|
-
cb(er);
|
|
3558
|
-
});
|
|
3559
|
-
}
|
|
3391
|
+
path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
|
|
3560
3392
|
function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
3561
3393
|
const merged = { ...defaults };
|
|
3562
3394
|
for (const key in overrides) {
|
|
@@ -3638,6 +3470,113 @@ function normalizeSingleAlias({ find, replacement, customResolver, }) {
|
|
|
3638
3470
|
return alias;
|
|
3639
3471
|
}
|
|
3640
3472
|
|
|
3473
|
+
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
3474
|
+
// copy from constants.ts
|
|
3475
|
+
const CSS_LANGS_RE =
|
|
3476
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
3477
|
+
/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
3478
|
+
const isCSSRequest = (request) => CSS_LANGS_RE.test(request);
|
|
3479
|
+
// Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
|
|
3480
|
+
// We don't recommend using this strategy as a general solution moving forward
|
|
3481
|
+
// splitVendorChunk is a simple index/vendor strategy that was used in Vite
|
|
3482
|
+
// until v2.8. It is exposed to let people continue to use it in case it was
|
|
3483
|
+
// working well for their setups.
|
|
3484
|
+
// The cache needs to be reset on buildStart for watch mode to work correctly
|
|
3485
|
+
// Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
|
|
3486
|
+
class SplitVendorChunkCache {
|
|
3487
|
+
constructor() {
|
|
3488
|
+
this.cache = new Map();
|
|
3489
|
+
}
|
|
3490
|
+
reset() {
|
|
3491
|
+
this.cache = new Map();
|
|
3492
|
+
}
|
|
3493
|
+
}
|
|
3494
|
+
function splitVendorChunk(options = {}) {
|
|
3495
|
+
const cache = options.cache ?? new SplitVendorChunkCache();
|
|
3496
|
+
return (id, { getModuleInfo }) => {
|
|
3497
|
+
if (isInNodeModules(id) &&
|
|
3498
|
+
!isCSSRequest(id) &&
|
|
3499
|
+
staticImportedByEntry(id, getModuleInfo, cache.cache)) {
|
|
3500
|
+
return 'vendor';
|
|
3501
|
+
}
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3504
|
+
function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
|
|
3505
|
+
if (cache.has(id)) {
|
|
3506
|
+
return cache.get(id);
|
|
3507
|
+
}
|
|
3508
|
+
if (importStack.includes(id)) {
|
|
3509
|
+
// circular deps!
|
|
3510
|
+
cache.set(id, false);
|
|
3511
|
+
return false;
|
|
3512
|
+
}
|
|
3513
|
+
const mod = getModuleInfo(id);
|
|
3514
|
+
if (!mod) {
|
|
3515
|
+
cache.set(id, false);
|
|
3516
|
+
return false;
|
|
3517
|
+
}
|
|
3518
|
+
if (mod.isEntry) {
|
|
3519
|
+
cache.set(id, true);
|
|
3520
|
+
return true;
|
|
3521
|
+
}
|
|
3522
|
+
const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
|
|
3523
|
+
cache.set(id, someImporterIs);
|
|
3524
|
+
return someImporterIs;
|
|
3525
|
+
}
|
|
3526
|
+
function splitVendorChunkPlugin() {
|
|
3527
|
+
const caches = [];
|
|
3528
|
+
function createSplitVendorChunk(output, config) {
|
|
3529
|
+
const cache = new SplitVendorChunkCache();
|
|
3530
|
+
caches.push(cache);
|
|
3531
|
+
const build = config.build ?? {};
|
|
3532
|
+
const format = output?.format;
|
|
3533
|
+
if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
|
|
3534
|
+
return splitVendorChunk({ cache });
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
return {
|
|
3538
|
+
name: 'vite:split-vendor-chunk',
|
|
3539
|
+
config(config) {
|
|
3540
|
+
let outputs = config?.build?.rollupOptions?.output;
|
|
3541
|
+
if (outputs) {
|
|
3542
|
+
outputs = Array.isArray(outputs) ? outputs : [outputs];
|
|
3543
|
+
for (const output of outputs) {
|
|
3544
|
+
const viteManualChunks = createSplitVendorChunk(output, config);
|
|
3545
|
+
if (viteManualChunks) {
|
|
3546
|
+
if (output.manualChunks) {
|
|
3547
|
+
if (typeof output.manualChunks === 'function') {
|
|
3548
|
+
const userManualChunks = output.manualChunks;
|
|
3549
|
+
output.manualChunks = (id, api) => {
|
|
3550
|
+
return userManualChunks(id, api) ?? viteManualChunks(id, api);
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
// else, leave the object form of manualChunks untouched, as
|
|
3554
|
+
// we can't safely replicate rollup handling.
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
output.manualChunks = viteManualChunks;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
else {
|
|
3563
|
+
return {
|
|
3564
|
+
build: {
|
|
3565
|
+
rollupOptions: {
|
|
3566
|
+
output: {
|
|
3567
|
+
manualChunks: createSplitVendorChunk({}, config),
|
|
3568
|
+
},
|
|
3569
|
+
},
|
|
3570
|
+
},
|
|
3571
|
+
};
|
|
3572
|
+
}
|
|
3573
|
+
},
|
|
3574
|
+
buildStart() {
|
|
3575
|
+
caches.forEach((cache) => cache.reset());
|
|
3576
|
+
},
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3641
3580
|
/*!
|
|
3642
3581
|
* etag
|
|
3643
3582
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
@@ -3768,8 +3707,7 @@ function stattag (stat) {
|
|
|
3768
3707
|
return '"' + size + '-' + mtime + '"'
|
|
3769
3708
|
}
|
|
3770
3709
|
|
|
3771
|
-
const
|
|
3772
|
-
createDebugger('vite:sourcemap', {
|
|
3710
|
+
const debug = createDebugger('vite:sourcemap', {
|
|
3773
3711
|
onlyWhenFocused: true,
|
|
3774
3712
|
});
|
|
3775
3713
|
function genSourceMapUrl(map) {
|
|
@@ -3779,7 +3717,7 @@ function genSourceMapUrl(map) {
|
|
|
3779
3717
|
return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
|
|
3780
3718
|
}
|
|
3781
3719
|
function getCodeWithSourcemap(type, code, map) {
|
|
3782
|
-
if (
|
|
3720
|
+
if (debug) {
|
|
3783
3721
|
code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
|
|
3784
3722
|
}
|
|
3785
3723
|
if (type === 'js') {
|
|
@@ -4253,13 +4191,10 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4253
4191
|
/** mode local file */ `.env.${mode}.local`,
|
|
4254
4192
|
];
|
|
4255
4193
|
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
4256
|
-
const
|
|
4257
|
-
|
|
4258
|
-
rootDir: envDir,
|
|
4259
|
-
});
|
|
4260
|
-
if (!path)
|
|
4194
|
+
const filePath = path$3.join(envDir, file);
|
|
4195
|
+
if (!tryStatSync(filePath)?.isFile())
|
|
4261
4196
|
return [];
|
|
4262
|
-
return Object.entries(parse_1(fs$1.readFileSync(
|
|
4197
|
+
return Object.entries(parse_1(fs$1.readFileSync(filePath)));
|
|
4263
4198
|
}));
|
|
4264
4199
|
// test NODE_ENV override before expand as otherwise process.env.NODE_ENV would override this
|
|
4265
4200
|
if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {
|