vite 4.5.10 → 4.5.12
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/node/chunks/{dep-413616b5.js → dep-5215c85e.js} +1 -1
- package/dist/node/chunks/{dep-add429cd.js → dep-845e3752.js} +40 -16
- package/dist/node/chunks/{dep-f75a2f53.js → dep-faa9987b.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { F as commonjsGlobal, E as getDefaultExportFromCjs } from './dep-845e3752.js';
|
|
2
2
|
import require$$0__default from 'fs';
|
|
3
3
|
import require$$0 from 'postcss';
|
|
4
4
|
import require$$0$1 from 'path';
|
|
@@ -16068,8 +16068,8 @@ class MagicString {
|
|
|
16068
16068
|
}
|
|
16069
16069
|
|
|
16070
16070
|
const assetUrlRE = /__VITE_ASSET__([a-z\d]+)__(?:\$_(.*?)__)?/g;
|
|
16071
|
-
const rawRE = /(?:\?|&)raw(?:&|$)/;
|
|
16072
|
-
const urlRE = /(\?|&)url(?:&|$)/;
|
|
16071
|
+
const rawRE$1 = /(?:\?|&)raw(?:&|$)/;
|
|
16072
|
+
const urlRE$1 = /(\?|&)url(?:&|$)/;
|
|
16073
16073
|
const jsSourceMapRE = /\.[cm]?js\.map$/;
|
|
16074
16074
|
const unnededFinalQueryCharRE = /[?&]$/;
|
|
16075
16075
|
const assetCache = new WeakMap();
|
|
@@ -16136,7 +16136,7 @@ function assetPlugin(config) {
|
|
|
16136
16136
|
generatedAssets.set(config, new Map());
|
|
16137
16137
|
},
|
|
16138
16138
|
resolveId(id) {
|
|
16139
|
-
if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
|
|
16139
|
+
if (!config.assetsInclude(cleanUrl(id)) && !urlRE$1.test(id)) {
|
|
16140
16140
|
return;
|
|
16141
16141
|
}
|
|
16142
16142
|
// imports to absolute urls pointing to files in /public
|
|
@@ -16153,15 +16153,15 @@ function assetPlugin(config) {
|
|
|
16153
16153
|
return;
|
|
16154
16154
|
}
|
|
16155
16155
|
// raw requests, read from disk
|
|
16156
|
-
if (rawRE.test(id)) {
|
|
16156
|
+
if (rawRE$1.test(id)) {
|
|
16157
16157
|
const file = checkPublicFile(id, config) || cleanUrl(id);
|
|
16158
16158
|
// raw query, read file and return as string
|
|
16159
16159
|
return `export default ${JSON.stringify(await fsp.readFile(file, 'utf-8'))}`;
|
|
16160
16160
|
}
|
|
16161
|
-
if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) {
|
|
16161
|
+
if (!config.assetsInclude(cleanUrl(id)) && !urlRE$1.test(id)) {
|
|
16162
16162
|
return;
|
|
16163
16163
|
}
|
|
16164
|
-
id = id.replace(urlRE, '$1').replace(unnededFinalQueryCharRE, '');
|
|
16164
|
+
id = id.replace(urlRE$1, '$1').replace(unnededFinalQueryCharRE, '');
|
|
16165
16165
|
const url = await fileToUrl(id, config, this);
|
|
16166
16166
|
return `export default ${JSON.stringify(url)}`;
|
|
16167
16167
|
},
|
|
@@ -38224,7 +38224,7 @@ const cssModuleRE = new RegExp(`\\.module${CSS_LANGS_RE.source}`);
|
|
|
38224
38224
|
const directRequestRE = /[?&]direct\b/;
|
|
38225
38225
|
const htmlProxyRE = /[?&]html-proxy\b/;
|
|
38226
38226
|
const commonjsProxyRE = /\?commonjs-proxy/;
|
|
38227
|
-
const inlineRE = /[?&]inline\b/;
|
|
38227
|
+
const inlineRE$1 = /[?&]inline\b/;
|
|
38228
38228
|
const inlineCSSRE = /[?&]inline-css\b/;
|
|
38229
38229
|
const styleAttrRE = /[?&]style-attr\b/;
|
|
38230
38230
|
const usedRE = /[?&]used\b/;
|
|
@@ -38315,7 +38315,7 @@ function cssPlugin(config) {
|
|
|
38315
38315
|
const thisModule = moduleGraph.getModuleById(id);
|
|
38316
38316
|
if (thisModule) {
|
|
38317
38317
|
// CSS modules cannot self-accept since it exports values
|
|
38318
|
-
const isSelfAccepting = !modules && !inlineRE.test(id) && !htmlProxyRE.test(id);
|
|
38318
|
+
const isSelfAccepting = !modules && !inlineRE$1.test(id) && !htmlProxyRE.test(id);
|
|
38319
38319
|
if (deps) {
|
|
38320
38320
|
// record deps in the module graph so edits to @import css can trigger
|
|
38321
38321
|
// main import to hot update
|
|
@@ -38394,7 +38394,7 @@ function cssPostPlugin(config) {
|
|
|
38394
38394
|
return;
|
|
38395
38395
|
}
|
|
38396
38396
|
css = stripBomTag(css);
|
|
38397
|
-
const inlined = inlineRE.test(id);
|
|
38397
|
+
const inlined = inlineRE$1.test(id);
|
|
38398
38398
|
const modules = cssModulesCache.get(config).get(id);
|
|
38399
38399
|
// #6984, #7552
|
|
38400
38400
|
// `foo.module.css` => modulesCode
|
|
@@ -38995,8 +38995,8 @@ function createCachedImport(imp) {
|
|
|
38995
38995
|
return cached;
|
|
38996
38996
|
};
|
|
38997
38997
|
}
|
|
38998
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38999
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38998
|
+
const importPostcssImport = createCachedImport(() => import('./dep-faa9987b.js').then(function (n) { return n.i; }));
|
|
38999
|
+
const importPostcssModules = createCachedImport(() => import('./dep-5215c85e.js').then(function (n) { return n.i; }));
|
|
39000
39000
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
39001
39001
|
/**
|
|
39002
39002
|
* @experimental
|
|
@@ -41988,7 +41988,7 @@ function importAnalysisPlugin(config) {
|
|
|
41988
41988
|
// warn imports to non-asset /public files
|
|
41989
41989
|
if (specifier[0] === '/' &&
|
|
41990
41990
|
!(config.assetsInclude(cleanUrl(specifier)) ||
|
|
41991
|
-
urlRE.test(specifier)) &&
|
|
41991
|
+
urlRE$1.test(specifier)) &&
|
|
41992
41992
|
checkPublicFile(specifier, config)) {
|
|
41993
41993
|
throw new Error(`Cannot import non-asset file ${specifier} which is inside /public. ` +
|
|
41994
41994
|
`JS/CSS files inside /public are copied as-is on build and ` +
|
|
@@ -42412,6 +42412,7 @@ function serializeDefine(define) {
|
|
|
42412
42412
|
}
|
|
42413
42413
|
|
|
42414
42414
|
const wasmHelperId = '\0vite/wasm-helper';
|
|
42415
|
+
const wasmInitRE = /(?<![?#].*)\.wasm\?init/;
|
|
42415
42416
|
const wasmHelper = async (opts = {}, url) => {
|
|
42416
42417
|
let result;
|
|
42417
42418
|
if (url.startsWith('data:')) {
|
|
@@ -42464,7 +42465,7 @@ const wasmHelperPlugin = (config) => {
|
|
|
42464
42465
|
if (id === wasmHelperId) {
|
|
42465
42466
|
return `export default ${wasmHelperCode}`;
|
|
42466
42467
|
}
|
|
42467
|
-
if (!
|
|
42468
|
+
if (!wasmInitRE.test(id)) {
|
|
42468
42469
|
return;
|
|
42469
42470
|
}
|
|
42470
42471
|
const url = await fileToUrl(id, config, this);
|
|
@@ -54853,6 +54854,7 @@ function setClientErrorHandler(server, logger) {
|
|
|
54853
54854
|
|
|
54854
54855
|
const ERR_LOAD_URL = 'ERR_LOAD_URL';
|
|
54855
54856
|
const ERR_LOAD_PUBLIC_URL = 'ERR_LOAD_PUBLIC_URL';
|
|
54857
|
+
const ERR_DENIED_ID = 'ERR_DENIED_ID';
|
|
54856
54858
|
const debugLoad = createDebugger('vite:load');
|
|
54857
54859
|
const debugTransform = createDebugger('vite:transform');
|
|
54858
54860
|
const debugCache$1 = createDebugger('vite:cache');
|
|
@@ -54950,6 +54952,11 @@ async function loadAndTransform(id, url, server, options, timestamp, mod, resolv
|
|
|
54950
54952
|
const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url, config.root) : '';
|
|
54951
54953
|
const ssr = !!options.ssr;
|
|
54952
54954
|
const file = cleanUrl(id);
|
|
54955
|
+
if (options.allowId && !options.allowId(id)) {
|
|
54956
|
+
const err = new Error(`Denied ID ${id}`);
|
|
54957
|
+
err.code = ERR_DENIED_ID;
|
|
54958
|
+
throw err;
|
|
54959
|
+
}
|
|
54953
54960
|
let code = null;
|
|
54954
54961
|
let map = null;
|
|
54955
54962
|
// load
|
|
@@ -64490,6 +64497,18 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
64490
64497
|
const debugCache = createDebugger('vite:cache');
|
|
64491
64498
|
const knownIgnoreList = new Set(['/', '/favicon.ico']);
|
|
64492
64499
|
const trailingQuerySeparatorsRE = /[?&]+$/;
|
|
64500
|
+
// TODO: consolidate this regex pattern with the url, raw, and inline checks in plugins
|
|
64501
|
+
const urlRE = /[?&]url\b/;
|
|
64502
|
+
const rawRE = /[?&]raw\b/;
|
|
64503
|
+
const inlineRE = /[?&]inline\b/;
|
|
64504
|
+
const svgRE = /\.svg\b/;
|
|
64505
|
+
function deniedServingAccessForTransform(url, server, res, next) {
|
|
64506
|
+
return ((rawRE.test(url) ||
|
|
64507
|
+
urlRE.test(url) ||
|
|
64508
|
+
inlineRE.test(url) ||
|
|
64509
|
+
svgRE.test(url)) &&
|
|
64510
|
+
!ensureServingAccess(url, server, res, next));
|
|
64511
|
+
}
|
|
64493
64512
|
function transformMiddleware(server) {
|
|
64494
64513
|
const { config: { root, logger }, moduleGraph, } = server;
|
|
64495
64514
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
@@ -64586,9 +64605,7 @@ function transformMiddleware(server) {
|
|
|
64586
64605
|
}
|
|
64587
64606
|
}
|
|
64588
64607
|
const urlWithoutTrailingQuerySeparators = url.replace(trailingQuerySeparatorsRE, '');
|
|
64589
|
-
if ((
|
|
64590
|
-
urlRE.test(urlWithoutTrailingQuerySeparators)) &&
|
|
64591
|
-
!ensureServingAccess(urlWithoutTrailingQuerySeparators, server, res, next)) {
|
|
64608
|
+
if (deniedServingAccessForTransform(urlWithoutTrailingQuerySeparators, server, res, next)) {
|
|
64592
64609
|
return;
|
|
64593
64610
|
}
|
|
64594
64611
|
if (isJSRequest(url) ||
|
|
@@ -64619,6 +64636,9 @@ function transformMiddleware(server) {
|
|
|
64619
64636
|
// resolve, load and transform using the plugin container
|
|
64620
64637
|
const result = await transformRequest(url, server, {
|
|
64621
64638
|
html: req.headers.accept?.includes('text/html'),
|
|
64639
|
+
allowId(id) {
|
|
64640
|
+
return !deniedServingAccessForTransform(id, server, res, next);
|
|
64641
|
+
},
|
|
64622
64642
|
});
|
|
64623
64643
|
if (result) {
|
|
64624
64644
|
const depsOptimizer = getDepsOptimizer(server.config, false); // non-ssr
|
|
@@ -64680,6 +64700,10 @@ function transformMiddleware(server) {
|
|
|
64680
64700
|
// Let other middleware handle if we can't load the url via transformRequest
|
|
64681
64701
|
return next();
|
|
64682
64702
|
}
|
|
64703
|
+
if (e?.code === ERR_DENIED_ID) {
|
|
64704
|
+
// next() is called in ensureServingAccess
|
|
64705
|
+
return;
|
|
64706
|
+
}
|
|
64683
64707
|
return next(e);
|
|
64684
64708
|
}
|
|
64685
64709
|
next();
|
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-845e3752.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import 'node:url';
|
|
@@ -759,7 +759,7 @@ cli
|
|
|
759
759
|
filterDuplicateOptions(options);
|
|
760
760
|
// output structure is preserved even after bundling so require()
|
|
761
761
|
// is ok here
|
|
762
|
-
const { createServer } = await import('./chunks/dep-
|
|
762
|
+
const { createServer } = await import('./chunks/dep-845e3752.js').then(function (n) { return n.I; });
|
|
763
763
|
try {
|
|
764
764
|
const server = await createServer({
|
|
765
765
|
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-845e3752.js').then(function (n) { return n.H; });
|
|
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-845e3752.js').then(function (n) { return n.G; });
|
|
869
869
|
try {
|
|
870
870
|
const config = await resolveConfig({
|
|
871
871
|
root,
|
|
@@ -892,7 +892,7 @@ cli
|
|
|
892
892
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
893
893
|
.action(async (root, options) => {
|
|
894
894
|
filterDuplicateOptions(options);
|
|
895
|
-
const { preview } = await import('./chunks/dep-
|
|
895
|
+
const { preview } = await import('./chunks/dep-845e3752.js').then(function (n) { return n.J; });
|
|
896
896
|
try {
|
|
897
897
|
const server = await preview({
|
|
898
898
|
root,
|
package/dist/node/index.d.ts
CHANGED
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-845e3752.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-845e3752.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';
|