@vicin/sigil 3.2.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.3.0] - 2026-02-27
6
+
7
+ ### Changed
8
+
9
+ - Label registry now stores user defined labels only, and `getSigilLabels` has no `includeAuto` argument any more
10
+
11
+ ### Added
12
+
13
+ - Options `skipLabelUniquenessCheck` is added to avoid false-positive HMR throws
14
+
5
15
  ## [3.2.1] - 2026-02-27
6
16
 
7
17
  ### Changed
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Features
11
11
 
12
- - ✅ **Drop-in `instanceof` replacement** that works across bundles and monorepos, Also add check for **exact class instance**
12
+ - ✅ **Drop-in `instanceof` replacement** that works across bundles, HMR and monorepos, Also add check for **exact class instance**
13
13
  - ✅ **Simple nominal typing** with just one line of code for each class (e.g., `UserId` vs. `PostId`)
14
14
  - ✅ **Tiny less than 1.6 KB minified and brotlied** measured using [size-limit](https://www.npmjs.com/package/size-limit)
15
15
  - ✅ **Performant as native instanceof** but with guaranteed checks
@@ -36,6 +36,7 @@
36
36
  - [Options & configuration](#options--configuration)
37
37
  - [Minimal mode](#minimal-mode)
38
38
  - [Strict mode](#strict-mode)
39
+ - [Hot module reload](#hot-module-reload)
39
40
  - [Benchmarks](#benchmarks)
40
41
  - [Bundle Size](#bundle-size)
41
42
  - [Tests](#tests)
@@ -149,12 +150,12 @@ Congratulations — you’ve opted into `Sigil` and you can start replacing `ins
149
150
 
150
151
  ### Purpose and Origins
151
152
 
152
- Sigil addresses issues in large monorepos and Domain-Driven Design (DDD):
153
+ Sigil addresses issues in large monorepos, HMR:
153
154
 
154
155
  - **Unreliable `instanceof`:** Bundling cause class redefinitions, breaking checks.
155
156
 
156
157
  ```ts
157
- // Can be broken in monorepo
158
+ // Can be broken in monorepo or HMR set-ups
158
159
  if (obj instanceof User) { ... }
159
160
 
160
161
  // With Sigil
@@ -162,6 +163,8 @@ if (User.isOfType(obj)) { ... } // This still works even if User was bundled twi
162
163
  if (User.isExactType(obj)) { ... } // Or check for exactly same constructor not its children
163
164
  ```
164
165
 
166
+ Also by utilizing unique passed labels it solve another problem in Domain-Driven Design (DDD):
167
+
165
168
  - **Manual Branding Overhead:** Custom identifiers lead to boilerplate and maintenance issues, `Sigil` add reliable inheritance-aware nominal branding with just one line of code.
166
169
 
167
170
  ```ts
@@ -175,8 +178,6 @@ type test1 = User extends Sigil ? true : false; // true
175
178
  type test2 = Sigil extends User ? true : false; // false
176
179
  ```
177
180
 
178
- `Sigil` makes identity management **explicit** and **error-resistant** if defined the right way.
179
-
180
181
  ### Implementation Mechanics
181
182
 
182
183
  - **Runtime Contract:** Established via extending `Sigil` or using `Sigilify` mixin.
@@ -334,6 +335,7 @@ class X extends Sigil {} // Throws: '@Sigil-auto' is a prefex reserved by the li
334
335
  ```ts
335
336
  updateSigilOptions({ autofillLabels: {} as any }); // Throws: 'updateSigilOptions.autofillLabels' must be boolean
336
337
  updateSigilOptions({ labelValidation: 123 as any }); // Throws: 'updateSigilOptions.labelValidation' must be null, function or RegExp
338
+ updateSigilOptions({ skipLabelUniquenessCheck: 'str' as any }); // Throws: 'updateSigilOptions.skipLabelUniquenessCheck' must be boolean
337
339
  ```
338
340
 
339
341
  ---
@@ -359,7 +361,7 @@ updateSigilOptions({ labelValidation: 123 as any }); // Throws: 'updateSigilOpti
359
361
  - **Helpers:**
360
362
  - `isSigilCtor(ctor)`
361
363
  - `isSigilInstance(inst)`
362
- - `getSigilLabels(includeAuto?)`
364
+ - `getSigilLabels()`
363
365
 
364
366
  - **Options:**
365
367
  - `updateSigilOptions(opts)`
@@ -384,7 +386,7 @@ updateSigilOptions({ labelValidation: 123 as any }); // Throws: 'updateSigilOpti
384
386
  - `withSigil(Class, label, opts?)`: HOF that validates and decorates an existing class constructor.
385
387
  - `isSigilCtor(value)`: `true` if `value` is a `Sigil` constructor.
386
388
  - `isSigilInstance(value)`: `true` if `value` is an instance of a `Sigil` constructor.
387
- - `getSigilLabels(includeAuto?)`: Get all `Sigil` labels registered, can include auto-generated labels as well.
389
+ - `getSigilLabels()`: Get `Sigil` labels registered.
388
390
  - `updateSigilOptions(opts)`: change global runtime options of `Sigil` library (e.g., `autofillLabels`).
389
391
  - `RECOMMENDED_LABEL_REGEX`: regex that ensures structure of `@scope/package.ClassName` to all labels, it's advised to use it as your `SigilOptions.labelValidation`
390
392
 
@@ -420,6 +422,7 @@ import { updateSigilOptions } from '@vicin/sigil';
420
422
  updateSigilOptions({
421
423
  autofillLabels: true, // Automatically label unlabeled subclasses
422
424
  labelValidation: null, // Function or regex, Enforce label format
425
+ skipLabelUniquenessCheck: false, // Skip uniqueness check for labels, should be used in HMR set-ups only
423
426
  });
424
427
  ```
425
428
 
@@ -429,7 +432,7 @@ Values defined in previous example are defaults, per-class overrides available i
429
432
 
430
433
  ## Minimal mode
431
434
 
432
- You can ignore all decorators and HOFs and just make base class extend `Sigil`:
435
+ By default `Sigil` works with minimal mode, You can ignore all decorators and HOFs and just make base class extend `Sigil`:
433
436
 
434
437
  ```ts
435
438
  import { Sigil, updateSigilOptions } from '@vicin/sigil';
@@ -454,6 +457,29 @@ Now if you forgot to pass a label error is thrown at the moment you create class
454
457
 
455
458
  ---
456
459
 
460
+ ## Hot module reload
461
+
462
+ HMR can cause class re-definitions, which will throw in default `Sigil` set-up as same label will be passed multiple times triggering duplicate label error.
463
+ To avoid this you can set global options to skip label uniqueness check at the start of app:
464
+
465
+ ```ts
466
+ import { updateSigilOptions } from '@vicin/sigil';
467
+
468
+ updateSigilOptions({ skipLabelUniquenessCheck: true });
469
+ ```
470
+
471
+ But this can cause bugs if same label is used for two different classes as checks are disables globally.
472
+ If you need more strict mode you can pass this options to the re-loaded class only:
473
+
474
+ ```ts
475
+ @WithSigil('HmrClassLabel', { skipLabelUniquenessCheck: true })
476
+ class HmrClass extends Sigil {}
477
+ ```
478
+
479
+ With this approach `skipLabelUniquenessCheck` affects only `HmrClass`, and if `HmrClassLabel` or any other label is re-used error is thrown immediately
480
+
481
+ ---
482
+
457
483
  ## Benchmarks
458
484
 
459
485
  Sigil is built for **real-world performance**. Below are the latest micro-benchmark results (run on **Node.js v20.12.0**).
@@ -503,7 +529,7 @@ npm run bench
503
529
 
504
530
  ## Bundle Size
505
531
 
506
- **Less than 1.6 KB (1.51 KB)** (minified + Brotli, including all dependencies)
532
+ **Less than 1.6 KB (1.54 KB)** (minified + Brotli, including all dependencies)
507
533
 
508
534
  This makes Sigil one of the smallest full-featured solutions for nominal typing + reliable runtime identity.
509
535
 
package/dist/index.d.mts CHANGED
@@ -242,6 +242,13 @@ interface SigilOptions {
242
242
  * will be assigned an autogenerated random label (so that explicit labels stay unique).
243
243
  */
244
244
  autofillLabels?: boolean;
245
+ /**
246
+ * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw
247
+ * duplicate label error, setting this to 'true' will disabel this error.
248
+ * However as it disables unique label check bugs can appear if the same label is passed to two different
249
+ * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.
250
+ */
251
+ skipLabelUniquenessCheck?: boolean;
245
252
  }
246
253
  /** -----------------------------------------
247
254
  * Update options
@@ -308,11 +315,9 @@ declare function isSigilCtor(ctor: unknown): ctor is ISigil;
308
315
  declare function isSigilInstance(inst: unknown): inst is ISigilInstance;
309
316
  /**
310
317
  * Helper function to get labels registered by 'Sigil'
311
- *
312
- * @param includeAuto - Flag to include auto-generated labels as well, default is 'false'.
313
318
  * @returns Sigil labels registered
314
319
  */
315
- declare function getSigilLabels(includeAuto?: boolean): string[];
320
+ declare function getSigilLabels(): string[];
316
321
 
317
322
  /**
318
323
  * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.
package/dist/index.d.ts CHANGED
@@ -242,6 +242,13 @@ interface SigilOptions {
242
242
  * will be assigned an autogenerated random label (so that explicit labels stay unique).
243
243
  */
244
244
  autofillLabels?: boolean;
245
+ /**
246
+ * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw
247
+ * duplicate label error, setting this to 'true' will disabel this error.
248
+ * However as it disables unique label check bugs can appear if the same label is passed to two different
249
+ * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.
250
+ */
251
+ skipLabelUniquenessCheck?: boolean;
245
252
  }
246
253
  /** -----------------------------------------
247
254
  * Update options
@@ -308,11 +315,9 @@ declare function isSigilCtor(ctor: unknown): ctor is ISigil;
308
315
  declare function isSigilInstance(inst: unknown): inst is ISigilInstance;
309
316
  /**
310
317
  * Helper function to get labels registered by 'Sigil'
311
- *
312
- * @param includeAuto - Flag to include auto-generated labels as well, default is 'false'.
313
318
  * @returns Sigil labels registered
314
319
  */
315
- declare function getSigilLabels(includeAuto?: boolean): string[];
320
+ declare function getSigilLabels(): string[];
316
321
 
317
322
  /**
318
323
  * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.
@@ -4,7 +4,8 @@
4
4
  // src/options.ts
5
5
  var OPTIONS = {
6
6
  labelValidation: null,
7
- autofillLabels: true
7
+ autofillLabels: true,
8
+ skipLabelUniquenessCheck: false
8
9
  };
9
10
  var updateSigilOptions = (opts) => {
10
11
  if ("autofillLabels" in opts) {
@@ -16,7 +17,12 @@
16
17
  const val = opts.labelValidation;
17
18
  if (val !== null && typeof val !== "function" && !(val instanceof RegExp))
18
19
  throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");
19
- OPTIONS.labelValidation = val != null ? val : null;
20
+ OPTIONS.labelValidation = val;
21
+ }
22
+ if ("skipLabelUniquenessCheck" in opts) {
23
+ if (typeof opts.skipLabelUniquenessCheck !== "boolean")
24
+ throw new Error("'updateSigilOptions.skipLabelUniquenessCheck' must be boolean");
25
+ OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;
20
26
  }
21
27
  };
22
28
  var RECOMMENDED_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
@@ -39,7 +45,6 @@
39
45
  }
40
46
  function handleAncestors(ctor, opts) {
41
47
  var _a;
42
- const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
43
48
  const ancestors = [];
44
49
  let a = Object.getPrototypeOf(ctor);
45
50
  while (a && typeof a === "function" && a.prototype[__SIGIL__]) {
@@ -47,6 +52,7 @@
47
52
  a = Object.getPrototypeOf(a);
48
53
  }
49
54
  const labelOwner = /* @__PURE__ */ new Map();
55
+ const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
50
56
  for (const a2 of ancestors) {
51
57
  const l = a2.prototype[__LABEL__];
52
58
  if (labelOwner.has(l)) {
@@ -101,7 +107,6 @@
101
107
  enumerable: false,
102
108
  writable: false
103
109
  });
104
- getLabelRegistry().add(label);
105
110
  handledCtors.add(ctor);
106
111
  }
107
112
  function isSigilCtor(ctor) {
@@ -119,10 +124,8 @@
119
124
  function lineageOf(ctor) {
120
125
  return ctor.prototype[__LINEAGE__];
121
126
  }
122
- function getSigilLabels(includeAuto = false) {
123
- const labels = getLabelRegistry().labels();
124
- if (includeAuto) return labels;
125
- return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));
127
+ function getSigilLabels() {
128
+ return getLabelRegistry().labels();
126
129
  }
127
130
  function getLabelRegistry() {
128
131
  if ("__labelRegistry__" in globalThis) return globalThis.__labelRegistry__;
@@ -144,11 +147,10 @@
144
147
  return labelRegistry;
145
148
  }
146
149
  function verifyLabel(ctor, label, opts) {
147
- var _a, _b;
148
- const labelValidation = (_a = opts == null ? void 0 : opts.labelValidation) != null ? _a : OPTIONS.labelValidation;
149
- const autofillLabels = (_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels;
150
+ var _a, _b, _c;
151
+ const reg = getLabelRegistry();
150
152
  if (!label) {
151
- if (!autofillLabels)
153
+ if (!((_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels))
152
154
  throw new Error(
153
155
  `[Sigil Error] Class '${ctor == null ? void 0 : ctor.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
154
156
  );
@@ -156,10 +158,11 @@
156
158
  }
157
159
  if (label.startsWith(AUTO_LABEL_PREFEX))
158
160
  throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);
159
- if (getLabelRegistry().has(label))
161
+ if (!((_b = opts == null ? void 0 : opts.skipLabelUniquenessCheck) != null ? _b : OPTIONS.skipLabelUniquenessCheck) && reg.has(label))
160
162
  throw new Error(
161
163
  `[Sigil Error] Passed label '${label}' to class '${ctor == null ? void 0 : ctor.name}' is re-used, passed labels must be unique`
162
164
  );
165
+ const labelValidation = (_c = opts == null ? void 0 : opts.labelValidation) != null ? _c : OPTIONS.labelValidation;
163
166
  if (labelValidation) {
164
167
  let valid;
165
168
  if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
@@ -169,6 +172,7 @@
169
172
  `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`
170
173
  );
171
174
  }
175
+ reg.add(label);
172
176
  }
173
177
  function generateRandomLabel(ctor) {
174
178
  return `${AUTO_LABEL_PREFEX}:${ctor == null ? void 0 : ctor.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";;;;EAqCO,IAAM,OAAA,GAAkC;EAAA,EAC7C,eAAA,EAAiB,IAAA;EAAA,EACjB,cAAA,EAAgB;EAClB,CAAA;AAYO,MAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;EAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;EAC5B,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;EACjC,MA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,CAAY,UAAA,EAAY,OAAO,IAAI,CAAA;EACnC,EAAA,OAAO,UAAA;EACT;;;AClXO,MAAM,KAAA,GAAQ,SAAS,MAAM;EAAC,CAAA,EAAG,OAAO;AAUxC,MAAM,UAAA,GAAa,QAAA,CAAS,KAAA,EAAO,YAAY;;;ECT/C,SAAS,SAAA,CAAU,OAAe,IAAA,EAAqB;EAC5D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;EAC9C,IAAA,IAAI,CAAC,YAAY,KAAK,CAAA;EACpB,MAAA,MAAM,IAAI,KAAA;EAAA,QACR,CAAA,iFAAA,EAAoF,MAAM,IAAI,CAAA,CAAA;EAAA,OAChG;EACF,IAAA,IAAI,YAAY,KAAK,CAAA;EACnB,MAAA,MAAM,IAAI,KAAA;EAAA,QACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;EAAA,OACrE;EAEF,IAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;EAAA,EAChC,CAAA;EACF;;;ECVO,SAAS,SAAA,CAA8B,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;EAC7F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;EACpB,IAAA,MAAM,IAAI,KAAA;EAAA,MACR,CAAA,2EAAA,EAA8E,MAAM,IAAI,CAAA,CAAA;EAAA,KAC1F;EACF,EAAA,IAAI,YAAY,KAAK,CAAA;EACnB,IAAA,MAAM,IAAI,KAAA;EAAA,MACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;EAAA,KACrE;EAEF,EAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;EAC9B,EAAA,OAAO,KAAA;EACT","file":"index.global.js","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Internal 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 autofillLabels: true,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val ?? null;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // handle options\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Add label to registered labels and mark as handled\n getLabelRegistry().add(label);\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n *\n * @param includeAuto - Flag to include auto-generated labels as well, default is 'false'.\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(includeAuto: boolean = false): string[] {\n const labels = getLabelRegistry().labels();\n if (includeAuto) return labels;\n return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // handle option\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!label) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n if (getLabelRegistry().has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
1
+ {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";;;;EA6CO,IAAM,OAAA,GAAkC;EAAA,EAC7C,eAAA,EAAiB,IAAA;EAAA,EACjB,cAAA,EAAgB,IAAA;EAAA,EAChB,wBAAA,EAA0B;EAC5B,CAAA;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CAAA,uBAAA;EAAA,KACrE;EAEF,EAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;EAC9B,EAAA,OAAO,KAAA;EACT","file":"index.global.js","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw\n * duplicate label error, setting this to 'true' will disabel this error.\n * However as it disables unique label check bugs can appear if the same label is passed to two different\n * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.\n */\n skipLabelUniquenessCheck?: boolean;\n}\n\n/** -----------------------------------------\n * Internal 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 autofillLabels: true,\n skipLabelUniquenessCheck: false,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val;\n }\n\n if ('skipLabelUniquenessCheck' in opts) {\n if (typeof opts.skipLabelUniquenessCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelUniquenessCheck' must be boolean\");\n OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Mark as handled\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(): string[] {\n return getLabelRegistry().labels();\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // get label registry\n const reg = getLabelRegistry();\n\n // If no label passed throw error\n if (!label) {\n if (!(opts?.autofillLabels ?? OPTIONS.autofillLabels))\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n // If label starts with '@Sigil-auto:' throw error\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n // If label is duplicate throw error\n if (!(opts?.skipLabelUniquenessCheck ?? OPTIONS.skipLabelUniquenessCheck) && reg.has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\n\n // If validation regex or function is defined validate\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n\n // Add label to registry\n reg.add(label);\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
package/dist/index.js CHANGED
@@ -3,7 +3,8 @@
3
3
  // src/options.ts
4
4
  var OPTIONS = {
5
5
  labelValidation: null,
6
- autofillLabels: true
6
+ autofillLabels: true,
7
+ skipLabelUniquenessCheck: false
7
8
  };
8
9
  var updateSigilOptions = (opts) => {
9
10
  if ("autofillLabels" in opts) {
@@ -15,7 +16,12 @@ var updateSigilOptions = (opts) => {
15
16
  const val = opts.labelValidation;
16
17
  if (val !== null && typeof val !== "function" && !(val instanceof RegExp))
17
18
  throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");
18
- OPTIONS.labelValidation = val != null ? val : null;
19
+ OPTIONS.labelValidation = val;
20
+ }
21
+ if ("skipLabelUniquenessCheck" in opts) {
22
+ if (typeof opts.skipLabelUniquenessCheck !== "boolean")
23
+ throw new Error("'updateSigilOptions.skipLabelUniquenessCheck' must be boolean");
24
+ OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;
19
25
  }
20
26
  };
21
27
  var RECOMMENDED_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
@@ -38,7 +44,6 @@ function handleSigil(ctor, label, opts) {
38
44
  }
39
45
  function handleAncestors(ctor, opts) {
40
46
  var _a;
41
- const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
42
47
  const ancestors = [];
43
48
  let a = Object.getPrototypeOf(ctor);
44
49
  while (a && typeof a === "function" && a.prototype[__SIGIL__]) {
@@ -46,6 +51,7 @@ function handleAncestors(ctor, opts) {
46
51
  a = Object.getPrototypeOf(a);
47
52
  }
48
53
  const labelOwner = /* @__PURE__ */ new Map();
54
+ const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
49
55
  for (const a2 of ancestors) {
50
56
  const l = a2.prototype[__LABEL__];
51
57
  if (labelOwner.has(l)) {
@@ -100,7 +106,6 @@ function sigilify(ctor, label) {
100
106
  enumerable: false,
101
107
  writable: false
102
108
  });
103
- getLabelRegistry().add(label);
104
109
  handledCtors.add(ctor);
105
110
  }
106
111
  function isSigilCtor(ctor) {
@@ -118,10 +123,8 @@ function labelOf(ctor) {
118
123
  function lineageOf(ctor) {
119
124
  return ctor.prototype[__LINEAGE__];
120
125
  }
121
- function getSigilLabels(includeAuto = false) {
122
- const labels = getLabelRegistry().labels();
123
- if (includeAuto) return labels;
124
- return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));
126
+ function getSigilLabels() {
127
+ return getLabelRegistry().labels();
125
128
  }
126
129
  function getLabelRegistry() {
127
130
  if ("__labelRegistry__" in globalThis) return globalThis.__labelRegistry__;
@@ -143,11 +146,10 @@ function getLabelRegistry() {
143
146
  return labelRegistry;
144
147
  }
145
148
  function verifyLabel(ctor, label, opts) {
146
- var _a, _b;
147
- const labelValidation = (_a = opts == null ? void 0 : opts.labelValidation) != null ? _a : OPTIONS.labelValidation;
148
- const autofillLabels = (_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels;
149
+ var _a, _b, _c;
150
+ const reg = getLabelRegistry();
149
151
  if (!label) {
150
- if (!autofillLabels)
152
+ if (!((_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels))
151
153
  throw new Error(
152
154
  `[Sigil Error] Class '${ctor == null ? void 0 : ctor.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
153
155
  );
@@ -155,10 +157,11 @@ function verifyLabel(ctor, label, opts) {
155
157
  }
156
158
  if (label.startsWith(AUTO_LABEL_PREFEX))
157
159
  throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);
158
- if (getLabelRegistry().has(label))
160
+ if (!((_b = opts == null ? void 0 : opts.skipLabelUniquenessCheck) != null ? _b : OPTIONS.skipLabelUniquenessCheck) && reg.has(label))
159
161
  throw new Error(
160
162
  `[Sigil Error] Passed label '${label}' to class '${ctor == null ? void 0 : ctor.name}' is re-used, passed labels must be unique`
161
163
  );
164
+ const labelValidation = (_c = opts == null ? void 0 : opts.labelValidation) != null ? _c : OPTIONS.labelValidation;
162
165
  if (labelValidation) {
163
166
  let valid;
164
167
  if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
@@ -168,6 +171,7 @@ function verifyLabel(ctor, label, opts) {
168
171
  `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`
169
172
  );
170
173
  }
174
+ reg.add(label);
171
175
  }
172
176
  function generateRandomLabel(ctor) {
173
177
  return `${AUTO_LABEL_PREFEX}:${ctor == null ? void 0 : ctor.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";;;AAqCO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB;AAClB,CAAA;AAYO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;AAC5B,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;AACjC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AACvE,IAAA,OAAA,CAAQ,iBAAiB,IAAA,CAAK,c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AA,GAAQ,SAAS,MAAM;AAAC,CAAA,EAAG,OAAO;AAUxC,IAAM,UAAA,GAAa,QAAA,CAAS,KAAA,EAAO,YAAY;;;ACT/C,SAAS,SAAA,CAAU,OAAe,IAAA,EAAqB;AAC5D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;AAC9C,IAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,iFAAA,EAAoF,MAAM,IAAI,CAAA,CAAA;AAAA,OAChG;AACF,IAAA,IAAI,YAAY,KAAK,CAAA;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,OACrE;AAEF,IAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAAA,EAChC,CAAA;AACF;;;ACVO,SAAS,SAAA,CAA8B,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;AAC7F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,2EAAA,EAA8E,MAAM,IAAI,CAAA,CAAA;AAAA,KAC1F;AACF,EAAA,IAAI,YAAY,KAAK,CAAA;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,KACrE;AAEF,EAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAC9B,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Internal 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 autofillLabels: true,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val ?? null;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // handle options\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Add label to registered labels and mark as handled\n getLabelRegistry().add(label);\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n *\n * @param includeAuto - Flag to include auto-generated labels as well, default is 'false'.\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(includeAuto: boolean = false): string[] {\n const labels = getLabelRegistry().labels();\n if (includeAuto) return labels;\n return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // handle option\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!label) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n if (getLabelRegistry().has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
1
+ {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";;;AA6CO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,IAAA;AAAA,EAChB,wBAAA,EAA0B;AAC5B,CAAA;AAYO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;A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EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw\n * duplicate label error, setting this to 'true' will disabel this error.\n * However as it disables unique label check bugs can appear if the same label is passed to two different\n * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.\n */\n skipLabelUniquenessCheck?: boolean;\n}\n\n/** -----------------------------------------\n * Internal 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 autofillLabels: true,\n skipLabelUniquenessCheck: false,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val;\n }\n\n if ('skipLabelUniquenessCheck' in opts) {\n if (typeof opts.skipLabelUniquenessCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelUniquenessCheck' must be boolean\");\n OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Mark as handled\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(): string[] {\n return getLabelRegistry().labels();\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // get label registry\n const reg = getLabelRegistry();\n\n // If no label passed throw error\n if (!label) {\n if (!(opts?.autofillLabels ?? OPTIONS.autofillLabels))\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n // If label starts with '@Sigil-auto:' throw error\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n // If label is duplicate throw error\n if (!(opts?.skipLabelUniquenessCheck ?? OPTIONS.skipLabelUniquenessCheck) && reg.has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\n\n // If validation regex or function is defined validate\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n\n // Add label to registry\n reg.add(label);\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/options.ts
2
2
  var OPTIONS = {
3
3
  labelValidation: null,
4
- autofillLabels: true
4
+ autofillLabels: true,
5
+ skipLabelUniquenessCheck: false
5
6
  };
6
7
  var updateSigilOptions = (opts) => {
7
8
  if ("autofillLabels" in opts) {
@@ -13,7 +14,12 @@ var updateSigilOptions = (opts) => {
13
14
  const val = opts.labelValidation;
14
15
  if (val !== null && typeof val !== "function" && !(val instanceof RegExp))
15
16
  throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");
16
- OPTIONS.labelValidation = val != null ? val : null;
17
+ OPTIONS.labelValidation = val;
18
+ }
19
+ if ("skipLabelUniquenessCheck" in opts) {
20
+ if (typeof opts.skipLabelUniquenessCheck !== "boolean")
21
+ throw new Error("'updateSigilOptions.skipLabelUniquenessCheck' must be boolean");
22
+ OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;
17
23
  }
18
24
  };
19
25
  var RECOMMENDED_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
@@ -36,7 +42,6 @@ function handleSigil(ctor, label, opts) {
36
42
  }
37
43
  function handleAncestors(ctor, opts) {
38
44
  var _a;
39
- const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
40
45
  const ancestors = [];
41
46
  let a = Object.getPrototypeOf(ctor);
42
47
  while (a && typeof a === "function" && a.prototype[__SIGIL__]) {
@@ -44,6 +49,7 @@ function handleAncestors(ctor, opts) {
44
49
  a = Object.getPrototypeOf(a);
45
50
  }
46
51
  const labelOwner = /* @__PURE__ */ new Map();
52
+ const autofillLabels = (_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels;
47
53
  for (const a2 of ancestors) {
48
54
  const l = a2.prototype[__LABEL__];
49
55
  if (labelOwner.has(l)) {
@@ -98,7 +104,6 @@ function sigilify(ctor, label) {
98
104
  enumerable: false,
99
105
  writable: false
100
106
  });
101
- getLabelRegistry().add(label);
102
107
  handledCtors.add(ctor);
103
108
  }
104
109
  function isSigilCtor(ctor) {
@@ -116,10 +121,8 @@ function labelOf(ctor) {
116
121
  function lineageOf(ctor) {
117
122
  return ctor.prototype[__LINEAGE__];
118
123
  }
119
- function getSigilLabels(includeAuto = false) {
120
- const labels = getLabelRegistry().labels();
121
- if (includeAuto) return labels;
122
- return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));
124
+ function getSigilLabels() {
125
+ return getLabelRegistry().labels();
123
126
  }
124
127
  function getLabelRegistry() {
125
128
  if ("__labelRegistry__" in globalThis) return globalThis.__labelRegistry__;
@@ -141,11 +144,10 @@ function getLabelRegistry() {
141
144
  return labelRegistry;
142
145
  }
143
146
  function verifyLabel(ctor, label, opts) {
144
- var _a, _b;
145
- const labelValidation = (_a = opts == null ? void 0 : opts.labelValidation) != null ? _a : OPTIONS.labelValidation;
146
- const autofillLabels = (_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels;
147
+ var _a, _b, _c;
148
+ const reg = getLabelRegistry();
147
149
  if (!label) {
148
- if (!autofillLabels)
150
+ if (!((_a = opts == null ? void 0 : opts.autofillLabels) != null ? _a : OPTIONS.autofillLabels))
149
151
  throw new Error(
150
152
  `[Sigil Error] Class '${ctor == null ? void 0 : ctor.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
151
153
  );
@@ -153,10 +155,11 @@ function verifyLabel(ctor, label, opts) {
153
155
  }
154
156
  if (label.startsWith(AUTO_LABEL_PREFEX))
155
157
  throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);
