@metajoy-preview/unplugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ import { t as MetajoyConfig } from "./config-C0xYNXLv.mjs";
2
+
3
+ //#region src/option.d.ts
4
+ interface Options {
5
+ /**
6
+ * API插件
7
+ * @default true
8
+ */
9
+ api?: boolean | (Pick<NonNullable<MetajoyConfig["api"]>, "baseUrl" | "overrides"> & {
10
+ /**
11
+ * 开发代理
12
+ * @default true
13
+ */
14
+ proxy?: boolean;
15
+ });
16
+ }
17
+ declare function normalizeOptions(options: Options | undefined): {
18
+ api: {
19
+ proxy: true;
20
+ } | undefined;
21
+ };
22
+ type NormalizedOptions = ReturnType<typeof normalizeOptions>;
23
+ //#endregion
24
+ export { NormalizedOptions, Options, normalizeOptions };
@@ -0,0 +1,9 @@
1
+ import { isBoolean, merge } from "lodash-es";
2
+ //#region src/option.ts
3
+ function normalizeOptions(options) {
4
+ const result = merge({ api: true }, options);
5
+ const apiDefaults = { proxy: true };
6
+ return { api: result.api ? isBoolean(result.api) ? apiDefaults : merge(apiDefaults, result.api) : void 0 };
7
+ }
8
+ //#endregion
9
+ export { normalizeOptions };