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: dirname4 } = require("path");
535
+ const { dirname: dirname5 } = require("path");
536
536
  function getProjectDir(compilerOptions) {
537
- return compilerOptions.configFilePath && dirname4(compilerOptions.configFilePath);
537
+ return compilerOptions.configFilePath && dirname5(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 ? dirname4(rootFileNames[0]) : projectDir ?? process.cwd();
544
+ const baseDir = rootFileNames.length > 0 ? dirname5(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 = dirname4(configFileNamePath);
556
+ const projectDir = dirname5(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 resolve4 = factory2.createUniqueName("resolve");
131465
+ const resolve5 = 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
- resolve4
131474
+ resolve5
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()]), resolve4, reject]
131491
+ [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve5, 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((resolve4, reject) => {
222138
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve4, reject });
222137
+ const promise = new Promise((resolve5, reject) => {
222138
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve5, 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(resolve4) {
222542
- resolve4(value);
222541
+ return value instanceof P ? value : new P(function(resolve5) {
222542
+ resolve5(value);
222543
222543
  });
222544
222544
  }
222545
222545
  __name(adopt, "adopt");
222546
- return new (P || (P = Promise))(function(resolve4, reject) {
222546
+ return new (P || (P = Promise))(function(resolve5, 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 ? resolve4(result.value) : adopt(result.value).then(fulfilled, rejected);
222564
+ result.done ? resolve5(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(resolve4, reject) {
222767
- v = o[n](v), settle(resolve4, reject, v.done, v.value);
222766
+ return new Promise(function(resolve5, reject) {
222767
+ v = o[n](v), settle(resolve5, reject, v.done, v.value);
222768
222768
  });
222769
222769
  };
222770
222770
  }
222771
222771
  __name(verb, "verb");
222772
- function settle(resolve4, reject, d, v) {
222772
+ function settle(resolve5, reject, d, v) {
222773
222773
  Promise.resolve(v).then(function(v2) {
222774
- resolve4({ value: v2, done: d });
222774
+ resolve5({ 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((resolve4, reject) => {
235171
+ return new Promise((resolve5, reject) => {
235172
235172
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
235173
235173
  this.on("error", (er) => reject(er));
235174
- this.on("end", () => resolve4());
235174
+ this.on("end", () => resolve5());
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 resolve4;
235198
+ let resolve5;
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
- resolve4({ value, done: !!this[EOF] });
235212
+ resolve5({ 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
- resolve4({ done: true, value: void 0 });
235219
+ resolve5({ 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
- resolve4 = res2;
235224
+ resolve5 = 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 resolve4 = /* @__PURE__ */ __name(() => {
236249
+ let resolve5 = /* @__PURE__ */ __name(() => {
236250
236250
  }, "resolve");
236251
- this.#asyncReaddirInFlight = new Promise((res) => resolve4 = res);
236251
+ this.#asyncReaddirInFlight = new Promise((res) => resolve5 = 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
- resolve4();
236264
+ resolve5();
236265
236265
  }
236266
236266
  return children.slice(0, children.provisional);
236267
236267
  }
@@ -238603,18 +238603,18 @@ __export(check_exports, {
238603
238603
  });
238604
238604
  module.exports = __toCommonJS(check_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
 
238609
238609
  // dist/cli/compiler-host.js
238610
238610
  var import_typescript2 = __toESM(require_typescript(), 1);
238611
- var import_node_path3 = require("node:path");
238612
- var import_node_fs2 = require("node:fs");
238611
+ var import_node_path4 = require("node:path");
238612
+ var import_node_fs3 = require("node:fs");
238613
238613
 
238614
238614
  // dist/cli/schema.js
238615
238615
  var import_typescript = __toESM(require_typescript(), 1);
238616
- var import_node_path2 = require("node:path");
238617
- var import_node_module = require("node:module");
238616
+ var import_node_path3 = require("node:path");
238617
+ var import_node_module2 = require("node:module");
238618
238618
 
238619
238619
  // dist/build.js
238620
238620
  var import_node_path = require("node:path");
@@ -238678,6 +238678,21 @@ function generateSchemas(filePath, typeNames) {
238678
238678
  }
238679
238679
  __name(generateSchemas, "generateSchemas");
238680
238680
 
238681
+ // dist/cli/loader.js
238682
+ var import_node_fs2 = require("node:fs");
238683
+ var import_node_path2 = require("node:path");
238684
+ var import_node_crypto = require("node:crypto");
238685
+ var import_node_module = require("node:module");
238686
+ function extractShebang(source) {
238687
+ if (source.startsWith("#!")) {
238688
+ const newlineIndex = source.indexOf(`
238689
+ `);
238690
+ return newlineIndex !== -1 ? [source.slice(0, newlineIndex + 1), source.slice(newlineIndex + 1)] : [source, ""];
238691
+ }
238692
+ return ["", source];
238693
+ }
238694
+ __name(extractShebang, "extractShebang");
238695
+
238681
238696
  // dist/cli/schema.js
238682
238697
  var JSONSCHEMA_TAG = "JSONSchema";
238683
238698
  function hasJsDocTag(node, tagName) {
@@ -238718,7 +238733,7 @@ function findMarkedTypes(path, source) {
238718
238733
  __name(findMarkedTypes, "findMarkedTypes");
238719
238734
  function resolveGenerateSchemas(projectDir) {
238720
238735
  if (projectDir) {
238721
- const buildMod = (0, import_node_module.createRequire)((0, import_node_path2.join)(projectDir, "package.json"))("thinkwell/build");
238736
+ const buildMod = (0, import_node_module2.createRequire)((0, import_node_path3.join)(projectDir, "package.json"))("thinkwell/build");
238722
238737
  if (typeof buildMod.generateSchemas == "function")
238723
238738
  return buildMod.generateSchemas;
238724
238739
  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.`);
@@ -238797,8 +238812,9 @@ function transformJsonSchemas(path, source, projectDir) {
238797
238812
  return source;
238798
238813
  const schemas = generateSchemas2(path, markedTypes, source, projectDir), insertions = generateInsertions(markedTypes, schemas);
238799
238814
  let modifiedSource = applyInsertions(source, insertions);
238800
- return modifiedSource = generateSchemaImport() + `
238801
- ` + modifiedSource, modifiedSource;
238815
+ const [shebang, rest] = extractShebang(modifiedSource);
238816
+ return modifiedSource = shebang + generateSchemaImport() + `
238817
+ ` + rest, modifiedSource;
238802
238818
  }
238803
238819
  __name(transformJsonSchemas, "transformJsonSchemas");
238804
238820
 
@@ -238806,10 +238822,10 @@ __name(transformJsonSchemas, "transformJsonSchemas");
238806
238822
  function getTypeScriptLibDir() {
238807
238823
  if (typeof process.pkg < "u") {
238808
238824
  const snapshotLibDir = "/snapshot/thinkwell/packages/thinkwell/dist-pkg/typescript-lib";
238809
- if ((0, import_node_fs2.existsSync)(snapshotLibDir))
238825
+ if ((0, import_node_fs3.existsSync)(snapshotLibDir))
238810
238826
  return snapshotLibDir;
238811
238827
  }
238812
- return (0, import_node_path3.dirname)(import_typescript2.default.getDefaultLibFilePath({}));
238828
+ return (0, import_node_path4.dirname)(import_typescript2.default.getDefaultLibFilePath({}));
238813
238829
  }
238814
238830
  __name(getTypeScriptLibDir, "getTypeScriptLibDir");
238815
238831
  function parseTsConfig(configPath) {
@@ -238820,7 +238836,7 @@ function parseTsConfig(configPath) {
238820
238836
  fileNames: [],
238821
238837
  errors: [configFile.error]
238822
238838
  };
238823
- const configDir = (0, import_node_path3.dirname)(configPath), parsed = import_typescript2.default.parseJsonConfigFileContent(
238839
+ const configDir = (0, import_node_path4.dirname)(configPath), parsed = import_typescript2.default.parseJsonConfigFileContent(
238824
238840
  configFile.config,
238825
238841
  import_typescript2.default.sys,
238826
238842
  configDir,
@@ -238856,7 +238872,7 @@ function createThinkwellHost(options) {
238856
238872
  return tsLibDir;
238857
238873
  },
238858
238874
  getDefaultLibFileName(options2) {
238859
- return (0, import_node_path3.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options2));
238875
+ return (0, import_node_path4.join)(tsLibDir, import_typescript2.default.getDefaultLibFileName(options2));
238860
238876
  },
238861
238877
  getSourceFile(fileName, languageVersionOrOptions) {
238862
238878
  const source = import_typescript2.default.sys.readFile(fileName);
@@ -238872,7 +238888,7 @@ function createThinkwellHost(options) {
238872
238888
  }
238873
238889
  __name(createThinkwellHost, "createThinkwellHost");
238874
238890
  function createThinkwellProgram(configPathOrOptions) {
238875
- 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);
238891
+ 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);
238876
238892
  function makeHost() {
238877
238893
  return createThinkwellHost(fileFilter || projectDir ? { compilerOptions: options, fileFilter, projectDir } : options);
238878
238894
  }
@@ -238895,8 +238911,8 @@ var whiteBold = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)(["
238895
238911
  var dim = /* @__PURE__ */ __name((t) => (0, import_node_util.styleText)("dim", t), "dim");
238896
238912
 
238897
238913
  // dist/cli/workspace.js
238898
- var import_node_fs3 = require("node:fs");
238899
- var import_node_path4 = require("node:path");
238914
+ var import_node_fs4 = require("node:fs");
238915
+ var import_node_path5 = require("node:path");
238900
238916
  function parsePnpmWorkspaceYaml(content) {
238901
238917
  const patterns = [], lines = content.split(`
238902
238918
  `);
@@ -238922,26 +238938,26 @@ function expandWorkspaceGlobs(rootDir, patterns) {
238922
238938
  for (const pattern of patterns)
238923
238939
  if (!pattern.startsWith("!"))
238924
238940
  if (pattern.includes("*")) {
238925
- const parts = pattern.split("/"), globIndex = parts.findIndex((p) => p.includes("*")), prefix = parts.slice(0, globIndex).join("/"), globPart = parts[globIndex], suffix = parts.slice(globIndex + 1).join("/"), baseDir = (0, import_node_path4.resolve)(rootDir, prefix);
238926
- if (!(0, import_node_fs3.existsSync)(baseDir))
238941
+ const parts = pattern.split("/"), globIndex = parts.findIndex((p) => p.includes("*")), prefix = parts.slice(0, globIndex).join("/"), globPart = parts[globIndex], suffix = parts.slice(globIndex + 1).join("/"), baseDir = (0, import_node_path5.resolve)(rootDir, prefix);
238942
+ if (!(0, import_node_fs4.existsSync)(baseDir))
238927
238943
  continue;
238928
238944
  if (globPart === "*") {
238929
- const entries = (0, import_node_fs3.readdirSync)(baseDir);
238945
+ const entries = (0, import_node_fs4.readdirSync)(baseDir);
238930
238946
  for (const entry of entries) {
238931
- const fullPath = suffix ? (0, import_node_path4.resolve)(baseDir, entry, suffix) : (0, import_node_path4.resolve)(baseDir, entry);
238932
- (0, import_node_fs3.existsSync)(fullPath) && isDirectory(fullPath) && dirs.push(fullPath);
238947
+ const fullPath = suffix ? (0, import_node_path5.resolve)(baseDir, entry, suffix) : (0, import_node_path5.resolve)(baseDir, entry);
238948
+ (0, import_node_fs4.existsSync)(fullPath) && isDirectory(fullPath) && dirs.push(fullPath);
238933
238949
  }
238934
238950
  } else globPart === "**" && collectDirectories(baseDir, suffix, dirs);
238935
238951
  } else {
238936
- const fullPath = (0, import_node_path4.resolve)(rootDir, pattern);
238937
- (0, import_node_fs3.existsSync)(fullPath) && isDirectory(fullPath) && dirs.push(fullPath);
238952
+ const fullPath = (0, import_node_path5.resolve)(rootDir, pattern);
238953
+ (0, import_node_fs4.existsSync)(fullPath) && isDirectory(fullPath) && dirs.push(fullPath);
238938
238954
  }
238939
238955
  return dirs;
238940
238956
  }
238941
238957
  __name(expandWorkspaceGlobs, "expandWorkspaceGlobs");
238942
238958
  function isDirectory(path) {
238943
238959
  try {
238944
- return (0, import_node_fs3.statSync)(path).isDirectory();
238960
+ return (0, import_node_fs4.statSync)(path).isDirectory();
238945
238961
  } catch {
238946
238962
  return false;
238947
238963
  }
@@ -238950,30 +238966,30 @@ __name(isDirectory, "isDirectory");
238950
238966
  function collectDirectories(baseDir, suffix, result) {
238951
238967
  let entries;
238952
238968
  try {
238953
- entries = (0, import_node_fs3.readdirSync)(baseDir);
238969
+ entries = (0, import_node_fs4.readdirSync)(baseDir);
238954
238970
  } catch {
238955
238971
  return;
238956
238972
  }
238957
238973
  for (const entry of entries) {
238958
238974
  if (entry.startsWith(".") || entry === "node_modules")
238959
238975
  continue;
238960
- const fullPath = (0, import_node_path4.resolve)(baseDir, entry);
238976
+ const fullPath = (0, import_node_path5.resolve)(baseDir, entry);
238961
238977
  if (!isDirectory(fullPath))
238962
238978
  continue;
238963
- const candidate = suffix ? (0, import_node_path4.resolve)(fullPath, suffix) : fullPath;
238964
- (0, import_node_fs3.existsSync)(candidate) && isDirectory(candidate) && result.push(candidate), collectDirectories(fullPath, suffix, result);
238979
+ const candidate = suffix ? (0, import_node_path5.resolve)(fullPath, suffix) : fullPath;
238980
+ (0, import_node_fs4.existsSync)(candidate) && isDirectory(candidate) && result.push(candidate), collectDirectories(fullPath, suffix, result);
238965
238981
  }
238966
238982
  }
238967
238983
  __name(collectDirectories, "collectDirectories");
238968
238984
  function readMember(dir) {
238969
- const pkgPath = (0, import_node_path4.join)(dir, "package.json");
238970
- if ((0, import_node_fs3.existsSync)(pkgPath))
238985
+ const pkgPath = (0, import_node_path5.join)(dir, "package.json");
238986
+ if ((0, import_node_fs4.existsSync)(pkgPath))
238971
238987
  try {
238972
- const content = (0, import_node_fs3.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
238988
+ const content = (0, import_node_fs4.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
238973
238989
  return !pkg.name || typeof pkg.name != "string" ? void 0 : {
238974
238990
  name: pkg.name,
238975
238991
  dir,
238976
- hasTsConfig: (0, import_node_fs3.existsSync)((0, import_node_path4.join)(dir, "tsconfig.json"))
238992
+ hasTsConfig: (0, import_node_fs4.existsSync)((0, import_node_path5.join)(dir, "tsconfig.json"))
238977
238993
  };
238978
238994
  } catch {
238979
238995
  return;
@@ -238981,18 +238997,18 @@ function readMember(dir) {
238981
238997
  }
238982
238998
  __name(readMember, "readMember");
238983
238999
  function detectWorkspace(rootDir) {
238984
- const absRoot = (0, import_node_path4.resolve)(rootDir), pnpmPath = (0, import_node_path4.join)(absRoot, "pnpm-workspace.yaml");
238985
- if ((0, import_node_fs3.existsSync)(pnpmPath)) {
238986
- const content = (0, import_node_fs3.readFileSync)(pnpmPath, "utf-8"), patterns = parsePnpmWorkspaceYaml(content);
239000
+ const absRoot = (0, import_node_path5.resolve)(rootDir), pnpmPath = (0, import_node_path5.join)(absRoot, "pnpm-workspace.yaml");
239001
+ if ((0, import_node_fs4.existsSync)(pnpmPath)) {
239002
+ const content = (0, import_node_fs4.readFileSync)(pnpmPath, "utf-8"), patterns = parsePnpmWorkspaceYaml(content);
238987
239003
  if (patterns.length > 0) {
238988
239004
  const members = expandWorkspaceGlobs(absRoot, patterns).map(readMember).filter((m) => m !== void 0);
238989
239005
  return { rootDir: absRoot, type: "pnpm", members };
238990
239006
  }
238991
239007
  }
238992
- const pkgPath = (0, import_node_path4.join)(absRoot, "package.json");
238993
- if ((0, import_node_fs3.existsSync)(pkgPath))
239008
+ const pkgPath = (0, import_node_path5.join)(absRoot, "package.json");
239009
+ if ((0, import_node_fs4.existsSync)(pkgPath))
238994
239010
  try {
238995
- const content = (0, import_node_fs3.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
239011
+ const content = (0, import_node_fs4.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
238996
239012
  if (Array.isArray(pkg.workspaces)) {
238997
239013
  const patterns = pkg.workspaces.filter((p) => typeof p == "string");
238998
239014
  if (patterns.length > 0) {
@@ -239018,13 +239034,13 @@ function resolvePackageName(name, members) {
239018
239034
  __name(resolvePackageName, "resolvePackageName");
239019
239035
 
239020
239036
  // dist/cli/dependency-check.js
239021
- var import_node_fs5 = require("node:fs");
239022
- var import_node_path6 = require("node:path");
239037
+ var import_node_fs6 = require("node:fs");
239038
+ var import_node_path7 = require("node:path");
239023
239039
  var import_node_child_process = require("node:child_process");
239024
239040
 
239025
239041
  // dist/cli/package-manager.js
239026
- var import_node_fs4 = require("node:fs");
239027
- var import_node_path5 = require("node:path");
239042
+ var import_node_fs5 = require("node:fs");
239043
+ var import_node_path6 = require("node:path");
239028
239044
  var LOCKFILES = [
239029
239045
  { file: "pnpm-lock.yaml", pm: "pnpm" },
239030
239046
  { file: "yarn.lock", pm: "yarn" },
@@ -239032,8 +239048,8 @@ var LOCKFILES = [
239032
239048
  ];
239033
239049
  function detectByLockfile(projectDir) {
239034
239050
  for (const { file, pm } of LOCKFILES) {
239035
- const lockfilePath = (0, import_node_path5.join)(projectDir, file);
239036
- if ((0, import_node_fs4.existsSync)(lockfilePath))
239051
+ const lockfilePath = (0, import_node_path6.join)(projectDir, file);
239052
+ if ((0, import_node_fs5.existsSync)(lockfilePath))
239037
239053
  return { pm, lockfile: file };
239038
239054
  }
239039
239055
  return null;
@@ -239047,11 +239063,11 @@ function parsePackageManagerField(value) {
239047
239063
  }
239048
239064
  __name(parsePackageManagerField, "parsePackageManagerField");
239049
239065
  function detectByPackageJson(projectDir) {
239050
- const pkgPath = (0, import_node_path5.join)(projectDir, "package.json");
239051
- if (!(0, import_node_fs4.existsSync)(pkgPath))
239066
+ const pkgPath = (0, import_node_path6.join)(projectDir, "package.json");
239067
+ if (!(0, import_node_fs5.existsSync)(pkgPath))
239052
239068
  return null;
239053
239069
  try {
239054
- const content = (0, import_node_fs4.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
239070
+ const content = (0, import_node_fs5.readFileSync)(pkgPath, "utf-8"), pkg = JSON.parse(content);
239055
239071
  return parsePackageManagerField(pkg.packageManager);
239056
239072
  } catch {
239057
239073
  return null;
@@ -239096,11 +239112,11 @@ __name(detectPackageManager, "detectPackageManager");
239096
239112
 
239097
239113
  // dist/cli/dependency-check.js
239098
239114
  function readPackageJson(dir) {
239099
- const pkgPath = (0, import_node_path6.join)(dir, "package.json");
239100
- if (!(0, import_node_fs5.existsSync)(pkgPath))
239115
+ const pkgPath = (0, import_node_path7.join)(dir, "package.json");
239116
+ if (!(0, import_node_fs6.existsSync)(pkgPath))
239101
239117
  return null;
239102
239118
  try {
239103
- const content = (0, import_node_fs5.readFileSync)(pkgPath, "utf-8");
239119
+ const content = (0, import_node_fs6.readFileSync)(pkgPath, "utf-8");
239104
239120
  return JSON.parse(content);
239105
239121
  } catch {
239106
239122
  return null;
@@ -239125,7 +239141,7 @@ function checkPackageJsonDirect(pkg, packageName) {
239125
239141
  }
239126
239142
  __name(checkPackageJsonDirect, "checkPackageJsonDirect");
239127
239143
  function execCommand(cmd, cwd) {
239128
- return new Promise((resolve4, reject) => {
239144
+ return new Promise((resolve5, reject) => {
239129
239145
  const [command, ...args] = cmd, proc = (0, import_node_child_process.spawn)(command, args, {
239130
239146
  cwd,
239131
239147
  stdio: ["ignore", "pipe", "pipe"]
@@ -239138,7 +239154,7 @@ function execCommand(cmd, cwd) {
239138
239154
  }), proc.on("error", (err) => {
239139
239155
  reject(err);
239140
239156
  }), proc.on("close", (code) => {
239141
- code === 0 ? resolve4({ stdout, stderr }) : reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
239157
+ code === 0 ? resolve5({ stdout, stderr }) : reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
239142
239158
  });
239143
239159
  });
239144
239160
  }
@@ -239238,7 +239254,7 @@ async function checkDependencies(projectDir) {
239238
239254
  }
239239
239255
  __name(checkDependencies, "checkDependencies");
239240
239256
  function hasPackageJson(projectDir) {
239241
- return (0, import_node_fs5.existsSync)((0, import_node_path6.join)(projectDir, "package.json"));
239257
+ return (0, import_node_fs6.existsSync)((0, import_node_path7.join)(projectDir, "package.json"));
239242
239258
  }
239243
239259
  __name(hasPackageJson, "hasPackageJson");
239244
239260
 
@@ -239274,7 +239290,7 @@ function formatDiagnostics(diagnostics, pretty) {
239274
239290
  }
239275
239291
  __name(formatDiagnostics, "formatDiagnostics");
239276
239292
  function checkPackage(dir, pretty, projectDir) {
239277
- const configPath = (0, import_node_path7.resolve)(dir, "tsconfig.json"), { program, configErrors } = projectDir ? createThinkwellProgram({ configPath, projectDir }) : createThinkwellProgram(configPath);
239293
+ const configPath = (0, import_node_path8.resolve)(dir, "tsconfig.json"), { program, configErrors } = projectDir ? createThinkwellProgram({ configPath, projectDir }) : createThinkwellProgram(configPath);
239278
239294
  if (configErrors.length > 0 && (process.stderr.write(formatDiagnostics(configErrors, pretty)), configErrors.some((d) => d.category === import_typescript3.default.DiagnosticCategory.Error)))
239279
239295
  return configErrors.filter((d) => d.category === import_typescript3.default.DiagnosticCategory.Error).length;
239280
239296
  const diagnostics = import_typescript3.default.getPreEmitDiagnostics(program), errors = diagnostics.filter((d) => d.category === import_typescript3.default.DiagnosticCategory.Error);
@@ -239292,15 +239308,15 @@ No pnpm-workspace.yaml or package.json "workspaces" found in current directory.
239292
239308
  hasMissingDependencies(depCheck) && (process.stderr.write(formatMissingDependencyError(depCheck) + `
239293
239309
  `), process.exit(2));
239294
239310
  }
239295
- const configPath = (0, import_node_path7.resolve)(cwd, "tsconfig.json");
239296
- (0, import_node_fs6.existsSync)(configPath) || (process.stderr.write(`Error: Cannot find tsconfig.json
239311
+ const configPath = (0, import_node_path8.resolve)(cwd, "tsconfig.json");
239312
+ (0, import_node_fs7.existsSync)(configPath) || (process.stderr.write(`Error: Cannot find tsconfig.json
239297
239313
  `), process.stderr.write(`
239298
239314
  `), process.stderr.write(` Run this command from a directory with a tsconfig.json.
239299
239315
  `), process.exit(2));
239300
239316
  let pkgName = cwd.split("/").pop() ?? "project";
239301
239317
  try {
239302
- const pkgPath = (0, import_node_path7.join)(cwd, "package.json");
239303
- if ((0, import_node_fs6.existsSync)(pkgPath)) {
239318
+ const pkgPath = (0, import_node_path8.join)(cwd, "package.json");
239319
+ if ((0, import_node_fs7.existsSync)(pkgPath)) {
239304
239320
  const pkg = JSON.parse((await import("node:fs")).readFileSync(pkgPath, "utf-8"));
239305
239321
  pkg.name && (pkgName = pkg.name);
239306
239322
  }