vite 3.0.0-alpha.6 → 3.0.0-alpha.9
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-a4f17494.js → dep-08f2a2be.js} +1 -1
- package/dist/node/chunks/{dep-8bed6f50.js → dep-3165073f.js} +1 -1
- package/dist/node/chunks/{dep-b4474709.js → dep-523c8a1b.js} +1 -1
- package/dist/node/chunks/{dep-52974b5a.js → dep-8df7bfd6.js} +392 -193
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +33 -74
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/dist/node-cjs/terser.cjs +1023 -2876
- package/package.json +9 -9
- package/types/es-module-lexer.d.ts +0 -90
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-8df7bfd6.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'fs';
|
|
6
6
|
import 'path';
|
|
@@ -682,7 +682,7 @@ cli
|
|
|
682
682
|
.action(async (root, options) => {
|
|
683
683
|
// output structure is preserved even after bundling so require()
|
|
684
684
|
// is ok here
|
|
685
|
-
const { createServer } = await import('./chunks/dep-
|
|
685
|
+
const { createServer } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.B; });
|
|
686
686
|
try {
|
|
687
687
|
const server = await createServer({
|
|
688
688
|
root,
|
|
@@ -728,7 +728,7 @@ cli
|
|
|
728
728
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
729
729
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
730
730
|
.action(async (root, options) => {
|
|
731
|
-
const { build } = await import('./chunks/dep-
|
|
731
|
+
const { build } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.A; });
|
|
732
732
|
const buildOptions = cleanOptions(options);
|
|
733
733
|
try {
|
|
734
734
|
await build({
|
|
@@ -752,7 +752,7 @@ cli
|
|
|
752
752
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
753
753
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
754
754
|
.action(async (root, options) => {
|
|
755
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
755
|
+
const { optimizeDeps } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.z; });
|
|
756
756
|
try {
|
|
757
757
|
const config = await resolveConfig({
|
|
758
758
|
root,
|
|
@@ -775,7 +775,7 @@ cli
|
|
|
775
775
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
776
776
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
777
777
|
.action(async (root, options) => {
|
|
778
|
-
const { preview } = await import('./chunks/dep-
|
|
778
|
+
const { preview } = await import('./chunks/dep-8df7bfd6.js').then(function (n) { return n.C; });
|
|
779
779
|
try {
|
|
780
780
|
const server = await preview({
|
|
781
781
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -645,77 +645,6 @@ export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
|
|
|
645
645
|
map: SourceMap;
|
|
646
646
|
};
|
|
647
647
|
|
|
648
|
-
export declare interface EsModuleLexerImportSpecifier {
|
|
649
|
-
/**
|
|
650
|
-
* Module name
|
|
651
|
-
*
|
|
652
|
-
* To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
|
|
653
|
-
*
|
|
654
|
-
* For dynamic import expressions, this field will be empty if not a valid JS string.
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* const [imports1, exports1] = parse(String.raw`import './\u0061\u0062.js'`);
|
|
658
|
-
* imports1[0].n;
|
|
659
|
-
* // Returns "./ab.js"
|
|
660
|
-
*
|
|
661
|
-
* const [imports2, exports2] = parse(`import("./ab.js")`);
|
|
662
|
-
* imports2[0].n;
|
|
663
|
-
* // Returns "./ab.js"
|
|
664
|
-
*
|
|
665
|
-
* const [imports3, exports3] = parse(`import("./" + "ab.js")`);
|
|
666
|
-
* imports3[0].n;
|
|
667
|
-
* // Returns undefined
|
|
668
|
-
*/
|
|
669
|
-
readonly n: string | undefined
|
|
670
|
-
/**
|
|
671
|
-
* Start of module specifier
|
|
672
|
-
*
|
|
673
|
-
* @example
|
|
674
|
-
* const source = `import { a } from 'asdf'`;
|
|
675
|
-
* const [imports, exports] = parse(source);
|
|
676
|
-
* source.substring(imports[0].s, imports[0].e);
|
|
677
|
-
* // Returns "asdf"
|
|
678
|
-
*/
|
|
679
|
-
readonly s: number
|
|
680
|
-
/**
|
|
681
|
-
* End of module specifier
|
|
682
|
-
*/
|
|
683
|
-
readonly e: number
|
|
684
|
-
|
|
685
|
-
/**
|
|
686
|
-
* Start of import statement
|
|
687
|
-
*
|
|
688
|
-
* @example
|
|
689
|
-
* const source = `import { a } from 'asdf'`;
|
|
690
|
-
* const [imports, exports] = parse(source);
|
|
691
|
-
* source.substring(imports[0].ss, imports[0].se);
|
|
692
|
-
* // Returns `"import { a } from 'asdf';"`
|
|
693
|
-
*/
|
|
694
|
-
readonly ss: number
|
|
695
|
-
/**
|
|
696
|
-
* End of import statement
|
|
697
|
-
*/
|
|
698
|
-
readonly se: number
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* If this import statement is a dynamic import, this is the start value.
|
|
702
|
-
* Otherwise this is `-1`.
|
|
703
|
-
*/
|
|
704
|
-
readonly d: number
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* If this import has an import assertion, this is the start value.
|
|
708
|
-
* Otherwise this is `-1`.
|
|
709
|
-
*/
|
|
710
|
-
readonly a: number
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
export declare type EsModuleLexerParseReturnType = readonly [
|
|
714
|
-
imports: ReadonlyArray<EsModuleLexerImportSpecifier>,
|
|
715
|
-
exports: ReadonlyArray<string>,
|
|
716
|
-
facade: boolean
|
|
717
|
-
];
|
|
718
|
-
|
|
719
648
|
export declare interface ExperimentalOptions {
|
|
720
649
|
/**
|
|
721
650
|
* Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
|
|
@@ -726,9 +655,12 @@ export declare interface ExperimentalOptions {
|
|
|
726
655
|
importGlobRestoreExtension?: boolean;
|
|
727
656
|
}
|
|
728
657
|
|
|
729
|
-
export declare type ExportsData =
|
|
730
|
-
|
|
731
|
-
|
|
658
|
+
export declare type ExportsData = {
|
|
659
|
+
hasImports: boolean;
|
|
660
|
+
exports: readonly string[];
|
|
661
|
+
facade: boolean;
|
|
662
|
+
hasReExports?: boolean;
|
|
663
|
+
jsxLoader?: boolean;
|
|
732
664
|
};
|
|
733
665
|
|
|
734
666
|
export declare interface FileSystemServeOptions {
|
|
@@ -1233,6 +1165,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1233
1165
|
tryEsmOnly?: boolean;
|
|
1234
1166
|
scan?: boolean;
|
|
1235
1167
|
getDepsOptimizer?: () => DepsOptimizer | undefined;
|
|
1168
|
+
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1236
1169
|
}
|
|
1237
1170
|
|
|
1238
1171
|
export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
|
|
@@ -1260,9 +1193,25 @@ export declare interface KnownAsTypeMap {
|
|
|
1260
1193
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1261
1194
|
|
|
1262
1195
|
export declare interface LibraryOptions {
|
|
1196
|
+
/**
|
|
1197
|
+
* Path of library entry
|
|
1198
|
+
*/
|
|
1263
1199
|
entry: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
1202
|
+
* `umd` or `iife`
|
|
1203
|
+
*/
|
|
1264
1204
|
name?: string;
|
|
1205
|
+
/**
|
|
1206
|
+
* Output bundle formats
|
|
1207
|
+
* @default ['es', 'umd']
|
|
1208
|
+
*/
|
|
1265
1209
|
formats?: LibraryFormats[];
|
|
1210
|
+
/**
|
|
1211
|
+
* The name of the package file output. The default file name is the name option
|
|
1212
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
1213
|
+
* format as an argument.
|
|
1214
|
+
*/
|
|
1266
1215
|
fileName?: string | ((format: ModuleFormat) => string);
|
|
1267
1216
|
}
|
|
1268
1217
|
|
|
@@ -1953,6 +1902,8 @@ export declare class SplitVendorChunkCache {
|
|
|
1953
1902
|
|
|
1954
1903
|
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
1955
1904
|
|
|
1905
|
+
export declare type SSRFormat = 'esm' | 'cjs';
|
|
1906
|
+
|
|
1956
1907
|
export declare interface SSROptions {
|
|
1957
1908
|
external?: string[];
|
|
1958
1909
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
@@ -1962,6 +1913,14 @@ export declare interface SSROptions {
|
|
|
1962
1913
|
* Default: 'node'
|
|
1963
1914
|
*/
|
|
1964
1915
|
target?: SSRTarget;
|
|
1916
|
+
/**
|
|
1917
|
+
* Define the format for the ssr build. Since Vite v3 the SSR build generates ESM by default.
|
|
1918
|
+
* `'cjs'` can be selected to generate a CJS build, but it isn't recommended. This option is
|
|
1919
|
+
* left marked as experimental to give users more time to update to ESM. CJS builds requires
|
|
1920
|
+
* complex externalization heuristics that aren't present in the ESM format.
|
|
1921
|
+
* @experimental
|
|
1922
|
+
*/
|
|
1923
|
+
format?: SSRFormat;
|
|
1965
1924
|
}
|
|
1966
1925
|
|
|
1967
1926
|
export declare type SSRTarget = 'node' | 'webworker';
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, q as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, u as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, k as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, q as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, u as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, k as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-8df7bfd6.js';
|
|
2
2
|
import 'fs';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'url';
|
|
@@ -1256,7 +1256,7 @@ function lookupFile(dir, formats, options) {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
/**
|
|
1259
|
-
* Use instead of fs.existsSync(filename)
|
|
1259
|
+
* Use fs.statSync(filename) instead of fs.existsSync(filename)
|
|
1260
1260
|
* #2051 if we don't have read permission on a directory, existsSync() still
|
|
1261
1261
|
* works and will result in massively slow subsequent checks (which are
|
|
1262
1262
|
* unnecessary in the first place)
|