Merge remote-tracking branch 'upstream/main'

This commit is contained in:
三咲智子 Kevin Deng 2024-03-14 14:17:25 +08:00
commit b4aa5f98d7
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
20 changed files with 354 additions and 304 deletions

View File

@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v3.0.0
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v3.0.0
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -102,7 +102,7 @@ jobs:
# - uses: actions/checkout@v4 # - uses: actions/checkout@v4
# - name: Install pnpm # - name: Install pnpm
# uses: pnpm/action-setup@v2 # uses: pnpm/action-setup@v3.0.0
# - name: Install Node.js # - name: Install Node.js
# uses: actions/setup-node@v4 # uses: actions/setup-node@v4

View File

@ -7,6 +7,7 @@ on:
pull_request: pull_request:
branches: branches:
- main - main
- minor
permissions: permissions:
contents: read contents: read
@ -22,7 +23,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v3.0.0
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v3.0.0
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@ -59,8 +59,8 @@
"node": ">=18.12.0" "node": ">=18.12.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/parser": "^7.23.9", "@babel/parser": "^7.24.0",
"@babel/types": "^7.23.9", "@babel/types": "^7.24.0",
"@codspeed/vitest-plugin": "^2.3.1", "@codspeed/vitest-plugin": "^2.3.1",
"@rollup/plugin-alias": "^5.1.0", "@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
@ -70,10 +70,10 @@
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"@types/hash-sum": "^1.0.2", "@types/hash-sum": "^1.0.2",
"@types/minimist": "^1.2.5", "@types/minimist": "^1.2.5",
"@types/node": "^20.11.20", "@types/node": "^20.11.25",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.0.2", "@typescript-eslint/parser": "^7.1.1",
"@vitest/coverage-istanbul": "^1.3.1", "@vitest/coverage-istanbul": "^1.3.1",
"@vitest/ui": "^1.2.2", "@vitest/ui": "^1.2.2",
"@vue/consolidate": "1.0.0", "@vue/consolidate": "1.0.0",
@ -90,30 +90,30 @@
"jsdom": "^24.0.0", "jsdom": "^24.0.0",
"lint-staged": "^15.2.2", "lint-staged": "^15.2.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"magic-string": "^0.30.7", "magic-string": "^0.30.8",
"markdown-table": "^3.0.3", "markdown-table": "^3.0.3",
"marked": "^12.0.0", "marked": "^12.0.1",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"npm-run-all2": "^6.1.2", "npm-run-all2": "^6.1.2",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"pretty-bytes": "^6.1.1", "pretty-bytes": "^6.1.1",
"pug": "^3.0.2", "pug": "^3.0.2",
"puppeteer": "~22.2.0", "puppeteer": "~22.4.1",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"rollup": "^4.12.0", "rollup": "^4.12.1",
"rollup-plugin-dts": "^6.1.0", "rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1", "rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-polyfill-node": "^0.13.0", "rollup-plugin-polyfill-node": "^0.13.0",
"semver": "^7.6.0", "semver": "^7.6.0",
"serve": "^14.2.1", "serve": "^14.2.1",
"simple-git-hooks": "^2.9.0", "simple-git-hooks": "^2.10.0",
"terser": "^5.28.1", "terser": "^5.29.1",
"todomvc-app-css": "^2.4.3", "todomvc-app-css": "^2.4.3",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"tsx": "^4.7.1", "tsx": "^4.7.1",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^5.1.4", "vite": "^5.1.5",
"vitest": "^1.3.1" "vitest": "^1.3.1"
} }
} }

View File

@ -46,13 +46,13 @@
}, },
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-core#readme", "homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-core#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.9", "@babel/parser": "^7.24.0",
"@vue/shared": "workspace:*", "@vue/shared": "workspace:*",
"entities": "^4.5.0", "entities": "^4.5.0",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/types": "^7.23.9" "@babel/types": "^7.24.0"
} }
} }

View File

