quicktype-core 23.3.6 → 23.3.8

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.
@@ -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("node:fs"));
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 = fs.lstatSync(fileOrURL).isSymbolicLink()
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");
@@ -1257,8 +1257,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1257
1257
  ]), ") x = ", ourQualifier, enumName, "::", name, ";");
1258
1258
  onFirst = false;
1259
1259
  });
1260
- this.emitLine('else { throw std::runtime_error("Input JSON does not conform to schema!"); }');
1261
1260
  }
1261
+ this.emitLine('else { throw std::runtime_error("Input JSON does not conform to schema!"); }');
1262
1262
  });
1263
1263
  this.ensureBlankLine();
1264
1264
  this.emitBlock([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.3.6",
3
+ "version": "23.3.8",
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
  }