lifecycleion 0.0.7 → 0.0.8
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/README.md +2 -1
- package/dist/lib/dev-mode.cjs +77 -0
- package/dist/lib/dev-mode.cjs.map +1 -0
- package/dist/lib/dev-mode.d.cts +38 -0
- package/dist/lib/dev-mode.d.ts +38 -0
- package/dist/lib/dev-mode.js +50 -0
- package/dist/lib/dev-mode.js.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Lifecycleion v0.0.
|
|
1
|
+
# Lifecycleion v0.0.8
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/lifecycleion)
|
|
4
4
|
|
|
@@ -89,6 +89,7 @@ Each library has comprehensive documentation in the [docs](./docs) folder. Click
|
|
|
89
89
|
| [constants](./docs/constants.md) | `lifecycleion/constants` | Common string constants including whitespace helpers and Python-style character sets |
|
|
90
90
|
| [curly-brackets](./docs/curly-brackets.md) | `lifecycleion/curly-brackets` | String templating with `{{placeholders}}`, fallbacks, escaping, and compiled templates |
|
|
91
91
|
| [deep-clone](./docs/deep-clone.md) | `lifecycleion/deep-clone` | Deep clone utility with circular reference detection for objects, arrays, Maps, Sets, and more |
|
|
92
|
+
| [dev-mode](./docs/dev-mode.md) | `lifecycleion/dev-mode` | Runtime-settable dev/production mode flag with auto-detection from CLI args or NODE_ENV |
|
|
92
93
|
| [error-to-string](./docs/error-to-string.md) | `lifecycleion/error-to-string` | Format errors into readable ASCII tables with support for nested info and sensitive field masking |
|
|
93
94
|
| [event-emitter](./docs/event-emitter.md) | `lifecycleion/event-emitter` | Lightweight event emitter with protected and public variants, type safety, and memory management |
|
|
94
95
|
| [id-helpers](./docs/id-helpers.md) | `lifecycleion/id-helpers` | Unified ID generation and validation for ObjectID, UUID v4, UUID v7, and ULID |
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/dev-mode.ts
|
|
21
|
+
var dev_mode_exports = {};
|
|
22
|
+
__export(dev_mode_exports, {
|
|
23
|
+
getDevMode: () => getDevMode,
|
|
24
|
+
initDevMode: () => initDevMode,
|
|
25
|
+
overrideDevMode: () => overrideDevMode
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(dev_mode_exports);
|
|
28
|
+
var GLOBAL_KEY = "__lifecycleion_is_dev__";
|
|
29
|
+
var INIT_PARAM_KEY = "__lifecycleion_init_param__";
|
|
30
|
+
var g = globalThis;
|
|
31
|
+
function detectValue(detect, isStrict) {
|
|
32
|
+
const argv = typeof process !== "undefined" ? process.argv ?? [] : [];
|
|
33
|
+
const env = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
34
|
+
const cmdArg = argv.find((a) => a === "dev" || a === "prod");
|
|
35
|
+
if (isStrict && detect === "cmd" && cmdArg === void 0) {
|
|
36
|
+
throw new Error('initDevMode: expected "dev" or "prod" as a CLI argument');
|
|
37
|
+
}
|
|
38
|
+
const isFromCmd = cmdArg !== void 0 ? cmdArg === "dev" : false;
|
|
39
|
+
const isFromEnv = env === "development";
|
|
40
|
+
if (detect === "cmd") {
|
|
41
|
+
return isFromCmd;
|
|
42
|
+
}
|
|
43
|
+
if (detect === "node_env") {
|
|
44
|
+
return isFromEnv;
|
|
45
|
+
}
|
|
46
|
+
return cmdArg !== void 0 ? isFromCmd : isFromEnv;
|
|
47
|
+
}
|
|
48
|
+
function resolveInitParam(param) {
|
|
49
|
+
if (param === void 0) {
|
|
50
|
+
return detectValue("both");
|
|
51
|
+
}
|
|
52
|
+
if (typeof param === "boolean") {
|
|
53
|
+
return param;
|
|
54
|
+
}
|
|
55
|
+
return detectValue(param.detect, param.strict);
|
|
56
|
+
}
|
|
57
|
+
function getDevMode() {
|
|
58
|
+
return typeof g[GLOBAL_KEY] === "boolean" ? g[GLOBAL_KEY] : false;
|
|
59
|
+
}
|
|
60
|
+
function initDevMode(param) {
|
|
61
|
+
if (typeof g[GLOBAL_KEY] === "boolean") {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
g[INIT_PARAM_KEY] = param;
|
|
65
|
+
g[GLOBAL_KEY] = resolveInitParam(param);
|
|
66
|
+
}
|
|
67
|
+
function overrideDevMode(value) {
|
|
68
|
+
const savedParam = g[INIT_PARAM_KEY];
|
|
69
|
+
g[GLOBAL_KEY] = value === "redetect" ? resolveInitParam(savedParam) : value;
|
|
70
|
+
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
getDevMode,
|
|
74
|
+
initDevMode,
|
|
75
|
+
overrideDevMode
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=dev-mode.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/dev-mode.ts"],"sourcesContent":["// Stored in globalThis so state survives module re-evaluation and works across\n// module boundaries.\nconst GLOBAL_KEY = '__lifecycleion_is_dev__';\nconst INIT_PARAM_KEY = '__lifecycleion_init_param__';\n\ntype DevModeSource = 'cmd' | 'node_env' | 'both';\ntype InitParam =\n | boolean\n | { detect: DevModeSource; strict?: boolean }\n | undefined;\n\n// Cast once at module level — avoids repeating the assertion in every function.\nconst g = globalThis as typeof globalThis & Record<string, unknown>;\n\nfunction detectValue(detect: DevModeSource, isStrict?: boolean): boolean {\n // Guard against environments where process or its properties may not exist\n // (e.g. browser without polyfill, Deno without Node compat, edge runtimes).\n // Vite statically replaces process.env.NODE_ENV at build time, so it is safe\n // on the client. process.argv is an empty array shim in browsers — harmless.\n const argv: string[] =\n typeof process !== 'undefined' ? (process.argv ?? []) : [];\n const env: string | undefined =\n typeof process !== 'undefined' ? process.env?.NODE_ENV : undefined;\n\n const cmdArg = argv.find((a) => a === 'dev' || a === 'prod');\n\n if (isStrict && detect === 'cmd' && cmdArg === undefined) {\n throw new Error('initDevMode: expected \"dev\" or \"prod\" as a CLI argument');\n }\n\n const isFromCmd = cmdArg !== undefined ? cmdArg === 'dev' : false;\n const isFromEnv = env === 'development';\n\n if (detect === 'cmd') {\n return isFromCmd;\n }\n\n if (detect === 'node_env') {\n return isFromEnv;\n }\n\n // 'both': cmd wins when explicitly present, otherwise fall back to NODE_ENV\n return cmdArg !== undefined ? isFromCmd : isFromEnv;\n}\n\nfunction resolveInitParam(param: InitParam): boolean {\n if (param === undefined) {\n return detectValue('both');\n }\n\n if (typeof param === 'boolean') {\n return param;\n }\n\n return detectValue(param.detect, param.strict);\n}\n\n/**\n * Returns the current dev mode value.\n *\n * Reads `globalThis.__lifecycleion_is_dev__`. Defaults to `false` if\n * `initDevMode()` has not been called yet.\n */\nexport function getDevMode(): boolean {\n return typeof g[GLOBAL_KEY] === 'boolean' ? g[GLOBAL_KEY] : false;\n}\n\n/**\n * Sets the dev mode global for the current process.\n *\n * First-wins: if the global is already set (e.g. set by the HTML injection on\n * the client, or by a prior `initDevMode()` call), this is a no-op. Call once\n * at startup before serving any requests.\n *\n * @param param\n * - `true` / `false` — explicit value\n * - `{ detect: 'cmd' }` — read from `process.argv` (\"dev\" or \"prod\")\n * - `{ detect: 'node_env' }` — read from `NODE_ENV`\n * - `{ detect: 'both' }` — argv takes precedence, falls back to `NODE_ENV`\n * - `{ detect: 'cmd', strict: true }` — argv required, throws if absent\n * - omitted — same as `{ detect: 'both' }`\n */\nexport function initDevMode(\n param?: boolean | { detect: DevModeSource; strict?: boolean },\n): void {\n if (typeof g[GLOBAL_KEY] === 'boolean') {\n return; // first-wins — already initialized, no-op\n }\n\n g[INIT_PARAM_KEY] = param; // save original param so 'redetect' can replay it\n g[GLOBAL_KEY] = resolveInitParam(param);\n}\n\n/**\n * Bypasses first-wins semantics and forces the dev mode value.\n *\n * Intended for testing or tooling — not for production use.\n *\n * Pass `'redetect'` to re-run the same detection logic that\n * `initDevMode()` used originally.\n */\nexport function overrideDevMode(value: boolean | 'redetect'): void {\n const savedParam = g[INIT_PARAM_KEY] as InitParam;\n g[GLOBAL_KEY] = value === 'redetect' ? resolveInitParam(savedParam) : value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAM,aAAa;AACnB,IAAM,iBAAiB;AASvB,IAAM,IAAI;AAEV,SAAS,YAAY,QAAuB,UAA6B;AAKvE,QAAM,OACJ,OAAO,YAAY,cAAe,QAAQ,QAAQ,CAAC,IAAK,CAAC;AAC3D,QAAM,MACJ,OAAO,YAAY,cAAc,QAAQ,KAAK,WAAW;AAE3D,QAAM,SAAS,KAAK,KAAK,CAAC,MAAM,MAAM,SAAS,MAAM,MAAM;AAE3D,MAAI,YAAY,WAAW,SAAS,WAAW,QAAW;AACxD,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,YAAY,WAAW,SAAY,WAAW,QAAQ;AAC5D,QAAM,YAAY,QAAQ;AAE1B,MAAI,WAAW,OAAO;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,WAAW,YAAY;AACzB,WAAO;AAAA,EACT;AAGA,SAAO,WAAW,SAAY,YAAY;AAC5C;AAEA,SAAS,iBAAiB,OAA2B;AACnD,MAAI,UAAU,QAAW;AACvB,WAAO,YAAY,MAAM;AAAA,EAC3B;AAEA,MAAI,OAAO,UAAU,WAAW;AAC9B,WAAO;AAAA,EACT;AAEA,SAAO,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC/C;AAQO,SAAS,aAAsB;AACpC,SAAO,OAAO,EAAE,UAAU,MAAM,YAAY,EAAE,UAAU,IAAI;AAC9D;AAiBO,SAAS,YACd,OACM;AACN,MAAI,OAAO,EAAE,UAAU,MAAM,WAAW;AACtC;AAAA,EACF;AAEA,IAAE,cAAc,IAAI;AACpB,IAAE,UAAU,IAAI,iBAAiB,KAAK;AACxC;AAUO,SAAS,gBAAgB,OAAmC;AACjE,QAAM,aAAa,EAAE,cAAc;AACnC,IAAE,UAAU,IAAI,UAAU,aAAa,iBAAiB,UAAU,IAAI;AACxE;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type DevModeSource = 'cmd' | 'node_env' | 'both';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current dev mode value.
|
|
4
|
+
*
|
|
5
|
+
* Reads `globalThis.__lifecycleion_is_dev__`. Defaults to `false` if
|
|
6
|
+
* `initDevMode()` has not been called yet.
|
|
7
|
+
*/
|
|
8
|
+
declare function getDevMode(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the dev mode global for the current process.
|
|
11
|
+
*
|
|
12
|
+
* First-wins: if the global is already set (e.g. set by the HTML injection on
|
|
13
|
+
* the client, or by a prior `initDevMode()` call), this is a no-op. Call once
|
|
14
|
+
* at startup before serving any requests.
|
|
15
|
+
*
|
|
16
|
+
* @param param
|
|
17
|
+
* - `true` / `false` — explicit value
|
|
18
|
+
* - `{ detect: 'cmd' }` — read from `process.argv` ("dev" or "prod")
|
|
19
|
+
* - `{ detect: 'node_env' }` — read from `NODE_ENV`
|
|
20
|
+
* - `{ detect: 'both' }` — argv takes precedence, falls back to `NODE_ENV`
|
|
21
|
+
* - `{ detect: 'cmd', strict: true }` — argv required, throws if absent
|
|
22
|
+
* - omitted — same as `{ detect: 'both' }`
|
|
23
|
+
*/
|
|
24
|
+
declare function initDevMode(param?: boolean | {
|
|
25
|
+
detect: DevModeSource;
|
|
26
|
+
strict?: boolean;
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Bypasses first-wins semantics and forces the dev mode value.
|
|
30
|
+
*
|
|
31
|
+
* Intended for testing or tooling — not for production use.
|
|
32
|
+
*
|
|
33
|
+
* Pass `'redetect'` to re-run the same detection logic that
|
|
34
|
+
* `initDevMode()` used originally.
|
|
35
|
+
*/
|
|
36
|
+
declare function overrideDevMode(value: boolean | 'redetect'): void;
|
|
37
|
+
|
|
38
|
+
export { getDevMode, initDevMode, overrideDevMode };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type DevModeSource = 'cmd' | 'node_env' | 'both';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current dev mode value.
|
|
4
|
+
*
|
|
5
|
+
* Reads `globalThis.__lifecycleion_is_dev__`. Defaults to `false` if
|
|
6
|
+
* `initDevMode()` has not been called yet.
|
|
7
|
+
*/
|
|
8
|
+
declare function getDevMode(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the dev mode global for the current process.
|
|
11
|
+
*
|
|
12
|
+
* First-wins: if the global is already set (e.g. set by the HTML injection on
|
|
13
|
+
* the client, or by a prior `initDevMode()` call), this is a no-op. Call once
|
|
14
|
+
* at startup before serving any requests.
|
|
15
|
+
*
|
|
16
|
+
* @param param
|
|
17
|
+
* - `true` / `false` — explicit value
|
|
18
|
+
* - `{ detect: 'cmd' }` — read from `process.argv` ("dev" or "prod")
|
|
19
|
+
* - `{ detect: 'node_env' }` — read from `NODE_ENV`
|
|
20
|
+
* - `{ detect: 'both' }` — argv takes precedence, falls back to `NODE_ENV`
|
|
21
|
+
* - `{ detect: 'cmd', strict: true }` — argv required, throws if absent
|
|
22
|
+
* - omitted — same as `{ detect: 'both' }`
|
|
23
|
+
*/
|
|
24
|
+
declare function initDevMode(param?: boolean | {
|
|
25
|
+
detect: DevModeSource;
|
|
26
|
+
strict?: boolean;
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Bypasses first-wins semantics and forces the dev mode value.
|
|
30
|
+
*
|
|
31
|
+
* Intended for testing or tooling — not for production use.
|
|
32
|
+
*
|
|
33
|
+
* Pass `'redetect'` to re-run the same detection logic that
|
|
34
|
+
* `initDevMode()` used originally.
|
|
35
|
+
*/
|
|
36
|
+
declare function overrideDevMode(value: boolean | 'redetect'): void;
|
|
37
|
+
|
|
38
|
+
export { getDevMode, initDevMode, overrideDevMode };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/lib/dev-mode.ts
|
|
2
|
+
var GLOBAL_KEY = "__lifecycleion_is_dev__";
|
|
3
|
+
var INIT_PARAM_KEY = "__lifecycleion_init_param__";
|
|
4
|
+
var g = globalThis;
|
|
5
|
+
function detectValue(detect, isStrict) {
|
|
6
|
+
const argv = typeof process !== "undefined" ? process.argv ?? [] : [];
|
|
7
|
+
const env = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
8
|
+
const cmdArg = argv.find((a) => a === "dev" || a === "prod");
|
|
9
|
+
if (isStrict && detect === "cmd" && cmdArg === void 0) {
|
|
10
|
+
throw new Error('initDevMode: expected "dev" or "prod" as a CLI argument');
|
|
11
|
+
}
|
|
12
|
+
const isFromCmd = cmdArg !== void 0 ? cmdArg === "dev" : false;
|
|
13
|
+
const isFromEnv = env === "development";
|
|
14
|
+
if (detect === "cmd") {
|
|
15
|
+
return isFromCmd;
|
|
16
|
+
}
|
|
17
|
+
if (detect === "node_env") {
|
|
18
|
+
return isFromEnv;
|
|
19
|
+
}
|
|
20
|
+
return cmdArg !== void 0 ? isFromCmd : isFromEnv;
|
|
21
|
+
}
|
|
22
|
+
function resolveInitParam(param) {
|
|
23
|
+
if (param === void 0) {
|
|
24
|
+
return detectValue("both");
|
|
25
|
+
}
|
|
26
|
+
if (typeof param === "boolean") {
|
|
27
|
+
return param;
|
|
28
|
+
}
|
|
29
|
+
return detectValue(param.detect, param.strict);
|
|
30
|
+
}
|
|
31
|
+
function getDevMode() {
|
|
32
|
+
return typeof g[GLOBAL_KEY] === "boolean" ? g[GLOBAL_KEY] : false;
|
|
33
|
+
}
|
|
34
|
+
function initDevMode(param) {
|
|
35
|
+
if (typeof g[GLOBAL_KEY] === "boolean") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
g[INIT_PARAM_KEY] = param;
|
|
39
|
+
g[GLOBAL_KEY] = resolveInitParam(param);
|
|
40
|
+
}
|
|
41
|
+
function overrideDevMode(value) {
|
|
42
|
+
const savedParam = g[INIT_PARAM_KEY];
|
|
43
|
+
g[GLOBAL_KEY] = value === "redetect" ? resolveInitParam(savedParam) : value;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
getDevMode,
|
|
47
|
+
initDevMode,
|
|
48
|
+
overrideDevMode
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=dev-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/dev-mode.ts"],"sourcesContent":["// Stored in globalThis so state survives module re-evaluation and works across\n// module boundaries.\nconst GLOBAL_KEY = '__lifecycleion_is_dev__';\nconst INIT_PARAM_KEY = '__lifecycleion_init_param__';\n\ntype DevModeSource = 'cmd' | 'node_env' | 'both';\ntype InitParam =\n | boolean\n | { detect: DevModeSource; strict?: boolean }\n | undefined;\n\n// Cast once at module level — avoids repeating the assertion in every function.\nconst g = globalThis as typeof globalThis & Record<string, unknown>;\n\nfunction detectValue(detect: DevModeSource, isStrict?: boolean): boolean {\n // Guard against environments where process or its properties may not exist\n // (e.g. browser without polyfill, Deno without Node compat, edge runtimes).\n // Vite statically replaces process.env.NODE_ENV at build time, so it is safe\n // on the client. process.argv is an empty array shim in browsers — harmless.\n const argv: string[] =\n typeof process !== 'undefined' ? (process.argv ?? []) : [];\n const env: string | undefined =\n typeof process !== 'undefined' ? process.env?.NODE_ENV : undefined;\n\n const cmdArg = argv.find((a) => a === 'dev' || a === 'prod');\n\n if (isStrict && detect === 'cmd' && cmdArg === undefined) {\n throw new Error('initDevMode: expected \"dev\" or \"prod\" as a CLI argument');\n }\n\n const isFromCmd = cmdArg !== undefined ? cmdArg === 'dev' : false;\n const isFromEnv = env === 'development';\n\n if (detect === 'cmd') {\n return isFromCmd;\n }\n\n if (detect === 'node_env') {\n return isFromEnv;\n }\n\n // 'both': cmd wins when explicitly present, otherwise fall back to NODE_ENV\n return cmdArg !== undefined ? isFromCmd : isFromEnv;\n}\n\nfunction resolveInitParam(param: InitParam): boolean {\n if (param === undefined) {\n return detectValue('both');\n }\n\n if (typeof param === 'boolean') {\n return param;\n }\n\n return detectValue(param.detect, param.strict);\n}\n\n/**\n * Returns the current dev mode value.\n *\n * Reads `globalThis.__lifecycleion_is_dev__`. Defaults to `false` if\n * `initDevMode()` has not been called yet.\n */\nexport function getDevMode(): boolean {\n return typeof g[GLOBAL_KEY] === 'boolean' ? g[GLOBAL_KEY] : false;\n}\n\n/**\n * Sets the dev mode global for the current process.\n *\n * First-wins: if the global is already set (e.g. set by the HTML injection on\n * the client, or by a prior `initDevMode()` call), this is a no-op. Call once\n * at startup before serving any requests.\n *\n * @param param\n * - `true` / `false` — explicit value\n * - `{ detect: 'cmd' }` — read from `process.argv` (\"dev\" or \"prod\")\n * - `{ detect: 'node_env' }` — read from `NODE_ENV`\n * - `{ detect: 'both' }` — argv takes precedence, falls back to `NODE_ENV`\n * - `{ detect: 'cmd', strict: true }` — argv required, throws if absent\n * - omitted — same as `{ detect: 'both' }`\n */\nexport function initDevMode(\n param?: boolean | { detect: DevModeSource; strict?: boolean },\n): void {\n if (typeof g[GLOBAL_KEY] === 'boolean') {\n return; // first-wins — already initialized, no-op\n }\n\n g[INIT_PARAM_KEY] = param; // save original param so 'redetect' can replay it\n g[GLOBAL_KEY] = resolveInitParam(param);\n}\n\n/**\n * Bypasses first-wins semantics and forces the dev mode value.\n *\n * Intended for testing or tooling — not for production use.\n *\n * Pass `'redetect'` to re-run the same detection logic that\n * `initDevMode()` used originally.\n */\nexport function overrideDevMode(value: boolean | 'redetect'): void {\n const savedParam = g[INIT_PARAM_KEY] as InitParam;\n g[GLOBAL_KEY] = value === 'redetect' ? resolveInitParam(savedParam) : value;\n}\n"],"mappings":";AAEA,IAAM,aAAa;AACnB,IAAM,iBAAiB;AASvB,IAAM,IAAI;AAEV,SAAS,YAAY,QAAuB,UAA6B;AAKvE,QAAM,OACJ,OAAO,YAAY,cAAe,QAAQ,QAAQ,CAAC,IAAK,CAAC;AAC3D,QAAM,MACJ,OAAO,YAAY,cAAc,QAAQ,KAAK,WAAW;AAE3D,QAAM,SAAS,KAAK,KAAK,CAAC,MAAM,MAAM,SAAS,MAAM,MAAM;AAE3D,MAAI,YAAY,WAAW,SAAS,WAAW,QAAW;AACxD,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AAEA,QAAM,YAAY,WAAW,SAAY,WAAW,QAAQ;AAC5D,QAAM,YAAY,QAAQ;AAE1B,MAAI,WAAW,OAAO;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,WAAW,YAAY;AACzB,WAAO;AAAA,EACT;AAGA,SAAO,WAAW,SAAY,YAAY;AAC5C;AAEA,SAAS,iBAAiB,OAA2B;AACnD,MAAI,UAAU,QAAW;AACvB,WAAO,YAAY,MAAM;AAAA,EAC3B;AAEA,MAAI,OAAO,UAAU,WAAW;AAC9B,WAAO;AAAA,EACT;AAEA,SAAO,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC/C;AAQO,SAAS,aAAsB;AACpC,SAAO,OAAO,EAAE,UAAU,MAAM,YAAY,EAAE,UAAU,IAAI;AAC9D;AAiBO,SAAS,YACd,OACM;AACN,MAAI,OAAO,EAAE,UAAU,MAAM,WAAW;AACtC;AAAA,EACF;AAEA,IAAE,cAAc,IAAI;AACpB,IAAE,UAAU,IAAI,iBAAiB,KAAK;AACxC;AAUO,SAAS,gBAAgB,OAAmC;AACjE,QAAM,aAAa,EAAE,cAAc;AACnC,IAAE,UAAU,IAAI,UAAU,aAAa,iBAAiB,UAAU,IAAI;AACxE;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lifecycleion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A collection of foundational TypeScript utilities for managing application lifecycle, logging, retries, events, and common programming patterns",
|
|
6
6
|
"exports": {
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"import": "./dist/lib/deep-clone.js",
|
|
40
40
|
"require": "./dist/lib/deep-clone.cjs"
|
|
41
41
|
},
|
|
42
|
+
"./dev-mode": {
|
|
43
|
+
"types": "./dist/lib/dev-mode.d.ts",
|
|
44
|
+
"import": "./dist/lib/dev-mode.js",
|
|
45
|
+
"require": "./dist/lib/dev-mode.cjs"
|
|
46
|
+
},
|
|
42
47
|
"./error-to-string": {
|
|
43
48
|
"types": "./dist/lib/error-to-string.d.ts",
|
|
44
49
|
"import": "./dist/lib/error-to-string.js",
|