@uapkg/diagnostics 1.3.1 → 1.4.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostic.js","names":[],"sources":["../../src/base/Diagnostic.ts"],"sourcesContent":["import { createDiagnosticFingerprint } from './DiagnosticFingerprint.js';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\n\nexport type DiagnosticEmitPolicy = 'always' | 'once';\n\n/**\n * Base shape for all diagnostics. Every concrete diagnostic must extend this\n * interface, discriminating on `code` so that `data` is always strongly typed.\n *\n * @typeParam C - The string literal diagnostic code.\n * @typeParam D - The shape of the typed data payload (defaults to `undefined`).\n */\nexport interface DiagnosticBase<C extends string = string, D = undefined> {\n /** Severity of this diagnostic. */\n readonly level: DiagnosticLevel;\n\n /** Stable, machine-readable code used for discrimination. */\n readonly code: C;\n\n /** Human-readable summary. */\n readonly message: string;\n\n /** Actionable hint shown to the user. */\n readonly hint?: string;\n\n /** Emit strategy for user-facing reporting. */\n readonly emitPolicy?: DiagnosticEmitPolicy;\n\n /** Stable dedupe key used when `emitPolicy` is `once`. */\n readonly emitFingerprint?: string;\n\n /** Strongly typed payload whose shape is determined by `code`. */\n readonly data: D;\n}\n\n// ---------------------------------------------------------------------------\n// Convenience helpers to construct a diagnostic without specifying every field\n// ---------------------------------------------------------------------------\n\n/** Create an error-level diagnostic. */\nexport function createDiagnostic<C extends string, D = undefined>(\n code: C,\n level: DiagnosticLevel,\n message: string,\n data: D,\n hint?: string,\n options?: {\n readonly emitPolicy?: DiagnosticEmitPolicy;\n },\n): DiagnosticBase<C, D> {\n const emitPolicy = options?.emitPolicy;\n const emitFingerprint =\n emitPolicy === 'once'\n ? createDiagnosticFingerprint({\n level,\n code,\n message,\n hint,\n data,\n })\n : undefined;\n\n return {\n level,\n code,\n message,\n data,\n hint,\n emitPolicy,\n emitFingerprint,\n };\n}\n"],"mappings":";;;;AAwCA,SAAgB,iBACd,MACA,OACA,SACA,MACA,MACA,SAGsB;CACtB,MAAM,aAAa,SAAS;CAY5B,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,iBAjBA,eAAe,SACX,4BAA4B;GAC1B;GACA;GACA;GACA;GACA;EACF,CAAC,IACD;CAUN;AACF"}
1
+ {"version":3,"file":"Diagnostic.js","names":[],"sources":["../../src/base/Diagnostic.ts"],"sourcesContent":["import { createDiagnosticFingerprint } from '#diagnostics/base/DiagnosticFingerprint.ts';\nimport type { DiagnosticLevel } from '#diagnostics/base/DiagnosticLevel.ts';\n\nexport type DiagnosticEmitPolicy = 'always' | 'once';\n\n/**\n * Base shape for all diagnostics. Every concrete diagnostic must extend this\n * interface, discriminating on `code` so that `data` is always strongly typed.\n *\n * @typeParam C - The string literal diagnostic code.\n * @typeParam D - The shape of the typed data payload (defaults to `undefined`).\n */\nexport interface DiagnosticBase<C extends string = string, D = undefined> {\n /** Severity of this diagnostic. */\n readonly level: DiagnosticLevel;\n\n /** Stable, machine-readable code used for discrimination. */\n readonly code: C;\n\n /** Human-readable summary. */\n readonly message: string;\n\n /** Actionable hint shown to the user. */\n readonly hint?: string;\n\n /** Emit strategy for user-facing reporting. */\n readonly emitPolicy?: DiagnosticEmitPolicy;\n\n /** Stable dedupe key used when `emitPolicy` is `once`. */\n readonly emitFingerprint?: string;\n\n /** Strongly typed payload whose shape is determined by `code`. */\n readonly data: D;\n}\n\n// ---------------------------------------------------------------------------\n// Convenience helpers to construct a diagnostic without specifying every field\n// ---------------------------------------------------------------------------\n\n/** Create an error-level diagnostic. */\nexport function createDiagnostic<C extends string, D = undefined>(\n code: C,\n level: DiagnosticLevel,\n message: string,\n data: D,\n hint?: string,\n options?: {\n readonly emitPolicy?: DiagnosticEmitPolicy;\n },\n): DiagnosticBase<C, D> {\n const emitPolicy = options?.emitPolicy;\n const emitFingerprint =\n emitPolicy === 'once'\n ? createDiagnosticFingerprint({\n level,\n code,\n message,\n hint,\n data,\n })\n : undefined;\n\n return {\n level,\n code,\n message,\n data,\n hint,\n emitPolicy,\n emitFingerprint,\n };\n}\n"],"mappings":";;;;AAwCA,SAAgB,iBACd,MACA,OACA,SACA,MACA,MACA,SAGsB;CACtB,MAAM,aAAa,SAAS;CAY5B,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,iBAjBA,eAAe,SACX,4BAA4B;GAC1B;GACA;GACA;GACA;GACA;EACF,CAAC,IACD;CAUN;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticBag.js","names":[],"sources":["../../src/base/DiagnosticBag.ts"],"sourcesContent":["import type { Diagnostic } from '../types.js';\nimport { createDiagnostic } from './Diagnostic.js';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\nimport { fail, ok, type Result } from './Result.js';\n\n/**\n * Mutable accumulator for diagnostics produced during an operation.\n *\n * Typical usage:\n * ```ts\n * const bag = new DiagnosticBag();\n * bag.addError('MY_CODE', 'Something broke', undefined, 'Try X');\n * if (bag.hasErrors()) return bag.toFailure();\n * return bag.toResult(value);\n * ```\n */\nexport class DiagnosticBag {\n private readonly items: Diagnostic[] = [];\n\n /** Number of diagnostics collected so far. */\n get length(): number {\n return this.items.length;\n }\n\n /** Add a pre-built diagnostic. */\n add(diagnostic: Diagnostic): this {\n this.items.push(diagnostic);\n return this;\n }\n\n /** Shorthand: add an error-level diagnostic. */\n addError<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'error', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add a warning-level diagnostic. */\n addWarning<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'warning', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add an info-level diagnostic. */\n addInfo<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'info', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Merge another bag's diagnostics into this one. */\n merge(other: DiagnosticBag): this {\n for (const d of other.items) {\n this.items.push(d);\n }\n return this;\n }\n\n /** Merge a readonly diagnostic array into this bag. */\n mergeArray(diagnostics: readonly Diagnostic[]): this {\n for (const d of diagnostics) {\n this.items.push(d);\n }\n return this;\n }\n\n /** True if at least one diagnostic has level `error`. */\n hasErrors(): boolean {\n return this.items.some((d) => d.level === 'error');\n }\n\n /** True if at least one diagnostic has the given level. */\n hasLevel(level: DiagnosticLevel): boolean {\n return this.items.some((d) => d.level === level);\n }\n\n /** Return all collected diagnostics as a readonly array. */\n all(): readonly Diagnostic[] {\n return this.items;\n }\n\n /** Build a successful `Result<T>` carrying accumulated diagnostics. */\n toResult<T>(value: T): Result<T> {\n if (this.hasErrors()) {\n return fail(this.items);\n }\n return ok(value, this.items);\n }\n\n /** Build a failed `Result` from the accumulated diagnostics. */\n toFailure(): Result<never> {\n return fail(this.items);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,gBAAb,MAA2B;CACzB,AAAiB,QAAsB,CAAC;;CAGxC,IAAI,SAAiB;EACnB,OAAO,KAAK,MAAM;CACpB;;CAGA,IAAI,YAA8B;EAChC,KAAK,MAAM,KAAK,UAAU;EAC1B,OAAO;CACT;;CAGA,SAA0C,MAAS,SAAiB,MAAS,MAAqB;EAChG,KAAK,MAAM,KAAK,iBAAiB,MAAM,SAAS,SAAS,MAAM,IAAI,CAAe;EAClF,OAAO;CACT;;CAGA,WAA4C,MAAS,SAAiB,MAAS,MAAqB;EAClG,KAAK,MAAM,KAAK,iBAAiB,MAAM,WAAW,SAAS,MAAM,IAAI,CAAe;EACpF,OAAO;CACT;;CAGA,QAAyC,MAAS,SAAiB,MAAS,MAAqB;EAC/F,KAAK,MAAM,KAAK,iBAAiB,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAe;EACjF,OAAO;CACT;;CAGA,MAAM,OAA4B;EAChC,KAAK,MAAM,KAAK,MAAM,OACpB,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,WAAW,aAA0C;EACnD,KAAK,MAAM,KAAK,aACd,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,YAAqB;EACnB,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,OAAO;CACnD;;CAGA,SAAS,OAAiC;EACxC,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,KAAK;CACjD;;CAGA,MAA6B;EAC3B,OAAO,KAAK;CACd;;CAGA,SAAY,OAAqB;EAC/B,IAAI,KAAK,UAAU,GACjB,OAAO,KAAK,KAAK,KAAK;EAExB,OAAO,GAAG,OAAO,KAAK,KAAK;CAC7B;;CAGA,YAA2B;EACzB,OAAO,KAAK,KAAK,KAAK;CACxB;AACF"}
1
+ {"version":3,"file":"DiagnosticBag.js","names":[],"sources":["../../src/base/DiagnosticBag.ts"],"sourcesContent":["import type { Diagnostic } from '#diagnostics/types.ts';\nimport { createDiagnostic } from '#diagnostics/base/Diagnostic.ts';\nimport type { DiagnosticLevel } from '#diagnostics/base/DiagnosticLevel.ts';\nimport { fail, ok, type Result } from '#diagnostics/base/Result.ts';\n\n/**\n * Mutable accumulator for diagnostics produced during an operation.\n *\n * Typical usage:\n * ```ts\n * const bag = new DiagnosticBag();\n * bag.addError('MY_CODE', 'Something broke', undefined, 'Try X');\n * if (bag.hasErrors()) return bag.toFailure();\n * return bag.toResult(value);\n * ```\n */\nexport class DiagnosticBag {\n private readonly items: Diagnostic[] = [];\n\n /** Number of diagnostics collected so far. */\n get length(): number {\n return this.items.length;\n }\n\n /** Add a pre-built diagnostic. */\n add(diagnostic: Diagnostic): this {\n this.items.push(diagnostic);\n return this;\n }\n\n /** Shorthand: add an error-level diagnostic. */\n addError<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'error', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add a warning-level diagnostic. */\n addWarning<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'warning', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add an info-level diagnostic. */\n addInfo<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'info', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Merge another bag's diagnostics into this one. */\n merge(other: DiagnosticBag): this {\n for (const d of other.items) {\n this.items.push(d);\n }\n return this;\n }\n\n /** Merge a readonly diagnostic array into this bag. */\n mergeArray(diagnostics: readonly Diagnostic[]): this {\n for (const d of diagnostics) {\n this.items.push(d);\n }\n return this;\n }\n\n /** True if at least one diagnostic has level `error`. */\n hasErrors(): boolean {\n return this.items.some((d) => d.level === 'error');\n }\n\n /** True if at least one diagnostic has the given level. */\n hasLevel(level: DiagnosticLevel): boolean {\n return this.items.some((d) => d.level === level);\n }\n\n /** Return all collected diagnostics as a readonly array. */\n all(): readonly Diagnostic[] {\n return this.items;\n }\n\n /** Build a successful `Result<T>` carrying accumulated diagnostics. */\n toResult<T>(value: T): Result<T> {\n if (this.hasErrors()) {\n return fail(this.items);\n }\n return ok(value, this.items);\n }\n\n /** Build a failed `Result` from the accumulated diagnostics. */\n toFailure(): Result<never> {\n return fail(this.items);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,gBAAb,MAA2B;CACzB,AAAiB,QAAsB,CAAC;;CAGxC,IAAI,SAAiB;EACnB,OAAO,KAAK,MAAM;CACpB;;CAGA,IAAI,YAA8B;EAChC,KAAK,MAAM,KAAK,UAAU;EAC1B,OAAO;CACT;;CAGA,SAA0C,MAAS,SAAiB,MAAS,MAAqB;EAChG,KAAK,MAAM,KAAK,iBAAiB,MAAM,SAAS,SAAS,MAAM,IAAI,CAAe;EAClF,OAAO;CACT;;CAGA,WAA4C,MAAS,SAAiB,MAAS,MAAqB;EAClG,KAAK,MAAM,KAAK,iBAAiB,MAAM,WAAW,SAAS,MAAM,IAAI,CAAe;EACpF,OAAO;CACT;;CAGA,QAAyC,MAAS,SAAiB,MAAS,MAAqB;EAC/F,KAAK,MAAM,KAAK,iBAAiB,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAe;EACjF,OAAO;CACT;;CAGA,MAAM,OAA4B;EAChC,KAAK,MAAM,KAAK,MAAM,OACpB,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,WAAW,aAA0C;EACnD,KAAK,MAAM,KAAK,aACd,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,YAAqB;EACnB,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,OAAO;CACnD;;CAGA,SAAS,OAAiC;EACxC,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,KAAK;CACjD;;CAGA,MAA6B;EAC3B,OAAO,KAAK;CACd;;CAGA,SAAY,OAAqB;EAC/B,IAAI,KAAK,UAAU,GACjB,OAAO,KAAK,KAAK,KAAK;EAExB,OAAO,GAAG,OAAO,KAAK,KAAK;CAC7B;;CAGA,YAA2B;EACzB,OAAO,KAAK,KAAK,KAAK;CACxB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticFingerprint.js","names":[],"sources":["../../src/base/DiagnosticFingerprint.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\n\ninterface FingerprintInput {\n readonly level: DiagnosticLevel;\n readonly code: string;\n readonly message: string;\n readonly hint?: string;\n readonly data: unknown;\n}\n\nexport function createDiagnosticFingerprint(input: FingerprintInput): string {\n const serialized = stableSerialize({\n level: input.level,\n code: input.code,\n message: input.message,\n hint: input.hint ?? null,\n data: input.data ?? null,\n });\n\n return createHash('sha256').update(serialized).digest('hex');\n}\n\nfunction stableSerialize(value: unknown): string {\n if (value === null || typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((item) => stableSerialize(item)).join(',')}]`;\n }\n\n const entries = Object.entries(value as Record<string, unknown>).sort(([a], [b]) => a.localeCompare(b));\n const body = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`).join(',');\n return `{${body}}`;\n}\n"],"mappings":";;;AAWA,SAAgB,4BAA4B,OAAiC;CAC3E,MAAM,aAAa,gBAAgB;EACjC,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,MAAM,MAAM,QAAQ;EACpB,MAAM,MAAM,QAAQ;CACtB,CAAC;CAED,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,KAAK;AAC7D;AAEA,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO,KAAK,UAAU,KAAK;CAG7B,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,IAAI,MAAM,KAAK,SAAS,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;CAKlE,OAAO,IAFS,OAAO,QAAQ,KAAgC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAClF,CAAC,CAAC,KAAK,CAAC,KAAK,UAAU,GAAG,KAAK,UAAU,GAAG,EAAE,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,KAAK,GACpF,EAAE;AAClB"}
1
+ {"version":3,"file":"DiagnosticFingerprint.js","names":[],"sources":["../../src/base/DiagnosticFingerprint.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport type { DiagnosticLevel } from '#diagnostics/base/DiagnosticLevel.ts';\n\ninterface FingerprintInput {\n readonly level: DiagnosticLevel;\n readonly code: string;\n readonly message: string;\n readonly hint?: string;\n readonly data: unknown;\n}\n\nexport function createDiagnosticFingerprint(input: FingerprintInput): string {\n const serialized = stableSerialize({\n level: input.level,\n code: input.code,\n message: input.message,\n hint: input.hint ?? null,\n data: input.data ?? null,\n });\n\n return createHash('sha256').update(serialized).digest('hex');\n}\n\nfunction stableSerialize(value: unknown): string {\n if (value === null || typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((item) => stableSerialize(item)).join(',')}]`;\n }\n\n const entries = Object.entries(value as Record<string, unknown>).sort(([a], [b]) => a.localeCompare(b));\n const body = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`).join(',');\n return `{${body}}`;\n}\n"],"mappings":";;;AAWA,SAAgB,4BAA4B,OAAiC;CAC3E,MAAM,aAAa,gBAAgB;EACjC,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,MAAM,MAAM,QAAQ;EACpB,MAAM,MAAM,QAAQ;CACtB,CAAC;CAED,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,KAAK;AAC7D;AAEA,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO,KAAK,UAAU,KAAK;CAG7B,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,IAAI,MAAM,KAAK,SAAS,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;CAKlE,OAAO,IAFS,OAAO,QAAQ,KAAgC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAClF,CAAC,CAAC,KAAK,CAAC,KAAK,UAAU,GAAG,KAAK,UAAU,GAAG,EAAE,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,KAAK,GACpF,EAAE;AAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Result.js","names":[],"sources":["../../src/base/Result.ts"],"sourcesContent":["import type { Diagnostic } from '../types.js';\n\n// ---------------------------------------------------------------------------\n// Result<T> — the universal return type for fallible operations.\n// ---------------------------------------------------------------------------\n\n/** Successful result carrying a value and optional diagnostics. */\nexport interface ResultOk<T> {\n readonly ok: true;\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Failed result carrying at least one diagnostic. */\nexport interface ResultFail {\n readonly ok: false;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Discriminated union returned by every fallible uapkg operation. */\nexport type Result<T> = ResultOk<T> | ResultFail;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\n/** Create a successful result. */\nexport function ok<T>(value: T, diagnostics: readonly Diagnostic[] = []): ResultOk<T> {\n return { ok: true, value, diagnostics };\n}\n\n/** Create a failed result. */\nexport function fail(diagnostics: readonly Diagnostic[]): ResultFail {\n return { ok: false, diagnostics };\n}\n\n/**\n * Build a result from a diagnostics array and an optional value.\n * If any diagnostic has level `error`, the result is a failure.\n */\nexport function fromDiagnostics<T>(diagnostics: readonly Diagnostic[], value?: T): Result<T> {\n const hasError = diagnostics.some((d) => d.level === 'error');\n if (hasError || value === undefined) {\n return { ok: false, diagnostics };\n }\n return { ok: true, value, diagnostics };\n}\n"],"mappings":";;AA2BA,SAAgB,GAAM,OAAU,cAAqC,CAAC,GAAgB;CACpF,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC;;AAGA,SAAgB,KAAK,aAAgD;CACnE,OAAO;EAAE,IAAI;EAAO;CAAY;AAClC;;;;;AAMA,SAAgB,gBAAmB,aAAoC,OAAsB;CAE3F,IADiB,YAAY,MAAM,MAAM,EAAE,UAAU,OAC1C,KAAK,UAAU,QACxB,OAAO;EAAE,IAAI;EAAO;CAAY;CAElC,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC"}
1
+ {"version":3,"file":"Result.js","names":[],"sources":["../../src/base/Result.ts"],"sourcesContent":["import type { Diagnostic } from '#diagnostics/types.ts';\n\n// ---------------------------------------------------------------------------\n// Result<T> — the universal return type for fallible operations.\n// ---------------------------------------------------------------------------\n\n/** Successful result carrying a value and optional diagnostics. */\nexport interface ResultOk<T> {\n readonly ok: true;\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Failed result carrying at least one diagnostic. */\nexport interface ResultFail {\n readonly ok: false;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Discriminated union returned by every fallible uapkg operation. */\nexport type Result<T> = ResultOk<T> | ResultFail;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\n/** Create a successful result. */\nexport function ok<T>(value: T, diagnostics: readonly Diagnostic[] = []): ResultOk<T> {\n return { ok: true, value, diagnostics };\n}\n\n/** Create a failed result. */\nexport function fail(diagnostics: readonly Diagnostic[]): ResultFail {\n return { ok: false, diagnostics };\n}\n\n/**\n * Build a result from a diagnostics array and an optional value.\n * If any diagnostic has level `error`, the result is a failure.\n */\nexport function fromDiagnostics<T>(diagnostics: readonly Diagnostic[], value?: T): Result<T> {\n const hasError = diagnostics.some((d) => d.level === 'error');\n if (hasError || value === undefined) {\n return { ok: false, diagnostics };\n }\n return { ok: true, value, diagnostics };\n}\n"],"mappings":";;AA2BA,SAAgB,GAAM,OAAU,cAAqC,CAAC,GAAgB;CACpF,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC;;AAGA,SAAgB,KAAK,aAAgD;CACnE,OAAO;EAAE,IAAI;EAAO;CAAY;AAClC;;;;;AAMA,SAAgB,gBAAmB,aAAoC,OAAsB;CAE3F,IADiB,YAAY,MAAM,MAAM,EAAE,UAAU,OAC1C,KAAK,UAAU,QACxB,OAAO;EAAE,IAAI;EAAO;CAAY;CAElC,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigDiagnostics.js","names":[],"sources":["../../src/config/ConfigDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n/** A config file contains invalid JSON and could not be parsed. */\nexport type ConfigInvalidJsonDiagnostic = DiagnosticBase<\n 'CONFIG_INVALID_JSON',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Config value type is incompatible with expected merge shape. */\nexport type ConfigTypeMismatchDiagnostic = DiagnosticBase<\n 'CONFIG_TYPE_MISMATCH',\n {\n readonly path: string;\n readonly expectedType: string;\n readonly actualType: string;\n readonly source: string;\n readonly filePath?: string;\n }\n>;\n\n/** Unknown config key encountered in a config layer. */\nexport type ConfigUnknownKeyDiagnostic = DiagnosticBase<\n 'CONFIG_UNKNOWN_KEY',\n {\n readonly path: string;\n readonly source: string;\n readonly filePath?: string;\n }\n>;\n\n/** Cross-field semantic mismatch: default registry not defined in registries map. */\nexport type ConfigUnresolvedDefaultRegistryDiagnostic = DiagnosticBase<\n 'CONFIG_UNRESOLVED_DEFAULT_REGISTRY',\n {\n readonly registryName: string;\n }\n>;\n\n/** Value failed a narrower semantic validation rule. */\nexport type ConfigInvalidValueDiagnostic = DiagnosticBase<\n 'CONFIG_INVALID_VALUE',\n {\n readonly path: string;\n readonly rule: string;\n }\n>;\n\n/** Union of all config diagnostics. */\nexport type ConfigDiagnostic =\n | ConfigInvalidJsonDiagnostic\n | ConfigTypeMismatchDiagnostic\n | ConfigUnknownKeyDiagnostic\n | ConfigUnresolvedDefaultRegistryDiagnostic\n | ConfigInvalidValueDiagnostic;\n\nexport function createConfigInvalidJsonDiagnostic(filePath: string, reason: string): ConfigInvalidJsonDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_INVALID_JSON',\n message: `Ignoring invalid JSON in config file \"${filePath}\".`,\n hint: 'Fix JSON syntax in this file to restore those settings.',\n data: { filePath, reason },\n };\n}\n\nexport function createConfigTypeMismatchDiagnostic(input: {\n readonly path: string;\n readonly expectedType: string;\n readonly actualType: string;\n readonly source: string;\n readonly filePath?: string;\n}): ConfigTypeMismatchDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_TYPE_MISMATCH',\n message: `Ignoring config value at \"${input.path}\" because it is ${input.actualType}, expected ${input.expectedType}.`,\n hint: 'Use a value type compatible with this config key.',\n data: input,\n };\n}\n\nexport function createConfigUnknownKeyDiagnostic(input: {\n readonly path: string;\n readonly source: string;\n readonly filePath?: string;\n}): ConfigUnknownKeyDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_UNKNOWN_KEY',\n message: `Ignoring unknown config key \"${input.path}\".`,\n hint: 'Remove or rename this key to a supported configuration path.',\n data: input,\n };\n}\n\nexport function createConfigUnresolvedDefaultRegistryDiagnostic(\n registryName: string,\n): ConfigUnresolvedDefaultRegistryDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_UNRESOLVED_DEFAULT_REGISTRY',\n message: `Default registry \"${registryName}\" is not defined under \"registries\".`,\n emitPolicy: 'once',\n hint: `Add \"registries.${registryName}\" or set a different default with 'uapkg registry use <name>'.`,\n data: { registryName },\n };\n}\n\nexport function createConfigInvalidValueDiagnostic(path: string, rule: string): ConfigInvalidValueDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_INVALID_VALUE',\n message: `Config value at \"${path}\" may be invalid: ${rule}.`,\n hint: 'Update this value to match the expected format for this key.',\n data: { path, rule },\n };\n}\n"],"mappings":";AA0DA,SAAgB,kCAAkC,UAAkB,QAA6C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yCAAyC,SAAS;EAC3D,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,OAMlB;CAC/B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,6BAA6B,MAAM,KAAK,kBAAkB,MAAM,WAAW,aAAa,MAAM,aAAa;EACpH,MAAM;EACN,MAAM;CACR;AACF;AAEA,SAAgB,iCAAiC,OAIlB;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gCAAgC,MAAM,KAAK;EACpD,MAAM;EACN,MAAM;CACR;AACF;AAEA,SAAgB,gDACd,cAC2C;CAC3C,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,aAAa;EAC3C,YAAY;EACZ,MAAM,mBAAmB,aAAa;EACtC,MAAM,EAAE,aAAa;CACvB;AACF;AAEA,SAAgB,mCAAmC,MAAc,MAA4C;CAC3G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,oBAAoB,KAAK,oBAAoB,KAAK;EAC3D,MAAM;EACN,MAAM;GAAE;GAAM;EAAK;CACrB;AACF"}
1
+ {"version":3,"file":"ConfigDiagnostics.js","names":[],"sources":["../../src/config/ConfigDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n/** A config file contains invalid JSON and could not be parsed. */\nexport type ConfigInvalidJsonDiagnostic = DiagnosticBase<\n 'CONFIG_INVALID_JSON',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Config value type is incompatible with expected merge shape. */\nexport type ConfigTypeMismatchDiagnostic = DiagnosticBase<\n 'CONFIG_TYPE_MISMATCH',\n {\n readonly path: string;\n readonly expectedType: string;\n readonly actualType: string;\n readonly source: string;\n readonly filePath?: string;\n }\n>;\n\n/** Unknown config key encountered in a config layer. */\nexport type ConfigUnknownKeyDiagnostic = DiagnosticBase<\n 'CONFIG_UNKNOWN_KEY',\n {\n readonly path: string;\n readonly source: string;\n readonly filePath?: string;\n }\n>;\n\n/** Cross-field semantic mismatch: default registry not defined in registries map. */\nexport type ConfigUnresolvedDefaultRegistryDiagnostic = DiagnosticBase<\n 'CONFIG_UNRESOLVED_DEFAULT_REGISTRY',\n {\n readonly registryName: string;\n }\n>;\n\n/** Value failed a narrower semantic validation rule. */\nexport type ConfigInvalidValueDiagnostic = DiagnosticBase<\n 'CONFIG_INVALID_VALUE',\n {\n readonly path: string;\n readonly rule: string;\n }\n>;\n\n/** Union of all config diagnostics. */\nexport type ConfigDiagnostic =\n | ConfigInvalidJsonDiagnostic\n | ConfigTypeMismatchDiagnostic\n | ConfigUnknownKeyDiagnostic\n | ConfigUnresolvedDefaultRegistryDiagnostic\n | ConfigInvalidValueDiagnostic;\n\nexport function createConfigInvalidJsonDiagnostic(filePath: string, reason: string): ConfigInvalidJsonDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_INVALID_JSON',\n message: `Ignoring invalid JSON in config file \"${filePath}\".`,\n hint: 'Fix JSON syntax in this file to restore those settings.',\n data: { filePath, reason },\n };\n}\n\nexport function createConfigTypeMismatchDiagnostic(input: {\n readonly path: string;\n readonly expectedType: string;\n readonly actualType: string;\n readonly source: string;\n readonly filePath?: string;\n}): ConfigTypeMismatchDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_TYPE_MISMATCH',\n message: `Ignoring config value at \"${input.path}\" because it is ${input.actualType}, expected ${input.expectedType}.`,\n hint: 'Use a value type compatible with this config key.',\n data: input,\n };\n}\n\nexport function createConfigUnknownKeyDiagnostic(input: {\n readonly path: string;\n readonly source: string;\n readonly filePath?: string;\n}): ConfigUnknownKeyDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_UNKNOWN_KEY',\n message: `Ignoring unknown config key \"${input.path}\".`,\n hint: 'Remove or rename this key to a supported configuration path.',\n data: input,\n };\n}\n\nexport function createConfigUnresolvedDefaultRegistryDiagnostic(\n registryName: string,\n): ConfigUnresolvedDefaultRegistryDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_UNRESOLVED_DEFAULT_REGISTRY',\n message: `Default registry \"${registryName}\" is not defined under \"registries\".`,\n emitPolicy: 'once',\n hint: `Add \"registries.${registryName}\" or set a different default with 'uapkg registry use <name>'.`,\n data: { registryName },\n };\n}\n\nexport function createConfigInvalidValueDiagnostic(path: string, rule: string): ConfigInvalidValueDiagnostic {\n return {\n level: 'warning',\n code: 'CONFIG_INVALID_VALUE',\n message: `Config value at \"${path}\" may be invalid: ${rule}.`,\n hint: 'Update this value to match the expected format for this key.',\n data: { path, rule },\n };\n}\n"],"mappings":";AA0DA,SAAgB,kCAAkC,UAAkB,QAA6C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yCAAyC,SAAS;EAC3D,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,OAMlB;CAC/B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,6BAA6B,MAAM,KAAK,kBAAkB,MAAM,WAAW,aAAa,MAAM,aAAa;EACpH,MAAM;EACN,MAAM;CACR;AACF;AAEA,SAAgB,iCAAiC,OAIlB;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gCAAgC,MAAM,KAAK;EACpD,MAAM;EACN,MAAM;CACR;AACF;AAEA,SAAgB,gDACd,cAC2C;CAC3C,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,aAAa;EAC3C,YAAY;EACZ,MAAM,mBAAmB,aAAa;EACtC,MAAM,EAAE,aAAa;CACvB;AACF;AAEA,SAAgB,mCAAmC,MAAc,MAA4C;CAC3G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,oBAAoB,KAAK,oBAAoB,KAAK;EAC3D,MAAM;EACN,MAAM;GAAE;GAAM;EAAK;CACrB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ControlPlaneDiagnostics.js","names":[],"sources":["../../src/controlPlane/ControlPlaneDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\nexport type LoginDiagnosticCode =\n | 'LOGIN_ACCESS_DENIED'\n | 'LOGIN_AUTHORIZATION_TIMEOUT'\n | 'LOGIN_AUTHORIZATION_RESPONSE_INVALID'\n | 'LOGIN_REAUTHORIZATION_CONFLICT'\n | 'LOGIN_OAUTH_ERROR'\n | 'LOGIN_FAILED';\n\nexport interface LoginDiagnosticData {\n readonly oauthError?: string;\n}\n\nexport interface ControlPlaneCommandFailedDiagnosticData {\n readonly operation: string;\n readonly serverCode?: string;\n readonly status?: number;\n}\n\nexport type LoginAccessDeniedDiagnostic = DiagnosticBase<'LOGIN_ACCESS_DENIED', LoginDiagnosticData>;\nexport type LoginAuthorizationTimeoutDiagnostic = DiagnosticBase<'LOGIN_AUTHORIZATION_TIMEOUT', LoginDiagnosticData>;\nexport type LoginAuthorizationResponseInvalidDiagnostic = DiagnosticBase<\n 'LOGIN_AUTHORIZATION_RESPONSE_INVALID',\n LoginDiagnosticData\n>;\nexport type LoginReauthorizationConflictDiagnostic = DiagnosticBase<\n 'LOGIN_REAUTHORIZATION_CONFLICT',\n LoginDiagnosticData\n>;\nexport type LoginOAuthErrorDiagnostic = DiagnosticBase<'LOGIN_OAUTH_ERROR', LoginDiagnosticData>;\nexport type LoginFailedDiagnostic = DiagnosticBase<'LOGIN_FAILED', LoginDiagnosticData>;\nexport type ControlPlaneCommandFailedDiagnostic = DiagnosticBase<\n 'CONTROL_PLANE_COMMAND_FAILED',\n ControlPlaneCommandFailedDiagnosticData\n>;\n\nexport type ControlPlaneDiagnostic =\n | LoginAccessDeniedDiagnostic\n | LoginAuthorizationTimeoutDiagnostic\n | LoginAuthorizationResponseInvalidDiagnostic\n | LoginReauthorizationConflictDiagnostic\n | LoginOAuthErrorDiagnostic\n | LoginFailedDiagnostic\n | ControlPlaneCommandFailedDiagnostic;\n\nexport type LoginDiagnosticByCode<C extends LoginDiagnosticCode> = Extract<ControlPlaneDiagnostic, { code: C }>;\n\nexport function createControlPlaneCommandFailedDiagnostic(\n message: string,\n data: ControlPlaneCommandFailedDiagnosticData,\n): ControlPlaneCommandFailedDiagnostic {\n return {\n level: 'error',\n code: 'CONTROL_PLANE_COMMAND_FAILED',\n message,\n data,\n };\n}\n"],"mappings":";AAgDA,SAAgB,0CACd,SACA,MACqC;CACrC,OAAO;EACL,OAAO;EACP,MAAM;EACN;EACA;CACF;AACF"}
1
+ {"version":3,"file":"ControlPlaneDiagnostics.js","names":[],"sources":["../../src/controlPlane/ControlPlaneDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\nexport type LoginDiagnosticCode =\n | 'LOGIN_ACCESS_DENIED'\n | 'LOGIN_AUTHORIZATION_TIMEOUT'\n | 'LOGIN_AUTHORIZATION_RESPONSE_INVALID'\n | 'LOGIN_REAUTHORIZATION_CONFLICT'\n | 'LOGIN_OAUTH_ERROR'\n | 'LOGIN_FAILED';\n\nexport interface LoginDiagnosticData {\n readonly oauthError?: string;\n}\n\nexport interface ControlPlaneCommandFailedDiagnosticData {\n readonly operation: string;\n readonly serverCode?: string;\n readonly status?: number;\n}\n\nexport type LoginAccessDeniedDiagnostic = DiagnosticBase<'LOGIN_ACCESS_DENIED', LoginDiagnosticData>;\nexport type LoginAuthorizationTimeoutDiagnostic = DiagnosticBase<'LOGIN_AUTHORIZATION_TIMEOUT', LoginDiagnosticData>;\nexport type LoginAuthorizationResponseInvalidDiagnostic = DiagnosticBase<\n 'LOGIN_AUTHORIZATION_RESPONSE_INVALID',\n LoginDiagnosticData\n>;\nexport type LoginReauthorizationConflictDiagnostic = DiagnosticBase<\n 'LOGIN_REAUTHORIZATION_CONFLICT',\n LoginDiagnosticData\n>;\nexport type LoginOAuthErrorDiagnostic = DiagnosticBase<'LOGIN_OAUTH_ERROR', LoginDiagnosticData>;\nexport type LoginFailedDiagnostic = DiagnosticBase<'LOGIN_FAILED', LoginDiagnosticData>;\nexport type ControlPlaneCommandFailedDiagnostic = DiagnosticBase<\n 'CONTROL_PLANE_COMMAND_FAILED',\n ControlPlaneCommandFailedDiagnosticData\n>;\n\nexport type ControlPlaneDiagnostic =\n | LoginAccessDeniedDiagnostic\n | LoginAuthorizationTimeoutDiagnostic\n | LoginAuthorizationResponseInvalidDiagnostic\n | LoginReauthorizationConflictDiagnostic\n | LoginOAuthErrorDiagnostic\n | LoginFailedDiagnostic\n | ControlPlaneCommandFailedDiagnostic;\n\nexport type LoginDiagnosticByCode<C extends LoginDiagnosticCode> = Extract<ControlPlaneDiagnostic, { code: C }>;\n\nexport function createControlPlaneCommandFailedDiagnostic(\n message: string,\n data: ControlPlaneCommandFailedDiagnosticData,\n): ControlPlaneCommandFailedDiagnostic {\n return {\n level: 'error',\n code: 'CONTROL_PLANE_COMMAND_FAILED',\n message,\n data,\n };\n}\n"],"mappings":";AAgDA,SAAgB,0CACd,SACA,MACqC;CACrC,OAAO;EACL,OAAO;EACP,MAAM;EACN;EACA;CACF;AACF"}
@@ -27,8 +27,8 @@ function createUnknownErrorDiagnostic(reason) {
27
27
  return {
28
28
  level: "error",
29
29
  code: "UNKNOWN_ERROR",
30
- message: `An unexpected error occurred: ${reason}.`,
31
- hint: "If this persists, please report a bug.",
30
+ message: `Unexpected error: ${reason}.`,
31
+ hint: "If the error continues, report it to the UAPKG maintainers.",
32
32
  data: { reason }
33
33
  };
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GeneralDiagnostics.js","names":[],"sources":["../../src/general/GeneralDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// General-purpose diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Generic JSON or data parse error. */\nexport type ParseErrorDiagnostic = DiagnosticBase<\n 'PARSE_ERROR',\n {\n readonly filePath?: string;\n readonly reason: string;\n }\n>;\n\n/** File system I/O error. */\nexport type IoErrorDiagnostic = DiagnosticBase<\n 'IO_ERROR',\n {\n readonly path: string;\n readonly reason: string;\n }\n>;\n\n/** Catch-all for truly unexpected situations (should be rare). */\nexport type UnknownErrorDiagnostic = DiagnosticBase<\n 'UNKNOWN_ERROR',\n {\n readonly reason: string;\n }\n>;\n\n/** Union of all general diagnostics. */\nexport type GeneralDiagnostic = ParseErrorDiagnostic | IoErrorDiagnostic | UnknownErrorDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createParseErrorDiagnostic(reason: string, filePath?: string): ParseErrorDiagnostic {\n return {\n level: 'error',\n code: 'PARSE_ERROR',\n message: filePath ? `Parse error in \"${filePath}\": ${reason}.` : `Parse error: ${reason}.`,\n hint: 'Ensure the input is well-formed.',\n data: { filePath, reason },\n };\n}\n\nexport function createIoErrorDiagnostic(path: string, reason: string): IoErrorDiagnostic {\n return {\n level: 'error',\n code: 'IO_ERROR',\n message: `I/O error at \"${path}\": ${reason}.`,\n hint: 'Check file permissions and that the path exists.',\n data: { path, reason },\n };\n}\n\nexport function createUnknownErrorDiagnostic(reason: string): UnknownErrorDiagnostic {\n return {\n level: 'error',\n code: 'UNKNOWN_ERROR',\n message: `An unexpected error occurred: ${reason}.`,\n hint: 'If this persists, please report a bug.',\n data: { reason },\n };\n}\n"],"mappings":";AAuCA,SAAgB,2BAA2B,QAAgB,UAAyC;CAClG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,WAAW,mBAAmB,SAAS,KAAK,OAAO,KAAK,gBAAgB,OAAO;EACxF,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,wBAAwB,MAAc,QAAmC;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iBAAiB,KAAK,KAAK,OAAO;EAC3C,MAAM;EACN,MAAM;GAAE;GAAM;EAAO;CACvB;AACF;AAEA,SAAgB,6BAA6B,QAAwC;CACnF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,OAAO;EACjD,MAAM;EACN,MAAM,EAAE,OAAO;CACjB;AACF"}
1
+ {"version":3,"file":"GeneralDiagnostics.js","names":[],"sources":["../../src/general/GeneralDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// General-purpose diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Generic JSON or data parse error. */\nexport type ParseErrorDiagnostic = DiagnosticBase<\n 'PARSE_ERROR',\n {\n readonly filePath?: string;\n readonly reason: string;\n }\n>;\n\n/** File system I/O error. */\nexport type IoErrorDiagnostic = DiagnosticBase<\n 'IO_ERROR',\n {\n readonly path: string;\n readonly reason: string;\n }\n>;\n\n/** Catch-all for truly unexpected situations (should be rare). */\nexport type UnknownErrorDiagnostic = DiagnosticBase<\n 'UNKNOWN_ERROR',\n {\n readonly reason: string;\n }\n>;\n\n/** Union of all general diagnostics. */\nexport type GeneralDiagnostic = ParseErrorDiagnostic | IoErrorDiagnostic | UnknownErrorDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createParseErrorDiagnostic(reason: string, filePath?: string): ParseErrorDiagnostic {\n return {\n level: 'error',\n code: 'PARSE_ERROR',\n message: filePath ? `Parse error in \"${filePath}\": ${reason}.` : `Parse error: ${reason}.`,\n hint: 'Ensure the input is well-formed.',\n data: { filePath, reason },\n };\n}\n\nexport function createIoErrorDiagnostic(path: string, reason: string): IoErrorDiagnostic {\n return {\n level: 'error',\n code: 'IO_ERROR',\n message: `I/O error at \"${path}\": ${reason}.`,\n hint: 'Check file permissions and that the path exists.',\n data: { path, reason },\n };\n}\n\nexport function createUnknownErrorDiagnostic(reason: string): UnknownErrorDiagnostic {\n return {\n level: 'error',\n code: 'UNKNOWN_ERROR',\n message: `Unexpected error: ${reason}.`,\n hint: 'If the error continues, report it to the UAPKG maintainers.',\n data: { reason },\n };\n}\n"],"mappings":";AAuCA,SAAgB,2BAA2B,QAAgB,UAAyC;CAClG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,WAAW,mBAAmB,SAAS,KAAK,OAAO,KAAK,gBAAgB,OAAO;EACxF,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,wBAAwB,MAAc,QAAmC;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iBAAiB,KAAK,KAAK,OAAO;EAC3C,MAAM;EACN,MAAM;GAAE;GAAM;EAAO;CACvB;AACF;AAEA,SAAgB,6BAA6B,QAAwC;CACnF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,OAAO;EACrC,MAAM;EACN,MAAM,EAAE,OAAO;CACjB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"InstallerDiagnostics.js","names":[],"sources":["../../src/installer/InstallerDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Installer diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** HTTP download of a package .tgz asset failed. */\nexport type DownloadFailedDiagnostic = DiagnosticBase<\n 'DOWNLOAD_FAILED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly reason: string;\n readonly attempt: number;\n }\n>;\n\n/** Remote responded with a non-2xx HTTP status. */\nexport type DownloadHttpStatusDiagnostic = DiagnosticBase<\n 'DOWNLOAD_HTTP_STATUS',\n {\n readonly packageName: string;\n readonly url: string;\n readonly status: number;\n }\n>;\n\n/** Download timed out per `network.timeout`. */\nexport type NetworkTimeoutDiagnostic = DiagnosticBase<\n 'NETWORK_TIMEOUT',\n {\n readonly packageName: string;\n readonly url: string;\n readonly timeoutSeconds: number;\n }\n>;\n\n/** Retries exhausted per `network.retries`. */\nexport type NetworkRetriesExhaustedDiagnostic = DiagnosticBase<\n 'NETWORK_RETRIES_EXHAUSTED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly attempts: number;\n }\n>;\n\n/** Downloaded file hash did not match the expected integrity from the registry. */\nexport type IntegrityMismatchDiagnostic = DiagnosticBase<\n 'INTEGRITY_MISMATCH',\n {\n readonly packageName: string;\n readonly expected: string;\n readonly actual: string;\n }\n>;\n\n/** Failed to extract a .tgz archive into the install path. */\nexport type ExtractionFailedDiagnostic = DiagnosticBase<\n 'EXTRACTION_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\n/** Failed to remove a package directory. */\nexport type DiskRemoveFailedDiagnostic = DiagnosticBase<\n 'DISK_REMOVE_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\nexport type InstallerDiagnostic =\n | DownloadFailedDiagnostic\n | DownloadHttpStatusDiagnostic\n | NetworkTimeoutDiagnostic\n | NetworkRetriesExhaustedDiagnostic\n | IntegrityMismatchDiagnostic\n | ExtractionFailedDiagnostic\n | DiskRemoveFailedDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createDownloadFailedDiagnostic(\n packageName: string,\n url: string,\n reason: string,\n attempt: number,\n): DownloadFailedDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_FAILED',\n message: `Download of \"${packageName}\" failed (attempt ${attempt}): ${reason}.`,\n hint: 'Check your network connection and registry URL.',\n data: { packageName, url, reason, attempt },\n };\n}\n\nexport function createDownloadHttpStatusDiagnostic(\n packageName: string,\n url: string,\n status: number,\n): DownloadHttpStatusDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_HTTP_STATUS',\n message: `Download of \"${packageName}\" returned HTTP ${status}.`,\n data: { packageName, url, status },\n };\n}\n\nexport function createNetworkTimeoutDiagnostic(\n packageName: string,\n url: string,\n timeoutSeconds: number,\n): NetworkTimeoutDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_TIMEOUT',\n message: `Download of \"${packageName}\" timed out after ${timeoutSeconds}s.`,\n hint: 'Increase `network.timeout` in your uapkg config.',\n data: { packageName, url, timeoutSeconds },\n };\n}\n\nexport function createNetworkRetriesExhaustedDiagnostic(\n packageName: string,\n url: string,\n attempts: number,\n): NetworkRetriesExhaustedDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_RETRIES_EXHAUSTED',\n message: `Giving up on \"${packageName}\" after ${attempts} attempts.`,\n hint: 'Increase `network.retries` or check network stability.',\n data: { packageName, url, attempts },\n };\n}\n\nexport function createIntegrityMismatchDiagnostic(\n packageName: string,\n expected: string,\n actual: string,\n): IntegrityMismatchDiagnostic {\n return {\n level: 'error',\n code: 'INTEGRITY_MISMATCH',\n message: `Integrity mismatch for \"${packageName}\".`,\n hint: 'The download may be corrupt or the registry entry has changed; re-run or report to the registry.',\n data: { packageName, expected, actual },\n };\n}\n\nexport function createExtractionFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): ExtractionFailedDiagnostic {\n return {\n level: 'error',\n code: 'EXTRACTION_FAILED',\n message: `Extraction of \"${packageName}\" to \"${path}\" failed: ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n\nexport function createDiskRemoveFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): DiskRemoveFailedDiagnostic {\n return {\n level: 'error',\n code: 'DISK_REMOVE_FAILED',\n message: `Failed to remove \"${packageName}\" at \"${path}\": ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n"],"mappings":";AA0FA,SAAgB,+BACd,aACA,KACA,QACA,SAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,QAAQ,KAAK,OAAO;EAC7E,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;GAAQ;EAAQ;CAC5C;AACF;AAEA,SAAgB,mCACd,aACA,KACA,QAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,kBAAkB,OAAO;EAC9D,MAAM;GAAE;GAAa;GAAK;EAAO;CACnC;AACF;AAEA,SAAgB,+BACd,aACA,KACA,gBAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,eAAe;EACxE,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAe;CAC3C;AACF;AAEA,SAAgB,wCACd,aACA,KACA,UACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iBAAiB,YAAY,UAAU,SAAS;EACzD,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAS;CACrC;AACF;AAEA,SAAgB,kCACd,aACA,UACA,QAC6B;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2BAA2B,YAAY;EAChD,MAAM;EACN,MAAM;GAAE;GAAa;GAAU;EAAO;CACxC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,YAAY,QAAQ,KAAK,YAAY,OAAO;EACvE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,YAAY,QAAQ,KAAK,KAAK,OAAO;EACnE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF"}
1
+ {"version":3,"file":"InstallerDiagnostics.js","names":[],"sources":["../../src/installer/InstallerDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Installer diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** HTTP download of a package .tgz asset failed. */\nexport type DownloadFailedDiagnostic = DiagnosticBase<\n 'DOWNLOAD_FAILED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly reason: string;\n readonly attempt: number;\n }\n>;\n\n/** Remote responded with a non-2xx HTTP status. */\nexport type DownloadHttpStatusDiagnostic = DiagnosticBase<\n 'DOWNLOAD_HTTP_STATUS',\n {\n readonly packageName: string;\n readonly url: string;\n readonly status: number;\n }\n>;\n\n/** Download timed out per `network.timeout`. */\nexport type NetworkTimeoutDiagnostic = DiagnosticBase<\n 'NETWORK_TIMEOUT',\n {\n readonly packageName: string;\n readonly url: string;\n readonly timeoutSeconds: number;\n }\n>;\n\n/** Retries exhausted per `network.retries`. */\nexport type NetworkRetriesExhaustedDiagnostic = DiagnosticBase<\n 'NETWORK_RETRIES_EXHAUSTED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly attempts: number;\n }\n>;\n\n/** Downloaded file hash did not match the expected integrity from the registry. */\nexport type IntegrityMismatchDiagnostic = DiagnosticBase<\n 'INTEGRITY_MISMATCH',\n {\n readonly packageName: string;\n readonly expected: string;\n readonly actual: string;\n }\n>;\n\n/** Failed to extract a .tgz archive into the install path. */\nexport type ExtractionFailedDiagnostic = DiagnosticBase<\n 'EXTRACTION_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\n/** Failed to remove a package directory. */\nexport type DiskRemoveFailedDiagnostic = DiagnosticBase<\n 'DISK_REMOVE_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\nexport type InstallerDiagnostic =\n | DownloadFailedDiagnostic\n | DownloadHttpStatusDiagnostic\n | NetworkTimeoutDiagnostic\n | NetworkRetriesExhaustedDiagnostic\n | IntegrityMismatchDiagnostic\n | ExtractionFailedDiagnostic\n | DiskRemoveFailedDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createDownloadFailedDiagnostic(\n packageName: string,\n url: string,\n reason: string,\n attempt: number,\n): DownloadFailedDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_FAILED',\n message: `Download of \"${packageName}\" failed (attempt ${attempt}): ${reason}.`,\n hint: 'Check your network connection and registry URL.',\n data: { packageName, url, reason, attempt },\n };\n}\n\nexport function createDownloadHttpStatusDiagnostic(\n packageName: string,\n url: string,\n status: number,\n): DownloadHttpStatusDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_HTTP_STATUS',\n message: `Download of \"${packageName}\" returned HTTP ${status}.`,\n data: { packageName, url, status },\n };\n}\n\nexport function createNetworkTimeoutDiagnostic(\n packageName: string,\n url: string,\n timeoutSeconds: number,\n): NetworkTimeoutDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_TIMEOUT',\n message: `Download of \"${packageName}\" timed out after ${timeoutSeconds}s.`,\n hint: 'Increase `network.timeout` in your uapkg config.',\n data: { packageName, url, timeoutSeconds },\n };\n}\n\nexport function createNetworkRetriesExhaustedDiagnostic(\n packageName: string,\n url: string,\n attempts: number,\n): NetworkRetriesExhaustedDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_RETRIES_EXHAUSTED',\n message: `Giving up on \"${packageName}\" after ${attempts} attempts.`,\n hint: 'Increase `network.retries` or check network stability.',\n data: { packageName, url, attempts },\n };\n}\n\nexport function createIntegrityMismatchDiagnostic(\n packageName: string,\n expected: string,\n actual: string,\n): IntegrityMismatchDiagnostic {\n return {\n level: 'error',\n code: 'INTEGRITY_MISMATCH',\n message: `Integrity mismatch for \"${packageName}\".`,\n hint: 'The download may be corrupt or the registry entry has changed; re-run or report to the registry.',\n data: { packageName, expected, actual },\n };\n}\n\nexport function createExtractionFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): ExtractionFailedDiagnostic {\n return {\n level: 'error',\n code: 'EXTRACTION_FAILED',\n message: `Extraction of \"${packageName}\" to \"${path}\" failed: ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n\nexport function createDiskRemoveFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): DiskRemoveFailedDiagnostic {\n return {\n level: 'error',\n code: 'DISK_REMOVE_FAILED',\n message: `Failed to remove \"${packageName}\" at \"${path}\": ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n"],"mappings":";AA0FA,SAAgB,+BACd,aACA,KACA,QACA,SAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,QAAQ,KAAK,OAAO;EAC7E,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;GAAQ;EAAQ;CAC5C;AACF;AAEA,SAAgB,mCACd,aACA,KACA,QAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,kBAAkB,OAAO;EAC9D,MAAM;GAAE;GAAa;GAAK;EAAO;CACnC;AACF;AAEA,SAAgB,+BACd,aACA,KACA,gBAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,eAAe;EACxE,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAe;CAC3C;AACF;AAEA,SAAgB,wCACd,aACA,KACA,UACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iBAAiB,YAAY,UAAU,SAAS;EACzD,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAS;CACrC;AACF;AAEA,SAAgB,kCACd,aACA,UACA,QAC6B;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2BAA2B,YAAY;EAChD,MAAM;EACN,MAAM;GAAE;GAAa;GAAU;EAAO;CACxC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,YAAY,QAAQ,KAAK,YAAY,OAAO;EACvE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,YAAY,QAAQ,KAAK,KAAK,OAAO;EACnE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ManifestDiagnostics.js","names":[],"sources":["../../src/manifest/ManifestDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Manifest diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Manifest content failed schema validation. */\nexport type ManifestInvalidDiagnostic = DiagnosticBase<\n 'MANIFEST_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** Lockfile content failed schema validation. */\nexport type LockfileInvalidDiagnostic = DiagnosticBase<\n 'LOCKFILE_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** Lockfile is missing from disk. */\nexport type LockfileMissingDiagnostic = DiagnosticBase<\n 'LOCKFILE_MISSING',\n {\n readonly filePath: string;\n }\n>;\n\n/** Lockfile is present but does not match manifest/config expectations. */\nexport type LockfileOutOfSyncDiagnostic = DiagnosticBase<\n 'LOCKFILE_OUT_OF_SYNC',\n {\n readonly issues: readonly {\n readonly severity: 'error' | 'warning' | 'info';\n readonly code: string;\n readonly message: string;\n readonly packageName?: string;\n }[];\n readonly totalIssues: number;\n readonly additionalIssues: number;\n readonly logFilePath: string;\n }\n>;\n\n/** Overrides are only allowed in root project manifests. */\nexport type ForbiddenOverridesDiagnostic = DiagnosticBase<\n 'FORBIDDEN_OVERRIDES',\n {\n readonly manifestKind: string;\n readonly filePath: string;\n }\n>;\n\n/** A registry name referenced in a dependency is not in configuration. */\nexport type UnresolvedRegistryDiagnostic = DiagnosticBase<\n 'UNRESOLVED_REGISTRY',\n {\n readonly registryName: string;\n readonly dependencyName: string;\n }\n>;\n\n/** Failed to read a manifest or lockfile from disk. */\nexport type ManifestReadErrorDiagnostic = DiagnosticBase<\n 'MANIFEST_READ_ERROR',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Failed to write a manifest or lockfile to disk. */\nexport type ManifestWriteErrorDiagnostic = DiagnosticBase<\n 'MANIFEST_WRITE_ERROR',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Remove was requested for a package that does not exist in manifest buckets. */\nexport type DependencyNotFoundDiagnostic = DiagnosticBase<\n 'DEPENDENCY_NOT_FOUND',\n {\n readonly packageName: string;\n }\n>;\n\n/** Union of all manifest diagnostics. */\nexport type ManifestDiagnostic =\n | ManifestInvalidDiagnostic\n | LockfileInvalidDiagnostic\n | LockfileMissingDiagnostic\n | LockfileOutOfSyncDiagnostic\n | ForbiddenOverridesDiagnostic\n | UnresolvedRegistryDiagnostic\n | ManifestReadErrorDiagnostic\n | ManifestWriteErrorDiagnostic\n | DependencyNotFoundDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createManifestInvalidDiagnostic(\n filePath: string,\n issues: readonly string[],\n): ManifestInvalidDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_INVALID',\n message: `Manifest validation failed for \"${filePath}\".`,\n hint: 'Review your uapkg.json against the expected schema.',\n data: { filePath, issues },\n };\n}\n\nexport function createLockfileInvalidDiagnostic(\n filePath: string,\n issues: readonly string[],\n): LockfileInvalidDiagnostic {\n return {\n level: 'error',\n code: 'LOCKFILE_INVALID',\n message: `Lockfile validation failed for \"${filePath}\".`,\n hint: 'Delete uapkg.lock and re-run install to regenerate.',\n data: { filePath, issues },\n };\n}\n\nexport function createLockfileMissingDiagnostic(\n filePath: string,\n level: 'warning' | 'error' = 'warning',\n): LockfileMissingDiagnostic {\n return {\n level,\n code: 'LOCKFILE_MISSING',\n message: `No lockfile found at \"${filePath}\".`,\n hint: 'Run `uapkg install` to generate a lockfile, or use `--frozen` only when one already exists.',\n data: { filePath },\n };\n}\n\nexport function createLockfileOutOfSyncDiagnostic(\n issues: readonly {\n readonly severity: 'error' | 'warning' | 'info';\n readonly code: string;\n readonly message: string;\n readonly packageName?: string;\n }[],\n totalIssues: number,\n logFilePath: string,\n): LockfileOutOfSyncDiagnostic {\n return {\n level: 'error',\n code: 'LOCKFILE_OUT_OF_SYNC',\n message: 'Lockfile is out of sync with the current manifest and registry state.',\n hint: 'Run `uapkg install` or `uapkg update` to regenerate the lockfile before using `--frozen`.',\n data: {\n issues,\n totalIssues,\n additionalIssues: Math.max(0, totalIssues - issues.length),\n logFilePath,\n },\n };\n}\n\nexport function createForbiddenOverridesDiagnostic(\n manifestKind: string,\n filePath: string,\n): ForbiddenOverridesDiagnostic {\n return {\n level: 'error',\n code: 'FORBIDDEN_OVERRIDES',\n message: `Overrides are not allowed in \"${manifestKind}\" manifests (\"${filePath}\").`,\n hint: 'Overrides may only appear in root project manifests.',\n data: { manifestKind, filePath },\n };\n}\n\nexport function createUnresolvedRegistryDiagnostic(\n registryName: string,\n dependencyName: string,\n): UnresolvedRegistryDiagnostic {\n return {\n level: 'error',\n code: 'UNRESOLVED_REGISTRY',\n message: `Registry \"${registryName}\" referenced by dependency \"${dependencyName}\" is not configured.`,\n hint: 'Add the registry to your uapkg configuration.',\n data: { registryName, dependencyName },\n };\n}\n\nexport function createManifestReadErrorDiagnostic(filePath: string, reason: string): ManifestReadErrorDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_READ_ERROR',\n message: `Failed to read \"${filePath}\": ${reason}.`,\n hint: 'Ensure the file exists and is valid JSON.',\n data: { filePath, reason },\n };\n}\n\nexport function createManifestWriteErrorDiagnostic(filePath: string, reason: string): ManifestWriteErrorDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_WRITE_ERROR',\n message: `Failed to write \"${filePath}\": ${reason}.`,\n hint: 'Ensure the directory exists and you have write permissions.',\n data: { filePath, reason },\n };\n}\n\nexport function createDependencyNotFoundDiagnostic(packageName: string): DependencyNotFoundDiagnostic {\n return {\n level: 'info',\n code: 'DEPENDENCY_NOT_FOUND',\n message: `Package \"${packageName}\" is not declared in this manifest and will not be removed.`,\n hint: 'Run `uapkg list` to inspect currently declared dependencies.',\n data: { packageName },\n };\n}\n"],"mappings":";AA4GA,SAAgB,gCACd,UACA,QAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,SAAS;EACrD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,gCACd,UACA,QAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,SAAS;EACrD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,gCACd,UACA,QAA6B,WACF;CAC3B,OAAO;EACL;EACA,MAAM;EACN,SAAS,yBAAyB,SAAS;EAC3C,MAAM;EACN,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,kCACd,QAMA,aACA,aAC6B;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM;GACJ;GACA;GACA,kBAAkB,KAAK,IAAI,GAAG,cAAc,OAAO,MAAM;GACzD;EACF;CACF;AACF;AAEA,SAAgB,mCACd,cACA,UAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,aAAa,gBAAgB,SAAS;EAChF,MAAM;EACN,MAAM;GAAE;GAAc;EAAS;CACjC;AACF;AAEA,SAAgB,mCACd,cACA,gBAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,aAAa,aAAa,8BAA8B,eAAe;EAChF,MAAM;EACN,MAAM;GAAE;GAAc;EAAe;CACvC;AACF;AAEA,SAAgB,kCAAkC,UAAkB,QAA6C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mBAAmB,SAAS,KAAK,OAAO;EACjD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,UAAkB,QAA8C;CACjH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,oBAAoB,SAAS,KAAK,OAAO;EAClD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,aAAmD;CACpG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY;EACjC,MAAM;EACN,MAAM,EAAE,YAAY;CACtB;AACF"}
1
+ {"version":3,"file":"ManifestDiagnostics.js","names":[],"sources":["../../src/manifest/ManifestDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Manifest diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Manifest content failed schema validation. */\nexport type ManifestInvalidDiagnostic = DiagnosticBase<\n 'MANIFEST_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** Lockfile content failed schema validation. */\nexport type LockfileInvalidDiagnostic = DiagnosticBase<\n 'LOCKFILE_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** Lockfile is missing from disk. */\nexport type LockfileMissingDiagnostic = DiagnosticBase<\n 'LOCKFILE_MISSING',\n {\n readonly filePath: string;\n }\n>;\n\n/** Lockfile is present but does not match manifest/config expectations. */\nexport type LockfileOutOfSyncDiagnostic = DiagnosticBase<\n 'LOCKFILE_OUT_OF_SYNC',\n {\n readonly issues: readonly {\n readonly severity: 'error' | 'warning' | 'info';\n readonly code: string;\n readonly message: string;\n readonly packageName?: string;\n }[];\n readonly totalIssues: number;\n readonly additionalIssues: number;\n readonly logFilePath: string;\n }\n>;\n\n/** Overrides are only allowed in root project manifests. */\nexport type ForbiddenOverridesDiagnostic = DiagnosticBase<\n 'FORBIDDEN_OVERRIDES',\n {\n readonly manifestKind: string;\n readonly filePath: string;\n }\n>;\n\n/** A registry name referenced in a dependency is not in configuration. */\nexport type UnresolvedRegistryDiagnostic = DiagnosticBase<\n 'UNRESOLVED_REGISTRY',\n {\n readonly registryName: string;\n readonly dependencyName: string;\n }\n>;\n\n/** Failed to read a manifest or lockfile from disk. */\nexport type ManifestReadErrorDiagnostic = DiagnosticBase<\n 'MANIFEST_READ_ERROR',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Failed to write a manifest or lockfile to disk. */\nexport type ManifestWriteErrorDiagnostic = DiagnosticBase<\n 'MANIFEST_WRITE_ERROR',\n {\n readonly filePath: string;\n readonly reason: string;\n }\n>;\n\n/** Remove was requested for a package that does not exist in manifest buckets. */\nexport type DependencyNotFoundDiagnostic = DiagnosticBase<\n 'DEPENDENCY_NOT_FOUND',\n {\n readonly packageName: string;\n }\n>;\n\n/** Union of all manifest diagnostics. */\nexport type ManifestDiagnostic =\n | ManifestInvalidDiagnostic\n | LockfileInvalidDiagnostic\n | LockfileMissingDiagnostic\n | LockfileOutOfSyncDiagnostic\n | ForbiddenOverridesDiagnostic\n | UnresolvedRegistryDiagnostic\n | ManifestReadErrorDiagnostic\n | ManifestWriteErrorDiagnostic\n | DependencyNotFoundDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createManifestInvalidDiagnostic(\n filePath: string,\n issues: readonly string[],\n): ManifestInvalidDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_INVALID',\n message: `Manifest validation failed for \"${filePath}\".`,\n hint: 'Review your uapkg.json against the expected schema.',\n data: { filePath, issues },\n };\n}\n\nexport function createLockfileInvalidDiagnostic(\n filePath: string,\n issues: readonly string[],\n): LockfileInvalidDiagnostic {\n return {\n level: 'error',\n code: 'LOCKFILE_INVALID',\n message: `Lockfile validation failed for \"${filePath}\".`,\n hint: 'Delete uapkg.lock and re-run install to regenerate.',\n data: { filePath, issues },\n };\n}\n\nexport function createLockfileMissingDiagnostic(\n filePath: string,\n level: 'warning' | 'error' = 'warning',\n): LockfileMissingDiagnostic {\n return {\n level,\n code: 'LOCKFILE_MISSING',\n message: `No lockfile found at \"${filePath}\".`,\n hint: 'Run `uapkg install` to generate a lockfile, or use `--frozen` only when one already exists.',\n data: { filePath },\n };\n}\n\nexport function createLockfileOutOfSyncDiagnostic(\n issues: readonly {\n readonly severity: 'error' | 'warning' | 'info';\n readonly code: string;\n readonly message: string;\n readonly packageName?: string;\n }[],\n totalIssues: number,\n logFilePath: string,\n): LockfileOutOfSyncDiagnostic {\n return {\n level: 'error',\n code: 'LOCKFILE_OUT_OF_SYNC',\n message: 'Lockfile is out of sync with the current manifest and registry state.',\n hint: 'Run `uapkg install` or `uapkg update` to regenerate the lockfile before using `--frozen`.',\n data: {\n issues,\n totalIssues,\n additionalIssues: Math.max(0, totalIssues - issues.length),\n logFilePath,\n },\n };\n}\n\nexport function createForbiddenOverridesDiagnostic(\n manifestKind: string,\n filePath: string,\n): ForbiddenOverridesDiagnostic {\n return {\n level: 'error',\n code: 'FORBIDDEN_OVERRIDES',\n message: `Overrides are not allowed in \"${manifestKind}\" manifests (\"${filePath}\").`,\n hint: 'Overrides may only appear in root project manifests.',\n data: { manifestKind, filePath },\n };\n}\n\nexport function createUnresolvedRegistryDiagnostic(\n registryName: string,\n dependencyName: string,\n): UnresolvedRegistryDiagnostic {\n return {\n level: 'error',\n code: 'UNRESOLVED_REGISTRY',\n message: `Registry \"${registryName}\" referenced by dependency \"${dependencyName}\" is not configured.`,\n hint: 'Add the registry to your uapkg configuration.',\n data: { registryName, dependencyName },\n };\n}\n\nexport function createManifestReadErrorDiagnostic(filePath: string, reason: string): ManifestReadErrorDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_READ_ERROR',\n message: `Failed to read \"${filePath}\": ${reason}.`,\n hint: 'Ensure the file exists and is valid JSON.',\n data: { filePath, reason },\n };\n}\n\nexport function createManifestWriteErrorDiagnostic(filePath: string, reason: string): ManifestWriteErrorDiagnostic {\n return {\n level: 'error',\n code: 'MANIFEST_WRITE_ERROR',\n message: `Failed to write \"${filePath}\": ${reason}.`,\n hint: 'Ensure the directory exists and you have write permissions.',\n data: { filePath, reason },\n };\n}\n\nexport function createDependencyNotFoundDiagnostic(packageName: string): DependencyNotFoundDiagnostic {\n return {\n level: 'info',\n code: 'DEPENDENCY_NOT_FOUND',\n message: `Package \"${packageName}\" is not declared in this manifest and will not be removed.`,\n hint: 'Run `uapkg list` to inspect currently declared dependencies.',\n data: { packageName },\n };\n}\n"],"mappings":";AA4GA,SAAgB,gCACd,UACA,QAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,SAAS;EACrD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,gCACd,UACA,QAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,SAAS;EACrD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,gCACd,UACA,QAA6B,WACF;CAC3B,OAAO;EACL;EACA,MAAM;EACN,SAAS,yBAAyB,SAAS;EAC3C,MAAM;EACN,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,kCACd,QAMA,aACA,aAC6B;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM;GACJ;GACA;GACA,kBAAkB,KAAK,IAAI,GAAG,cAAc,OAAO,MAAM;GACzD;EACF;CACF;AACF;AAEA,SAAgB,mCACd,cACA,UAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,aAAa,gBAAgB,SAAS;EAChF,MAAM;EACN,MAAM;GAAE;GAAc;EAAS;CACjC;AACF;AAEA,SAAgB,mCACd,cACA,gBAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,aAAa,aAAa,8BAA8B,eAAe;EAChF,MAAM;EACN,MAAM;GAAE;GAAc;EAAe;CACvC;AACF;AAEA,SAAgB,kCAAkC,UAAkB,QAA6C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mBAAmB,SAAS,KAAK,OAAO;EACjD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,UAAkB,QAA8C;CACjH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,oBAAoB,SAAS,KAAK,OAAO;EAClD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,mCAAmC,aAAmD;CACpG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY;EACjC,MAAM;EACN,MAAM,EAAE,YAAY;CACtB;AACF"}
@@ -27,7 +27,7 @@ function createPluginRootNotFoundDiagnostic(cwd) {
27
27
  return {
28
28
  level: "error",
29
29
  code: "PLUGIN_ROOT_NOT_FOUND",
30
- message: "No uapkg.json found from current directory upward.",
30
+ message: "No uapkg.json found in the current directory or its parent directories.",
31
31
  hint: "Run this command from within a uapkg project.",
32
32
  data: { cwd }
33
33
  };
@@ -37,7 +37,7 @@ function createUnresolvedLfsDiagnostic(filePath) {
37
37
  level: "error",
38
38
  code: "UNRESOLVED_LFS",
39
39
  message: `Unresolved LFS pointer file: ${filePath}.`,
40
- hint: "Run 'git lfs pull' or use --allow-missing-lfs.",
40
+ hint: "Run 'git lfs pull' to download the file, or use --allow-missing-lfs to leave it out of the archive.",
41
41
  data: { filePath }
42
42
  };
43
43
  }
