From 9f2146bc46a4adb70d2c1dfeed6c88cc467454ff Mon Sep 17 00:00:00 2001 From: SandroMaglione Date: Wed, 26 Aug 2026 16:15:11 +0200 Subject: [PATCH] Fix published Oxlint plugin entrypoints --- .changeset/smooth-melons-load.md | 7 ++++++ packages/oxlint-plugin/package.json | 22 ++++------------- scripts/oxlint-plugin-pack-check.mjs | 36 +++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 .changeset/smooth-melons-load.md diff --git a/.changeset/smooth-melons-load.md b/.changeset/smooth-melons-load.md new file mode 100644 index 0000000..aa98675 --- /dev/null +++ b/.changeset/smooth-melons-load.md @@ -0,0 +1,7 @@ +--- +"@typeonce/oxlint-plugin-effect-machine": patch +--- + +Fix the published plugin entrypoints so Oxlint loads built JavaScript instead of TypeScript source under `node_modules`. + +Upgrade from `0.26.0` without changing the Oxlint configuration. Both the package root and the recommended configuration now resolve to built files. diff --git a/packages/oxlint-plugin/package.json b/packages/oxlint-plugin/package.json index bca8758..51bd853 100644 --- a/packages/oxlint-plugin/package.json +++ b/packages/oxlint-plugin/package.json @@ -27,31 +27,19 @@ ], "exports": { ".": { - "types": "./src/index.ts", - "import": "./src/index.ts" + "types": "./dist/index.d.ts", + "import": "./dist/index.js" }, "./recommended": { - "types": "./src/recommended.ts", - "import": "./src/recommended.ts" + "types": "./dist/recommended.d.ts", + "import": "./dist/recommended.js" }, "./package.json": "./package.json", "./internal/*": null }, "publishConfig": { "access": "public", - "provenance": true, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" - }, - "./recommended": { - "types": "./dist/recommended.d.ts", - "import": "./dist/recommended.js" - }, - "./package.json": "./package.json", - "./internal/*": null - } + "provenance": true }, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/scripts/oxlint-plugin-pack-check.mjs b/scripts/oxlint-plugin-pack-check.mjs index f5f8ed6..f553f73 100644 --- a/scripts/oxlint-plugin-pack-check.mjs +++ b/scripts/oxlint-plugin-pack-check.mjs @@ -25,11 +25,19 @@ const run = (command, args, options = {}) => { } try { - const packed = run("pnpm", ["pack", "--pack-destination", destination], { + const packed = run("npm", [ + "pack", + "--cache", + join(destination, "npm-cache"), + "--pack-destination", + destination, + "--json" + ], { cwd: packageRoot }) - const archive = packed.stdout.trim().split("\n").at(-1) - if (archive === undefined) throw new Error("pnpm pack did not return an archive path") + const filename = JSON.parse(packed.stdout).at(0)?.filename + if (filename === undefined) throw new Error("npm pack did not return an archive filename") + const archive = join(destination, filename) const listing = run("tar", ["-tzf", archive]).stdout.trim().split("\n") const required = [ @@ -63,6 +71,28 @@ try { }, null, 2) ) run("pnpm", ["install", "--prefer-offline", "--ignore-scripts"], { cwd: consumer }) + const installedManifest = JSON.parse( + await readFile( + join( + consumer, + "node_modules", + "@typeonce", + "oxlint-plugin-effect-machine", + "package.json" + ), + "utf8" + ) + ) + const rootExport = installedManifest.exports?.["."] + const recommendedExport = installedManifest.exports?.["./recommended"] + if ( + rootExport?.types !== "./dist/index.d.ts" || + rootExport?.import !== "./dist/index.js" || + recommendedExport?.types !== "./dist/recommended.d.ts" || + recommendedExport?.import !== "./dist/recommended.js" + ) { + throw new Error("packed plugin entrypoints do not resolve to built files") + } await writeFile( join(consumer, ".oxlintrc.json"), JSON.stringify({