vite 3.0.0-alpha.5 → 3.0.0-alpha.8

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.
Files changed (81) hide show
  1. package/dist/node/chunks/{dep-21067347.js → dep-6b269949.js} +1 -1
  2. package/dist/node/chunks/{dep-0232e200.js → dep-8250f392.js} +422 -200
  3. package/dist/node/chunks/{dep-cd161504.js → dep-8259d5f4.js} +1 -1
  4. package/dist/node/chunks/{dep-13a14c32.js → dep-cfa39351.js} +1 -1
  5. package/dist/node/cli.js +5 -5
  6. package/dist/node/constants.js +1 -1
  7. package/dist/node/index.d.ts +40 -4
  8. package/dist/node/index.js +1 -1
  9. package/dist/node-cjs/publicUtils.cjs +1 -1
  10. package/dist/node-cjs/terser.cjs +1023 -2876
  11. package/package.json +11 -10
  12. package/dist/node/build.d.ts +0 -178
  13. package/dist/node/certificate.d.ts +0 -2
  14. package/dist/node/cli.d.ts +0 -1
  15. package/dist/node/config.d.ts +0 -246
  16. package/dist/node/constants.d.ts +0 -35
  17. package/dist/node/env.d.ts +0 -3
  18. package/dist/node/http.d.ts +0 -88
  19. package/dist/node/logger.d.ts +0 -31
  20. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  21. package/dist/node/optimizer/index.d.ts +0 -181
  22. package/dist/node/optimizer/optimizer.d.ts +0 -4
  23. package/dist/node/optimizer/scan.d.ts +0 -8
  24. package/dist/node/packages.d.ts +0 -27
  25. package/dist/node/plugin.d.ts +0 -130
  26. package/dist/node/plugins/asset.d.ts +0 -68
  27. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  28. package/dist/node/plugins/clientInjections.d.ts +0 -7
  29. package/dist/node/plugins/css.d.ts +0 -86
  30. package/dist/node/plugins/dataUri.d.ts +0 -5
  31. package/dist/node/plugins/define.d.ts +0 -3
  32. package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
  33. package/dist/node/plugins/ensureWatch.d.ts +0 -5
  34. package/dist/node/plugins/esbuild.d.ts +0 -15
  35. package/dist/node/plugins/html.d.ts +0 -120
  36. package/dist/node/plugins/importAnalysis.d.ts +0 -47
  37. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
  38. package/dist/node/plugins/importMetaGlob.d.ts +0 -34
  39. package/dist/node/plugins/index.d.ts +0 -3
  40. package/dist/node/plugins/json.d.ts +0 -23
  41. package/dist/node/plugins/loadFallback.d.ts +0 -5
  42. package/dist/node/plugins/manifest.d.ts +0 -14
  43. package/dist/node/plugins/metadata.d.ts +0 -9
  44. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  45. package/dist/node/plugins/optimizedDeps.d.ts +0 -7
  46. package/dist/node/plugins/preAlias.d.ts +0 -6
  47. package/dist/node/plugins/reporter.d.ts +0 -3
  48. package/dist/node/plugins/resolve.d.ts +0 -41
  49. package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
  50. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  51. package/dist/node/plugins/terser.d.ts +0 -3
  52. package/dist/node/plugins/wasm.d.ts +0 -4
  53. package/dist/node/plugins/worker.d.ts +0 -9
  54. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  55. package/dist/node/preview.d.ts +0 -33
  56. package/dist/node/publicUtils.d.ts +0 -11
  57. package/dist/node/server/hmr.d.ts +0 -39
  58. package/dist/node/server/index.d.ts +0 -189
  59. package/dist/node/server/middlewares/base.d.ts +0 -3
  60. package/dist/node/server/middlewares/compression.d.ts +0 -1
  61. package/dist/node/server/middlewares/error.d.ts +0 -8
  62. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  63. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  64. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  65. package/dist/node/server/middlewares/static.d.ts +0 -6
  66. package/dist/node/server/middlewares/time.d.ts +0 -2
  67. package/dist/node/server/middlewares/transform.d.ts +0 -3
  68. package/dist/node/server/moduleGraph.d.ts +0 -55
  69. package/dist/node/server/openBrowser.d.ts +0 -15
  70. package/dist/node/server/pluginContainer.d.ts +0 -41
  71. package/dist/node/server/searchRoot.d.ts +0 -8
  72. package/dist/node/server/send.d.ts +0 -10
  73. package/dist/node/server/sourcemap.d.ts +0 -11
  74. package/dist/node/server/transformRequest.d.ts +0 -14
  75. package/dist/node/server/ws.d.ts +0 -55
  76. package/dist/node/ssr/ssrExternal.d.ts +0 -11
  77. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  78. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  79. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  80. package/dist/node/ssr/ssrTransform.d.ts +0 -14
  81. package/dist/node/utils.d.ts +0 -144
