@hydranium/cli 1.0.0-next.30 → 1.0.0-next.32

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.
@@ -310,9 +310,9 @@ __BIN__ },
310
310
  ],
311
311
  "scripts": {
312
312
  "build": "npm run generate && tsc",
313
- "clean": "rimraf lib syntaxes src/language-server/generated src/language-server/generated-transfer tsconfig.tsbuildinfo",
313
+ "clean": "rimraf lib syntaxes src/language-server/generated src/language-server/generated-hydranium tsconfig.tsbuildinfo",
314
314
  "generate": "npm run langium:generate && npm run generate:transfer-model",
315
- "generate:transfer-model": "hydranium-cli generate-transfer-model --ast-file src/language-server/generated/ast.ts --augmentation-file src/language-server/ast.ts --out-file src/language-server/generated-transfer/transfer-model.ts --element-type-name __NAME__Element --terminals-name __NAME__Terminals --regen-command \\"Run: __NPM_RUN__ generate:transfer-model\\"",
315
+ "generate:transfer-model": "hydranium-cli generate-transfer-model --ast-file src/language-server/generated/ast.ts --augmentation-file src/language-server/ast.ts --out-file src/language-server/generated-hydranium/transfer-model.ts --ast-builder-file src/language-server/generated-hydranium/ast-builder.ts --element-type-name __NAME__Element --terminals-name __NAME__Terminals --regen-command \\"Run: __NPM_RUN__ generate:transfer-model\\"",
316
316
  "langium:generate": "langium generate",
317
317
  "langium:watch": "langium generate --watch",
318
318
  __LINT__ "start": "node lib/main.js --stdio",
@@ -439,6 +439,11 @@ const TSCONFIG_COMPILER_OPTIONS: ReadonlyArray<readonly [string, JsonValue]> = [
439
439
  ['outDir', 'lib'],
440
440
  ['strict', true],
441
441
  ['esModuleInterop', true],
442
+ // A server that renders its own user-facing messages loads a catalogue, and
443
+ // a catalogue is JSON. Without this the import does not resolve at all, and
444
+ // without the `include` glob below a composite project rejects it with
445
+ // TS6307 naming neither cause.
446
+ ['resolveJsonModule', true],
442
447
  ['skipLibCheck', true],
443
448
  ['declaration', true],
444
449
  ['experimentalDecorators', true],
@@ -480,7 +485,7 @@ function tsconfigJson(composition: InitComposition): string {
480
485
  ];
481
486
  const extendsLine = workspace?.baseTsconfig === undefined ? '' : ` "extends": "${workspace.baseTsconfig}",\n`;
482
487
  const body = options.map(([key, value]) => ` "${key}": ${JSON.stringify(value)}`).join(',\n');
483
- return `{\n${extendsLine} "compilerOptions": {\n${body}\n },\n "include": ["src"]\n}\n`;
488
+ return `{\n${extendsLine} "compilerOptions": {\n${body}\n },\n "include": ["src", "src/**/*.json"]\n}\n`;
484
489
  }
485
490
 
486
491
  // `isolatedModules` is what makes this check agree with the transform that
@@ -498,7 +503,7 @@ const TSCONFIG_TEST = `{
498
503
  "isolatedModules": true,
499
504
  "types": ["node"]
500
505
  },
501
- "include": ["src", "test"]
506
+ "include": ["src", "test", "src/**/*.json"]
502
507
  }
503
508
  `;
504
509
 
@@ -1003,7 +1008,7 @@ import { startGlspServer } from '@hydranium/glsp-server/node';
1003
1008
  // \`TransferElement\` structurally, so naming the AST type here compiles fine and
1004
1009
  // silently tells every typed client that a reference is a resolvable object
1005
1010
  // rather than a name.
1006
- ${importList(roots, './language-server/generated-transfer/transfer-model.js', columns, true)}
1011
+ ${importList(roots, './language-server/generated-hydranium/transfer-model.js', columns, true)}
1007
1012
  `
1008
1013
  : '';
1009
1014
 
@@ -1086,7 +1091,13 @@ void glspServer;
1086
1091
  // than a library entry — import \`./index.js\` instead to compose the language.
1087
1092
 
1088
1093
  ${reflectImport}${glspImports}${importList(coreNodeSymbols, '@hydranium/core/node', columns)}
1089
- ${data ? "import { DataServer } from '@hydranium/data-server';\n" : ''}import { startLanguageServer } from '@hydranium/langium/lsp';
1094
+ ${data ? "import { DataServer } from '@hydranium/data-server';\n" : ''}// The framework's entry point, NOT Langium's \`@hydranium/langium/lsp\` one. It is
1095
+ // signature-compatible and delegates straight through; what it adds first is
1096
+ // \`assertLspHeadComposed\`, which fails the start if the LSP head's SHARED module
1097
+ // was never composed. Reaching for Langium's is the natural mistake and it is
1098
+ // silent: the server boots, links and completes, while echo suppression, the
1099
+ // didChangeContent debounce and the last-client-close rebuild are all inert.
1100
+ import { startLanguageServer } from '@hydranium/core/lsp';
1090
1101
  import { ProposedFeatures, createConnection } from 'vscode-languageserver/node';
1091
1102
  ${diagramImports}${transferImports}import { create__NAME__Services } from './language-server/__PROJECT_ID__-module.js';
1092
1103
  ${portCommands === '' ? '' : '\n' + portCommands}
@@ -1140,7 +1151,7 @@ function dataServerMainFile(composition: InitComposition): string {
1140
1151
  ${importList(['NodeFileSystem', 'startStdioServer'], '@hydranium/core/node', columns)}
1141
1152
  import { DataServer } from '@hydranium/data-server';
1142
1153
  // The TRANSFER root${plural}, not the AST one${plural} — same reasoning as \`main.ts\`.
1143
- ${importList(roots, './language-server/generated-transfer/transfer-model.js', columns, true)}
1154
+ ${importList(roots, './language-server/generated-hydranium/transfer-model.js', columns, true)}
1144
1155
  import { create__NAME__Services } from './language-server/__PROJECT_ID__-module.js';
1145
1156
 
1146
1157
  const { shared } = create__NAME__Services({ ...NodeFileSystem });
@@ -1270,7 +1281,7 @@ function serializationTest(composition: InitComposition): string {
1270
1281
  import { parseHelper } from '@hydranium/core/testing';
1271
1282
  import { describe, expect, it } from 'vitest';
1272
1283
  ${importList(astTypes, '../src/language-server/ast.js', columns, true)}
1273
- ${importList(transferTypes, '../src/language-server/generated-transfer/transfer-model.js', columns, true)}
1284
+ ${importList(transferTypes, '../src/language-server/generated-hydranium/transfer-model.js', columns, true)}
1274
1285
  import { createServices } from '../src/services.js';
1275
1286
 
1276
1287
  ${composition.grammars.map(grammar => render(SERIALIZATION_SUITE, composition, grammar)).join('\n\n')}
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
 
10
+ export * from './commands/generate-ast-builder.js';
10
11
  export * from './commands/generate-transfer-model.js';
11
12
  export * from './commands/projects.js';
12
13
  export * from './commands/query.js';