@arkstack/console 0.16.4 → 0.16.6
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.
|
@@ -168,6 +168,18 @@ var BuildInterfaces = class BuildInterfaces {
|
|
|
168
168
|
return /* @__PURE__ */ new Set();
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Render a config name as a valid interface property key. Config file names
|
|
173
|
+
* become `ConfigRegistry` keys verbatim (they're the same key `config()`
|
|
174
|
+
* resolves by at runtime, e.g. `config('rate-limit.max')`), so a hyphenated
|
|
175
|
+
* or otherwise non-identifier name must be quoted — otherwise the generated
|
|
176
|
+
* `.d.ts` is a syntax error and the whole registry augmentation is dropped.
|
|
177
|
+
*
|
|
178
|
+
* @param name The config file base name (without `.ts`).
|
|
179
|
+
*/
|
|
180
|
+
static propertyKey(name) {
|
|
181
|
+
return /^[A-Za-z_$][\w$]*$/.test(name) ? name : `'${name.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
182
|
+
}
|
|
171
183
|
static generateConfig(configDir = path.join(process.cwd(), "src/config")) {
|
|
172
184
|
BuildInterfaces.project = new Project({
|
|
173
185
|
tsConfigFilePath: path.join(process.cwd(), "tsconfig.json"),
|
|
@@ -185,14 +197,14 @@ var BuildInterfaces = class BuildInterfaces {
|
|
|
185
197
|
const expr = exportAssignment.getExpression();
|
|
186
198
|
const annotatedType = BuildInterfaces.resolveReturnTypeAnnotation(sourceFile, expr, imports);
|
|
187
199
|
if (annotatedType) {
|
|
188
|
-
properties.push(` ${configName}: ${annotatedType}`);
|
|
200
|
+
properties.push(` ${BuildInterfaces.propertyKey(configName)}: ${annotatedType}`);
|
|
189
201
|
continue;
|
|
190
202
|
}
|
|
191
203
|
const type = BuildInterfaces.checker.getTypeAtLocation(expr);
|
|
192
204
|
const callSignatures = type.getCallSignatures();
|
|
193
205
|
const resolvedType = callSignatures.length ? callSignatures[0].getReturnType() : type;
|
|
194
206
|
const typeStr = BuildInterfaces.resolveType(resolvedType, 2);
|
|
195
|
-
properties.push(` ${configName}: ${typeStr}`);
|
|
207
|
+
properties.push(` ${BuildInterfaces.propertyKey(configName)}: ${typeStr}`);
|
|
196
208
|
}
|
|
197
209
|
return [
|
|
198
210
|
...BuildInterfaces.renderImports(imports),
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,16 @@ declare class BuildInterfaces {
|
|
|
56
56
|
* @returns
|
|
57
57
|
*/
|
|
58
58
|
private static frameworkEnvKeys;
|
|
59
|
+
/**
|
|
60
|
+
* Render a config name as a valid interface property key. Config file names
|
|
61
|
+
* become `ConfigRegistry` keys verbatim (they're the same key `config()`
|
|
62
|
+
* resolves by at runtime, e.g. `config('rate-limit.max')`), so a hyphenated
|
|
63
|
+
* or otherwise non-identifier name must be quoted — otherwise the generated
|
|
64
|
+
* `.d.ts` is a syntax error and the whole registry augmentation is dropped.
|
|
65
|
+
*
|
|
66
|
+
* @param name The config file base name (without `.ts`).
|
|
67
|
+
*/
|
|
68
|
+
private static propertyKey;
|
|
59
69
|
private static generateConfig;
|
|
60
70
|
private static resolveReturnTypeAnnotation;
|
|
61
71
|
private static findNamedTypeImport;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as ArkstackConsoleApp } from "./app-Ek2hTWvh.js";
|
|
3
3
|
import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
|
|
4
|
-
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-
|
|
4
|
+
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-bwFm_Aiq.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { Publisher, abort, abortIf, assertFound, config, discoverCommands, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
package/dist/prepare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as BuildInterfaces } from "./BuildInterfaces-
|
|
2
|
+
import { t as BuildInterfaces } from "./BuildInterfaces-bwFm_Aiq.js";
|
|
3
3
|
import { existsSync, mkdirSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { Arkstack } from "@arkstack/contract";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/console",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Console module for Arkstack, providing the command-line runtime and console integration layer.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net/guide/cli",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"h3ravel"
|
|
23
23
|
],
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"stubs"
|
|
26
27
|
],
|
|
27
28
|
"exports": {
|
|
28
29
|
".": "./dist/index.js",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"access": "public"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"arkormx": "^2.
|
|
43
|
+
"arkormx": "^2.11.2",
|
|
43
44
|
"clear-router": "^2.9.0"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
"chalk": "^5.6.2",
|
|
49
50
|
"resora": "^1.3.27",
|
|
50
51
|
"ts-morph": "^28.0.0",
|
|
51
|
-
"@arkstack/common": "^0.16.
|
|
52
|
-
"@arkstack/contract": "^0.16.
|
|
52
|
+
"@arkstack/common": "^0.16.6",
|
|
53
|
+
"@arkstack/contract": "^0.16.6"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
56
|
"arkormx": {
|