@codedrifters/configulator 0.0.270 → 0.0.272

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
  }
@@ -28895,6 +29012,7 @@ var JsiiFaker = class _JsiiFaker extends Component13 {
28895
29012
 
28896
29013
  // src/projects/astro-project.ts
28897
29014
  import { SampleFile as SampleFile2 } from "projen";
29015
+ import { merge as merge3 } from "ts-deepmerge";
28898
29016
 
28899
29017
  // src/projects/monorepo-layout.ts
28900
29018
  var MONOREPO_LAYOUT = {
@@ -28916,14 +29034,14 @@ var LAYOUT_ROOT_BY_PROJECT_TYPE = {
28916
29034
  };
28917
29035
  function validateMonorepoLayout(root) {
28918
29036
  const violations = [];
28919
- const rootOutdir = toPosix(root.outdir);
29037
+ const rootOutdir = toPosix2(root.outdir);
28920
29038
  for (const sub of root.subprojects) {
28921
29039
  const className = sub.constructor.name;
28922
29040
  const expectedRoot = expectedRootFor(sub, className);
28923
29041
  if (expectedRoot === void 0) {
28924
29042
  continue;
28925
29043
  }
28926
- const relOutdir = relativeOutdir(rootOutdir, toPosix(sub.outdir));
29044
+ const relOutdir = relativeOutdir(rootOutdir, toPosix2(sub.outdir));
28927
29045
  if (!outdirMatchesRoot(relOutdir, expectedRoot)) {
28928
29046
  violations.push({
28929
29047
  projectName: sub.name,
@@ -28982,7 +29100,7 @@ function outdirMatchesRoot(relOutdir, expectedRoot) {
28982
29100
  }
28983
29101
  return segments.length >= 2;
28984
29102
  }
28985
- function toPosix(p) {
29103
+ function toPosix2(p) {
28986
29104
  return p.replace(/\\/g, "/");
28987
29105
  }
28988
29106
  function relativeOutdir(rootOutdir, subOutdir) {
@@ -29071,8 +29189,8 @@ var ResetTask = class _ResetTask extends Component14 {
29071
29189
  const resetTask = this.project.tasks.addTask(this.taskName, {
29072
29190
  description: "Delete build artifacts specified by pathsToRemove option, or artifactsDirectory if pathsToRemove is empty"
29073
29191
  });
29074
- this.pathsToRemove.forEach((path3) => {
29075
- resetTask.exec(`[ -e "${path3}" ] && rm -rf ${path3} || true`);
29192
+ this.pathsToRemove.forEach((path4) => {
29193
+ resetTask.exec(`[ -e "${path4}" ] && rm -rf ${path4} || true`);
29076
29194
  });
29077
29195
  const rootHasTurbo = TurboRepo.of(this.project.root) !== void 0;
29078
29196
  const isSubproject = this.project !== this.project.root;
@@ -30088,20 +30206,27 @@ var TypeScriptProject = class extends typescript.TypeScriptProject {
30088
30206
  var AstroProject = class extends TypeScriptProject {
30089
30207
  constructor(userOptions) {
30090
30208
  const resolvedOutdir = userOptions.outdir ?? resolveAstroProjectOutdir(userOptions.packageName ?? userOptions.name);
30091
- const options = {
30209
+ const defaultOptions = {
30092
30210
  testRunner: TestRunner.VITEST,
30093
30211
  // Astro sites don't expose a library API surface — skip the
30094
30212
  // `@microsoft/api-extractor` wiring the TypeScriptProject base adds
30095
30213
  // by default. Callers can opt in with `apiExtractor: { ... }` if a
30096
30214
  // given site genuinely ships typed re-exports.
30097
30215
  apiExtractor: false,
30098
- ...userOptions,
30099
- outdir: resolvedOutdir,
30216
+ tsconfig: {
30217
+ compilerOptions: {
30218
+ declaration: false
30219
+ }
30220
+ },
30100
30221
  depsUpgradeOptions: {
30101
- ...userOptions.depsUpgradeOptions,
30102
- exclude: [...userOptions.depsUpgradeOptions?.exclude ?? [], "astro"]
30222
+ exclude: ["astro"]
30103
30223
  }
30104
30224
  };
30225
+ const merged = merge3(defaultOptions, userOptions);
30226
+ const options = {
30227
+ ...merged,
30228
+ outdir: resolvedOutdir
30229
+ };
30105
30230
  super(options);
30106
30231
  const astroVersion = options.astroVersion ?? VERSION.ASTRO_VERSION;
30107
30232
  const astroTsconfigExtends = options.astroTsconfigExtends ?? "astro/tsconfigs/strict";
@@ -30153,6 +30278,9 @@ var AstroProject = class extends TypeScriptProject {
30153
30278
  parser: "astro-eslint-parser"
30154
30279
  });
30155
30280
  this.eslint?.addLintPattern("src/**/*.astro");
30281
+ this.eslint?.addRules({
30282
+ "import/no-unresolved": ["error", { ignore: ["^astro:"] }]
30283
+ });
30156
30284
  this.gitignore.addPatterns(".astro", ".vercel", ".netlify");
30157
30285
  const turbo = TurboRepo.of(this);
30158
30286
  if (turbo?.compileTask) {
@@ -30202,7 +30330,7 @@ import {
30202
30330
  UpgradeDependenciesSchedule as UpgradeDependenciesSchedule3
30203
30331
  } from "projen/lib/javascript";
30204
30332
  import { ReleaseTrigger as ReleaseTrigger2 } from "projen/lib/release";
30205
- import { merge as merge3 } from "ts-deepmerge";
30333
+ import { merge as merge4 } from "ts-deepmerge";
30206
30334
 
30207
30335
  // src/workflows/aws-deploy-workflow.ts
30208
30336
  var import_utils11 = __toESM(require_lib());
@@ -30772,7 +30900,7 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
30772
30900
  paths: [`${resolvedOutdir}/src/**`, `${resolvedOutdir}/package.json`]
30773
30901
  })
30774
30902
  };
30775
- const options = merge3(defaultOptions, userOptions);
30903
+ const options = merge4(defaultOptions, userOptions);
30776
30904
  super(options);
30777
30905
  this.addDevDeps("@types/node@catalog:");
30778
30906
  this.tsconfig?.addExclude("**/*.test.*");
@@ -30844,7 +30972,7 @@ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
30844
30972
  ]
30845
30973
  };
30846
30974
  const userResetTaskOptions = options.resetTaskOptions ?? {};
30847
- const resetTaskOptions = merge3(
30975
+ const resetTaskOptions = merge4(
30848
30976
  defaultResetTaskOptions,
30849
30977
  {
30850
30978
  ...userResetTaskOptions,
@@ -30921,7 +31049,7 @@ var StarlightProject = class extends AstroProject {
30921
31049
  new SampleFile3(this, "src/content/docs/index.mdx", {
30922
31050
  contents: DEFAULT_INDEX_MDX
30923
31051
  });
30924
- new SampleFile3(this, "src/content/config.ts", {
31052
+ new SampleFile3(this, "src/content.config.ts", {
30925
31053
  contents: DEFAULT_CONTENT_CONFIG_TS
30926
31054
  });
30927
31055
  }
@@ -30961,15 +31089,16 @@ description: Starlight-powered documentation site.
30961
31089
  Edit \`src/content/docs/index.mdx\` to replace this page.
30962
31090
  `;
30963
31091
  var DEFAULT_CONTENT_CONFIG_TS = `import { defineCollection } from "astro:content";
31092
+ import { docsLoader } from "@astrojs/starlight/loaders";
30964
31093
  import { docsSchema } from "@astrojs/starlight/schema";
30965
31094
 
30966
31095
  export const collections = {
30967
- docs: defineCollection({ schema: docsSchema() }),
31096
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
30968
31097
  };
30969
31098
  `;
30970
31099
 
30971
31100
  // src/typescript/typescript-config.ts
30972
- import { relative as relative4 } from "path";
31101
+ import { relative as relative5 } from "path";
30973
31102
  import { Component as Component19 } from "projen";
30974
31103
  import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
30975
31104
  var TypeScriptConfig = class extends Component19 {
@@ -30988,7 +31117,7 @@ var TypeScriptConfig = class extends Component19 {
30988
31117
  ...tsPaths,
30989
31118
  [dep.name]: [
30990
31119
  ensureRelativePathStartsWithDot(
30991
- relative4(project.outdir, subproject.outdir)
31120
+ relative5(project.outdir, subproject.outdir)
30992
31121
  )
30993
31122
  ]
30994
31123
  };
@@ -31139,6 +31268,7 @@ export {
31139
31268
  customerProfileBundle,
31140
31269
  docsSyncBundle,
31141
31270
  extractApiProcedure,
31271
+ extractDocReferences,
31142
31272
  formatLayoutViolation,
31143
31273
  formatStarlightSingletonViolation,
31144
31274
  getLatestEligibleVersion,