Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/smooth-melons-load.md
Original file line number Diff line number Diff line change
@@ -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.
22 changes: 5 additions & 17 deletions packages/oxlint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 33 additions & 3 deletions scripts/oxlint-plugin-pack-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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({
Expand Down