@athrio/loom 0.0.14 → 0.0.15
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.
- package/dist/{LanguageLoader-BAPSmTv0.js → LanguageLoader-BnifC_28.js} +2 -2
- package/dist/{LanguageLoader-BAPSmTv0.js.map → LanguageLoader-BnifC_28.js.map} +1 -1
- package/dist/LanguageLoader-CBfzN4NH.js +3 -0
- package/dist/{LoomFormatter-CcAXsbSL.js → LoomFormatter-BHgesYCg.js} +19 -10
- package/dist/LoomFormatter-BHgesYCg.js.map +1 -0
- package/dist/{LoomServer-DpleSkxj.js → LoomServer-D14D2si9.js} +4 -4
- package/dist/{LoomServer-DpleSkxj.js.map → LoomServer-D14D2si9.js.map} +1 -1
- package/dist/{LoomStore-Bcx6V9HH.js → LoomStore-C5R57cqa.js} +3 -3
- package/dist/{LoomStore-Bcx6V9HH.js.map → LoomStore-C5R57cqa.js.map} +1 -1
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/dist/LanguageLoader-BF5irHbe.js +0 -3
- package/dist/LoomFormatter-CcAXsbSL.js.map +0 -1
|
@@ -125,7 +125,7 @@ var ServiceManifestSchema = Struct({
|
|
|
125
125
|
});
|
|
126
126
|
var serviceDir = (id, dir) => join(storeDir(dir), "node_modules", servicePackage(id));
|
|
127
127
|
var serviceManifest = (id, dir) => pipe(liftThrowable(() => readFileSync(join(serviceDir(id, dir), "package.json"), "utf8"))(), flatMap$1(liftThrowable((text) => JSON.parse(text))), flatMap$1(decodeUnknownOption(ServiceManifestSchema)));
|
|
128
|
-
var serviceVersion = "0.0.
|
|
128
|
+
var serviceVersion = "0.0.15";
|
|
129
129
|
var installedVersion = (id, dir) => flatMap$1(serviceManifest(id, dir), (manifest) => fromNullishOr(manifest.version));
|
|
130
130
|
var embeddedFiles = globalThis.Bun?.embeddedFiles ?? [];
|
|
131
131
|
var embeddedFile = (name) => findFirst(embeddedFiles, (file) => file.name === name);
|
|
@@ -181,7 +181,7 @@ var installPackage = (dir, packageName, range) => gen(function* () {
|
|
|
181
181
|
var ServiceInstall = taggedEnum();
|
|
182
182
|
var installService = (id, dir) => gen(function* () {
|
|
183
183
|
const installed = installedVersion(id, dir);
|
|
184
|
-
if (contains(installed, "0.0.
|
|
184
|
+
if (contains(installed, "0.0.15")) return ServiceInstall.Current();
|
|
185
185
|
yield* installPackage(dir, servicePackage(id), serviceVersion);
|
|
186
186
|
return match(installed, {
|
|
187
187
|
onNone: () => ServiceInstall.Installed(),
|
|
@@ -244,4 +244,4 @@ var removeService = (id, dir) => sync(() => rmSync(serviceDir(id, dir), {
|
|
|
244
244
|
//#endregion
|
|
245
245
|
export { SemanticTokenSchema as _, installedVersion as a, symbolsOf as b, serviceDir as c, serviceVersion as d, standalone as f, workspaceRoot as g, workspaceOf as h, installTypeScript as i, serviceManifest as l, storeTypeScript as m, embeddedFile as n, isWorkspace as o, storeDir as p, installService as r, removeService as s, ServiceInstall as t, servicePackage as u, profileOf as v, symbolAt as y };
|
|
246
246
|
|
|
247
|
-
//# sourceMappingURL=LoomStore-
|
|
247
|
+
//# sourceMappingURL=LoomStore-C5R57cqa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoomStore-Bcx6V9HH.js","names":[],"sources":["../../loom-ast/src/ast/LoomSymbol.ts","../../loom-lang-services/src/LoomStore.ts"],"sourcesContent":["import { Array, Match, Option, Schema } from 'effect'\nimport { type Position } from '#ast/LoomNode'\nimport {\n type LoomDocument,\n type LoomFrontmatter,\n type LoomHeading,\n type LoomSection,\n} from '#ast/LoomAst'\nimport { type SectionBodyWeft, type TocWeft } from '#ast/Weft'\nimport { type WarpAnchorToken, type WarpToken } from '#ast/LoomTokens'\n\nexport const SymbolKindSchema = Schema.Literals([\n 'headingTitle',\n 'sectionAnchor',\n 'warpAnchor',\n 'warpDef',\n 'specifier',\n 'sink',\n 'arrow',\n 'tilde',\n 'prose',\n 'frontmatterMembership',\n 'frontmatterValue',\n 'frontmatterTitle',\n 'frontmatterPart',\n 'frontmatterPartName',\n 'tocPart',\n 'tocEntry',\n])\nexport type SymbolKind = typeof SymbolKindSchema.Type\n\nexport interface SpanFeatures {\n readonly navigation?: boolean\n readonly semantic?: boolean\n readonly structure?: boolean\n readonly verification?: boolean\n readonly completion?: boolean\n}\n\nexport const SemanticTokenSchema = Schema.Literals([\n 'namespace',\n 'variable',\n 'keyword',\n 'string',\n 'operator',\n])\nexport type SemanticToken = typeof SemanticTokenSchema.Type\n\nexport interface SymbolProfile {\n readonly semantic: Option.Option<SemanticToken>\n readonly features: SpanFeatures\n}\n\nconst profile = (\n semantic: Option.Option<SemanticToken>,\n features: SpanFeatures,\n): SymbolProfile => ({ semantic, features })\n\nexport const profileOf = (kind: SymbolKind): SymbolProfile =>\n Match.value(kind).pipe(\n Match.when('headingTitle', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('sectionAnchor', () =>\n profile(Option.some('namespace'), {\n navigation: true,\n structure: true,\n verification: true,\n }),\n ),\n Match.when('warpAnchor', () =>\n profile(Option.some('variable'), { navigation: true, verification: true }),\n ),\n Match.when('warpDef', () => profile(Option.some('variable'), { navigation: true })),\n Match.when('specifier', () => profile(Option.some('keyword'), { verification: true })),\n Match.when('sink', () => profile(Option.some('string'), { verification: true })),\n Match.when('arrow', () => profile(Option.some('operator'), {})),\n Match.when('tilde', () => profile(Option.some('operator'), {})),\n Match.when('prose', () => profile(Option.none(), { structure: true })),\n Match.when('frontmatterMembership', () =>\n profile(Option.some('namespace'), { structure: true }),\n ),\n Match.when('frontmatterValue', () => profile(Option.some('string'), { structure: true })),\n Match.when('frontmatterTitle', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('frontmatterPart', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('frontmatterPartName', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('tocPart', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('tocEntry', () =>\n profile(Option.some('namespace'), {\n navigation: true,\n structure: true,\n verification: true,\n }),\n ),\n Match.exhaustive,\n )\n\nexport interface Symbol {\n readonly kind: SymbolKind\n readonly position: Position\n}\n\nconst anchorKind = (warpsInScope: ReadonlySet<string>, anchor: WarpAnchorToken): SymbolKind =>\n warpsInScope.has(anchor.name.value) ? 'warpAnchor' : 'sectionAnchor'\n\nconst namesOf = (warps: ReadonlyArray<WarpToken>): ReadonlyArray<string> =>\n Array.map(warps, (warp) => warp.name.value)\n\nconst at = (kind: SymbolKind, position: Position): Symbol => ({ kind, position })\n\nconst optSymbol = (\n kind: SymbolKind,\n token: { readonly position: Position } | undefined,\n): ReadonlyArray<Symbol> =>\n Option.toArray(Option.map(Option.fromNullishOr(token), (t) => at(kind, t.position)))\n\nconst frontmatterSymbols = (fm: LoomFrontmatter): ReadonlyArray<Symbol> => [\n ...optSymbol('frontmatterPart', fm.part),\n ...optSymbol('frontmatterPartName', fm.partName),\n ...optSymbol('frontmatterMembership', fm.chapter),\n ...optSymbol('frontmatterTitle', fm.title),\n ...optSymbol('frontmatterValue', fm.package),\n ...optSymbol('frontmatterValue', fm.language),\n]\n\nconst tocSymbols = (weft: TocWeft): ReadonlyArray<Symbol> => [\n ...optSymbol('tocPart', weft.part),\n ...optSymbol('tocEntry', weft.title),\n]\n\nconst headingSymbols = (heading: LoomHeading): ReadonlyArray<Symbol> => [\n ...Option.toArray(\n Option.map(Option.fromNullishOr(heading.title), (t) => at('headingTitle', t.position)),\n ),\n ...Option.toArray(\n Option.map(Option.fromNullishOr(heading.specifier), (s) => at('specifier', s.label.position)),\n ),\n ...Option.toArray(Option.map(Option.fromNullishOr(heading.sink), (s) => at('sink', s.position))),\n]\n\nconst delimiterOf = (weft: SectionBodyWeft): ReadonlyArray<Symbol> =>\n Match.value(weft).pipe(\n Match.when({ type: 'ArrowWeft' }, (w) => [at('arrow', w.arrow.position)]),\n Match.when({ type: 'TildeWeft' }, (w) => [at('tilde', w.tilde.position)]),\n Match.orElse(() => []),\n )\n\nconst sectionSymbols = (\n section: LoomSection,\n documentWarps: ReadonlyArray<string>,\n): ReadonlyArray<Symbol> => {\n const warps = Array.flatMap(section.preamble, (weft) => weft.warps)\n const scope = new Set([...documentWarps, ...namesOf(warps)])\n const anchors = [\n ...Array.flatMap(section.preamble, (weft) => weft.anchors),\n ...Array.flatMap(section.code, (weft) => weft.anchors),\n ]\n return [\n ...headingSymbols(section.heading),\n ...Array.map(warps, (warp) => at('warpDef', warp.name.position)),\n ...Array.map(anchors, (anchor) => at(anchorKind(scope, anchor), anchor.name.position)),\n ...Array.flatMap(section.code, delimiterOf),\n ...Array.flatMap(section.entries ?? [], tocSymbols),\n ]\n}\n\nexport const symbolsOf = (doc: LoomDocument): ReadonlyArray<Symbol> => {\n const warps = Array.flatMap(doc.preamble, (weft) => weft.warps)\n const scope = new Set(namesOf(warps))\n return [\n ...Array.flatMap(Option.toArray(Option.fromNullishOr(doc.frontmatter)), frontmatterSymbols),\n ...Array.map(warps, (warp) => at('warpDef', warp.name.position)),\n ...Array.map(\n Array.flatMap(doc.preamble, (weft) => weft.anchors),\n (anchor) => at(anchorKind(scope, anchor), anchor.name.position),\n ),\n ...Array.flatMap(doc.sections, (section) => sectionSymbols(section, namesOf(warps))),\n ]\n}\n\nexport const symbolAt = (doc: LoomDocument, offset: number): Option.Option<Symbol> =>\n Array.findFirst(\n symbolsOf(doc),\n (symbol) => symbol.position.start.offset <= offset && offset <= symbol.position.end.offset,\n )\n","import { Array, Data, Effect, Option, Schema, pipe } from 'effect'\nimport { execFile } from 'node:child_process'\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { promisify } from 'node:util'\nimport { gunzipSync } from 'node:zlib'\n\nconst run = promisify(execFile)\n\nexport const servicePackage = (id: string): string => `@athrio/loom-service-${id}`\n\nexport const isWorkspace = (dir: string): boolean => existsSync(join(dir, '.loom', 'config.yaml'))\n\nexport const workspaceOf = (dir: string): Option.Option<string> => {\n if (isWorkspace(dir)) return Option.some(dir)\n const parent = dirname(dir)\n return parent === dir ? Option.none() : workspaceOf(parent)\n}\n\nexport const workspaceRoot = (dir: string): string => Option.getOrElse(workspaceOf(dir), () => dir)\n\nexport const storeDir = (dir: string): string =>\n process.env.LOOM_HOME === undefined\n ? join(workspaceRoot(dir), '.loom', 'services')\n : join(process.env.LOOM_HOME, 'services')\n\nconst servicePrefix = 'loom-service-'\n\nexport const installedServices = (dir: string): Effect.Effect<ReadonlyArray<string>> =>\n Effect.sync(() => {\n const scope = join(storeDir(dir), 'node_modules', '@athrio')\n if (!existsSync(scope)) return []\n return readdirSync(scope)\n .filter((name) => name.startsWith(servicePrefix))\n .map((name) => name.slice(servicePrefix.length))\n })\n\nexport const ServiceManifestSchema = Schema.Struct({\n version: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n})\n\nexport type ServiceManifest = typeof ServiceManifestSchema.Type\n\nexport const serviceDir = (id: string, dir: string): string =>\n join(storeDir(dir), 'node_modules', servicePackage(id))\n\nexport const serviceManifest = (id: string, dir: string): Option.Option<ServiceManifest> =>\n pipe(\n Option.liftThrowable(() => readFileSync(join(serviceDir(id, dir), 'package.json'), 'utf8'))(),\n Option.flatMap(Option.liftThrowable((text: string): unknown => JSON.parse(text))),\n Option.flatMap(Schema.decodeUnknownOption(ServiceManifestSchema)),\n )\n\nexport const serviceVersion = '0.0.14'\n\nexport const installedVersion = (id: string, dir: string): Option.Option<string> =>\n Option.flatMap(serviceManifest(id, dir), (manifest) => Option.fromNullishOr(manifest.version))\n\ninterface EmbeddedFile extends Blob {\n readonly name?: string\n}\n\nconst embeddedFiles: ReadonlyArray<EmbeddedFile> =\n (globalThis as { readonly Bun?: { readonly embeddedFiles?: ReadonlyArray<EmbeddedFile> } }).Bun\n ?.embeddedFiles ?? []\n\nexport const embeddedFile = (name: string): Option.Option<EmbeddedFile> =>\n Array.findFirst(embeddedFiles, (file) => file.name === name)\n\nexport const standalone: boolean =\n embeddedFiles.length > 0 || /(\\$|%24)bunfs|(~|%7E)BUN/i.test(String(import.meta.url))\n\nexport class StoreError extends Data.TaggedError('StoreError')<{\n readonly packageName: string\n readonly cause: unknown\n}> {}\n\nconst prepareStore = (store: string): void => {\n mkdirSync(store, { recursive: true })\n const manifest = join(store, 'package.json')\n if (!existsSync(manifest))\n writeFileSync(\n manifest,\n `${JSON.stringify({ name: 'loom-services', private: true }, null, 2)}\\n`,\n )\n}\n\ninterface PackageManager {\n readonly command: string\n readonly args: ReadonlyArray<string>\n readonly env: NodeJS.ProcessEnv\n}\n\nconst packageManager = (store: string, spec: string): PackageManager =>\n standalone\n ? {\n command: process.execPath,\n args: ['add', spec, '--cwd', store, '--omit', 'peer'],\n env: { ...process.env, BUN_BE_BUN: '1' },\n }\n : {\n command: 'npm',\n args: ['install', spec, '--prefix', store, '--omit=peer', '--no-audit', '--no-fund'],\n env: process.env,\n }\n\nconst installPackage = (\n dir: string,\n packageName: string,\n range: string,\n): Effect.Effect<void, StoreError> =>\n Effect.gen(function* () {\n const store = storeDir(dir)\n yield* Effect.sync(() => prepareStore(store))\n const manager = packageManager(store, `${packageName}@${range}`)\n yield* Effect.tryPromise({\n try: () => run(manager.command, [...manager.args], { env: manager.env }),\n catch: (cause) => new StoreError({ packageName, cause }),\n })\n })\n\nexport type ServiceInstall = Data.TaggedEnum<{\n Current: {}\n Installed: {}\n Updated: { readonly from: string }\n}>\nexport const ServiceInstall = Data.taggedEnum<ServiceInstall>()\n\nexport const installService = (id: string, dir: string): Effect.Effect<ServiceInstall, StoreError> =>\n Effect.gen(function* () {\n const installed = installedVersion(id, dir)\n if (Option.contains(installed, serviceVersion)) return ServiceInstall.Current()\n yield* installPackage(dir, servicePackage(id), serviceVersion)\n return Option.match(installed, {\n onNone: () => ServiceInstall.Installed(),\n onSome: (from) => ServiceInstall.Updated({ from }),\n })\n })\n\nexport const typeScriptRange = '^6'\n\nexport const storeTypeScript = (dir: string): Option.Option<string> => {\n const file = join(storeDir(dir), 'node_modules', 'typescript', 'lib', 'typescript.js')\n return existsSync(file) ? Option.some(file) : Option.none()\n}\n\nconst typeScriptAsset = 'typescript.json.gz'\n\nconst PackedTypeScriptSchema = Schema.Struct({\n files: Schema.Record(Schema.String, Schema.String),\n})\n\nconst typeScriptError = (cause: unknown): StoreError =>\n new StoreError({ packageName: 'typescript', cause })\n\nconst unpackTypeScript = (dir: string, packed: Blob): Effect.Effect<void, StoreError> =>\n Effect.gen(function* () {\n const archive = yield* Effect.tryPromise({\n try: async () => new Uint8Array(await packed.arrayBuffer()),\n catch: typeScriptError,\n })\n const json = yield* Effect.try({\n try: (): unknown => JSON.parse(gunzipSync(archive).toString('utf8')),\n catch: typeScriptError,\n })\n const { files } = yield* Schema.decodeUnknownEffect(PackedTypeScriptSchema)(json).pipe(\n Effect.mapError(typeScriptError),\n )\n const store = storeDir(dir)\n const modules = join(store, 'node_modules')\n const partial = join(modules, `.typescript-${process.pid}`)\n yield* Effect.sync(() => prepareStore(store))\n yield* Effect.forEach(\n Object.entries(files),\n ([path, text]) =>\n Effect.try({\n try: () => {\n mkdirSync(dirname(join(partial, path)), { recursive: true })\n writeFileSync(join(partial, path), text)\n },\n catch: typeScriptError,\n }),\n { discard: true },\n )\n yield* Effect.try({\n try: () => {\n rmSync(join(modules, 'typescript'), { recursive: true, force: true })\n renameSync(partial, join(modules, 'typescript'))\n },\n catch: typeScriptError,\n })\n })\n\nexport const installTypeScript = (dir: string): Effect.Effect<string, StoreError> =>\n Option.match(embeddedFile(typeScriptAsset), {\n onSome: (packed) => unpackTypeScript(dir, packed),\n onNone: () => installPackage(dir, 'typescript', typeScriptRange),\n }).pipe(\n Effect.flatMap(() =>\n Option.match(storeTypeScript(dir), {\n onNone: () => Effect.fail(typeScriptError('the store holds no lib/typescript.js')),\n onSome: Effect.succeed,\n }),\n ),\n )\n\nexport const removeService = (id: string, dir: string): Effect.Effect<void> =>\n Effect.sync(() => rmSync(serviceDir(id, dir), { recursive: true, force: true }))\n"],"mappings":";;;;;;;AAWgC,SAAgB;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAWD,IAAa,sBAAsB,SAAgB;CACjD;CACA;CACA;CACA;CACA;AACF,CAAC;AAQD,IAAM,WACJ,UACA,cACmB;CAAE;CAAU;AAAS;AAE1C,IAAa,aAAa,SACxB,MAAY,IAAI,CAAC,CAAC,KAChB,KAAW,sBACT,QAAQ,KAAY,WAAW,GAAG;CAAE,YAAY;CAAM,WAAW;AAAK,CAAC,CACzE,GACA,KAAW,uBACT,QAAQ,KAAY,WAAW,GAAG;CAChC,YAAY;CACZ,WAAW;CACX,cAAc;AAChB,CAAC,CACH,GACA,KAAW,oBACT,QAAQ,KAAY,UAAU,GAAG;CAAE,YAAY;CAAM,cAAc;AAAK,CAAC,CAC3E,GACA,KAAW,iBAAiB,QAAQ,KAAY,UAAU,GAAG,EAAE,YAAY,KAAK,CAAC,CAAC,GAClF,KAAW,mBAAmB,QAAQ,KAAY,SAAS,GAAG,EAAE,cAAc,KAAK,CAAC,CAAC,GACrF,KAAW,cAAc,QAAQ,KAAY,QAAQ,GAAG,EAAE,cAAc,KAAK,CAAC,CAAC,GAC/E,KAAW,eAAe,QAAQ,KAAY,UAAU,GAAG,CAAC,CAAC,CAAC,GAC9D,KAAW,eAAe,QAAQ,KAAY,UAAU,GAAG,CAAC,CAAC,CAAC,GAC9D,KAAW,eAAe,QAAQ,KAAY,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC,GACrE,KAAW,+BACT,QAAQ,KAAY,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC,CACvD,GACA,KAAW,0BAA0B,QAAQ,KAAY,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC,GAC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e,QAAQ,KAAK;CAC1D,OAAO,WAAkB,aAAa,KAAK,CAAC;CAC5C,OAAO,QACL,OAAO,QAAQ,KAAK,IACnB,CAAC,MAAM,UACN,KAAW;EACT,WAAW;GACT,UAAU,QAAQ,KAAK,SAAS,IAAI,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,cAAc,KAAK,SAAS,IAAI,GAAG,IAAI;EACzC;EACA,OAAO;CACT,CAAC,GACH,EAAE,SAAS,KAAK,CAClB;CACA,OAAO,KAAW;EAChB,WAAW;GACT,OAAO,KAAK,SAAS,YAAY,GAAG;IAAE,WAAW;IAAM,OAAO;GAAK,CAAC;GACpE,WAAW,SAAS,KAAK,SAAS,YAAY,CAAC;EACjD;EACA,OAAO;CACT,CAAC;AACH,CAAC;AAEH,IAAa,qBAAqB,QAChC,MAAa,aAAa,eAAe,GAAG;CAC1C,SAAS,WAAW,iBAAiB,KAAK,MAAM;CAChD,cAAc,eAAe,KAAK,cAAA,IAA6B;AACjE,CAAC,CAAC,CAAC,KACD,gBACE,MAAa,gBAAgB,GAAG,GAAG;CACjC,cAAc,KAAY,gBAAgB,sCAAsC,CAAC;CACjF,QAAQ;AACV,CAAC,CACH,CACF;AAEF,IAAa,iBAAiB,IAAY,QACxC,WAAkB,OAAO,WAAW,IAAI,GAAG,GAAG;CAAE,WAAW;CAAM,OAAO;AAAK,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"LoomStore-C5R57cqa.js","names":[],"sources":["../../loom-ast/src/ast/LoomSymbol.ts","../../loom-lang-services/src/LoomStore.ts"],"sourcesContent":["import { Array, Match, Option, Schema } from 'effect'\nimport { type Position } from '#ast/LoomNode'\nimport {\n type LoomDocument,\n type LoomFrontmatter,\n type LoomHeading,\n type LoomSection,\n} from '#ast/LoomAst'\nimport { type SectionBodyWeft, type TocWeft } from '#ast/Weft'\nimport { type WarpAnchorToken, type WarpToken } from '#ast/LoomTokens'\n\nexport const SymbolKindSchema = Schema.Literals([\n 'headingTitle',\n 'sectionAnchor',\n 'warpAnchor',\n 'warpDef',\n 'specifier',\n 'sink',\n 'arrow',\n 'tilde',\n 'prose',\n 'frontmatterMembership',\n 'frontmatterValue',\n 'frontmatterTitle',\n 'frontmatterPart',\n 'frontmatterPartName',\n 'tocPart',\n 'tocEntry',\n])\nexport type SymbolKind = typeof SymbolKindSchema.Type\n\nexport interface SpanFeatures {\n readonly navigation?: boolean\n readonly semantic?: boolean\n readonly structure?: boolean\n readonly verification?: boolean\n readonly completion?: boolean\n}\n\nexport const SemanticTokenSchema = Schema.Literals([\n 'namespace',\n 'variable',\n 'keyword',\n 'string',\n 'operator',\n])\nexport type SemanticToken = typeof SemanticTokenSchema.Type\n\nexport interface SymbolProfile {\n readonly semantic: Option.Option<SemanticToken>\n readonly features: SpanFeatures\n}\n\nconst profile = (\n semantic: Option.Option<SemanticToken>,\n features: SpanFeatures,\n): SymbolProfile => ({ semantic, features })\n\nexport const profileOf = (kind: SymbolKind): SymbolProfile =>\n Match.value(kind).pipe(\n Match.when('headingTitle', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('sectionAnchor', () =>\n profile(Option.some('namespace'), {\n navigation: true,\n structure: true,\n verification: true,\n }),\n ),\n Match.when('warpAnchor', () =>\n profile(Option.some('variable'), { navigation: true, verification: true }),\n ),\n Match.when('warpDef', () => profile(Option.some('variable'), { navigation: true })),\n Match.when('specifier', () => profile(Option.some('keyword'), { verification: true })),\n Match.when('sink', () => profile(Option.some('string'), { verification: true })),\n Match.when('arrow', () => profile(Option.some('operator'), {})),\n Match.when('tilde', () => profile(Option.some('operator'), {})),\n Match.when('prose', () => profile(Option.none(), { structure: true })),\n Match.when('frontmatterMembership', () =>\n profile(Option.some('namespace'), { structure: true }),\n ),\n Match.when('frontmatterValue', () => profile(Option.some('string'), { structure: true })),\n Match.when('frontmatterTitle', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('frontmatterPart', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('frontmatterPartName', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('tocPart', () =>\n profile(Option.some('namespace'), { navigation: true, structure: true }),\n ),\n Match.when('tocEntry', () =>\n profile(Option.some('namespace'), {\n navigation: true,\n structure: true,\n verification: true,\n }),\n ),\n Match.exhaustive,\n )\n\nexport interface Symbol {\n readonly kind: SymbolKind\n readonly position: Position\n}\n\nconst anchorKind = (warpsInScope: ReadonlySet<string>, anchor: WarpAnchorToken): SymbolKind =>\n warpsInScope.has(anchor.name.value) ? 'warpAnchor' : 'sectionAnchor'\n\nconst namesOf = (warps: ReadonlyArray<WarpToken>): ReadonlyArray<string> =>\n Array.map(warps, (warp) => warp.name.value)\n\nconst at = (kind: SymbolKind, position: Position): Symbol => ({ kind, position })\n\nconst optSymbol = (\n kind: SymbolKind,\n token: { readonly position: Position } | undefined,\n): ReadonlyArray<Symbol> =>\n Option.toArray(Option.map(Option.fromNullishOr(token), (t) => at(kind, t.position)))\n\nconst frontmatterSymbols = (fm: LoomFrontmatter): ReadonlyArray<Symbol> => [\n ...optSymbol('frontmatterPart', fm.part),\n ...optSymbol('frontmatterPartName', fm.partName),\n ...optSymbol('frontmatterMembership', fm.chapter),\n ...optSymbol('frontmatterTitle', fm.title),\n ...optSymbol('frontmatterValue', fm.package),\n ...optSymbol('frontmatterValue', fm.language),\n]\n\nconst tocSymbols = (weft: TocWeft): ReadonlyArray<Symbol> => [\n ...optSymbol('tocPart', weft.part),\n ...optSymbol('tocEntry', weft.title),\n]\n\nconst headingSymbols = (heading: LoomHeading): ReadonlyArray<Symbol> => [\n ...Option.toArray(\n Option.map(Option.fromNullishOr(heading.title), (t) => at('headingTitle', t.position)),\n ),\n ...Option.toArray(\n Option.map(Option.fromNullishOr(heading.specifier), (s) => at('specifier', s.label.position)),\n ),\n ...Option.toArray(Option.map(Option.fromNullishOr(heading.sink), (s) => at('sink', s.position))),\n]\n\nconst delimiterOf = (weft: SectionBodyWeft): ReadonlyArray<Symbol> =>\n Match.value(weft).pipe(\n Match.when({ type: 'ArrowWeft' }, (w) => [at('arrow', w.arrow.position)]),\n Match.when({ type: 'TildeWeft' }, (w) => [at('tilde', w.tilde.position)]),\n Match.orElse(() => []),\n )\n\nconst sectionSymbols = (\n section: LoomSection,\n documentWarps: ReadonlyArray<string>,\n): ReadonlyArray<Symbol> => {\n const warps = Array.flatMap(section.preamble, (weft) => weft.warps)\n const scope = new Set([...documentWarps, ...namesOf(warps)])\n const anchors = [\n ...Array.flatMap(section.preamble, (weft) => weft.anchors),\n ...Array.flatMap(section.code, (weft) => weft.anchors),\n ]\n return [\n ...headingSymbols(section.heading),\n ...Array.map(warps, (warp) => at('warpDef', warp.name.position)),\n ...Array.map(anchors, (anchor) => at(anchorKind(scope, anchor), anchor.name.position)),\n ...Array.flatMap(section.code, delimiterOf),\n ...Array.flatMap(section.entries ?? [], tocSymbols),\n ]\n}\n\nexport const symbolsOf = (doc: LoomDocument): ReadonlyArray<Symbol> => {\n const warps = Array.flatMap(doc.preamble, (weft) => weft.warps)\n const scope = new Set(namesOf(warps))\n return [\n ...Array.flatMap(Option.toArray(Option.fromNullishOr(doc.frontmatter)), frontmatterSymbols),\n ...Array.map(warps, (warp) => at('warpDef', warp.name.position)),\n ...Array.map(\n Array.flatMap(doc.preamble, (weft) => weft.anchors),\n (anchor) => at(anchorKind(scope, anchor), anchor.name.position),\n ),\n ...Array.flatMap(doc.sections, (section) => sectionSymbols(section, namesOf(warps))),\n ]\n}\n\nexport const symbolAt = (doc: LoomDocument, offset: number): Option.Option<Symbol> =>\n Array.findFirst(\n symbolsOf(doc),\n (symbol) => symbol.position.start.offset <= offset && offset <= symbol.position.end.offset,\n )\n","import { Array, Data, Effect, Option, Schema, pipe } from 'effect'\nimport { execFile } from 'node:child_process'\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { promisify } from 'node:util'\nimport { gunzipSync } from 'node:zlib'\n\nconst run = promisify(execFile)\n\nexport const servicePackage = (id: string): string => `@athrio/loom-service-${id}`\n\nexport const isWorkspace = (dir: string): boolean => existsSync(join(dir, '.loom', 'config.yaml'))\n\nexport const workspaceOf = (dir: string): Option.Option<string> => {\n if (isWorkspace(dir)) return Option.some(dir)\n const parent = dirname(dir)\n return parent === dir ? Option.none() : workspaceOf(parent)\n}\n\nexport const workspaceRoot = (dir: string): string => Option.getOrElse(workspaceOf(dir), () => dir)\n\nexport const storeDir = (dir: string): string =>\n process.env.LOOM_HOME === undefined\n ? join(workspaceRoot(dir), '.loom', 'services')\n : join(process.env.LOOM_HOME, 'services')\n\nconst servicePrefix = 'loom-service-'\n\nexport const installedServices = (dir: string): Effect.Effect<ReadonlyArray<string>> =>\n Effect.sync(() => {\n const scope = join(storeDir(dir), 'node_modules', '@athrio')\n if (!existsSync(scope)) return []\n return readdirSync(scope)\n .filter((name) => name.startsWith(servicePrefix))\n .map((name) => name.slice(servicePrefix.length))\n })\n\nexport const ServiceManifestSchema = Schema.Struct({\n version: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n exports: Schema.optional(Schema.Unknown),\n})\n\nexport type ServiceManifest = typeof ServiceManifestSchema.Type\n\nexport const serviceDir = (id: string, dir: string): string =>\n join(storeDir(dir), 'node_modules', servicePackage(id))\n\nexport const serviceManifest = (id: string, dir: string): Option.Option<ServiceManifest> =>\n pipe(\n Option.liftThrowable(() => readFileSync(join(serviceDir(id, dir), 'package.json'), 'utf8'))(),\n Option.flatMap(Option.liftThrowable((text: string): unknown => JSON.parse(text))),\n Option.flatMap(Schema.decodeUnknownOption(ServiceManifestSchema)),\n )\n\nexport const serviceVersion = '0.0.15'\n\nexport const installedVersion = (id: string, dir: string): Option.Option<string> =>\n Option.flatMap(serviceManifest(id, dir), (manifest) => Option.fromNullishOr(manifest.version))\n\ninterface EmbeddedFile extends Blob {\n readonly name?: string\n}\n\nconst embeddedFiles: ReadonlyArray<EmbeddedFile> =\n (globalThis as { readonly Bun?: { readonly embeddedFiles?: ReadonlyArray<EmbeddedFile> } }).Bun\n ?.embeddedFiles ?? []\n\nexport const embeddedFile = (name: string): Option.Option<EmbeddedFile> =>\n Array.findFirst(embeddedFiles, (file) => file.name === name)\n\nexport const standalone: boolean =\n embeddedFiles.length > 0 || /(\\$|%24)bunfs|(~|%7E)BUN/i.test(String(import.meta.url))\n\nexport class StoreError extends Data.TaggedError('StoreError')<{\n readonly packageName: string\n readonly cause: unknown\n}> {}\n\nconst prepareStore = (store: string): void => {\n mkdirSync(store, { recursive: true })\n const manifest = join(store, 'package.json')\n if (!existsSync(manifest))\n writeFileSync(\n manifest,\n `${JSON.stringify({ name: 'loom-services', private: true }, null, 2)}\\n`,\n )\n}\n\ninterface PackageManager {\n readonly command: string\n readonly args: ReadonlyArray<string>\n readonly env: NodeJS.ProcessEnv\n}\n\nconst packageManager = (store: string, spec: string): PackageManager =>\n standalone\n ? {\n command: process.execPath,\n args: ['add', spec, '--cwd', store, '--omit', 'peer'],\n env: { ...process.env, BUN_BE_BUN: '1' },\n }\n : {\n command: 'npm',\n args: ['install', spec, '--prefix', store, '--omit=peer', '--no-audit', '--no-fund'],\n env: process.env,\n }\n\nconst installPackage = (\n dir: string,\n packageName: string,\n range: string,\n): Effect.Effect<void, StoreError> =>\n Effect.gen(function* () {\n const store = storeDir(dir)\n yield* Effect.sync(() => prepareStore(store))\n const manager = packageManager(store, `${packageName}@${range}`)\n yield* Effect.tryPromise({\n try: () => run(manager.command, [...manager.args], { env: manager.env }),\n catch: (cause) => new StoreError({ packageName, cause }),\n })\n })\n\nexport type ServiceInstall = Data.TaggedEnum<{\n Current: {}\n Installed: {}\n Updated: { readonly from: string }\n}>\nexport const ServiceInstall = Data.taggedEnum<ServiceInstall>()\n\nexport const installService = (id: string, dir: string): Effect.Effect<ServiceInstall, StoreError> =>\n Effect.gen(function* () {\n const installed = installedVersion(id, dir)\n if (Option.contains(installed, serviceVersion)) return ServiceInstall.Current()\n yield* installPackage(dir, servicePackage(id), serviceVersion)\n return Option.match(installed, {\n onNone: () => ServiceInstall.Installed(),\n onSome: (from) => ServiceInstall.Updated({ from }),\n })\n })\n\nexport const typeScriptRange = '^6'\n\nexport const storeTypeScript = (dir: string): Option.Option<string> => {\n const file = join(storeDir(dir), 'node_modules', 'typescript', 'lib', 'typescript.js')\n return existsSync(file) ? Option.some(file) : Option.none()\n}\n\nconst typeScriptAsset = 'typescript.json.gz'\n\nconst PackedTypeScriptSchema = Schema.Struct({\n files: Schema.Record(Schema.String, Schema.String),\n})\n\nconst typeScriptError = (cause: unknown): StoreError =>\n new StoreError({ packageName: 'typescript', cause })\n\nconst unpackTypeScript = (dir: string, packed: Blob): Effect.Effect<void, StoreError> =>\n Effect.gen(function* () {\n const archive = yield* Effect.tryPromise({\n try: async () => new Uint8Array(await packed.arrayBuffer()),\n catch: typeScriptError,\n })\n const json = yield* Effect.try({\n try: (): unknown => JSON.parse(gunzipSync(archive).toString('utf8')),\n catch: typeScriptError,\n })\n const { files } = yield* Schema.decodeUnknownEffect(PackedTypeScriptSchema)(json).pipe(\n Effect.mapError(typeScriptError),\n )\n const store = storeDir(dir)\n const modules = join(store, 'node_modules')\n const partial = join(modules, `.typescript-${process.pid}`)\n yield* Effect.sync(() => prepareStore(store))\n yield* Effect.forEach(\n Object.entries(files),\n ([path, text]) =>\n Effect.try({\n try: () => {\n mkdirSync(dirname(join(partial, path)), { recursive: true })\n writeFileSync(join(partial, path), text)\n },\n catch: typeScriptError,\n }),\n { discard: true },\n )\n yield* Effect.try({\n try: () => {\n rmSync(join(modules, 'typescript'), { recursive: true, force: true })\n renameSync(partial, join(modules, 'typescript'))\n },\n catch: typeScriptError,\n })\n })\n\nexport const installTypeScript = (dir: string): Effect.Effect<string, StoreError> =>\n Option.match(embeddedFile(typeScriptAsset), {\n onSome: (packed) => unpackTypeScript(dir, packed),\n onNone: () => installPackage(dir, 'typescript', typeScriptRange),\n }).pipe(\n Effect.flatMap(() =>\n Option.match(storeTypeScript(dir), {\n onNone: () => Effect.fail(typeScriptError('the store holds no lib/typescript.js')),\n onSome: Effect.succeed,\n }),\n ),\n )\n\nexport const removeService = (id: string, dir: string): Effect.Effect<void> =>\n Effect.sync(() => rmSync(serviceDir(id, dir), { recursive: true, force: true }))\n"],"mappings":";;;;;;;AAWgC,SAAgB;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAWD,IAAa,sBAAsB,SAAgB;CACjD;CACA;CACA;CACA;CACA;AACF,CAAC;AAQD,IAAM,WACJ,UACA,cACmB;CAAE;CAAU;AAAS;AAE1C,IAAa,aAAa,SACxB,MAAY,IAAI,CAAC,CAAC,KAChB,KAAW,sBACT,QAAQ,KAAY,WAAW,GAAG;CAAE,YAAY;CAAM,WAAW;AAAK,CAAC,CACzE,GACA,KAAW,uBACT,QAAQ,KAAY,WAAW,GAAG;CAChC,YAAY;CACZ,WAAW;CACX,cAAc;AAChB,CAAC,CACH,GACA,KAAW,oBACT,QAAQ,KAAY,UAAU,GAAG;CAAE,YAAY;CAAM,cAAc;AAAK,CAAC,CAC3E,GACA,KAAW,iBAAiB,QAAQ,KAAY,UAAU,GAAG,EAAE,YAAY,KAAK,CAAC,CAAC,GAClF,KAAW,mBAAmB,QAAQ,KAAY,SAAS,GAAG,EAAE,cAAc,KAAK,CAAC,CAAC,GACrF,KAAW,cAAc,QAAQ,KAAY,QAAQ,GAAG,EAAE,cAAc,KAAK,CAAC,CAAC,GAC/E,KAAW,eAAe,QAAQ,KAAY,UAAU,GAAG,CAAC,CAAC,CAAC,GAC9D,KAAW,eAAe,QAAQ,KAAY,UAAU,GAAG,CAAC,CAAC,CAAC,GAC9D,KAAW,eAAe,QAAQ,KAAY,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC,GACrE,KAAW,+BACT,QAAQ,KAAY,WAAW,GAAG,EAAE,W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ACA,MAAM,QAAQ,SAAS,GAAG;CAC1B,MAAM,UAAU,KAAK,OAAO,cAAc;CAC1C,MAAM,UAAU,KAAK,SAAS,eAAe,QAAQ,KAAK;CAC1D,OAAO,WAAkB,aAAa,KAAK,CAAC;CAC5C,OAAO,QACL,OAAO,QAAQ,KAAK,IACnB,CAAC,MAAM,UACN,KAAW;EACT,WAAW;GACT,UAAU,QAAQ,KAAK,SAAS,IAAI,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,cAAc,KAAK,SAAS,IAAI,GAAG,IAAI;EACzC;EACA,OAAO;CACT,CAAC,GACH,EAAE,SAAS,KAAK,CAClB;CACA,OAAO,KAAW;EAChB,WAAW;GACT,OAAO,KAAK,SAAS,YAAY,GAAG;IAAE,WAAW;IAAM,OAAO;GAAK,CAAC;GACpE,WAAW,SAAS,KAAK,SAAS,YAAY,CAAC;EACjD;EACA,OAAO;CACT,CAAC;AACH,CAAC;AAEH,IAAa,qBAAqB,QAChC,MAAa,aAAa,eAAe,GAAG;CAC1C,SAAS,WAAW,iBAAiB,KAAK,MAAM;CAChD,cAAc,eAAe,KAAK,cAAA,IAA6B;AACjE,CAAC,CAAC,CAAC,KACD,gBACE,MAAa,gBAAgB,GAAG,GAAG;CACjC,cAAc,KAAY,gBAAgB,sCAAsC,CAAC;CACjF,QAAQ;AACV,CAAC,CACH,CACF;AAEF,IAAa,iBAAiB,IAAY,QACxC,WAAkB,OAAO,WAAW,IAAI,GAAG,GAAG;CAAE,WAAW;CAAM,OAAO;AAAK,CAAC,CAAC"}
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { $ as transduce, $i as Array_, $n as result, $t as optionalKey, A as FileSystem, Ai as getUnsafe, An as forEach, Ar as done, At as Defect, B as fromEffect, Bi as getOrElse, Bt as Struct, Ci as fail$1, Cn as effectify, Cr as isDone, D as log, Di as Reference, Dn as filterOrFail, Dr as succeed$3, Dt as ArraySchema, E as error, Ei as succeed$2, En as filter$2, Er as fail$2, Et as nominal, F as concat, Fi as filter$3, Fn as ignore, Fr as toMillis, G as mapEffect$1, Gi as isSome, Gn as option, Gr as filter, H as isStream, Hn as mapError, Hr as empty, Ht as TrueLiterals, I as decodeText, Ii as flatMap$2, In as interrupt, J as orDie$1, Ji as match$1, Jn as promise, Jr as findLast, K as merge, Ki as liftThrowable, Kn as orDie, Kr as findFirst, Kt as decodeUnknownEffect, L as empty$2, Ln as isEffect, Lr as dedupe, M as WatchBackend, Mn as forkScoped, Mr as pretty, Mt as Int$4, N as make$10, Ni as contains, Nr as TaggedError$1, Nt as Literal, O as Path$3, Oi as Service, On as flatMap$1, Or as Done, P as callback$1, Pi as exists, Pn as gen, Pr as taggedEnum, Q as splitLines, Qn as raceFirst, Qt as optional$3, R as filter$1, Ri as fromNullishOr, Rr as dedupeWith, Sr as doneUnsafe, T as make$9, Ti as match$3, Tn as fail, Tr as makeUnsafe$1, Ui as getOrUndefined, Un as match$2, V as groupedWithin, Vn as map$2, Vt as TaggedError, Wi as isNone, Wn as matchEffect, Wt as Union, X as runCollect, Xi as orElse, Xn as provideContext, Xr as flatMap$3, Y as run$3, Yi as none, Yn as provide$1, Yt as is, Z as runForEach, Zi as some, Zn as provideService, _ as orElse$1, _a as dual, _n as catchCause, _r as provideMerge, _t as poll, a as make$15, aa as isGreaterThan, ar as sync, at as fromChannel, b as when, ba as pipeArguments, bn as catchTags, br as MinimumLogLevel, bt as makeUnsafe, c as errorExitCode, ca as assignProperty, cn as toNumber, cr as tryPromise, ct as badArgument, da as equals, dn as all, dr as void_, dt as mapDone, ea as Number$2, er as runFork, fa as hasProperty, fi as match, fn as andThen, fr as catchDone, ft as endUnsafe, ga as isUndefined, gi as reduce, gn as callback, gr as provide, gt as offerUnsafe, ha as isNullish, hn as cached, hr as mergeAll, ht as offer, i as isQuitError, in as value, ir as suspend, it as drain, j as FileTypeId, ji as make$7, jn as forever, jr as fail$3, jt as FalseLiterals, k as make$11, ki as empty$1, kn as fnUntraced, kr as UnknownError, kt as BooleanLiterals, l as errorReported, la as BaseProto, ln as acquireRelease, lr as try_, lt as systemError, ma as isNotUndefined, mi as of, mr as effect, mt as make$13, n as QuitError, nr as serviceOption, nt as get, o as Stdio, oa as mapInput, oi as isReadonlyArrayNonEmpty, or as tap, ot as isSink, pa as isNotNull, pn as as, pr as round, pt as failCauseUnsafe, q as mkString, qi as map$4, qn as orElseSucceed, qr as findFirstIndex, r as Terminal, rn as make$6, rr as succeed$1, rt as make$14, s as make$12, sa as Prototype, sn as bytes, sr as tapError, st as BadArgument, ta as String$6, tn as toCodecStringTree, tr as scoped, tt as unwrap, u as makeRunMain, ua as format$1, ui as map$3, un as addFinalizer$1, ur as uninterruptible, ut as fromTransform, va as identity, vn as catchFilter, vr as succeed$4, vt as take, w as Crypto, wn as ensuring, wr as isDoneUnsafe, xn as catch_, xr as _await, y as value$1, ya as pipe, yi as sort, yn as catchTag, yr as addFinalizer, yt as make$8, z as fromChannel$1, zi as fromUndefinedOr, zt as String$5 } from "./dist-NXZtp5_0.js";
|
|
3
|
-
import { a as holds, c as storeDirs, l as PackageConfig, n as DocumentSource, o as loomsIn, r as LoomCompiler, s as projectIn, t as LoomFormatter, u as LoomConfig } from "./LoomFormatter-
|
|
4
|
-
import { a as installedVersion, d as serviceVersion, f as standalone, g as workspaceRoot, h as workspaceOf, i as installTypeScript, m as storeTypeScript, n as embeddedFile, p as storeDir, r as installService, s as removeService, t as ServiceInstall, u as servicePackage } from "./LoomStore-
|
|
3
|
+
import { a as holds, c as storeDirs, l as PackageConfig, n as DocumentSource, o as loomsIn, r as LoomCompiler, s as projectIn, t as LoomFormatter, u as LoomConfig } from "./LoomFormatter-BHgesYCg.js";
|
|
4
|
+
import { a as installedVersion, d as serviceVersion, f as standalone, g as workspaceRoot, h as workspaceOf, i as installTypeScript, m as storeTypeScript, n as embeddedFile, p as storeDir, r as installService, s as removeService, t as ServiceInstall, u as servicePackage } from "./LoomStore-C5R57cqa.js";
|
|
5
5
|
import * as OS from "node:os";
|
|
6
6
|
import { homedir, tmpdir } from "node:os";
|
|
7
7
|
import * as NodeChildProcess from "node:child_process";
|
|
@@ -8703,7 +8703,7 @@ var formatLanguages = (target) => gen(function* () {
|
|
|
8703
8703
|
globalThis.require ??= createRequire(import.meta.url);
|
|
8704
8704
|
});
|
|
8705
8705
|
const { installHostRuntime } = yield* promise(() => import("./Runtime-B-1DeuX_.js"));
|
|
8706
|
-
const { loadActive } = yield* promise(() => import("./LanguageLoader-
|
|
8706
|
+
const { loadActive } = yield* promise(() => import("./LanguageLoader-CBfzN4NH.js"));
|
|
8707
8707
|
yield* sync(() => installHostRuntime(ts));
|
|
8708
8708
|
return yield* loadActive(ids, root);
|
|
8709
8709
|
})
|
|
@@ -8796,7 +8796,7 @@ var installNote = (language, change) => ServiceInstall.$match(change, {
|
|
|
8796
8796
|
var failedInstall = (error) => refuse(`loom: could not install ${error.packageName} — ${String(error.cause)}`);
|
|
8797
8797
|
var alreadyActive = (language, dir) => log(`\n ${teal("✓")} ${language} is already activated\n` + match$1(installedVersion(language, dir), {
|
|
8798
8798
|
onNone: () => ` ${dim(`its service is not in the store; \`loom update ${language}\` installs it`)}\n`,
|
|
8799
|
-
onSome: (version) => version === "0.0.
|
|
8799
|
+
onSome: (version) => version === "0.0.15" ? "" : ` ${dim(`the store holds its service at ${version}; \`loom update ${language}\` brings it to ${serviceVersion}`)}\n`
|
|
8800
8800
|
}));
|
|
8801
8801
|
var add = (language) => gen(function* () {
|
|
8802
8802
|
const config = yield* LoomConfig;
|
|
@@ -8888,7 +8888,7 @@ var installerUpgrade = Installation.$match({
|
|
|
8888
8888
|
Pnpm: () => some("pnpm add -g @athrio/loom@latest"),
|
|
8889
8889
|
Project: ({ root, manager }) => some(`cd ${quoted(root)} && ${projectCommands[manager].add} @athrio/loom@latest`)
|
|
8890
8890
|
});
|
|
8891
|
-
var loomVersion = "0.0.
|
|
8891
|
+
var loomVersion = "0.0.15";
|
|
8892
8892
|
var releases = process.env.LOOM_RELEASES ?? "https://api.github.com/repos/athrio-com/loom/releases";
|
|
8893
8893
|
var ReleaseSchema = Struct({
|
|
8894
8894
|
tag_name: String$5,
|
|
@@ -8998,7 +8998,7 @@ var status = gen(function* () {
|
|
|
8998
8998
|
const languages = Object.keys(manifest?.languages ?? {});
|
|
8999
8999
|
const mark = (id) => match$1(installedVersion(id, dir), {
|
|
9000
9000
|
onNone: () => ` ${dim("○")} ${id}${dim(` — run \`loom update ${id}\``)}`,
|
|
9001
|
-
onSome: (version) => version === "0.0.
|
|
9001
|
+
onSome: (version) => version === "0.0.15" ? ` ${teal("●")} ${id}` : ` ${dim("◐")} ${id}${dim(` — ${version} is installed; run \`loom update ${id}\` for ${serviceVersion}`)}`
|
|
9002
9002
|
});
|
|
9003
9003
|
yield* log(`\n ${dim("store")} ${storeDir(dir)}\n ${dim("primary")} ${primary ?? dim("(none)")}\n ${dim("activated")} ${languages.length === 0 ? dim("(none)") : languages.join(", ")}\n`);
|
|
9004
9004
|
if (languages.length > 0) yield* log(`${languages.map(mark).join("\n")}\n`);
|
|
@@ -9037,7 +9037,7 @@ var serviceFinding = (id, root) => match$1(installedVersion(id, root), {
|
|
|
9037
9037
|
note: `the store holds no service for ${id}`,
|
|
9038
9038
|
fix: `loom update ${id}`
|
|
9039
9039
|
}),
|
|
9040
|
-
onSome: (version) => version === "0.0.
|
|
9040
|
+
onSome: (version) => version === "0.0.15" ? Finding.Fine({ note: `the store holds ${id}'s service at this Loom's ${serviceVersion}` }) : Finding.Problem({
|
|
9041
9041
|
note: `the store holds ${id}'s service at ${version}, and this Loom needs ${serviceVersion}`,
|
|
9042
9042
|
fix: `loom update ${id}`
|
|
9043
9043
|
})
|
|
@@ -9328,7 +9328,7 @@ var program = run(make$5("loom").pipe(withSubcommands([
|
|
|
9328
9328
|
])), { version: loomVersion }).pipe(provide$1(LoomTangler.layer), provide$1(LoomWeaver.layer), provide$1(LoomContents.layer), provide$1(LoomFormatter.layer), provide$1(DocumentSource.layer), provide$1(PackageConfig.layer), provide$1(LoomConfig.layer), provide$1(layer));
|
|
9329
9329
|
if (process.argv[2] === "lsp") {
|
|
9330
9330
|
globalThis.require = createRequire(import.meta.url);
|
|
9331
|
-
const { startLanguageServer } = await import("./LoomServer-
|
|
9331
|
+
const { startLanguageServer } = await import("./LoomServer-D14D2si9.js");
|
|
9332
9332
|
startLanguageServer();
|
|
9333
9333
|
} else runMain(program);
|
|
9334
9334
|
//#endregion
|