Skip to content

Commit b4aa5f9

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 9412c20 + 384591a commit b4aa5f9

File tree

20 files changed

+354
-304
lines changed

20 files changed

+354
-304
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v4
2121

2222
- name: Install pnpm
23-
uses: pnpm/action-setup@v2
23+
uses: pnpm/action-setup@v3.0.0
2424

2525
- name: Install Node.js
2626
uses: actions/setup-node@v4
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@v4
4343

4444
- name: Install pnpm
45-
uses: pnpm/action-setup@v2
45+
uses: pnpm/action-setup@v3.0.0
4646

4747
- name: Install Node.js
4848
uses: actions/setup-node@v4
@@ -102,7 +102,7 @@ jobs:
102102
# - uses: actions/checkout@v4
103103

104104
# - name: Install pnpm
105-
# uses: pnpm/action-setup@v2
105+
# uses: pnpm/action-setup@v3.0.0
106106

107107
# - name: Install Node.js
108108
# uses: actions/setup-node@v4

.github/workflows/size-data.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- main
10+
- minor
1011

1112
permissions:
1213
contents: read
@@ -22,7 +23,7 @@ jobs:
2223
- uses: actions/checkout@v4
2324

2425
- name: Install pnpm
25-
uses: pnpm/action-setup@v2
26+
uses: pnpm/action-setup@v3.0.0
2627

2728
- name: Install Node.js
2829
uses: actions/setup-node@v4

.github/workflows/size-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525

2626
- name: Install pnpm
27-
uses: pnpm/action-setup@v2
27+
uses: pnpm/action-setup@v3.0.0
2828

2929
- name: Install Node.js
3030
uses: actions/setup-node@v4

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"node": ">=18.12.0"
6060
},
6161
"devDependencies": {
62-
"@babel/parser": "^7.23.9",
63-
"@babel/types": "^7.23.9",
62+
"@babel/parser": "^7.24.0",
63+
"@babel/types": "^7.24.0",
6464
"@codspeed/vitest-plugin": "^2.3.1",
6565
"@rollup/plugin-alias": "^5.1.0",
6666
"@rollup/plugin-commonjs": "^25.0.7",
@@ -70,10 +70,10 @@
7070
"@rollup/plugin-terser": "^0.4.4",
7171
"@types/hash-sum": "^1.0.2",
7272
"@types/minimist": "^1.2.5",
73-
"@types/node": "^20.11.20",
73+
"@types/node": "^20.11.25",
7474
"@types/semver": "^7.5.8",
75-
"@typescript-eslint/eslint-plugin": "^7.0.2",
76-
"@typescript-eslint/parser": "^7.0.2",
75+
"@typescript-eslint/eslint-plugin": "^7.1.1",
76+
"@typescript-eslint/parser": "^7.1.1",
7777
"@vitest/coverage-istanbul": "^1.3.1",
7878
"@vitest/ui": "^1.2.2",
7979
"@vue/consolidate": "1.0.0",
@@ -90,30 +90,30 @@
9090
"jsdom": "^24.0.0",
9191
"lint-staged": "^15.2.2",
9292
"lodash": "^4.17.21",
93-
"magic-string": "^0.30.7",
93+
"magic-string": "^0.30.8",
9494
"markdown-table": "^3.0.3",
95-
"marked": "^12.0.0",
95+
"marked": "^12.0.1",
9696
"minimist": "^1.2.8",
9797
"npm-run-all2": "^6.1.2",
9898
"picocolors": "^1.0.0",
9999
"prettier": "^3.2.5",
100100
"pretty-bytes": "^6.1.1",
101101
"pug": "^3.0.2",
102-
"puppeteer": "~22.2.0",
102+
"puppeteer": "~22.4.1",
103103
"rimraf": "^5.0.5",
104-
"rollup": "^4.12.0",
104+
"rollup": "^4.12.1",
105105
"rollup-plugin-dts": "^6.1.0",
106106
"rollup-plugin-esbuild": "^6.1.1",
107107
"rollup-plugin-polyfill-node": "^0.13.0",
108108
"semver": "^7.6.0",
109109
"serve": "^14.2.1",
110-
"simple-git-hooks": "^2.9.0",
111-
"terser": "^5.28.1",
110+
"simple-git-hooks": "^2.10.0",
111+
"terser": "^5.29.1",
112112
"todomvc-app-css": "^2.4.3",
113113
"tslib": "^2.6.2",
114114
"tsx": "^4.7.1",
115115
"typescript": "^5.2.2",
116-
"vite": "^5.1.4",
116+
"vite": "^5.1.5",
117117
"vitest": "^1.3.1"
118118
}
119119
}

