vite 5.1.0-beta.4 → 5.1.0-beta.6
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/client/client.mjs +8 -0
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-y3MfcbcG.js → dep-0ozvs92U.js} +1 -1
- package/dist/node/chunks/{dep-0RU5--AQ.js → dep-4a4aOlj8.js} +1 -1
- package/dist/node/chunks/{dep-2l_yqaZo.js → dep-ZX7UfftI.js} +198 -34
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +74 -1
- package/dist/node/index.js +110 -5
- package/dist/node/runtime.d.ts +12 -0
- package/dist/node/runtime.js +1614 -0
- package/dist/node/types.d-jgA8ss1A.d.ts +324 -0
- package/dist/node-cjs/publicUtils.cjs +8 -4
- package/package.json +15 -4
- package/types/hmrPayload.d.ts +2 -0
@@ -32,10 +32,10 @@ import assert$1 from 'node:assert';
|
|
32
32
|
import v8 from 'node:v8';
|
33
33
|
import { Worker as Worker$1 } from 'node:worker_threads';
|
34
34
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
35
|
+
import { EventEmitter as EventEmitter$4 } from 'node:events';
|
35
36
|
import { parseAst, parseAstAsync } from 'rollup/parseAst';
|
36
37
|
import * as qs from 'querystring';
|
37
38
|
import readline from 'node:readline';
|
38
|
-
import { EventEmitter as EventEmitter$4 } from 'node:events';
|
39
39
|
import require$$0$b from 'zlib';
|
40
40
|
import require$$0$c from 'buffer';
|
41
41
|
import require$$1$1 from 'https';
|
@@ -29558,7 +29558,7 @@ function stripLiteralDetailed(code, options) {
|
|
29558
29558
|
var main$1 = {exports: {}};
|
29559
29559
|
|
29560
29560
|
var name = "dotenv";
|
29561
|
-
var version$2 = "16.3.
|
29561
|
+
var version$2 = "16.3.2";
|
29562
29562
|
var description = "Loads environment variables from .env file";
|
29563
29563
|
var main = "lib/main.js";
|
29564
29564
|
var types$2 = "lib/main.d.ts";
|
@@ -29829,6 +29829,10 @@ function configDotenv (options) {
|
|
29829
29829
|
}
|
29830
29830
|
if (options.encoding != null) {
|
29831
29831
|
encoding = options.encoding;
|
29832
|
+
} else {
|
29833
|
+
if (debug) {
|
29834
|
+
_debug('No encoding is specified. UTF-8 is used by default');
|
29835
|
+
}
|
29832
29836
|
}
|
29833
29837
|
}
|
29834
29838
|
|
@@ -29876,9 +29880,9 @@ function decrypt (encrypted, keyStr) {
|
|
29876
29880
|
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
29877
29881
|
let ciphertext = Buffer.from(encrypted, 'base64');
|
29878
29882
|
|
29879
|
-
const nonce = ciphertext.
|
29880
|
-
const authTag = ciphertext.
|
29881
|
-
ciphertext = ciphertext.
|
29883
|
+
const nonce = ciphertext.subarray(0, 12);
|
29884
|
+
const authTag = ciphertext.subarray(-16);
|
29885
|
+
ciphertext = ciphertext.subarray(12, -16);
|
29882
29886
|
|
29883
29887
|
try {
|
29884
29888
|
const aesgcm = crypto$1.createDecipheriv('aes-256-gcm', key, nonce);
|
@@ -31998,8 +32002,8 @@ function createCachedImport(imp) {
|
|
31998
32002
|
return cached;
|
31999
32003
|
};
|
32000
32004
|
}
|
32001
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
32002
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
32005
|
+
const importPostcssImport = createCachedImport(() => import('./dep-0ozvs92U.js').then(function (n) { return n.i; }));
|
32006
|
+
const importPostcssModules = createCachedImport(() => import('./dep-4a4aOlj8.js').then(function (n) { return n.i; }));
|
32003
32007
|
const importPostcss = createCachedImport(() => import('postcss'));
|
32004
32008
|
const preprocessorWorkerControllerCache = new WeakMap();
|
32005
32009
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -54452,12 +54456,12 @@ function ssrFixStacktrace(e, moduleGraph) {
|
|
54452
54456
|
}
|
54453
54457
|
|
54454
54458
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
54455
|
-
const AsyncFunction = async function () { }.constructor;
|
54456
|
-
let fnDeclarationLineCount = 0;
|
54459
|
+
const AsyncFunction$1 = async function () { }.constructor;
|
54460
|
+
let fnDeclarationLineCount$1 = 0;
|
54457
54461
|
{
|
54458
54462
|
const body = '/*code*/';
|
54459
|
-
const source = new AsyncFunction('a', 'b', body).toString();
|
54460
|
-
fnDeclarationLineCount =
|
54463
|
+
const source = new AsyncFunction$1('a', 'b', body).toString();
|
54464
|
+
fnDeclarationLineCount$1 =
|
54461
54465
|
source.slice(0, source.indexOf(body)).split('\n').length - 1;
|
54462
54466
|
}
|
54463
54467
|
const pendingModules = new Map();
|
@@ -54587,13 +54591,13 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
54587
54591
|
const moduleSourceMap = Object.assign({}, result.map, {
|
54588
54592
|
// currently we need to offset the line
|
54589
54593
|
// https://github.com/nodejs/node/issues/43047#issuecomment-1180632750
|
54590
|
-
mappings: ';'.repeat(fnDeclarationLineCount) + result.map.mappings,
|
54594
|
+
mappings: ';'.repeat(fnDeclarationLineCount$1) + result.map.mappings,
|
54591
54595
|
});
|
54592
54596
|
sourceMapSuffix =
|
54593
54597
|
'\n//# sourceMappingURL=' + genSourceMapUrl(moduleSourceMap);
|
54594
54598
|
}
|
54595
54599
|
try {
|
54596
|
-
const initModule = new AsyncFunction(`global`, ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, '"use strict";' +
|
54600
|
+
const initModule = new AsyncFunction$1(`global`, ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, '"use strict";' +
|
54597
54601
|
result.code +
|
54598
54602
|
`\n//# sourceURL=${mod.id}${sourceMapSuffix}`);
|
54599
54603
|
await initModule(context.global, ssrModule, ssrImportMeta, ssrImport, ssrDynamicImport, ssrExportAll);
|
@@ -56023,6 +56027,12 @@ class NoopWatcher extends EventEmitter$4 {
|
|
56023
56027
|
getWatched() {
|
56024
56028
|
return {};
|
56025
56029
|
}
|
56030
|
+
ref() {
|
56031
|
+
return this;
|
56032
|
+
}
|
56033
|
+
unref() {
|
56034
|
+
return this;
|
56035
|
+
}
|
56026
56036
|
async close() {
|
56027
56037
|
// noop
|
56028
56038
|
}
|
@@ -56031,6 +56041,105 @@ function createNoopWatcher(options) {
|
|
56031
56041
|
return new NoopWatcher(options);
|
56032
56042
|
}
|
56033
56043
|
|
56044
|
+
/**
|
56045
|
+
* Fetch module information for Vite runtime.
|
56046
|
+
* @experimental
|
56047
|
+
*/
|
56048
|
+
async function fetchModule(server, url, importer, options = {}) {
|
56049
|
+
// builtins should always be externalized
|
56050
|
+
if (url.startsWith('data:') || isBuiltin(url)) {
|
56051
|
+
return { externalize: url, type: 'builtin' };
|
56052
|
+
}
|
56053
|
+
if (isExternalUrl(url)) {
|
56054
|
+
return { externalize: url, type: 'network' };
|
56055
|
+
}
|
56056
|
+
if (url[0] !== '.' && url[0] !== '/') {
|
56057
|
+
const { isProduction, resolve: { dedupe, preserveSymlinks }, root, ssr, } = server.config;
|
56058
|
+
const overrideConditions = ssr.resolve?.externalConditions || [];
|
56059
|
+
const resolveOptions = {
|
56060
|
+
mainFields: ['main'],
|
56061
|
+
conditions: [],
|
56062
|
+
overrideConditions: [...overrideConditions, 'production', 'development'],
|
56063
|
+
extensions: ['.js', '.cjs', '.json'],
|
56064
|
+
dedupe,
|
56065
|
+
preserveSymlinks,
|
56066
|
+
isBuild: false,
|
56067
|
+
isProduction,
|
56068
|
+
root,
|
56069
|
+
ssrConfig: ssr,
|
56070
|
+
legacyProxySsrExternalModules: server.config.legacy?.proxySsrExternalModules,
|
56071
|
+
packageCache: server.config.packageCache,
|
56072
|
+
};
|
56073
|
+
const resolved = tryNodeResolve(url, importer, { ...resolveOptions, tryEsmOnly: true }, false, undefined, true);
|
56074
|
+
if (!resolved) {
|
56075
|
+
const err = new Error(`Cannot find module '${url}' imported from '${importer}'`);
|
56076
|
+
err.code = 'ERR_MODULE_NOT_FOUND';
|
56077
|
+
throw err;
|
56078
|
+
}
|
56079
|
+
const file = pathToFileURL(resolved.id).toString();
|
56080
|
+
const type = isFilePathESM(file, server.config.packageCache)
|
56081
|
+
? 'module'
|
56082
|
+
: 'commonjs';
|
56083
|
+
return { externalize: file, type };
|
56084
|
+
}
|
56085
|
+
url = unwrapId(url);
|
56086
|
+
let result = await server.transformRequest(url, { ssr: true });
|
56087
|
+
if (!result) {
|
56088
|
+
throw new Error(`[vite] transform failed for module '${url}'${importer ? ` imported from '${importer}'` : ''}.`);
|
56089
|
+
}
|
56090
|
+
// module entry should be created by transformRequest
|
56091
|
+
const mod = await server.moduleGraph.getModuleByUrl(url, true);
|
56092
|
+
if (!mod) {
|
56093
|
+
throw new Error(`[vite] cannot find module '${url}' ${importer ? ` imported from '${importer}'` : ''}.`);
|
56094
|
+
}
|
56095
|
+
if (options.inlineSourceMap !== false) {
|
56096
|
+
result = inlineSourceMap(mod, result, options.processSourceMap);
|
56097
|
+
}
|
56098
|
+
// remove shebang
|
56099
|
+
if (result.code[0] === '#')
|
56100
|
+
result.code = result.code.replace(/^#!.*/, (s) => ' '.repeat(s.length));
|
56101
|
+
return { code: result.code, file: mod.file };
|
56102
|
+
}
|
56103
|
+
let SOURCEMAPPING_URL = 'sourceMa';
|
56104
|
+
SOURCEMAPPING_URL += 'ppingURL';
|
56105
|
+
const VITE_RUNTIME_SOURCEMAPPING_SOURCE = '//# sourceMappingSource=vite-runtime';
|
56106
|
+
const VITE_RUNTIME_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
|
56107
|
+
function inlineSourceMap(mod, result, processSourceMap) {
|
56108
|
+
const map = result.map;
|
56109
|
+
let code = result.code;
|
56110
|
+
if (!map ||
|
56111
|
+
!('version' in map) ||
|
56112
|
+
code.includes(VITE_RUNTIME_SOURCEMAPPING_SOURCE))
|
56113
|
+
return result;
|
56114
|
+
// to reduce the payload size, we only inline vite node source map, because it's also the only one we use
|
56115
|
+
const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,([A-Za-z0-9+/=]+)$`, 'gm');
|
56116
|
+
while (OTHER_SOURCE_MAP_REGEXP.test(code))
|
56117
|
+
code = code.replace(OTHER_SOURCE_MAP_REGEXP, '');
|
56118
|
+
const sourceMap = Buffer.from(JSON.stringify(processSourceMap?.(map) || map), 'utf-8').toString('base64');
|
56119
|
+
result.code = `${code.trimEnd()}\n//# sourceURL=${mod.id}\n${VITE_RUNTIME_SOURCEMAPPING_SOURCE}\n//# ${VITE_RUNTIME_SOURCEMAPPING_URL};base64,${sourceMap}\n`;
|
56120
|
+
return result;
|
56121
|
+
}
|
56122
|
+
|
56123
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
56124
|
+
const AsyncFunction = async function () { }.constructor;
|
56125
|
+
const fnDeclarationLineCount = (() => {
|
56126
|
+
const body = '/*code*/';
|
56127
|
+
const source = new AsyncFunction('a', 'b', body).toString();
|
56128
|
+
return source.slice(0, source.indexOf(body)).split('\n').length - 1;
|
56129
|
+
})();
|
56130
|
+
function ssrFetchModule(server, id, importer) {
|
56131
|
+
return fetchModule(server, id, importer, {
|
56132
|
+
processSourceMap(map) {
|
56133
|
+
// this assumes that "new AsyncFunction" is used to create the module
|
56134
|
+
return Object.assign({}, map, {
|
56135
|
+
// currently we need to offset the line
|
56136
|
+
// https://github.com/nodejs/node/issues/43047#issuecomment-1180632750
|
56137
|
+
mappings: ';'.repeat(fnDeclarationLineCount) + map.mappings,
|
56138
|
+
});
|
56139
|
+
},
|
56140
|
+
});
|
56141
|
+
}
|
56142
|
+
|
56034
56143
|
var bufferUtil$1 = {exports: {}};
|
56035
56144
|
|
56036
56145
|
var constants = {
|
@@ -64023,7 +64132,9 @@ async function _createServer(inlineConfig = {}, options) {
|
|
64023
64132
|
? null
|
64024
64133
|
: await resolveHttpServer(serverConfig, middlewares, httpsOptions);
|
64025
64134
|
const ws = createWebSocketServer(httpServer, config, httpsOptions);
|
64026
|
-
const hot = createHMRBroadcaster()
|
64135
|
+
const hot = createHMRBroadcaster()
|
64136
|
+
.addChannel(ws)
|
64137
|
+
.addChannel(createServerHMRChannel());
|
64027
64138
|
if (typeof config.server.hmr === 'object' && config.server.hmr.channels) {
|
64028
64139
|
config.server.hmr.channels.forEach((channel) => hot.addChannel(channel));
|
64029
64140
|
}
|
@@ -64082,6 +64193,9 @@ async function _createServer(inlineConfig = {}, options) {
|
|
64082
64193
|
async ssrLoadModule(url, opts) {
|
64083
64194
|
return ssrLoadModule(url, server, undefined, undefined, opts?.fixStacktrace);
|
64084
64195
|
},
|
64196
|
+
async ssrFetchModule(url, importer) {
|
64197
|
+
return ssrFetchModule(server, url, importer);
|
64198
|
+
},
|
64085
64199
|
ssrFixStacktrace(e) {
|
64086
64200
|
ssrFixStacktrace(e, moduleGraph);
|
64087
64201
|
},
|
@@ -64683,6 +64797,9 @@ function updateModules(file, modules, timestamp, { config, hot, moduleGraph }, a
|
|
64683
64797
|
? isExplicitImportRequired(acceptedVia.url)
|
64684
64798
|
: false,
|
64685
64799
|
isWithinCircularImport,
|
64800
|
+
// browser modules are invalidated by changing ?t= query,
|
64801
|
+
// but in ssr we control the module system, so we can directly remove them form cache
|
64802
|
+
ssrInvalidates: getSSRInvalidatedImporters(acceptedVia),
|
64686
64803
|
})));
|
64687
64804
|
}
|
64688
64805
|
if (needFullReload) {
|
@@ -64706,6 +64823,24 @@ function updateModules(file, modules, timestamp, { config, hot, moduleGraph }, a
|
|
64706
64823
|
updates,
|
64707
64824
|
});
|
64708
64825
|
}
|
64826
|
+
function populateSSRImporters(module, timestamp, seen) {
|
64827
|
+
module.ssrImportedModules.forEach((importer) => {
|
64828
|
+
if (seen.has(importer)) {
|
64829
|
+
return;
|
64830
|
+
}
|
64831
|
+
if (importer.lastHMRTimestamp === timestamp ||
|
64832
|
+
importer.lastInvalidationTimestamp === timestamp) {
|
64833
|
+
seen.add(importer);
|
64834
|
+
populateSSRImporters(importer, timestamp, seen);
|
64835
|
+
}
|
64836
|
+
});
|
64837
|
+
return seen;
|
64838
|
+
}
|
64839
|
+
function getSSRInvalidatedImporters(module) {
|
64840
|
+
return [
|
64841
|
+
...populateSSRImporters(module, module.lastHMRTimestamp, new Set()),
|
64842
|
+
].map((m) => m.file);
|
64843
|
+
}
|
64709
64844
|
async function handleFileAddUnlink(file, server, isUnlink) {
|
64710
64845
|
const modules = [...(server.moduleGraph.getModulesByFile(file) || [])];
|
64711
64846
|
if (isUnlink) {
|
@@ -65090,6 +65225,44 @@ function createHMRBroadcaster() {
|
|
65090
65225
|
};
|
65091
65226
|
return broadcaster;
|
65092
65227
|
}
|
65228
|
+
function createServerHMRChannel() {
|
65229
|
+
const innerEmitter = new EventEmitter$4();
|
65230
|
+
const outsideEmitter = new EventEmitter$4();
|
65231
|
+
return {
|
65232
|
+
name: 'ssr',
|
65233
|
+
send(...args) {
|
65234
|
+
let payload;
|
65235
|
+
if (typeof args[0] === 'string') {
|
65236
|
+
payload = {
|
65237
|
+
type: 'custom',
|
65238
|
+
event: args[0],
|
65239
|
+
data: args[1],
|
65240
|
+
};
|
65241
|
+
}
|
65242
|
+
else {
|
65243
|
+
payload = args[0];
|
65244
|
+
}
|
65245
|
+
outsideEmitter.emit('send', payload);
|
65246
|
+
},
|
65247
|
+
off(event, listener) {
|
65248
|
+
innerEmitter.off(event, listener);
|
65249
|
+
},
|
65250
|
+
on: ((event, listener) => {
|
65251
|
+
innerEmitter.on(event, listener);
|
65252
|
+
}),
|
65253
|
+
close() {
|
65254
|
+
innerEmitter.removeAllListeners();
|
65255
|
+
outsideEmitter.removeAllListeners();
|
65256
|
+
},
|
65257
|
+
listen() {
|
65258
|
+
innerEmitter.emit('connection');
|
65259
|
+
},
|
65260
|
+
api: {
|
65261
|
+
innerEmitter,
|
65262
|
+
outsideEmitter,
|
65263
|
+
},
|
65264
|
+
};
|
65265
|
+
}
|
65093
65266
|
|
65094
65267
|
const debug$1 = createDebugger('vite:import-analysis');
|
65095
65268
|
const clientDir = normalizePath$3(CLIENT_DIR);
|
@@ -65097,18 +65270,11 @@ const skipRE = /\.(?:map|json)(?:$|\?)/;
|
|
65097
65270
|
const canSkipImportAnalysis = (id) => skipRE.test(id) || isDirectCSSRequest(id);
|
65098
65271
|
const optimizedDepChunkRE = /\/chunk-[A-Z\d]{8}\.js/;
|
65099
65272
|
const optimizedDepDynamicRE = /-[A-Z\d]{8}\.js/;
|
65100
|
-
const hasImportInQueryParamsRE = /[?&]import=?\b/;
|
65101
65273
|
const hasViteIgnoreRE = /\/\*\s*@vite-ignore\s*\*\//;
|
65102
65274
|
const urlIsStringRE = /^(?:'.*'|".*"|`.*`)$/;
|
65103
65275
|
const templateLiteralRE = /^\s*`(.*)`\s*$/;
|
65104
65276
|
function isExplicitImportRequired(url) {
|
65105
|
-
return !isJSRequest(
|
65106
|
-
}
|
65107
|
-
function markExplicitImport(url) {
|
65108
|
-
if (isExplicitImportRequired(url)) {
|
65109
|
-
return injectQuery(url, 'import');
|
65110
|
-
}
|
65111
|
-
return url;
|
65277
|
+
return !isJSRequest(url) && !isCSSRequest(url);
|
65112
65278
|
}
|
65113
65279
|
function extractImportedBindings(id, source, importSpec, importedBindings) {
|
65114
65280
|
let bindings = importedBindings.get(id);
|
@@ -65325,15 +65491,16 @@ function importAnalysisPlugin(config) {
|
|
65325
65491
|
// make the URL browser-valid if not SSR
|
65326
65492
|
if (!ssr) {
|
65327
65493
|
// mark non-js/css imports with `?import`
|
65328
|
-
|
65329
|
-
|
65330
|
-
|
65331
|
-
|
65332
|
-
// do not do this for unknown type imports, otherwise the appended
|
65333
|
-
// query can break 3rd party plugin's extension checks.
|
65334
|
-
if ((isRelative || isSelfImport) &&
|
65335
|
-
!hasImportInQueryParamsRE.test(url) &&
|
65494
|
+
if (isExplicitImportRequired(url)) {
|
65495
|
+
url = injectQuery(url, 'import');
|
65496
|
+
}
|
65497
|
+
else if ((isRelative || isSelfImport) &&
|
65336
65498
|
!DEP_VERSION_RE.test(url)) {
|
65499
|
+
// If the url isn't a request for a pre-bundled common chunk,
|
65500
|
+
// for relative js/css imports, or self-module virtual imports
|
65501
|
+
// (e.g. vue blocks), inherit importer's version query
|
65502
|
+
// do not do this for unknown type imports, otherwise the appended
|
65503
|
+
// query can break 3rd party plugin's extension checks.
|
65337
65504
|
const versionMatch = importer.match(DEP_VERSION_RE);
|
65338
65505
|
if (versionMatch) {
|
65339
65506
|
url = injectQuery(url, versionMatch[1]);
|
@@ -66492,9 +66659,6 @@ async function build(inlineConfig = {}) {
|
|
66492
66659
|
const outDir = resolve(options.outDir);
|
66493
66660
|
// inject ssr arg to plugin load/transform hooks
|
66494
66661
|
const plugins = (ssr ? config.plugins.map((p) => injectSsrFlagToHooks(p)) : config.plugins);
|
66495
|
-
if (isDepsOptimizerEnabled(config, ssr)) {
|
66496
|
-
await initDepsOptimizer(config);
|
66497
|
-
}
|
66498
66662
|
const rollupOptions = {
|
66499
66663
|
preserveEntrySignatures: ssr
|
66500
66664
|
? 'allow-extension'
|
@@ -67906,4 +68070,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
67906
68070
|
}
|
67907
68071
|
}
|
67908
68072
|
|
67909
|
-
export {
|
68073
|
+
export { resolveEnvPrefix as A, getDefaultExportFromCjs as B, commonjsGlobal as C, index$1 as D, index as E, build$1 as F, preview$1 as G, createLogger as a, arraify as b, colors$1 as c, defineConfig as d, createServer as e, build as f, formatPostcssSourceMap as g, preprocessCSS as h, isInNodeModules$1 as i, buildErrorMessage as j, fetchModule as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, mergeAlias as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, createFilter as u, rollupVersion as v, send as w, searchForWorkspaceRoot as x, isFileServingAllowed as y, loadEnv as z };
|
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ 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 { c as colors, a as createLogger, r as resolveConfig } from './chunks/dep-ZX7UfftI.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -32,10 +32,10 @@ import 'node:assert';
|
|
32
32
|
import 'node:v8';
|
33
33
|
import 'node:worker_threads';
|
34
34
|
import 'node:buffer';
|
35
|
+
import 'node:events';
|
35
36
|
import 'rollup/parseAst';
|
36
37
|
import 'querystring';
|
37
38
|
import 'node:readline';
|
38
|
-
import 'node:events';
|
39
39
|
import 'zlib';
|
40
40
|
import 'buffer';
|
41
41
|
import 'https';
|
@@ -757,7 +757,7 @@ cli
|
|
757
757
|
filterDuplicateOptions(options);
|
758
758
|
// output structure is preserved even after bundling so require()
|
759
759
|
// is ok here
|
760
|
-
const { createServer } = await import('./chunks/dep-
|
760
|
+
const { createServer } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.E; });
|
761
761
|
try {
|
762
762
|
const server = await createServer({
|
763
763
|
root,
|
@@ -837,7 +837,7 @@ cli
|
|
837
837
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
838
838
|
.action(async (root, options) => {
|
839
839
|
filterDuplicateOptions(options);
|
840
|
-
const { build } = await import('./chunks/dep-
|
840
|
+
const { build } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.F; });
|
841
841
|
const buildOptions = cleanOptions(options);
|
842
842
|
try {
|
843
843
|
await build({
|
@@ -865,7 +865,7 @@ cli
|
|
865
865
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
866
866
|
.action(async (root, options) => {
|
867
867
|
filterDuplicateOptions(options);
|
868
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
868
|
+
const { optimizeDeps } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.D; });
|
869
869
|
try {
|
870
870
|
const config = await resolveConfig({
|
871
871
|
root,
|
@@ -891,7 +891,7 @@ cli
|
|
891
891
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
892
892
|
.action(async (root, options) => {
|
893
893
|
filterDuplicateOptions(options);
|
894
|
-
const { preview } = await import('./chunks/dep-
|
894
|
+
const { preview } = await import('./chunks/dep-ZX7UfftI.js').then(function (n) { return n.G; });
|
895
895
|
try {
|
896
896
|
const server = await preview({
|
897
897
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -15,6 +15,8 @@ import * as url from 'node:url';
|
|
15
15
|
import { URL } from 'node:url';
|
16
16
|
import * as stream from 'node:stream';
|
17
17
|
import { Duplex, DuplexOptions } from 'node:stream';
|
18
|
+
import { F as FetchResult, V as ViteRuntimeOptions, H as HMRLogger, a as ViteModuleRunner, b as ViteRuntime, c as HMRRuntimeConnection } from './types.d-jgA8ss1A.js';
|
19
|
+
export { d as FetchFunction } from './types.d-jgA8ss1A.js';
|
18
20
|
import { SecureContextOptions } from 'node:tls';
|
19
21
|
import { ZlibOptions } from 'node:zlib';
|
20
22
|
import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
|
@@ -26,6 +28,7 @@ export { TransformOptions as EsbuildTransformOptions, version as esbuildVersion
|
|
26
28
|
import * as PostCSS from 'postcss';
|
27
29
|
export { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from '../../types/importGlob.js';
|
28
30
|
export { ChunkMetadata } from '../../types/metadata.js';
|
31
|
+
import '../../types/hot.js';
|
29
32
|
|
30
33
|
interface Alias {
|
31
34
|
find: string | RegExp
|
@@ -72,6 +75,19 @@ declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
72
75
|
*/
|
73
76
|
constructor(options?: WatchOptions)
|
74
77
|
|
78
|
+
/**
|
79
|
+
* When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
|
80
|
+
* Calling watcher.ref() multiple times will have no effect.
|
81
|
+
*/
|
82
|
+
ref(): this
|
83
|
+
|
84
|
+
/**
|
85
|
+
* When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
|
86
|
+
* If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
|
87
|
+
* Calling watcher.unref() multiple times will have no effect.
|
88
|
+
*/
|
89
|
+
unref(): this
|
90
|
+
|
75
91
|
/**
|
76
92
|
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
77
93
|
* string.
|
@@ -1487,6 +1503,12 @@ interface HMRBroadcaster extends Omit<HMRChannel, 'close' | 'name'> {
|
|
1487
1503
|
addChannel(connection: HMRChannel): HMRBroadcaster;
|
1488
1504
|
close(): Promise<unknown[]>;
|
1489
1505
|
}
|
1506
|
+
interface ServerHMRChannel extends HMRChannel {
|
1507
|
+
api: {
|
1508
|
+
innerEmitter: EventEmitter;
|
1509
|
+
outsideEmitter: EventEmitter;
|
1510
|
+
};
|
1511
|
+
}
|
1490
1512
|
|
1491
1513
|
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
1492
1514
|
interface WebSocketServer extends HMRChannel {
|
@@ -1709,6 +1731,11 @@ interface ViteDevServer {
|
|
1709
1731
|
ssrLoadModule(url: string, opts?: {
|
1710
1732
|
fixStacktrace?: boolean;
|
1711
1733
|
}): Promise<Record<string, any>>;
|
1734
|
+
/**
|
1735
|
+
* Fetch information about the module for Vite SSR runtime.
|
1736
|
+
* @experimental
|
1737
|
+
*/
|
1738
|
+
ssrFetchModule(id: string, importer?: string): Promise<FetchResult>;
|
1712
1739
|
/**
|
1713
1740
|
* Returns a fixed version of the given stack
|
1714
1741
|
*/
|
@@ -3367,6 +3394,16 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
|
|
3367
3394
|
|
3368
3395
|
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
3369
3396
|
|
3397
|
+
interface FetchModuleOptions {
|
3398
|
+
inlineSourceMap?: boolean;
|
3399
|
+
processSourceMap?<T extends NonNullable<TransformResult['map']>>(map: T): T;
|
3400
|
+
}
|
3401
|
+
/**
|
3402
|
+
* Fetch module information for Vite runtime.
|
3403
|
+
* @experimental
|
3404
|
+
*/
|
3405
|
+
declare function fetchModule(server: ViteDevServer, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
|
3406
|
+
|
3370
3407
|
declare const VERSION: string;
|
3371
3408
|
|
3372
3409
|
declare const isCSSRequest: (request: string) => boolean;
|
@@ -3427,4 +3464,40 @@ interface ManifestChunk {
|
|
3427
3464
|
dynamicImports?: string[];
|
3428
3465
|
}
|
3429
3466
|
|
3430
|
-
|
3467
|
+
/**
|
3468
|
+
* @experimental
|
3469
|
+
*/
|
3470
|
+
interface MainThreadRuntimeOptions extends Omit<ViteRuntimeOptions, 'root' | 'fetchModule' | 'hmr'> {
|
3471
|
+
/**
|
3472
|
+
* Disable HMR or configure HMR logger.
|
3473
|
+
*/
|
3474
|
+
hmr?: false | {
|
3475
|
+
logger?: false | HMRLogger;
|
3476
|
+
};
|
3477
|
+
/**
|
3478
|
+
* Provide a custom module runner. This controls how the code is executed.
|
3479
|
+
*/
|
3480
|
+
runner?: ViteModuleRunner;
|
3481
|
+
}
|
3482
|
+
/**
|
3483
|
+
* Create an instance of the Vite SSR runtime that support HMR.
|
3484
|
+
* @experimental
|
3485
|
+
*/
|
3486
|
+
declare function createViteRuntime(server: ViteDevServer, options?: MainThreadRuntimeOptions): Promise<ViteRuntime>;
|
3487
|
+
|
3488
|
+
/**
|
3489
|
+
* The connector class to establish HMR communication between the server and the Vite runtime.
|
3490
|
+
* @experimental
|
3491
|
+
*/
|
3492
|
+
declare class ServerHMRConnector implements HMRRuntimeConnection {
|
3493
|
+
private handlers;
|
3494
|
+
private hmrChannel;
|
3495
|
+
private hmrClient;
|
3496
|
+
private connected;
|
3497
|
+
constructor(server: ViteDevServer);
|
3498
|
+
isReady(): boolean;
|
3499
|
+
send(message: string): void;
|
3500
|
+
onUpdate(handler: (payload: HMRPayload) => void): void;
|
3501
|
+
}
|
3502
|
+
|
3503
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HmrContext, type HmrOptions, type HookHandler, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type MainThreadRuntimeOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createServer, createViteRuntime, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|