vite 2.4.0-beta.1 → 2.4.1
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/CHANGELOG.md +43 -0
- package/LICENSE.md +95 -0
- package/client.d.ts +1 -1
- package/dist/client/{client.js → client.mjs} +1 -1
- package/dist/client/client.mjs.map +1 -0
- package/dist/client/{env.js → env.mjs} +1 -1
- package/dist/client/env.mjs.map +1 -0
- package/dist/node/chunks/{dep-1e79df13.js → dep-7db2a04d.js} +14 -8
- package/dist/node/chunks/dep-7db2a04d.js.map +1 -0
- package/dist/node/chunks/{dep-d89c6c28.js → dep-b2288281.js} +2 -2
- package/dist/node/chunks/{dep-d89c6c28.js.map → dep-b2288281.js.map} +1 -1
- package/dist/node/chunks/{dep-3136f934.js → dep-cb9bf5e2.js} +2 -2
- package/dist/node/chunks/{dep-3136f934.js.map → dep-cb9bf5e2.js.map} +1 -1
- package/dist/node/chunks/{dep-200de8ae.js → dep-cc49d7be.js} +282 -310
- package/dist/node/chunks/dep-cc49d7be.js.map +1 -0
- package/dist/node/chunks/{dep-e462ce9f.js → dep-d25c0094.js} +2 -2
- package/dist/node/chunks/{dep-e462ce9f.js.map → dep-d25c0094.js.map} +1 -1
- package/dist/node/cli.js +4 -4
- package/dist/node/index.d.ts +13 -0
- package/dist/node/index.js +1 -1
- package/package.json +9 -9
- package/rollup.config.js +2 -2
- package/src/node/__tests__/scan.spec.ts +33 -1
- package/src/node/build.ts +1 -4
- package/src/node/config.ts +1 -0
- package/src/node/constants.ts +2 -2
- package/src/node/optimizer/esbuildDepPlugin.ts +1 -1
- package/src/node/optimizer/index.ts +7 -5
- package/src/node/optimizer/scan.ts +3 -2
- package/src/node/plugins/css.ts +7 -6
- package/src/node/plugins/importAnalysisBuild.ts +5 -1
- package/src/node/server/hmr.ts +5 -5
- package/src/node/server/middlewares/base.ts +9 -1
- package/src/node/server/openBrowser.ts +1 -1
- package/src/node/ssr/__tests__/ssrTransform.spec.ts +49 -1
- package/src/node/ssr/ssrTransform.ts +18 -5
- package/types/commonjs.d.ts +12 -0
- package/dist/client/client.js.map +0 -1
- package/dist/client/env.js.map +0 -1
- package/dist/node/chunks/dep-1e79df13.js.map +0 -1
- package/dist/node/chunks/dep-200de8ae.js.map +0 -1
package/dist/node/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var require$$0$1 = require('events');
|
|
4
|
-
var build = require('./chunks/dep-
|
|
4
|
+
var build = require('./chunks/dep-cc49d7be.js');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var require$$0$2 = require('tty');
|
|
7
7
|
var require$$0$3 = require('util');
|
|
@@ -13954,7 +13954,7 @@ cli
|
|
|
13954
13954
|
.action(async (root, options) => {
|
|
13955
13955
|
// output structure is preserved even after bundling so require()
|
|
13956
13956
|
// is ok here
|
|
13957
|
-
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
13957
|
+
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-cc49d7be.js'); }).then(function (n) { return n.index$1; });
|
|
13958
13958
|
try {
|
|
13959
13959
|
const server = await createServer({
|
|
13960
13960
|
root,
|
|
@@ -13989,7 +13989,7 @@ cli
|
|
|
13989
13989
|
.option('-m, --mode <mode>', `[string] set env mode`)
|
|
13990
13990
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
13991
13991
|
.action(async (root, options) => {
|
|
13992
|
-
const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
13992
|
+
const { build: build$1 } = await Promise.resolve().then(function () { return require('./chunks/dep-cc49d7be.js'); }).then(function (n) { return n.build$1; });
|
|
13993
13993
|
const buildOptions = cleanOptions(options);
|
|
13994
13994
|
try {
|
|
13995
13995
|
await build$1({
|
|
@@ -14012,7 +14012,7 @@ cli
|
|
|
14012
14012
|
.command('optimize [root]')
|
|
14013
14013
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
14014
14014
|
.action(async (root, options) => {
|
|
14015
|
-
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
14015
|
+
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-cc49d7be.js'); }).then(function (n) { return n.index; });
|
|
14016
14016
|
try {
|
|
14017
14017
|
const config = await build.resolveConfig({
|
|
14018
14018
|
root,
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
|
|
2
3
|
import { BuildOptions as BuildOptions_2 } from 'esbuild';
|
|
3
4
|
import { ChangeEvent } from 'rollup';
|
|
4
5
|
import { CustomPluginOptions } from 'rollup';
|
|
@@ -1821,6 +1822,18 @@ export declare interface RollupCommonJSOptions {
|
|
|
1821
1822
|
* @default true
|
|
1822
1823
|
*/
|
|
1823
1824
|
sourceMap?: boolean
|
|
1825
|
+
/**
|
|
1826
|
+
* Some `require` calls cannot be resolved statically to be translated to
|
|
1827
|
+
* imports.
|
|
1828
|
+
* When this option is set to `false`, the generated code will either
|
|
1829
|
+
* directly throw an error when such a call is encountered or, when
|
|
1830
|
+
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
1831
|
+
* configured dynamic require target.
|
|
1832
|
+
* Setting this option to `true` will instead leave the `require` call in the
|
|
1833
|
+
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
1834
|
+
* @default false
|
|
1835
|
+
*/
|
|
1836
|
+
ignoreDynamicRequires?: boolean
|
|
1824
1837
|
/**
|
|
1825
1838
|
* Instructs the plugin whether to enable mixed module transformations. This
|
|
1826
1839
|
* is useful in scenarios with modules that contain a mix of ES `import`
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"description": "Native-ESM powered web dev build tool",
|
|
@@ -68,18 +68,18 @@
|
|
|
68
68
|
"@rollup/pluginutils": "^4.1.0",
|
|
69
69
|
"@types/clean-css": "^4.2.4",
|
|
70
70
|
"@types/convert-source-map": "^1.5.1",
|
|
71
|
-
"@types/debug": "^4.1.
|
|
71
|
+
"@types/debug": "^4.1.6",
|
|
72
72
|
"@types/es-module-lexer": "^0.3.0",
|
|
73
|
-
"@types/estree": "^0.0.
|
|
73
|
+
"@types/estree": "^0.0.49",
|
|
74
74
|
"@types/etag": "^1.8.0",
|
|
75
75
|
"@types/less": "^3.0.2",
|
|
76
76
|
"@types/mime": "^2.0.3",
|
|
77
77
|
"@types/node": "^15.12.2",
|
|
78
78
|
"@types/resolve": "^1.20.0",
|
|
79
79
|
"@types/sass": "^1.16.0",
|
|
80
|
-
"@types/stylus": "^0.48.
|
|
81
|
-
"@types/ws": "^7.4.
|
|
82
|
-
"@vue/compiler-dom": "^3.1.
|
|
80
|
+
"@types/stylus": "^0.48.36",
|
|
81
|
+
"@types/ws": "^7.4.6",
|
|
82
|
+
"@vue/compiler-dom": "^3.1.4",
|
|
83
83
|
"acorn": "^8.4.1",
|
|
84
84
|
"acorn-class-fields": "^1.0.0",
|
|
85
85
|
"acorn-numeric-separator": "^0.3.6",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"dotenv": "^10.0.0",
|
|
100
100
|
"dotenv-expand": "^5.1.0",
|
|
101
101
|
"es-module-lexer": "^0.6.0",
|
|
102
|
-
"estree-walker": "^
|
|
102
|
+
"estree-walker": "^2.0.2",
|
|
103
103
|
"etag": "^1.8.1",
|
|
104
104
|
"execa": "^5.1.1",
|
|
105
105
|
"fast-glob": "^3.2.6",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"mime": "^2.5.2",
|
|
110
110
|
"minimatch": "^3.0.4",
|
|
111
111
|
"okie": "^1.0.1",
|
|
112
|
-
"open": "^
|
|
112
|
+
"open": "^8.2.1",
|
|
113
113
|
"periscopic": "^2.0.3",
|
|
114
114
|
"postcss-import": "^14.0.2",
|
|
115
115
|
"postcss-load-config": "^3.0.0",
|
|
@@ -124,6 +124,6 @@
|
|
|
124
124
|
"terser": "^5.7.1",
|
|
125
125
|
"tslib": "^2.3.0",
|
|
126
126
|
"types": "link:./types",
|
|
127
|
-
"ws": "^7.5.
|
|
127
|
+
"ws": "^7.5.2"
|
|
128
128
|
}
|
|
129
129
|
}
|
package/rollup.config.js
CHANGED
|
@@ -26,7 +26,7 @@ const envConfig = {
|
|
|
26
26
|
})
|
|
27
27
|
],
|
|
28
28
|
output: {
|
|
29
|
-
|
|
29
|
+
file: path.resolve(__dirname, 'dist/client', 'env.mjs'),
|
|
30
30
|
sourcemap: true
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -48,7 +48,7 @@ const clientConfig = {
|
|
|
48
48
|
})
|
|
49
49
|
],
|
|
50
50
|
output: {
|
|
51
|
-
|
|
51
|
+
file: path.resolve(__dirname, 'dist/client', 'client.mjs'),
|
|
52
52
|
sourcemap: true
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { scriptRE, commentRE } from '../optimizer/scan'
|
|
1
|
+
import { scriptRE, commentRE, importsRE } from '../optimizer/scan'
|
|
2
2
|
|
|
3
3
|
describe('optimizer-scan:script-test', () => {
|
|
4
4
|
const scriptContent = `import { defineComponent } from 'vue'
|
|
@@ -64,4 +64,36 @@ describe('optimizer-scan:script-test', () => {
|
|
|
64
64
|
expect(tag1).toEqual('<script>')
|
|
65
65
|
expect(content1).toEqual('var test = null')
|
|
66
66
|
})
|
|
67
|
+
|
|
68
|
+
test('imports regex should work', () => {
|
|
69
|
+
const shouldMatchArray = [
|
|
70
|
+
`import 'vue'`,
|
|
71
|
+
`import { foo } from 'vue'`,
|
|
72
|
+
`import foo from 'vue'`,
|
|
73
|
+
`;import foo from 'vue'`,
|
|
74
|
+
` import foo from 'vue'`,
|
|
75
|
+
`import { foo
|
|
76
|
+
} from 'vue'`,
|
|
77
|
+
`import bar, { foo } from 'vue'`,
|
|
78
|
+
`import foo from 'vue';`,
|
|
79
|
+
`*/ import foo from 'vue';`,
|
|
80
|
+
`import foo from 'vue';//comment`,
|
|
81
|
+
`import foo from 'vue';/*comment
|
|
82
|
+
*/`
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
shouldMatchArray.forEach((str) => {
|
|
86
|
+
importsRE.lastIndex = 0
|
|
87
|
+
expect(importsRE.exec(str)[1]).toEqual("'vue'")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const shouldFailArray = [
|
|
91
|
+
`testMultiline("import", {
|
|
92
|
+
body: "ok" });`,
|
|
93
|
+
`import type, {foo} from 'vue'`
|
|
94
|
+
]
|
|
95
|
+
shouldFailArray.forEach((str) => {
|
|
96
|
+
expect(importsRE.test(str)).toBe(false)
|
|
97
|
+
})
|
|
98
|
+
})
|
|
67
99
|
})
|
package/src/node/build.ts
CHANGED
|
@@ -272,10 +272,7 @@ export function resolveBuildPlugins(config: ResolvedConfig): {
|
|
|
272
272
|
return {
|
|
273
273
|
pre: [
|
|
274
274
|
buildHtmlPlugin(config),
|
|
275
|
-
commonjsPlugin(
|
|
276
|
-
ignoreDynamicRequires: true,
|
|
277
|
-
...options.commonjsOptions
|
|
278
|
-
}),
|
|
275
|
+
commonjsPlugin(options.commonjsOptions),
|
|
279
276
|
dataURIPlugin(),
|
|
280
277
|
dynamicImportVars(options.dynamicImportVarsOptions),
|
|
281
278
|
assetImportMetaUrlPlugin(config),
|
package/src/node/config.ts
CHANGED
package/src/node/constants.ts
CHANGED
|
@@ -41,9 +41,9 @@ export const NULL_BYTE_PLACEHOLDER = `__x00__`
|
|
|
41
41
|
export const CLIENT_PUBLIC_PATH = `/@vite/client`
|
|
42
42
|
export const ENV_PUBLIC_PATH = `/@vite/env`
|
|
43
43
|
// eslint-disable-next-line node/no-missing-require
|
|
44
|
-
export const CLIENT_ENTRY = require.resolve('vite/dist/client/client.
|
|
44
|
+
export const CLIENT_ENTRY = require.resolve('vite/dist/client/client.mjs')
|
|
45
45
|
// eslint-disable-next-line node/no-missing-require
|
|
46
|
-
export const ENV_ENTRY = require.resolve('vite/dist/client/env.
|
|
46
|
+
export const ENV_ENTRY = require.resolve('vite/dist/client/env.mjs')
|
|
47
47
|
export const CLIENT_DIR = path.dirname(CLIENT_ENTRY)
|
|
48
48
|
|
|
49
49
|
export const KNOWN_ASSET_TYPES = [
|
|
@@ -144,6 +144,12 @@ export async function optimizeDeps(
|
|
|
144
144
|
} else {
|
|
145
145
|
fs.mkdirSync(cacheDir, { recursive: true })
|
|
146
146
|
}
|
|
147
|
+
// a hint for Node.js
|
|
148
|
+
// all files in the cache directory should be recognized as ES modules
|
|
149
|
+
writeFile(
|
|
150
|
+
path.resolve(cacheDir, 'package.json'),
|
|
151
|
+
JSON.stringify({ type: 'module' })
|
|
152
|
+
)
|
|
147
153
|
|
|
148
154
|
let deps: Record<string, string>, missing: Record<string, string>
|
|
149
155
|
if (!newDeps) {
|
|
@@ -261,6 +267,7 @@ export async function optimizeDeps(
|
|
|
261
267
|
config.optimizeDeps?.esbuildOptions ?? {}
|
|
262
268
|
|
|
263
269
|
const result = await build({
|
|
270
|
+
absWorkingDir: process.cwd(),
|
|
264
271
|
entryPoints: Object.keys(flatIdDeps),
|
|
265
272
|
bundle: true,
|
|
266
273
|
format: 'esm',
|
|
@@ -354,12 +361,7 @@ function isSingleDefaultExport(exports: string[]) {
|
|
|
354
361
|
|
|
355
362
|
const lockfileFormats = ['package-lock.json', 'yarn.lock', 'pnpm-lock.yaml']
|
|
356
363
|
|
|
357
|
-
let cachedHash: string | undefined
|
|
358
|
-
|
|
359
364
|
function getDepHash(root: string, config: ResolvedConfig): string {
|
|
360
|
-
if (cachedHash) {
|
|
361
|
-
return cachedHash
|
|
362
|
-
}
|
|
363
365
|
let content = lookupFile(root, lockfileFormats) || ''
|
|
364
366
|
// also take config into account
|
|
365
367
|
// only a subset of config options that can affect dep optimization
|
|
@@ -37,8 +37,8 @@ const htmlTypesRE = /\.(html|vue|svelte)$/
|
|
|
37
37
|
// use Acorn because it's slow. Luckily this doesn't have to be bullet proof
|
|
38
38
|
// since even missed imports can be caught at runtime, and false positives will
|
|
39
39
|
// simply be ignored.
|
|
40
|
-
const importsRE =
|
|
41
|
-
|
|
40
|
+
export const importsRE =
|
|
41
|
+
/(?:^|;|\*\/)\s*import(?!\s+type)(?:[\w*{}\n\r\t, ]+from\s*)?\s*("[^"]+"|'[^']+')\s*(?:$|;|\/\/|\/\*)/gm
|
|
42
42
|
|
|
43
43
|
export async function scanImports(config: ResolvedConfig): Promise<{
|
|
44
44
|
deps: Record<string, string>
|
|
@@ -94,6 +94,7 @@ export async function scanImports(config: ResolvedConfig): Promise<{
|
|
|
94
94
|
await Promise.all(
|
|
95
95
|
entries.map((entry) =>
|
|
96
96
|
build({
|
|
97
|
+
absWorkingDir: process.cwd(),
|
|
97
98
|
write: false,
|
|
98
99
|
entryPoints: [entry],
|
|
99
100
|
bundle: true,
|
package/src/node/plugins/css.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface CSSModulesOptions {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`
|
|
84
|
-
const cssLangRE = new RegExp(cssLangs)
|
|
84
|
+
export const cssLangRE = new RegExp(cssLangs)
|
|
85
85
|
const cssModuleRE = new RegExp(`\\.module${cssLangs}`)
|
|
86
86
|
const directRequestRE = /(\?|&)direct\b/
|
|
87
87
|
const commonjsProxyRE = /\?commonjs-proxy/
|
|
@@ -760,7 +760,7 @@ type CssUrlReplacer = (
|
|
|
760
760
|
) => string | Promise<string>
|
|
761
761
|
// https://drafts.csswg.org/css-syntax-3/#identifier-code-point
|
|
762
762
|
export const cssUrlRE =
|
|
763
|
-
/(
|
|
763
|
+
/(?<=^|[^\w\-\u0080-\uffff])url\(\s*('[^']+'|"[^"]+"|[^'")]+)\s*\)/
|
|
764
764
|
const cssImageSetRE = /image-set\(([^)]+)\)/
|
|
765
765
|
|
|
766
766
|
const UrlRewritePostcssPlugin: Postcss.PluginCreator<{
|
|
@@ -837,9 +837,7 @@ async function doUrlReplace(
|
|
|
837
837
|
return matched
|
|
838
838
|
}
|
|
839
839
|
|
|
840
|
-
|
|
841
|
-
const initialComma = matched[0] === ',' ? ',' : ''
|
|
842
|
-
return `${initialComma}url(${wrap}${await replacer(rawUrl)}${wrap})`
|
|
840
|
+
return `url(${wrap}${await replacer(rawUrl)}${wrap})`
|
|
843
841
|
}
|
|
844
842
|
|
|
845
843
|
let CleanCSS: any
|
|
@@ -944,7 +942,10 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any {
|
|
|
944
942
|
return loadedPreprocessors[lang]
|
|
945
943
|
}
|
|
946
944
|
try {
|
|
947
|
-
|
|
945
|
+
// Search for the preprocessor in the root directory first, and fall back
|
|
946
|
+
// to the default require paths.
|
|
947
|
+
const fallbackPaths = require.resolve.paths(lang) || []
|
|
948
|
+
const resolved = require.resolve(lang, { paths: [root, ...fallbackPaths] })
|
|
948
949
|
return (loadedPreprocessors[lang] = require(resolved))
|
|
949
950
|
} catch (e) {
|
|
950
951
|
throw new Error(
|
|
@@ -161,7 +161,11 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
if (
|
|
164
|
+
if (
|
|
165
|
+
needPreloadHelper &&
|
|
166
|
+
!ssr &&
|
|
167
|
+
!source.includes(`const ${preloadMethod} =`)
|
|
168
|
+
) {
|
|
165
169
|
str().prepend(`import { ${preloadMethod} } from "${preloadHelperId}";`)
|
|
166
170
|
}
|
|
167
171
|
|
package/src/node/server/hmr.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { RollupError } from 'rollup'
|
|
|
10
10
|
import { prepareError } from './middlewares/error'
|
|
11
11
|
import match from 'minimatch'
|
|
12
12
|
import { Server } from 'http'
|
|
13
|
-
import {
|
|
13
|
+
import { cssLangRE } from '../plugins/css'
|
|
14
14
|
|
|
15
15
|
export const debugHmr = createDebugger('vite:hmr')
|
|
16
16
|
|
|
@@ -227,7 +227,7 @@ function propagateUpdate(
|
|
|
227
227
|
// additionally check for CSS importers, since a PostCSS plugin like
|
|
228
228
|
// Tailwind JIT may register any file as a dependency to a CSS file.
|
|
229
229
|
for (const importer of node.importers) {
|
|
230
|
-
if (
|
|
230
|
+
if (cssLangRE.test(importer.url) && !currentChain.includes(importer)) {
|
|
231
231
|
propagateUpdate(
|
|
232
232
|
importer,
|
|
233
233
|
timestamp,
|
|
@@ -243,13 +243,13 @@ function propagateUpdate(
|
|
|
243
243
|
if (!node.importers.size) {
|
|
244
244
|
return true
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
|
|
247
247
|
// #3716, #3913
|
|
248
248
|
// For a non-CSS file, if all of its importers are CSS files (registered via
|
|
249
249
|
// PostCSS plugins) it should be considered a dead end and force full reload.
|
|
250
250
|
if (
|
|
251
|
-
!
|
|
252
|
-
[...node.importers].every((i) =>
|
|
251
|
+
!cssLangRE.test(node.url) &&
|
|
252
|
+
[...node.importers].every((i) => cssLangRE.test(i.url))
|
|
253
253
|
) {
|
|
254
254
|
return true
|
|
255
255
|
}
|
|
@@ -19,7 +19,15 @@ export function baseMiddleware({
|
|
|
19
19
|
// rewrite url to remove base.. this ensures that other middleware does
|
|
20
20
|
// not need to consider base being prepended or not
|
|
21
21
|
req.url = url.replace(base, '/')
|
|
22
|
-
|
|
22
|
+
return next()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// skip redirect and error fallback on middleware mode, #4057
|
|
26
|
+
if (config.server.middlewareMode) {
|
|
27
|
+
return next()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (path === '/' || path === '/index.html') {
|
|
23
31
|
// redirect root visit to based url
|
|
24
32
|
res.writeHead(302, {
|
|
25
33
|
Location: base
|
|
@@ -91,7 +91,7 @@ function startBrowserProcess(browser: string | undefined, url: string) {
|
|
|
91
91
|
// Fallback to open
|
|
92
92
|
// (It will always open new tab)
|
|
93
93
|
try {
|
|
94
|
-
const options = { app:
|
|
94
|
+
const options: open.Options = browser ? { app: { name: browser } } : {}
|
|
95
95
|
open(url, options).catch(() => {}) // Prevent `unhandledRejection` error.
|
|
96
96
|
return true
|
|
97
97
|
} catch (err) {
|
|
@@ -211,8 +211,56 @@ test('should declare variable for imported super class', async () => {
|
|
|
211
211
|
).toMatchInlineSnapshot(`
|
|
212
212
|
"const __vite_ssr_import_0__ = __vite_ssr_import__(\\"./dependency\\")
|
|
213
213
|
const Foo = __vite_ssr_import_0__.Foo;
|
|
214
|
-
|
|
214
|
+
class A extends Foo {}
|
|
215
215
|
class B extends Foo {}
|
|
216
|
+
Object.defineProperty(__vite_ssr_exports__, \\"default\\", { enumerable: true, value: A })
|
|
217
|
+
Object.defineProperty(__vite_ssr_exports__, \\"B\\", { enumerable: true, configurable: true, get(){ return B }})"
|
|
218
|
+
`)
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
// #4049
|
|
222
|
+
test('should handle default export variants', async () => {
|
|
223
|
+
// default anonymous functions
|
|
224
|
+
expect(
|
|
225
|
+
(await ssrTransform(`export default function() {}\n`, null, null)).code
|
|
226
|
+
).toMatchInlineSnapshot(`
|
|
227
|
+
"__vite_ssr_exports__.default = function() {}
|
|
228
|
+
"
|
|
229
|
+
`)
|
|
230
|
+
// default anonymous class
|
|
231
|
+
expect((await ssrTransform(`export default class {}\n`, null, null)).code)
|
|
232
|
+
.toMatchInlineSnapshot(`
|
|
233
|
+
"__vite_ssr_exports__.default = class {}
|
|
234
|
+
"
|
|
235
|
+
`)
|
|
236
|
+
// default named functions
|
|
237
|
+
expect(
|
|
238
|
+
(
|
|
239
|
+
await ssrTransform(
|
|
240
|
+
`export default function foo() {}\n` +
|
|
241
|
+
`foo.prototype = Object.prototype;`,
|
|
242
|
+
null,
|
|
243
|
+
null
|
|
244
|
+
)
|
|
245
|
+
).code
|
|
246
|
+
).toMatchInlineSnapshot(`
|
|
247
|
+
"function foo() {}
|
|
248
|
+
foo.prototype = Object.prototype;
|
|
249
|
+
Object.defineProperty(__vite_ssr_exports__, \\"default\\", { enumerable: true, value: foo })"
|
|
250
|
+
`)
|
|
251
|
+
// default named classes
|
|
252
|
+
expect(
|
|
253
|
+
(
|
|
254
|
+
await ssrTransform(
|
|
255
|
+
`export default class A {}\n` + `export class B extends A {}`,
|
|
256
|
+
null,
|
|
257
|
+
null
|
|
258
|
+
)
|
|
259
|
+
).code
|
|
260
|
+
).toMatchInlineSnapshot(`
|
|
261
|
+
"class A {}
|
|
262
|
+
class B extends A {}
|
|
263
|
+
Object.defineProperty(__vite_ssr_exports__, \\"default\\", { enumerable: true, value: A })
|
|
216
264
|
Object.defineProperty(__vite_ssr_exports__, \\"B\\", { enumerable: true, configurable: true, get(){ return B }})"
|
|
217
265
|
`)
|
|
218
266
|
})
|
|
@@ -124,11 +124,24 @@ export async function ssrTransform(
|
|
|
124
124
|
|
|
125
125
|
// default export
|
|
126
126
|
if (node.type === 'ExportDefaultDeclaration') {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
if ('id' in node.declaration && node.declaration.id) {
|
|
128
|
+
// named hoistable/class exports
|
|
129
|
+
// export default function foo() {}
|
|
130
|
+
// export default class A {}
|
|
131
|
+
const { name } = node.declaration.id
|
|
132
|
+
s.remove(node.start, node.start + 15 /* 'export default '.length */)
|
|
133
|
+
s.append(
|
|
134
|
+
`\nObject.defineProperty(${ssrModuleExportsKey}, "default", ` +
|
|
135
|
+
`{ enumerable: true, value: ${name} })`
|
|
136
|
+
)
|
|
137
|
+
} else {
|
|
138
|
+
// anonymous default exports
|
|
139
|
+
s.overwrite(
|
|
140
|
+
node.start,
|
|
141
|
+
node.start + 14 /* 'export default'.length */,
|
|
142
|
+
`${ssrModuleExportsKey}.default =`
|
|
143
|
+
)
|
|
144
|
+
}
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
// export * from './foo'
|
package/types/commonjs.d.ts
CHANGED
|
@@ -41,6 +41,18 @@ export interface RollupCommonJSOptions {
|
|
|
41
41
|
* @default true
|
|
42
42
|
*/
|
|
43
43
|
sourceMap?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Some `require` calls cannot be resolved statically to be translated to
|
|
46
|
+
* imports.
|
|
47
|
+
* When this option is set to `false`, the generated code will either
|
|
48
|
+
* directly throw an error when such a call is encountered or, when
|
|
49
|
+
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
50
|
+
* configured dynamic require target.
|
|
51
|
+
* Setting this option to `true` will instead leave the `require` call in the
|
|
52
|
+
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
ignoreDynamicRequires?: boolean
|
|
44
56
|
/**
|
|
45
57
|
* Instructs the plugin whether to enable mixed module transformations. This
|
|
46
58
|
* is useful in scenarios with modules that contain a mix of ES `import`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../src/client/overlay.ts","../../src/client/client.ts"],"sourcesContent":["import { ErrorPayload } from 'types/hmrPayload'\n\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n z-index: 99999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n --monospace: 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --red: #ff5555;\n --yellow: #e2aa53;\n --purple: #cfa4ff;\n --cyan: #2dd9da;\n --dim: #c9c9c9;\n}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: #d8d8d8;\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: #181818;\n border-radius: 6px 6px 8px 8px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n border-top: 8px solid var(--red);\n}\n\npre {\n font-family: var(--monospace);\n font-size: 16px;\n margin-top: 0;\n margin-bottom: 1em;\n overflow-x: scroll;\n scrollbar-width: none;\n}\n\npre::-webkit-scrollbar {\n display: none;\n}\n\n.message {\n line-height: 1.3;\n font-weight: 600;\n white-space: pre-wrap;\n}\n\n.message-body {\n color: var(--red);\n}\n\n.plugin {\n color: var(--purple);\n}\n\n.file {\n color: var(--cyan);\n margin-bottom: 0;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.frame {\n color: var(--yellow);\n}\n\n.stack {\n font-size: 13px;\n color: var(--dim);\n}\n\n.tip {\n font-size: 13px;\n color: #999;\n border-top: 1px dotted #999;\n padding-top: 13px;\n}\n\ncode {\n font-size: 13px;\n font-family: var(--monospace);\n color: var(--yellow);\n}\n\n.file-link {\n text-decoration: underline;\n cursor: pointer;\n}\n</style>\n<div class=\"window\">\n <pre class=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\"></pre>\n <pre class=\"frame\"></pre>\n <pre class=\"stack\"></pre>\n <div class=\"tip\">\n Click outside or fix the code to dismiss.<br>\n You can also disable this overlay with\n <code>hmr: { overlay: false }</code> in <code>vite.config.js.</code>\n </div>\n</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n\n constructor(err: ErrorPayload['err']) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, true)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, true)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n this.addEventListener('click', () => {\n this.close()\n })\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch('/__open-in-editor?file=' + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n\n close(): void {\n this.parentNode?.removeChild(this)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\ncustomElements.define(overlayId, ErrorOverlay)\n","import {\n ErrorPayload,\n FullReloadPayload,\n HMRPayload,\n PrunePayload,\n Update,\n UpdatePayload\n} from 'types/hmrPayload'\nimport { CustomEventName } from 'types/customEvent'\nimport { ErrorOverlay, overlayId } from './overlay'\nimport './env'\n\n// injected by the hmr plugin when served\ndeclare const __ROOT__: string\ndeclare const __BASE__: string\ndeclare const __HMR_PROTOCOL__: string\ndeclare const __HMR_HOSTNAME__: string\ndeclare const __HMR_PORT__: string\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.log('[vite] connecting...')\n\n// use server configuration, then fallback to inference\nconst socketProtocol =\n __HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')\nconst socketHost = `${__HMR_HOSTNAME__ || location.hostname}:${__HMR_PORT__}`\nconst socket = new WebSocket(`${socketProtocol}://${socketHost}`, 'vite-hmr')\nconst base = __BASE__ || '/'\n\nfunction warnFailedFetch(err: Error, path: string | string[]) {\n if (!err.message.match('fetch')) {\n console.error(err)\n }\n console.error(\n `[hmr] Failed to reload ${path}. ` +\n `This could be due to syntax errors or importing non-existent ` +\n `modules. (see errors above)`\n )\n}\n\n// Listen for messages\nsocket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n})\n\nlet isFirstUpdate = true\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.log(`[vite] connected.`)\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => socket.send('ping'), __HMR_TIMEOUT__)\n break\n case 'update':\n notifyListeners('vite:beforeUpdate', payload)\n // if this is the first update and there's already an error overlay, it\n // means the page opened with existing server compile error and the whole\n // module script failed to load (since one of the nested imports is 500).\n // in this case a normal update won't work and a full reload is needed.\n if (isFirstUpdate && hasErrorOverlay()) {\n window.location.reload()\n return\n } else {\n clearErrorOverlay()\n isFirstUpdate = false\n }\n payload.updates.forEach((update) => {\n if (update.type === 'js-update') {\n queueUpdate(fetchUpdate(update))\n } else {\n // css-update\n // this is only sent when a css file referenced with <link> is updated\n let { path, timestamp } = update\n path = path.replace(/\\?.*/, '')\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = (\n [].slice.call(\n document.querySelectorAll(`link`)\n ) as HTMLLinkElement[]\n ).find((e) => e.href.includes(path))\n if (el) {\n const newPath = `${path}${\n path.includes('?') ? '&' : '?'\n }t=${timestamp}`\n el.href = new URL(newPath, el.href).href\n }\n console.log(`[vite] css hot updated: ${path}`)\n }\n })\n break\n case 'custom': {\n notifyListeners(payload.event as CustomEventName<any>, payload.data)\n break\n }\n case 'full-reload':\n notifyListeners('vite:beforeFullReload', payload)\n if (payload.path && payload.path.endsWith('.html')) {\n // if html file is edited, only reload the page if the browser is\n // currently on that page.\n const pagePath = location.pathname\n const payloadPath = base + payload.path.slice(1)\n if (\n pagePath === payloadPath ||\n (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)\n ) {\n location.reload()\n }\n return\n } else {\n location.reload()\n }\n break\n case 'prune':\n notifyListeners('vite:beforePrune', payload)\n // After an HMR update, some modules are no longer imported on the page\n // but they may have left behind side effects that need to be cleaned up\n // (.e.g style injections)\n // TODO Trigger their dispose callbacks.\n payload.paths.forEach((path) => {\n const fn = pruneMap.get(path)\n if (fn) {\n fn(dataMap.get(path))\n }\n })\n break\n case 'error': {\n notifyListeners('vite:error', payload)\n const err = payload.err\n if (enableOverlay) {\n createErrorOverlay(err)\n } else {\n console.error(\n `[vite] Internal Server Error\\n${err.message}\\n${err.stack}`\n )\n }\n break\n }\n default: {\n const check: never = payload\n return check\n }\n }\n}\n\nfunction notifyListeners(\n event: 'vite:beforeUpdate',\n payload: UpdatePayload\n): void\nfunction notifyListeners(event: 'vite:beforePrune', payload: PrunePayload): void\nfunction notifyListeners(\n event: 'vite:beforeFullReload',\n payload: FullReloadPayload\n): void\nfunction notifyListeners(event: 'vite:error', payload: ErrorPayload): void\nfunction notifyListeners<T extends string>(\n event: CustomEventName<T>,\n data: any\n): void\nfunction notifyListeners(event: string, data: any): void {\n const cbs = customListenersMap.get(event)\n if (cbs) {\n cbs.forEach((cb) => cb(data))\n }\n}\n\nconst enableOverlay = __HMR_ENABLE_OVERLAY__\n\nfunction createErrorOverlay(err: ErrorPayload['err']) {\n if (!enableOverlay) return\n clearErrorOverlay()\n document.body.appendChild(new ErrorOverlay(err))\n}\n\nfunction clearErrorOverlay() {\n document\n .querySelectorAll(overlayId)\n .forEach((n) => (n as ErrorOverlay).close())\n}\n\nfunction hasErrorOverlay() {\n return document.querySelectorAll(overlayId).length\n}\n\nlet pending = false\nlet queued: Promise<(() => void) | undefined>[] = []\n\n/**\n * buffer multiple hot updates triggered by the same src change\n * so that they are invoked in the same order they were sent.\n * (otherwise the order may be inconsistent because of the http request round trip)\n */\nasync function queueUpdate(p: Promise<(() => void) | undefined>) {\n queued.push(p)\n if (!pending) {\n pending = true\n await Promise.resolve()\n pending = false\n const loading = [...queued]\n queued = []\n ;(await Promise.all(loading)).forEach((fn) => fn && fn())\n }\n}\n\nasync function waitForSuccessfulPing(ms = 1000) {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n await fetch(`${base}__vite_ping`)\n break\n } catch (e) {\n await new Promise((resolve) => setTimeout(resolve, ms))\n }\n }\n}\n\n// ping server\nsocket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing()\n location.reload()\n})\n\n// https://wicg.github.io/construct-stylesheets\nconst supportsConstructedSheet = (() => {\n try {\n // new CSSStyleSheet()\n // return true\n } catch (e) {}\n return false\n})()\n\nconst sheetsMap = new Map()\n\nexport function updateStyle(id: string, content: string): void {\n let style = sheetsMap.get(id)\n if (supportsConstructedSheet && !content.includes('@import')) {\n if (style && !(style instanceof CSSStyleSheet)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = new CSSStyleSheet()\n style.replaceSync(content)\n // @ts-ignore\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]\n } else {\n style.replaceSync(content)\n }\n } else {\n if (style && !(style instanceof HTMLStyleElement)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.innerHTML = content\n document.head.appendChild(style)\n } else {\n style.innerHTML = content\n }\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n if (style instanceof CSSStyleSheet) {\n // @ts-ignore\n const index = document.adoptedStyleSheets.indexOf(style)\n // @ts-ignore\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(\n (s: CSSStyleSheet) => s !== style\n )\n } else {\n document.head.removeChild(style)\n }\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({ path, acceptedPath, timestamp }: Update) {\n const mod = hotModulesMap.get(path)\n if (!mod) {\n // In a code-splitting project,\n // it is common that the hot-updating module is not loaded yet.\n // https://github.com/vitejs/vite/issues/721\n return\n }\n\n const moduleMap = new Map()\n const isSelfUpdate = path === acceptedPath\n\n // make sure we only import each dep once\n const modulesToUpdate = new Set<string>()\n if (isSelfUpdate) {\n // self update - only update self\n modulesToUpdate.add(path)\n } else {\n // dep update\n for (const { deps } of mod.callbacks) {\n deps.forEach((dep) => {\n if (acceptedPath === dep) {\n modulesToUpdate.add(dep)\n }\n })\n }\n }\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => {\n return deps.some((dep) => modulesToUpdate.has(dep))\n })\n\n await Promise.all(\n Array.from(modulesToUpdate).map(async (dep) => {\n const disposer = disposeMap.get(dep)\n if (disposer) await disposer(dataMap.get(dep))\n const [path, query] = dep.split(`?`)\n try {\n const newMod = await import(\n /* @vite-ignore */\n base +\n path.slice(1) +\n `?import&t=${timestamp}${query ? `&${query}` : ''}`\n )\n moduleMap.set(dep, newMod)\n } catch (e) {\n warnFailedFetch(e, dep)\n }\n })\n )\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => moduleMap.get(dep)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.log(`[vite] hot updated: ${loggedPath}`)\n }\n}\n\ninterface HotModule {\n id: string\n callbacks: HotCallback[]\n}\n\ninterface HotCallback {\n // the dependencies must be fetchable paths\n deps: string[]\n fn: (modules: object[]) => void\n}\n\nconst hotModulesMap = new Map<string, HotModule>()\nconst disposeMap = new Map<string, (data: any) => void | Promise<void>>()\nconst pruneMap = new Map<string, (data: any) => void | Promise<void>>()\nconst dataMap = new Map<string, any>()\nconst customListenersMap = new Map<string, ((data: any) => void)[]>()\nconst ctxToListenersMap = new Map<\n string,\n Map<string, ((data: any) => void)[]>\n>()\n\n// Just infer the return type for now\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const createHotContext = (ownerPath: string) => {\n if (!dataMap.has(ownerPath)) {\n dataMap.set(ownerPath, {})\n }\n\n // when a file is hot updated, a new context is created\n // clear its stale callbacks\n const mod = hotModulesMap.get(ownerPath)\n if (mod) {\n mod.callbacks = []\n }\n\n // clear stale custom event listeners\n const staleListeners = ctxToListenersMap.get(ownerPath)\n if (staleListeners) {\n for (const [event, staleFns] of staleListeners) {\n const listeners = customListenersMap.get(event)\n if (listeners) {\n customListenersMap.set(\n event,\n listeners.filter((l) => !staleFns.includes(l))\n )\n }\n }\n }\n\n const newListeners = new Map()\n ctxToListenersMap.set(ownerPath, newListeners)\n\n function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {\n const mod: HotModule = hotModulesMap.get(ownerPath) || {\n id: ownerPath,\n callbacks: []\n }\n mod.callbacks.push({\n deps,\n fn: callback\n })\n hotModulesMap.set(ownerPath, mod)\n }\n\n const hot = {\n get data() {\n return dataMap.get(ownerPath)\n },\n\n accept(deps: any, callback?: any) {\n if (typeof deps === 'function' || !deps) {\n // self-accept: hot.accept(() => {})\n acceptDeps([ownerPath], ([mod]) => deps && deps(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback && callback(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n acceptDeps() {\n throw new Error(\n `hot.acceptDeps() is deprecated. ` +\n `Use hot.accept() with the same signature instead.`\n )\n },\n\n dispose(cb: (data: any) => void) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb: (data: any) => void) {\n pruneMap.set(ownerPath, cb)\n },\n\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n invalidate() {\n // TODO should tell the server to re-perform hmr propagation\n // from this module as root\n location.reload()\n },\n\n // custom events\n on: (event: string, cb: (data: any) => void) => {\n const addToMap = (map: Map<string, any[]>) => {\n const existing = map.get(event) || []\n existing.push(cb)\n map.set(event, existing)\n }\n addToMap(customListenersMap)\n addToMap(newListeners)\n }\n }\n\n return hot\n}\n\n/**\n * urls here are dynamic import() urls that couldn't be statically analyzed\n */\nexport function injectQuery(url: string, queryToInject: string): string {\n // skip urls that won't be handled by vite\n if (!url.startsWith('.') && !url.startsWith('/')) {\n return url\n }\n\n // can't use pathname from URL since it may be relative like ../\n const pathname = url.replace(/#.*$/, '').replace(/\\?.*$/, '')\n const { search, hash } = new URL(url, 'http://vitejs.dev')\n\n return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${\n hash || ''\n }`\n}\n"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GzB,CAAA;AAED,MAAM,MAAM,GAAG,gCAAgC,CAAA;AAC/C,MAAM,WAAW,GAAG,0CAA0C,CAAA;MAEjD,YAAa,SAAQ,WAAW;IAG3C,YAAY,GAAwB;;QAClC,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;QAC/C,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QAE9B,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;QACzB,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,QAAQ;cACpB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;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ACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACjB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aACzB,CAAA;YACD,QAAQ,CAAC,kBAAkB,CAAC,CAAA;YAC5B,QAAQ,CAAC,YAAY,CAAC,CAAA;SACvB;KACF,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,EAAC;AAED;;;SAGgB,WAAW,CAAC,GAAW,EAAE,aAAqB;;IAE5D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAChD,OAAO,GAAG,CAAA;KACX;;IAGD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAE1D,OAAO,GAAG,QAAQ,IAAI,aAAa,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GACvE,IAAI,IAAI,EACV,EAAE,CAAA;AACJ;;;;"}
|
package/dist/client/env.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sources":["../../src/client/env.ts"],"sourcesContent":["declare const __MODE__: string\ndeclare const __DEFINES__: Record<string, any>\n\nconst context = (() => {\n if (typeof globalThis !== 'undefined') {\n return globalThis\n } else if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else {\n return Function('return this')()\n }\n})()\n\n// assign defines\nconst defines = __DEFINES__\nObject.keys(defines).forEach((key) => {\n const segments = key.split('.')\n let target = context\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i]\n if (i === segments.length - 1) {\n target[segment] = defines[key]\n } else {\n target = target[segment] || (target[segment] = {})\n }\n }\n})\n"],"names":[],"mappings":"AAGA,MAAM,OAAO,GAAG,CAAC;IACf,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE;QACrC,OAAO,UAAU,CAAA;KAClB;SAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QACtC,OAAO,IAAI,CAAA;KACZ;SAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACxC,OAAO,MAAM,CAAA;KACd;SAAM;QACL,OAAO,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAA;KACjC;AACH,CAAC,GAAG,CAAA;AAEJ;AACA,MAAM,OAAO,GAAG,WAAW,CAAA;AAC3B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG;IAC/B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,MAAM,GAAG,OAAO,CAAA;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3B,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;SAC/B;aAAM;YACL,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;SACnD;KACF;AACH,CAAC,CAAC"}
|