refactor: remove typescript

This commit is contained in:
三咲智子 Kevin Deng 2023-09-26 01:31:03 +08:00
parent 516685b16a
commit 3a3c4f85c0
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
4 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,7 @@
{
"name": "@vue/babel-plugin-resolve-type",
"version": "0.0.0",
"description": "Babel plugin for resolving Vue types",
"description": "Babel plugin for resolving Vue types.",
"author": "三咲智子 <sxzz@sxzz.moe>",
"homepage": "https://github.com/vuejs/babel-plugin-jsx/tree/dev/packages/babel-plugin-resolve-type#readme",
"license": "MIT",
@ -36,11 +36,11 @@
"@babel/code-frame": "^7.22.10",
"@babel/helper-module-imports": "^7.22.5",
"@babel/parser": "^7.22.11",
"@babel/plugin-syntax-typescript": "^7.22.5",
"@vue/compiler-sfc": "npm:@vue/compiler-sfc-canary@minor"
},
"devDependencies": {
"@babel/core": "^7.22.11",
"@babel/plugin-syntax-typescript": "^7.22.5",
"@types/babel__code-frame": "^7.0.3",
"@types/babel__helper-module-imports": "^7.18.0",
"vue": "^3.3.4"

View File

@ -1,7 +1,5 @@
import type * as BabelCore from '@babel/core';
import { parseExpression } from '@babel/parser';
// @ts-expect-error no dts
import typescript from '@babel/plugin-syntax-typescript';
import {
type SimpleTypeResolveContext,
type SimpleTypeResolveOptions,
@ -19,7 +17,6 @@ export default ({
return {
name: 'babel-plugin-resolve-type',
inherits: typescript,
pre(file) {
const filename = file.opts.filename || 'unknown.js';
helpers = new Set();

View File

@ -1,9 +1,11 @@
import { transformAsync } from '@babel/core';
// @ts-expect-error missing types
import typescript from '@babel/plugin-syntax-typescript';
import ResolveType from '../src';
async function transform(code: string): Promise<string> {
const result = await transformAsync(code, {
plugins: [[ResolveType, { isTSX: true }]],
plugins: [[typescript, { isTSX: true }], ResolveType],
});
return result!.code!;
}

8
pnpm-lock.yaml generated
View File

@ -125,9 +125,6 @@ importers:
'@babel/parser':
specifier: ^7.22.11
version: 7.22.16
'@babel/plugin-syntax-typescript':
specifier: ^7.22.5
version: 7.22.5(@babel/core@7.22.20)
'@vue/compiler-sfc':
specifier: npm:@vue/compiler-sfc-canary@minor
version: /@vue/compiler-sfc-canary@3.20230925.0-minor.0
@ -135,6 +132,9 @@ importers:
'@babel/core':
specifier: ^7.22.11
version: 7.22.20
'@babel/plugin-syntax-typescript':
specifier: ^7.22.5
version: 7.22.5(@babel/core@7.22.20)
'@types/babel__code-frame':
specifier: ^7.0.3
version: 7.0.3
@ -682,7 +682,7 @@ packages:
dependencies:
'@babel/core': 7.22.20
'@babel/helper-plugin-utils': 7.22.5
dev: false
dev: true
/@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.22.20):
resolution: {integrity: sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==}