@oiyo/config 0.1.1 → 0.2.0

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.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @oiyo/config v0.1.1
2
+ * @oiyo/config v0.2.0
3
3
  * Copyright (c) 2026 skiyee. All rights reserved.
4
4
  * Commercial software. See LICENSE for terms.
5
5
  * Official site: https://oiyo.js.org
@@ -27,10 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  enumerable: true
28
28
  }) : target, mod));
29
29
  //#endregion
30
+ let defu = require("defu");
30
31
  let node_process = require("node:process");
31
32
  node_process = __toESM(node_process);
32
- let defu = require("defu");
33
- //#region src/oiyo/index.ts
33
+ //#region src/oiyo/default.ts
34
34
  const DEFAULT_RUNTIME_LIFECYCLE_APIS = [
35
35
  "onBeforeMount",
36
36
  "onMounted",
@@ -200,6 +200,8 @@ const defaultConfig = {
200
200
  path: {}
201
201
  }
202
202
  };
203
+ //#endregion
204
+ //#region src/oiyo/index.ts
203
205
  /**
204
206
  * 解析并合并配置
205
207
  * @param userConfig 用户提供的配置
@@ -211,12 +213,6 @@ function resolveOiyoConfig(userConfig) {
211
213
  function defineOiyoConfig(config) {
212
214
  return config;
213
215
  }
214
- function defineApiScanner(input) {
215
- return input;
216
- }
217
- function defineComponentScanner(input) {
218
- return input;
219
- }
220
216
  //#endregion
221
217
  //#region src/pages/index.ts
222
218
  function definePagesConfig(config) {
@@ -224,9 +220,6 @@ function definePagesConfig(config) {
224
220
  }
225
221
  //#endregion
226
222
  exports.DEFAULT_EXCLUDE = DEFAULT_EXCLUDE;
227
- exports.defaultConfig = defaultConfig;
228
- exports.defineApiScanner = defineApiScanner;
229
- exports.defineComponentScanner = defineComponentScanner;
230
223
  exports.defineOiyoConfig = defineOiyoConfig;
231
224
  exports.definePagesConfig = definePagesConfig;
232
225
  exports.resolveOiyoConfig = resolveOiyoConfig;
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @oiyo/config v0.1.1
2
+ * @oiyo/config v0.2.0
3
3
  * Copyright (c) 2026 skiyee. All rights reserved.
4
4
  * Commercial software. See LICENSE for terms.
5
5
  * Official site: https://oiyo.js.org
6
6
  */