@@ -53,7 +53,7 @@ function createNoFilesSelectedDiagnostic() {
53
53
  return {
54
54
  level: "error",
55
55
  code: "NO_FILES_SELECTED",
56
- message: "No files selected for packing after ignore/LFS resolution.",
56
+ message: "No files remain to pack after applying ignore rules and checking Git LFS files.",
57
57
  data: {}
58
58
  };
59
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PackDiagnostics.js","names":[],"sources":["../../src/pack/PackDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Pack diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Cyclic symlink detected during file crawl. */\nexport type CyclicSymlinkDiagnostic = DiagnosticBase<'CYCLIC_SYMLINK', { readonly filePath: string }>;\n\n/** Symlink resolves outside the plugin root. */\nexport type SymlinkOutsideRootDiagnostic = DiagnosticBase<'SYMLINK_OUTSIDE_ROOT', { readonly filePath: string }>;\n\n/** Path normalization produced an invalid result. */\nexport type InvalidPathDiagnostic = DiagnosticBase<'INVALID_PATH', { readonly filePath: string }>;\n\n/** No uapkg.json found walking upward from cwd. */\nexport type PluginRootNotFoundDiagnostic = DiagnosticBase<'PLUGIN_ROOT_NOT_FOUND', { readonly cwd: string }>;\n\n/** Unresolved LFS pointer file (fatal when --allow-missing-lfs is off). */\nexport type UnresolvedLfsDiagnostic = DiagnosticBase<'UNRESOLVED_LFS', { readonly filePath: string }>;\n\n/** LFS pointer was skipped (warning when --allow-missing-lfs is on). */\nexport type LfsSkippedDiagnostic = DiagnosticBase<'LFS_SKIPPED', { readonly filePath: string }>;\n\n/** No files were selected for packing after filtering. */\nexport type NoFilesSelectedDiagnostic = DiagnosticBase<'NO_FILES_SELECTED', Record<string, never>>;\n\n/** --outFile resolved to a directory instead of a file. */\nexport type OutFileIsDirectoryDiagnostic = DiagnosticBase<'OUTFILE_IS_DIRECTORY', { readonly filePath: string }>;\n\n/** Plugin descriptor (*.uplugin) is required for pack operations. */\nexport type UpluginMissingDiagnostic = DiagnosticBase<'UPLUGIN_MISSING', { readonly pluginRoot: string }>;\n\n/** Union of all pack diagnostics. */\nexport type PackDiagnostic =\n | CyclicSymlinkDiagnostic\n | SymlinkOutsideRootDiagnostic\n | InvalidPathDiagnostic\n | PluginRootNotFoundDiagnostic\n | UnresolvedLfsDiagnostic\n | LfsSkippedDiagnostic\n | NoFilesSelectedDiagnostic\n | OutFileIsDirectoryDiagnostic\n | UpluginMissingDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createCyclicSymlinkDiagnostic(filePath: string): CyclicSymlinkDiagnostic {\n return {\n level: 'error',\n code: 'CYCLIC_SYMLINK',\n message: `Cyclic symlink detected at ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createSymlinkOutsideRootDiagnostic(filePath: string): SymlinkOutsideRootDiagnostic {\n return {\n level: 'error',\n code: 'SYMLINK_OUTSIDE_ROOT',\n message: `Symlink resolves outside plugin root: ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createInvalidPathDiagnostic(filePath: string): InvalidPathDiagnostic {\n return { level: 'error', code: 'INVALID_PATH', message: `Invalid normalized path: ${filePath}.`, data: { filePath } };\n}\n\nexport function createPluginRootNotFoundDiagnostic(cwd: string): PluginRootNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'PLUGIN_ROOT_NOT_FOUND',\n message: 'No uapkg.json found from current directory upward.',\n hint: 'Run this command from within a uapkg project.',\n data: { cwd },\n };\n}\n\nexport function createUnresolvedLfsDiagnostic(filePath: string): UnresolvedLfsDiagnostic {\n return {\n level: 'error',\n code: 'UNRESOLVED_LFS',\n message: `Unresolved LFS pointer file: ${filePath}.`,\n hint: \"Run 'git lfs pull' or use --allow-missing-lfs.\",\n data: { filePath },\n };\n}\n\nexport function createLfsSkippedDiagnostic(filePath: string): LfsSkippedDiagnostic {\n return {\n level: 'warning',\n code: 'LFS_SKIPPED',\n message: `Skipping unresolved LFS file: ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createNoFilesSelectedDiagnostic(): NoFilesSelectedDiagnostic {\n return {\n level: 'error',\n code: 'NO_FILES_SELECTED',\n message: 'No files selected for packing after ignore/LFS resolution.',\n data: {},\n };\n}\n\nexport function createOutFileIsDirectoryDiagnostic(filePath: string): OutFileIsDirectoryDiagnostic {\n return {\n level: 'error',\n code: 'OUTFILE_IS_DIRECTORY',\n message: '--outFile must be a file path, not a directory.',\n data: { filePath },\n };\n}\n\nexport function createUpluginMissingDiagnostic(pluginRoot: string): UpluginMissingDiagnostic {\n return {\n level: 'error',\n code: 'UPLUGIN_MISSING',\n message: `No plugin descriptor (*.uplugin) was found in \"${pluginRoot}\".`,\n hint: 'Ensure your plugin root contains a .uplugin file before running `uapkg pack`.',\n data: { pluginRoot },\n };\n}\n"],"mappings":";AAiDA,SAAgB,8BAA8B,UAA2C;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,SAAS;EAChD,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,mCAAmC,UAAgD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yCAAyC,SAAS;EAC3D,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,4BAA4B,UAAyC;CACnF,OAAO;EAAE,OAAO;EAAS,MAAM;EAAgB,SAAS,4BAA4B,SAAS;EAAI,MAAM,EAAE,SAAS;CAAE;AACtH;AAEA,SAAgB,mCAAmC,KAA2C;CAC5F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM,EAAE,IAAI;CACd;AACF;AAEA,SAAgB,8BAA8B,UAA2C;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gCAAgC,SAAS;EAClD,MAAM;EACN,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,2BAA2B,UAAwC;CACjF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,SAAS;EACnD,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,kCAA6D;CAC3E,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM,CAAC;CACT;AACF;AAEA,SAAgB,mCAAmC,UAAgD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,+BAA+B,YAA8C;CAC3F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kDAAkD,WAAW;EACtE,MAAM;EACN,MAAM,EAAE,WAAW;CACrB;AACF"}
1
+ {"version":3,"file":"PackDiagnostics.js","names":[],"sources":["../../src/pack/PackDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Pack diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Cyclic symlink detected during file crawl. */\nexport type CyclicSymlinkDiagnostic = DiagnosticBase<'CYCLIC_SYMLINK', { readonly filePath: string }>;\n\n/** Symlink resolves outside the plugin root. */\nexport type SymlinkOutsideRootDiagnostic = DiagnosticBase<'SYMLINK_OUTSIDE_ROOT', { readonly filePath: string }>;\n\n/** Path normalization produced an invalid result. */\nexport type InvalidPathDiagnostic = DiagnosticBase<'INVALID_PATH', { readonly filePath: string }>;\n\n/** No uapkg.json found walking upward from cwd. */\nexport type PluginRootNotFoundDiagnostic = DiagnosticBase<'PLUGIN_ROOT_NOT_FOUND', { readonly cwd: string }>;\n\n/** Unresolved LFS pointer file (fatal when --allow-missing-lfs is off). */\nexport type UnresolvedLfsDiagnostic = DiagnosticBase<'UNRESOLVED_LFS', { readonly filePath: string }>;\n\n/** LFS pointer was skipped (warning when --allow-missing-lfs is on). */\nexport type LfsSkippedDiagnostic = DiagnosticBase<'LFS_SKIPPED', { readonly filePath: string }>;\n\n/** No files were selected for packing after filtering. */\nexport type NoFilesSelectedDiagnostic = DiagnosticBase<'NO_FILES_SELECTED', Record<string, never>>;\n\n/** --outFile resolved to a directory instead of a file. */\nexport type OutFileIsDirectoryDiagnostic = DiagnosticBase<'OUTFILE_IS_DIRECTORY', { readonly filePath: string }>;\n\n/** Plugin descriptor (*.uplugin) is required for pack operations. */\nexport type UpluginMissingDiagnostic = DiagnosticBase<'UPLUGIN_MISSING', { readonly pluginRoot: string }>;\n\n/** Union of all pack diagnostics. */\nexport type PackDiagnostic =\n | CyclicSymlinkDiagnostic\n | SymlinkOutsideRootDiagnostic\n | InvalidPathDiagnostic\n | PluginRootNotFoundDiagnostic\n | UnresolvedLfsDiagnostic\n | LfsSkippedDiagnostic\n | NoFilesSelectedDiagnostic\n | OutFileIsDirectoryDiagnostic\n | UpluginMissingDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createCyclicSymlinkDiagnostic(filePath: string): CyclicSymlinkDiagnostic {\n return {\n level: 'error',\n code: 'CYCLIC_SYMLINK',\n message: `Cyclic symlink detected at ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createSymlinkOutsideRootDiagnostic(filePath: string): SymlinkOutsideRootDiagnostic {\n return {\n level: 'error',\n code: 'SYMLINK_OUTSIDE_ROOT',\n message: `Symlink resolves outside plugin root: ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createInvalidPathDiagnostic(filePath: string): InvalidPathDiagnostic {\n return { level: 'error', code: 'INVALID_PATH', message: `Invalid normalized path: ${filePath}.`, data: { filePath } };\n}\n\nexport function createPluginRootNotFoundDiagnostic(cwd: string): PluginRootNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'PLUGIN_ROOT_NOT_FOUND',\n message: 'No uapkg.json found in the current directory or its parent directories.',\n hint: 'Run this command from within a uapkg project.',\n data: { cwd },\n };\n}\n\nexport function createUnresolvedLfsDiagnostic(filePath: string): UnresolvedLfsDiagnostic {\n return {\n level: 'error',\n code: 'UNRESOLVED_LFS',\n message: `Unresolved LFS pointer file: ${filePath}.`,\n hint: \"Run 'git lfs pull' to download the file, or use --allow-missing-lfs to leave it out of the archive.\",\n data: { filePath },\n };\n}\n\nexport function createLfsSkippedDiagnostic(filePath: string): LfsSkippedDiagnostic {\n return {\n level: 'warning',\n code: 'LFS_SKIPPED',\n message: `Skipping unresolved LFS file: ${filePath}.`,\n data: { filePath },\n };\n}\n\nexport function createNoFilesSelectedDiagnostic(): NoFilesSelectedDiagnostic {\n return {\n level: 'error',\n code: 'NO_FILES_SELECTED',\n message: 'No files remain to pack after applying ignore rules and checking Git LFS files.',\n data: {},\n };\n}\n\nexport function createOutFileIsDirectoryDiagnostic(filePath: string): OutFileIsDirectoryDiagnostic {\n return {\n level: 'error',\n code: 'OUTFILE_IS_DIRECTORY',\n message: '--outFile must be a file path, not a directory.',\n data: { filePath },\n };\n}\n\nexport function createUpluginMissingDiagnostic(pluginRoot: string): UpluginMissingDiagnostic {\n return {\n level: 'error',\n code: 'UPLUGIN_MISSING',\n message: `No plugin descriptor (*.uplugin) was found in \"${pluginRoot}\".`,\n hint: 'Ensure your plugin root contains a .uplugin file before running `uapkg pack`.',\n data: { pluginRoot },\n };\n}\n"],"mappings":";AAiDA,SAAgB,8BAA8B,UAA2C;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,SAAS;EAChD,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,mCAAmC,UAAgD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yCAAyC,SAAS;EAC3D,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,4BAA4B,UAAyC;CACnF,OAAO;EAAE,OAAO;EAAS,MAAM;EAAgB,SAAS,4BAA4B,SAAS;EAAI,MAAM,EAAE,SAAS;CAAE;AACtH;AAEA,SAAgB,mCAAmC,KAA2C;CAC5F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM;EACN,MAAM,EAAE,IAAI;CACd;AACF;AAEA,SAAgB,8BAA8B,UAA2C;CACvF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gCAAgC,SAAS;EAClD,MAAM;EACN,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,2BAA2B,UAAwC;CACjF,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,SAAS;EACnD,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,kCAA6D;CAC3E,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM,CAAC;CACT;AACF;AAEA,SAAgB,mCAAmC,UAAgD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS;EACT,MAAM,EAAE,SAAS;CACnB;AACF;AAEA,SAAgB,+BAA+B,YAA8C;CAC3F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kDAAkD,WAAW;EACtE,MAAM;EACN,MAAM,EAAE,WAAW;CACrB;AACF"}
@@ -43,7 +43,7 @@ function createPostinstallDuplicateEntryDiagnostic(packageName, candidates) {
43
43
  level: "error",
44
44
  code: "POSTINSTALL_DUPLICATE_ENTRY",
45
45
  message: `Multiple postinstall entry files found for "${packageName}".`,
46
- hint: "Keep only one of `.uapkg/postinstall.ts|.js|.mjs`.",
46
+ hint: "Keep one entry file: `.uapkg/postinstall.ts`, `.uapkg/postinstall.js`, or `.uapkg/postinstall.mjs`.",
47
47
  data: {
48
48
  packageName,
49
49
  candidates
@@ -68,7 +68,7 @@ function createPostinstallEsbuildErrorDiagnostic(packageName, entryFile, reason)
68
68
  level: "error",
69
69
  code: "POSTINSTALL_ESBUILD_ERROR",
70
70
  message: `esbuild failed on "${entryFile}" for "${packageName}": ${reason}.`,
71
- hint: "Note: uapkg transpiles but does not type-check; fix the file in your IDE.",
71
+ hint: "Fix the script in your editor. UAPKG transpiles it without checking TypeScript types.",
72
72
  data: {
73
73
  packageName,
74
74
  entryFile,
@@ -1 +1 @@
1
- {"version":3,"file":"PostinstallDiagnostics.js","names":[],"sources":["../../src/postinstall/PostinstallDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Postinstall diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Postinstall was denied by policy (install.postInstallPolicy or per-registry override). */\nexport type PostinstallPolicyDeniedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_POLICY_DENIED',\n {\n readonly packageName: string;\n readonly registry: string;\n readonly policy: 'allow' | 'deny';\n readonly resolvedFrom: 'registry' | 'install';\n }\n>;\n\n/** Loading the postinstall module failed (e.g. import error). */\nexport type PostinstallLoadFailedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_LOAD_FAILED',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\n/** The postinstall module's default export failed Zod validation. */\nexport type PostinstallInvalidExportDiagnostic = DiagnosticBase<\n 'POSTINSTALL_INVALID_EXPORT',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** More than one candidate postinstall entry file exists (e.g. both .ts and .js). */\nexport type PostinstallDuplicateEntryDiagnostic = DiagnosticBase<\n 'POSTINSTALL_DUPLICATE_ENTRY',\n {\n readonly packageName: string;\n readonly candidates: readonly string[];\n }\n>;\n\n/** Marker-block in a generated file is corrupt or was edited manually. */\nexport type PostinstallMarkerCorruptDiagnostic = DiagnosticBase<\n 'POSTINSTALL_MARKER_CORRUPT',\n {\n readonly packageName: string;\n readonly file: string;\n readonly reason: string;\n }\n>;\n\n/** esbuild failed to transpile a `.ts` postinstall entry file. */\nexport type PostinstallEsbuildErrorDiagnostic = DiagnosticBase<\n 'POSTINSTALL_ESBUILD_ERROR',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\nexport type PostinstallDiagnostic =\n | PostinstallPolicyDeniedDiagnostic\n | PostinstallLoadFailedDiagnostic\n | PostinstallInvalidExportDiagnostic\n | PostinstallDuplicateEntryDiagnostic\n | PostinstallMarkerCorruptDiagnostic\n | PostinstallEsbuildErrorDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createPostinstallPolicyDeniedDiagnostic(\n packageName: string,\n registry: string,\n policy: 'allow' | 'deny',\n resolvedFrom: 'registry' | 'install',\n): PostinstallPolicyDeniedDiagnostic {\n return {\n level: 'info',\n code: 'POSTINSTALL_POLICY_DENIED',\n message: `Postinstall skipped for \"${packageName}\" (policy=${policy}, from ${resolvedFrom}).`,\n hint:\n resolvedFrom === 'registry'\n ? `Override per-registry via \\`registries.${registry}.postInstallPolicy = \"allow\"\\`.`\n : 'Override globally via `install.postInstallPolicy = \"allow\"` in your uapkg config.',\n data: { packageName, registry, policy, resolvedFrom },\n };\n}\n\nexport function createPostinstallLoadFailedDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallLoadFailedDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_LOAD_FAILED',\n message: `Failed to load postinstall for \"${packageName}\" from \"${entryFile}\": ${reason}.`,\n data: { packageName, entryFile, reason },\n };\n}\n\nexport function createPostinstallInvalidExportDiagnostic(\n packageName: string,\n entryFile: string,\n issues: readonly string[],\n): PostinstallInvalidExportDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_INVALID_EXPORT',\n message: `Postinstall default export for \"${packageName}\" is invalid.`,\n hint: 'Use `definePostinstall({...})` and export the result as default.',\n data: { packageName, entryFile, issues },\n };\n}\n\nexport function createPostinstallDuplicateEntryDiagnostic(\n packageName: string,\n candidates: readonly string[],\n): PostinstallDuplicateEntryDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_DUPLICATE_ENTRY',\n message: `Multiple postinstall entry files found for \"${packageName}\".`,\n hint: 'Keep only one of `.uapkg/postinstall.ts|.js|.mjs`.',\n data: { packageName, candidates },\n };\n}\n\nexport function createPostinstallMarkerCorruptDiagnostic(\n packageName: string,\n file: string,\n reason: string,\n): PostinstallMarkerCorruptDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_MARKER_CORRUPT',\n message: `Postinstall marker block corrupt in \"${file}\" for \"${packageName}\": ${reason}.`,\n hint: 'Restore the UAPKG-BEGIN/END markers or remove them manually and re-run.',\n data: { packageName, file, reason },\n };\n}\n\nexport function createPostinstallEsbuildErrorDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallEsbuildErrorDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_ESBUILD_ERROR',\n message: `esbuild failed on \"${entryFile}\" for \"${packageName}\": ${reason}.`,\n hint: 'Note: uapkg transpiles but does not type-check; fix the file in your IDE.',\n data: { packageName, entryFile, reason },\n };\n}\n"],"mappings":";AA8EA,SAAgB,wCACd,aACA,UACA,QACA,cACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,YAAY,YAAY,OAAO,SAAS,aAAa;EAC1F,MACE,iBAAiB,aACb,0CAA0C,SAAS,mCACnD;EACN,MAAM;GAAE;GAAa;GAAU;GAAQ;EAAa;CACtD;AACF;AAEA,SAAgB,sCACd,aACA,WACA,QACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY,UAAU,UAAU,KAAK,OAAO;EACxF,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,yCACd,aACA,WACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY;EACxD,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,0CACd,aACA,YACqC;CACrC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,+CAA+C,YAAY;EACpE,MAAM;EACN,MAAM;GAAE;GAAa;EAAW;CAClC;AACF;AAEA,SAAgB,yCACd,aACA,MACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,wCAAwC,KAAK,SAAS,YAAY,KAAK,OAAO;EACvF,MAAM;EACN,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,wCACd,aACA,WACA,QACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,SAAS,YAAY,KAAK,OAAO;EAC1E,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF"}
1
+ {"version":3,"file":"PostinstallDiagnostics.js","names":[],"sources":["../../src/postinstall/PostinstallDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Postinstall diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Postinstall was denied by policy (install.postInstallPolicy or per-registry override). */\nexport type PostinstallPolicyDeniedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_POLICY_DENIED',\n {\n readonly packageName: string;\n readonly registry: string;\n readonly policy: 'allow' | 'deny';\n readonly resolvedFrom: 'registry' | 'install';\n }\n>;\n\n/** Loading the postinstall module failed (e.g. import error). */\nexport type PostinstallLoadFailedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_LOAD_FAILED',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\n/** The postinstall module's default export failed Zod validation. */\nexport type PostinstallInvalidExportDiagnostic = DiagnosticBase<\n 'POSTINSTALL_INVALID_EXPORT',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** More than one candidate postinstall entry file exists (e.g. both .ts and .js). */\nexport type PostinstallDuplicateEntryDiagnostic = DiagnosticBase<\n 'POSTINSTALL_DUPLICATE_ENTRY',\n {\n readonly packageName: string;\n readonly candidates: readonly string[];\n }\n>;\n\n/** Marker-block in a generated file is corrupt or was edited manually. */\nexport type PostinstallMarkerCorruptDiagnostic = DiagnosticBase<\n 'POSTINSTALL_MARKER_CORRUPT',\n {\n readonly packageName: string;\n readonly file: string;\n readonly reason: string;\n }\n>;\n\n/** esbuild failed to transpile a `.ts` postinstall entry file. */\nexport type PostinstallEsbuildErrorDiagnostic = DiagnosticBase<\n 'POSTINSTALL_ESBUILD_ERROR',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\nexport type PostinstallDiagnostic =\n | PostinstallPolicyDeniedDiagnostic\n | PostinstallLoadFailedDiagnostic\n | PostinstallInvalidExportDiagnostic\n | PostinstallDuplicateEntryDiagnostic\n | PostinstallMarkerCorruptDiagnostic\n | PostinstallEsbuildErrorDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createPostinstallPolicyDeniedDiagnostic(\n packageName: string,\n registry: string,\n policy: 'allow' | 'deny',\n resolvedFrom: 'registry' | 'install',\n): PostinstallPolicyDeniedDiagnostic {\n return {\n level: 'info',\n code: 'POSTINSTALL_POLICY_DENIED',\n message: `Postinstall skipped for \"${packageName}\" (policy=${policy}, from ${resolvedFrom}).`,\n hint:\n resolvedFrom === 'registry'\n ? `Override per-registry via \\`registries.${registry}.postInstallPolicy = \"allow\"\\`.`\n : 'Override globally via `install.postInstallPolicy = \"allow\"` in your uapkg config.',\n data: { packageName, registry, policy, resolvedFrom },\n };\n}\n\nexport function createPostinstallLoadFailedDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallLoadFailedDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_LOAD_FAILED',\n message: `Failed to load postinstall for \"${packageName}\" from \"${entryFile}\": ${reason}.`,\n data: { packageName, entryFile, reason },\n };\n}\n\nexport function createPostinstallInvalidExportDiagnostic(\n packageName: string,\n entryFile: string,\n issues: readonly string[],\n): PostinstallInvalidExportDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_INVALID_EXPORT',\n message: `Postinstall default export for \"${packageName}\" is invalid.`,\n hint: 'Use `definePostinstall({...})` and export the result as default.',\n data: { packageName, entryFile, issues },\n };\n}\n\nexport function createPostinstallDuplicateEntryDiagnostic(\n packageName: string,\n candidates: readonly string[],\n): PostinstallDuplicateEntryDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_DUPLICATE_ENTRY',\n message: `Multiple postinstall entry files found for \"${packageName}\".`,\n hint: 'Keep one entry file: `.uapkg/postinstall.ts`, `.uapkg/postinstall.js`, or `.uapkg/postinstall.mjs`.',\n data: { packageName, candidates },\n };\n}\n\nexport function createPostinstallMarkerCorruptDiagnostic(\n packageName: string,\n file: string,\n reason: string,\n): PostinstallMarkerCorruptDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_MARKER_CORRUPT',\n message: `Postinstall marker block corrupt in \"${file}\" for \"${packageName}\": ${reason}.`,\n hint: 'Restore the UAPKG-BEGIN/END markers or remove them manually and re-run.',\n data: { packageName, file, reason },\n };\n}\n\nexport function createPostinstallEsbuildErrorDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallEsbuildErrorDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_ESBUILD_ERROR',\n message: `esbuild failed on \"${entryFile}\" for \"${packageName}\": ${reason}.`,\n hint: 'Fix the script in your editor. UAPKG transpiles it without checking TypeScript types.',\n data: { packageName, entryFile, reason },\n };\n}\n"],"mappings":";AA8EA,SAAgB,wCACd,aACA,UACA,QACA,cACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,YAAY,YAAY,OAAO,SAAS,aAAa;EAC1F,MACE,iBAAiB,aACb,0CAA0C,SAAS,mCACnD;EACN,MAAM;GAAE;GAAa;GAAU;GAAQ;EAAa;CACtD;AACF;AAEA,SAAgB,sCACd,aACA,WACA,QACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY,UAAU,UAAU,KAAK,OAAO;EACxF,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,yCACd,aACA,WACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY;EACxD,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,0CACd,aACA,YACqC;CACrC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,+CAA+C,YAAY;EACpE,MAAM;EACN,MAAM;GAAE;GAAa;EAAW;CAClC;AACF;AAEA,SAAgB,yCACd,aACA,MACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,wCAAwC,KAAK,SAAS,YAAY,KAAK,OAAO;EACvF,MAAM;EACN,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,wCACd,aACA,WACA,QACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,SAAS,YAAY,KAAK,OAAO;EAC1E,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"PublishingDiagnostics.js","names":[],"sources":["../../src/publishing/PublishingDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n/**\n * Safe, user-facing context for a failed publish request. The fixed set of\n * kinds prevents arbitrary control-plane details from leaking into output.\n */\nexport type PublishDiagnosticFact =\n | { readonly kind: 'package'; readonly value: string }\n | { readonly kind: 'version'; readonly value: string }\n | { readonly kind: 'registry'; readonly value: string }\n | { readonly kind: 'credential-kind'; readonly value: string }\n | { readonly kind: 'requested-owner'; readonly value: string }\n | { readonly kind: 'token-owner'; readonly value: string }\n | { readonly kind: 'allowed-owner'; readonly value: string }\n | { readonly kind: 'actual-access-mode'; readonly value: string }\n | { readonly kind: 'required-access-mode'; readonly value: string }\n | { readonly kind: 'repository'; readonly value: string }\n | { readonly kind: 'requested-repository'; readonly value: string }\n | { readonly kind: 'trusted-repository'; readonly value: string }\n | { readonly kind: 'request-id'; readonly value: string }\n | { readonly kind: 'retry-after'; readonly value: string }\n | { readonly kind: 'missing-capability'; readonly value: string };\n\n/** A CLI command or account page that can help resolve a publish failure. */\nexport type PublishDiagnosticResource =\n | {\n readonly kind: 'command';\n readonly command: string;\n readonly label?: string;\n }\n | {\n readonly kind: 'url';\n readonly url: string;\n readonly label?: string;\n };\n\nexport interface PublishRequestFailedDiagnosticData {\n /** Stable control-plane error code, when a response was received. */\n readonly serverCode?: string;\n /** HTTP response status, when a response was received. */\n readonly status?: number;\n /** Validated facts that are safe to show to the user. */\n readonly facts: readonly PublishDiagnosticFact[];\n /** Commands and account pages that can help the user recover. */\n readonly resources: readonly PublishDiagnosticResource[];\n}\n\nexport type PublishRequestFailedDiagnostic = DiagnosticBase<\n 'PUBLISH_REQUEST_FAILED',\n PublishRequestFailedDiagnosticData\n>;\n\nexport type PublishingDiagnostic = PublishRequestFailedDiagnostic;\n\nexport function createPublishRequestFailedDiagnostic(\n message: string,\n data: PublishRequestFailedDiagnosticData,\n hint?: string,\n): PublishRequestFailedDiagnostic {\n return {\n level: 'error',\n code: 'PUBLISH_REQUEST_FAILED',\n message,\n hint,\n data,\n };\n}\n"],"mappings":";AAsDA,SAAgB,qCACd,SACA,MACA,MACgC;CAChC,OAAO;EACL,OAAO;EACP,MAAM;EACN;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"PublishingDiagnostics.js","names":[],"sources":["../../src/publishing/PublishingDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n/**\n * Safe, user-facing context for a failed publish request. The fixed set of\n * kinds prevents arbitrary control-plane details from leaking into output.\n */\nexport type PublishDiagnosticFact =\n | { readonly kind: 'package'; readonly value: string }\n | { readonly kind: 'version'; readonly value: string }\n | { readonly kind: 'registry'; readonly value: string }\n | { readonly kind: 'credential-kind'; readonly value: string }\n | { readonly kind: 'requested-owner'; readonly value: string }\n | { readonly kind: 'token-owner'; readonly value: string }\n | { readonly kind: 'allowed-owner'; readonly value: string }\n | { readonly kind: 'actual-access-mode'; readonly value: string }\n | { readonly kind: 'required-access-mode'; readonly value: string }\n | { readonly kind: 'repository'; readonly value: string }\n | { readonly kind: 'requested-repository'; readonly value: string }\n | { readonly kind: 'trusted-repository'; readonly value: string }\n | { readonly kind: 'request-id'; readonly value: string }\n | { readonly kind: 'retry-after'; readonly value: string }\n | { readonly kind: 'missing-capability'; readonly value: string };\n\n/** A CLI command or account page that can help resolve a publish failure. */\nexport type PublishDiagnosticResource =\n | {\n readonly kind: 'command';\n readonly command: string;\n readonly label?: string;\n }\n | {\n readonly kind: 'url';\n readonly url: string;\n readonly label?: string;\n };\n\nexport interface PublishRequestFailedDiagnosticData {\n /** Stable control-plane error code, when a response was received. */\n readonly serverCode?: string;\n /** HTTP response status, when a response was received. */\n readonly status?: number;\n /** Validated facts that are safe to show to the user. */\n readonly facts: readonly PublishDiagnosticFact[];\n /** Commands and account pages that can help the user recover. */\n readonly resources: readonly PublishDiagnosticResource[];\n}\n\nexport type PublishRequestFailedDiagnostic = DiagnosticBase<\n 'PUBLISH_REQUEST_FAILED',\n PublishRequestFailedDiagnosticData\n>;\n\nexport type PublishingDiagnostic = PublishRequestFailedDiagnostic;\n\nexport function createPublishRequestFailedDiagnostic(\n message: string,\n data: PublishRequestFailedDiagnosticData,\n hint?: string,\n): PublishRequestFailedDiagnostic {\n return {\n level: 'error',\n code: 'PUBLISH_REQUEST_FAILED',\n message,\n hint,\n data,\n };\n}\n"],"mappings":";AAsDA,SAAgB,qCACd,SACA,MACA,MACgC;CAChC,OAAO;EACL,OAAO;EACP,MAAM;EACN;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryDiagnostics.js","names":[],"sources":["../../src/registry/RegistryDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Registry diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** A network-level error when communicating with a registry. */\nexport type NetworkErrorDiagnostic = DiagnosticBase<\n 'NETWORK_ERROR',\n {\n readonly url: string;\n readonly reason: string;\n }\n>;\n\n/** A git operation failed. */\nexport type GitErrorDiagnostic = DiagnosticBase<\n 'GIT_ERROR',\n {\n readonly command: string;\n readonly stderr: string;\n readonly exitCode: number;\n }\n>;\n\n/** A registry document did not pass schema validation. */\nexport type SchemaInvalidDiagnostic = DiagnosticBase<\n 'SCHEMA_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** A referenced registry name is not found in configuration. */\nexport type RegistryNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_NOT_FOUND',\n {\n readonly registryName: string;\n }\n>;\n\n/** Failed to acquire the registry update lock. */\nexport type LockAcquisitionFailedDiagnostic = DiagnosticBase<\n 'LOCK_ACQUISITION_FAILED',\n {\n readonly lockPath: string;\n readonly ownerPid: number;\n }\n>;\n\n/** Registry cache could not be read. */\nexport type CacheReadErrorDiagnostic = DiagnosticBase<\n 'CACHE_READ_ERROR',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** Registry cache state is internally inconsistent or malformed. */\nexport type CacheCorruptDiagnostic = DiagnosticBase<\n 'CACHE_CORRUPT',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** A shortened cache path belongs to a different full registry identifier. */\nexport type CacheIdentifierCollisionDiagnostic = DiagnosticBase<\n 'CACHE_IDENTIFIER_COLLISION',\n {\n readonly cachePath: string;\n readonly expectedIdentifier: string;\n readonly actualIdentifier: string;\n }\n>;\n\n/** Registry could not be reached, optionally with cached state available. */\nexport type RegistryUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_UNREACHABLE',\n {\n readonly registryName: string;\n readonly url: string;\n readonly httpStatus?: number;\n readonly cause: string;\n readonly initialized: boolean;\n }\n>;\n\n/** Union of all registry diagnostics. */\nexport type RegistryDiagnostic =\n | NetworkErrorDiagnostic\n | GitErrorDiagnostic\n | SchemaInvalidDiagnostic\n | RegistryNotFoundDiagnostic\n | LockAcquisitionFailedDiagnostic\n | CacheReadErrorDiagnostic\n | CacheCorruptDiagnostic\n | CacheIdentifierCollisionDiagnostic\n | RegistryUnreachableDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createNetworkErrorDiagnostic(url: string, reason: string): NetworkErrorDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_ERROR',\n message: `Network error for \"${url}\": ${reason}.`,\n hint: 'Check your network connection and retry.',\n data: { url, reason },\n };\n}\n\nexport function createGitErrorDiagnostic(command: string, stderr: string, exitCode: number): GitErrorDiagnostic {\n return {\n level: 'error',\n code: 'GIT_ERROR',\n message: `Git command failed (exit ${exitCode}): ${command}.`,\n hint: 'Ensure git is installed and the registry URL is reachable.',\n data: { command, stderr, exitCode },\n };\n}\n\nexport function createSchemaInvalidDiagnostic(filePath: string, issues: readonly string[]): SchemaInvalidDiagnostic {\n return {\n level: 'error',\n code: 'SCHEMA_INVALID',\n message: `Schema validation failed for \"${filePath}\".`,\n hint: 'Review the file against the expected schema.',\n data: { filePath, issues },\n };\n}\n\nexport function createRegistryNotFoundDiagnostic(registryName: string): RegistryNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'REGISTRY_NOT_FOUND',\n message: `Registry \"${registryName}\" is not defined in configuration.`,\n hint: `Add the registry. Example:\n uapkg registry add ${registryName} https://registry.example.com\n\nOr configure manually:\n uapkg config set registries.${registryName}.url https://registry.example.com\n uapkg config set registries.${registryName}.ref.type branch\n uapkg config set registries.${registryName}.ref.value main`,\n data: { registryName },\n };\n}\n\nexport function createLockAcquisitionFailedDiagnostic(\n lockPath: string,\n ownerPid: number,\n): LockAcquisitionFailedDiagnostic {\n return {\n level: 'error',\n code: 'LOCK_ACQUISITION_FAILED',\n message: `Could not acquire registry lock at \"${lockPath}\" (held by PID ${ownerPid}).`,\n hint: 'Another uapkg process may be updating this registry. Wait or remove the stale lock.',\n data: { lockPath, ownerPid },\n };\n}\n\nexport function createCacheReadErrorDiagnostic(cachePath: string, reason: string): CacheReadErrorDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_READ_ERROR',\n message: `Failed to read registry cache at \"${cachePath}\": ${reason}.`,\n hint: 'The cache may be corrupted. Try running `uapkg update` to refresh.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheCorruptDiagnostic(cachePath: string, reason: string): CacheCorruptDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_CORRUPT',\n message: `Registry cache at \"${cachePath}\" is corrupt: ${reason}.`,\n hint: 'Remove this registry cache directory and retry. Registry caches contain only disposable local data.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheIdentifierCollisionDiagnostic(\n cachePath: string,\n expectedIdentifier: string,\n actualIdentifier: string,\n): CacheIdentifierCollisionDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_IDENTIFIER_COLLISION',\n message: `Registry cache identifier collision at \"${cachePath}\".`,\n hint: 'Remove this registry cache directory and retry. If the collision recurs, report it to the uapkg maintainers.',\n data: { cachePath, expectedIdentifier, actualIdentifier },\n };\n}\n\nexport function createRegistryUnreachableDiagnostic(input: {\n readonly registryName: string;\n readonly url: string;\n readonly cause: string;\n readonly initialized: boolean;\n readonly httpStatus?: number;\n readonly level?: 'error' | 'warning';\n}): RegistryUnreachableDiagnostic {\n return {\n level: input.level ?? (input.initialized ? 'warning' : 'error'),\n code: 'REGISTRY_UNREACHABLE',\n message: `The \"${input.registryName}\" registry could not be reached at ${input.url}.`,\n emitPolicy: 'once',\n hint: `Verify the registry URL with 'uapkg config get registries.${input.registryName}.url --trace'.\nThe registry may also be temporarily unavailable.`,\n data: {\n registryName: input.registryName,\n url: input.url,\n cause: input.cause,\n initialized: input.initialized,\n httpStatus: input.httpStatus,\n },\n };\n}\n"],"mappings":";AA2GA,SAAgB,6BAA6B,KAAa,QAAwC;CAChG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,IAAI,KAAK,OAAO;EAC/C,MAAM;EACN,MAAM;GAAE;GAAK;EAAO;CACtB;AACF;AAEA,SAAgB,yBAAyB,SAAiB,QAAgB,UAAsC;CAC9G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,SAAS,KAAK,QAAQ;EAC3D,MAAM;EACN,MAAM;GAAE;GAAS;GAAQ;EAAS;CACpC;AACF;AAEA,SAAgB,8BAA8B,UAAkB,QAAoD;CAClH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,SAAS;EACnD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,iCAAiC,cAAkD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,aAAa,aAAa;EACnC,MAAM;uBACa,aAAa;;;gCAGJ,aAAa;gCACb,aAAa;gCACb,aAAa;EACzC,MAAM,EAAE,aAAa;CACvB;AACF;AAEA,SAAgB,sCACd,UACA,UACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,uCAAuC,SAAS,iBAAiB,SAAS;EACnF,MAAM;EACN,MAAM;GAAE;GAAU;EAAS;CAC7B;AACF;AAEA,SAAgB,+BAA+B,WAAmB,QAA0C;CAC1G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qCAAqC,UAAU,KAAK,OAAO;EACpE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,6BAA6B,WAAmB,QAAwC;CACtG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,gBAAgB,OAAO;EAChE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,yCACd,WACA,oBACA,kBACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2CAA2C,UAAU;EAC9D,MAAM;EACN,MAAM;GAAE;GAAW;GAAoB;EAAiB;CAC1D;AACF;AAEA,SAAgB,oCAAoC,OAOlB;CAChC,OAAO;EACL,OAAO,MAAM,UAAU,MAAM,cAAc,YAAY;EACvD,MAAM;EACN,SAAS,QAAQ,MAAM,aAAa,qCAAqC,MAAM,IAAI;EACnF,YAAY;EACZ,MAAM,6DAA6D,MAAM,aAAa;;EAEtF,MAAM;GACJ,cAAc,MAAM;GACpB,KAAK,MAAM;GACX,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,YAAY,MAAM;EACpB;CACF;AACF"}
1
+ {"version":3,"file":"RegistryDiagnostics.js","names":[],"sources":["../../src/registry/RegistryDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Registry diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** A network-level error when communicating with a registry. */\nexport type NetworkErrorDiagnostic = DiagnosticBase<\n 'NETWORK_ERROR',\n {\n readonly url: string;\n readonly reason: string;\n }\n>;\n\n/** A git operation failed. */\nexport type GitErrorDiagnostic = DiagnosticBase<\n 'GIT_ERROR',\n {\n readonly command: string;\n readonly stderr: string;\n readonly exitCode: number;\n }\n>;\n\n/** A registry document did not pass schema validation. */\nexport type SchemaInvalidDiagnostic = DiagnosticBase<\n 'SCHEMA_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** A referenced registry name is not found in configuration. */\nexport type RegistryNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_NOT_FOUND',\n {\n readonly registryName: string;\n }\n>;\n\n/** Failed to acquire the registry update lock. */\nexport type LockAcquisitionFailedDiagnostic = DiagnosticBase<\n 'LOCK_ACQUISITION_FAILED',\n {\n readonly lockPath: string;\n readonly ownerPid: number;\n }\n>;\n\n/** Registry cache could not be read. */\nexport type CacheReadErrorDiagnostic = DiagnosticBase<\n 'CACHE_READ_ERROR',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** Registry cache state is internally inconsistent or malformed. */\nexport type CacheCorruptDiagnostic = DiagnosticBase<\n 'CACHE_CORRUPT',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** A shortened cache path belongs to a different full registry identifier. */\nexport type CacheIdentifierCollisionDiagnostic = DiagnosticBase<\n 'CACHE_IDENTIFIER_COLLISION',\n {\n readonly cachePath: string;\n readonly expectedIdentifier: string;\n readonly actualIdentifier: string;\n }\n>;\n\n/** Registry could not be reached, optionally with cached state available. */\nexport type RegistryUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_UNREACHABLE',\n {\n readonly registryName: string;\n readonly url: string;\n readonly httpStatus?: number;\n readonly cause: string;\n readonly initialized: boolean;\n }\n>;\n\n/** Union of all registry diagnostics. */\nexport type RegistryDiagnostic =\n | NetworkErrorDiagnostic\n | GitErrorDiagnostic\n | SchemaInvalidDiagnostic\n | RegistryNotFoundDiagnostic\n | LockAcquisitionFailedDiagnostic\n | CacheReadErrorDiagnostic\n | CacheCorruptDiagnostic\n | CacheIdentifierCollisionDiagnostic\n | RegistryUnreachableDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createNetworkErrorDiagnostic(url: string, reason: string): NetworkErrorDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_ERROR',\n message: `Network error for \"${url}\": ${reason}.`,\n hint: 'Check your network connection and retry.',\n data: { url, reason },\n };\n}\n\nexport function createGitErrorDiagnostic(command: string, stderr: string, exitCode: number): GitErrorDiagnostic {\n return {\n level: 'error',\n code: 'GIT_ERROR',\n message: `Git command failed (exit ${exitCode}): ${command}.`,\n hint: 'Ensure git is installed and the registry URL is reachable.',\n data: { command, stderr, exitCode },\n };\n}\n\nexport function createSchemaInvalidDiagnostic(filePath: string, issues: readonly string[]): SchemaInvalidDiagnostic {\n return {\n level: 'error',\n code: 'SCHEMA_INVALID',\n message: `Schema validation failed for \"${filePath}\".`,\n hint: 'Review the file against the expected schema.',\n data: { filePath, issues },\n };\n}\n\nexport function createRegistryNotFoundDiagnostic(registryName: string): RegistryNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'REGISTRY_NOT_FOUND',\n message: `Registry \"${registryName}\" is not defined in configuration.`,\n hint: `Add the registry. Example:\n uapkg registry add ${registryName} https://registry.example.com\n\nOr configure manually:\n uapkg config set registries.${registryName}.url https://registry.example.com\n uapkg config set registries.${registryName}.ref.type branch\n uapkg config set registries.${registryName}.ref.value main`,\n data: { registryName },\n };\n}\n\nexport function createLockAcquisitionFailedDiagnostic(\n lockPath: string,\n ownerPid: number,\n): LockAcquisitionFailedDiagnostic {\n return {\n level: 'error',\n code: 'LOCK_ACQUISITION_FAILED',\n message: `Could not acquire registry lock at \"${lockPath}\" (held by PID ${ownerPid}).`,\n hint: 'Another uapkg process may be updating this registry. Wait or remove the stale lock.',\n data: { lockPath, ownerPid },\n };\n}\n\nexport function createCacheReadErrorDiagnostic(cachePath: string, reason: string): CacheReadErrorDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_READ_ERROR',\n message: `Failed to read registry cache at \"${cachePath}\": ${reason}.`,\n hint: 'The cache may be corrupted. Try running `uapkg update` to refresh.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheCorruptDiagnostic(cachePath: string, reason: string): CacheCorruptDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_CORRUPT',\n message: `Registry cache at \"${cachePath}\" is corrupt: ${reason}.`,\n hint: 'Remove this registry cache directory and retry. Registry caches contain only disposable local data.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheIdentifierCollisionDiagnostic(\n cachePath: string,\n expectedIdentifier: string,\n actualIdentifier: string,\n): CacheIdentifierCollisionDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_IDENTIFIER_COLLISION',\n message: `Registry cache identifier collision at \"${cachePath}\".`,\n hint: 'Remove this registry cache directory and retry. If the collision recurs, report it to the uapkg maintainers.',\n data: { cachePath, expectedIdentifier, actualIdentifier },\n };\n}\n\nexport function createRegistryUnreachableDiagnostic(input: {\n readonly registryName: string;\n readonly url: string;\n readonly cause: string;\n readonly initialized: boolean;\n readonly httpStatus?: number;\n readonly level?: 'error' | 'warning';\n}): RegistryUnreachableDiagnostic {\n return {\n level: input.level ?? (input.initialized ? 'warning' : 'error'),\n code: 'REGISTRY_UNREACHABLE',\n message: `The \"${input.registryName}\" registry could not be reached at ${input.url}.`,\n emitPolicy: 'once',\n hint: `Verify the registry URL with 'uapkg config get registries.${input.registryName}.url --trace'.\nThe registry may also be temporarily unavailable.`,\n data: {\n registryName: input.registryName,\n url: input.url,\n cause: input.cause,\n initialized: input.initialized,\n httpStatus: input.httpStatus,\n },\n };\n}\n"],"mappings":";AA2GA,SAAgB,6BAA6B,KAAa,QAAwC;CAChG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,IAAI,KAAK,OAAO;EAC/C,MAAM;EACN,MAAM;GAAE;GAAK;EAAO;CACtB;AACF;AAEA,SAAgB,yBAAyB,SAAiB,QAAgB,UAAsC;CAC9G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,SAAS,KAAK,QAAQ;EAC3D,MAAM;EACN,MAAM;GAAE;GAAS;GAAQ;EAAS;CACpC;AACF;AAEA,SAAgB,8BAA8B,UAAkB,QAAoD;CAClH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,SAAS;EACnD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,iCAAiC,cAAkD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,aAAa,aAAa;EACnC,MAAM;uBACa,aAAa;;;gCAGJ,aAAa;gCACb,aAAa;gCACb,aAAa;EACzC,MAAM,EAAE,aAAa;CACvB;AACF;AAEA,SAAgB,sCACd,UACA,UACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,uCAAuC,SAAS,iBAAiB,SAAS;EACnF,MAAM;EACN,MAAM;GAAE;GAAU;EAAS;CAC7B;AACF;AAEA,SAAgB,+BAA+B,WAAmB,QAA0C;CAC1G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qCAAqC,UAAU,KAAK,OAAO;EACpE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,6BAA6B,WAAmB,QAAwC;CACtG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,gBAAgB,OAAO;EAChE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,yCACd,WACA,oBACA,kBACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2CAA2C,UAAU;EAC9D,MAAM;EACN,MAAM;GAAE;GAAW;GAAoB;EAAiB;CAC1D;AACF;AAEA,SAAgB,oCAAoC,OAOlB;CAChC,OAAO;EACL,OAAO,MAAM,UAAU,MAAM,cAAc,YAAY;EACvD,MAAM;EACN,SAAS,QAAQ,MAAM,aAAa,qCAAqC,MAAM,IAAI;EACnF,YAAY;EACZ,MAAM,6DAA6D,MAAM,aAAa;;EAEtF,MAAM;GACJ,cAAc,MAAM;GACpB,KAAK,MAAM;GACX,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,YAAY,MAAM;EACpB;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryToolsDiagnostics.js","names":[],"sources":["../../src/registryTools/RegistryToolsDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Registry-tools diagnostic codes\n//\n// Emitted by `@uapkg/registry-tools` when authoring, validating, or linting a\n// registry repo. All diagnostics in this family default to `emitPolicy: 'once'`\n// so plan-then-apply flows do not double-report the same issue.\n// ---------------------------------------------------------------------------\n\n/** Package name does not match its on-disk manifest path. */\nexport type RegistryToolsPathMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n {\n readonly packageName: string;\n readonly expectedPath: string;\n readonly actualPath: string;\n }\n>;\n\n/** Existing package manifest declares a different `packageSource` than the request. */\nexport type RegistryToolsPackageSourceMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n {\n readonly packageName: string;\n readonly existing: { readonly type: string; readonly url: string };\n readonly requested: { readonly type: string; readonly url: string };\n }\n>;\n\n/** A version already exists and `overwriteExistingVersion` was not set. */\nexport type RegistryToolsVersionExistsDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Requested version was not found on the package. */\nexport type RegistryToolsVersionNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Package manifest is missing and was not allowed to be created. */\nexport type RegistryToolsPackageMissingDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n {\n readonly packageName: string;\n readonly manifestPath: string;\n }\n>;\n\n/** Versions in a manifest are not sorted newest-first by SemVer. */\nexport type RegistryToolsVersionsUnsortedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n {\n readonly packageName: string;\n readonly actual: readonly string[];\n readonly expected: readonly string[];\n }\n>;\n\n/** External-registry dependency is forbidden by policy. */\nexport type RegistryToolsExternalRegistryDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** External-registry dependency uses a registry name not in the allow-list. */\nexport type RegistryToolsExternalRegistryNotAllowedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly allowList: readonly string[];\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** A required (non-external) dependency is not present in this registry. */\nexport type RegistryToolsDependencyNotInRegistryDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n }\n>;\n\n/** A dependency version range cannot be satisfied by any version in the registry. */\nexport type RegistryToolsDependencyRangeUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly range: string;\n readonly availableVersions: readonly string[];\n }\n>;\n\n/** A removal was attempted but disallowed by policy. */\nexport type RegistryToolsRemovalDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n {\n readonly kind: 'version' | 'package';\n readonly packageName: string;\n readonly version?: string;\n readonly policy: string;\n }\n>;\n\n/** A computed integrity does not match an expected integrity. */\nexport type RegistryToolsIntegrityMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n {\n readonly filePath: string;\n readonly expectedHash: string;\n readonly actualHash: string;\n readonly expectedSize: number;\n readonly actualSize: number;\n }\n>;\n\n/** A release file name does not match an accepted pattern. */\nexport type RegistryToolsReleaseFileNameInvalidDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n {\n readonly packageName: string;\n readonly version: string;\n readonly fileName: string;\n readonly accepted: readonly string[];\n }\n>;\n\n/** Generic violation surfaced by the official-registry policy validator. */\nexport type RegistryToolsOfficialPolicyViolationDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n {\n readonly rule: string;\n readonly detail: string;\n readonly path?: string;\n }\n>;\n\n/** An unrecognized top-level or nested key was found in a registry manifest. */\nexport type RegistryToolsUnknownKeyDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n {\n readonly path: string;\n readonly key: string;\n }\n>;\n\n/** Union of all registry-tools diagnostics. */\nexport type RegistryToolsDiagnostic =\n | RegistryToolsPathMismatchDiagnostic\n | RegistryToolsPackageSourceMismatchDiagnostic\n | RegistryToolsVersionExistsDiagnostic\n | RegistryToolsVersionNotFoundDiagnostic\n | RegistryToolsPackageMissingDiagnostic\n | RegistryToolsVersionsUnsortedDiagnostic\n | RegistryToolsExternalRegistryDeniedDiagnostic\n | RegistryToolsExternalRegistryNotAllowedDiagnostic\n | RegistryToolsDependencyNotInRegistryDiagnostic\n | RegistryToolsDependencyRangeUnreachableDiagnostic\n | RegistryToolsRemovalDeniedDiagnostic\n | RegistryToolsIntegrityMismatchDiagnostic\n | RegistryToolsReleaseFileNameInvalidDiagnostic\n | RegistryToolsOfficialPolicyViolationDiagnostic\n | RegistryToolsUnknownKeyDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nimport { createDiagnostic } from '../base/Diagnostic.js';\n\nconst ONCE = { emitPolicy: 'once' as const };\n\nexport function createRegistryToolsPathMismatchDiagnostic(\n packageName: string,\n expectedPath: string,\n actualPath: string,\n): RegistryToolsPathMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n 'error',\n `Package \"${packageName}\" was found at \"${actualPath}\" but should live at \"${expectedPath}\".`,\n { packageName, expectedPath, actualPath },\n 'Move the manifest to packages/{first-letter}/{name}.json or correct the package name.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageSourceMismatchDiagnostic(\n packageName: string,\n existing: { readonly type: string; readonly url: string },\n requested: { readonly type: string; readonly url: string },\n): RegistryToolsPackageSourceMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n 'error',\n `Package \"${packageName}\" already declares a different packageSource (${existing.type}:${existing.url}); ` +\n `the request used (${requested.type}:${requested.url}).`,\n { packageName, existing, requested },\n 'Either update the request to match the existing source, or remove and re-create the package intentionally.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionExistsDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionExistsDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n 'error',\n `Version \"${version}\" already exists for package \"${packageName}\".`,\n { packageName, version },\n 'Pass `overwriteExistingVersion: true` to replace it, or publish a new version.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionNotFoundDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionNotFoundDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n 'error',\n `Version \"${version}\" was not found for package \"${packageName}\".`,\n { packageName, version },\n 'Use `listVersions` to see the available versions.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageMissingDiagnostic(\n packageName: string,\n manifestPath: string,\n): RegistryToolsPackageMissingDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n 'error',\n `Package manifest for \"${packageName}\" was not found at \"${manifestPath}\".`,\n { packageName, manifestPath },\n 'Pass `createPackageManifestIfMissing: true` on the add request to create it.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionsUnsortedDiagnostic(\n packageName: string,\n actual: readonly string[],\n expected: readonly string[],\n): RegistryToolsVersionsUnsortedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n 'warning',\n `Versions on package \"${packageName}\" are not sorted newest-first.`,\n { packageName, actual, expected },\n 'Re-write the manifest. Registry tools sorts versions newest-first by SemVer.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryDeniedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryDeniedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", but external registries are denied by policy.`,\n args,\n 'Set `policy.externalRegistries` to `allow-listed` or `allow-any` if cross-registry dependencies are intended.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryNotAllowedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryNotAllowedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryNotAllowedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", which is not in the allow-list [${args.allowList.join(', ')}].`,\n args,\n 'Add the registry name to `policy.allowedExternalRegistryNames` or remove the dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyNotInRegistryDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n): RegistryToolsDependencyNotInRegistryDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n 'error',\n `Dependency \"${dependency}\" of \"${packageName}@${version}\" is not present in this registry.`,\n { packageName, version, dependency },\n 'Publish the dependency first, or mark it as an external-registry dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyRangeUnreachableDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n range: string,\n availableVersions: readonly string[],\n): RegistryToolsDependencyRangeUnreachableDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n 'error',\n `Dependency \"${dependency}@${range}\" of \"${packageName}@${version}\" cannot be satisfied by any published version.`,\n { packageName, version, dependency, range, availableVersions },\n `Available versions: ${availableVersions.length > 0 ? availableVersions.join(', ') : '(none)'}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsRemovalDeniedDiagnostic(\n kind: 'version' | 'package',\n packageName: string,\n policy: string,\n version?: string,\n): RegistryToolsRemovalDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n 'error',\n kind === 'version'\n ? `Removing version \"${version ?? '?'}\" of \"${packageName}\" is not allowed (policy: ${policy}).`\n : `Removing package \"${packageName}\" is not allowed (policy: ${policy}).`,\n { kind, packageName, version, policy },\n 'Update `policy.removals` if removals are intentional.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsIntegrityMismatchDiagnostic(\n filePath: string,\n expectedHash: string,\n actualHash: string,\n expectedSize: number,\n actualSize: number,\n): RegistryToolsIntegrityMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n 'error',\n `Integrity mismatch for \"${filePath}\".`,\n { filePath, expectedHash, actualHash, expectedSize, actualSize },\n `Expected ${expectedHash} (${expectedSize} bytes); got ${actualHash} (${actualSize} bytes).`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsReleaseFileNameInvalidDiagnostic(\n packageName: string,\n version: string,\n fileName: string,\n accepted: readonly string[],\n): RegistryToolsReleaseFileNameInvalidDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n 'error',\n `Release file \"${fileName}\" for \"${packageName}@${version}\" is not an accepted name.`,\n { packageName, version, fileName, accepted },\n `Use one of: ${accepted.join(', ')}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsOfficialPolicyViolationDiagnostic(\n rule: string,\n detail: string,\n path?: string,\n): RegistryToolsOfficialPolicyViolationDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n 'error',\n `Official-registry policy violation (${rule}): ${detail}.`,\n { rule, detail, path },\n 'Adjust the package contents to satisfy the official-registry policy and try again.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsUnknownKeyDiagnostic(\n path: string,\n key: string,\n level: 'warning' | 'error' = 'warning',\n): RegistryToolsUnknownKeyDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n level,\n `Unknown key \"${key}\" at \"${path}\".`,\n { path, key },\n 'Remove the key, or update `@uapkg/registry-schema` if it is a new field.',\n ONCE,\n );\n}\n"],"mappings":";;;AA+LA,MAAM,OAAO,EAAE,YAAY,OAAgB;AAE3C,SAAgB,0CACd,aACA,cACA,YACqC;CACrC,OAAO,iBACL,gCACA,SACA,YAAY,YAAY,kBAAkB,WAAW,wBAAwB,aAAa,KAC1F;EAAE;EAAa;EAAc;CAAW,GACxC,yFACA,IACF;AACF;AAEA,SAAgB,mDACd,aACA,UACA,WAC8C;CAC9C,OAAO,iBACL,0CACA,SACA,YAAY,YAAY,gDAAgD,SAAS,KAAK,GAAG,SAAS,IAAI,uBAC/E,UAAU,KAAK,GAAG,UAAU,IAAI,KACvD;EAAE;EAAa;EAAU;CAAU,GACnC,8GACA,IACF;AACF;AAEA,SAAgB,2CACd,aACA,SACsC;CACtC,OAAO,iBACL,iCACA,SACA,YAAY,QAAQ,gCAAgC,YAAY,KAChE;EAAE;EAAa;CAAQ,GACvB,kFACA,IACF;AACF;AAEA,SAAgB,6CACd,aACA,SACwC;CACxC,OAAO,iBACL,oCACA,SACA,YAAY,QAAQ,+BAA+B,YAAY,KAC/D;EAAE;EAAa;CAAQ,GACvB,qDACA,IACF;AACF;AAEA,SAAgB,4CACd,aACA,cACuC;CACvC,OAAO,iBACL,kCACA,SACA,yBAAyB,YAAY,sBAAsB,aAAa,KACxE;EAAE;EAAa;CAAa,GAC5B,gFACA,IACF;AACF;AAEA,SAAgB,8CACd,aACA,QACA,UACyC;CACzC,OAAO,iBACL,oCACA,WACA,wBAAwB,YAAY,iCACpC;EAAE;EAAa;EAAQ;CAAS,GAChC,gFACA,IACF;AACF;AAEA,SAAgB,oDACd,MAC+C;CAC/C,OAAO,iBACL,2CACA,SACA,eAAe,KAAK,WAAW,QAAQ,KAAK,YAAY,GAAG,KAAK,QAAQ,+BAClE,KAAK,aAAa,mDACxB,MACA,iHACA,IACF;AACF;AAEA,SAAgB,wDACd,MACmD;CACnD,OAAO,iBACL,gDACA,SACA,eAAe,KAAK,WAAW,QAAQ,KAAK,YAAY,GAAG,KAAK,QAAQ,+BAClE,KAAK,aAAa,qCAAqC,KAAK,UAAU,KAAK,IAAI,EAAE,KACvF,MACA,4FACA,IACF;AACF;AAEA,SAAgB,qDACd,aACA,SACA,YACgD;CAChD,OAAO,iBACL,6CACA,SACA,eAAe,WAAW,QAAQ,YAAY,GAAG,QAAQ,qCACzD;EAAE;EAAa;EAAS;CAAW,GACnC,gFACA,IACF;AACF;AAEA,SAAgB,wDACd,aACA,SACA,YACA,OACA,mBACmD;CACnD,OAAO,iBACL,+CACA,SACA,eAAe,WAAW,GAAG,MAAM,QAAQ,YAAY,GAAG,QAAQ,kDAClE;EAAE;EAAa;EAAS;EAAY;EAAO;CAAkB,GAC7D,uBAAuB,kBAAkB,SAAS,IAAI,kBAAkB,KAAK,IAAI,IAAI,SAAS,IAC9F,IACF;AACF;AAEA,SAAgB,2CACd,MACA,aACA,QACA,SACsC;CACtC,OAAO,iBACL,iCACA,SACA,SAAS,YACL,qBAAqB,WAAW,IAAI,QAAQ,YAAY,4BAA4B,OAAO,MAC3F,qBAAqB,YAAY,4BAA4B,OAAO,KACxE;EAAE;EAAM;EAAa;EAAS;CAAO,GACrC,yDACA,IACF;AACF;AAEA,SAAgB,+CACd,UACA,cACA,YACA,cACA,YAC0C;CAC1C,OAAO,iBACL,qCACA,SACA,2BAA2B,SAAS,KACpC;EAAE;EAAU;EAAc;EAAY;EAAc;CAAW,GAC/D,YAAY,aAAa,IAAI,aAAa,eAAe,WAAW,IAAI,WAAW,WACnF,IACF;AACF;AAEA,SAAgB,oDACd,aACA,SACA,UACA,UAC+C;CAC/C,OAAO,iBACL,4CACA,SACA,iBAAiB,SAAS,SAAS,YAAY,GAAG,QAAQ,6BAC1D;EAAE;EAAa;EAAS;EAAU;CAAS,GAC3C,eAAe,SAAS,KAAK,IAAI,EAAE,IACnC,IACF;AACF;AAEA,SAAgB,qDACd,MACA,QACA,MACgD;CAChD,OAAO,iBACL,4CACA,SACA,uCAAuC,KAAK,KAAK,OAAO,IACxD;EAAE;EAAM;EAAQ;CAAK,GACrB,sFACA,IACF;AACF;AAEA,SAAgB,wCACd,MACA,KACA,QAA6B,WACM;CACnC,OAAO,iBACL,8BACA,OACA,gBAAgB,IAAI,QAAQ,KAAK,KACjC;EAAE;EAAM;CAAI,GACZ,4EACA,IACF;AACF"}
1
+ {"version":3,"file":"RegistryToolsDiagnostics.js","names":[],"sources":["../../src/registryTools/RegistryToolsDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Registry-tools diagnostic codes\n//\n// Emitted by `@uapkg/registry-tools` when authoring, validating, or linting a\n// registry repo. All diagnostics in this family default to `emitPolicy: 'once'`\n// so plan-then-apply flows do not double-report the same issue.\n// ---------------------------------------------------------------------------\n\n/** Package name does not match its on-disk manifest path. */\nexport type RegistryToolsPathMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n {\n readonly packageName: string;\n readonly expectedPath: string;\n readonly actualPath: string;\n }\n>;\n\n/** Existing package manifest declares a different `packageSource` than the request. */\nexport type RegistryToolsPackageSourceMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n {\n readonly packageName: string;\n readonly existing: { readonly type: string; readonly url: string };\n readonly requested: { readonly type: string; readonly url: string };\n }\n>;\n\n/** A version already exists and `overwriteExistingVersion` was not set. */\nexport type RegistryToolsVersionExistsDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Requested version was not found on the package. */\nexport type RegistryToolsVersionNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Package manifest is missing and was not allowed to be created. */\nexport type RegistryToolsPackageMissingDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n {\n readonly packageName: string;\n readonly manifestPath: string;\n }\n>;\n\n/** Versions in a manifest are not sorted newest-first by SemVer. */\nexport type RegistryToolsVersionsUnsortedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n {\n readonly packageName: string;\n readonly actual: readonly string[];\n readonly expected: readonly string[];\n }\n>;\n\n/** External-registry dependency is forbidden by policy. */\nexport type RegistryToolsExternalRegistryDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** External-registry dependency uses a registry name not in the allow-list. */\nexport type RegistryToolsExternalRegistryNotAllowedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly allowList: readonly string[];\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** A required (non-external) dependency is not present in this registry. */\nexport type RegistryToolsDependencyNotInRegistryDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n }\n>;\n\n/** A dependency version range cannot be satisfied by any version in the registry. */\nexport type RegistryToolsDependencyRangeUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly range: string;\n readonly availableVersions: readonly string[];\n }\n>;\n\n/** A removal was attempted but disallowed by policy. */\nexport type RegistryToolsRemovalDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n {\n readonly kind: 'version' | 'package';\n readonly packageName: string;\n readonly version?: string;\n readonly policy: string;\n }\n>;\n\n/** A computed integrity does not match an expected integrity. */\nexport type RegistryToolsIntegrityMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n {\n readonly filePath: string;\n readonly expectedHash: string;\n readonly actualHash: string;\n readonly expectedSize: number;\n readonly actualSize: number;\n }\n>;\n\n/** A release file name does not match an accepted pattern. */\nexport type RegistryToolsReleaseFileNameInvalidDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n {\n readonly packageName: string;\n readonly version: string;\n readonly fileName: string;\n readonly accepted: readonly string[];\n }\n>;\n\n/** Generic violation surfaced by the official-registry policy validator. */\nexport type RegistryToolsOfficialPolicyViolationDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n {\n readonly rule: string;\n readonly detail: string;\n readonly path?: string;\n }\n>;\n\n/** An unrecognized top-level or nested key was found in a registry manifest. */\nexport type RegistryToolsUnknownKeyDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n {\n readonly path: string;\n readonly key: string;\n }\n>;\n\n/** Union of all registry-tools diagnostics. */\nexport type RegistryToolsDiagnostic =\n | RegistryToolsPathMismatchDiagnostic\n | RegistryToolsPackageSourceMismatchDiagnostic\n | RegistryToolsVersionExistsDiagnostic\n | RegistryToolsVersionNotFoundDiagnostic\n | RegistryToolsPackageMissingDiagnostic\n | RegistryToolsVersionsUnsortedDiagnostic\n | RegistryToolsExternalRegistryDeniedDiagnostic\n | RegistryToolsExternalRegistryNotAllowedDiagnostic\n | RegistryToolsDependencyNotInRegistryDiagnostic\n | RegistryToolsDependencyRangeUnreachableDiagnostic\n | RegistryToolsRemovalDeniedDiagnostic\n | RegistryToolsIntegrityMismatchDiagnostic\n | RegistryToolsReleaseFileNameInvalidDiagnostic\n | RegistryToolsOfficialPolicyViolationDiagnostic\n | RegistryToolsUnknownKeyDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nimport { createDiagnostic } from '#diagnostics/base/Diagnostic.ts';\n\nconst ONCE = { emitPolicy: 'once' as const };\n\nexport function createRegistryToolsPathMismatchDiagnostic(\n packageName: string,\n expectedPath: string,\n actualPath: string,\n): RegistryToolsPathMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n 'error',\n `Package \"${packageName}\" was found at \"${actualPath}\" but should live at \"${expectedPath}\".`,\n { packageName, expectedPath, actualPath },\n 'Move the manifest to packages/{first-letter}/{name}.json or correct the package name.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageSourceMismatchDiagnostic(\n packageName: string,\n existing: { readonly type: string; readonly url: string },\n requested: { readonly type: string; readonly url: string },\n): RegistryToolsPackageSourceMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n 'error',\n `Package \"${packageName}\" already declares a different packageSource (${existing.type}:${existing.url}); ` +\n `the request used (${requested.type}:${requested.url}).`,\n { packageName, existing, requested },\n 'Either update the request to match the existing source, or remove and re-create the package intentionally.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionExistsDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionExistsDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n 'error',\n `Version \"${version}\" already exists for package \"${packageName}\".`,\n { packageName, version },\n 'Pass `overwriteExistingVersion: true` to replace it, or publish a new version.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionNotFoundDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionNotFoundDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n 'error',\n `Version \"${version}\" was not found for package \"${packageName}\".`,\n { packageName, version },\n 'Use `listVersions` to see the available versions.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageMissingDiagnostic(\n packageName: string,\n manifestPath: string,\n): RegistryToolsPackageMissingDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n 'error',\n `Package manifest for \"${packageName}\" was not found at \"${manifestPath}\".`,\n { packageName, manifestPath },\n 'Pass `createPackageManifestIfMissing: true` on the add request to create it.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionsUnsortedDiagnostic(\n packageName: string,\n actual: readonly string[],\n expected: readonly string[],\n): RegistryToolsVersionsUnsortedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n 'warning',\n `Versions on package \"${packageName}\" are not sorted newest-first.`,\n { packageName, actual, expected },\n 'Re-write the manifest. Registry tools sorts versions newest-first by SemVer.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryDeniedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryDeniedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", but external registries are denied by policy.`,\n args,\n 'Set `policy.externalRegistries` to `allow-listed` or `allow-any` if cross-registry dependencies are intended.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryNotAllowedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryNotAllowedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryNotAllowedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", which is not in the allow-list [${args.allowList.join(', ')}].`,\n args,\n 'Add the registry name to `policy.allowedExternalRegistryNames` or remove the dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyNotInRegistryDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n): RegistryToolsDependencyNotInRegistryDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n 'error',\n `Dependency \"${dependency}\" of \"${packageName}@${version}\" is not present in this registry.`,\n { packageName, version, dependency },\n 'Publish the dependency first, or mark it as an external-registry dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyRangeUnreachableDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n range: string,\n availableVersions: readonly string[],\n): RegistryToolsDependencyRangeUnreachableDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n 'error',\n `Dependency \"${dependency}@${range}\" of \"${packageName}@${version}\" cannot be satisfied by any published version.`,\n { packageName, version, dependency, range, availableVersions },\n `Available versions: ${availableVersions.length > 0 ? availableVersions.join(', ') : '(none)'}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsRemovalDeniedDiagnostic(\n kind: 'version' | 'package',\n packageName: string,\n policy: string,\n version?: string,\n): RegistryToolsRemovalDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n 'error',\n kind === 'version'\n ? `Removing version \"${version ?? '?'}\" of \"${packageName}\" is not allowed (policy: ${policy}).`\n : `Removing package \"${packageName}\" is not allowed (policy: ${policy}).`,\n { kind, packageName, version, policy },\n 'Update `policy.removals` if removals are intentional.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsIntegrityMismatchDiagnostic(\n filePath: string,\n expectedHash: string,\n actualHash: string,\n expectedSize: number,\n actualSize: number,\n): RegistryToolsIntegrityMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n 'error',\n `Integrity mismatch for \"${filePath}\".`,\n { filePath, expectedHash, actualHash, expectedSize, actualSize },\n `Expected ${expectedHash} (${expectedSize} bytes); got ${actualHash} (${actualSize} bytes).`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsReleaseFileNameInvalidDiagnostic(\n packageName: string,\n version: string,\n fileName: string,\n accepted: readonly string[],\n): RegistryToolsReleaseFileNameInvalidDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n 'error',\n `Release file \"${fileName}\" for \"${packageName}@${version}\" is not an accepted name.`,\n { packageName, version, fileName, accepted },\n `Use one of: ${accepted.join(', ')}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsOfficialPolicyViolationDiagnostic(\n rule: string,\n detail: string,\n path?: string,\n): RegistryToolsOfficialPolicyViolationDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n 'error',\n `Official-registry policy violation (${rule}): ${detail}.`,\n { rule, detail, path },\n 'Adjust the package contents to satisfy the official-registry policy and try again.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsUnknownKeyDiagnostic(\n path: string,\n key: string,\n level: 'warning' | 'error' = 'warning',\n): RegistryToolsUnknownKeyDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n level,\n `Unknown key \"${key}\" at \"${path}\".`,\n { path, key },\n 'Remove the key, or update `@uapkg/registry-schema` if it is a new field.',\n ONCE,\n );\n}\n"],"mappings":";;;AA+LA,MAAM,OAAO,EAAE,YAAY,OAAgB;AAE3C,SAAgB,0CACd,aACA,cACA,YACqC;CACrC,OAAO,iBACL,gCACA,SACA,YAAY,YAAY,kBAAkB,WAAW,wBAAwB,aAAa,KAC1F;EAAE;EAAa;EAAc;CAAW,GACxC,yFACA,IACF;AACF;AAEA,SAAgB,mDACd,aACA,UACA,WAC8C;CAC9C,OAAO,iBACL,0CACA,SACA,YAAY,YAAY,gDAAgD,SAAS,KAAK,GAAG,SAAS,IAAI,uBAC/E,UAAU,KAAK,GAAG,UAAU,IAAI,KACvD;EAAE;EAAa;EAAU;CAAU,GACnC,8GACA,IACF;AACF;AAEA,SAAgB,2CACd,aACA,SACsC;CACtC,OAAO,iBACL,iCACA,SACA,YAAY,QAAQ,gCAAgC,YAAY,KAChE;EAAE;EAAa;CAAQ,GACvB,kFACA,IACF;AACF;AAEA,SAAgB,6CACd,aACA,SACwC;CACxC,OAAO,iBACL,oCACA,SACA,YAAY,QAAQ,+BAA+B,YAAY,KAC/D;EAAE;EAAa;CAAQ,GACvB,qDACA,IACF;AACF;AAEA,SAAgB,4CACd,aACA,cACuC;CACvC,OAAO,iBACL,kCACA,SACA,yBAAyB,YAAY,sBAAsB,aAAa,KACxE;EAAE;EAAa;CAAa,GAC5B,gFACA,IACF;AACF;AAEA,SAAgB,8CACd,aACA,QACA,UACyC;CACzC,OAAO,iBACL,oCACA,WACA,wBAAwB,YAAY,iCACpC;EAAE;EAAa;EAAQ;CAAS,GAChC,gFACA,IACF;AACF;AAEA,SAAgB,oDACd,MAC+C;CAC/C,OAAO,iBACL,2CACA,SACA,eAAe,KAAK,WAAW,QAAQ,KAAK,YAAY,GAAG,KAAK,QAAQ,+BAClE,KAAK,aAAa,mDACxB,MACA,iHACA,IACF;AACF;AAEA,SAAgB,wDACd,MACmD;CACnD,OAAO,iBACL,gDACA,SACA,eAAe,KAAK,WAAW,QAAQ,KAAK,YAAY,GAAG,KAAK,QAAQ,+BAClE,KAAK,aAAa,qCAAqC,KAAK,UAAU,KAAK,IAAI,EAAE,KACvF,MACA,4FACA,IACF;AACF;AAEA,SAAgB,qDACd,aACA,SACA,YACgD;CAChD,OAAO,iBACL,6CACA,SACA,eAAe,WAAW,QAAQ,YAAY,GAAG,QAAQ,qCACzD;EAAE;EAAa;EAAS;CAAW,GACnC,gFACA,IACF;AACF;AAEA,SAAgB,wDACd,aACA,SACA,YACA,OACA,mBACmD;CACnD,OAAO,iBACL,+CACA,SACA,eAAe,WAAW,GAAG,MAAM,QAAQ,YAAY,GAAG,QAAQ,kDAClE;EAAE;EAAa;EAAS;EAAY;EAAO;CAAkB,GAC7D,uBAAuB,kBAAkB,SAAS,IAAI,kBAAkB,KAAK,IAAI,IAAI,SAAS,IAC9F,IACF;AACF;AAEA,SAAgB,2CACd,MACA,aACA,QACA,SACsC;CACtC,OAAO,iBACL,iCACA,SACA,SAAS,YACL,qBAAqB,WAAW,IAAI,QAAQ,YAAY,4BAA4B,OAAO,MAC3F,qBAAqB,YAAY,4BAA4B,OAAO,KACxE;EAAE;EAAM;EAAa;EAAS;CAAO,GACrC,yDACA,IACF;AACF;AAEA,SAAgB,+CACd,UACA,cACA,YACA,cACA,YAC0C;CAC1C,OAAO,iBACL,qCACA,SACA,2BAA2B,SAAS,KACpC;EAAE;EAAU;EAAc;EAAY;EAAc;CAAW,GAC/D,YAAY,aAAa,IAAI,aAAa,eAAe,WAAW,IAAI,WAAW,WACnF,IACF;AACF;AAEA,SAAgB,oDACd,aACA,SACA,UACA,UAC+C;CAC/C,OAAO,iBACL,4CACA,SACA,iBAAiB,SAAS,SAAS,YAAY,GAAG,QAAQ,6BAC1D;EAAE;EAAa;EAAS;EAAU;CAAS,GAC3C,eAAe,SAAS,KAAK,IAAI,EAAE,IACnC,IACF;AACF;AAEA,SAAgB,qDACd,MACA,QACA,MACgD;CAChD,OAAO,iBACL,4CACA,SACA,uCAAuC,KAAK,KAAK,OAAO,IACxD;EAAE;EAAM;EAAQ;CAAK,GACrB,sFACA,IACF;AACF;AAEA,SAAgB,wCACd,MACA,KACA,QAA6B,WACM;CACnC,OAAO,iBACL,8BACA,OACA,gBAAgB,IAAI,QAAQ,KAAK,KACjC;EAAE;EAAM;CAAI,GACZ,4EACA,IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResolverDiagnostics.js","names":[],"sources":["../../src/resolver/ResolverDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Resolver diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Two or more registries resolve the same package name to different versions (single-version kind). */\nexport type VersionConflictDiagnostic = DiagnosticBase<\n 'VERSION_CONFLICT',\n {\n readonly packageName: string;\n readonly versions: readonly string[];\n readonly registry: string;\n }\n>;\n\n/** A dependency cycle was detected. */\nexport type CircularDepDiagnostic = DiagnosticBase<\n 'CIRCULAR_DEP',\n {\n readonly path: readonly string[];\n }\n>;\n\n/** Requested package could not be found in any configured registry. */\nexport type PackageNotFoundDiagnostic = DiagnosticBase<\n 'PACKAGE_NOT_FOUND',\n {\n readonly packageName: string;\n readonly registry: string;\n }\n>;\n\n/** No published version satisfies the requested range. */\nexport type VersionNotFoundDiagnostic = DiagnosticBase<\n 'VERSION_NOT_FOUND',\n {\n readonly packageName: string;\n readonly versionRange: string;\n readonly registry: string;\n readonly availableVersions: readonly string[];\n }\n>;\n\n/** Same package name required from two different registries. */\nexport type RegistryNameCollisionDiagnostic = DiagnosticBase<\n 'REGISTRY_NAME_COLLISION',\n {\n readonly packageName: string;\n readonly registries: readonly string[];\n }\n>;\n\n/** Union of all resolver diagnostics. */\nexport type ResolverDiagnostic =\n | VersionConflictDiagnostic\n | CircularDepDiagnostic\n | PackageNotFoundDiagnostic\n | VersionNotFoundDiagnostic\n | RegistryNameCollisionDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createVersionConflictDiagnostic(\n packageName: string,\n versions: readonly string[],\n registry: string,\n): VersionConflictDiagnostic {\n return {\n level: 'error',\n code: 'VERSION_CONFLICT',\n message: `Version conflict for \"${packageName}\" in registry \"${registry}\": resolved to [${versions.join(', ')}].`,\n hint: 'Single-version packages cannot coexist at multiple versions. Pin an explicit version or use overrides.',\n data: { packageName, versions, registry },\n };\n}\n\nexport function createCircularDepDiagnostic(path: readonly string[]): CircularDepDiagnostic {\n return {\n level: 'error',\n code: 'CIRCULAR_DEP',\n message: `Circular dependency detected: ${path.join(' → ')}.`,\n hint: 'Break the cycle by removing or restructuring the dependency.',\n data: { path },\n };\n}\n\nexport function createPackageNotFoundDiagnostic(packageName: string, registry: string): PackageNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'PACKAGE_NOT_FOUND',\n message: `Package \"${packageName}\" not found in registry \"${registry}\".`,\n hint: 'Verify the package name and ensure the registry is up-to-date.',\n data: { packageName, registry },\n };\n}\n\nexport function createVersionNotFoundDiagnostic(\n packageName: string,\n versionRange: string,\n registry: string,\n availableVersions: readonly string[],\n): VersionNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'VERSION_NOT_FOUND',\n message: `No version of \"${packageName}\" in registry \"${registry}\" satisfies \"${versionRange}\".`,\n hint: `Available versions: ${availableVersions.length > 0 ? availableVersions.join(', ') : '(none)'}.`,\n data: { packageName, versionRange, registry, availableVersions },\n };\n}\n\nexport function createRegistryNameCollisionDiagnostic(\n packageName: string,\n registries: readonly string[],\n): RegistryNameCollisionDiagnostic {\n return {\n level: 'error',\n code: 'REGISTRY_NAME_COLLISION',\n message: `Package \"${packageName}\" is required from multiple registries: [${registries.join(', ')}].`,\n hint: 'A package name must resolve from a single registry.',\n data: { packageName, registries },\n };\n}\n"],"mappings":";AAiEA,SAAgB,gCACd,aACA,UACA,UAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yBAAyB,YAAY,iBAAiB,SAAS,kBAAkB,SAAS,KAAK,IAAI,EAAE;EAC9G,MAAM;EACN,MAAM;GAAE;GAAa;GAAU;EAAS;CAC1C;AACF;AAEA,SAAgB,4BAA4B,MAAgD;CAC1F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,KAAK,KAAK,KAAK,EAAE;EAC3D,MAAM;EACN,MAAM,EAAE,KAAK;CACf;AACF;AAEA,SAAgB,gCAAgC,aAAqB,UAA6C;CAChH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY,2BAA2B,SAAS;EACrE,MAAM;EACN,MAAM;GAAE;GAAa;EAAS;CAChC;AACF;AAEA,SAAgB,gCACd,aACA,cACA,UACA,mBAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,YAAY,iBAAiB,SAAS,eAAe,aAAa;EAC7F,MAAM,uBAAuB,kBAAkB,SAAS,IAAI,kBAAkB,KAAK,IAAI,IAAI,SAAS;EACpG,MAAM;GAAE;GAAa;GAAc;GAAU;EAAkB;CACjE;AACF;AAEA,SAAgB,sCACd,aACA,YACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY,2CAA2C,WAAW,KAAK,IAAI,EAAE;EAClG,MAAM;EACN,MAAM;GAAE;GAAa;EAAW;CAClC;AACF"}
1
+ {"version":3,"file":"ResolverDiagnostics.js","names":[],"sources":["../../src/resolver/ResolverDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Resolver diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Two or more registries resolve the same package name to different versions (single-version kind). */\nexport type VersionConflictDiagnostic = DiagnosticBase<\n 'VERSION_CONFLICT',\n {\n readonly packageName: string;\n readonly versions: readonly string[];\n readonly registry: string;\n }\n>;\n\n/** A dependency cycle was detected. */\nexport type CircularDepDiagnostic = DiagnosticBase<\n 'CIRCULAR_DEP',\n {\n readonly path: readonly string[];\n }\n>;\n\n/** Requested package could not be found in any configured registry. */\nexport type PackageNotFoundDiagnostic = DiagnosticBase<\n 'PACKAGE_NOT_FOUND',\n {\n readonly packageName: string;\n readonly registry: string;\n }\n>;\n\n/** No published version satisfies the requested range. */\nexport type VersionNotFoundDiagnostic = DiagnosticBase<\n 'VERSION_NOT_FOUND',\n {\n readonly packageName: string;\n readonly versionRange: string;\n readonly registry: string;\n readonly availableVersions: readonly string[];\n }\n>;\n\n/** Same package name required from two different registries. */\nexport type RegistryNameCollisionDiagnostic = DiagnosticBase<\n 'REGISTRY_NAME_COLLISION',\n {\n readonly packageName: string;\n readonly registries: readonly string[];\n }\n>;\n\n/** Union of all resolver diagnostics. */\nexport type ResolverDiagnostic =\n | VersionConflictDiagnostic\n | CircularDepDiagnostic\n | PackageNotFoundDiagnostic\n | VersionNotFoundDiagnostic\n | RegistryNameCollisionDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createVersionConflictDiagnostic(\n packageName: string,\n versions: readonly string[],\n registry: string,\n): VersionConflictDiagnostic {\n return {\n level: 'error',\n code: 'VERSION_CONFLICT',\n message: `Version conflict for \"${packageName}\" in registry \"${registry}\": resolved to [${versions.join(', ')}].`,\n hint: 'Single-version packages cannot coexist at multiple versions. Pin an explicit version or use overrides.',\n data: { packageName, versions, registry },\n };\n}\n\nexport function createCircularDepDiagnostic(path: readonly string[]): CircularDepDiagnostic {\n return {\n level: 'error',\n code: 'CIRCULAR_DEP',\n message: `Circular dependency detected: ${path.join(' → ')}.`,\n hint: 'Break the cycle by removing or restructuring the dependency.',\n data: { path },\n };\n}\n\nexport function createPackageNotFoundDiagnostic(packageName: string, registry: string): PackageNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'PACKAGE_NOT_FOUND',\n message: `Package \"${packageName}\" not found in registry \"${registry}\".`,\n hint: 'Verify the package name and ensure the registry is up-to-date.',\n data: { packageName, registry },\n };\n}\n\nexport function createVersionNotFoundDiagnostic(\n packageName: string,\n versionRange: string,\n registry: string,\n availableVersions: readonly string[],\n): VersionNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'VERSION_NOT_FOUND',\n message: `No version of \"${packageName}\" in registry \"${registry}\" satisfies \"${versionRange}\".`,\n hint: `Available versions: ${availableVersions.length > 0 ? availableVersions.join(', ') : '(none)'}.`,\n data: { packageName, versionRange, registry, availableVersions },\n };\n}\n\nexport function createRegistryNameCollisionDiagnostic(\n packageName: string,\n registries: readonly string[],\n): RegistryNameCollisionDiagnostic {\n return {\n level: 'error',\n code: 'REGISTRY_NAME_COLLISION',\n message: `Package \"${packageName}\" is required from multiple registries: [${registries.join(', ')}].`,\n hint: 'A package name must resolve from a single registry.',\n data: { packageName, registries },\n };\n}\n"],"mappings":";AAiEA,SAAgB,gCACd,aACA,UACA,UAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yBAAyB,YAAY,iBAAiB,SAAS,kBAAkB,SAAS,KAAK,IAAI,EAAE;EAC9G,MAAM;EACN,MAAM;GAAE;GAAa;GAAU;EAAS;CAC1C;AACF;AAEA,SAAgB,4BAA4B,MAAgD;CAC1F,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,KAAK,KAAK,KAAK,EAAE;EAC3D,MAAM;EACN,MAAM,EAAE,KAAK;CACf;AACF;AAEA,SAAgB,gCAAgC,aAAqB,UAA6C;CAChH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY,2BAA2B,SAAS;EACrE,MAAM;EACN,MAAM;GAAE;GAAa;EAAS;CAChC;AACF;AAEA,SAAgB,gCACd,aACA,cACA,UACA,mBAC2B;CAC3B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,YAAY,iBAAiB,SAAS,eAAe,aAAa;EAC7F,MAAM,uBAAuB,kBAAkB,SAAS,IAAI,kBAAkB,KAAK,IAAI,IAAI,SAAS;EACpG,MAAM;GAAE;GAAa;GAAc;GAAU;EAAkB;CACjE;AACF;AAEA,SAAgB,sCACd,aACA,YACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,YAAY,YAAY,2CAA2C,WAAW,KAAK,IAAI,EAAE;EAClG,MAAM;EACN,MAAM;GAAE;GAAa;EAAW;CAClC;AACF"}
@@ -16,7 +16,7 @@ function createSafetyPathNotProjectManifestDiagnostic(pluginName, dependencyName
16
16
  level: "warning",
17
17
  code: "SAFETY_PATH_NOT_PROJECT_MANIFEST",
18
18
  message: `Plugin "${pluginName}" requested install path "${requestedPath}" for "${dependencyName}"; using default "${fallbackPath}" instead.`,
19
- hint: "Only project-kind manifests may dictate install paths. Move the override to your project manifest.",
19
+ hint: "Only project manifests can set install paths. Move the override to your project manifest.",
20
20
  data: {
21
21
  pluginName,
22
22
  dependencyName,
@@ -1 +1 @@
1
- {"version":3,"file":"SafetyDiagnostics.js","names":[],"sources":["../../src/safety/SafetyDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Safety diagnostic codes — emitted by @uapkg/installer's SafetyPolicy layer.\n// ---------------------------------------------------------------------------\n\n/**\n * A target install directory exists but has no `uapkg.json` inside.\n * The installer refuses to overwrite because the directory's identity is\n * unknown. Use `--force` to override.\n */\nexport type SafetyTargetExistsNoManifestDiagnostic = DiagnosticBase<\n 'SAFETY_TARGET_EXISTS_NO_MANIFEST',\n {\n readonly packageName: string;\n readonly path: string;\n }\n>;\n\n/**\n * A plugin-kind manifest declared a custom install `path` for one of its\n * dependencies. Only project-kind manifests may override paths; plugins fall\n * back to the default install location and this warning is emitted.\n */\nexport type SafetyPathNotProjectManifestDiagnostic = DiagnosticBase<\n 'SAFETY_PATH_NOT_PROJECT_MANIFEST',\n {\n readonly pluginName: string;\n readonly dependencyName: string;\n readonly requestedPath: string;\n readonly fallbackPath: string;\n }\n>;\n\n/** Informational: a safety check was bypassed because --force was passed. */\nexport type SafetyOverriddenByForceDiagnostic = DiagnosticBase<\n 'SAFETY_OVERRIDDEN_BY_FORCE',\n {\n readonly packageName: string;\n readonly policy: string;\n }\n>;\n\nexport type SafetyDiagnostic =\n | SafetyTargetExistsNoManifestDiagnostic\n | SafetyPathNotProjectManifestDiagnostic\n | SafetyOverriddenByForceDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createSafetyTargetExistsNoManifestDiagnostic(\n packageName: string,\n path: string,\n): SafetyTargetExistsNoManifestDiagnostic {\n return {\n level: 'error',\n code: 'SAFETY_TARGET_EXISTS_NO_MANIFEST',\n message: `Refusing to overwrite \"${path}\" (no uapkg.json found) for package \"${packageName}\".`,\n hint: 'Remove the directory or re-run with --force to overwrite.',\n data: { packageName, path },\n };\n}\n\nexport function createSafetyPathNotProjectManifestDiagnostic(\n pluginName: string,\n dependencyName: string,\n requestedPath: string,\n fallbackPath: string,\n): SafetyPathNotProjectManifestDiagnostic {\n return {\n level: 'warning',\n code: 'SAFETY_PATH_NOT_PROJECT_MANIFEST',\n message: `Plugin \"${pluginName}\" requested install path \"${requestedPath}\" for \"${dependencyName}\"; using default \"${fallbackPath}\" instead.`,\n hint: 'Only project-kind manifests may dictate install paths. Move the override to your project manifest.',\n data: { pluginName, dependencyName, requestedPath, fallbackPath },\n };\n}\n\nexport function createSafetyOverriddenByForceDiagnostic(\n packageName: string,\n policy: string,\n): SafetyOverriddenByForceDiagnostic {\n return {\n level: 'info',\n code: 'SAFETY_OVERRIDDEN_BY_FORCE',\n message: `Safety policy \"${policy}\" bypassed for \"${packageName}\" (--force).`,\n data: { packageName, policy },\n };\n}\n"],"mappings":";AAoDA,SAAgB,6CACd,aACA,MACwC;CACxC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,0BAA0B,KAAK,uCAAuC,YAAY;EAC3F,MAAM;EACN,MAAM;GAAE;GAAa;EAAK;CAC5B;AACF;AAEA,SAAgB,6CACd,YACA,gBACA,eACA,cACwC;CACxC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,WAAW,WAAW,4BAA4B,cAAc,SAAS,eAAe,oBAAoB,aAAa;EAClI,MAAM;EACN,MAAM;GAAE;GAAY;GAAgB;GAAe;EAAa;CAClE;AACF;AAEA,SAAgB,wCACd,aACA,QACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,OAAO,kBAAkB,YAAY;EAChE,MAAM;GAAE;GAAa;EAAO;CAC9B;AACF"}
1
+ {"version":3,"file":"SafetyDiagnostics.js","names":[],"sources":["../../src/safety/SafetyDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Safety diagnostic codes — emitted by @uapkg/installer's SafetyPolicy layer.\n// ---------------------------------------------------------------------------\n\n/**\n * A target install directory exists but has no `uapkg.json` inside.\n * The installer refuses to overwrite because the directory's identity is\n * unknown. Use `--force` to override.\n */\nexport type SafetyTargetExistsNoManifestDiagnostic = DiagnosticBase<\n 'SAFETY_TARGET_EXISTS_NO_MANIFEST',\n {\n readonly packageName: string;\n readonly path: string;\n }\n>;\n\n/**\n * A plugin-kind manifest declared a custom install `path` for one of its\n * dependencies. Only project-kind manifests may override paths; plugins fall\n * back to the default install location and this warning is emitted.\n */\nexport type SafetyPathNotProjectManifestDiagnostic = DiagnosticBase<\n 'SAFETY_PATH_NOT_PROJECT_MANIFEST',\n {\n readonly pluginName: string;\n readonly dependencyName: string;\n readonly requestedPath: string;\n readonly fallbackPath: string;\n }\n>;\n\n/** Informational: a safety check was bypassed because --force was passed. */\nexport type SafetyOverriddenByForceDiagnostic = DiagnosticBase<\n 'SAFETY_OVERRIDDEN_BY_FORCE',\n {\n readonly packageName: string;\n readonly policy: string;\n }\n>;\n\nexport type SafetyDiagnostic =\n | SafetyTargetExistsNoManifestDiagnostic\n | SafetyPathNotProjectManifestDiagnostic\n | SafetyOverriddenByForceDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createSafetyTargetExistsNoManifestDiagnostic(\n packageName: string,\n path: string,\n): SafetyTargetExistsNoManifestDiagnostic {\n return {\n level: 'error',\n code: 'SAFETY_TARGET_EXISTS_NO_MANIFEST',\n message: `Refusing to overwrite \"${path}\" (no uapkg.json found) for package \"${packageName}\".`,\n hint: 'Remove the directory or re-run with --force to overwrite.',\n data: { packageName, path },\n };\n}\n\nexport function createSafetyPathNotProjectManifestDiagnostic(\n pluginName: string,\n dependencyName: string,\n requestedPath: string,\n fallbackPath: string,\n): SafetyPathNotProjectManifestDiagnostic {\n return {\n level: 'warning',\n code: 'SAFETY_PATH_NOT_PROJECT_MANIFEST',\n message: `Plugin \"${pluginName}\" requested install path \"${requestedPath}\" for \"${dependencyName}\"; using default \"${fallbackPath}\" instead.`,\n hint: 'Only project manifests can set install paths. Move the override to your project manifest.',\n data: { pluginName, dependencyName, requestedPath, fallbackPath },\n };\n}\n\nexport function createSafetyOverriddenByForceDiagnostic(\n packageName: string,\n policy: string,\n): SafetyOverriddenByForceDiagnostic {\n return {\n level: 'info',\n code: 'SAFETY_OVERRIDDEN_BY_FORCE',\n message: `Safety policy \"${policy}\" bypassed for \"${packageName}\" (--force).`,\n data: { packageName, policy },\n };\n}\n"],"mappings":";AAoDA,SAAgB,6CACd,aACA,MACwC;CACxC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,0BAA0B,KAAK,uCAAuC,YAAY;EAC3F,MAAM;EACN,MAAM;GAAE;GAAa;EAAK;CAC5B;AACF;AAEA,SAAgB,6CACd,YACA,gBACA,eACA,cACwC;CACxC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,WAAW,WAAW,4BAA4B,cAAc,SAAS,eAAe,oBAAoB,aAAa;EAClI,MAAM;EACN,MAAM;GAAE;GAAY;GAAgB;GAAe;EAAa;CAClE;AACF;AAEA,SAAgB,wCACd,aACA,QACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,OAAO,kBAAkB,YAAY;EAChE,MAAM;GAAE;GAAa;EAAO;CAC9B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"SpecDiagnostics.js","names":[],"sources":["../../src/spec/SpecDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Spec-parse diagnostics (CLI package specifier parsing: `@org/name@range`)\n// ---------------------------------------------------------------------------\n\n/** The raw CLI specifier could not be parsed into `(@org/)?name(@range)?`. */\nexport type InvalidPackageSpecDiagnostic = DiagnosticBase<\n 'INVALID_PACKAGE_SPEC',\n {\n readonly input: string;\n readonly reason: string;\n }\n>;\n\n/** Organization portion of a package spec was not a valid OrgName. */\nexport type InvalidOrgNameDiagnostic = DiagnosticBase<\n 'INVALID_ORG_NAME',\n {\n readonly input: string;\n readonly org: string;\n }\n>;\n\n/** Version range portion of a package spec was not a valid semver range. */\nexport type InvalidVersionRangeDiagnostic = DiagnosticBase<\n 'INVALID_VERSION_RANGE',\n {\n readonly input: string;\n readonly range: string;\n }\n>;\n\nexport type SpecParseDiagnostic =\n | InvalidPackageSpecDiagnostic\n | InvalidOrgNameDiagnostic\n | InvalidVersionRangeDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createInvalidPackageSpecDiagnostic(input: string, reason: string): InvalidPackageSpecDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_PACKAGE_SPEC',\n message: `Invalid package specifier \"${input}\": ${reason}.`,\n hint: 'Use the form \"(@org/)?name(@range)?\" — e.g. \"@myorg/my-pkg@^1.0.0\".',\n data: { input, reason },\n };\n}\n\nexport function createInvalidOrgNameDiagnostic(input: string, org: string): InvalidOrgNameDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_ORG_NAME',\n message: `Invalid organization name \"${org}\" in specifier \"${input}\".`,\n hint: 'Organization names must be lowercase alphanumeric with hyphens or underscores.',\n data: { input, org },\n };\n}\n\nexport function createInvalidVersionRangeDiagnostic(input: string, range: string): InvalidVersionRangeDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_VERSION_RANGE',\n message: `Invalid semver range \"${range}\" in specifier \"${input}\".`,\n hint: 'Use a valid semver range like \"^1.0.0\", \"~2.3.4\", or \">=1.0.0 <2.0.0\".',\n data: { input, range },\n };\n}\n"],"mappings":";AA0CA,SAAgB,mCAAmC,OAAe,QAA8C;CAC9G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,MAAM,KAAK,OAAO;EACzD,MAAM;EACN,MAAM;GAAE;GAAO;EAAO;CACxB;AACF;AAEA,SAAgB,+BAA+B,OAAe,KAAuC;CACnG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,IAAI,kBAAkB,MAAM;EACnE,MAAM;EACN,MAAM;GAAE;GAAO;EAAI;CACrB;AACF;AAEA,SAAgB,oCAAoC,OAAe,OAA8C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yBAAyB,MAAM,kBAAkB,MAAM;EAChE,MAAM;EACN,MAAM;GAAE;GAAO;EAAM;CACvB;AACF"}
1
+ {"version":3,"file":"SpecDiagnostics.js","names":[],"sources":["../../src/spec/SpecDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '#diagnostics/base/Diagnostic.ts';\n\n// ---------------------------------------------------------------------------\n// Spec-parse diagnostics (CLI package specifier parsing: `@org/name@range`)\n// ---------------------------------------------------------------------------\n\n/** The raw CLI specifier could not be parsed into `(@org/)?name(@range)?`. */\nexport type InvalidPackageSpecDiagnostic = DiagnosticBase<\n 'INVALID_PACKAGE_SPEC',\n {\n readonly input: string;\n readonly reason: string;\n }\n>;\n\n/** Organization portion of a package spec was not a valid OrgName. */\nexport type InvalidOrgNameDiagnostic = DiagnosticBase<\n 'INVALID_ORG_NAME',\n {\n readonly input: string;\n readonly org: string;\n }\n>;\n\n/** Version range portion of a package spec was not a valid semver range. */\nexport type InvalidVersionRangeDiagnostic = DiagnosticBase<\n 'INVALID_VERSION_RANGE',\n {\n readonly input: string;\n readonly range: string;\n }\n>;\n\nexport type SpecParseDiagnostic =\n | InvalidPackageSpecDiagnostic\n | InvalidOrgNameDiagnostic\n | InvalidVersionRangeDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createInvalidPackageSpecDiagnostic(input: string, reason: string): InvalidPackageSpecDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_PACKAGE_SPEC',\n message: `Invalid package specifier \"${input}\": ${reason}.`,\n hint: 'Use the form \"(@org/)?name(@range)?\" — e.g. \"@myorg/my-pkg@^1.0.0\".',\n data: { input, reason },\n };\n}\n\nexport function createInvalidOrgNameDiagnostic(input: string, org: string): InvalidOrgNameDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_ORG_NAME',\n message: `Invalid organization name \"${org}\" in specifier \"${input}\".`,\n hint: 'Organization names must be lowercase alphanumeric with hyphens or underscores.',\n data: { input, org },\n };\n}\n\nexport function createInvalidVersionRangeDiagnostic(input: string, range: string): InvalidVersionRangeDiagnostic {\n return {\n level: 'error',\n code: 'INVALID_VERSION_RANGE',\n message: `Invalid semver range \"${range}\" in specifier \"${input}\".`,\n hint: 'Use a valid semver range like \"^1.0.0\", \"~2.3.4\", or \">=1.0.0 <2.0.0\".',\n data: { input, range },\n };\n}\n"],"mappings":";AA0CA,SAAgB,mCAAmC,OAAe,QAA8C;CAC9G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,MAAM,KAAK,OAAO;EACzD,MAAM;EACN,MAAM;GAAE;GAAO;EAAO;CACxB;AACF;AAEA,SAAgB,+BAA+B,OAAe,KAAuC;CACnG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,8BAA8B,IAAI,kBAAkB,MAAM;EACnE,MAAM;EACN,MAAM;GAAE;GAAO;EAAI;CACrB;AACF;AAEA,SAAgB,oCAAoC,OAAe,OAA8C;CAC/G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,yBAAyB,MAAM,kBAAkB,MAAM;EAChE,MAAM;EACN,MAAM;GAAE;GAAO;EAAM;CACvB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uapkg/diagnostics",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -22,6 +22,13 @@
22
22
  "default": "./dist/index.js"
23
23
  }
24
24
  },
25
+ "imports": {
26
+ "#diagnostics/*.ts": {
27
+ "uapkg-source": "./src/*.ts",
28
+ "types": "./dist/*.d.ts",
29
+ "default": "./dist/*.js"
30
+ }
31
+ },
25
32
  "scripts": {
26
33
  "build": "vp pack",
27
34
  "build:watch": "vp pack --watch"