breeze-bindgen 1.1.12 → 1.1.14
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 +32 -2
- package/dist/core.cjs +38 -8
- package/dist/core.mjs +38 -8
- 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) || {};
|
|
@@ -411,7 +411,9 @@ template<> struct js_bind<${fullName}> {
|
|
|
411
411
|
}
|
|
412
412
|
for (const [propName, { getter, setter }] of properties) {
|
|
413
413
|
if (!getter) {
|
|
414
|
-
|
|
414
|
+
console.log(`Found setter ${setter.name} without getter for property ${propName}, treating as normal method`);
|
|
415
|
+
setter.isSetter = false;
|
|
416
|
+
continue;
|
|
415
417
|
}
|
|
416
418
|
if (setter) {
|
|
417
419
|
binding += `
|
|
@@ -455,7 +457,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
|
455
457
|
typescriptDef += `
|
|
456
458
|
${fieldDef.trim()}`;
|
|
457
459
|
});
|
|
460
|
+
for (const method of methods) {
|
|
461
|
+
if (method.isGetter) {
|
|
462
|
+
const prop = properties.get(method.propertyName) || {};
|
|
463
|
+
prop.getter = method;
|
|
464
|
+
properties.set(method.propertyName, prop);
|
|
465
|
+
} else if (method.isSetter) {
|
|
466
|
+
const prop = properties.get(method.propertyName) || {};
|
|
467
|
+
prop.setter = method;
|
|
468
|
+
properties.set(method.propertyName, prop);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
for (const [propName, { getter, setter }] of properties) {
|
|
472
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
|
473
|
+
if (setter) {
|
|
474
|
+
propDef += `
|
|
475
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
|
476
|
+
}
|
|
477
|
+
if (getter?.comment) {
|
|
478
|
+
propDef = `
|
|
479
|
+
/**
|
|
480
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
|
481
|
+
*/
|
|
482
|
+
${propDef}`;
|
|
483
|
+
}
|
|
484
|
+
typescriptDef += `
|
|
485
|
+
${propDef.trim()}`;
|
|
486
|
+
}
|
|
458
487
|
methods.forEach((method) => {
|
|
488
|
+
if (method.isGetter || method.isSetter) return;
|
|
459
489
|
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
490
|
let comments = "";
|
|
461
491
|
if (method.comment) comments += method.comment;
|
package/dist/core.cjs
CHANGED
|
@@ -146,7 +146,7 @@ var require_fancy_log = __commonJS({
|
|
|
146
146
|
var util = require("util");
|
|
147
147
|
var Console = require("console").Console;
|
|
148
148
|
var supportsColor = require_color_support();
|
|
149
|
-
var
|
|
149
|
+
var console2 = new Console({
|
|
150
150
|
stdout: process.stdout,
|
|
151
151
|
stderr: process.stderr,
|
|
152
152
|
colorMode: false
|
|
@@ -179,31 +179,31 @@ var require_fancy_log = __commonJS({
|
|
|
179
179
|
function log2() {
|
|
180
180
|
var time = getTimestamp();
|
|
181
181
|
process.stdout.write(time + " ");
|
|
182
|
-
|
|
182
|
+
console2.log.apply(console2, arguments);
|
|
183
183
|
return this;
|
|
184
184
|
}
|
|
185
185
|
function info() {
|
|
186
186
|
var time = getTimestamp();
|
|
187
187
|
process.stdout.write(time + " ");
|
|
188
|
-
|
|
188
|
+
console2.info.apply(console2, arguments);
|
|
189
189
|
return this;
|
|
190
190
|
}
|
|
191
191
|
function dir() {
|
|
192
192
|
var time = getTimestamp();
|
|
193
193
|
process.stdout.write(time + " ");
|
|
194
|
-
|
|
194
|
+
console2.dir.apply(console2, arguments);
|
|
195
195
|
return this;
|
|
196
196
|
}
|
|
197
197
|
function warn() {
|
|
198
198
|
var time = getTimestamp();
|
|
199
199
|
process.stderr.write(time + " ");
|
|
200
|
-
|
|
200
|
+
console2.warn.apply(console2, arguments);
|
|
201
201
|
return this;
|
|
202
202
|
}
|
|
203
203
|
function error() {
|
|
204
204
|
var time = getTimestamp();
|
|
205
205
|
process.stderr.write(time + " ");
|
|
206
|
-
|
|
206
|
+
console2.error.apply(console2, arguments);
|
|
207
207
|
return this;
|
|
208
208
|
}
|
|
209
209
|
module2.exports = log2;
|
|
@@ -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) || {};
|
|
@@ -621,7 +621,9 @@ template<> struct js_bind<${fullName}> {
|
|
|
621
621
|
}
|
|
622
622
|
for (const [propName, { getter, setter }] of properties) {
|
|
623
623
|
if (!getter) {
|
|
624
|
-
|
|
624
|
+
console.log(`Found setter ${setter.name} without getter for property ${propName}, treating as normal method`);
|
|
625
|
+
setter.isSetter = false;
|
|
626
|
+
continue;
|
|
625
627
|
}
|
|
626
628
|
if (setter) {
|
|
627
629
|
binding += `
|
|
@@ -665,7 +667,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
|
665
667
|
typescriptDef += `
|
|
666
668
|
${fieldDef.trim()}`;
|
|
667
669
|
});
|
|
670
|
+
for (const method of methods) {
|
|
671
|
+
if (method.isGetter) {
|
|
672
|
+
const prop = properties.get(method.propertyName) || {};
|
|
673
|
+
prop.getter = method;
|
|
674
|
+
properties.set(method.propertyName, prop);
|
|
675
|
+
} else if (method.isSetter) {
|
|
676
|
+
const prop = properties.get(method.propertyName) || {};
|
|
677
|
+
prop.setter = method;
|
|
678
|
+
properties.set(method.propertyName, prop);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
for (const [propName, { getter, setter }] of properties) {
|
|
682
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
|
683
|
+
if (setter) {
|
|
684
|
+
propDef += `
|
|
685
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
|
686
|
+
}
|
|
687
|
+
if (getter?.comment) {
|
|
688
|
+
propDef = `
|
|
689
|
+
/**
|
|
690
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
|
691
|
+
*/
|
|
692
|
+
${propDef}`;
|
|
693
|
+
}
|
|
694
|
+
typescriptDef += `
|
|
695
|
+
${propDef.trim()}`;
|
|
696
|
+
}
|
|
668
697
|
methods.forEach((method) => {
|
|
698
|
+
if (method.isGetter || method.isSetter) return;
|
|
669
699
|
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
700
|
let comments = "";
|
|
671
701
|
if (method.comment) comments += method.comment;
|
package/dist/core.mjs
CHANGED
|
@@ -147,7 +147,7 @@ var require_fancy_log = __commonJS({
|
|
|
147
147
|
var util = __require("util");
|
|
148
148
|
var Console = __require("console").Console;
|
|
149
149
|
var supportsColor = require_color_support();
|
|
150
|
-
var
|
|
150
|
+
var console2 = new Console({
|
|
151
151
|
stdout: process.stdout,
|
|
152
152
|
stderr: process.stderr,
|
|
153
153
|
colorMode: false
|
|
@@ -180,31 +180,31 @@ var require_fancy_log = __commonJS({
|
|
|
180
180
|
function log2() {
|
|
181
181
|
var time = getTimestamp();
|
|
182
182
|
process.stdout.write(time + " ");
|
|
183
|
-
|
|
183
|
+
console2.log.apply(console2, arguments);
|
|
184
184
|
return this;
|
|
185
185
|
}
|
|
186
186
|
function info() {
|
|
187
187
|
var time = getTimestamp();
|
|
188
188
|
process.stdout.write(time + " ");
|
|
189
|
-
|
|
189
|
+
console2.info.apply(console2, arguments);
|
|
190
190
|
return this;
|
|
191
191
|
}
|
|
192
192
|
function dir() {
|
|
193
193
|
var time = getTimestamp();
|
|
194
194
|
process.stdout.write(time + " ");
|
|
195
|
-
|
|
195
|
+
console2.dir.apply(console2, arguments);
|
|
196
196
|
return this;
|
|
197
197
|
}
|
|
198
198
|
function warn() {
|
|
199
199
|
var time = getTimestamp();
|
|
200
200
|
process.stderr.write(time + " ");
|
|
201
|
-
|
|
201
|
+
console2.warn.apply(console2, arguments);
|
|
202
202
|
return this;
|
|
203
203
|
}
|
|
204
204
|
function error() {
|
|
205
205
|
var time = getTimestamp();
|
|
206
206
|
process.stderr.write(time + " ");
|
|
207
|
-
|
|
207
|
+
console2.error.apply(console2, arguments);
|
|
208
208
|
return this;
|
|
209
209
|
}
|
|
210
210
|
module.exports = log2;
|
|
@@ -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) || {};
|
|
@@ -617,7 +617,9 @@ template<> struct js_bind<${fullName}> {
|
|
|
617
617
|
}
|
|
618
618
|
for (const [propName, { getter, setter }] of properties) {
|
|
619
619
|
if (!getter) {
|
|
620
|
-
|
|
620
|
+
console.log(`Found setter ${setter.name} without getter for property ${propName}, treating as normal method`);
|
|
621
|
+
setter.isSetter = false;
|
|
622
|
+
continue;
|
|
621
623
|
}
|
|
622
624
|
if (setter) {
|
|
623
625
|
binding += `
|
|
@@ -661,7 +663,35 @@ export class ${tsClassName}${bases.length > 0 ? ` extends ${bases.map((base) =>
|
|
|
661
663
|
typescriptDef += `
|
|
662
664
|
${fieldDef.trim()}`;
|
|
663
665
|
});
|
|
666
|
+
for (const method of methods) {
|
|
667
|
+
if (method.isGetter) {
|
|
668
|
+
const prop = properties.get(method.propertyName) || {};
|
|
669
|
+
prop.getter = method;
|
|
670
|
+
properties.set(method.propertyName, prop);
|
|
671
|
+
} else if (method.isSetter) {
|
|
672
|
+
const prop = properties.get(method.propertyName) || {};
|
|
673
|
+
prop.setter = method;
|
|
674
|
+
properties.set(method.propertyName, prop);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
for (const [propName, { getter, setter }] of properties) {
|
|
678
|
+
let propDef = `get ${propName}(): ${cTypeToTypeScript(getter.returnType, nameFilter)};`;
|
|
679
|
+
if (setter) {
|
|
680
|
+
propDef += `
|
|
681
|
+
set ${propName}(value: ${cTypeToTypeScript(setter.args[0], nameFilter)});`;
|
|
682
|
+
}
|
|
683
|
+
if (getter?.comment) {
|
|
684
|
+
propDef = `
|
|
685
|
+
/**
|
|
686
|
+
* ${getter.comment.split("\n").join("\n * ")}
|
|
687
|
+
*/
|
|
688
|
+
${propDef}`;
|
|
689
|
+
}
|
|
690
|
+
typescriptDef += `
|
|
691
|
+
${propDef.trim()}`;
|
|
692
|
+
}
|
|
664
693
|
methods.forEach((method) => {
|
|
694
|
+
if (method.isGetter || method.isSetter) return;
|
|
665
695
|
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
696
|
let comments = "";
|
|
667
697
|
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.14",
|
|
5
5
|
"main": "dist/core.cjs",
|
|
6
6
|
"module": "dist/core.mjs",
|
|
7
7
|
"types": "dist/core.d.ts",
|