This commit is contained in:
10
package.json
10
package.json
@@ -18,6 +18,16 @@
|
|||||||
"types": "./dist/lib.d.cts",
|
"types": "./dist/lib.d.cts",
|
||||||
"default": "./dist/lib.cjs"
|
"default": "./dist/lib.cjs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"./util": {
|
||||||
|
"import": {
|
||||||
|
"types": "./dist/util.d.mts",
|
||||||
|
"default": "./dist/util.mjs"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"types": "./dist/util.d.cts",
|
||||||
|
"default": "./dist/util.cjs"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -5,30 +5,40 @@ import ts from "rollup-plugin-ts"
|
|||||||
import pkg from "./package.json" assert { type: "json" }
|
import pkg from "./package.json" assert { type: "json" }
|
||||||
|
|
||||||
|
|
||||||
export default defineConfig({
|
export const createBundleConfig = (
|
||||||
input: "src/lib.ts",
|
input: string,
|
||||||
|
name: keyof typeof pkg.exports,
|
||||||
|
) => (
|
||||||
|
defineConfig({
|
||||||
|
input,
|
||||||
|
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
file: pkg.exports["."].import.default,
|
file: pkg.exports[name].import.default,
|
||||||
format: "esm",
|
format: "esm",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
file: pkg.exports[name].require.default,
|
||||||
|
format: "cjs",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
{
|
external: id => !/^[./]/.test(id),
|
||||||
file: pkg.exports["."].require.default,
|
|
||||||
format: "cjs",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
external: id => !/^[./]/.test(id),
|
plugins: [
|
||||||
|
nodeResolve(),
|
||||||
|
ts(),
|
||||||
|
|
||||||
plugins: [
|
cleanup({
|
||||||
nodeResolve(),
|
comments: "jsdoc",
|
||||||
ts(),
|
extensions: ["ts"],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
cleanup({
|
|
||||||
comments: "jsdoc",
|
export default [
|
||||||
extensions: ["ts"],
|
createBundleConfig("src/lib.ts", "."),
|
||||||
}),
|
createBundleConfig("src/util/lib.ts", "./util"),
|
||||||
],
|
]
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export {
|
export {
|
||||||
abstract, expression, trait,
|
abstract, expression, trait,
|
||||||
|
type Implements,
|
||||||
type Trait,
|
type Trait,
|
||||||
type TraitExpression
|
type TraitExpression
|
||||||
} from "."
|
} from "."
|
||||||
|
|||||||
6
src/util/lib.ts
Normal file
6
src/util/lib.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export {
|
||||||
|
Extend,
|
||||||
|
ExtendFn,
|
||||||
|
Extendable,
|
||||||
|
ExtendableFn
|
||||||
|
} from "."
|
||||||
Reference in New Issue
Block a user