@reddoorla/maintenance 0.10.3 → 0.10.4

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/dist/index.d.ts CHANGED
@@ -369,4 +369,25 @@ declare function loadBundledImages(): Promise<{
369
369
  blurred: BundledImage;
370
370
  }>;
371
371
 
372
- export { ALL_AUDIT_NAMES, ALL_RECIPE_NAMES, type AirtableInventoryOptions, AuditName, AuditResult, BLURRED_CID, type BumpDepsOptions, type BundledImage, CHECK_CID, type ConvertToPnpmOptions, DEFAULT_INIT_STEPS, type DraftOptions, type DraftResult, type DueItem, type HeaderImage, type InitOptions, type InitResult, type InitStep, type InitStepResult, InventoryProvider, type LighthouseScores, type LocalPathOptions, type OnboardAudit, type OnboardOptions, type OrchestrateOptions, RecipeName, RecipeResult, type RenderResult, type ReportData, type ReportType, Site, type UpgradeSvelte4to5Options, a11yAudit, a11yFixturesPage, bumpDeps, convertToPnpm, depsAudit, draftReportForSite, findDueReports, fromAirtableBase, fromJsonFile, init, isRecipeName, lighthouseAudit, lintAudit, loadBundledImages, localPath, onboard, renderReportHtml, runAudits, runAuditsAcross, securityAudit, sendApprovedReports, svelteCodemods, upgradeSvelte4to5 };
372
+ /**
373
+ * Read this package's own version at runtime so recipe defaults don't go
374
+ * stale at each minor bump.
375
+ *
376
+ * Pass `import.meta.url` from the calling file. Walks UP from the caller
377
+ * looking for the first `package.json` whose `name` matches this package
378
+ * (`@reddoorla/maintenance`). The older "two levels up" shortcut held for
379
+ * `src/X/Y.ts` and `dist/cli/bin.js` (both happen to be 2 dirs deep) but
380
+ * broke for `dist/index.js` (only 1 dir deep) — silently returned "0.0.0"
381
+ * and pinned consumers to `^0.0.0`. Same bug class as the 0.10.1 bundled-
382
+ * assets ENOENT (2026-05-27). Walk-up is robust regardless of bundling
383
+ * layout.
384
+ *
385
+ * Returns "0.0.0" if no matching package.json is reachable (defensive
386
+ * fallback; callers should treat that as a signal to either override
387
+ * explicitly or fail loudly).
388
+ */
389
+ declare function selfPackageVersion(callerImportMetaUrl: string): string;
390
+ /** Caret-pinned range against this package's own version: e.g. "^0.6.2". */
391
+ declare function selfCaretRange(callerImportMetaUrl: string): string;
392
+
393
+ export { ALL_AUDIT_NAMES, ALL_RECIPE_NAMES, type AirtableInventoryOptions, AuditName, AuditResult, BLURRED_CID, type BumpDepsOptions, type BundledImage, CHECK_CID, type ConvertToPnpmOptions, DEFAULT_INIT_STEPS, type DraftOptions, type DraftResult, type DueItem, type HeaderImage, type InitOptions, type InitResult, type InitStep, type InitStepResult, InventoryProvider, type LighthouseScores, type LocalPathOptions, type OnboardAudit, type OnboardOptions, type OrchestrateOptions, RecipeName, RecipeResult, type RenderResult, type ReportData, type ReportType, Site, type UpgradeSvelte4to5Options, a11yAudit, a11yFixturesPage, bumpDeps, convertToPnpm, depsAudit, draftReportForSite, findDueReports, fromAirtableBase, fromJsonFile, init, isRecipeName, lighthouseAudit, lintAudit, loadBundledImages, localPath, onboard, renderReportHtml, runAudits, runAuditsAcross, securityAudit, selfCaretRange, selfPackageVersion, sendApprovedReports, svelteCodemods, upgradeSvelte4to5 };
package/dist/index.js CHANGED
@@ -1521,6 +1521,20 @@ function findMatchingClose(source, openIdx) {
1521
1521
  i = closeStr + 1;
1522
1522
  continue;
1523
1523
  }
