vite 4.0.0-alpha.3 → 4.0.0-alpha.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs$l, { promises as promises$2 } from 'node:fs';
|
|
2
|
-
import path$o, { posix as posix$1, isAbsolute as isAbsolute$2,
|
|
2
|
+
import path$o, { posix as posix$1, isAbsolute as isAbsolute$2, join as join$2, relative as relative$2, dirname as dirname$2, basename as basename$2, extname as extname$1 } from 'node:path';
|
|
3
3
|
import { URL as URL$3, URLSearchParams, parse as parse$j, pathToFileURL as pathToFileURL$1 } from 'node:url';
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
5
|
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
|
@@ -22,7 +22,7 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
|
22
22
|
import { promisify as promisify$4 } from 'node:util';
|
|
23
23
|
import { promises } from 'node:dns';
|
|
24
24
|
import resolve$5 from 'resolve';
|
|
25
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION as VERSION$1, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
26
26
|
import require$$5 from 'crypto';
|
|
27
27
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
28
28
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
|
@@ -32,6 +32,7 @@ import require$$1$2 from 'https';
|
|
|
32
32
|
import require$$4 from 'tls';
|
|
33
33
|
import { STATUS_CODES } from 'node:http';
|
|
34
34
|
import { createServer as createServer$2 } from 'node:https';
|
|
35
|
+
import { VERSION } from 'rollup';
|
|
35
36
|
import * as qs from 'querystring';
|
|
36
37
|
import readline from 'node:readline';
|
|
37
38
|
import { execSync } from 'node:child_process';
|
|
@@ -20884,9 +20885,9 @@ async function bundleWorkerEntry(config, id, query) {
|
|
|
20884
20885
|
: workerOutputConfig
|
|
20885
20886
|
: {};
|
|
20886
20887
|
const { output: [outputChunk, ...outputChunks] } = await bundle.generate({
|
|
20887
|
-
entryFileNames: path$o.posix.join(config.build.assetsDir, '[name]
|
|
20888
|
-
chunkFileNames: path$o.posix.join(config.build.assetsDir, '[name]
|
|
20889
|
-
assetFileNames: path$o.posix.join(config.build.assetsDir, '[name]
|
|
20888
|
+
entryFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
20889
|
+
chunkFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
20890
|
+
assetFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].[ext]'),
|
|
20890
20891
|
...workerConfig,
|
|
20891
20892
|
format,
|
|
20892
20893
|
sourcemap: config.build.sourcemap
|
|
@@ -36451,7 +36452,7 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
36451
36452
|
}));
|
|
36452
36453
|
}
|
|
36453
36454
|
if (isModule) {
|
|
36454
|
-
postcssPlugins.unshift((await import('./dep-
|
|
36455
|
+
postcssPlugins.unshift((await import('./dep-2ed340b5.js').then(function (n) { return n.i; })).default({
|
|
36455
36456
|
...modulesOptions,
|
|
36456
36457
|
localsConvention: modulesOptions?.localsConvention,
|
|
36457
36458
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
@@ -38992,7 +38993,7 @@ function importAnalysisPlugin(config) {
|
|
|
38992
38993
|
// properly finish the request with a 504 sent to the browser.
|
|
38993
38994
|
throwOutdatedRequest(importer);
|
|
38994
38995
|
}
|
|
38995
|
-
if (!imports.length) {
|
|
38996
|
+
if (!imports.length && !this._addedImports) {
|
|
38996
38997
|
importerModule.isSelfAccepting = false;
|
|
38997
38998
|
isDebug$1 &&
|
|
38998
38999
|
debug$9(`${timeFrom(start)} ${picocolors.exports.dim(`[no imports] ${prettyImporter}`)}`);
|
|
@@ -39013,7 +39014,7 @@ function importAnalysisPlugin(config) {
|
|
|
39013
39014
|
? new Map()
|
|
39014
39015
|
: null;
|
|
39015
39016
|
const toAbsoluteUrl = (url) => path$o.posix.resolve(path$o.posix.dirname(importerModule.url), url);
|
|
39016
|
-
const normalizeUrl = async (url, pos) => {
|
|
39017
|
+
const normalizeUrl = async (url, pos, forceSkipImportAnalysis = false) => {
|
|
39017
39018
|
url = stripBase(url, base);
|
|
39018
39019
|
let importerFile = importer;
|
|
39019
39020
|
const optimizeDeps = getDepOptimizationConfig(config, ssr);
|
|
@@ -39091,7 +39092,7 @@ function importAnalysisPlugin(config) {
|
|
|
39091
39092
|
// up-to-date version of this module.
|
|
39092
39093
|
try {
|
|
39093
39094
|
// delay setting `isSelfAccepting` until the file is actually used (#7870)
|
|
39094
|
-
const depModule = await moduleGraph.ensureEntryFromUrl(unwrapId(url), ssr, canSkipImportAnalysis(url));
|
|
39095
|
+
const depModule = await moduleGraph.ensureEntryFromUrl(unwrapId(url), ssr, canSkipImportAnalysis(url) || forceSkipImportAnalysis);
|
|
39095
39096
|
if (depModule.lastHMRTimestamp > 0) {
|
|
39096
39097
|
url = injectQuery(url, `t=${depModule.lastHMRTimestamp}`);
|
|
39097
39098
|
}
|
|
@@ -39306,7 +39307,7 @@ function importAnalysisPlugin(config) {
|
|
|
39306
39307
|
// attached by pluginContainer.addWatchFile
|
|
39307
39308
|
const pluginImports = this._addedImports;
|
|
39308
39309
|
if (pluginImports) {
|
|
39309
|
-
(await Promise.all([...pluginImports].map((id) => normalizeUrl(id, 0)))).forEach(([url]) => importedUrls.add(url));
|
|
39310
|
+
(await Promise.all([...pluginImports].map((id) => normalizeUrl(id, 0, true)))).forEach(([url]) => importedUrls.add(url));
|
|
39310
39311
|
}
|
|
39311
39312
|
// HMR transforms are no-ops in SSR, so an `accept` call will
|
|
39312
39313
|
// never be injected. Avoid updating the `isSelfAccepting`
|
|
@@ -42032,14 +42033,9 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
42032
42033
|
});
|
|
42033
42034
|
// ---------------------------------------------------------------------------
|
|
42034
42035
|
const watchFiles = new Set();
|
|
42035
|
-
// TODO: use import()
|
|
42036
|
-
const _require = createRequire$1(import.meta.url);
|
|
42037
|
-
// get rollup version
|
|
42038
|
-
const rollupPkgPath = resolve$6(_require.resolve('rollup'), '../../package.json');
|
|
42039
42036
|
const minimalContext = {
|
|
42040
42037
|
meta: {
|
|
42041
|
-
rollupVersion:
|
|
42042
|
-
.version,
|
|
42038
|
+
rollupVersion: VERSION,
|
|
42043
42039
|
watchMode: true
|
|
42044
42040
|
}
|
|
42045
42041
|
};
|
|
@@ -45215,7 +45211,7 @@ async function doBuild(inlineConfig = {}) {
|
|
|
45215
45211
|
const options = config.build;
|
|
45216
45212
|
const ssr = !!options.ssr;
|
|
45217
45213
|
const libOptions = options.lib;
|
|
45218
|
-
config.logger.info(picocolors.exports.cyan(`vite v${VERSION} ${picocolors.exports.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
|
|
45214
|
+
config.logger.info(picocolors.exports.cyan(`vite v${VERSION$1} ${picocolors.exports.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
|
|
45219
45215
|
const resolve = (p) => path$o.resolve(config.root, p);
|
|
45220
45216
|
const input = libOptions
|
|
45221
45217
|
? options.rollupOptions?.input ||
|
|
@@ -45304,13 +45300,13 @@ async function doBuild(inlineConfig = {}) {
|
|
|
45304
45300
|
? `[name].${jsExt}`
|
|
45305
45301
|
: libOptions
|
|
45306
45302
|
? ({ name }) => resolveLibFilename(libOptions, format, name, config.root, jsExt)
|
|
45307
|
-
: path$o.posix.join(options.assetsDir, `[name]
|
|
45303
|
+
: path$o.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
45308
45304
|
chunkFileNames: libOptions
|
|
45309
|
-
? `[name]
|
|
45310
|
-
: path$o.posix.join(options.assetsDir, `[name]
|
|
45305
|
+
? `[name]-[hash].${jsExt}`
|
|
45306
|
+
: path$o.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
45311
45307
|
assetFileNames: libOptions
|
|
45312
45308
|
? `[name].[ext]`
|
|
45313
|
-
: path$o.posix.join(options.assetsDir, `[name]
|
|
45309
|
+
: path$o.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
|
|
45314
45310
|
inlineDynamicImports: output.format === 'umd' ||
|
|
45315
45311
|
output.format === 'iife' ||
|
|
45316
45312
|
(ssrWorkerBuild &&
|
|
@@ -62427,7 +62423,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62427
62423
|
: pkgPath
|
|
62428
62424
|
? path$o.join(path$o.dirname(pkgPath), `node_modules/.vite`)
|
|
62429
62425
|
: path$o.join(resolvedRoot, `.vite`);
|
|
62430
|
-
const assetsFilter = config.assetsInclude
|
|
62426
|
+
const assetsFilter = config.assetsInclude &&
|
|
62427
|
+
(!Array.isArray(config.assetsInclude) || config.assetsInclude.length)
|
|
62431
62428
|
? createFilter(config.assetsInclude)
|
|
62432
62429
|
: () => false;
|
|
62433
62430
|
// create an internal resolver to be used in special scenarios, e.g.
|
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 { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-
|
|
5
|
+
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-b73c4a2f.js';
|
|
6
6
|
import { VERSION } from './constants.js';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:module';
|
|
@@ -32,6 +32,7 @@ import 'https';
|
|
|
32
32
|
import 'tls';
|
|
33
33
|
import 'node:http';
|
|
34
34
|
import 'node:https';
|
|
35
|
+
import 'rollup';
|
|
35
36
|
import 'querystring';
|
|
36
37
|
import 'node:readline';
|
|
37
38
|
import 'node:child_process';
|
|
@@ -719,7 +720,7 @@ cli
|
|
|
719
720
|
filterDuplicateOptions(options);
|
|
720
721
|
// output structure is preserved even after bundling so require()
|
|
721
722
|
// is ok here
|
|
722
|
-
const { createServer } = await import('./chunks/dep-
|
|
723
|
+
const { createServer } = await import('./chunks/dep-b73c4a2f.js').then(function (n) { return n.D; });
|
|
723
724
|
try {
|
|
724
725
|
const server = await createServer({
|
|
725
726
|
root,
|
|
@@ -772,7 +773,7 @@ cli
|
|
|
772
773
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
773
774
|
.action(async (root, options) => {
|
|
774
775
|
filterDuplicateOptions(options);
|
|
775
|
-
const { build } = await import('./chunks/dep-
|
|
776
|
+
const { build } = await import('./chunks/dep-b73c4a2f.js').then(function (n) { return n.C; });
|
|
776
777
|
const buildOptions = cleanOptions(options);
|
|
777
778
|
try {
|
|
778
779
|
await build({
|
|
@@ -800,7 +801,7 @@ cli
|
|
|
800
801
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
801
802
|
.action(async (root, options) => {
|
|
802
803
|
filterDuplicateOptions(options);
|
|
803
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
804
|
+
const { optimizeDeps } = await import('./chunks/dep-b73c4a2f.js').then(function (n) { return n.B; });
|
|
804
805
|
try {
|
|
805
806
|
const config = await resolveConfig({
|
|
806
807
|
root,
|
|
@@ -825,7 +826,7 @@ cli
|
|
|
825
826
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
826
827
|
.action(async (root, options) => {
|
|
827
828
|
filterDuplicateOptions(options);
|
|
828
|
-
const { preview } = await import('./chunks/dep-
|
|
829
|
+
const { preview } = await import('./chunks/dep-b73c4a2f.js').then(function (n) { return n.E; });
|
|
829
830
|
try {
|
|
830
831
|
const server = await preview({
|
|
831
832
|
root,
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-b73c4a2f.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|