From e2584dafeff885ca9c5312810ad353000792b7da Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 24 Jun 2025 16:52:19 +0800 Subject: [PATCH 01/11] feat: migrate to `tsdown` --- .gitignore | 1 + package.json | 12 ++++-------- rollup.config.js | 35 ----------------------------------- tsconfig.json | 6 ++---- tsdown.config.ts | 19 +++++++++++++++++++ 5 files changed, 26 insertions(+), 47 deletions(-) delete mode 100644 rollup.config.js create mode 100644 tsdown.config.ts diff --git a/.gitignore b/.gitignore index 8bf60fc5..c0ea8b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ node_modules /test.js /test/fixtures/espree-v8/node_modules /test/fixtures/integrations/**/_actual.json +/dist \ No newline at end of file diff --git a/package.json b/package.json index 211d5c85..a868409a 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "name": "vue-eslint-parser", "version": "10.1.4", "description": "The ESLint custom parser for `.vue` files.", - "main": "index.js", + "main": "dist/index.js", "files": [ - "index.*" + "dist" ], "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -39,7 +39,6 @@ "@typescript-eslint/parser": "^8.22.0", "chokidar": "^3.5.2", "cross-spawn": "^7.0.3", - "dts-bundle": "^0.7.3", "eslint": "^9.19.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-jsonc": "^2.19.1", @@ -55,18 +54,15 @@ "opener": "^1.5.2", "prettier": "^3.4.2", "rimraf": "^3.0.2", - "rollup": "^2.60.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-sourcemaps": "^0.6.3", "ts-node": "^10.9.2", + "tsdown": "^0.12.8", "typescript": "~5.7.3", "wait-on": "^6.0.0", "warun": "^1.0.0" }, "scripts": { "prebuild": "npm run -s clean", - "build": "tsc --module es2015 && rollup -c -o index.js && dts-bundle --name vue-eslint-parser --main .temp/index.d.ts --out ../index.d.ts", + "build": "tsdown", "clean": "rimraf .nyc_output .temp coverage index.*", "coverage": "opener ./coverage/lcov-report/index.html", "lint": "eslint src test package.json", diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index fef6483f..00000000 --- a/rollup.config.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @author Toru Nagashima - * @copyright 2017 Toru Nagashima. All rights reserved. - * See LICENSE file in root directory for full license. - */ -import resolve from "rollup-plugin-node-resolve" -import sourcemaps from "rollup-plugin-sourcemaps" -import replace from "rollup-plugin-replace" - -const pkg = require("./package.json") -const deps = new Set( - ["assert", "events", "path"].concat(Object.keys(pkg.dependencies)) -) - -export default { - input: ".temp/index.js", - output: { - file: "index.js", - format: "cjs", - sourcemap: true, - sourcemapFile: "index.js.map", - banner: `/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */`, - }, - plugins: [ - sourcemaps(), - resolve(), - replace({ - "process.env.PACKAGE_VERSION": `"${pkg.version}"`, - }), - ], - external: id => deps.has(id) || id.startsWith("lodash"), -} diff --git a/tsconfig.json b/tsconfig.json index e4cbfcc2..4c7f2784 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,4 @@ { - "compileOnSave": true, "compilerOptions": { "allowJs": false, "allowSyntheticDefaultImports": true, @@ -8,7 +7,6 @@ "alwaysStrict": true, "baseUrl": ".", "checkJs": false, - "declaration": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "inlineSources": true, @@ -23,11 +21,11 @@ "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, - "outDir": ".temp", "paths": { "*": ["typings/*"] }, "pretty": true, + "resolveJsonModule": true, "removeComments": true, "sourceMap": true, "sourceRoot": "src", @@ -37,5 +35,5 @@ "skipLibCheck": true }, - "include": ["src/**/*.ts"] + "include": ["src/**/*.ts", "tsdown.config.ts"] } diff --git a/tsdown.config.ts b/tsdown.config.ts new file mode 100644 index 00000000..5ff30aca --- /dev/null +++ b/tsdown.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from "tsdown" +import pkg from "./package.json" + +export default defineConfig({ + entry: "./src/index.ts", + target: "es2015", + sourcemap: true, + env: { + PACKAGE_VERSION: pkg.version, + }, + outputOptions: { + banner: `/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */`, + }, + dts: true, + format: "cjs", +}) From a8a528373e51dac0ffc5c2f1aa8dea1468158ec8 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 24 Jun 2025 17:08:53 +0800 Subject: [PATCH 02/11] chore: update --- .gitignore | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c0ea8b8d..2d1f6b5c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ node_modules /test.js /test/fixtures/espree-v8/node_modules /test/fixtures/integrations/**/_actual.json -/dist \ No newline at end of file +/dist diff --git a/package.json b/package.json index a868409a..2e118fd2 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "scripts": { "prebuild": "npm run -s clean", "build": "tsdown", - "clean": "rimraf .nyc_output .temp coverage index.*", + "clean": "rimraf .nyc_output .temp coverage", "coverage": "opener ./coverage/lcov-report/index.html", "lint": "eslint src test package.json", "pretest": "run-s build lint", From 97e5caa1d4a0e19af7dab84d4ec408d1fca4ae46 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 24 Jun 2025 17:15:20 +0800 Subject: [PATCH 03/11] chore: get `name` and `version` from `package.json` directly --- src/index.ts | 6 +++--- tsdown.config.ts | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 13cb5300..216e4599 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,6 +25,7 @@ import { import { parseStyleElements } from "./style/index" import { analyzeScope } from "./script/scope-analyzer" import { analyzeScriptSetupScope } from "./script-setup/scope-analyzer" +import { name, version } from "../package.json" const STARTS_WITH_LT = /^\s* From 919b8c3468585d47cffec049324a1313c91e0234 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 24 Jun 2025 17:29:54 +0800 Subject: [PATCH 04/11] chore: update --- .gitignore | 1 - README.md | 2 +- eslint.config.mjs | 4 +--- package.json | 10 ++++------ test/fixtures/.eslintrc.json | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 2d1f6b5c..79bf6cf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /.nyc_output -/.temp /coverage node_modules /test/temp diff --git a/README.md b/README.md index 57e0668f..0caf445f 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ The `npm install` command installs dependencies. ### Development Tools - `npm test` runs tests and measures coverage. -- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`. +- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts` in `dist`. - `npm run coverage` shows the coverage result of `npm test` command with the default browser. - `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`. - `npm run lint` runs ESLint. diff --git a/eslint.config.mjs b/eslint.config.mjs index 5e81622f..b740115d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -23,8 +23,8 @@ export default [ { ignores: [ ".nyc_output", - ".temp", "coverage", + "dist", "**/node_modules", "src/html/util/alternative-cr.ts", "src/html/util/attribute-names.ts", @@ -32,8 +32,6 @@ export default [ "src/html/util/tag-names.ts", "test/fixtures", "test/temp", - "index.d.ts", - "index.js", ], }, ...nodeDeps.configs["flat/recommended"], diff --git a/package.json b/package.json index 2e118fd2..42a0c922 100644 --- a/package.json +++ b/package.json @@ -61,9 +61,8 @@ "warun": "^1.0.0" }, "scripts": { - "prebuild": "npm run -s clean", "build": "tsdown", - "clean": "rimraf .nyc_output .temp coverage", + "clean": "rimraf .nyc_output coverage", "coverage": "opener ./coverage/lcov-report/index.html", "lint": "eslint src test package.json", "pretest": "run-s build lint", @@ -77,10 +76,9 @@ "postversion": "git push && git push --tags", "prewatch": "npm run -s clean", "watch": "run-p watch:*", - "watch:tsc": "tsc --module es2015 --watch", - "watch:rollup": "wait-on .temp/index.js && rollup -c -o index.js --watch", - "watch:test": "wait-on index.js && warun index.js \"test/*.js\" \"test/fixtures/ast/*/*.json\" \"test/fixtures/*\" --debounce 1000 --no-initial -- nyc mocha \"test/*.js\" --reporter dot --timeout 10000", - "watch:update-ast": "wait-on index.js && warun index.js \"test/fixtures/ast/*/*.vue\" -- node scripts/update-fixtures-ast.js", + "watch:tsdown": "tsdown --watch", + "watch:test": "wait-on dist/index.js && warun dist/index.js \"test/*.js\" \"test/fixtures/ast/*/*.json\" \"test/fixtures/*\" --debounce 1000 --no-initial -- nyc mocha \"test/*.js\" --reporter dot --timeout 10000", + "watch:update-ast": "wait-on dist/index.js && warun dist/index.js \"test/fixtures/ast/*/*.vue\" -- node scripts/update-fixtures-ast.js", "watch:coverage-report": "wait-on coverage/lcov-report/index.html && opener coverage/lcov-report/index.html" }, "repository": { diff --git a/test/fixtures/.eslintrc.json b/test/fixtures/.eslintrc.json index 8dd6ae07..becf1353 100644 --- a/test/fixtures/.eslintrc.json +++ b/test/fixtures/.eslintrc.json @@ -1,3 +1,3 @@ { - "parser": "../../index.js" + "parser": "../../dist/index.js" } From 35d010a75b33e1a3c30ad607866b683797f6a51a Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 24 Jun 2025 17:39:07 +0800 Subject: [PATCH 05/11] chore: update --- .gitignore | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 79bf6cf7..140dd68b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /coverage node_modules /test/temp -/index.* /npm-debug.log /test.js /test/fixtures/espree-v8/node_modules diff --git a/package.json b/package.json index 42a0c922..4dd7de76 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "watch": "run-p watch:*", "watch:tsdown": "tsdown --watch", "watch:test": "wait-on dist/index.js && warun dist/index.js \"test/*.js\" \"test/fixtures/ast/*/*.json\" \"test/fixtures/*\" --debounce 1000 --no-initial -- nyc mocha \"test/*.js\" --reporter dot --timeout 10000", - "watch:update-ast": "wait-on dist/index.js && warun dist/index.js \"test/fixtures/ast/*/*.vue\" -- node scripts/update-fixtures-ast.js", + "watch:update-ast": "wait-on dist/index.js && warun dist/index.js \"test/fixtures/ast/*/*.vue\" -- ts-node scripts/update-fixtures-ast.js", "watch:coverage-report": "wait-on coverage/lcov-report/index.html && opener coverage/lcov-report/index.html" }, "repository": { From 13b85102cf3ee489ab8561198972da76d80f4d93 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Wed, 25 Jun 2025 17:42:27 +0800 Subject: [PATCH 06/11] build: remove `sourceMap` in `tsconfig` --- package.json | 2 +- tsconfig.json | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 4dd7de76..b5a280ef 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "prettier": "^3.4.2", "rimraf": "^3.0.2", "ts-node": "^10.9.2", - "tsdown": "^0.12.8", + "tsdown": "^0.12.9", "typescript": "~5.7.3", "wait-on": "^6.0.0", "warun": "^1.0.0" diff --git a/tsconfig.json b/tsconfig.json index 4c7f2784..2f9db9a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,6 @@ "checkJs": false, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "inlineSources": true, "lib": ["es2015"], "module": "commonjs", "moduleResolution": "node", @@ -27,8 +26,6 @@ "pretty": true, "resolveJsonModule": true, "removeComments": true, - "sourceMap": true, - "sourceRoot": "src", "strict": true, "strictNullChecks": true, "target": "ES2024", From 1ec01140e707a79d86b82cb0266e80de352f9338 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Fri, 4 Jul 2025 22:27:55 +0800 Subject: [PATCH 07/11] chore: update --- tsdown.config.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tsdown.config.ts b/tsdown.config.ts index c6158f33..ff829d7a 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -1,14 +1,16 @@ import { defineConfig } from "tsdown" +const banner = `/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */` + export default defineConfig({ entry: "./src/index.ts", target: "es2015", sourcemap: true, outputOptions: { - banner: `/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */`, + banner, }, dts: true, format: "cjs", From 106f6cba9e6e44a129d13085536fa27191c1a0cf Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Fri, 4 Jul 2025 22:28:06 +0800 Subject: [PATCH 08/11] chore: update tsconfig --- src/index.ts | 2 +- tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 216e4599..1f278baf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,7 +25,7 @@ import { import { parseStyleElements } from "./style/index" import { analyzeScope } from "./script/scope-analyzer" import { analyzeScriptSetupScope } from "./script-setup/scope-analyzer" -import { name, version } from "../package.json" +import { name, version } from "../package.json" with { type: "json" } const STARTS_WITH_LT = /^\s* Date: Fri, 4 Jul 2025 22:29:45 +0800 Subject: [PATCH 09/11] chore: cleanup some configs relate to output --- tsconfig.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 6e44f313..73550ba5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,9 +23,7 @@ "paths": { "*": ["typings/*"] }, - "pretty": true, "resolveJsonModule": true, - "removeComments": true, "strict": true, "strictNullChecks": true, "target": "ES2024", From 686fb6a0d9da32e02253384b80023bf0c668be13 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Tue, 8 Jul 2025 15:39:49 +0800 Subject: [PATCH 10/11] chore: update and fix test --- package.json | 1 - test/integrations.test.ts | 9 ++++++++- tsconfig.json | 5 ++--- tsconfig.test.json | 12 ------------ tsdown.config.ts | 6 ++++-- 5 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 tsconfig.test.json diff --git a/package.json b/package.json index 5fff8304..8e9db395 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "jsonc-eslint-parser": "^2.0.3", "npm-run-all": "^4.1.5", "prettier": "^3.4.2", - "rimraf": "^3.0.2", "ts-node": "^10.9.2", "tsdown": "^0.12.9", "typescript": "~5.7.3", diff --git a/test/integrations.test.ts b/test/integrations.test.ts index 651e6616..cdbe92f0 100644 --- a/test/integrations.test.ts +++ b/test/integrations.test.ts @@ -22,7 +22,14 @@ const FIXTURE_DIR = path.join(__dirname, "fixtures/integrations") describe("Integration tests", () => { beforeAll(async () => { - await import("ts-node/register") + const { register } = await import("ts-node") + register({ + transpileOnly: true, + compilerOptions: { + module: "commonjs", + moduleResolution: "node", + }, + }) }) for (const target of fs.readdirSync(FIXTURE_DIR)) { it(target, async () => { diff --git a/tsconfig.json b/tsconfig.json index 082b1520..70087f3e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "module": "preserve", "moduleResolution": "bundler", "newLine": "LF", - "noEmitOnError": true, + "noEmit": true, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, @@ -30,6 +30,5 @@ "skipLibCheck": true }, - "include": ["src/**/*.ts", "tsdown.config.ts"], - "references": [{ "path": "./tsconfig.test.json" }] + "include": ["**/*.ts"] } diff --git a/tsconfig.test.json b/tsconfig.test.json deleted file mode 100644 index a5e080f7..00000000 --- a/tsconfig.test.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "composite": true, - "paths": { - "*": ["typings/*"] - }, - "module": "esnext", - "moduleResolution": "Bundler" - }, - "include": ["test/**/*.ts", "vitest.config.ts"] -} diff --git a/tsdown.config.ts b/tsdown.config.ts index ff829d7a..8983a22e 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -1,9 +1,11 @@ import { defineConfig } from "tsdown" -const banner = `/** +const banner = ` +/** * @author Toru Nagashima * See LICENSE file in root directory for full license. - */` + */ +`.trim() export default defineConfig({ entry: "./src/index.ts", From fe0ad354c472537fa95ccd54ff44576a35417df4 Mon Sep 17 00:00:00 2001 From: Vida Xie Date: Mon, 14 Jul 2025 21:08:29 +0800 Subject: [PATCH 11/11] chore: remove invalid script --- README.md | 1 - package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 0caf445f..57a71a6b 100644 --- a/README.md +++ b/README.md @@ -326,7 +326,6 @@ The `npm install` command installs dependencies. - `npm test` runs tests and measures coverage. - `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts` in `dist`. - `npm run coverage` shows the coverage result of `npm test` command with the default browser. -- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`. - `npm run lint` runs ESLint. - `npm run update-fixtures` updates files in `test/fixtures/ast` directory based on `test/fixtures/ast/*/source.vue` files. - `npm run watch` runs `build`, `update-fixtures`, and tests with `--watch` option. diff --git a/package.json b/package.json index 8e9db395..65beba64 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "preversion": "npm test", "version": "npm run -s build", "postversion": "git push && git push --tags", - "prewatch": "npm run -s clean", "watch": "run-p watch:*", "watch:tsdown": "tsdown --watch", "watch:update-ast": "wait-on dist/index.js && warun dist/index.js \"test/fixtures/ast/*/*.vue\" -- ts-node scripts/update-fixtures-ast.js" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy