@soda-gql/common 0.0.1 → 0.0.3

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.
Files changed (72) hide show
  1. package/dist/canonical-id/index.cjs +2 -2
  2. package/dist/canonical-id/index.d.cts +1 -1
  3. package/dist/canonical-id/index.d.mts +2 -0
  4. package/dist/canonical-id/index.mjs +4 -0
  5. package/dist/{canonical-id-CE4Xjo2C.cjs → canonical-id-CCOns1qX.cjs} +35 -4
  6. package/dist/{canonical-id-Bn6ZPdZl.js → canonical-id-Hi4LzuFW.mjs} +3 -3
  7. package/dist/canonical-id-Hi4LzuFW.mjs.map +1 -0
  8. package/dist/{index-D6Lx478n.d.ts → index-BG7Aiges.d.cts} +2 -2
  9. package/dist/index-BG7Aiges.d.cts.map +1 -0
  10. package/dist/{index-C0n5gWc3.d.cts → index-BedBpKbv.d.mts} +2 -2
  11. package/dist/index-BedBpKbv.d.mts.map +1 -0
  12. package/dist/{index-C8yyrGd7.d.cts → index-C4t2Wbzs.d.mts} +2 -2
  13. package/dist/index-C4t2Wbzs.d.mts.map +1 -0
  14. package/dist/{index-LjtXZhxM.d.ts → index-DaAp2rNj.d.cts} +2 -2
  15. package/dist/index-DaAp2rNj.d.cts.map +1 -0
  16. package/dist/{index-B_QJzQA2.d.cts → index-Dit86qkX.d.mts} +2 -2
  17. package/dist/index-Dit86qkX.d.mts.map +1 -0
  18. package/dist/{index-Fi3RpHje.d.cts → index-Duf0evWM.d.mts} +2 -2
  19. package/dist/index-Duf0evWM.d.mts.map +1 -0
  20. package/dist/{index-DN4VW1v7.d.ts → index-LHYortIn.d.cts} +2 -2
  21. package/dist/index-LHYortIn.d.cts.map +1 -0
  22. package/dist/{index-CcSB32XQ.d.ts → index-noEcoTPq.d.cts} +2 -2
  23. package/dist/index-noEcoTPq.d.cts.map +1 -0
  24. package/dist/index.cjs +4 -4
  25. package/dist/index.d.cts +4 -4
  26. package/dist/index.d.mts +5 -0
  27. package/dist/index.mjs +6 -0
  28. package/dist/portable/index.cjs +1 -1
  29. package/dist/portable/index.d.cts +1 -1
  30. package/dist/portable/index.d.mts +2 -0
  31. package/dist/portable/index.mjs +3 -0
  32. package/dist/{portable-Bq_Qob6b.cjs → portable-C_7gJWmz.cjs} +12 -0
  33. package/dist/{portable-BqSEwase.js → portable-Dbo3u2CQ.mjs} +14 -2
  34. package/dist/portable-Dbo3u2CQ.mjs.map +1 -0
  35. package/dist/utils/index.cjs +1 -1
  36. package/dist/utils/index.d.cts +1 -1
  37. package/dist/utils/index.d.mts +2 -0
  38. package/dist/utils/index.mjs +3 -0
  39. package/dist/{utils-DxBnV8tL.js → utils-BBKXI0bh.mjs} +2 -2
  40. package/dist/utils-BBKXI0bh.mjs.map +1 -0
  41. package/dist/{utils-NBAPoMgh.cjs → utils-CJAVaQGX.cjs} +1 -3
  42. package/dist/zod/index.cjs +1 -1
  43. package/dist/zod/index.d.cts +1 -1
  44. package/dist/zod/index.d.mts +2 -0
  45. package/dist/zod/index.mjs +3 -0
  46. package/dist/{zod-B1gOOwdX.cjs → zod-CwtNt-Vj.cjs} +1 -2
  47. package/dist/{zod-BPbnZc6i.js → zod-DeSimXdI.mjs} +2 -2
  48. package/dist/zod-DeSimXdI.mjs.map +1 -0
  49. package/package.json +1 -1
  50. package/dist/canonical-id/index.d.ts +0 -2
  51. package/dist/canonical-id/index.js +0 -4
  52. package/dist/canonical-id-Bn6ZPdZl.js.map +0 -1
  53. package/dist/chunk-CUT6urMc.cjs +0 -30
  54. package/dist/index-B_QJzQA2.d.cts.map +0 -1
  55. package/dist/index-C0n5gWc3.d.cts.map +0 -1
  56. package/dist/index-C8yyrGd7.d.cts.map +0 -1
  57. package/dist/index-CcSB32XQ.d.ts.map +0 -1
  58. package/dist/index-D6Lx478n.d.ts.map +0 -1
  59. package/dist/index-DN4VW1v7.d.ts.map +0 -1
  60. package/dist/index-Fi3RpHje.d.cts.map +0 -1
  61. package/dist/index-LjtXZhxM.d.ts.map +0 -1
  62. package/dist/index.d.ts +0 -5
  63. package/dist/index.js +0 -6
  64. package/dist/portable/index.d.ts +0 -2
  65. package/dist/portable/index.js +0 -3
  66. package/dist/portable-BqSEwase.js.map +0 -1
  67. package/dist/utils/index.d.ts +0 -2
  68. package/dist/utils/index.js +0 -3
  69. package/dist/utils-DxBnV8tL.js.map +0 -1
  70. package/dist/zod/index.d.ts +0 -2
  71. package/dist/zod/index.js +0 -3
  72. package/dist/zod-BPbnZc6i.js.map +0 -1
@@ -1,5 +1,5 @@
1
- require('../utils-NBAPoMgh.cjs');
2
- const require_canonical_id = require('../canonical-id-CE4Xjo2C.cjs');
1
+ const require_canonical_id = require('../canonical-id-CCOns1qX.cjs');
2
+ require('../utils-CJAVaQGX.cjs');
3
3
 
4
4
  exports.CanonicalIdSchema = require_canonical_id.CanonicalIdSchema;
5
5
  exports.buildAstPath = require_canonical_id.buildAstPath;
