@dusted/anqst 1.7.2 → 1.7.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.
- package/AnQstWebBase/AnQstWebBaseAbi.cmake +1 -0
- package/AnQstWebBase/CMakeLists.txt +116 -0
- package/AnQstWebBase/CMakeUserPresets.json +14 -0
- package/AnQstWebBase/README.md +65 -0
- package/AnQstWebBase/src/AnQstBase93.cpp +91 -0
- package/AnQstWebBase/src/AnQstBase93.h +15 -0
- package/AnQstWebBase/src/AnQstBridgeProxy.cpp +30 -0
- package/AnQstWebBase/src/AnQstBridgeProxy.h +41 -0
- package/AnQstWebBase/src/AnQstHostBridgeFacade.cpp +345 -0
- package/AnQstWebBase/src/AnQstHostBridgeFacade.h +99 -0
- package/AnQstWebBase/src/AnQstWebBaseAbi.h +4 -0
- package/AnQstWebBase/src/AnQstWebBaseAbi.h.in +4 -0
- package/AnQstWebBase/src/AnQstWebHostBase.cpp +1822 -0
- package/AnQstWebBase/src/AnQstWebHostBase.h +227 -0
- package/AnQstWebBase/src/AnQstWidgetDebugDialog.cpp +425 -0
- package/AnQstWebBase/src/AnQstWidgetDebugDialog.h +105 -0
- package/AnQstWebBase/src/AngularHttpBaseServer.cpp +965 -0
- package/AnQstWebBase/src/AngularHttpBaseServer.h +97 -0
- package/AnQstWebBase/src/UI/AnQstWidgetDebugDialog.ui +235 -0
- package/AnQstWebBase/tests/CMakeLists.txt +22 -0
- package/AnQstWebBase/tests/test_AnQstWebHostBase.cpp +1102 -0
- package/dist/src/abi-hash-stamp.js +5 -0
- package/dist/src/abi-hash.js +33 -0
- package/dist/src/app.js +67 -19
- package/dist/src/boundary-codec-render.js +17 -10
- package/dist/src/emit.js +76 -30
- package/dist/src/project.js +11 -1
- package/dist/src/webbase.js +94 -0
- package/package.json +2 -1
package/dist/src/project.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.resolveAnQstSettings = resolveAnQstSettings;
|
|
|
9
9
|
exports.resolveAnQstSpecPath = resolveAnQstSpecPath;
|
|
10
10
|
exports.resolveAnQstGenerateTargets = resolveAnQstGenerateTargets;
|
|
11
11
|
exports.resolveAnQstWidgetCategory = resolveAnQstWidgetCategory;
|
|
12
|
+
exports.resolveAnQstUseSharedBaseWidget = resolveAnQstUseSharedBaseWidget;
|
|
12
13
|
exports.resolveAnQstWidgetName = resolveAnQstWidgetName;
|
|
13
14
|
exports.buildSpecScaffold = buildSpecScaffold;
|
|
14
15
|
exports.runInstill = runInstill;
|
|
@@ -91,6 +92,10 @@ function readAnQstSettingsFromPath(cwd, settingsPath) {
|
|
|
91
92
|
throw new errors_1.VerifyError(`Invalid AnQst settings file '${(0, layout_1.normalizeSlashes)(node_path_1.default.relative(cwd, settingsPath))}': expected non-empty string 'widgetCategory'.`);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
95
|
+
const useSharedBaseWidget = settingsObject.useSharedBaseWidget;
|
|
96
|
+
if (useSharedBaseWidget !== undefined && typeof useSharedBaseWidget !== "boolean") {
|
|
97
|
+
throw new errors_1.VerifyError(`Invalid AnQst settings file '${(0, layout_1.normalizeSlashes)(node_path_1.default.relative(cwd, settingsPath))}': expected boolean 'useSharedBaseWidget'.`);
|
|
98
|
+
}
|
|
94
99
|
const resolvedSpecPath = node_path_1.default.resolve(cwd, spec.trim());
|
|
95
100
|
const anqstRoot = (0, layout_1.anqstRootDir)(cwd);
|
|
96
101
|
if (!isSubPath(anqstRoot, resolvedSpecPath)) {
|
|
@@ -101,7 +106,8 @@ function readAnQstSettingsFromPath(cwd, settingsPath) {
|
|
|
101
106
|
widgetName: widgetName.trim(),
|
|
102
107
|
spec: spec.trim(),
|
|
103
108
|
generate: Array.isArray(generate) ? [...generate] : undefined,
|
|
104
|
-
widgetCategory: typeof widgetCategory === "string" ? widgetCategory.trim() : undefined
|
|
109
|
+
widgetCategory: typeof widgetCategory === "string" ? widgetCategory.trim() : undefined,
|
|
110
|
+
useSharedBaseWidget: typeof useSharedBaseWidget === "boolean" ? useSharedBaseWidget : undefined
|
|
105
111
|
};
|
|
106
112
|
}
|
|
107
113
|
function resolveSettingsPathFromPackage(cwd, packageJson) {
|
|
@@ -215,6 +221,10 @@ function resolveAnQstWidgetCategory(cwd) {
|
|
|
215
221
|
const { settings } = resolveAnQstSettings(cwd);
|
|
216
222
|
return settings.widgetCategory;
|
|
217
223
|
}
|
|
224
|
+
function resolveAnQstUseSharedBaseWidget(cwd) {
|
|
225
|
+
const { settings } = resolveAnQstSettings(cwd);
|
|
226
|
+
return settings.useSharedBaseWidget ?? true;
|
|
227
|
+
}
|
|
218
228
|
function resolveAnQstWidgetName(cwd) {
|
|
219
229
|
const { settings } = resolveAnQstSettings(cwd);
|
|
220
230
|
return settings.widgetName;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ANQST_WEBBASE_DIR_NAME = void 0;
|
|
7
|
+
exports.resolveAnQstGenRoot = resolveAnQstGenRoot;
|
|
8
|
+
exports.resolveAnQstWebBaseSourceDir = resolveAnQstWebBaseSourceDir;
|
|
9
|
+
exports.copyAnQstWebBaseTree = copyAnQstWebBaseTree;
|
|
10
|
+
exports.installAnQstWebBaseTree = installAnQstWebBaseTree;
|
|
11
|
+
exports.writeAnQstWebBaseAbiStamp = writeAnQstWebBaseAbiStamp;
|
|
12
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const abi_hash_1 = require("./abi-hash");
|
|
15
|
+
exports.ANQST_WEBBASE_DIR_NAME = "AnQstWebBase";
|
|
16
|
+
const SKIP_DIR_NAMES = new Set([
|
|
17
|
+
".git",
|
|
18
|
+
".vs",
|
|
19
|
+
"build",
|
|
20
|
+
"CMakeFiles",
|
|
21
|
+
"node_modules"
|
|
22
|
+
]);
|
|
23
|
+
function resolveAnQstGenRoot() {
|
|
24
|
+
return node_path_1.default.resolve(__dirname, "..", "..");
|
|
25
|
+
}
|
|
26
|
+
function isWebBaseSourceDir(dir) {
|
|
27
|
+
return node_fs_1.default.existsSync(node_path_1.default.join(dir, "CMakeLists.txt"))
|
|
28
|
+
&& node_fs_1.default.existsSync(node_path_1.default.join(dir, "src", "AnQstWebHostBase.h"));
|
|
29
|
+
}
|
|
30
|
+
function resolveAnQstWebBaseSourceDir() {
|
|
31
|
+
const root = resolveAnQstGenRoot();
|
|
32
|
+
const candidates = [
|
|
33
|
+
node_path_1.default.join(root, exports.ANQST_WEBBASE_DIR_NAME),
|
|
34
|
+
node_path_1.default.resolve(root, "..", "AnQstWidget", exports.ANQST_WEBBASE_DIR_NAME)
|
|
35
|
+
];
|
|
36
|
+
for (const candidate of candidates) {
|
|
37
|
+
if (isWebBaseSourceDir(candidate)) {
|
|
38
|
+
return candidate;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`Unable to locate ${exports.ANQST_WEBBASE_DIR_NAME} sources.`);
|
|
42
|
+
}
|
|
43
|
+
function shouldSkipWebBaseEntry(relativePath) {
|
|
44
|
+
const parts = relativePath.split(node_path_1.default.sep);
|
|
45
|
+
return parts.some((part) => SKIP_DIR_NAMES.has(part));
|
|
46
|
+
}
|
|
47
|
+
function copyAnQstWebBaseTree(sourceDir, targetDir) {
|
|
48
|
+
if (!isWebBaseSourceDir(sourceDir)) {
|
|
49
|
+
throw new Error(`Invalid ${exports.ANQST_WEBBASE_DIR_NAME} source directory: ${sourceDir}`);
|
|
50
|
+
}
|
|
51
|
+
if (node_path_1.default.resolve(sourceDir) === node_path_1.default.resolve(targetDir)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
node_fs_1.default.mkdirSync(targetDir, { recursive: true });
|
|
55
|
+
const queue = [""];
|
|
56
|
+
while (queue.length > 0) {
|
|
57
|
+
const relativeDir = queue.shift();
|
|
58
|
+
const currentSourceDir = node_path_1.default.join(sourceDir, relativeDir);
|
|
59
|
+
const entries = node_fs_1.default.readdirSync(currentSourceDir, { withFileTypes: true })
|
|
60
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const relativePath = node_path_1.default.join(relativeDir, entry.name);
|
|
63
|
+
if (shouldSkipWebBaseEntry(relativePath)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const sourcePath = node_path_1.default.join(sourceDir, relativePath);
|
|
67
|
+
const targetPath = node_path_1.default.join(targetDir, relativePath);
|
|
68
|
+
if (entry.isDirectory()) {
|
|
69
|
+
node_fs_1.default.mkdirSync(targetPath, { recursive: true });
|
|
70
|
+
queue.push(relativePath);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (entry.isFile()) {
|
|
74
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(targetPath), { recursive: true });
|
|
75
|
+
node_fs_1.default.copyFileSync(sourcePath, targetPath);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
writeAnQstWebBaseAbiStamp(targetDir, (0, abi_hash_1.resolveAnQstWebBaseAbiHashStamp)());
|
|
80
|
+
}
|
|
81
|
+
function installAnQstWebBaseTree(targetDir) {
|
|
82
|
+
node_fs_1.default.rmSync(targetDir, { recursive: true, force: true });
|
|
83
|
+
copyAnQstWebBaseTree(resolveAnQstWebBaseSourceDir(), targetDir);
|
|
84
|
+
}
|
|
85
|
+
function writeAnQstWebBaseAbiStamp(targetDir, stamp) {
|
|
86
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(targetDir, "AnQstWebBaseAbi.cmake"), `set(ANQST_WEBBASE_ABI_HASH_STAMP "${stamp}")\n`, "utf8");
|
|
87
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(targetDir, "src", "AnQstWebBaseAbi.h"), [
|
|
88
|
+
"#pragma once",
|
|
89
|
+
"",
|
|
90
|
+
`#define ANQST_WEBBASE_ABI_HASH_STAMP "${stamp}"`,
|
|
91
|
+
`#define ANQST_WEBBASE_NAMESPACE anqstwebbase${stamp}`,
|
|
92
|
+
""
|
|
93
|
+
].join("\n"), "utf8");
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dusted/anqst",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Opinionated backend generator for webapps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"anqst": "dist/src/bin/anqst.js"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
|
+
"AnQstWebBase/**",
|
|
35
36
|
"dist/src",
|
|
36
37
|
"index.d.ts",
|
|
37
38
|
"spec/AnQst-Spec-DSL.d.ts",
|