source: imaps-frontend/node_modules/vite/index.cjs@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[d565449]1warnCjsUsage()
2
3// type utils
4module.exports.defineConfig = (config) => config
5
6// proxy cjs utils (sync functions)
7Object.assign(module.exports, require('./dist/node-cjs/publicUtils.cjs'))
8
9// async functions, can be redirect from ESM build
10const asyncFunctions = [
11 'build',
12 'createServer',
13 'preview',
14 'transformWithEsbuild',
15 'resolveConfig',
16 'optimizeDeps',
17 'formatPostcssSourceMap',
18 'loadConfigFromFile',
19 'preprocessCSS',
20]
21asyncFunctions.forEach((name) => {
22 module.exports[name] = (...args) =>
23 import('./dist/node/index.js').then((i) => i[name](...args))
24})
25
26function warnCjsUsage() {
27 if (process.env.VITE_CJS_IGNORE_WARNING) return
[0c6b92a]28 const logLevelIndex = process.argv.findIndex((arg) =>
29 /^(?:-l|--logLevel)/.test(arg),
30 )
31 if (logLevelIndex > 0) {
32 const logLevelValue = process.argv[logLevelIndex + 1]
33 if (logLevelValue === 'silent' || logLevelValue === 'error') {
34 return
35 }
36 if (/silent|error/.test(process.argv[logLevelIndex])) {
37 return
38 }
39 }
[d565449]40 const yellow = (str) => `\u001b[33m${str}\u001b[39m`
[0c6b92a]41 console.warn(
[d565449]42 yellow(
[0c6b92a]43 `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.`,
[d565449]44 ),
45 )
[0c6b92a]46 if (process.env.VITE_CJS_TRACE) {
47 const e = {}
48 const stackTraceLimit = Error.stackTraceLimit
49 Error.stackTraceLimit = 100
50 Error.captureStackTrace(e)
51 Error.stackTraceLimit = stackTraceLimit
52 console.log(
53 e.stack
54 .split('\n')
55 .slice(1)
56 .filter((line) => !line.includes('(node:'))
57 .join('\n'),
58 )
59 }
[d565449]60}
Note: See TracBrowser for help on using the repository browser.