@@ -1,2 +1,2 @@
1
- import { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "../index-C8yyrGd7.cjs";
1
+ import { a as createCanonicalTracker, c as CanonicalId, i as buildAstPath, l as CanonicalIdSchema, n as ScopeFrame, o as createOccurrenceTracker, r as ScopeHandle, s as createPathTracker, t as CanonicalPathTracker, u as createCanonicalId } from "../index-BG7Aiges.cjs";
2
2
  export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
@@ -0,0 +1,2 @@
1
+ import { a as createCanonicalTracker, c as CanonicalId, i as buildAstPath, l as CanonicalIdSchema, n as ScopeFrame, o as createOccurrenceTracker, r as ScopeHandle, s as createPathTracker, t as CanonicalPathTracker, u as createCanonicalId } from "../index-C4t2Wbzs.mjs";
2
+ export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
@@ -0,0 +1,4 @@
1
+ import "../utils-BBKXI0bh.mjs";
2
+ import { a as CanonicalIdSchema, i as createPathTracker, n as createCanonicalTracker, o as createCanonicalId, r as createOccurrenceTracker, t as buildAstPath } from "../canonical-id-Hi4LzuFW.mjs";
3
+
4
+ export { CanonicalIdSchema, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
@@ -1,9 +1,34 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_utils = require('./utils-NBAPoMgh.cjs');
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ const require_utils = require('./utils-CJAVaQGX.cjs');
3
29
  let node_path = require("node:path");
4
- node_path = require_chunk.__toESM(node_path);
5
30
  let zod = require("zod");
6
- zod = require_chunk.__toESM(zod);
31
+ zod = __toESM(zod);
7
32
 
8
33
  //#region packages/common/src/canonical-id/canonical-id.ts
9
34
  const canonicalIdSeparator = "::";
@@ -160,6 +185,12 @@ Object.defineProperty(exports, 'CanonicalIdSchema', {
160
185
  return CanonicalIdSchema;
161
186
  }
162
187
  });
188
+ Object.defineProperty(exports, '__toESM', {
189
+ enumerable: true,
190
+ get: function () {
191
+ return __toESM;
192
+ }
193
+ });
163
194
  Object.defineProperty(exports, 'buildAstPath', {
164
195
  enumerable: true,
165
196
  get: function () {
@@ -1,4 +1,4 @@
1
- import { normalizePath } from "./utils-DxBnV8tL.js";
1
+ import { i as normalizePath } from "./utils-BBKXI0bh.mjs";
2
2
  import { isAbsolute, resolve } from "node:path";
3
3
  import z$1 from "zod";
4
4
 
@@ -151,5 +151,5 @@ const buildAstPath = (stack) => {
151
151
  };
152
152
 
153
153
  //#endregion
154
- export { CanonicalIdSchema, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
155
- //# sourceMappingURL=canonical-id-Bn6ZPdZl.js.map
154
+ export { CanonicalIdSchema as a, createPathTracker as i, createCanonicalTracker as n, createCanonicalId as o, createOccurrenceTracker as r, buildAstPath as t };
155
+ //# sourceMappingURL=canonical-id-Hi4LzuFW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-id-Hi4LzuFW.mjs","names":["CanonicalIdSchema: z.ZodType<CanonicalId>","z","scopeStack: ScopeFrame[]","frame: ScopeFrame","exportBinding: string | undefined"],"sources":["../src/canonical-id/canonical-id.ts","../src/canonical-id/path-tracker.ts"],"sourcesContent":["import { isAbsolute, resolve } from \"node:path\";\nimport z from \"zod\";\nimport { normalizePath } from \"../utils\";\n\nexport type CanonicalId = string & { readonly __brand: \"CanonicalId\" };\n\nconst canonicalIdSeparator = \"::\" as const;\n\nexport const CanonicalIdSchema: z.ZodType<CanonicalId> = z.string() as unknown as z.ZodType<CanonicalId>;\n\n// Type-safe schema for CanonicalId - validates as string but types as branded\nexport const createCanonicalId = (filePath: string, astPath: string): CanonicalId => {\n if (!isAbsolute(filePath)) {\n throw new Error(\"[INTERNAL] CANONICAL_ID_REQUIRES_ABSOLUTE_PATH\");\n }\n\n const resolved = resolve(filePath);\n const normalized = normalizePath(resolved);\n\n // Create a 2-part ID: {absPath}::{astPath}\n // astPath uniquely identifies the definition's location in the AST (e.g., \"MyComponent.useQuery.def\")\n const idParts = [normalized, astPath];\n\n return idParts.join(canonicalIdSeparator) as CanonicalId;\n};\n","/**\n * Canonical path tracker for AST traversal.\n *\n * This module provides a stateful helper that tracks scope information during\n * AST traversal to generate canonical IDs. It's designed to integrate with\n * existing plugin visitor patterns (Babel, SWC, TypeScript) without requiring\n * a separate AST traversal.\n *\n * Usage pattern:\n * 1. Plugin creates tracker at file/program entry\n * 2. Plugin calls enterScope/exitScope during its traversal\n * 3. Plugin calls registerDefinition when discovering GQL definitions\n * 4. Tracker provides canonical ID information\n */\n\nimport type { CanonicalId } from \"./canonical-id\";\nimport { createCanonicalId } from \"./canonical-id\";\n\n/**\n * Scope frame for tracking AST path segments\n */\nexport type ScopeFrame = {\n /** Name segment (e.g., \"MyComponent\", \"useQuery\", \"arrow#1\") */\n readonly nameSegment: string;\n /** Kind of scope */\n readonly kind: \"function\" | \"class\" | \"variable\" | \"property\" | \"method\" | \"expression\";\n /** Occurrence index for disambiguation */\n readonly occurrence: number;\n};\n\n/**\n * Opaque handle for scope tracking\n */\nexport type ScopeHandle = {\n readonly __brand: \"ScopeHandle\";\n readonly depth: number;\n};\n\n/**\n * Canonical path tracker interface\n */\nexport interface CanonicalPathTracker {\n /**\n * Enter a new scope during traversal\n * @param options Scope information\n * @returns Handle to use when exiting the scope\n */\n enterScope(options: { segment: string; kind: ScopeFrame[\"kind\"]; stableKey?: string }): ScopeHandle;\n\n /**\n * Exit a scope during traversal\n * @param handle Handle returned from enterScope\n */\n exitScope(handle: ScopeHandle): void;\n\n /**\n * Register a definition discovered during traversal\n * @returns Definition metadata including astPath and canonical ID information\n */\n registerDefinition(): {\n astPath: string;\n isTopLevel: boolean;\n exportBinding?: string;\n };\n\n /**\n * Resolve a canonical ID from an astPath\n * @param astPath AST path string\n * @returns Canonical ID\n */\n resolveCanonicalId(astPath: string): CanonicalId;\n\n /**\n * Register an export binding\n * @param local Local variable name\n * @param exported Exported name\n */\n registerExportBinding(local: string, exported: string): void;\n\n /**\n * Get current scope depth\n * @returns Current depth (0 = top level)\n */\n currentDepth(): number;\n}\n\n/**\n * Build AST path from scope stack (internal helper)\n */\nconst _buildAstPath = (stack: readonly ScopeFrame[]): string => {\n return stack.map((frame) => frame.nameSegment).join(\".\");\n};\n\n/**\n * Create a canonical path tracker\n *\n * @param options Configuration options\n * @returns Tracker instance\n *\n * @example\n * ```typescript\n * // In a Babel plugin\n * const tracker = createCanonicalTracker({ filePath: state.filename });\n *\n * const visitor = {\n * FunctionDeclaration: {\n * enter(path) {\n * const handle = tracker.enterScope({\n * segment: path.node.id.name,\n * kind: 'function'\n * });\n * },\n * exit(path) {\n * tracker.exitScope(handle);\n * }\n * }\n * };\n * ```\n */\nexport const createCanonicalTracker = (options: {\n filePath: string;\n getExportName?: (localName: string) => string | undefined;\n}): CanonicalPathTracker => {\n const { filePath, getExportName } = options;\n\n // Scope stack\n const scopeStack: ScopeFrame[] = [];\n\n // Occurrence counters for disambiguating duplicate names\n const occurrenceCounters = new Map<string, number>();\n\n // Used paths for ensuring uniqueness\n const usedPaths = new Set<string>();\n\n // Export bindings map\n const exportBindings = new Map<string, string>();\n\n const getNextOccurrence = (key: string): number => {\n const current = occurrenceCounters.get(key) ?? 0;\n occurrenceCounters.set(key, current + 1);\n return current;\n };\n\n const ensureUniquePath = (basePath: string): string => {\n let path = basePath;\n let suffix = 0;\n while (usedPaths.has(path)) {\n suffix++;\n path = `${basePath}$${suffix}`;\n }\n usedPaths.add(path);\n return path;\n };\n\n return {\n enterScope({ segment, kind, stableKey }): ScopeHandle {\n const key = stableKey ?? `${kind}:${segment}`;\n const occurrence = getNextOccurrence(key);\n\n const frame: ScopeFrame = {\n nameSegment: segment,\n kind,\n occurrence,\n };\n\n scopeStack.push(frame);\n\n return {\n __brand: \"ScopeHandle\",\n depth: scopeStack.length - 1,\n } as ScopeHandle;\n },\n\n exitScope(handle: ScopeHandle): void {\n // Validate handle depth matches current stack\n if (handle.depth !== scopeStack.length - 1) {\n throw new Error(`[INTERNAL] Invalid scope exit: expected depth ${scopeStack.length - 1}, got ${handle.depth}`);\n }\n scopeStack.pop();\n },\n\n registerDefinition(): {\n astPath: string;\n isTopLevel: boolean;\n exportBinding?: string;\n } {\n const basePath = _buildAstPath(scopeStack);\n const astPath = ensureUniquePath(basePath);\n const isTopLevel = scopeStack.length === 0;\n\n // Check export binding if provided\n let exportBinding: string | undefined;\n if (getExportName && isTopLevel) {\n // For top-level definitions, try to get export name\n // This is a simplified version - real logic depends on how the definition is bound\n exportBinding = undefined;\n }\n\n return {\n astPath,\n isTopLevel,\n exportBinding,\n };\n },\n\n resolveCanonicalId(astPath: string): CanonicalId {\n return createCanonicalId(filePath, astPath);\n },\n\n registerExportBinding(local: string, exported: string): void {\n exportBindings.set(local, exported);\n },\n\n currentDepth(): number {\n return scopeStack.length;\n },\n };\n};\n\n/**\n * Helper to create occurrence tracker (for backward compatibility)\n */\nexport const createOccurrenceTracker = (): {\n getNextOccurrence: (key: string) => number;\n} => {\n const occurrenceCounters = new Map<string, number>();\n\n return {\n getNextOccurrence(key: string): number {\n const current = occurrenceCounters.get(key) ?? 0;\n occurrenceCounters.set(key, current + 1);\n return current;\n },\n };\n};\n\n/**\n * Helper to create path tracker (for backward compatibility)\n */\nexport const createPathTracker = (): {\n ensureUniquePath: (basePath: string) => string;\n} => {\n const usedPaths = new Set<string>();\n\n return {\n ensureUniquePath(basePath: string): string {\n let path = basePath;\n let suffix = 0;\n while (usedPaths.has(path)) {\n suffix++;\n path = `${basePath}$${suffix}`;\n }\n usedPaths.add(path);\n return path;\n },\n };\n};\n\n/**\n * Build AST path from scope stack (for backward compatibility)\n */\nexport const buildAstPath = (stack: readonly ScopeFrame[]):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UAAU,QAA2B;AAEnC,OAAI,OAAO,UAAU,WAAW,SAAS,GAAG;AAC1C,UAAM,IAAI,MAAM,iDAAiD,WAAW,SAAS,EAAE,QAAQ,OAAO,QAAQ;;AAEhH,cAAW,KAAK;;EAGlB,qBAIE;GACA,MAAM,WAAW,cAAc,WAAW;GAC1C,MAAM,UAAU,iBAAiB,SAAS;GAC1C,MAAM,aAAa,WAAW,WAAW;GAGzC,IAAIC;AACJ,OAAI,iBAAiB,YAAY;AAG/B,oBAAgB;;AAGlB,UAAO;IACL;IACA;IACA;IACD;;EAGH,mBAAmB,SAA8B;AAC/C,UAAO,kBAAkB,UAAU,QAAQ;;EAG7C,sBAAsB,OAAe,UAAwB;AAC3D,kBAAe,IAAI,OAAO,SAAS;;EAGrC,eAAuB;AACrB,UAAO,WAAW;;EAErB;;;;;AAMH,MAAa,gCAER;CACH,MAAM,qBAAqB,IAAI,KAAqB;AAEpD,QAAO,EACL,kBAAkB,KAAqB;EACrC,MAAM,UAAU,mBAAmB,IAAI,IAAI,IAAI;AAC/C,qBAAmB,IAAI,KAAK,UAAU,EAAE;AACxC,SAAO;IAEV;;;;;AAMH,MAAa,0BAER;CACH,MAAM,YAAY,IAAI,KAAa;AAEnC,QAAO,EACL,iBAAiB,UAA0B;EACzC,IAAI,OAAO;EACX,IAAI,SAAS;AACb,SAAO,UAAU,IAAI,KAAK,EAAE;AAC1B;AACA,UAAO,GAAG,SAAS,GAAG;;AAExB,YAAU,IAAI,KAAK;AACnB,SAAO;IAEV;;;;;AAMH,MAAa,gBAAgB,UAAyC;AACpE,QAAO,MAAM,KAAK,UAAU,MAAM,YAAY,CAAC,KAAK,IAAI"}
@@ -120,5 +120,5 @@ declare const createPathTracker: () => {
120
120
  */
121
121
  declare const buildAstPath: (stack: readonly ScopeFrame[]) => string;
122
122
  //#endregion
123
- export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
124
- //# sourceMappingURL=index-D6Lx478n.d.ts.map
123
+ export { createCanonicalTracker as a, CanonicalId as c, buildAstPath as i, CanonicalIdSchema as l, ScopeFrame as n, createOccurrenceTracker as o, ScopeHandle as r, createPathTracker as s, CanonicalPathTracker as t, createCanonicalId as u };
124
+ //# sourceMappingURL=index-BG7Aiges.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BG7Aiges.d.cts","names":[],"sources":["../src/canonical-id/canonical-id.ts","../src/canonical-id/path-tracker.ts"],"sourcesContent":[],"mappings":";;;KAIY,WAAA;;AAAZ,CAAA;AAIa,cAAA,iBAA6B,EAAV,GAAA,CAAE,OAAF,CAAU,WAAD,CAAA;AAG5B,cAAA,iBAAyD,EAAA,CAAA,QAarE,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GAbqE,WAarE;;;;;;AC+FD;AAuGa,KAzMD,UAAA,GAyMC;EAiBA;EAsBA,SAAA,WAEZ,EAAA,MAF4C;;;;;;;;;KApOjC,WAAA;;;;;;;UAQK,oBAAA;;;;;;;;UAM8B;;MAA2C;;;;;oBAMtE;;;;;;;;;;;;;;;uCAiBmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiD1B;;;MAGT;;;;cAoGS;;;;;;cAiBA;;;;;;cAsBA,+BAAgC"}
@@ -84,5 +84,5 @@ interface SpawnResult {
84
84
  }
85
85
  declare function spawn(options: SpawnOptions): Promise<SpawnResult>;
86
86
  //#endregion
87
- export { type HashAlgorithm, type PortableFS, type PortableHasher, type SpawnOptions, type SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
88
- //# sourceMappingURL=index-C0n5gWc3.d.cts.map
87
+ export { resetPortableForTests as a, HashAlgorithm as c, createPortableHasher as d, getPortableHasher as f, getPortableFS as g, createPortableFS as h, once as i, PortableHasher as l, __resetPortableFSForTests as m, SpawnResult as n, runtime as o, PortableFS as p, spawn as r, generateId as s, SpawnOptions as t, __resetPortableHasherForTests as u };
88
+ //# sourceMappingURL=index-BedBpKbv.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BedBpKbv.d.mts","names":[],"sources":["../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/runtime.ts","../src/portable/spawn.ts"],"sourcesContent":[],"mappings":";;AAMA;;AAE4C,UAF3B,UAAA,CAE2B;EACpB,QAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EAFE,OAEF,CAAA,MAAA,CAAA;EACe,SAAA,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAFK,OAEL,CAAA,IAAA,CAAA;EAAjB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EADE,OACF,CAAA,OAAA,CAAA;EACsB,IAAA,CAAA,IAAA,EAAA,MAAA,CAAA,EADtB,OACsB,CAAA;IACc,KAAA,EAFnB,IAEmB;IAAO,IAAA,EAAA,MAAA;EAsBjD,CAAA,CAAA;EA4FA,MAAA,CAAA,OAAA,EAAa,MAAA,EAAA,OAAI,EAAA,MAAU,CAAA,EAnHC,OAmHD,CAAA,IAAA,CAAA;EAW3B,KAAA,CAAA,IAAA,EAAA,MAAA,EAAA,QAAyB,EAAA;;MA7HiB;;ACN9C,iBD4BI,gBAAA,CAAA,CC5BS,ED4BW,UC5BX;AAER,iBDsHD,aAAA,CAAA,CCrHoB,EDqHH,UCrHgB;AAUjD;AAqCA;AAWA;;iBDsEgB,yBAAA,CAAA;;;;AAnIhB;;AAE4C,KCFhC,aAAA,GDEgC,QAAA,GAAA,QAAA;AACpB,UCDP,cAAA,CDCO;EACe,IAAA,CAAA,OAAA,EAAA,MAAA,EAAA,SAAA,CAAA,ECDH,aDCG,CAAA,EAAA,MAAA;;AACK,iBCQ5B,oBAAA,CAAA,CDR4B,ECQJ,cDRI;AACc,iBC4C1C,iBAAA,CAAA,CD5C0C,EC4CrB,cD5CqB;;AAsB1D;AA4FA;AAWA;iBCtEgB,6BAAA,CAAA;;;;AD7DhB;;;;;;AAK4C,iBED5B,UAAA,CAAA,CFC4B,EAAA,MAAA;;;;AAL5C;;AAE4C,cGJ/B,OHI+B,EAAA;EACpB,SAAA,KAAA,EAAA,OAAA;EACe,SAAA,MAAA,EAAA,OAAA;EAAjB,SAAA,iBAAA,EAAA,OAAA;CACsB;;;AAuB5C;AA4FgB,iBGjHA,IHiHa,CAAA,CAAA,CAAA,CAAI,EAAA,EAAA,GAAA,GGjHC,CHiHS,CAAA,EAAA,GAAA,GGjHC,CHiHD;AAW3C;;;;ACnIY,iBEwBI,qBAAA,CAAA,CFxBS,EAAA,IAAA;;;;ADAzB;;AAE4C,UIF3B,YAAA,CJE2B;EACpB,GAAA,EAAA,MAAA,EAAA;EACe,GAAA,CAAA,EAAA,MAAA;EAAjB,GAAA,CAAA,EIDd,MJCc,CAAA,MAAA,EAAA,MAAA,CAAA;;AAEoC,UIAzC,WAAA,CJAyC;EAAO,MAAA,EAAA,MAAA;EAsBjD,MAAA,EAAA,MAAA;EA4FA,QAAA,EAAA,MAAa;AAW7B;iBIvHsB,KAAA,UAAe,eAAe,QAAQ"}
@@ -120,5 +120,5 @@ declare const createPathTracker: () => {
120
120
  */
121
121
  declare const buildAstPath: (stack: readonly ScopeFrame[]) => string;
122
122
  //#endregion
123
- export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
124
- //# sourceMappingURL=index-C8yyrGd7.d.cts.map
123
+ export { createCanonicalTracker as a, CanonicalId as c, buildAstPath as i, CanonicalIdSchema as l, ScopeFrame as n, createOccurrenceTracker as o, ScopeHandle as r, createPathTracker as s, CanonicalPathTracker as t, createCanonicalId as u };
124
+ //# sourceMappingURL=index-C4t2Wbzs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C4t2Wbzs.d.mts","names":[],"sources":["../src/canonical-id/canonical-id.ts","../src/canonical-id/path-tracker.ts"],"sourcesContent":[],"mappings":";;;KAIY,WAAA;;AAAZ,CAAA;AAIa,cAAA,iBAA6B,EAAV,GAAA,CAAE,OAAF,CAAU,WAAD,CAAA;AAG5B,cAAA,iBAAyD,EAAA,CAAA,QAarE,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GAbqE,WAarE;;;;;;AC+FD;AAuGa,KAzMD,UAAA,GAyMC;EAiBA;EAsBA,SAAA,WAEZ,EAAA,MAF4C;;;;;;;;;KApOjC,WAAA;;;;;;;UAQK,oBAAA;;;;;;;;UAM8B;;MAA2C;;;;;oBAMtE;;;;;;;;;;;;;;;uCAiBmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiD1B;;;MAGT;;;;cAoGS;;;;;;cAiBA;;;;;;cAsBA,+BAAgC"}
@@ -84,5 +84,5 @@ interface SpawnResult {
84
84
  }
85
85
  declare function spawn(options: SpawnOptions): Promise<SpawnResult>;
86
86
  //#endregion
87
- export { type HashAlgorithm, type PortableFS, type PortableHasher, type SpawnOptions, type SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
88
- //# sourceMappingURL=index-LjtXZhxM.d.ts.map
87
+ export { resetPortableForTests as a, HashAlgorithm as c, createPortableHasher as d, getPortableHasher as f, getPortableFS as g, createPortableFS as h, once as i, PortableHasher as l, __resetPortableFSForTests as m, SpawnResult as n, runtime as o, PortableFS as p, spawn as r, generateId as s, SpawnOptions as t, __resetPortableHasherForTests as u };
88
+ //# sourceMappingURL=index-DaAp2rNj.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DaAp2rNj.d.cts","names":[],"sources":["../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/runtime.ts","../src/portable/spawn.ts"],"sour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AA,OAAA;CACsB;;;AAuB5C;AA4FgB,iBGjHA,IHiHa,CAAA,CAAA,CAAA,CAAI,EAAA,EAAA,GAAA,GGjHC,CHiHS,CAAA,EAAA,GAAA,GGjHC,CHiHD;AAW3C;;;;ACnIY,iBEwBI,qBAAA,CAAA,CFxBS,EAAA,IAAA;;;;ADAzB;;AAE4C,UIF3B,YAAA,CJE2B;EACpB,GAAA,EAAA,MAAA,EAAA;EACe,GAAA,CAAA,EAAA,MAAA;EAAjB,GAAA,CAAA,EIDd,MJCc,CAAA,MAAA,EAAA,MAAA,CAAA;;AAEoC,UIAzC,WAAA,CJAyC;EAAO,MAAA,EAAA,MAAA;EAsBjD,MAAA,EAAA,MAAA;EA4FA,QAAA,EAAA,MAAa;AAW7B;iBIvHsB,KAAA,UAAe,eAAe,QAAQ"}
@@ -5,5 +5,5 @@ type SchemaFor<TOutput> = z.ZodType<TOutput, any, any>;
5
5
  type ShapeFor<TOutput extends object> = { [K in keyof TOutput]-?: SchemaFor<TOutput[K]> };
6
6
  declare function defineSchemaFor<TOutput extends object>(): <TShape extends ShapeFor<NoInfer<TOutput>>>(shape: TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never }) => z.ZodObject<TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never } extends infer T ? { -readonly [P in keyof T]: T[P] } : never, z.core.$strict>;
7
7
  //#endregion
8
- export { SchemaFor, ShapeFor, defineSchemaFor };
9
- //# sourceMappingURL=index-B_QJzQA2.d.cts.map
8
+ export { ShapeFor as n, defineSchemaFor as r, SchemaFor as t };
9
+ //# sourceMappingURL=index-Dit86qkX.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Dit86qkX.d.mts","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":[],"mappings":";;;KAGY,qBAAqB,CAAA,CAAE,QAAQ;KAE/B,2CAFA,MAEiD,OAFxC,KAEoD,SAF9B,CAEwC,OAFhD,CAEwD,CAFxD,CAAA,CAAA,EAEnC;AAA6D,iBAE7C,eAF6C,CAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,EAAA,CAAA,eAGpC,QAHoC,CAG3B,OAH2B,CAGnB,OAHmB,CAAA,CAAA,CAAA,CAAA,KAAA,EAGD,MAHC,GAAA,QAGgB,OAHhB,CAAA,MAG8B,MAH9B,EAAA,MAG4C,OAH5C,CAAA,GAAA,KAAA,EAAA,EAAA,GAG8D,CAAA,CAAA,SAH9D,CAG8D,MAH9D,GAAA,QAGY,OAHZ,CAAA,MAGY,MAHZ,EAAA,MAGY,OAHZ,CAAA,GAAA,KAAA,EAAA,SAAA,KAAA,EAAA,GAAA,kBAAA,MAGY,CAHZ,GAGY,CAHZ,CAGY,CAHZ,CAAA,EAAA,GAAA,KAAA,EAGY,CAAA,CAAA,IAAA,CAAA,OAHZ,CAAA"}
@@ -56,5 +56,5 @@ declare const isRelativeSpecifier: (specifier: string) => boolean;
56
56
  */
57
57
  declare const isExternalSpecifier: (specifier: string) => boolean;
58
58
  //#endregion
59
- export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
60
- //# sourceMappingURL=index-Fi3RpHje.d.cts.map
59
+ export { resolveRelativeImportWithExistenceCheck as a, normalizePath as i, isExternalSpecifier as n, resolveRelativeImportWithReferences as o, isRelativeSpecifier as r, cachedFn as s, MODULE_EXTENSION_CANDIDATES as t };
60
+ //# sourceMappingURL=index-Duf0evWM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Duf0evWM.d.mts","names":[],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":[],"mappings":";cAAa,wBAAyB;EAAzB,EAAA,EAAyB,CAAzB;;;;;;AAAb;;;cCOa;AAAb;AAMA;AAUA;AAyCA;AAAuD,cAnD1C,aAmD0C,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,MAAA;;;;;;;AAsCvD;AAKA;cApFa;;;;;;;;;;;;;;;cAyCA;;;;;;;cAOC,YAAY,KAAK;;;;;cA+BlB;;;;cAKA"}
@@ -5,5 +5,5 @@ type SchemaFor<TOutput> = z.ZodType<TOutput, any, any>;
5
5
  type ShapeFor<TOutput extends object> = { [K in keyof TOutput]-?: SchemaFor<TOutput[K]> };
6
6
  declare function defineSchemaFor<TOutput extends object>(): <TShape extends ShapeFor<NoInfer<TOutput>>>(shape: TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never }) => z.ZodObject<TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never } extends infer T ? { -readonly [P in keyof T]: T[P] } : never, z.core.$strict>;
7
7
  //#endregion
8
- export { SchemaFor, ShapeFor, defineSchemaFor };
9
- //# sourceMappingURL=index-DN4VW1v7.d.ts.map
8
+ export { ShapeFor as n, defineSchemaFor as r, SchemaFor as t };
9
+ //# sourceMappingURL=index-LHYortIn.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-LHYortIn.d.cts","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":[],"mappings":";;;KAGY,qBAAqB,CAAA,CAAE,QAAQ;KAE/B,2CAFA,MAEiD,OAFxC,KAEoD,SAF9B,CAEwC,OAFhD,CAEwD,CAFxD,CAAA,CAAA,EAEnC;AAA6D,iBAE7C,eAF6C,CAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,EAAA,CAAA,eAGpC,QAHoC,CAG3B,OAH2B,CAGnB,OAHmB,CAAA,CAAA,CAAA,CAAA,KAAA,EAGD,MAHC,GAAA,QAGgB,OAHhB,CAAA,MAG8B,MAH9B,EAAA,MAG4C,OAH5C,CAAA,GAAA,KAAA,EAAA,EAAA,GAG8D,CAAA,CAAA,SAH9D,CAG8D,MAH9D,GAAA,QAGY,OAHZ,CAAA,MAGY,MAHZ,EAAA,MAGY,OAHZ,CAAA,GAAA,KAAA,EAAA,SAAA,KAAA,EAAA,GAAA,kBAAA,MAGY,CAHZ,GAGY,CAHZ,CAGY,CAHZ,CAAA,EAAA,GAAA,KAAA,EAGY,CAAA,CAAA,IAAA,CAAA,OAHZ,CAAA"}
@@ -56,5 +56,5 @@ declare const isRelativeSpecifier: (specifier: string) => boolean;
56
56
  */
57
57
  declare const isExternalSpecifier: (specifier: string) => boolean;
58
58
  //#endregion
59
- export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
60
- //# sourceMappingURL=index-CcSB32XQ.d.ts.map
59
+ export { resolveRelativeImportWithExistenceCheck as a, normalizePath as i, isExternalSpecifier as n, resolveRelativeImportWithReferences as o, isRelativeSpecifier as r, cachedFn as s, MODULE_EXTENSION_CANDIDATES as t };
60
+ //# sourceMappingURL=index-noEcoTPq.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-noEcoTPq.d.cts","names":[],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":[],"mappings":";cAAa,wBAAyB;EAAzB,EAAA,EAAyB,CAAzB;;;;;;AAAb;;;cCOa;AAAb;AAMA;AAUA;AAyCA;AAAuD,cAnD1C,aAmD0C,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,MAAA;;;;;;;AAsCvD;AAKA;cApFa;;;;;;;;;;;;;;;cAyCA;;;;;;;cAOC,YAAY,KAAK;;;;;cA+BlB;;;;cAKA"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- const require_utils = require('./utils-NBAPoMgh.cjs');
2
- const require_canonical_id = require('./canonical-id-CE4Xjo2C.cjs');
3
- const require_portable = require('./portable-Bq_Qob6b.cjs');
4
- const require_zod = require('./zod-B1gOOwdX.cjs');
1
+ const require_canonical_id = require('./canonical-id-CCOns1qX.cjs');
2
+ const require_utils = require('./utils-CJAVaQGX.cjs');
3
+ const require_portable = require('./portable-C_7gJWmz.cjs');
4
+ const require_zod = require('./zod-CwtNt-Vj.cjs');
5
5
 
6
6
  exports.CanonicalIdSchema = require_canonical_id.CanonicalIdSchema;
7
7
  exports.MODULE_EXTENSION_CANDIDATES = require_utils.MODULE_EXTENSION_CANDIDATES;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "./index-C8yyrGd7.cjs";
2
- import { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "./index-C0n5gWc3.cjs";
3
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "./index-Fi3RpHje.cjs";
4
- import { SchemaFor, ShapeFor, defineSchemaFor } from "./index-B_QJzQA2.cjs";
1
+ import { a as createCanonicalTracker, c as CanonicalId, i as buildAstPath, l as CanonicalIdSchema, n as ScopeFrame, o as createOccurrenceTracker, r as ScopeHandle, s as createPathTracker, t as CanonicalPathTracker, u as createCanonicalId } from "./index-BG7Aiges.cjs";
2
+ import { a as resetPortableForTests, c as HashAlgorithm, d as createPortableHasher, f as getPortableHasher, g as getPortableFS, h as createPortableFS, i as once, l as PortableHasher, m as __resetPortableFSForTests, n as SpawnResult, o as runtime, p as PortableFS, r as spawn, s as generateId, t as SpawnOptions, u as __resetPortableHasherForTests } from "./index-DaAp2rNj.cjs";
3
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "./index-noEcoTPq.cjs";
4
+ import { n as ShapeFor, r as defineSchemaFor, t as SchemaFor } from "./index-LHYortIn.cjs";
5
5
  export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, HashAlgorithm, MODULE_EXTENSION_CANDIDATES, PortableFS, PortableHasher, SchemaFor, ScopeFrame, ScopeHandle, ShapeFor, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, buildAstPath, cachedFn, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker, createPortableFS, createPortableHasher, defineSchemaFor, generateId, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, once, resetPortableForTests, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, runtime, spawn };
@@ -0,0 +1,5 @@
1
+ import { a as createCanonicalTracker, c as CanonicalId, i as buildAstPath, l as CanonicalIdSchema, n as ScopeFrame, o as createOccurrenceTracker, r as ScopeHandle, s as createPathTracker, t as CanonicalPathTracker, u as createCanonicalId } from "./index-C4t2Wbzs.mjs";
2
+ import { a as resetPortableForTests, c as HashAlgorithm, d as createPortableHasher, f as getPortableHasher, g as getPortableFS, h as createPortableFS, i as once, l as PortableHasher, m as __resetPortableFSForTests, n as SpawnResult, o as runtime, p as PortableFS, r as spawn, s as generateId, t as SpawnOptions, u as __resetPortableHasherForTests } from "./index-BedBpKbv.mjs";
3
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "./index-Duf0evWM.mjs";
4
+ import { n as ShapeFor, r as defineSchemaFor, t as SchemaFor } from "./index-Dit86qkX.mjs";
5
+ export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, HashAlgorithm, MODULE_EXTENSION_CANDIDATES, PortableFS, PortableHasher, SchemaFor, ScopeFrame, ScopeHandle, ShapeFor, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, buildAstPath, cachedFn, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker, createPortableFS, createPortableHasher, defineSchemaFor, generateId, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, once, resetPortableForTests, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, runtime, spawn };
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { a as getPortableHasher, c as getPortableFS, d as runtime, i as createPortableHasher, l as once, n as generateId, o as __resetPortableFSForTests, r as __resetPortableHasherForTests, s as createPortableFS, t as spawn, u as resetPortableForTests } from "./portable-Dbo3u2CQ.mjs";
2
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "./utils-BBKXI0bh.mjs";
3
+ import { a as CanonicalIdSchema, i as createPathTracker, n as createCanonicalTracker, o as createCanonicalId, r as createOccurrenceTracker, t as buildAstPath } from "./canonical-id-Hi4LzuFW.mjs";
4
+ import { t as defineSchemaFor } from "./zod-DeSimXdI.mjs";
5
+
6
+ export { CanonicalIdSchema, MODULE_EXTENSION_CANDIDATES, __resetPortableFSForTests, __resetPortableHasherForTests, buildAstPath, cachedFn, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker, createPortableFS, createPortableHasher, defineSchemaFor, generateId, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, once, resetPortableForTests, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, runtime, spawn };
@@ -1,4 +1,4 @@
1
- const require_portable = require('../portable-Bq_Qob6b.cjs');
1
+ const require_portable = require('../portable-C_7gJWmz.cjs');
2
2
 
3
3
  exports.__resetPortableFSForTests = require_portable.__resetPortableFSForTests;
4
4
  exports.__resetPortableHasherForTests = require_portable.__resetPortableHasherForTests;
@@ -1,2 +1,2 @@
1
- import { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "../index-C0n5gWc3.cjs";
1
+ import { a as resetPortableForTests, c as HashAlgorithm, d as createPortableHasher, f as getPortableHasher, g as getPortableFS, h as createPortableFS, i as once, l as PortableHasher, m as __resetPortableFSForTests, n as SpawnResult, o as runtime, p as PortableFS, r as spawn, s as generateId, t as SpawnOptions, u as __resetPortableHasherForTests } from "../index-DaAp2rNj.cjs";
2
2
  export { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
@@ -0,0 +1,2 @@
1
+ import { a as resetPortableForTests, c as HashAlgorithm, d as createPortableHasher, f as getPortableHasher, g as getPortableFS, h as createPortableFS, i as once, l as PortableHasher, m as __resetPortableFSForTests, n as SpawnResult, o as runtime, p as PortableFS, r as spawn, s as generateId, t as SpawnOptions, u as __resetPortableHasherForTests } from "../index-BedBpKbv.mjs";
2
+ export { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
@@ -0,0 +1,3 @@
1
+ import { a as getPortableHasher, c as getPortableFS, d as runtime, i as createPortableHasher, l as once, n as generateId, o as __resetPortableFSForTests, r as __resetPortableHasherForTests, s as createPortableFS, t as spawn, u as resetPortableForTests } from "../portable-Dbo3u2CQ.mjs";
2
+
3
+ export { __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
@@ -30,6 +30,9 @@ function resetPortableForTests() {}
30
30
 
31
31
  //#endregion
32
32
  //#region packages/common/src/portable/fs.ts
33
+ /**
34
+ * Portable filesystem API that works on both Bun and Node.js
35
+ */
33
36
  const getNodeFS = once(async () => {
34
37
  const fs = await import("node:fs/promises");
35
38
  return fs;
@@ -130,6 +133,9 @@ function __resetPortableFSForTests() {
130
133
  //#endregion
131
134
  //#region packages/common/src/portable/hash.ts
132
135
  /**
136
+ * Portable hashing API that works on both Bun and Node.js
137
+ */
138
+ /**
133
139
  * Pads a hex string to the specified length
134
140
  */
135
141
  function padHex(hex, length) {
@@ -175,6 +181,9 @@ function __resetPortableHasherForTests() {
175
181
  //#endregion
176
182
  //#region packages/common/src/portable/id.ts
177
183
  /**
184
+ * Portable ID generation that works on both Bun and Node.js
185
+ */
186
+ /**
178
187
  * Generate a unique ID
179
188
  * Uses UUIDv7 on Bun (monotonic), falls back to randomUUID on Node.js
180
189
  */
@@ -188,6 +197,9 @@ function generateId() {
188
197
 
189
198
  //#endregion
190
199
  //#region packages/common/src/portable/spawn.ts
200
+ /**
201
+ * Portable subprocess spawning that works on both Bun and Node.js
202
+ */
191
203
  async function spawn(options) {
192
204
  if (runtime.isBun) {
193
205
  const proc = Bun.spawn(options.cmd, {
@@ -35,6 +35,9 @@ function resetPortableForTests() {}
35
35
 
36
36
  //#endregion
37
37
  //#region packages/common/src/portable/fs.ts
38
+ /**
39
+ * Portable filesystem API that works on both Bun and Node.js
40
+ */
38
41
  const getNodeFS = once(async () => {
39
42
  const fs = await import("node:fs/promises");
40
43
  return fs;
@@ -135,6 +138,9 @@ function __resetPortableFSForTests() {
135
138
  //#endregion
136
139
  //#region packages/common/src/portable/hash.ts
137
140
  /**
141
+ * Portable hashing API that works on both Bun and Node.js
142
+ */
143
+ /**
138
144
  * Pads a hex string to the specified length
139
145
  */
140
146
  function padHex(hex, length) {
@@ -180,6 +186,9 @@ function __resetPortableHasherForTests() {
180
186
  //#endregion
181
187
  //#region packages/common/src/portable/id.ts
182
188
  /**
189
+ * Portable ID generation that works on both Bun and Node.js
190
+ */
191
+ /**
183
192
  * Generate a unique ID
184
193
  * Uses UUIDv7 on Bun (monotonic), falls back to randomUUID on Node.js
185
194
  */
@@ -193,6 +202,9 @@ function generateId() {
193
202
 
194
203
  //#endregion
195
204
  //#region packages/common/src/portable/spawn.ts
205
+ /**
206
+ * Portable subprocess spawning that works on both Bun and Node.js
207
+ */
196
208
  async function spawn(options) {
197
209
  if (runtime.isBun) {
198
210
  const proc = Bun.spawn(options.cmd, {
@@ -245,5 +257,5 @@ async function spawn(options) {
245
257
  }
246
258
 
247
259
  //#endregion
248
- export { __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
249
- //# sourceMappingURL=portable-BqSEwase.js.map
260
+ export { getPortableHasher as a, getPortableFS as c, runtime as d, createPortableHasher as i, once as l, generateId as n, __resetPortableFSForTests as o, __resetPortableHasherForTests as r, createPortableFS as s, spawn as t, resetPortableForTests as u };
261
+ //# sourceMappingURL=portable-Dbo3u2CQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable-Dbo3u2CQ.mjs","names":["result: T | undefined","fsInstance: PortableFS | null","crypto","hasherInstance: PortableHasher | null","crypto","execOptions: {\n cwd?: string;\n env?: Record<string, string>;\n encoding: BufferEncoding;\n }","error: unknown"],"sources":["../src/portable/runtime.ts","../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/spawn.ts"],"sourcesContent":["/**\n * Runtime detection utilities for portable API implementation\n */\n\nexport const runtime = {\n isBun: typeof Bun !== \"undefined\",\n isNode: typeof process !== \"undefined\" && typeof Bun === \"undefined\",\n supportsWebCrypto: typeof crypto !== \"undefined\" && typeof crypto.subtle !== \"undefined\",\n} as const;\n\n/**\n * Helper to cache module imports to avoid repeated dynamic imports\n */\nexport function once<T>(fn: () => T): () => T {\n let result: T | undefined;\n let called = false;\n\n return () => {\n if (!called) {\n result = fn();\n called = true;\n }\n return result as T;\n };\n}\n\n/**\n * Reset runtime state for testing purposes only\n * @internal\n */\nexport function resetPortableForTests(): void {\n // This is a marker function that portable modules can use\n // to reset their singleton state in tests\n}\n","/**\n * Portable filesystem API that works on both Bun and Node.js\n */\n\nimport { once, runtime } from \"./runtime\";\n\nexport interface PortableFS {\n readFile(path: string): Promise<string>;\n writeFile(path: string, content: string): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<{ mtime: Date; size: number }>;\n rename(oldPath: string, newPath: string): Promise<void>;\n mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;\n}\n\ninterface FSPromises {\n readFile: (path: string, encoding: string) => Promise<string>;\n writeFile: (path: string, content: string, encoding: string) => Promise<void>;\n access: (path: string) => Promise<void>;\n stat: (path: string) => Promise<{\n mtime: Date;\n size: number;\n isDirectory: () => boolean;\n }>;\n rename: (oldPath: string, newPath: string) => Promise<void>;\n mkdir: (path: string, options?: { recursive?: boolean }) => Promise<void>;\n}\n\n// Cache the fs/promises import\nconst getNodeFS = once(async (): Promise<FSPromises> => {\n const fs = await import(\"node:fs/promises\");\n return fs as FSPromises;\n});\n\nexport function createPortableFS(): PortableFS {\n if (runtime.isBun) {\n return {\n async readFile(path) {\n const file = Bun.file(path);\n return await file.text();\n },\n\n async writeFile(path, content) {\n // Bun.write auto-creates parent directories\n await Bun.write(path, content);\n },\n\n async exists(path) {\n // Bun.file().exists() only works for files, use fs.stat for both files and dirs\n const nodeFS = await getNodeFS();\n try {\n await nodeFS.stat(path);\n return true;\n } catch {\n return false;\n }\n },\n\n async stat(path) {\n const file = Bun.file(path);\n const size = file.size;\n // Bun doesn't expose mtime directly, use Node fs.stat\n const nodeFS = await getNodeFS();\n const { mtime } = await nodeFS.stat(path);\n return { mtime, size };\n },\n\n async rename(oldPath, newPath) {\n const nodeFS = await getNodeFS();\n await nodeFS.rename(oldPath, newPath);\n },\n\n async mkdir(path, options) {\n const nodeFS = await getNodeFS();\n await nodeFS.mkdir(path, options);\n },\n };\n }\n\n // Node.js implementation\n return {\n async readFile(path) {\n const nodeFS = await getNodeFS();\n return await nodeFS.readFile(path, \"utf-8\");\n },\n\n async writeFile(path, content) {\n const nodeFS = await getNodeFS();\n // Auto-create parent directories like Bun.write does\n const pathModule = await import(\"node:path\");\n const dir = pathModule.dirname(path);\n await nodeFS.mkdir(dir, { recursive: true });\n await nodeFS.writeFile(path, content, \"utf-8\");\n },\n\n async exists(path) {\n const nodeFS = await getNodeFS();\n try {\n await nodeFS.access(path);\n return true;\n } catch {\n return false;\n }\n },\n\n async stat(path) {\n const nodeFS = await getNodeFS();\n const stats = await nodeFS.stat(path);\n return { mtime: stats.mtime, size: stats.size };\n },\n\n async rename(oldPath, newPath) {\n const nodeFS = await getNodeFS();\n await nodeFS.rename(oldPath, newPath);\n },\n\n async mkdir(path, options) {\n const nodeFS = await getNodeFS();\n await nodeFS.mkdir(path, options);\n },\n };\n}\n\n// Singleton to avoid recreating instances\nlet fsInstance: PortableFS | null = null;\n\nexport function getPortableFS(): PortableFS {\n if (!fsInstance) {\n fsInstance = createPortableFS();\n }\n return fsInstance;\n}\n\n/**\n * Reset the filesystem singleton for testing\n * @internal\n */\nexport function __resetPortableFSForTests(): void {\n fsInstance = null;\n}\n","/**\n * Portable hashing API that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\nexport type HashAlgorithm = \"sha256\" | \"xxhash\";\n\nexport interface PortableHasher {\n hash(content: string, algorithm?: HashAlgorithm): string;\n}\n\n/**\n * Pads a hex string to the specified length\n */\nfunction padHex(hex: string, length: number): string {\n return hex.padStart(length, \"0\");\n}\n\nexport function createPortableHasher(): PortableHasher {\n if (runtime.isBun) {\n return {\n hash(content, algorithm = \"xxhash\") {\n if (algorithm === \"sha256\") {\n const hasher = new Bun.CryptoHasher(\"sha256\");\n hasher.update(content);\n return hasher.digest(\"hex\");\n }\n // xxhash - Bun.hash returns a number\n const hashNum = Bun.hash(content);\n // Convert to hex and pad to 16 chars for consistency\n return padHex(hashNum.toString(16), 16);\n },\n };\n }\n\n // Node.js implementation\n return {\n hash(content, algorithm = \"xxhash\") {\n if (algorithm === \"sha256\") {\n const crypto = require(\"node:crypto\");\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n }\n // xxhash fallback: use sha256 for now (can add xxhash package later if needed)\n // This ensures consistent behavior across runtimes\n const crypto = require(\"node:crypto\");\n const sha256Hash = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n // Take first 16 chars to match xxhash output length\n return sha256Hash.substring(0, 16);\n },\n };\n}\n\n// Singleton to avoid recreating instances\nlet hasherInstance: PortableHasher | null = null;\n\nexport function getPortableHasher(): PortableHasher {\n if (!hasherInstance) {\n hasherInstance = createPortableHasher();\n }\n return hasherInstance;\n}\n\n/**\n * Reset the hasher singleton for testing\n * @internal\n */\nexport function __resetPortableHasherForTests(): void {\n hasherInstance = null;\n}\n","/**\n * Portable ID generation that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\n/**\n * Generate a unique ID\n * Uses UUIDv7 on Bun (monotonic), falls back to randomUUID on Node.js\n */\nexport function generateId(): string {\n if (runtime.isBun && typeof Bun !== \"undefined\" && typeof Bun.randomUUIDv7 === \"function\") {\n return Bun.randomUUIDv7();\n }\n\n // Node.js fallback: use crypto.randomUUID\n const crypto = require(\"node:crypto\");\n return crypto.randomUUID();\n}\n","/**\n * Portable subprocess spawning that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\nexport interface SpawnOptions {\n cmd: string[];\n cwd?: string;\n env?: Record<string, string>;\n}\n\nexport interface SpawnResult {\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nexport async function spawn(options: SpawnOptions): Promise<SpawnResult> {\n if (runtime.isBun) {\n const proc = Bun.spawn(options.cmd, {\n cwd: options.cwd,\n env: options.env,\n stdout: \"pipe\",\n stderr: \"pipe\",\n });\n\n const [stdout, stderr] = await Promise.all([new Response(proc.stdout).text(), new Response(proc.stderr).text()]);\n\n const exitCode = await proc.exited;\n\n return { stdout, stderr, exitCode };\n }\n\n // Node.js implementation\n const { execFile } = await import(\"node:child_process\");\n const { promisify } = await import(\"node:util\");\n const execFilePromise = promisify(execFile);\n\n const [command, ...args] = options.cmd;\n if (!command) {\n return {\n stdout: \"\",\n stderr: \"Error: No command provided\",\n exitCode: 1,\n };\n }\n\n try {\n const execOptions: {\n cwd?: string;\n env?: Record<string, string>;\n encoding: BufferEncoding;\n } = {\n encoding: \"utf-8\",\n };\n\n if (options.cwd) {\n execOptions.cwd = options.cwd;\n }\n if (options.env) {\n execOptions.env = options.env;\n }\n\n const { stdout, stderr } = await execFilePromise(command, args, execOptions);\n return {\n stdout: stdout || \"\",\n stderr: stderr || \"\",\n exitCode: 0,\n };\n } catch (error: unknown) {\n const err = error as {\n stdout?: string;\n stderr?: string;\n code?: number;\n };\n return {\n stdout: err.stdout || \"\",\n stderr: err.stderr || \"\",\n exitCode: err.code || 1,\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,UAAU;CACrB,OAAO,OAAO,QAAQ;CACtB,QAAQ,OAAO,YAAY,eAAe,OAAO,QAAQ;CACzD,mBAAmB,OAAO,WAAW,eAAe,OAAO,OAAO,WAAW;CAC9E;;;;AAKD,SAAgB,KAAQ,IAAsB;CAC5C,IAAIA;CACJ,IAAI,SAAS;AAEb,cAAa;AACX,MAAI,CAAC,QAAQ;AACX,YAAS,IAAI;AACb,YAAS;;AAEX,SAAO;;;;;;;AAQX,SAAgB,wBAA8B;;;;;;;ACD9C,MAAM,YAAY,KAAK,YAAiC;CACtD,MAAM,KAAK,MAAM,OAAO;AACxB,QAAO;EACP;AAEF,SAAgB,mBAA+B;AAC7C,KAAI,QAAQ,OAAO;AACjB,SAAO;GACL,MAAM,SAAS,MAAM;IACnB,MAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,WAAO,MAAM,KAAK,MAAM;;GAG1B,MAAM,UAAU,MAAM,SAAS;AAE7B,UAAM,IAAI,MAAM,MAAM,QAAQ;;GAGhC,MAAM,OAAO,MAAM;IAEjB,MAAM,SAAS,MAAM,WAAW;AAChC,QAAI;AACF,WAAM,OAAO,KAAK,KAAK;AACv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B,MAAM,SAA6C;AACvE,KAAI,QAAQ,OAAO;EACjB,MAAM,OAAO,IAAI,MAAM,QAAQ,KAAK;GAClC,KAAK,QAAQ;GACb,KAAK,QAAQ;GACb,QAAQ;GACR,QAAQ;GACT,CAAC;EAEF,MAAM,CAAC,QAAQ,UAAU,MAAM,QAAQ,IAAI,CAAC,IAAI,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,IAAI,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;EAEhH,MAAM,WAAW,MAAM,KAAK;AAE5B,SAAO;GAAE;GAAQ;GAAQ;GAAU;;CAIrC,MAAM,EAAE,aAAa,MAAM,OAAO;CAClC,MAAM,EAAE,cAAc,MAAM,OAAO;CACnC,MAAM,kBAAkB,UAAU,SAAS;CAE3C,MAAM,CAAC,SAAS,GAAG,QAAQ,QAAQ;AACnC,KAAI,CAAC,SAAS;AACZ,SAAO;GACL,QAAQ;GACR,QAAQ;GACR,UAAU;GACX;;AAGH,KAAI;EACF,MAAMC,cAIF,EACF,UAAU,SACX;AAED,MAAI,QAAQ,KAAK;AACf,eAAY,MAAM,QAAQ;;AAE5B,MAAI,QAAQ,KAAK;AACf,eAAY,MAAM,QAAQ;;EAG5B,MAAM,EAAE,QAAQ,WAAW,MAAM,gBAAgB,SAAS,MAAM,YAAY;AAC5E,SAAO;GACL,QAAQ,UAAU;GAClB,QAAQ,UAAU;GAClB,UAAU;GACX;UACMC,OAAgB;EACvB,MAAM,MAAM;AAKZ,SAAO;GACL,QAAQ,IAAI,UAAU;GACtB,QAAQ,IAAI,UAAU;GACtB,UAAU,IAAI,QAAQ;GACvB"}
@@ -1,4 +1,4 @@
1
- const require_utils = require('../utils-NBAPoMgh.cjs');
1
+ const require_utils = require('../utils-CJAVaQGX.cjs');
2
2
 
3
3
  exports.MODULE_EXTENSION_CANDIDATES = require_utils.MODULE_EXTENSION_CANDIDATES;
4
4
  exports.cachedFn = require_utils.cachedFn;
@@ -1,2 +1,2 @@
1
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "../index-Fi3RpHje.cjs";
1
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "../index-noEcoTPq.cjs";
2
2
  export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
@@ -0,0 +1,2 @@
1
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "../index-Duf0evWM.mjs";
2
+ export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
@@ -0,0 +1,3 @@
1
+ import { a as resolveRelativeImportWithExistenceCheck, i as normalizePath, n as isExternalSpecifier, o as resolveRelativeImportWithReferences, r as isRelativeSpecifier, s as cachedFn, t as MODULE_EXTENSION_CANDIDATES } from "../utils-BBKXI0bh.mjs";
2
+
3
+ export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
@@ -96,5 +96,5 @@ const isRelativeSpecifier = (specifier) => specifier.startsWith("./") || specifi
96
96
  const isExternalSpecifier = (specifier) => !isRelativeSpecifier(specifier);
97
97
 
98
98
  //#endregion
99
- export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
100
- //# sourceMappingURL=utils-DxBnV8tL.js.map
99
+ export { resolveRelativeImportWithExistenceCheck as a, normalizePath as i, isExternalSpecifier as n, resolveRelativeImportWithReferences as o, isRelativeSpecifier as r, cachedFn as s, MODULE_EXTENSION_CANDIDATES as t };
100
+ //# sourceMappingURL=utils-BBKXI0bh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-BBKXI0bh.mjs","names":["cached: { value: T } | null"],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":["export const cachedFn = <T>(fn: () => T) => {\n let cached: { value: T } | null = null;\n\n const ensure = () => (cached ??= { value: fn() }).value;\n ensure.clear = () => {\n cached = null;\n };\n\n return ensure;\n};\n","import { existsSync } from \"node:fs\";\nimport { dirname, join, normalize, resolve } from \"node:path\";\n\n/**\n * File extensions to try when resolving module specifiers.\n * Ordered by precedence: TypeScript, then JavaScript.\n */\nexport const MODULE_EXTENSION_CANDIDATES = [\".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".jsx\", \".mjs\", \".cjs\"] as const;\n\n/**\n * Normalize path to use forward slashes (cross-platform).\n * Ensures consistent path handling across platforms.\n */\nexport const normalizePath = (value: string): string => normalize(value).replace(/\\\\/g, \"/\");\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithExistenceCheck = ({\n filePath,\n specifier,\n}: {\n filePath: string;\n specifier: string;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try exact path first\n if (existsSync(base)) {\n return normalizePath(base);\n }\n\n // Try with extensions\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n return null;\n};\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithReferences = <_>({\n filePath,\n specifier,\n references,\n}: {\n filePath: string;\n specifier: string;\n references: Map<string, _> | Set<string>;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try exact path first\n if (references.has(base)) {\n return normalizePath(base);\n }\n\n // Try with extensions\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n return null;\n};\n\n/**\n * Check if a module specifier is relative (starts with '.' or '..')\n */\nexport const isRelativeSpecifier = (specifier: string): boolean => specifier.startsWith(\"./\") || specifier.startsWith(\"../\");\n\n/**\n * Check if a module specifier is external (package name, not relative)\n */\nexport const isExternalSpecifier = (specifier: string): boolean => !isRelativeSpecifier(specifier);\n"],"mappings":";;;;AAAA,MAAa,YAAe,OAAgB;CAC1C,IAAIA,SAA8B;CAElC,MAAM,gBAAgB,WAAW,EAAE,OAAO,IAAI,EAAE,EAAE;AAClD,QAAO,cAAc;AACnB,WAAS;;AAGX,QAAO;;;;;;;;;ACDT,MAAa,8BAA8B;CAAC;CAAO;CAAQ;CAAQ;CAAQ;CAAO;CAAQ;CAAQ;CAAO;;;;;AAMzG,MAAa,iBAAiB,UAA0B,UAAU,MAAM,CAAC,QAAQ,OAAO,IAAI;;;;;;;;;AAU5F,MAAa,2CAA2C,EACtD,UACA,gBAImB;CACnB,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE,UAAU;AAGlD,KAAI,WAAW,KAAK,EAAE;AACpB,SAAO,cAAc,KAAK;;AAI5B,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,GAAG,OAAO;AAC5B,MAAI,WAAW,UAAU,EAAE;AACzB,UAAO,cAAc,UAAU;;;AAKnC,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,KAAK,MAAM,QAAQ,MAAM;AAC3C,MAAI,WAAW,UAAU,EAAE;AACzB,UAAO,cAAc,UAAU;;;AAInC,QAAO;;;;;;;;;;AAWT,MAAa,uCAA0C,EACrD,UACA,WACA,iBAKmB;CACnB,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE,UAAU;AAGlD,KAAI,WAAW,IAAI,KAAK,EAAE;AACxB,SAAO,cAAc,KAAK;;AAI5B,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,GAAG,OAAO;AAC5B,MAAI,WAAW,IAAI,UAAU,EAAE;AAC7B,UAAO,cAAc,UAAU;;;AAKnC,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,KAAK,MAAM,QAAQ,MAAM;AAC3C,MAAI,WAAW,IAAI,UAAU,EAAE;AAC7B,UAAO,cAAc,UAAU;;;AAInC,QAAO;;;;;AAMT,MAAa,uBAAuB,cAA+B,UAAU,WAAW,KAAK,IAAI,UAAU,WAAW,MAAM;;;;AAK5H,MAAa,uBAAuB,cAA+B,CAAC,oBAAoB,UAAU"}
@@ -1,8 +1,6 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_canonical_id = require('./canonical-id-CCOns1qX.cjs');
2
2
  let node_path = require("node:path");
3
- node_path = require_chunk.__toESM(node_path);
4
3
  let node_fs = require("node:fs");
5
- node_fs = require_chunk.__toESM(node_fs);
6
4
 
7
5
  //#region packages/common/src/utils/cached-fn.ts
8
6
  const cachedFn = (fn) => {
@@ -1,3 +1,3 @@
1
- const require_zod = require('../zod-B1gOOwdX.cjs');
1
+ const require_zod = require('../zod-CwtNt-Vj.cjs');
2
2
 
3
3
  exports.defineSchemaFor = require_zod.defineSchemaFor;
@@ -1,2 +1,2 @@
1
- import { SchemaFor, ShapeFor, defineSchemaFor } from "../index-B_QJzQA2.cjs";
1
+ import { n as ShapeFor, r as defineSchemaFor, t as SchemaFor } from "../index-LHYortIn.cjs";
2
2
  export { SchemaFor, ShapeFor, defineSchemaFor };
@@ -0,0 +1,2 @@
1
+ import { n as ShapeFor, r as defineSchemaFor, t as SchemaFor } from "../index-Dit86qkX.mjs";
2
+ export { SchemaFor, ShapeFor, defineSchemaFor };
@@ -0,0 +1,3 @@
1
+ import { t as defineSchemaFor } from "../zod-DeSimXdI.mjs";
2
+
3
+ export { defineSchemaFor };
@@ -1,6 +1,5 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_canonical_id = require('./canonical-id-CCOns1qX.cjs');
2
2
  let zod = require("zod");
3
- zod = require_chunk.__toESM(zod);
4
3
 
5
4
  //#region packages/common/src/zod/schema-helper.ts
6
5
  function defineSchemaFor() {
@@ -6,5 +6,5 @@ function defineSchemaFor() {
6
6
  }
7
7
 
8
8
  //#endregion
9
- export { defineSchemaFor };
10
- //# sourceMappingURL=zod-BPbnZc6i.js.map
9
+ export { defineSchemaFor as t };
10
+ //# sourceMappingURL=zod-DeSimXdI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-DeSimXdI.mjs","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// biome-ignore lint/suspicious/noExplicitAny: abstract type\nexport type SchemaFor<TOutput> = z.ZodType<TOutput, any, any>;\n\nexport type ShapeFor<TOutput extends object> = { [K in keyof TOutput]-?: SchemaFor<TOutput[K]> };\n\nexport function defineSchemaFor<TOutput extends object>() {\n return <TShape extends ShapeFor<NoInfer<TOutput>>>(shape: TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never }) =>\n z.object(shape).strict();\n}\n"],"mappings":";;;AAOA,SAAgB,kBAA0C;AACxD,SAAmD,UACjD,EAAE,OAAO,MAAM,CAAC,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soda-gql/common",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- import { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "../index-D6Lx478n.js";
2
- export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
@@ -1,4 +0,0 @@
1
- import "../utils-DxBnV8tL.js";
2
- import { CanonicalIdSchema, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "../canonical-id-Bn6ZPdZl.js";
3
-
4
- export { CanonicalIdSchema, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker };
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonical-id-Bn6ZPdZl.js","names":["CanonicalIdSchema: z.ZodType<CanonicalId>","z","scopeStack: ScopeFrame[]","frame: ScopeFrame","exportBinding: string | undefined"],"sources":["../src/canonical-id/canonical-id.ts","../src/canonical-id/path-tracker.ts"],"sourcesContent":["import { isAbsolute, resolve } from \"node:path\";\nimport z from \"zod\";\nimport { normalizePath } from \"../utils\";\n\nexport type CanonicalId = string & { readonly __brand: \"CanonicalId\" };\n\nconst canonicalIdSeparator = \"::\" as const;\n\nexport const CanonicalIdSchema: z.ZodType<CanonicalId> = z.string() as unknown as z.ZodType<CanonicalId>;\n\n// Type-safe schema for CanonicalId - validates as string but types as branded\nexport const createCanonicalId = (filePath: string, astPath: string): CanonicalId => {\n if (!isAbsolute(filePath)) {\n throw new Error(\"[INTERNAL] CANONICAL_ID_REQUIRES_ABSOLUTE_PATH\");\n }\n\n const resolved = resolve(filePath);\n const normalized = normalizePath(resolved);\n\n // Create a 2-part ID: {absPath}::{astPath}\n // astPath uniquely identifies the definition's location in the AST (e.g., \"MyComponent.useQuery.def\")\n const idParts = [normalized, astPath];\n\n return idParts.join(canonicalIdSeparator) as CanonicalId;\n};\n","/**\n * Canonical path tracker for AST traversal.\n *\n * This module provides a stateful helper that tracks scope information during\n * AST traversal to generate canonical IDs. It's designed to integrate with\n * existing plugin visitor patterns (Babel, SWC, TypeScript) without requiring\n * a separate AST traversal.\n *\n * Usage pattern:\n * 1. Plugin creates tracker at file/program entry\n * 2. Plugin calls enterScope/exitScope during its traversal\n * 3. Plugin calls registerDefinition when discovering GQL definitions\n * 4. Tracker provides canonical ID information\n */\n\nimport type { CanonicalId } from \"./canonical-id\";\nimport { createCanonicalId } from \"./canonical-id\";\n\n/**\n * Scope frame for tracking AST path segments\n */\nexport type ScopeFrame = {\n /** Name segment (e.g., \"MyComponent\", \"useQuery\", \"arrow#1\") */\n readonly nameSegment: string;\n /** Kind of scope */\n readonly kind: \"function\" | \"class\" | \"variable\" | \"property\" | \"method\" | \"expression\";\n /** Occurrence index for disambiguation */\n readonly occurrence: number;\n};\n\n/**\n * Opaque handle for scope tracking\n */\nexport type ScopeHandle = {\n readonly __brand: \"ScopeHandle\";\n readonly depth: number;\n};\n\n/**\n * Canonical path tracker interface\n */\nexport interface CanonicalPathTracker {\n /**\n * Enter a new scope during traversal\n * @param options Scope information\n * @returns Handle to use when exiting the scope\n */\n enterScope(options: { segment: string; kind: ScopeFrame[\"kind\"]; stableKey?: string }): ScopeHandle;\n\n /**\n * Exit a scope during traversal\n * @param handle Handle returned from enterScope\n */\n exitScope(handle: ScopeHandle): void;\n\n /**\n * Register a definition discovered during traversal\n * @returns Definition metadata including astPath and canonical ID information\n */\n registerDefinition(): {\n astPath: string;\n isTopLevel: boolean;\n exportBinding?: string;\n };\n\n /**\n * Resolve a canonical ID from an astPath\n * @param astPath AST path string\n * @returns Canonical ID\n */\n resolveCanonicalId(astPath: string): CanonicalId;\n\n /**\n * Register an export binding\n * @param local Local variable name\n * @param exported Exported name\n */\n registerExportBinding(local: string, exported: string): void;\n\n /**\n * Get current scope depth\n * @returns Current depth (0 = top level)\n */\n currentDepth(): number;\n}\n\n/**\n * Build AST path from scope stack (internal helper)\n */\nconst _buildAstPath = (stack: readonly ScopeFrame[]): string => {\n return stack.map((frame) => frame.nameSegment).join(\".\");\n};\n\n/**\n * Create a canonical path tracker\n *\n * @param options Configuration options\n * @returns Tracker instance\n *\n * @example\n * ```typescript\n * // In a Babel plugin\n * const tracker = createCanonicalTracker({ filePath: state.filename });\n *\n * const visitor = {\n * FunctionDeclaration: {\n * enter(path) {\n * const handle = tracker.enterScope({\n * segment: path.node.id.name,\n * kind: 'function'\n * });\n * },\n * exit(path) {\n * tracker.exitScope(handle);\n * }\n * }\n * };\n * ```\n */\nexport const createCanonicalTracker = (options: {\n filePath: string;\n getExportName?: (localName: string) => string | undefined;\n}): CanonicalPathTracker => {\n const { filePath, getExportName } = options;\n\n // Scope stack\n const scopeStack: ScopeFrame[] = [];\n\n // Occurrence counters for disambiguating duplicate names\n const occurrenceCounters = new Map<string, number>();\n\n // Used paths for ensuring uniqueness\n const usedPaths = new Set<string>();\n\n // Export bindings map\n const exportBindings = new Map<string, string>();\n\n const getNextOccurrence = (key: string): number => {\n const current = occurrenceCounters.get(key) ?? 0;\n occurrenceCounters.set(key, current + 1);\n return current;\n };\n\n const ensureUniquePath = (basePath: string): string => {\n let path = basePath;\n let suffix = 0;\n while (usedPaths.has(path)) {\n suffix++;\n path = `${basePath}$${suffix}`;\n }\n usedPaths.add(path);\n return path;\n };\n\n return {\n enterScope({ segment, kind, stableKey }): ScopeHandle {\n const key = stableKey ?? `${kind}:${segment}`;\n const occurrence = getNextOccurrence(key);\n\n const frame: ScopeFrame = {\n nameSegment: segment,\n kind,\n occurrence,\n };\n\n scopeStack.push(frame);\n\n return {\n __brand: \"ScopeHandle\",\n depth: scopeStack.length - 1,\n } as ScopeHandle;\n },\n\n exitScope(handle: ScopeHandle): void {\n // Validate handle depth matches current stack\n if (handle.depth !== scopeStack.length - 1) {\n throw new Error(`[INTERNAL] Invalid scope exit: expected depth ${scopeStack.length - 1}, got ${handle.depth}`);\n }\n scopeStack.pop();\n },\n\n registerDefinition(): {\n astPath: string;\n isTopLevel: boolean;\n exportBinding?: string;\n } {\n const basePath = _buildAstPath(scopeStack);\n const astPath = ensureUniquePath(basePath);\n const isTopLevel = scopeStack.length === 0;\n\n // Check export binding if provided\n let exportBinding: string | undefined;\n if (getExportName && isTopLevel) {\n // For top-level definitions, try to get export name\n // This is a simplified version - real logic depends on how the definition is bound\n exportBinding = undefined;\n }\n\n return {\n astPath,\n isTopLevel,\n exportBinding,\n };\n },\n\n resolveCanonicalId(astPath: string): CanonicalId {\n return createCanonicalId(filePath, astPath);\n },\n\n registerExportBinding(local: string, exported: string): void {\n exportBindings.set(local, exported);\n },\n\n currentDepth(): number {\n return scopeStack.length;\n },\n };\n};\n\n/**\n * Helper to create occurrence tracker (for backward compatibility)\n */\nexport const createOccurrenceTracker = (): {\n getNextOccurrence: (key: string) => number;\n} => {\n const occurrenceCounters = new Map<string, number>();\n\n return {\n getNextOccurrence(key: string): number {\n const current = occurrenceCounters.get(key) ?? 0;\n occurrenceCounters.set(key, current + 1);\n return current;\n },\n };\n};\n\n/**\n * Helper to create path tracker (for backward compatibility)\n */\nexport const createPathTracker = (): {\n ensureUniquePath: (basePath: string) => string;\n} => {\n const usedPaths = new Set<string>();\n\n return {\n ensureUniquePath(basePath: string): string {\n let path = basePath;\n let suffix = 0;\n while (usedPaths.has(path)) {\n suffix++;\n path = `${basePath}$${suffix}`;\n }\n usedPaths.add(path);\n return path;\n },\n };\n};\n\n/**\n * Build AST path from scope stack (for backward compatibility)\n */\nexport const buildAstPath = (stack: readonly ScopeFrame[]): string => {\n return stack.map((frame) => frame.nameSegment).join(\".\");\n};\n"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,SAAS,GAAG;AAC1C,UAAM,IAAI,MAAM,iDAAiD,WAAW,SAAS,EAAE,QAAQ,OAAO,QAAQ;;AAEhH,cAAW,KAAK;;EAGlB,qBAIE;GACA,MAAM,WAAW,cAAc,WAAW;GAC1C,MAAM,UAAU,iBAAiB,SAAS;GAC1C,MAAM,aAAa,WAAW,WAAW;GAGzC,IAAIC;AACJ,OAAI,iBAAiB,YAAY;AAG/B,oBAAgB;;AAGlB,UAAO;IACL;IACA;IACA;IACD;;EAGH,mBAAmB,SAA8B;AAC/C,UAAO,kBAAkB,UAAU,QAAQ;;EAG7C,sBAAsB,OAAe,UAAwB;AAC3D,kBAAe,IAAI,OAAO,SAAS;;EAGrC,eAAuB;AACrB,UAAO,WAAW;;EAErB;;;;;AAMH,MAAa,gCAER;CACH,MAAM,qBAAqB,IAAI,KAAqB;AAEpD,QAAO,EACL,kBAAkB,KAAqB;EACrC,MAAM,UAAU,mBAAmB,IAAI,IAAI,IAAI;AAC/C,qBAAmB,IAAI,KAAK,UAAU,EAAE;AACxC,SAAO;IAEV;;;;;AAMH,MAAa,0BAER;CACH,MAAM,YAAY,IAAI,KAAa;AAEnC,QAAO,EACL,iBAAiB,UAA0B;EACzC,IAAI,OAAO;EACX,IAAI,SAAS;AACb,SAAO,UAAU,IAAI,KAAK,EAAE;AAC1B;AACA,UAAO,GAAG,SAAS,GAAG;;AAExB,YAAU,IAAI,KAAK;AACnB,SAAO;IAEV;;;;;AAMH,MAAa,gBAAgB,UAAyC;AACpE,QAAO,MAAM,KAAK,UAAU,MAAM,YAAY,CAAC,KAAK,IAAI"}
@@ -1,30 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
-
25
- Object.defineProperty(exports, '__toESM', {
26
- enumerable: true,
27
- get: function () {
28
- return __toESM;
29
- }
30
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-B_QJzQA2.d.cts","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":[],"mappings":";;;KAGY,qBAAqB,CAAA,CAAE,QAAQ;KAE/B,2CAFA,MAEiD,OAFxC,KAEoD,SAFpD,CAE8D,OAF9D,CAEsE,CAFtE,CAAA,CAAA,EAAA;AAAsB,iBAI3B,eAJ2B,CAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,EAAA,CAAA,eAKlB,QALkB,CAKT,OALS,CAKD,OALC,CAAA,CAAA,CAAA,CAAA,KAAA,EAKiB,MALjB,GAAA,QAKkC,OALlC,CAAA,MAKgD,MALhD,EAAA,MAK8D,OAL9D,CAAA,GAAA,KAAA,EAAA,EAAA,GAKgF,CAAA,CAAA,SALhF,CAKgF,MALhF,GAAA,QAK8B,OAL9B,CAAA,MAK8B,MAL9B,EAAA,MAK8B,OAL9B,CAAA,GAAA,KAAA,EAAA,SAAA,KAAA,EAAA,GAAA,kBAAA,MAK8B,CAL9B,GAK8B,CAL9B,CAK8B,CAL9B,CAAA,EAAA,GAAA,KAAA,EAK8B,CAAA,CAAA,IAAA,CAAA,OAL9B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-C0n5gWc3.d.cts","names":[],"sources":["../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/runtime.ts","../src/portable/spawn.ts"],"sourcesContent":[],"mappings":";;AAMA;;AAC0B,UADT,UAAA,CACS;UACkB,CAAA,IAAA,EAAA,MAAA,CAAA,EADlB,OACkB,CAAA,MAAA,CAAA;WACpB,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EADoB,OACpB,CAAA,IAAA,CAAA;QACe,CAAA,IAAA,EAAA,MAAA,CAAA,EADf,OACe,CAAA,OAAA,CAAA;MAAjB,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA,CAAA;IACsB,KAAA,EADL,IACK;IACc,IAAA,EAAA,MAAA;EAAO,CAAA,CAAA;EAsBjD,MAAA,CAAA,OAAA,EAAA,MAAgB,EAAA,OAAI,EAAA,MAAA,CAAA,EAvBQ,OAuBE,CAAA,IAAA,CAAA;EA4F9B,KAAA,CAAA,IAAA,EAAA,MAAa,EAAA,QAAI,EAAA;IAWjB,SAAA,CAAA,EAAA,OAAA;MA7H0C;;iBAsB1C,gBAAA,CAAA,GAAoB;AC5BxB,iBDwHI,aAAA,CAAA,CCxHS,EDwHQ,UCxHR;AAEzB;AAWA;AAqCA;AAWA;iBDsEgB,yBAAA,CAAA;;;;AAnIhB;;AAC0B,KCDd,aAAA,GDCc,QAAA,GAAA,QAAA;AACkB,UCA3B,cAAA,CDA2B;MACpB,CAAA,OAAA,EAAA,MAAA,EAAA,SAAA,CAAA,ECAY,aDAZ,CAAA,EAAA,MAAA;;AACF,iBCSN,oBAAA,CAAA,CDTM,ECSkB,cDTlB;AACsB,iBC6C5B,iBAAA,CAAA,CD7C4B,EC6CP,cD7CO;;;AAuB5C;AA4FA;AAWgB,iBCtEA,6BAAA,CAAA,CDsEyB,EAAA,IAAA;;;;AAnIzC;;;;;;AAIsB,iBEAN,UAAA,CAAA,CFAM,EAAA,MAAA;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;;;;;;;;;;;uCAiBmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiD1B;;;MAGT;;;;cAoGS;;;;;;cAiBA;;;;;;cAsBA,+BAAgC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CcSB32XQ.d.ts","names":[],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":[],"mappings":";cAAa,wBAAyB;EAAzB,EAAA,GAAA;EASZ,KAAA,EAAA,EAAA,IAAA;;;;;AATD;;;cCOa;;;;;AAAA,cAMA,aANqG,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAMlH;AAUA;;;;;AAyCA;;AAAuD,cAzC1C,uCAyC0C,EAAA,CAAA;EAAA,QAAA;EAAA;CAAA,EAAA;UAAA,EAAA,MAAA;WAAA,EAAA,MAAA;YAO7B,GAAA,IAAA;;;;AA+B1B;AAKA;;;;cA3Ca;;;;;;;cAOC,YAAY,KAAK;;;;;cA+BlB;;;;cAKA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-D6Lx478n.d.ts","names":[],"sources":["../src/canonical-id/canonical-id.ts","../src/canonical-id/path-tracker.ts"],"sourcesContent":[],"mappings":";;;KAIY,WAAA;;AAAZ,CAAA;AAIa,cAAA,iBAA2F,EAAxE,GAAA,CAAE,OAAsE,CAA9D,WAA8D,CAAA;AAAA,cAG3F,iBAH2F,EAAA,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,GAGlC,WAHkC;;;;ACiCxG;;;AAM0F,KA1B9E,UAAA,GA0B8E;;WAuBnD,WAAA,EAAA,MAAA;EAAW;EAiDrC,SAAA,IAAA,EAAA,UAkGZ,GAAA,OAAA,GA/FG,UAAA,GAAA,UA+FH,GAAA,QAAA,GAAA,YAAA;EAKY;EAiBA,SAAA,UAAA,EAiBZ,MAAA;AAKD,CAAA;;;;KApOY,WAAA;;;;;;;UAQK,oBAAA;;;;;;;;UAM8B;;MAA2C;;;;;oBAMtE;;;;;;;;;;;;;;;uCAiBmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiD1B;;;MAGT;;;;cAoGS;;;;;;cAiBA;;;;;;cAsBA,+BAAgC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DN4VW1v7.d.ts","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":[],"mappings":";;;KAGY,qBAAqB,CAAA,CAAE,QAAQ;KAE/B,2CAFA,MAEiD,OAFxC,KAEoD,SAFpD,CAE8D,OAF9D,CAEsE,CAFtE,CAAA,CAAA,EAAA;AAAsB,iBAI3B,eAJ2B,CAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,EAAA,CAAA,eAKlB,QALkB,CAKT,OALS,CAKD,OALC,CAAA,CAAA,CAAA,CAAA,KAAA,EAKiB,MALjB,GAAA,QAKkC,OALlC,CAAA,MAKgD,MALhD,EAAA,MAK8D,OAL9D,CAAA,GAAA,KAAA,EAAA,EAAA,GAKgF,CAAA,CAAA,SALhF,CAKgF,MALhF,GAAA,QAK8B,OAL9B,CAAA,MAK8B,MAL9B,EAAA,MAK8B,OAL9B,CAAA,GAAA,KAAA,EAAA,SAAA,KAAA,EAAA,GAAA,kBAAA,MAK8B,CAL9B,GAK8B,CAL9B,CAK8B,CAL9B,CAAA,EAAA,GAAA,KAAA,EAK8B,CAAA,CAAA,IAAA,CAAA,OAL9B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Fi3RpHje.d.cts","names":[],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":[],"mappings":";cAAa,wBAAyB;EAAzB,EAAA,GAAA;EASZ,KAAA,EAAA,EAAA,IAAA;;;;;AATD;;;cCOa;;;;;AAAA,cAMA,aANqG,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAMlH;AAUA;;;;;AAyCA;;AAAuD,cAzC1C,uCAyC0C,EAAA,CAAA;EAAA,QAAA;EAAA;CAAA,EAAA;UAAA,EAAA,MAAA;WAAA,EAAA,MAAA;YAO7B,GAAA,IAAA;;;;AA+B1B;AAKA;;;;cA3Ca;;;;;;;cAOC,YAAY,KAAK;;;;;cA+BlB;;;;cAKA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-LjtXZhxM.d.ts","names":[],"sources":["../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/runtime.ts","../src/portable/spawn.ts"],"sourcesContent":[],"mappings":";;AAMA;;AAC0B,UADT,UAAA,CACS;UACkB,CAAA,IAAA,EAAA,MAAA,CAAA,EADlB,OACkB,CAAA,MAAA,CAAA;WACpB,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EADoB,OACpB,CAAA,IAAA,CAAA;QACe,CAAA,IAAA,EAAA,MAAA,CAAA,EADf,OACe,CAAA,OAAA,CAAA;MAAjB,CAAA,IAAA,EAAA,MAAA,CAAA,EAAA,OAAA,CAAA;IACsB,KAAA,EADL,IACK;IACc,IAAA,EAAA,MAAA;EAAO,CAAA,CAAA;EAsBjD,MAAA,CAAA,OAAA,EAAA,MAAgB,EAAA,OAAI,EAAA,MAAA,CAAA,EAvBQ,OAuBE,CAAA,IAAA,CAAA;EA4F9B,KAAA,CAAA,IAAA,EAAA,MAAa,EAAA,QAAI,EAAA;IAWjB,SAAA,CAAA,EAAA,OAAA;MA7H0C;;iBAsB1C,gBAAA,CAAA,GAAoB;AC5BxB,iBDwHI,aAAA,CAAA,CCxHS,EDwHQ,UCxHR;AAEzB;AAWA;AAqCA;AAWA;iBDsEgB,yBAAA,CAAA;;;;AAnIhB;;AAC0B,KCDd,aAAA,GDCc,QAAA,GAAA,QAAA;AACkB,UCA3B,cAAA,CDA2B;MACpB,CAAA,OAAA,EAAA,MAAA,EAAA,SAAA,CAAA,ECAY,aDAZ,CAAA,EAAA,MAAA;;AACF,iBCSN,oBAAA,CAAA,CDTM,ECSkB,cDTlB;AACsB,iBC6C5B,iBAAA,CAAA,CD7C4B,EC6CP,cD7CO;;;AAuB5C;AA4FA;AAWgB,iBCtEA,6BAAA,CAAA,CDsEyB,EAAA,IAAA;;;;AAnIzC;;;;;;AAIsB,iBEAN,UAAA,CAAA,CFAM,EAAA,MAAA;;;;AAJtB;;AAC0B,cGHb,OHGa,EAAA;WACkB,KAAA,EAAA,OAAA;WACpB,MAAA,EAAA,OAAA;WACe,iBAAA,EAAA,OAAA;;;;;AAwBvB,iBGrBA,IHqBgB,CAAA,CAAA,CAAA,CAAA,EAAI,EAAA,GAAA,GGrBF,CHqBE,CAAA,EAAU,GAAA,GGrBF,CHqBE;AA4F9C;AAWA;;;iBG3GgB,qBAAA,CAAA;;;;AHxBhB;;AAC0B,UIDT,YAAA,CJCS;KACkB,EAAA,MAAA,EAAA;KACpB,CAAA,EAAA,MAAA;KACe,CAAA,EID/B,MJC+B,CAAA,MAAA,EAAA,MAAA,CAAA;;AACK,UIC3B,WAAA,CJD2B;QACc,EAAA,MAAA;EAAO,MAAA,EAAA,MAAA;EAsBjD,QAAA,EAAA,MAAA;AA4FhB;AAWgB,iBIvHM,KAAA,CJuHN,OAAyB,EIvHJ,YJuHI,CAAA,EIvHW,OJuHX,CIvHmB,WJuHnB,CAAA"}
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, ScopeFrame, ScopeHandle, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "./index-D6Lx478n.js";
2
- import { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "./index-LjtXZhxM.js";
3
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "./index-CcSB32XQ.js";
4
- import { SchemaFor, ShapeFor, defineSchemaFor } from "./index-DN4VW1v7.js";
5
- export { CanonicalId, CanonicalIdSchema, CanonicalPathTracker, HashAlgorithm, MODULE_EXTENSION_CANDIDATES, PortableFS, PortableHasher, SchemaFor, ScopeFrame, ScopeHandle, ShapeFor, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, buildAstPath, cachedFn, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker, createPortableFS, createPortableHasher, defineSchemaFor, generateId, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, once, resetPortableForTests, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, runtime, spawn };
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- import { __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "./portable-BqSEwase.js";
2
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "./utils-DxBnV8tL.js";
3
- import { CanonicalIdSchema, buildAstPath, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker } from "./canonical-id-Bn6ZPdZl.js";
4
- import { defineSchemaFor } from "./zod-BPbnZc6i.js";
5
-
6
- export { CanonicalIdSchema, MODULE_EXTENSION_CANDIDATES, __resetPortableFSForTests, __resetPortableHasherForTests, buildAstPath, cachedFn, createCanonicalId, createCanonicalTracker, createOccurrenceTracker, createPathTracker, createPortableFS, createPortableHasher, defineSchemaFor, generateId, getPortableFS, getPortableHasher, isExternalSpecifier, isRelativeSpecifier, normalizePath, once, resetPortableForTests, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences, runtime, spawn };
@@ -1,2 +0,0 @@
1
- import { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "../index-LjtXZhxM.js";
2
- export { HashAlgorithm, PortableFS, PortableHasher, SpawnOptions, SpawnResult, __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
@@ -1,3 +0,0 @@
1
- import { __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn } from "../portable-BqSEwase.js";
2
-
3
- export { __resetPortableFSForTests, __resetPortableHasherForTests, createPortableFS, createPortableHasher, generateId, getPortableFS, getPortableHasher, once, resetPortableForTests, runtime, spawn };
@@ -1 +0,0 @@
1
- {"version":3,"file":"portable-BqSEwase.js","names":["result: T | undefined","fsInstance: PortableFS | null","crypto","hasherInstance: PortableHasher | null","crypto","execOptions: {\n cwd?: string;\n env?: Record<string, string>;\n encoding: BufferEncoding;\n }","error: unknown"],"sources":["../src/portable/runtime.ts","../src/portable/fs.ts","../src/portable/hash.ts","../src/portable/id.ts","../src/portable/spawn.ts"],"sourcesContent":["/**\n * Runtime detection utilities for portable API implementation\n */\n\nexport const runtime = {\n isBun: typeof Bun !== \"undefined\",\n isNode: typeof process !== \"undefined\" && typeof Bun === \"undefined\",\n supportsWebCrypto: typeof crypto !== \"undefined\" && typeof crypto.subtle !== \"undefined\",\n} as const;\n\n/**\n * Helper to cache module imports to avoid repeated dynamic imports\n */\nexport function once<T>(fn: () => T): () => T {\n let result: T | undefined;\n let called = false;\n\n return () => {\n if (!called) {\n result = fn();\n called = true;\n }\n return result as T;\n };\n}\n\n/**\n * Reset runtime state for testing purposes only\n * @internal\n */\nexport function resetPortableForTests(): void {\n // This is a marker function that portable modules can use\n // to reset their singleton state in tests\n}\n","/**\n * Portable filesystem API that works on both Bun and Node.js\n */\n\nimport { once, runtime } from \"./runtime\";\n\nexport interface PortableFS {\n readFile(path: string): Promise<string>;\n writeFile(path: string, content: string): Promise<void>;\n exists(path: string): Promise<boolean>;\n stat(path: string): Promise<{ mtime: Date; size: number }>;\n rename(oldPath: string, newPath: string): Promise<void>;\n mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;\n}\n\ninterface FSPromises {\n readFile: (path: string, encoding: string) => Promise<string>;\n writeFile: (path: string, content: string, encoding: string) => Promise<void>;\n access: (path: string) => Promise<void>;\n stat: (path: string) => Promise<{\n mtime: Date;\n size: number;\n isDirectory: () => boolean;\n }>;\n rename: (oldPath: string, newPath: string) => Promise<void>;\n mkdir: (path: string, options?: { recursive?: boolean }) => Promise<void>;\n}\n\n// Cache the fs/promises import\nconst getNodeFS = once(async (): Promise<FSPromises> => {\n const fs = await import(\"node:fs/promises\");\n return fs as FSPromises;\n});\n\nexport function createPortableFS(): PortableFS {\n if (runtime.isBun) {\n return {\n async readFile(path) {\n const file = Bun.file(path);\n return await file.text();\n },\n\n async writeFile(path, content) {\n // Bun.write auto-creates parent directories\n await Bun.write(path, content);\n },\n\n async exists(path) {\n // Bun.file().exists() only works for files, use fs.stat for both files and dirs\n const nodeFS = await getNodeFS();\n try {\n await nodeFS.stat(path);\n return true;\n } catch {\n return false;\n }\n },\n\n async stat(path) {\n const file = Bun.file(path);\n const size = file.size;\n // Bun doesn't expose mtime directly, use Node fs.stat\n const nodeFS = await getNodeFS();\n const { mtime } = await nodeFS.stat(path);\n return { mtime, size };\n },\n\n async rename(oldPath, newPath) {\n const nodeFS = await getNodeFS();\n await nodeFS.rename(oldPath, newPath);\n },\n\n async mkdir(path, options) {\n const nodeFS = await getNodeFS();\n await nodeFS.mkdir(path, options);\n },\n };\n }\n\n // Node.js implementation\n return {\n async readFile(path) {\n const nodeFS = await getNodeFS();\n return await nodeFS.readFile(path, \"utf-8\");\n },\n\n async writeFile(path, content) {\n const nodeFS = await getNodeFS();\n // Auto-create parent directories like Bun.write does\n const pathModule = await import(\"node:path\");\n const dir = pathModule.dirname(path);\n await nodeFS.mkdir(dir, { recursive: true });\n await nodeFS.writeFile(path, content, \"utf-8\");\n },\n\n async exists(path) {\n const nodeFS = await getNodeFS();\n try {\n await nodeFS.access(path);\n return true;\n } catch {\n return false;\n }\n },\n\n async stat(path) {\n const nodeFS = await getNodeFS();\n const stats = await nodeFS.stat(path);\n return { mtime: stats.mtime, size: stats.size };\n },\n\n async rename(oldPath, newPath) {\n const nodeFS = await getNodeFS();\n await nodeFS.rename(oldPath, newPath);\n },\n\n async mkdir(path, options) {\n const nodeFS = await getNodeFS();\n await nodeFS.mkdir(path, options);\n },\n };\n}\n\n// Singleton to avoid recreating instances\nlet fsInstance: PortableFS | null = null;\n\nexport function getPortableFS(): PortableFS {\n if (!fsInstance) {\n fsInstance = createPortableFS();\n }\n return fsInstance;\n}\n\n/**\n * Reset the filesystem singleton for testing\n * @internal\n */\nexport function __resetPortableFSForTests(): void {\n fsInstance = null;\n}\n","/**\n * Portable hashing API that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\nexport type HashAlgorithm = \"sha256\" | \"xxhash\";\n\nexport interface PortableHasher {\n hash(content: string, algorithm?: HashAlgorithm): string;\n}\n\n/**\n * Pads a hex string to the specified length\n */\nfunction padHex(hex: string, length: number): string {\n return hex.padStart(length, \"0\");\n}\n\nexport function createPortableHasher(): PortableHasher {\n if (runtime.isBun) {\n return {\n hash(content, algorithm = \"xxhash\") {\n if (algorithm === \"sha256\") {\n const hasher = new Bun.CryptoHasher(\"sha256\");\n hasher.update(content);\n return hasher.digest(\"hex\");\n }\n // xxhash - Bun.hash returns a number\n const hashNum = Bun.hash(content);\n // Convert to hex and pad to 16 chars for consistency\n return padHex(hashNum.toString(16), 16);\n },\n };\n }\n\n // Node.js implementation\n return {\n hash(content, algorithm = \"xxhash\") {\n if (algorithm === \"sha256\") {\n const crypto = require(\"node:crypto\");\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n }\n // xxhash fallback: use sha256 for now (can add xxhash package later if needed)\n // This ensures consistent behavior across runtimes\n const crypto = require(\"node:crypto\");\n const sha256Hash = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n // Take first 16 chars to match xxhash output length\n return sha256Hash.substring(0, 16);\n },\n };\n}\n\n// Singleton to avoid recreating instances\nlet hasherInstance: PortableHasher | null = null;\n\nexport function getPortableHasher(): PortableHasher {\n if (!hasherInstance) {\n hasherInstance = createPortableHasher();\n }\n return hasherInstance;\n}\n\n/**\n * Reset the hasher singleton for testing\n * @internal\n */\nexport function __resetPortableHasherForTests(): void {\n hasherInstance = null;\n}\n","/**\n * Portable ID generation that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\n/**\n * Generate a unique ID\n * Uses UUIDv7 on Bun (monotonic), falls back to randomUUID on Node.js\n */\nexport function generateId(): string {\n if (runtime.isBun && typeof Bun !== \"undefined\" && typeof Bun.randomUUIDv7 === \"function\") {\n return Bun.randomUUIDv7();\n }\n\n // Node.js fallback: use crypto.randomUUID\n const crypto = require(\"node:crypto\");\n return crypto.randomUUID();\n}\n","/**\n * Portable subprocess spawning that works on both Bun and Node.js\n */\n\nimport { runtime } from \"./runtime\";\n\nexport interface SpawnOptions {\n cmd: string[];\n cwd?: string;\n env?: Record<string, string>;\n}\n\nexport interface SpawnResult {\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nexport async function spawn(options: SpawnOptions): Promise<SpawnResult> {\n if (runtime.isBun) {\n const proc = Bun.spawn(options.cmd, {\n cwd: options.cwd,\n env: options.env,\n stdout: \"pipe\",\n stderr: \"pipe\",\n });\n\n const [stdout, stderr] = await Promise.all([new Response(proc.stdout).text(), new Response(proc.stderr).text()]);\n\n const exitCode = await proc.exited;\n\n return { stdout, stderr, exitCode };\n }\n\n // Node.js implementation\n const { execFile } = await import(\"node:child_process\");\n const { promisify } = await import(\"node:util\");\n const execFilePromise = promisify(execFile);\n\n const [command, ...args] = options.cmd;\n if (!command) {\n return {\n stdout: \"\",\n stderr: \"Error: No command provided\",\n exitCode: 1,\n };\n }\n\n try {\n const execOptions: {\n cwd?: string;\n env?: Record<string, string>;\n encoding: BufferEncoding;\n } = {\n encoding: \"utf-8\",\n };\n\n if (options.cwd) {\n execOptions.cwd = options.cwd;\n }\n if (options.env) {\n execOptions.env = options.env;\n }\n\n const { stdout, stderr } = await execFilePromise(command, args, execOptions);\n return {\n stdout: stdout || \"\",\n stderr: stderr || \"\",\n exitCode: 0,\n };\n } catch (error: unknown) {\n const err = error as {\n stdout?: string;\n stderr?: string;\n code?: number;\n };\n return {\n stdout: err.stdout || \"\",\n stderr: err.stderr || \"\",\n exitCode: err.code || 1,\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,UAAU;CACrB,OAAO,OAAO,QAAQ;CACtB,QAAQ,OAAO,YAAY,eAAe,OAAO,QAAQ;CACzD,mBAAmB,OAAO,WAAW,eAAe,OAAO,OAAO,WAAW;CAC9E;;;;AAKD,SAAgB,KAAQ,IAAsB;CAC5C,IAAIA;CACJ,IAAI,SAAS;AAEb,cAAa;AACX,MAAI,CAAC,QAAQ;AACX,YAAS,IAAI;AACb,YAAS;;AAEX,SAAO;;;;;;;AAQX,SAAgB,wBAA8B;;;;ACD9C,MAAM,YAAY,KAAK,YAAiC;CACtD,MAAM,KAAK,MAAM,OAAO;AACxB,QAAO;EACP;AAEF,SAAgB,mBAA+B;AAC7C,KAAI,QAAQ,OAAO;AACjB,SAAO;GACL,MAAM,SAAS,MAAM;IACnB,MAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,WAAO,MAAM,KAAK,MAAM;;GAG1B,MAAM,UAAU,MAAM,SAAS;AAE7B,UAAM,IAAI,MAAM,MAAM,QAAQ;;GAGhC,MAAM,OAAO,MAAM;IAEjB,MAAM,SAAS,MAAM,WAAW;AAChC,QAAI;AACF,WAAM,OAAO,KAAK,KAAK;AACvB,YAAO;YACD;AACN,YAAO;;;GAIX,MAAM,KAAK,MAAM;IACf,MAAM,OAA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,KAAK;GAClC,KAAK,QAAQ;GACb,KAAK,QAAQ;GACb,QAAQ;GACR,QAAQ;GACT,CAAC;EAEF,MAAM,CAAC,QAAQ,UAAU,MAAM,QAAQ,IAAI,CAAC,IAAI,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,IAAI,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;EAEhH,MAAM,WAAW,MAAM,KAAK;AAE5B,SAAO;GAAE;GAAQ;GAAQ;GAAU;;CAIrC,MAAM,EAAE,aAAa,MAAM,OAAO;CAClC,MAAM,EAAE,cAAc,MAAM,OAAO;CACnC,MAAM,kBAAkB,UAAU,SAAS;CAE3C,MAAM,CAAC,SAAS,GAAG,QAAQ,QAAQ;AACnC,KAAI,CAAC,SAAS;AACZ,SAAO;GACL,QAAQ;GACR,QAAQ;GACR,UAAU;GACX;;AAGH,KAAI;EACF,MAAMC,cAIF,EACF,UAAU,SACX;AAED,MAAI,QAAQ,KAAK;AACf,eAAY,MAAM,QAAQ;;AAE5B,MAAI,QAAQ,KAAK;AACf,eAAY,MAAM,QAAQ;;EAG5B,MAAM,EAAE,QAAQ,WAAW,MAAM,gBAAgB,SAAS,MAAM,YAAY;AAC5E,SAAO;GACL,QAAQ,UAAU;GAClB,QAAQ,UAAU;GAClB,UAAU;GACX;UACMC,OAAgB;EACvB,MAAM,MAAM;AAKZ,SAAO;GACL,QAAQ,IAAI,UAAU;GACtB,QAAQ,IAAI,UAAU;GACtB,UAAU,IAAI,QAAQ;GACvB"}
@@ -1,2 +0,0 @@
1
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "../index-CcSB32XQ.js";
2
- export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
@@ -1,3 +0,0 @@
1
- import { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences } from "../utils-DxBnV8tL.js";
2
-
3
- export { MODULE_EXTENSION_CANDIDATES, cachedFn, isExternalSpecifier, isRelativeSpecifier, normalizePath, resolveRelativeImportWithExistenceCheck, resolveRelativeImportWithReferences };
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-DxBnV8tL.js","names":["cached: { value: T } | null"],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":["export const cachedFn = <T>(fn: () => T) => {\n let cached: { value: T } | null = null;\n\n const ensure = () => (cached ??= { value: fn() }).value;\n ensure.clear = () => {\n cached = null;\n };\n\n return ensure;\n};\n","import { existsSync } from \"node:fs\";\nimport { dirname, join, normalize, resolve } from \"node:path\";\n\n/**\n * File extensions to try when resolving module specifiers.\n * Ordered by precedence: TypeScript, then JavaScript.\n */\nexport const MODULE_EXTENSION_CANDIDATES = [\".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".jsx\", \".mjs\", \".cjs\"] as const;\n\n/**\n * Normalize path to use forward slashes (cross-platform).\n * Ensures consistent path handling across platforms.\n */\nexport const normalizePath = (value: string): string => normalize(value).replace(/\\\\/g, \"/\");\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithExistenceCheck = ({\n filePath,\n specifier,\n}: {\n filePath: string;\n specifier: string;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try exact path first\n if (existsSync(base)) {\n return normalizePath(base);\n }\n\n // Try with extensions\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n return null;\n};\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithReferences = <_>({\n filePath,\n specifier,\n references,\n}: {\n filePath: string;\n specifier: string;\n references: Map<string, _> | Set<string>;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try exact path first\n if (references.has(base)) {\n return normalizePath(base);\n }\n\n // Try with extensions\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n return null;\n};\n\n/**\n * Check if a module specifier is relative (starts with '.' or '..')\n */\nexport const isRelativeSpecifier = (specifier: string): boolean => specifier.startsWith(\"./\") || specifier.startsWith(\"../\");\n\n/**\n * Check if a module specifier is external (package name, not relative)\n */\nexport const isExternalSpecifier = (specifier: string): boolean => !isRelativeSpecifier(specifier);\n"],"mappings":";;;;AAAA,MAAa,YAAe,OAAgB;CAC1C,IAAIA,SAA8B;CAElC,MAAM,gBAAgB,WAAW,EAAE,OAAO,IAAI,EAAE,EAAE;AAClD,QAAO,cAAc;AACnB,WAAS;;AAGX,QAAO;;;;;;;;;ACDT,MAAa,8BAA8B;CAAC;CAAO;CAAQ;CAAQ;CAAQ;CAAO;CAAQ;CAAQ;CAAO;;;;;AAMzG,MAAa,iBAAiB,UAA0B,UAAU,MAAM,CAAC,QAAQ,OAAO,IAAI;;;;;;;;;AAU5F,MAAa,2CAA2C,EACtD,UACA,gBAImB;CACnB,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE,UAAU;AAGlD,KAAI,WAAW,KAAK,EAAE;AACpB,SAAO,cAAc,KAAK;;AAI5B,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,GAAG,OAAO;AAC5B,MAAI,WAAW,UAAU,EAAE;AACzB,UAAO,cAAc,UAAU;;;AAKnC,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,KAAK,MAAM,QAAQ,MAAM;AAC3C,MAAI,WAAW,UAAU,EAAE;AACzB,UAAO,cAAc,UAAU;;;AAInC,QAAO;;;;;;;;;;AAWT,MAAa,uCAA0C,EACrD,UACA,WACA,iBAKmB;CACnB,MAAM,OAAO,QAAQ,QAAQ,SAAS,EAAE,UAAU;AAGlD,KAAI,WAAW,IAAI,KAAK,EAAE;AACxB,SAAO,cAAc,KAAK;;AAI5B,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,GAAG,OAAO;AAC5B,MAAI,WAAW,IAAI,UAAU,EAAE;AAC7B,UAAO,cAAc,UAAU;;;AAKnC,MAAK,MAAM,OAAO,6BAA6B;EAC7C,MAAM,YAAY,KAAK,MAAM,QAAQ,MAAM;AAC3C,MAAI,WAAW,IAAI,UAAU,EAAE;AAC7B,UAAO,cAAc,UAAU;;;AAInC,QAAO;;;;;AAMT,MAAa,uBAAuB,cAA+B,UAAU,WAAW,KAAK,IAAI,UAAU,WAAW,MAAM;;;;AAK5H,MAAa,uBAAuB,cAA+B,CAAC,oBAAoB,UAAU"}
@@ -1,2 +0,0 @@
1
- import { SchemaFor, ShapeFor, defineSchemaFor } from "../index-DN4VW1v7.js";
2
- export { SchemaFor, ShapeFor, defineSchemaFor };
package/dist/zod/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { defineSchemaFor } from "../zod-BPbnZc6i.js";
2
-
3
- export { defineSchemaFor };
@@ -1 +0,0 @@
1
- {"version":3,"file":"zod-BPbnZc6i.js","names":[],"sources":["../src/zod/schema-helper.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// biome-ignore lint/suspicious/noExplicitAny: abstract type\nexport type SchemaFor<TOutput> = z.ZodType<TOutput, any, any>;\n\nexport type ShapeFor<TOutput extends object> = { [K in keyof TOutput]-?: SchemaFor<TOutput[K]> };\n\nexport function defineSchemaFor<TOutput extends object>() {\n return <TShape extends ShapeFor<NoInfer<TOutput>>>(shape: TShape & { [K in Exclude<keyof TShape, keyof TOutput>]: never }) =>\n z.object(shape).strict();\n}\n"],"mappings":";;;AAOA,SAAgB,kBAA0C;AACxD,SAAmD,UACjD,EAAE,OAAO,MAAM,CAAC,QAAQ"}