@vicin/sigil 1.2.7 → 2.0.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 +12 -0
- package/README.md +23 -131
- package/dist/index.d.mts +163 -403
- package/dist/index.d.ts +163 -403
- package/dist/index.global.js +1865 -432
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +154 -437
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -435
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -8
package/dist/index.js
CHANGED
|
@@ -1,297 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
3
|
+
var cuid2 = require('@paralleldrive/cuid2');
|
|
6
4
|
|
|
7
5
|
// src/core/options.ts
|
|
8
6
|
var OPTIONS = {
|
|
9
7
|
labelValidation: null,
|
|
10
8
|
skipLabelInheritanceCheck: false,
|
|
11
9
|
autofillLabels: false,
|
|
12
|
-
devMarker: false
|
|
13
|
-
registry: null,
|
|
14
|
-
useGlobalRegistry: false,
|
|
15
|
-
storeConstructor: false
|
|
10
|
+
devMarker: false
|
|
16
11
|
};
|
|
17
|
-
var
|
|
18
|
-
var updateGlobalRegistry = (map) => {
|
|
19
|
-
if (map === null) delete globalThis[__SIGIL_REGISTRY__];
|
|
20
|
-
else globalThis[__SIGIL_REGISTRY__] = map;
|
|
21
|
-
};
|
|
22
|
-
var getGlobalRegistry = () => {
|
|
23
|
-
const val = globalThis[__SIGIL_REGISTRY__];
|
|
24
|
-
return val === void 0 ? null : val;
|
|
25
|
-
};
|
|
26
|
-
var SigilRegistry = class _SigilRegistry {
|
|
27
|
-
/**
|
|
28
|
-
* @param map - Map used to register 'Sigil' classes. if not passed it will be auto-generated internally.
|
|
29
|
-
*/
|
|
30
|
-
constructor(map) {
|
|
31
|
-
/** Internal private registry map. */
|
|
32
|
-
__publicField(this, "_registry");
|
|
33
|
-
this._registry = map != null ? map : /* @__PURE__ */ new Map();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Return a readonly view (array) of the current registry entries.
|
|
37
|
-
*
|
|
38
|
-
* @returns An array containing all registered labels, or an empty array when registry is disabled.
|
|
39
|
-
*/
|
|
40
|
-
listLabels() {
|
|
41
|
-
return this._registry ? Array.from(this._registry.keys()) : [];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Determine whether the registry currently contains `label`.
|
|
45
|
-
*
|
|
46
|
-
* @param label - The label to test.
|
|
47
|
-
* @returns `true` if present; `false` otherwise.
|
|
48
|
-
*/
|
|
49
|
-
has(label) {
|
|
50
|
-
return !!this._registry && this._registry.has(label);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get class constructor using its label.
|
|
54
|
-
*
|
|
55
|
-
* @param label - Label appended to Sigil class.
|
|
56
|
-
* @returns Reference to Sigil class constructor or null if stored with 'SigilOptions.storeConstructor = false'.
|
|
57
|
-
*/
|
|
58
|
-
get(label) {
|
|
59
|
-
var _a;
|
|
60
|
-
return (_a = this._registry.get(label)) != null ? _a : null;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Register a label and class constructor in the active registry.
|
|
64
|
-
*
|
|
65
|
-
* If the label already exists then:
|
|
66
|
-
* - In DEV builds: prints a console warning (HMR friendly) and returns early.
|
|
67
|
-
* - In non-DEV builds: throws an Error to prevent duplicate registration.
|
|
68
|
-
*
|
|
69
|
-
* @param label - Label string to register (e.g. '@scope/pkg.ClassName').
|
|
70
|
-
* @param Class - Constructor of the class being registered.
|
|
71
|
-
* @param opts - Optional per-call overrides.
|
|
72
|
-
*/
|
|
73
|
-
register(label, Class, opts) {
|
|
74
|
-
var _a, _b, _c, _d;
|
|
75
|
-
if (!OPTIONS.registry) return;
|
|
76
|
-
const storeCtor = (_a = opts == null ? void 0 : opts.storeConstructor) != null ? _a : OPTIONS.storeConstructor;
|
|
77
|
-
const devMarker = (_b = opts == null ? void 0 : opts.devMarker) != null ? _b : OPTIONS.devMarker;
|
|
78
|
-
if (this._registry.has(label)) {
|
|
79
|
-
const existing = this._registry.get(label);
|
|
80
|
-
const isLikelyHMR = (existing == null ? void 0 : existing.name) === (Class == null ? void 0 : Class.name);
|
|
81
|
-
if (devMarker) {
|
|
82
|
-
if (isLikelyHMR) {
|
|
83
|
-
console.warn(
|
|
84
|
-
`[Sigil] Duplicate label "${label}" may be due to HMR \u2014 ignore if you are sure that it's defined once.`
|
|
85
|
-
);
|
|
86
|
-
} else {
|
|
87
|
-
throw new Error(
|
|
88
|
-
`[Sigil Error] Duplicate label '${label}' (different classes: ${(_c = existing == null ? void 0 : existing.name) != null ? _c : "unknown"} vs ${(_d = Class == null ? void 0 : Class.name) != null ? _d : "unknown"}).`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
throw new Error(
|
|
93
|
-
`[Sigil Error] Duplicate label '${label}' detected. Labels must be unique.`
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
this._registry.set(label, storeCtor ? Class : null);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Alias for 'SigilRegistry.register'.
|
|
102
|
-
*
|
|
103
|
-
* @param label - Label string to register (e.g. '@scope/pkg.ClassName').
|
|
104
|
-
* @param Class - Constructor of the class being registered.
|
|
105
|
-
* @param opts - Optional per-call overrides.
|
|
106
|
-
*/
|
|
107
|
-
set(label, Class, opts) {
|
|
108
|
-
return this.register(label, Class, opts);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Unregister a previously registered class.
|
|
112
|
-
*
|
|
113
|
-
* @param label - The label to remove from the registry.
|
|
114
|
-
* @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).
|
|
115
|
-
*/
|
|
116
|
-
unregister(label) {
|
|
117
|
-
return this._registry.delete(label);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Alias for 'SigilRegistry.unregister'.
|
|
121
|
-
*
|
|
122
|
-
* @param label - The label to remove from the registry.
|
|
123
|
-
* @returns `true` if the label was present and removed; `false` otherwise (or when registry is disabled).
|
|
124
|
-
*/
|
|
125
|
-
delete(label) {
|
|
126
|
-
return this.unregister(label);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Replace active registry with new one. deprecated use 'updateOptions({ registry: newRegistry })' instead.
|
|
130
|
-
*
|
|
131
|
-
* @deprecated Will be removed in v2.0.0, check https://www.npmjs.com/package/@vicin/sigil?activeTab=readme#deprecated-api for more details.
|
|
132
|
-
* @param newRegistry - New Set<string> instance to use as the active registry, or `null` to disable checks.
|
|
133
|
-
*/
|
|
134
|
-
replaceRegistry(newRegistry) {
|
|
135
|
-
if (newRegistry)
|
|
136
|
-
updateOptions({ registry: new _SigilRegistry(newRegistry) });
|
|
137
|
-
else updateOptions({ registry: newRegistry });
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Clear the registry completely.
|
|
141
|
-
*
|
|
142
|
-
* Useful for test teardown, or when explicitly resetting state during development.
|
|
143
|
-
* No-op when the registry is disabled.
|
|
144
|
-
*/
|
|
145
|
-
clear() {
|
|
146
|
-
this._registry.clear();
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Merge another SigilRegistry into this one.
|
|
150
|
-
*
|
|
151
|
-
* Entries from `other` will be registered into this registry. Duplicate labels
|
|
152
|
-
* are handled via this registry's `register` logic (i.e., will warn in DEV or
|
|
153
|
-
* throw in production).
|
|
154
|
-
*
|
|
155
|
-
* @param other - Another `SigilRegistry` whose entries will be merged into this registry.
|
|
156
|
-
*/
|
|
157
|
-
merge(other) {
|
|
158
|
-
if (!OPTIONS.registry) return;
|
|
159
|
-
for (const [label, ctor] of other) this.register(label, ctor);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Return a Map-style iterator over entries: `[label, constructor]`.
|
|
163
|
-
* Equivalent to calling `registry[Symbol.iterator]()`.
|
|
164
|
-
*
|
|
165
|
-
* @returns IterableIterator of `[label, ISigil]`.
|
|
166
|
-
*/
|
|
167
|
-
entries() {
|
|
168
|
-
return this._registry.entries();
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Return an iterator over registered constructors.
|
|
172
|
-
*
|
|
173
|
-
* @returns IterableIterator of `ISigil` constructors.
|
|
174
|
-
*/
|
|
175
|
-
values() {
|
|
176
|
-
return this._registry.values();
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Return an iterator over registered labels (keys).
|
|
180
|
-
*
|
|
181
|
-
* @returns IterableIterator of `string` labels.
|
|
182
|
-
*/
|
|
183
|
-
keys() {
|
|
184
|
-
return this._registry.keys();
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Execute a provided function once per registry entry.
|
|
188
|
-
*
|
|
189
|
-
* @param callback - Function invoked with `(ctor, label)` for each entry.
|
|
190
|
-
* @param thisArg - Optional `this` context for the callback.
|
|
191
|
-
*/
|
|
192
|
-
forEach(callback, thisArg) {
|
|
193
|
-
this._registry.forEach(
|
|
194
|
-
(ctor, label) => callback.call(thisArg, ctor, label)
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get the size (number of entries) of the active registry.
|
|
199
|
-
*
|
|
200
|
-
* @returns The number of registered labels, or 0 when registry is disabled.
|
|
201
|
-
*/
|
|
202
|
-
get size() {
|
|
203
|
-
return this._registry.size;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Return an iterator over `[label, constructor]` pairs.
|
|
207
|
-
*
|
|
208
|
-
* This makes the registry compatible with `for..of` and other iterable helpers:
|
|
209
|
-
* ```ts
|
|
210
|
-
* for (const [label, ctor] of registry) { ... }
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* @returns An iterable iterator that yields `[label, ISigil]` tuples.
|
|
214
|
-
*/
|
|
215
|
-
[Symbol.iterator]() {
|
|
216
|
-
return this._registry[Symbol.iterator]();
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
var getActiveRegistry = () => {
|
|
220
|
-
const globalRegistry = getGlobalRegistry();
|
|
221
|
-
if (globalRegistry) return globalRegistry;
|
|
222
|
-
return OPTIONS.registry;
|
|
223
|
-
};
|
|
224
|
-
exports.REGISTRY = OPTIONS.registry;
|
|
225
|
-
var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
|
|
226
|
-
var updateOptions = (opts, mergeRegistries = true) => {
|
|
227
|
-
applyBeforeSideEffects(OPTIONS, opts, mergeRegistries);
|
|
12
|
+
var updateOptions = (opts) => {
|
|
228
13
|
for (const [k, v] of Object.entries(opts)) OPTIONS[k] = v;
|
|
229
|
-
applyAfterSideEffects(OPTIONS);
|
|
230
14
|
};
|
|
231
|
-
function applyBeforeSideEffects(oldOpts, newOpts, mergeRegistries) {
|
|
232
|
-
if (mergeRegistries && newOpts.registry && oldOpts.registry)
|
|
233
|
-
newOpts.registry.merge(oldOpts.registry);
|
|
234
|
-
}
|
|
235
|
-
function applyAfterSideEffects(opts) {
|
|
236
|
-
if (opts.useGlobalRegistry) updateGlobalRegistry(opts.registry);
|
|
237
|
-
else updateGlobalRegistry(null);
|
|
238
|
-
if (OPTIONS.registry) exports.REGISTRY = OPTIONS.registry;
|
|
239
|
-
else exports.REGISTRY = new SigilRegistry();
|
|
240
|
-
}
|
|
241
15
|
var DEFAULT_OPTIONS = {
|
|
242
16
|
labelValidation: null,
|
|
243
17
|
skipLabelInheritanceCheck: false,
|
|
244
18
|
autofillLabels: false,
|
|
245
|
-
devMarker: process.env.NODE_ENV !== "production"
|
|
246
|
-
registry: new SigilRegistry(),
|
|
247
|
-
useGlobalRegistry: true,
|
|
248
|
-
storeConstructor: true
|
|
19
|
+
devMarker: process.env.NODE_ENV !== "production"
|
|
249
20
|
};
|
|
250
21
|
updateOptions(DEFAULT_OPTIONS);
|
|
22
|
+
var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
|
|
251
23
|
|
|
252
24
|
// src/core/symbols.ts
|
|
253
25
|
var __SIGIL__ = /* @__PURE__ */ Symbol.for("@Sigil.__SIGIL__");
|
|
254
26
|
var __SIGIL_BASE__ = /* @__PURE__ */ Symbol.for("@Sigil.__SIGIL_BASE__");
|
|
255
27
|
var __DECORATED__ = /* @__PURE__ */ Symbol.for("@Sigil.__DECORATED__");
|
|
256
|
-
var __INHERITANCE_CHECKED__ = /* @__PURE__ */ Symbol.for(
|
|
257
|
-
"@Sigil.__INHERITANCE_CHECKED__"
|
|
258
|
-
);
|
|
28
|
+
var __INHERITANCE_CHECKED__ = /* @__PURE__ */ Symbol.for("@Sigil.__INHERITANCE_CHECKED__");
|
|
259
29
|
var __LABEL__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL__");
|
|
260
|
-
var
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// src/core/helpers.ts
|
|
265
|
-
function decorateCtor(ctor, label, opts, isMixin = false) {
|
|
266
|
-
var _a;
|
|
30
|
+
var __LABEL_LINEAGE__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_LINEAGE__");
|
|
31
|
+
var __LABEL_SET__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_SET__");
|
|
32
|
+
function decorateCtor(ctor, label, isMixin = false) {
|
|
267
33
|
if (isDecorated(ctor))
|
|
268
34
|
throw new Error(
|
|
269
35
|
`Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`
|
|
270
36
|
);
|
|
271
|
-
const symbol = Symbol.for(label);
|
|
272
|
-
(_a = getActiveRegistry()) == null ? void 0 : _a.register(label, ctor, opts);
|
|
273
37
|
Object.defineProperty(ctor, __LABEL__, {
|
|
274
38
|
value: label,
|
|
275
39
|
configurable: false,
|
|
276
40
|
enumerable: false,
|
|
277
41
|
writable: false
|
|
278
42
|
});
|
|
279
|
-
Object.defineProperty(ctor, __TYPE__, {
|
|
280
|
-
value: symbol,
|
|
281
|
-
configurable: false,
|
|
282
|
-
enumerable: false,
|
|
283
|
-
writable: false
|
|
284
|
-
});
|
|
285
43
|
const parent = Object.getPrototypeOf(ctor);
|
|
286
|
-
const parentChain = parent && parent[
|
|
287
|
-
const ctorChain = isMixin && label !== "Sigil" ? [
|
|
288
|
-
Object.defineProperty(ctor,
|
|
44
|
+
const parentChain = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];
|
|
45
|
+
const ctorChain = isMixin && label !== "Sigil" ? ["Sigil", ...parentChain, label] : [...parentChain, label];
|
|
46
|
+
Object.defineProperty(ctor, __LABEL_LINEAGE__, {
|
|
289
47
|
value: ctorChain,
|
|
290
48
|
configurable: false,
|
|
291
49
|
enumerable: false,
|
|
292
50
|
writable: false
|
|
293
51
|
});
|
|
294
|
-
Object.defineProperty(ctor,
|
|
52
|
+
Object.defineProperty(ctor, __LABEL_SET__, {
|
|
295
53
|
value: new Set(ctorChain),
|
|
296
54
|
configurable: false,
|
|
297
55
|
enumerable: false,
|
|
@@ -326,7 +84,7 @@ function checkInheritance(ctor, opts) {
|
|
|
326
84
|
);
|
|
327
85
|
}
|
|
328
86
|
label = generateRandomLabel();
|
|
329
|
-
decorateCtor(ctor2, label
|
|
87
|
+
decorateCtor(ctor2, label);
|
|
330
88
|
}
|
|
331
89
|
labelOwner.set(label, ctor2.name);
|
|
332
90
|
}
|
|
@@ -345,10 +103,8 @@ function verifyLabel(label, opts) {
|
|
|
345
103
|
);
|
|
346
104
|
}
|
|
347
105
|
}
|
|
348
|
-
function generateRandomLabel(
|
|
349
|
-
let label =
|
|
350
|
-
const registry = getActiveRegistry();
|
|
351
|
-
if (registry) while (registry.has(label)) label = generateRandomLabel();
|
|
106
|
+
function generateRandomLabel() {
|
|
107
|
+
let label = cuid2.createId();
|
|
352
108
|
return `@Sigil.auto-${label}`;
|
|
353
109
|
}
|
|
354
110
|
function markSigil(ctor) {
|
|
@@ -410,19 +166,10 @@ function getConstructor(obj) {
|
|
|
410
166
|
if (!obj || typeof obj !== "object") return null;
|
|
411
167
|
return (_c = (_b = obj.constructor) != null ? _b : (_a = Object.getPrototypeOf(obj)) == null ? void 0 : _a.constructor) != null ? _c : null;
|
|
412
168
|
}
|
|
413
|
-
function generateRandomString(length = 16) {
|
|
414
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
415
|
-
let result = "";
|
|
416
|
-
for (let i = 0; i < length; i++) {
|
|
417
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
418
|
-
}
|
|
419
|
-
return result;
|
|
420
|
-
}
|
|
421
169
|
|
|
422
170
|
// src/core/mixin.ts
|
|
423
171
|
function Sigilify(Base, label, opts) {
|
|
424
|
-
if (isSigilCtor(Base))
|
|
425
|
-
throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);
|
|
172
|
+
if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);
|
|
426
173
|
let l;
|
|
427
174
|
if (label) {
|
|
428
175
|
verifyLabel(label, opts);
|
|
@@ -436,35 +183,26 @@ function Sigilify(Base, label, opts) {
|
|
|
436
183
|
return this[__LABEL__];
|
|
437
184
|
}
|
|
438
185
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
* This symbol is created with `Symbol.for(label)` during decoration so it is
|
|
442
|
-
* stable across realms that share the same global symbol registry.
|
|
443
|
-
*/
|
|
444
|
-
static get SigilType() {
|
|
445
|
-
return this[__TYPE__];
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Copy of the linearized sigil type symbol chain for the current constructor.
|
|
186
|
+
* Copy of the linearized sigil type label chain for the current constructor.
|
|
449
187
|
*
|
|
450
188
|
* Useful for debugging and performing strict lineage comparisons.
|
|
451
189
|
*
|
|
452
|
-
* @returns An array of
|
|
190
|
+
* @returns An array of labels representing parent → child type labels.
|
|
453
191
|
*/
|
|
454
|
-
static get
|
|
192
|
+
static get SigilLabelLineage() {
|
|
455
193
|
var _a;
|
|
456
|
-
return [...(_a = this[
|
|
194
|
+
return [...(_a = this[__LABEL_LINEAGE__]) != null ? _a : []];
|
|
457
195
|
}
|
|
458
196
|
/**
|
|
459
|
-
* Copy of the sigil type
|
|
197
|
+
* Copy of the sigil type label set for the current constructor.
|
|
460
198
|
*
|
|
461
199
|
* Useful for quick membership checks (O(1) lookups) and debugging.
|
|
462
200
|
*
|
|
463
|
-
* @returns A Readonly Set of
|
|
201
|
+
* @returns A Readonly Set of labels that represent the type lineage.
|
|
464
202
|
*/
|
|
465
|
-
static get
|
|
203
|
+
static get SigilLabelSet() {
|
|
466
204
|
const set = /* @__PURE__ */ new Set();
|
|
467
|
-
for (const s of this[
|
|
205
|
+
for (const s of this[__LABEL_SET__]) set.add(s);
|
|
468
206
|
return set;
|
|
469
207
|
}
|
|
470
208
|
constructor(...args) {
|
|
@@ -475,9 +213,7 @@ function Sigilify(Base, label, opts) {
|
|
|
475
213
|
const ctor = getConstructor(this);
|
|
476
214
|
if (!ctor) {
|
|
477
215
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
478
|
-
throw new Error(
|
|
479
|
-
`[Sigil Error] 'Sigilify(${label})' instance without constructor`
|
|
480
|
-
);
|
|
216
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
481
217
|
return;
|
|
482
218
|
}
|
|
483
219
|
checkInheritance(ctor);
|
|
@@ -494,10 +230,6 @@ function Sigilify(Base, label, opts) {
|
|
|
494
230
|
/**
|
|
495
231
|
* Check whether `other` is (or inherits from) the type represented by the calling constructor.
|
|
496
232
|
*
|
|
497
|
-
* Implementation detail:
|
|
498
|
-
* - Uses the other instance's `__TYPE_SET__` for O(1) membership test.
|
|
499
|
-
* - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
|
|
500
|
-
*
|
|
501
233
|
* This replaces `instanceof` so that checks remain valid across bundles/realms
|
|
502
234
|
* and when subclassing.
|
|
503
235
|
*
|
|
@@ -507,18 +239,14 @@ function Sigilify(Base, label, opts) {
|
|
|
507
239
|
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
508
240
|
*/
|
|
509
241
|
static isOfType(other) {
|
|
242
|
+
var _a;
|
|
510
243
|
if (!isSigilInstance(other)) return false;
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return !!otherSet && otherSet.has(this.SigilType);
|
|
244
|
+
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
245
|
+
const thisType = this[__LABEL__];
|
|
246
|
+
return !!otherSet && otherSet.has(thisType);
|
|
515
247
|
}
|
|
516
248
|
/**
|
|
517
|
-
* Strict lineage check: compares the type
|
|
518
|
-
*
|
|
519
|
-
* Implementation detail:
|
|
520
|
-
* - Works in O(n) time where n is the depth of the lineage.
|
|
521
|
-
* - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
|
|
249
|
+
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
522
250
|
*
|
|
523
251
|
* @typeParam T - The calling constructor type.
|
|
524
252
|
* @param this - The constructor performing the check.
|
|
@@ -526,90 +254,99 @@ function Sigilify(Base, label, opts) {
|
|
|
526
254
|
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
527
255
|
*/
|
|
528
256
|
static isOfTypeStrict(other) {
|
|
257
|
+
var _a;
|
|
529
258
|
if (!isSigilInstance(other)) return false;
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
const otherLineage = otherCtor[__TYPE_LINEAGE__];
|
|
533
|
-
const thisLineage = this[__TYPE_LINEAGE__];
|
|
259
|
+
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
260
|
+
const thisLineage = this[__LABEL_LINEAGE__];
|
|
534
261
|
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
535
262
|
}
|
|
536
263
|
/**
|
|
537
|
-
*
|
|
264
|
+
* Check whether `other` is (or inherits from) the type instance.
|
|
538
265
|
*
|
|
539
|
-
*
|
|
266
|
+
* Allows 'instanceof' like checks but in instances.
|
|
267
|
+
*
|
|
268
|
+
* @typeParam T - The instance type.
|
|
269
|
+
* @param this - The instance performing the check.
|
|
270
|
+
* @param other - The object to test.
|
|
271
|
+
* @returns `true` if `other` is the same instance of this type or a subtype.
|
|
540
272
|
*/
|
|
541
|
-
|
|
273
|
+
isOfType(other) {
|
|
542
274
|
var _a;
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
`[Sigil Error] 'Sigilify(${label})' instance without constructor`
|
|
548
|
-
);
|
|
549
|
-
return "@Sigil.unknown";
|
|
550
|
-
}
|
|
551
|
-
return ctor.SigilLabel;
|
|
275
|
+
if (!isSigilInstance(other)) return false;
|
|
276
|
+
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
277
|
+
const thisType = getConstructor(this)[__LABEL__];
|
|
278
|
+
return !!otherSet && otherSet.has(thisType);
|
|
552
279
|
}
|
|
553
280
|
/**
|
|
554
|
-
*
|
|
281
|
+
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
282
|
+
*
|
|
283
|
+
* Allows 'instanceof' like checks but in instances.
|
|
555
284
|
*
|
|
556
|
-
* @
|
|
285
|
+
* @typeParam T - The instance type.
|
|
286
|
+
* @param this - The instance performing the check.
|
|
287
|
+
* @param other - The object to test.
|
|
288
|
+
* @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
|
|
289
|
+
*/
|
|
290
|
+
isOfTypeStrict(other) {
|
|
291
|
+
var _a, _b;
|
|
292
|
+
if (!isSigilInstance(other)) return false;
|
|
293
|
+
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
294
|
+
const thisLineage = (_b = getConstructor(this)) == null ? void 0 : _b[__LABEL_LINEAGE__];
|
|
295
|
+
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Returns the human-readable sigil label of this instance's constructor.
|
|
299
|
+
*
|
|
300
|
+
* @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
|
|
557
301
|
*/
|
|
558
|
-
|
|
302
|
+
getSigilLabel() {
|
|
559
303
|
var _a;
|
|
560
304
|
const ctor = getConstructor(this);
|
|
561
305
|
if (!ctor) {
|
|
562
306
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
563
|
-
throw new Error(
|
|
564
|
-
|
|
565
|
-
);
|
|
566
|
-
return /* @__PURE__ */ Symbol.for("@Sigil.unknown");
|
|
307
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
308
|
+
return "@Sigil.unknown";
|
|
567
309
|
}
|
|
568
|
-
return ctor.
|
|
310
|
+
return ctor.SigilLabel;
|
|
569
311
|
}
|
|
570
312
|
/**
|
|
571
|
-
* Returns a copy of the sigil type
|
|
313
|
+
* Returns a copy of the sigil type label lineage for this instance's constructor.
|
|
572
314
|
*
|
|
573
|
-
* @returns readonly array of
|
|
315
|
+
* @returns readonly array of labels representing the type lineage.
|
|
574
316
|
*/
|
|
575
|
-
|
|
317
|
+
getSigilLabelLineage() {
|
|
576
318
|
var _a;
|
|
577
319
|
const ctor = getConstructor(this);
|
|
578
320
|
if (!ctor) {
|
|
579
321
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
580
|
-
throw new Error(
|
|
581
|
-
|
|
582
|
-
);
|
|
583
|
-
return [/* @__PURE__ */ Symbol.for("@Sigil.unknown")];
|
|
322
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
323
|
+
return ["@Sigil.unknown"];
|
|
584
324
|
}
|
|
585
|
-
return ctor.
|
|
325
|
+
return ctor.SigilLabelLineage;
|
|
586
326
|
}
|
|
587
327
|
/**
|
|
588
|
-
* Returns a readonly copy of the sigil type
|
|
328
|
+
* Returns a readonly copy of the sigil type label set for this instance's constructor.
|
|
589
329
|
*
|
|
590
|
-
* @returns A Readonly Set of
|
|
330
|
+
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
591
331
|
*/
|
|
592
|
-
|
|
332
|
+
getSigilLabelSet() {
|
|
593
333
|
var _a;
|
|
594
334
|
const ctor = getConstructor(this);
|
|
595
335
|
if (!ctor) {
|
|
596
336
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
597
|
-
throw new Error(
|
|
598
|
-
|
|
599
|
-
);
|
|
600
|
-
return /* @__PURE__ */ new Set([/* @__PURE__ */ Symbol.for("@Sigil.unknown")]);
|
|
337
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
338
|
+
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
601
339
|
}
|
|
602
|
-
return ctor.
|
|
340
|
+
return ctor.SigilLabelSet;
|
|
603
341
|
}
|
|
604
342
|
}
|
|
605
|
-
decorateCtor(Sigilified, l,
|
|
343
|
+
decorateCtor(Sigilified, l, true);
|
|
606
344
|
markSigil(Sigilified);
|
|
607
345
|
markSigilBase(Sigilified);
|
|
608
346
|
return Sigilified;
|
|
609
347
|
}
|
|
610
348
|
function SigilifyAbstract(Base, label, opts) {
|
|
611
|
-
if (isSigilCtor(Base))
|
|
612
|
-
throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);
|
|
349
|
+
if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already siglified.`);
|
|
613
350
|
let l;
|
|
614
351
|
if (label) {
|
|
615
352
|
verifyLabel(label, opts);
|
|
@@ -623,35 +360,26 @@ function SigilifyAbstract(Base, label, opts) {
|
|
|
623
360
|
return this[__LABEL__];
|
|
624
361
|
}
|
|
625
362
|
/**
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
* This symbol is created with `Symbol.for(label)` during decoration so it is
|
|
629
|
-
* stable across realms that share the same global symbol registry.
|
|
630
|
-
*/
|
|
631
|
-
static get SigilType() {
|
|
632
|
-
return this[__TYPE__];
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Copy of the linearized sigil type symbol chain for the current constructor.
|
|
363
|
+
* Copy of the linearized sigil type label chain for the current constructor.
|
|
636
364
|
*
|
|
637
365
|
* Useful for debugging and performing strict lineage comparisons.
|
|
638
366
|
*
|
|
639
|
-
* @returns An array of
|
|
367
|
+
* @returns An array of labels representing parent → child type labels.
|
|
640
368
|
*/
|
|
641
|
-
static get
|
|
369
|
+
static get SigilLabelLineage() {
|
|
642
370
|
var _a;
|
|
643
|
-
return [...(_a = this[
|
|
371
|
+
return [...(_a = this[__LABEL_LINEAGE__]) != null ? _a : []];
|
|
644
372
|
}
|
|
645
373
|
/**
|
|
646
|
-
* Copy of the sigil type
|
|
374
|
+
* Copy of the sigil type label set for the current constructor.
|
|
647
375
|
*
|
|
648
376
|
* Useful for quick membership checks (O(1) lookups) and debugging.
|
|
649
377
|
*
|
|
650
|
-
* @returns A Readonly Set of
|
|
378
|
+
* @returns A Readonly Set of labels that represent the type lineage.
|
|
651
379
|
*/
|
|
652
|
-
static get
|
|
380
|
+
static get SigilLabelSet() {
|
|
653
381
|
const set = /* @__PURE__ */ new Set();
|
|
654
|
-
for (const s of this[
|
|
382
|
+
for (const s of this[__LABEL_SET__]) set.add(s);
|
|
655
383
|
return set;
|
|
656
384
|
}
|
|
657
385
|
constructor(...args) {
|
|
@@ -662,9 +390,7 @@ function SigilifyAbstract(Base, label, opts) {
|
|
|
662
390
|
const ctor = getConstructor(this);
|
|
663
391
|
if (!ctor) {
|
|
664
392
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
665
|
-
throw new Error(
|
|
666
|
-
`[Sigil Error] 'Sigilify(${label})' instance without constructor`
|
|
667
|
-
);
|
|
393
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
668
394
|
return;
|
|
669
395
|
}
|
|
670
396
|
checkInheritance(ctor);
|
|
@@ -682,7 +408,7 @@ function SigilifyAbstract(Base, label, opts) {
|
|
|
682
408
|
* Check whether `other` is (or inherits from) the type represented by the calling constructor.
|
|
683
409
|
*
|
|
684
410
|
* Implementation detail:
|
|
685
|
-
* - Uses the other instance's `
|
|
411
|
+
* - Uses the other instance's `__LABEL_SET__` for O(1) membership test.
|
|
686
412
|
* - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
|
|
687
413
|
*
|
|
688
414
|
* This replaces `instanceof` so that checks remain valid across bundles/realms
|
|
@@ -694,14 +420,14 @@ function SigilifyAbstract(Base, label, opts) {
|
|
|
694
420
|
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
695
421
|
*/
|
|
696
422
|
static isOfType(other) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
return !!otherSet && otherSet.has(
|
|
423
|
+
var _a;
|
|
424
|
+
if (!isSigilInstance(other) || !isSigilCtor(this)) return false;
|
|
425
|
+
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
426
|
+
const thisType = this[__LABEL__];
|
|
427
|
+
return !!otherSet && otherSet.has(thisType);
|
|
702
428
|
}
|
|
703
429
|
/**
|
|
704
|
-
* Strict lineage check: compares the type
|
|
430
|
+
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
705
431
|
*
|
|
706
432
|
* Implementation detail:
|
|
707
433
|
* - Works in O(n) time where n is the depth of the lineage.
|
|
@@ -713,83 +439,93 @@ function SigilifyAbstract(Base, label, opts) {
|
|
|
713
439
|
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
714
440
|
*/
|
|
715
441
|
static isOfTypeStrict(other) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
const thisLineage = this[__TYPE_LINEAGE__];
|
|
442
|
+
var _a;
|
|
443
|
+
if (!isSigilInstance(other) || !isSigilCtor(this)) return false;
|
|
444
|
+
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
445
|
+
const thisLineage = this[__LABEL_LINEAGE__];
|
|
721
446
|
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
722
447
|
}
|
|
723
448
|
/**
|
|
724
|
-
*
|
|
449
|
+
* Check whether `other` is (or inherits from) the type instance.
|
|
725
450
|
*
|
|
726
|
-
*
|
|
451
|
+
* Allows 'instanceof' like checks but in instances.
|
|
452
|
+
*
|
|
453
|
+
* @typeParam T - The instance type.
|
|
454
|
+
* @param this - The instance performing the check.
|
|
455
|
+
* @param other - The object to test.
|
|
456
|
+
* @returns `true` if `other` is the same instance of this type or a subtype.
|
|
727
457
|
*/
|
|
728
|
-
|
|
458
|
+
isOfType(other) {
|
|
729
459
|
var _a;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
`[Sigil Error] 'Sigilify(${label})' instance without constructor`
|
|
735
|
-
);
|
|
736
|
-
return "@Sigil.unknown";
|
|
737
|
-
}
|
|
738
|
-
return ctor.SigilLabel;
|
|
460
|
+
if (!isSigilInstance(other) || !isSigilInstance(this)) return false;
|
|
461
|
+
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
462
|
+
const thisType = getConstructor(this)[__LABEL__];
|
|
463
|
+
return !!otherSet && otherSet.has(thisType);
|
|
739
464
|
}
|
|
740
465
|
/**
|
|
741
|
-
*
|
|
466
|
+
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
742
467
|
*
|
|
743
|
-
*
|
|
468
|
+
* Allows 'instanceof' like checks but in instances.
|
|
469
|
+
*
|
|
470
|
+
* @typeParam T - The instance type.
|
|
471
|
+
* @param this - The instance performing the check.
|
|
472
|
+
* @param other - The object to test.
|
|
473
|
+
* @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
|
|
744
474
|
*/
|
|
745
|
-
|
|
475
|
+
isOfTypeStrict(other) {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
if (!isSigilInstance(other) || !isSigilInstance(this)) return false;
|
|
478
|
+
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
479
|
+
const thisLineage = (_b = getConstructor(this)) == null ? void 0 : _b[__LABEL_LINEAGE__];
|
|
480
|
+
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Returns the human-readable sigil label of this instance's constructor.
|
|
484
|
+
*
|
|
485
|
+
* @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
|
|
486
|
+
*/
|
|
487
|
+
getSigilLabel() {
|
|
746
488
|
var _a;
|
|
747
489
|
const ctor = getConstructor(this);
|
|
748
490
|
if (!ctor) {
|
|
749
491
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
750
|
-
throw new Error(
|
|
751
|
-
|
|
752
|
-
);
|
|
753
|
-
return /* @__PURE__ */ Symbol.for("@Sigil.unknown");
|
|
492
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
493
|
+
return "@Sigil.unknown";
|
|
754
494
|
}
|
|
755
|
-
return ctor.
|
|
495
|
+
return ctor.SigilLabel;
|
|
756
496
|
}
|
|
757
497
|
/**
|
|
758
|
-
* Returns a copy of the sigil type
|
|
498
|
+
* Returns a copy of the sigil type label lineage for this instance's constructor.
|
|
759
499
|
*
|
|
760
|
-
* @returns readonly array of
|
|
500
|
+
* @returns readonly array of labels representing the type lineage.
|
|
761
501
|
*/
|
|
762
|
-
|
|
502
|
+
getSigilLabelLineage() {
|
|
763
503
|
var _a;
|
|
764
504
|
const ctor = getConstructor(this);
|
|
765
505
|
if (!ctor) {
|
|
766
506
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
767
|
-
throw new Error(
|
|
768
|
-
|
|
769
|
-
);
|
|
770
|
-
return [/* @__PURE__ */ Symbol.for("@Sigil.unknown")];
|
|
507
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
508
|
+
return ["@Sigil.unknown"];
|
|
771
509
|
}
|
|
772
|
-
return ctor.
|
|
510
|
+
return ctor.SigilLabelLineage;
|
|
773
511
|
}
|
|
774
512
|
/**
|
|
775
|
-
* Returns a readonly copy of the sigil type
|
|
513
|
+
* Returns a readonly copy of the sigil type label set for this instance's constructor.
|
|
776
514
|
*
|
|
777
|
-
* @returns A Readonly Set of
|
|
515
|
+
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
778
516
|
*/
|
|
779
|
-
|
|
517
|
+
getSigilLabelSet() {
|
|
780
518
|
var _a;
|
|
781
519
|
const ctor = getConstructor(this);
|
|
782
520
|
if (!ctor) {
|
|
783
521
|
if ((_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker)
|
|
784
|
-
throw new Error(
|
|
785
|
-
|
|
786
|
-
);
|
|
787
|
-
return /* @__PURE__ */ new Set([/* @__PURE__ */ Symbol.for("@Sigil.unknown")]);
|
|
522
|
+
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
523
|
+
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
788
524
|
}
|
|
789
|
-
return ctor.
|
|
525
|
+
return ctor.SigilLabelSet;
|
|
790
526
|
}
|
|
791
527
|
}
|
|
792
|
-
decorateCtor(Sigilified, l,
|
|
528
|
+
decorateCtor(Sigilified, l, true);
|
|
793
529
|
markSigil(Sigilified);
|
|
794
530
|
markSigilBase(Sigilified);
|
|
795
531
|
return Sigilified;
|
|
@@ -813,7 +549,7 @@ function WithSigil(label, opts) {
|
|
|
813
549
|
throw new Error(
|
|
814
550
|
`[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`
|
|
815
551
|
);
|
|
816
|
-
decorateCtor(value, l
|
|
552
|
+
decorateCtor(value, l);
|
|
817
553
|
checkInheritance(value, opts);
|
|
818
554
|
};
|
|
819
555
|
}
|
|
@@ -831,26 +567,10 @@ function withSigil(Class, label, opts) {
|
|
|
831
567
|
l = label;
|
|
832
568
|
} else l = generateRandomLabel();
|
|
833
569
|
const ctor = Class;
|
|
834
|
-
decorateCtor(ctor, l
|
|
570
|
+
decorateCtor(ctor, l);
|
|
835
571
|
checkInheritance(ctor, opts);
|
|
836
572
|
return Class;
|
|
837
573
|
}
|
|
838
|
-
function typed(Class, label, opts) {
|
|
839
|
-
var _a, _b;
|
|
840
|
-
const devMarker = (_a = opts == null ? void 0 : opts.devMarker) != null ? _a : OPTIONS.devMarker;
|
|
841
|
-
if (!isSigilCtor(Class))
|
|
842
|
-
throw new Error(
|
|
843
|
-
`[Sigil Error] 'typed' HOF accept only Sigil classes but used on class ${(_b = Class == null ? void 0 : Class.name) != null ? _b : "unknown"}`
|
|
844
|
-
);
|
|
845
|
-
if (devMarker && label) {
|
|
846
|
-
const runtimeLabel = Class.SigilLabel;
|
|
847
|
-
if (runtimeLabel && runtimeLabel !== label)
|
|
848
|
-
throw new Error(
|
|
849
|
-
`[Sigil Error][typed] runtime label "${runtimeLabel}" does not match asserted label "${label}".`
|
|
850
|
-
);
|
|
851
|
-
}
|
|
852
|
-
return Class;
|
|
853
|
-
}
|
|
854
574
|
function withSigilTyped(Class, label, opts) {
|
|
855
575
|
var _a;
|
|
856
576
|
if (!isSigilCtor(Class))
|
|
@@ -863,7 +583,7 @@ function withSigilTyped(Class, label, opts) {
|
|
|
863
583
|
l = label;
|
|
864
584
|
} else l = generateRandomLabel();
|
|
865
585
|
const ctor = Class;
|
|
866
|
-
decorateCtor(ctor, l
|
|
586
|
+
decorateCtor(ctor, l);
|
|
867
587
|
checkInheritance(ctor, opts);
|
|
868
588
|
return Class;
|
|
869
589
|
}
|
|
@@ -871,18 +591,15 @@ function withSigilTyped(Class, label, opts) {
|
|
|
871
591
|
exports.DEFAULT_LABEL_REGEX = DEFAULT_LABEL_REGEX;
|
|
872
592
|
exports.Sigil = Sigil;
|
|
873
593
|
exports.SigilError = SigilError;
|
|
874
|
-
exports.SigilRegistry = SigilRegistry;
|
|
875
594
|
exports.Sigilify = Sigilify;
|
|
876
595
|
exports.SigilifyAbstract = SigilifyAbstract;
|
|
877
596
|
exports.WithSigil = WithSigil;
|
|
878
|
-
exports.getActiveRegistry = getActiveRegistry;
|
|
879
597
|
exports.isDecorated = isDecorated;
|
|
880
598
|
exports.isInheritanceChecked = isInheritanceChecked;
|
|
881
599
|
exports.isSigilBaseCtor = isSigilBaseCtor;
|
|
882
600
|
exports.isSigilBaseInstance = isSigilBaseInstance;
|
|
883
601
|
exports.isSigilCtor = isSigilCtor;
|
|
884
602
|
exports.isSigilInstance = isSigilInstance;
|
|
885
|
-
exports.typed = typed;
|
|
886
603
|
exports.updateOptions = updateOptions;
|
|
887
604
|
exports.withSigil = withSigil;
|
|
888
605
|
exports.withSigilTyped = withSigilTyped;
|