packages/compiler-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
},
4747
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-core#readme",
4848
"dependencies": {
49-
"@babel/parser": "^7.23.9",
49+
"@babel/parser": "^7.24.0",
5050
"@vue/shared": "workspace:*",
5151
"entities": "^4.5.0",
5252
"estree-walker": "^2.0.2",
5353
"source-map-js": "^1.0.2"
5454
},
5555
"devDependencies": {
56-
"@babel/types": "^7.23.9"
56+
"@babel/types": "^7.24.0"
5757
}
5858
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,3 +1362,24 @@ return { get foo() { return foo } }
13621362
13631363
}"
13641364
`;
1365+
1366+
exports[`compileScript > should care about runtimeModuleName 1`] = `
1367+
"import { withAsyncContext as _withAsyncContext } from "npm:vue"
1368+
1369+
export default {
1370+
async setup(__props, { expose: __expose }) {
1371+
__expose();
1372+
1373+
let __temp, __restore
1374+
1375+
;(
1376+
([__temp,__restore] = _withAsyncContext(() => Promise.resolve(1))),
1377+
await __temp,
1378+
__restore()
1379+
)
1380+
1381+
return { }
1382+
}
1383+
1384+
}"
1385+
`;

packages/compiler-sfc/__tests__/compileScript.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,3 +1472,26 @@ describe('SFC genDefaultAs', () => {
14721472
})
14731473
})
14741474
})
1475+
1476+
describe('compileScript', () => {
1477+
test('should care about runtimeModuleName', () => {
1478+
const { content } = compile(
1479+
`
1480+
<script setup>
1481+
await Promise.resolve(1)
1482+
</script>
1483+
`,
1484+
{
1485+
templateOptions: {
1486+
compilerOptions: {
1487+
runtimeModuleName: 'npm:vue',
1488+
},
1489+
},
1490+
},
1491+
)
1492+
expect(content).toMatch(
1493+
`import { withAsyncContext as _withAsyncContext } from "npm:vue"\n`,
1494+
)
1495+
assertCode(content)
1496+
})
1497+
})

packages/compiler-sfc/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
},
4343
"homepage": "https://github.com/vuejs/core-vapor/tree/main/packages/compiler-sfc#readme",
4444
"dependencies": {
45-
"@babel/parser": "^7.23.9",
45+
"@babel/parser": "^7.24.0",
4646
"@vue/compiler-core": "workspace:*",
4747
"@vue/compiler-dom": "workspace:*",
4848
"@vue/compiler-ssr": "workspace:*",
4949
"@vue/compiler-vapor": "workspace:*",
5050
"@vue/shared": "workspace:*",
5151
"estree-walker": "^2.0.2",
52-
"magic-string": "^0.30.7",
52+
"magic-string": "^0.30.8",
5353
"postcss": "^8.4.35",
5454
"source-map-js": "^1.0.2"
5555
},
5656
"devDependencies": {
57-
"@babel/types": "^7.23.9",
57+
"@babel/types": "^7.24.0",
5858
"@vue/consolidate": "^1.0.0",
5959
"hash-sum": "^2.0.0",
6060
"lru-cache": "10.1.0",

packages/compiler-sfc/src/compileScript.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,10 +999,15 @@ export function compileScript(
999999

10001000
// 11. finalize Vue helper imports
10011001
if (ctx.helperImports.size > 0) {
1002+
const runtimeModuleName =
1003+
options.templateOptions?.compilerOptions?.runtimeModuleName
1004+
const importSrc = runtimeModuleName
1005+
? JSON.stringify(runtimeModuleName)
1006+
: `'vue'`
10021007
ctx.s.prepend(
10031008
`import { ${[...ctx.helperImports]
10041009
.map(h => `${h} as _${h}`)
1005-
.join(', ')} } from 'vue'\n`,
1010+
.join(', ')} } from ${importSrc}\n`,
10061011
)
10071012
}
10081013
if (ctx.vaporHelperImports.size > 0) {

packages/reactivity/src/collectionHandlers.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ function createReadonlyMethod(type: TriggerOpTypes): Function {
237237
}
238238
}
239239

240+
type Instrumentations = Record<string | symbol, Function | number>
241+
240242
function createInstrumentations() {
241-
const mutableInstrumentations: Record<string, Function | number> = {
243+
const mutableInstrumentations: Instrumentations = {
242244
get(this: MapTypes, key: unknown) {
243245
return get(this, key)
244246
},
@@ -253,7 +255,7 @@ function createInstrumentations() {
253255
forEach: createForEach(false, false),
254256
}
255257

256-
const shallowInstrumentations: Record<string, Function | number> = {
258+
const shallowInstrumentations: Instrumentations = {
257259
get(this: MapTypes, key: unknown) {
258260
return get(this, key, false, true)
259261
},
@@ -268,7 +270,7 @@ function createInstrumentations() {
268270
forEach: createForEach(false, true),
269271
}
270272

271-
const readonlyInstrumentations: Record<string, Function | number> = {
273+
const readonlyInstrumentations: Instrumentations = {
272274
get(this: MapTypes, key: unknown) {
273275
return get(this, key, true)
274276
},
@@ -285,7 +287,7 @@ function createInstrumentations() {
285287
forEach: createForEach(true, false),
286288
}
287289

288-
const shallowReadonlyInstrumentations: Record<string, Function | number> = {
290+
const shallowReadonlyInstrumentations: Instrumentations = {
289291
get(this: MapTypes, key: unknown) {
290292
return get(this, key, true, true)
291293
},
@@ -302,24 +304,18 @@ function createInstrumentations() {
302304
forEach: createForEach(true, true),
303305
}
304306

305-
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator]
307+
const iteratorMethods = [
308+
'keys',
309+
'values',
310+
'entries',
311+
Symbol.iterator,
312+
] as const
313+
306314
iteratorMethods.forEach(method => {
307-
mutableInstrumentations[method as string] = createIterableMethod(
308-
method,
309-
false,
310-
false,
311-
)
312-
readonlyInstrumentations[method as string] = createIterableMethod(
313-
method,
314-
true,
315-
false,
316-
)
317-
shallowInstrumentations[method as string] = createIterableMethod(
318-
method,
319-
false,
320-
true,
321-
)
322-
shallowReadonlyInstrumentations[method as string] = createIterableMethod(
315+
mutableInstrumentations[method] = createIterableMethod(method, false, false)
316+
readonlyInstrumentations[method] = createIterableMethod(method, true, false)
317+
shallowInstrumentations[method] = createIterableMethod(method, false, true)
318+
shallowReadonlyInstrumentations[method] = createIterableMethod(
323319
method,
324320
true,
325321
true,

0 commit comments

Comments
 (0)