@vicin/sigil 2.0.3 → 2.1.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 +10 -3
- package/README.md +9 -9
- package/dist/index.d.mts +5 -52
- package/dist/index.d.ts +5 -52
- package/dist/index.global.js +20 -10
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.1.0] - 2026-02-22
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Changed name of `updateOptions` to be `updateSigilOptions`
|
|
10
|
+
- Updated JSDOCs of multiple APIs
|
|
11
|
+
|
|
5
12
|
## [2.0.3] - 2026-02-21
|
|
6
13
|
|
|
7
14
|
- Patched types
|
|
@@ -26,19 +33,19 @@ All notable changes to this project will be documented in this file.
|
|
|
26
33
|
|
|
27
34
|
### Breaking changes
|
|
28
35
|
|
|
29
|
-
- All `SigilRegistry`options, methods and classes are removed
|
|
36
|
+
- All `SigilRegistry`options, methods and classes are removed
|
|
30
37
|
|
|
31
38
|
## [1.3.0] - 2026-02-18
|
|
32
39
|
|
|
33
40
|
### Added
|
|
34
41
|
|
|
35
|
-
- `isOfType()` & `isOfTypeStrict()` now can be called from instances
|
|
42
|
+
- `isOfType()` & `isOfTypeStrict()` now can be called from instances
|
|
36
43
|
|
|
37
44
|
## [1.2.7] - 2026-02-13
|
|
38
45
|
|
|
39
46
|
### Added
|
|
40
47
|
|
|
41
|
-
- Support for `abstract` classes using `SigilifyAbstract` factory
|
|
48
|
+
- Support for `abstract` classes using `SigilifyAbstract` factory
|
|
42
49
|
|
|
43
50
|
## [1.2.6] - 2026-02-11
|
|
44
51
|
|
package/README.md
CHANGED
|
@@ -156,8 +156,8 @@ Migrating old code into `Sigil` can be done seamlessly with this set-up:
|
|
|
156
156
|
1. Set `SigilOptions.autofillLabels` to `true` at the start of the app so no errors are thrown in the migration stage:
|
|
157
157
|
|
|
158
158
|
```ts
|
|
159
|
-
import {
|
|
160
|
-
|
|
159
|
+
import { updateSigilOptions } from '@vicin/sigil';
|
|
160
|
+
updateSigilOptions({ autofillLabels: true });
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
2. Pass your base class to `Sigilify` mixin:
|
|
@@ -384,7 +384,7 @@ class X extends Sigil {
|
|
|
384
384
|
- `isInheritanceChecked(ctor)`
|
|
385
385
|
|
|
386
386
|
- **Options:**
|
|
387
|
-
- `
|
|
387
|
+
- `updateSigilOptions(opts)`
|
|
388
388
|
- `DEFAULT_LABEL_REGEX`
|
|
389
389
|
|
|
390
390
|
- **Types:**
|
|
@@ -407,7 +407,7 @@ class X extends Sigil {
|
|
|
407
407
|
- `withSigilTyped(Class, label?, opts?)`: like `withSigil` but narrows the TypeScript type to include brands.
|
|
408
408
|
- `isSigilCtor(value)`: `true` if `value` is a `Sigil` constructor.
|
|
409
409
|
- `isSigilInstance(value)`: `true` if `value` is an instance of a `Sigil` constructor.
|
|
410
|
-
- `
|
|
410
|
+
- `updateSigilOptions(opts)`: change global runtime options before `Sigil` decoration (e.g., `autofillLabels`).
|
|
411
411
|
- `DEFAULT_LABEL_REGEX`: regex that ensures structure of `@scope/package.ClassName` to all labels, it's advised to use it as your `SigilOptions.labelValidation`
|
|
412
412
|
|
|
413
413
|
### Instance & static helpers provided by Sigilified constructors
|
|
@@ -437,9 +437,9 @@ Instances of sigilified classes expose instance helpers:
|
|
|
437
437
|
Customize behavior globally at startup:
|
|
438
438
|
|
|
439
439
|
```ts
|
|
440
|
-
import {
|
|
440
|
+
import { updateSigilOptions } from '@vicin/sigil';
|
|
441
441
|
|
|
442
|
-
|
|
442
|
+
updateSigilOptions({
|
|
443
443
|
autofillLabels: false, // Automatically label unlabeled subclasses
|
|
444
444
|
skipLabelInheritanceCheck: false, // Bypass dev inheritance checks -- ALMOST NEVER WANT TO SET THIS TO TRUE, Use 'autofillLabels: true' instead.
|
|
445
445
|
labelValidation: null, // Function or regex, Enforce label format
|
|
@@ -452,13 +452,13 @@ Values defined in previous example are defaults, per-class overrides available i
|
|
|
452
452
|
|
|
453
453
|
## Minimal mode
|
|
454
454
|
|
|
455
|
-
`
|
|
455
|
+
`updateSigilOptions({ autofillLabels: true });` – Enables background operation without explicit labels:
|
|
456
456
|
|
|
457
457
|
```ts
|
|
458
|
-
import { Sigil,
|
|
458
|
+
import { Sigil, updateSigilOptions } from '@vicin/sigil';
|
|
459
459
|
|
|
460
460
|
// run at the start of the app
|
|
461
|
-
|
|
461
|
+
updateSigilOptions({ autofillLabels: true });
|
|
462
462
|
|
|
463
463
|
// No decorators or HOF needed to use 'isOfType' ('instanceof' replacement)
|
|
464
464
|
class A extends Sigil {}
|
package/dist/index.d.mts
CHANGED
|
@@ -322,7 +322,7 @@ interface SigilOptions {
|
|
|
322
322
|
*
|
|
323
323
|
* @param opts - Partial options to merge into the global `OPTIONS` object.
|
|
324
324
|
*/
|
|
325
|
-
declare const
|
|
325
|
+
declare const updateSigilOptions: (opts: SigilOptions) => void;
|
|
326
326
|
/** -----------------------------------------
|
|
327
327
|
* Label validation
|
|
328
328
|
* ----------------------------------------- */
|
|
@@ -338,17 +338,6 @@ declare const DEFAULT_LABEL_REGEX: RegExp;
|
|
|
338
338
|
/**
|
|
339
339
|
* Class decorator factory that attaches sigil statics to a class constructor.
|
|
340
340
|
*
|
|
341
|
-
* Usage:
|
|
342
|
-
* ```ts
|
|
343
|
-
* @WithSigil('@myorg/mypkg.MyClass')
|
|
344
|
-
* class MyClass { ... }
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* The returned decorator:
|
|
348
|
-
* - validates the provided label (via `verifyLabel`)
|
|
349
|
-
* - performs inheritance checks (via `checkInheritance`) in DEV builds
|
|
350
|
-
* - attaches sigil-related statics to the constructor (via `decorateCtor`)
|
|
351
|
-
*
|
|
352
341
|
* Notes:
|
|
353
342
|
* - This decorator is intended to be applied to classes only. When used
|
|
354
343
|
* incorrectly (e.g. on a property), it is a no-op.
|
|
@@ -366,13 +355,6 @@ declare function WithSigil<L extends string>(label?: L, opts?: SigilOptions): (v
|
|
|
366
355
|
* HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.
|
|
367
356
|
* Alternative to '@WithSigil' if you prefer HOFs.
|
|
368
357
|
*
|
|
369
|
-
* This does both:
|
|
370
|
-
* - validate (and autofill) a label,
|
|
371
|
-
* - perform runtime decoration (via `decorateCtor`),
|
|
372
|
-
*
|
|
373
|
-
* The helper is idempotent: `decorateCtor` will register the label and throw if already
|
|
374
|
-
* decorated; we handle this gracefully in DEV to support HMR flows.
|
|
375
|
-
*
|
|
376
358
|
* @typeParam S - Constructor type (should be an ISigil).
|
|
377
359
|
* @typeParam L - Label literal to attach.
|
|
378
360
|
* @param Class - The constructor (class) to enhance.
|
|
@@ -382,15 +364,7 @@ declare function WithSigil<L extends string>(label?: L, opts?: SigilOptions): (v
|
|
|
382
364
|
*/
|
|
383
365
|
declare function withSigil<S extends Function, L extends string = string>(Class: S, label?: L, opts?: SigilOptions): S;
|
|
384
366
|
/**
|
|
385
|
-
* Convenience helper that combine 'withSigil' and '
|
|
386
|
-
*
|
|
387
|
-
* This does both:
|
|
388
|
-
* - validate (and autofill) a label,
|
|
389
|
-
* - perform runtime decoration (via `decorateCtor`),
|
|
390
|
-
* - return the constructor typed as `TypedSigil`.
|
|
391
|
-
*
|
|
392
|
-
* The helper is idempotent: `decorateCtor` will register the label and throw if already
|
|
393
|
-
* decorated; we handle this gracefully in DEV to support HMR flows.
|
|
367
|
+
* Convenience helper that combine 'withSigil' and update 'SigilBrand'.
|
|
394
368
|
*
|
|
395
369
|
* @typeParam S - Constructor type (should be an ISigil).
|
|
396
370
|
* @typeParam L - Label literal to attach.
|
|
@@ -405,9 +379,6 @@ declare function withSigilTyped<S extends Function, L extends string = string>(C
|
|
|
405
379
|
/**
|
|
406
380
|
* Runtime predicate that checks whether the provided value is a sigil constructor.
|
|
407
381
|
*
|
|
408
|
-
* This is a lightweight check that verifies the presence of an internal
|
|
409
|
-
* symbol attached to the constructor.
|
|
410
|
-
*
|
|
411
382
|
* @param ctor - Constructor to test.
|
|
412
383
|
* @returns `true` if `value` is a sigil constructor, otherwise `false`.
|
|
413
384
|
*/
|
|
@@ -423,8 +394,6 @@ declare function isSigilInstance(inst: unknown): inst is GetInstance<ISigil>;
|
|
|
423
394
|
/**
|
|
424
395
|
* Check whether the provided constructor was marked as a sigil base constructor.
|
|
425
396
|
*
|
|
426
|
-
* Uses `Object.hasOwn` to ensure we only check own properties.
|
|
427
|
-
*
|
|
428
397
|
* @param ctor - Constructor to check.
|
|
429
398
|
* @returns `true` if `ctor` is a sigil base constructor.
|
|
430
399
|
*/
|
|
@@ -432,8 +401,6 @@ declare function isSigilBaseCtor(ctor: Function): ctor is ISigil;
|
|
|
432
401
|
/**
|
|
433
402
|
* Check whether the provided object is an instance of a sigil base constructor.
|
|
434
403
|
*
|
|
435
|
-
* This resolves the instance's constructor and delegates to `isSigilBaseCtor`.
|
|
436
|
-
*
|
|
437
404
|
* @param inst - The instance to test.
|
|
438
405
|
* @returns `true` if `inst` is an instance of a sigil base constructor.
|
|
439
406
|
*/
|
|
@@ -441,8 +408,6 @@ declare function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil>
|
|
|
441
408
|
/**
|
|
442
409
|
* Returns whether the constructor has been explicitly decorated with `WithSigil`.
|
|
443
410
|
*
|
|
444
|
-
* This is an own-property check and does not traverse the prototype chain.
|
|
445
|
-
*
|
|
446
411
|
* @internal
|
|
447
412
|
* @param ctor - Constructor to test.
|
|
448
413
|
* @returns `true` if the constructor is explicitly decorated.
|
|
@@ -451,8 +416,6 @@ declare function isDecorated(ctor: Function): boolean;
|
|
|
451
416
|
/**
|
|
452
417
|
* Returns whether inheritance checks have already been performed for the constructor.
|
|
453
418
|
*
|
|
454
|
-
* This is used to avoid repeated checks during development (DEV-only checks).
|
|
455
|
-
*
|
|
456
419
|
* @internal
|
|
457
420
|
* @param ctor - Constructor to test.
|
|
458
421
|
* @returns `true` if inheritance checks were marked as completed.
|
|
@@ -460,12 +423,7 @@ declare function isDecorated(ctor: Function): boolean;
|
|
|
460
423
|
declare function isInheritanceChecked(ctor: Function): boolean;
|
|
461
424
|
|
|
462
425
|
/**
|
|
463
|
-
* Mixin factory that augments an existing class with Sigil runtime metadata and
|
|
464
|
-
* helpers.
|
|
465
|
-
*
|
|
466
|
-
* The returned class:
|
|
467
|
-
* - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
|
|
468
|
-
* - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
|
|
426
|
+
* Mixin factory that augments an existing class with Sigil runtime metadata and helpers.
|
|
469
427
|
*
|
|
470
428
|
* @param Base - The base constructor to extend.
|
|
471
429
|
* @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').
|
|
@@ -587,12 +545,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
587
545
|
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
588
546
|
} & B;
|
|
589
547
|
/**
|
|
590
|
-
* Mixin factory that augments an existing class with Sigil runtime metadata and
|
|
591
|
-
* helpers. Accept and return 'abstract' class.
|
|
592
|
-
*
|
|
593
|
-
* The returned class:
|
|
594
|
-
* - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
|
|
595
|
-
* - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
|
|
548
|
+
* Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.
|
|
596
549
|
*
|
|
597
550
|
* @param Base - The base constructor to extend.
|
|
598
551
|
* @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').
|
|
@@ -721,4 +674,4 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
|
|
|
721
674
|
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
722
675
|
}) & B;
|
|
723
676
|
|
|
724
|
-
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, Sigil, type SigilBrandOf, SigilError, type SigilOptions, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance,
|
|
677
|
+
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, Sigil, type SigilBrandOf, SigilError, type SigilOptions, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, updateSigilOptions, withSigil, withSigilTyped };
|
package/dist/index.d.ts
CHANGED
|
@@ -322,7 +322,7 @@ interface SigilOptions {
|
|
|
322
322
|
*
|
|
323
323
|
* @param opts - Partial options to merge into the global `OPTIONS` object.
|
|
324
324
|
*/
|
|
325
|
-
declare const
|
|
325
|
+
declare const updateSigilOptions: (opts: SigilOptions) => void;
|
|
326
326
|
/** -----------------------------------------
|
|
327
327
|
* Label validation
|
|
328
328
|
* ----------------------------------------- */
|
|
@@ -338,17 +338,6 @@ declare const DEFAULT_LABEL_REGEX: RegExp;
|
|
|
338
338
|
/**
|
|
339
339
|
* Class decorator factory that attaches sigil statics to a class constructor.
|
|
340
340
|
*
|
|
341
|
-
* Usage:
|
|
342
|
-
* ```ts
|
|
343
|
-
* @WithSigil('@myorg/mypkg.MyClass')
|
|
344
|
-
* class MyClass { ... }
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* The returned decorator:
|
|
348
|
-
* - validates the provided label (via `verifyLabel`)
|
|
349
|
-
* - performs inheritance checks (via `checkInheritance`) in DEV builds
|
|
350
|
-
* - attaches sigil-related statics to the constructor (via `decorateCtor`)
|
|
351
|
-
*
|
|
352
341
|
* Notes:
|
|
353
342
|
* - This decorator is intended to be applied to classes only. When used
|
|
354
343
|
* incorrectly (e.g. on a property), it is a no-op.
|
|
@@ -366,13 +355,6 @@ declare function WithSigil<L extends string>(label?: L, opts?: SigilOptions): (v
|
|
|
366
355
|
* HOF (class inhancer) that attaches runtime sigil metadata to Sigil class.
|
|
367
356
|
* Alternative to '@WithSigil' if you prefer HOFs.
|
|
368
357
|
*
|
|
369
|
-
* This does both:
|
|
370
|
-
* - validate (and autofill) a label,
|
|
371
|
-
* - perform runtime decoration (via `decorateCtor`),
|
|
372
|
-
*
|
|
373
|
-
* The helper is idempotent: `decorateCtor` will register the label and throw if already
|
|
374
|
-
* decorated; we handle this gracefully in DEV to support HMR flows.
|
|
375
|
-
*
|
|
376
358
|
* @typeParam S - Constructor type (should be an ISigil).
|
|
377
359
|
* @typeParam L - Label literal to attach.
|
|
378
360
|
* @param Class - The constructor (class) to enhance.
|
|
@@ -382,15 +364,7 @@ declare function WithSigil<L extends string>(label?: L, opts?: SigilOptions): (v
|
|
|
382
364
|
*/
|
|
383
365
|
declare function withSigil<S extends Function, L extends string = string>(Class: S, label?: L, opts?: SigilOptions): S;
|
|
384
366
|
/**
|
|
385
|
-
* Convenience helper that combine 'withSigil' and '
|
|
386
|
-
*
|
|
387
|
-
* This does both:
|
|
388
|
-
* - validate (and autofill) a label,
|
|
389
|
-
* - perform runtime decoration (via `decorateCtor`),
|
|
390
|
-
* - return the constructor typed as `TypedSigil`.
|
|
391
|
-
*
|
|
392
|
-
* The helper is idempotent: `decorateCtor` will register the label and throw if already
|
|
393
|
-
* decorated; we handle this gracefully in DEV to support HMR flows.
|
|
367
|
+
* Convenience helper that combine 'withSigil' and update 'SigilBrand'.
|
|
394
368
|
*
|
|
395
369
|
* @typeParam S - Constructor type (should be an ISigil).
|
|
396
370
|
* @typeParam L - Label literal to attach.
|
|
@@ -405,9 +379,6 @@ declare function withSigilTyped<S extends Function, L extends string = string>(C
|
|
|
405
379
|
/**
|
|
406
380
|
* Runtime predicate that checks whether the provided value is a sigil constructor.
|
|
407
381
|
*
|
|
408
|
-
* This is a lightweight check that verifies the presence of an internal
|
|
409
|
-
* symbol attached to the constructor.
|
|
410
|
-
*
|
|
411
382
|
* @param ctor - Constructor to test.
|
|
412
383
|
* @returns `true` if `value` is a sigil constructor, otherwise `false`.
|
|
413
384
|
*/
|
|
@@ -423,8 +394,6 @@ declare function isSigilInstance(inst: unknown): inst is GetInstance<ISigil>;
|
|
|
423
394
|
/**
|
|
424
395
|
* Check whether the provided constructor was marked as a sigil base constructor.
|
|
425
396
|
*
|
|
426
|
-
* Uses `Object.hasOwn` to ensure we only check own properties.
|
|
427
|
-
*
|
|
428
397
|
* @param ctor - Constructor to check.
|
|
429
398
|
* @returns `true` if `ctor` is a sigil base constructor.
|
|
430
399
|
*/
|
|
@@ -432,8 +401,6 @@ declare function isSigilBaseCtor(ctor: Function): ctor is ISigil;
|
|
|
432
401
|
/**
|
|
433
402
|
* Check whether the provided object is an instance of a sigil base constructor.
|
|
434
403
|
*
|
|
435
|
-
* This resolves the instance's constructor and delegates to `isSigilBaseCtor`.
|
|
436
|
-
*
|
|
437
404
|
* @param inst - The instance to test.
|
|
438
405
|
* @returns `true` if `inst` is an instance of a sigil base constructor.
|
|
439
406
|
*/
|
|
@@ -441,8 +408,6 @@ declare function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil>
|
|
|
441
408
|
/**
|
|
442
409
|
* Returns whether the constructor has been explicitly decorated with `WithSigil`.
|
|
443
410
|
*
|
|
444
|
-
* This is an own-property check and does not traverse the prototype chain.
|
|
445
|
-
*
|
|
446
411
|
* @internal
|
|
447
412
|
* @param ctor - Constructor to test.
|
|
448
413
|
* @returns `true` if the constructor is explicitly decorated.
|
|
@@ -451,8 +416,6 @@ declare function isDecorated(ctor: Function): boolean;
|
|
|
451
416
|
/**
|
|
452
417
|
* Returns whether inheritance checks have already been performed for the constructor.
|
|
453
418
|
*
|
|
454
|
-
* This is used to avoid repeated checks during development (DEV-only checks).
|
|
455
|
-
*
|
|
456
419
|
* @internal
|
|
457
420
|
* @param ctor - Constructor to test.
|
|
458
421
|
* @returns `true` if inheritance checks were marked as completed.
|
|
@@ -460,12 +423,7 @@ declare function isDecorated(ctor: Function): boolean;
|
|
|
460
423
|
declare function isInheritanceChecked(ctor: Function): boolean;
|
|
461
424
|
|
|
462
425
|
/**
|
|
463
|
-
* Mixin factory that augments an existing class with Sigil runtime metadata and
|
|
464
|
-
* helpers.
|
|
465
|
-
*
|
|
466
|
-
* The returned class:
|
|
467
|
-
* - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
|
|
468
|
-
* - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
|
|
426
|
+
* Mixin factory that augments an existing class with Sigil runtime metadata and helpers.
|
|
469
427
|
*
|
|
470
428
|
* @param Base - The base constructor to extend.
|
|
471
429
|
* @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').
|
|
@@ -587,12 +545,7 @@ declare function Sigilify<B extends Constructor, L extends string>(Base: B, labe
|
|
|
587
545
|
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
588
546
|
} & B;
|
|
589
547
|
/**
|
|
590
|
-
* Mixin factory that augments an existing class with Sigil runtime metadata and
|
|
591
|
-
* helpers. Accept and return 'abstract' class.
|
|
592
|
-
*
|
|
593
|
-
* The returned class:
|
|
594
|
-
* - exposes static helpers such as `SigilLabel`, `SigilType`, `isOfType`, and `isOfTypeStrict`
|
|
595
|
-
* - exposes instance helpers such as `getSigilLabel`, `getSigilType`, etc.
|
|
548
|
+
* Mixin factory that augments an existing class with Sigil runtime metadata and helpers. Accept and return 'abstract' class.
|
|
596
549
|
*
|
|
597
550
|
* @param Base - The base constructor to extend.
|
|
598
551
|
* @param label - Optional identity label to attach to the resulting class (e.g. '@scope/pkg.ClassName').
|
|
@@ -721,4 +674,4 @@ declare function SigilifyAbstract<B extends ConstructorAbstract, L extends strin
|
|
|
721
674
|
isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
|
|
722
675
|
}) & B;
|
|
723
676
|
|
|
724
|
-
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, Sigil, type SigilBrandOf, SigilError, type SigilOptions, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance,
|
|
677
|
+
export { DEFAULT_LABEL_REGEX, type GetInstance, type ISigil, type ISigilInstance, type ISigilStatic, Sigil, type SigilBrandOf, SigilError, type SigilOptions, Sigilify, SigilifyAbstract, type TypedSigil, type UpdateSigilBrand, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, updateSigilOptions, withSigil, withSigilTyped };
|
package/dist/index.global.js
CHANGED
|
@@ -11,15 +11,25 @@
|
|
|
11
11
|
skipLabelInheritanceCheck: false,
|
|
12
12
|
autofillLabels: false
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
var updateSigilOptions = (opts) => {
|
|
15
|
+
if (opts.autofillLabels) {
|
|
16
|
+
if (typeof opts.autofillLabels !== "boolean")
|
|
17
|
+
throw new Error("'updateSigilOptions.autofillLabels' must be boolean");
|
|
18
|
+
OPTIONS.autofillLabels = opts.autofillLabels;
|
|
19
|
+
}
|
|
20
|
+
if (opts.skipLabelInheritanceCheck) {
|
|
21
|
+
if (typeof opts.skipLabelInheritanceCheck !== "boolean")
|
|
22
|
+
throw new Error("'updateSigilOptions.skipLabelInheritanceCheck' must be boolean");
|
|
23
|
+
OPTIONS.skipLabelInheritanceCheck = opts.skipLabelInheritanceCheck;
|
|
24
|
+
}
|
|
25
|
+
if (opts.labelValidation) {
|
|
26
|
+
if (opts.labelValidation !== null && typeof opts.labelValidation !== "function" && !(opts.labelValidation instanceof RegExp))
|
|
27
|
+
throw new Error(
|
|
28
|
+
"'updateSigilOptions.labelValidation' must be null, function or regex expression"
|
|
29
|
+
);
|
|
30
|
+
OPTIONS.labelValidation = opts.labelValidation;
|
|
31
|
+
}
|
|
21
32
|
};
|
|
22
|
-
updateOptions(DEFAULT_OPTIONS);
|
|
23
33
|
var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
|
|
24
34
|
|
|
25
35
|
// src/core/symbols.ts
|
|
@@ -2257,7 +2267,7 @@
|
|
|
2257
2267
|
};
|
|
2258
2268
|
}
|
|
2259
2269
|
|
|
2260
|
-
// src/core/
|
|
2270
|
+
// src/core/hof.ts
|
|
2261
2271
|
function withSigil(Class, label, opts) {
|
|
2262
2272
|
var _a;
|
|
2263
2273
|
if (!isSigilCtor(Class))
|
|
@@ -2308,7 +2318,7 @@
|
|
|
2308
2318
|
exports.isSigilBaseInstance = isSigilBaseInstance;
|
|
2309
2319
|
exports.isSigilCtor = isSigilCtor;
|
|
2310
2320
|
exports.isSigilInstance = isSigilInstance;
|
|
2311
|
-
exports.
|
|
2321
|
+
exports.updateSigilOptions = updateSigilOptions;
|
|
2312
2322
|
exports.withSigil = withSigil;
|
|
2313
2323
|
exports.withSigilTyped = withSigilTyped;
|
|
2314
2324
|
|