156
- if (getLabelRegistry().has(label))
158
+ if (!((_b = opts == null ? void 0 : opts.skipLabelUniquenessCheck) != null ? _b : OPTIONS.skipLabelUniquenessCheck) && reg.has(label))
157
159
  throw new Error(
158
160
  `[Sigil Error] Passed label '${label}' to class '${ctor == null ? void 0 : ctor.name}' is re-used, passed labels must be unique`
159
161
  );
162
+ const labelValidation = (_c = opts == null ? void 0 : opts.labelValidation) != null ? _c : OPTIONS.labelValidation;
160
163
  if (labelValidation) {
161
164
  let valid;
162
165
  if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
@@ -166,6 +169,7 @@ function verifyLabel(ctor, label, opts) {
166
169
  `[Sigil Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`
167
170
  );
168
171
  }
172
+ reg.add(label);
169
173
  }
170
174
  function generateRandomLabel(ctor) {
171
175
  return `${AUTO_LABEL_PREFEX}:${ctor == null ? void 0 : ctor.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";AAqCO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB;AAClB,CAAA;AAYO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;AAC5B,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;AACjC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AACvE,IAAA,OAAA,CAAQ,iBAAiB,IAAA,CAAK,cAAA;AAAA,EAChC;AAEA,EAAA,IAAI,qBAAqB,IAAA,EAAM;AAC7B,IAAA,MAAM,MAAM,IAAA,CAAK,eAAA;AACjB,IAA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/C,SAAS,SAAA,CAAU,OAAe,IAAA,EAAqB;AAC5D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;AAC9C,IAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,iFAAA,EAAoF,MAAM,IAAI,CAAA,CAAA;AAAA,OAChG;AACF,IAAA,IAAI,YAAY,KAAK,CAAA;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,OACrE;AAEF,IAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAAA,EAChC,CAAA;AACF;;;ACVO,SAAS,SAAA,CAA8B,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;AAC7F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,2EAAA,EAA8E,MAAM,IAAI,CAAA,CAAA;AAAA,KAC1F;AACF,EAAA,IAAI,YAAY,KAAK,CAAA;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,KACrE;AAEF,EAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAC9B,EAAA,OAAO,KAAA;AACT","file":"index.mjs","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Internal 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 autofillLabels: true,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val ?? null;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // handle options\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Add label to registered labels and mark as handled\n getLabelRegistry().add(label);\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n *\n * @param includeAuto - Flag to include auto-generated labels as well, default is 'false'.\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(includeAuto: boolean = false): string[] {\n const labels = getLabelRegistry().labels();\n if (includeAuto) return labels;\n return labels.filter((l) => !l.startsWith(AUTO_LABEL_PREFEX));\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // handle option\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n\n if (!label) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n if (getLabelRegistry().has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
1
+ {"version":3,"sources":["../src/options.ts","../src/symbols.ts","../src/helpers.ts","../src/mixin.ts","../src/classes.ts","../src/decorator.ts","../src/hof.ts"],"names":["a"],"mappings":";AA6CO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,IAAA;AAAA,EAChB,wBAAA,EAA0B;AAC5B,CAAA;AAYO,IAAM,kBAAA,GAAqB,CAAC,IAAA,KAA6B;AAC9D,EAAA,IAAI,oBAAoB,IAAA,EAAM;AAC5B,IAAA,IAAI,OAAO,KAAK,cAAA,KAAmB,SAAA;AACjC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AACvE,IAAA,OA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A;AAGF,EAAA,WAAA,CAAY,UAAA,EAAY,OAAO,IAAI,CAAA;AACnC,EAAA,OAAO,UAAA;AACT;;;AClXO,IAAM,KAAA,GAAQ,SAAS,MAAM;AAAC,CAAA,EAAG,OAAO;AAUxC,IAAM,UAAA,GAAa,QAAA,CAAS,KAAA,EAAO,YAAY;;;ACT/C,SAAS,SAAA,CAAU,OAAe,IAAA,EAAqB;AAC5D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;AAC9C,IAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,iFAAA,EAAoF,MAAM,IAAI,CAAA,CAAA;AAAA,OAChG;AACF,IAAA,IAAI,YAAY,KAAK,CAAA;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,OACrE;AAEF,IAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAAA,EAChC,CAAA;AACF;;;ACVO,SAAS,SAAA,CAA8B,KAAA,EAAU,KAAA,EAAe,IAAA,EAAwB;AAC7F,EAAA,IAAI,CAAC,YAAY,KAAK,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,2EAAA,EAA8E,MAAM,IAAI,CAAA,CAAA;AAAA,KAC1F;AACF,EAAA,IAAI,YAAY,KAAK,CAAA;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,KAAA,CAAM,IAAI,CAAA,cAAA,EAAiB,MAAM,UAAU,CAAA,uBAAA;AAAA,KACrE;AAEF,EAAA,WAAA,CAAY,KAAA,EAAO,OAAO,IAAI,CAAA;AAC9B,EAAA,OAAO,KAAA;AACT","file":"index.mjs","sourcesContent":["/** -----------------------------------------\n * Types\n * ----------------------------------------- */\n\n/**\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 * 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 * Option for Hot module reload set-ups, reload of files can result in class redefinition which will throw\n * duplicate label error, setting this to 'true' will disabel this error.\n * However as it disables unique label check bugs can appear if the same label is passed to two different\n * classes so set this to 'true' only when needed and ensure uniqueness of passed labels.\n */\n skipLabelUniquenessCheck?: boolean;\n}\n\n/** -----------------------------------------\n * Internal 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 autofillLabels: true,\n skipLabelUniquenessCheck: false,\n};\n\n/** -----------------------------------------\n * Update options\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 updateSigilOptions = (opts: SigilOptions): void => {\n if ('autofillLabels' in opts) {\n if (typeof opts.autofillLabels !== 'boolean')\n throw new Error(\"'updateSigilOptions.autofillLabels' must be boolean\");\n OPTIONS.autofillLabels = opts.autofillLabels!;\n }\n\n if ('labelValidation' in opts) {\n const val = opts.labelValidation;\n if (val !== null && typeof val !== 'function' && !(val instanceof RegExp))\n throw new Error(\"'updateSigilOptions.labelValidation' must be null, function or RegExp\");\n OPTIONS.labelValidation = val;\n }\n\n if ('skipLabelUniquenessCheck' in opts) {\n if (typeof opts.skipLabelUniquenessCheck !== 'boolean')\n throw new Error(\"'updateSigilOptions.skipLabelUniquenessCheck' must be boolean\");\n OPTIONS.skipLabelUniquenessCheck = opts.skipLabelUniquenessCheck;\n }\n};\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 RECOMMENDED_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\n\n/** @deprecated - Use 'RECOMMENDED_LABEL_REGEX' instead, will be removed in v4 */\nexport const DEFAULT_LABEL_REGEX = RECOMMENDED_LABEL_REGEX;\n","/**\n * Symbol to uniquely identify sigil classes.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __SIGIL__ = Symbol.for('@vicin/sigil.__SIGIL__');\n\n/**\n * Symbol used to store the identity 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('@vicin/sigil.__LABEL__');\n\n/**\n * Symbol used to store the human-readable label for a sigil constructor, it can be inherited if no label is deined.\n *\n * Stored on the constructor as a non-enumerable property.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __EFFECTIVE_LABEL__ = Symbol.for('@vicin/sigil.__EFFECTIVE_LABEL__');\n\n/**\n * Symbol used to store the label lineage set for a sigil constructor.\n *\n * This is a set of labels (strings) representing the inheritance path of labels.\n *\n * @internal\n * @constant {symbol}\n */\nexport const __LINEAGE__ = Symbol.for('@vicin/sigil.__LINEAGE__');\n","import { OPTIONS, type SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __SIGIL__, __LINEAGE__ } from './symbols';\nimport type { ISigil, ISigilInstance } from './types';\n\n/** Prefex use by the lib to identify auto-generated classes */\nconst AUTO_LABEL_PREFEX = '@Sigil-auto';\n\n/** -----------------------------------------\n * Main helper\n * ----------------------------------------- */\n\n/** Weak set to ensure that every ctor is handled only once. */\nconst handledCtors = new WeakSet<Function>();\n\n/** Main function to handle 'Sigil' and attach its metadata to the class */\nexport function handleSigil(ctor: Function, label?: string, opts?: SigilOptions) {\n // fast return if already defined\n if (handledCtors.has(ctor)) return;\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n handleAncestors(ctor, opts);\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: Pick<SigilOptions, 'autofillLabels'>): void {\n // get line age of this class (ancestors only)\n const ancestors: Function[] = [];\n let a = Object.getPrototypeOf(ctor);\n while (a && typeof a === 'function' && a.prototype[__SIGIL__]) {\n ancestors.unshift(a);\n a = Object.getPrototypeOf(a);\n }\n\n /** Map<label, className> to record the owner of each label. */\n const labelOwner = new Map<string, string>();\n\n // loop lineage to insure that each label is unique in ancestors\n const autofillLabels = opts?.autofillLabels ?? OPTIONS.autofillLabels;\n for (const a of ancestors) {\n // get label\n const l = a.prototype[__LABEL__] as string;\n // if duplicate (no label is passed for this class) update class with new label\n if (labelOwner.has(l)) {\n if (!autofillLabels)\n throw new Error(\n `[Sigil Error] Class '${a.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n sigilify(a, generateRandomLabel(a));\n }\n // register current label with class name\n labelOwner.set(labelOf(a)!, a.name);\n }\n}\n\nfunction sigilify(ctor: Function, label: string) {\n const sym = Symbol.for(label);\n Object.defineProperty(ctor.prototype, __SIGIL__, {\n value: sym,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, sym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n if (!label.startsWith(AUTO_LABEL_PREFEX))\n Object.defineProperty(ctor.prototype, __EFFECTIVE_LABEL__, {\n value: label,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n Object.defineProperty(ctor.prototype, __LINEAGE__, {\n value: new Set(['Sigil', ...(lineageOf(ctor) ?? []), label]),\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // add { Symbol.for('Sigil'): true } if not present\n const sigilSym = Symbol.for('Sigil');\n if (ctor.prototype[sigilSym] !== true)\n Object.defineProperty(ctor.prototype, sigilSym, {\n value: true,\n configurable: false,\n enumerable: false,\n writable: false,\n });\n // Mark as handled\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Inspection helpers\n * ----------------------------------------- */\n\n/**\n * Runtime predicate that checks whether the provided value is a sigil 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.prototype && __SIGIL__ in ctor.prototype;\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 ISigilInstance {\n return !!inst && typeof inst === 'object' && __SIGIL__ in inst;\n}\n\nexport function hasOwnSigil(ctor: Function): ctor is ISigil {\n return typeof ctor === 'function' && Object.hasOwn(ctor.prototype, __SIGIL__);\n}\n\nfunction labelOf(ctor: Function): string | undefined {\n return ctor.prototype[__LABEL__];\n}\n\nfunction lineageOf(ctor: Function): Set<string> | undefined {\n return ctor.prototype[__LINEAGE__];\n}\n\n/**\n * Helper function to get labels registered by 'Sigil'\n * @returns Sigil labels registered\n */\nexport function getSigilLabels(): string[] {\n return getLabelRegistry().labels();\n}\n\n/** -----------------------------------------\n * Label helpers\n * ----------------------------------------- */\n\n/** Exposed methods of global label registry */\ninterface LabelRegistry {\n has: (label: string) => boolean;\n add: (label: string) => void;\n labels: () => string[];\n enc: () => number;\n}\n\n/** Internal helper to get (or init then get) global label registry */\nfunction getLabelRegistry(): LabelRegistry {\n if ('__labelRegistry__' in globalThis) return (globalThis as any).__labelRegistry__;\n\n const labelSet = new Set<string>();\n let count = 0;\n\n const labelRegistry: LabelRegistry = {\n has: (label: string) => labelSet.has(label),\n add: (label: string) => labelSet.add(label),\n labels: () => [...labelSet],\n enc: () => ++count,\n };\n\n Object.freeze(labelRegistry);\n\n Object.defineProperty(globalThis, '__labelRegistry__', {\n value: labelRegistry,\n writable: false,\n configurable: false,\n enumerable: false,\n });\n\n return labelRegistry;\n}\n\n/** Internal helper to validate passed label */\nfunction verifyLabel<L extends string>(ctor: Function, label?: L, opts?: SigilOptions): void {\n // get label registry\n const reg = getLabelRegistry();\n\n // If no label passed throw error\n if (!label) {\n if (!(opts?.autofillLabels ?? OPTIONS.autofillLabels))\n throw new Error(\n `[Sigil Error] Class '${ctor?.name}' is not sigilified, Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`\n );\n return;\n }\n\n // If label starts with '@Sigil-auto:' throw error\n if (label.startsWith(AUTO_LABEL_PREFEX))\n throw new Error(`'${AUTO_LABEL_PREFEX}' is a prefex reserved by the library`);\n\n // If label is duplicate throw error\n if (!(opts?.skipLabelUniquenessCheck ?? OPTIONS.skipLabelUniquenessCheck) && reg.has(label))\n throw new Error(\n `[Sigil Error] Passed label '${label}' to class '${ctor?.name}' is re-used, passed labels must be unique`\n );\n\n // If validation regex or function is defined validate\n const labelValidation = opts?.labelValidation ?? OPTIONS.labelValidation;\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 Error] Invalid Sigil label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n\n // Add label to registry\n reg.add(label);\n}\n\n/** Internal helper to generate random label */\nfunction generateRandomLabel(ctor: Function): string {\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${getLabelRegistry().enc()}:${Math.random().toString(36).slice(2, 10)}`;\n}\n","import { handleSigil, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\nimport { __LABEL__, __EFFECTIVE_LABEL__, __LINEAGE__, __SIGIL__ } from './symbols';\nimport type {\n Constructor,\n Prettify,\n ConstructorAbstract,\n ISigilInstance,\n GetPrototype,\n ISigilStatic,\n sigil,\n} from './types';\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * @param opts - Options object to override any global options if needed.\n * @returns A new constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already sigilified.\n */\nexport function Sigilify<B extends Constructor, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T extends ISigilStatic>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T extends ISigilInstance>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n\n/**\n * Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.\n *\n * @param Base - The base constructor to extend.\n * @param label - Identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\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 sigilified.\n */\nexport function SigilifyAbstract<B extends ConstructorAbstract, L extends string>(\n Base: B,\n label: L,\n opts?: SigilOptions\n) {\n if (hasOwnSigil(Base))\n throw new Error(\n `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`\n );\n\n abstract class Sigilified extends Base implements ISigilInstance {\n /**\n * Class-level identity label constant for this sigil constructor.\n */\n static get SigilLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__LABEL__];\n }\n\n /**\n * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.\n */\n static get SigilEffectiveLabel(): L {\n handleSigil(this);\n return (this as any).prototype[__EFFECTIVE_LABEL__];\n }\n\n /**\n * 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 handleSigil(this);\n return [...(this as any).prototype[__LINEAGE__]];\n }\n\n /**\n * Sigil type label set for the current constructor.\n * Useful for debugging.\n *\n * @returns A Readonly Set of labels that represent the type lineage.\n */\n static get SigilLabelSet(): Readonly<Set<string>> {\n handleSigil(this);\n return (this as any).prototype[__LINEAGE__];\n }\n\n /**\n * Compile-time nominal brand that encodes the class sigil labels object.\n */\n declare readonly [sigil]: Prettify<\n {\n Sigil: true;\n } & {\n [K in L]: true;\n }\n >;\n\n constructor(...args: any[]) {\n super(...args);\n const ctor = new.target;\n handleSigil(ctor);\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isOfType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n static isExactType<T>(this: T, other: unknown): other is GetPrototype<T> {\n handleSigil(this as any);\n if (other == null || typeof other !== 'object') return false;\n if ((this as any).prototype?.[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size)\n return false;\n return (other as any)[(this as any).prototype[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is (or inherits from) the instance represented by the\n * calling constructor.\n *\n * This replaces `instanceof` so that checks remain valid across bundles/realms\n * and when subclassing.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isOfType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Check whether `other` is exactly the same instance represented by the\n * calling constructor.\n *\n * @typeParam T - The specific sigil constructor (`this`).\n * @param this - The constructor performing the type check.\n * @param other - The object to test.\n * @returns A type guard asserting `other` is an instance of the constructor.\n */\n isExactType<T>(this: T, other: unknown): other is T {\n if (other == null || typeof other !== 'object') return false;\n if ((this as any)[__LINEAGE__].size !== (other as any)[__LINEAGE__]?.size) return false;\n return (other as any)[(this as any)[__SIGIL__]] === true;\n }\n\n /**\n * Returns the identity sigil label of this instance's constructor.\n *\n * @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil-auto:ClassName:1:pnf11bgl').\n */\n getSigilLabel(): string {\n return (this as any)[__LABEL__];\n }\n\n /**\n * Returns the human-readable sigil label of this instance's constructor.\n *\n * @returns The last passed label string (e.g. '@scope/pkg.ClassName').\n */\n getSigilEffectiveLabel(): string {\n return (this as any)[__EFFECTIVE_LABEL__];\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 return [...(this as any)[__LINEAGE__]];\n }\n\n /**\n * Returns a copy of the sigil type label lineage set for this instance's constructor.\n *\n * @returns readonly array of labels representing the type lineage.\n */\n getSigilLabelSet(): Readonly<Set<string>> {\n return (this as any)[__LINEAGE__];\n }\n }\n\n handleSigil(Sigilified, label, opts);\n return Sigilified;\n}\n","import { Sigilify } from './mixin';\nimport type { sigil } 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 = 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 { handleSigil, hasOwnSigil, isSigilCtor } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * Class decorator factory that attaches sigil statics to a class constructor.\n *\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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(label: string, opts?: SigilOptions) {\n return function (value: Function, context: any) {\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 if (hasOwnSigil(value))\n throw new Error(\n `[Sigil Error] Class '${value.name}' with label '${value.SigilLabel}' is already sigilified`\n );\n\n handleSigil(value, label, opts);\n };\n}\n","import { handleSigil, isSigilCtor, hasOwnSigil } from './helpers';\nimport type { SigilOptions } from './options';\n\n/**\n * HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.\n * Alternative to '@WithSigil' if you prefer HOFs.\n *\n * @typeParam S - Constructor type (should be an instance of sigil class).\n * @param Class - The constructor (class) to enhance.\n * @param label - Sigil label string to assign to the decorated class (e.g. `@scope/pkg.ClassName`).\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>(Class: S, label: string, opts?: SigilOptions): S {\n if (!isSigilCtor(Class))\n throw new Error(\n `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`\n );\n if (hasOwnSigil(Class))\n throw new Error(\n `[Sigil Error] Class '${Class.name}' with label '${Class.SigilLabel}' is already sigilified`\n );\n\n handleSigil(Class, label, opts);\n return Class;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicin/sigil",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "Sigil gives you the power of safe cross-bundle class instances checks and simple class nominal typing if needed",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",