1524
+ if (ch === "/") {
1525
+ const next = source[i + 1];
1526
+ if (next === "/") {
1527
+ const eol = source.indexOf("\n", i + 2);
1528
+ i = eol === -1 ? source.length : eol;
1529
+ continue;
1530
+ }
1531
+ if (next === "*") {
1532
+ const end = source.indexOf("*/", i + 2);
1533
+ if (end === -1) return -1;
1534
+ i = end + 2;
1535
+ continue;
1536
+ }
1537
+ }
1524
1538
  if (ch === "{") depth++;
1525
1539
  else if (ch === "}") {
1526
1540
  depth--;
@@ -1809,15 +1823,25 @@ import { stat as stat3 } from "fs/promises";
1809
1823
  import { join as join17 } from "path";
1810
1824
 
1811
1825
  // src/util/self-version.ts
1812
- import { readFileSync } from "fs";
1826
+ import { readFileSync, existsSync as existsSync2 } from "fs";
1813
1827
  import { fileURLToPath } from "url";
1814
1828
  import { dirname, join as join16 } from "path";
1815
1829
  function selfPackageVersion(callerImportMetaUrl) {
1816
1830
  try {
1817
- const here = dirname(fileURLToPath(callerImportMetaUrl));
1818
- const raw = readFileSync(join16(here, "..", "..", "package.json"), "utf-8");
1819
- const pkg = JSON.parse(raw);
1820
- return pkg.version ?? "0.0.0";
1831
+ let dir = dirname(fileURLToPath(callerImportMetaUrl));
1832
+ while (true) {
1833
+ const candidate = join16(dir, "package.json");
1834
+ if (existsSync2(candidate)) {
1835
+ const raw = readFileSync(candidate, "utf-8");
1836
+ const pkg = JSON.parse(raw);
1837
+ if (pkg.name === "@reddoorla/maintenance") {
1838
+ return pkg.version ?? "0.0.0";
1839
+ }
1840
+ }
1841
+ const parent = dirname(dir);
1842
+ if (parent === dir) return "0.0.0";
1843
+ dir = parent;
1844
+ }
1821
1845
  } catch {
1822
1846
  return "0.0.0";
1823
1847
  }
@@ -2152,7 +2176,7 @@ import mjml2html from "mjml";
2152
2176
 
2153
2177
  // src/reports/maintenance-email/assets/index.ts
2154
2178
  import { readFile as readFile11 } from "fs/promises";
2155
- import { existsSync as existsSync2 } from "fs";
2179
+ import { existsSync as existsSync3 } from "fs";
2156
2180
  import { dirname as dirname3, join as join19 } from "path";
2157
2181
  import { fileURLToPath as fileURLToPath2 } from "url";
2158
2182
  var CHECK_CID = "rd-check-png";
@@ -2163,12 +2187,12 @@ function resolveAssetsDir() {
2163
2187
  let dir = dirname3(fileURLToPath2(import.meta.url));
2164
2188
  while (true) {
2165
2189
  const srcCandidate = join19(dir, "src", "reports", "maintenance-email", "assets", "check.png");
2166
- if (existsSync2(srcCandidate)) {
2190
+ if (existsSync3(srcCandidate)) {
2167
2191
  cachedAssetsDir = dirname3(srcCandidate);
2168
2192
  return cachedAssetsDir;
2169
2193
  }
2170
2194
  const distCandidate = join19(dir, "dist", "reports", "maintenance-email", "assets", "check.png");
2171
- if (existsSync2(distCandidate)) {
2195
+ if (existsSync3(distCandidate)) {
2172
2196
  cachedAssetsDir = dirname3(distCandidate);
2173
2197
  return cachedAssetsDir;
2174
2198
  }
@@ -2839,6 +2863,8 @@ export {
2839
2863
  runAudits,
2840
2864
  runAuditsAcross,
2841
2865
  securityAudit,
2866
+ selfCaretRange,
2867
+ selfPackageVersion,
2842
2868
  sendApprovedReports,
2843
2869
  svelteCodemods,
2844
2870
  syncConfigs,