vite 2.7.0-beta.6 → 2.7.0

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

package/dist/node/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('events');
4
- var build = require('./chunks/dep-0183a921.js');
4
+ var build = require('./chunks/dep-7e125991.js');
5
5
  var perf_hooks = require('perf_hooks');
6
6
  require('fs');
7
7
  require('path');
@@ -683,7 +683,7 @@ cli
683
683
  .action(async (root, options) => {
684
684
  // output structure is preserved even after bundling so require()
685
685
  // is ok here
686
- const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-0183a921.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-7e125991.js'); }).then(function (n) { return n.index$1; });
687
687
  try {
688
688
  const server = await createServer({
689
689
  root,
@@ -732,7 +732,7 @@ cli
732
732
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
733
733
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
734
734
  .action(async (root, options) => {
735
- const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-0183a921.js'); }).then(function (n) { return n.build$1; });
735
+ const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-7e125991.js'); }).then(function (n) { return n.build$1; });
736
736
  const buildOptions = cleanOptions(options);
737
737
  try {
738
738
  await build$1({
@@ -755,7 +755,7 @@ cli
755
755
  .command('optimize [root]')
756
756
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
757
757
  .action(async (root, options) => {
758
- const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-0183a921.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-7e125991.js'); }).then(function (n) { return n.index; });
759
759
  try {
760
760
  const config = await build.resolveConfig({
761
761
  root,
@@ -972,6 +972,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
972
972
  isBuild: boolean;
973
973
  isProduction: boolean;
974
974
  ssrConfig?: SSROptions;
975
+ packageCache?: PackageCache;
975
976
  /**
976
977
  * src code mode also attempts the following:
977
978
  * - resolving /xxx as URLs
@@ -1118,9 +1119,12 @@ export declare function normalizePath(id: string): string;
1118
1119
  export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean, newDeps?: Record<string, string>, // missing imports encountered after server has started
1119
1120
  ssr?: boolean): Promise<DepOptimizationMetadata | null>;
1120
1121
 
1122
+ /** Cache for package.json resolution and package.json contents */
1123
+ export declare type PackageCache = Map<string, PackageData>;
1124
+
1121
1125
  export declare interface PackageData {
1122
1126
  dir: string;
1123
- hasSideEffects: (id: string) => boolean;
1127
+ hasSideEffects: (id: string) => boolean | 'no-treeshake';
1124
1128
  webResolvedImports: Record<string, string | undefined>;
1125
1129
  nodeResolvedImports: Record<string, string | undefined>;
1126
1130
  setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
@@ -1342,6 +1346,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'alia
1342
1346
  logger: Logger;
1343
1347
  createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
1344
1348
  optimizeDeps: Omit<DepOptimizationOptions, 'keepNames'>;
1349
+ /* Excluded from this release type: packageCache */
1345
1350
  }>;
1346
1351
 
1347
1352
  export declare interface ResolvedPreviewOptions extends PreviewOptions {
@@ -1369,7 +1374,7 @@ export declare interface ResolveOptions {
1369
1374
  preserveSymlinks?: boolean;
1370
1375
  }
1371
1376
 
1372
- export declare function resolvePackageData(id: string, basedir: string, preserveSymlinks?: boolean): PackageData | undefined;
1377
+ export declare function resolvePackageData(id: string, basedir: string, preserveSymlinks?: boolean, packageCache?: PackageCache): PackageData | null;
1373
1378
 
1374
1379
  export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
1375
1380
 
@@ -2021,6 +2026,11 @@ export declare interface ViteDevServer {
2021
2026
  * @deprecated import `transformWithEsbuild` from `vite` instead
2022
2027
  */
2023
2028
  transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
2029
+ /**
2030
+ * Transform module code into SSR format.
2031
+ * @experimental
2032
+ */
2033
+ ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
2024
2034
  /**
2025
2035
  * Load a given URL as an instantiated module for SSR.
2026
2036
  */
@@ -2041,9 +2051,17 @@ export declare interface ViteDevServer {
2041
2051
  * Print server urls
2042
2052
  */
2043
2053
  printUrls(): void;
2054
+ /**
2055
+ * Restart the server.
2056
+ *
2057
+ * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
2058
+ */
2059
+ restart(forceOptimize?: boolean): Promise<void>;
2044
2060
  /* Excluded from this release type: _optimizeDepsMetadata */
2045
2061
  /* Excluded from this release type: _ssrExternals */
2046
2062
  /* Excluded from this release type: _globImporters */
2063
+ /* Excluded from this release type: _restartPromise */
2064
+ /* Excluded from this release type: _forceOptimizeOnRestart */
2047
2065
  /* Excluded from this release type: _isRunningOptimizer */
2048
2066
  /* Excluded from this release type: _registerMissingImport */
2049
2067
  /* Excluded from this release type: _pendingReload */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var build = require('./chunks/dep-0183a921.js');
5
+ var build = require('./chunks/dep-7e125991.js');
6
6
  require('fs');
7
7
  require('path');
8
8
  require('os');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "2.7.0-beta.6",
3
+ "version": "2.7.0",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "description": "Native-ESM powered web dev build tool",
@@ -35,12 +35,12 @@
35
35
  "build-types": "run-s build-temp-types patch-types roll-types",
36
36
  "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
37
37
  "ci-build": "rimraf dist && run-s build-bundle build-types",
38
- "patch-types": "node scripts/patchTypes",
38
+ "patch-types": "node scripts/patchTypes.cjs",
39
39
  "roll-types": "api-extractor run && rimraf temp",
40
40
  "lint": "eslint --ext .ts src/**",
41
41
  "format": "prettier --write --parser typescript \"src/**/*.ts\"",
42
42
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .",
43
- "release": "node ../../scripts/release.js"
43
+ "release": "node ../../scripts/release.cjs"
44
44
  },
45
45
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
46
46
  "dependencies": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@ampproject/remapping": "^1.0.1",
57
- "@babel/parser": "^7.16.3",
57
+ "@babel/parser": "^7.16.4",
58
58
  "@babel/types": "^7.16.0",
59
59
  "@rollup/plugin-alias": "^3.1.8",
60
60
  "@rollup/plugin-commonjs": "^21.0.1",
@@ -70,16 +70,15 @@
70
70
  "@types/less": "^3.0.3",
71
71
  "@types/micromatch": "^4.0.2",
72
72
  "@types/mime": "^2.0.3",
73
- "@types/node": "^16.11.7",
73
+ "@types/node": "^16.11.9",
74
74
  "@types/resolve": "^1.20.1",
75
75
  "@types/sass": "~1.43.0",
76
76
  "@types/stylus": "^0.48.36",
77
77
  "@types/ws": "^8.2.0",
78
78
  "@vue/compiler-dom": "^3.2.22",
79
- "acorn": "^8.5.0",
79
+ "acorn": "^8.6.0",
80
80
  "acorn-class-fields": "^1.0.0",
81
81
  "acorn-static-class-features": "^1.0.0",
82
- "builtin-modules": "^3.2.0",
83
82
  "cac": "6.7.9",
84
83
  "chalk": "^4.1.2",
85
84
  "chokidar": "^3.5.2",
@@ -112,7 +111,7 @@
112
111
  "selfsigned": "^1.10.11",
113
112
  "sirv": "^1.0.18",
114
113
  "source-map": "^0.6.1",
115
- "source-map-support": "^0.5.20",
114
+ "source-map-support": "^0.5.21",
116
115
  "strip-ansi": "^6.0.1",
117
116
  "terser": "^5.10.0",
118
117
  "tsconfck": "1.1.1",
@@ -78,10 +78,8 @@ async function handleMessage(payload: HMRPayload) {
78
78
  // can't use querySelector with `[href*=]` here since the link may be
79
79
  // using relative paths so we need to use link.href to grab the full
80
80
  // URL for the include check.
81
- const el = (
82
- [].slice.call(
83
- document.querySelectorAll(`link`)
84
- ) as HTMLLinkElement[]
81
+ const el = Array.from(
82
+ document.querySelectorAll<HTMLLinkElement>('link')
85
83
  ).find((e) => e.href.includes(path))
86
84
  if (el) {
87
85
  const newPath = `${base}${path.slice(1)}${
@@ -275,8 +273,6 @@ export function removeStyle(id: string): void {
275
273
  const style = sheetsMap.get(id)
276
274
  if (style) {
277
275
  if (style instanceof CSSStyleSheet) {
278
- // @ts-ignore
279
- const index = document.adoptedStyleSheets.indexOf(style)
280
276
  // @ts-ignore
281
277
  document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
282
278
  (s: CSSStyleSheet) => s !== style