@mptool/all 0.6.3 → 0.7.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/lib/index.d.mts +155 -122
- package/lib/index.d.ts +155 -122
- package/lib/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +7 -7
- package/lib/index.mjs.map +1 -1
- package/package.json +5 -8
package/lib/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ declare const isMp: boolean;
|
|
|
8
8
|
type EventType = string | symbol;
|
|
9
9
|
type Handler<T = unknown> = (event: T) => void | Promise<void>;
|
|
10
10
|
type WildcardHandler<T = Record<string, unknown>> = (type: keyof T, event: T[keyof T]) => void | Promise<void>;
|
|
11
|
-
type EventHandlerList<T = unknown> =
|
|
12
|
-
type WildCardEventHandlerList<T = Record<string, unknown>> =
|
|
13
|
-
type EventHandlerMap<Events
|
|
14
|
-
interface EmitterInstance<Events
|
|
11
|
+
type EventHandlerList<T = unknown> = Handler<T>[];
|
|
12
|
+
type WildCardEventHandlerList<T = Record<string, unknown>> = WildcardHandler<T>[];
|
|
13
|
+
type EventHandlerMap<Events> = Map<keyof Events | "*", EventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>>;
|
|
14
|
+
interface EmitterInstance<Events> {
|
|
15
15
|
all: EventHandlerMap<Events>;
|
|
16
16
|
on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;
|
|
17
17
|
on(type: "*", handler: WildcardHandler<Events>): void;
|
|
@@ -27,7 +27,7 @@ interface EmitterInstance<Events extends Record<EventType, unknown>> {
|
|
|
27
27
|
* @name emitter
|
|
28
28
|
* @returns Emitter
|
|
29
29
|
*/
|
|
30
|
-
declare function Emitter<Events
|
|
30
|
+
declare function Emitter<Events>(all?: EventHandlerMap<Events>): EmitterInstance<Events>;
|
|
31
31
|
|
|
32
32
|
/** 写入普通日志 */
|
|
33
33
|
declare const debug: (...args: any[]) => void;
|
|
@@ -97,6 +97,7 @@ declare namespace query {
|
|
|
97
97
|
* @returns 对象的类型
|
|
98
98
|
*/
|
|
99
99
|
declare const type: (obj: unknown) => string;
|
|
100
|
+
declare const isFunction: <T extends Function>(obj: unknown) => obj is T;
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* 包装函数,先执行 wrapper ,然后执行原函数
|
|
@@ -145,7 +146,7 @@ declare function wrapFunction<T>(original: ((this: T, ...args: any[]) => Promise
|
|
|
145
146
|
* }, 15);
|
|
146
147
|
* ```
|
|
147
148
|
*/
|
|
148
|
-
declare const lock: <T, A extends unknown[], R>(fn: (this: T, release: () => void, ...args: A) => R, ctx?: T
|
|
149
|
+
declare const lock: <T, A extends unknown[], R>(fn: (this: T, release: () => void, ...args: A) => R, ctx?: T) => ((this: T, ...args: A) => R | undefined);
|
|
149
150
|
/**
|
|
150
151
|
* 包装函数保证其之被调用一次
|
|
151
152
|
*
|
|
@@ -163,7 +164,7 @@ declare const lock: <T, A extends unknown[], R>(fn: (this: T, release: () => voi
|
|
|
163
164
|
* counter(); // count is still 1
|
|
164
165
|
* ```
|
|
165
166
|
*/
|
|
166
|
-
declare const once: <T, A extends unknown[], R>(func: (...args: A) => R, ctx?: T
|
|
167
|
+
declare const once: <T, A extends unknown[], R>(func: (...args: A) => R, ctx?: T) => ((this: T, ...args: A) => R | undefined);
|
|
167
168
|
interface Task<ArgType extends unknown[] = unknown[], This = unknown> {
|
|
168
169
|
/** 函数本身 */
|
|
169
170
|
func: (this: This, next: () => void, ...args: ArgType) => void;
|
|
@@ -182,7 +183,7 @@ declare class Queue {
|
|
|
182
183
|
/** 允许同时并行的任务数 */
|
|
183
184
|
capacity?: number);
|
|
184
185
|
/** 回调队列 */
|
|
185
|
-
funcQueue: Task
|
|
186
|
+
funcQueue: Task[];
|
|
186
187
|
/** 正在运行的数量 */
|
|
187
188
|
running: number;
|
|
188
189
|
/** 执行下一个函数 */
|
|
@@ -193,7 +194,7 @@ declare class Queue {
|
|
|
193
194
|
* @param ctx 函数运行上下文
|
|
194
195
|
* @param args 函数参数
|
|
195
196
|
*/
|
|
196
|
-
add<A extends
|
|
197
|
+
add<A extends any[], T>(func: (next: () => void, ...args: A) => void, ctx?: T, ...args: A): void;
|
|
197
198
|
/** 清除队列,不再执行尚未执行的函数 */
|
|
198
199
|
clear(): void;
|
|
199
200
|
}
|
|
@@ -206,7 +207,7 @@ declare class Queue {
|
|
|
206
207
|
* @returns 包装过的函数
|
|
207
208
|
* @async
|
|
208
209
|
*/
|
|
209
|
-
declare const funcQueue: <A extends unknown[], T = unknown>(fn: (next: () => void, ...args: A) => void, capacity?: number) => (this: T, ...args: A) => void;
|
|
210
|
+
declare const funcQueue: <A extends unknown[], T = unknown>(fn: (next: () => void, ...args: A) => void, capacity?: number) => ((this: T, ...args: A) => void);
|
|
210
211
|
|
|
211
212
|
type Props = Record<string, unknown>;
|
|
212
213
|
type PropsOptions<Property = Props> = {
|
|
@@ -230,12 +231,9 @@ type PropMethod<Type, TypeConstructor = any> = Type extends (...args: any) => an
|
|
|
230
231
|
(): Type;
|
|
231
232
|
readonly prototype: TypeConstructor;
|
|
232
233
|
} : never;
|
|
233
|
-
type PropConstructor<Type = any> = {
|
|
234
|
-
new (...args: any[]): Type & {};
|
|
235
|
-
} | {
|
|
236
|
-
(): Type;
|
|
237
|
-
} | PropMethod<Type>;
|
|
234
|
+
type PropConstructor<Type = any> = (new (...args: any[]) => Type & {}) | (() => Type) | PropMethod<Type>;
|
|
238
235
|
type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
|
|
236
|
+
type InferFromType<Type> = [Type] extends [null] ? any : [Type] extends [ArrayConstructor] ? any[] : [Type] extends [ObjectConstructor] ? WechatMiniprogram.IAnyObject : [Type] extends [BooleanConstructor] ? boolean : [Type] extends [PropConstructor<infer V>] ? unknown extends V ? any : V : Type;
|
|
239
237
|
type RequiredKeys<T> = {
|
|
240
238
|
[K in keyof T]: T[K] extends {
|
|
241
239
|
required: true;
|
|
@@ -361,23 +359,22 @@ interface ExtendedComponentMethods extends InstanceEmitterMethods {
|
|
|
361
359
|
*/
|
|
362
360
|
_$attached(parent: TrivialComponentInstance | TrivialPageInstance): void;
|
|
363
361
|
}
|
|
364
|
-
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption,
|
|
362
|
+
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends Partial<WechatMiniprogram.Component.MethodOption>, InstanceProps extends WechatMiniprogram.IAnyObject = {}, IsPage extends boolean = false> = WechatMiniprogram.Component.InstanceProperties & WechatMiniprogram.Component.InstanceMethods<Data> & ExtendedComponentMethods & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : {}) & InstanceProps & ExtendedComponentProperty & ExtendedPageMethods<Data & InferPropTypes<Props>, InstanceProps & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : {})> & {
|
|
365
363
|
/** 组件数据,**包括内部数据和属性值** */
|
|
366
|
-
data: Data & InferPropTypes<
|
|
364
|
+
data: Data & InferPropTypes<Props>;
|
|
367
365
|
/** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */
|
|
368
|
-
properties: Data & InferPropTypes<
|
|
366
|
+
properties: Data & InferPropTypes<Props>;
|
|
369
367
|
};
|
|
370
|
-
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption,
|
|
368
|
+
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = {}, IsPage extends boolean = false> = Partial<WechatMiniprogram.Component.Data<Data>> & Partial<{
|
|
371
369
|
/** 组件属性 */
|
|
372
|
-
|
|
373
|
-
}> & Partial<WechatMiniprogram.Component.Method<Method, IsPage>> & Partial<WechatMiniprogram.Component.OtherOption> & Partial<ComponentLifetimes> & ThisType<ComponentInstance<Data,
|
|
374
|
-
|
|
375
|
-
<Data extends WechatMiniprogram.Component.DataOption, Property extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, CustomInstanceProperty extends WechatMiniprogram.IAnyObject = {}, IsPage extends boolean = false>(options: ComponentOptions<Data, Property, Method, CustomInstanceProperty, IsPage>): string;
|
|
376
|
-
}
|
|
370
|
+
props: Props;
|
|
371
|
+
}> & Partial<WechatMiniprogram.Component.Method<Method, IsPage>> & Partial<WechatMiniprogram.Component.OtherOption> & Partial<ComponentLifetimes> & ThisType<ComponentInstance<Data, Props, Method, InstanceProps, IsPage>>;
|
|
372
|
+
type ComponentConstructor = <Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = {}, IsPage extends boolean = false>(options: ComponentOptions<Data, Props, Method, InstanceProps, IsPage>) => string;
|
|
377
373
|
type TrivialComponentInstance = ComponentInstance<WechatMiniprogram.IAnyObject, Record<string, null>, Record<string, (...args: unknown[]) => any>>;
|
|
378
374
|
type TrivialComponentOptions = ComponentInstance<WechatMiniprogram.IAnyObject, Record<string, null>, Record<string, (...args: any[]) => any>>;
|
|
379
375
|
type RefMap = Record<string, TrivialComponentInstance>;
|
|
380
376
|
|
|
377
|
+
declare const handleProperties: (oldProps?: PropsOptions) => WechatMiniprogram.Component.PropertyOption;
|
|
381
378
|
/**
|
|
382
379
|
* 组件注册器
|
|
383
380
|
*
|
|
@@ -385,6 +382,10 @@ type RefMap = Record<string, TrivialComponentInstance>;
|
|
|
385
382
|
*/
|
|
386
383
|
declare const $Component: ComponentConstructor;
|
|
387
384
|
|
|
385
|
+
declare const getRef: (id: number) => TrivialComponentInstance;
|
|
386
|
+
declare const setRef: (id: number, value: TrivialComponentInstance) => void;
|
|
387
|
+
declare const removeRef: (id: number) => void;
|
|
388
|
+
|
|
388
389
|
declare function bind(this: TrivialComponentInstance, touchEvent: WechatMiniprogram.Touch<{
|
|
389
390
|
id: number;
|
|
390
391
|
event: string;
|
|
@@ -571,9 +572,7 @@ interface NavigatorMethods {
|
|
|
571
572
|
$bindBack(): Promise<void> | void;
|
|
572
573
|
}
|
|
573
574
|
|
|
574
|
-
|
|
575
|
-
[props: string]: string;
|
|
576
|
-
}
|
|
575
|
+
type PageQuery = Record<string, string>;
|
|
577
576
|
interface PageState {
|
|
578
577
|
/** 是否是打开的第一个页面 */
|
|
579
578
|
firstOpen: boolean;
|
|
@@ -666,9 +665,7 @@ type PageInstance<Data extends WechatMiniprogram.IAnyObject, Custom extends Wech
|
|
|
666
665
|
type PageOptions<Data extends WechatMiniprogram.IAnyObject, Custom extends WechatMiniprogram.IAnyObject> = (Custom & Partial<WechatMiniprogram.Page.Data<Data>> & Partial<WechatMiniprogram.Page.ILifetime & ExtendedPageLifeCycles> & Partial<ExtendedPageProperties> & {
|
|
667
666
|
options?: WechatMiniprogram.Component.ComponentOptions;
|
|
668
667
|
}) & ThisType<PageInstance<Data, Custom>>;
|
|
669
|
-
|
|
670
|
-
<Data extends WechatMiniprogram.IAnyObject, Custom extends WechatMiniprogram.IAnyObject>(name: string, options: PageOptions<Data, Custom>): void;
|
|
671
|
-
}
|
|
668
|
+
type PageConstructor = <Data extends WechatMiniprogram.IAnyObject, Custom extends WechatMiniprogram.IAnyObject>(name: string, options: PageOptions<Data, Custom>) => void;
|
|
672
669
|
type TrivialPageInstance = PageInstance<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>;
|
|
673
670
|
type TrivialPageOptions = PageOptions<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject>;
|
|
674
671
|
|
|
@@ -740,10 +737,16 @@ interface ExtendsAppOptions {
|
|
|
740
737
|
type ExtendedAppMethods = InstanceEmitterMethods;
|
|
741
738
|
type AppOptions<Custom> = ExtendsAppOptions & Partial<WechatMiniprogram.App.Option> & Custom & Partial<ExtendedAppMethods> & ThisType<AppInstance<Custom>>;
|
|
742
739
|
type AppInstance<Custom> = AppOptions<Custom> & Custom & ExtendedAppMethods;
|
|
743
|
-
|
|
744
|
-
<Custom extends WechatMiniprogram.IAnyObject>(appOptions: AppOptions<Custom>): void;
|
|
745
|
-
}
|
|
740
|
+
type AppConstructor = <Custom extends WechatMiniprogram.IAnyObject>(appOptions: AppOptions<Custom>) => void;
|
|
746
741
|
|
|
742
|
+
declare const appState: {
|
|
743
|
+
/** 是否已启动 */
|
|
744
|
+
launch: boolean;
|
|
745
|
+
/** 启动参数 */
|
|
746
|
+
lOpt: {};
|
|
747
|
+
/** 切入后台时的时间戳 */
|
|
748
|
+
hide: number;
|
|
749
|
+
};
|
|
747
750
|
/**
|
|
748
751
|
* Application wrapper
|
|
749
752
|
*
|
|
@@ -751,18 +754,59 @@ interface AppConstructor {
|
|
|
751
754
|
*/
|
|
752
755
|
declare const $App: AppConstructor;
|
|
753
756
|
|
|
754
|
-
interface
|
|
757
|
+
interface AppConfigCommonOptions {
|
|
755
758
|
/**
|
|
756
|
-
*
|
|
759
|
+
* 主页页面名称或路径
|
|
760
|
+
*/
|
|
761
|
+
home?: string;
|
|
762
|
+
/**
|
|
763
|
+
* 跳转延迟执行的最长时间,单位 ms
|
|
757
764
|
*
|
|
758
|
-
*
|
|
765
|
+
* @description 异步 onNavigate 方法用时过久会直接调转
|
|
759
766
|
*
|
|
760
|
-
*
|
|
767
|
+
* @default 200
|
|
768
|
+
*/
|
|
769
|
+
maxDelay?: number;
|
|
770
|
+
/**
|
|
771
|
+
* 允许进行跳转据页面首屏渲染后的最小间隔时间,单位 ms
|
|
761
772
|
*
|
|
762
|
-
*
|
|
763
|
-
* - `user': '/pages/user/user`
|
|
773
|
+
* @default 100
|
|
764
774
|
*/
|
|
765
|
-
|
|
775
|
+
minInterval?: number;
|
|
776
|
+
/**
|
|
777
|
+
* 自定义扩展组件
|
|
778
|
+
*
|
|
779
|
+
* 时机在框架执行扩展之前,可为每个组件挂载实例方法
|
|
780
|
+
*
|
|
781
|
+
* @param options 组件选项
|
|
782
|
+
*/
|
|
783
|
+
extendComponent?(options: TrivialComponentOptions): void;
|
|
784
|
+
/**
|
|
785
|
+
* 自定义注入组件
|
|
786
|
+
*
|
|
787
|
+
* 时机在框架执行扩展之后,这意味着你可以覆盖框架的方法
|
|
788
|
+
*
|
|
789
|
+
* @param options 组件选项
|
|
790
|
+
*/
|
|
791
|
+
injectComponent?(options: TrivialComponentOptions): void;
|
|
792
|
+
/**
|
|
793
|
+
* 自定义扩展页面,在框架执行扩展之前
|
|
794
|
+
*
|
|
795
|
+
* @param name 页面名称
|
|
796
|
+
* @param options 页面选项
|
|
797
|
+
*/
|
|
798
|
+
extendPage?(name: string, options: TrivialPageOptions): void;
|
|
799
|
+
/**
|
|
800
|
+
* 自定义注入页面
|
|
801
|
+
*
|
|
802
|
+
* 在框架执行扩展之后,这意味着你可以覆盖框架的方法
|
|
803
|
+
*
|
|
804
|
+
* @param name 页面名称
|
|
805
|
+
* @param options 页面选项
|
|
806
|
+
*/
|
|
807
|
+
injectPage?(name: string, options: TrivialPageOptions): void;
|
|
808
|
+
}
|
|
809
|
+
interface RoutePathConfig {
|
|
766
810
|
/**
|
|
767
811
|
* 你可以直接以对象形式表示简称到路径的映射。如:
|
|
768
812
|
*
|
|
@@ -810,58 +854,47 @@ interface AppConfig {
|
|
|
810
854
|
*/
|
|
811
855
|
routes?: Record<string, string> | [string | string[], string][];
|
|
812
856
|
/**
|
|
813
|
-
*
|
|
814
|
-
*/
|
|
815
|
-
home?: string;
|
|
816
|
-
/**
|
|
817
|
-
* 跳转延迟执行的最长时间,单位 ms
|
|
857
|
+
* 当你给出的页面路径或简称无法通过 routeMap 解析时,会回退到此路径
|
|
818
858
|
*
|
|
819
|
-
*
|
|
859
|
+
* 填入小程序路径模式,小程序路径模式是一个路径字符串,用 `$name` 表示小程序简称的位置
|
|
820
860
|
*
|
|
821
|
-
*
|
|
822
|
-
*/
|
|
823
|
-
maxDelay?: number;
|
|
824
|
-
/**
|
|
825
|
-
* 允许进行跳转据页面首屏渲染后的最小间隔时间,单位 ms
|
|
861
|
+
* 例子: 你可以填入 `/pages/$name/$name` 来表达:
|
|
826
862
|
*
|
|
827
|
-
*
|
|
863
|
+
* - `main': '/pages/main/main`
|
|
864
|
+
* - `user': '/pages/user/user`
|
|
828
865
|
*/
|
|
829
|
-
|
|
866
|
+
defaultRoute: string;
|
|
867
|
+
}
|
|
868
|
+
interface RouteCustomConfig {
|
|
830
869
|
/**
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
* 时机在框架执行扩展之前,可为每个组件挂载实例方法
|
|
870
|
+
* 获得页面简称
|
|
834
871
|
*
|
|
835
|
-
* @param
|
|
872
|
+
* @param url 页面路径
|
|
873
|
+
* @returns 页面名称
|
|
836
874
|
*/
|
|
837
|
-
|
|
875
|
+
getName: (url: string) => string;
|
|
838
876
|
/**
|
|
839
|
-
*
|
|
840
|
-
*
|
|
841
|
-
* 时机在框架执行扩展之后,这意味着你可以覆盖框架的方法
|
|
877
|
+
* 获得页面路径
|
|
842
878
|
*
|
|
843
|
-
* @param
|
|
879
|
+
* @param pageName 页面简称
|
|
880
|
+
* @returns 页面路径
|
|
844
881
|
*/
|
|
845
|
-
|
|
882
|
+
getRoute: (pageName: string) => string;
|
|
883
|
+
}
|
|
884
|
+
type AppConfigOptions = AppConfigCommonOptions & (RoutePathConfig | RouteCustomConfig);
|
|
885
|
+
|
|
886
|
+
interface Config extends Omit<AppConfigOptions, "defaultRoute" | "routeMap"> {
|
|
846
887
|
/**
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* @param name 页面名称
|
|
850
|
-
* @param options 页面选项
|
|
888
|
+
* @returns name
|
|
851
889
|
*/
|
|
852
|
-
|
|
890
|
+
getName: (url: string) => string;
|
|
853
891
|
/**
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
* 在框架执行扩展之后,这意味着你可以覆盖框架的方法
|
|
857
|
-
*
|
|
858
|
-
* @param name 页面名称
|
|
859
|
-
* @param options 页面选项
|
|
892
|
+
* @returns route
|
|
860
893
|
*/
|
|
861
|
-
|
|
894
|
+
getRoute: (pageName: string) => string;
|
|
862
895
|
}
|
|
863
|
-
|
|
864
|
-
declare const
|
|
896
|
+
declare const $Config: (config: AppConfigOptions) => void;
|
|
897
|
+
declare const getConfig: () => Config;
|
|
865
898
|
|
|
866
899
|
/** 文件编码 */
|
|
867
900
|
type FileEncoding = "utf-8" | "ascii" | "base64" | "binary" | "hex" | "ucs2" | "ucs-2" | "utf16le" | "utf-16le" | "utf8" | "latin1";
|
|
@@ -1074,6 +1107,7 @@ interface CookieType {
|
|
|
1074
1107
|
sameSite?: string | undefined;
|
|
1075
1108
|
}
|
|
1076
1109
|
|
|
1110
|
+
declare const getCookieScopeDomain: (domain?: string) => string[];
|
|
1077
1111
|
/**
|
|
1078
1112
|
* Cookie 类
|
|
1079
1113
|
*/
|
|
@@ -1107,54 +1141,10 @@ declare class Cookie {
|
|
|
1107
1141
|
toJSON(): CookieType;
|
|
1108
1142
|
}
|
|
1109
1143
|
|
|
1110
|
-
type HeadersInit = [string, string][] | Record<string, string> | Headers;
|
|
1111
|
-
declare class Headers {
|
|
1112
|
-
private headers;
|
|
1113
|
-
private headerNames;
|
|
1114
|
-
constructor(init?: HeadersInit);
|
|
1115
|
-
/**
|
|
1116
|
-
* Appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
1117
|
-
*/
|
|
1118
|
-
append(name: string, value: string): void;
|
|
1119
|
-
/**
|
|
1120
|
-
* Deletes a header from the `Headers` object.
|
|
1121
|
-
*/
|
|
1122
|
-
delete(name: string): void;
|
|
1123
|
-
/**
|
|
1124
|
-
* Returns a `ByteString` sequence of all the values of a header with a given name.
|
|
1125
|
-
*/
|
|
1126
|
-
get(name: string): string | null;
|
|
1127
|
-
/**
|
|
1128
|
-
* Returns an array containing the values
|
|
1129
|
-
* of all Set-Cookie headers associated
|
|
1130
|
-
* with a response
|
|
1131
|
-
*/
|
|
1132
|
-
getSetCookie(): string[];
|
|
1133
|
-
/**
|
|
1134
|
-
* Returns a boolean stating whether a `Headers` object contains a certain header.
|
|
1135
|
-
*/
|
|
1136
|
-
has(name: string): boolean;
|
|
1137
|
-
/**
|
|
1138
|
-
* Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
1139
|
-
*/
|
|
1140
|
-
set(name: string, value: string): void;
|
|
1141
|
-
/**
|
|
1142
|
-
* Traverses the `Headers` object,
|
|
1143
|
-
* calling the given callback for each header.
|
|
1144
|
-
*/
|
|
1145
|
-
forEach<ThisArg = this>(callback: (this: ThisArg, value: string, name: string, parent: this) => void, thisArg?: ThisArg): void;
|
|
1146
|
-
keys(): IterableIterator<string>;
|
|
1147
|
-
values(): IterableIterator<string>;
|
|
1148
|
-
entries(): IterableIterator<[string, string]>;
|
|
1149
|
-
toObject(): Record<string, string>;
|
|
1150
|
-
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
1144
|
/**
|
|
1154
1145
|
* @see RFC 6265
|
|
1155
1146
|
*/
|
|
1156
1147
|
declare const normalizeDomain: (domain?: string) => string;
|
|
1157
|
-
declare const getCookieScopeDomain: (domain?: string) => string[];
|
|
1158
1148
|
interface UrlInfo {
|
|
1159
1149
|
domain: string;
|
|
1160
1150
|
path: string;
|
|
@@ -1290,6 +1280,49 @@ declare class CookieStore {
|
|
|
1290
1280
|
private save;
|
|
1291
1281
|
}
|
|
1292
1282
|
|
|
1283
|
+
type HeadersInit = [string, string][] | Record<string, string> | Headers;
|
|
1284
|
+
declare class Headers {
|
|
1285
|
+
private headers;
|
|
1286
|
+
private headerNames;
|
|
1287
|
+
constructor(init?: HeadersInit);
|
|
1288
|
+
/**
|
|
1289
|
+
* Appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
1290
|
+
*/
|
|
1291
|
+
append(name: string, value: string): void;
|
|
1292
|
+
/**
|
|
1293
|
+
* Deletes a header from the `Headers` object.
|
|
1294
|
+
*/
|
|
1295
|
+
delete(name: string): void;
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns a `ByteString` sequence of all the values of a header with a given name.
|
|
1298
|
+
*/
|
|
1299
|
+
get(name: string): string | null;
|
|
1300
|
+
/**
|
|
1301
|
+
* Returns an array containing the values
|
|
1302
|
+
* of all Set-Cookie headers associated
|
|
1303
|
+
* with a response
|
|
1304
|
+
*/
|
|
1305
|
+
getSetCookie(): string[];
|
|
1306
|
+
/**
|
|
1307
|
+
* Returns a boolean stating whether a `Headers` object contains a certain header.
|
|
1308
|
+
*/
|
|
1309
|
+
has(name: string): boolean;
|
|
1310
|
+
/**
|
|
1311
|
+
* Sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.
|
|
1312
|
+
*/
|
|
1313
|
+
set(name: string, value: string): void;
|
|
1314
|
+
/**
|
|
1315
|
+
* Traverses the `Headers` object,
|
|
1316
|
+
* calling the given callback for each header.
|
|
1317
|
+
*/
|
|
1318
|
+
forEach<ThisArg = this>(callback: (this: ThisArg, value: string, name: string, parent: this) => void, thisArg?: ThisArg): void;
|
|
1319
|
+
keys(): IterableIterator<string>;
|
|
1320
|
+
values(): IterableIterator<string>;
|
|
1321
|
+
entries(): IterableIterator<[string, string]>;
|
|
1322
|
+
toObject(): Record<string, string>;
|
|
1323
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1293
1326
|
declare class URLSearchParams {
|
|
1294
1327
|
private params;
|
|
1295
1328
|
constructor(init?: URLSearchParams | string | Record<string, string | string[]> | Iterable<[string, string]>);
|
|
@@ -1758,4 +1791,4 @@ declare const getRichTextNodes: (content: string | AnyNode[], { appendClass, tra
|
|
|
1758
1791
|
|
|
1759
1792
|
declare const getText: (content: string | AnyNode[]) => string;
|
|
1760
1793
|
|
|
1761
|
-
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type
|
|
1794
|
+
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type AppConfigCommonOptions, type AppConfigOptions, type AppConstructor, type AppInstance, type AppOptions, type ComponentConstructor, type ComponentInstance, type ComponentLifetimes, type ComponentOptions, type Config, Cookie, type CookieMap, type CookieOptions, CookieStore, type CookieStoreType, type CookieType, type ElementNode, Emitter, type EmitterInstance, type EventHandlerList, type EventHandlerMap, type EventType, type ExtendedAppMethods, type ExtendedComponentMethods, type ExtendedComponentProperty, type ExtendedPageLifeCycles, type ExtendedPageMethods, type ExtendedPageProperties, type ExtendsAppOptions, type Handler, Headers, type HeadersInit, type InferFromType, type InferPropType, type InferPropTypes, type PageConstructor, type PageInstance, type PageOptions, type PageQuery, type PageState, type PropItem, type PropOption, type PropType, type Props, type PropsOptions, Queue, type RefMap, type RequestBody, type RequestError, type RequestFactory, type RequestInitOptions, type RequestOptions, type RequestResponse, type RequestType, type RichTextNode, type RouteCustomConfig, type RoutePathConfig, type SetCookieOptions, type StorageData, type Task, type TextNode, type TrivialComponentInstance, type TrivialComponentOptions, type TrivialPageInstance, type TrivialPageOptions, URLSearchParams, type UrlInfo, type WildCardEventHandlerList, type WildcardHandler, appState, check, checkAsync, createRequest, decode as decodeBase64, dirname, userEmitter as emitter, encode as encodeBase64, exists, funcQueue, get, getAsync, getConfig, getCookieOptions, getCookieScopeDomain, getDomain, getRef, getRichTextNodes, getText, handleProperties, isDir, isFile, isFunction, isMp, isQQ, isWx, lock, logger, ls, mkdir, normalizeDomain, once, parseCookieHeader, parseHTML, parseUrl, put, query, readFile, readJSON, remove, removeAsync, removeRef, request, requestCookieStore, rm, saveFile, saveOnlineFile, set, setAsync, setRef, storage, take, type, unzip, wrapFunction, writeFile, writeJSON };
|