correctly 0.0.0 → 0.1.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.
Files changed (68) hide show
  1. package/AGENTS.md +6 -2
  2. package/README.md +21 -15
  3. package/dist/ajv.d.mts +11 -0
  4. package/dist/ajv.d.mts.map +1 -0
  5. package/dist/ajv.mjs +221 -0
  6. package/dist/ajv.mjs.map +1 -0
  7. package/dist/check-BI7U3ZLc.mjs +88 -0
  8. package/dist/check-BI7U3ZLc.mjs.map +1 -0
  9. package/dist/cli.mjs +14 -62
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/config-Bx1-XXeo.d.mts +189 -0
  12. package/dist/config-Bx1-XXeo.d.mts.map +1 -0
  13. package/dist/config-Cb6o4YnJ.mjs +348 -0
  14. package/dist/config-Cb6o4YnJ.mjs.map +1 -0
  15. package/dist/core.d.mts +27 -125
  16. package/dist/core.d.mts.map +1 -1
  17. package/dist/core.mjs +5 -2
  18. package/dist/diagnostics-BqD1WOy4.mjs +70 -0
  19. package/dist/diagnostics-BqD1WOy4.mjs.map +1 -0
  20. package/dist/engine-VST0hoSk.mjs +111 -0
  21. package/dist/engine-VST0hoSk.mjs.map +1 -0
  22. package/dist/extensions-ClclWslY.d.mts +11 -0
  23. package/dist/extensions-ClclWslY.d.mts.map +1 -0
  24. package/dist/hints-HvSIhuMM.mjs +57 -0
  25. package/dist/hints-HvSIhuMM.mjs.map +1 -0
  26. package/dist/lsp.mjs +40 -91
  27. package/dist/lsp.mjs.map +1 -1
  28. package/dist/renovate.d.mts +5 -0
  29. package/dist/renovate.d.mts.map +1 -0
  30. package/dist/renovate.mjs +11 -0
  31. package/dist/renovate.mjs.map +1 -0
  32. package/dist/schemas-UxCtIdo2.mjs +265 -0
  33. package/dist/schemas-UxCtIdo2.mjs.map +1 -0
  34. package/dist/session-DCFav56x.mjs +113 -0
  35. package/dist/session-DCFav56x.mjs.map +1 -0
  36. package/dist/worker.mjs +80 -0
  37. package/dist/worker.mjs.map +1 -0
  38. package/docs/guide.md +166 -34
  39. package/examples/basic/correctly.config.ts +13 -0
  40. package/package.json +69 -60
  41. package/src/cli/check.ts +41 -11
  42. package/src/cli/main.ts +3 -2
  43. package/src/cli/readable.ts +24 -5
  44. package/src/cli/vsix.ts +1 -0
  45. package/src/core/adapters.ts +54 -0
  46. package/src/core/config.ts +201 -64
  47. package/src/core/engine.ts +118 -218
  48. package/src/core/extensions.ts +144 -0
  49. package/src/core/index.ts +3 -0
  50. package/src/core/parse.ts +26 -2
  51. package/src/core/parsers.ts +22 -0
  52. package/src/core/schema-walk.ts +43 -0
  53. package/src/core/schemas.ts +21 -41
  54. package/src/core/types.ts +33 -6
  55. package/src/extensions/renovate.ts +4 -0
  56. package/src/lsp/hints.ts +22 -12
  57. package/src/lsp/server.ts +9 -2
  58. package/src/lsp/workspace.ts +49 -54
  59. package/src/runtime/session.ts +173 -0
  60. package/src/runtime/worker.ts +99 -0
  61. package/src/validators/ajv.ts +257 -0
  62. package/src/vscode/README.md +1 -1
  63. package/src/vscode/extension.ts +2 -4
  64. package/src/vscode/package.json +9 -2
  65. package/dist/engine-BgWBnb1A.mjs +0 -746
  66. package/dist/engine-BgWBnb1A.mjs.map +0 -1
  67. package/examples/basic/correctly.config.json +0 -10
  68. package/src/core/config.schema.json +0 -47
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine-BgWBnb1A.mjs","names":["configSchema"],"sources":["../src/core/config.schema.json","../src/core/parse.ts","../src/core/types.ts","../src/core/config.ts","../src/core/schemas.ts","../src/core/diagnostics.ts","../src/core/engine.ts"],"sourcesContent":["","import {\n\tfindNodeAtLocation,\n\tgetNodePath,\n\tgetNodeValue,\n\tparseTree,\n\tprintParseErrorCode,\n\ttype Node,\n\ttype ParseError,\n} from \"jsonc-parser\"\nimport type { Diagnostic, Mode, Position } from \"./types.ts\"\n\nexport type SourceSpan = { offset: number; length: number }\nexport type ParsedDocument = {\n\tvalue: unknown\n\tdiagnostics: Diagnostic[]\n\tlocate: (pointer: string, key?: boolean) => SourceSpan | undefined\n}\nexport type ParsedJsonDocument = ParsedDocument & { root: Node | undefined }\n\nexport function pointer(parts: readonly (string | number)[]): string {\n\treturn parts\n\t\t.map((p) => `/${String(p).replace(/~/g, \"~0\").replace(/\\//g, \"~1\")}`)\n\t\t.join(\"\")\n}\n\nexport function positionAt(text: string, offset: number): Position {\n\tconst end = Math.min(Math.max(0, offset), text.length)\n\tlet line = 0\n\tlet start = 0\n\tfor (let i = 0; i < end; i++) {\n\t\tif (text[i] === \"\\r\") {\n\t\t\tif (text[i + 1] === \"\\n\" && i + 1 < end) i++\n\t\t\tline++\n\t\t\tstart = i + 1\n\t\t} else if (text[i] === \"\\n\") {\n\t\t\tline++\n\t\t\tstart = i + 1\n\t\t}\n\t}\n\treturn { line, character: end - start }\n}\n\nexport function diagnostic(\n\ttext: string,\n\tcode: string,\n\tmessage: string,\n\tjsonPointer = \"\",\n\toffset = 0,\n\tlength = 1,\n): Diagnostic {\n\tconst start = Math.min(offset, text.length)\n\tconst size = Math.min(Math.max(1, length), text.length - start)\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\tpointer: jsonPointer,\n\t\toffset: start,\n\t\tlength: size,\n\t\trange: {\n\t\t\tstart: positionAt(text, start),\n\t\t\tend: positionAt(text, start + size),\n\t\t},\n\t}\n}\n\nexport function parseDocument(text: string, mode: Mode): ParsedJsonDocument {\n\tconst errors: ParseError[] = []\n\tconst root = parseTree(text, errors, {\n\t\tdisallowComments: mode === \"json\",\n\t\tallowTrailingComma: mode === \"jsonc\",\n\t\tallowEmptyContent: false,\n\t})\n\tconst diagnostics = errors.map((e) =>\n\t\tdiagnostic(\n\t\t\ttext,\n\t\t\t\"syntax\",\n\t\t\tprintParseErrorCode(e.error),\n\t\t\t\"\",\n\t\t\te.offset,\n\t\t\te.length,\n\t\t),\n\t)\n\tfunction visit(node: Node) {\n\t\tif (node.type === \"object\") {\n\t\t\tconst keys = new Set<string>()\n\t\t\tfor (const property of node.children ?? []) {\n\t\t\t\tconst key = property.children?.[0]\n\t\t\t\tif (!key || typeof key.value !== \"string\") continue\n\t\t\t\tif (keys.has(key.value)) {\n\t\t\t\t\tdiagnostics.push(\n\t\t\t\t\t\tdiagnostic(\n\t\t\t\t\t\t\ttext,\n\t\t\t\t\t\t\t\"duplicate-key\",\n\t\t\t\t\t\t\t`Duplicate key ${JSON.stringify(key.value)}`,\n\t\t\t\t\t\t\tpointer([...getNodePath(node), key.value]),\n\t\t\t\t\t\t\tkey.offset,\n\t\t\t\t\t\t\tkey.length,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tkeys.add(key.value)\n\t\t\t}\n\t\t}\n\t\tif (node.type === \"number\" && !Number.isFinite(node.value)) {\n\t\t\tdiagnostics.push(\n\t\t\t\tdiagnostic(\n\t\t\t\t\ttext,\n\t\t\t\t\t\"syntax\",\n\t\t\t\t\t\"Number exceeds the supported finite range\",\n\t\t\t\t\tpointer(getNodePath(node)),\n\t\t\t\t\tnode.offset,\n\t\t\t\t\tnode.length,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t\tfor (const child of node.children ?? []) visit(child)\n\t}\n\tif (root) visit(root)\n\t// jsonc-parser's object values have null prototypes. Ajv's deep equality\n\t// expects ordinary JSON objects; Object.fromEntries safely preserves __proto__.\n\tfunction value(node: Node): unknown {\n\t\tif (node.type === \"object\")\n\t\t\treturn Object.fromEntries(\n\t\t\t\t(node.children ?? []).flatMap((property) => {\n\t\t\t\t\tconst key = property.children?.[0]\n\t\t\t\t\tconst child = property.children?.[1]\n\t\t\t\t\treturn key && child ? [[String(key.value), value(child)]] : []\n\t\t\t\t}),\n\t\t\t)\n\t\tif (node.type === \"array\") return (node.children ?? []).map(value)\n\t\treturn getNodeValue(node) as unknown\n\t}\n\treturn {\n\t\troot,\n\t\tvalue: root ? value(root) : undefined,\n\t\tdiagnostics,\n\t\tlocate: (jsonPointer, key = false) => {\n\t\t\tconst node = locate(root, jsonPointer, key)\n\t\t\treturn node ? { offset: node.offset, length: node.length } : undefined\n\t\t},\n\t}\n}\n\nexport function locate(\n\troot: Node | undefined,\n\tjsonPointer: string,\n\tkey = false,\n): Node | undefined {\n\tif (!root) return undefined\n\tconst parts =\n\t\tjsonPointer === \"\"\n\t\t\t? []\n\t\t\t: jsonPointer\n\t\t\t\t\t.slice(1)\n\t\t\t\t\t.split(\"/\")\n\t\t\t\t\t.map((p) => p.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\tlet current = root\n\tfor (const part of parts) {\n\t\tconst next = findNodeAtLocation(current, [\n\t\t\tcurrent.type === \"array\" ? Number(part) : part,\n\t\t])\n\t\tif (!next) break\n\t\tcurrent = next\n\t}\n\treturn key && current.parent?.type === \"property\"\n\t\t? (current.parent.children?.[0] ?? current)\n\t\t: current\n}\n","export type Mode = \"json\" | \"jsonc\"\nexport type Position = { line: number; character: number }\nexport type Range = { start: Position; end: Position }\nexport type Diagnostic = {\n\tcode: string\n\tmessage: string\n\tpointer: string\n\toffset: number\n\tlength: number\n\trange: Range\n\tcontext?: { parent: number; label: string }\n}\nexport type Failure = { code: string; message: string; file?: string }\nexport class CorrectlyError extends Error {\n\treadonly code: string\n\tconstructor(code: string, message: string) {\n\t\tsuper(message)\n\t\tthis.name = \"CorrectlyError\"\n\t\tthis.code = code\n\t}\n}\nexport function failure(error: unknown, file?: string): Failure {\n\treturn {\n\t\tcode: error instanceof CorrectlyError ? error.code : \"execution\",\n\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t...(file === undefined ? {} : { file }),\n\t}\n}\nexport type Association = {\n\tindex: number\n\tname: string\n\tschema: string | null\n\tmode: Mode\n}\nexport type FileResult = {\n\tfile: string\n\tmode: Mode\n\tcoverage: \"schema\" | \"syntax-only\" | \"excluded\"\n\tassociation: Association | null\n\tdiagnostics: Diagnostic[]\n\tfailures: Failure[]\n}\nexport type Report = {\n\treportVersion: 1\n\tconfig: string | null\n\tfiles: FileResult[]\n\tfailures: Failure[]\n\tsummary: {\n\t\tchecked: number\n\t\tschemaCovered: number\n\t\tsyntaxOnly: number\n\t\tinvalid: number\n\t\tfailures: number\n\t}\n\texitCode: 0 | 1 | 2\n}\n","import { readFile, stat } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\nimport { Ajv } from \"ajv\"\nimport picomatch from \"picomatch\"\nimport configSchema from \"./config.schema.json\" with { type: \"json\" }\nimport { parseDocument } from \"./parse.ts\"\nimport { CorrectlyError, type Association, type Mode } from \"./types.ts\"\n\nexport const CONFIG_NAME = \"correctly.config.json\"\nexport const DEFAULT_EXCLUDES = [\n\t\"**/node_modules/**\",\n\t\"**/.git/**\",\n\t\"**/dist/**\",\n\t\"**/artifacts/**\",\n\t\"**/.correctly-cache/**\",\n]\nexport type ProjectConfig = {\n\tfiles?: string[]\n\texclude?: string[]\n\tassociations: {\n\t\tname?: string\n\t\tfiles: string[]\n\t\tschema: string | null\n\t\tmode?: Mode\n\t}[]\n\tremote?: {\n\t\toffline?: boolean\n\t\tcacheDir?: string\n\t\ttimeoutMs?: number\n\t\tmaxBytes?: number\n\t\tmaxRequests?: number\n\t}\n}\nexport type Project = {\n\tconfigPath: string\n\troot: string\n\tconfig: ProjectConfig\n}\nexport type ReadText = (uri: string) => Promise<string>\nexport const readText: ReadText = (uri) => readFile(fileURLToPath(uri), \"utf8\")\nconst validateConfig = new Ajv({ allErrors: true, strict: true }).compile(\n\tconfigSchema,\n)\n\nexport function contains(root: string, file: string): boolean {\n\tconst relative = path.relative(root, file)\n\treturn (\n\t\trelative !== \"..\" &&\n\t\t!relative.startsWith(`..${path.sep}`) &&\n\t\t!path.isAbsolute(relative)\n\t)\n}\n\nexport async function discoverConfig(\n\tstart: string,\n\tboundary?: string,\n\tvirtualFiles: ReadonlySet<string> = new Set(),\n): Promise<string> {\n\tlet directory = path.resolve(start)\n\tif (boundary && !contains(boundary, directory))\n\t\tthrow new CorrectlyError(\"config\", `Path is outside workspace ${boundary}`)\n\twhile (true) {\n\t\tconst candidate = path.join(directory, CONFIG_NAME)\n\t\tif (virtualFiles.has(candidate)) return candidate\n\t\ttry {\n\t\t\tconst info = await stat(candidate)\n\t\t\tif (info.isFile()) return candidate\n\t\t} catch (error) {\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error\n\t\t}\n\t\tconst parent = path.dirname(directory)\n\t\tif (directory === boundary || parent === directory) break\n\t\tdirectory = parent\n\t}\n\tthrow new CorrectlyError(\n\t\t\"config\",\n\t\t`No ${CONFIG_NAME} found from ${start}${boundary ? ` within ${boundary}` : \"\"}`,\n\t)\n}\n\nexport async function loadProject(\n\tconfigPath: string,\n\tread: ReadText = readText,\n): Promise<Project> {\n\tconst resolved = path.resolve(configPath)\n\tlet text: string\n\ttry {\n\t\ttext = await read(pathToFileURL(resolved).href)\n\t} catch (error) {\n\t\tthrow new CorrectlyError(\n\t\t\t\"config\",\n\t\t\t`Cannot read configuration ${resolved}: ${String(error)}`,\n\t\t)\n\t}\n\tconst parsed = parseDocument(text, \"json\")\n\tif (parsed.diagnostics.length) {\n\t\tconst d = parsed.diagnostics[0]!\n\t\tthrow new CorrectlyError(\n\t\t\t\"config\",\n\t\t\t`${resolved}:${d.range.start.line + 1}:${d.range.start.character + 1}: ${d.message}`,\n\t\t)\n\t}\n\tif (!validateConfig(parsed.value)) {\n\t\tthrow new CorrectlyError(\n\t\t\t\"config\",\n\t\t\t`${resolved}: ${validateConfig.errors?.map((e) => `${e.instancePath || \"/\"} ${e.message}`).join(\"; \")}`,\n\t\t)\n\t}\n\tconst config = parsed.value as ProjectConfig\n\tfor (const pattern of [\n\t\t...(config.files ?? []),\n\t\t...(config.exclude ?? []),\n\t\t...config.associations.flatMap((a) => a.files),\n\t]) {\n\t\tif (pattern.includes(\"\\\\\"))\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"config\",\n\t\t\t\t`Use forward slashes in patterns: ${pattern}`,\n\t\t\t)\n\t}\n\treturn { configPath: resolved, root: path.dirname(resolved), config }\n}\n\nexport function schemaUri(value: string, root: string): string {\n\tif (\n\t\t/^[A-Za-z][A-Za-z\\d+.-]*:/.test(value) &&\n\t\t!/^[A-Za-z]:[\\\\/]/.test(value)\n\t) {\n\t\tconst uri = new URL(value)\n\t\tif (![\"file:\", \"http:\", \"https:\"].includes(uri.protocol))\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema\",\n\t\t\t\t`Unsupported schema protocol: ${uri.protocol}`,\n\t\t\t)\n\t\treturn uri.href\n\t}\n\tconst hash = value.indexOf(\"#\")\n\tconst filename = hash === -1 ? value : value.slice(0, hash)\n\tconst uri = pathToFileURL(path.resolve(root, filename))\n\tif (hash !== -1) uri.hash = value.slice(hash + 1)\n\treturn uri.href\n}\n\nexport function exclusions(project: Project): string[] {\n\tconst cachePath = path.resolve(\n\t\tproject.root,\n\t\tproject.config.remote?.cacheDir ?? \".correctly-cache\",\n\t)\n\tconst relative = path\n\t\t.relative(project.root, cachePath)\n\t\t.split(path.sep)\n\t\t.join(\"/\")\n\treturn [\n\t\t...DEFAULT_EXCLUDES,\n\t\t...(project.config.exclude ?? []),\n\t\t...(relative && contains(project.root, cachePath)\n\t\t\t? [`${relative}/**`]\n\t\t\t: []),\n\t]\n}\n\nexport function isIncluded(project: Project, file: string): boolean {\n\tif (!contains(project.root, file)) return false\n\tconst relative = path.relative(project.root, file).split(path.sep).join(\"/\")\n\tconst options = { dot: true }\n\treturn (\n\t\tpicomatch(\n\t\t\tproject.config.files ?? [\"**/*.json\", \"**/*.jsonc\"],\n\t\t\toptions,\n\t\t)(relative) && !picomatch(exclusions(project), options)(relative)\n\t)\n}\n\nexport function associationFor(\n\tproject: Project,\n\tfile: string,\n): Association | null {\n\tconst relative = path.relative(project.root, file).split(path.sep).join(\"/\")\n\tfor (\n\t\tlet index = project.config.associations.length - 1;\n\t\tindex >= 0;\n\t\tindex--\n\t) {\n\t\tconst rule = project.config.associations[index]!\n\t\tif (picomatch(rule.files, { dot: true })(relative)) {\n\t\t\treturn {\n\t\t\t\tindex,\n\t\t\t\tname: rule.name ?? `association ${index + 1}`,\n\t\t\t\tschema:\n\t\t\t\t\trule.schema === null ? null : schemaUri(rule.schema, project.root),\n\t\t\t\tmode: rule.mode ?? modeFor(file),\n\t\t\t}\n\t\t}\n\t}\n\treturn null\n}\nexport function modeFor(file: string): Mode {\n\treturn path.extname(file).toLowerCase() === \".jsonc\" ? \"jsonc\" : \"json\"\n}\n","import { createHash, randomUUID } from \"node:crypto\"\nimport { mkdir, readFile, rename, writeFile } from \"node:fs/promises\"\nimport path from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport type { AnySchema, SchemaObject } from \"ajv\"\nimport { parseDocument } from \"./parse.ts\"\nimport { readText, type Project, type ReadText } from \"./config.ts\"\nimport { CorrectlyError } from \"./types.ts\"\n\nexport type Dialect = \"draft7\" | \"2020-12\"\nexport const DIALECTS = {\n\tdraft7: \"http://json-schema.org/draft-07/schema#\",\n\t\"2020-12\": \"https://json-schema.org/draft/2020-12/schema\",\n} as const\nconst VOCABULARIES = new Set(\n\t[\n\t\t\"core\",\n\t\t\"applicator\",\n\t\t\"unevaluated\",\n\t\t\"validation\",\n\t\t\"meta-data\",\n\t\t\"format-annotation\",\n\t\t\"content\",\n\t].map((name) => `https://json-schema.org/draft/2020-12/vocab/${name}`),\n)\nconst SINGLE_SCHEMAS = [\n\t\"additionalItems\",\n\t\"additionalProperties\",\n\t\"contains\",\n\t\"propertyNames\",\n\t\"not\",\n\t\"if\",\n\t\"then\",\n\t\"else\",\n\t\"unevaluatedProperties\",\n\t\"unevaluatedItems\",\n\t\"contentSchema\",\n]\nconst MAP_SCHEMAS = [\n\t\"properties\",\n\t\"patternProperties\",\n\t\"definitions\",\n\t\"$defs\",\n\t\"dependentSchemas\",\n\t\"dependencies\",\n]\nconst ARRAY_SCHEMAS = [\"allOf\", \"anyOf\", \"oneOf\", \"prefixItems\"]\n\nfunction isObject(value: unknown): value is SchemaObject {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\nfunction dialect(value: unknown, inherited: Dialect): Dialect {\n\tif (value === undefined) return inherited\n\tif (typeof value !== \"string\")\n\t\tthrow new CorrectlyError(\"schema\", \"Schema $schema must be a string\")\n\tconst id = value.replace(/#$/, \"\")\n\tif (\n\t\tid === \"http://json-schema.org/draft-07/schema\" ||\n\t\tid === \"https://json-schema.org/draft-07/schema\"\n\t)\n\t\treturn \"draft7\"\n\tif (id === DIALECTS[\"2020-12\"]) return \"2020-12\"\n\tthrow new CorrectlyError(\n\t\t\"unsupported-dialect\",\n\t\t`Unsupported schema dialect: ${value}; supported: draft 7, draft 2020-12`,\n\t)\n}\n\nexport type SchemaResource = {\n\turi: string\n\tschema: AnySchema\n\tdialect: Dialect\n}\ntype CacheEntry = {\n\turi: string\n\ttext: string\n\tetag?: string\n\tlastModified?: string\n}\nexport type StoreOptions = {\n\toffline?: boolean\n\tread?: ReadText\n\tfetch?: typeof fetch\n\tsignal?: AbortSignal\n}\n\nexport class SchemaStore {\n\tprivate readonly options: StoreOptions\n\treadonly resources = new Map<string, SchemaResource>()\n\tprivate readonly pending = new Map<string, Promise<SchemaResource>>()\n\tprivate readonly cacheDir: string\n\tprivate readonly offline: boolean\n\tprivate readonly timeoutMs: number\n\tprivate readonly maxBytes: number\n\tprivate readonly maxRequests: number\n\tprivate readonly read: ReadText\n\tprivate readonly request: typeof fetch\n\tprivate requests = 0\n\tconstructor(project: Project, options: StoreOptions = {}) {\n\t\tthis.options = options\n\t\tconst remote = project.config.remote\n\t\tthis.cacheDir = path.resolve(\n\t\t\tproject.root,\n\t\t\tremote?.cacheDir ?? \".correctly-cache\",\n\t\t)\n\t\tthis.offline = options.offline ?? remote?.offline ?? false\n\t\tthis.timeoutMs = remote?.timeoutMs ?? 5000\n\t\tthis.maxBytes = remote?.maxBytes ?? 2 * 1024 * 1024\n\t\tthis.maxRequests = remote?.maxRequests ?? 64\n\t\tthis.read = options.read ?? readText\n\t\tthis.request = options.fetch ?? fetch\n\t}\n\n\tasync load(\n\t\tvalue: string,\n\t\tinherited: Dialect = \"draft7\",\n\t): Promise<SchemaResource> {\n\t\tthis.options.signal?.throwIfAborted()\n\t\tconst url = new URL(value)\n\t\turl.hash = \"\"\n\t\tconst uri = url.href\n\t\tconst known = this.resources.get(uri)\n\t\tif (known) return known\n\t\tlet promise = this.pending.get(uri)\n\t\tif (!promise) {\n\t\t\tpromise = this.loadResource(uri, inherited)\n\t\t\tthis.pending.set(uri, promise)\n\t\t}\n\t\treturn promise\n\t}\n\n\tprivate async loadResource(\n\t\turi: string,\n\t\tinherited: Dialect,\n\t): Promise<SchemaResource> {\n\t\tif (++this.requests > this.maxRequests)\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema-limit\",\n\t\t\t\t`Schema resource limit (${this.maxRequests}) exceeded`,\n\t\t\t)\n\t\tlet text: string\n\t\tconst url = new URL(uri)\n\t\ttry {\n\t\t\tif (url.protocol === \"file:\") text = await this.read(uri)\n\t\t\telse if (url.protocol === \"https:\" || url.protocol === \"http:\")\n\t\t\t\ttext = await this.remote(uri)\n\t\t\telse\n\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\"schema\",\n\t\t\t\t\t`Unsupported schema protocol: ${url.protocol}`,\n\t\t\t\t)\n\t\t} catch (error) {\n\t\t\tif (error instanceof CorrectlyError) throw error\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema-load\",\n\t\t\t\t`Cannot load schema ${uri}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t)\n\t\t}\n\t\tthis.options.signal?.throwIfAborted()\n\t\tif (Buffer.byteLength(text) > this.maxBytes)\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema-limit\",\n\t\t\t\t`Schema ${uri} exceeds ${this.maxBytes} bytes`,\n\t\t\t)\n\t\tconst parsed = parseDocument(text, \"json\")\n\t\tif (parsed.diagnostics.length) {\n\t\t\tconst d = parsed.diagnostics[0]!\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema\",\n\t\t\t\t`Invalid schema JSON at ${uri}:${d.range.start.line + 1}:${d.range.start.character + 1}: ${d.message}`,\n\t\t\t)\n\t\t}\n\t\tif (typeof parsed.value !== \"boolean\" && !isObject(parsed.value))\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema\",\n\t\t\t\t`Schema must be an object or boolean: ${uri}`,\n\t\t\t)\n\t\tconst rootDialect = dialect(\n\t\t\tisObject(parsed.value) ? parsed.value.$schema : undefined,\n\t\t\tinherited,\n\t\t)\n\t\tconst schema = parsed.value as AnySchema\n\t\tconst resource: SchemaResource = { uri, schema, dialect: rootDialect }\n\t\t// Normalize schema identifiers only, never document data or annotation values.\n\t\tthis.normalize(schema, uri, rootDialect, resource)\n\t\tif (isObject(schema) && schema.$id === undefined) schema.$id = uri\n\t\tthis.register(uri, resource)\n\t\treturn resource\n\t}\n\n\tprivate register(uri: string, resource: SchemaResource) {\n\t\tconst previous = this.resources.get(uri)\n\t\tif (previous && previous.schema !== resource.schema)\n\t\t\tthrow new CorrectlyError(\"schema\", `Duplicate schema identifier: ${uri}`)\n\t\tthis.resources.set(uri, resource)\n\t}\n\n\tprivate normalize(\n\t\tschema: unknown,\n\t\tbase: string,\n\t\texpected: Dialect,\n\t\troot: SchemaResource,\n\t) {\n\t\tif (!isObject(schema)) return\n\t\tconst ownDialect = dialect(schema.$schema, expected)\n\t\tif (ownDialect !== expected)\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"unsupported-dialect\",\n\t\t\t\t`Mixed schema dialects at ${base} are not supported`,\n\t\t\t)\n\t\tif (schema.$schema !== undefined) schema.$schema = DIALECTS[ownDialect]\n\t\tif (schema.$async !== undefined)\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema\",\n\t\t\t\t`Asynchronous data validation is not supported: ${base}`,\n\t\t\t)\n\t\tif (schema.$vocabulary !== undefined) {\n\t\t\tif (!isObject(schema.$vocabulary))\n\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\"schema\",\n\t\t\t\t\t`$vocabulary must be an object: ${base}`,\n\t\t\t\t)\n\t\t\tfor (const [vocabulary, required] of Object.entries(schema.$vocabulary)) {\n\t\t\t\tif (typeof required !== \"boolean\")\n\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\"schema\",\n\t\t\t\t\t\t`$vocabulary values must be boolean: ${base}`,\n\t\t\t\t\t)\n\t\t\t\tif (required && !VOCABULARIES.has(vocabulary))\n\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\"unsupported-vocabulary\",\n\t\t\t\t\t\t`Unsupported required vocabulary: ${vocabulary}`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tlet scope = base\n\t\tif (schema.$id !== undefined) {\n\t\t\tif (typeof schema.$id !== \"string\")\n\t\t\t\tthrow new CorrectlyError(\"schema\", `$id must be a string: ${base}`)\n\t\t\tscope = new URL(schema.$id, base).href\n\t\t\tschema.$id = scope\n\t\t\tthis.register(scope.replace(/#$/, \"\"), { ...root, schema })\n\t\t}\n\t\tfor (const anchor of [schema.$anchor, schema.$dynamicAnchor]) {\n\t\t\tif (typeof anchor === \"string\")\n\t\t\t\tthis.register(new URL(`#${anchor}`, scope).href, { ...root, schema })\n\t\t}\n\t\tfor (const key of SINGLE_SCHEMAS)\n\t\t\tthis.normalize(schema[key], scope, expected, root)\n\t\tfor (const key of MAP_SCHEMAS) {\n\t\t\tif (isObject(schema[key]))\n\t\t\t\tfor (const child of Object.values(\n\t\t\t\t\tschema[key] as Record<string, unknown>,\n\t\t\t\t))\n\t\t\t\t\tthis.normalize(child, scope, expected, root)\n\t\t}\n\t\tfor (const key of [...ARRAY_SCHEMAS, \"items\"]) {\n\t\t\tconst children: unknown = schema[key]\n\t\t\tif (Array.isArray(children))\n\t\t\t\tfor (const child of children)\n\t\t\t\t\tthis.normalize(child, scope, expected, root)\n\t\t\telse if (key === \"items\") this.normalize(children, scope, expected, root)\n\t\t}\n\t}\n\n\tprivate async remote(uri: string): Promise<string> {\n\t\tconst cacheFile = path.join(\n\t\t\tthis.cacheDir,\n\t\t\t`${createHash(\"sha256\").update(uri).digest(\"hex\")}.json`,\n\t\t)\n\t\tlet cached: CacheEntry | undefined\n\t\ttry {\n\t\t\tconst raw = await readFile(cacheFile, \"utf8\")\n\t\t\tconst entry: unknown = JSON.parse(raw)\n\t\t\tif (\n\t\t\t\t!isObject(entry) ||\n\t\t\t\tentry.uri !== uri ||\n\t\t\t\ttypeof entry.text !== \"string\"\n\t\t\t)\n\t\t\t\tthrow new Error(\"invalid cache entry\")\n\t\t\tcached = entry as CacheEntry\n\t\t} catch (error) {\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\")\n\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\"schema-cache\",\n\t\t\t\t\t`Cannot read schema cache ${cacheFile}: ${String(error)}`,\n\t\t\t\t)\n\t\t}\n\t\tif (this.offline) {\n\t\t\tif (!cached)\n\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\"offline-miss\",\n\t\t\t\t\t`Schema is not cached in offline mode: ${uri}`,\n\t\t\t\t)\n\t\t\treturn cached.text\n\t\t}\n\t\tconst timeout = AbortSignal.timeout(this.timeoutMs)\n\t\tconst signal = this.options.signal\n\t\t\t? AbortSignal.any([this.options.signal, timeout])\n\t\t\t: timeout\n\t\tconst headers: Record<string, string> = {}\n\t\tif (cached?.etag) headers[\"If-None-Match\"] = cached.etag\n\t\tif (cached?.lastModified) headers[\"If-Modified-Since\"] = cached.lastModified\n\t\tlet current = uri\n\t\tfor (let redirects = 0; redirects <= 5; redirects++) {\n\t\t\tconst response = await this.request(current, {\n\t\t\t\tsignal,\n\t\t\t\theaders,\n\t\t\t\tredirect: \"manual\",\n\t\t\t})\n\t\t\tif ([301, 302, 303, 307, 308].includes(response.status)) {\n\t\t\t\tawait response.body?.cancel()\n\t\t\t\tconst location = response.headers.get(\"location\")\n\t\t\t\tif (!location)\n\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\"schema-load\",\n\t\t\t\t\t\t`Redirect without location: ${current}`,\n\t\t\t\t\t)\n\t\t\t\tcurrent = new URL(location, current).href\n\t\t\t\tif (![\"http:\", \"https:\"].includes(new URL(current).protocol))\n\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\"schema-load\",\n\t\t\t\t\t\t`Unsupported redirect: ${current}`,\n\t\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (response.status === 304 && cached) {\n\t\t\t\tawait response.body?.cancel()\n\t\t\t\treturn cached.text\n\t\t\t}\n\t\t\tif (!response.ok || !response.body) {\n\t\t\t\tawait response.body?.cancel()\n\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\"schema-load\",\n\t\t\t\t\t`HTTP ${response.status} loading schema ${uri}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst reader = response.body.getReader()\n\t\t\tconst chunks: Uint8Array[] = []\n\t\t\tlet size = 0\n\t\t\ttry {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst { value, done } = await reader.read()\n\t\t\t\t\tif (done) break\n\t\t\t\t\tsize += value.byteLength\n\t\t\t\t\tif (size > this.maxBytes)\n\t\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\t\"schema-limit\",\n\t\t\t\t\t\t\t`Schema ${uri} exceeds ${this.maxBytes} bytes`,\n\t\t\t\t\t\t)\n\t\t\t\t\tchunks.push(value)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tawait reader.cancel()\n\t\t\t}\n\t\t\tconst text = Buffer.concat(chunks).toString(\"utf8\")\n\t\t\tconst entry: CacheEntry = { uri, text }\n\t\t\tconst etag = response.headers.get(\"etag\")\n\t\t\tconst lastModified = response.headers.get(\"last-modified\")\n\t\t\tif (etag) entry.etag = etag\n\t\t\tif (lastModified) entry.lastModified = lastModified\n\t\t\tsignal.throwIfAborted()\n\t\t\tawait mkdir(this.cacheDir, { recursive: true })\n\t\t\tconst temporary = `${cacheFile}.${randomUUID()}.tmp`\n\t\t\tawait writeFile(temporary, JSON.stringify(entry))\n\t\t\tawait rename(temporary, cacheFile)\n\t\t\treturn text\n\t\t}\n\t\tthrow new CorrectlyError(\n\t\t\t\"schema-limit\",\n\t\t\t`Too many redirects loading schema ${uri}`,\n\t\t)\n\t}\n}\n\nexport function localSchemaPath(uri: string): string | undefined {\n\tconst url = new URL(uri)\n\treturn url.protocol === \"file:\" ? fileURLToPath(url) : undefined\n}\n","import type { ErrorObject } from \"ajv\"\nimport type { Diagnostic } from \"./types.ts\"\n\nexport type DiagnosticView = Diagnostic & {\n\tbranches: { label: string; diagnostics: DiagnosticView[] }[]\n}\n\n// Ajv emits branch failures before the applicator's summary. Keep the complete\n// flat report and annotate only relationships established by schema paths.\n// Reference paths can lose their caller; leave those errors standalone.\nexport function validationContexts(\n\terrors: readonly ErrorObject[],\n\tdiagnostics: Diagnostic[],\n): Diagnostic[] {\n\tconst summaries = errors.flatMap((error, index) => {\n\t\tif (error.keyword === \"anyOf\" || error.keyword === \"oneOf\")\n\t\t\treturn [\n\t\t\t\t{ index, error, prefix: `${error.schemaPath}/`, alternative: true },\n\t\t\t]\n\t\tif (\n\t\t\terror.keyword === \"if\" &&\n\t\t\t[\"then\", \"else\"].includes(error.params.failingKeyword as string)\n\t\t)\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tindex,\n\t\t\t\t\terror,\n\t\t\t\t\tprefix: `${error.schemaPath.slice(0, -3)}/${error.params.failingKeyword}`,\n\t\t\t\t\talternative: false,\n\t\t\t\t},\n\t\t\t]\n\t\treturn []\n\t})\n\treturn diagnostics.map((diagnostic, index) => {\n\t\tconst error = errors[index]!\n\t\tconst candidates = summaries.filter(\n\t\t\t(parent) =>\n\t\t\t\tparent.index > index &&\n\t\t\t\t(error.instancePath === parent.error.instancePath ||\n\t\t\t\t\terror.instancePath.startsWith(`${parent.error.instancePath}/`)) &&\n\t\t\t\t(parent.error.propertyName === undefined ||\n\t\t\t\t\terror.propertyName === parent.error.propertyName) &&\n\t\t\t\t(parent.alternative\n\t\t\t\t\t? error.schemaPath.startsWith(parent.prefix)\n\t\t\t\t\t: error.schemaPath === parent.prefix ||\n\t\t\t\t\t\terror.schemaPath.startsWith(`${parent.prefix}/`)),\n\t\t)\n\t\tconst parent = candidates.toSorted(\n\t\t\t(a, b) => b.prefix.length - a.prefix.length || a.index - b.index,\n\t\t)[0]\n\t\tif (!parent) return diagnostic\n\t\tconst branch = parent.alternative\n\t\t\t? error.schemaPath.slice(parent.prefix.length).split(\"/\")[0]!\n\t\t\t: (parent.error.params.failingKeyword as string)\n\t\tif (parent.alternative && !/^\\d+$/.test(branch)) return diagnostic\n\t\treturn {\n\t\t\t...diagnostic,\n\t\t\tcontext: {\n\t\t\t\tparent: parent.index,\n\t\t\t\tlabel: parent.alternative\n\t\t\t\t\t? `Alternative ${Number(branch) + 1}`\n\t\t\t\t\t: branch === \"then\"\n\t\t\t\t\t\t? \"Then branch\"\n\t\t\t\t\t\t: \"Else branch\",\n\t\t\t},\n\t\t}\n\t})\n}\n\nexport function diagnosticViews(\n\tdiagnostics: readonly Diagnostic[],\n): DiagnosticView[] {\n\tconst views = diagnostics.map((diagnostic): DiagnosticView => ({\n\t\t...diagnostic,\n\t\tbranches: [],\n\t}))\n\tconst roots: DiagnosticView[] = []\n\tfor (const [index, view] of views.entries()) {\n\t\tconst context = view.context\n\t\t// Parents must follow their children, so malformed metadata cannot create\n\t\t// cycles or make a diagnostic disappear from the displayed report.\n\t\tconst parent =\n\t\t\tcontext && Number.isInteger(context.parent) && context.parent > index\n\t\t\t\t? views[context.parent]\n\t\t\t\t: undefined\n\t\tif (!parent) {\n\t\t\troots.push(view)\n\t\t\tcontinue\n\t\t}\n\t\tlet branch = parent.branches.find(\n\t\t\t(branch) => branch.label === context!.label,\n\t\t)\n\t\tif (!branch) {\n\t\t\tbranch = { label: context!.label, diagnostics: [] }\n\t\t\tparent.branches.push(branch)\n\t\t}\n\t\tbranch.diagnostics.push(view)\n\t}\n\treturn roots\n}\n\nexport function diagnosticDetails(\n\tview: DiagnosticView,\n): { label: string; diagnostic: DiagnosticView }[] {\n\treturn view.branches.flatMap((branch) =>\n\t\tbranch.diagnostics.flatMap((child) => [\n\t\t\t{ label: branch.label, diagnostic: child },\n\t\t\t...diagnosticDetails(child).map((detail) => ({\n\t\t\t\t...detail,\n\t\t\t\tlabel: `${branch.label} / ${detail.label}`,\n\t\t\t})),\n\t\t]),\n\t)\n}\n","import {\n\tAjv,\n\ttype ErrorObject,\n\ttype ValidateFunction,\n\ttype SchemaObject,\n} from \"ajv\"\nimport { Ajv2020 } from \"ajv/dist/2020.js\"\nimport addFormats from \"ajv-formats\"\nimport {\n\tassociationFor,\n\tisIncluded,\n\tmodeFor,\n\tschemaUri,\n\ttype Project,\n} from \"./config.ts\"\nimport {\n\tdiagnostic,\n\tparseDocument,\n\tpointer,\n\ttype ParsedDocument,\n} from \"./parse.ts\"\nimport { DIALECTS, SchemaStore, type StoreOptions } from \"./schemas.ts\"\nimport { validationContexts } from \"./diagnostics.ts\"\nimport {\n\tCorrectlyError,\n\tfailure,\n\ttype Diagnostic,\n\ttype FileResult,\n} from \"./types.ts\"\n\nconst ANNOTATIONS = [\n\t\"markdownDescription\",\n\t\"enumDescriptions\",\n\t\"markdownEnumDescriptions\",\n\t\"defaultSnippets\",\n\t\"errorMessage\",\n\t\"patternErrorMessage\",\n\t\"deprecationMessage\",\n\t\"suggestSortText\",\n\t\"doNotSuggest\",\n\t\"allowComments\",\n\t\"allowTrailingCommas\",\n\t\"deprecated\",\n\t\"$vocabulary\",\n]\n\nfunction registerRootAnchors(ajv: Ajv, schema: unknown, uri: string) {\n\tif (typeof schema !== \"object\" || schema === null) return\n\tconst object = schema as SchemaObject\n\tfor (const anchor of [object.$anchor, object.$dynamicAnchor]) {\n\t\tif (typeof anchor === \"string\")\n\t\t\tajv.refs[new URL(`#${anchor}`, object.$id ?? uri).href] =\n\t\t\t\tobject.$id ?? uri\n\t}\n}\n\nfunction validationMessage(error: ErrorObject): string {\n\tif (error.keyword === \"anyOf\")\n\t\treturn \"must match at least one alternative; none matched\"\n\tif (\n\t\terror.keyword === \"if\" &&\n\t\t[\"then\", \"else\"].includes(error.params.failingKeyword as string)\n\t)\n\t\treturn `must satisfy the ${error.params.failingKeyword} branch of the conditional schema`\n\tif (error.keyword === \"uniqueItems\") {\n\t\tconst { i, j } = error.params\n\t\tif (Number.isInteger(i) && Number.isInteger(j))\n\t\t\treturn `duplicates item at ${error.instancePath}${pointer([Math.min(i, j)])}; array items must be unique`\n\t}\n\tif (error.keyword === \"enum\" && Array.isArray(error.params.allowedValues))\n\t\treturn `must be one of: ${error.params.allowedValues.map((value: unknown) => JSON.stringify(value)).join(\", \")}`\n\tif (error.keyword === \"const\" && Object.hasOwn(error.params, \"allowedValue\"))\n\t\treturn `must equal ${JSON.stringify(error.params.allowedValue)}`\n\tif (error.keyword === \"oneOf\") {\n\t\tif (error.params.passingSchemas === null)\n\t\t\treturn \"must match exactly one alternative; none matched\"\n\t\tif (Array.isArray(error.params.passingSchemas))\n\t\t\treturn `must match exactly one alternative; multiple matched (alternatives ${error.params.passingSchemas.map((index: number) => index + 1).join(\", \")})`\n\t}\n\treturn error.message ?? \"Schema violation\"\n}\n\nfunction validationDiagnostic(\n\ttext: string,\n\tparsed: ParsedDocument,\n\terror: ErrorObject,\n): Diagnostic {\n\tlet jsonPointer = error.instancePath\n\tif (\n\t\terror.keyword === \"uniqueItems\" &&\n\t\tNumber.isInteger(error.params.i) &&\n\t\tNumber.isInteger(error.params.j)\n\t)\n\t\tjsonPointer += pointer([Math.max(error.params.i, error.params.j)])\n\tconst property: unknown =\n\t\terror.params.additionalProperty ??\n\t\terror.params.unevaluatedProperty ??\n\t\terror.params.missingProperty ??\n\t\terror.params.propertyName ??\n\t\terror.propertyName\n\tif (typeof property === \"string\") jsonPointer += pointer([property])\n\tconst node = parsed.locate(\n\t\tjsonPointer,\n\t\terror.keyword === \"additionalProperties\" ||\n\t\t\terror.keyword === \"unevaluatedProperties\" ||\n\t\t\terror.keyword === \"propertyNames\" ||\n\t\t\ttypeof error.propertyName === \"string\",\n\t)\n\tconst rangeNode =\n\t\terror.keyword === \"required\" && error.propertyName === undefined\n\t\t\t? parsed.locate(error.instancePath)\n\t\t\t: node\n\tconst length =\n\t\terror.keyword === \"required\" && error.propertyName === undefined\n\t\t\t? 1\n\t\t\t: rangeNode?.length\n\treturn diagnostic(\n\t\ttext,\n\t\t`schema/${error.keyword}`,\n\t\t`${jsonPointer || \"/\"}: ${validationMessage(error)}`,\n\t\tjsonPointer,\n\t\trangeNode?.offset ?? 0,\n\t\tlength ?? 1,\n\t)\n}\n\nexport class Engine {\n\treadonly project: Project\n\treadonly store: SchemaStore\n\tprivate readonly compiled = new Map<string, Promise<ValidateFunction>>()\n\tconstructor(project: Project, options: StoreOptions = {}) {\n\t\tthis.project = project\n\t\tthis.store = new SchemaStore(project, options)\n\t}\n\n\tvalidator(uri: string): Promise<ValidateFunction> {\n\t\tlet compiled = this.compiled.get(uri)\n\t\tif (!compiled) {\n\t\t\tcompiled = this.compile(uri)\n\t\t\tthis.compiled.set(uri, compiled)\n\t\t}\n\t\treturn compiled\n\t}\n\n\tprivate async compile(uri: string): Promise<ValidateFunction> {\n\t\ttry {\n\t\t\tconst resource = await this.store.load(uri)\n\t\t\tconst options = {\n\t\t\t\tallErrors: true,\n\t\t\t\tstrictSchema: true,\n\t\t\t\tstrictTypes: false,\n\t\t\t\tstrictTuples: false,\n\t\t\t\tstrictRequired: false,\n\t\t\t\tcoerceTypes: false,\n\t\t\t\tuseDefaults: false,\n\t\t\t\tremoveAdditional: false,\n\t\t\t\tvalidateSchema: true,\n\t\t\t\tloadSchema: async (ref: string) => {\n\t\t\t\t\tconst loaded = await this.store.load(ref, resource.dialect)\n\t\t\t\t\tif (loaded.dialect !== resource.dialect)\n\t\t\t\t\t\tthrow new CorrectlyError(\n\t\t\t\t\t\t\t\"unsupported-dialect\",\n\t\t\t\t\t\t\t`Mixed schema dialects: ${uri} references ${ref}`,\n\t\t\t\t\t\t)\n\t\t\t\t\tregisterRootAnchors(ajv, loaded.schema, loaded.uri)\n\t\t\t\t\treturn loaded.schema as SchemaObject\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst ajv =\n\t\t\t\tresource.dialect === \"2020-12\" ? new Ajv2020(options) : new Ajv(options)\n\t\t\t// CommonJS package exports retain a callable default at runtime.\n\t\t\tconst formats = addFormats as unknown as (instance: Ajv) => void\n\t\t\tformats(ajv)\n\t\t\tfor (const keyword of ANNOTATIONS)\n\t\t\t\tif (!ajv.RULES.keywords[keyword])\n\t\t\t\t\tajv.addKeyword({ keyword, valid: true })\n\t\t\t// Ajv indexes plain anchors during reference resolution, but does not\n\t\t\t// register the annotation keyword in its strict vocabulary.\n\t\t\tif (resource.dialect === \"2020-12\")\n\t\t\t\tajv.addKeyword({\n\t\t\t\t\tkeyword: \"$anchor\",\n\t\t\t\t\tschemaType: \"string\",\n\t\t\t\t\tvalid: true,\n\t\t\t\t})\n\t\t\tajv.addSchema(resource.schema, resource.uri)\n\t\t\tregisterRootAnchors(ajv, resource.schema, resource.uri)\n\t\t\tconst validate = await ajv.compileAsync({\n\t\t\t\t$schema: DIALECTS[resource.dialect],\n\t\t\t\t$ref: uri,\n\t\t\t})\n\t\t\treturn validate as ValidateFunction\n\t\t} catch (error) {\n\t\t\tif (error instanceof CorrectlyError) throw error\n\t\t\tthrow new CorrectlyError(\n\t\t\t\t\"schema\",\n\t\t\t\t`Cannot compile schema ${uri}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t)\n\t\t}\n\t}\n\n\tasync prepare(): Promise<void> {\n\t\t// Register configured resources before compiling references to their IDs.\n\t\tfor (const association of this.project.config.associations) {\n\t\t\tif (association.schema !== null)\n\t\t\t\tawait this.store.load(schemaUri(association.schema, this.project.root))\n\t\t}\n\t\tfor (const association of this.project.config.associations) {\n\t\t\tif (association.schema !== null)\n\t\t\t\tawait this.validator(schemaUri(association.schema, this.project.root))\n\t\t}\n\t}\n\n\tasync validate(file: string, text: string): Promise<FileResult> {\n\t\tconst association = associationFor(this.project, file)\n\t\tconst mode = association?.mode ?? modeFor(file)\n\t\tconst result: FileResult = {\n\t\t\tfile,\n\t\t\tmode,\n\t\t\tassociation,\n\t\t\tcoverage: \"excluded\",\n\t\t\tdiagnostics: [],\n\t\t\tfailures: [],\n\t\t}\n\t\tif (!isIncluded(this.project, file)) return result\n\t\tresult.coverage = association?.schema ? \"schema\" : \"syntax-only\"\n\t\tconst parsed = parseDocument(text, mode)\n\t\tresult.diagnostics.push(...parsed.diagnostics)\n\t\tif (association?.schema) {\n\t\t\ttry {\n\t\t\t\tconst validate = await this.validator(association.schema)\n\t\t\t\tif (parsed.diagnostics.length === 0 && !validate(parsed.value)) {\n\t\t\t\t\tresult.diagnostics.push(\n\t\t\t\t\t\t...validationContexts(\n\t\t\t\t\t\t\tvalidate.errors ?? [],\n\t\t\t\t\t\t\t(validate.errors ?? []).map((e) =>\n\t\t\t\t\t\t\t\tvalidationDiagnostic(text, parsed, e),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tresult.failures.push(failure(error, file))\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBA,SAAgB,QAAQ,OAA6C;CACpE,OAAO,MACL,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,OAAO,IAAI,GAAG,CAAC,CACpE,KAAK,EAAE;AACV;AAEA,SAAgB,WAAW,MAAc,QAA0B;CAClE,MAAM,MAAM,KAAK,IAAI,KAAK,IAAI,GAAG,MAAM,GAA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AAQ,OAAO,IAAI,CAAC;EAC1C;EAED,OAAO;CACR;AACD"}
@@ -1,10 +0,0 @@
1
- {
2
- "files": ["project.json", "project.jsonc"],
3
- "associations": [
4
- {
5
- "name": "Project",
6
- "files": ["project.*"],
7
- "schema": "project.schema.json"
8
- }
9
- ]
10
- }
@@ -1,47 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "type": "object",
4
- "additionalProperties": false,
5
- "required": ["associations"],
6
- "properties": {
7
- "$schema": { "type": "string" },
8
- "files": { "$ref": "#/definitions/patterns" },
9
- "exclude": { "$ref": "#/definitions/patterns" },
10
- "associations": {
11
- "type": "array",
12
- "items": {
13
- "type": "object",
14
- "additionalProperties": false,
15
- "required": ["files", "schema"],
16
- "properties": {
17
- "name": { "type": "string", "minLength": 1 },
18
- "files": { "$ref": "#/definitions/patterns" },
19
- "schema": { "type": ["string", "null"], "minLength": 1 },
20
- "mode": { "enum": ["json", "jsonc"] }
21
- }
22
- }
23
- },
24
- "remote": {
25
- "type": "object",
26
- "additionalProperties": false,
27
- "properties": {
28
- "offline": { "type": "boolean" },
29
- "cacheDir": { "type": "string", "minLength": 1 },
30
- "timeoutMs": { "type": "integer", "minimum": 1, "maximum": 60000 },
31
- "maxBytes": { "type": "integer", "minimum": 1, "maximum": 16777216 },
32
- "maxRequests": { "type": "integer", "minimum": 1, "maximum": 256 }
33
- }
34
- }
35
- },
36
- "definitions": {
37
- "patterns": {
38
- "type": "array",
39
- "minItems": 1,
40
- "items": {
41
- "type": "string",
42
- "minLength": 1,
43
- "pattern": "^(?![/!])(?![A-Za-z]:)(?!.*(?:^|/)\\.\\.(?:/|$)).+"
44
- }
45
- }
46
- }
47
- }