@vicin/sigil 3.1.0 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -29,14 +29,14 @@ var AUTO_LABEL_PREFEX = "@Sigil-auto";
29
29
  var handledCtors = /* @__PURE__ */ new WeakSet();
30
30
  function handleSigil(ctor, label, opts) {
31
31
  if (handledCtors.has(ctor)) return;
32
- handledCtors.add(ctor);
33
32
  verifyLabel(ctor, label, opts);
34
33
  const ancLabelsMap = handleAncestors(ctor, opts);
35
34
  if (label && ancLabelsMap.has(label))
36
35
  throw new Error(
37
- `[Sigil Error] Attempt to assign label '${label}' to ${ctor.name} but label is already used by parent '${ancLabelsMap.get(label)}', Make sure that every class has a unique label`
36
+ `[Sigil Error] Attempt to assign label '${label}' to class '${ctor == null ? void 0 : ctor.name}' but label is already used by parent '${ancLabelsMap.get(label)}', Make sure that every class has a unique label`
38
37
  );
39
38
  sigilify(ctor, label != null ? label : generateRandomLabel(ctor));
39
+ handledCtors.add(ctor);
40
40
  }
41
41
  function handleAncestors(ctor, opts) {
42
42
  var _a;
@@ -105,7 +105,7 @@ function sigilify(ctor, label) {
105
105
  });
106
106
  }
107
107
  function isSigilCtor(ctor) {
108
- return typeof ctor === "function" && __SIGIL__ in ctor.prototype;
108
+ return typeof ctor === "function" && ctor.prototype && __SIGIL__ in ctor.prototype;
109
109
  }
