@codedrifters/configulator 0.0.270 → 0.0.271

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/lib/index.mjs CHANGED
@@ -26530,8 +26530,8 @@ var FALLBACKS = {
26530
26530
  monorepoLayoutSeedBlock: ""
26531
26531
  };
26532
26532
  var TEMPLATE_RE = /\{\{(\w+(?:\.\w+)*)\}\}/g;
26533
- function getNestedValue(obj, path3) {
26534
- const parts = path3.split(".");
26533
+ function getNestedValue(obj, path4) {
26534
+ const parts = path4.split(".");
26535
26535
  let current = obj;
26536
26536
  for (const part of parts) {
26537
26537
  if (current == null || typeof current !== "object") {
@@ -26757,20 +26757,20 @@ var ClaudeRenderer = class _ClaudeRenderer {
26757
26757
  obj.excludedCommands = [...sandbox.excludedCommands];
26758
26758
  }
26759
26759
  if (sandbox.filesystem) {
26760
- const fs = {};
26760
+ const fs2 = {};
26761
26761
  if (sandbox.filesystem.allowRead?.length) {
26762
- fs.allowRead = [...sandbox.filesystem.allowRead];
26762
+ fs2.allowRead = [...sandbox.filesystem.allowRead];
26763
26763
  }
26764
26764
  if (sandbox.filesystem.denyRead?.length) {
26765
- fs.denyRead = [...sandbox.filesystem.denyRead];
26765
+ fs2.denyRead = [...sandbox.filesystem.denyRead];
26766
26766
  }
26767
26767
  if (sandbox.filesystem.allowWrite?.length) {
26768
- fs.allowWrite = [...sandbox.filesystem.allowWrite];
26768
+ fs2.allowWrite = [...sandbox.filesystem.allowWrite];
26769
26769
  }
26770
26770
  if (sandbox.filesystem.denyWrite?.length) {
26771
- fs.denyWrite = [...sandbox.filesystem.denyWrite];
26771
+ fs2.denyWrite = [...sandbox.filesystem.denyWrite];
26772
26772
  }
26773
- if (Object.keys(fs).length > 0) obj.filesystem = fs;
26773
+ if (Object.keys(fs2).length > 0) obj.filesystem = fs2;
26774
26774
  }
26775
26775
  if (sandbox.network) {
26776
26776
  const net = {};
@@ -28515,8 +28515,125 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component12 {
28515
28515
  }
28516
28516
  };
28517
28517
 
28518
- // src/docs-sync/tsdoc-coverage/coverage.ts
28518
+ // src/docs-sync/reference-extraction/extraction.ts
28519
+ import * as fs from "fs";
28519
28520
  import * as path2 from "path";
28521
+ import { fromMarkdown } from "mdast-util-from-markdown";
28522
+ var DEFAULT_DOCS_ROOT = "docs/src/content/docs";
28523
+ var DEFAULT_SYMBOL_PATTERN = /^(?:[a-z][a-zA-Z0-9]*|[A-Z][a-zA-Z0-9]*|[A-Z][A-Z0-9_]*)$/;
28524
+ function extractDocReferences(options = {}) {
28525
+ const docsRoot = path2.resolve(options.docsRoot ?? DEFAULT_DOCS_ROOT);
28526
+ const symbolPattern = options.symbolPattern ?? DEFAULT_SYMBOL_PATTERN;
28527
+ const knownSymbols = new Set(options.knownSymbols ?? []);
28528
+ if (!fs.existsSync(docsRoot)) {
28529
+ return [];
28530
+ }
28531
+ const records = [];
28532
+ for (const absolutePath of walkMarkdownFiles(docsRoot)) {
28533
+ const docPath = toPosix(path2.relative(docsRoot, absolutePath));
28534
+ const source = fs.readFileSync(absolutePath, "utf-8");
28535
+ const tree = fromMarkdown(stripYamlFrontmatter(source));
28536
+ collectInlineCode(tree, (symbol, position) => {
28537
+ if (!symbolPattern.test(symbol)) {
28538
+ return;
28539
+ }
28540
+ records.push({
28541
+ docPath,
28542
+ line: position.line,
28543
+ column: position.column,
28544
+ symbol,
28545
+ isKnown: knownSymbols.has(symbol)
28546
+ });
28547
+ });
28548
+ }
28549
+ records.sort((a, b) => {
28550
+ if (a.docPath !== b.docPath) {
28551
+ return a.docPath.localeCompare(b.docPath);
28552
+ }
28553
+ if (a.line !== b.line) {
28554
+ return a.line - b.line;
28555
+ }
28556
+ if (a.column !== b.column) {
28557
+ return a.column - b.column;
28558
+ }
28559
+ return a.symbol.localeCompare(b.symbol);
28560
+ });
28561
+ return records;
28562
+ }
28563
+ function walkMarkdownFiles(root) {
28564
+ const out = [];
28565
+ const stack = [root];
28566
+ while (stack.length > 0) {
28567
+ const dir = stack.pop();
28568
+ let entries;
28569
+ try {
28570
+ entries = fs.readdirSync(dir, { withFileTypes: true });
28571
+ } catch {
28572
+ continue;
28573
+ }
28574
+ for (const entry of entries) {
28575
+ const full = path2.join(dir, entry.name);
28576
+ if (entry.isDirectory()) {
28577
+ stack.push(full);
28578
+ } else if (entry.isFile() && full.toLowerCase().endsWith(".md")) {
28579
+ out.push(full);
28580
+ }
28581
+ }
28582
+ }
28583
+ out.sort();
28584
+ return out;
28585
+ }
28586
+ function collectInlineCode(tree, visit) {
28587
+ walk(tree);
28588
+ function walk(node) {
28589
+ if (node.type === "inlineCode") {
28590
+ const start = node.position?.start;
28591
+ if (!start) {
28592
+ return;
28593
+ }
28594
+ visit(node.value, { line: start.line, column: start.column });
28595
+ return;
28596
+ }
28597
+ if (node.type === "code" || node.type === "html") {
28598
+ return;
28599
+ }
28600
+ const parent = node;
28601
+ if (Array.isArray(parent.children)) {
28602
+ for (const child of parent.children) {
28603
+ walk(child);
28604
+ }
28605
+ }
28606
+ }
28607
+ }
28608
+ function toPosix(p) {
28609
+ return p.split(path2.sep).join("/");
28610
+ }
28611
+ function stripYamlFrontmatter(source) {
28612
+ if (!source.startsWith("---")) {
28613
+ return source;
28614
+ }
28615
+ const lines = source.split("\n");
28616
+ if (lines[0] !== "---") {
28617
+ return source;
28618
+ }
28619
+ let endIndex = -1;
28620
+ for (let i = 1; i < lines.length; i++) {
28621
+ if (lines[i] === "---") {
28622
+ endIndex = i;
28623
+ break;
28624
+ }
28625
+ }
28626
+ if (endIndex < 0) {
28627
+ return source;
28628
+ }
28629
+ for (let i = 0; i <= endIndex; i++) {
28630
+ lines[i] = "";
28631
+ }
28632
+ return lines.join("\n");
28633
+ }
28634
+
28635
+ // src/docs-sync/tsdoc-coverage/coverage.ts
28636
+ import * as path3 from "path";
28520
28637
  import { TSDocParser } from "@microsoft/tsdoc";
28521
28638
  import * as ts from "typescript";
28522
28639
  var TsDocCoverageKind = {
@@ -28534,8 +28651,8 @@ var DEFAULT_THIN_SUMMARY_WORD_THRESHOLD = 4;
28534
28651
  var DEFAULT_ENTRY_POINT = "src/index.ts";
28535
28652
  function analyzeTsDocCoverage(options) {
28536
28653
  const resolvedOptions = typeof options === "string" ? { packageRoot: options } : options;
28537
- const packageRoot = path2.resolve(resolvedOptions.packageRoot);
28538
- const entryPoint = path2.resolve(
28654
+ const packageRoot = path3.resolve(resolvedOptions.packageRoot);
28655
+ const entryPoint = path3.resolve(
28539
28656
  packageRoot,
28540
28657
  resolvedOptions.entryPoint ?? DEFAULT_ENTRY_POINT
28541
28658
  );
@@ -28598,7 +28715,7 @@ function analyzeTsDocCoverage(options) {
28598
28715
  }
28599
28716
  function resolveCompilerOptions(packageRoot, tsconfigPath) {
28600
28717
  if (tsconfigPath) {
28601
- const absoluteTsconfig = path2.resolve(packageRoot, tsconfigPath);
28718
+ const absoluteTsconfig = path3.resolve(packageRoot, tsconfigPath);
28602
28719
  const configFile = ts.readConfigFile(absoluteTsconfig, ts.sys.readFile);
28603
28720
  if (configFile.error) {
28604
28721
  throw new Error(
@@ -28608,7 +28725,7 @@ function resolveCompilerOptions(packageRoot, tsconfigPath) {
28608
28725
  const parsed = ts.parseJsonConfigFileContent(
28609
28726
  configFile.config,
28610
28727
  ts.sys,
28611
- path2.dirname(absoluteTsconfig)
28728
+ path3.dirname(absoluteTsconfig)
28612
28729
  );
28613
28730
  return { ...parsed.options, noEmit: true };
28614
28731
  }
@@ -28916,14 +29033,14 @@ var LAYOUT_ROOT_BY_PROJECT_TYPE = {
28916
29033
  };
28917
29034
  function validateMonorepoLayout(root) {
28918
29035
  const violations = [];
28919
- const rootOutdir = toPosix(root.outdir);
29036
+ const rootOutdir = toPosix2(root.outdir);
28920
29037
  for (const sub of root.subprojects) {
28921
29038
  const className = sub.constructor.name;
28922
29039
  const expectedRoot = expectedRootFor(sub, className);
28923
29040
  if (expectedRoot === void 0) {
28924
29041
  continue;
28925
29042
  }
28926
- const relOutdir = relativeOutdir(rootOutdir, toPosix(sub.outdir));
29043
+ const relOutdir = relativeOutdir(rootOutdir, toPosix2(sub.outdir));
28927
29044
  if (!outdirMatchesRoot(relOutdir, expectedRoot)) {
28928
29045
  violations.push({
28929
29046
  projectName: sub.name,
@@ -28982,7 +29099,7 @@ function outdirMatchesRoot(relOutdir, expectedRoot) {
28982
29099
  }
28983
29100
  return segments.length >= 2;
28984
29101
  }
28985
- function toPosix(p) {
29102
+ function toPosix2(p) {
28986
29103
  return p.replace(/\\/g, "/");
28987
29104
  }
28988
29105
  function relativeOutdir(rootOutdir, subOutdir) {
@@ -29071,8 +29188,8 @@ var ResetTask = class _ResetTask extends Component14 {
29071
29188
  const resetTask = this.project.tasks.addTask(this.taskName, {
29072
29189
  description: "Delete build artifacts specified by pathsToRemove option, or artifactsDirectory if pathsToRemove is empty"
29073
29190
  });
29074
- this.pathsToRemove.forEach((path3) => {
29075
- resetTask.exec(`[ -e "${path3}" ] && rm -rf ${path3} || true`);
29191
+ this.pathsToRemove.forEach((path4) => {
29192
+ resetTask.exec(`[ -e "${path4}" ] && rm -rf ${path4} || true`);
29076
29193
  });
29077
29194
  const rootHasTurbo = TurboRepo.of(this.project.root) !== void 0;
29078
29195
  const isSubproject = this.project !== this.project.root;
@@ -30969,7 +31086,7 @@ export const collections = {
30969
31086
  `;
30970
31087
 
30971
31088
  // src/typescript/typescript-config.ts
30972
- import { relative as relative4 } from "path";
31089
+ import { relative as relative5 } from "path";
30973
31090
  import { Component as Component19 } from "projen";
30974
31091
  import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
30975
31092
  var TypeScriptConfig = class extends Component19 {
@@ -30988,7 +31105,7 @@ var TypeScriptConfig = class extends Component19 {
30988
31105
  ...tsPaths,
30989
31106
  [dep.name]: [
30990
31107
  ensureRelativePathStartsWithDot(
30991
- relative4(project.outdir, subproject.outdir)
31108
+ relative5(project.outdir, subproject.outdir)
30992
31109
  )
30993
31110
  ]
30994
31111
  };
@@ -31139,6 +31256,7 @@ export {
31139
31256
  customerProfileBundle,
31140
31257
  docsSyncBundle,
31141
31258
  extractApiProcedure,
31259
+ extractDocReferences,
31142
31260
  formatLayoutViolation,
31143
31261
  formatStarlightSingletonViolation,
31144
31262
  getLatestEligibleVersion,