JSR exports field lint with bundler
tsdown, When publint option is enabled on tsdown.config, tsdown will lint the exports field in package.json using publint.publint currently does not lint the exports in package manifest files like JSRβs jsr.json.jsr.json may be niche, but for those like me who distribute library packages via both npm and JSR, this lint is necessary.# npm
npm install --save-dev jsr-exports-lint
## pnpm
pnpm add -D jsr-exports-lint
## yarn
yarn add -D jsr-exports-lint
## bum
bun add -D jsr-exports-lint
import { defineConfig } from 'tsdown'
import { lintJsrExports } from 'jsr-exports-lint/tsdown'
export default defineConfig({
entry: ['./src/index.ts', './src/features/feature1.ts', './src/features/feature2.ts'],
publint: true,
dts: true,
hooks: {
'build:done': lintJsrExports() // or put your jsr.json path (e.g. `lintJsrExports('/path/to/your/projects/project/jsr.json')`)
}
})
import { defineBuildConfig } from 'unbuild'
import { lintJsrExports } from 'jsr-exports-lint/unbuild'
export default defineBuildConfig({
entries: ['./src/index.ts', './src/features/feature1.ts', './src/features/feature2.ts'],
declaration: true,
hooks: {
'build:done': lintJsrExports() // or put your jsr.json path (e.g. `lintJsrExports('/path/to/your/projects/project/jsr.json')`)
}
})
The development of Gunish is supported by my OSS sponsors!
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.