Преглед изворни кода

Merge remote-tracking branch 'upstream/main'

三咲智子 Kevin Deng пре 2 година
родитељ
комит
b4aa5f98d7

+ 3 - 3
.github/workflows/ci.yml

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

+ 2 - 1
.github/workflows/size-data.yml

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

+ 1 - 1
.github/workflows/size-report.yml

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

+ 12 - 12
package.json

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

+ 2 - 2
packages/compiler-core/package.json

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

+ 21 - 0
packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

@@ -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 {  }
+}
+
+}"
+`;

+ 23 - 0
packages/compiler-sfc/__tests__/compileScript.spec.ts

@@ -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)
+  })
+})

+ 3 - 3
packages/compiler-sfc/package.json

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

+ 6 - 1
packages/compiler-sfc/src/compileScript.ts

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

+ 17 - 21
packages/reactivity/src/collectionHandlers.ts

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

+ 1 - 0
packages/runtime-core/src/devtools.ts

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

+ 3 - 2
packages/runtime-dom/src/jsx.ts

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

+ 1 - 1
packages/server-renderer/src/helpers/ssrRenderAttrs.ts

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

+ 1 - 1
packages/sfc-playground/package.json

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

+ 1 - 1
packages/sfc-playground/src/download/download.ts

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

+ 1 - 1
packages/sfc-playground/src/download/template/README.md

@@ -1,6 +1,6 @@
 # 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:
 

+ 1 - 1
packages/sfc-playground/src/download/template/package.json

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

+ 2 - 0
packages/shared/src/makeMap.ts

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

+ 1 - 1
packages/vue-compat/package.json

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

Разлика између датотеке није приказан због своје велике величине
+ 186 - 186
pnpm-lock.yaml


Неке датотеке нису приказане због велике количине промена