@@ -1,4 +1,4 @@
1
- import { w as commonjsGlobal } from './dep-0232e200.js';
1
+ import { w as commonjsGlobal } from './dep-8250f392.js';
2
2
  import require$$1 from 'crypto';
3
3
  import 'fs';
4
4
  import 'path';
@@ -1,4 +1,4 @@
1
- import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-0232e200.js';
1
+ import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-8250f392.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'url';
4
4
  import { dirname as __cjs_dirname } from 'path';
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-0232e200.js';
3
+ import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-8250f392.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-0232e200.js').then(function (n) { return n.B; });
685
+ const { createServer } = await import('./chunks/dep-8250f392.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-0232e200.js').then(function (n) { return n.A; });
731
+ const { build } = await import('./chunks/dep-8250f392.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-0232e200.js').then(function (n) { return n.z; });
755
+ const { optimizeDeps } = await import('./chunks/dep-8250f392.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-0232e200.js').then(function (n) { return n.C; });
778
+ const { preview } = await import('./chunks/dep-8250f392.js').then(function (n) { return n.C; });
779
779
  try {
780
780
  const server = await preview({
781
781
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
 
4
- var version = "3.0.0-alpha.5";
4
+ var version = "3.0.0-alpha.8";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -23,7 +23,6 @@ import type * as net from 'net';
23
23
  import type { OutgoingHttpHeaders } from 'http';
24
24
  import type { OutputBundle } from 'rollup';
25
25
  import type { OutputChunk } from 'rollup';
26
- import { parse } from 'es-module-lexer';
27
26
  import type { PartialResolvedId } from 'rollup';
28
27
  import type { Plugin as Plugin_3 } from 'rollup';
29
28
  import type { PluginContext } from 'rollup';
@@ -534,6 +533,13 @@ export declare interface DepOptimizationOptions {
534
533
  * vite project root. This will overwrite default entries inference.
535
534
  */
536
535
  entries?: string | string[];
536
+ /**
537
+ * Enable esbuild based scan phase, to get back to the optimized deps discovery
538
+ * strategy used in Vite v2
539
+ * @default false
540
+ * @experimental
541
+ */
542
+ devScan?: boolean;
537
543
  /**
538
544
  * Force optimize listed dependencies (must be resolvable import paths,
539
545
  * cannot be globs).
@@ -649,9 +655,12 @@ export declare interface ExperimentalOptions {
649
655
  importGlobRestoreExtension?: boolean;
650
656
  }
651
657
 
652
- export declare type ExportsData = ReturnType<typeof parse> & {
653
- hasReExports?: true;
654
- jsxLoader?: true;
658
+ export declare type ExportsData = {
659
+ hasImports: boolean;
660
+ exports: readonly string[];
661
+ facade: boolean;
662
+ hasReExports?: boolean;
663
+ jsxLoader?: boolean;
655
664
  };
656
665
 
657
666
  export declare interface FileSystemServeOptions {
@@ -1156,6 +1165,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1156
1165
  tryEsmOnly?: boolean;
1157
1166
  scan?: boolean;
1158
1167
  getDepsOptimizer?: () => DepsOptimizer | undefined;
1168
+ shouldExternalize?: (id: string) => boolean | undefined;
1159
1169
  }
1160
1170
 
1161
1171
  export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
@@ -1183,9 +1193,25 @@ export declare interface KnownAsTypeMap {
1183
1193
  export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
1184
1194
 
1185
1195
  export declare interface LibraryOptions {
1196
+ /**
1197
+ * Path of library entry
1198
+ */
1186
1199
  entry: string;
1200
+ /**
1201
+ * The name of the exposed global variable. Required when the `formats` option includes
1202
+ * `umd` or `iife`
1203
+ */
1187
1204
  name?: string;
1205
+ /**
1206
+ * Output bundle formats
1207
+ * @default ['es', 'umd']
1208
+ */
1188
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
+ */
1189
1215
  fileName?: string | ((format: ModuleFormat) => string);
1190
1216
  }
1191
1217
 
@@ -1876,6 +1902,8 @@ export declare class SplitVendorChunkCache {
1876
1902
 
1877
1903
  export declare function splitVendorChunkPlugin(): Plugin_2;
1878
1904
 
1905
+ export declare type SSRFormat = 'esm' | 'cjs';
1906
+
1879
1907
  export declare interface SSROptions {
1880
1908
  external?: string[];
1881
1909
  noExternal?: string | RegExp | (string | RegExp)[] | true;
@@ -1885,6 +1913,14 @@ export declare interface SSROptions {
1885
1913
  * Default: 'node'
1886
1914
  */
1887
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;
1888
1924
  }
1889
1925
 
1890
1926
  export declare type SSRTarget = 'node' | 'webworker';
@@ -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-0232e200.js';
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-8250f392.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)