Skip to content

Commit 07a4dd0

Browse files
committed
feat: support import attributes syntax
upgrade babel and add `importAttributes` for parser plugin. TypeScript already supports this syntax [proposal](https://github.com/tc39/proposal-import-attributes)
1 parent 61c3c8e commit 07a4dd0

File tree

7 files changed

+154
-197
lines changed

7 files changed

+154
-197
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"node": ">=16.11.0"
5757
},
5858
"devDependencies": {
59-
"@babel/parser": "^7.21.3",
60-
"@babel/types": "^7.21.3",
59+
"@babel/parser": "^7.22.7",
60+
"@babel/types": "^7.22.5",
6161
"@rollup/plugin-alias": "^4.0.3",
6262
"@rollup/plugin-commonjs": "^24.0.1",
6363
"@rollup/plugin-json": "^6.0.0",

packages/compiler-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
},
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
3434
"dependencies": {
35-
"@babel/parser": "^7.21.3",
35+
"@babel/parser": "^7.22.7",
3636
"@vue/shared": "3.3.4",
3737
"estree-walker": "^2.0.2",
3838
"source-map-js": "^1.0.2"
3939
},
4040
"devDependencies": {
41-
"@babel/types": "^7.21.3"
41+
"@babel/types": "^7.22.5"
4242
}
4343
}

packages/compiler-sfc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
3434
"dependencies": {
35-
"@babel/parser": "^7.20.15",
35+
"@babel/parser": "^7.22.7",
3636
"@vue/compiler-core": "3.3.4",
3737
"@vue/compiler-dom": "3.3.4",
3838
"@vue/compiler-ssr": "3.3.4",
@@ -44,7 +44,7 @@
4444
"source-map-js": "^1.0.2"
4545
},
4646
"devDependencies": {
47-
"@babel/types": "^7.21.3",
47+
"@babel/types": "^7.22.5",
4848
"@types/estree": "^0.0.48",
4949
"@types/lru-cache": "^5.1.0",
5050
"@vue/consolidate": "^0.17.3",

packages/compiler-sfc/src/script/context.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ export function resolveParserPlugins(
163163
userPlugins = userPlugins.filter(p => p !== 'jsx')
164164
}
165165
if (lang === 'ts' || lang === 'tsx') {
166-
plugins.push(['typescript', { dts }])
166+
plugins.push(
167+
['typescript', { dts }],
168+
['importAttributes', { deprecatedAssertSyntax: true }]
169+
)
167170
if (!plugins.includes('decorators')) {
168171
plugins.push('decorators-legacy')
169172
}

packages/reactivity-transform/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
},
2929
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
3030
"dependencies": {
31-
"@babel/parser": "^7.20.15",
31+
"@babel/parser": "^7.22.7",
3232
"@vue/compiler-core": "3.3.4",
3333
"@vue/shared": "3.3.4",
3434
"estree-walker": "^2.0.2",
3535
"magic-string": "^0.30.0"
3636
},
3737
"devDependencies": {
38-
"@babel/core": "^7.21.3",
39-
"@babel/types": "^7.21.3"
38+
"@babel/core": "^7.22.9",
39+
"@babel/types": "^7.22.5"
4040
}
4141
}

packages/vue-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"homepage": "https://github.com/vuejs/core/tree/main/packages/vue-compat#readme",
4040
"dependencies": {
41-
"@babel/parser": "^7.21.3",
41+
"@babel/parser": "^7.22.7",
4242
"estree-walker": "^2.0.2",
4343
"source-map-js": "^1.0.2"
4444
},

0 commit comments

Comments
 (0)