diff --git a/jsr.json b/jsr.json index e9eb7e4c..2895228a 100644 --- a/jsr.json +++ b/jsr.json @@ -4,10 +4,7 @@ "exports": "./dist/esm/index.js", "publish": { "include": [ - "dist/esm/index.js", - "dist/esm/index.d.ts", - "dist/esm/types.ts", - "dist/esm/types.d.ts", + "dist", "README.md", "jsr.json", "LICENSE" diff --git a/package.json b/package.json index 404dba67..2f55034c 100644 --- a/package.json +++ b/package.json @@ -63,10 +63,9 @@ "lint:fix": "eslint --fix . && eslint --fix -c eslint.config-content.js .", "fmt": "prettier --write .", "fmt:check": "prettier --check .", - "build:dedupe-types": "node tools/dedupe-types.js dist/esm/index.js", "build:rules": "node tools/build-rules.js", "build:update-rules-docs": "node tools/update-rules-docs.js", - "build": "npm run build:rules && rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:update-rules-docs", + "build": "npm run build:rules && tsc && npm run build:update-rules-docs", "build:readme": "node tools/update-readme.js", "prepare": "npm run build", "test": "c8 mocha \"tests/**/*.test.js\" --timeout 30000", @@ -85,9 +84,6 @@ "lint-staged": "^15.2.9", "mocha": "^11.6.0", "prettier": "^3.3.3", - "rollup": "^4.19.0", - "rollup-plugin-copy": "^3.5.0", - "rollup-plugin-delete": "^3.0.1", "typescript": "^5.8.3", "yorkie": "^2.0.0" }, diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index 74e1742a..00000000 --- a/rollup.config.js +++ /dev/null @@ -1,19 +0,0 @@ -import copy from "rollup-plugin-copy"; -import del from "rollup-plugin-delete"; - -export default { - input: "src/index.js", - output: [ - { - file: "dist/esm/index.js", - format: "esm", - banner: '// @ts-self-types="./index.d.ts"', - }, - ], - plugins: [ - del({ targets: "dist/*" }), - copy({ - targets: [{ src: "src/types.ts", dest: "dist/esm" }], - }), - ], -}; diff --git a/tests/types/types.test.ts b/tests/types/types.test.ts index 3d2de338..c94cb03a 100644 --- a/tests/types/types.test.ts +++ b/tests/types/types.test.ts @@ -1,13 +1,11 @@ import markdown, { MarkdownSourceCode, - MarkdownNode, MarkdownRuleDefinition, MarkdownRuleVisitor, - SourceLocation, - SourceRange, type RuleModule, } from "@eslint/markdown"; -import { Toml, Json } from "@eslint/markdown/types"; +import type { SourceLocation, SourceRange } from "@eslint/core"; +import type { Toml, Json } from "@eslint/markdown/types"; import { ESLint, Linter } from "eslint"; import type { // Nodes (abstract) @@ -168,8 +166,8 @@ typeof processorPlugins satisfies {}; "json:exit": (...args) => testVisitor(...args), // Unknown selectors allowed - "heading[depth=1]"(node: MarkdownNode, parent?: ParentNode) {}, - "randomSelector:exit"(node: MarkdownNode, parent?: ParentNode) {}, + "heading[depth=1]"(node: Node, parent?: ParentNode) {}, + "randomSelector:exit"(node: Node, parent?: ParentNode) {}, }; }, }); diff --git a/tools/dedupe-types.js b/tools/dedupe-types.js deleted file mode 100644 index b4a4adab..00000000 --- a/tools/dedupe-types.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @fileoverview Strips typedef aliases from the rolled-up file. This - * is necessary because the TypeScript compiler throws an error when - * it encounters a duplicate typedef. - * - * Usage: - * node scripts/strip-typedefs.js filename1.js filename2.js ... - * - * @author Nicholas C. Zakas - */ - -//----------------------------------------------------------------------------- -// Imports -//----------------------------------------------------------------------------- - -import fs from "node:fs"; - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- - -// read files from the command line -const files = process.argv.slice(2); - -files.forEach(filePath => { - const lines = fs.readFileSync(filePath, "utf8").split(/\r?\n/gu); - const typedefs = new Set(); - - const remainingLines = lines.filter(line => { - if (!line.startsWith("/** @typedef {import")) { - return true; - } - - if (typedefs.has(line)) { - return false; - } - - typedefs.add(line); - return true; - }); - - // replace references to ../types.ts with ./types.ts - const text = remainingLines - .join("\n") - .replace(/\.\.\/types\.ts/gu, "./types.ts"); - - fs.writeFileSync(filePath, text, "utf8"); -}); diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index 40ece132..00000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "files": ["dist/esm/index.js"] -} diff --git a/tsconfig.json b/tsconfig.json index 04a726cc..74036659 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,6 @@ "files": ["src/index.js"], "compilerOptions": { "declaration": true, - "emitDeclarationOnly": true, - "allowImportingTsExtensions": true, "allowJs": true, "checkJs": true, "outDir": "dist/esm",