@dusted/anqst 0.1.1 → 0.1.3

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.
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifySpec = void 0;
4
- var verify_1 = require("../../verify");
5
- Object.defineProperty(exports, "verifySpec", { enumerable: true, get: function () { return verify_1.verifySpec; } });
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveBackend = resolveBackend;
4
- exports.isBackendId = isBackendId;
5
- const ast_1 = require("./ast");
6
- const tsc_1 = require("./tsc");
7
- const backends = {
8
- ast: ast_1.astBackend,
9
- tsc: tsc_1.tscBackend
10
- };
11
- function resolveBackend(backendId) {
12
- return backends[backendId];
13
- }
14
- function isBackendId(value) {
15
- return value === "ast" || value === "tsc";
16
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitCppQWidget = emitCppQWidget;
4
- const emit_1 = require("../ast/emit");
5
- function emitCppQWidget(spec, options) {
6
- if (!options.emitQWidget)
7
- return {};
8
- return (0, emit_1.generateOutputs)(spec, {
9
- emitQWidget: true,
10
- emitAngularService: false,
11
- emitNodeExpressWs: false
12
- });
13
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitNodeExpressWs = emitNodeExpressWs;
4
- const emit_1 = require("../ast/emit");
5
- function emitNodeExpressWs(spec, options) {
6
- if (!options.emitNodeExpressWs)
7
- return {};
8
- return (0, emit_1.generateOutputs)(spec, {
9
- emitQWidget: false,
10
- emitAngularService: false,
11
- emitNodeExpressWs: true
12
- });
13
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tscBackend = void 0;
4
- const emit_cpp_1 = require("./emit-cpp");
5
- const emit_node_1 = require("./emit-node");
6
- const parser_1 = require("./parser");
7
- const verify_1 = require("./verify");
8
- function mergeGeneratedFiles(...parts) {
9
- const out = {};
10
- for (const part of parts) {
11
- for (const [key, value] of Object.entries(part)) {
12
- out[key] = value;
13
- }
14
- }
15
- return out;
16
- }
17
- function formatTargets(options) {
18
- const enabled = [];
19
- if (options.emitQWidget)
20
- enabled.push("QWidget");
21
- if (options.emitNodeExpressWs)
22
- enabled.push("node_express_ws");
23
- if (enabled.length === 0)
24
- return "none";
25
- return enabled.join(", ");
26
- }
27
- function logBackendInput(spec, options) {
28
- console.log(`[AnQst][backend=tsc] parsed widget=${spec.widgetName}, services=${spec.services.length}, targets=${formatTargets(options)}`);
29
- }
30
- exports.tscBackend = {
31
- id: "tsc",
32
- parseSpecFile: parser_1.parseSpecFile,
33
- verifySpec: verify_1.verifySpec,
34
- generateOutputs(spec, options) {
35
- logBackendInput(spec, options);
36
- const cpp = (0, emit_cpp_1.emitCppQWidget)(spec, options);
37
- const node = (0, emit_node_1.emitNodeExpressWs)(spec, options);
38
- return mergeGeneratedFiles(cpp, node);
39
- },
40
- emitsArtifacts: true
41
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseSpecFile = parseSpecFile;
4
- const parser_1 = require("../ast/parser");
5
- const debug_dump_1 = require("./debug-dump");
6
- const program_1 = require("./program");
7
- const typegraph_1 = require("./typegraph");
8
- function parseSpecFile(specPath) {
9
- (0, program_1.createTscProgramContext)(specPath);
10
- const parsed = (0, parser_1.parseSpecFile)(specPath);
11
- if ((0, debug_dump_1.isDebugEnabled)()) {
12
- (0, debug_dump_1.writeDebugFile)(process.cwd(), "anqstmodel/parsed-before-typegraph.txt", `${(0, debug_dump_1.inspectText)(parsed)}\n`);
13
- }
14
- const normalized = (0, typegraph_1.applyResolvedTypeGraph)(parsed);
15
- if ((0, debug_dump_1.isDebugEnabled)()) {
16
- (0, debug_dump_1.writeDebugFile)(process.cwd(), "anqstmodel/parsed-after-typegraph.txt", `${(0, debug_dump_1.inspectText)(normalized)}\n`);
17
- }
18
- return normalized;
19
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifySpec = verifySpec;
4
- const errors_1 = require("../../errors");
5
- const verify_1 = require("../ast/verify");
6
- const program_1 = require("./program");
7
- function verifySpec(spec) {
8
- const diagnostics = (0, program_1.getProgramDiagnostics)(spec.filePath);
9
- if (diagnostics.length > 0) {
10
- throw new errors_1.VerifyError(`TypeScript diagnostics in spec:\n ${diagnostics.join("\n ")}`);
11
- }
12
- return (0, verify_1.verifySpec)(spec);
13
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });