@hydranium/cli 1.0.0-next.37 → 1.0.0-next.370
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/README.md +102 -204
- package/bin/hydranium-cli.js +13 -0
- package/heap-analysis/heap/core/load.mjs +2 -2
- package/heap-analysis/heap/langium/langium.classifier.mjs +22 -11
- package/lib/cli-version.js.map +1 -1
- package/lib/cli.js +7 -2
- package/lib/cli.js.map +1 -1
- package/lib/commands/analyze-heap-args.d.ts.map +1 -1
- package/lib/commands/analyze-heap-args.js +1 -2
- package/lib/commands/analyze-heap-args.js.map +1 -1
- package/lib/commands/analyze-heap.d.ts +3 -0
- package/lib/commands/analyze-heap.d.ts.map +1 -1
- package/lib/commands/analyze-heap.js +2 -1
- package/lib/commands/analyze-heap.js.map +1 -1
- package/lib/commands/ast-ground-truth-args.d.ts +3 -2
- package/lib/commands/ast-ground-truth-args.d.ts.map +1 -1
- package/lib/commands/ast-ground-truth-args.js +11 -9
- package/lib/commands/ast-ground-truth-args.js.map +1 -1
- package/lib/commands/ast-ground-truth-driver.js +4 -2
- package/lib/commands/ast-ground-truth-driver.js.map +1 -1
- package/lib/commands/ast-ground-truth.js +1 -1
- package/lib/commands/ast-ground-truth.js.map +1 -1
- package/lib/commands/client-session.d.ts +17 -0
- package/lib/commands/client-session.d.ts.map +1 -0
- package/lib/commands/client-session.js +27 -0
- package/lib/commands/client-session.js.map +1 -0
- package/lib/commands/create-args.d.ts +17 -0
- package/lib/commands/create-args.d.ts.map +1 -0
- package/lib/commands/create-args.js +53 -0
- package/lib/commands/create-args.js.map +1 -0
- package/lib/commands/create.d.ts +38 -0
- package/lib/commands/create.d.ts.map +1 -0
- package/lib/commands/create.js +43 -0
- package/lib/commands/create.js.map +1 -0
- package/lib/commands/delete-args.d.ts +17 -0
- package/lib/commands/delete-args.d.ts.map +1 -0
- package/lib/commands/delete-args.js +49 -0
- package/lib/commands/delete-args.js.map +1 -0
- package/lib/commands/delete.d.ts +30 -0
- package/lib/commands/delete.d.ts.map +1 -0
- package/lib/commands/delete.js +32 -0
- package/lib/commands/delete.js.map +1 -0
- package/lib/commands/generate-ast-builder.d.ts.map +1 -1
- package/lib/commands/generate-ast-builder.js +1 -10
- package/lib/commands/generate-ast-builder.js.map +1 -1
- package/lib/commands/generate-languages.d.ts +35 -0
- package/lib/commands/generate-languages.d.ts.map +1 -0
- package/lib/commands/generate-languages.js +105 -0
- package/lib/commands/generate-languages.js.map +1 -0
- package/lib/commands/generate-transfer-builder.d.ts +33 -0
- package/lib/commands/generate-transfer-builder.d.ts.map +1 -0
- package/lib/commands/generate-transfer-builder.js +86 -0
- package/lib/commands/generate-transfer-builder.js.map +1 -0
- package/lib/commands/generate-transfer-model-args.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model-args.js +20 -5
- package/lib/commands/generate-transfer-model-args.js.map +1 -1
- package/lib/commands/generate-transfer-model-config.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model-config.js +8 -3
- package/lib/commands/generate-transfer-model-config.js.map +1 -1
- package/lib/commands/generate-transfer-model.d.ts +40 -9
- package/lib/commands/generate-transfer-model.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model.js +219 -67
- package/lib/commands/generate-transfer-model.js.map +1 -1
- package/lib/commands/generated-module-path.d.ts +16 -0
- package/lib/commands/generated-module-path.d.ts.map +1 -0
- package/lib/commands/generated-module-path.js +21 -0
- package/lib/commands/generated-module-path.js.map +1 -0
- package/lib/commands/harness-args.d.ts +44 -42
- package/lib/commands/harness-args.d.ts.map +1 -1
- package/lib/commands/harness-args.js +109 -27
- package/lib/commands/harness-args.js.map +1 -1
- package/lib/commands/headless-harness.d.ts +37 -20
- package/lib/commands/headless-harness.d.ts.map +1 -1
- package/lib/commands/headless-harness.js +71 -19
- package/lib/commands/headless-harness.js.map +1 -1
- package/lib/commands/init-args.d.ts +2 -0
- package/lib/commands/init-args.d.ts.map +1 -1
- package/lib/commands/init-args.js +74 -31
- package/lib/commands/init-args.js.map +1 -1
- package/lib/commands/init-hosts.d.ts +24 -0
- package/lib/commands/init-hosts.d.ts.map +1 -0
- package/lib/commands/init-hosts.js +37 -0
- package/lib/commands/init-hosts.js.map +1 -0
- package/lib/commands/init-prompt.d.ts +3 -3
- package/lib/commands/init-prompt.d.ts.map +1 -1
- package/lib/commands/init-prompt.js +4 -5
- package/lib/commands/init-prompt.js.map +1 -1
- package/lib/commands/init-templates.d.ts +26 -14
- package/lib/commands/init-templates.d.ts.map +1 -1
- package/lib/commands/init-templates.js +2989 -743
- package/lib/commands/init-templates.js.map +1 -1
- package/lib/commands/init-wizard.d.ts +3 -0
- package/lib/commands/init-wizard.d.ts.map +1 -1
- package/lib/commands/init-wizard.js +46 -31
- package/lib/commands/init-wizard.js.map +1 -1
- package/lib/commands/init-workspace.d.ts +13 -11
- package/lib/commands/init-workspace.d.ts.map +1 -1
- package/lib/commands/init-workspace.js +21 -7
- package/lib/commands/init-workspace.js.map +1 -1
- package/lib/commands/init.d.ts +58 -22
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +206 -48
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/kebab.d.ts +15 -0
- package/lib/commands/kebab.d.ts.map +1 -0
- package/lib/commands/kebab.js +17 -0
- package/lib/commands/kebab.js.map +1 -0
- package/lib/commands/lint-grammar-args.d.ts +3 -2
- package/lib/commands/lint-grammar-args.d.ts.map +1 -1
- package/lib/commands/lint-grammar-args.js +13 -10
- package/lib/commands/lint-grammar-args.js.map +1 -1
- package/lib/commands/lint-grammar-driver.js +2 -1
- package/lib/commands/lint-grammar-driver.js.map +1 -1
- package/lib/commands/lint-grammar-report.js.map +1 -1
- package/lib/commands/lint-grammar.js +1 -1
- package/lib/commands/lint-grammar.js.map +1 -1
- package/lib/commands/measure-memory-args.d.ts +3 -2
- package/lib/commands/measure-memory-args.d.ts.map +1 -1
- package/lib/commands/measure-memory-args.js +22 -11
- package/lib/commands/measure-memory-args.js.map +1 -1
- package/lib/commands/measure-memory-driver.js +5 -3
- package/lib/commands/measure-memory-driver.js.map +1 -1
- package/lib/commands/measure-memory.js +1 -1
- package/lib/commands/measure-memory.js.map +1 -1
- package/lib/commands/model-docs-args.d.ts +4 -3
- package/lib/commands/model-docs-args.d.ts.map +1 -1
- package/lib/commands/model-docs-args.js +12 -10
- package/lib/commands/model-docs-args.js.map +1 -1
- package/lib/commands/model-docs-driver.js +2 -1
- package/lib/commands/model-docs-driver.js.map +1 -1
- package/lib/commands/model-docs.js +1 -1
- package/lib/commands/model-docs.js.map +1 -1
- package/lib/commands/projects-args.d.ts.map +1 -1
- package/lib/commands/projects-args.js +5 -5
- package/lib/commands/projects-args.js.map +1 -1
- package/lib/commands/projects.d.ts +3 -4
- package/lib/commands/projects.d.ts.map +1 -1
- package/lib/commands/projects.js +2 -2
- package/lib/commands/projects.js.map +1 -1
- package/lib/commands/query-args.d.ts.map +1 -1
- package/lib/commands/query-args.js +6 -5
- package/lib/commands/query-args.js.map +1 -1
- package/lib/commands/query.d.ts +6 -5
- package/lib/commands/query.d.ts.map +1 -1
- package/lib/commands/query.js +5 -4
- package/lib/commands/query.js.map +1 -1
- package/lib/commands/reflect-args.d.ts +3 -2
- package/lib/commands/reflect-args.d.ts.map +1 -1
- package/lib/commands/reflect-args.js +13 -10
- package/lib/commands/reflect-args.js.map +1 -1
- package/lib/commands/reflect-driver.js +2 -1
- package/lib/commands/reflect-driver.js.map +1 -1
- package/lib/commands/reflect-report.js.map +1 -1
- package/lib/commands/reflect.js +1 -1
- package/lib/commands/reflect.js.map +1 -1
- package/lib/commands/save-args.d.ts.map +1 -1
- package/lib/commands/save-args.js +7 -4
- package/lib/commands/save-args.js.map +1 -1
- package/lib/commands/save.d.ts +8 -4
- package/lib/commands/save.d.ts.map +1 -1
- package/lib/commands/save.js +12 -23
- package/lib/commands/save.js.map +1 -1
- package/lib/commands/validate-args.d.ts +3 -2
- package/lib/commands/validate-args.d.ts.map +1 -1
- package/lib/commands/validate-args.js +13 -10
- package/lib/commands/validate-args.js.map +1 -1
- package/lib/commands/validate-driver.js +2 -1
- package/lib/commands/validate-driver.js.map +1 -1
- package/lib/commands/validate-report.js.map +1 -1
- package/lib/commands/validate.js +1 -1
- package/lib/commands/validate.js.map +1 -1
- package/lib/commands/watch-args.d.ts.map +1 -1
- package/lib/commands/watch-args.js +6 -4
- package/lib/commands/watch-args.js.map +1 -1
- package/lib/commands/watch.d.ts +3 -4
- package/lib/commands/watch.d.ts.map +1 -1
- package/lib/commands/watch.js +20 -2
- package/lib/commands/watch.js.map +1 -1
- package/lib/driver-heap.d.ts +52 -0
- package/lib/driver-heap.d.ts.map +1 -0
- package/lib/driver-heap.js +51 -0
- package/lib/driver-heap.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/log-level.d.ts +21 -11
- package/lib/log-level.d.ts.map +1 -1
- package/lib/log-level.js +25 -14
- package/lib/log-level.js.map +1 -1
- package/lib/spawn-data-server.d.ts +9 -4
- package/lib/spawn-data-server.d.ts.map +1 -1
- package/lib/spawn-data-server.js +5 -4
- package/lib/spawn-data-server.js.map +1 -1
- package/lib/stderr-connection-logger.d.ts +12 -0
- package/lib/stderr-connection-logger.d.ts.map +1 -0
- package/lib/stderr-connection-logger.js +16 -0
- package/lib/stderr-connection-logger.js.map +1 -0
- package/lib/testing/echo-server.js +9 -1
- package/lib/testing/echo-server.js.map +1 -1
- package/package.json +91 -39
- package/src/cli.ts +7 -2
- package/src/commands/analyze-heap-args.ts +1 -2
- package/src/commands/analyze-heap.ts +4 -1
- package/src/commands/ast-ground-truth-args.ts +15 -12
- package/src/commands/ast-ground-truth-driver.ts +4 -2
- package/src/commands/ast-ground-truth.ts +1 -1
- package/src/commands/client-session.ts +33 -0
- package/src/commands/create-args.ts +68 -0
- package/src/commands/create.ts +83 -0
- package/src/commands/delete-args.ts +64 -0
- package/src/commands/delete.ts +61 -0
- package/src/commands/generate-ast-builder.ts +1 -11
- package/src/commands/generate-languages.ts +132 -0
- package/src/commands/generate-transfer-builder.ts +101 -0
- package/src/commands/generate-transfer-model-args.ts +20 -5
- package/src/commands/generate-transfer-model-config.ts +8 -3
- package/src/commands/generate-transfer-model.ts +291 -65
- package/src/commands/generated-module-path.ts +22 -0
- package/src/commands/harness-args.ts +99 -31
- package/src/commands/headless-harness.ts +89 -28
- package/src/commands/init-args.ts +76 -31
- package/src/commands/init-hosts.ts +51 -0
- package/src/commands/init-prompt.ts +5 -6
- package/src/commands/init-templates.ts +3161 -756
- package/src/commands/init-wizard.ts +55 -31
- package/src/commands/init-workspace.ts +31 -16
- package/src/commands/init.ts +266 -63
- package/src/commands/kebab.ts +17 -0
- package/src/commands/lint-grammar-args.ts +17 -13
- package/src/commands/lint-grammar-driver.ts +2 -1
- package/src/commands/lint-grammar.ts +1 -1
- package/src/commands/measure-memory-args.ts +27 -14
- package/src/commands/measure-memory-driver.ts +5 -3
- package/src/commands/measure-memory.ts +1 -1
- package/src/commands/model-docs-args.ts +16 -13
- package/src/commands/model-docs-driver.ts +2 -1
- package/src/commands/model-docs.ts +1 -1
- package/src/commands/projects-args.ts +5 -4
- package/src/commands/projects.ts +4 -6
- package/src/commands/query-args.ts +6 -4
- package/src/commands/query.ts +9 -9
- package/src/commands/reflect-args.ts +17 -13
- package/src/commands/reflect-driver.ts +2 -1
- package/src/commands/reflect.ts +1 -1
- package/src/commands/save-args.ts +7 -3
- package/src/commands/save.ts +24 -27
- package/src/commands/validate-args.ts +17 -13
- package/src/commands/validate-driver.ts +2 -1
- package/src/commands/validate.ts +1 -1
- package/src/commands/watch-args.ts +6 -3
- package/src/commands/watch.ts +28 -7
- package/src/driver-heap.ts +65 -0
- package/src/index.ts +2 -0
- package/src/log-level.ts +42 -14
- package/src/spawn-data-server.ts +17 -5
- package/src/stderr-connection-logger.ts +18 -0
- package/src/testing/echo-server.ts +11 -2
- package/templates/client/gitignore +3 -0
- package/templates/client/src/__GRAMMAR_ID__-diagram-module.ts +82 -0
- package/templates/editorconfig +15 -0
- package/templates/gitignore +1 -0
- package/templates/host-browser/esbuild.mjs +82 -0
- package/templates/host-browser/gitignore +4 -0
- package/templates/host-browser/hydranium-mark.svg +40 -0
- package/templates/host-browser/index.html +287 -0
- package/templates/host-browser/playwright.config.mts +24 -0
- package/templates/host-browser/src/data-status.ts +15 -0
- package/templates/host-browser/src/diagram-save.ts +60 -0
- package/templates/host-browser/src/diagram.ts +118 -0
- package/templates/host-browser/src/editor.ts +102 -0
- package/templates/host-browser/src/log.ts +14 -0
- package/templates/host-browser/src/monaco-editor-core-worker.d.ts +7 -0
- package/templates/host-browser/src/monaco-editor-worker.ts +10 -0
- package/templates/host-browser/src/posix-path-shim.ts +23 -0
- package/templates/host-browser/src/shown-file.ts +61 -0
- package/templates/host-browser/src/workspace.ts +5 -0
- package/templates/host-browser/tsconfig.e2e.json +16 -0
- package/templates/host-browser/tsconfig.page.json +16 -0
- package/templates/host-browser/tsconfig.worker.json +16 -0
- package/templates/host-theia-browser/esbuild.mjs +24 -0
- package/templates/host-theia-browser/gitignore +9 -0
- package/templates/host-theia-browser/playwright.config.mts +42 -0
- package/templates/host-theia-browser/start.mjs +50 -0
- package/templates/host-theia-browser/tsconfig.e2e.json +16 -0
- package/templates/host-theia-electron/esbuild.mjs +27 -0
- package/templates/host-theia-electron/gitignore +8 -0
- package/templates/host-theia-electron/playwright.config.mts +12 -0
- package/templates/host-theia-electron/start.mjs +47 -0
- package/templates/host-theia-electron/tsconfig.e2e.json +16 -0
- package/templates/host-vscode/esbuild.mjs +38 -0
- package/templates/host-vscode/gitignore +7 -0
- package/templates/host-vscode/playwright.config.mts +14 -0
- package/templates/host-vscode/src/__GRAMMAR_ID__-diagram-editor.ts +19 -0
- package/templates/host-vscode/src/show-model-command.ts +24 -0
- package/templates/host-vscode/src/webview/__GRAMMAR_ID__-diagram.ts +18 -0
- package/templates/host-vscode/src/webview/diagram.css +40 -0
- package/templates/host-vscode/start.mjs +22 -0
- package/templates/host-vscode/test/install-vscode.mts +21 -0
- package/templates/host-vscode/test/vscode-version.mts +10 -0
- package/templates/host-vscode/tsconfig.e2e.json +17 -0
- package/templates/host-vscode/tsconfig.json +19 -0
- package/templates/host-vscode/tsconfig.webview.json +17 -0
- package/templates/oxlintrc.json +4 -0
- package/templates/protocol/gitignore +3 -0
- package/templates/protocol/src/__GRAMMAR_ID__-diagram-types.ts +47 -0
- package/templates/server/gitignore +6 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/create-node-operation-handler.ts +62 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/delete-operation-handler.ts +63 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/gmodel-factory.ts +144 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/state.ts +18 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/storage.ts +16 -0
- package/templates/server/src/glsp/__GRAMMAR_ID__/submission-handler.ts +24 -0
- package/templates/server/src/grammar/common.langium +12 -0
- package/templates/server/src/language-server/__GRAMMAR_ID__-serializer.ts +53 -0
- package/templates/server/src/language-server/__GRAMMAR_ID__-validation.ts +30 -0
- package/templates/server/src/language-server/ast.ts +23 -0
- package/templates/server/src/node/services.ts +16 -0
- package/templates/server/test/__GRAMMAR_ID__-diagram.test.ts +388 -0
- package/templates/server/test/tsconfig.json +4 -0
- package/templates/server/tsconfig.test.json +10 -0
- package/templates/server/vitest.config.ts +14 -0
- package/templates/theia/gitignore +3 -0
- package/templates/theia/src/browser/__GRAMMAR_ID__-diagram-frontend-module.ts +65 -0
- package/templates/theia/src/browser/__PROJECT_ID__-connection-preload-module.ts +15 -0
- package/templates/theia/src/browser/__PROJECT_ID__-data-connection.ts +15 -0
- package/templates/theia/src/browser/__PROJECT_ID__-data-port.ts +11 -0
- package/templates/theia/src/browser/__PROJECT_ID__-glsp-client-contribution.ts +13 -0
- package/templates/theia/src/browser/__PROJECT_ID__-show-model-command.ts +51 -0
- package/templates/theia/src/common/__PROJECT_ID__-glsp-contribution.ts +3 -0
- package/templates/theia/src/node/__PROJECT_ID__-connection-backend-module.ts +12 -0
- package/templates/theia/src/node/__PROJECT_ID__-data-backend-module.ts +15 -0
- package/templates/theia/src/node/__PROJECT_ID__-glsp-backend-module.ts +16 -0
- package/templates/theia/style/diagram.css +20 -0
- package/templates/theia/tsconfig.json +24 -0
- package/templates/vscode-servers/gitignore +4 -0
- package/templates/vscode-servers/tsconfig.json +19 -0
- package/templates/workspace/nodes.__EXTENSION__ +5 -0
- package/templates/workspace/references.__EXTENSION__ +2 -0
|
@@ -11,8 +11,9 @@ import { statSync, writeFileSync } from 'node:fs';
|
|
|
11
11
|
import { createRequire } from 'node:module';
|
|
12
12
|
import * as path from 'node:path';
|
|
13
13
|
import { pathToFileURL } from 'node:url';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { driverHeapArgs } from '../driver-heap.js';
|
|
15
|
+
import { logEnv } from '../log-level.js';
|
|
16
|
+
import { IMPORT_FLAG, SERVICES_FLAG } from './harness-args.js';
|
|
16
17
|
/** The flag every report-producing subcommand names its destination file with. */
|
|
17
18
|
export const OUT_FILE_FLAG = '--out-file';
|
|
18
19
|
/**
|
|
@@ -20,13 +21,15 @@ export const OUT_FILE_FLAG = '--out-file';
|
|
|
20
21
|
* its `createServices` thunk AND the `@hydranium/core/node` harness, both
|
|
21
22
|
* resolved from the HEAD's location rather than the CLI's.
|
|
22
23
|
*
|
|
23
|
-
* The module is an ESM file
|
|
24
|
-
*
|
|
24
|
+
* The module is an ESM file exporting a ZERO-ARG `createServices(): { shared }`:
|
|
25
|
+
* a compiled `lib/*.js`, or the TypeScript source when the child was started
|
|
26
|
+
* with a loader through {@link IMPORT_FLAG}. `hydranium-cli` is language-agnostic
|
|
25
27
|
* and cannot statically import a head's `create<Lang>Services`, so the dynamic
|
|
26
28
|
* import is the seam that keeps the binary head-neutral. Resolving the harness
|
|
27
|
-
* from the head's graph (via `createRequire` rooted at the head module)
|
|
28
|
-
*
|
|
29
|
-
*
|
|
29
|
+
* from the head's graph (via `createRequire` rooted at the head module) rather
|
|
30
|
+
* than from the CLI's guarantees it runs against the SAME core copy as
|
|
31
|
+
* `createServices`, which a second copy of the module would break even where
|
|
32
|
+
* both resolve.
|
|
30
33
|
*
|
|
31
34
|
* Throws a clear error when the path names no file, and when the export is
|
|
32
35
|
* missing or not a function.
|
|
@@ -40,11 +43,17 @@ export async function loadHeadlessContext(servicesModule) {
|
|
|
40
43
|
const stats = statSync(modulePath, { throwIfNoEntry: false });
|
|
41
44
|
if (stats === undefined || !stats.isFile()) {
|
|
42
45
|
throw new Error(`${SERVICES_FLAG} must name an existing ESM file; '${servicesModule}' resolved to ${modulePath}, ` +
|
|
43
|
-
|
|
44
|
-
'not
|
|
46
|
+
"which is not one. Pass the path of the server package's built `lib/node/services.js` from where you run this — " +
|
|
47
|
+
'not a package name.');
|
|
45
48
|
}
|
|
46
49
|
const moduleUrl = pathToFileURL(modulePath).href;
|
|
47
|
-
|
|
50
|
+
let imported;
|
|
51
|
+
try {
|
|
52
|
+
imported = (await import(moduleUrl));
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
throw withLoaderHint(err, modulePath);
|
|
56
|
+
}
|
|
48
57
|
const createServices = imported.createServices;
|
|
49
58
|
if (typeof createServices !== 'function') {
|
|
50
59
|
throw new Error(`Services module '${servicesModule}' must export a zero-arg 'createServices(): { shared }' ` +
|
|
@@ -56,6 +65,30 @@ export async function loadHeadlessContext(servicesModule) {
|
|
|
56
65
|
const coreNode = (await import(pathToFileURL(coreNodePath).href));
|
|
57
66
|
return { createServices: createServices, coreNode };
|
|
58
67
|
}
|
|
68
|
+
/** The codes Node fails a TypeScript entry with when no loader handled it, depending on its version. */
|
|
69
|
+
const UNLOADED_TYPESCRIPT_CODES = new Set([
|
|
70
|
+
'ERR_UNKNOWN_FILE_EXTENSION',
|
|
71
|
+
'ERR_MODULE_NOT_FOUND',
|
|
72
|
+
'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX'
|
|
73
|
+
]);
|
|
74
|
+
/**
|
|
75
|
+
* Append a loader hint to a TypeScript entry's import failure, unless the child
|
|
76
|
+
* was started with {@link IMPORT_FLAG}, where the hint would only repeat the
|
|
77
|
+
* caller's own command. Appended rather than substituted: a loader set through
|
|
78
|
+
* `NODE_OPTIONS` does not show in `execArgv`, and under it the failure can be a
|
|
79
|
+
* missing module that only Node's own message names.
|
|
80
|
+
*/
|
|
81
|
+
function withLoaderHint(err, modulePath) {
|
|
82
|
+
if (!(err instanceof Error) || !/\.[cm]?ts$/.test(modulePath) || !('code' in err) || typeof err.code !== 'string') {
|
|
83
|
+
return err;
|
|
84
|
+
}
|
|
85
|
+
if (!UNLOADED_TYPESCRIPT_CODES.has(err.code) || process.execArgv.some(arg => arg.startsWith(IMPORT_FLAG))) {
|
|
86
|
+
return err;
|
|
87
|
+
}
|
|
88
|
+
return new Error(`${err.message}\nA TypeScript head needs a loader registered with \`${IMPORT_FLAG}\`, e.g. \`${IMPORT_FLAG} tsx\`.`, {
|
|
89
|
+
cause: err
|
|
90
|
+
});
|
|
91
|
+
}
|
|
59
92
|
/**
|
|
60
93
|
* Child-side: deliver a finished report — to `outFile` when one was named, else
|
|
61
94
|
* to stdout.
|
|
@@ -73,8 +106,9 @@ export function emitReport(report, outFile) {
|
|
|
73
106
|
}
|
|
74
107
|
writeFileSync(outFile, report.endsWith('\n') ? report : `${report}\n`);
|
|
75
108
|
// Progress on stderr, so a caller that also captures stdout gets a clean
|
|
76
|
-
// stream rather than a note where the report used to be.
|
|
77
|
-
|
|
109
|
+
// stream rather than a note where the report used to be. Not `console.error`,
|
|
110
|
+
// which a configured log file records as an error line.
|
|
111
|
+
process.stderr.write(`Wrote ${outFile}\n`);
|
|
78
112
|
}
|
|
79
113
|
/**
|
|
80
114
|
* Parent-side: spawn `node <execArgs...>` inheriting stdio and resolve with the
|
|
@@ -100,22 +134,40 @@ export function spawnNodeChild(execArgs, env) {
|
|
|
100
134
|
* Parent-side: run a subcommand's driver child and propagate its exit code, so a
|
|
101
135
|
* shell or CI step sees the gate.
|
|
102
136
|
*
|
|
103
|
-
* **The log
|
|
104
|
-
* head's logger reads `
|
|
105
|
-
* which is inside the driver's dynamic import — a flag the driver
|
|
106
|
-
* arrive after the only moment it can be read. Setting
|
|
107
|
-
* exporting
|
|
108
|
-
*
|
|
137
|
+
* **The log options travel in the child's ENVIRONMENT, not its argv.** The
|
|
138
|
+
* head's logger reads its `HYDRANIUM_LOG_*` variables while `createServices`
|
|
139
|
+
* constructs it, which is inside the driver's dynamic import — a flag the driver
|
|
140
|
+
* parsed would arrive after the only moment it can be read. Setting them here
|
|
141
|
+
* rather than exporting them also leaves the CLI's own output alone, unlike
|
|
142
|
+
* ambient variables the parent would carry too.
|
|
109
143
|
*
|
|
110
144
|
* A head that binds a logger of its own decides for itself whether the flag means
|
|
111
145
|
* anything, which is the intended seam: the CLI is language-agnostic and cannot
|
|
112
146
|
* reach past `createServices`.
|
|
147
|
+
*
|
|
148
|
+
* **The heap ceiling is prepended HERE rather than passed by each subcommand.**
|
|
149
|
+
* Every caller wants the same answer to the same question, and the answer is not
|
|
150
|
+
* a constant — see {@link driverHeapArgs}. A literal at the call site is a place
|
|
151
|
+
* the container case can be missed, and the caller that misses it takes the whole
|
|
152
|
+
* cgroup down with it rather than failing on its own.
|
|
113
153
|
*/
|
|
114
154
|
export async function runDriverChild(execArgs, options) {
|
|
115
155
|
const spawnChild = options.__spawnForTest ?? spawnNodeChild;
|
|
116
|
-
const
|
|
156
|
+
const importArgs = (options.imports ?? []).map(specifier => `${IMPORT_FLAG}=${loaderSpecifier(specifier)}`);
|
|
157
|
+
const code = await spawnChild([...driverHeapArgs(options.__heapReadingForTest), ...importArgs, ...execArgs], logEnv(options));
|
|
117
158
|
if (code) {
|
|
118
159
|
process.exitCode = code;
|
|
119
160
|
}
|
|
120
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* A path, absolute or `./`/`../` relative with either separator, becomes a file
|
|
164
|
+
* URL resolved against the caller's directory. Node reads `--import` as a URL or
|
|
165
|
+
* package specifier, so it would take a Windows `C:\…` for the URL scheme `c:`
|
|
166
|
+
* and a `.\…` for a package name. Any other specifier passes through as Node
|
|
167
|
+
* reads it.
|
|
168
|
+
*/
|
|
169
|
+
function loaderSpecifier(specifier) {
|
|
170
|
+
const isPath = path.isAbsolute(specifier) || /^\.\.?[\\/]/.test(specifier);
|
|
171
|
+
return isPath ? pathToFileURL(path.resolve(specifier)).href : specifier;
|
|
172
|
+
}
|
|
121
173
|
//# sourceMappingURL=headless-harness.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless-harness.js","sourceRoot":"","sources":["../../src/commands/headless-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"headless-harness.js","sourceRoot":"","sources":["../../src/commands/headless-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAoB,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/D,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAoB1C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,cAAsB;IAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CA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G,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { type UsageError } from './harness-args.js';
|
|
28
28
|
import { type InitHead } from './init.js';
|
|
29
|
+
import type { InitHost } from './init-hosts.js';
|
|
29
30
|
/** One grammar as the command line collected it, before any derivation. */
|
|
30
31
|
export interface ParsedInitGrammar {
|
|
31
32
|
name: string;
|
|
@@ -39,6 +40,7 @@ export interface ParsedInitArgs {
|
|
|
39
40
|
name?: string;
|
|
40
41
|
force: boolean;
|
|
41
42
|
heads?: InitHead[];
|
|
43
|
+
hosts?: InitHost[];
|
|
42
44
|
monorepo: boolean;
|
|
43
45
|
scope?: string;
|
|
44
46
|
public: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-args.d.ts","sourceRoot":"","sources":["../../src/commands/init-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA2D,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init-args.d.ts","sourceRoot":"","sources":["../../src/commands/init-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA2D,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKhD,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,sGAAsG;AACtG,MAAM,WAAW,cAAc;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAYvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAQ7C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,cAAc,CAqFjG;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EA0FtC,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BlE"}
|
|
@@ -39,6 +39,7 @@ import { createNodeWorkspaceProbe, detectWorkspace } from './init-workspace.js';
|
|
|
39
39
|
export const INIT_FLAGS = [
|
|
40
40
|
'--name',
|
|
41
41
|
'--heads',
|
|
42
|
+
'--hosts',
|
|
42
43
|
'--force',
|
|
43
44
|
'--monorepo',
|
|
44
45
|
'--scope',
|
|
@@ -52,7 +53,15 @@ export const INIT_FLAGS = [
|
|
|
52
53
|
* The subset that takes a value, so `--help` in a value position reads as data.
|
|
53
54
|
* The rest are presence-only.
|
|
54
55
|
*/
|
|
55
|
-
export const INIT_VALUE_FLAGS = [
|
|
56
|
+
export const INIT_VALUE_FLAGS = [
|
|
57
|
+
'--name',
|
|
58
|
+
'--heads',
|
|
59
|
+
'--hosts',
|
|
60
|
+
'--scope',
|
|
61
|
+
'--grammar',
|
|
62
|
+
'--extensions',
|
|
63
|
+
'--language-id'
|
|
64
|
+
];
|
|
56
65
|
/**
|
|
57
66
|
* Parse `init`'s flags without deciding whether the result is complete.
|
|
58
67
|
*
|
|
@@ -69,6 +78,7 @@ export function parseInitArgs(args, onError = exitWithUsage) {
|
|
|
69
78
|
let name;
|
|
70
79
|
let force = false;
|
|
71
80
|
let heads;
|
|
81
|
+
let hosts;
|
|
72
82
|
let monorepo = false;
|
|
73
83
|
let scope;
|
|
74
84
|
let isPublic = false;
|
|
@@ -112,11 +122,14 @@ export function parseInitArgs(args, onError = exitWithUsage) {
|
|
|
112
122
|
scoped().diagram = true;
|
|
113
123
|
break;
|
|
114
124
|
case '--heads': {
|
|
115
|
-
// Validated in `resolveInitComposition
|
|
116
|
-
//
|
|
125
|
+
// Validated in `resolveInitComposition`; the cast only gets the
|
|
126
|
+
// strings that far.
|
|
117
127
|
heads = next().split(',');
|
|
118
128
|
break;
|
|
119
129
|
}
|
|
130
|
+
case '--hosts':
|
|
131
|
+
hosts = next().split(',');
|
|
132
|
+
break;
|
|
120
133
|
case '--force':
|
|
121
134
|
force = true;
|
|
122
135
|
break;
|
|
@@ -147,7 +160,7 @@ export function parseInitArgs(args, onError = exitWithUsage) {
|
|
|
147
160
|
}
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
|
-
return { targetDir, name, force, heads, monorepo, scope, public: isPublic, grammars };
|
|
163
|
+
return { targetDir, name, force, heads, hosts, monorepo, scope, public: isPublic, grammars };
|
|
151
164
|
}
|
|
152
165
|
/**
|
|
153
166
|
* The `init --help` text, as data.
|
|
@@ -157,46 +170,71 @@ export function parseInitArgs(args, onError = exitWithUsage) {
|
|
|
157
170
|
* authoritative, and a flag missing from it is a capability nobody finds.
|
|
158
171
|
*/
|
|
159
172
|
export const INIT_HELP = [
|
|
160
|
-
'Usage: hydranium-cli init <target-dir> --name <Name> [--heads <list>]
|
|
161
|
-
' [--
|
|
173
|
+
'Usage: hydranium-cli init <target-dir> --name <Name> [--heads <list>]',
|
|
174
|
+
' [--hosts <list>] [--force] [--monorepo]',
|
|
175
|
+
' [--scope <@scope>] [--public]',
|
|
162
176
|
' ( --grammar <Name> [--extensions <list>]',
|
|
163
177
|
' [--language-id <id>] [--diagram] )...',
|
|
164
178
|
'',
|
|
165
|
-
'Scaffold a new Hydranium language project end-to-end:
|
|
166
|
-
'
|
|
167
|
-
'
|
|
168
|
-
'
|
|
169
|
-
'
|
|
179
|
+
'Scaffold a new Hydranium language project end-to-end: its packages and a',
|
|
180
|
+
'starter workspace, each in its own directory. server/ holds a starter grammar',
|
|
181
|
+
'per --grammar, the `create<Name>Services` DI wiring, a launch of every head',
|
|
182
|
+
'and build scripts; protocol/ holds what the server and its clients both',
|
|
183
|
+
'import; client/, with a diagram, holds its host-neutral client side;',
|
|
184
|
+
'host-<name>/ holds each --hosts application, vscode-servers/ the server',
|
|
185
|
+
'launch of the VS Code and Theia ones, and theia/ the Theia extension;',
|
|
186
|
+
'workspace/ holds two starter model files per grammar. A standalone project',
|
|
187
|
+
'also gets a root manifest naming the packages as npm workspaces.',
|
|
188
|
+
'Does NOT run `npm install` or `langium generate` — those are printed as next',
|
|
189
|
+
'steps. Refuses a non-empty directory without --force.',
|
|
170
190
|
'',
|
|
171
191
|
'Run it with no --name on a terminal to be prompted instead. The wizard echoes',
|
|
172
192
|
'the command it composed before running it, so every answer is reproducible as',
|
|
173
193
|
'flags. Without a terminal a missing --name stays an error, so CI never hangs.',
|
|
174
194
|
'',
|
|
175
195
|
'Project options (position-free):',
|
|
176
|
-
' <target-dir>
|
|
196
|
+
' <target-dir> The project directory to scaffold into (required).',
|
|
177
197
|
' --name <Name> PascalCase PROJECT name; drives the services and the',
|
|
178
198
|
' Langium projectName, i.e. the shared generated symbols',
|
|
179
199
|
' (<Name>AstReflection, <Name>GeneratedSharedModule) (required).',
|
|
180
|
-
' --heads <list> Comma-separated protocol heads: lsp, data, glsp
|
|
181
|
-
'
|
|
182
|
-
'
|
|
183
|
-
' The emitted dependencies, main.ts and
|
|
184
|
-
' all follow this set. Default: lsp,data.',
|
|
200
|
+
' --heads <list> Comma-separated protocol heads: lsp, data, glsp, any',
|
|
201
|
+
' non-empty set. Without lsp, main.ts serves the socket',
|
|
202
|
+
' heads from a workspace path it is given and prints',
|
|
203
|
+
' their ports. The emitted dependencies, main.ts and',
|
|
204
|
+
' module bindings all follow this set. Default: lsp,data.',
|
|
205
|
+
' --hosts <list> Comma-separated host applications to emit around the',
|
|
206
|
+
' heads: browser, a page running every head in a web',
|
|
207
|
+
' worker, which needs lsp or glsp; without lsp it has',
|
|
208
|
+
' no editor and saves through the diagram. vscode, a',
|
|
209
|
+
' VS Code extension and the servers-only extension it',
|
|
210
|
+
' starts the server through, which needs lsp.',
|
|
211
|
+
' theia-browser, a Theia browser application, its',
|
|
212
|
+
' Theia extension and the servers-only extension it',
|
|
213
|
+
' sideloads, which needs lsp. theia-electron, the',
|
|
214
|
+
' same in a Theia Electron application. Without',
|
|
215
|
+
' --hosts, the server with its Node entry points, and',
|
|
216
|
+
' with glsp the client/ package a host mounts.',
|
|
185
217
|
' --force Scaffold into a non-empty directory anyway.',
|
|
186
|
-
' --monorepo Scaffold
|
|
187
|
-
'
|
|
188
|
-
'
|
|
189
|
-
' scripts address the
|
|
190
|
-
' ancestor declares `workspaces`.
|
|
191
|
-
' target — the root `workspaces`
|
|
192
|
-
'
|
|
218
|
+
' --monorepo Scaffold the packages as members of the surrounding npm',
|
|
219
|
+
' workspace, with no root of their own: each tsconfig',
|
|
220
|
+
' extends the root config that actually carries',
|
|
221
|
+
' compilerOptions, and the scripts address the server by',
|
|
222
|
+
' --prefix. Errors when no ancestor declares `workspaces`.',
|
|
223
|
+
' Never writes outside the target — the root `workspaces`',
|
|
224
|
+
' entries and dependency pins are printed, not added.',
|
|
225
|
+
' --scope <@scope> npm scope for the package names, e.g. @acme. Not inferred:',
|
|
193
226
|
' a root manifest is usually named for the repo, not the',
|
|
194
227
|
' scope. The wizard offers the siblings’ scope as a default.',
|
|
195
|
-
'
|
|
196
|
-
'
|
|
197
|
-
'
|
|
198
|
-
'
|
|
199
|
-
'
|
|
228
|
+
' The VS Code extensions stay unscoped, since vsce',
|
|
229
|
+
' refuses a scoped extension name.',
|
|
230
|
+
' --public Omit "private": true from the server, protocol,',
|
|
231
|
+
' client and Theia extension packages, so they can be',
|
|
232
|
+
' published together; a host package stays private.',
|
|
233
|
+
' The scaffold emits it by default, because the',
|
|
234
|
+
' manifests also declare license "UNLICENSED": a',
|
|
235
|
+
' package granting no rights on a public registry',
|
|
236
|
+
' contradicts itself. Pass this once the project has',
|
|
237
|
+
' picked a licence.',
|
|
200
238
|
'',
|
|
201
239
|
'Grammar options — each applies to the PRECEDING --grammar:',
|
|
202
240
|
' --grammar <Name> PascalCase GRAMMAR name; drives the `grammar X` declaration',
|
|
@@ -210,8 +248,12 @@ export const INIT_HELP = [
|
|
|
210
248
|
' (default: <project-id>-<grammar-id>).',
|
|
211
249
|
' --diagram Scaffold a GLSP diagram for that grammar. Requires',
|
|
212
250
|
' `glsp` in --heads. Derived when there is exactly one',
|
|
213
|
-
' grammar; required when there are several, because
|
|
214
|
-
' diagram
|
|
251
|
+
' grammar; required when there are several, because the',
|
|
252
|
+
' scaffolded diagram is typed over one grammar’s model.',
|
|
253
|
+
'',
|
|
254
|
+
'Example — one grammar, three heads, in a browser page:',
|
|
255
|
+
' hydranium-cli init ./bookstore --name Bookstore --heads lsp,data,glsp \\',
|
|
256
|
+
' --hosts browser',
|
|
215
257
|
'',
|
|
216
258
|
'Example — three grammars, one with a differing extension, three heads:',
|
|
217
259
|
' hydranium-cli init ./order-flow --name OrderFlow --heads lsp,data,glsp \\',
|
|
@@ -241,6 +283,7 @@ export async function runInitCommand(args) {
|
|
|
241
283
|
name: assertRequired(parsed.name, '--name', 'init'),
|
|
242
284
|
grammars: parsed.grammars,
|
|
243
285
|
heads: parsed.heads,
|
|
286
|
+
hosts: parsed.hosts,
|
|
244
287
|
force: parsed.force,
|
|
245
288
|
monorepo: parsed.monorepo,
|
|
246
289
|
scope: parsed.scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-args.js","sourceRoot":"","sources":["../../src/commands/init-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init-args.js","sourceRoot":"","sources":["../../src/commands/init-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAuBhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC1C,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,YAAY;IACZ,SAAS;IACT,UAAU;IACV,WAAW;IACX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SAAS,CAAC,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,wBAAwB,EAAE,CAAC,EAAE;YAC3G,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,aAAa;SAC3B,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC;QACL,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC;QACnE,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC;QACnD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;KACvB,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
/**
|
|
10
|
+
* The host applications `init` can emit around the server: each holds the
|
|
11
|
+
* clients of the heads it runs, in a sibling package of its own.
|
|
12
|
+
*/
|
|
13
|
+
import type { InitHead } from './init.js';
|
|
14
|
+
/** The hosts a scaffold can emit, in the order a workspace lists them. */
|
|
15
|
+
export declare const INIT_HOSTS: readonly ['browser', 'vscode', 'theia-browser', 'theia-electron'];
|
|
16
|
+
/** One host application — see {@link INIT_HOSTS}. */
|
|
17
|
+
export type InitHost = (typeof INIT_HOSTS)[number];
|
|
18
|
+
/** True for a string naming one of {@link INIT_HOSTS}. */
|
|
19
|
+
export declare function isInitHost(value: string): value is InitHost;
|
|
20
|
+
/** True for a host that is a Theia application, which runs the Theia extension. */
|
|
21
|
+
export declare function isTheiaHost(host: InitHost): boolean;
|
|
22
|
+
/** The heads {@link host} needs at least one of in the composition. */
|
|
23
|
+
export declare function editingHeads(host: InitHost): readonly InitHead[];
|
|
24
|
+
//# sourceMappingURL=init-hosts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-hosts.d.ts","sourceRoot":"","sources":["../../src/commands/init-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,0EAA0E;AAC1E,eAAO,MAAM,UAAU,YAAI,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAE5F,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAiBnD,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAE3D;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEnD;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,QAAQ,EAAE,CAEhE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
/** The hosts a scaffold can emit, in the order a workspace lists them. */
|
|
10
|
+
export const INIT_HOSTS = ['browser', 'vscode', 'theia-browser', 'theia-electron'];
|
|
11
|
+
/**
|
|
12
|
+
* The heads a host needs at least one of: those whose client edits and saves
|
|
13
|
+
* the files. The browser page has no filesystem of its own, so it saves through
|
|
14
|
+
* the LSP head's editor or the GLSP head's diagram. VS Code and Theia own the
|
|
15
|
+
* files and reach the server through a language client, so they need the LSP
|
|
16
|
+
* head. Every other head is optional, and a head the host does not know is left
|
|
17
|
+
* unused.
|
|
18
|
+
*/
|
|
19
|
+
const EDITING_HEADS = {
|
|
20
|
+
browser: ['lsp', 'glsp'],
|
|
21
|
+
vscode: ['lsp'],
|
|
22
|
+
'theia-browser': ['lsp'],
|
|
23
|
+
'theia-electron': ['lsp']
|
|
24
|
+
};
|
|
25
|
+
/** True for a string naming one of {@link INIT_HOSTS}. */
|
|
26
|
+
export function isInitHost(value) {
|
|
27
|
+
return INIT_HOSTS.includes(value);
|
|
28
|
+
}
|
|
29
|
+
/** True for a host that is a Theia application, which runs the Theia extension. */
|
|
30
|
+
export function isTheiaHost(host) {
|
|
31
|
+
return host === 'theia-browser' || host === 'theia-electron';
|
|
32
|
+
}
|
|
33
|
+
/** The heads {@link host} needs at least one of in the composition. */
|
|
34
|
+
export function editingHeads(host) {
|
|
35
|
+
return EDITING_HEADS[host];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=init-hosts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-hosts.js","sourceRoot":"","sources":["../../src/commands/init-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAK5F;;;;;;;GAOG;AACH,MAAM,aAAa,GAA0C;IAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,CAAC,KAAK,CAAC;IACf,eAAe,EAAE,CAAC,KAAK,CAAC;IACxB,gBAAgB,EAAE,CAAC,KAAK,CAAC;CAC3B,CAAC;AAEF,0DAA0D;AAC1D,MAAM,UAAU,UAAU,CAAC,KAAa;IACrC,OAAQ,UAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAAC,IAAc;IACvC,OAAO,IAAI,KAAK,eAAe,IAAI,IAAI,KAAK,gBAAgB,CAAC;AAChE,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,IAAc;IACxC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -39,7 +39,7 @@ export interface PromptPort {
|
|
|
39
39
|
readonly choices: ReadonlyArray<PromptChoice<Value>>;
|
|
40
40
|
readonly initialValue?: Value;
|
|
41
41
|
}) => Promise<Value>;
|
|
42
|
-
/** Ask for
|
|
42
|
+
/** Ask for at least one of several choices. */
|
|
43
43
|
readonly multiselect: <Value extends string>(options: {
|
|
44
44
|
readonly message: string;
|
|
45
45
|
readonly choices: ReadonlyArray<PromptChoice<Value>>;
|
|
@@ -53,8 +53,8 @@ export interface PromptPort {
|
|
|
53
53
|
/** Close the session with a closing line. */
|
|
54
54
|
readonly outro: (message: string) => void;
|
|
55
55
|
}
|
|
56
|
-
/** The
|
|
57
|
-
export declare const
|
|
56
|
+
/** The heads, as a checkbox list. */
|
|
57
|
+
export declare const HEAD_CHOICES: ReadonlyArray<PromptChoice<InitHead>>;
|
|
58
58
|
/**
|
|
59
59
|
* The real prompt, backed by `@clack/prompts`.
|
|
60
60
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prompt.d.ts","sourceRoot":"","sources":["../../src/commands/init-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAqBlF,OAAO,KAAK,EAAE,QAAQ,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E,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/G,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,qCAAqC;AACrC,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,CAI9D,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAqD7D"}
|
|
@@ -13,8 +13,9 @@ export class InitWizardCancelled extends Error {
|
|
|
13
13
|
this.name = 'InitWizardCancelled';
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
/** The
|
|
17
|
-
export const
|
|
16
|
+
/** The heads, as a checkbox list. */
|
|
17
|
+
export const HEAD_CHOICES = [
|
|
18
|
+
{ value: 'lsp', label: 'lsp', hint: 'text editing in an LSP client' },
|
|
18
19
|
{ value: 'data', label: 'data', hint: 'typed JSON-RPC for forms, trees and code-gen' },
|
|
19
20
|
{ value: 'glsp', label: 'glsp', hint: 'graphical editing; adds a scaffolded diagram' }
|
|
20
21
|
];
|
|
@@ -60,9 +61,7 @@ export async function createClackPrompt() {
|
|
|
60
61
|
message: options.message,
|
|
61
62
|
options: toOptions(options.choices),
|
|
62
63
|
initialValues: options.initialValues ? [...options.initialValues] : [],
|
|
63
|
-
|
|
64
|
-
// server, so an empty selection must not be rejected.
|
|
65
|
-
required: false
|
|
64
|
+
required: true
|
|
66
65
|
})),
|
|
67
66
|
confirm: async (options) => unwrap(await clack.confirm({ message: options.message, initialValue: options.initialValue })),
|
|
68
67
|
outro: message => clack.outro(message)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prompt.js","sourceRoot":"","sources":["../../src/commands/init-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAuClF,4EAA4E;AAC5E,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC3C;QACG,KAAK,CAA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,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;YACtE,QAAQ,EAAE,IAAI;SAChB,CAAC,CACJ;QACJ,OAAO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QACvH,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;KACxC,CAAC;AACL,CAAC"}
|
|
@@ -6,21 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type
|
|
9
|
+
import { type InitComposition, type InitFile, type InitMember } from './init.js';
|
|
10
10
|
/** One template file: its path (tokens allowed) and its content (tokens allowed). */
|
|
11
11
|
export interface InitTemplate {
|
|
12
12
|
path: string;
|
|
13
13
|
content: string;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* The version every framework package carries before the first release.
|
|
17
|
-
*
|
|
18
|
-
* A scaffold made by a CLI still at this version pins a range the registry
|
|
19
|
-
* cannot serve, so the emitted README keeps its yalc note and `init` keeps its
|
|
20
|
-
* install warning while — and only while — it holds: from a published CLI the
|
|
21
|
-
* derived pins resolve and either note would be false as printed.
|
|
22
|
-
*/
|
|
23
|
-
export declare const UNPUBLISHED_FRAMEWORK_VERSION = "0.0.0";
|
|
24
15
|
/**
|
|
25
16
|
* The version `init` pins every `@hydranium/*` dependency at: the scaffolding
|
|
26
17
|
* CLI's own.
|
|
@@ -32,11 +23,32 @@ export declare const UNPUBLISHED_FRAMEWORK_VERSION = "0.0.0";
|
|
|
32
23
|
*/
|
|
33
24
|
export declare function readFrameworkVersion(): string;
|
|
34
25
|
/**
|
|
35
|
-
*
|
|
26
|
+
* A member's package name: `<id>-<member>`, under the scope when there is one,
|
|
27
|
+
* except for the VS Code extensions, whose scoped name `vsce` refuses to
|
|
28
|
+
* package.
|
|
36
29
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
30
|
+
* Suffixed even for the server, because a project of several packages has no
|
|
31
|
+
* member entitled to the bare id, and a later client or host would otherwise
|
|
32
|
+
* read as a part of the server.
|
|
33
|
+
*/
|
|
34
|
+
export declare function memberPackageName(composition: InitComposition, member: InitMember): string;
|
|
35
|
+
/**
|
|
36
|
+
* The Node major a standalone scaffold's `.nvmrc` and printed steps name.
|
|
37
|
+
* `langium generate` from the pinned `langium-cli` fails on Node 24.20 and
|
|
38
|
+
* later, which `engines` still admits.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SCAFFOLD_NODE_MAJOR = "22";
|
|
41
|
+
/**
|
|
42
|
+
* The exact pins of every member the composition emits, for a workspace root
|
|
43
|
+
* to declare too. npm installs a root's own dependencies at the top of the
|
|
44
|
+
* tree, so another member's version of one nests beneath that member instead of
|
|
45
|
+
* taking the place of the copy this package shares with the framework.
|
|
46
|
+
*/
|
|
47
|
+
export declare function workspaceRootPins(composition: InitComposition): ReadonlyArray<readonly [string, string]>;
|
|
48
|
+
/**
|
|
49
|
+
* Every file the scaffold emits, fully rendered, at its path in the project
|
|
50
|
+
* directory. A workspace member's project gets no root of its own: it joins the
|
|
51
|
+
* surrounding workspace, whose manifest `init` prints the changes for.
|
|
40
52
|
*/
|
|
41
53
|
export declare function buildInitTemplates(composition: InitComposition): InitFile[];
|
|
42
54
|
//# sourceMappingURL=init-templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AA2FlF,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAwC,KAAK,UAAU,EAAe,MAAM,WAAW,CAAC;AAIpI,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAI1F;AA0RD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,eAAe,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAoBxG;AAo5HD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,eAAe,GAAG,QAAQ,EAAE,CAc3E"}
|