@idlizer/core 2.0.33 → 2.0.36
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/build/lib/src/LanguageWriters/ArgConvertors.js +11 -3
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +3 -1
- package/build/lib/src/LanguageWriters/LanguageWriter.js +1 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.js +2 -1
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.js +0 -2
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.js +1 -0
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.js +10 -8
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +7 -0
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +3 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +6 -0
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +7 -1
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +6 -0
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +11 -2
- package/build/lib/src/from-idl/DtsPrinter.d.ts +2 -2
- package/build/lib/src/from-idl/DtsPrinter.js +8 -19
- package/build/lib/src/from-idl/common.d.ts +2 -2
- package/build/lib/src/from-idl/common.js +2 -8
- package/build/lib/src/from-idl/deserialize.d.ts +1 -4
- package/build/lib/src/from-idl/deserialize.js +17 -19
- package/build/lib/src/idl.d.ts +25 -33
- package/build/lib/src/idl.js +37 -56
- package/build/lib/src/index.d.ts +1 -1
- package/build/lib/src/index.js +1 -1
- package/build/lib/src/library.d.ts +1 -2
- package/build/lib/src/library.js +1 -4
- package/build/lib/src/peer-generation/Materialized.d.ts +3 -1
- package/build/lib/src/peer-generation/Materialized.js +8 -1
- package/build/lib/src/peer-generation/PeerFile.d.ts +1 -1
- package/build/lib/src/peer-generation/PeerFile.js +3 -11
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +10 -5
- package/build/lib/src/peer-generation/PeerLibrary.js +31 -4
- package/build/lib/src/peer-generation/PeerMethod.js +4 -1
- package/build/lib/src/peer-generation/PrimitiveType.d.ts +2 -0
- package/build/lib/src/peer-generation/PrimitiveType.js +4 -0
- package/build/lib/src/peer-generation/isMaterialized.d.ts +1 -0
- package/build/lib/src/peer-generation/isMaterialized.js +8 -0
- package/package.json +2 -2
- package/build/lib/src/LanguageWriters/InteropConvertor.d.ts +0 -36
- package/build/lib/src/LanguageWriters/InteropConvertor.js +0 -174
- package/build/lib/src/configMerge.d.ts +0 -2
- package/build/lib/src/configMerge.js +0 -42
- package/build/lib/src/peer-generation/LanguageWriters/index.d.ts +0 -2
- package/build/lib/src/peer-generation/LanguageWriters/index.js +0 -2
- package/build/lib/src/peer-generation/LanguageWriters/nameConvertor.d.ts +0 -25
- package/build/lib/src/peer-generation/LanguageWriters/nameConvertor.js +0 -55
package/build/lib/src/idl.js
CHANGED
|
@@ -19,34 +19,32 @@ import { IDLKeywords } from "./languageSpecificKeywords";
|
|
|
19
19
|
export var IDLKind;
|
|
20
20
|
(function (IDLKind) {
|
|
21
21
|
IDLKind[IDLKind["Interface"] = 0] = "Interface";
|
|
22
|
-
IDLKind[IDLKind["
|
|
23
|
-
IDLKind[IDLKind["
|
|
24
|
-
IDLKind[IDLKind["
|
|
25
|
-
IDLKind[IDLKind["
|
|
26
|
-
IDLKind[IDLKind["
|
|
27
|
-
IDLKind[IDLKind["
|
|
28
|
-
IDLKind[IDLKind["
|
|
29
|
-
IDLKind[IDLKind["
|
|
30
|
-
IDLKind[IDLKind["
|
|
31
|
-
IDLKind[IDLKind["
|
|
32
|
-
IDLKind[IDLKind["
|
|
33
|
-
IDLKind[IDLKind["
|
|
34
|
-
IDLKind[IDLKind["
|
|
35
|
-
IDLKind[IDLKind["
|
|
36
|
-
IDLKind[IDLKind["
|
|
37
|
-
IDLKind[IDLKind["
|
|
38
|
-
IDLKind[IDLKind["
|
|
39
|
-
IDLKind[IDLKind["
|
|
40
|
-
IDLKind[IDLKind["
|
|
41
|
-
IDLKind[IDLKind["
|
|
42
|
-
IDLKind[IDLKind["
|
|
43
|
-
IDLKind[IDLKind["File"] = 22] = "File";
|
|
22
|
+
IDLKind[IDLKind["Import"] = 1] = "Import";
|
|
23
|
+
IDLKind[IDLKind["Callback"] = 2] = "Callback";
|
|
24
|
+
IDLKind[IDLKind["Const"] = 3] = "Const";
|
|
25
|
+
IDLKind[IDLKind["Property"] = 4] = "Property";
|
|
26
|
+
IDLKind[IDLKind["Parameter"] = 5] = "Parameter";
|
|
27
|
+
IDLKind[IDLKind["Method"] = 6] = "Method";
|
|
28
|
+
IDLKind[IDLKind["Callable"] = 7] = "Callable";
|
|
29
|
+
IDLKind[IDLKind["Constructor"] = 8] = "Constructor";
|
|
30
|
+
IDLKind[IDLKind["Enum"] = 9] = "Enum";
|
|
31
|
+
IDLKind[IDLKind["EnumMember"] = 10] = "EnumMember";
|
|
32
|
+
IDLKind[IDLKind["Typedef"] = 11] = "Typedef";
|
|
33
|
+
IDLKind[IDLKind["PrimitiveType"] = 12] = "PrimitiveType";
|
|
34
|
+
IDLKind[IDLKind["ContainerType"] = 13] = "ContainerType";
|
|
35
|
+
IDLKind[IDLKind["UnspecifiedGenericType"] = 14] = "UnspecifiedGenericType";
|
|
36
|
+
IDLKind[IDLKind["ReferenceType"] = 15] = "ReferenceType";
|
|
37
|
+
IDLKind[IDLKind["UnionType"] = 16] = "UnionType";
|
|
38
|
+
IDLKind[IDLKind["TypeParameterType"] = 17] = "TypeParameterType";
|
|
39
|
+
IDLKind[IDLKind["OptionalType"] = 18] = "OptionalType";
|
|
40
|
+
IDLKind[IDLKind["Version"] = 19] = "Version";
|
|
41
|
+
IDLKind[IDLKind["Namespace"] = 20] = "Namespace";
|
|
42
|
+
IDLKind[IDLKind["File"] = 21] = "File";
|
|
44
43
|
})(IDLKind || (IDLKind = {}));
|
|
45
44
|
export var IDLEntity;
|
|
46
45
|
(function (IDLEntity) {
|
|
47
46
|
IDLEntity["Class"] = "Class";
|
|
48
47
|
IDLEntity["Interface"] = "Interface";
|
|
49
|
-
IDLEntity["Package"] = "Package";
|
|
50
48
|
IDLEntity["Import"] = "Import";
|
|
51
49
|
IDLEntity["Intersection"] = "Intersection";
|
|
52
50
|
IDLEntity["Literal"] = "Literal";
|
|
@@ -69,7 +67,6 @@ export var IDLExtendedAttributes;
|
|
|
69
67
|
IDLExtendedAttributes["DtsName"] = "DtsName";
|
|
70
68
|
IDLExtendedAttributes["DtsTag"] = "DtsTag";
|
|
71
69
|
IDLExtendedAttributes["Entity"] = "Entity";
|
|
72
|
-
IDLExtendedAttributes["GlobalScope"] = "GlobalScope";
|
|
73
70
|
IDLExtendedAttributes["Import"] = "Import";
|
|
74
71
|
IDLExtendedAttributes["IndexSignature"] = "IndexSignature";
|
|
75
72
|
IDLExtendedAttributes["Interfaces"] = "Interfaces";
|
|
@@ -171,7 +168,6 @@ export function forEachChild(node, cbEnter, cbLeave) {
|
|
|
171
168
|
case IDLKind.ReferenceType:
|
|
172
169
|
case IDLKind.TypeParameterType:
|
|
173
170
|
case IDLKind.EnumMember:
|
|
174
|
-
case IDLKind.Package:
|
|
175
171
|
case IDLKind.Import:
|
|
176
172
|
case IDLKind.PrimitiveType:
|
|
177
173
|
case IDLKind.Version:
|
|
@@ -228,9 +224,6 @@ export function isTypeParameterType(type) {
|
|
|
228
224
|
export function isInterface(node) {
|
|
229
225
|
return node.kind === IDLKind.Interface;
|
|
230
226
|
}
|
|
231
|
-
export function isPackage(type) {
|
|
232
|
-
return type.kind == IDLKind.Package;
|
|
233
|
-
}
|
|
234
227
|
export function isImport(type) {
|
|
235
228
|
return type.kind == IDLKind.Import;
|
|
236
229
|
}
|
|
@@ -400,13 +393,7 @@ export function isEqualByQualifedName(a, b) {
|
|
|
400
393
|
}
|
|
401
394
|
export function getPackageClause(entry) {
|
|
402
395
|
let file = getFileFor(entry);
|
|
403
|
-
|
|
404
|
-
return [];
|
|
405
|
-
for (const child of file.entries)
|
|
406
|
-
if (isPackage(child))
|
|
407
|
-
return child.clause;
|
|
408
|
-
// console.warn("Expected to have one IDLPackage inside IDLFile. Using empty package name")
|
|
409
|
-
return [];
|
|
396
|
+
return (file === null || file === void 0 ? void 0 : file.packageClause) || [];
|
|
410
397
|
}
|
|
411
398
|
export function getPackageName(entry) {
|
|
412
399
|
return getPackageClause(entry).join(".");
|
|
@@ -499,24 +486,15 @@ export function createUnionType(types, name) {
|
|
|
499
486
|
_idlNamedNodeBrand: innerIdlSymbol,
|
|
500
487
|
};
|
|
501
488
|
}
|
|
502
|
-
export function createFile(entries, fileName) {
|
|
489
|
+
export function createFile(entries, fileName, packageClause = []) {
|
|
503
490
|
return {
|
|
504
491
|
kind: IDLKind.File,
|
|
492
|
+
packageClause,
|
|
505
493
|
entries: entries,
|
|
506
494
|
fileName,
|
|
507
495
|
_idlNodeBrand: innerIdlSymbol,
|
|
508
496
|
};
|
|
509
497
|
}
|
|
510
|
-
export function createPackage(clause) {
|
|
511
|
-
return {
|
|
512
|
-
kind: IDLKind.Package,
|
|
513
|
-
name: "",
|
|
514
|
-
clause,
|
|
515
|
-
_idlNodeBrand: innerIdlSymbol,
|
|
516
|
-
_idlEntryBrand: innerIdlSymbol,
|
|
517
|
-
_idlNamedNodeBrand: innerIdlSymbol,
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
498
|
export function createImport(clause, name, nodeInitializer) {
|
|
521
499
|
return Object.assign(Object.assign({ kind: IDLKind.Import, name: name || "", clause }, nodeInitializer), { _idlNodeBrand: innerIdlSymbol, _idlEntryBrand: innerIdlSymbol, _idlNamedNodeBrand: innerIdlSymbol });
|
|
522
500
|
}
|
|
@@ -754,10 +732,10 @@ export function printMethod(idl) {
|
|
|
754
732
|
];
|
|
755
733
|
}
|
|
756
734
|
export function printPackage(idl) {
|
|
757
|
-
if (!idl.
|
|
735
|
+
if (!idl.packageClause.length)
|
|
758
736
|
return [];
|
|
759
737
|
return [
|
|
760
|
-
`package ${idl.
|
|
738
|
+
`package ${idl.packageClause.join(".")};`
|
|
761
739
|
];
|
|
762
740
|
}
|
|
763
741
|
export function printImport(idl) {
|
|
@@ -856,6 +834,7 @@ export function printTypedef(idl) {
|
|
|
856
834
|
`typedef ${printType(idl.type)} ${idl.name};`
|
|
857
835
|
];
|
|
858
836
|
}
|
|
837
|
+
// TODO: use IndentedPrinter instead!
|
|
859
838
|
export function printIDL(idl, options) {
|
|
860
839
|
var _a;
|
|
861
840
|
if (idl.kind == IDLKind.Interface)
|
|
@@ -866,8 +845,6 @@ export function printIDL(idl, options) {
|
|
|
866
845
|
return printTypedef(idl);
|
|
867
846
|
if (idl.kind == IDLKind.Callback)
|
|
868
847
|
return printCallback(idl);
|
|
869
|
-
if (idl.kind == IDLKind.Package)
|
|
870
|
-
return printPackage(idl);
|
|
871
848
|
if (idl.kind == IDLKind.Import)
|
|
872
849
|
return printImport(idl);
|
|
873
850
|
if (idl.kind == IDLKind.Namespace)
|
|
@@ -883,23 +860,27 @@ export function printIDL(idl, options) {
|
|
|
883
860
|
throw new Error(`unexpected kind: ${idl.kind}`);
|
|
884
861
|
}
|
|
885
862
|
}
|
|
886
|
-
export function toIDLString(
|
|
863
|
+
export function toIDLString(file, options) {
|
|
887
864
|
let indent = 0;
|
|
888
|
-
const
|
|
865
|
+
const generated = printPackage(file);
|
|
866
|
+
return generated.concat(file.entries
|
|
889
867
|
.map(it => printIDL(it, options))
|
|
890
868
|
.flat()
|
|
891
869
|
.filter(isDefined)
|
|
892
870
|
.filter(it => it.length > 0)
|
|
893
871
|
.map(it => {
|
|
894
|
-
if (it === printedIndentInc)
|
|
872
|
+
if (it === printedIndentInc) {
|
|
895
873
|
++indent;
|
|
896
|
-
|
|
874
|
+
return undefined;
|
|
875
|
+
}
|
|
876
|
+
else if (it === printedIndentDec) {
|
|
897
877
|
--indent;
|
|
878
|
+
return undefined;
|
|
879
|
+
}
|
|
898
880
|
else
|
|
899
881
|
return indentedBy(it, indent);
|
|
900
882
|
})
|
|
901
|
-
.join("\n");
|
|
902
|
-
return generatedIdl;
|
|
883
|
+
.filter(isDefined)).join("\n");
|
|
903
884
|
}
|
|
904
885
|
// throws validation error
|
|
905
886
|
export function verifyIDLString(source) {
|
package/build/lib/src/index.d.ts
CHANGED
|
@@ -45,5 +45,5 @@ export * from "./peer-generation/ReferenceResolver";
|
|
|
45
45
|
export * from "./peer-generation/idl/common";
|
|
46
46
|
export { fromIDL } from "./from-idl/common";
|
|
47
47
|
export { idlToDtsString, CustomPrintVisitor } from "./from-idl/DtsPrinter";
|
|
48
|
-
export {
|
|
48
|
+
export { toIDLFile, addSyntheticType, resolveSyntheticType } from "./from-idl/deserialize";
|
|
49
49
|
//# sourceMappingURL=index.d.ts.map
|
package/build/lib/src/index.js
CHANGED
|
@@ -59,5 +59,5 @@ export * from "./peer-generation/ReferenceResolver";
|
|
|
59
59
|
export * from "./peer-generation/idl/common";
|
|
60
60
|
export { fromIDL } from "./from-idl/common";
|
|
61
61
|
export { idlToDtsString, CustomPrintVisitor } from "./from-idl/DtsPrinter";
|
|
62
|
-
export {
|
|
62
|
+
export { toIDLFile, addSyntheticType, resolveSyntheticType } from "./from-idl/deserialize";
|
|
63
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -31,7 +31,6 @@ export type QueryType<T> = LibraryQuery<IDLLibrary, T> | LensBuilder<T>;
|
|
|
31
31
|
export declare function query<T>(lib: IDLLibrary, input: QueryType<T>): T;
|
|
32
32
|
interface EntitiesParams {
|
|
33
33
|
expandNamespaces?: boolean;
|
|
34
|
-
slipPackage?: boolean;
|
|
35
34
|
}
|
|
36
35
|
export declare const lib: {
|
|
37
36
|
createLibrary: typeof createLibrary;
|
|
@@ -40,7 +39,7 @@ export declare const lib: {
|
|
|
40
39
|
query: typeof query;
|
|
41
40
|
select: {
|
|
42
41
|
files(): LibraryReducer<readonly idl.IDLFile[]>;
|
|
43
|
-
nodes(params
|
|
42
|
+
nodes(params?: EntitiesParams): LibraryQuery<readonly idl.IDLFile[], idl.IDLNode[]>;
|
|
44
43
|
entries(): LibraryQuery<idl.IDLNode[], idl.IDLEntry[]>;
|
|
45
44
|
interfaces(): LibraryQuery<idl.IDLNode[], idl.IDLInterface[]>;
|
|
46
45
|
hasExt<T extends idl.IDLNode>(attr: idl.IDLExtendedAttributes): LibraryQuery<T[], T[]>;
|
package/build/lib/src/library.js
CHANGED
|
@@ -139,12 +139,9 @@ const select = {
|
|
|
139
139
|
nodes(params) {
|
|
140
140
|
const key = 'entities' + serializeParam(params);
|
|
141
141
|
function go(node) {
|
|
142
|
-
if (idl.isNamespace(node) && params.expandNamespaces) {
|
|
142
|
+
if (idl.isNamespace(node) && (params === null || params === void 0 ? void 0 : params.expandNamespaces)) {
|
|
143
143
|
return node.members.flatMap(go);
|
|
144
144
|
}
|
|
145
|
-
if (idl.isPackage(node) && params.slipPackage) {
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
145
|
return [node];
|
|
149
146
|
}
|
|
150
147
|
return req(key, xs => {
|
|
@@ -52,9 +52,11 @@ export declare class MaterializedClass implements PeerClassBase {
|
|
|
52
52
|
getComponentName(): string;
|
|
53
53
|
getImplementationName(): string;
|
|
54
54
|
generatedName(isCallSignature: boolean): string;
|
|
55
|
+
private _isGlobal;
|
|
56
|
+
setGlobalScope(): void;
|
|
55
57
|
isGlobalScope(): boolean;
|
|
56
58
|
}
|
|
57
|
-
export declare function createDestroyPeerMethod(clazz: MaterializedClass): MaterializedMethod;
|
|
59
|
+
export declare function createDestroyPeerMethod(clazz: MaterializedClass): MaterializedMethod | undefined;
|
|
58
60
|
export declare function getInternalClassName(name: string): string;
|
|
59
61
|
export declare function getInternalClassQualifiedName(target: idl.IDLEntry): string;
|
|
60
62
|
export declare function getMaterializedFileName(name: string): string;
|
|
@@ -111,6 +111,7 @@ export class MaterializedClass {
|
|
|
111
111
|
this.methods = methods;
|
|
112
112
|
this.needBeGenerated = needBeGenerated;
|
|
113
113
|
this.taggedMethods = taggedMethods;
|
|
114
|
+
this._isGlobal = false;
|
|
114
115
|
PeerMethod.markAndGroupOverloads(methods);
|
|
115
116
|
}
|
|
116
117
|
getComponentName() {
|
|
@@ -122,11 +123,17 @@ export class MaterializedClass {
|
|
|
122
123
|
generatedName(isCallSignature) {
|
|
123
124
|
return this.className;
|
|
124
125
|
}
|
|
126
|
+
setGlobalScope() {
|
|
127
|
+
this._isGlobal = true;
|
|
128
|
+
}
|
|
125
129
|
isGlobalScope() {
|
|
126
|
-
return
|
|
130
|
+
return this._isGlobal;
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
133
|
export function createDestroyPeerMethod(clazz) {
|
|
134
|
+
if (clazz.isGlobalScope()) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
130
137
|
return new MaterializedMethod(clazz.className, clazz.getImplementationName(), [], idl.IDLVoidType, false, new Method('destroyPeer', new NamedMethodSignature(idl.IDLVoidType, [idl.createReferenceType(clazz.className)], ['peer'])));
|
|
131
138
|
}
|
|
132
139
|
export function getInternalClassName(name) {
|
|
@@ -7,7 +7,7 @@ export declare class PeerFile implements LibraryFileInterface {
|
|
|
7
7
|
readonly peers: Map<string, PeerClass>;
|
|
8
8
|
constructor(file: idl.IDLFile, isPredefined?: boolean);
|
|
9
9
|
packageName(): string;
|
|
10
|
-
|
|
10
|
+
packageClause(): string[];
|
|
11
11
|
get peersToGenerate(): PeerClass[];
|
|
12
12
|
get entries(): idl.IDLEntry[];
|
|
13
13
|
get originalFilename(): string;
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
import * as idl from '../idl';
|
|
16
15
|
export class PeerFile {
|
|
17
16
|
constructor(file, isPredefined = false) {
|
|
18
17
|
this.file = file;
|
|
@@ -20,17 +19,10 @@ export class PeerFile {
|
|
|
20
19
|
this.peers = new Map();
|
|
21
20
|
}
|
|
22
21
|
packageName() {
|
|
23
|
-
|
|
24
|
-
if (packageTag === undefined) {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
if (packageTag.name.startsWith('"') && packageTag.name.endsWith('"')) {
|
|
28
|
-
return packageTag.name.slice(1, packageTag.name.length - 1);
|
|
29
|
-
}
|
|
30
|
-
return packageTag.name;
|
|
22
|
+
return this.packageClause().join(".");
|
|
31
23
|
}
|
|
32
|
-
|
|
33
|
-
return this.
|
|
24
|
+
packageClause() {
|
|
25
|
+
return this.file.packageClause;
|
|
34
26
|
}
|
|
35
27
|
get peersToGenerate() {
|
|
36
28
|
const peers = Array.from(this.peers.values());
|
|
@@ -9,10 +9,14 @@ import { MaterializedClass } from './Materialized';
|
|
|
9
9
|
import { PeerFile } from './PeerFile';
|
|
10
10
|
import { LayoutManager, LayoutManagerStrategy } from './LayoutManager';
|
|
11
11
|
import { IDLLibrary } from '../library';
|
|
12
|
+
export interface GlobalScopeDeclarations {
|
|
13
|
+
methods: idl.IDLMethod[];
|
|
14
|
+
constants: idl.IDLConstant[];
|
|
15
|
+
}
|
|
12
16
|
export declare const lenses: {
|
|
13
17
|
globals: {
|
|
14
|
-
req: import("../library").LibraryReducer<
|
|
15
|
-
pipe<T>(r: import("../library").LibraryQuery<
|
|
18
|
+
req: import("../library").LibraryReducer<GlobalScopeDeclarations[]>;
|
|
19
|
+
pipe<T>(r: import("../library").LibraryQuery<GlobalScopeDeclarations[], T>): {
|
|
16
20
|
req: import("../library").LibraryReducer<T>;
|
|
17
21
|
pipe<T_1>(r: import("../library").LibraryQuery<T, T_1>): {
|
|
18
22
|
req: import("../library").LibraryReducer<T_1>;
|
|
@@ -5128,7 +5132,7 @@ export declare const lenses: {
|
|
|
5128
5132
|
};
|
|
5129
5133
|
query(): import("../library").LibraryReducer<T>;
|
|
5130
5134
|
};
|
|
5131
|
-
row<T_2047>(key: string, f: (x:
|
|
5135
|
+
row<T_2047>(key: string, f: (x: GlobalScopeDeclarations[]) => T_2047): {
|
|
5132
5136
|
req: import("../library").LibraryReducer<T_2047>;
|
|
5133
5137
|
pipe<T_2048>(r: import("../library").LibraryQuery<T_2047, T_2048>): {
|
|
5134
5138
|
req: import("../library").LibraryReducer<T_2048>;
|
|
@@ -10244,7 +10248,7 @@ export declare const lenses: {
|
|
|
10244
10248
|
};
|
|
10245
10249
|
query(): import("../library").LibraryReducer<T_2047>;
|
|
10246
10250
|
};
|
|
10247
|
-
query(): import("../library").LibraryReducer<
|
|
10251
|
+
query(): import("../library").LibraryReducer<GlobalScopeDeclarations[]>;
|
|
10248
10252
|
};
|
|
10249
10253
|
};
|
|
10250
10254
|
export declare class PeerLibrary implements LibraryInterface {
|
|
@@ -10252,10 +10256,11 @@ export declare class PeerLibrary implements LibraryInterface {
|
|
|
10252
10256
|
libraryPackages: string[] | undefined;
|
|
10253
10257
|
private _cachedIdlLibrary?;
|
|
10254
10258
|
asIDLLibrary(): IDLLibrary;
|
|
10255
|
-
get
|
|
10259
|
+
get globals(): GlobalScopeDeclarations[];
|
|
10256
10260
|
layout: LayoutManager;
|
|
10257
10261
|
private _syntheticFile;
|
|
10258
10262
|
initSyntheticEntries(file: idl.IDLFile): void;
|
|
10263
|
+
getSyntheticData(): idl.IDLInterface[];
|
|
10259
10264
|
readonly files: PeerFile[];
|
|
10260
10265
|
readonly builderClasses: Map<string, BuilderClass>;
|
|
10261
10266
|
get buildersToGenerate(): BuilderClass[];
|
|
@@ -30,9 +30,33 @@ import { lib, query } from '../library';
|
|
|
30
30
|
import { isMaterialized } from './isMaterialized';
|
|
31
31
|
export const lenses = {
|
|
32
32
|
globals: lib.lens(lib.select.files())
|
|
33
|
-
.pipe(lib.select.nodes(
|
|
34
|
-
.pipe(lib.
|
|
35
|
-
|
|
33
|
+
.pipe(lib.select.nodes())
|
|
34
|
+
.pipe(lib.req('globals', (nodes) => {
|
|
35
|
+
const result = [];
|
|
36
|
+
const queue = [nodes];
|
|
37
|
+
while (queue.length) {
|
|
38
|
+
const line = {
|
|
39
|
+
constants: [],
|
|
40
|
+
methods: []
|
|
41
|
+
};
|
|
42
|
+
const next = queue.pop();
|
|
43
|
+
next.forEach(node => {
|
|
44
|
+
if (idl.isNamespace(node)) {
|
|
45
|
+
queue.push(node.members);
|
|
46
|
+
}
|
|
47
|
+
if (idl.isConstant(node)) {
|
|
48
|
+
line.constants.push(node);
|
|
49
|
+
}
|
|
50
|
+
if (idl.isMethod(node)) {
|
|
51
|
+
line.methods.push(node);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
if (line.constants.length || line.methods.length) {
|
|
55
|
+
result.push(line);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}))
|
|
36
60
|
};
|
|
37
61
|
export class PeerLibrary {
|
|
38
62
|
asIDLLibrary() {
|
|
@@ -44,10 +68,13 @@ export class PeerLibrary {
|
|
|
44
68
|
};
|
|
45
69
|
return this._cachedIdlLibrary;
|
|
46
70
|
}
|
|
47
|
-
get
|
|
71
|
+
get globals() { return query(this.asIDLLibrary(), lenses.globals); }
|
|
48
72
|
initSyntheticEntries(file) {
|
|
49
73
|
this._syntheticFile = file;
|
|
50
74
|
}
|
|
75
|
+
getSyntheticData() {
|
|
76
|
+
return this._syntheticFile.entries.filter(it => idl.isInterface(it));
|
|
77
|
+
}
|
|
51
78
|
get buildersToGenerate() {
|
|
52
79
|
return Array.from(this.builderClasses.values()).filter(it => it.needBeGenerated);
|
|
53
80
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
import { generatorTypePrefix } from "../config";
|
|
16
|
+
import { asPromise } from "../idl";
|
|
16
17
|
import { mangleMethodName, MethodModifier } from "../LanguageWriters/LanguageWriter";
|
|
17
18
|
import { capitalize, isDefined } from "../util";
|
|
18
19
|
import { PrimitiveTypesInstance } from "./PrimitiveType";
|
|
@@ -78,7 +79,9 @@ export class PeerMethod {
|
|
|
78
79
|
const receiver = this.generateReceiver();
|
|
79
80
|
if (receiver)
|
|
80
81
|
args.unshift(`${receiver.argType} ${receiver.argName}`);
|
|
81
|
-
if ((
|
|
82
|
+
if (!!asPromise(this.method.signature.returnType))
|
|
83
|
+
args.unshift(`${generatorTypePrefix()}AsyncWorkerPtr asyncWorker`);
|
|
84
|
+
if (!!asPromise(this.method.signature.returnType) || ((_a = this.method.modifiers) === null || _a === void 0 ? void 0 : _a.includes(MethodModifier.THROWS)))
|
|
82
85
|
args.unshift(`${generatorTypePrefix()}VMContext vmContext`);
|
|
83
86
|
return args;
|
|
84
87
|
}
|
|
@@ -3,6 +3,7 @@ export declare class PrimitiveType {
|
|
|
3
3
|
protected isPointer: boolean;
|
|
4
4
|
constructor(name: string, isPointer?: boolean);
|
|
5
5
|
getText(): string;
|
|
6
|
+
getInterop(): string;
|
|
6
7
|
toString(): string;
|
|
7
8
|
}
|
|
8
9
|
export declare class PrimitiveTypeList {
|
|
@@ -11,6 +12,7 @@ export declare class PrimitiveTypeList {
|
|
|
11
12
|
static get ObjectTag(): string;
|
|
12
13
|
readonly Int32: PrimitiveType;
|
|
13
14
|
readonly Int64: PrimitiveType;
|
|
15
|
+
readonly Number: PrimitiveType;
|
|
14
16
|
readonly Boolean: PrimitiveType;
|
|
15
17
|
readonly Function: PrimitiveType;
|
|
16
18
|
readonly Undefined: PrimitiveType;
|
|
@@ -21,6 +21,9 @@ export class PrimitiveType {
|
|
|
21
21
|
getText() {
|
|
22
22
|
return generatorConfiguration().TypePrefix + this.name;
|
|
23
23
|
}
|
|
24
|
+
getInterop() {
|
|
25
|
+
return 'Interop' + this.name;
|
|
26
|
+
}
|
|
24
27
|
toString() {
|
|
25
28
|
return this.getText();
|
|
26
29
|
}
|
|
@@ -29,6 +32,7 @@ export class PrimitiveTypeList {
|
|
|
29
32
|
constructor() {
|
|
30
33
|
this.Int32 = new PrimitiveType(`Int32`);
|
|
31
34
|
this.Int64 = new PrimitiveType(`Int64`);
|
|
35
|
+
this.Number = new PrimitiveType(`Number`);
|
|
32
36
|
this.Boolean = new PrimitiveType(`Boolean`);
|
|
33
37
|
this.Function = new PrimitiveType(`Function`);
|
|
34
38
|
this.Undefined = new PrimitiveType(`Undefined`);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as idl from '../idl';
|
|
2
2
|
import { ReferenceResolver } from './ReferenceResolver';
|
|
3
3
|
export declare function isMaterialized(declaration: idl.IDLInterface, resolver: ReferenceResolver): boolean;
|
|
4
|
+
export declare function isMaterializedType(type: idl.IDLType, resolver: ReferenceResolver): boolean;
|
|
4
5
|
//# sourceMappingURL=isMaterialized.d.ts.map
|
|
@@ -43,4 +43,12 @@ export function isMaterialized(declaration, resolver) {
|
|
|
43
43
|
}
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
+
export function isMaterializedType(type, resolver) {
|
|
47
|
+
if (!idl.isReferenceType(type))
|
|
48
|
+
return false;
|
|
49
|
+
const decl = resolver.resolveTypeReference(type);
|
|
50
|
+
if (!decl)
|
|
51
|
+
return false;
|
|
52
|
+
return (idl.isInterface(decl) && isMaterialized(decl, resolver));
|
|
53
|
+
}
|
|
46
54
|
//# sourceMappingURL=isMaterialized.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlizer/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.36",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "build/lib/src/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"keywords": [],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@koalaui/interop": "1.5.
|
|
37
|
+
"@koalaui/interop": "1.5.7",
|
|
38
38
|
"typescript": "4.9.5",
|
|
39
39
|
"@types/node": "^18.0.0"
|
|
40
40
|
},
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as idl from '../idl';
|
|
2
|
-
import { IdlNameConvertor, NodeConvertor } from "./nameConvertor";
|
|
3
|
-
import { ReferenceResolver } from "../peer-generation/ReferenceResolver";
|
|
4
|
-
export interface ConvertResult {
|
|
5
|
-
text: string;
|
|
6
|
-
noPrefix: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class InteropConvertor implements NodeConvertor<ConvertResult> {
|
|
9
|
-
protected resolver: ReferenceResolver;
|
|
10
|
-
constructor(resolver: ReferenceResolver);
|
|
11
|
-
private make;
|
|
12
|
-
convertNode(node: idl.IDLNode): ConvertResult;
|
|
13
|
-
convertNamespace(node: idl.IDLNamespace): ConvertResult;
|
|
14
|
-
convertInterface(node: idl.IDLInterface): ConvertResult;
|
|
15
|
-
convertEnum(node: idl.IDLEnum): ConvertResult;
|
|
16
|
-
convertTypedef(node: idl.IDLTypedef): ConvertResult;
|
|
17
|
-
convertCallback(node: idl.IDLCallback): ConvertResult;
|
|
18
|
-
convertMethod(node: idl.IDLMethod): ConvertResult;
|
|
19
|
-
convertConstant(node: idl.IDLConstant): ConvertResult;
|
|
20
|
-
convertOptional(type: idl.IDLOptionalType): ConvertResult;
|
|
21
|
-
convertUnion(type: idl.IDLUnionType): ConvertResult;
|
|
22
|
-
convertContainer(type: idl.IDLContainerType): ConvertResult;
|
|
23
|
-
convertImport(type: idl.IDLReferenceType, _: string): ConvertResult;
|
|
24
|
-
convertTypeReference(type: idl.IDLReferenceType): ConvertResult;
|
|
25
|
-
convertTypeParameter(type: idl.IDLTypeParameterType): ConvertResult;
|
|
26
|
-
convertPrimitiveType(type: idl.IDLPrimitiveType): ConvertResult;
|
|
27
|
-
private enumName;
|
|
28
|
-
private computeTargetTypeLiteralName;
|
|
29
|
-
}
|
|
30
|
-
export declare class InteropNameConvertor implements IdlNameConvertor {
|
|
31
|
-
protected resolver: ReferenceResolver;
|
|
32
|
-
private readonly interopConvertor;
|
|
33
|
-
constructor(resolver: ReferenceResolver);
|
|
34
|
-
convert(node: idl.IDLNode): string;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=InteropConvertor.d.ts.map
|