@weapp-core/shared 3.3.0 → 3.4.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/_virtual/_rolldown/runtime.js +1 -2
- package/dist/fs/index.d.ts +0 -2
- package/dist/fs/index.js +1 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -2
- package/dist/layoutHostRegistry.d.ts +1 -3
- package/dist/layoutHostRegistry.js +1 -2
- package/dist/node.d.ts +0 -2
- package/dist/node.js +1 -2
- package/dist/node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.d.ts +0 -2
- package/dist/node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.js +1 -2
- package/dist/node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js +1 -2
- package/dist/node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js +1 -2
- package/dist/node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js +1 -2
- package/dist/node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js +1 -2
- package/dist/platforms/descriptors.d.ts +1 -3
- package/dist/platforms/descriptors.js +1 -2
- package/dist/platforms/helpers.d.ts +0 -2
- package/dist/platforms/helpers.js +1 -2
- package/dist/platforms/runtime/descriptors.d.ts +1 -3
- package/dist/platforms/runtime/descriptors.js +1 -2
- package/dist/platforms/runtime/helpers.d.ts +1 -3
- package/dist/platforms/runtime/helpers.js +1 -2
- package/dist/platforms/runtime/template.d.ts +1 -3
- package/dist/platforms/runtime/template.js +1 -2
- package/dist/platforms/types.d.ts +1 -3
- package/dist/rich-text.d.ts +1 -3
- package/dist/rich-text.js +1 -2
- package/dist/runtimeProviders.d.ts +1 -3
- package/dist/wxml.d.ts +1 -3
- package/dist/wxml.js +1 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,5 +20,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
export { __commonJSMin, __toESM };
|
package/dist/fs/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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
|
-
//#region src/fs/index.d.ts
|
|
4
3
|
export interface JsonReadOptions {
|
|
5
4
|
encoding?: BufferEncoding;
|
|
6
5
|
throws?: boolean;
|
|
@@ -88,5 +87,4 @@ export declare const fs: {
|
|
|
88
87
|
};
|
|
89
88
|
export type FsDirent = Dirent;
|
|
90
89
|
export type FsStats = Stats;
|
|
91
|
-
//#endregion
|
|
92
90
|
export {};
|
package/dist/fs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dirent, Stats, close, closeSync, constants, existsSync, mkdirSync, openSync, promises, readFileSync, unlinkSync, utimesSync, watch, writeFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/fs/index.ts
|
|
4
4
|
function normalizeJsonEncoding(encoding) {
|
|
5
5
|
return encoding ?? "utf8";
|
|
6
6
|
}
|
|
@@ -194,5 +194,4 @@ const fs = {
|
|
|
194
194
|
writeJSON,
|
|
195
195
|
writeJson
|
|
196
196
|
};
|
|
197
|
-
//#endregion
|
|
198
197
|
export { fs };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { RuntimeProviderBackend, RuntimeProviderCapabilities, RuntimeProviderCom
|
|
|
9
9
|
import { escapeWxmlAttribute, escapeWxmlText } from "./wxml.js";
|
|
10
10
|
import get from "get-value";
|
|
11
11
|
import set from "set-value";
|
|
12
|
-
//#region src/index.d.ts
|
|
13
12
|
/**
|
|
14
13
|
* @description 转义字符串中的正则特殊字符
|
|
15
14
|
*/
|
|
@@ -42,5 +41,4 @@ export declare function isObject(x: unknown): x is Record<string | symbol | numb
|
|
|
42
41
|
* @description 判断对象是否为空对象
|
|
43
42
|
*/
|
|
44
43
|
export declare function isEmptyObject(obj: unknown): boolean;
|
|
45
|
-
//#endregion
|
|
46
44
|
export { MINI_PROGRAM_PLATFORM_ALIASES, MINI_PROGRAM_PLATFORM_DESCRIPTORS, MiniProgramLayoutHostResolver, MiniProgramLayoutHostWaitOptions, type MiniProgramPageIdentityRule, type MiniProgramPlatformDescriptor, type MiniProgramPlatformFamily, type MiniProgramRuntimeCapabilities, type MiniProgramRuntimeCapabilityName, type MiniProgramTemplatePreset, type MpPlatform, type OutputExtensions, RuntimeProviderBackend, RuntimeProviderCapabilities, RuntimeProviderCompilation, RuntimeProviderDescriptorContract, RuntimeProviderEntry, RuntimeProviderHmrDescriptor, RuntimeProviderHmrMode, RuntimeProviderInjectionMode, RuntimeProviderModuleKind, RuntimeProviderVariant, createMiniProgramLayoutHostRegistry, defu, escapeWxmlAttribute, escapeWxmlText, get, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramAppTypesPackage, getMiniProgramDefaultBuildTarget, getMiniProgramDirectivePrefix, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramPlatformDescriptor, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getMiniProgramTemplatePreset, getSupportedMiniProgramDirectivePrefixes, getSupportedMiniProgramPlatforms, normalizeMiniProgramLayoutHostKeys, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, set, supportsMiniProgramAutoTouchAppStyle, supportsMiniProgramRuntimeCapability };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getMiniProgramAppTypesPackage, getMiniProgramDefaultBuildTarget, getMin
|
|
|
8
8
|
import { escapeWxmlAttribute, escapeWxmlText } from "./wxml.js";
|
|
9
9
|
import { require_set_value } from "./node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js";
|
|
10
10
|
import get from "get-value";
|
|
11
|
-
|
|
11
|
+
// src/index.ts
|
|
12
12
|
var import_set_value = /* @__PURE__ */ __toESM(require_set_value(), 1);
|
|
13
13
|
const SPECIAL_CHARS_RE = /[|\\{}()[\]^$+*?.]/g;
|
|
14
14
|
const HYPHEN_RE = /-/g;
|
|
@@ -77,6 +77,5 @@ function isEmptyObject(obj) {
|
|
|
77
77
|
}
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
var set = import_set_value.default;
|
|
82
81
|
export { MINI_PROGRAM_PLATFORM_ALIASES, MINI_PROGRAM_PLATFORM_DESCRIPTORS, addExtension, arrify, createMiniProgramLayoutHostRegistry, defu, defuOverrideArray, escapeStringRegexp, escapeWxmlAttribute, escapeWxmlText, get, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramAppTypesPackage, getMiniProgramDefaultBuildTarget, getMiniProgramDirectivePrefix, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramPlatformDescriptor, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getMiniProgramTemplatePreset, getSupportedMiniProgramDirectivePrefixes, getSupportedMiniProgramPlatforms, isEmptyObject, isObject, normalizeMiniProgramLayoutHostKeys, normalizeMiniProgramPlatform, removeExtension, removeExtensionDeep, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, set, supportsMiniProgramAutoTouchAppStyle, supportsMiniProgramRuntimeCapability };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/layoutHostRegistry.d.ts
|
|
2
1
|
export interface MiniProgramLayoutHostWaitOptions {
|
|
3
2
|
interval?: number;
|
|
4
3
|
retries?: number;
|
|
@@ -18,5 +17,4 @@ export declare function createMiniProgramLayoutHostRegistry<TBridge>(): {
|
|
|
18
17
|
unregister: (keys: string | string[], bridge: TBridge, pageKeys: string[]) => boolean;
|
|
19
18
|
unregisterBridge: (bridge: TBridge) => boolean;
|
|
20
19
|
waitForHost: <THost>(key: string, resolvePageKeys: () => string[], resolver: MiniProgramLayoutHostResolver<TBridge, THost>, options?: MiniProgramLayoutHostWaitOptions) => Promise<THost | null>;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
20
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/layoutHostRegistry.ts
|
|
2
2
|
/**
|
|
3
3
|
* @description 对 layout host key 去重并过滤空字符串。
|
|
4
4
|
*/
|
|
@@ -75,5 +75,4 @@ function createMiniProgramLayoutHostRegistry() {
|
|
|
75
75
|
waitForHost
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
export { createMiniProgramLayoutHostRegistry, normalizeMiniProgramLayoutHostKeys };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { CopyOptions, FsDirent, FsStats, JsonReadOptions, JsonWriteOptions, MoveOptions, fs } from "./fs/index.js";
|
|
2
|
-
//#region src/node.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* @description 生成稳定对象哈希,避免依赖已被禁用的 object-hash 包。
|
|
5
4
|
*/
|
|
6
5
|
export declare function objectHash(value: unknown): string;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { type CopyOptions, type FsDirent, type FsStats, type JsonReadOptions, type JsonWriteOptions, type MoveOptions, fs };
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fs } from "./fs/index.js";
|
|
2
|
-
|
|
2
|
+
// src/node.ts
|
|
3
3
|
const UTF8_ENCODER = new TextEncoder();
|
|
4
4
|
const HASH_SEEDS = [
|
|
5
5
|
0,
|
|
@@ -57,5 +57,4 @@ function objectHash(value) {
|
|
|
57
57
|
const bytes = UTF8_ENCODER.encode(stableSerialize(value));
|
|
58
58
|
return HASH_SEEDS.map((seed) => xmur3(bytes, seed).toString(16).padStart(8, "0")).join("");
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { fs, objectHash };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.d.mts
|
|
2
1
|
type Input = Record<string | number | symbol, any>;
|
|
3
2
|
type IgnoredInput = boolean | number | null | any[] | Record<never, any> | undefined;
|
|
4
3
|
type Merger = <T extends Input, K extends keyof T>(object: T, key: keyof T, value: T[K], namespace: string) => any;
|
|
@@ -15,5 +14,4 @@ interface DefuInstance {
|
|
|
15
14
|
type MergeArrays<Destination, Source> = Destination extends Array<infer DestinationType> ? Source extends Array<infer SourceType> ? Array<DestinationType | SourceType> : Source | Array<DestinationType> : Source | Destination;
|
|
16
15
|
type Merge<Destination extends Input, Defaults extends Input> = Destination extends nullish ? Defaults extends nullish ? nullish : Defaults : Defaults extends nullish ? Destination : Destination extends Array<any> ? Defaults extends Array<any> ? MergeArrays<Destination, Defaults> : Destination | Defaults : Destination extends Function ? Destination | Defaults : Destination extends RegExp ? Destination | Defaults : Destination extends Promise<any> ? Destination | Defaults : Defaults extends Function ? Destination | Defaults : Defaults extends RegExp ? Destination | Defaults : Defaults extends Promise<any> ? Destination | Defaults : Destination extends Input ? Defaults extends Input ? MergeObjects<Destination, Defaults> : Destination | Defaults : Destination | Defaults;
|
|
17
16
|
declare const defu: DefuInstance;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { type Defu, type DefuFn, type DefuInstance, defu as default, defu };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
2
2
|
function isPlainObject(value) {
|
|
3
3
|
if (value === null || typeof value !== "object") return false;
|
|
4
4
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -25,5 +25,4 @@ function createDefu(merger) {
|
|
|
25
25
|
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
26
26
|
}
|
|
27
27
|
const defu = createDefu();
|
|
28
|
-
//#endregion
|
|
29
28
|
export { createDefu, defu as default, defu };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { require_isobject } from "../../../isobject@3.0.1/node_modules/isobject/index.js";
|
|
3
|
-
|
|
3
|
+
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
4
4
|
/*!
|
|
5
5
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
6
6
|
*
|
|
@@ -23,6 +23,5 @@ var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
23
23
|
return true;
|
|
24
24
|
};
|
|
25
25
|
}));
|
|
26
|
-
//#endregion
|
|
27
26
|
export default require_is_plain_object();
|
|
28
27
|
export { require_is_plain_object };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
3
3
|
/*!
|
|
4
4
|
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
5
5
|
*
|
|
@@ -12,6 +12,5 @@ var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12
12
|
return typeof val !== "function";
|
|
13
13
|
};
|
|
14
14
|
}));
|
|
15
|
-
//#endregion
|
|
16
15
|
export default require_is_primitive();
|
|
17
16
|
export { require_is_primitive };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
3
3
|
/*!
|
|
4
4
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
5
5
|
*
|
|
@@ -11,6 +11,5 @@ var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11
11
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
12
12
|
};
|
|
13
13
|
}));
|
|
14
|
-
//#endregion
|
|
15
14
|
export default require_isobject();
|
|
16
15
|
export { require_isobject };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { require_is_primitive } from "../../../is-primitive@3.0.1/node_modules/is-primitive/index.js";
|
|
3
3
|
import { require_is_plain_object } from "../../../is-plain-object@2.0.4/node_modules/is-plain-object/index.js";
|
|
4
|
-
|
|
4
|
+
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
5
5
|
/*!
|
|
6
6
|
* set-value <https://github.com/jonschlinkert/set-value>
|
|
7
7
|
*
|
|
@@ -113,6 +113,5 @@ var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
113
113
|
};
|
|
114
114
|
module.exports = setValue;
|
|
115
115
|
}));
|
|
116
|
-
//#endregion
|
|
117
116
|
export default require_set_value();
|
|
118
117
|
export { require_set_value };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { MiniProgramPlatformDescriptor } from "./types.js";
|
|
2
|
-
//#region src/platforms/descriptors.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* @description 全仓库统一的小程序平台描述表。
|
|
5
4
|
*/
|
|
6
|
-
export declare const MINI_PROGRAM_PLATFORM_DESCRIPTORS: readonly MiniProgramPlatformDescriptor[];
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare const MINI_PROGRAM_PLATFORM_DESCRIPTORS: readonly MiniProgramPlatformDescriptor[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ALIPAY_RUNTIME_DESCRIPTOR, JD_RUNTIME_DESCRIPTOR, SWAN_RUNTIME_DESCRIPTOR, TT_RUNTIME_DESCRIPTOR, WEAPP_RUNTIME_DESCRIPTOR, XHS_RUNTIME_DESCRIPTOR } from "./runtime/descriptors.js";
|
|
2
2
|
import { MINI_PROGRAM_DIRECTIVE_PREFIXES } from "./runtime/template.js";
|
|
3
|
-
|
|
3
|
+
// src/platforms/descriptors.ts
|
|
4
4
|
const DEFAULT_PROJECT_CONFIG_ROOT_KEYS = ["miniprogramRoot", "srcMiniprogramRoot"];
|
|
5
5
|
/**
|
|
6
6
|
* @description 全仓库统一的小程序平台描述表。
|
|
@@ -200,5 +200,4 @@ const MINI_PROGRAM_PLATFORM_DESCRIPTORS = [
|
|
|
200
200
|
runtime: XHS_RUNTIME_DESCRIPTOR.runtime
|
|
201
201
|
}
|
|
202
202
|
];
|
|
203
|
-
//#endregion
|
|
204
203
|
export { MINI_PROGRAM_PLATFORM_DESCRIPTORS };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MiniProgramPlatformDescriptor, MiniProgramTemplatePreset, MpPlatform } from "./types.js";
|
|
2
2
|
import { MINI_PROGRAM_PLATFORM_ALIASES, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeDescriptor, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramRuntimeCapability } from "./runtime/helpers.js";
|
|
3
3
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramDirectivePrefixes } from "./runtime/template.js";
|
|
4
|
-
//#region src/platforms/helpers.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* @description 获取平台描述。
|
|
7
6
|
*/
|
|
@@ -22,5 +21,4 @@ export declare function getMiniProgramDefaultBuildTarget(platform?: MpPlatform):
|
|
|
22
21
|
* @description 获取平台默认使用的类型包。
|
|
23
22
|
*/
|
|
24
23
|
export declare function getMiniProgramAppTypesPackage(platform?: MpPlatform): string;
|
|
25
|
-
//#endregion
|
|
26
24
|
export { MINI_PROGRAM_PLATFORM_ALIASES, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramDirectivePrefix, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeDescriptor, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getSupportedMiniProgramDirectivePrefixes, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramRuntimeCapability };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramDirectivePrefixes } from "./runtime/template.js";
|
|
2
2
|
import { MINI_PROGRAM_PLATFORM_DESCRIPTORS } from "./descriptors.js";
|
|
3
3
|
import { MINI_PROGRAM_PLATFORM_ALIASES, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeDescriptor, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramRuntimeCapability } from "./runtime/helpers.js";
|
|
4
|
-
|
|
4
|
+
// src/platforms/helpers.ts
|
|
5
5
|
const MINI_PROGRAM_PLATFORM_DESCRIPTOR_BY_ID = new Map(MINI_PROGRAM_PLATFORM_DESCRIPTORS.map((descriptor) => [descriptor.id, descriptor]));
|
|
6
6
|
/**
|
|
7
7
|
* @description 获取平台描述。
|
|
@@ -38,5 +38,4 @@ function getMiniProgramDefaultBuildTarget(platform) {
|
|
|
38
38
|
function getMiniProgramAppTypesPackage(platform) {
|
|
39
39
|
return getMiniProgramPlatformDescriptor(platform ?? getDefaultMiniProgramPlatform()).typescript?.appTypesPackage ?? "miniprogram-api-typings";
|
|
40
40
|
}
|
|
41
|
-
//#endregion
|
|
42
41
|
export { MINI_PROGRAM_PLATFORM_ALIASES, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramAppTypesPackage, getMiniProgramDefaultBuildTarget, getMiniProgramDirectivePrefix, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramPlatformDescriptor, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeDescriptor, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getMiniProgramTemplatePreset, getSupportedMiniProgramDirectivePrefixes, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramAutoTouchAppStyle, supportsMiniProgramRuntimeCapability };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MiniProgramPlatformDescriptor, MiniProgramRuntimeCapabilities } from "../types.js";
|
|
2
|
-
//#region src/platforms/runtime/descriptors.d.ts
|
|
3
2
|
export type MiniProgramRuntimeDescriptor = Pick<MiniProgramPlatformDescriptor, 'id' | 'aliases' | 'runtime'>;
|
|
4
3
|
export declare const DEFAULT_RUNTIME_HOST_CONFIG_KEY = "__wxConfig";
|
|
5
4
|
export declare const DEFAULT_RUNTIME_CAPABILITIES: MiniProgramRuntimeCapabilities;
|
|
@@ -9,5 +8,4 @@ export declare const SWAN_RUNTIME_DESCRIPTOR: MiniProgramRuntimeDescriptor;
|
|
|
9
8
|
export declare const TT_RUNTIME_DESCRIPTOR: MiniProgramRuntimeDescriptor;
|
|
10
9
|
export declare const JD_RUNTIME_DESCRIPTOR: MiniProgramRuntimeDescriptor;
|
|
11
10
|
export declare const XHS_RUNTIME_DESCRIPTOR: MiniProgramRuntimeDescriptor;
|
|
12
|
-
export declare const MINI_PROGRAM_RUNTIME_DESCRIPTORS: readonly MiniProgramRuntimeDescriptor[];
|
|
13
|
-
//#endregion
|
|
11
|
+
export declare const MINI_PROGRAM_RUNTIME_DESCRIPTORS: readonly MiniProgramRuntimeDescriptor[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/platforms/runtime/descriptors.ts
|
|
2
2
|
const DEFAULT_RUNTIME_HOST_CONFIG_KEY = "__wxConfig";
|
|
3
3
|
const DEFAULT_RUNTIME_CAPABILITIES = Object.freeze({
|
|
4
4
|
globalPageStack: true,
|
|
@@ -137,5 +137,4 @@ const MINI_PROGRAM_RUNTIME_DESCRIPTORS = [
|
|
|
137
137
|
JD_RUNTIME_DESCRIPTOR,
|
|
138
138
|
XHS_RUNTIME_DESCRIPTOR
|
|
139
139
|
];
|
|
140
|
-
//#endregion
|
|
141
140
|
export { ALIPAY_RUNTIME_DESCRIPTOR, DEFAULT_RUNTIME_CAPABILITIES, DEFAULT_RUNTIME_HOST_CONFIG_KEY, JD_RUNTIME_DESCRIPTOR, MINI_PROGRAM_RUNTIME_DESCRIPTORS, SWAN_RUNTIME_DESCRIPTOR, TT_RUNTIME_DESCRIPTOR, WEAPP_RUNTIME_DESCRIPTOR, XHS_RUNTIME_DESCRIPTOR };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MiniProgramRuntimeCapabilities, MiniProgramRuntimeCapabilityName, MpPlatform } from "../types.js";
|
|
2
2
|
import { MiniProgramRuntimeDescriptor } from "./descriptors.js";
|
|
3
|
-
//#region src/platforms/runtime/helpers.d.ts
|
|
4
3
|
export declare const MINI_PROGRAM_PLATFORM_ALIASES: Readonly<Record<string, MpPlatform>>;
|
|
5
4
|
/**
|
|
6
5
|
* @description 标准化平台输入。
|
|
@@ -61,5 +60,4 @@ export declare function supportsMiniProgramRuntimeCapability(platform: MpPlatfor
|
|
|
61
60
|
/**
|
|
62
61
|
* @description 根据平台描述解析页面身份 key。
|
|
63
62
|
*/
|
|
64
|
-
export declare function resolveMiniProgramPageKeys(page?: Record<string, any>, platform?: MpPlatform): string[];
|
|
65
|
-
//#endregion
|
|
63
|
+
export declare function resolveMiniProgramPageKeys(page?: Record<string, any>, platform?: MpPlatform): string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_RUNTIME_CAPABILITIES, MINI_PROGRAM_RUNTIME_DESCRIPTORS } from "./descriptors.js";
|
|
2
|
-
|
|
2
|
+
// src/platforms/runtime/helpers.ts
|
|
3
3
|
const LEADING_SLASH_RE = /^\/+/;
|
|
4
4
|
function createMiniProgramPlatformRegistry(descriptors) {
|
|
5
5
|
const descriptorById = /* @__PURE__ */ new Map();
|
|
@@ -165,5 +165,4 @@ function resolveMiniProgramPageKeys(page, platform) {
|
|
|
165
165
|
}
|
|
166
166
|
return Array.from(new Set(keys));
|
|
167
167
|
}
|
|
168
|
-
//#endregion
|
|
169
168
|
export { MINI_PROGRAM_PLATFORM_ALIASES, getDefaultMiniProgramPlatform, getDefaultMiniProgramRuntimeGlobalKey, getMiniProgramPlatformByRuntimeGlobalKey, getMiniProgramRouteRuntimeGlobalKeys, getMiniProgramRuntimeCapabilities, getMiniProgramRuntimeDescriptor, getMiniProgramRuntimeGlobalKey, getMiniProgramRuntimeGlobalKeys, getMiniProgramRuntimeGlobalKeysByResolvePriority, getMiniProgramRuntimeHostConfigKey, getSupportedMiniProgramPlatforms, normalizeMiniProgramPlatform, resolveMiniProgramPageKeys, resolveMiniProgramPlatform, supportsMiniProgramRuntimeCapability };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { MpPlatform } from "../types.js";
|
|
2
|
-
//#region src/platforms/runtime/template.d.ts
|
|
3
2
|
/** 返回所有受支持的小程序模板指令前缀。 */
|
|
4
3
|
export declare function getSupportedMiniProgramDirectivePrefixes(): readonly string[];
|
|
5
4
|
/** 获取平台模板指令前缀,兼容未指定平台时的微信默认值。 */
|
|
6
|
-
export declare function getMiniProgramDirectivePrefix(platform?: MpPlatform): string;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function getMiniProgramDirectivePrefix(platform?: MpPlatform): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/platforms/runtime/template.ts
|
|
2
2
|
const MINI_PROGRAM_DIRECTIVE_PREFIXES = Object.freeze({
|
|
3
3
|
weapp: "wx",
|
|
4
4
|
alipay: "a",
|
|
@@ -18,5 +18,4 @@ function getMiniProgramDirectivePrefix(platform) {
|
|
|
18
18
|
if (!prefix) throw new Error(`不支持的小程序平台 "${platform}"。`);
|
|
19
19
|
return prefix;
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { MINI_PROGRAM_DIRECTIVE_PREFIXES, getMiniProgramDirectivePrefix, getSupportedMiniProgramDirectivePrefixes };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/platforms/types.d.ts
|
|
2
1
|
export type MpPlatform = 'weapp' | 'alipay' | 'tt' | 'swan' | 'jd' | 'xhs';
|
|
3
2
|
export type MiniProgramTemplatePreset = 'wechat' | 'alipay' | 'tt' | 'swan';
|
|
4
3
|
export type MiniProgramPlatformFamily = 'wechat' | 'alipay' | 'tt' | 'swan';
|
|
@@ -209,5 +208,4 @@ export interface MiniProgramPlatformDescriptor {
|
|
|
209
208
|
pageIdentityRules: readonly MiniProgramPageIdentityRule[];
|
|
210
209
|
capabilities: MiniProgramRuntimeCapabilities;
|
|
211
210
|
};
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
211
|
+
}
|
package/dist/rich-text.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/rich-text.d.ts
|
|
2
1
|
export interface RichTextSourceNode {
|
|
3
2
|
type?: string;
|
|
4
3
|
name?: string;
|
|
@@ -17,5 +16,4 @@ export type SafeRichTextNode = {
|
|
|
17
16
|
};
|
|
18
17
|
export declare function sanitizeRichTextStyle(value: unknown): string;
|
|
19
18
|
export declare function sanitizeRichTextAttributes(value: unknown, tagName: string): Record<string, string>;
|
|
20
|
-
export declare function normalizeRichTextNodes(value: unknown): SafeRichTextNode[];
|
|
21
|
-
//#endregion
|
|
19
|
+
export declare function normalizeRichTextNodes(value: unknown): SafeRichTextNode[];
|
package/dist/rich-text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseDocument } from "htmlparser2";
|
|
2
|
-
|
|
2
|
+
// src/rich-text.ts
|
|
3
3
|
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
4
4
|
"a",
|
|
5
5
|
"abbr",
|
|
@@ -223,5 +223,4 @@ function normalizeRichTextNodes(value) {
|
|
|
223
223
|
}).children.flatMap(convertParsedNode);
|
|
224
224
|
return (Array.isArray(value) ? value : [value]).flatMap(convertSourceNode);
|
|
225
225
|
}
|
|
226
|
-
//#endregion
|
|
227
226
|
export { normalizeRichTextNodes, sanitizeRichTextAttributes, sanitizeRichTextStyle };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/runtimeProviders.d.ts
|
|
2
1
|
export type RuntimeProviderBackend = 'miniprogram' | 'web';
|
|
3
2
|
export type RuntimeProviderCompilation = 'native' | 'vue' | 'web';
|
|
4
3
|
export type RuntimeProviderModuleKind = 'runtime' | 'reactivity' | 'template';
|
|
@@ -40,5 +39,4 @@ export interface RuntimeProviderDescriptorContract {
|
|
|
40
39
|
capabilities: Readonly<RuntimeProviderCapabilities>;
|
|
41
40
|
hmr: Readonly<RuntimeProviderHmrDescriptor>;
|
|
42
41
|
contractVersion: number;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
42
|
+
}
|
package/dist/wxml.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/wxml.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* @description 按 exparser 与 glass-easel 的共同规则序列化 WXML 静态文本。
|
|
4
3
|
*/
|
|
@@ -6,5 +5,4 @@ export declare function escapeWxmlText(value: string): string;
|
|
|
6
5
|
/**
|
|
7
6
|
* @description 按 exparser 与 glass-easel 的共同规则序列化双引号 WXML 属性值。
|
|
8
7
|
*/
|
|
9
|
-
export declare function escapeWxmlAttribute(value: string): string;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function escapeWxmlAttribute(value: string): string;
|
package/dist/wxml.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/wxml.ts
|
|
2
2
|
const WXML_TEXT_ESCAPE_RE = /[&<>]/g;
|
|
3
3
|
const WXML_ATTRIBUTE_ESCAPE_RE = /[&"<]/g;
|
|
4
4
|
const WXML_TEXT_ESCAPE_MAP = {
|
|
@@ -22,5 +22,4 @@ function escapeWxmlText(value) {
|
|
|
22
22
|
function escapeWxmlAttribute(value) {
|
|
23
23
|
return value.replace(WXML_ATTRIBUTE_ESCAPE_RE, (char) => WXML_ATTRIBUTE_ESCAPE_MAP[char] ?? char);
|
|
24
24
|
}
|
|
25
|
-
//#endregion
|
|
26
25
|
export { escapeWxmlAttribute, escapeWxmlText };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
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",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"dist"
|
|
95
95
|
],
|
|
96
96
|
"engines": {
|
|
97
|
-
"node": "^
|
|
97
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@types/set-value": "^4.0.3",
|