@athrio/loom 0.0.11 → 0.0.13

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.
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { r as __exportAll } from "./rolldown-runtime-YU9U6SYh.js";
3
+ import { Di as Service, Nr as TaggedError, Sn as die, mr as effect } from "./dist-LBqwqmSY.js";
4
+ //#region ../loom-lang-services/src/LanguageService.ts
5
+ var LanguageService_exports = /* @__PURE__ */ __exportAll({
6
+ Composition: () => Composition,
7
+ FrameQuery: () => FrameQuery,
8
+ ServiceError: () => ServiceError,
9
+ TypescriptSdk: () => TypescriptSdk,
10
+ defineLanguageService: () => defineLanguageService,
11
+ isLanguageService: () => isLanguageService
12
+ });
13
+ var ServiceError = class extends TaggedError("ServiceError") {};
14
+ var TypescriptSdk = class extends Service()("TypescriptSdk", { make: die("TypescriptSdk must be provided by the host") }) {
15
+ static {
16
+ this.layer = effect(this, this.make);
17
+ }
18
+ };
19
+ var FrameQuery = class extends Service()("FrameQuery", { make: die("FrameQuery must be provided by the host") }) {
20
+ static {
21
+ this.layer = effect(this, this.make);
22
+ }
23
+ };
24
+ var Composition = class extends Service()("Composition", { make: die("Composition must be provided by the host") }) {
25
+ static {
26
+ this.layer = effect(this, this.make);
27
+ }
28
+ };
29
+ var isLanguageService = (value) => typeof value === "object" && value !== null && typeof value.id === "string" && typeof value.displayName === "string" && Array.isArray(value.extensions) && typeof value.plugins === "function";
30
+ var defineLanguageService = (service) => {
31
+ if (!isLanguageService(service)) throw new Error("defineLanguageService: the value does not satisfy the LanguageService contract");
32
+ return service;
33
+ };
34
+ //#endregion
35
+ export { defineLanguageService as a, TypescriptSdk as i, FrameQuery as n, isLanguageService as o, LanguageService_exports as r, Composition as t };
36
+
37
+ //# sourceMappingURL=LanguageService-CcElIYBZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LanguageService-CcElIYBZ.js","names":[],"sources":["../../loom-lang-services/src/LanguageService.ts"],"sourcesContent":["import type { LanguageServicePlugin } from '@volar/language-service'\nimport { Context, Data, Effect, Layer } from 'effect'\nimport { type Diagnostic } from '@athrio/loom-ast/LoomNode'\nimport type { SemanticToken } from '@athrio/loom-ast/LoomSymbol'\n\nexport class ServiceError extends Data.TaggedError('ServiceError')<{\n readonly service: string\n readonly reason: string\n}> {}\n\nexport interface LanguageService {\n readonly id: string\n readonly displayName: string\n readonly extensions: ReadonlyArray<string>\n readonly plugins: (\n context: LanguageServiceContext,\n ) => Effect.Effect<ReadonlyArray<LanguageServicePlugin>, ServiceError, HostCapabilities>\n readonly format?: (request: FormatRequest) => Effect.Effect<string, ServiceError>\n}\n\nexport interface FormatRequest {\n readonly code: string\n readonly path: string\n readonly width: number\n}\n\nexport class TypescriptSdk extends Context.Service<TypescriptSdk>()('TypescriptSdk', {\n make: Effect.die('TypescriptSdk must be provided by the host') as Effect.Effect<\n typeof import('typescript')\n >,\n}) {\n static readonly layer = Layer.effect(this, this.make)\n}\n\nexport interface FrameLocation {\n readonly path: string\n readonly range: {\n readonly start: { readonly line: number; readonly character: number }\n readonly end: { readonly line: number; readonly character: number }\n }\n}\n\nexport interface FrameToken {\n readonly range: FrameLocation['range']\n readonly type: SemanticToken\n}\n\nexport interface FrameQueryApi {\n readonly diagnostics: (path: string) => ReadonlyArray<Diagnostic>\n readonly definition: (path: string, offset: number) => FrameLocation | undefined\n readonly references: (path: string, offset: number) => ReadonlyArray<FrameLocation>\n readonly rename: (path: string, offset: number) => ReadonlyArray<FrameLocation>\n readonly renameRange: (path: string, offset: number) => FrameLocation | undefined\n readonly navigationRange: (path: string, offset: number) => FrameLocation | undefined\n readonly semanticTokens: (path: string) => ReadonlyArray<FrameToken>\n readonly format: (path: string, text: string) => Promise<string>\n}\n\nexport class FrameQuery extends Context.Service<FrameQuery>()('FrameQuery', {\n make: Effect.die('FrameQuery must be provided by the host') as Effect.Effect<FrameQueryApi>,\n}) {\n static readonly layer = Layer.effect(this, this.make)\n}\n\nexport interface ComposedFile {\n readonly path: string\n readonly content: string\n readonly loomPath: string\n readonly rootId: string\n readonly heading: FrameLocation\n}\n\nexport interface CompositionApi {\n readonly rootsFor: (path: string) => ReadonlyArray<ComposedFile>\n}\n\nexport class Composition extends Context.Service<Composition>()('Composition', {\n make: Effect.die('Composition must be provided by the host') as Effect.Effect<CompositionApi>,\n}) {\n static readonly layer = Layer.effect(this, this.make)\n}\n\nexport type HostCapabilities = TypescriptSdk | FrameQuery | Composition\n\nexport interface LanguageServiceContext {\n readonly settings: Record<string, unknown>\n}\n\nexport const isLanguageService = (value: unknown): value is LanguageService =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as LanguageService).id === 'string' &&\n typeof (value as LanguageService).displayName === 'string' &&\n Array.isArray((value as LanguageService).extensions) &&\n typeof (value as LanguageService).plugins === 'function'\n\nexport const defineLanguageService = (service: LanguageService): LanguageService => {\n if (!isLanguageService(service)) {\n throw new Error(\n 'defineLanguageService: the value does not satisfy the LanguageService contract',\n )\n }\n return service\n}\n"],"mappings":";;;;;;;;;;;;AAKA,IAAa,eAAb,cAAkC,YAAiB,cAAc,CAAC,CAG/D,CAAC;AAkBJ,IAAa,gBAAb,cAAmC,QAA+B,CAAC,CAAC,iBAAiB,EACnF,MAAM,IAAW,4CAA4C,EAG/D,CAAC,CAAC,CAAC;;eACuB,OAAa,MAAM,KAAK,IAAI;;AACtD;AA0BA,IAAa,aAAb,cAAgC,QAA4B,CAAC,CAAC,cAAc,EAC1E,MAAM,IAAW,yCAAyC,EAC5D,CAAC,CAAC,CAAC;;eACuB,OAAa,MAAM,KAAK,IAAI;;AACtD;AAcA,IAAa,cAAb,cAAiC,QAA6B,CAAC,CAAC,eAAe,EAC7E,MAAM,IAAW,0CAA0C,EAC7D,CAAC,CAAC,CAAC;;eACuB,OAAa,MAAM,KAAK,IAAI;;AACtD;AAQA,IAAa,qBAAqB,UAChC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA0B,OAAO,YACzC,OAAQ,MAA0B,gBAAgB,YAClD,MAAM,QAAS,MAA0B,UAAU,KACnD,OAAQ,MAA0B,YAAY;AAEhD,IAAa,yBAAyB,YAA8C;CAClF,IAAI,CAAC,kBAAkB,OAAO,GAC5B,MAAM,IAAI,MACR,gFACF;CAEF,OAAO;AACT"}