@arkstack/console 0.16.5 → 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-BBAwvchK.js";
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-BBAwvchK.js";
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.5",
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",
@@ -40,7 +40,7 @@
40
40
  "access": "public"
41
41
  },
42
42
  "peerDependencies": {
43
- "arkormx": "^2.10.1",
43
+ "arkormx": "^2.11.2",
44
44
  "clear-router": "^2.9.0"
45
45
  },
46
46
  "dependencies": {
@@ -49,8 +49,8 @@
49
49
  "chalk": "^5.6.2",
50
50
  "resora": "^1.3.27",
51
51
  "ts-morph": "^28.0.0",
52
- "@arkstack/contract": "^0.16.5",
53
- "@arkstack/common": "^0.16.5"
52
+ "@arkstack/common": "^0.16.6",
53
+ "@arkstack/contract": "^0.16.6"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "arkormx": {