vite 5.0.0-beta.2 → 5.0.0-beta.20

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/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable no-restricted-globals */
2
2
 
3
+ warnCjsUsage()
4
+
3
5
  // type utils
4
6
  module.exports.defineConfig = (config) => config
5
7
 
@@ -23,12 +25,13 @@ asyncFunctions.forEach((name) => {
23
25
  import('./dist/node/index.js').then((i) => i[name](...args))
24
26
  })
25
27
 
26
- // some sync functions are marked not supported due to their complexity and uncommon usage
27
- const unsupportedCJS = ['resolvePackageEntry', 'resolvePackageData']
28
- unsupportedCJS.forEach((name) => {
29
- module.exports[name] = () => {
30
- throw new Error(
31
- `"${name}" is not supported in CJS build of Vite 4.\nPlease use ESM or dynamic imports \`const { ${name} } = await import('vite')\`.`,
32
- )
33
- }
34
- })
28
+ function warnCjsUsage() {
29
+ if (process.env.VITE_CJS_IGNORE_WARNING) return
30
+ const yellow = (str) => `\u001b[33m${str}\u001b[39m`
31
+ const log = process.env.VITE_CJS_TRACE ? console.trace : console.warn
32
+ log(
33
+ yellow(
34
+ `The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
35
+ ),
36
+ )
37
+ }
package/index.d.cts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @deprecated The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
3
+ */
4
+ declare const module: any
5
+
6
+ export = module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.20",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -20,9 +20,14 @@
20
20
  "types": "./dist/node/index.d.ts",
21
21
  "exports": {
22
22
  ".": {
23
- "types": "./dist/node/index.d.ts",
24
- "import": "./dist/node/index.js",
25
- "require": "./index.cjs"
23
+ "import": {
24
+ "types": "./dist/node/index.d.ts",
25
+ "default": "./dist/node/index.js"
26
+ },
27
+ "require": {
28
+ "types": "./index.d.cts",
29
+ "default": "./index.cjs"
30
+ }
26
31
  },
27
32
  "./client": {
28
33
  "types": "./client.d.ts"
@@ -38,6 +43,7 @@
38
43
  "dist",
39
44
  "client.d.ts",
40
45
  "index.cjs",
46
+ "index.d.cts",
41
47
  "types"
42
48
  ],
43
49
  "engines": {
@@ -55,53 +61,50 @@
55
61
  "funding": "https://github.com/vitejs/vite?sponsor=1",
56
62
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
57
63
  "dependencies": {
58
- "esbuild": "^0.18.10",
59
- "postcss": "^8.4.27",
60
- "rollup": "^3.28.0"
64
+ "esbuild": "^0.19.3",
65
+ "postcss": "^8.4.31",
66
+ "rollup": "^4.2.0"
61
67
  },
62
68
  "optionalDependencies": {
63
- "fsevents": "~2.3.2"
69
+ "fsevents": "~2.3.3"
64
70
  },
65
71
  "devDependencies": {
66
72
  "@ampproject/remapping": "^2.2.1",
67
- "@babel/parser": "^7.22.7",
68
- "@babel/types": "^7.22.17",
69
- "@jridgewell/trace-mapping": "^0.3.18",
70
- "@rollup/plugin-alias": "^4.0.4",
71
- "@rollup/plugin-commonjs": "^25.0.3",
72
- "@rollup/plugin-dynamic-import-vars": "^2.0.4",
73
- "@rollup/plugin-json": "^6.0.0",
74
- "@rollup/plugin-node-resolve": "15.1.0",
75
- "@rollup/plugin-typescript": "^11.1.2",
76
- "@rollup/pluginutils": "^5.0.2",
77
- "@types/escape-html": "^1.0.2",
78
- "@types/pnpapi": "^0.0.2",
79
- "acorn": "^8.10.0",
80
- "acorn-import-assertions": "^1.9.0",
81
- "acorn-walk": "^8.2.0",
73
+ "@babel/parser": "^7.23.3",
74
+ "@jridgewell/trace-mapping": "^0.3.20",
75
+ "@rollup/plugin-alias": "^5.0.1",
76
+ "@rollup/plugin-commonjs": "^25.0.7",
77
+ "@rollup/plugin-dynamic-import-vars": "^2.1.0",
78
+ "@rollup/plugin-json": "^6.0.1",
79
+ "@rollup/plugin-node-resolve": "15.2.3",
80
+ "@rollup/plugin-typescript": "^11.1.5",
81
+ "@rollup/pluginutils": "^5.0.5",
82
+ "@types/escape-html": "^1.0.4",
83
+ "@types/pnpapi": "^0.0.5",
84
+ "acorn": "^8.11.2",
85
+ "acorn-walk": "^8.3.0",
82
86
  "cac": "^6.7.14",
83
87
  "chokidar": "^3.5.3",
84
88
  "connect": "^3.7.0",
85
- "connect-history-api-fallback": "^2.0.0",
86
89
  "convert-source-map": "^2.0.0",
87
90
  "cors": "^2.8.5",
88
91
  "cross-spawn": "^7.0.3",
89
92
  "debug": "^4.3.4",
90
93
  "dep-types": "link:./src/types",
91
94
  "dotenv": "^16.3.1",
92
- "dotenv-expand": "^9.0.0",
93
- "es-module-lexer": "^1.3.0",
95
+ "dotenv-expand": "^10.0.0",
96
+ "es-module-lexer": "^1.4.1",
94
97
  "escape-html": "^1.0.3",
95
98
  "estree-walker": "^3.0.3",
96
99
  "etag": "^1.8.1",
97
- "fast-glob": "^3.3.1",
100
+ "fast-glob": "^3.3.2",
98
101
  "http-proxy": "^1.18.1",
99
102
  "json-stable-stringify": "^1.0.2",
100
- "launch-editor-middleware": "^2.6.0",
101
- "lightningcss": "^1.21.5",
102
- "magic-string": "^0.30.2",
103
+ "launch-editor-middleware": "^2.6.1",
104
+ "lightningcss": "^1.22.1",
105
+ "magic-string": "^0.30.5",
103
106
  "micromatch": "^4.0.5",
104
- "mlly": "^1.4.0",
107
+ "mlly": "^1.4.2",
105
108
  "mrmime": "^1.0.1",
106
109
  "okie": "^1.0.1",
107
110
  "open": "^8.4.2",
@@ -113,16 +116,17 @@
113
116
  "postcss-load-config": "^4.0.1",
114
117
  "postcss-modules": "^6.0.0",
115
118
  "resolve.exports": "^2.0.2",
116
- "rollup-plugin-license": "^3.0.1",
119
+ "rollup-plugin-dts": "^6.1.0",
120
+ "rollup-plugin-license": "^3.2.0",
117
121
  "sirv": "^2.0.3",
118
122
  "source-map-support": "^0.5.21",
119
123
  "strip-ansi": "^7.1.0",
120
124
  "strip-literal": "^1.3.0",
121
- "tsconfck": "^3.0.0-next.8",
122
- "tslib": "^2.6.1",
125
+ "tsconfck": "^3.0.0",
126
+ "tslib": "^2.6.2",
123
127
  "types": "link:./types",
124
- "ufo": "^1.2.0",
125
- "ws": "^8.13.0"
128
+ "ufo": "^1.3.1",
129
+ "ws": "^8.14.2"
126
130
  },
127
131
  "peerDependencies": {
128
132
  "@types/node": "^18.0.0 || >=20.0.0",
@@ -160,12 +164,10 @@
160
164
  "dev": "rimraf dist && pnpm run build-bundle -w",
161
165
  "build": "rimraf dist && run-s build-bundle build-types",
162
166
  "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
163
- "build-types": "run-s build-types-temp build-types-pre-patch build-types-roll build-types-post-patch build-types-check",
167
+ "build-types": "run-s build-types-temp build-types-roll build-types-check",
164
168
  "build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
165
- "build-types-pre-patch": "tsx scripts/prePatchTypes.ts",
166
- "build-types-roll": "tsx scripts/api-extractor.ts run && rimraf temp",
167
- "build-types-post-patch": "tsx scripts/postPatchTypes.ts",
168
- "build-types-check": "tsx scripts/checkBuiltTypes.ts && tsc --project tsconfig.check.json",
169
+ "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
170
+ "build-types-check": "tsc --project tsconfig.check.json",
169
171
  "typecheck": "tsc --noEmit",
170
172
  "lint": "eslint --cache --ext .ts src/**",
171
173
  "format": "prettier --write --cache --parser typescript \"src/**/*.ts\""
package/types/hot.d.ts CHANGED
@@ -28,5 +28,9 @@ export interface ViteHotContext {
28
28
  event: T,
29
29
  cb: (payload: InferCustomEventPayload<T>) => void,
30
30
  ): void
31
+ off<T extends string>(
32
+ event: T,
33
+ cb: (payload: InferCustomEventPayload<T>) => void,
34
+ ): void
31
35
  send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
32
36
  }
@@ -0,0 +1,5 @@
1
+ /// <reference path="./importMeta.d.ts" />
2
+
3
+ // https://github.com/microsoft/TypeScript/issues/45096
4
+ // TypeScript has a bug that makes <reference types="vite/types/importMeta" />
5
+ // not possible in userland. This file provides a workaround for now.