@fox-js/fox 3.1.1-21 → 3.1.1-22

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.
@@ -74,16 +74,6 @@ declare const chainKey: unique symbol;
74
74
 
75
75
  declare const childrenKey: unique symbol;
76
76
 
77
- /**
78
- * 克隆对象
79
- * @param target
80
- * @param source
81
- * @param plain
82
- *
83
- * @returns
84
- */
85
- export declare function clone(target: any, source: any, plain?: boolean): any;
86
-
87
77
  declare const _cloneRouteRecorder: unique symbol;
88
78
 
89
79
  declare const _constructRouteModel: unique symbol;
@@ -441,18 +431,12 @@ export declare interface Fox {
441
431
  * 获取require
442
432
  */
443
433
  get require(): Require;
444
- /**
445
- * 返回extend
446
- */
447
- get extend(): Function;
448
- /**
449
- * 返回clone
450
- */
451
- get clone(): Function;
452
434
  /**
453
435
  * 判断是否为es模块
454
436
  */
455
- get isESModule(): Function;
437
+ get isESModule(): {
438
+ (mod: any): boolean;
439
+ };
456
440
  /**
457
441
  * 安装
458
442
  * @param app
@@ -919,7 +903,8 @@ declare const _removeRouteRecorder: unique symbol;
919
903
  declare const _removeView: unique symbol;
920
904
 
921
905
  /**
922
- * AMD加载器
906
+ * 依赖加载器
907
+ * 支持js(amd、esm格式) 和 css
923
908
  */
924
909
  declare class Require {
925
910
  /**
@@ -927,78 +912,82 @@ declare class Require {
927
912
  */
928
913
  private moduleManager;
929
914
  /**
930
- * 参数配置
931
- */
932
- private options;
933
- /**
934
- * 设置路径映射
935
- */
936
- set paths(paths: Record<string, string>);
937
- /**
938
- * 获取路径映射
939
- */
940
- get paths(): Record<string, string>;
941
- /**
942
- * 设置路径别名
915
+ * 路径别名
943
916
  */
917
+ private _alias;
944
918
  set alias(alias: Record<string, string>);
919
+ get alias(): Record<string, string>;
920
+ private _resourceParser?;
921
+ set resourceParser(parser: RequireResourceParser);
922
+ get resourceParser(): RequireResourceParser | undefined;
945
923
  /**
946
- * 获取路径别名
924
+ * 设置超时时间
947
925
  */
948
- get alias(): Record<string, string>;
926
+ private _timeout?;
927
+ set timeout(time: number);
928
+ get timeout(): number | undefined;
949
929
  /**
950
- * 设置不需要解析路径或判断函数
930
+ * 设置query
951
931
  */
952
- set naturePaths(nature: string[] | {
953
- (path: string): boolean;
954
- });
932
+ private _query?;
933
+ set query(val: Record<string, string>);
934
+ get query(): Record<string, string> | undefined;
955
935
  /**
956
- * 获取不需要解析路径或判断函数
936
+ * 获取document head
957
937
  */
958
- get naturePaths(): string[] | {
959
- (path: string): boolean;
960
- };
938
+ get head(): any;
961
939
  /**
962
- * 设置超时时间
940
+ * css挂载点
963
941
  */
964
- set timeout(t: number);
942
+ private _cssMountPoint;
943
+ set cssMountPoint(point: any);
944
+ get cssMountPoint(): any;
965
945
  /**
966
- * 获取超时时间
946
+ * js挂载点
967
947
  */
968
- get timeout(): number;
948
+ private _jsMountPoint;
949
+ set jsMountPoint(point: any);
950
+ get jsMountPoint(): any;
969
951
  /**
970
- * 设置query
952
+ * 设置module
953
+ * @param id
954
+ * @param exports
971
955
  */
972
- private _query?;
973
- set query(val: Record<string, string | number> | undefined);
974
- get query(): Record<string, string | number> | undefined;
956
+ setModule(id: string | RegExp, exports: any | {
957
+ (): any;
958
+ }): void;
975
959
  /**
976
- * 获取document head
960
+ * 移除module
961
+ * @param id
977
962
  */
978
- get head(): any;
963
+ removeModule(id: string | RegExp): void;
979
964
  /**
980
- * 构造函数
965
+ * 获取module exports
966
+ * @param id
967
+ * @returns
981
968
  */
982
- constructor();
969
+ getModuleExports(id: string): any;
983
970
  /**
984
- * 安装module
971
+ * expose require方法
972
+ * @param name
973
+ * @param global
974
+ * @param debug
975
+ * @returns
985
976
  */
986
- setModule(id: string, exports: Record<string, any> | {
987
- (): Record<string, any>;
988
- }): void;
977
+ exposeRequire(name?: string, global?: any, debug?: boolean): boolean;
989
978
  /**
990
- * 移除module
979
+ * reslove resource
991
980
  */
992
- removeModule(id: string): void;
981
+ private resloveResource;
993
982
  /**
994
983
  * 加载
995
984
  * @params args
996
985
  */
997
- ensure(...args: any[]): Require;
986
+ ensure(...args: [...any[]] | [...any[], RequireMountedCallback]): Promise<any[]>;
998
987
  /**
999
988
  * 卸载
1000
989
  */
1001
- remove(...args: any): Require;
990
+ remove(...args: [...any[]] | [...any[], RequireUnMountedCallback]): Promise<boolean>;
1002
991
  /**
1003
992
  * 加载
1004
993
  *
@@ -1021,6 +1010,13 @@ declare class Require {
1021
1010
  * @param point
1022
1011
  */
1023
1012
  private mountJS;
1013
+ /**
1014
+ * 加载cjs
1015
+ *
1016
+ * @param chain
1017
+ * @param task
1018
+ */
1019
+ private mountCJS;
1024
1020
  /**
1025
1021
  * 卸载资源
1026
1022
  */
@@ -1043,33 +1039,61 @@ declare class Require {
1043
1039
  */
1044
1040
  private createRequireLoad;
1045
1041
  /**
1046
- * 解析路径
1042
+ * 构建资源uri
1047
1043
  * @param uri
1048
1044
  * @returns
1049
1045
  */
1050
- private resolvePath;
1046
+ private constructResourceUri;
1051
1047
  /**
1052
1048
  * 创建search字符串
1053
1049
  */
1054
1050
  private createSearch;
1055
1051
  /**
1056
- * 获取文件名后缀
1052
+ * 获取资源路径的后缀
1057
1053
  * @param name
1058
- * @returns {string}
1059
- */
1060
- private getFileNamePostfix;
1061
- /**
1062
- * 是否为不处理的路径
1063
- * @param uri
1064
- * @return
1065
- */
1066
- private isNaturePath;
1067
- /**
1068
- * 解析路径
1069
- * @param uri
1070
- * @param replace
1054
+ * @returns
1071
1055
  */
1072
- private parserPath;
1056
+ private getResourcePathSuffix;
1057
+ }
1058
+
1059
+ /**
1060
+ * require mount callback
1061
+ */
1062
+ declare interface RequireMountedCallback {
1063
+ (ret: boolean): void;
1064
+ }
1065
+
1066
+ /**
1067
+ * 资源
1068
+ */
1069
+ declare interface RequireResource {
1070
+ path: string;
1071
+ type?: RequireResourceType;
1072
+ format?: RequireResourceFormat;
1073
+ }
1074
+
1075
+ /**
1076
+ * 资源类型
1077
+ */
1078
+ declare type RequireResourceFormat = 'es' | 'umd';
1079
+
1080
+ /**
1081
+ * 资源解析
1082
+ */
1083
+ declare interface RequireResourceParser {
1084
+ (path: string): RequireResource | null;
1085
+ }
1086
+
1087
+ /**
1088
+ * 资源类型
1089
+ */
1090
+ declare type RequireResourceType = 'js' | 'css';
1091
+
1092
+ /**
1093
+ * require unmount callback
1094
+ */
1095
+ declare interface RequireUnMountedCallback {
1096
+ (): void;
1073
1097
  }
1074
1098
 
1075
1099
  declare const _resolveComponent: unique symbol;