@weapp-core/shared 3.2.1 → 3.2.2
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/fs/index.d.ts +8 -9
- package/dist/index.d.ts +25 -25
- package/dist/node.d.ts +2 -2
- package/package.json +16 -3
package/dist/fs/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Dirent, OpenMode, PathLike, Stats, closeSync, constants, existsSync, mkdirSync, openSync, promises, readFileSync, unlinkSync, utimesSync, watch, writeFileSync } from "node:fs";
|
|
2
2
|
import { FileHandle } from "node:fs/promises";
|
|
3
3
|
//#region src/fs/index.d.ts
|
|
4
|
-
interface JsonReadOptions {
|
|
4
|
+
export interface JsonReadOptions {
|
|
5
5
|
encoding?: BufferEncoding;
|
|
6
6
|
throws?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface JsonWriteOptions {
|
|
8
|
+
export interface JsonWriteOptions {
|
|
9
9
|
encoding?: BufferEncoding;
|
|
10
10
|
replacer?: ((this: any, key: string, value: any) => any) | Array<number | string> | null;
|
|
11
11
|
spaces?: number | string;
|
|
12
12
|
}
|
|
13
|
-
interface CopyOptions {
|
|
13
|
+
export interface CopyOptions {
|
|
14
14
|
dereference?: boolean;
|
|
15
15
|
errorOnExist?: boolean;
|
|
16
16
|
filter?: (src: string, dest: string) => boolean | Promise<boolean>;
|
|
@@ -18,7 +18,7 @@ interface CopyOptions {
|
|
|
18
18
|
preserveTimestamps?: boolean;
|
|
19
19
|
verbatimSymlinks?: boolean;
|
|
20
20
|
}
|
|
21
|
-
interface MoveOptions {
|
|
21
|
+
export interface MoveOptions {
|
|
22
22
|
overwrite?: boolean;
|
|
23
23
|
}
|
|
24
24
|
declare function pathExists(target: string): Promise<boolean>;
|
|
@@ -41,7 +41,7 @@ declare function readJsonSync<T = unknown>(file: string, options?: JsonReadOptio
|
|
|
41
41
|
declare function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
|
|
42
42
|
declare function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
|
|
43
43
|
declare function close$1(handle: number | FileHandle): Promise<void>;
|
|
44
|
-
declare const fs: {
|
|
44
|
+
export declare const fs: {
|
|
45
45
|
Dirent: typeof Dirent;
|
|
46
46
|
Stats: typeof Stats;
|
|
47
47
|
access: typeof promises.access;
|
|
@@ -86,7 +86,6 @@ declare const fs: {
|
|
|
86
86
|
writeJSON: typeof writeJSON;
|
|
87
87
|
writeJson: typeof writeJson;
|
|
88
88
|
};
|
|
89
|
-
type FsDirent = Dirent;
|
|
90
|
-
type FsStats = Stats;
|
|
91
|
-
//#endregion
|
|
92
|
-
export { CopyOptions, FsDirent, FsStats, JsonReadOptions, JsonWriteOptions, MoveOptions, fs };
|
|
89
|
+
export type FsDirent = Dirent;
|
|
90
|
+
export type FsStats = Stats;
|
|
91
|
+
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -20,19 +20,19 @@ type Merge<Destination extends Input, Defaults extends Input> = Destination exte
|
|
|
20
20
|
declare const defu: DefuInstance;
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/layoutHostRegistry.d.ts
|
|
23
|
-
interface MiniProgramLayoutHostWaitOptions {
|
|
23
|
+
export interface MiniProgramLayoutHostWaitOptions {
|
|
24
24
|
interval?: number;
|
|
25
25
|
retries?: number;
|
|
26
26
|
}
|
|
27
|
-
type MiniProgramLayoutHostResolver<TBridge, THost = unknown> = (bridge: TBridge, key: string) => THost | null | undefined;
|
|
27
|
+
export type MiniProgramLayoutHostResolver<TBridge, THost = unknown> = (bridge: TBridge, key: string) => THost | null | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* @description 对 layout host key 去重并过滤空字符串。
|
|
30
30
|
*/
|
|
31
|
-
declare function normalizeMiniProgramLayoutHostKeys(keys: string | string[]): string[];
|
|
31
|
+
export declare function normalizeMiniProgramLayoutHostKeys(keys: string | string[]): string[];
|
|
32
32
|
/**
|
|
33
33
|
* @description 创建小程序 layout host 注册表。
|
|
34
34
|
*/
|
|
35
|
-
declare function createMiniProgramLayoutHostRegistry<TBridge>(): {
|
|
35
|
+
export declare function createMiniProgramLayoutHostRegistry<TBridge>(): {
|
|
36
36
|
register: (keys: string | string[], bridge: TBridge, pageKeys: string[]) => string[] | null;
|
|
37
37
|
resolveBridge: (key: string, pageKeys: string[]) => TBridge | undefined;
|
|
38
38
|
resolveHost: <THost>(key: string, pageKeys: string[], resolver: MiniProgramLayoutHostResolver<TBridge, THost>) => NonNullable<THost> | null;
|
|
@@ -42,23 +42,23 @@ declare function createMiniProgramLayoutHostRegistry<TBridge>(): {
|
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/runtimeProviders.d.ts
|
|
45
|
-
type RuntimeProviderBackend = 'miniprogram' | 'web';
|
|
46
|
-
type RuntimeProviderCompilation = 'native' | 'vue' | 'web';
|
|
47
|
-
type RuntimeProviderModuleKind = 'runtime' | 'reactivity' | 'template';
|
|
48
|
-
type RuntimeProviderVariant = 'development' | 'production';
|
|
49
|
-
type RuntimeProviderInjectionMode = 'none' | 'virtual-module';
|
|
50
|
-
type RuntimeProviderHmrMode = 'none' | 'host-reload' | 'module-accept';
|
|
45
|
+
export type RuntimeProviderBackend = 'miniprogram' | 'web';
|
|
46
|
+
export type RuntimeProviderCompilation = 'native' | 'vue' | 'web';
|
|
47
|
+
export type RuntimeProviderModuleKind = 'runtime' | 'reactivity' | 'template';
|
|
48
|
+
export type RuntimeProviderVariant = 'development' | 'production';
|
|
49
|
+
export type RuntimeProviderInjectionMode = 'none' | 'virtual-module';
|
|
50
|
+
export type RuntimeProviderHmrMode = 'none' | 'host-reload' | 'module-accept';
|
|
51
51
|
/**
|
|
52
52
|
* 运行时 provider 的开发与生产入口。
|
|
53
53
|
*/
|
|
54
|
-
interface RuntimeProviderEntry {
|
|
54
|
+
export interface RuntimeProviderEntry {
|
|
55
55
|
development: string;
|
|
56
56
|
production: string;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* 运行时 provider 的声明式能力。
|
|
60
60
|
*/
|
|
61
|
-
interface RuntimeProviderCapabilities {
|
|
61
|
+
export interface RuntimeProviderCapabilities {
|
|
62
62
|
framework: boolean;
|
|
63
63
|
hmr: boolean;
|
|
64
64
|
nativeHost: boolean;
|
|
@@ -67,14 +67,14 @@ interface RuntimeProviderCapabilities {
|
|
|
67
67
|
/**
|
|
68
68
|
* 运行时 provider 的 HMR 契约。
|
|
69
69
|
*/
|
|
70
|
-
interface RuntimeProviderHmrDescriptor {
|
|
70
|
+
export interface RuntimeProviderHmrDescriptor {
|
|
71
71
|
mode: RuntimeProviderHmrMode;
|
|
72
72
|
acceptCode?: string;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* 跨包共享的运行时 provider 描述契约。
|
|
76
76
|
*/
|
|
77
|
-
interface RuntimeProviderDescriptorContract {
|
|
77
|
+
export interface RuntimeProviderDescriptorContract {
|
|
78
78
|
id: string;
|
|
79
79
|
backend: RuntimeProviderBackend;
|
|
80
80
|
compilation: RuntimeProviderCompilation;
|
|
@@ -89,44 +89,44 @@ interface RuntimeProviderDescriptorContract {
|
|
|
89
89
|
/**
|
|
90
90
|
* @description 按 exparser 与 glass-easel 的共同规则序列化 WXML 静态文本。
|
|
91
91
|
*/
|
|
92
|
-
declare function escapeWxmlText(value: string): string;
|
|
92
|
+
export declare function escapeWxmlText(value: string): string;
|
|
93
93
|
/**
|
|
94
94
|
* @description 按 exparser 与 glass-easel 的共同规则序列化双引号 WXML 属性值。
|
|
95
95
|
*/
|
|
96
|
-
declare function escapeWxmlAttribute(value: string): string;
|
|
96
|
+
export declare function escapeWxmlAttribute(value: string): string;
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/index.d.ts
|
|
99
99
|
/**
|
|
100
100
|
* @description 转义字符串中的正则特殊字符
|
|
101
101
|
*/
|
|
102
|
-
declare function escapeStringRegexp(str: string): string;
|
|
102
|
+
export declare function escapeStringRegexp(str: string): string;
|
|
103
103
|
/**
|
|
104
104
|
* @description 移除文件名的最后一个扩展名
|
|
105
105
|
*/
|
|
106
|
-
declare function removeExtension(file: string): string;
|
|
106
|
+
export declare function removeExtension(file: string): string;
|
|
107
107
|
/**
|
|
108
108
|
* @description 移除文件名的所有扩展名(多重后缀)
|
|
109
109
|
*/
|
|
110
|
-
declare function removeExtensionDeep(file: string): string;
|
|
110
|
+
export declare function removeExtensionDeep(file: string): string;
|
|
111
111
|
/**
|
|
112
112
|
* @description 若缺少扩展名则追加(默认 .js)
|
|
113
113
|
*/
|
|
114
|
-
declare function addExtension(filename: string, ext?: string): string;
|
|
114
|
+
export declare function addExtension(filename: string, ext?: string): string;
|
|
115
115
|
/**
|
|
116
116
|
* @description 将单个值转换为数组
|
|
117
117
|
*/
|
|
118
|
-
declare function arrify<T>(val: T | readonly T[]): T[];
|
|
118
|
+
export declare function arrify<T>(val: T | readonly T[]): T[];
|
|
119
119
|
/**
|
|
120
120
|
* @description defu 合并策略:当目标/来源为数组时直接覆盖
|
|
121
121
|
*/
|
|
122
|
-
declare const defuOverrideArray: DefuFn;
|
|
122
|
+
export declare const defuOverrideArray: DefuFn;
|
|
123
123
|
/**
|
|
124
124
|
* @description 判断是否为非 null 的对象
|
|
125
125
|
*/
|
|
126
|
-
declare function isObject(x: unknown): x is Record<string | symbol | number, unknown>;
|
|
126
|
+
export declare function isObject(x: unknown): x is Record<string | symbol | number, unknown>;
|
|
127
127
|
/**
|
|
128
128
|
* @description 判断对象是否为空对象
|
|
129
129
|
*/
|
|
130
|
-
declare function isEmptyObject(obj: unknown): boolean;
|
|
130
|
+
export declare function isEmptyObject(obj: unknown): boolean;
|
|
131
131
|
//#endregion
|
|
132
|
-
export { MINI_PROGRAM_PLATFORM_ALIASES, MINI_PROGRAM_PLATFORM_DESCRIPTORS,
|
|
132
|
+
export { MINI_PROGRAM_PLATFORM_ALIASES, MINI_PROGRAM_PLATFORM_DESCRIPTORS, type MiniProgramPageIdentityRule, type MiniProgramPlatformDescriptor, type MiniProgramPlatformFamily, type MiniProgramRuntimeCapabilities, type MiniProgramRuntimeCapabilityName, type MiniProgramTemplatePreset, type MpPlatform, type OutputExtensions, defu, get, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramAppTypesPackage, getMiniProgramDefaultBuildTarget, getMiniProgramDirectivePrefix, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramPlatformDescriptor, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getMiniProgramTemplatePreset, getSupportedMiniProgramDirectivePrefixes, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, set, supportsMiniProgramAutoTouchAppStyle, supportsMiniProgramRuntimeCapability };
|
package/dist/node.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import { CopyOptions, FsDirent, FsStats, JsonReadOptions, JsonWriteOptions, Move
|
|
|
3
3
|
/**
|
|
4
4
|
* @description 生成稳定对象哈希,避免依赖已被禁用的 object-hash 包。
|
|
5
5
|
*/
|
|
6
|
-
declare function objectHash(value: unknown): string;
|
|
6
|
+
export declare function objectHash(value: unknown): string;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { type CopyOptions, type FsDirent, type FsStats, type JsonReadOptions, type JsonWriteOptions, type MoveOptions, fs
|
|
8
|
+
export { type CopyOptions, type FsDirent, type FsStats, type JsonReadOptions, type JsonWriteOptions, type MoveOptions, fs };
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.2.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "3.2.2",
|
|
5
|
+
"description": "Shared runtime-safe utilities and platform contracts for the weapp-vite ecosystem.",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/weapp-vite/weapp-vite#readme",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "git+https://github.com/weapp-vite/weapp-vite.git",
|
|
@@ -13,7 +14,15 @@
|
|
|
13
14
|
"bugs": {
|
|
14
15
|
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
15
16
|
},
|
|
16
|
-
"keywords": [
|
|
17
|
+
"keywords": [
|
|
18
|
+
"weapp-vite",
|
|
19
|
+
"weapp",
|
|
20
|
+
"wechat",
|
|
21
|
+
"mini-program",
|
|
22
|
+
"miniprogram",
|
|
23
|
+
"vite",
|
|
24
|
+
"runtime"
|
|
25
|
+
],
|
|
17
26
|
"sideEffects": false,
|
|
18
27
|
"weapp-vite-dev": {
|
|
19
28
|
"exports": {
|
|
@@ -65,6 +74,10 @@
|
|
|
65
74
|
"engines": {
|
|
66
75
|
"node": "^20.19.0 || >=22.12.0"
|
|
67
76
|
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public",
|
|
79
|
+
"registry": "https://registry.npmjs.org"
|
|
80
|
+
},
|
|
68
81
|
"scripts": {
|
|
69
82
|
"dev": "tsdown -w --sourcemap",
|
|
70
83
|
"build": "tsdown",
|