vite 7.0.6 → 7.1.0-beta.0
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/LICENSE.md +53 -79
- package/bin/openChrome.js +68 -0
- package/dist/client/client.mjs +107 -18
- package/dist/node/chunks/{dep-Ctugieod.js → dep-BDCsDwBr.js} +2 -1
- package/dist/node/chunks/{dep-BO5GbxpL.js → dep-BeiFehmI.js} +14 -14
- package/dist/node/chunks/{dep-Ck0J6tA7.js → dep-C3Gi22Hg.js} +2 -2
- package/dist/node/chunks/{dep-CmzxWWz4.js → dep-CVQJZ3QI.js} +2 -2
- package/dist/node/chunks/{dep-BHkUv4Z8.js → dep-CYKWp2mZ.js} +2451 -2224
- package/dist/node/chunks/{dep-Bg9-PZ8I.js → dep-DQ3EcyiN.js} +2 -2
- package/dist/node/chunks/{dep-PzytSxfE.js → dep-KxHho39H.js} +2 -2
- package/dist/node/cli.js +6 -6
- package/dist/node/constants.js +2 -2
- package/dist/node/index.d.ts +216 -171
- package/dist/node/index.js +3 -3
- package/dist/node/module-runner.d.ts +14 -2
- package/dist/node/module-runner.js +67 -17
- package/package.json +7 -6
- package/types/metadata.d.ts +0 -2
- package/bin/openChrome.applescript +0 -95
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
|
2
|
-
import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-
|
3
|
-
import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, defaultAllowedOrigins } from "./chunks/dep-
|
2
|
+
import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/dep-CYKWp2mZ.js";
|
3
|
+
import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, defaultAllowedOrigins } from "./chunks/dep-BDCsDwBr.js";
|
4
4
|
import { parseAst, parseAstAsync } from "rollup/parseAst";
|
5
5
|
import { version as esbuildVersion } from "esbuild";
|
6
6
|
|
@@ -28,4 +28,4 @@ var FetchableDevEnvironment = class extends DevEnvironment {
|
|
28
28
|
};
|
29
29
|
|
30
30
|
//#endregion
|
31
|
-
export { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parseAst, parseAstAsync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, VERSION as version };
|
31
|
+
export { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parseAst, parseAstAsync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, VERSION as version };
|
@@ -110,7 +110,6 @@ declare class ModuleRunner {
|
|
110
110
|
private debug?;
|
111
111
|
evaluatedModules: EvaluatedModules;
|
112
112
|
hmrClient?: HMRClient;
|
113
|
-
private readonly envProxy;
|
114
113
|
private readonly transport;
|
115
114
|
private readonly resetSourceMapSupport?;
|
116
115
|
private readonly concurrentModuleNodePromises;
|
@@ -218,6 +217,12 @@ interface ModuleRunnerOptions {
|
|
218
217
|
* @default true
|
219
218
|
*/
|
220
219
|
hmr?: boolean | ModuleRunnerHmr;
|
220
|
+
/**
|
221
|
+
* Create import.meta object for the module.
|
222
|
+
*
|
223
|
+
* @default createDefaultImportMeta
|
224
|
+
*/
|
225
|
+
createImportMeta?: (modulePath: string) => ModuleRunnerImportMeta | Promise<ModuleRunnerImportMeta>;
|
221
226
|
/**
|
222
227
|
* Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
|
223
228
|
*/
|
@@ -297,4 +302,11 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
|
|
297
302
|
runExternalModule(filepath: string): Promise<any>;
|
298
303
|
}
|
299
304
|
//#endregion
|
300
|
-
|
305
|
+
//#region src/module-runner/createImportMeta.d.ts
|
306
|
+
declare function createDefaultImportMeta(modulePath: string): ModuleRunnerImportMeta;
|
307
|
+
/**
|
308
|
+
* Create import.meta object for Node.js.
|
309
|
+
*/
|
310
|
+
declare function createNodeImportMeta(modulePath: string): Promise<ModuleRunnerImportMeta>;
|
311
|
+
//#endregion
|
312
|
+
export { ESModulesEvaluator, type EvaluatedModuleNode, EvaluatedModules, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRLogger, type InterceptorOptions, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, type ModuleRunnerTransport, type ModuleRunnerTransportHandlers, type ResolvedResult, type SSRImportMetadata, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
|
@@ -911,12 +911,73 @@ var ESModulesEvaluator = class {
|
|
911
911
|
runExternalModule(filepath) {
|
912
912
|
return import(filepath);
|
913
913
|
}
|
914
|
-
}
|
914
|
+
};
|
915
|
+
const customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/", customizationHooksModule = `
|
916
|
+
|
917
|
+
export async function resolve(specifier, context, nextResolve) {
|
918
|
+
if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) {
|
919
|
+
const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length)
|
920
|
+
const [parsedSpecifier, parsedImporter] = JSON.parse(data)
|
921
|
+
specifier = parsedSpecifier
|
922
|
+
context.parentURL = parsedImporter
|
923
|
+
}
|
924
|
+
|
925
|
+
return nextResolve(specifier, context)
|
926
|
+
}
|
927
|
+
|
928
|
+
`;
|
929
|
+
async function createImportMetaResolver() {
|
930
|
+
let module;
|
931
|
+
try {
|
932
|
+
module = (await import("node:module")).Module;
|
933
|
+
} catch {
|
934
|
+
return;
|
935
|
+
}
|
936
|
+
if (module?.register) {
|
937
|
+
try {
|
938
|
+
let hookModuleContent = `data:text/javascript,${encodeURI(customizationHooksModule)}`;
|
939
|
+
module.register(hookModuleContent);
|
940
|
+
} catch (e) {
|
941
|
+
if ("code" in e && e.code === "ERR_NETWORK_IMPORT_DISALLOWED") return;
|
942
|
+
throw e;
|
943
|
+
}
|
944
|
+
return (specifier, importer) => import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`);
|
945
|
+
}
|
946
|
+
}
|
947
|
+
const envProxy = new Proxy({}, { get(_, p) {
|
948
|
+
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
949
|
+
} });
|
950
|
+
function createDefaultImportMeta(modulePath) {
|
951
|
+
let href = posixPathToFileHref(modulePath), filename = modulePath, dirname$1 = posixDirname(modulePath);
|
952
|
+
return {
|
953
|
+
filename: isWindows ? toWindowsPath(filename) : filename,
|
954
|
+
dirname: isWindows ? toWindowsPath(dirname$1) : dirname$1,
|
955
|
+
url: href,
|
956
|
+
env: envProxy,
|
957
|
+
resolve(_id, _parent) {
|
958
|
+
throw Error("[module runner] \"import.meta.resolve\" is not supported.");
|
959
|
+
},
|
960
|
+
glob() {
|
961
|
+
throw Error("[module runner] \"import.meta.glob\" is statically replaced during file transformation. Make sure to reference it by the full name.");
|
962
|
+
}
|
963
|
+
};
|
964
|
+
}
|
965
|
+
let importMetaResolverCache;
|
966
|
+
async function createNodeImportMeta(modulePath) {
|
967
|
+
let defaultMeta = createDefaultImportMeta(modulePath), href = defaultMeta.url;
|
968
|
+
importMetaResolverCache ??= createImportMetaResolver();
|
969
|
+
let importMetaResolver = await importMetaResolverCache;
|
970
|
+
return {
|
971
|
+
...defaultMeta,
|
972
|
+
resolve(id, parent) {
|
973
|
+
let resolver = importMetaResolver ?? defaultMeta.resolve;
|
974
|
+
return resolver(id, parent ?? href);
|
975
|
+
}
|
976
|
+
};
|
977
|
+
}
|
978
|
+
var ModuleRunner = class {
|
915
979
|
evaluatedModules;
|
916
980
|
hmrClient;
|
917
|
-
envProxy = new Proxy({}, { get(_, p) {
|
918
|
-
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
919
|
-
} });
|
920
981
|
transport;
|
921
982
|
resetSourceMapSupport;
|
922
983
|
concurrentModuleNodePromises = /* @__PURE__ */ new Map();
|
@@ -1024,18 +1085,7 @@ var ESModulesEvaluator = class {
|
|
1024
1085
|
let importer = callstack[callstack.length - 2];
|
1025
1086
|
throw Error(`[module runner] Failed to load "${url}"${importer ? ` imported from ${importer}` : ""}`);
|
1026
1087
|
}
|
1027
|
-
let modulePath = cleanUrl(file || moduleId), href = posixPathToFileHref(modulePath),
|
1028
|
-
filename: isWindows ? toWindowsPath(filename) : filename,
|
1029
|
-
dirname: isWindows ? toWindowsPath(dirname$1) : dirname$1,
|
1030
|
-
url: href,
|
1031
|
-
env: this.envProxy,
|
1032
|
-
resolve(_id, _parent) {
|
1033
|
-
throw Error("[module runner] \"import.meta.resolve\" is not supported.");
|
1034
|
-
},
|
1035
|
-
glob() {
|
1036
|
-
throw Error("[module runner] \"import.meta.glob\" is statically replaced during file transformation. Make sure to reference it by the full name.");
|
1037
|
-
}
|
1038
|
-
}, exports = Object.create(null);
|
1088
|
+
let createImportMeta = this.options.createImportMeta ?? createDefaultImportMeta, modulePath = cleanUrl(file || moduleId), href = posixPathToFileHref(modulePath), meta = await createImportMeta(modulePath), exports = Object.create(null);
|
1039
1089
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
1040
1090
|
value: "Module",
|
1041
1091
|
enumerable: !1,
|
@@ -1078,4 +1128,4 @@ function exportAll(exports, sourceModule) {
|
|
1078
1128
|
} catch {}
|
1079
1129
|
}
|
1080
1130
|
}
|
1081
|
-
export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
|
1131
|
+
export { ESModulesEvaluator, EvaluatedModules, ModuleRunner, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "7.0.
|
3
|
+
"version": "7.1.0-beta.0",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"fdir": "^6.4.6",
|
73
73
|
"picomatch": "^4.0.3",
|
74
74
|
"postcss": "^8.5.6",
|
75
|
-
"rollup": "^4.
|
75
|
+
"rollup": "^4.43.0",
|
76
76
|
"tinyglobby": "^0.2.14"
|
77
77
|
},
|
78
78
|
"optionalDependencies": {
|
@@ -84,6 +84,7 @@
|
|
84
84
|
"@jridgewell/trace-mapping": "^0.3.29",
|
85
85
|
"@oxc-project/types": "0.77.0",
|
86
86
|
"@polka/compression": "^1.0.0-next.25",
|
87
|
+
"@rolldown/pluginutils": "^1.0.0-beta.29",
|
87
88
|
"@rollup/plugin-alias": "^5.1.1",
|
88
89
|
"@rollup/plugin-commonjs": "^28.0.6",
|
89
90
|
"@rollup/plugin-dynamic-import-vars": "2.1.4",
|
@@ -91,7 +92,7 @@
|
|
91
92
|
"@types/escape-html": "^1.0.4",
|
92
93
|
"@types/pnpapi": "^0.0.5",
|
93
94
|
"artichokie": "^0.3.2",
|
94
|
-
"baseline-browser-mapping": "^2.5.
|
95
|
+
"baseline-browser-mapping": "^2.5.6",
|
95
96
|
"cac": "^6.7.14",
|
96
97
|
"chokidar": "^3.6.0",
|
97
98
|
"connect": "^3.7.0",
|
@@ -100,14 +101,14 @@
|
|
100
101
|
"cross-spawn": "^7.0.6",
|
101
102
|
"debug": "^4.4.1",
|
102
103
|
"dep-types": "link:./src/types",
|
103
|
-
"dotenv": "^17.2.
|
104
|
+
"dotenv": "^17.2.1",
|
104
105
|
"dotenv-expand": "^12.0.2",
|
105
106
|
"es-module-lexer": "^1.7.0",
|
106
107
|
"escape-html": "^1.0.3",
|
107
108
|
"estree-walker": "^3.0.3",
|
108
109
|
"etag": "^1.8.1",
|
109
110
|
"host-validation-middleware": "^0.1.1",
|
110
|
-
"http-proxy": "^1.
|
111
|
+
"http-proxy-3": "^1.20.10",
|
111
112
|
"launch-editor-middleware": "^2.10.0",
|
112
113
|
"lightningcss": "^1.30.1",
|
113
114
|
"magic-string": "^0.30.17",
|
@@ -115,7 +116,7 @@
|
|
115
116
|
"mrmime": "^2.0.1",
|
116
117
|
"nanoid": "^5.1.5",
|
117
118
|
"open": "^10.2.0",
|
118
|
-
"parse5": "^
|
119
|
+
"parse5": "^8.0.0",
|
119
120
|
"pathe": "^2.0.3",
|
120
121
|
"periscopic": "^4.0.2",
|
121
122
|
"picocolors": "^1.1.1",
|
package/types/metadata.d.ts
CHANGED
@@ -1,95 +0,0 @@
|
|
1
|
-
(*
|
2
|
-
Copyright (c) 2015-present, Facebook, Inc.
|
3
|
-
|
4
|
-
This source code is licensed under the MIT license found in the
|
5
|
-
LICENSE file at
|
6
|
-
https://github.com/facebookincubator/create-react-app/blob/master/LICENSE
|
7
|
-
*)
|
8
|
-
|
9
|
-
property targetTab: null
|
10
|
-
property targetTabIndex: -1
|
11
|
-
property targetWindow: null
|
12
|
-
property theProgram: "Google Chrome"
|
13
|
-
|
14
|
-
on run argv
|
15
|
-
set theURL to item 1 of argv
|
16
|
-
|
17
|
-
-- Allow requested program to be optional,
|
18
|
-
-- default to Google Chrome
|
19
|
-
if (count of argv) > 1 then
|
20
|
-
set theProgram to item 2 of argv
|
21
|
-
end if
|
22
|
-
|
23
|
-
using terms from application "Google Chrome"
|
24
|
-
tell application theProgram
|
25
|
-
|
26
|
-
if (count every window) = 0 then
|
27
|
-
make new window
|
28
|
-
end if
|
29
|
-
|
30
|
-
-- 1: Looking for tab running debugger
|
31
|
-
-- then, Reload debugging tab if found
|
32
|
-
-- then return
|
33
|
-
set found to my lookupTabWithUrl(theURL)
|
34
|
-
if found then
|
35
|
-
set targetWindow's active tab index to targetTabIndex
|
36
|
-
tell targetTab to reload
|
37
|
-
tell targetWindow to activate
|
38
|
-
set index of targetWindow to 1
|
39
|
-
return
|
40
|
-
end if
|
41
|
-
|
42
|
-
-- 2: Looking for Empty tab
|
43
|
-
-- In case debugging tab was not found
|
44
|
-
-- We try to find an empty tab instead
|
45
|
-
set found to my lookupTabWithUrl("chrome://newtab/")
|
46
|
-
if found then
|
47
|
-
set targetWindow's active tab index to targetTabIndex
|
48
|
-
set URL of targetTab to theURL
|
49
|
-
tell targetWindow to activate
|
50
|
-
return
|
51
|
-
end if
|
52
|
-
|
53
|
-
-- 3: Create new tab
|
54
|
-
-- both debugging and empty tab were not found
|
55
|
-
-- make a new tab with url
|
56
|
-
tell window 1
|
57
|
-
activate
|
58
|
-
make new tab with properties {URL:theURL}
|
59
|
-
end tell
|
60
|
-
end tell
|
61
|
-
end using terms from
|
62
|
-
end run
|
63
|
-
|
64
|
-
-- Function:
|
65
|
-
-- Lookup tab with given url
|
66
|
-
-- if found, store tab, index, and window in properties
|
67
|
-
-- (properties were declared on top of file)
|
68
|
-
on lookupTabWithUrl(lookupUrl)
|
69
|
-
using terms from application "Google Chrome"
|
70
|
-
tell application theProgram
|
71
|
-
-- Find a tab with the given url
|
72
|
-
set found to false
|
73
|
-
set theTabIndex to -1
|
74
|
-
repeat with theWindow in every window
|
75
|
-
set theTabIndex to 0
|
76
|
-
repeat with theTab in every tab of theWindow
|
77
|
-
set theTabIndex to theTabIndex + 1
|
78
|
-
if (theTab's URL as string) contains lookupUrl then
|
79
|
-
-- assign tab, tab index, and window to properties
|
80
|
-
set targetTab to theTab
|
81
|
-
set targetTabIndex to theTabIndex
|
82
|
-
set targetWindow to theWindow
|
83
|
-
set found to true
|
84
|
-
exit repeat
|
85
|
-
end if
|
86
|
-
end repeat
|
87
|
-
|
88
|
-
if found then
|
89
|
-
exit repeat
|
90
|
-
end if
|
91
|
-
end repeat
|
92
|
-
end tell
|
93
|
-
end using terms from
|
94
|
-
return found
|
95
|
-
end lookupTabWithUrl
|