vite 4.3.3 → 4.3.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-f7d05e3f.js';
|
|
2
2
|
import require$$0__default from 'fs';
|
|
3
3
|
import require$$0 from 'postcss';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
@@ -32855,7 +32855,7 @@ function resolveEnd(end, offset, reqSpace, onError) {
|
|
|
32855
32855
|
}
|
|
32856
32856
|
|
|
32857
32857
|
const blockMsg = 'Block collections are not allowed within flow collections';
|
|
32858
|
-
const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
|
|
32858
|
+
const isBlock$1 = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
|
|
32859
32859
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError) {
|
|
32860
32860
|
const isMap = fc.start.source === '{';
|
|
32861
32861
|
const fcName = isMap ? 'flow map' : 'flow sequence';
|
|
@@ -32938,7 +32938,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
32938
32938
|
: composeEmptyNode(ctx, props.end, sep, null, props, onError);
|
|
32939
32939
|
coll.items.push(valueNode);
|
|
32940
32940
|
offset = valueNode.range[2];
|
|
32941
|
-
if (isBlock(value))
|
|
32941
|
+
if (isBlock$1(value))
|
|
32942
32942
|
onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
32943
32943
|
}
|
|
32944
32944
|
else {
|
|
@@ -32948,7 +32948,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
32948
32948
|
const keyNode = key
|
|
32949
32949
|
? composeNode(ctx, key, props, onError)
|
|
32950
32950
|
: composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
32951
|
-
if (isBlock(key))
|
|
32951
|
+
if (isBlock$1(key))
|
|
32952
32952
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
32953
32953
|
// value properties
|
|
32954
32954
|
const valueProps = resolveProps(sep ?? [], {
|
|
@@ -32987,7 +32987,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
32987
32987
|
? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)
|
|
32988
32988
|
: null;
|
|
32989
32989
|
if (valueNode) {
|
|
32990
|
-
if (isBlock(value))
|
|
32990
|
+
if (isBlock$1(value))
|
|
32991
32991
|
onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
32992
32992
|
}
|
|
32993
32993
|
else if (valueProps.comment) {
|
|
@@ -38574,8 +38574,8 @@ function createCachedImport(imp) {
|
|
|
38574
38574
|
return cached;
|
|
38575
38575
|
};
|
|
38576
38576
|
}
|
|
38577
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38578
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38577
|
+
const importPostcssImport = createCachedImport(() => import('./dep-524177e3.js').then(function (n) { return n.i; }));
|
|
38578
|
+
const importPostcssModules = createCachedImport(() => import('./dep-53740c38.js').then(function (n) { return n.i; }));
|
|
38579
38579
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38580
38580
|
/**
|
|
38581
38581
|
* @experimental
|
|
@@ -41550,13 +41550,7 @@ function definePlugin(config) {
|
|
|
41550
41550
|
if (isBuild) {
|
|
41551
41551
|
const match = key.match(metaEnvRe);
|
|
41552
41552
|
if (match) {
|
|
41553
|
-
userDefineEnv[match[1]] =
|
|
41554
|
-
// test if value is raw identifier to wrap with __vite__ so when
|
|
41555
|
-
// stringified for `import.meta.env`, we can remove the quotes and
|
|
41556
|
-
// retain being an identifier
|
|
41557
|
-
typeof val === 'string' && /^[\p{L}_$]/u.test(val.trim())
|
|
41558
|
-
? `__vite__define__${val}`
|
|
41559
|
-
: val;
|
|
41553
|
+
userDefineEnv[match[1]] = `__vite__define__${userDefine[key]}`;
|
|
41560
41554
|
}
|
|
41561
41555
|
}
|
|
41562
41556
|
}
|
|
@@ -41575,7 +41569,7 @@ function definePlugin(config) {
|
|
|
41575
41569
|
...config.env,
|
|
41576
41570
|
SSR: '__vite__ssr__',
|
|
41577
41571
|
...userDefineEnv,
|
|
41578
|
-
}).replace(/"__vite__define__(.+?)"/g, (_, val) => val),
|
|
41572
|
+
}).replace(/"__vite__define__(.+?)"([,}])/g, (_, val, suffix) => `${val.replace(/(^\\")|(\\"$)/g, '"')}${suffix}`),
|
|
41579
41573
|
});
|
|
41580
41574
|
}
|
|
41581
41575
|
function getImportMetaKeys(ssr) {
|
|
@@ -44896,7 +44890,7 @@ const isModernFlag = `__VITE_IS_MODERN__`;
|
|
|
44896
44890
|
const preloadMethod = `__vitePreload`;
|
|
44897
44891
|
const preloadMarker = `__VITE_PRELOAD__`;
|
|
44898
44892
|
const preloadHelperId = '\0vite/preload-helper';
|
|
44899
|
-
const preloadMarkerWithQuote = `"${preloadMarker}"
|
|
44893
|
+
const preloadMarkerWithQuote = new RegExp(`['"]${preloadMarker}['"]`);
|
|
44900
44894
|
const dynamicImportPrefixRE = /import\s*\(/;
|
|
44901
44895
|
// TODO: abstract
|
|
44902
44896
|
const optimizedDepChunkRE = /\/chunk-[A-Z\d]{8}\.js/;
|
|
@@ -44905,6 +44899,13 @@ function toRelativePath(filename, importer) {
|
|
|
44905
44899
|
const relPath = path$o.relative(path$o.dirname(importer), filename);
|
|
44906
44900
|
return relPath[0] === '.' ? relPath : `./${relPath}`;
|
|
44907
44901
|
}
|
|
44902
|
+
function indexOfMatchInSlice(str, reg, pos = 0) {
|
|
44903
|
+
if (pos !== 0) {
|
|
44904
|
+
str = str.slice(pos);
|
|
44905
|
+
}
|
|
44906
|
+
const matcher = str.match(reg);
|
|
44907
|
+
return matcher?.index !== undefined ? matcher.index + pos : -1;
|
|
44908
|
+
}
|
|
44908
44909
|
/**
|
|
44909
44910
|
* Helper for preloading CSS and direct imports of async chunks in parallel to
|
|
44910
44911
|
* the async chunk itself.
|
|
@@ -45252,10 +45253,10 @@ function buildImportAnalysisPlugin(config) {
|
|
|
45252
45253
|
};
|
|
45253
45254
|
addDeps(normalizedFile);
|
|
45254
45255
|
}
|
|
45255
|
-
let markerStartPos = code
|
|
45256
|
+
let markerStartPos = indexOfMatchInSlice(code, preloadMarkerWithQuote, end);
|
|
45256
45257
|
// fix issue #3051
|
|
45257
45258
|
if (markerStartPos === -1 && imports.length === 1) {
|
|
45258
|
-
markerStartPos = code
|
|
45259
|
+
markerStartPos = indexOfMatchInSlice(code, preloadMarkerWithQuote);
|
|
45259
45260
|
}
|
|
45260
45261
|
if (markerStartPos > 0) {
|
|
45261
45262
|
// the dep list includes the main chunk, so only need to reload when there are actual other deps.
|
|
@@ -45304,19 +45305,19 @@ function buildImportAnalysisPlugin(config) {
|
|
|
45304
45305
|
? toRelativePath(d, file)
|
|
45305
45306
|
: d));
|
|
45306
45307
|
}
|
|
45307
|
-
s.update(markerStartPos, markerStartPos +
|
|
45308
|
+
s.update(markerStartPos, markerStartPos + preloadMarker.length + 2, `[${renderedDeps.join(',')}]`);
|
|
45308
45309
|
rewroteMarkerStartPos.add(markerStartPos);
|
|
45309
45310
|
}
|
|
45310
45311
|
}
|
|
45311
45312
|
}
|
|
45312
45313
|
// there may still be markers due to inlined dynamic imports, remove
|
|
45313
45314
|
// all the markers regardless
|
|
45314
|
-
let markerStartPos = code
|
|
45315
|
+
let markerStartPos = indexOfMatchInSlice(code, preloadMarkerWithQuote);
|
|
45315
45316
|
while (markerStartPos >= 0) {
|
|
45316
45317
|
if (!rewroteMarkerStartPos.has(markerStartPos)) {
|
|
45317
|
-
s.update(markerStartPos, markerStartPos +
|
|
45318
|
+
s.update(markerStartPos, markerStartPos + preloadMarker.length + 2, 'void 0');
|
|
45318
45319
|
}
|
|
45319
|
-
markerStartPos = code
|
|
45320
|
+
markerStartPos = indexOfMatchInSlice(code, preloadMarkerWithQuote, markerStartPos + preloadMarker.length + 2);
|
|
45320
45321
|
}
|
|
45321
45322
|
if (s.hasChanged()) {
|
|
45322
45323
|
chunk.code = s.toString();
|
|
@@ -54116,11 +54117,12 @@ const functionNodeTypeRE = /Function(?:Expression|Declaration)$|Method$/;
|
|
|
54116
54117
|
function isFunction(node) {
|
|
54117
54118
|
return functionNodeTypeRE.test(node.type);
|
|
54118
54119
|
}
|
|
54120
|
+
const blockNodeTypeRE = /^BlockStatement$|^For(?:In|Of)?Statement$/;
|
|
54121
|
+
function isBlock(node) {
|
|
54122
|
+
return blockNodeTypeRE.test(node.type);
|
|
54123
|
+
}
|
|
54119
54124
|
function findParentScope(parentStack, isVar = false) {
|
|
54120
|
-
|
|
54121
|
-
? isFunction
|
|
54122
|
-
: (node) => node.type === 'BlockStatement';
|
|
54123
|
-
return parentStack.find(predicate);
|
|
54125
|
+
return parentStack.find(isVar ? isFunction : isBlock);
|
|
54124
54126
|
}
|
|
54125
54127
|
function isInDestructuringAssignment(parent, parentStack) {
|
|
54126
54128
|
if (parent &&
|
|
@@ -63452,6 +63454,8 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
63452
63454
|
const listen = httpServer.listen.bind(httpServer);
|
|
63453
63455
|
httpServer.listen = (async (port, ...args) => {
|
|
63454
63456
|
try {
|
|
63457
|
+
// ensure ws server started
|
|
63458
|
+
ws.listen();
|
|
63455
63459
|
await initServer();
|
|
63456
63460
|
}
|
|
63457
63461
|
catch (e) {
|
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 { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { C as colors, D as bindShortcuts, x as createLogger, h as resolveConfig } from './chunks/dep-f7d05e3f.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -728,7 +728,7 @@ cli
|
|
|
728
728
|
filterDuplicateOptions(options);
|
|
729
729
|
// output structure is preserved even after bundling so require()
|
|
730
730
|
// is ok here
|
|
731
|
-
const { createServer } = await import('./chunks/dep-
|
|
731
|
+
const { createServer } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.I; });
|
|
732
732
|
try {
|
|
733
733
|
const server = await createServer({
|
|
734
734
|
root,
|
|
@@ -806,7 +806,7 @@ cli
|
|
|
806
806
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
807
807
|
.action(async (root, options) => {
|
|
808
808
|
filterDuplicateOptions(options);
|
|
809
|
-
const { build } = await import('./chunks/dep-
|
|
809
|
+
const { build } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.H; });
|
|
810
810
|
const buildOptions = cleanOptions(options);
|
|
811
811
|
try {
|
|
812
812
|
await build({
|
|
@@ -834,7 +834,7 @@ cli
|
|
|
834
834
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
835
835
|
.action(async (root, options) => {
|
|
836
836
|
filterDuplicateOptions(options);
|
|
837
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
837
|
+
const { optimizeDeps } = await import('./chunks/dep-f7d05e3f.js').then(function (n) { return n.G; });
|
|
838
838
|
try {
|
|
839
839
|
const config = await resolveConfig({
|
|
840
840
|
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-f7d05e3f.js').then(function (n) { return n.J; });
|
|
864
864
|
try {
|
|
865
865
|
const server = await preview({
|
|
866
866
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as isInNodeModules } from './chunks/dep-
|
|
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, z as isFileServingAllowed, l as loadConfigFromFile, A 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, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
import { i as isInNodeModules } from './chunks/dep-f7d05e3f.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, z as isFileServingAllowed, l as loadConfigFromFile, A 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, B as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, y as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-f7d05e3f.js';
|
|
3
3
|
export { VERSION as version } from './constants.js';
|
|
4
4
|
export { version as esbuildVersion } from 'esbuild';
|
|
5
5
|
export { VERSION as rollupVersion } from 'rollup';
|