@vicin/sigil 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,8 +6,7 @@ var cuid2 = require('@paralleldrive/cuid2');
6
6
  var OPTIONS = {
7
7
  labelValidation: null,
8
8
  skipLabelInheritanceCheck: false,
9
- autofillLabels: false,
10
- devMarker: false
9
+ autofillLabels: false
11
10
  };
12
11
  var updateOptions = (opts) => {
13
12
  for (const [k, v] of Object.entries(opts)) OPTIONS[k] = v;
@@ -15,8 +14,7 @@ var updateOptions = (opts) => {
15
14
  var DEFAULT_OPTIONS = {
16
15
  labelValidation: null,
17
16
  skipLabelInheritanceCheck: false,
18
- autofillLabels: false,
19
- devMarker: process.env.NODE_ENV !== "production"
17
+ autofillLabels: false
20
18
  };
21
19
  updateOptions(DEFAULT_OPTIONS);
22
20
  var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
@@ -29,6 +27,11 @@ var __INHERITANCE_CHECKED__ = /* @__PURE__ */ Symbol.for("@Sigil.__INHERITANCE_C
29
27
  var __LABEL__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL__");
30
28
  var __LABEL_LINEAGE__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_LINEAGE__");
31
29
  var __LABEL_SET__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_SET__");
30
+
31
+ // src/core/constants.ts
32
+ var __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV === "development";
33
+
34
+ // src/core/helpers.ts
32
35
  function decorateCtor(ctor, label, isMixin = false) {
33
36
  if (isDecorated(ctor))
34
37
  throw new Error(
@@ -58,11 +61,9 @@ function decorateCtor(ctor, label, isMixin = false) {
58
61
  markDecorated(ctor);
59
62
  }
60
63
  function checkInheritance(ctor, opts) {
61
- var _a, _b, _c;
62
- const devMarker = (_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker;
63
- const skipLabelInheritanceCheck = (_b = opts == null ? void 0 : opts.skipLabelInheritanceCheck) != null ? _b : OPTIONS.skipLabelInheritanceCheck;
64
- const autofillLabels = (_c = opts == null ? void 0 : opts.autofillLabels) != null ? _c : OPTIONS.autofillLabels;
65
- if (!devMarker) return;
64
+ var _a, _b;
65
+ const skipLabelInheritanceCheck = (_a = opts == null ? void 0 : opts.skipLabelInheritanceCheck) != null ? _a : OPTIONS.skipLabelInheritanceCheck;
66
+ const autofillLabels = (_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels;
66
67
  if (!isSigilCtor(ctor)) return;
67
68
  if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;
68
69
  const ctors = [ctor];
@@ -206,17 +207,16 @@ function Sigilify(Base, label, opts) {
206
207
  return set;
207
208
  }
208
209
  constructor(...args) {
209
- var _a;
210
210
  super(...args);
211
211
  if (Object.getPrototypeOf(this) !== new.target.prototype)
212
212
  Object.setPrototypeOf(this, new.target.prototype);
213
213
  const ctor = getConstructor(this);
214
214
  if (!ctor) {
215
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
215
+ if (__DEV__)
216
216
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
217
217
  return;
218
218
  }
219
- checkInheritance(ctor);
219
+ if (__DEV__) checkInheritance(ctor);
220
220
  }
221
221
  /**
222
222
  * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
@@ -300,10 +300,9 @@ function Sigilify(Base, label, opts) {
300
300
  * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
301
301
  */
302
302
  getSigilLabel() {
303
- var _a;
304
303
  const ctor = getConstructor(this);
305
304
  if (!ctor) {
306
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
305
+ if (__DEV__)
307
306
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
308
307
  return "@Sigil.unknown";
309
308
  }
@@ -315,10 +314,9 @@ function Sigilify(Base, label, opts) {
315
314
  * @returns readonly array of labels representing the type lineage.
316
315
  */
317
316
  getSigilLabelLineage() {
318
- var _a;
319
317
  const ctor = getConstructor(this);
320
318
  if (!ctor) {
321
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
319
+ if (__DEV__)
322
320
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
323
321
  return ["@Sigil.unknown"];
324
322
  }
@@ -330,10 +328,9 @@ function Sigilify(Base, label, opts) {
330
328
  * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
331
329
  */
332
330
  getSigilLabelSet() {
333
- var _a;
334
331
  const ctor = getConstructor(this);
335
332
  if (!ctor) {
336
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
333
+ if (__DEV__)
337
334
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
338
335
  return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
339
336
  }
@@ -383,17 +380,16 @@ function SigilifyAbstract(Base, label, opts) {
383
380
  return set;
384
381
  }
385
382
  constructor(...args) {
386
- var _a;
387
383
  super(...args);
388
384
  if (Object.getPrototypeOf(this) !== new.target.prototype)
389
385
  Object.setPrototypeOf(this, new.target.prototype);
390
386
  const ctor = getConstructor(this);
391
387
  if (!ctor) {
392
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
388
+ if (__DEV__)
393
389
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
394
390
  return;
395
391
  }
396
- checkInheritance(ctor);
392
+ if (__DEV__) checkInheritance(ctor);
397
393
  }
398
394
  /**
399
395
  * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
@@ -485,10 +481,9 @@ function SigilifyAbstract(Base, label, opts) {
485
481
  * @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
486
482
  */
487
483
  getSigilLabel() {
488
- var _a;
489
484
  const ctor = getConstructor(this);
490
485
  if (!ctor) {
491
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
486
+ if (__DEV__)
492
487
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
493
488
  return "@Sigil.unknown";
494
489
  }
@@ -500,10 +495,9 @@ function SigilifyAbstract(Base, label, opts) {
500
495
  * @returns readonly array of labels representing the type lineage.
501
496
  */
502
497
  getSigilLabelLineage() {
503
- var _a;
504
498
  const ctor = getConstructor(this);
505
499
  if (!ctor) {
506
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
500
+ if (__DEV__)
507
501
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
508
502
  return ["@Sigil.unknown"];
509
503
  }
@@ -515,10 +509,9 @@ function SigilifyAbstract(Base, label, opts) {
515
509
  * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
516
510
  */
517
511
  getSigilLabelSet() {
518
- var _a;
519
512
  const ctor = getConstructor(this);
520
513
  if (!ctor) {
521
- if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
514
+ if (__DEV__)
522
515
  throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
523
516
  return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
524
517
  }
@@ -550,7 +543,7 @@ function WithSigil(label, opts) {
550
543
  `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`
551
544
  );
552
545
  decorateCtor(value, l);
553
- checkInheritance(value, opts);
546
+ if (__DEV__) checkInheritance(value, opts);
554
547
  };
555
548
  }
556
549
 
@@ -568,7 +561,7 @@ function withSigil(Class, label, opts) {
568
561
  } else l = generateRandomLabel();
569
562
  const ctor = Class;
570
563
  decorateCtor(ctor, l);
571
- checkInheritance(ctor, opts);
564
+ if (__DEV__) checkInheritance(ctor, opts);
572
565
  return Class;
573
566
  }
574
567
  function withSigilTyped(Class, label, opts) {
@@ -584,7 +577,7 @@ function withSigilTyped(Class, label, opts) {
584
577
  } else l = generateRandomLabel();
585
578
  const ctor = Class;
586
579
  decorateCtor(ctor, l);
587
- checkInheritance(ctor, opts);
580
+ if (__DEV__) checkInheritance(ctor, opts);
588
581
  return Class;
589
582
  }
590
583
 
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":["ctor","createId"],"mappings":";;;;;AA2DO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB,KAAA;AAAA,EAChB,SAAA,EAAW;AACb,CAAA;AAQO,IAAM,aAAA,GAAgB,CAAC,IAAA,KAA6B;AACzD,EAAA,KAAA,MAAW,CAAC,CAAA,EAAG,CAAC,CAAA,IAAK,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAA,EAAI,OAAA,CAAgB,CAAC,CAAA,GAAI,CAAA;AACnE;AAOA,IAAM,eAAA,GAA0C;AAAA,EAC9C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB,KAAA;AAAA,EAChB,SAAA,EAAW,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa;AACtC,CAAA;AAGA,aAAA,CAAc,eAAe,CAAA;AAatB,IAAM,mBAAA,GAAsB;;;AC7F5B,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,kBAAkB,CAAA;AAW/C,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,uBAAuB,CAAA;AAWzD,IAAM,aAAA,mBAAgB,MAAA,CAAO,GAAA,CAAI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,EACA,KAAA,EACA,IAAA,EACkB;AA5EpB,EAAA,IAAA,EAAA;AA6EE,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,MAAM,CAAC,CAAA;AACpB,EAAA,gBAAA,CAAiB,MAAM,IAAI,CAAA;AAE3B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n\n /**\n * Skips the runtime check that prevents subclasses from inheriting\n * the same sigil label as their ancestors.\n *\n * When `false` (default), extending a sigil class without\n * using `WithSigil(newLabel)` decorator will throw an error if the label\n * is reused and `OPTIONS.autofillLabels` is set to `false`.\n *\n * Set this to `true` only if you intentionally want subclasses to inherit labels\n * from their ancestors (this weakens the uniqueness guarantees).\n *\n * WARNING:\n * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for\n * each class and allow multiple child classes to use the same label which can\n * result on false 'isOfType' result. this options should be used in debugging\n * only to silence all errors but never in production.\n */\n skipLabelInheritanceCheck?: boolean;\n\n /**\n * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label\n * will be assigned an autogenerated random label (so that explicit labels stay unique).\n */\n autofillLabels?: boolean;\n\n /**\n * Marker used internally to control dev only checks to optimize performace while preserving\n * consistency for things like inheritance checks.\n * defaults to 'process.env.NODE_ENV !== \"production'.\n */\n devMarker?: boolean;\n}\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};\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 * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateOptions = (opts: SigilOptions): void => {\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\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};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\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 * 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('@Sigil.__INHERITANCE_CHECKED__');\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","import { OPTIONS, type SigilOptions } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __LABEL_LINEAGE__,\n __LABEL_SET__,\n} from './symbols';\nimport type { ISigil } from './types';\nimport { createId } from '@paralleldrive/cuid2';\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 * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__LABEL_LINEAGE__` (array of strings)\n * - `__LABEL_SET__` (Set of strings)\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(ctor: Function, label: string, isMixin: boolean = false) {\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 // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\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 = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' ? ['Sigil', ...parentChain, label] : [...parentChain, label];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __LABEL_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __LABEL_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<SigilOptions, 'skipLabelInheritanceCheck' | 'autofillLabels' | 'devMarker'>\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);\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(): string {\n let label = createId();\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(inst: unknown): 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","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __LABEL_LINEAGE__, __LABEL_SET__ } from './symbols';\nimport type { Constructor, ISigil, Prettify, GetInstance, ConstructorAbstract } from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers.\n *\n * The returned class:\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\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)) 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 * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_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(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\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 * 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 const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\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 const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance 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 instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\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(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, 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\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. Accept and return 'abstract' class.\n *\n * The returned class:\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\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 SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base)) 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 abstract 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 * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_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(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\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 `__LABEL_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) || !isSigilCtor(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label 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) || !isSigilCtor(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance 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 instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\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(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (opts?.devMarker ?? OPTIONS.devMarker)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, 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 './options';\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);\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 type { SigilOptions } from './options';\nimport type { TypedSigil } 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);\n checkInheritance(ctor, opts);\n\n return Class;\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);\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/constants.ts","../src/core/helpers.ts","../src/core/mixin.ts","../src/core/classes.ts","../src/core/decorator.ts","../src/core/enhancers.ts"],"names":["ctor","createId"],"mappings":";;;;;AAoDO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB;AAClB,CAAA;AAQO,IAAM,aAAA,GAAgB,CAAC,IAAA,KAA6B;AACzD,EAAA,KAAA,MAAW,CAAC,CAAA,EAAG,CAAC,CAAA,IAAK,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAA,EAAI,OAAA,CAAgB,CAAC,CAAA,GAAI,CAAA;AACnE;AAOA,IAAM,eAAA,GAA0C;AAAA,EAC9C,eAAA,EAAiB,IAAA;AAAA,EACjB,yBAAA,EAA2B,KAAA;AAAA,EAC3B,cAAA,EAAgB;AAClB,CAAA;AAGA,aAAA,CAAc,eAAe,CAAA;AAatB,IAAM,mBAAA,GAAsB;;;ACpF5B,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,kBAAkB,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A;AACpB,EAAA,IAAI,OAAA,EAAS,gBAAA,CAAiB,IAAA,EAAM,IAAI,CAAA;AAExC,EAAA,OAAO,KAAA;AACT;AAqBO,SAAS,cAAA,CACd,KAAA,EACA,KAAA,EACA,IAAA,EACkB;AA7EpB,EAAA,IAAA,EAAA;AA8EE,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,MAAM,CAAC,CAAA;AACpB,EAAA,IAAI,OAAA,EAAS,gBAAA,CAAiB,IAAA,EAAM,IAAI,CAAA;AAExC,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/**\n * Configuration options for the Sigil library.\n *\n * These options control runtime validation, inheritance checks, label autofill behavior.\n */\nexport interface SigilOptions {\n /**\n * Validation rule applied to sigil labels before registration.\n *\n * - A function receives the label and must return `true` if valid.\n * - A `RegExp` must match the label.\n * - `null` disables validation entirely.\n *\n * Defaults to `null`.\n */\n labelValidation?: ((label: string) => boolean) | RegExp | null;\n\n /**\n * Skips the runtime check that prevents subclasses from inheriting\n * the same sigil label as their ancestors.\n *\n * When `false` (default), extending a sigil class without\n * using `WithSigil(newLabel)` decorator will throw an error if the label\n * is reused and `OPTIONS.autofillLabels` is set to `false`.\n *\n * Set this to `true` only if you intentionally want subclasses to inherit labels\n * from their ancestors (this weakens the uniqueness guarantees).\n *\n * WARNING:\n * Disabling inheritanceCheck removes guaranties by 'Sigil' or unique label for\n * each class and allow multiple child classes to use the same label which can\n * result on false 'isOfType' result. this options should be used in debugging\n * only to silence all errors but never in production.\n */\n skipLabelInheritanceCheck?: boolean;\n\n /**\n * When enabled, non-decorated subclasses that would otherwise inherit an ancestor's label\n * will be assigned an autogenerated random label (so that explicit labels stay unique).\n */\n autofillLabels?: boolean;\n}\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};\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 * @param opts - Partial options to merge into the global `OPTIONS` object.\n */\nexport const updateOptions = (opts: SigilOptions): void => {\n for (const [k, v] of Object.entries(opts)) (OPTIONS as any)[k] = v;\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};\n\n// populate 'OPTIONS' with DEFAULT_OPTIONS\nupdateOptions(DEFAULT_OPTIONS);\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 * 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('@Sigil.__INHERITANCE_CHECKED__');\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","export const __DEV__ = typeof process !== 'undefined' && process.env.NODE_ENV === 'development';\n","import { OPTIONS, type SigilOptions } from './options';\nimport {\n __DECORATED__,\n __INHERITANCE_CHECKED__,\n __LABEL__,\n __SIGIL_BASE__,\n __SIGIL__,\n __LABEL_LINEAGE__,\n __LABEL_SET__,\n} from './symbols';\nimport type { ISigil, GetInstance } from './types';\nimport { createId } from '@paralleldrive/cuid2';\nimport { __DEV__ } from './constants';\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 * - Defines non-enumerable statics on the constructor:\n * - `__LABEL__` (string)\n * - `__LABEL_LINEAGE__` (array of strings)\n * - `__LABEL_SET__` (Set of strings)\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(ctor: Function, label: string, isMixin: boolean = false) {\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 // attach basic runtime statics\n Object.defineProperty(ctor, __LABEL__, {\n value: label,\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 = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];\n\n // generate Ctor chain, if mixin (Sigilify function) then append 'Sigil' at the start\n const ctorChain =\n isMixin && label !== 'Sigil' ? ['Sigil', ...parentChain, label] : [...parentChain, label];\n\n // attach symbol lineage and set\n Object.defineProperty(ctor, __LABEL_LINEAGE__, {\n value: ctorChain,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor, __LABEL_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<SigilOptions, 'skipLabelInheritanceCheck' | 'autofillLabels'>\n) {\n const skipLabelInheritanceCheck =\n opts?.skipLabelInheritanceCheck ?? OPTIONS.skipLabelInheritanceCheck;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\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);\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(): string {\n let label = createId();\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 GetInstance<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(inst: unknown): inst is GetInstance<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","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n getConstructor,\n isSigilCtor,\n isSigilInstance,\n markSigil,\n markSigilBase,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __LABEL_LINEAGE__, __LABEL_SET__ } from './symbols';\nimport type { Constructor, ISigil, Prettify, GetInstance, ConstructorAbstract } from './types';\nimport { __DEV__ } from './constants';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers.\n *\n * The returned class:\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\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)) 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 * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_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 (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n if (__DEV__) 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 * 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 const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\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 const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance 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 instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\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 (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, 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\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and\n * helpers. Accept and return 'abstract' class.\n *\n * The returned class:\n * - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`\n * - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.\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 SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label?: L,\n opts?: SigilOptions\n) {\n // if siglified throw\n if (isSigilCtor(Base)) 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 abstract 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 * Copy of the linearized sigil type label chain for the current constructor.\n *\n * Useful for debugging and performing strict lineage comparisons.\n *\n * @returns An array of labels representing parent → child type labels.\n */\n static get SigilLabelLineage(): readonly string[] {\n return [...((this as any)[__LABEL_LINEAGE__] ?? [])];\n }\n\n /**\n * Copy of the sigil type label set for the current constructor.\n *\n * Useful for quick membership checks (O(1) lookups) and debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n const set: Set<string> = new Set();\n for (const s of (this as any)[__LABEL_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 (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return;\n }\n\n // Perform dev-only inheritance validation to ensure labels are unique across the chain.\n if (__DEV__) 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 `__LABEL_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) || !isSigilCtor(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = (this as any)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label 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) || !isSigilCtor(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = (this as any)[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\n }\n\n /**\n * Check whether `other` is (or inherits from) the type instance.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance performing the check.\n * @param other - The object to test.\n * @returns `true` if `other` is the same instance of this type or a subtype.\n */\n isOfType<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherSet = getConstructor(other)?.[__LABEL_SET__];\n const thisType = getConstructor(this)[__LABEL__];\n return !!otherSet && otherSet.has(thisType);\n }\n\n /**\n * Strict lineage check: compares the type label lineage arrays element-by-element.\n *\n * Allows 'instanceof' like checks but in instances.\n *\n * @typeParam T - The instance type.\n * @param this - The instance 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 instance's lineage.\n */\n isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T> {\n if (!isSigilInstance(other) || !isSigilInstance(this)) return false;\n const otherLineage = getConstructor(other)?.[__LABEL_LINEAGE__];\n const thisLineage = getConstructor(this)?.[__LABEL_LINEAGE__] as readonly string[];\n return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);\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 (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return '@Sigil.unknown';\n }\n return ctor.SigilLabel;\n }\n\n /**\n * Returns a copy of the sigil type label lineage for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelLineage(): readonly string[] {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return ['@Sigil.unknown'];\n }\n return ctor.SigilLabelLineage;\n }\n\n /**\n * Returns a readonly copy of the sigil type label set for this instance's constructor.\n *\n * @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n const ctor = getConstructor(this);\n if (!ctor) {\n if (__DEV__)\n throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);\n return new Set(['@Sigil.unknown']);\n }\n return ctor.SigilLabelSet;\n }\n }\n\n // Attach sigil metadata to constructor (registers label, sets labels, marks decorated)\n decorateCtor(Sigilified, l, 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';\nimport type { GetInstance } from './types';\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 = GetInstance<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 = GetInstance<typeof SigilError>;\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport { __DEV__ } from './constants';\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);\n // Development-only inheritance checks and potential autofill\n if (__DEV__) checkInheritance(value, opts);\n };\n}\n","import {\n checkInheritance,\n decorateCtor,\n generateRandomLabel,\n isSigilCtor,\n verifyLabel,\n} from './helpers';\nimport type { SigilOptions } from './options';\nimport type { TypedSigil } from './types';\nimport { __DEV__ } from './constants';\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);\n if (__DEV__) checkInheritance(ctor, opts);\n\n return Class;\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);\n if (__DEV__) checkInheritance(ctor, opts);\n\n return Class as unknown as TypedSigil<S, L>;\n}\n"]}