From 62aa5a32525d51e5814ea70c3a67aefce3c88e7d Mon Sep 17 00:00:00 2001 From: Teages Date: Fri, 30 May 2025 22:58:37 +0800 Subject: [PATCH 01/10] feat: replace `esbuild` with `oxidase` --- package.json | 3 +- pnpm-lock.yaml | 9 +++ src/utils/template.ts | 3 +- test/template.test.ts | 126 ++++++++++++++++++------------------------ 4 files changed, 67 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index ca92ca7..3635d78 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "vue": "^3.5.13" }, "dependencies": { - "@babel/parser": "^7.27.0" + "@babel/parser": "^7.27.0", + "oxidase": "^0.0.3" }, "devDependencies": { "@antfu/eslint-config": "4.13.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69a4406..8be419b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,6 +15,9 @@ importers: '@babel/parser': specifier: ^7.27.0 version: 7.27.2 + oxidase: + specifier: ^0.0.3 + version: 0.0.3 devDependencies: '@antfu/eslint-config': specifier: 4.13.2 @@ -2472,6 +2475,10 @@ packages: oxc-resolver@9.0.2: resolution: {integrity: sha512-w838ygc1p7rF+7+h5vR9A+Y9Fc4imy6C3xPthCMkdFUgFvUWkmABeNB8RBDQ6+afk44Q60/UMMQ+gfDUW99fBA==} + oxidase@0.0.3: + resolution: {integrity: sha512-b34YuOWiiFRSj06jYmJHVAqR1cqnG+W4fR4D8lvCFVIFm7Ysrf0E6ZLbfe9nJselZT/qjem0YlKRWtw2EBaIZQ==} + engines: {node: '>=18.20'} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -6002,6 +6009,8 @@ snapshots: '@oxc-resolver/binding-win32-arm64-msvc': 9.0.2 '@oxc-resolver/binding-win32-x64-msvc': 9.0.2 + oxidase@0.0.3: {} + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 diff --git a/src/utils/template.ts b/src/utils/template.ts index d6ba2ee..2c8b5a8 100644 --- a/src/utils/template.ts +++ b/src/utils/template.ts @@ -1,5 +1,6 @@ import type { AttributeNode, DirectiveNode, ExpressionNode, ParentNode, RootNode, SourceLocation, TemplateChildNode, TextNode } from '@vue/compiler-dom' import { isFnExpressionBrowser as isFnExpression, isMemberExpressionBrowser as isMemberExpression } from '@vue/compiler-core' +import { transpile } from 'oxidase' // copy from `@vue/compiler-dom` enum NodeTypes { @@ -142,7 +143,7 @@ export async function transpileVueTemplate( content: string, root: RootNode, offset = 0, - transform: (code: string) => Promise, + transform: (code: string) => Promise = async code => transpile(code), ): Promise { const { MagicString } = await import('vue/compiler-sfc') const expressions: Expression[] = [] diff --git a/test/template.test.ts b/test/template.test.ts index eb7dccf..f269f49 100644 --- a/test/template.test.ts +++ b/test/template.test.ts @@ -1,5 +1,4 @@ import { createRequire } from 'node:module' -import { transform } from 'esbuild' import { resolveModulePath } from 'exsolve' import { describe, expect, it } from 'vitest' import { replaceQuote, transpileVueTemplate } from '../src/utils/template' @@ -7,84 +6,71 @@ import { replaceQuote, transpileVueTemplate } from '../src/utils/template' describe('transform typescript template', () => { it('v-for', async () => { expect(await fixture(`
{{ item }}
`)) - .toEqual(`
{{ item }}
`) + .toMatchInlineSnapshot(`"
{{ item }}
"`) expect(await fixture(`
{{ item }}
`)) - .toEqual(`
{{ item }}
`) + .toMatchInlineSnapshot(`"
{{ item }}
"`) expect(await fixture(`
`)) - .toEqual(`
`) + .toMatchInlineSnapshot(`"
"`) expect(await fixture(`
`)) - .toEqual(`
`) + .toMatchInlineSnapshot(`"
"`) }) it('v-if', async () => { expect(await fixture(`
`)) - .toEqual(`
`) + .toMatchInlineSnapshot(`"
"`) }) it('v-show', async () => { - expect(await fixture(`
`)).toEqual( - `
`, + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) }) it('v-model', async () => { - expect(await fixture(``)).toEqual( - ``, + expect(await fixture(``)).toMatchInlineSnapshot( + `""`, ) }) it('v-on', async () => { expect( await fixture(`
`), - ).toEqual(`
`) - expect(await fixture(`
`)).toEqual( - `
`, + ).toMatchInlineSnapshot(`"
"`) + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) expect( await fixture( `
`, ), - ).toEqual(`
`) + ).toMatchInlineSnapshot(`"
"`) expect( await fixture( `
`, ), - ).toMatchInlineSnapshot(` - "
" - `) + ).toMatchInlineSnapshot(`"
"`) // https://github.com/nuxt/module-builder/issues/587#issuecomment-2820414064 expect( await fixture(`
`), - ).toMatchInlineSnapshot(` - "
" - `) + ).toMatchInlineSnapshot(`"
"`) expect( await fixture(`
`), - ).toMatchInlineSnapshot(` - "
" - `) + ).toMatchInlineSnapshot(`"
"`) }) it('v-slot', async () => { expect(await fixture(``)) - .toMatchInlineSnapshot(`""`) + .toMatchInlineSnapshot(`""`) }) it('destructuring', async () => { expect( await fixture(`{{ active }}`), - ).toEqual(`{{ active }}`) + ).toMatchInlineSnapshot(`"{{ active }}"`) expect( await fixture( @@ -94,64 +80,64 @@ describe('transform typescript template', () => { }) it('compound expressions', async () => { - expect(await fixture(``)).toEqual( - ``, + expect(await fixture(``)).toMatchInlineSnapshot( + `""`, ) }) it('custom directives', async () => { expect( await fixture(`
`), - ).toEqual(`
`) + ).toMatchInlineSnapshot(`"
"`) }) it('v-bind', async () => { - expect(await fixture(`
`)).toEqual( - `
`, + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) expect( await fixture(`
`), - ).toEqual(`
`) - expect(await fixture(``)).toEqual(``) - expect(await fixture(``)).toEqual( - ``, + ).toMatchInlineSnapshot(`"
"`) + expect(await fixture(``)).toMatchInlineSnapshot(`""`) + expect(await fixture(``)).toMatchInlineSnapshot( + `""`, ) - expect(await fixture(``)).toEqual( - ``, + expect(await fixture(``)).toMatchInlineSnapshot( + `""`, ) }) it('interpolation', async () => { - expect(await fixture(`
{{ data!.test }}
`)).toEqual( - `
{{ data.test }}
`, + expect(await fixture(`
{{ data!.test }}
`)).toMatchInlineSnapshot( + `"
{{ data .test }}
"`, ) - expect(await fixture(`
hi {{ data!.test }}
`)).toEqual( - `
hi {{ data.test }}
`, + expect(await fixture(`
hi {{ data!.test }}
`)).toMatchInlineSnapshot( + `"
hi {{ data .test }}
"`, ) expect( await fixture( `
{{ typeof data!.test === "string" ? data!.test : getKey(data!.test) }}
`, ), - ).toEqual( - `
{{ typeof data.test === "string" ? data.test : getKey(data.test) }}
`, + ).toMatchInlineSnapshot( + `"
{{ typeof data .test === "string" ? data .test : getKey(data .test) }}
"`, ) }) it('keep comments', async () => { expect( await fixture(`
{{ data!.test }}
`), - ).toEqual(`
{{ data.test }}
`) + ).toMatchInlineSnapshot(`"
{{ data .test }}
"`) }) it('keep text', async () => { - expect(await fixture(`
data!.test
`)).toEqual( - `
data!.test
`, + expect(await fixture(`
data!.test
`)).toMatchInlineSnapshot( + `"
data!.test
"`, ) }) it('keep empty', async () => { - expect(await fixture(`
{{}}
`)).toEqual(`
{{}}
`) - expect(await fixture(`
`)).toEqual(`
`) + expect(await fixture(`
{{}}
`)).toMatchInlineSnapshot(`"
{{}}
"`) + expect(await fixture(`
`)).toMatchInlineSnapshot(`"
"`) }) it('throw error', async () => { @@ -159,14 +145,14 @@ describe('transform typescript template', () => { }) it('quotes', async () => { - expect(await fixture(`
`)).toEqual( - `
`, + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) - expect(await fixture(`
`)).toEqual( - `
`, + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) - expect(await fixture(`
`)).toEqual( - `
`, + expect(await fixture(`
`)).toMatchInlineSnapshot( + `"
"`, ) }) @@ -181,9 +167,9 @@ describe('transform typescript template', () => { ).toMatchInlineSnapshot(` "
- - - + + +
" `) }) @@ -191,7 +177,7 @@ describe('transform typescript template', () => { it('handles deeply nested templates', async () => { const nestedTemplate = `

{{ (data as any).value }}

` const result = await fixture(nestedTemplate) - expect(result).toEqual('

{{ data.value }}

') + expect(result).toMatchInlineSnapshot(`"

{{ (data ).value }}

"`) }) it('replaces quotes correctly', () => { @@ -216,10 +202,10 @@ describe('transform typescript template', () => { " " @@ -234,10 +220,6 @@ describe('transform typescript template', () => { src, parse(src, { parseMode: 'base' }), 0, - async (code) => { - const res = await transform(code, { loader: 'ts', target: 'esnext' }) - return res.code - }, ) } }) From 45f7be91b00e2b38cff74d9d813dce637bb92678 Mon Sep 17 00:00:00 2001 From: Teages Date: Fri, 30 May 2025 23:03:03 +0800 Subject: [PATCH 02/10] chore: require lts node version (v20) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3635d78..ff312ad 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dist" ], "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" }, "scripts": { "build": "unbuild", From 38b011efb2e31fd9d1a36be1a9d90a1fc9012412 Mon Sep 17 00:00:00 2001 From: Teages Date: Fri, 30 May 2025 23:07:17 +0800 Subject: [PATCH 03/10] feat: remove custom transformer for ` " `) @@ -270,7 +270,7 @@ describe('transform typescript script setup', () => { " `) @@ -370,7 +370,7 @@ describe('transform typescript script setup', () => { " `) From 2487acf6dbdf574fe055ec3a8c886ffd7e1569b1 Mon Sep 17 00:00:00 2001 From: Teages Date: Sat, 31 May 2025 00:13:57 +0800 Subject: [PATCH 07/10] chore(deps): remove `esbuild` from dependencies --- README.md | 10 ++-------- package.json | 2 -- pnpm-lock.yaml | 3 --- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 0446884..c4d4a23 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,14 @@ Install package: ```sh # npm -npm install vue-sfc-transformer vue @vue/compiler-core esbuild +npm install vue-sfc-transformer vue @vue/compiler-core # pnpm -pnpm install vue-sfc-transformer vue @vue/compiler-core esbuild +pnpm install vue-sfc-transformer vue @vue/compiler-core ``` ```js import { parse as parseSFC } from '@vue/compiler-sfc' -import { transform } from 'esbuild' - import { preTranspileScriptSetup, transpileVueTemplate } from 'vue-sfc-transformer' const src = ` @@ -47,10 +45,6 @@ const templateBlockContents = await transpileVueTemplate( sfc.descriptor.template.content, sfc.descriptor.template.ast, sfc.descriptor.template.loc.start.offset, - async (code) => { - const res = await transform(code, { loader: 'ts', target: 'esnext' }) - return res.code - }, ) console.log(templateBlockContents) //
diff --git a/package.json b/package.json index ff312ad..9bf799d 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ }, "peerDependencies": { "@vue/compiler-core": "^3.5.13", - "esbuild": "*", "vue": "^3.5.13" }, "dependencies": { @@ -61,7 +60,6 @@ "@vue/compiler-dom": "3.5.15", "bumpp": "10.1.1", "changelogithub": "13.14.0", - "esbuild": "0.25.4", "eslint": "9.27.0", "exsolve": "1.0.5", "installed-check": "9.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8be419b..fb4e46d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,9 +43,6 @@ importers: changelogithub: specifier: 13.14.0 version: 13.14.0(magicast@0.3.5) - esbuild: - specifier: 0.25.4 - version: 0.25.4 eslint: specifier: 9.27.0 version: 9.27.0(jiti@2.4.2) From 9fe546f88f599a275abb686817fec0cb9aadebec Mon Sep 17 00:00:00 2001 From: Teages Date: Tue, 3 Jun 2025 00:12:47 +0800 Subject: [PATCH 08/10] feat: replace `oxidase` with `@teages/oxc-blank-space` as experimental --- package.json | 2 + pnpm-lock.yaml | 199 +++++++++++++++++++++++++++++++++++++++--- src/utils/mkdist.ts | 2 +- src/utils/template.ts | 2 +- 4 files changed, 193 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 9bf799d..2df281f 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,12 @@ }, "peerDependencies": { "@vue/compiler-core": "^3.5.13", + "typescript": "5.8.3", "vue": "^3.5.13" }, "dependencies": { "@babel/parser": "^7.27.0", + "@teages/oxc-blank-space": "^0.1.0", "oxidase": "^0.0.3" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb4e46d..ff4e3d9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,7 +14,10 @@ importers: dependencies: '@babel/parser': specifier: ^7.27.0 - version: 7.27.2 + version: 7.27.4 + '@teages/oxc-blank-space': + specifier: ^0.1.0 + version: 0.1.0(typescript@5.8.3) oxidase: specifier: ^0.0.3 version: 0.0.3 @@ -166,8 +169,8 @@ packages: resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==} engines: {node: '>=6.9.0'} - '@babel/parser@7.27.2': - resolution: {integrity: sha512-QYLs8299NA7WM/bZAdp+CviYYkVoYXlDW2rzliy3chxd1PQjej7JORuMJDJXJUb9g0TT+B99EwaVLKmX+sPXWw==} + '@babel/parser@7.27.4': + resolution: {integrity: sha512-BRmLHGwpUqLFR2jzx9orBuX/ABDkj2jLKOXrHDTN2aOKL+jFDDKaRNo9nyYsIl9h/UE/7lMKdDjKQQyxKKDZ7g==} engines: {node: '>=6.0.0'} hasBin: true @@ -175,6 +178,10 @@ packages: resolution: {integrity: sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q==} engines: {node: '>=6.9.0'} + '@babel/types@7.27.3': + resolution: {integrity: sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw==} + engines: {node: '>=6.9.0'} + '@bcoe/v8-coverage@1.0.2': resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} @@ -546,6 +553,92 @@ packages: '@octokit/types@13.10.0': resolution: {integrity: sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==} + '@oxc-parser/binding-darwin-arm64@0.72.2': + resolution: {integrity: sha512-+h1ukuH8AqxNq1hEyXG0gBNmPWl99qwtZ6rdZ5odXq3lHsimH2MgMETyccmSjBALVU/VKeoe/1wHL7kJj5MVqA==} + engines: {node: '>=14.0.0'} + cpu: [arm64] + os: [darwin] + + '@oxc-parser/binding-darwin-x64@0.72.2': + resolution: {integrity: sha512-v2c/L0kCuF75AAJTLBbnZ6kSfzCHR23JKqhnksf/ccB7IvssIZCxWyT28IJTkG1vGXCenRz9+kAmUbGHIUqV4A==} + engines: {node: '>=14.0.0'} + cpu: [x64] + os: [darwin] + + '@oxc-parser/binding-freebsd-x64@0.72.2': + resolution: {integrity: sha512-BeZH+f4HqLgdkC7dj7VPhoL5HpeBXQLwxgnm6McbnBJnvDRNl8bc7El1mFBRYe/w6OPcand5P3kNc9oMAfasfw==} + engines: {node: '>=14.0.0'} + cpu: [x64] + os: [freebsd] + + '@oxc-parser/binding-linux-arm-gnueabihf@0.72.2': + resolution: {integrity: sha512-mIu9B856olNcAdG/xdUALW5VhNoCqe3nhdsPmXNZAUQtQ/YyW3X+1zb2v74RhehsNNe7sT0eN2iOMetM+IYF+Q==} + engines: {node: '>=14.0.0'} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm-musleabihf@0.72.2': + resolution: {integrity: sha512-RR74LnLVtoQ2+dErNqrczLofs9I6YG9lIt4Co/6pNcd8pCIMEHXaVtY7Gz9NSko84Que/6ESPccvolhqACXnHQ==} + engines: {node: '>=14.0.0'} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm64-gnu@0.72.2': + resolution: {integrity: sha512-q+86LrcddEkRgA7ces/cmge/FyuoGpa0M2D6Xh6c60orALus39J6j0LRD0pbfh6c8YVmD4XFoOahiOD2kep4+w==} + engines: {node: '>=14.0.0'} + cpu: [arm64] + os: [linux] + + '@oxc-parser/binding-linux-arm64-musl@0.72.2': + resolution: {integrity: sha512-mjwp4B3Yqj6Fo1KIRDRQyWkkJ7ydijReo0UQ6wdDdvQt9v3Sjw4VMlkYAc+hAEo7EX6muPwy2WtjMOtzedlzvA==} + engines: {node: '>=14.0.0'} + cpu: [arm64] + os: [linux] + + '@oxc-parser/binding-linux-riscv64-gnu@0.72.2': + resolution: {integrity: sha512-xjbjHPIjHzew583ly/2uIR8u4YSX2fWuhJitkvqzKGBd403/wV9fOGKbgbgeFZxcqIqQlZI6WcxTU+fcmMQ5HQ==} + engines: {node: '>=14.0.0'} + cpu: [riscv64] + os: [linux] + + '@oxc-parser/binding-linux-s390x-gnu@0.72.2': + resolution: {integrity: sha512-ohZ70sS4koTbQ+LqMDWK2SOMFmhPzv9DNgC82X/PqjuvzAIDPn13Rt+rUmpMwew/Xtbpe/vPHsEdkxNqsq2XMg==} + engines: {node: '>=14.0.0'} + cpu: [s390x] + os: [linux] + + '@oxc-parser/binding-linux-x64-gnu@0.72.2': + resolution: {integrity: sha512-9lYwvYstsnRHivGpH2k8qZQPf0E/FhMr1YuZPxLqyUYzGmdiEpcU7wQbgU6dNIepLLdu/VLmYqmYYaBh86GzWQ==} + engines: {node: '>=14.0.0'} + cpu: [x64] + os: [linux] + + '@oxc-parser/binding-linux-x64-musl@0.72.2': + resolution: {integrity: sha512-4KYID/lCsXR/8m8lgynZzXQIL5zidi5J9cW1nkje2deAf+YmmG6kKm1Vhvq8DaXOkdfGmtDbYd9luYplxncWBg==} + engines: {node: '>=14.0.0'} + cpu: [x64] + os: [linux] + + '@oxc-parser/binding-wasm32-wasi@0.72.2': + resolution: {integrity: sha512-ng+OJ+4MOsdJVt2a7VpcornkYFLu9Faos77UXogJg+HM5NnH1L+8rraGvxzJWf8OhYkwlQCIvLuqkncfPap4RA==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@oxc-parser/binding-win32-arm64-msvc@0.72.2': + resolution: {integrity: sha512-0FSLOzfB7mg1+csZjbo3i5tjLIKGu86vB5ldui5o3QNoxWg+TdRhH0cbxfXZANo3eHTLu5GPtrqaZ0pgB4Pvgw==} + engines: {node: '>=14.0.0'} + cpu: [arm64] + os: [win32] + + '@oxc-parser/binding-win32-x64-msvc@0.72.2': + resolution: {integrity: sha512-mmO/7xfszYE0Q6zAwqOooQrq/0f4ZjtYOoOqvoNCBZ6YqdlwiMSWD3M0ylVfeungyKog2wfJbruabKKt5QbVNw==} + engines: {node: '>=14.0.0'} + cpu: [x64] + os: [win32] + + '@oxc-project/types@0.72.2': + resolution: {integrity: sha512-il5RF8AP85XC0CMjHF4cnVT9nT/v/ocm6qlZQpSiAR9qBbQMGkFKloBZwm7PcnOdiUX97yHgsKM7uDCCWCu3tg==} + '@oxc-resolver/binding-darwin-arm64@9.0.2': resolution: {integrity: sha512-MVyRgP2gzJJtAowjG/cHN3VQXwNLWnY+FpOEsyvDepJki1SdAX/8XDijM1yN6ESD1kr9uhBKjGelC6h3qtT+rA==} cpu: [arm64] @@ -798,6 +891,12 @@ packages: peerDependencies: eslint: '>=9.0.0' + '@teages/oxc-blank-space@0.1.0': + resolution: {integrity: sha512-jxvGT3GZcP1xjy/QtRAX5t9mU5H3NMLdvgnUOeaBDRVag5FeKw2F0PCgIdoj1LdeUV2Sf/Dg7R/x98vUytM6Zg==} + engines: {node: ^20.17.0 || >=22.0.0} + peerDependencies: + typescript: ^5.8.3 + '@trysound/sax@0.2.0': resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} @@ -2469,6 +2568,10 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + oxc-parser@0.72.2: + resolution: {integrity: sha512-uoiphvClzsbf5NKgV1urQ7GfxIO+3YopmBWK465AiAURp0K/77udIWeZWdLCspxW+2CR5PhUpd1XocjANliKYw==} + engines: {node: '>=14.0.0'} + oxc-resolver@9.0.2: resolution: {integrity: sha512-w838ygc1p7rF+7+h5vR9A+Y9Fc4imy6C3xPthCMkdFUgFvUWkmABeNB8RBDQ6+afk44Q60/UMMQ+gfDUW99fBA==} @@ -3422,15 +3525,20 @@ snapshots: '@babel/helper-validator-identifier@7.27.1': {} - '@babel/parser@7.27.2': + '@babel/parser@7.27.4': dependencies: - '@babel/types': 7.27.1 + '@babel/types': 7.27.3 '@babel/types@7.27.1': dependencies: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.27.1 + '@babel/types@7.27.3': + dependencies: + '@babel/helper-string-parser': 7.27.1 + '@babel/helper-validator-identifier': 7.27.1 + '@bcoe/v8-coverage@1.0.2': {} '@clack/core@0.4.2': @@ -3770,6 +3878,52 @@ snapshots: dependencies: '@octokit/openapi-types': 24.2.0 + '@oxc-parser/binding-darwin-arm64@0.72.2': + optional: true + + '@oxc-parser/binding-darwin-x64@0.72.2': + optional: true + + '@oxc-parser/binding-freebsd-x64@0.72.2': + optional: true + + '@oxc-parser/binding-linux-arm-gnueabihf@0.72.2': + optional: true + + '@oxc-parser/binding-linux-arm-musleabihf@0.72.2': + optional: true + + '@oxc-parser/binding-linux-arm64-gnu@0.72.2': + optional: true + + '@oxc-parser/binding-linux-arm64-musl@0.72.2': + optional: true + + '@oxc-parser/binding-linux-riscv64-gnu@0.72.2': + optional: true + + '@oxc-parser/binding-linux-s390x-gnu@0.72.2': + optional: true + + '@oxc-parser/binding-linux-x64-gnu@0.72.2': + optional: true + + '@oxc-parser/binding-linux-x64-musl@0.72.2': + optional: true + + '@oxc-parser/binding-wasm32-wasi@0.72.2': + dependencies: + '@napi-rs/wasm-runtime': 0.2.10 + optional: true + + '@oxc-parser/binding-win32-arm64-msvc@0.72.2': + optional: true + + '@oxc-parser/binding-win32-x64-msvc@0.72.2': + optional: true + + '@oxc-project/types@0.72.2': {} + '@oxc-resolver/binding-darwin-arm64@9.0.2': optional: true @@ -3951,6 +4105,12 @@ snapshots: - supports-color - typescript + '@teages/oxc-blank-space@0.1.0(typescript@5.8.3)': + dependencies: + magic-string: 0.30.17 + oxc-parser: 0.72.2 + typescript: 5.8.3 + '@trysound/sax@0.2.0': {} '@tybys/wasm-util@0.9.0': @@ -4204,7 +4364,7 @@ snapshots: '@vue/compiler-core@3.5.15': dependencies: - '@babel/parser': 7.27.2 + '@babel/parser': 7.27.4 '@vue/shared': 3.5.15 entities: 4.5.0 estree-walker: 2.0.2 @@ -4222,7 +4382,7 @@ snapshots: '@vue/compiler-sfc@3.5.15': dependencies: - '@babel/parser': 7.27.2 + '@babel/parser': 7.27.4 '@vue/compiler-core': 3.5.15 '@vue/compiler-dom': 3.5.15 '@vue/compiler-ssr': 3.5.15 @@ -4234,7 +4394,7 @@ snapshots: '@vue/compiler-sfc@3.5.16': dependencies: - '@babel/parser': 7.27.2 + '@babel/parser': 7.27.4 '@vue/compiler-core': 3.5.15 '@vue/compiler-dom': 3.5.16 '@vue/compiler-ssr': 3.5.16 @@ -5503,7 +5663,7 @@ snapshots: magicast@0.3.5: dependencies: - '@babel/parser': 7.27.2 + '@babel/parser': 7.27.4 '@babel/types': 7.27.1 source-map-js: 1.2.1 @@ -5990,6 +6150,25 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + oxc-parser@0.72.2: + dependencies: + '@oxc-project/types': 0.72.2 + optionalDependencies: + '@oxc-parser/binding-darwin-arm64': 0.72.2 + '@oxc-parser/binding-darwin-x64': 0.72.2 + '@oxc-parser/binding-freebsd-x64': 0.72.2 + '@oxc-parser/binding-linux-arm-gnueabihf': 0.72.2 + '@oxc-parser/binding-linux-arm-musleabihf': 0.72.2 + '@oxc-parser/binding-linux-arm64-gnu': 0.72.2 + '@oxc-parser/binding-linux-arm64-musl': 0.72.2 + '@oxc-parser/binding-linux-riscv64-gnu': 0.72.2 + '@oxc-parser/binding-linux-s390x-gnu': 0.72.2 + '@oxc-parser/binding-linux-x64-gnu': 0.72.2 + '@oxc-parser/binding-linux-x64-musl': 0.72.2 + '@oxc-parser/binding-wasm32-wasi': 0.72.2 + '@oxc-parser/binding-win32-arm64-msvc': 0.72.2 + '@oxc-parser/binding-win32-x64-msvc': 0.72.2 + oxc-resolver@9.0.2: optionalDependencies: '@oxc-resolver/binding-darwin-arm64': 9.0.2 @@ -6812,7 +6991,7 @@ snapshots: vue-sfc-transformer@0.1.16(@vue/compiler-core@3.5.15)(esbuild@0.25.4)(vue@3.5.16(typescript@5.8.3)): dependencies: - '@babel/parser': 7.27.2 + '@babel/parser': 7.27.4 '@vue/compiler-core': 3.5.15 esbuild: 0.25.4 vue: 3.5.16(typescript@5.8.3) diff --git a/src/utils/mkdist.ts b/src/utils/mkdist.ts index 4b5b5f2..ac92c58 100644 --- a/src/utils/mkdist.ts +++ b/src/utils/mkdist.ts @@ -1,7 +1,7 @@ import type { SFCBlock, SFCTemplateBlock } from 'vue/compiler-sfc' import type { InputFile, Loader, LoaderContext, LoaderResult, OutputFile } from '../types/mkdist' import process from 'node:process' -import { transpile } from 'oxidase' +import { transpile } from '@teages/oxc-blank-space' import { preTranspileScriptSetup, transpileVueTemplate } from '../index' interface DefineVueLoaderOptions { diff --git a/src/utils/template.ts b/src/utils/template.ts index 83fc51d..f169214 100644 --- a/src/utils/template.ts +++ b/src/utils/template.ts @@ -1,6 +1,6 @@ import type { AttributeNode, DirectiveNode, ExpressionNode, ParentNode, RootNode, SourceLocation, TemplateChildNode, TextNode } from '@vue/compiler-dom' +import { transpile } from '@teages/oxc-blank-space' import { isFnExpressionBrowser as isFnExpression, isMemberExpressionBrowser as isMemberExpression } from '@vue/compiler-core' -import { transpile } from 'oxidase' // copy from `@vue/compiler-dom` enum NodeTypes { From fed28faa08ac01a6b28cc5d4ed3f4b7682bbda1c Mon Sep 17 00:00:00 2001 From: Teages Date: Tue, 3 Jun 2025 00:20:09 +0800 Subject: [PATCH 09/10] chore: remove not maintained package `oxidase` --- package.json | 3 +-- pnpm-lock.yaml | 9 --------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/package.json b/package.json index d312511..aba5c13 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,7 @@ }, "dependencies": { "@babel/parser": "^7.27.0", - "@teages/oxc-blank-space": "^0.1.0", - "oxidase": "^0.0.3" + "@teages/oxc-blank-space": "^0.1.0" }, "devDependencies": { "@antfu/eslint-config": "4.13.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f90b620..d7a8c1d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,9 +18,6 @@ importers: '@teages/oxc-blank-space': specifier: ^0.1.0 version: 0.1.0(typescript@5.8.3) - oxidase: - specifier: ^0.0.3 - version: 0.0.3 devDependencies: '@antfu/eslint-config': specifier: 4.13.2 @@ -2733,10 +2730,6 @@ packages: oxc-resolver@9.0.2: resolution: {integrity: sha512-w838ygc1p7rF+7+h5vR9A+Y9Fc4imy6C3xPthCMkdFUgFvUWkmABeNB8RBDQ6+afk44Q60/UMMQ+gfDUW99fBA==} - oxidase@0.0.3: - resolution: {integrity: sha512-b34YuOWiiFRSj06jYmJHVAqR1cqnG+W4fR4D8lvCFVIFm7Ysrf0E6ZLbfe9nJselZT/qjem0YlKRWtw2EBaIZQ==} - engines: {node: '>=18.20'} - p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -6437,8 +6430,6 @@ snapshots: '@oxc-resolver/binding-win32-arm64-msvc': 9.0.2 '@oxc-resolver/binding-win32-x64-msvc': 9.0.2 - oxidase@0.0.3: {} - p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 From b755af470b2dd25418f571caeffc4a4c6b38a7a4 Mon Sep 17 00:00:00 2001 From: Teages Date: Tue, 3 Jun 2025 00:49:40 +0800 Subject: [PATCH 10/10] chore(deps): update `@teages/oxc-blank-space` to v0.1.1 --- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index aba5c13..f37b789 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ }, "dependencies": { "@babel/parser": "^7.27.0", - "@teages/oxc-blank-space": "^0.1.0" + "@teages/oxc-blank-space": "^0.1.1" }, "devDependencies": { "@antfu/eslint-config": "4.13.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7a8c1d..3bcd2ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ importers: specifier: ^7.27.0 version: 7.27.4 '@teages/oxc-blank-space': - specifier: ^0.1.0 - version: 0.1.0(typescript@5.8.3) + specifier: ^0.1.1 + version: 0.1.1(typescript@5.8.3) devDependencies: '@antfu/eslint-config': specifier: 4.13.2 @@ -1034,9 +1034,9 @@ packages: peerDependencies: eslint: '>=9.0.0' - '@teages/oxc-blank-space@0.1.0': - resolution: {integrity: sha512-jxvGT3GZcP1xjy/QtRAX5t9mU5H3NMLdvgnUOeaBDRVag5FeKw2F0PCgIdoj1LdeUV2Sf/Dg7R/x98vUytM6Zg==} - engines: {node: ^20.17.0 || >=22.0.0} + '@teages/oxc-blank-space@0.1.1': + resolution: {integrity: sha512-eLNpk2AF+94Zbt/gqgXX+/FI6vtwi/UWyLtA1iTMm0KMaRjgJlIgPwIfeCN8tMVTBywB4vYDzcMjJX0r5/A/yg==} + engines: {node: '>=18.0.0'} peerDependencies: typescript: ^5.8.3 @@ -4326,7 +4326,7 @@ snapshots: - supports-color - typescript - '@teages/oxc-blank-space@0.1.0(typescript@5.8.3)': + '@teages/oxc-blank-space@0.1.1(typescript@5.8.3)': dependencies: magic-string: 0.30.17 oxc-parser: 0.72.2