feat(theme): add support for optional features
This commit is contained in:
parent
ce544d2dfc
commit
5e9d2d043a
@ -37,6 +37,9 @@
|
||||
"types": "./lib/client/composables/index.d.ts",
|
||||
"import": "./lib/client/composables/index.js"
|
||||
},
|
||||
"./features/*": {
|
||||
"import": "./lib/client/features/components/*"
|
||||
},
|
||||
"./shared": {
|
||||
"types": "./lib/shared/index.d.ts",
|
||||
"import": "./lib/shared/index.js"
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
import process from 'node:process'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { type Options, defineConfig } from 'tsup'
|
||||
|
||||
const sharedExternal: (string | RegExp)[] = [
|
||||
@ -12,6 +15,11 @@ const clientExternal: (string | RegExp)[] = [
|
||||
/.*\.css$/,
|
||||
]
|
||||
|
||||
const featuresComposables = fs.readdirSync(
|
||||
path.join(process.cwd(), 'src/client/features/composables'),
|
||||
{ recursive: true, encoding: 'utf-8' },
|
||||
)
|
||||
|
||||
export default defineConfig((cli) => {
|
||||
const DEFAULT_OPTIONS: Options = {
|
||||
dts: !cli.watch,
|
||||
@ -35,6 +43,7 @@ export default defineConfig((cli) => {
|
||||
outDir: './lib/node',
|
||||
external: sharedExternal,
|
||||
target: 'node18',
|
||||
watch: false,
|
||||
},
|
||||
// client/utils/index.js
|
||||
{
|
||||
@ -77,5 +86,16 @@ export default defineConfig((cli) => {
|
||||
'./config.js',
|
||||
],
|
||||
},
|
||||
...featuresComposables.map(file => ({
|
||||
...DEFAULT_OPTIONS,
|
||||
entry: [`./src/client/features/composables/${file}`],
|
||||
outDir: `./lib/client/features/composables/`,
|
||||
external: [
|
||||
...clientExternal,
|
||||
'../../composables/index.js',
|
||||
'../../utils/index.js',
|
||||
...featuresComposables.map(file => `./${file.replace('.ts', '.js')}`),
|
||||
],
|
||||
})),
|
||||
]
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user