Skip to content

Commit 7d42b06

Browse files
lishaduckota-meshi
andauthored
Migrate to tsdown to fix dts output (#146)
* fix!: dts output * fix: don't drop node 16 Don't mark `package.json` as external. * fix: mark @typescript-eslint/utils as direct dependency For us `hoist: false`ers. * fix: stuff * refactor: drop tseslint/utils dep Co-authored-by: Yosuke Ota <[email protected]> * Create eight-suits-provide.md * chore: bump tsdown --------- Co-authored-by: Yosuke Ota <[email protected]>
1 parent 45b7075 commit 7d42b06

9 files changed

+50
-24
lines changed

.changeset/eight-suits-provide.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"typescript-eslint-parser-for-extra-files": minor
3+
---
4+
5+
Migrate to tsdown to fix dts output
File renamed without changes.

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = {
1+
export default {
22
plugins: ['prettier-plugin-svelte', 'prettier-plugin-astro']
33
}

package.json

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"name": "typescript-eslint-parser-for-extra-files",
33
"version": "0.8.0",
4+
"type": "module",
45
"description": "An experimental ESLint custom parser for Vue, Svelte, and Astro for use with TypeScript. It provides type information in combination with each framework's ESLint custom parser.",
5-
"repository": "git+https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files.git",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files.git"
9+
},
610
"homepage": "https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files#readme",
711
"author": "Yosuke Ota (https://github.com/ota-meshi)",
812
"funding": "https://github.com/sponsors/ota-meshi",
@@ -11,17 +15,23 @@
1115
"engines": {
1216
"node": ">=16.0.0"
1317
},
14-
"main": "lib/index.js",
15-
"module": "./lib/index.mjs",
18+
"main": "./lib/index.cjs",
19+
"module": "./lib/index.js",
20+
"types": "./lib/index.d.ts",
1621
"exports": {
1722
".": {
18-
"import": "./lib/index.mjs",
19-
"require": "./lib/index.js"
23+
"module-sync": {
24+
"types": "./lib/index.d.ts",
25+
"default": "./lib/index.js"
26+
},
27+
"default": {
28+
"types": "./lib/index.d.cts",
29+
"default": "./lib/index.cjs"
30+
}
2031
}
2132
},
22-
"types": "./lib/index.d.ts",
2333
"files": [
24-
"lib"
34+
"lib/"
2535
],
2636
"keywords": [
2737
"eslint",
@@ -32,7 +42,7 @@
3242
"typescript"
3343
],
3444
"scripts": {
35-
"build": "tsup",
45+
"build": "tsdown",
3646
"clean": "rimraf .nyc_output lib coverage",
3747
"cover": "nyc --reporter=lcov yarn test",
3848
"debug": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
@@ -107,12 +117,14 @@
107117
"prettier-plugin-astro": "^0.14.0",
108118
"prettier-plugin-pkg": "^0.19.0",
109119
"prettier-plugin-svelte": "^3.0",
120+
"publint": "^0.3.12",
110121
"semver": "^7.3.5",
111122
"svelte": "^4.0.0",
112123
"svelte-eslint-parser": "^1.0.0",
113124
"svelte2tsx": "^0.7.0",
114-
"tsup": "^8.0.0",
125+
"tsdown": "^0.10.1",
115126
"typescript": "~5.8.0",
127+
"unplugin-unused": "^0.4.4",
116128
"vue": "^3.2.41",
117129
"vue-eslint-parser": "^10.0.0"
118130
},

src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { TSServiceManager } from "./ts";
44
import * as tsEslintParser from "@typescript-eslint/parser";
55
import { getProjectConfigFiles } from "./utils/get-project-config-files";
66
import { resolveProjectList } from "./utils/resolve-project-list";
7-
export * as meta from "./meta";
8-
export { name } from "./meta";
7+
export { default as meta, name } from "./meta";
98

109
const DEFAULT_EXTRA_FILE_EXTENSIONS = [".vue", ".svelte", ".astro"];
1110
const tsServiceManager = new TSServiceManager();

src/meta.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { name, version } from "../package.json";
1+
import { name as pkgName, version } from "../package.json";
2+
3+
const meta: { name: string; version: string } = { name: pkgName, version };
4+
export default meta;
5+
6+
export const name: string = pkgName;

tsconfig.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
"target": "es2015",
44
"strict": true,
55
"lib": ["es2020", "DOM"],
6-
"module": "Node16",
7-
"moduleResolution": "Node16",
6+
"module": "Preserve",
7+
"moduleResolution": "Bundler",
88
"declaration": true,
9+
"isolatedDeclarations": true,
10+
"isolatedModules": true,
11+
"verbatimModuleSyntax": true,
912
"noImplicitAny": true,
1013
"noImplicitReturns": true,
1114
"noFallthroughCasesInSwitch": true,

tsdown.config.mts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from "tsdown";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
format: ["cjs", "esm"],
6+
target: ["node16"],
7+
outDir: "lib",
8+
skipNodeModulesBundle: true,
9+
publint: { strict: true, pack: "npm" },
10+
unused: true,
11+
});

tsup.config.ts

-9
This file was deleted.

0 commit comments

Comments
 (0)