@gershy/util-jsfn-encode 0.0.5 → 0.0.7
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/cmp/cjs/main.d.ts +4 -3
- package/cmp/cjs/main.js +1 -1
- package/cmp/esm/main.d.ts +4 -3
- package/cmp/esm/main.js +1 -1
- package/package.json +1 -1
package/cmp/cjs/main.d.ts
CHANGED
|
@@ -4,15 +4,16 @@ export type JsImport = {
|
|
|
4
4
|
varDef: null | string;
|
|
5
5
|
};
|
|
6
6
|
export type SovereignFn = (...args: any) => any;
|
|
7
|
-
export type
|
|
7
|
+
export type SovereignCls = abstract new (...args: any) => any;
|
|
8
|
+
export type JsfnInst<Cls extends abstract new (...args: any[]) => any> = {
|
|
8
9
|
toJsfn: () => JsfnInstSer<Cls>;
|
|
9
10
|
};
|
|
10
|
-
export type JsfnInstSer<Cls extends abstract new (...args:
|
|
11
|
+
export type JsfnInstSer<Cls extends abstract new (...args: any[]) => any> = {
|
|
11
12
|
hoist: `${string}::${string}`;
|
|
12
13
|
form: Cls;
|
|
13
14
|
args: ConstructorParameters<Cls>;
|
|
14
15
|
};
|
|
15
|
-
export type Jsfn = null | boolean | number | string | SovereignFn | JsfnInst<any> | Jsfn[] | {
|
|
16
|
+
export type Jsfn = null | boolean | number | string | SovereignFn | SovereignCls | JsfnInst<any> | Jsfn[] | {
|
|
16
17
|
[K: string]: Jsfn;
|
|
17
18
|
};
|
|
18
19
|
export type JsfnEncodeArgs<V extends Jsfn> = {
|
package/cmp/cjs/main.js
CHANGED
|
@@ -36,7 +36,7 @@ var main_default = (args) => {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
if (cl.inCls(val?.toJsfn, Function)) {
|
|
39
|
-
const { args: args2, hoist } = val;
|
|
39
|
+
const { args: args2, hoist } = val.toJsfn();
|
|
40
40
|
const [importPath, varDef] = hoist.split("::");
|
|
41
41
|
jsImports.push({ importPath, varDef });
|
|
42
42
|
return `new ${varDef.replace(/[{}]/g, "").trim()}(${args2.map((a) => serialize(a)).join(",")})`;
|
package/cmp/esm/main.d.ts
CHANGED
|
@@ -4,15 +4,16 @@ export type JsImport = {
|
|
|
4
4
|
varDef: null | string;
|
|
5
5
|
};
|
|
6
6
|
export type SovereignFn = (...args: any) => any;
|
|
7
|
-
export type
|
|
7
|
+
export type SovereignCls = abstract new (...args: any) => any;
|
|
8
|
+
export type JsfnInst<Cls extends abstract new (...args: any[]) => any> = {
|
|
8
9
|
toJsfn: () => JsfnInstSer<Cls>;
|
|
9
10
|
};
|
|
10
|
-
export type JsfnInstSer<Cls extends abstract new (...args:
|
|
11
|
+
export type JsfnInstSer<Cls extends abstract new (...args: any[]) => any> = {
|
|
11
12
|
hoist: `${string}::${string}`;
|
|
12
13
|
form: Cls;
|
|
13
14
|
args: ConstructorParameters<Cls>;
|
|
14
15
|
};
|
|
15
|
-
export type Jsfn = null | boolean | number | string | SovereignFn | JsfnInst<any> | Jsfn[] | {
|
|
16
|
+
export type Jsfn = null | boolean | number | string | SovereignFn | SovereignCls | JsfnInst<any> | Jsfn[] | {
|
|
16
17
|
[K: string]: Jsfn;
|
|
17
18
|
};
|
|
18
19
|
export type JsfnEncodeArgs<V extends Jsfn> = {
|
package/cmp/esm/main.js
CHANGED
|
@@ -13,7 +13,7 @@ var main_default = (args) => {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
if (cl.inCls(val?.toJsfn, Function)) {
|
|
16
|
-
const { args: args2, hoist } = val;
|
|
16
|
+
const { args: args2, hoist } = val.toJsfn();
|
|
17
17
|
const [importPath, varDef] = hoist.split("::");
|
|
18
18
|
jsImports.push({ importPath, varDef });
|
|
19
19
|
return `new ${varDef.replace(/[{}]/g, "").trim()}(${args2.map((a) => serialize(a)).join(",")})`;
|