@arkstack/common 0.14.16 → 0.14.17
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/dist/index.d.ts +23 -4
- package/dist/index.js +2 -2
- package/dist/utils/index.js +1 -1
- package/dist/{utils-B_zH08ji.js → utils-DJQAOLbx.js} +29 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -328,9 +328,15 @@ declare const outputDir: (cwd?: string) => string;
|
|
|
328
328
|
* Map an application source path to its build-output counterpart.
|
|
329
329
|
*
|
|
330
330
|
* Application code is authored under `src/` and compiled into {@link outputDir},
|
|
331
|
-
* which strips the leading `src/` segment (e.g.
|
|
332
|
-
* `dist/app/models/User.js`).
|
|
333
|
-
*
|
|
331
|
+
* which strips the leading `src/` segment and emits JavaScript (e.g.
|
|
332
|
+
* `src/app/models/User.ts` -> `dist/app/models/User.js`). A TypeScript source
|
|
333
|
+
* extension is rewritten to `.js`; paths without one (directories) keep their
|
|
334
|
+
* shape. Absolute or root-relative paths outside the app root are returned
|
|
335
|
+
* unchanged.
|
|
336
|
+
*
|
|
337
|
+
* This is a pure path transform — it does not touch the filesystem. Use
|
|
338
|
+
* {@link resolveRuntimeModule} / {@link resolveRuntimeDir} when you need an
|
|
339
|
+
* existing file/dir for the current environment.
|
|
334
340
|
*
|
|
335
341
|
* @param sourcePath Absolute or root-relative source path.
|
|
336
342
|
*/
|
|
@@ -349,6 +355,19 @@ declare const toOutputPath: (sourcePath: string) => string;
|
|
|
349
355
|
* @returns An existing importable path, or `sourcePath` unchanged when none exists.
|
|
350
356
|
*/
|
|
351
357
|
declare const resolveRuntimeModule: (sourcePath: string) => string;
|
|
358
|
+
/**
|
|
359
|
+
* Resolve an application source directory to the directory that exists at
|
|
360
|
+
* runtime.
|
|
361
|
+
*
|
|
362
|
+
* The directory counterpart of {@link resolveRuntimeModule}: it maps the source
|
|
363
|
+
* directory into {@link outputDir} (stripping the leading `src/` segment) but
|
|
364
|
+
* appends no file extension. Production prefers the build output, development
|
|
365
|
+
* prefers source, and the absolute source path is returned when neither exists.
|
|
366
|
+
*
|
|
367
|
+
* @param sourcePath Absolute or root-relative source directory.
|
|
368
|
+
* @returns An existing directory path, or the absolute source path when none exists.
|
|
369
|
+
*/
|
|
370
|
+
declare const resolveRuntimeDir: (sourcePath: string) => string;
|
|
352
371
|
/**
|
|
353
372
|
* Rebuild the application output (tsdown) into {@link outputDir}, wiping it first
|
|
354
373
|
* so no stale emitted modules survive a source change. Standalone — it does NOT
|
|
@@ -570,4 +589,4 @@ declare class Hook {
|
|
|
570
589
|
static clear: () => void;
|
|
571
590
|
}
|
|
572
591
|
//#endregion
|
|
573
|
-
export { AbstractModelConstructor, AppException, ArkstackErrorPayload, ArkstackErrorShape, CONFIG_KEY, ConfigRegistry, ConfigShape, DotPath, DotPathValue, Encryption, EnvRegistry, ErrorHandler, Exception, FileImporter, GlobalConfig, GlobalEnv, Hash, Hook, HookArgs, HookFor, HookName, HookPos, HookPositions, HookRegistry, IHook, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, MergedConfig, ModelConstructor, ModelRegistry, Primitive, PublishEntry, PublishFilter, PublishGroup, Publisher, RequestException, UnionToIntersection, abort, abortIf, appKey, appUrl, assertFound, bindGracefulShutdown, bootWithDetectedPort, config, createErrorPayload, discoverCommands, env, getErrorLogger, getModel, getPrimaryError, getValidationErrors, importFile, initializeGlobalContext, interopDefault, isClass, isModelNotFoundError, isValidationError, loadPrototypes, logUnhandledError, nodeEnv, normalizeStatusCode, outputDir, perPage, rebuildOutput, renderError, resolveRuntimeModule, serializeError, shouldHideStack, shouldLogError, toErrorShape, toOutputPath };
|
|
592
|
+
export { AbstractModelConstructor, AppException, ArkstackErrorPayload, ArkstackErrorShape, CONFIG_KEY, ConfigRegistry, ConfigShape, DotPath, DotPathValue, Encryption, EnvRegistry, ErrorHandler, Exception, FileImporter, GlobalConfig, GlobalEnv, Hash, Hook, HookArgs, HookFor, HookName, HookPos, HookPositions, HookRegistry, IHook, Logger, LoggerChalk, LoggerLog, LoggerParseSignature, MergedConfig, ModelConstructor, ModelRegistry, Primitive, PublishEntry, PublishFilter, PublishGroup, Publisher, RequestException, UnionToIntersection, abort, abortIf, appKey, appUrl, assertFound, bindGracefulShutdown, bootWithDetectedPort, config, createErrorPayload, discoverCommands, env, getErrorLogger, getModel, getPrimaryError, getValidationErrors, importFile, initializeGlobalContext, interopDefault, isClass, isModelNotFoundError, isValidationError, loadPrototypes, logUnhandledError, nodeEnv, normalizeStatusCode, outputDir, perPage, rebuildOutput, renderError, resolveRuntimeDir, resolveRuntimeModule, serializeError, shouldHideStack, shouldLogError, toErrorShape, toOutputPath };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as resolveRuntimeDir, C as discoverCommands, D as nodeEnv, E as interopDefault, M as toOutputPath, O as outputDir, S as config, T as importFile, _ as Hash, b as appKey, c as abortIf, d as initializeGlobalContext, f as isClass, g as Exception, h as AppException, j as resolveRuntimeModule, k as rebuildOutput, l as assertFound, m as RequestException, p as perPage, s as abort, u as getModel, v as Encryption, w as env, x as appUrl, y as CONFIG_KEY } from "./utils-DJQAOLbx.js";
|
|
2
2
|
import { Hook as Hook$1 } from "@arkstack/foundry";
|
|
3
3
|
import { str } from "@h3ravel/support";
|
|
4
4
|
import { Arkstack } from "@arkstack/contract";
|
|
@@ -529,4 +529,4 @@ var Hook = class {
|
|
|
529
529
|
};
|
|
530
530
|
};
|
|
531
531
|
//#endregion
|
|
532
|
-
export { AppException, CONFIG_KEY, Encryption, ErrorHandler, Exception, Hash, Hook, Logger, Publisher, RequestException, abort, abortIf, appKey, appUrl, assertFound, bindGracefulShutdown, bootWithDetectedPort, config, createErrorPayload, discoverCommands, env, getErrorLogger, getModel, getPrimaryError, getValidationErrors, importFile, initializeGlobalContext, interopDefault, isClass, isModelNotFoundError, isValidationError, loadPrototypes, logUnhandledError, nodeEnv, normalizeStatusCode, outputDir, perPage, rebuildOutput, renderError, resolveRuntimeModule, serializeError, shouldHideStack, shouldLogError, toErrorShape, toOutputPath };
|
|
532
|
+
export { AppException, CONFIG_KEY, Encryption, ErrorHandler, Exception, Hash, Hook, Logger, Publisher, RequestException, abort, abortIf, appKey, appUrl, assertFound, bindGracefulShutdown, bootWithDetectedPort, config, createErrorPayload, discoverCommands, env, getErrorLogger, getModel, getPrimaryError, getValidationErrors, importFile, initializeGlobalContext, interopDefault, isClass, isModelNotFoundError, isValidationError, loadPrototypes, logUnhandledError, nodeEnv, normalizeStatusCode, outputDir, perPage, rebuildOutput, renderError, resolveRuntimeDir, resolveRuntimeModule, serializeError, shouldHideStack, shouldLogError, toErrorShape, toOutputPath };
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as Hash, a as use, c as abortIf, d as initializeGlobalContext, f as isClass, i as trait, l as assertFound, n as crc32, o as uses, p as perPage, r as getTraitMethods, s as abort, t as callTraitMethods, u as getModel, v as Encryption } from "../utils-
|
|
1
|
+
import { _ as Hash, a as use, c as abortIf, d as initializeGlobalContext, f as isClass, i as trait, l as assertFound, n as crc32, o as uses, p as perPage, r as getTraitMethods, s as abort, t as callTraitMethods, u as getModel, v as Encryption } from "../utils-DJQAOLbx.js";
|
|
2
2
|
export { Encryption, Hash, abort, abortIf, assertFound, callTraitMethods, crc32, getModel, getTraitMethods, initializeGlobalContext, isClass, perPage, trait, use, uses };
|
|
@@ -187,9 +187,15 @@ const moduleCandidates = (base, extensions) => {
|
|
|
187
187
|
* Map an application source path to its build-output counterpart.
|
|
188
188
|
*
|
|
189
189
|
* Application code is authored under `src/` and compiled into {@link outputDir},
|
|
190
|
-
* which strips the leading `src/` segment (e.g.
|
|
191
|
-
* `dist/app/models/User.js`).
|
|
192
|
-
*
|
|
190
|
+
* which strips the leading `src/` segment and emits JavaScript (e.g.
|
|
191
|
+
* `src/app/models/User.ts` -> `dist/app/models/User.js`). A TypeScript source
|
|
192
|
+
* extension is rewritten to `.js`; paths without one (directories) keep their
|
|
193
|
+
* shape. Absolute or root-relative paths outside the app root are returned
|
|
194
|
+
* unchanged.
|
|
195
|
+
*
|
|
196
|
+
* This is a pure path transform — it does not touch the filesystem. Use
|
|
197
|
+
* {@link resolveRuntimeModule} / {@link resolveRuntimeDir} when you need an
|
|
198
|
+
* existing file/dir for the current environment.
|
|
193
199
|
*
|
|
194
200
|
* @param sourcePath Absolute or root-relative source path.
|
|
195
201
|
*/
|
|
@@ -198,7 +204,7 @@ const toOutputPath = (sourcePath) => {
|
|
|
198
204
|
const abs = path.isAbsolute(sourcePath) ? sourcePath : path.join(root, sourcePath);
|
|
199
205
|
const rel = path.relative(root, abs);
|
|
200
206
|
if (!rel || rel.startsWith("..")) return abs;
|
|
201
|
-
return path.join(outputDir(), rel.replace(new RegExp(`^${SOURCE_DIR}[\\\\/]`), ""));
|
|
207
|
+
return path.join(outputDir(), rel.replace(new RegExp(`^${SOURCE_DIR}[\\\\/]`), "")).replace(/\.(ts|tsx|mts|cts)$/i, ".js");
|
|
202
208
|
};
|
|
203
209
|
/**
|
|
204
210
|
* Resolve an application module's source path to a file that can be imported at
|
|
@@ -221,6 +227,24 @@ const resolveRuntimeModule = (sourcePath) => {
|
|
|
221
227
|
return (nodeEnv() === "prod" ? [...outputCandidates, ...sourceCandidates] : [...sourceCandidates, ...outputCandidates]).find((candidate) => existsSync(candidate)) ?? abs;
|
|
222
228
|
};
|
|
223
229
|
/**
|
|
230
|
+
* Resolve an application source directory to the directory that exists at
|
|
231
|
+
* runtime.
|
|
232
|
+
*
|
|
233
|
+
* The directory counterpart of {@link resolveRuntimeModule}: it maps the source
|
|
234
|
+
* directory into {@link outputDir} (stripping the leading `src/` segment) but
|
|
235
|
+
* appends no file extension. Production prefers the build output, development
|
|
236
|
+
* prefers source, and the absolute source path is returned when neither exists.
|
|
237
|
+
*
|
|
238
|
+
* @param sourcePath Absolute or root-relative source directory.
|
|
239
|
+
* @returns An existing directory path, or the absolute source path when none exists.
|
|
240
|
+
*/
|
|
241
|
+
const resolveRuntimeDir = (sourcePath) => {
|
|
242
|
+
const root = Arkstack.rootDir();
|
|
243
|
+
const abs = path.isAbsolute(sourcePath) ? sourcePath : path.join(root, sourcePath);
|
|
244
|
+
const mapped = toOutputPath(abs);
|
|
245
|
+
return (nodeEnv() === "prod" ? [mapped, abs] : [abs, mapped]).find((candidate) => existsSync(candidate)) ?? abs;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
224
248
|
* Rebuild the application output (tsdown) into {@link outputDir}, wiping it first
|
|
225
249
|
* so no stale emitted modules survive a source change. Standalone — it does NOT
|
|
226
250
|
* boot the app — so the console kernel can call it to self-heal a stale or
|
|
@@ -776,4 +800,4 @@ function uses(instance, trait) {
|
|
|
776
800
|
return false;
|
|
777
801
|
}
|
|
778
802
|
//#endregion
|
|
779
|
-
export {
|
|
803
|
+
export { resolveRuntimeDir as A, discoverCommands as C, nodeEnv as D, interopDefault as E, toOutputPath as M, outputDir as O, config as S, importFile as T, Hash as _, use as a, appKey as b, abortIf as c, initializeGlobalContext as d, isClass as f, Exception as g, AppException as h, trait as i, resolveRuntimeModule as j, rebuildOutput as k, assertFound as l, RequestException as m, crc32 as n, uses as o, perPage as p, getTraitMethods as r, abort as s, callTraitMethods as t, getModel as u, Encryption as v, env as w, appUrl as x, CONFIG_KEY as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/common",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core utilities, primitives, and shared infrastructure for the Arkstack ecosystem.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@h3ravel/support": "^2.1.4",
|
|
44
44
|
"arkormx": "^2.9.3",
|
|
45
|
-
"@arkstack/foundry": "^0.14.
|
|
46
|
-
"@arkstack/contract": "^0.14.
|
|
45
|
+
"@arkstack/foundry": "^0.14.17",
|
|
46
|
+
"@arkstack/contract": "^0.14.17"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsdown --config-loader unrun",
|