vite 6.3.5 → 7.0.0-beta.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.
package/index.cjs DELETED
@@ -1,96 +0,0 @@
1
- const description =
2
- ' See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.'
3
-
4
- warnCjsUsage()
5
-
6
- // type utils
7
- module.exports.defineConfig = (config) => config
8
-
9
- // proxy cjs utils (sync functions)
10
- Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
11
-
12
- // async functions, can be redirect from ESM build
13
- const asyncFunctions = [
14
- 'build',
15
- 'createServer',
16
- 'preview',
17
- 'transformWithEsbuild',
18
- 'resolveConfig',
19
- 'optimizeDeps',
20
- 'formatPostcssSourceMap',
21
- 'loadConfigFromFile',
22
- 'preprocessCSS',
23
- 'createBuilder',
24
- 'runnerImport',
25
- ]
26
- asyncFunctions.forEach((name) => {
27
- module.exports[name] = (...args) =>
28
- import('./dist/node/index.js').then((i) => i[name](...args))
29
- })
30
-
31
- // variables and sync functions that cannot be used from cjs build
32
- const disallowedVariables = [
33
- // was not exposed in cjs from the beginning
34
- 'parseAst',
35
- 'parseAstAsync',
36
- 'buildErrorMessage',
37
- 'sortUserPlugins',
38
- // Environment API related variables that are too big to include in the cjs build
39
- 'DevEnvironment',
40
- 'BuildEnvironment',
41
- 'createIdResolver',
42
- 'createRunnableDevEnvironment',
43
- // can be redirected from ESM, but doesn't make sense as it's Environment API related
44
- 'fetchModule',
45
- 'moduleRunnerTransform',
46
- // can be exposed, but doesn't make sense as it's Environment API related
47
- 'createServerHotChannel',
48
- 'createServerModuleRunner',
49
- 'createServerModuleRunnerTransport',
50
- 'isRunnableDevEnvironment',
51
- 'createFetchableDevEnvironment',
52
- 'isFetchableDevEnvironment',
53
- ]
54
- disallowedVariables.forEach((name) => {
55
- Object.defineProperty(module.exports, name, {
56
- get() {
57
- throw new Error(
58
- `${name} is not available in the CJS build of Vite.` + description,
59
- )
60
- },
61
- })
62
- })
63
-
64
- function warnCjsUsage() {
65
- if (process.env.VITE_CJS_IGNORE_WARNING) return
66
- const logLevelIndex = process.argv.findIndex((arg) =>
67
- /^(?:-l|--logLevel)/.test(arg),
68
- )
69
- if (logLevelIndex > 0) {
70
- const logLevelValue = process.argv[logLevelIndex + 1]
71
- if (logLevelValue === 'silent' || logLevelValue === 'error') {
72
- return
73
- }
74
- if (/silent|error/.test(process.argv[logLevelIndex])) {
75
- return
76
- }
77
- }
78
- const yellow = (str) => `\u001b[33m${str}\u001b[39m`
79
- console.warn(
80
- yellow("The CJS build of Vite's Node API is deprecated." + description),
81
- )
82
- if (process.env.VITE_CJS_TRACE) {
83
- const e = {}
84
- const stackTraceLimit = Error.stackTraceLimit
85
- Error.stackTraceLimit = 100
86
- Error.captureStackTrace(e)
87
- Error.stackTraceLimit = stackTraceLimit
88
- console.log(
89
- e.stack
90
- .split('\n')
91
- .slice(1)
92
- .filter((line) => !line.includes('(node:'))
93
- .join('\n'),
94
- )
95
- }
96
- }
package/index.d.cts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
3
- */
4
- declare const module: any
5
-
6
- export = module