@idlizer/core 2.1.2 → 2.1.5
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.d.ts +3 -3
- package/build/lib/src/LanguageWriters/ArgConvertors.js +36 -30
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +26 -13
- package/build/lib/src/LanguageWriters/LanguageWriter.js +26 -52
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.d.ts +2 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.js +16 -5
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.d.ts +4 -2
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.js +20 -12
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.js +7 -17
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.d.ts +4 -2
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.js +9 -3
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.d.ts +2 -1
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.js +24 -4
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.d.ts +4 -2
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.js +47 -28
- package/build/lib/src/LanguageWriters/nameConvertor.d.ts +3 -1
- package/build/lib/src/LanguageWriters/nameConvertor.js +5 -1
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +12 -9
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +10 -37
- package/build/lib/src/LanguageWriters/writers/CLikeLanguageWriter.d.ts +4 -1
- package/build/lib/src/LanguageWriters/writers/CLikeLanguageWriter.js +1 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +9 -9
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +15 -24
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.d.ts +14 -8
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +18 -18
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +4 -6
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +15 -14
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +7 -5
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +22 -43
- package/build/lib/src/LibraryInterface.d.ts +1 -4
- package/build/lib/src/config.d.ts +206 -66
- package/build/lib/src/config.js +7 -3
- package/build/lib/src/configDescriber.d.ts +30 -3
- package/build/lib/src/configDescriber.js +99 -1
- package/build/lib/src/from-idl/DtsPrinter.js +30 -18
- package/build/lib/src/from-idl/IDLLinter.d.ts +40 -7
- package/build/lib/src/from-idl/IDLLinter.js +211 -25
- package/build/lib/src/from-idl/common.js +1 -1
- package/build/lib/src/from-idl/deserialize.d.ts +4 -1
- package/build/lib/src/from-idl/deserialize.js +434 -346
- package/build/lib/src/idl.d.ts +25 -17
- package/build/lib/src/idl.js +363 -109
- package/build/lib/src/idlize.d.ts +2 -1
- package/build/lib/src/idlize.js +82 -26
- package/build/lib/src/index.d.ts +4 -3
- package/build/lib/src/index.js +3 -2
- package/build/lib/src/options.d.ts +1 -1
- package/build/lib/src/peer-generation/BuilderClass.d.ts +0 -2
- package/build/lib/src/peer-generation/BuilderClass.js +0 -8
- package/build/lib/src/peer-generation/LayoutManager.d.ts +10 -3
- package/build/lib/src/peer-generation/LayoutManager.js +3 -2
- package/build/lib/src/peer-generation/Materialized.d.ts +1 -1
- package/build/lib/src/peer-generation/Materialized.js +2 -2
- package/build/lib/src/peer-generation/PeerClass.d.ts +3 -8
- package/build/lib/src/peer-generation/PeerClass.js +0 -1
- package/build/lib/src/peer-generation/PeerFile.d.ts +1 -2
- package/build/lib/src/peer-generation/PeerFile.js +1 -1
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +12 -7
- package/build/lib/src/peer-generation/PeerLibrary.js +129 -65
- package/build/lib/src/peer-generation/ReferenceResolver.d.ts +1 -1
- package/build/lib/src/peer-generation/ReferenceResolver.js +2 -2
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.d.ts +1 -0
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.js +6 -2
- package/build/lib/src/peer-generation/idl/common.d.ts +2 -1
- package/build/lib/src/peer-generation/idl/common.js +13 -2
- package/build/lib/src/peer-generation/isMaterialized.js +25 -8
- package/build/lib/src/peer-generation/unions.d.ts +3 -2
- package/build/lib/src/peer-generation/unions.js +6 -2
- package/build/lib/src/resolveNamedNode.d.ts +3 -0
- package/build/lib/src/resolveNamedNode.js +105 -0
- package/build/lib/src/util.d.ts +6 -0
- package/build/lib/src/util.js +33 -0
- package/build/lib/src/visitor.d.ts +0 -1
- package/build/lib/src/visitor.js +1 -7
- package/package.json +2 -2
- package/webidl2.js/LICENSE +21 -0
- package/webidl2.js/README.md +827 -0
- package/webidl2.js/dist/package.json +3 -0
- package/webidl2.js/dist/webidl2.js +35 -7
package/build/lib/src/util.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare function snakeCaseToCamelCase(input: string, tailToLowerCase?: bo
|
|
|
53
53
|
export declare function toCamelCase(input: string): string;
|
|
54
54
|
export declare function isUpperCase(s: string): boolean;
|
|
55
55
|
export declare function camelCaseToUpperSnakeCase(input: string): string;
|
|
56
|
+
export declare function snakeToLowCamelNode(node: idl.IDLEntry): string;
|
|
56
57
|
export declare function renameDtsToPeer(fileName: string, language: Language, withFileExtension?: boolean): string;
|
|
57
58
|
export declare function renameDtsToComponent(fileName: string, language: Language, withFileExtension?: boolean): string;
|
|
58
59
|
export declare function renameDtsToInterfaces(fileName: string, language: Language, withFileExtension?: boolean): string;
|
|
@@ -84,4 +85,9 @@ export declare class Lazy<T> {
|
|
|
84
85
|
export declare function lazy<T>(factory: () => T): Lazy<T>;
|
|
85
86
|
export declare function isInNamespace(node: idl.IDLEntry): boolean;
|
|
86
87
|
export declare function rightmostIndexOf<T>(array: T[], predicate: (value: T) => boolean): number;
|
|
88
|
+
type StringProperties<T> = {
|
|
89
|
+
[Property in keyof T as (T[Property] extends string ? Property : never)]: T[Property];
|
|
90
|
+
};
|
|
91
|
+
export declare function sorted<T, N extends keyof StringProperties<T>>(array: T[], key: ((value: T) => string) | N): T[];
|
|
92
|
+
export {};
|
|
87
93
|
//# sourceMappingURL=util.d.ts.map
|
package/build/lib/src/util.js
CHANGED
|
@@ -300,6 +300,9 @@ export function identName(node) {
|
|
|
300
300
|
return `void`;
|
|
301
301
|
if (node.kind == ts.SyntaxKind.UndefinedKeyword)
|
|
302
302
|
return `undefined`;
|
|
303
|
+
if (ts.isThisTypeNode(node)) {
|
|
304
|
+
return 'this';
|
|
305
|
+
}
|
|
303
306
|
if (ts.isVariableDeclaration(node)) {
|
|
304
307
|
return identString(node.name);
|
|
305
308
|
}
|
|
@@ -340,6 +343,9 @@ export function identName(node) {
|
|
|
340
343
|
if (ts.isComputedPropertyName(node)) {
|
|
341
344
|
return identString(node);
|
|
342
345
|
}
|
|
346
|
+
if (ts.isExportAssignment(node)) {
|
|
347
|
+
return node.expression.getText();
|
|
348
|
+
}
|
|
343
349
|
if (ts.isUnionTypeNode(node)) {
|
|
344
350
|
return `UnionType`;
|
|
345
351
|
}
|
|
@@ -469,6 +475,22 @@ export function camelCaseToUpperSnakeCase(input) {
|
|
|
469
475
|
.map(s => toUpperSnakeCase(s))
|
|
470
476
|
.join('_');
|
|
471
477
|
}
|
|
478
|
+
export function snakeToLowCamelNode(node) {
|
|
479
|
+
if (!node.fileName) {
|
|
480
|
+
throw new Error("Invalid Convert");
|
|
481
|
+
}
|
|
482
|
+
const classname = path.basename(node.fileName).replace(".idl", "").replace(".d.ts", "");
|
|
483
|
+
return classname
|
|
484
|
+
.split('_')
|
|
485
|
+
.filter(word => word !== '')
|
|
486
|
+
.map((word, index) => {
|
|
487
|
+
if (index === 0) {
|
|
488
|
+
return word.toLowerCase();
|
|
489
|
+
}
|
|
490
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
491
|
+
})
|
|
492
|
+
.join('');
|
|
493
|
+
}
|
|
472
494
|
export function renameDtsToPeer(fileName, language, withFileExtension = true) {
|
|
473
495
|
const renamed = "Ark"
|
|
474
496
|
.concat(snakeCaseToCamelCase(fileName))
|
|
@@ -654,4 +676,15 @@ export function rightmostIndexOf(array, predicate) {
|
|
|
654
676
|
});
|
|
655
677
|
return result;
|
|
656
678
|
}
|
|
679
|
+
// sort array using external key function or internal string property
|
|
680
|
+
export function sorted(array, key) {
|
|
681
|
+
const comparator = new Intl.Collator();
|
|
682
|
+
if (typeof key === "function") {
|
|
683
|
+
return array.map(it => { return { sortKey: key(it), value: it }; })
|
|
684
|
+
.sort((a, b) => comparator.compare(a.sortKey, b.sortKey))
|
|
685
|
+
.map(it => it.value);
|
|
686
|
+
}
|
|
687
|
+
return array.map(it => it)
|
|
688
|
+
.sort((a, b) => comparator.compare(a[key], b[key]));
|
|
689
|
+
}
|
|
657
690
|
//# sourceMappingURL=util.js.map
|
|
@@ -30,7 +30,6 @@ export declare class IDLDependencyCollector implements IDLConverter<idl.IDLNode[
|
|
|
30
30
|
visitPrimitiveType(): idl.IDLNode[];
|
|
31
31
|
visitNamespace(decl: idl.IDLNamespace): idl.IDLNode[];
|
|
32
32
|
visitInterface(decl: idl.IDLInterface): idl.IDLNode[];
|
|
33
|
-
protected visitSupertype(type: idl.IDLType | idl.IDLInterface): idl.IDLNode[];
|
|
34
33
|
visitEnum(): idl.IDLNode[];
|
|
35
34
|
visitTypedef(decl: idl.IDLTypedef): idl.IDLNode[];
|
|
36
35
|
visitCallback(decl: idl.IDLCallback): idl.IDLNode[];
|
package/build/lib/src/visitor.js
CHANGED
|
@@ -90,7 +90,7 @@ export class IDLDependencyCollector {
|
|
|
90
90
|
return [
|
|
91
91
|
...decl.inheritance
|
|
92
92
|
.filter(it => it !== idl.IDLTopType)
|
|
93
|
-
.flatMap(it => this.
|
|
93
|
+
.flatMap(it => this.walk(it)),
|
|
94
94
|
...decl.properties
|
|
95
95
|
.filter(it => !it.isStatic)
|
|
96
96
|
.flatMap(it => this.walk(it.type)),
|
|
@@ -101,12 +101,6 @@ export class IDLDependencyCollector {
|
|
|
101
101
|
])
|
|
102
102
|
];
|
|
103
103
|
}
|
|
104
|
-
visitSupertype(type) {
|
|
105
|
-
if (idl.isInterface(type)) {
|
|
106
|
-
return this.walk(idl.createReferenceType(type));
|
|
107
|
-
}
|
|
108
|
-
return this.walk(type);
|
|
109
|
-
}
|
|
110
104
|
visitEnum() {
|
|
111
105
|
return [];
|
|
112
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlizer/core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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.15",
|
|
38
38
|
"typescript": "4.9.5",
|
|
39
39
|
"@types/node": "^18.0.0"
|
|
40
40
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Robin Berjon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|