110
110
  function isSigilInstance(inst) {
111
111
  return !!inst && typeof inst === "object" && __SIGIL__ in inst;
@@ -126,7 +126,7 @@ function verifyLabel(ctor, label, opts) {
126
126
  if (!label) {
127
127
  if (!autofillLabels)
128
128
  throw new Error(
129
- `[Sigil Error] Class '${ctor.name}' is not sigilified with 'autofillLabels' setted to 'false', Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
129
+ `[Sigil Error] Class '${ctor == null ? void 0 : ctor.name}' is not sigilified with 'autofillLabels' setted to 'false', Make sure to sigilify all Sigil classes or set 'autofillLabels' to 'true'`
130
130
  );
131
131
  return;
132
132
  }
@@ -136,21 +136,21 @@ function verifyLabel(ctor, label, opts) {
136
136
  let valid;
137
137
  if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
138
138
  else valid = labelValidation(label);
139
- if (process.env.NODE_ENV !== "production") {
140
- if (!valid)
141
- throw new Error(
142
- `[Sigil Error] Invalid identity label "${label}". Make sure that supplied label matches validation regex or function`
143
- );
144
- }
139
+ if (!valid)
140
+ throw new Error(
141
+ `[Sigil Error] Invalid identity label '${label}'. Make sure that supplied label matches validation regex or function`
142
+ );
145
143
  }
146
144
  }
147
- if (!globalThis.__SigilabelCounter) globalThis.__SigilabelCounter = 0;
145
+ function initCounter() {
146
+ if (!globalThis.__SigilabelCounter) globalThis.__SigilabelCounter = 0;
147
+ }
148
148
  function generateRandomLabel(ctor) {
149
- const namePart = ctor && typeof ctor.name === "string" && ctor.name.length ? ctor.name : "C";
149
+ initCounter();
150
150
  const counter = globalThis.__SigilabelCounter++;
151
151
  const time = Date.now().toString(36);
152
152
  const rand = Math.random().toString(36).slice(2, 6);
153
- return `${AUTO_LABEL_PREFEX}:${namePart}:${time}:${counter.toString(36)}:${rand}`;
153
+ return `${AUTO_LABEL_PREFEX}:${ctor == null ? void 0 : ctor.name}:${time}:${counter.toString(36)}:${rand}`;
154
154
  }
155
155
 
156
156
  // src/mixin.ts
@@ -164,17 +164,15 @@ function Sigilify(Base, label, opts) {
164
164
  * Class-level identity label constant for this sigil constructor.
165
165
  */
166
166
  static get SigilLabel() {
167
- var _a;
168
167
  handleSigil(this);
169
- return (_a = this.prototype) == null ? void 0 : _a[__LABEL__];
168
+ return this.prototype[__LABEL__];
170
169
  }
171
170
  /**
172
171
  * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.
173
172
  */
174
173
  static get SigilEffectiveLabel() {
175
- var _a;
176
174
  handleSigil(this);
177
- return (_a = this.prototype) == null ? void 0 : _a[__EFFECTIVE_LABEL__];
175
+ return this.prototype[__EFFECTIVE_LABEL__];
178
176
  }
179
177
  /**
180
178
  * Linearized sigil type label chain for the current constructor.
@@ -184,9 +182,8 @@ function Sigilify(Base, label, opts) {
184
182
  * @returns An array of labels representing parent → child type labels.
185
183
  */
186
184
  static get SigilLabelLineage() {
187
- var _a, _b;
188
185
  handleSigil(this);
189
- return [...(_b = (_a = this.prototype) == null ? void 0 : _a[__LINEAGE__]) != null ? _b : []];
186
+ return [...this.prototype[__LINEAGE__]];
190
187
  }
191
188
  /**
192
189
  * Sigil type label set for the current constructor.
@@ -195,24 +192,14 @@ function Sigilify(Base, label, opts) {
195
192
  * @returns A Readonly Set of labels that represent the type lineage.
196
193
  */
197
194
  static get SigilLabelSet() {
198
- var _a;
199
195
  handleSigil(this);
200
- return (_a = this.prototype) == null ? void 0 : _a[__LINEAGE__];
196
+ return this.prototype[__LINEAGE__];
201
197
  }
202
198
  constructor(...args) {
203
199
  super(...args);
204
200
  const ctor = new.target;
205
201
  handleSigil(ctor);
206
202
  }
207
- /**
208
- * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
209
- *
210
- * @param obj - The value to test.
211
- * @returns `true` if `obj` is a sigil instance.
212
- */
213
- static isSigilified(obj) {
214
- return isSigilInstance(obj);
215
- }
216
203
  /**
217
204
  * Check whether `other` is (or inherits from) the instance represented by the
218
205
  * calling constructor.
@@ -226,10 +213,9 @@ function Sigilify(Base, label, opts) {
226
213
  * @returns A type guard asserting `other` is an instance of the constructor.
227
214
  */
228
215
  static isOfType(other) {
229
- var _a;
230
216
  handleSigil(this);
231
217
  if (other == null || typeof other !== "object") return false;
232
- return other[(_a = this.prototype) == null ? void 0 : _a[__SIGIL__]] === true;
218
+ return other[this.prototype[__SIGIL__]] === true;
233
219
  }
234
220
  /**
235
221
  * Check whether `other` is exactly the same instance represented by the
@@ -241,12 +227,12 @@ function Sigilify(Base, label, opts) {
241
227
  * @returns A type guard asserting `other` is an instance of the constructor.
242
228
  */
243
229
  static isExactType(other) {
244
- var _a, _b, _c;
230
+ var _a, _b;
245
231
  handleSigil(this);
246
232
  if (other == null || typeof other !== "object") return false;
247
233
  if (((_a = this.prototype) == null ? void 0 : _a[__LINEAGE__].size) !== ((_b = other[__LINEAGE__]) == null ? void 0 : _b.size))
248
234
  return false;
249
- return other[(_c = this.prototype) == null ? void 0 : _c[__SIGIL__]] === true;
235
+ return other[this.prototype[__SIGIL__]] === true;
250
236
  }
251
237
  /**
252
238
  * Check whether `other` is (or inherits from) the instance represented by the
@@ -318,24 +304,22 @@ function Sigilify(Base, label, opts) {
318
304
  function SigilifyAbstract(Base, label, opts) {
319
305
  if (hasOwnSigil(Base))
320
306
  throw new Error(
321
- `[Sigil Error] Base class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`
307
+ `[Sigil Error] Class '${Base.name}' with label '${Base.SigilLabel}' is already sigilified`
322
308
  );
323
309
  class Sigilified extends Base {
324
310
  /**
325
311
  * Class-level identity label constant for this sigil constructor.
326
312
  */
327
313
  static get SigilLabel() {
328
- var _a;
329
314
  handleSigil(this);
330
- return (_a = this.prototype) == null ? void 0 : _a[__LABEL__];
315
+ return this.prototype[__LABEL__];
331
316
  }
332
317
  /**
333
318
  * Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.
334
319
  */
335
320
  static get SigilEffectiveLabel() {
336
- var _a;
337
321
  handleSigil(this);
338
- return (_a = this.prototype) == null ? void 0 : _a[__EFFECTIVE_LABEL__];
322
+ return this.prototype[__EFFECTIVE_LABEL__];
339
323
  }
340
324
  /**
341
325
  * Linearized sigil type label chain for the current constructor.
@@ -345,9 +329,8 @@ function SigilifyAbstract(Base, label, opts) {
345
329
  * @returns An array of labels representing parent → child type labels.
346
330
  */
347
331
  static get SigilLabelLineage() {
348
- var _a, _b;
349
332
  handleSigil(this);
350
- return [...(_b = (_a = this.prototype) == null ? void 0 : _a[__LINEAGE__]) != null ? _b : []];
333
+ return [...this.prototype[__LINEAGE__]];
351
334
  }
352
335
  /**
353
336
  * Sigil type label set for the current constructor.
@@ -356,24 +339,14 @@ function SigilifyAbstract(Base, label, opts) {
356
339
  * @returns A Readonly Set of labels that represent the type lineage.
357
340
  */
358
341
  static get SigilLabelSet() {
359
- var _a;
360
342
  handleSigil(this);
361
- return (_a = this.prototype) == null ? void 0 : _a[__LINEAGE__];
343
+ return this.prototype[__LINEAGE__];
362
344
  }
363
345
  constructor(...args) {
364
346
  super(...args);
365
347
  const ctor = new.target;
366
348
  handleSigil(ctor);
367
349
  }
368
- /**
369
- * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
370
- *
371
- * @param obj - The value to test.
372
- * @returns `true` if `obj` is a sigil instance.
373
- */
374
- static isSigilified(obj) {
375
- return isSigilInstance(obj);
376
- }
377
350
  /**
378
351
  * Check whether `other` is (or inherits from) the instance represented by the
379
352
  * calling constructor.
@@ -387,9 +360,9 @@ function SigilifyAbstract(Base, label, opts) {
387
360
  * @returns A type guard asserting `other` is an instance of the constructor.
388
361
  */
389
362
  static isOfType(other) {
390
- var _a;
363
+ handleSigil(this);
391
364
  if (other == null || typeof other !== "object") return false;
392
- return other[(_a = this.prototype) == null ? void 0 : _a[__SIGIL__]] === true;
365
+ return other[this.prototype[__SIGIL__]] === true;
393
366
  }
394
367
  /**
395
368
  * Check whether `other` is exactly the same instance represented by the
@@ -401,11 +374,12 @@ function SigilifyAbstract(Base, label, opts) {
401
374
  * @returns A type guard asserting `other` is an instance of the constructor.
402
375
  */
403
376
  static isExactType(other) {
404
- var _a, _b, _c;
377
+ var _a, _b;
378
+ handleSigil(this);
405
379
  if (other == null || typeof other !== "object") return false;
406
380
  if (((_a = this.prototype) == null ? void 0 : _a[__LINEAGE__].size) !== ((_b = other[__LINEAGE__]) == null ? void 0 : _b.size))
407
381
  return false;
408
- return other[(_c = this.prototype) == null ? void 0 : _c[__SIGIL__]] === true;
382
+ return other[this.prototype[__SIGIL__]] === true;
409
383
  }
410
384
  /**
411
385
  * Check whether `other` is (or inherits from) the instance represented by the
@@ -483,10 +457,9 @@ var SigilError = Sigilify(Error, "SigilError");
483
457
  // src/decorator.ts
484
458
  function WithSigil(label, opts) {
485
459
  return function(value, context) {
486
- if (context.kind !== "class") return;
487
460
  if (!isSigilCtor(value))
488
461
  throw new Error(
489
- `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`
462
+ `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class '${value.name}'`
490
463
  );
491
464
  if (hasOwnSigil(value))
492
465
  throw new Error(
@@ -498,10 +471,9 @@ function WithSigil(label, opts) {
498
471
 
499
472
  // src/hof.ts
500
473
  function withSigil(Class, label, opts) {
501
- var _a;
502
474
  if (!isSigilCtor(Class))
503
475
  throw new Error(
504
- `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${(_a = Class == null ? void 0 : Class.name) != null ? _a : "unknown"}`
476
+ `[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class '${Class.name}'`
505
477
  );
506
478
  if (hasOwnSigil(Class))
507
479
  throw new Error(
@@ -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":";AAiCO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB;AAClB,CAAA;AAQO,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,IAAA,IAAI,QAAQ,IAAA,IAAQ,OAAO,GAAA,KAAQ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,CAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,2EAAA,EAAA,CAA8E,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,IAAA,KAAP,IAAA,GAAA,EAAA,GAAe,SAAS,CAAA;AAAA,KACxG;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 * 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 * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n autofillLabels: true,\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 DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\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 handledCtors.add(ctor);\n\n // Verify label\n verifyLabel(ctor, label, opts);\n\n // check ancestors to ensure that every label in sigil chain in unique\n const ancLabelsMap = handleAncestors(ctor, opts);\n\n // make sure that newly passed label is unique as well\n if (label && ancLabelsMap.has(label))\n throw new Error(\n `[Sigil Error] Attempt to assign label '${label}' to ${ctor.name} but label is already used by parent '${ancLabelsMap.get(label)}', Make sure that every class has a unique label`\n );\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(ctor: Function, opts?: SigilOptions): Map<string, string> {\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 with 'autofillLabels' setted to 'false', 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 return labelOwner;\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}\n\n/** -----------------------------------------\n * Introspection 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' && __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 * Label helpers\n * ----------------------------------------- */\n\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 with 'autofillLabels' setted to 'false', 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 (labelValidation) {\n let valid: boolean;\n if (labelValidation instanceof RegExp) valid = labelValidation.test(label);\n else valid = labelValidation(label);\n\n if (process.env.NODE_ENV !== 'production')\n if (!valid)\n throw new Error(\n `[Sigil Error] Invalid identity label \"${label}\". Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\nif (!(globalThis as any).__SigilabelCounter) (globalThis as any).__SigilabelCounter = 0;\n\nfunction generateRandomLabel(ctor: Function): string {\n const namePart = ctor && typeof ctor.name === 'string' && ctor.name.length ? ctor.name : 'C';\n\n const counter = (globalThis as any).__SigilabelCounter++;\n const time = Date.now().toString(36);\n const rand = Math.random().toString(36).slice(2, 6);\n\n return `${AUTO_LABEL_PREFEX}:${namePart}:${time}:${counter.toString(36)}:${rand}`;\n}\n","import { handleSigil, hasOwnSigil, isSigilInstance } 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} from './types';\nimport { sigil } 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 - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new 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 * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigilInstance {\n return isSigilInstance(obj);\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:mm2gkdwn:0:g1sq').\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 - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').\n * If not passed a random label is generated instead.\n * @param opts - Options object to override any global options if needed.\n * @returns A new abstract constructor that extends `Base` and includes Sigil statics/instance methods.\n * @throws Error if `Base` is already 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] Base 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 * Runtime predicate indicating whether `obj` is an instance produced by a sigil class.\n *\n * @param obj - The value to test.\n * @returns `true` if `obj` is a sigil instance.\n */\n static isSigilified(obj: unknown): obj is ISigilInstance {\n return isSigilInstance(obj);\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 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 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:mm2gkdwn:0:g1sq').\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 { 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 // Only apply to class declarations\n if (context.kind !== 'class') return;\n if (!isSigilCtor(value))\n throw new Error(\n `[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`\n );\n 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 ?? 'unknown'}`\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":";AAiCO,IAAM,OAAA,GAAkC;AAAA,EAC7C,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB;AAClB,CAAA;AAQO,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,IAAA,IAAI,QAAQ,IAAA,IAAQ,OAAO,GAAA,KAAQ,UAAA,IAAc,EAAE,GAAA,YAAe,MAAA,CAAA;AAChE,MAAA,MAAM,IAAI,MAAM,uEAAuE,CAAA;AACzF,IAAA,OAAA,CAAQ,kBAAkB,GAAA,IAAA,IAAA,GAAA,GAAA,GAAO,IAAA;AAAA,EACnC;AACF;AAaO,IAAM,mBAAA,GAAsB;;;AChE5B,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAUrD,IAAM,SAAA,mBAAY,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAUrD,IAAM,mBAAA,mBAAsB,MAAA,CAAO,GAAA,CAAI,kCAAkC,CAAA;AAUzE,IAAM,WAAA,mBAAc,MAAA,CAAO,GAAA,CAAI,0BAA0B,CAAA;;;AC/BhE,IAAM,iBAAA,GAAoB,aAAA;AAO1B,IAAM,YAAA,uBAAmB,OAAA,EAAkB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,YAAY;;;ACT/C,SAAS,SAAA,CAAU,OAAe,IAAA,EAAqB;AAC5D,EAAA,OAAO,SAAU,OAAiB,OAAA,EAAc;AAE9C,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;;;ACXO,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 * 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 * Main options object\n * ----------------------------------------- */\n\n/**\n * Defined SigilOptions used in the library.\n *\n * @internal\n */\nexport const OPTIONS: Required<SigilOptions> = {\n labelValidation: null,\n autofillLabels: true,\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 DEFAULT_LABEL_REGEX = /^@[\\w-]+(?:\\/[\\w-]+)*\\.[A-Z][A-Za-z0-9]*$/;\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 const ancLabelsMap = handleAncestors(ctor, opts);\n\n // make sure that newly passed label is unique as well\n if (label && ancLabelsMap.has(label))\n throw new Error(\n `[Sigil Error] Attempt to assign label '${label}' to class '${ctor?.name}' but label is already used by parent '${ancLabelsMap.get(label)}', Make sure that every class has a unique label`\n );\n\n // handle current class\n sigilify(ctor, label ?? generateRandomLabel(ctor));\n\n // mark as handled\n handledCtors.add(ctor);\n}\n\n/** -----------------------------------------\n * Generic helpers\n * ----------------------------------------- */\n\nfunction handleAncestors(\n ctor: Function,\n opts?: Pick<SigilOptions, 'autofillLabels'>\n): Map<string, string> {\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 with 'autofillLabels' setted to 'false', 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 return labelOwner;\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}\n\n/** -----------------------------------------\n * Introspection 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 * Label helpers\n * ----------------------------------------- */\n\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 with 'autofillLabels' setted to 'false', 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 (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 identity label '${label}'. Make sure that supplied label matches validation regex or function`\n );\n }\n}\n\nfunction initCounter() {\n if (!(globalThis as any).__SigilabelCounter) (globalThis as any).__SigilabelCounter = 0;\n}\n\nfunction generateRandomLabel(ctor: Function): string {\n initCounter();\n\n const counter = (globalThis as any).__SigilabelCounter++;\n const time = Date.now().toString(36);\n const rand = Math.random().toString(36).slice(2, 6);\n\n return `${AUTO_LABEL_PREFEX}:${ctor?.name}:${time}:${counter.toString(36)}:${rand}`;\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:mm2gkdwn:0:g1sq').\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:mm2gkdwn:0:g1sq').\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 // Only apply to class declarations\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.1.0",
3
+ "version": "3.1.3",
4
4
  "description": "Lightweight TypeScript library for nominal identity classes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "test:types": "tsd",
28
28
  "prepublishOnly": "npm run build && npm run test:unit && npm run test:types",
29
29
  "size": "npm run build && size-limit",
30
- "bench": "npm install && npm run test:performance"
30
+ "bench": "npm run test:performance"
31
31
  },
32
32
  "files": [
33
33
  "dist",