vite 5.0.0 → 5.0.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.
- package/dist/node/chunks/{dep-M-BNPx05.js → dep-CV-Y9tzJ.js} +1 -1
- package/dist/node/chunks/{dep-T98iZFpD.js → dep-ErEj4WmL.js} +31 -16
- package/dist/node/chunks/{dep-_v8GkZ9b.js → dep-sKpqGbYj.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
|
@@ -15796,8 +15796,15 @@ function manifestPlugin(config) {
|
|
|
15796
15796
|
const fileNameToAssetMeta = new Map();
|
|
15797
15797
|
const assets = generatedAssets.get(config);
|
|
15798
15798
|
assets.forEach((asset, referenceId) => {
|
|
15799
|
-
|
|
15800
|
-
|
|
15799
|
+
try {
|
|
15800
|
+
const fileName = this.getFileName(referenceId);
|
|
15801
|
+
fileNameToAssetMeta.set(fileName, asset);
|
|
15802
|
+
}
|
|
15803
|
+
catch (error) {
|
|
15804
|
+
// The asset was generated as part of a different output option.
|
|
15805
|
+
// It was already handled during the previous run of this plugin.
|
|
15806
|
+
assets.delete(referenceId);
|
|
15807
|
+
}
|
|
15801
15808
|
});
|
|
15802
15809
|
const fileNameToAsset = new Map();
|
|
15803
15810
|
for (const file in bundle) {
|
|
@@ -37223,6 +37230,12 @@ function buildHtmlPlugin(config) {
|
|
|
37223
37230
|
attrs: {
|
|
37224
37231
|
...(isAsync ? { async: true } : {}),
|
|
37225
37232
|
type: 'module',
|
|
37233
|
+
// crossorigin must be set not only for serving assets in a different origin
|
|
37234
|
+
// but also to make it possible to preload the script using `<link rel="preload">`.
|
|
37235
|
+
// `<script type="module">` used to fetch the script with credential mode `omit`,
|
|
37236
|
+
// however `crossorigin` attribute cannot specify that value.
|
|
37237
|
+
// https://developer.chrome.com/blog/modulepreload/#ok-so-why-doesnt-link-relpreload-work-for-modules:~:text=For%20%3Cscript%3E,of%20other%20modules.
|
|
37238
|
+
// Now `<script type="module">` uses `same origin`: https://github.com/whatwg/html/pull/3656#:~:text=Module%20scripts%20are%20always%20fetched%20with%20credentials%20mode%20%22same%2Dorigin%22%20by%20default%20and%20can%20no%20longer%0Ause%20%22omit%22
|
|
37226
37239
|
crossorigin: true,
|
|
37227
37240
|
src: toOutputPath(chunk.fileName),
|
|
37228
37241
|
},
|
|
@@ -38011,11 +38024,11 @@ function cssPostPlugin(config) {
|
|
|
38011
38024
|
return normalizePath$3(path$o.format({ ...path$o.parse(name), base: undefined, ext }));
|
|
38012
38025
|
}
|
|
38013
38026
|
if (config.build.cssCodeSplit) {
|
|
38014
|
-
if (isPureCssChunk) {
|
|
38015
|
-
// this is a shared CSS-only chunk that is empty.
|
|
38016
|
-
pureCssChunks.add(chunk);
|
|
38017
|
-
}
|
|
38018
38027
|
if (opts.format === 'es' || opts.format === 'cjs') {
|
|
38028
|
+
if (isPureCssChunk) {
|
|
38029
|
+
// this is a shared CSS-only chunk that is empty.
|
|
38030
|
+
pureCssChunks.add(chunk);
|
|
38031
|
+
}
|
|
38019
38032
|
const isEntry = chunk.isEntry && isPureCssChunk;
|
|
38020
38033
|
const cssAssetName = ensureFileExt(chunk.name, '.css');
|
|
38021
38034
|
const originalFilename = getChunkOriginalFileName(chunk, config.root, opts.format);
|
|
@@ -38496,8 +38509,8 @@ function createCachedImport(imp) {
|
|
|
38496
38509
|
return cached;
|
|
38497
38510
|
};
|
|
38498
38511
|
}
|
|
38499
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38500
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38512
|
+
const importPostcssImport = createCachedImport(() => import('./dep-CV-Y9tzJ.js').then(function (n) { return n.i; }));
|
|
38513
|
+
const importPostcssModules = createCachedImport(() => import('./dep-sKpqGbYj.js').then(function (n) { return n.i; }));
|
|
38501
38514
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38502
38515
|
/**
|
|
38503
38516
|
* @experimental
|
|
@@ -57149,13 +57162,10 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
57149
57162
|
if (
|
|
57150
57163
|
// Only accept GET or HEAD
|
|
57151
57164
|
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
|
57152
|
-
// Require Accept header
|
|
57153
|
-
!req.headers ||
|
|
57154
|
-
typeof req.headers.accept !== 'string' ||
|
|
57155
|
-
// Ignore JSON requests
|
|
57156
|
-
req.headers.accept.includes('application/json') ||
|
|
57157
57165
|
// Require Accept: text/html or */*
|
|
57158
|
-
!(req.headers.accept
|
|
57166
|
+
!(req.headers.accept === undefined || // equivalent to `Accept: */*`
|
|
57167
|
+
req.headers.accept === '' || // equivalent to `Accept: */*`
|
|
57168
|
+
req.headers.accept.includes('text/html') ||
|
|
57159
57169
|
req.headers.accept.includes('*/*'))) {
|
|
57160
57170
|
return next();
|
|
57161
57171
|
}
|
|
@@ -59064,8 +59074,9 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
|
|
|
59064
59074
|
* @param nodeChain The chain of nodes/imports that lead to the node.
|
|
59065
59075
|
* (The last node in the chain imports the `node` parameter)
|
|
59066
59076
|
* @param currentChain The current chain tracked from the `node` parameter
|
|
59077
|
+
* @param traversedModules The set of modules that have traversed
|
|
59067
59078
|
*/
|
|
59068
|
-
function isNodeWithinCircularImports(node, nodeChain, currentChain = [node]) {
|
|
59079
|
+
function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], traversedModules = new Set()) {
|
|
59069
59080
|
// To help visualize how each parameters work, imagine this import graph:
|
|
59070
59081
|
//
|
|
59071
59082
|
// A -> B -> C -> ACCEPTED -> D -> E -> NODE
|
|
@@ -59081,6 +59092,10 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node]) {
|
|
|
59081
59092
|
//
|
|
59082
59093
|
// It works by checking if any `node` importers are within `nodeChain`, which
|
|
59083
59094
|
// means there's an import loop with a HMR-accepted module in it.
|
|
59095
|
+
if (traversedModules.has(node)) {
|
|
59096
|
+
return false;
|
|
59097
|
+
}
|
|
59098
|
+
traversedModules.add(node);
|
|
59084
59099
|
for (const importer of node.importers) {
|
|
59085
59100
|
// Node may import itself which is safe
|
|
59086
59101
|
if (importer === node)
|
|
@@ -59107,7 +59122,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node]) {
|
|
|
59107
59122
|
}
|
|
59108
59123
|
// Continue recursively
|
|
59109
59124
|
if (!currentChain.includes(importer)) {
|
|
59110
|
-
const result = isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer));
|
|
59125
|
+
const result = isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
|
|
59111
59126
|
if (result)
|
|
59112
59127
|
return result;
|
|
59113
59128
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-
|
|
1
|
+
import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-ErEj4WmL.js';
|
|
2
2
|
import require$$0__default from 'fs';
|
|
3
3
|
import require$$0 from 'postcss';
|
|
4
4
|
import require$$0$1 from 'path';
|
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 { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-ErEj4WmL.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-ErEj4WmL.js').then(function (n) { return n.A; });
|
|
763
763
|
try {
|
|
764
764
|
const server = await createServer({
|
|
765
765
|
root,
|
|
@@ -839,7 +839,7 @@ cli
|
|
|
839
839
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
840
840
|
.action(async (root, options) => {
|
|
841
841
|
filterDuplicateOptions(options);
|
|
842
|
-
const { build } = await import('./chunks/dep-
|
|
842
|
+
const { build } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.C; });
|
|
843
843
|
const buildOptions = cleanOptions(options);
|
|
844
844
|
try {
|
|
845
845
|
await build({
|
|
@@ -867,7 +867,7 @@ cli
|
|
|
867
867
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
868
868
|
.action(async (root, options) => {
|
|
869
869
|
filterDuplicateOptions(options);
|
|
870
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
870
|
+
const { optimizeDeps } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.B; });
|
|
871
871
|
try {
|
|
872
872
|
const config = await resolveConfig({
|
|
873
873
|
root,
|
|
@@ -893,7 +893,7 @@ cli
|
|
|
893
893
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
894
894
|
.action(async (root, options) => {
|
|
895
895
|
filterDuplicateOptions(options);
|
|
896
|
-
const { preview } = await import('./chunks/dep-
|
|
896
|
+
const { preview } = await import('./chunks/dep-ErEj4WmL.js').then(function (n) { return n.D; });
|
|
897
897
|
try {
|
|
898
898
|
const server = await preview({
|
|
899
899
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -2760,6 +2760,7 @@ interface CSSModulesOptions {
|
|
|
2760
2760
|
getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
|
|
2761
2761
|
scopeBehaviour?: 'global' | 'local';
|
|
2762
2762
|
globalModulePaths?: RegExp[];
|
|
2763
|
+
exportGlobals?: boolean;
|
|
2763
2764
|
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
|
2764
2765
|
hashPrefix?: string;
|
|
2765
2766
|
/**
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
|
2
|
-
import { i as isInNodeModules } from './chunks/dep-
|
|
3
|
-
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
2
|
+
import { i as isInNodeModules } from './chunks/dep-ErEj4WmL.js';
|
|
3
|
+
export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ErEj4WmL.js';
|
|
4
4
|
export { VERSION as version } from './constants.js';
|
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
|
6
6
|
export { VERSION as rollupVersion } from 'rollup';
|