refactor: unwrap ConfigPlugin namespace to flat exports + self-reexport (#22876)
This commit is contained in:
@@ -4,7 +4,6 @@ import { pathToFileURL } from "url"
|
|||||||
import { isPathPluginSpec, parsePluginSpecifier, resolvePathPluginTarget } from "@/plugin/shared"
|
import { isPathPluginSpec, parsePluginSpecifier, resolvePathPluginTarget } from "@/plugin/shared"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
|
|
||||||
export namespace ConfigPlugin {
|
|
||||||
const Options = z.record(z.string(), z.unknown())
|
const Options = z.record(z.string(), z.unknown())
|
||||||
export type Options = z.infer<typeof Options>
|
export type Options = z.infer<typeof Options>
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ export namespace ConfigPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function load(dir: string) {
|
export async function load(dir: string) {
|
||||||
const plugins: ConfigPlugin.Spec[] = []
|
const plugins: Spec[] = []
|
||||||
|
|
||||||
for (const item of await Glob.scan("{plugin,plugins}/*.{ts,js}", {
|
for (const item of await Glob.scan("{plugin,plugins}/*.{ts,js}", {
|
||||||
cwd: dir,
|
cwd: dir,
|
||||||
@@ -81,4 +80,5 @@ export namespace ConfigPlugin {
|
|||||||
|
|
||||||
return list.toReversed()
|
return list.toReversed()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
export * as ConfigPlugin from "./plugin"
|
||||||
|
|||||||
Reference in New Issue
Block a user