@ -1362,3 +1362,24 @@ return { get foo() { return foo } }
}" }"
`; `;
exports[`compileScript > should care about runtimeModuleName 1`] = `
"import { withAsyncContext as _withAsyncContext } from "npm:vue"
export default {
async setup(__props, { expose: __expose }) {
__expose();
let __temp, __restore
;(
([__temp,__restore] = _withAsyncContext(() => Promise.resolve(1))),
await __temp,
__restore()
)
return { }
}
}"
`;

View File

@ -1472,3 +1472,26 @@ describe('SFC genDefaultAs', () => {
}) })
}) })
}) })
describe('compileScript', () => {
test('should care about runtimeModuleName', () => {
const { content } = compile(
`
<script setup>
await Promise.resolve(1)
</script>
`,
{
templateOptions: {
compilerOptions: {
runtimeModuleName: 'npm:vue',
},
},
},
)
expect(content).toMatch(
`import { withAsyncContext as _withAsyncContext } from "npm:vue"\n`,
)
assertCode(content)
})
})

View File

@ -42,19 +42,19 @@
}, },
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-sfc#readme", "homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-sfc#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.9", "@babel/parser": "^7.24.0",
"@vue/compiler-core": "workspace:*", "@vue/compiler-core": "workspace:*",
"@vue/compiler-dom": "workspace:*", "@vue/compiler-dom": "workspace:*",
"@vue/compiler-ssr": "workspace:*", "@vue/compiler-ssr": "workspace:*",
"@vue/compiler-vapor": "workspace:*", "@vue/compiler-vapor": "workspace:*",
"@vue/shared": "workspace:*", "@vue/shared": "workspace:*",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"magic-string": "^0.30.7", "magic-string": "^0.30.8",
"postcss": "^8.4.35", "postcss": "^8.4.35",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/types": "^7.23.9", "@babel/types": "^7.24.0",
"@vue/consolidate": "^1.0.0", "@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lru-cache": "10.1.0", "lru-cache": "10.1.0",

View File

