@idlizer/core 2.1.7 → 2.1.9-arktscgen-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/IndentedPrinter.js +2 -0
- package/build/lib/src/Language.d.ts +1 -0
- package/build/lib/src/Language.js +3 -0
- package/build/lib/src/LanguageWriters/ArgConvertors.d.ts +18 -3
- package/build/lib/src/LanguageWriters/ArgConvertors.js +154 -23
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +29 -4
- package/build/lib/src/LanguageWriters/LanguageWriter.js +42 -0
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.js +23 -10
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertor.d.ts +24 -0
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertor.js +69 -0
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertors.d.ts +25 -0
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertors.js +128 -0
- package/build/lib/src/LanguageWriters/index.js +4 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +5 -5
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +25 -23
- package/build/lib/src/LanguageWriters/writers/CLikeLanguageWriter.d.ts +1 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +11 -2
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +43 -10
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.d.ts +2 -2
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +20 -11
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +2 -2
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +3 -3
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.d.ts +149 -0
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.js +495 -0
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +2 -2
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +6 -4
- package/build/lib/src/LibraryInterface.d.ts +2 -0
- package/build/lib/src/config.d.ts +132 -66
- package/build/lib/src/config.js +4 -2
- package/build/lib/src/configDescriber.d.ts +1 -1
- package/build/lib/src/configDescriber.js +1 -1
- package/build/lib/src/from-idl/DtsPrinter.js +10 -7
- package/build/lib/src/from-idl/IDLLinter.d.ts +0 -1
- package/build/lib/src/from-idl/IDLLinter.js +0 -6
- package/build/lib/src/from-idl/deserialize.js +7 -21
- package/build/lib/src/idl.d.ts +4 -13
- package/build/lib/src/idl.js +24 -58
- package/build/lib/src/idlize.js +2 -0
- package/build/lib/src/index.d.ts +2 -0
- package/build/lib/src/index.js +2 -0
- package/build/lib/src/peer-generation/LayoutManager.d.ts +4 -1
- package/build/lib/src/peer-generation/LayoutManager.js +5 -1
- package/build/lib/src/peer-generation/Materialized.d.ts +7 -3
- package/build/lib/src/peer-generation/Materialized.js +18 -3
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +5 -2
- package/build/lib/src/peer-generation/PeerLibrary.js +26 -6
- package/build/lib/src/peer-generation/PeerMethod.d.ts +1 -1
- package/build/lib/src/peer-generation/getSuperType.d.ts +5 -0
- package/build/lib/src/peer-generation/getSuperType.js +55 -0
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.d.ts +4 -0
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.js +7 -0
- package/build/lib/src/peer-generation/idl/common.js +1 -1
- package/build/lib/src/peer-generation/isExternalType.d.ts +4 -0
- package/build/lib/src/peer-generation/isExternalType.js +15 -0
- package/build/lib/src/peer-generation/isMaterialized.js +15 -7
- package/build/lib/src/util.d.ts +2 -0
- package/build/lib/src/util.js +17 -7
- package/build/lib/src/visitor.js +0 -1
- package/package.json +2 -2
- package/webidl2.js/LICENSE +0 -21
- package/webidl2.js/README.md +0 -827
- package/webidl2.js/dist/package.json +0 -3
|
@@ -17,7 +17,7 @@ import * as idl from '../idl';
|
|
|
17
17
|
import { resolveNamedNode } from '../resolveNamedNode';
|
|
18
18
|
import { Language } from '../Language';
|
|
19
19
|
import { createLanguageWriter } from '../LanguageWriters';
|
|
20
|
-
import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor, ClassConvertor, ArrayConvertor, FunctionConvertor, OptionConvertor, NumberConvertor, NumericConvertor, CustomTypeConvertor, UnionConvertor, MaterializedClassConvertor, BooleanConvertor, EnumConvertor, UndefinedConvertor, VoidConvertor, ImportTypeConvertor, InterfaceConvertor, BigIntToU64Convertor, ObjectConvertor, } from "../LanguageWriters/ArgConvertors";
|
|
20
|
+
import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor, ClassConvertor, ArrayConvertor, FunctionConvertor, OptionConvertor, NumberConvertor, NumericConvertor, CustomTypeConvertor, UnionConvertor, MaterializedClassConvertor, BooleanConvertor, EnumConvertor, UndefinedConvertor, VoidConvertor, ImportTypeConvertor, InterfaceConvertor, BigIntToU64Convertor, ObjectConvertor, ExternalTypeConvertor, } from "../LanguageWriters/ArgConvertors";
|
|
21
21
|
import { CppNameConvertor } from '../LanguageWriters/convertors/CppConvertors';
|
|
22
22
|
import { CJTypeNameConvertor } from '../LanguageWriters/convertors/CJConvertors';
|
|
23
23
|
import { CppConvertor } from '../LanguageWriters/convertors/CppConvertors';
|
|
@@ -32,6 +32,8 @@ import { isMaterialized } from './isMaterialized';
|
|
|
32
32
|
import { isInIdlizeInternal } from '../idlize';
|
|
33
33
|
import { isInCurrentModule } from './modules';
|
|
34
34
|
import { generatorConfiguration } from '../config';
|
|
35
|
+
import { isExternalType } from './isExternalType';
|
|
36
|
+
import { KotlinTypeNameConvertor } from '../LanguageWriters/convertors/KotlinConvertors';
|
|
35
37
|
export const lenses = {
|
|
36
38
|
globals: lib.lens(lib.select.files())
|
|
37
39
|
.pipe(lib.select.nodes())
|
|
@@ -86,11 +88,16 @@ export class PeerLibrary {
|
|
|
86
88
|
get buildersToGenerate() {
|
|
87
89
|
return Array.from(this.builderClasses.values()).filter(it => it.needBeGenerated);
|
|
88
90
|
}
|
|
89
|
-
get
|
|
90
|
-
|
|
91
|
+
get orderedMaterialized() {
|
|
92
|
+
function accessorName(decl) {
|
|
93
|
+
return idl.getQualifiedName(decl, "namespace.name");
|
|
94
|
+
}
|
|
95
|
+
return Array.from(this.materializedClasses.values()).filter(it => it.needBeGenerated)
|
|
96
|
+
.sort((a, b) => accessorName(a.decl).localeCompare(accessorName(b.decl)));
|
|
91
97
|
}
|
|
92
|
-
constructor(language, useMemoM3 = false) {
|
|
98
|
+
constructor(language, interopNativeModule, useMemoM3 = false) {
|
|
93
99
|
this.language = language;
|
|
100
|
+
this.interopNativeModule = interopNativeModule;
|
|
94
101
|
this.useMemoM3 = useMemoM3;
|
|
95
102
|
this.layout = LayoutManager.Empty();
|
|
96
103
|
this._syntheticFile = idl.createFile([]);
|
|
@@ -114,6 +121,7 @@ export class PeerLibrary {
|
|
|
114
121
|
case Language.JAVA: return new JavaTypeNameConvertor(this);
|
|
115
122
|
case Language.CJ: return new CJTypeNameConvertor(this);
|
|
116
123
|
case Language.CPP: return new CppConvertor(this);
|
|
124
|
+
case Language.KOTLIN: return new KotlinTypeNameConvertor(this);
|
|
117
125
|
}
|
|
118
126
|
throw new Error(`IdlNameConvertor for ${language} is not implemented`);
|
|
119
127
|
}
|
|
@@ -156,6 +164,15 @@ export class PeerLibrary {
|
|
|
156
164
|
this.referenceCache = new Map();
|
|
157
165
|
}
|
|
158
166
|
resolveTypeReference(type, singleStep) {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
const key = type.parent ? type : type.name; // does entry have resolve context or just FQN
|
|
169
|
+
let result = ((_a = this.referenceCache) === null || _a === void 0 ? void 0 : _a.has(key))
|
|
170
|
+
? this.referenceCache.get(key)
|
|
171
|
+
: this.resolveTypeReferenceUncached(type, singleStep);
|
|
172
|
+
(_b = this.referenceCache) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
resolveTypeReferenceUncached(type, singleStep) {
|
|
159
176
|
var _a, _b;
|
|
160
177
|
if ((_a = this.referenceCache) === null || _a === void 0 ? void 0 : _a.has(type))
|
|
161
178
|
return this.referenceCache.get(type);
|
|
@@ -365,7 +382,7 @@ export class PeerLibrary {
|
|
|
365
382
|
return new EnumConvertor(param, declaration.parent);
|
|
366
383
|
}
|
|
367
384
|
if (idl.isCallback(declaration)) {
|
|
368
|
-
return new CallbackConvertor(this, param, declaration);
|
|
385
|
+
return new CallbackConvertor(this, param, declaration, this.interopNativeModule);
|
|
369
386
|
}
|
|
370
387
|
if (idl.isTypedef(declaration)) {
|
|
371
388
|
if (isCyclicTypeDef(declaration)) {
|
|
@@ -375,8 +392,11 @@ export class PeerLibrary {
|
|
|
375
392
|
return new TypeAliasConvertor(this, param, declaration);
|
|
376
393
|
}
|
|
377
394
|
if (idl.isInterface(declaration)) {
|
|
395
|
+
if (isExternalType(declaration, this)) {
|
|
396
|
+
return new ExternalTypeConvertor(this, param, declaration);
|
|
397
|
+
}
|
|
378
398
|
if (isMaterialized(declaration, this)) {
|
|
379
|
-
return new MaterializedClassConvertor(param, declaration);
|
|
399
|
+
return new MaterializedClassConvertor(this, param, declaration);
|
|
380
400
|
}
|
|
381
401
|
if (isBuilderClass(declaration)) {
|
|
382
402
|
return new ClassConvertor(this, declarationName, param, declaration);
|
|
@@ -10,7 +10,7 @@ export declare class PeerMethod {
|
|
|
10
10
|
isCallSignature: boolean;
|
|
11
11
|
method: Method;
|
|
12
12
|
outArgConvertor?: ArgConvertor | undefined;
|
|
13
|
-
|
|
13
|
+
protected overloadIndex?: number;
|
|
14
14
|
constructor(originalParentName: string, argConvertors: ArgConvertor[], returnType: IDLType, isCallSignature: boolean, method: Method, outArgConvertor?: ArgConvertor | undefined);
|
|
15
15
|
get overloadedName(): string;
|
|
16
16
|
get fullMethodName(): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as idl from '../idl';
|
|
2
|
+
import { ReferenceResolver } from './ReferenceResolver';
|
|
3
|
+
export declare function getSuper(declaration: idl.IDLInterface, resolver: ReferenceResolver): idl.IDLInterface | undefined;
|
|
4
|
+
export declare function getSuperType(declaration: idl.IDLInterface, resolver: ReferenceResolver): idl.IDLReferenceType | undefined;
|
|
5
|
+
//# sourceMappingURL=getSuperType.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import * as idl from '../idl';
|
|
16
|
+
function getSuperCandidates(declaration, resolver) {
|
|
17
|
+
return declaration.inheritance
|
|
18
|
+
.map(it => [resolver.resolveTypeReference(it), it])
|
|
19
|
+
.filter(([it,]) => it && idl.isInterface(it) && idl.isClassSubkind(it))
|
|
20
|
+
.map(it => it);
|
|
21
|
+
}
|
|
22
|
+
function getSuperTuple(declaration, resolver) {
|
|
23
|
+
if (idl.isClassSubkind(declaration)) {
|
|
24
|
+
const found = declaration.inheritance.find(it => idl.hasExtAttribute(it, idl.IDLExtendedAttributes.Extends));
|
|
25
|
+
if (found) {
|
|
26
|
+
const resolved = resolver.resolveTypeReference(found);
|
|
27
|
+
if (resolved && idl.isInterface(resolved)) {
|
|
28
|
+
return [resolved, found];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const candidates = getSuperCandidates(declaration, resolver);
|
|
32
|
+
if (candidates.length > 0) {
|
|
33
|
+
return candidates[0];
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const fst = declaration.inheritance[0];
|
|
38
|
+
if (!fst) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const resolved = resolver.resolveTypeReference(fst);
|
|
42
|
+
if (!resolved || !idl.isInterface(resolved)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
return [resolved, fst];
|
|
46
|
+
}
|
|
47
|
+
export function getSuper(declaration, resolver) {
|
|
48
|
+
var _a;
|
|
49
|
+
return (_a = getSuperTuple(declaration, resolver)) === null || _a === void 0 ? void 0 : _a[0];
|
|
50
|
+
}
|
|
51
|
+
export function getSuperType(declaration, resolver) {
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = getSuperTuple(declaration, resolver)) === null || _a === void 0 ? void 0 : _a[1];
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=getSuperType.js.map
|
|
@@ -34,6 +34,10 @@ export declare class CJFeatureNameConvertor extends DeclarationNameConvertor {
|
|
|
34
34
|
convertEnum(decl: idl.IDLEnum): string;
|
|
35
35
|
static readonly I: CJFeatureNameConvertor;
|
|
36
36
|
}
|
|
37
|
+
export declare class KotlinFeatureNameConvertor extends DeclarationNameConvertor {
|
|
38
|
+
convertEnum(decl: idl.IDLEnum): string;
|
|
39
|
+
static readonly I: KotlinFeatureNameConvertor;
|
|
40
|
+
}
|
|
37
41
|
export declare function createDeclarationNameConvertor(language: Language): DeclarationNameConvertor;
|
|
38
42
|
export declare function createFeatureNameConvertor(language: Language): DeclarationNameConvertor;
|
|
39
43
|
//# sourceMappingURL=IdlNameConvertor.d.ts.map
|
|
@@ -85,6 +85,12 @@ export class CJFeatureNameConvertor extends DeclarationNameConvertor {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
CJFeatureNameConvertor.I = new CJFeatureNameConvertor();
|
|
88
|
+
export class KotlinFeatureNameConvertor extends DeclarationNameConvertor {
|
|
89
|
+
convertEnum(decl) {
|
|
90
|
+
return decl.name;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
KotlinFeatureNameConvertor.I = new KotlinFeatureNameConvertor();
|
|
88
94
|
export function createDeclarationNameConvertor(language) {
|
|
89
95
|
switch (language) {
|
|
90
96
|
case Language.ARKTS: return ETSDeclarationNameConvertor.I;
|
|
@@ -102,6 +108,7 @@ export function createFeatureNameConvertor(language) {
|
|
|
102
108
|
case Language.CPP:
|
|
103
109
|
case Language.TS: return TSFeatureNameConvertor.I;
|
|
104
110
|
case Language.CJ: return CJFeatureNameConvertor.I;
|
|
111
|
+
case Language.KOTLIN: return KotlinFeatureNameConvertor.I;
|
|
105
112
|
default: throw new Error(`Language ${language.toString()} is not supported`);
|
|
106
113
|
}
|
|
107
114
|
}
|
|
@@ -58,7 +58,7 @@ export function generifiedTypeName(refType, refName) {
|
|
|
58
58
|
var _a;
|
|
59
59
|
if (!refType)
|
|
60
60
|
return undefined;
|
|
61
|
-
const typeArgs = (_a = refType.typeArguments) === null || _a === void 0 ? void 0 : _a.map(it => idl.printType(it)).join(",");
|
|
61
|
+
const typeArgs = (_a = refType.typeArguments) === null || _a === void 0 ? void 0 : _a.map(it => idl.printType(it) /* FIXME: BUG! */).join(",");
|
|
62
62
|
return `${refName ? refName : refType.name}${typeArgs ? `<${typeArgs}>` : ``}`;
|
|
63
63
|
}
|
|
64
64
|
export function sanitizeGenerics(genericDeclarationString) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as idl from '../idl';
|
|
2
|
+
import { generatorConfiguration } from '../config';
|
|
3
|
+
export function isExternalType(declaration, resolver) {
|
|
4
|
+
// declarations outside of the generator input dirs
|
|
5
|
+
if (generatorConfiguration().externalTypes.get(declaration.name) != undefined)
|
|
6
|
+
return true;
|
|
7
|
+
// treat as external types only declarations with methods
|
|
8
|
+
if (declaration.methods.length == 0)
|
|
9
|
+
return false;
|
|
10
|
+
const pack = idl.getPackageName(declaration);
|
|
11
|
+
if (generatorConfiguration().externalPackages.includes(pack))
|
|
12
|
+
return true;
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=isExternalType.js.map
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
import { generatorConfiguration } from '../config';
|
|
16
16
|
import * as idl from '../idl';
|
|
17
17
|
import { isBuilderClass } from './BuilderClass';
|
|
18
|
+
import { isExternalType } from './isExternalType';
|
|
19
|
+
import { getSuper } from './getSuperType';
|
|
18
20
|
export function isMaterialized(declaration, resolver) {
|
|
19
21
|
var _a;
|
|
20
22
|
if (!idl.isInterfaceSubkind(declaration) && !idl.isClassSubkind(declaration))
|
|
@@ -28,7 +30,8 @@ export function isMaterialized(declaration, resolver) {
|
|
|
28
30
|
return true;
|
|
29
31
|
}
|
|
30
32
|
// TODO: rework this
|
|
31
|
-
|
|
33
|
+
// TODO: CustomComponent from components.custom config file
|
|
34
|
+
if (["BaseSpan", "CustomComponent"].includes(declaration.name)) {
|
|
32
35
|
return false;
|
|
33
36
|
}
|
|
34
37
|
for (const ignore of ["Attribute", "Method", "Interface"]) {
|
|
@@ -42,15 +45,19 @@ export function isMaterialized(declaration, resolver) {
|
|
|
42
45
|
if (generatorConfiguration().ignoreMaterialized.includes(declaration.name)) {
|
|
43
46
|
return false;
|
|
44
47
|
}
|
|
48
|
+
if (isExternalType(declaration, resolver)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
45
51
|
// A materialized class is a class or an interface with methods
|
|
46
52
|
// excluding components and related classes
|
|
47
53
|
if (declaration.methods.length > 0 || declaration.constructors.length > 0)
|
|
48
54
|
return true;
|
|
49
55
|
// Or a class or an interface derived from materialized class
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
const superClass = getSuper(declaration, resolver);
|
|
57
|
+
if (superClass) {
|
|
58
|
+
const superType = superClass;
|
|
52
59
|
if (!superType || !idl.isInterface(superType)) {
|
|
53
|
-
console.log(`Unable to resolve ${
|
|
60
|
+
console.log(`Unable to resolve ${superClass.name} type, consider ${declaration.name} to be not materialized`);
|
|
54
61
|
return false;
|
|
55
62
|
}
|
|
56
63
|
return isMaterialized(superType, resolver);
|
|
@@ -73,10 +80,11 @@ export function isStaticMaterialized(declaration, resolver) {
|
|
|
73
80
|
return false;
|
|
74
81
|
if (!declaration.methods.every(it => it.isStatic && !isSelfReturnMethod(it, declaration, resolver)))
|
|
75
82
|
return false;
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
const superClass = getSuper(declaration, resolver);
|
|
84
|
+
if (superClass) {
|
|
85
|
+
const superType = superClass;
|
|
78
86
|
if (!superType || !idl.isInterface(superType)) {
|
|
79
|
-
console.log(`Unable to resolve ${
|
|
87
|
+
console.log(`Unable to resolve ${superClass.name} type, consider ${declaration.name} to be not materialized`);
|
|
80
88
|
return false;
|
|
81
89
|
}
|
|
82
90
|
return isStaticMaterialized(superType, resolver);
|
package/build/lib/src/util.d.ts
CHANGED
|
@@ -90,5 +90,7 @@ type StringProperties<T> = {
|
|
|
90
90
|
[Property in keyof T as (T[Property] extends string ? Property : never)]: T[Property];
|
|
91
91
|
};
|
|
92
92
|
export declare function sorted<T, N extends keyof StringProperties<T>>(array: T[], key: ((value: T) => string) | N): T[];
|
|
93
|
+
export declare function getExtractorName(target: idl.IDLInterface, language: Language, toPtr?: boolean): string;
|
|
94
|
+
export declare function getExternalTypePackage(node: idl.IDLEntry): string | undefined;
|
|
93
95
|
export {};
|
|
94
96
|
//# sourceMappingURL=util.d.ts.map
|
package/build/lib/src/util.js
CHANGED
|
@@ -17,6 +17,7 @@ import * as fs from "fs";
|
|
|
17
17
|
import * as ts from "typescript";
|
|
18
18
|
import * as idl from "./idl";
|
|
19
19
|
import { Language } from './Language';
|
|
20
|
+
import { generatorConfiguration } from './config';
|
|
20
21
|
/** True if this is visible outside this file, false otherwise */
|
|
21
22
|
export function isNodePublic(node) {
|
|
22
23
|
return (ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Public) !== 0;
|
|
@@ -617,13 +618,10 @@ export function hashCodeFromString(value) {
|
|
|
617
618
|
return hash;
|
|
618
619
|
}
|
|
619
620
|
export function forceWriteFile(filePath, content) {
|
|
620
|
-
path.dirname(filePath)
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}
|
|
625
|
-
return dirPath;
|
|
626
|
-
}, ".");
|
|
621
|
+
const dirPath = path.dirname(filePath);
|
|
622
|
+
if (!fs.existsSync(dirPath)) {
|
|
623
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
624
|
+
}
|
|
627
625
|
fs.writeFileSync(filePath, content);
|
|
628
626
|
}
|
|
629
627
|
export function findVersion() {
|
|
@@ -692,4 +690,16 @@ export function sorted(array, key) {
|
|
|
692
690
|
return array.map(it => it)
|
|
693
691
|
.sort((a, b) => comparator.compare(a[key], b[key]));
|
|
694
692
|
}
|
|
693
|
+
export function getExtractorName(target, language, toPtr = true) {
|
|
694
|
+
// TODO: Update for CJ
|
|
695
|
+
return toPtr ? `to${target.name}Ptr` : `from${target.name}Ptr`;
|
|
696
|
+
}
|
|
697
|
+
export function getExternalTypePackage(node) {
|
|
698
|
+
if (!idl.isInterface(node))
|
|
699
|
+
return undefined;
|
|
700
|
+
const pack = idl.getPackageName(node);
|
|
701
|
+
if (generatorConfiguration().externalPackages.includes(pack))
|
|
702
|
+
return `@${pack}`;
|
|
703
|
+
return generatorConfiguration().externalTypes.get(node.name);
|
|
704
|
+
}
|
|
695
705
|
//# sourceMappingURL=util.js.map
|
package/build/lib/src/visitor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlizer/core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9-arktscgen-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.7.
|
|
37
|
+
"@koalaui/interop": "1.7.5",
|
|
38
38
|
"typescript": "4.9.5",
|
|
39
39
|
"@types/node": "^18.0.0"
|
|
40
40
|
},
|
package/webidl2.js/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|