7
- //#region src/oiyo/index.d.ts
8
- type ScanName = string | ScanNameItem;
9
- interface ScanNameItem {
7
+ //#region src/oiyo/types.d.ts
8
+ type GlobRule = string | string[];
9
+ interface OnlyScanNameItem {
10
10
  /** 来源侧名字 */
11
11
  name: string;
12
12
  /** 暴露到项目中的名字 */
@@ -17,41 +17,58 @@ interface ScanNameItem {
17
17
  */
18
18
  isType?: boolean;
19
19
  }
20
- type GlobRule = string | string[];
21
- type ApiScanner = string | {
22
- /** 目录、文件、包或包子路径 */from: string; /** 是否扫描类型导出(仅参与 d.ts 生成) */
23
- types?: boolean; /** 只匹配这些文件 */
24
- pattern?: GlobRule; /** 忽略这些文件 */
25
- ignore?: GlobRule; /** 只保留这些导出,并支持重命名 */
26
- only?: ScanName[]; /** 排除这些最终暴露名 */
20
+ interface ApiScanTarget {
21
+ /** 目录、文件、包或包子路径 */
22
+ from: string;
23
+ /** 是否扫描类型导出(仅作为类型被使用) */
24
+ types?: boolean;
25
+ /** 只匹配这些文件 */
26
+ pattern?: GlobRule;
27
+ /** 忽略这些文件 */
28
+ ignore?: GlobRule;
29
+ /** 只保留这些导出,支持重命名 */
30
+ only?: Array<string | OnlyScanNameItem>;
31
+ /** 排除这些最终暴露名 */
27
32
  exclude?: string[];
28
- };
29
- type ComponentScanner = string | {
30
- /** 扫描目录、文件、包或包子路径 */from: string; /** 只匹配这些文件 */
31
- pattern?: GlobRule; /** 忽略这些文件 */
32
- ignore?: GlobRule; /** 只保留这些导出,并支持重命名 */
33
- only?: ScanName[]; /** 为组件添加前缀 */
34
- prefix?: string; /** 是否目录链参与命名 */
33
+ }
34
+ interface ComponentScanTarget {
35
+ /** 扫描目录、文件、包或包子路径 */
36
+ from: string;
37
+ /** 只匹配这些文件 */
38
+ pattern?: GlobRule;
39
+ /** 忽略这些文件 */
40
+ ignore?: GlobRule;
41
+ /** 只保留这些导出,并支持重命名 */
42
+ only?: Array<string | OnlyScanNameItem>;
43
+ /** 为组件添加前缀 */
44
+ prefix?: string;
45
+ /** 是否目录链参与命名 */
35
46
  chain?: boolean;
36
- };
47
+ }
37
48
  interface OiyoConfigScan {
38
- /** 自动扫描与注册 API */
39
- apis?: ApiScanner[];
49
+ /** 自动扫描与注册API */
50
+ apis?: Array<string | ApiScanTarget>;
40
51
  /** 自动扫描与注册组件 */
41
- components?: ComponentScanner[];
52
+ components?: Array<string | ComponentScanTarget>;
42
53
  }
43
54
  /**
44
55
  * Oiyo 路径配置
45
56
  */
46
57
  interface OiyoConfigDir {
47
58
  /** 主包目录 */
48
- mainPackage: string;
59
+ mainPackage?: string;
49
60
  /** 子包目录配置 */
50
- subPackages: string[];
61
+ subPackages?: string[];
51
62
  /** 布局目录 */
52
- layouts: string;
63
+ layouts?: string;
53
64
  /** 中间件目录 */
54
- middleware: string;
65
+ middleware?: string;
66
+ }
67
+ /**
68
+ * IDE 配置路径平台
69
+ */
70
+ interface IDEPlatformPath {
71
+ weixin?: string;
55
72
  }
56
73
  /**
57
74
  * IDE 配置
@@ -60,21 +77,31 @@ interface OiyoConfigIDE {
60
77
  /** 构建小程序平台时自动打开对应 IDE */
61
78
  open?: boolean;
62
79
  /** 不同平台 IDE 的可执行路径 */
63
- path?: Partial<Record<string, string>>;
80
+ path?: IDEPlatformPath;
64
81
  }
65
82
  /**
66
83
  * Oiyo 配置
67
84
  */
68
85
  interface OiyoConfig {
69
- /** 项目根目录 */
86
+ /**
87
+ * 项目根目录
88
+ */
70
89
  rootDir?: string;
71
- /** 源码目录 */
90
+ /**
91
+ * 源码目录
92
+ */
72
93
  srcDir?: string;
73
- /** 目录配置 */
74
- dir?: Partial<OiyoConfigDir>;
75
- /** 自动扫描配置 */
76
- scan?: Partial<OiyoConfigScan>;
77
- /** 排除的页面(glob 模式) */
94
+ /**
95
+ * 目录配置
96
+ */
97
+ dir?: OiyoConfigDir;
98
+ /**
99
+ * 自动扫描配置
100
+ */
101
+ scan?: OiyoConfigScan;
102
+ /**
103
+ * 忽略参与 oiyo 系统的文件(glob 模式)
104
+ */
78
105
  exclude?: string[];
79
106
  /**
80
107
  * 小程序 IDE 配置
@@ -82,23 +109,21 @@ interface OiyoConfig {
82
109
  */
83
110
  ide?: OiyoConfigIDE;
84
111
  }
112
+ //#endregion
113
+ //#region src/oiyo/default.d.ts
85
114
  /**
86
115
  * 默认排除规则
87
116
  */
88
117
  declare const DEFAULT_EXCLUDE: string[];
89
- /**
90
- * 默认的 Oiyo 配置
91
- */
92
- declare const defaultConfig: OiyoConfig;
118
+ //#endregion
119
+ //#region src/oiyo/index.d.ts
93
120
  /**
94
121
  * 解析并合并配置
95
122
  * @param userConfig 用户提供的配置
96
123
  * @returns 合并后的完整配置
97
124
  */
98
- declare function resolveOiyoConfig(userConfig?: Partial<OiyoConfig>): OiyoConfig;
99
- declare function defineOiyoConfig(config: Partial<OiyoConfig>): Partial<OiyoConfig>;
100
- declare function defineApiScanner(input: ApiScanner): ApiScanner;
101
- declare function defineComponentScanner(input: ComponentScanner): ComponentScanner;
125
+ declare function resolveOiyoConfig(userConfig?: OiyoConfig): Required<OiyoConfig>;
126
+ declare function defineOiyoConfig(config?: OiyoConfig): OiyoConfig | undefined;
102
127
  //#endregion
103
128
  //#region src/pages/interfaces/condition.d.ts
104
129
  interface ConditionItem {
@@ -3058,4 +3083,4 @@ interface PagesJson {
3058
3083
  interface PagesConfig extends PagesJson {}
3059
3084
  declare function definePagesConfig(config: PagesConfig): PagesConfig;
3060
3085
  //#endregion
3061
- export { AnimationType, ApiScanner, Color, ComponentScanner, Condition, ConditionItem, DEFAULT_EXCLUDE, EasyCom, GlobRule, GlobalStyle, HEXColor, OiyoConfig, OiyoConfigDir, OiyoConfigIDE, OiyoConfigScan, Page, PagesConfig, PagesJson, PercentageSize, PxSize, RGBAColor, RGBColor, RpxSize, ScanName, ScanNameItem, SubPackage, TabBar, TabBarIconFont, TabBarItem, TabBarMidButton, TheWindow, ThemeVar, TitleNViewButton, UniIdRouter, defaultConfig, defineApiScanner, defineComponentScanner, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
3086
+ export { AnimationType, ApiScanTarget, Color, ComponentScanTarget, Condition, ConditionItem, DEFAULT_EXCLUDE, EasyCom, GlobRule, GlobalStyle, HEXColor, IDEPlatformPath, OiyoConfig, OiyoConfigDir, OiyoConfigIDE, OiyoConfigScan, OnlyScanNameItem, Page, PagesConfig, PagesJson, PercentageSize, PxSize, RGBAColor, RGBColor, RpxSize, SubPackage, TabBar, TabBarIconFont, TabBarItem, TabBarMidButton, TheWindow, ThemeVar, TitleNViewButton, UniIdRouter, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @oiyo/config v0.1.1
2
+ * @oiyo/config v0.2.0
3
3
  * Copyright (c) 2026 skiyee. All rights reserved.
4
4
  * Commercial software. See LICENSE for terms.
5
5
  * Official site: https://oiyo.js.org
6
6
  */
7
- //#region src/oiyo/index.d.ts
8
- type ScanName = string | ScanNameItem;
9
- interface ScanNameItem {
7
+ //#region src/oiyo/types.d.ts
8
+ type GlobRule = string | string[];
9
+ interface OnlyScanNameItem {
10
10
  /** 来源侧名字 */
11
11
  name: string;
12
12
  /** 暴露到项目中的名字 */
@@ -17,41 +17,58 @@ interface ScanNameItem {
17
17
  */
18
18
  isType?: boolean;
19
19
  }
20
- type GlobRule = string | string[];
21
- type ApiScanner = string | {
22
- /** 目录、文件、包或包子路径 */from: string; /** 是否扫描类型导出(仅参与 d.ts 生成) */
23
- types?: boolean; /** 只匹配这些文件 */
24
- pattern?: GlobRule; /** 忽略这些文件 */
25
- ignore?: GlobRule; /** 只保留这些导出,并支持重命名 */
26
- only?: ScanName[]; /** 排除这些最终暴露名 */
20
+ interface ApiScanTarget {
21
+ /** 目录、文件、包或包子路径 */
22
+ from: string;
23
+ /** 是否扫描类型导出(仅作为类型被使用) */
24
+ types?: boolean;
25
+ /** 只匹配这些文件 */
26
+ pattern?: GlobRule;
27
+ /** 忽略这些文件 */
28
+ ignore?: GlobRule;
29
+ /** 只保留这些导出,支持重命名 */
30
+ only?: Array<string | OnlyScanNameItem>;
31
+ /** 排除这些最终暴露名 */
27
32
  exclude?: string[];
28
- };
29
- type ComponentScanner = string | {
30
- /** 扫描目录、文件、包或包子路径 */from: string; /** 只匹配这些文件 */
31
- pattern?: GlobRule; /** 忽略这些文件 */
32
- ignore?: GlobRule; /** 只保留这些导出,并支持重命名 */
33
- only?: ScanName[]; /** 为组件添加前缀 */
34
- prefix?: string; /** 是否目录链参与命名 */
33
+ }
34
+ interface ComponentScanTarget {
35
+ /** 扫描目录、文件、包或包子路径 */
36
+ from: string;
37
+ /** 只匹配这些文件 */
38
+ pattern?: GlobRule;
39
+ /** 忽略这些文件 */
40
+ ignore?: GlobRule;
41
+ /** 只保留这些导出,并支持重命名 */
42
+ only?: Array<string | OnlyScanNameItem>;
43
+ /** 为组件添加前缀 */
44
+ prefix?: string;
45
+ /** 是否目录链参与命名 */
35
46
  chain?: boolean;
36
- };
47
+ }
37
48
  interface OiyoConfigScan {
38
- /** 自动扫描与注册 API */
39
- apis?: ApiScanner[];
49
+ /** 自动扫描与注册API */
50
+ apis?: Array<string | ApiScanTarget>;
40
51
  /** 自动扫描与注册组件 */
41
- components?: ComponentScanner[];
52
+ components?: Array<string | ComponentScanTarget>;
42
53
  }
43
54
  /**
44
55
  * Oiyo 路径配置
45
56
  */
46
57
  interface OiyoConfigDir {
47
58
  /** 主包目录 */
48
- mainPackage: string;
59
+ mainPackage?: string;
49
60
  /** 子包目录配置 */
50
- subPackages: string[];
61
+ subPackages?: string[];
51
62
  /** 布局目录 */
52
- layouts: string;
63
+ layouts?: string;
53
64
  /** 中间件目录 */
54
- middleware: string;
65
+ middleware?: string;
66
+ }
67
+ /**
68
+ * IDE 配置路径平台
69
+ */
70
+ interface IDEPlatformPath {
71
+ weixin?: string;
55
72
  }
56
73
  /**
57
74
  * IDE 配置
@@ -60,21 +77,31 @@ interface OiyoConfigIDE {
60
77
  /** 构建小程序平台时自动打开对应 IDE */
61
78
  open?: boolean;
62
79
  /** 不同平台 IDE 的可执行路径 */
63
- path?: Partial<Record<string, string>>;
80
+ path?: IDEPlatformPath;
64
81
  }
65
82
  /**
66
83
  * Oiyo 配置
67
84
  */
68
85
  interface OiyoConfig {
69
- /** 项目根目录 */
86
+ /**
87
+ * 项目根目录
88
+ */
70
89
  rootDir?: string;
71
- /** 源码目录 */
90
+ /**
91
+ * 源码目录
92
+ */
72
93
  srcDir?: string;
73
- /** 目录配置 */
74
- dir?: Partial<OiyoConfigDir>;
75
- /** 自动扫描配置 */
76
- scan?: Partial<OiyoConfigScan>;
77
- /** 排除的页面(glob 模式) */
94
+ /**
95
+ * 目录配置
96
+ */
97
+ dir?: OiyoConfigDir;
98
+ /**
99
+ * 自动扫描配置
100
+ */
101
+ scan?: OiyoConfigScan;
102
+ /**
103
+ * 忽略参与 oiyo 系统的文件(glob 模式)
104
+ */
78
105
  exclude?: string[];
79
106
  /**
80
107
  * 小程序 IDE 配置
@@ -82,23 +109,21 @@ interface OiyoConfig {
82
109
  */
83
110
  ide?: OiyoConfigIDE;
84
111
  }
112
+ //#endregion
113
+ //#region src/oiyo/default.d.ts
85
114
  /**
86
115
  * 默认排除规则
87
116
  */
88
117
  declare const DEFAULT_EXCLUDE: string[];
89
- /**
90
- * 默认的 Oiyo 配置
91
- */
92
- declare const defaultConfig: OiyoConfig;
118
+ //#endregion
119
+ //#region src/oiyo/index.d.ts
93
120
  /**
94
121
  * 解析并合并配置
95
122
  * @param userConfig 用户提供的配置
96
123
  * @returns 合并后的完整配置
97
124
  */
98
- declare function resolveOiyoConfig(userConfig?: Partial<OiyoConfig>): OiyoConfig;
99
- declare function defineOiyoConfig(config: Partial<OiyoConfig>): Partial<OiyoConfig>;
100
- declare function defineApiScanner(input: ApiScanner): ApiScanner;
101
- declare function defineComponentScanner(input: ComponentScanner): ComponentScanner;
125
+ declare function resolveOiyoConfig(userConfig?: OiyoConfig): Required<OiyoConfig>;
126
+ declare function defineOiyoConfig(config?: OiyoConfig): OiyoConfig | undefined;
102
127
  //#endregion
103
128
  //#region src/pages/interfaces/condition.d.ts
104
129
  interface ConditionItem {
@@ -3058,4 +3083,4 @@ interface PagesJson {
3058
3083
  interface PagesConfig extends PagesJson {}
3059
3084
  declare function definePagesConfig(config: PagesConfig): PagesConfig;
3060
3085
  //#endregion
3061
- export { AnimationType, ApiScanner, Color, ComponentScanner, Condition, ConditionItem, DEFAULT_EXCLUDE, EasyCom, GlobRule, GlobalStyle, HEXColor, OiyoConfig, OiyoConfigDir, OiyoConfigIDE, OiyoConfigScan, Page, PagesConfig, PagesJson, PercentageSize, PxSize, RGBAColor, RGBColor, RpxSize, ScanName, ScanNameItem, SubPackage, TabBar, TabBarIconFont, TabBarItem, TabBarMidButton, TheWindow, ThemeVar, TitleNViewButton, UniIdRouter, defaultConfig, defineApiScanner, defineComponentScanner, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
3086
+ export { AnimationType, ApiScanTarget, Color, ComponentScanTarget, Condition, ConditionItem, DEFAULT_EXCLUDE, EasyCom, GlobRule, GlobalStyle, HEXColor, IDEPlatformPath, OiyoConfig, OiyoConfigDir, OiyoConfigIDE, OiyoConfigScan, OnlyScanNameItem, Page, PagesConfig, PagesJson, PercentageSize, PxSize, RGBAColor, RGBColor, RpxSize, SubPackage, TabBar, TabBarIconFont, TabBarItem, TabBarMidButton, TheWindow, ThemeVar, TitleNViewButton, UniIdRouter, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @oiyo/config v0.1.1
2
+ * @oiyo/config v0.2.0
3
3
  * Copyright (c) 2026 skiyee. All rights reserved.
4
4
  * Commercial software. See LICENSE for terms.
5
5
  * Official site: https://oiyo.js.org
6
6
  */
7
- import process from "node:process";
8
7
  import { defu } from "defu";
9
- //#region src/oiyo/index.ts
8
+ import process from "node:process";
9
+ //#region src/oiyo/default.ts
10
10
  const DEFAULT_RUNTIME_LIFECYCLE_APIS = [
11
11
  "onBeforeMount",
12
12
  "onMounted",
@@ -176,6 +176,8 @@ const defaultConfig = {
176
176
  path: {}
177
177
  }
178
178
  };
179
+ //#endregion
180
+ //#region src/oiyo/index.ts
179
181
  /**
180
182
  * 解析并合并配置
181
183
  * @param userConfig 用户提供的配置
@@ -187,16 +189,10 @@ function resolveOiyoConfig(userConfig) {
187
189
  function defineOiyoConfig(config) {
188
190
  return config;
189
191
  }
190
- function defineApiScanner(input) {
191
- return input;
192
- }
193
- function defineComponentScanner(input) {
194
- return input;
195
- }
196
192
  //#endregion
197
193
  //#region src/pages/index.ts
198
194
  function definePagesConfig(config) {
199
195
  return config;
200
196
  }
201
197
  //#endregion
202
- export { DEFAULT_EXCLUDE, defaultConfig, defineApiScanner, defineComponentScanner, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
198
+ export { DEFAULT_EXCLUDE, defineOiyoConfig, definePagesConfig, resolveOiyoConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oiyo/config",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.2.0",
5
5
  "author": {
6
6
  "name": "skiyee",
7
7
  "email": "319619193@qq.com",