@prisma-next/psl-parser
Advanced tools
@@ -20,3 +20,3 @@ import { notOk } from "@prisma-next/utils/result"; | ||
| function hasPslInterpreter(source) { | ||
| return source.sourceFormat === "psl" && "interpret" in source && typeof source.interpret === "function"; | ||
| return source.format === "psl" && "interpret" in source && typeof source.interpret === "function"; | ||
| } | ||
@@ -23,0 +23,0 @@ //#endregion |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"interpret.mjs","names":[],"sources":["../src/interpret.ts"],"sourcesContent":["import type {\n ContractSourceContext,\n ContractSourceDiagnostic,\n ContractSourceDiagnostics,\n ContractSourceProvider,\n PslContractSourceProvider,\n} from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport type { SourceFile } from './source-file';\nimport type { SymbolTable } from './symbol-table';\nimport type { DocumentAst } from './syntax/ast/declarations';\n\n/**\n * Lets editor tooling that already parses incrementally (e.g. the language\n * server) hand cached artifacts to the interpreter instead of forcing a\n * disk re-parse.\n */\nexport interface PslInterpretInput {\n readonly document: DocumentAst;\n readonly sourceFile: SourceFile;\n readonly symbolTable: SymbolTable;\n readonly sourceId: string;\n}\n\n/**\n * Declared here — the authoring layer that owns `DocumentAst` / `SourceFile` /\n * `SymbolTable` — because `@prisma-next/config` (core) cannot name authoring\n * types. `interpret` must not read disk or `context.resolvedInputs` — those\n * are load-path concerns.\n */\nexport interface PslInterpretCapable extends PslContractSourceProvider {\n interpret(\n input: PslInterpretInput,\n context: ContractSourceContext,\n ): Result<Contract, ContractSourceDiagnostics>;\n}\n\n/**\n * Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n * interpretation result. The authored headline is deliberately uniform — it\n * reports how many errors the schema has, never which pipeline stage found\n * them.\n */\nexport function withSeedDiagnostics(\n result: Result<Contract, ContractSourceDiagnostics>,\n seedDiagnostics: readonly ContractSourceDiagnostic[],\n): Result<Contract, ContractSourceDiagnostics> {\n if (seedDiagnostics.length === 0) {\n return result;\n }\n const diagnostics = result.ok\n ? seedDiagnostics\n : [...seedDiagnostics, ...result.failure.diagnostics];\n return notOk({\n summary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? '' : 's'}`,\n diagnostics,\n ...(result.ok || result.failure.meta === undefined ? {} : { meta: result.failure.meta }),\n });\n}\n\n/** The single seam that narrows a contract source to the interpret capability. */\nexport function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable {\n return (\n source.sourceFormat === 'psl' && 'interpret' in source && typeof source.interpret === 'function'\n );\n}\n"],"mappings":";;;;;;;;AA4CA,SAAgB,oBACd,QACA,iBAC6C;CAC7C,IAAI,gBAAgB,WAAW,GAC7B,OAAO;CAET,MAAM,cAAc,OAAO,KACvB,kBACA,CAAC,GAAG,iBAAiB,GAAG,OAAO,QAAQ,WAAW;CACtD,OAAO,MAAM;EACX,SAAS,cAAc,YAAY,OAAO,QAAQ,YAAY,WAAW,IAAI,KAAK;EAClF;EACA,GAAI,OAAO,MAAM,OAAO,QAAQ,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,OAAO,QAAQ,KAAK;CACxF,CAAC;AACH;;AAGA,SAAgB,kBAAkB,QAA+D;CAC/F,OACE,OAAO,iBAAiB,SAAS,eAAe,UAAU,OAAO,OAAO,cAAc;AAE1F"} | ||
| {"version":3,"file":"interpret.mjs","names":[],"sources":["../src/interpret.ts"],"sourcesContent":["import type {\n ContractSourceContext,\n ContractSourceDiagnostic,\n ContractSourceDiagnostics,\n ContractSourceProvider,\n PslContractSourceProvider,\n} from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport type { SourceFile } from './source-file';\nimport type { SymbolTable } from './symbol-table';\nimport type { DocumentAst } from './syntax/ast/declarations';\n\n/**\n * Lets editor tooling that already parses incrementally (e.g. the language\n * server) hand cached artifacts to the interpreter instead of forcing a\n * disk re-parse.\n */\nexport interface PslInterpretInput {\n readonly document: DocumentAst;\n readonly sourceFile: SourceFile;\n readonly symbolTable: SymbolTable;\n readonly sourceId: string;\n}\n\n/**\n * Declared here — the authoring layer that owns `DocumentAst` / `SourceFile` /\n * `SymbolTable` — because `@prisma-next/config` (core) cannot name authoring\n * types. `interpret` must not read disk or `context.resolvedInputs` — those\n * are load-path concerns.\n */\nexport interface PslInterpretCapable extends PslContractSourceProvider {\n interpret(\n input: PslInterpretInput,\n context: ContractSourceContext,\n ): Result<Contract, ContractSourceDiagnostics>;\n}\n\n/**\n * Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n * interpretation result. The authored headline is deliberately uniform — it\n * reports how many errors the schema has, never which pipeline stage found\n * them.\n */\nexport function withSeedDiagnostics(\n result: Result<Contract, ContractSourceDiagnostics>,\n seedDiagnostics: readonly ContractSourceDiagnostic[],\n): Result<Contract, ContractSourceDiagnostics> {\n if (seedDiagnostics.length === 0) {\n return result;\n }\n const diagnostics = result.ok\n ? seedDiagnostics\n : [...seedDiagnostics, ...result.failure.diagnostics];\n return notOk({\n summary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? '' : 's'}`,\n diagnostics,\n ...(result.ok || result.failure.meta === undefined ? {} : { meta: result.failure.meta }),\n });\n}\n\n/** The single seam that narrows a contract source to the interpret capability. */\nexport function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable {\n return source.format === 'psl' && 'interpret' in source && typeof source.interpret === 'function';\n}\n"],"mappings":";;;;;;;;AA4CA,SAAgB,oBACd,QACA,iBAC6C;CAC7C,IAAI,gBAAgB,WAAW,GAC7B,OAAO;CAET,MAAM,cAAc,OAAO,KACvB,kBACA,CAAC,GAAG,iBAAiB,GAAG,OAAO,QAAQ,WAAW;CACtD,OAAO,MAAM;EACX,SAAS,cAAc,YAAY,OAAO,QAAQ,YAAY,WAAW,IAAI,KAAK;EAClF;EACA,GAAI,OAAO,MAAM,OAAO,QAAQ,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,OAAO,QAAQ,KAAK;CACxF,CAAC;AACH;;AAGA,SAAgB,kBAAkB,QAA+D;CAC/F,OAAO,OAAO,WAAW,SAAS,eAAe,UAAU,OAAO,OAAO,cAAc;AACzF"} |
+7
-7
| { | ||
| "name": "@prisma-next/psl-parser", | ||
| "version": "0.16.0-dev.19", | ||
| "version": "0.16.0-dev.21", | ||
| "license": "Apache-2.0", | ||
@@ -9,10 +9,10 @@ "type": "module", | ||
| "dependencies": { | ||
| "@prisma-next/config": "0.16.0-dev.19", | ||
| "@prisma-next/contract": "0.16.0-dev.19", | ||
| "@prisma-next/framework-components": "0.16.0-dev.19", | ||
| "@prisma-next/utils": "0.16.0-dev.19" | ||
| "@prisma-next/config": "0.16.0-dev.21", | ||
| "@prisma-next/contract": "0.16.0-dev.21", | ||
| "@prisma-next/framework-components": "0.16.0-dev.21", | ||
| "@prisma-next/utils": "0.16.0-dev.21" | ||
| }, | ||
| "devDependencies": { | ||
| "@prisma-next/tsconfig": "0.16.0-dev.19", | ||
| "@prisma-next/tsdown": "0.16.0-dev.19", | ||
| "@prisma-next/tsconfig": "0.16.0-dev.21", | ||
| "@prisma-next/tsdown": "0.16.0-dev.21", | ||
| "tsdown": "0.22.8", | ||
@@ -19,0 +19,0 @@ "typescript": "5.9.3", |
+1
-3
@@ -64,5 +64,3 @@ import type { | ||
| export function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable { | ||
| return ( | ||
| source.sourceFormat === 'psl' && 'interpret' in source && typeof source.interpret === 'function' | ||
| ); | ||
| return source.format === 'psl' && 'interpret' in source && typeof source.interpret === 'function'; | ||
| } |
557035
-0.01%7885
-0.03%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed