thinkwell 0.5.6 → 0.5.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.
@@ -532,16 +532,16 @@ var require_typescript = __commonJS({
532
532
  var tsp;
533
533
  (function(tsp2) {
534
534
  const activeProgramTransformers = /* @__PURE__ */ new Set();
535
- const { dirname: dirname5 } = require("path");
535
+ const { dirname: dirname6 } = require("path");
536
536
  function getProjectDir(compilerOptions) {
537
- return compilerOptions.configFilePath && dirname5(compilerOptions.configFilePath);
537
+ return compilerOptions.configFilePath && dirname6(compilerOptions.configFilePath);
538
538
  }
539
539
  __name(getProjectDir, "getProjectDir");
540
540
  function getProjectConfig(compilerOptions, rootFileNames) {
541
541
  let configFilePath = compilerOptions.configFilePath;
542
542
  let projectDir = getProjectDir(compilerOptions);
543
543
  if (configFilePath === void 0) {
544
- const baseDir = rootFileNames.length > 0 ? dirname5(rootFileNames[0]) : projectDir ?? process.cwd();
544
+ const baseDir = rootFileNames.length > 0 ? dirname6(rootFileNames[0]) : projectDir ?? process.cwd();
545
545
  configFilePath = tsp2.tsShim.findConfigFile(baseDir, tsp2.tsShim.sys.fileExists);
546
546
  if (configFilePath) {
547
547
  const config = readConfig(configFilePath);
@@ -553,7 +553,7 @@ var require_typescript = __commonJS({
553
553
  }
554
554
  __name(getProjectConfig, "getProjectConfig");
555
555
  function readConfig(configFileNamePath) {
556
- const projectDir = dirname5(configFileNamePath);
556
+ const projectDir = dirname6(configFileNamePath);
557
557
  const result = tsp2.tsShim.readConfigFile(configFileNamePath, tsp2.tsShim.sys.readFile);
558
558
  if (result.error)
559
559
  throw new tsp2.TsPatchError("Error in tsconfig.json: " + result.error.messageText);
@@ -131462,7 +131462,7 @@ ${lanes.join("\n")}
131462
131462
  }
131463
131463
  __name(createImportCallExpressionUMD, "createImportCallExpressionUMD");
131464
131464
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
131465
- const resolve3 = factory2.createUniqueName("resolve");
131465
+ const resolve4 = factory2.createUniqueName("resolve");
131466
131466
  const reject = factory2.createUniqueName("reject");
131467
131467
  const parameters = [
131468
131468
  factory2.createParameterDeclaration(
@@ -131471,7 +131471,7 @@ ${lanes.join("\n")}
131471
131471
  /*dotDotDotToken*/
131472
131472
  void 0,
131473
131473
  /*name*/
131474
- resolve3
131474
+ resolve4
131475
131475
  ),
131476
131476
  factory2.createParameterDeclaration(
131477
131477
  /*modifiers*/
@@ -131488,7 +131488,7 @@ ${lanes.join("\n")}
131488
131488
  factory2.createIdentifier("require"),
131489
131489
  /*typeArguments*/
131490
131490
  void 0,
131491
- [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve3, reject]
131491
+ [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve4, reject]
131492
131492
  )
131493
131493
  )
131494
131494
  ]);
@@ -145024,10 +145024,10 @@ ${lanes.join("\n")}
145024
145024
  /*ignoreCase*/
145025
145025
  false
145026
145026
  )) {
145027
- const basename = getBaseFileName(a.fileName);
145028
- if (basename === "lib.d.ts" || basename === "lib.es6.d.ts")
145027
+ const basename2 = getBaseFileName(a.fileName);
145028
+ if (basename2 === "lib.d.ts" || basename2 === "lib.es6.d.ts")
145029
145029
  return 0;
145030
- const name = removeSuffix(removePrefix(basename, "lib."), ".d.ts");
145030
+ const name = removeSuffix(removePrefix(basename2, "lib."), ".d.ts");
145031
145031
  const index = libs.indexOf(name);
145032
145032
  if (index !== -1)
145033
145033
  return index + 1;
@@ -211800,8 +211800,8 @@ ${options.prefix}` : "\n" : options.prefix
211800
211800
  }
211801
211801
  }, "createProjectWatcher");
211802
211802
  for (const file of files) {
211803
- const basename = getBaseFileName(file);
211804
- if (basename === "package.json" || basename === "bower.json") {
211803
+ const basename2 = getBaseFileName(file);
211804
+ if (basename2 === "package.json" || basename2 === "bower.json") {
211805
211805
  createProjectWatcher(
211806
211806
  file,
211807
211807
  "FileWatcher"
@@ -215547,8 +215547,8 @@ All files are: ${JSON.stringify(names)}`,
215547
215547
  var _a;
215548
215548
  const fileOrDirectoryPath = removeIgnoredPath(this.toPath(fileOrDirectory));
215549
215549
  if (!fileOrDirectoryPath) return;
215550
- const basename = getBaseFileName(fileOrDirectoryPath);
215551
- if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
215550
+ const basename2 = getBaseFileName(fileOrDirectoryPath);
215551
+ if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename2 === "package.json" || basename2 === "node_modules")) {
215552
215552
  result.affectedModuleSpecifierCacheProjects.forEach((project) => {
215553
215553
  var _a2;
215554
215554
  (_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
@@ -222134,8 +222134,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
222134
222134
  installPackage(options) {
222135
222135
  this.packageInstallId++;
222136
222136
  const request = { kind: "installPackage", ...options, id: this.packageInstallId };
222137
- const promise = new Promise((resolve3, reject) => {
222138
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve3, reject });
222137
+ const promise = new Promise((resolve4, reject) => {
222138
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve4, reject });
222139
222139
  });
222140
222140
  this.installer.send(request);
222141
222141
  return promise;
@@ -222538,12 +222538,12 @@ function __metadata(metadataKey, metadataValue) {
222538
222538
  }
222539
222539
  function __awaiter(thisArg, _arguments, P, generator) {
222540
222540
  function adopt(value) {
222541
- return value instanceof P ? value : new P(function(resolve3) {
222542
- resolve3(value);
222541
+ return value instanceof P ? value : new P(function(resolve4) {
222542
+ resolve4(value);
222543
222543
  });
222544
222544
  }
222545
222545
  __name(adopt, "adopt");
222546
- return new (P || (P = Promise))(function(resolve3, reject) {
222546
+ return new (P || (P = Promise))(function(resolve4, reject) {
222547
222547
  function fulfilled(value) {
222548
222548
  try {
222549
222549
  step(generator.next(value));
@@ -222561,7 +222561,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
222561
222561
  }
222562
222562
  __name(rejected, "rejected");
222563
222563
  function step(result) {
222564
- result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
222564
+ result.done ? resolve4(result.value) : adopt(result.value).then(fulfilled, rejected);
222565
222565
  }
222566
222566
  __name(step, "step");
222567
222567
  step((generator = generator.apply(thisArg, _arguments || [])).next());
@@ -222763,15 +222763,15 @@ function __asyncValues(o) {
222763
222763
  }, i);
222764
222764
  function verb(n) {
222765
222765
  i[n] = o[n] && function(v) {
222766
- return new Promise(function(resolve3, reject) {
222767
- v = o[n](v), settle(resolve3, reject, v.done, v.value);
222766
+ return new Promise(function(resolve4, reject) {
222767
+ v = o[n](v), settle(resolve4, reject, v.done, v.value);
222768
222768
  });
222769
222769
  };
222770
222770
  }
222771
222771
  __name(verb, "verb");
222772
- function settle(resolve3, reject, d, v) {
222772
+ function settle(resolve4, reject, d, v) {
222773
222773
  Promise.resolve(v).then(function(v2) {
222774
- resolve3({ value: v2, done: d });
222774
+ resolve4({ value: v2, done: d });
222775
222775
  }, reject);
222776
222776
  }
222777
222777
  __name(settle, "settle");
@@ -223419,7 +223419,7 @@ var require_safe_stable_stringify = __commonJS({
223419
223419
  return circularValue;
223420
223420
  }
223421
223421
  let res = "";
223422
- let join8 = ",";
223422
+ let join9 = ",";
223423
223423
  const originalIndentation = indentation;
223424
223424
  if (Array.isArray(value)) {
223425
223425
  if (value.length === 0) {
@@ -223433,7 +223433,7 @@ var require_safe_stable_stringify = __commonJS({
223433
223433
  indentation += spacer;
223434
223434
  res += `
223435
223435
  ${indentation}`;
223436
- join8 = `,
223436
+ join9 = `,
223437
223437
  ${indentation}`;
223438
223438
  }
223439
223439
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -223441,13 +223441,13 @@ ${indentation}`;
223441
223441
  for (; i < maximumValuesToStringify - 1; i++) {
223442
223442
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
223443
223443
  res += tmp2 !== void 0 ? tmp2 : "null";
223444
- res += join8;
223444
+ res += join9;
223445
223445
  }
223446
223446
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
223447
223447
  res += tmp !== void 0 ? tmp : "null";
223448
223448
  if (value.length - 1 > maximumBreadth) {
223449
223449
  const removedKeys = value.length - maximumBreadth - 1;
223450
- res += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
223450
+ res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
223451
223451
  }
223452
223452
  if (spacer !== "") {
223453
223453
  res += `
@@ -223468,7 +223468,7 @@ ${originalIndentation}`;
223468
223468
  let separator = "";
223469
223469
  if (spacer !== "") {
223470
223470
  indentation += spacer;
223471
- join8 = `,
223471
+ join9 = `,
223472
223472
  ${indentation}`;
223473
223473
  whitespace = " ";
223474
223474
  }
@@ -223482,13 +223482,13 @@ ${indentation}`;
223482
223482
  const tmp = stringifyFnReplacer(key3, value, stack, replacer, spacer, indentation);
223483
223483
  if (tmp !== void 0) {
223484
223484
  res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
223485
- separator = join8;
223485
+ separator = join9;
223486
223486
  }
223487
223487
  }
223488
223488
  if (keyLength > maximumBreadth) {
223489
223489
  const removedKeys = keyLength - maximumBreadth;
223490
223490
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
223491
- separator = join8;
223491
+ separator = join9;
223492
223492
  }
223493
223493
  if (spacer !== "" && separator.length > 1) {
223494
223494
  res = `
@@ -223530,7 +223530,7 @@ ${originalIndentation}`;
223530
223530
  }
223531
223531
  const originalIndentation = indentation;
223532
223532
  let res = "";
223533
- let join8 = ",";
223533
+ let join9 = ",";
223534
223534
  if (Array.isArray(value)) {
223535
223535
  if (value.length === 0) {
223536
223536
  return "[]";
@@ -223543,7 +223543,7 @@ ${originalIndentation}`;
223543
223543
  indentation += spacer;
223544
223544
  res += `
223545
223545
  ${indentation}`;
223546
- join8 = `,
223546
+ join9 = `,
223547
223547
  ${indentation}`;
223548
223548
  }
223549
223549
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -223551,13 +223551,13 @@ ${indentation}`;
223551
223551
  for (; i < maximumValuesToStringify - 1; i++) {
223552
223552
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
223553
223553
  res += tmp2 !== void 0 ? tmp2 : "null";
223554
- res += join8;
223554
+ res += join9;
223555
223555
  }
223556
223556
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
223557
223557
  res += tmp !== void 0 ? tmp : "null";
223558
223558
  if (value.length - 1 > maximumBreadth) {
223559
223559
  const removedKeys = value.length - maximumBreadth - 1;
223560
- res += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
223560
+ res += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
223561
223561
  }
223562
223562
  if (spacer !== "") {
223563
223563
  res += `
@@ -223570,7 +223570,7 @@ ${originalIndentation}`;
223570
223570
  let whitespace = "";
223571
223571
  if (spacer !== "") {
223572
223572
  indentation += spacer;
223573
- join8 = `,
223573
+ join9 = `,
223574
223574
  ${indentation}`;
223575
223575
  whitespace = " ";
223576
223576
  }
@@ -223579,7 +223579,7 @@ ${indentation}`;
223579
223579
  const tmp = stringifyArrayReplacer(key3, value[key3], stack, replacer, spacer, indentation);
223580
223580
  if (tmp !== void 0) {
223581
223581
  res += `${separator}${strEscape(key3)}:${whitespace}${tmp}`;
223582
- separator = join8;
223582
+ separator = join9;
223583
223583
  }
223584
223584
  }
223585
223585
  if (spacer !== "" && separator.length > 1) {
@@ -223638,20 +223638,20 @@ ${originalIndentation}`;
223638
223638
  indentation += spacer;
223639
223639
  let res2 = `
223640
223640
  ${indentation}`;
223641
- const join9 = `,
223641
+ const join10 = `,
223642
223642
  ${indentation}`;
223643
223643
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
223644
223644
  let i = 0;
223645
223645
  for (; i < maximumValuesToStringify - 1; i++) {
223646
223646
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
223647
223647
  res2 += tmp2 !== void 0 ? tmp2 : "null";
223648
- res2 += join9;
223648
+ res2 += join10;
223649
223649
  }
223650
223650
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
223651
223651
  res2 += tmp !== void 0 ? tmp : "null";
223652
223652
  if (value.length - 1 > maximumBreadth) {
223653
223653
  const removedKeys = value.length - maximumBreadth - 1;
223654
- res2 += `${join9}"... ${getItemCount(removedKeys)} not stringified"`;
223654
+ res2 += `${join10}"... ${getItemCount(removedKeys)} not stringified"`;
223655
223655
  }
223656
223656
  res2 += `
223657
223657
  ${originalIndentation}`;
@@ -223667,16 +223667,16 @@ ${originalIndentation}`;
223667
223667
  return '"[Object]"';
223668
223668
  }
223669
223669
  indentation += spacer;
223670
- const join8 = `,
223670
+ const join9 = `,
223671
223671
  ${indentation}`;
223672
223672
  let res = "";
223673
223673
  let separator = "";
223674
223674
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
223675
223675
  if (isTypedArrayWithEntries(value)) {
223676
- res += stringifyTypedArray(value, join8, maximumBreadth);
223676
+ res += stringifyTypedArray(value, join9, maximumBreadth);
223677
223677
  keys = keys.slice(value.length);
223678
223678
  maximumPropertiesToStringify -= value.length;
223679
- separator = join8;
223679
+ separator = join9;
223680
223680
  }
223681
223681
  if (deterministic) {
223682
223682
  keys = sort(keys, comparator);
@@ -223687,13 +223687,13 @@ ${indentation}`;
223687
223687
  const tmp = stringifyIndent(key3, value[key3], stack, spacer, indentation);
223688
223688
  if (tmp !== void 0) {
223689
223689
  res += `${separator}${strEscape(key3)}: ${tmp}`;
223690
- separator = join8;
223690
+ separator = join9;
223691
223691
  }
223692
223692
  }
223693
223693
  if (keyLength > maximumBreadth) {
223694
223694
  const removedKeys = keyLength - maximumBreadth;
223695
223695
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
223696
- separator = join8;
223696
+ separator = join9;
223697
223697
  }
223698
223698
  if (separator !== "") {
223699
223699
  res = `
@@ -235168,10 +235168,10 @@ var require_commonjs5 = __commonJS({
235168
235168
  * Return a void Promise that resolves once the stream ends.
235169
235169
  */
235170
235170
  async promise() {
235171
- return new Promise((resolve3, reject) => {
235171
+ return new Promise((resolve4, reject) => {
235172
235172
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
235173
235173
  this.on("error", (er) => reject(er));
235174
- this.on("end", () => resolve3());
235174
+ this.on("end", () => resolve4());
235175
235175
  });
235176
235176
  }
235177
235177
  /**
@@ -235195,7 +235195,7 @@ var require_commonjs5 = __commonJS({
235195
235195
  return Promise.resolve({ done: false, value: res });
235196
235196
  if (this[EOF])
235197
235197
  return stop();
235198
- let resolve3;
235198
+ let resolve4;
235199
235199
  let reject;
235200
235200
  const onerr = /* @__PURE__ */ __name((er) => {
235201
235201
  this.off("data", ondata);
@@ -235209,19 +235209,19 @@ var require_commonjs5 = __commonJS({
235209
235209
  this.off("end", onend);
235210
235210
  this.off(DESTROYED, ondestroy);
235211
235211
  this.pause();
235212
- resolve3({ value, done: !!this[EOF] });
235212
+ resolve4({ value, done: !!this[EOF] });
235213
235213
  }, "ondata");
235214
235214
  const onend = /* @__PURE__ */ __name(() => {
235215
235215
  this.off("error", onerr);
235216
235216
  this.off("data", ondata);
235217
235217
  this.off(DESTROYED, ondestroy);
235218
235218
  stop();
235219
- resolve3({ done: true, value: void 0 });
235219
+ resolve4({ done: true, value: void 0 });
235220
235220
  }, "onend");
235221
235221
  const ondestroy = /* @__PURE__ */ __name(() => onerr(new Error("stream destroyed")), "ondestroy");
235222
235222
  return new Promise((res2, rej) => {
235223
235223
  reject = rej;
235224
- resolve3 = res2;
235224
+ resolve4 = res2;
235225
235225
  this.once(DESTROYED, ondestroy);
235226
235226
  this.once("error", onerr);
235227
235227
  this.once("end", onend);
@@ -236246,9 +236246,9 @@ var require_commonjs6 = __commonJS({
236246
236246
  if (this.#asyncReaddirInFlight) {
236247
236247
  await this.#asyncReaddirInFlight;
236248
236248
  } else {
236249
- let resolve3 = /* @__PURE__ */ __name(() => {
236249
+ let resolve4 = /* @__PURE__ */ __name(() => {
236250
236250
  }, "resolve");
236251
- this.#asyncReaddirInFlight = new Promise((res) => resolve3 = res);
236251
+ this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
236252
236252
  try {
236253
236253
  for (const e of await this.#fs.promises.readdir(fullpath, {
236254
236254
  withFileTypes: true
@@ -236261,7 +236261,7 @@ var require_commonjs6 = __commonJS({
236261
236261
  children.provisional = 0;
236262
236262
  }
236263
236263
  this.#asyncReaddirInFlight = void 0;
236264
- resolve3();
236264
+ resolve4();
236265
236265
  }
236266
236266
  return children.slice(0, children.provisional);
236267
236267
  }
@@ -238603,19 +238603,19 @@ __export(build_exports, {
238603
238603
  });
238604
238604
  module.exports = __toCommonJS(build_exports);
238605
238605
  var import_typescript3 = __toESM(require_typescript(), 1);
238606
- var import_node_fs6 = require("node:fs");
238607
- var import_node_path7 = require("node:path");
238606
+ var import_node_fs7 = require("node:fs");
238607
+ var import_node_path8 = require("node:path");
238608
238608
  var import_node_util3 = require("node:util");
238609
238609
 
238610
238610
  // dist/cli/compiler-host.js
238611
238611
  var import_typescript2 = __toESM(require_typescript(), 1);
238612
- var import_node_path3 = require("node:path");
238613
- var import_node_fs2 = require("node:fs");
238612
+ var import_node_path4 = require("node:path");
238613
+ var import_node_fs3 = require("node:fs");
238614
238614
 
238615
238615
  // dist/cli/schema.js
238616
238616
  var import_typescript = __toESM(require_typescript(), 1);
238617
- var import_node_path2 = require("node:path");
238618
- var import_node_module = require("node:module");
238617
+ var import_node_path3 = require("node:path");
238618
+ var import_node_module2 = require("node:module");
238619
238619
 
238620
238620
  // dist/build.js
238621
238621
  var import_node_path = require("node:path");
@@ -238679,6 +238679,21 @@ function generateSchemas(filePath, typeNames) {
238679
238679
  }
238680
238680
  __name(generateSchemas, "generateSchemas");
238681
238681
 
238682
+ // dist/cli/loader.js
238683
+ var import_node_fs2 = require("node:fs");
238684
+ var import_node_path2 = require("node:path");
238685
+ var import_node_crypto = require("node:crypto");
238686
+ var import_node_module = require("node:module");
238687
+ function extractShebang(source) {
238688
+ if (source.startsWith("#!")) {
238689
+ const newlineIndex = source.indexOf(`
238690
+ `);
238691
+ return newlineIndex !== -1 ? [source.slice(0, newlineIndex + 1), source.slice(newlineIndex + 1)] : [source, ""];
238692
+ }
238693
+ return ["", source];
238694
+ }
238695
+ __name(extractShebang, "extractShebang");
238696
+
238682
238697
  // dist/cli/schema.js
238683
238698
  var JSONSCHEMA_TAG = "JSONSchema";
238684
238699
  function hasJsDocTag(node, tagName) {
@@ -238719,7 +238734,7 @@ function findMarkedTypes(path, source) {
238719
238734
  __name(findMarkedTypes, "findMarkedTypes");
238720
238735
  function resolveGenerateSchemas(projectDir) {
238721
238736
  if (projectDir) {
238722
- const buildMod = (0, import_node_module.createRequire)((0, import_node_path2.join)(projectDir, "package.json"))("thinkwell/build");
238737
+ const buildMod = (0, import_node_module2.createRequire)((0, import_node_path3.join)(projectDir, "package.json"))("thinkwell/build");
238723
238738
  if (typeof buildMod.generateSchemas == "function")
238724
238739
  return buildMod.generateSchemas;
238725
238740
  throw new Error(`thinkwell/build resolved from ${projectDir} but does not export generateSchemas. This may indicate a version mismatch \u2014 try updating the thinkwell dependency.`);
@@ -238798,8 +238813,9 @@ function transformJsonSchemas(path, source, projectDir) {
238798
238813
  return source;
238799
238814
  const schemas = generateSchemas2(path, markedTypes, source, projectDir), insertions = generateInsertions(markedTypes, schemas);
238800
238815
  let modifiedSource = applyInsertions(source, insertions);
238801
- return modifiedSource = generateSchemaImport() + `
238802
- ` + modifiedSource, modifiedSource;
238816
+ const [shebang, rest] = extractShebang(modifiedSource);
238817
+ return modifiedSource = shebang + generateSchemaImport() + `
238818
+ ` + rest, modifiedSource;
238803
238819
  }
238804
238820
  __name(transformJsonSchemas, "transformJsonSchemas");
238805
238821
 
@@ -238807,10 +238823,10 @@ __name(transformJsonSchemas, "transformJsonSchemas");
238807
238823
  function getTypeScriptLibDir() {
238808
238824
  if (typeof process.pkg < "u") {
238809
238825
  const snapshotLibDir = "/snapshot/thinkwell/packages/thinkwell/dist-pkg/typescript-lib";
238810
- if ((0, import_node_fs2.existsSync)(snapshotLibDir))
238826
+ if ((0, import_node_fs3.existsSync)(snapshotLibDir))
238811
238827
  return snapshotLibDir;
238812
238828
  }
238813
- return (0, import_node_path3.dirname)(import_typescript2.default.getDefaultLibFilePath({}));
238829
+ return (0, import_node_path4.dirname)(import_typescript2.default.getDefaultLibFilePath({}));
238814
238830
  }
238815
238831
  __name(getTypeScriptLibDir, "getTypeScriptLibDir");
238816
238832
  function parseTsConfig(configPath) {
@@ -238821,7 +238837,7 @@ function parseTsConfig(configPath) {
238821
238837
  fileNames: [],
238822
238838
  errors: [configFile.error]
238823
238839
  };
238824
- const configDir = (0, import_node_path3.dirname)(configPath), parsed = import_typescript2.default.parseJsonConfigFileContent(
238840
+ const configDir = (0, import_node_path4.dirname)(configPath), parsed = import_typescript2.default.parseJsonConfigFileContent(
238825
238841
  configFile.config,
238826
238842
  import_typescript2.default.sys,
238827
238843
  configDir,
@@ -238857,7 +238873,7 @@ function createThinkwellHost(options) {
238857
238873
  return tsLibDir;
238858
238874
  },
238859
238875
  getDefaultLibFileName(options2) {
238860
- return (0, import_node_path3.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options2));
238876
+ return (0, import_node_path4.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options2));
238861
238877
  },
238862
238878
  getSourceFile(fileName, languageVersionOrOptions) {
238863
238879
  const source = import_typescript2.default.sys.readFile(fileName);
@@ -238873,7 +238889,7 @@ function createThinkwellHost(options) {
238873
238889
  }
238874
238890
  __name(createThinkwellHost, "createThinkwellHost");
238875
238891
  function createThinkwellProgram(configPathOrOptions) {
238876
- const configPath = typeof configPathOrOptions == "string" ? configPathOrOptions : configPathOrOptions.configPath, fileFilter = typeof configPathOrOptions == "object" ? configPathOrOptions.fileFilter : void 0, projectDir = typeof configPathOrOptions == "object" ? configPathOrOptions.projectDir : void 0, resolvedConfigPath = (0, import_node_path3.resolve)(configPath), { options, fileNames, errors } = parseTsConfig(resolvedConfigPath);
238892
+ const configPath = typeof configPathOrOptions == "string" ? configPathOrOptions : configPathOrOptions.configPath, fileFilter = typeof configPathOrOptions == "object" ? configPathOrOptions.fileFilter : void 0, projectDir = typeof configPathOrOptions == "object" ? configPathOrOptions.projectDir : void 0, resolvedConfigPath = (0, import_node_path4.resolve)(configPath), { options, fileNames, errors } = parseTsConfig(resolvedConfigPath);
238877
238893
  function makeHost() {
238878
238894
  return createThinkwellHost(fileFilter || projectDir ? { compilerOptions: options, fileFilter, projectDir } : options);
238879
238895
  }
@@ -238888,7 +238904,7 @@ function createThinkwellProgram(configPathOrOptions) {
238888
238904
  __name(createThinkwellProgram, "createThinkwellProgram");
238889
238905
  function patchHost(host, fileFilter, projectDir) {
238890
238906
  const originalGetSourceFile = host.getSourceFile.bind(host), tsLibDir = getTypeScriptLibDir();
238891
- host.getDefaultLibLocation = () => tsLibDir, host.getDefaultLibFileName = (options) => (0, import_node_path3.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options)), host.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
238907
+ host.getDefaultLibLocation = () => tsLibDir, host.getDefaultLibFileName = (options) => (0, import_node_path4.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options)), host.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
238892
238908
  const source = import_typescript2.default.sys.readFile(fileName);
238893
238909
  if (source === void 0)
238894
238910
  return originalGetSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
@@ -238903,7 +238919,7 @@ __name(patchHost, "patchHost");
238903
238919
  function createThinkwellWatchHost(options) {
238904
238920
  const { configPath, fileFilter, projectDir, reportDiagnostic, reportWatchStatus } = options, createProgram = /* @__PURE__ */ __name((rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences) => (host && patchHost(host, fileFilter, projectDir), import_typescript2.default.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, host, oldProgram, configFileParsingDiagnostics, projectReferences)), "createProgram");
238905
238921
  return import_typescript2.default.createWatchCompilerHost(
238906
- (0, import_node_path3.resolve)(configPath),
238922
+ (0, import_node_path4.resolve)(configPath),
238907
238923
  /* optionsToExtend */
238908
238924
  void 0,
238909
238925
  import_typescript2.default.sys,
@@ -238923,8 +238939,8 @@ var whiteBold = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)(["
238923
238939
  var dim = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)("dim", t), "dim");
238924
238940
 
238925
238941
  // dist/cli/commands.js
238926
- var import_node_fs3 = require("node:fs");
238927
- var import_node_path4 = require("node:path");
238942
+ var import_node_fs4 = require("node:fs");
238943
+ var import_node_path5 = require("node:path");
238928
238944
  var import_node_os = require("node:os");
238929
238945
  var import_node_util2 = require("node:util");
238930
238946
  var redBold = /* @__PURE__ */ __name((t) => (0, import_node_util2.styleText)(["red", "bold"], t), "redBold");
@@ -238934,13 +238950,13 @@ function fmtError(message) {
238934
238950
  __name(fmtError, "fmtError");
238935
238951
 
238936
238952
  // dist/cli/dependency-check.js
238937
- var import_node_fs5 = require("node:fs");
238938
- var import_node_path6 = require("node:path");
238953
+ var import_node_fs6 = require("node:fs");
238954
+ var import_node_path7 = require("node:path");
238939
238955
  var import_node_child_process = require("node:child_process");
238940
238956
 
238941
238957
  // dist/cli/package-manager.js
238942
- var import_node_fs4 = require("node:fs");
238943
- var import_node_path5 = require("node:path");
238958
+ var import_node_fs5 = require("node:fs");
238959
+ var import_node_path6 = require("node:path");
238944
238960
  var LOCKFILES = [
238945
238961
  { file: "pnpm-lock.yaml", pm: "pnpm" },
238946
238962
  { file: "yarn.lock", pm: "yarn" },
@@ -238948,8 +238964,8 @@ var LOCKFILES = [
238948
238964
  ];
238949
238965
  function detectByLockfile(projectDir) {
238950
238966
  for (const { file, pm } of LOCKFILES) {
238951
- const lockfilePath = (0, import_node_path5.join)(projectDir, file);
238952
- if ((0, import_node_fs4.existsSync)(lockfilePath))
238967
+ const lockfilePath = (0, import_node_path6.join)(projectDir, file);
238968
+ if ((0, import_node_fs5.existsSync)(lockfilePath))
238953
238969
  return { pm, lockfile: file };
238954
238970
  }
238955
238971
  return null;
@@ -238963,11 +238979,11 @@ function parsePackageManagerField(value) {
238963
238979
  }
238964
238980
  __name(parsePackageManagerField, "parsePackageManagerField");
238965
238981
  function detectByPackageJson(projectDir) {
238966
- const pkgPath = (0, import_node_path5.join)(projectDir, "package.json");
238967
- if (!(0, import_node_fs4.existsSync)(pkgPath))
238982
+ const pkgPath = (0, import_node_path6.join)(projectDir, "package.json");
238983
+ if (!(0, import_node_fs5.existsSync)(pkgPath))
238968
238984
  return null;
238969
238985
  try {
238970
- const content = (0, import_node_fs4.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
238986
+ const content = (0, import_node_fs5.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
238971
238987
  return parsePackageManagerField(pkg.packageManager);
238972
238988
  } catch {
238973
238989
  return null;
@@ -239012,11 +239028,11 @@ __name(detectPackageManager, "detectPackageManager");
239012
239028
 
239013
239029
  // dist/cli/dependency-check.js
239014
239030
  function readPackageJson(dir) {
239015
- const pkgPath = (0, import_node_path6.join)(dir, "package.json");
239016
- if (!(0, import_node_fs5.existsSync)(pkgPath))
239031
+ const pkgPath = (0, import_node_path7.join)(dir, "package.json");
239032
+ if (!(0, import_node_fs6.existsSync)(pkgPath))
239017
239033
  return null;
239018
239034
  try {
239019
- const content = (0, import_node_fs5.readFileSync)(pkgPath, "utf-8");
239035
+ const content = (0, import_node_fs6.readFileSync)(pkgPath, "utf-8");
239020
239036
  return JSON.parse(content);
239021
239037
  } catch {
239022
239038
  return null;
@@ -239041,7 +239057,7 @@ function checkPackageJsonDirect(pkg, packageName) {
239041
239057
  }
239042
239058
  __name(checkPackageJsonDirect, "checkPackageJsonDirect");
239043
239059
  function execCommand(cmd, cwd) {
239044
- return new Promise((resolve3, reject) => {
239060
+ return new Promise((resolve4, reject) => {
239045
239061
  const [command, ...args] = cmd, proc = (0, import_node_child_process.spawn)(command, args, {
239046
239062
  cwd,
239047
239063
  stdio: ["ignore", "pipe", "pipe"]
@@ -239054,7 +239070,7 @@ function execCommand(cmd, cwd) {
239054
239070
  }), proc.on("error", (err) => {
239055
239071
  reject(err);
239056
239072
  }), proc.on("close", (code) => {
239057
- code === 0 ? resolve3({ stdout, stderr }) : reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
239073
+ code === 0 ? resolve4({ stdout, stderr }) : reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
239058
239074
  });
239059
239075
  });
239060
239076
  }
@@ -239154,7 +239170,7 @@ async function checkDependencies(projectDir) {
239154
239170
  }
239155
239171
  __name(checkDependencies, "checkDependencies");
239156
239172
  function hasPackageJson(projectDir) {
239157
- return (0, import_node_fs5.existsSync)((0, import_node_path6.join)(projectDir, "package.json"));
239173
+ return (0, import_node_fs6.existsSync)((0, import_node_path7.join)(projectDir, "package.json"));
239158
239174
  }
239159
239175
  __name(hasPackageJson, "hasPackageJson");
239160
239176
 
@@ -239175,10 +239191,10 @@ __name(hasMissingDependencies, "hasMissingDependencies");
239175
239191
 
239176
239192
  // dist/cli/build.js
239177
239193
  function readPackageJsonConfig(dir) {
239178
- const pkgPath = (0, import_node_path7.join)(dir, "package.json");
239179
- if ((0, import_node_fs6.existsSync)(pkgPath))
239194
+ const pkgPath = (0, import_node_path8.join)(dir, "package.json");
239195
+ if ((0, import_node_fs7.existsSync)(pkgPath))
239180
239196
  try {
239181
- const content = (0, import_node_fs6.readFileSync)(pkgPath, "utf-8"), config = JSON.parse(content)?.thinkwell?.build;
239197
+ const content = (0, import_node_fs7.readFileSync)(pkgPath, "utf-8"), config = JSON.parse(content)?.thinkwell?.build;
239182
239198
  if (!config || typeof config != "object")
239183
239199
  return;
239184
239200
  const result = {};
@@ -239196,12 +239212,12 @@ function createFileFilter(config) {
239196
239212
  return (fileName) => {
239197
239213
  if (hasExclude) {
239198
239214
  for (const pattern of exclude)
239199
- if ((0, import_node_path7.matchesGlob)(fileName, pattern))
239215
+ if ((0, import_node_path8.matchesGlob)(fileName, pattern))
239200
239216
  return false;
239201
239217
  }
239202
239218
  if (hasInclude) {
239203
239219
  for (const pattern of include)
239204
- if ((0, import_node_path7.matchesGlob)(fileName, pattern))
239220
+ if ((0, import_node_path8.matchesGlob)(fileName, pattern))
239205
239221
  return true;
239206
239222
  return false;
239207
239223
  }
@@ -239224,8 +239240,8 @@ async function runBuild(options) {
239224
239240
  const depCheck = await checkDependencies(cwd);
239225
239241
  hasMissingDependencies(depCheck) && (console.error(formatMissingDependencyError(depCheck)), process.exit(2));
239226
239242
  }
239227
- const configPath = options.project ? (0, import_node_path7.resolve)(cwd, options.project) : (0, import_node_path7.resolve)(cwd, "tsconfig.json");
239228
- (0, import_node_fs6.existsSync)(configPath) || (console.error(fmtError(`Cannot find ${options.project ?? "tsconfig.json"}`)), console.error(""), console.error(" Run this command from a directory with a tsconfig.json,"), console.error(" or use --project to specify the path."), process.exit(1));
239243
+ const configPath = options.project ? (0, import_node_path8.resolve)(cwd, options.project) : (0, import_node_path8.resolve)(cwd, "tsconfig.json");
239244
+ (0, import_node_fs7.existsSync)(configPath) || (console.error(fmtError(`Cannot find ${options.project ?? "tsconfig.json"}`)), console.error(""), console.error(" Run this command from a directory with a tsconfig.json,"), console.error(" or use --project to specify the path."), process.exit(1));
239229
239245
  const pkgConfig = readPackageJsonConfig(cwd), fileFilter = createFileFilter(pkgConfig);
239230
239246
  options.verbose && pkgConfig && (pkgConfig.include && console.error(` @JSONSchema include: ${pkgConfig.include.join(", ")}`), pkgConfig.exclude && console.error(` @JSONSchema exclude: ${pkgConfig.exclude.join(", ")}`));
239231
239247
  const projectDir = hasPackageJson(cwd) ? cwd : void 0;