@hydranium/cli 1.0.0-next.30 → 1.0.0-next.300
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 +75 -204
- package/bin/hydranium-cli.js +13 -0
- package/heap-analysis/heap/core/load.mjs +2 -2
- 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.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 +2 -1
- 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 +49 -0
- package/lib/commands/generate-ast-builder.d.ts.map +1 -0
- package/lib/commands/generate-ast-builder.js +200 -0
- package/lib/commands/generate-ast-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 +11 -1
- 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 +6 -3
- package/lib/commands/generate-transfer-model-config.js.map +1 -1
- package/lib/commands/generate-transfer-model.d.ts +9 -0
- package/lib/commands/generate-transfer-model.d.ts.map +1 -1
- package/lib/commands/generate-transfer-model.js +18 -4
- package/lib/commands/generate-transfer-model.js.map +1 -1
- 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 +68 -17
- package/lib/commands/headless-harness.js.map +1 -1
- package/lib/commands/init-args.js +6 -6
- package/lib/commands/init-args.js.map +1 -1
- package/lib/commands/init-prompt.d.ts.map +1 -1
- package/lib/commands/init-templates.d.ts +8 -10
- package/lib/commands/init-templates.d.ts.map +1 -1
- package/lib/commands/init-templates.js +261 -167
- package/lib/commands/init-templates.js.map +1 -1
- package/lib/commands/init-wizard.js +4 -4
- package/lib/commands/init-wizard.js.map +1 -1
- package/lib/commands/init-workspace.d.ts +13 -3
- package/lib/commands/init-workspace.d.ts.map +1 -1
- package/lib/commands/init-workspace.js +21 -6
- package/lib/commands/init-workspace.js.map +1 -1
- package/lib/commands/init.d.ts +16 -10
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +17 -15
- package/lib/commands/init.js.map +1 -1
- 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 +5 -5
- package/lib/commands/query-args.js.map +1 -1
- package/lib/commands/query.d.ts +3 -4
- package/lib/commands/query.d.ts.map +1 -1
- package/lib/commands/query.js +2 -2
- 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 +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -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 +50 -39
- package/src/cli.ts +7 -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 +2 -1
- 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 +246 -0
- package/src/commands/generate-transfer-model-args.ts +11 -1
- package/src/commands/generate-transfer-model-config.ts +6 -3
- package/src/commands/generate-transfer-model.ts +27 -4
- package/src/commands/harness-args.ts +99 -31
- package/src/commands/headless-harness.ts +86 -26
- package/src/commands/init-args.ts +6 -6
- package/src/commands/init-templates.ts +272 -169
- package/src/commands/init-wizard.ts +4 -4
- package/src/commands/init-workspace.ts +31 -7
- package/src/commands/init.ts +36 -26
- 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 +5 -4
- package/src/commands/query.ts +4 -6
- 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 +3 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-ground-truth.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,8BAA8B,EAAE,
|
|
1
|
+
{"version":3,"file":"ast-ground-truth.js","sourceRoot":"","sources":["../../src/commands/ast-ground-truth.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,8BAA8B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAYvF,oEAAoE;AACpE,MAAM,UAAU,0BAA0B,CAAC,OAAqC;IAC7E,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACvE,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqC;IACpE,OAAO,cAAc,CAAC,CAAC,MAAM,EAAE,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
|
+
import type { DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
|
+
/**
|
|
12
|
+
* Run `fn` as the client session `clientId`, and end the session whether `fn`
|
|
13
|
+
* succeeded or not, which closes whatever it left open. An end that fails
|
|
14
|
+
* after a failed `fn` is swallowed: `fn`'s error is the one the user needs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function withClientSession<T>(server: Pick<DataServerProtocol<TransferElement>, 'createSession' | 'closeSession'>, clientId: string, fn: () => Promise<T>): Promise<T>;
|
|
17
|
+
//# sourceMappingURL=client-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-session.d.ts","sourceRoot":"","sources":["../../src/commands/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACtC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC,EACnF,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACpB,OAAO,CAAC,CAAC,CAAC,CAWZ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
* Run `fn` as the client session `clientId`, and end the session whether `fn`
|
|
11
|
+
* succeeded or not, which closes whatever it left open. An end that fails
|
|
12
|
+
* after a failed `fn` is swallowed: `fn`'s error is the one the user needs.
|
|
13
|
+
*/
|
|
14
|
+
export async function withClientSession(server, clientId, fn) {
|
|
15
|
+
await server.createSession({ clientId, label: 'hydranium-cli' });
|
|
16
|
+
let result;
|
|
17
|
+
try {
|
|
18
|
+
result = await fn();
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
await server.closeSession({ clientId }).catch(() => undefined);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
await server.closeSession({ clientId });
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=client-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-session.js","sourceRoot":"","sources":["../../src/commands/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAKlF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACpC,MAAmF,EACnF,QAAgB,EAChB,EAAoB;IAEpB,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;IACjE,IAAI,MAAS,CAAC;IACd,IAAI,CAAC;QACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACvB,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import { type UsageError } from './harness-args.js';
|
|
10
|
+
import { type CreateCommandOptions } from './create.js';
|
|
11
|
+
/** Every flag `create` accepts, each of which takes a value. */
|
|
12
|
+
export declare const CREATE_FLAGS: readonly string[];
|
|
13
|
+
/** The `--help` text, as data, held to {@link CREATE_FLAGS} by a test. */
|
|
14
|
+
export declare const CREATE_HELP: readonly string[];
|
|
15
|
+
export declare function parseCreateArgs(args: string[], onError?: UsageError): CreateCommandOptions;
|
|
16
|
+
export declare function runCreateCommand(args: string[]): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=create-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-args.d.ts","sourceRoot":"","sources":["../../src/commands/create-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,aAAa,CAAC;AAInE,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE3F,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAexC,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,oBAAoB,CAczG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import { assertRequired, exitWithUsage, helpRequested, logHelpLines, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
|
|
10
|
+
import { runCreate } from './create.js';
|
|
11
|
+
const OWN_FLAGS = ['--uri', '--content', '--client-id'];
|
|
12
|
+
/** Every flag `create` accepts, each of which takes a value. */
|
|
13
|
+
export const CREATE_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
|
|
14
|
+
/** The `--help` text, as data, held to {@link CREATE_FLAGS} by a test. */
|
|
15
|
+
export const CREATE_HELP = [
|
|
16
|
+
'Usage: hydranium-cli create --server "<cmd>..." --uri <uri> --content <text|@file> [--client-id <id>] [--cwd <dir>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
|
|
17
|
+
'',
|
|
18
|
+
'Create the document at `<uri>` with `<content>` via createModelDocument, and persist it',
|
|
19
|
+
'as given. Fails when the file exists or a client has it open.',
|
|
20
|
+
'Output is the post-save envelope as a single JSON line.',
|
|
21
|
+
'',
|
|
22
|
+
'Options:',
|
|
23
|
+
' --server "<cmd>" Command-line for the data-server subprocess (required).',
|
|
24
|
+
' --uri <uri> Document URI (required).',
|
|
25
|
+
' --content <text> Content to write (required). Prefix `@` to read from a file',
|
|
26
|
+
' (escape with `\\@` for literal `@`-leading content).',
|
|
27
|
+
' --client-id <id> clientId for authorship attribution. Default: hydranium-cli.',
|
|
28
|
+
' --cwd <dir> Working directory for the spawned child. Default: cwd.',
|
|
29
|
+
...logHelpLines(22, 'the spawned server')
|
|
30
|
+
];
|
|
31
|
+
export function parseCreateArgs(args, onError = exitWithUsage) {
|
|
32
|
+
const { serverCommand, serverArgs, cwd, logLevel, logFile, logFileLevel, extra } = parseServerSpawnOptions(args, 'create', onError);
|
|
33
|
+
const { uri, content, clientId } = parseFlagOptions(extra, 'create', OWN_FLAGS, onError);
|
|
34
|
+
return {
|
|
35
|
+
serverCommand,
|
|
36
|
+
serverArgs,
|
|
37
|
+
cwd,
|
|
38
|
+
logLevel,
|
|
39
|
+
logFile,
|
|
40
|
+
logFileLevel,
|
|
41
|
+
uri: assertRequired(uri, '--uri', 'create', onError),
|
|
42
|
+
content: assertRequired(content, '--content', 'create', onError),
|
|
43
|
+
clientId
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function runCreateCommand(args) {
|
|
47
|
+
if (helpRequested(args, CREATE_FLAGS)) {
|
|
48
|
+
printHelp(CREATE_HELP);
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
return runCreate(parseCreateArgs(args));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=create-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-args.js","sourceRoot":"","sources":["../../src/commands/create-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa,CAAU,CAAC;AAEjE,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC3C,sLAAsL;IACtL,EAAE;IACF,yFAAyF;IACzF,+DAA+D;IAC/D,yDAAyD;IACzD,EAAE;IACF,UAAU;IACV,iFAAiF;IACjF,kDAAkD;IAClD,qFAAqF;IACrF,8EAA8E;IAC9E,sFAAsF;IACtF,gFAAgF;IAChF,GAAG,YAAY,CAAC,EAAE,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,OAAO,GAAe,aAAa;IAChF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpI,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACzF,OAAO;QACJ,aAAa;QACb,UAAU;QACV,GAAG;QACH,QAAQ;QACR,OAAO;QACP,YAAY;QACZ,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;QACpD,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;QAChE,QAAQ;KACV,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC5C,IAAI,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QACrC,SAAS,CAAC,WAAW,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
|
+
import type { DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
|
+
import { type LogOptions } from '../log-level.js';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the {@link runCreate} subcommand. Creates the document at `uri`
|
|
14
|
+
* with `content` (literal text or `@<path>` for a file reference) via the
|
|
15
|
+
* data-server's `createModelDocument` RPC, and persists that text as it is.
|
|
16
|
+
* Fails when the file exists or a client has it open. Writes the post-save
|
|
17
|
+
* envelope as a single JSON line, as `save` does.
|
|
18
|
+
*
|
|
19
|
+
* `clientId` defaults to `'hydranium-cli'`. The command creates as a client
|
|
20
|
+
* session under it: it registers the session, creates the document, persists
|
|
21
|
+
* it, since a created document reaches disk only with a save, and ends the
|
|
22
|
+
* session.
|
|
23
|
+
*/
|
|
24
|
+
export interface CreateCommandOptions extends LogOptions {
|
|
25
|
+
readonly serverCommand: string;
|
|
26
|
+
readonly serverArgs?: readonly string[];
|
|
27
|
+
readonly cwd?: string;
|
|
28
|
+
readonly uri: string;
|
|
29
|
+
/** Literal content text, or `@<path>` to read from a file. */
|
|
30
|
+
readonly content: string;
|
|
31
|
+
readonly clientId?: string;
|
|
32
|
+
readonly write?: (line: string) => void;
|
|
33
|
+
readonly __proxyForTest?: DataServerProtocol<TransferElement>;
|
|
34
|
+
/** Test-only: override the file-reader so unit tests can stub `@<path>` expansion. */
|
|
35
|
+
readonly __readFileForTest?: (path: string) => Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
export declare function runCreate(options: CreateCommandOptions): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK1D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC9D,sFAAsF;IACtF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB5E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
import { logEnv } from '../log-level.js';
|
|
10
|
+
import { withDataServer } from '../spawn-data-server.js';
|
|
11
|
+
import { withClientSession } from './client-session.js';
|
|
12
|
+
import { resolveContent } from './harness-args.js';
|
|
13
|
+
export async function runCreate(options) {
|
|
14
|
+
const write = options.write ?? ((line) => process.stdout.write(line));
|
|
15
|
+
const clientId = options.clientId ?? 'hydranium-cli';
|
|
16
|
+
const text = await resolveContent(options.content, options.__readFileForTest);
|
|
17
|
+
if (options.__proxyForTest) {
|
|
18
|
+
write(`${JSON.stringify(await createPersisted(options.__proxyForTest, options.uri, clientId, text))}\n`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
await withDataServer({
|
|
22
|
+
command: options.serverCommand,
|
|
23
|
+
args: options.serverArgs,
|
|
24
|
+
cwd: options.cwd,
|
|
25
|
+
env: logEnv(options)
|
|
26
|
+
}, async (server) => {
|
|
27
|
+
write(`${JSON.stringify(await createPersisted(server, options.uri, clientId, text))}\n`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create `uri` with `text` as the session `clientId` and persist it, then end
|
|
32
|
+
* the session. The persist is gated on the version the create made, so a
|
|
33
|
+
* write that landed before the create's answer or after it, another client's
|
|
34
|
+
* or an integrity repair, fails the command with a conflict and nothing
|
|
35
|
+
* persists.
|
|
36
|
+
*/
|
|
37
|
+
function createPersisted(server, uri, clientId, text) {
|
|
38
|
+
return withClientSession(server, clientId, async () => {
|
|
39
|
+
const created = await server.createModelDocument({ uri, clientId, text });
|
|
40
|
+
return server.persistModelDocument({ uri, clientId, baseVersion: created.created.version });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4BnD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA6B;IAC1D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE9E,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACzG,OAAO;IACV,CAAC;IAED,MAAM,cAAc,CACjB;QACG,OAAO,EAAE,OAAO,CAAC,aAAa;QAC9B,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC;KACtB,EACD,KAAK,EAAC,MAAM,EAAC,EAAE;QACZ,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5F,CAAC,CACH,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CACrB,MAAoI,EACpI,GAAW,EACX,QAAgB,EAChB,IAAY;IAEZ,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,OAAO,MAAM,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import { type UsageError } from './harness-args.js';
|
|
10
|
+
import { type DeleteCommandOptions } from './delete.js';
|
|
11
|
+
/** Every flag `delete` accepts, each of which takes a value. */
|
|
12
|
+
export declare const DELETE_FLAGS: readonly string[];
|
|
13
|
+
/** The `--help` text, as data, held to {@link DELETE_FLAGS} by a test. */
|
|
14
|
+
export declare const DELETE_HELP: readonly string[];
|
|
15
|
+
export declare function parseDeleteArgs(args: string[], onError?: UsageError): DeleteCommandOptions;
|
|
16
|
+
export declare function runDeleteCommand(args: string[]): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=delete-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-args.d.ts","sourceRoot":"","sources":["../../src/commands/delete-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EASJ,KAAK,UAAU,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,aAAa,CAAC;AAInE,gEAAgE;AAChE,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAgD,CAAC;AAE3F,0EAA0E;AAC1E,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAYxC,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,UAA0B,GAAG,oBAAoB,CAazG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM9D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import { assertRequired, exitWithUsage, helpRequested, logHelpLines, parseFlagOptions, parseServerSpawnOptions, printHelp, SERVER_SPAWN_VALUE_FLAGS } from './harness-args.js';
|
|
10
|
+
import { runDelete } from './delete.js';
|
|
11
|
+
const OWN_FLAGS = ['--uri', '--client-id'];
|
|
12
|
+
/** Every flag `delete` accepts, each of which takes a value. */
|
|
13
|
+
export const DELETE_FLAGS = [...SERVER_SPAWN_VALUE_FLAGS, ...OWN_FLAGS];
|
|
14
|
+
/** The `--help` text, as data, held to {@link DELETE_FLAGS} by a test. */
|
|
15
|
+
export const DELETE_HELP = [
|
|
16
|
+
'Usage: hydranium-cli delete --server "<cmd>..." --uri <uri> [--client-id <id>] [--cwd <dir>] [--log-level <lvl>] [--log-file <file>] [--log-file-level <lvl>]',
|
|
17
|
+
'',
|
|
18
|
+
'Delete the document at `<uri>`, its file and then the document, via deleteModelDocument,',
|
|
19
|
+
'whatever text it holds. Prints nothing.',
|
|
20
|
+
'',
|
|
21
|
+
'Options:',
|
|
22
|
+
' --server "<cmd>" Command-line for the data-server subprocess (required).',
|
|
23
|
+
' --uri <uri> Document URI (required).',
|
|
24
|
+
' --client-id <id> clientId the deletion is attributed to. Default: hydranium-cli.',
|
|
25
|
+
' --cwd <dir> Working directory for the spawned child. Default: cwd.',
|
|
26
|
+
...logHelpLines(22, 'the spawned server')
|
|
27
|
+
];
|
|
28
|
+
export function parseDeleteArgs(args, onError = exitWithUsage) {
|
|
29
|
+
const { serverCommand, serverArgs, cwd, logLevel, logFile, logFileLevel, extra } = parseServerSpawnOptions(args, 'delete', onError);
|
|
30
|
+
const { uri, clientId } = parseFlagOptions(extra, 'delete', OWN_FLAGS, onError);
|
|
31
|
+
return {
|
|
32
|
+
serverCommand,
|
|
33
|
+
serverArgs,
|
|
34
|
+
cwd,
|
|
35
|
+
logLevel,
|
|
36
|
+
logFile,
|
|
37
|
+
logFileLevel,
|
|
38
|
+
uri: assertRequired(uri, '--uri', 'delete', onError),
|
|
39
|
+
clientId
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function runDeleteCommand(args) {
|
|
43
|
+
if (helpRequested(args, DELETE_FLAGS)) {
|
|
44
|
+
printHelp(DELETE_HELP);
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
return runDelete(parseDeleteArgs(args));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=delete-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-args.js","sourceRoot":"","sources":["../../src/commands/delete-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,wBAAwB,EAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,aAAa,CAAU,CAAC;AAEpD,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,GAAG,wBAAwB,EAAE,GAAG,SAAS,CAAC,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC3C,+JAA+J;IAC/J,EAAE;IACF,0FAA0F;IAC1F,yCAAyC;IACzC,EAAE;IACF,UAAU;IACV,iFAAiF;IACjF,kDAAkD;IAClD,yFAAyF;IACzF,gFAAgF;IAChF,GAAG,YAAY,CAAC,EAAE,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,OAAO,GAAe,aAAa;IAChF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpI,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAChF,OAAO;QACJ,aAAa;QACb,UAAU;QACV,GAAG;QACH,QAAQ;QACR,OAAO;QACP,YAAY;QACZ,GAAG,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC;QACpD,QAAQ;KACV,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC5C,IAAI,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC;QACrC,SAAS,CAAC,WAAW,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import type { TransferElement } from '@hydranium/protocol';
|
|
10
|
+
import type { DataServerProtocol } from '@hydranium/protocol/data';
|
|
11
|
+
import { type LogOptions } from '../log-level.js';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the {@link runDelete} subcommand. Deletes the document at `uri`,
|
|
14
|
+
* its file and then the document, via the data-server's `deleteModelDocument`
|
|
15
|
+
* RPC, whatever text it holds. Prints nothing; a failed delete rejects.
|
|
16
|
+
*
|
|
17
|
+
* `clientId` defaults to `'hydranium-cli'`. The command deletes as a client
|
|
18
|
+
* session under it: it registers the session, opens the document, deletes it,
|
|
19
|
+
* and ends the session.
|
|
20
|
+
*/
|
|
21
|
+
export interface DeleteCommandOptions extends LogOptions {
|
|
22
|
+
readonly serverCommand: string;
|
|
23
|
+
readonly serverArgs?: readonly string[];
|
|
24
|
+
readonly cwd?: string;
|
|
25
|
+
readonly uri: string;
|
|
26
|
+
readonly clientId?: string;
|
|
27
|
+
readonly __proxyForTest?: DataServerProtocol<TransferElement>;
|
|
28
|
+
}
|
|
29
|
+
export declare function runDelete(options: DeleteCommandOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI1D;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAChE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
import { logEnv } from '../log-level.js';
|
|
10
|
+
import { withDataServer } from '../spawn-data-server.js';
|
|
11
|
+
import { withClientSession } from './client-session.js';
|
|
12
|
+
export async function runDelete(options) {
|
|
13
|
+
const clientId = options.clientId ?? 'hydranium-cli';
|
|
14
|
+
if (options.__proxyForTest) {
|
|
15
|
+
await deleteOpened(options.__proxyForTest, options.uri, clientId);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
await withDataServer({
|
|
19
|
+
command: options.serverCommand,
|
|
20
|
+
args: options.serverArgs,
|
|
21
|
+
cwd: options.cwd,
|
|
22
|
+
env: logEnv(options)
|
|
23
|
+
}, server => deleteOpened(server, options.uri, clientId));
|
|
24
|
+
}
|
|
25
|
+
/** Open `uri` as the session `clientId` and delete it, then end the session. */
|
|
26
|
+
function deleteOpened(server, uri, clientId) {
|
|
27
|
+
return withClientSession(server, clientId, async () => {
|
|
28
|
+
await server.openModelDocument({ uri, clientId });
|
|
29
|
+
await server.deleteModelDocument({ uri, clientId, baseVersion: 'any' });
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAoBxD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAA6B;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IACrD,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1B,MAAM,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClE,OAAO;IACV,CAAC;IACD,MAAM,cAAc,CACjB;QACG,OAAO,EAAE,OAAO,CAAC,aAAa;QAC9B,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC;KACtB,EACD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CACvD,CAAC;AACL,CAAC;AAED,gFAAgF;AAChF,SAAS,YAAY,CAClB,MAAiI,EACjI,GAAW,EACX,QAAgB;IAEhB,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,MAAM,MAAM,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
import type { SourceFile } from 'ts-morph';
|
|
10
|
+
/** Inputs for {@link emitAstBuilder}, resolved by the transfer-model command. */
|
|
11
|
+
export interface EmitAstBuilderOptions {
|
|
12
|
+
/** Destination path for the generated builder module. */
|
|
13
|
+
outFile: string;
|
|
14
|
+
/** Path to the Langium-generated AST file the builder imports from. */
|
|
15
|
+
astFile: string;
|
|
16
|
+
/** Language id derived from the `<LanguageId>AstReflection` class name. */
|
|
17
|
+
languageId: string;
|
|
18
|
+
/** Header line naming the command that regenerates the file. */
|
|
19
|
+
regenCommand: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Emit a module binding {@link makeAstNodeBuilder} to a project's reflection,
|
|
23
|
+
* once per grammar plus once across all of them.
|
|
24
|
+
*
|
|
25
|
+
* **The binding is boilerplate with exactly one degree of freedom** — the type
|
|
26
|
+
* map — so hand-writing it buys nothing and goes stale the moment a grammar is
|
|
27
|
+
* added. Generating it is also the only way a narrowed binding can exist at all:
|
|
28
|
+
* the per-grammar type maps live in namespaces Langium emits only on its
|
|
29
|
+
* multi-language path, so a single-grammar project gets the merged binding alone
|
|
30
|
+
* and there is nothing to narrow.
|
|
31
|
+
*
|
|
32
|
+
* **A narrowed binding is only as narrow as its grammar's import closure.**
|
|
33
|
+
* Langium's per-grammar `AstType` lists everything REACHABLE from that grammar,
|
|
34
|
+
* so where one grammar imports all the others its map equals the project's and
|
|
35
|
+
* its binding checks nothing the merged one does not. The emitted doc says so at
|
|
36
|
+
* each declaration rather than promising a guarantee the type map cannot give.
|
|
37
|
+
*
|
|
38
|
+
* Answers `false` when the AST source declares no whole-project type alias,
|
|
39
|
+
* which means the file did not come from `langium generate` and the caller
|
|
40
|
+
* should report rather than write a module that cannot compile.
|
|
41
|
+
*/
|
|
42
|
+
export declare function emitAstBuilder(astSource: SourceFile, options: EmitAstBuilderOptions): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The module text {@link emitAstBuilder} would write, or `undefined` when the
|
|
45
|
+
* AST source declares no whole-project type alias. Pure over its inputs, so the
|
|
46
|
+
* emitted shape is testable without touching a filesystem.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildAstBuilderSource(astSource: SourceFile, options: EmitAstBuilderOptions): string | undefined;
|
|
49
|
+
//# sourceMappingURL=generate-ast-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-ast-builder.d.ts","sourceRoot":"","sources":["../../src/commands/generate-ast-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACnC,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;CACvB;AAyBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAc7F;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAqB/G"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
/**
|
|
12
|
+
* Langium declares this type alias inside each language's namespace in a
|
|
13
|
+
* multi-language project. Its presence is what marks a namespace as a grammar's
|
|
14
|
+
* type registry rather than an incidental one.
|
|
15
|
+
*/
|
|
16
|
+
const NAMESPACED_AST_TYPE_NAME = 'AstType';
|
|
17
|
+
/** Export name of the merged, whole-project binding. */
|
|
18
|
+
const MERGED_EXPORT_NAME = 'astNode';
|
|
19
|
+
/**
|
|
20
|
+
* Emit a module binding {@link makeAstNodeBuilder} to a project's reflection,
|
|
21
|
+
* once per grammar plus once across all of them.
|
|
22
|
+
*
|
|
23
|
+
* **The binding is boilerplate with exactly one degree of freedom** — the type
|
|
24
|
+
* map — so hand-writing it buys nothing and goes stale the moment a grammar is
|
|
25
|
+
* added. Generating it is also the only way a narrowed binding can exist at all:
|
|
26
|
+
* the per-grammar type maps live in namespaces Langium emits only on its
|
|
27
|
+
* multi-language path, so a single-grammar project gets the merged binding alone
|
|
28
|
+
* and there is nothing to narrow.
|
|
29
|
+
*
|
|
30
|
+
* **A narrowed binding is only as narrow as its grammar's import closure.**
|
|
31
|
+
* Langium's per-grammar `AstType` lists everything REACHABLE from that grammar,
|
|
32
|
+
* so where one grammar imports all the others its map equals the project's and
|
|
33
|
+
* its binding checks nothing the merged one does not. The emitted doc says so at
|
|
34
|
+
* each declaration rather than promising a guarantee the type map cannot give.
|
|
35
|
+
*
|
|
36
|
+
* Answers `false` when the AST source declares no whole-project type alias,
|
|
37
|
+
* which means the file did not come from `langium generate` and the caller
|
|
38
|
+
* should report rather than write a module that cannot compile.
|
|
39
|
+
*/
|
|
40
|
+
export function emitAstBuilder(astSource, options) {
|
|
41
|
+
const content = buildAstBuilderSource(astSource, options);
|
|
42
|
+
if (content === undefined) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
fs.mkdirSync(path.dirname(options.outFile), { recursive: true });
|
|
46
|
+
if (fs.existsSync(options.outFile) && fs.readFileSync(options.outFile, 'utf-8') === content) {
|
|
47
|
+
console.log('AST builder is up to date.');
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
fs.writeFileSync(options.outFile, content, 'utf-8');
|
|
51
|
+
console.log(`Generated: ${options.outFile}`);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The module text {@link emitAstBuilder} would write, or `undefined` when the
|
|
56
|
+
* AST source declares no whole-project type alias. Pure over its inputs, so the
|
|
57
|
+
* emitted shape is testable without touching a filesystem.
|
|
58
|
+
*/
|
|
59
|
+
export function buildAstBuilderSource(astSource, options) {
|
|
60
|
+
const mergedTypeMap = `${options.languageId}AstType`;
|
|
61
|
+
if (!astSource.getTypeAlias(mergedTypeMap)) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const bindings = [{ exportName: MERGED_EXPORT_NAME, typeMap: mergedTypeMap }];
|
|
65
|
+
for (const namespace of findGrammarNamespaces(astSource)) {
|
|
66
|
+
bindings.push({
|
|
67
|
+
exportName: builderExportName(namespace),
|
|
68
|
+
typeMap: `${namespace}.${NAMESPACED_AST_TYPE_NAME}`,
|
|
69
|
+
namespace
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
assertDistinctExportNames(bindings);
|
|
73
|
+
return renderAstBuilder(bindings, {
|
|
74
|
+
reflectionName: findReflectionConstName(astSource, options.languageId),
|
|
75
|
+
importPath: relativeImportPath(options.outFile, options.astFile),
|
|
76
|
+
regenCommand: options.regenCommand
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Namespaces that carry a grammar's type registry, in declaration order.
|
|
81
|
+
*
|
|
82
|
+
* Keyed on the nested `AstType` alias rather than on the namespace being
|
|
83
|
+
* exported, because an adopter's augmentation can add namespaces to the same
|
|
84
|
+
* file for unrelated reasons and only the ones Langium emits per grammar have
|
|
85
|
+
* a type map to bind.
|
|
86
|
+
*/
|
|
87
|
+
function findGrammarNamespaces(astSource) {
|
|
88
|
+
const names = [];
|
|
89
|
+
for (const module of astSource.getModules()) {
|
|
90
|
+
const name = module.getName();
|
|
91
|
+
if (name && module.getTypeAlias(NAMESPACED_AST_TYPE_NAME)) {
|
|
92
|
+
names.push(name);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return names;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* `Domain` → `domainNode`. Lower-cases the leading character only, so a grammar
|
|
99
|
+
* named `OrderFlow` reads as `orderFlowNode` rather than losing its word break.
|
|
100
|
+
*/
|
|
101
|
+
function builderExportName(namespace) {
|
|
102
|
+
return `${namespace.charAt(0).toLowerCase()}${namespace.slice(1)}Node`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Two grammars whose names differ only in their leading character collapse to
|
|
106
|
+
* one export. Emitting anyway would silently drop a binding, so fail with both
|
|
107
|
+
* names rather than leave the caller to discover it at compile time.
|
|
108
|
+
*/
|
|
109
|
+
function assertDistinctExportNames(bindings) {
|
|
110
|
+
const seen = new Map();
|
|
111
|
+
for (const binding of bindings) {
|
|
112
|
+
const previous = seen.get(binding.exportName);
|
|
113
|
+
if (previous !== undefined) {
|
|
114
|
+
throw new Error(`Cannot emit the AST builder: grammars '${previous}' and '${binding.namespace}' both map to the export ` +
|
|
115
|
+
`'${binding.exportName}'. Rename one grammar so the generated bindings stay distinct.`);
|
|
116
|
+
}
|
|
117
|
+
seen.set(binding.exportName, binding.namespace ?? MERGED_EXPORT_NAME);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Name of the const holding the project's reflection instance.
|
|
122
|
+
*
|
|
123
|
+
* Langium emits `export const reflection = new <LanguageId>AstReflection()`, but
|
|
124
|
+
* the const is located by its initializer rather than by that name so a renamed
|
|
125
|
+
* export still resolves. Falls back to the emitted default when no declaration
|
|
126
|
+
* matches, which keeps the output compiling against a stock Langium file.
|
|
127
|
+
*/
|
|
128
|
+
function findReflectionConstName(astSource, languageId) {
|
|
129
|
+
const reflectionClass = `${languageId}AstReflection`;
|
|
130
|
+
for (const declaration of astSource.getVariableDeclarations()) {
|
|
131
|
+
if (declaration.getInitializer()?.getText().replace(/\s/g, '') === `new${reflectionClass}()`) {
|
|
132
|
+
return declaration.getName();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return 'reflection';
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Module specifier for the AST file as seen from the generated module's own
|
|
139
|
+
* directory. Emitted with a `.js` extension and posix separators because the
|
|
140
|
+
* output is ESM TypeScript, where the specifier names the compiled sibling.
|
|
141
|
+
*/
|
|
142
|
+
function relativeImportPath(outFile, astFile) {
|
|
143
|
+
const relative = path.relative(path.dirname(path.resolve(outFile)), path.resolve(astFile));
|
|
144
|
+
const posix = relative.split(path.sep).join('/').replace(/\.ts$/, '.js');
|
|
145
|
+
return posix.startsWith('.') ? posix : `./${posix}`;
|
|
146
|
+
}
|
|
147
|
+
function renderAstBuilder(bindings, context) {
|
|
148
|
+
const imported = [context.reflectionName, ...bindings.map(binding => `type ${binding.namespace ?? binding.typeMap}`)];
|
|
149
|
+
const out = [];
|
|
150
|
+
out.push('/******************************************************************************');
|
|
151
|
+
out.push(' * Generated from the Langium AST — DO NOT EDIT MANUALLY!');
|
|
152
|
+
out.push(` * ${context.regenCommand}`);
|
|
153
|
+
out.push(' ******************************************************************************/');
|
|
154
|
+
out.push('');
|
|
155
|
+
out.push('/* eslint-disable */');
|
|
156
|
+
out.push('');
|
|
157
|
+
out.push("import { makeAstNodeBuilder } from '@hydranium/core';");
|
|
158
|
+
out.push(`import { ${imported.join(', ')} } from '${context.importPath}';`);
|
|
159
|
+
out.push('');
|
|
160
|
+
// A single-grammar project has nothing to narrow to, so the merged binding is
|
|
161
|
+
// simply THE binding there and must not point at a sibling that was not emitted.
|
|
162
|
+
const narrowed = bindings.some(binding => binding.namespace !== undefined);
|
|
163
|
+
const guarantee = [
|
|
164
|
+
' * Mandatory fields are a type error at the call site, and grammar-declared',
|
|
165
|
+
' * containment arrays are materialised from reflection metadata, so a built',
|
|
166
|
+
' * node carries `[]` where a cast literal would leave `undefined`.'
|
|
167
|
+
];
|
|
168
|
+
for (const binding of bindings) {
|
|
169
|
+
out.push('/**');
|
|
170
|
+
if (binding.namespace !== undefined) {
|
|
171
|
+
out.push(` * AST-node factory narrowed to the '${binding.namespace}' grammar.`);
|
|
172
|
+
out.push(' *');
|
|
173
|
+
out.push(' * Narrowed by grammar REACHABILITY, not by ownership: a grammar that');
|
|
174
|
+
out.push(" * imports another sees that one's types too, so this binding is only as");
|
|
175
|
+
out.push(` * narrow as '${binding.namespace}'s import closure. Where that closure is the`);
|
|
176
|
+
out.push(' * whole project, it accepts exactly what the merged binding does and the');
|
|
177
|
+
out.push(' * choice is documentation rather than a check.');
|
|
178
|
+
out.push(' *');
|
|
179
|
+
out.push(...guarantee);
|
|
180
|
+
}
|
|
181
|
+
else if (narrowed) {
|
|
182
|
+
out.push(' * AST-node factory spanning every grammar in this project.');
|
|
183
|
+
out.push(' *');
|
|
184
|
+
out.push(' * Prefer the narrowed binding matching the grammar the call site works in:');
|
|
185
|
+
out.push(" * it rejects a type outside that grammar's import closure, which this one");
|
|
186
|
+
out.push(' * accepts from anywhere. Reach for this one where a call site genuinely');
|
|
187
|
+
out.push(' * spans grammars.');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
out.push(" * AST-node factory for this project's grammar.");
|
|
191
|
+
out.push(' *');
|
|
192
|
+
out.push(...guarantee);
|
|
193
|
+
}
|
|
194
|
+
out.push(' */');
|
|
195
|
+
out.push(`export const ${binding.exportName} = makeAstNodeBuilder<${binding.typeMap}>(${context.reflectionName});`);
|
|
196
|
+
out.push('');
|
|
197
|
+
}
|
|
198
|
+
return out.join('\n');
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=generate-ast-builder.js.map
|