quicktype-core 23.3.5 → 23.3.7
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/input/io/NodeIO.js
CHANGED
|
@@ -47,7 +47,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.readableFromFileOrURL = readableFromFileOrURL;
|
|
49
49
|
exports.readFromFileOrURL = readFromFileOrURL;
|
|
50
|
-
const fs = __importStar(require("
|
|
50
|
+
const fs = __importStar(require("fs"));
|
|
51
|
+
const path = __importStar(require("path"));
|
|
51
52
|
const ts_necessities_1 = require("@glideapps/ts-necessities");
|
|
52
53
|
const browser_or_node_1 = require("browser-or-node");
|
|
53
54
|
const is_url_1 = __importDefault(require("is-url"));
|
|
@@ -72,6 +73,16 @@ function parseHeaders(httpHeaders) {
|
|
|
72
73
|
return result;
|
|
73
74
|
}, {});
|
|
74
75
|
}
|
|
76
|
+
function resolveSymbolicLink(filePath) {
|
|
77
|
+
if (!fs.lstatSync(filePath).isSymbolicLink()) {
|
|
78
|
+
return filePath;
|
|
79
|
+
}
|
|
80
|
+
const linkPath = fs.readlinkSync(filePath);
|
|
81
|
+
if (path.isAbsolute(linkPath)) {
|
|
82
|
+
return linkPath;
|
|
83
|
+
}
|
|
84
|
+
return path.join(path.dirname(filePath), linkPath);
|
|
85
|
+
}
|
|
75
86
|
function readableFromFileOrURL(fileOrURL, httpHeaders) {
|
|
76
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
88
|
try {
|
|
@@ -86,9 +97,7 @@ function readableFromFileOrURL(fileOrURL, httpHeaders) {
|
|
|
86
97
|
// Cast node readable to isomorphic readable from readable-stream
|
|
87
98
|
return process.stdin;
|
|
88
99
|
}
|
|
89
|
-
const filePath =
|
|
90
|
-
? fs.readlinkSync(fileOrURL)
|
|
91
|
-
: fileOrURL;
|
|
100
|
+
const filePath = resolveSymbolicLink(fileOrURL);
|
|
92
101
|
if (fs.existsSync(filePath)) {
|
|
93
102
|
// Cast node readable to isomorphic readable from readable-stream
|
|
94
103
|
return fs.createReadStream(filePath, "utf8");
|
|
@@ -732,11 +732,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
732
732
|
* a member called 'value' value = value will screw up the compiler
|
|
733
733
|
*/
|
|
734
734
|
const checkConst = this.lookupGlobalName(utils_1.GlobalNames.CheckConstraint);
|
|
735
|
-
if (
|
|
736
|
-
property.type.findMember("null") !== undefined)
|
|
737
|
-
(property.isOptional &&
|
|
738
|
-
property.type.kind !== "null" &&
|
|
739
|
-
property.type.kind !== "any")) {
|
|
735
|
+
if (property.type instanceof Type_1.UnionType &&
|
|
736
|
+
property.type.findMember("null") !== undefined) {
|
|
740
737
|
this.emitLine(rendered, " ", getterName, "() const { return ", name, "; }");
|
|
741
738
|
if (constraints === null || constraints === void 0 ? void 0 : constraints.has(jsonName)) {
|
|
742
739
|
this.emitLine("void ", setterName, "(", rendered, " value) { if (value) ", checkConst, "(", this._stringType.createStringLiteral([name]), ", ", this.constraintMember(jsonName), ", *value); this->", name, " = value; }");
|
|
@@ -1416,6 +1413,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1416
1413
|
this.ensureBlankLine();
|
|
1417
1414
|
});
|
|
1418
1415
|
this.ensureBlankLine();
|
|
1416
|
+
this.emitBlock([
|
|
1417
|
+
"inline void ",
|
|
1418
|
+
checkConst,
|
|
1419
|
+
"(",
|
|
1420
|
+
this._stringType.getConstType(),
|
|
1421
|
+
" name, ",
|
|
1422
|
+
this.withConst(classConstraint),
|
|
1423
|
+
" & c, const ",
|
|
1424
|
+
this._optionalType,
|
|
1425
|
+
"<",
|
|
1426
|
+
cppType,
|
|
1427
|
+
"> & value)",
|
|
1428
|
+
], false, () => {
|
|
1429
|
+
this.emitBlock(["if (value)"], false, () => {
|
|
1430
|
+
this.emitLine(checkConst, "(name, c, *value);");
|
|
1431
|
+
});
|
|
1432
|
+
});
|
|
1433
|
+
this.ensureBlankLine();
|
|
1419
1434
|
}
|
|
1420
1435
|
emitConstraintClasses() {
|
|
1421
1436
|
const ourQualifier = this.ourQualifier(false);
|
|
@@ -1537,6 +1552,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1537
1552
|
});
|
|
1538
1553
|
this.ensureBlankLine();
|
|
1539
1554
|
});
|
|
1555
|
+
this.ensureBlankLine();
|
|
1556
|
+
this.emitBlock([
|
|
1557
|
+
"inline void ",
|
|
1558
|
+
checkConst,
|
|
1559
|
+
"(",
|
|
1560
|
+
this._stringType.getConstType(),
|
|
1561
|
+
" name, ",
|
|
1562
|
+
this.withConst(classConstraint),
|
|
1563
|
+
" & c, const ",
|
|
1564
|
+
this._optionalType,
|
|
1565
|
+
"<",
|
|
1566
|
+
this._stringType.getType(),
|
|
1567
|
+
"> & value)",
|
|
1568
|
+
], false, () => {
|
|
1569
|
+
this.emitBlock(["if (value)"], false, () => {
|
|
1570
|
+
this.emitLine(checkConst, "(name, c, *value);");
|
|
1571
|
+
});
|
|
1572
|
+
});
|
|
1540
1573
|
}
|
|
1541
1574
|
emitHelperFunctions() {
|
|
1542
1575
|
this._stringType.emitHelperFunctions();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicktype-core",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.7",
|
|
4
4
|
"description": "The quicktype engine as a library",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
52
|
"browser": {
|
|
53
|
-
"fs": false
|
|
53
|
+
"fs": false,
|
|
54
|
+
"path": false
|
|
54
55
|
}
|
|
55
56
|
}
|