breeze-bindgen 1.1.12 → 1.1.13
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/dist/cli.mjs +29 -1
- package/dist/core.cjs +29 -1
- package/dist/core.mjs +29 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
@@ -256,6 +256,7 @@ declare module '${tsModuleName}' {
|
|
256
256
|
const structName = node_struct.name;
|
257
257
|
const fields = [];
|
258
258
|
const methods = [];
|
259
|
+
const properties = /* @__PURE__ */ new Map();
|
259
260
|
const bases = node_struct.bases?.filter((base) => !base.type.qualType.includes("std::")).map((base) => ({
|
260
261
|
access: base.access,
|
261
262
|
type: ctypeToQualified(base.type.qualType, path)
|
@@ -397,7 +398,6 @@ template<> struct js_bind<${fullName}> {
|
|
397
398
|
binding += `
|
398
399
|
.base<${bases[0].type}>()`;
|
399
400
|
}
|
400
|
-
const properties = /* @__PURE__ */ new Map();
|
401
401
|
for (const method of methods) {
|
402
402
|
if (method.isGetter) {
|
403
403
|
const prop = properties.get(method.propertyName) || {};
|
@@ -455,7 +455,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
455
455
|
typescriptDef += `
|
456
456
|
${fieldDef.trim()}`;
|
457
457
|
});
|
458
|
+
for (const method of methods) {
|
459
|
+
if (method.isGetter) {
|
460
|
+
const prop = properties.get(method.propertyName) || {};
|
461
|
+
prop.getter = method;
|
462
|
+
properties.set(method.propertyName, prop);
|
463
|
+
} else if (method.isSetter) {
|
464
|
+
const prop = properties.get(method.propertyName) || {};
|
465
|
+
prop.setter = method;
|
466
|
+
properties.set(method.propertyName, prop);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
for (const [propName, { getter, setter }] of properties) {
|
470
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
471
|
+
if (setter) {
|
472
|
+
propDef += `
|
473
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
474
|
+
}
|
475
|
+
if (getter?.comment) {
|
476
|
+
propDef = `
|
477
|
+
/**
|
478
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
479
|
+
*/
|
480
|
+
${propDef}`;
|
481
|
+
}
|
482
|
+
typescriptDef += `
|
483
|
+
${propDef.trim()}`;
|
484
|
+
}
|
458
485
|
methods.forEach((method) => {
|
486
|
+
if (method.isGetter || method.isSetter) return;
|
459
487
|
let methodDef = `${method.static ? "static " : ""}${method.name}(${method.argNames && method.argNames.length > 0 ? method.args.map((arg, i) => `${method.argNames[i] || `arg${i}`}${arg.startsWith("std::optional") ? "?" : ""}: ${cTypeToTypeScript(arg, nameFilter)}`).join(", ") : ""}): ${cTypeToTypeScript(method.returnType, nameFilter)}`;
|
460
488
|
let comments = "";
|
461
489
|
if (method.comment) comments += method.comment;
|
package/dist/core.cjs
CHANGED
@@ -466,6 +466,7 @@ declare module '${tsModuleName}' {
|
|
466
466
|
const structName = node_struct.name;
|
467
467
|
const fields = [];
|
468
468
|
const methods = [];
|
469
|
+
const properties = /* @__PURE__ */ new Map();
|
469
470
|
const bases = node_struct.bases?.filter((base) => !base.type.qualType.includes("std::")).map((base) => ({
|
470
471
|
access: base.access,
|
471
472
|
type: ctypeToQualified(base.type.qualType, path)
|
@@ -607,7 +608,6 @@ template<> struct js_bind<${fullName}> {
|
|
607
608
|
binding += `
|
608
609
|
.base<${bases[0].type}>()`;
|
609
610
|
}
|
610
|
-
const properties = /* @__PURE__ */ new Map();
|
611
611
|
for (const method of methods) {
|
612
612
|
if (method.isGetter) {
|
613
613
|
const prop = properties.get(method.propertyName) || {};
|
@@ -665,7 +665,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
665
665
|
typescriptDef += `
|
666
666
|
${fieldDef.trim()}`;
|
667
667
|
});
|
668
|
+
for (const method of methods) {
|
669
|
+
if (method.isGetter) {
|
670
|
+
const prop = properties.get(method.propertyName) || {};
|
671
|
+
prop.getter = method;
|
672
|
+
properties.set(method.propertyName, prop);
|
673
|
+
} else if (method.isSetter) {
|
674
|
+
const prop = properties.get(method.propertyName) || {};
|
675
|
+
prop.setter = method;
|
676
|
+
properties.set(method.propertyName, prop);
|
677
|
+
}
|
678
|
+
}
|
679
|
+
for (const [propName, { getter, setter }] of properties) {
|
680
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
681
|
+
if (setter) {
|
682
|
+
propDef += `
|
683
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
684
|
+
}
|
685
|
+
if (getter?.comment) {
|
686
|
+
propDef = `
|
687
|
+
/**
|
688
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
689
|
+
*/
|
690
|
+
${propDef}`;
|
691
|
+
}
|
692
|
+
typescriptDef += `
|
693
|
+
${propDef.trim()}`;
|
694
|
+
}
|
668
695
|
methods.forEach((method) => {
|
696
|
+
if (method.isGetter || method.isSetter) return;
|
669
697
|
let methodDef = `${method.static ? "static " : ""}${method.name}(${method.argNames && method.argNames.length > 0 ? method.args.map((arg, i) => `${method.argNames[i] || `arg${i}`}${arg.startsWith("std::optional") ? "?" : ""}: ${cTypeToTypeScript(arg, nameFilter)}`).join(", ") : ""}): ${cTypeToTypeScript(method.returnType, nameFilter)}`;
|
670
698
|
let comments = "";
|
671
699
|
if (method.comment) comments += method.comment;
|
package/dist/core.mjs
CHANGED
@@ -462,6 +462,7 @@ declare module '${tsModuleName}' {
|
|
462
462
|
const structName = node_struct.name;
|
463
463
|
const fields = [];
|
464
464
|
const methods = [];
|
465
|
+
const properties = /* @__PURE__ */ new Map();
|
465
466
|
const bases = node_struct.bases?.filter((base) => !base.type.qualType.includes("std::")).map((base) => ({
|
466
467
|
access: base.access,
|
467
468
|
type: ctypeToQualified(base.type.qualType, path)
|
@@ -603,7 +604,6 @@ template<> struct js_bind<${fullName}> {
|
|
603
604
|
binding += `
|
604
605
|
.base<${bases[0].type}>()`;
|
605
606
|
}
|
606
|
-
const properties = /* @__PURE__ */ new Map();
|
607
607
|
for (const method of methods) {
|
608
608
|
if (method.isGetter) {
|
609
609
|
const prop = properties.get(method.propertyName) || {};
|
@@ -661,7 +661,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
661
661
|
typescriptDef += `
|
662
662
|
${fieldDef.trim()}`;
|
663
663
|
});
|
664
|
+
for (const method of methods) {
|
665
|
+
if (method.isGetter) {
|
666
|
+
const prop = properties.get(method.propertyName) || {};
|
667
|
+
prop.getter = method;
|
668
|
+
properties.set(method.propertyName, prop);
|
669
|
+
} else if (method.isSetter) {
|
670
|
+
const prop = properties.get(method.propertyName) || {};
|
671
|
+
prop.setter = method;
|
672
|
+
properties.set(method.propertyName, prop);
|
673
|
+
}
|
674
|
+
}
|
675
|
+
for (const [propName, { getter, setter }] of properties) {
|
676
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
677
|
+
if (setter) {
|
678
|
+
propDef += `
|
679
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
680
|
+
}
|
681
|
+
if (getter?.comment) {
|
682
|
+
propDef = `
|
683
|
+
/**
|
684
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
685
|
+
*/
|
686
|
+
${propDef}`;
|
687
|
+
}
|
688
|
+
typescriptDef += `
|
689
|
+
${propDef.trim()}`;
|
690
|
+
}
|
664
691
|
methods.forEach((method) => {
|
692
|
+
if (method.isGetter || method.isSetter) return;
|
665
693
|
let methodDef = `${method.static ? "static " : ""}${method.name}(${method.argNames && method.argNames.length > 0 ? method.args.map((arg, i) => `${method.argNames[i] || `arg${i}`}${arg.startsWith("std::optional") ? "?" : ""}: ${cTypeToTypeScript(arg, nameFilter)}`).join(", ") : ""}): ${cTypeToTypeScript(method.returnType, nameFilter)}`;
|
666
694
|
let comments = "";
|
667
695
|
if (method.comment) comments += method.comment;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
3
3
|
"name": "breeze-bindgen",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.13",
|
5
5
|
"main": "dist/core.cjs",
|
6
6
|
"module": "dist/core.mjs",
|
7
7
|
"types": "dist/core.d.ts",
|