@ -999,10 +999,15 @@ export function compileScript(
// 11. finalize Vue helper imports // 11. finalize Vue helper imports
if (ctx.helperImports.size > 0) { if (ctx.helperImports.size > 0) {
const runtimeModuleName =
options.templateOptions?.compilerOptions?.runtimeModuleName
const importSrc = runtimeModuleName
? JSON.stringify(runtimeModuleName)
: `'vue'`
ctx.s.prepend( ctx.s.prepend(
`import { ${[...ctx.helperImports] `import { ${[...ctx.helperImports]
.map(h => `${h} as _${h}`) .map(h => `${h} as _${h}`)
.join(', ')} } from 'vue'\n`, .join(', ')} } from ${importSrc}\n`,
) )
} }
if (ctx.vaporHelperImports.size > 0) { if (ctx.vaporHelperImports.size > 0) {

View File

@ -237,8 +237,10 @@ function createReadonlyMethod(type: TriggerOpTypes): Function {
} }
} }
type Instrumentations = Record<string | symbol, Function | number>
function createInstrumentations() { function createInstrumentations() {
const mutableInstrumentations: Record<string, Function | number> = { const mutableInstrumentations: Instrumentations = {
get(this: MapTypes, key: unknown) { get(this: MapTypes, key: unknown) {
return get(this, key) return get(this, key)
}, },
@ -253,7 +255,7 @@ function createInstrumentations() {
forEach: createForEach(false, false), forEach: createForEach(false, false),
} }
const shallowInstrumentations: Record<string, Function | number> = { const shallowInstrumentations: Instrumentations = {
get(this: MapTypes, key: unknown) { get(this: MapTypes, key: unknown) {
return get(this, key, false, true) return get(this, key, false, true)
}, },
@ -268,7 +270,7 @@ function createInstrumentations() {
forEach: createForEach(false, true), forEach: createForEach(false, true),
} }
const readonlyInstrumentations: Record<string, Function | number> = { const readonlyInstrumentations: Instrumentations = {
get(this: MapTypes, key: unknown) { get(this: MapTypes, key: unknown) {
return get(this, key, true) return get(this, key, true)
}, },
@ -285,7 +287,7 @@ function createInstrumentations() {
forEach: createForEach(true, false), forEach: createForEach(true, false),
} }
const shallowReadonlyInstrumentations: Record<string, Function | number> = { const shallowReadonlyInstrumentations: Instrumentations = {
get(this: MapTypes, key: unknown) { get(this: MapTypes, key: unknown) {
return get(this, key, true, true) return get(this, key, true, true)
}, },
@ -302,24 +304,18 @@ function createInstrumentations() {
forEach: createForEach(true, true), forEach: createForEach(true, true),
} }
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator] const iteratorMethods = [
'keys',
'values',
'entries',
Symbol.iterator,
] as const
iteratorMethods.forEach(method => { iteratorMethods.forEach(method => {
mutableInstrumentations[method as string] = createIterableMethod( mutableInstrumentations[method] = createIterableMethod(method, false, false)
method, readonlyInstrumentations[method] = createIterableMethod(method, true, false)
false, shallowInstrumentations[method] = createIterableMethod(method, false, true)
false, shallowReadonlyInstrumentations[method] = createIterableMethod(
)
readonlyInstrumentations[method as string] = createIterableMethod(
method,
true,
false,
)
shallowInstrumentations[method as string] = createIterableMethod(
method,
false,
true,
)
shallowReadonlyInstrumentations[method as string] = createIterableMethod(
method, method,
true, true,
true, true,

View File

@ -123,6 +123,7 @@ export const devtoolsComponentRemoved = (
} }
} }
/*! #__NO_SIDE_EFFECTS__ */
function createDevtoolsComponentHook(hook: DevtoolsHooks) { function createDevtoolsComponentHook(hook: DevtoolsHooks) {
return (component: ComponentInternalInstance) => { return (component: ComponentInternalInstance) => {
emit( emit(

View File

@ -1348,8 +1348,9 @@ export interface Events {
// selection events // selection events
onSelect: Event onSelect: Event
// UI events // scroll events
onScroll: UIEvent onScroll: Event
onScrollend: Event
// touch events // touch events
onTouchcancel: TouchEvent onTouchcancel: TouchEvent

View File

@ -17,7 +17,7 @@ import {
} from '@vue/shared' } from '@vue/shared'
// leading comma for empty string "" // leading comma for empty string ""
const shouldIgnoreProp = makeMap( const shouldIgnoreProp = /*#__PURE__*/ makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`, `,key,ref,innerHTML,textContent,ref_key,ref_for`,
) )

View File

@ -10,7 +10,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"vite": "^5.1.4" "vite": "^5.1.5"
}, },
"dependencies": { "dependencies": {
"@vue/repl": "^4.1.1", "@vue/repl": "^4.1.1",

View File

@ -27,7 +27,7 @@ export async function downloadProject(store: ReplStore) {
const files = store.getFiles() const files = store.getFiles()
for (const file in files) { for (const file in files) {
if (file !== 'import-map.json') { if (file !== 'import-map.json' && file !== 'tsconfig.json') {
src.file(file, files[file]) src.file(file, files[file])
} else { } else {
zip.file(file, files[file]) zip.file(file, files[file])

View File

@ -1,6 +1,6 @@
# Vite Vue Starter # Vite Vue Starter
This is a project template using [Vite](https://vitejs.dev/). It requires [Node.js](https://nodejs.org) v12+. This is a project template using [Vite](https://vitejs.dev/). It requires [Node.js](https://nodejs.org) version 18+, 20+.
To start: To start:

View File

@ -12,6 +12,6 @@
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"vite": "^5.1.4" "vite": "^5.1.5"
} }
} }

View File

@ -5,6 +5,8 @@
* \/\*#\_\_PURE\_\_\*\/ * \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary. * So that rollup can tree-shake them if necessary.
*/ */
/*! #__NO_SIDE_EFFECTS__ */
export function makeMap( export function makeMap(
str: string, str: string,
expectsLowerCase?: boolean, expectsLowerCase?: boolean,

View File

@ -52,7 +52,7 @@
}, },
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/vue-compat#readme", "homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/vue-compat#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.9", "@babel/parser": "^7.24.0",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
}, },

File diff suppressed because it is too large Load Diff