@vicin/sigil 1.2.5 → 1.2.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.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.global.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -503,8 +503,8 @@ declare const Sigil: {
|
|
|
503
503
|
get SigilTypeLineage(): readonly symbol[];
|
|
504
504
|
get SigilTypeSet(): Readonly<Set<symbol>>;
|
|
505
505
|
isSigilified(obj: unknown): obj is ISigil;
|
|
506
|
-
isOfType<T
|
|
507
|
-
isOfTypeStrict<T
|
|
506
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
507
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
508
508
|
} & {
|
|
509
509
|
new (): {};
|
|
510
510
|
};
|
|
@@ -536,8 +536,8 @@ declare const SigilError: {
|
|
|
536
536
|
get SigilTypeLineage(): readonly symbol[];
|
|
537
537
|
get SigilTypeSet(): Readonly<Set<symbol>>;
|
|
538
538
|
isSigilified(obj: unknown): obj is ISigil;
|
|
539
|
-
isOfType<T
|
|
540
|
-
isOfTypeStrict<T
|
|
539
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
540
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
541
541
|
} & ErrorConstructor;
|
|
542
542
|
type SigilError = InstanceType<typeof SigilError>;
|
|
543
543
|
|
|
@@ -797,7 +797,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
797
797
|
* @param other - The object to test.
|
|
798
798
|
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
799
799
|
*/
|
|
800
|
-
isOfType<T
|
|
800
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
801
801
|
/**
|
|
802
802
|
* Strict lineage check: compares the type symbol lineage arrays element-by-element.
|
|
803
803
|
*
|
|
@@ -810,7 +810,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
810
810
|
* @param other - The object to test.
|
|
811
811
|
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
812
812
|
*/
|
|
813
|
-
isOfTypeStrict<T
|
|
813
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
814
814
|
} & B;
|
|
815
815
|
|
|
816
816
|
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, REGISTRY, Sigil, type SigilBrandOf, SigilError, type SigilOptions, SigilRegistry, Sigilify, type TypedSigil, type UpdateSigilBrand, WithSigil, getActiveRegistry, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, typed, updateOptions, withSigil, withSigilTyped };
|
package/dist/index.d.ts
CHANGED
|
@@ -503,8 +503,8 @@ declare const Sigil: {
|
|
|
503
503
|
get SigilTypeLineage(): readonly symbol[];
|
|
504
504
|
get SigilTypeSet(): Readonly<Set<symbol>>;
|
|
505
505
|
isSigilified(obj: unknown): obj is ISigil;
|
|
506
|
-
isOfType<T
|
|
507
|
-
isOfTypeStrict<T
|
|
506
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
507
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
508
508
|
} & {
|
|
509
509
|
new (): {};
|
|
510
510
|
};
|
|
@@ -536,8 +536,8 @@ declare const SigilError: {
|
|
|
536
536
|
get SigilTypeLineage(): readonly symbol[];
|
|
537
537
|
get SigilTypeSet(): Readonly<Set<symbol>>;
|
|
538
538
|
isSigilified(obj: unknown): obj is ISigil;
|
|
539
|
-
isOfType<T
|
|
540
|
-
isOfTypeStrict<T
|
|
539
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
540
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
541
541
|
} & ErrorConstructor;
|
|
542
542
|
type SigilError = InstanceType<typeof SigilError>;
|
|
543
543
|
|
|
@@ -797,7 +797,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
797
797
|
* @param other - The object to test.
|
|
798
798
|
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
799
799
|
*/
|
|
800
|
-
isOfType<T
|
|
800
|
+
isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
801
801
|
/**
|
|
802
802
|
* Strict lineage check: compares the type symbol lineage arrays element-by-element.
|
|
803
803
|
*
|
|
@@ -810,7 +810,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
810
810
|
* @param other - The object to test.
|
|
811
811
|
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
812
812
|
*/
|
|
813
|
-
isOfTypeStrict<T
|
|
813
|
+
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
814
814
|
} & B;
|
|
815
815
|
|
|
816
816
|
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, REGISTRY, Sigil, type SigilBrandOf, SigilError, type SigilOptions, SigilRegistry, Sigilify, type TypedSigil, type UpdateSigilBrand, WithSigil, getActiveRegistry, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, typed, updateOptions, withSigil, withSigilTyped };
|
package/dist/index.global.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["REGISTRY","ctor"],"mappings":";;;;;;;;EAWO,IAAM,OAAA,GAAkC;EAAA,EAC7C,e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GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;EAAA,KAC5G;EAGF,EAAA,IAAI,CAAA;EACJ,EAAA,IAAI,KAAA,EAAO;EACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;EACvB,IAAA,CAAA,GAAI,KAAA;EAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;EAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;EACb,EAAA,YAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;EAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;EAE3B,EAAA,OAAO,KAAA;EACT","file":"index.global.js","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type { Constructor, ISigil, SigilOptions, Prettify } from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has(this.SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["REGISTRY","ctor"],"mappings":";;;;;;;;EAWO,IAAM,OAAA,GAAkC;EAAA,EAC7C,eAAA,EAAiB,IAAA;EAAA,EACjB,yBAAA,EAA2B,KAAA;EAAA,EAC3B,cAAA,EAAgB,KAAA;EAAA,EAChB,SAAA,EAAW,KAAA;EAAA,EACX,QAAA,EAAU,IAAA;EAAA,EACV,iBAAA,EAAmB,KAAA;EAAA,EACnB,gBAAA,EAAkB;EACpB,CAAA;EAeA,IAAM,kBAAA,mBAAqB,MAAA,CAAO,GAAA,CAAI,2BAA2B,CAAA;EAGjE,IAAM,oBAAA,GAAuB,CAAC,GAAA,KAAoC;EAChE,EAAA,IAAI,GAAA,KAAQ,IAAA,EAAM,OAAQ,UAAA,CAAmB,kBAAkB,CAAA;EAAA,OACzD,UAAA,CAAmB,kBAAkB,CAAA,GAAI,GAAA;EACjD,CAAA;EAGA,IAAM,oBAAoB,MAA4B;EACpD,EAAA,MAAM,GAAA,GAAO,WAAmB,kBAAkB,CAAA;EAClD,EAAA,OAAO,GAAA,KAAQ,SAAY,IAAA,GAAQ,GAAA;EACrC,CAAA;AAYO,MAAM,aAAA,GAAN,MAAM,cAAA,CAAc;EAAA;EAAA;EAAA;EAAA,EAOzB,YAAY,GAAA,EAAkC;EAL9C;EAAA,IAAA,aAAA,CAAA,IAAA,EAAQ,WAAA,CAAA;EAMN,IAAA,IAAA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AM,UAAA;EAC3B,IAAA,IAAI,gBAAgB,YAAA,KAAiB,KAAA;EACnC,MAAA,MAAM,IAAI,KAAA;EAAA,QACR,CAAA,oCAAA,EAAuC,YAAY,CAAA,iCAAA,EAAoC,KAAK,CAAA,EAAA;EAAA,OAC9F;EAAA,EACJ;EACA,EAAA,OAAO,KAAA;EACT;EAqBO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,IAAA,EACkB;EAlHpB,EAAA,IAAA,EAAA;EAmHE,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;EACpB,IAAA,MAAM,IAAI,KAAA;EAAA,MACR,CAAA,+EAAA,EAAA,CAAkF,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;EAAA,KAC5G;EAGF,EAAA,IAAI,CAAA;EACJ,EAAA,IAAI,KAAA,EAAO;EACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;EACvB,IAAA,CAAA,GAAI,KAAA;EAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;EAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;EACb,EAAA,YAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;EAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;EAE3B,EAAA,OAAO,KAAA;EACT","file":"index.global.js","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type {\n Constructor,\n ISigil,\n SigilOptions,\n Prettify,\n GetInstance,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has((this as any).SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["REGISTRY","ctor"],"mappings":";;;;;;;AAWO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB,KAAA;AAAA,EAChB,SAAA,EAAW,KAAA;AAAA,EACX,QAAA,EAAU,IAAA;AAAA,EACV,iBAAA,EAAmB,KAAA;AAAA,EACnB,gBAAA,EAAkB;AACpB,CAAA;AAeA,IAAM,kBAAA,mBAAqB,MAAA,CAAO,GAAA,CAAI,2BAA2B,CAAA;AAGjE,IAAM,oB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A,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;AAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type { Constructor, ISigil, SigilOptions, Prettify } from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has(this.SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/options.ts","../src/core/sym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A;AAmHE,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+EAAA,EAAA,CAAkF,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KAC5G;AAGF,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;AAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type {\n Constructor,\n ISigil,\n SigilOptions,\n Prettify,\n GetInstance,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has((this as any).SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["ctor"],"mappings":";;;;;AAWO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB,KAAA;AAAA,EAChB,SAAA,EAAW,KAAA;AAAA,EACX,QAAA,EAAU,IAAA;AAAA,EACV,iBAAA,EAAmB,KAAA;AAAA,EACnB,gBAAA,EAAkB;AACpB,CAAA;AAeA,IAAM,kBAAA,mBAAqB,MAAA,CAAO,GAAA,CAAI,2BAA2B,CAAA;AAGjE,IAAM,oBAAA,GAAuB,CAAC,GAAA,KAAoC;AAChE,EAAA,IAAI,GAAA,KAAQ,IAAA,EAAM,OAAQ,UAAA,CAAmB,kBAAkB,CAAA;AAAA,OACzD,UAAA,CAAmB,kBAAkB,CAAA,GAAI,GAAA;AACjD,CAAA;AAGA,IAAM,oBAAoB,MAA4B;AACpD,EAAA,MAAM,GAAA,GAAO,WAAmB,kBAAkB,CAAA;AAClD,EAAA,OAAO,GAAA,KAAQ,SAAY,IAAA,GAAQ,GAAA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KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KACnG;AAEF,EAAA,IAAI,aAAa,KAAA,EAAO;AACtB,IAAA,MAAM,eAAe,KAAA,CAAM,UAAA;AAC3B,IAAA,IAAI,gBAAgB,YAAA,KAAiB,KAAA;AACnC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,oCAAA,EAAuC,YAAY,CAAA,iCAAA,EAAoC,KAAK,CAAA,EAAA;AAAA,OAC9F;AAAA,EACJ;AACA,EAAA,OAAO,KAAA;AACT;AAqBO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,IAAA,EACkB;AAlHpB,EAAA,IAAA,EAAA;AAmHE,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+EAAA,EAAA,CAAkF,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KAC5G;AAGF,EAAA,IAAI,CAAA;AACJ,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;AAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.mjs","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type { Constructor, ISigil, SigilOptions, Prettify } from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has(this.SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T extends ISigil>(\n this: T,\n other: unknown\n ): other is InstanceType<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/options.ts","../src/core/symbols.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["ctor"],"mappings":";;;;;AAWO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB,KAAA;AAAA,EAChB,SAAA,EAAW,KAAA;AAAA,EACX,QAAA,EAAU,IAAA;AAAA,EACV,iBAAA,EAA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AAI,CAAA;AACvB,IAAA,CAAA,GAAI,KAAA;AAAA,EACN,CAAA,UAAW,mBAAA,EAAoB;AAG/B,EAAA,MAAM,IAAA,GAAO,KAAA;AACb,EAAA,YAAA,CAAa,IAAA,EAAM,GAAG,IAAI,CAAA;AAC1B,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.mjs","sourcesContent":["import type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: false,\n registry: null,\n useGlobalRegistry: false,\n storeConstructor: false,\n};\n\n/** -----------------------------------------\n * Registry\n * ----------------------------------------- */\n\n/**\n * Global registry key used on `globalThis` to store a map of Sigil labels and reference to their classes.\n *\n * We use `Symbol.for` so the same key survives across bundles that share the\n * global symbol registry (useful for HMR/dev workflows).\n *\n * @internal\n * @constant {symbol}\n */\nconst __SIGIL_REGISTRY__ = Symbol.for('@Sigil.__SIGIL_REGISTRY__');\n\n/** Update global registry map stored. */\nconst updateGlobalRegistry = (map: SigilRegistry | null): void => {\n if (map === null) delete (globalThis as any)[__SIGIL_REGISTRY__];\n else (globalThis as any)[__SIGIL_REGISTRY__] = map;\n};\n\n/** Get global registry map stored. */\nconst getGlobalRegistry = (): SigilRegistry | null => {\n const val = (globalThis as any)[__SIGIL_REGISTRY__];\n return val === undefined ? null : (val as SigilRegistry | null);\n};\n\n/**\n * Small wrapper around a shared registry Set that provides safe operations\n * and hot-reload-friendly behavior.\n *\n * Responsibilities:\n * - Query the current registry (may be `null` to indicate disabled checks).\n * - Register / unregister labels in a controlled manner.\n * - Query class constructors using their 'SigilLabel'.\n * - Support hot-reload tolerant registration (avoid throwing in DEV).\n */\nexport class SigilRegistry {\n /** Internal private registry map. */\n private _registry: Map<string, ISigil | null>;\n\n /**\n * @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.\n */\n constructor(map?: Map<string, ISigil | null>) {\n this._registry = map ?? new Map();\n }\n\n /**\n * Return a readonly view (array) of the current registry entries.\n *\n * @returns An array containing all registered labels, or an empty array when registry is disabled.\n */\n listLabels(): string[] {\n return this._registry ? Array.from(this._registry.keys()) : [];\n }\n\n /**\n * Determine whether the registry currently contains `label`.\n *\n * @param label - The label to test.\n * @returns `true` if present; `false` otherwise.\n */\n has(label: string): boolean {\n return !!this._registry && this._registry.has(label);\n }\n\n /**\n * Get class constructor using its label.\n *\n * @param label - Label appended to Sigil class.\n * @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.\n */\n get(label: string): ISigil | null {\n return this._registry.get(label) ?? null;\n }\n\n /**\n * Register a label and class constructor in the active registry.\n *\n * If the label already exists then:\n * - In DEV builds: prints a console warning (HMR friendly) and returns early.\n * - In non-DEV builds: throws an Error to prevent duplicate registration.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n register(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n const storeCtor = opts?.storeConstructor ?? OPTIONS.storeConstructor;\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (this._registry.has(label)) {\n const existing = this._registry.get(label);\n const isLikelyHMR = existing?.name === Class?.name;\n\n if (devMarker) {\n if (isLikelyHMR) {\n // The console is intentional\n // eslint-disable-next-line no-console\n console.warn(\n `[Sigil] Duplicate label \"${label}\" may be due to HMR — ignore if you are sure that it's defined once.`\n );\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' (different classes: ${existing?.name ?? 'unknown'} vs ${Class?.name ?? 'unknown'}).`\n );\n }\n } else {\n throw new Error(\n `[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`\n );\n }\n } else {\n this._registry.set(label, storeCtor ? Class : null);\n }\n }\n\n /**\n * Alias for 'SigilRegistry.register'.\n *\n * @param label - Label string to register (e.g. '@scope/pkg.ClassName').\n * @param Class - Constructor of the class being registered.\n * @param opts - Optional per-call overrides.\n */\n set(\n label: string,\n Class: ISigil | null,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>\n ): void {\n return this.register(label, Class, opts);\n }\n\n /**\n * Unregister a previously registered class.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n unregister(label: string): boolean {\n return this._registry.delete(label);\n }\n\n /**\n * Alias for 'SigilRegistry.unregister'.\n *\n * @param label - The label to remove from the registry.\n * @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).\n */\n delete(label: string): boolean {\n return this.unregister(label);\n }\n\n /**\n * Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.\n */\n replaceRegistry(newRegistry: Map<string, ISigil | null> | null): void {\n if (newRegistry)\n updateOptions({ registry: new SigilRegistry(newRegistry) });\n else updateOptions({ registry: newRegistry });\n }\n\n /**\n * Clear the registry completely.\n *\n * Useful for test teardown, or when explicitly resetting state during development.\n * No-op when the registry is disabled.\n */\n clear(): void {\n this._registry.clear();\n }\n\n /**\n * Merge another SigilRegistry into this one.\n *\n * Entries from `other` will be registered into this registry. Duplicate labels\n * are handled via this registry's `register` logic (i.e., will warn in DEV or\n * throw in production).\n *\n * @param other - Another `SigilRegistry` whose entries will be merged into this registry.\n */\n merge(other: SigilRegistry): void {\n if (!OPTIONS.registry) return; // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n for (const [label, ctor] of other) this.register(label, ctor);\n }\n\n /**\n * Return a Map-style iterator over entries: `[label, constructor]`.\n * Equivalent to calling `registry[Symbol.iterator]()`.\n *\n * @returns IterableIterator of `[label, ISigil]`.\n */\n entries(): IterableIterator<[string, ISigil | null]> {\n return this._registry.entries();\n }\n\n /**\n * Return an iterator over registered constructors.\n *\n * @returns IterableIterator of `ISigil` constructors.\n */\n values(): IterableIterator<ISigil | null> {\n return this._registry.values();\n }\n\n /**\n * Return an iterator over registered labels (keys).\n *\n * @returns IterableIterator of `string` labels.\n */\n keys(): IterableIterator<string> {\n return this._registry.keys();\n }\n\n /**\n * Execute a provided function once per registry entry.\n *\n * @param callback - Function invoked with `(ctor, label)` for each entry.\n * @param thisArg - Optional `this` context for the callback.\n */\n forEach(\n callback: (ctor: ISigil | null, label: string) => void,\n thisArg?: any\n ): void {\n this._registry.forEach((ctor, label) =>\n callback.call(thisArg, ctor, label)\n );\n }\n\n /**\n * Get the size (number of entries) of the active registry.\n *\n * @returns The number of registered labels, or 0 when registry is disabled.\n */\n get size(): number {\n return this._registry.size;\n }\n\n /**\n * Return an iterator over `[label, constructor]` pairs.\n *\n * This makes the registry compatible with `for..of` and other iterable helpers:\n * ```ts\n * for (const [label, ctor] of registry) { ... }\n * ```\n *\n * @returns An iterable iterator that yields `[label, ISigil]` tuples.\n */\n [Symbol.iterator](): IterableIterator<[string, ISigil | null]> {\n return this._registry[Symbol.iterator]();\n }\n}\n\n/**\n * Returns the currently configured SigilRegistry instance (or `null` if no registry is active).\n *\n * IMPORTANT: this function reflects the live `OPTIONS.registry` value and therefore\n * will reflect any changes made via `updateOptions(...)`. Consumers that need a stable\n * registry instance for mutation should call this function each time rather than\n * holding a long-lived reference to the previously returned object.\n *\n * It gets global registry if defined, otherwise returns registry stored in SigilOptions.\n *\n * @returns {SigilRegistry | null} The active registry or `null` when no registry is in use.\n */\nexport const getActiveRegistry = (): SigilRegistry | null => {\n const globalRegistry = getGlobalRegistry();\n if (globalRegistry) return globalRegistry;\n return OPTIONS.registry;\n};\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Old 'REGISTRY' alias to interact with registy.\n *\n * 'REGISTRY' is a live binding for compat; prefer getActiveRegistry() to avoid manual sync.\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n */\nlet REGISTRY = OPTIONS.registry!;\n\n/** -----------------------------------------\n * Label validation\n * ----------------------------------------- */\n\n/**\n * Label validation regex. Labels must follow the pattern\n * `@scope/package.ClassName` where `ClassName` begins with an uppercase\n * letter. This avoids collisions across packages and helps debugging.\n *\n * It's advised to use this regex in 'SigilOptions.labelValidation'.\n */\nexport const DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** -----------------------------------------\n * Deprecated registry\n * ----------------------------------------- */\n\n/**\n * Update runtime options for the Sigil library.\n * Call this early during application startup if you want non-default behavior.\n *\n * Example:\n * ```ts\n * updateOptions({ autofillLabels: true, labelValidation: /^@[\\w-]+\\/[\\w-]+\\.[A-Za-z0-9]+$/ });\n * ```\n *\n * @param opts - Partial options to merge into the global `OPTIONS` object.\n * @param mergeRegistries - Boolean to merge old registry into new one directly, default is 'true'.\n */\nexport const updateOptions = (\n opts: SigilOptions,\n mergeRegistries: boolean = true\n): void => {\n // apply side effects\n applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);\n // update options\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\n // apply side effects\n applyAfterSideEffects(OPTIONS);\n};\n\n/**\n * Function to apply side effects before options update.\n *\n * @param oldOpts - Old options object.\n * @param newOpts - New options object\n */\nfunction applyBeforeSideEffects(\n oldOpts: Required<SigilOptions>,\n newOpts: SigilOptions,\n mergeRegistries: boolean\n): void {\n if (mergeRegistries && newOpts.registry && oldOpts.registry)\n newOpts.registry.merge(oldOpts.registry);\n}\n\n/**\n * Function to apply side effects after options update.\n *\n * @param opts - New options object.\n */\nfunction applyAfterSideEffects(opts: Required<SigilOptions>): void {\n if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);\n else updateGlobalRegistry(null);\n\n // DEPRECATED: support for 'REGISTRY', remove in v2.0.0\n if (OPTIONS.registry) REGISTRY = OPTIONS.registry;\n else REGISTRY = new SigilRegistry();\n}\n\n/**\n * Default runtime options used by the Sigil library.\n *\n * @internal\n */\nconst DEFAULT_OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n skipLabelInheritanceCheck: false,\n autofillLabels: false,\n devMarker: process.env.NODE_ENV !== 'production',\n registry: new SigilRegistry(),\n useGlobalRegistry: true,\n storeConstructor: true,\n};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\n\n// DEPRECATED: support for 'REGISTRY', remove in v2.0.0\nexport { REGISTRY };\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * Uses `Symbol.for()` so the symbol is stable across multiple bundles/realms\n * that share the same global symbol registry.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@Sigil.__SIGIL__');\n\n/**\n * Symbol to uniquely identify the base of sigil classes.\n *\n * When attached to a constructor it indicates that the constructor is a\n * sigil base and should be treated specially by inheritance checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL_BASE__ = Symbol.for('@Sigil.__SIGIL_BASE__');\n\n/**\n * Symbol to mark constructors that were explicitly decorated with `WithSigil()`.\n *\n * This differs from `__SIGIL__` in that `__DECORATED__` indicates explicit\n * decoration (as opposed to automatically assigned labels).\n *\n * @internal\n * @constant {symbol}\n */\nexport const __DECORATED__ = Symbol.for('@Sigil.__DECORATED__');\n\n/**\n * Symbol to mark that inheritance checks for a given constructor have been completed.\n *\n * This is used to avoid repeated DEV-time validation on subsequent instance creations.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __INHERITANCE_CHECKED__ = Symbol.for(\n '@Sigil.__INHERITANCE_CHECKED__'\n);\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL__ = Symbol.for('@Sigil.__LABEL__');\n\n/**\n * Symbol used to store the linearized label lineage for a sigil constructor.\n *\n * This is an array of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_LINEAGE__ = Symbol.for('@Sigil.__LABEL_LINEAGE__');\n\n/**\n * Symbol used to store the set of labels for a sigil constructor.\n *\n * This is a `Set<string>` that mirrors `__LABEL_LINEAGE__` for fast membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LABEL_SET__ = Symbol.for('@Sigil.__LABEL_SET__');\n\n/**\n * Symbol used to store the runtime type symbol for a sigil constructor.\n *\n * This symbol (usually created via `Symbol.for(label)`) is the canonical runtime\n * identifier used by `isOfType` checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE__ = Symbol.for('@Sigil.__TYPE__');\n\n/**\n * Symbol used to store the linearized sigil type symbol chain for a constructor.\n *\n * The value stored is an array of `symbol`s representing parent → child type symbols,\n * useful for strict lineage comparisons.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_LINEAGE__ = Symbol.for('@Sigil.__TYPE_LINEAGE__');\n\n/**\n * Symbol used to store the sigil type symbol set for a constructor.\n *\n * The value stored is a `Set<symbol>` built from `__TYPE_LINEAGE__` for O(1) membership checks.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __TYPE_SET__ = Symbol.for('@Sigil.__TYPE_SET__');\n","import { OPTIONS, getActiveRegistry } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __TYPE_LINEAGE__,\n __TYPE_SET__,\n __TYPE__,\n} from './symbols';\nimport type { ISigil, SigilOptions } from './types';\n\n/** -----------------------------------------\n * High level helpers\n * ----------------------------------------- */\n\n/**\n * Attach sigil-related statics to a constructor and register its label.\n *\n * Side effects:\n * - Registers `label` in the global registry via `REGISTRY.register(label)`.\n * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__TYPE__` (Symbol.for(label))\n * - `__TYPE_LINEAGE__` (array of symbols)\n * - `__TYPE_SET__` (Set of symbols)\n * - Marks the constructor as decorated via `markDecorated`.\n *\n * Throws if the constructor is already decorated.\n *\n * @internal\n * @param ctor - The constructor to decorate.\n * @param label - The identity label to register and attach (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @throws Error when `ctor` is already decorated.\n */\nexport function decorateCtor(\n ctor: Function,\n label: string,\n opts?: Pick<SigilOptions, 'devMarker' | 'storeConstructor'>,\n isMixin: boolean = false\n) {\n // if already decorated throw error\n if (isDecorated(ctor))\n throw new Error(\n `Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`\n );\n\n // get symbol for the label and update registry\n const symbol = Symbol.for(label);\n getActiveRegistry()?.register(label, ctor as ISigil, opts);\n\n // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE__, {\n value: symbol,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // get parent chain (safe if parent hasn't been augmented yet — uses existing value or empty)\n const parent = Object.getPrototypeOf(ctor);\n const parentChain =\n parent && parent[__TYPE_LINEAGE__] ? parent[__TYPE_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' //\n ? [Symbol.for('Sigil'), ...parentChain, symbol]\n : [...parentChain, symbol];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __TYPE_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __TYPE_SET__, {\n value: new Set(ctorChain),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n\n // mark as decorated\n markDecorated(ctor);\n}\n\n/**\n * Perform development-only inheritance checks to ensure no ancestor classes\n * reuse the same sigil label.\n *\n * Behavior:\n * - No-op if `ctor` is not a sigil constructor.\n * - No-op in non-DEV builds.\n * - No-op if inheritance checks were already performed or `OPTIONS.skipLabelInheritanceCheck` is true.\n *\n * When a duplicate label is detected:\n * - If the class is explicitly decorated (`isDecorated`) or `OPTIONS.autofillLabels` is false,\n * an Error is thrown describing the label collision.\n * - Otherwise (autofill enabled), a random label will be generated and assigned\n * to the offending constructor via `decorateCtor`.\n *\n * @internal\n * @param ctor - The constructor to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws Error when a decorated subclass re-uses an ancestor's sigil label.\n */\nexport function checkInheritance(\n ctor: Function,\n opts?: Pick<\n SigilOptions,\n | 'skipLabelInheritanceCheck'\n | 'autofillLabels'\n | 'devMarker'\n | 'storeConstructor'\n >\n) {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!devMarker) return;\n if (!isSigilCtor(ctor)) return;\n if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;\n\n /** Array of all sigil constructors in the chain (starting with the provided ctor) */\n const ctors: ISigil[] = [ctor];\n\n // go through prototype chain to get all sigil ancestors\n let ancestor: any = Object.getPrototypeOf(ctor);\n while (isSigilCtor(ancestor)) {\n ctors.push(ancestor);\n ancestor = Object.getPrototypeOf(ancestor);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop ctors from base to current and make sure no label is reused\n for (let i = ctors.length - 1; i >= 0; i--) {\n const ctor = ctors[i];\n if (!ctor) continue;\n let label = ctor.SigilLabel;\n if (labelOwner.has(label)) {\n if (isDecorated(ctor) || !autofillLabels) {\n const ancestorName = labelOwner.get(label);\n throw new Error(\n `[Sigil Error] Class \"${ctor.name}\" re-uses Sigil label \"${label}\" from ancestor \"${ancestorName}\". ` +\n `Each Sigil subclass must use a unique label. Did you forget to use \"WithSigil(newLabel)\" on the subclass?`\n );\n }\n label = generateRandomLabel();\n decorateCtor(ctor, label, opts);\n }\n labelOwner.set(label, ctor.name);\n }\n markInheritanceChecked(ctor);\n}\n\n/**\n * Validate a sigil label at runtime and throw a helpful error if it is malformed.\n *\n * This is intentionally `void` and runs synchronously at class declaration time so\n * invalid labels fail fast during development. Validation behavior follows `OPTIONS.labelValidation`:\n * - If `OPTIONS.labelValidation` is `null` no validation is performed.\n * - If it is a `RegExp`, the label must match the regex.\n * - If it is a function, the function must return `true` for the label to be considered valid.\n *\n * @internal\n * @typeParam L - Label string literal type.\n * @param label - The label to validate.\n * @param opts - Options object to override any global options if needed.\n * @throws {Error} Throws when the label does not pass configured validation.\n */\nexport function verifyLabel<L extends string>(\n label: L,\n opts?: Pick<SigilOptions, 'labelValidation'>\n): void {\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n\n if (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (!valid)\n throw new Error(\n `[Sigil] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function.`\n );\n }\n}\n\n/**\n * Generate a random alphanumeric label of the requested length.\n *\n * This is used to auto-generate labels when `OPTIONS.autofillLabels` is enabled.\n * It insures that generated label is not registered yet.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random label.\n */\nexport function generateRandomLabel(length = 16): string {\n let label = generateRandomString(length);\n const registry = getActiveRegistry();\n if (registry) while (registry.has(label)) label = generateRandomLabel();\n return `@Sigil.auto-${label}`;\n}\n\n/** -----------------------------------------\n * Introspection helpers\n * ----------------------------------------- */\n\n/**\n * Mark a constructor as a sigil constructor by attaching an internal symbol.\n *\n * This function defines a non-enumerable, non-writable, non-configurable\n * property on the constructor so subsequent checks can detect sigil\n * constructors.\n *\n * @internal\n * @param ctor - The constructor to mark.\n */\nexport function markSigil(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as a \"sigil base\" constructor.\n *\n * A sigil base constructor indicates that the class is the base for\n * other sigil classes. This writes a stable, non-enumerable property\n * to the constructor.\n *\n * @internal\n * @param ctor - The constructor to mark as sigil base.\n */\nexport function markSigilBase(ctor: Function) {\n Object.defineProperty(ctor, __SIGIL_BASE__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark a constructor as having been decorated with `WithSigil`.\n *\n * This is used to detect classes that were explicitly decorated rather\n * than auto-filled by the library.\n *\n * @internal\n * @param ctor - The constructor that was decorated.\n */\nexport function markDecorated(ctor: Function) {\n Object.defineProperty(ctor, __DECORATED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Mark that inheritance checks for this constructor have already been performed.\n *\n * The library uses this to avoid repeating expensive inheritance validation\n * during development.\n *\n * @internal\n * @param ctor - The constructor that has been checked.\n */\nexport function markInheritanceChecked(ctor: Function) {\n Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n}\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil constructor.\n *\n * This is a lightweight check that verifies the presence of an internal\n * symbol attached to the constructor.\n *\n * @param ctor - Constructor to test.\n * @returns `true` if `value` is a sigil constructor, otherwise `false`.\n */\nexport function isSigilCtor(ctor: unknown): ctor is ISigil {\n return typeof ctor === 'function' && (ctor as any)[__SIGIL__] === true;\n}\n\n/**\n * Runtime predicate that checks whether the provided object is an instance\n * of a sigil class.\n *\n * @param inst - The instanca to test.\n * @returns `true` if `obj` is an instance produced by a sigil constructor.\n */\nexport function isSigilInstance(inst: unknown): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilCtor(ctor);\n}\n\n/**\n * Check whether the provided constructor was marked as a sigil base constructor.\n *\n * Uses `Object.hasOwn` to ensure we only check own properties.\n *\n * @param ctor - Constructor to check.\n * @returns `true` if `ctor` is a sigil base constructor.\n */\nexport function isSigilBaseCtor(ctor: Function): ctor is ISigil {\n return Object.hasOwn(ctor, __SIGIL_BASE__);\n}\n\n/**\n * Check whether the provided object is an instance of a sigil base constructor.\n *\n * This resolves the instance's constructor and delegates to `isSigilBaseCtor`.\n *\n * @param inst - The instance to test.\n * @returns `true` if `inst` is an instance of a sigil base constructor.\n */\nexport function isSigilBaseInstance(\n inst: unknown\n): inst is InstanceType<ISigil> {\n if (!inst || typeof inst !== 'object') return false;\n const ctor = getConstructor(inst);\n return isSigilBaseCtor(ctor);\n}\n\n/**\n * Returns whether the constructor has been explicitly decorated with `WithSigil`.\n *\n * This is an own-property check and does not traverse the prototype chain.\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if the constructor is explicitly decorated.\n */\nexport function isDecorated(ctor: Function): boolean {\n return Object.hasOwn(ctor, __DECORATED__);\n}\n\n/**\n * Returns whether inheritance checks have already been performed for the constructor.\n *\n * This is used to avoid repeated checks during development (DEV-only checks).\n *\n * @internal\n * @param ctor - Constructor to test.\n * @returns `true` if inheritance checks were marked as completed.\n */\nexport function isInheritanceChecked(ctor: Function): boolean {\n return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\n/**\n * Retrieve the constructor function for a given instance.\n *\n * Returns `null` for non-objects or when a constructor cannot be resolved.\n *\n * @internal\n * @param obj - The value that may be an instance whose constructor should be returned.\n * @returns The constructor function or `null` if not available.\n */\nexport function getConstructor(obj: any) {\n if (!obj || typeof obj !== 'object') return null;\n return obj.constructor ?? Object.getPrototypeOf(obj)?.constructor ?? null;\n}\n\n/**\n * Generate a random alphanumeric string of the requested length.\n *\n * @internal\n * @param length - Desired length of the generated string (defaults to 16).\n * @returns A random string consisting of upper/lower letters and digits.\n */\nfunction generateRandomString(length = 16) {\n const chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n\n return result;\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport { __LABEL__, __TYPE__, __TYPE_LINEAGE__, __TYPE_SET__ } from './symbols';\nimport type {\n Constructor,\n ISigil,\n SigilOptions,\n Prettify,\n GetInstance,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. The returned class:\n * - registers a stable symbol for the provided `label` (via `WithSigil`)\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\n *\n * Notes:\n * - Uses `Symbol.for(label)` internally so symbols are stable across bundles/realms\n * that share the global symbol registry.\n * - Throws if `Base` is already a sigil constructor.\n *\n * @param Base - The base constructor to extend.\n * @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilized.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base))\n throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // extend actual class\n class Sigilified extends Base {\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare static readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n /**\n * Class-level human-readable label constant for this sigil constructor.\n */\n static get SigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Class-level unique runtime symbol used as the type identifier.\n *\n * This symbol is created with `Symbol.for(label)` during decoration so it is\n * stable across realms that share the same global symbol registry.\n */\n static get SigilType(): symbol {\n return (this as any)[__TYPE__];\n }\n\n /**\n * Copy of the linearized sigil type symbol chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of symbols representing parent → child type symbols.\n */\n static get SigilTypeLineage(): readonly symbol[] {\n return [...((this as any)[__TYPE_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type symbol set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of symbols that represent the type lineage.\n */\n static get SigilTypeSet(): Readonly<Set<symbol>> {\n const set: Set<symbol> = new Set();\n for (const s of (this as any)[__TYPE_SET__]) set.add(s);\n return set;\n }\n\n /**\n * Compile-time nominal brand that encodes the class label `L` plus parent's brand keys `BrandOf<P>`.\n *\n * - HAVE NO RUN-TIME VALUE (undefined)\n * - Provides a *type-only* unique marker that makes instances nominally\n * distinct by label and allows propagation/merging of brand keys across inheritance.\n */\n declare readonly __SIGIL_BRAND__: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n\n // Correct prototype chain when necessary (defensive for transpiled code / edge cases)\n if (Object.getPrototypeOf(this) !== new.target.prototype)\n Object.setPrototypeOf(this, new.target.prototype);\n\n // Resolve constructor; defensive null-check helps catch weird runtime cases.\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n checkInheritance(ctor);\n }\n\n /**\n * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigil {\n return isSigilInstance(obj);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type represented by the calling constructor.\n *\n * Implementation detail:\n * - Uses the other instance's `__TYPE_SET__` for O(1) membership test.\n * - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The calling constructor type (narrowing the returned instance type).\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is an instance of this type or a subtype.\n */\n static isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherSet = otherCtor[__TYPE_SET__] as Set<symbol> | undefined;\n return !!otherSet && otherSet.has((this as any).SigilType);\n }\n\n /**\n * Strict lineage check: compares the type symbol lineage arrays element-by-element.\n *\n * Implementation detail:\n * - Works in O(n) time where n is the depth of the lineage.\n * - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.\n *\n * @typeParam T - The calling constructor type.\n * @param this - The constructor performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.\n */\n static isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n\n const otherCtor = getConstructor(other);\n if (!otherCtor) return false;\n const otherLineage = otherCtor[__TYPE_LINEAGE__] as readonly symbol[];\n const thisLineage = (this as any)[__TYPE_LINEAGE__] as readonly symbol[];\n return (\n !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i])\n );\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.\n */\n getSigilLabel(): string {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns the runtime sigil type symbol of this instance's constructor.\n *\n * @returns The symbol that identifies this type at runtime.\n */\n getSigilType(): symbol {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return Symbol.for('@Sigil.unknown');\n }\n return ctor.SigilType;\n }\n\n /**\n * Returns a copy of the sigil type symbol lineage for this instance's constructor.\n *\n * @returns readonly array of symbols representing the type lineage.\n */\n getSigilTypeLineage(): readonly symbol[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return [Symbol.for('@Sigil.unknown')];\n }\n return ctor.SigilTypeLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type symbol set for this instance's constructor.\n *\n * @returns A Readonly Set of symbols representing the type lineage for O(1) membership tests.\n */\n getSigilTypeSet(): Readonly<Set<symbol>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(\n `[Sigil Error] 'Sigilify(${label})' instance without constructor`\n );\n return new Set([Symbol.for('@Sigil.unknown')]);\n }\n return ctor.SigilTypeSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(Sigilified, l, opts, true);\n\n // Mark the returned constructor as sigil (runtime flag) and as a base.\n markSigil(Sigilified);\n markSigilBase(Sigilified);\n\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\n\n/**\n * A minimal root Sigil class used by the library as a base identity.\n *\n * This is produced by `Sigilify` and can serve as a basic sentinel/base\n * class for other sigil classes or for debugging/inspection.\n */\nexport const Sigil = Sigilify(class {}, 'Sigil');\nexport type Sigil = InstanceType<typeof Sigil>;\n\n/**\n * A sigil variant of the built-in `Error` constructor used by the library\n * to represent Sigil-specific errors.\n *\n * Use `SigilError` when you want an Error type that is identifiable via sigil\n * runtime checks (e.g. `SigilError.isOfType(someError)`).\n */\nexport const SigilError = Sigilify(Error, 'SigilError');\nexport type SigilError = InstanceType<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './types';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * Usage:\n * ```ts\n * @WithSigil('@myorg/mypkg.MyClass')\n * class MyClass { ... }\n * ```\n *\n * The returned decorator:\n * - validates the provided label (via `verifyLabel`)\n * - performs inheritance checks (via `checkInheritance`) in DEV builds\n * - attaches sigil-related statics to the constructor (via `decorateCtor`)\n *\n * Notes:\n * - This decorator is intended to be applied to classes only. When used\n * incorrectly (e.g. on a property), it is a no-op.\n * - Throws an error during class creation if the label validation fails.\n *\n * @typeParam L - Narrow string literal type for the provided label.\n * @param label - Optional sigil label to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A class decorator compatible with the ECMAScript decorator context.\n */\nexport function WithSigil<L extends string>(label?: L, opts?: SigilOptions) {\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n return function (value: Function, context: any) {\n // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n // Attach sigil metadata to constructor (registers label, sets symbols, marks decorated)\n decorateCtor(value, l, opts);\n // Development-only inheritance checks and potential autofill\n checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS } from './options';\nimport type { TypedSigil, SigilOptions } from './types';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to enhance.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured.\n */\nexport function withSigil<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class;\n}\n\n/**\n * Narrow a constructor to a compile-time `TypedSigil` without modifying runtime.\n *\n * This is a *purely type-level* helper (no runtime changes). It optionally\n * verifies in DEV that the runtime `SigilLabel` matches the provided `label`.\n *\n * Use this when the runtime metadata is already present (for example the class\n * is already decorated or was created via `Sigilify`).\n *\n * @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to associate at compile-time.\n * @param Class - The constructor to assert as typed sigil.\n * @param label - Optional label literal to assert at compile-time (and to verify in DEV).\n * @returns The same constructor value, typed as `TypedSigil<S, L, P>`.\n */\nexport function typed<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: Pick<SigilOptions, 'devMarker'>\n): TypedSigil<S, L> {\n const devMarker = opts?.devMarker ?? OPTIONS.devMarker;\n\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n if (devMarker && label) {\n const runtimeLabel = Class.SigilLabel;\n if (runtimeLabel && runtimeLabel !== label)\n throw new Error(\n `[Sigil Error][typed] runtime label \"${runtimeLabel}\" does not match asserted label \"${label}\".`\n );\n }\n return Class as unknown as TypedSigil<S, L>;\n}\n\n/**\n * Convenience helper that combine 'withSigil' and 'typeSigil'.\n *\n * This does both:\n * - validate (and autofill) a label,\n * - perform runtime decoration (via `decorateCtor`),\n * - return the constructor typed as `TypedSigil`.\n *\n * The helper is idempotent: `decorateCtor` will register the label and throw if already\n * decorated; we handle this gracefully in DEV to support HMR flows.\n *\n * @typeParam S - Constructor type (should be an ISigil).\n * @typeParam L - Label literal to attach.\n * @param Class - The constructor (class) to decorate and type.\n * @param label - Optional label string. If omitted, a random label is generated.\n * @param parent - Optional parent sigil constructor (type-only).\n * @param opts - Options object to override any global options if needed.\n * @returns The same constructor value, with runtime metadata ensured and typed as `TypedSigil<S,L,P>`.\n */\nexport function withSigilTyped<S extends Function, L extends string = string>(\n Class: S,\n label?: L,\n opts?: SigilOptions\n): TypedSigil<S, L> {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${Class?.name ?? 'unknown'}`\n );\n\n // generate random label if not passed and verify it\n let l: string;\n if (label) {\n verifyLabel(label, opts);\n l = label;\n } else l = generateRandomLabel();\n\n // decorate and check inheritance.\n const ctor = Class;\n decorateCtor(ctor, l, opts);\n checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}
|