@vicin/sigil 2.2.1 → 3.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 +20 -0
- package/README.md +55 -188
- package/dist/index.d.mts +79 -160
- package/dist/index.d.ts +79 -160
- package/dist/index.global.js +4 -2379
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -659
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -643
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -3
package/dist/index.mjs
CHANGED
|
@@ -1,644 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// src/core/options.ts
|
|
4
|
-
var OPTIONS = {
|
|
5
|
-
labelValidation: null,
|
|
6
|
-
skipLabelInheritanceCheck: false,
|
|
7
|
-
autofillLabels: true
|
|
8
|
-
};
|
|
9
|
-
var updateSigilOptions = (opts) => {
|
|
10
|
-
if ("autofillLabels" in opts) {
|
|
11
|
-
if (typeof opts.autofillLabels !== "boolean")
|
|
12
|
-
throw new Error("'updateSigilOptions.autofillLabels' must be boolean");
|
|
13
|
-
OPTIONS.autofillLabels = opts.autofillLabels;
|
|
14
|
-
}
|
|
15
|
-
if ("skipLabelInheritanceCheck" in opts) {
|
|
16
|
-
if (typeof opts.skipLabelInheritanceCheck !== "boolean")
|
|
17
|
-
throw new Error("'updateSigilOptions.skipLabelInheritanceCheck' must be boolean");
|
|
18
|
-
OPTIONS.skipLabelInheritanceCheck = opts.skipLabelInheritanceCheck;
|
|
19
|
-
}
|
|
20
|
-
if ("labelValidation" in opts) {
|
|
21
|
-
const val = opts.labelValidation;
|
|
22
|
-
if (val !== null && typeof val !== "function" && !(val instanceof RegExp))
|
|
23
|
-
throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");
|
|
24
|
-
OPTIONS.labelValidation = val != null ? val : null;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
|
|
28
|
-
|
|
29
|
-
// src/core/symbols.ts
|
|
30
|
-
var __SIGIL__ = /* @__PURE__ */ Symbol.for("@Sigil.__SIGIL__");
|
|
31
|
-
var __SIGIL_BASE__ = /* @__PURE__ */ Symbol.for("@Sigil.__SIGIL_BASE__");
|
|
32
|
-
var __DECORATED__ = /* @__PURE__ */ Symbol.for("@Sigil.__DECORATED__");
|
|
33
|
-
var __INHERITANCE_CHECKED__ = /* @__PURE__ */ Symbol.for("@Sigil.__INHERITANCE_CHECKED__");
|
|
34
|
-
var __LABEL__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL__");
|
|
35
|
-
var __EFFECTIVE_LABEL__ = /* @__PURE__ */ Symbol.for("@Sigil.__EFFECTIVE_LABEL__");
|
|
36
|
-
var __LABEL_LINEAGE__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_LINEAGE__");
|
|
37
|
-
var __LABEL_SET__ = /* @__PURE__ */ Symbol.for("@Sigil.__LABEL_SET__");
|
|
38
|
-
function decorateCtor(ctor, label, runtime) {
|
|
39
|
-
if (process.env.NODE_ENV !== "production") {
|
|
40
|
-
if (isDecorated(ctor))
|
|
41
|
-
throw new Error(
|
|
42
|
-
`Constructor ${ctor} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
Object.defineProperty(ctor, __LABEL__, {
|
|
46
|
-
value: label,
|
|
47
|
-
configurable: true,
|
|
48
|
-
enumerable: false,
|
|
49
|
-
writable: false
|
|
50
|
-
});
|
|
51
|
-
if (!(runtime == null ? void 0 : runtime.isInheritanceCheck))
|
|
52
|
-
Object.defineProperty(ctor, __EFFECTIVE_LABEL__, {
|
|
53
|
-
value: label,
|
|
54
|
-
configurable: true,
|
|
55
|
-
enumerable: false,
|
|
56
|
-
writable: false
|
|
57
|
-
});
|
|
58
|
-
const parent = Object.getPrototypeOf(ctor);
|
|
59
|
-
const parentChain = parent && parent[__LABEL_LINEAGE__] ? parent[__LABEL_LINEAGE__] : [];
|
|
60
|
-
const ctorChain = (runtime == null ? void 0 : runtime.isMixin) && label !== "Sigil" ? ["Sigil", ...parentChain, label] : [...parentChain, label];
|
|
61
|
-
Object.defineProperty(ctor, __LABEL_LINEAGE__, {
|
|
62
|
-
value: ctorChain,
|
|
63
|
-
configurable: true,
|
|
64
|
-
enumerable: false,
|
|
65
|
-
writable: false
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(ctor, __LABEL_SET__, {
|
|
68
|
-
value: new Set(ctorChain),
|
|
69
|
-
configurable: true,
|
|
70
|
-
enumerable: false,
|
|
71
|
-
writable: false
|
|
72
|
-
});
|
|
73
|
-
if (!(runtime == null ? void 0 : runtime.isInheritanceCheck)) markDecorated(ctor);
|
|
74
|
-
}
|
|
75
|
-
function checkInheritance(ctor, opts) {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
if (isInheritanceChecked(ctor) || ((_a = opts == null ? void 0 : opts.skipLabelInheritanceCheck) != null ? _a : OPTIONS.skipLabelInheritanceCheck))
|
|
78
|
-
return;
|
|
79
|
-
const ctors = [ctor];
|
|
80
|
-
let ancestor = Object.getPrototypeOf(ctor);
|
|
81
|
-
while (isSigilCtor(ancestor)) {
|
|
82
|
-
ctors.push(ancestor);
|
|
83
|
-
ancestor = Object.getPrototypeOf(ancestor);
|
|
84
|
-
}
|
|
85
|
-
const labelOwner = /* @__PURE__ */ new Map();
|
|
86
|
-
for (let i = ctors.length - 1; i >= 0; i--) {
|
|
87
|
-
const ctor2 = ctors[i];
|
|
88
|
-
if (!ctor2) continue;
|
|
89
|
-
let label = ctor2[__LABEL__];
|
|
90
|
-
if (labelOwner.has(label)) {
|
|
91
|
-
if (process.env.NODE_ENV !== "production") {
|
|
92
|
-
if (isDecorated(ctor2) || !((_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels))
|
|
93
|
-
throw new Error(
|
|
94
|
-
`[Sigil Error] Class "${ctor2.name}" re-uses Sigil label "${label}" from ancestor "${labelOwner.get(label)}". Each Sigil subclass must use a unique label. Did you forget to use "WithSigil(newLabel)" on the subclass?`
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
label = generateRandomLabel();
|
|
98
|
-
decorateCtor(ctor2, label, { isInheritanceCheck: true });
|
|
99
|
-
}
|
|
100
|
-
labelOwner.set(label, ctor2.name);
|
|
101
|
-
}
|
|
102
|
-
markInheritanceChecked(ctor);
|
|
103
|
-
}
|
|
104
|
-
function verifyLabel(label, opts) {
|
|
105
|
-
var _a;
|
|
106
|
-
const labelValidation = (_a = opts == null ? void 0 : opts.labelValidation) != null ? _a : OPTIONS.labelValidation;
|
|
107
|
-
if (labelValidation) {
|
|
108
|
-
let valid;
|
|
109
|
-
if (labelValidation instanceof RegExp) valid = labelValidation.test(label);
|
|
110
|
-
else valid = labelValidation(label);
|
|
111
|
-
if (process.env.NODE_ENV !== "production") {
|
|
112
|
-
if (!valid)
|
|
113
|
-
throw new Error(
|
|
114
|
-
`[Sigil] Invalid identity label "${label}". Make sure that supplied label matches validation regex or function.`
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function generateRandomLabel() {
|
|
120
|
-
let label = createId();
|
|
121
|
-
return `@Sigil.auto-${label}`;
|
|
122
|
-
}
|
|
123
|
-
function markSigil(ctor) {
|
|
124
|
-
Object.defineProperty(ctor, __SIGIL__, {
|
|
125
|
-
value: true,
|
|
126
|
-
configurable: false,
|
|
127
|
-
enumerable: false,
|
|
128
|
-
writable: false
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function markSigilBase(ctor) {
|
|
132
|
-
Object.defineProperty(ctor, __SIGIL_BASE__, {
|
|
133
|
-
value: true,
|
|
134
|
-
configurable: false,
|
|
135
|
-
enumerable: false,
|
|
136
|
-
writable: false
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function markDecorated(ctor) {
|
|
140
|
-
Object.defineProperty(ctor, __DECORATED__, {
|
|
141
|
-
value: true,
|
|
142
|
-
configurable: false,
|
|
143
|
-
enumerable: false,
|
|
144
|
-
writable: false
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function markInheritanceChecked(ctor) {
|
|
148
|
-
Object.defineProperty(ctor, __INHERITANCE_CHECKED__, {
|
|
149
|
-
value: true,
|
|
150
|
-
configurable: false,
|
|
151
|
-
enumerable: false,
|
|
152
|
-
writable: false
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function isSigilCtor(ctor) {
|
|
156
|
-
return typeof ctor === "function" && ctor[__SIGIL__] === true;
|
|
157
|
-
}
|
|
158
|
-
function isSigilInstance(inst) {
|
|
159
|
-
if (!inst || typeof inst !== "object") return false;
|
|
160
|
-
const ctor = getConstructor(inst);
|
|
161
|
-
return isSigilCtor(ctor);
|
|
162
|
-
}
|
|
163
|
-
function isSigilBaseCtor(ctor) {
|
|
164
|
-
return Object.hasOwn(ctor, __SIGIL_BASE__);
|
|
165
|
-
}
|
|
166
|
-
function isSigilBaseInstance(inst) {
|
|
167
|
-
if (!inst || typeof inst !== "object") return false;
|
|
168
|
-
const ctor = getConstructor(inst);
|
|
169
|
-
return isSigilBaseCtor(ctor);
|
|
170
|
-
}
|
|
171
|
-
function isDecorated(ctor) {
|
|
172
|
-
return Object.hasOwn(ctor, __DECORATED__);
|
|
173
|
-
}
|
|
174
|
-
function isInheritanceChecked(ctor) {
|
|
175
|
-
return Object.hasOwn(ctor, __INHERITANCE_CHECKED__);
|
|
176
|
-
}
|
|
177
|
-
function getConstructor(obj) {
|
|
178
|
-
var _a, _b, _c;
|
|
179
|
-
if (!obj || typeof obj !== "object") return null;
|
|
180
|
-
return (_c = (_b = obj.constructor) != null ? _b : (_a = Object.getPrototypeOf(obj)) == null ? void 0 : _a.constructor) != null ? _c : null;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// src/core/mixin.ts
|
|
184
|
-
function Sigilify(Base, label, opts) {
|
|
185
|
-
if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already sigilified.`);
|
|
186
|
-
let l;
|
|
187
|
-
if (label) {
|
|
188
|
-
verifyLabel(label, opts);
|
|
189
|
-
l = label;
|
|
190
|
-
} else l = generateRandomLabel();
|
|
191
|
-
class Sigilified extends Base {
|
|
192
|
-
/**
|
|
193
|
-
* Class-level identity label constant for this sigil constructor.
|
|
194
|
-
*/
|
|
195
|
-
static get SigilLabel() {
|
|
196
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
197
|
-
return this[__LABEL__];
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.
|
|
201
|
-
*/
|
|
202
|
-
static get SigilEffectiveLabel() {
|
|
203
|
-
return this[__EFFECTIVE_LABEL__];
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Copy of the linearized sigil type label chain for the current constructor.
|
|
207
|
-
*
|
|
208
|
-
* Useful for debugging and performing strict lineage comparisons.
|
|
209
|
-
*
|
|
210
|
-
* @returns An array of labels representing parent → child type labels.
|
|
211
|
-
*/
|
|
212
|
-
static get SigilLabelLineage() {
|
|
213
|
-
var _a;
|
|
214
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
215
|
-
return [...(_a = this[__LABEL_LINEAGE__]) != null ? _a : []];
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Copy of the sigil type label set for the current constructor.
|
|
219
|
-
*
|
|
220
|
-
* Useful for quick membership checks (O(1) lookups) and debugging.
|
|
221
|
-
*
|
|
222
|
-
* @returns A Readonly Set of labels that represent the type lineage.
|
|
223
|
-
*/
|
|
224
|
-
static get SigilLabelSet() {
|
|
225
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
226
|
-
const set = /* @__PURE__ */ new Set();
|
|
227
|
-
for (const s of this[__LABEL_SET__]) set.add(s);
|
|
228
|
-
return set;
|
|
229
|
-
}
|
|
230
|
-
constructor(...args) {
|
|
231
|
-
super(...args);
|
|
232
|
-
if (Object.getPrototypeOf(this) !== new.target.prototype)
|
|
233
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
234
|
-
const ctor = getConstructor(this);
|
|
235
|
-
if (!ctor) {
|
|
236
|
-
if (process.env.NODE_ENV !== "production")
|
|
237
|
-
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
checkInheritance(ctor);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
|
|
244
|
-
*
|
|
245
|
-
* @param obj - The value to test.
|
|
246
|
-
* @returns `true` if `obj` is a sigil instance.
|
|
247
|
-
*/
|
|
248
|
-
static isSigilified(obj) {
|
|
249
|
-
return isSigilInstance(obj);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Check whether `other` is (or inherits from) the type represented by the calling constructor.
|
|
253
|
-
*
|
|
254
|
-
* This replaces `instanceof` so that checks remain valid across bundles/realms
|
|
255
|
-
* and when subclassing.
|
|
256
|
-
*
|
|
257
|
-
* @typeParam T - The calling constructor type (narrowing the returned instance type).
|
|
258
|
-
* @param this - The constructor performing the check.
|
|
259
|
-
* @param other - The object to test.
|
|
260
|
-
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
261
|
-
*/
|
|
262
|
-
static isOfType(other) {
|
|
263
|
-
var _a;
|
|
264
|
-
if (!isSigilInstance(other)) return false;
|
|
265
|
-
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
266
|
-
const thisType = this[__LABEL__];
|
|
267
|
-
return !!otherSet && otherSet.has(thisType);
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
271
|
-
*
|
|
272
|
-
* @typeParam T - The calling constructor type.
|
|
273
|
-
* @param this - The constructor performing the check.
|
|
274
|
-
* @param other - The object to test.
|
|
275
|
-
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
276
|
-
*/
|
|
277
|
-
static isOfTypeStrict(other) {
|
|
278
|
-
var _a;
|
|
279
|
-
if (!isSigilInstance(other)) return false;
|
|
280
|
-
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
281
|
-
const thisLineage = this[__LABEL_LINEAGE__];
|
|
282
|
-
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Check whether `other` is (or inherits from) the type instance.
|
|
286
|
-
*
|
|
287
|
-
* Allows 'instanceof' like checks but in instances.
|
|
288
|
-
*
|
|
289
|
-
* @typeParam T - The instance type.
|
|
290
|
-
* @param this - The instance performing the check.
|
|
291
|
-
* @param other - The object to test.
|
|
292
|
-
* @returns `true` if `other` is the same instance of this type or a subtype.
|
|
293
|
-
*/
|
|
294
|
-
isOfType(other) {
|
|
295
|
-
var _a;
|
|
296
|
-
if (!isSigilInstance(other)) return false;
|
|
297
|
-
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
298
|
-
const thisType = getConstructor(this)[__LABEL__];
|
|
299
|
-
return !!otherSet && otherSet.has(thisType);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
303
|
-
*
|
|
304
|
-
* Allows 'instanceof' like checks but in instances.
|
|
305
|
-
*
|
|
306
|
-
* @typeParam T - The instance type.
|
|
307
|
-
* @param this - The instance performing the check.
|
|
308
|
-
* @param other - The object to test.
|
|
309
|
-
* @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
|
|
310
|
-
*/
|
|
311
|
-
isOfTypeStrict(other) {
|
|
312
|
-
var _a, _b;
|
|
313
|
-
if (!isSigilInstance(other)) return false;
|
|
314
|
-
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
315
|
-
const thisLineage = (_b = getConstructor(this)) == null ? void 0 : _b[__LABEL_LINEAGE__];
|
|
316
|
-
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Returns the identity sigil label of this instance's constructor.
|
|
320
|
-
*
|
|
321
|
-
* @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil.auto-dq62ib6jnvmmlfbjhxh2937h') or '@Sigil.unknown' if constructor is missing.
|
|
322
|
-
*/
|
|
323
|
-
getSigilLabel() {
|
|
324
|
-
const ctor = getConstructor(this);
|
|
325
|
-
if (!ctor) {
|
|
326
|
-
if (process.env.NODE_ENV !== "production")
|
|
327
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
328
|
-
return "@Sigil.unknown";
|
|
329
|
-
}
|
|
330
|
-
return ctor.SigilLabel;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Returns the human-readable sigil label of this instance's constructor.
|
|
334
|
-
*
|
|
335
|
-
* @returns The last passed label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' if constructor is missing.
|
|
336
|
-
*/
|
|
337
|
-
getSigilEffectiveLabel() {
|
|
338
|
-
const ctor = getConstructor(this);
|
|
339
|
-
if (!ctor) {
|
|
340
|
-
if (process.env.NODE_ENV !== "production")
|
|
341
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
342
|
-
return "@Sigil.unknown";
|
|
343
|
-
}
|
|
344
|
-
return ctor.SigilEffectiveLabel;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Returns a copy of the sigil type label lineage for this instance's constructor.
|
|
348
|
-
*
|
|
349
|
-
* @returns readonly array of labels representing the type lineage.
|
|
350
|
-
*/
|
|
351
|
-
getSigilLabelLineage() {
|
|
352
|
-
const ctor = getConstructor(this);
|
|
353
|
-
if (!ctor) {
|
|
354
|
-
if (process.env.NODE_ENV !== "production")
|
|
355
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
356
|
-
return ["@Sigil.unknown"];
|
|
357
|
-
}
|
|
358
|
-
return ctor.SigilLabelLineage;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Returns a readonly copy of the sigil type label set for this instance's constructor.
|
|
362
|
-
*
|
|
363
|
-
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
364
|
-
*/
|
|
365
|
-
getSigilLabelSet() {
|
|
366
|
-
const ctor = getConstructor(this);
|
|
367
|
-
if (!ctor) {
|
|
368
|
-
if (process.env.NODE_ENV !== "production")
|
|
369
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
370
|
-
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
371
|
-
}
|
|
372
|
-
return ctor.SigilLabelSet;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
decorateCtor(Sigilified, l, { isMixin: true });
|
|
376
|
-
markSigil(Sigilified);
|
|
377
|
-
markSigilBase(Sigilified);
|
|
378
|
-
return Sigilified;
|
|
379
|
-
}
|
|
380
|
-
function SigilifyAbstract(Base, label, opts) {
|
|
381
|
-
if (isSigilCtor(Base)) throw new Error(`[Sigil Error] 'Sigilify(${label})' already sigilified.`);
|
|
382
|
-
let l;
|
|
383
|
-
if (label) {
|
|
384
|
-
verifyLabel(label, opts);
|
|
385
|
-
l = label;
|
|
386
|
-
} else l = generateRandomLabel();
|
|
387
|
-
class Sigilified extends Base {
|
|
388
|
-
/**
|
|
389
|
-
* Class-level identity label constant for this sigil constructor.
|
|
390
|
-
*/
|
|
391
|
-
static get SigilLabel() {
|
|
392
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
393
|
-
return this[__LABEL__];
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Class-level human-readable label constant for this sigil constructor, last passed label in 'Sigil' chain by developer.
|
|
397
|
-
*/
|
|
398
|
-
static get SigilEffectiveLabel() {
|
|
399
|
-
return this[__EFFECTIVE_LABEL__];
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Copy of the linearized sigil type label chain for the current constructor.
|
|
403
|
-
*
|
|
404
|
-
* Useful for debugging and performing strict lineage comparisons.
|
|
405
|
-
*
|
|
406
|
-
* @returns An array of labels representing parent → child type labels.
|
|
407
|
-
*/
|
|
408
|
-
static get SigilLabelLineage() {
|
|
409
|
-
var _a;
|
|
410
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
411
|
-
return [...(_a = this[__LABEL_LINEAGE__]) != null ? _a : []];
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Copy of the sigil type label set for the current constructor.
|
|
415
|
-
*
|
|
416
|
-
* Useful for quick membership checks (O(1) lookups) and debugging.
|
|
417
|
-
*
|
|
418
|
-
* @returns A Readonly Set of labels that represent the type lineage.
|
|
419
|
-
*/
|
|
420
|
-
static get SigilLabelSet() {
|
|
421
|
-
if (!isInheritanceChecked(this)) checkInheritance(this);
|
|
422
|
-
const set = /* @__PURE__ */ new Set();
|
|
423
|
-
for (const s of this[__LABEL_SET__]) set.add(s);
|
|
424
|
-
return set;
|
|
425
|
-
}
|
|
426
|
-
constructor(...args) {
|
|
427
|
-
super(...args);
|
|
428
|
-
if (Object.getPrototypeOf(this) !== new.target.prototype)
|
|
429
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
430
|
-
const ctor = getConstructor(this);
|
|
431
|
-
if (!ctor) {
|
|
432
|
-
if (process.env.NODE_ENV !== "production")
|
|
433
|
-
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
checkInheritance(ctor);
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
|
|
440
|
-
*
|
|
441
|
-
* @param obj - The value to test.
|
|
442
|
-
* @returns `true` if `obj` is a sigil instance.
|
|
443
|
-
*/
|
|
444
|
-
static isSigilified(obj) {
|
|
445
|
-
return isSigilInstance(obj);
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Check whether `other` is (or inherits from) the type represented by the calling constructor.
|
|
449
|
-
*
|
|
450
|
-
* Implementation detail:
|
|
451
|
-
* - Uses the other instance's `__LABEL_SET__` for O(1) membership test.
|
|
452
|
-
* - O(1) and reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
|
|
453
|
-
*
|
|
454
|
-
* This replaces `instanceof` so that checks remain valid across bundles/realms
|
|
455
|
-
* and when subclassing.
|
|
456
|
-
*
|
|
457
|
-
* @typeParam T - The calling constructor type (narrowing the returned instance type).
|
|
458
|
-
* @param this - The constructor performing the check.
|
|
459
|
-
* @param other - The object to test.
|
|
460
|
-
* @returns `true` if `other` is an instance of this type or a subtype.
|
|
461
|
-
*/
|
|
462
|
-
static isOfType(other) {
|
|
463
|
-
var _a;
|
|
464
|
-
if (!isSigilInstance(other)) return false;
|
|
465
|
-
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
466
|
-
const thisType = this[__LABEL__];
|
|
467
|
-
return !!otherSet && otherSet.has(thisType);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
471
|
-
*
|
|
472
|
-
* Implementation detail:
|
|
473
|
-
* - Works in O(n) time where n is the depth of the lineage.
|
|
474
|
-
* - Reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
|
|
475
|
-
*
|
|
476
|
-
* @typeParam T - The calling constructor type.
|
|
477
|
-
* @param this - The constructor performing the check.
|
|
478
|
-
* @param other - The object to test.
|
|
479
|
-
* @returns `true` if `other` has an identical lineage up to the length of this constructor's lineage.
|
|
480
|
-
*/
|
|
481
|
-
static isOfTypeStrict(other) {
|
|
482
|
-
var _a;
|
|
483
|
-
if (!isSigilInstance(other)) return false;
|
|
484
|
-
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
485
|
-
const thisLineage = this[__LABEL_LINEAGE__];
|
|
486
|
-
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* Check whether `other` is (or inherits from) the type instance.
|
|
490
|
-
*
|
|
491
|
-
* Allows 'instanceof' like checks but in instances.
|
|
492
|
-
*
|
|
493
|
-
* @typeParam T - The instance type.
|
|
494
|
-
* @param this - The instance performing the check.
|
|
495
|
-
* @param other - The object to test.
|
|
496
|
-
* @returns `true` if `other` is the same instance of this type or a subtype.
|
|
497
|
-
*/
|
|
498
|
-
isOfType(other) {
|
|
499
|
-
var _a;
|
|
500
|
-
if (!isSigilInstance(other)) return false;
|
|
501
|
-
const otherSet = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_SET__];
|
|
502
|
-
const thisType = getConstructor(this)[__LABEL__];
|
|
503
|
-
return !!otherSet && otherSet.has(thisType);
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Strict lineage check: compares the type label lineage arrays element-by-element.
|
|
507
|
-
*
|
|
508
|
-
* Allows 'instanceof' like checks but in instances.
|
|
509
|
-
*
|
|
510
|
-
* @typeParam T - The instance type.
|
|
511
|
-
* @param this - The instance performing the check.
|
|
512
|
-
* @param other - The object to test.
|
|
513
|
-
* @returns `true` if `other` has an identical lineage up to the length of this instance's lineage.
|
|
514
|
-
*/
|
|
515
|
-
isOfTypeStrict(other) {
|
|
516
|
-
var _a, _b;
|
|
517
|
-
if (!isSigilInstance(other)) return false;
|
|
518
|
-
const otherLineage = (_a = getConstructor(other)) == null ? void 0 : _a[__LABEL_LINEAGE__];
|
|
519
|
-
const thisLineage = (_b = getConstructor(this)) == null ? void 0 : _b[__LABEL_LINEAGE__];
|
|
520
|
-
return !!otherLineage && thisLineage.every((s, i) => s === otherLineage[i]);
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Returns the identity sigil label of this instance's constructor.
|
|
524
|
-
*
|
|
525
|
-
* @returns The label string if passed (e.g. '@scope/pkg.ClassName'), random label if not passed (e.g. '@Sigil.auto-dq62ib6jnvmmlfbjhxh2937h') or '@Sigil.unknown' if constructor is missing.
|
|
526
|
-
*/
|
|
527
|
-
getSigilLabel() {
|
|
528
|
-
const ctor = getConstructor(this);
|
|
529
|
-
if (!ctor) {
|
|
530
|
-
if (process.env.NODE_ENV !== "production")
|
|
531
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
532
|
-
return "@Sigil.unknown";
|
|
533
|
-
}
|
|
534
|
-
return ctor.SigilLabel;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Returns the human-readable sigil label of this instance's constructor.
|
|
538
|
-
*
|
|
539
|
-
* @returns The last passed label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' if constructor is missing.
|
|
540
|
-
*/
|
|
541
|
-
getSigilEffectiveLabel() {
|
|
542
|
-
const ctor = getConstructor(this);
|
|
543
|
-
if (!ctor) {
|
|
544
|
-
if (process.env.NODE_ENV !== "production")
|
|
545
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
546
|
-
return "@Sigil.unknown";
|
|
547
|
-
}
|
|
548
|
-
return ctor.SigilEffectiveLabel;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Returns a copy of the sigil type label lineage for this instance's constructor.
|
|
552
|
-
*
|
|
553
|
-
* @returns readonly array of labels representing the type lineage.
|
|
554
|
-
*/
|
|
555
|
-
getSigilLabelLineage() {
|
|
556
|
-
const ctor = getConstructor(this);
|
|
557
|
-
if (!ctor) {
|
|
558
|
-
if (process.env.NODE_ENV !== "production")
|
|
559
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
560
|
-
return ["@Sigil.unknown"];
|
|
561
|
-
}
|
|
562
|
-
return ctor.SigilLabelLineage;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Returns a readonly copy of the sigil type label set for this instance's constructor.
|
|
566
|
-
*
|
|
567
|
-
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
568
|
-
*/
|
|
569
|
-
getSigilLabelSet() {
|
|
570
|
-
const ctor = getConstructor(this);
|
|
571
|
-
if (!ctor) {
|
|
572
|
-
if (process.env.NODE_ENV !== "production")
|
|
573
|
-
throw new Error(`[Sigil Error] Sigil class instance without constructor`);
|
|
574
|
-
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
575
|
-
}
|
|
576
|
-
return ctor.SigilLabelSet;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
decorateCtor(Sigilified, l, { isMixin: true });
|
|
580
|
-
markSigil(Sigilified);
|
|
581
|
-
markSigilBase(Sigilified);
|
|
582
|
-
return Sigilified;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// src/core/classes.ts
|
|
586
|
-
var Sigil = Sigilify(class {
|
|
587
|
-
}, "Sigil");
|
|
588
|
-
var SigilError = Sigilify(Error, "SigilError");
|
|
589
|
-
|
|
590
|
-
// src/core/decorator.ts
|
|
591
|
-
function WithSigil(label, opts) {
|
|
592
|
-
let l;
|
|
593
|
-
if (label) {
|
|
594
|
-
verifyLabel(label, opts);
|
|
595
|
-
l = label;
|
|
596
|
-
} else l = generateRandomLabel();
|
|
597
|
-
return function(value, context) {
|
|
598
|
-
if (context.kind !== "class") return;
|
|
599
|
-
if (!isSigilCtor(value))
|
|
600
|
-
throw new Error(
|
|
601
|
-
`[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`
|
|
602
|
-
);
|
|
603
|
-
decorateCtor(value, l);
|
|
604
|
-
checkInheritance(value, opts);
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// src/core/hof.ts
|
|
609
|
-
function withSigil(Class, label, opts) {
|
|
610
|
-
var _a;
|
|
611
|
-
if (!isSigilCtor(Class))
|
|
612
|
-
throw new Error(
|
|
613
|
-
`[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${(_a = Class == null ? void 0 : Class.name) != null ? _a : "unknown"}`
|
|
614
|
-
);
|
|
615
|
-
let l;
|
|
616
|
-
if (label) {
|
|
617
|
-
verifyLabel(label, opts);
|
|
618
|
-
l = label;
|
|
619
|
-
} else l = generateRandomLabel();
|
|
620
|
-
const ctor = Class;
|
|
621
|
-
decorateCtor(ctor, l);
|
|
622
|
-
checkInheritance(ctor, opts);
|
|
623
|
-
return Class;
|
|
624
|
-
}
|
|
625
|
-
function withSigilTyped(Class, label, opts) {
|
|
626
|
-
var _a;
|
|
627
|
-
if (!isSigilCtor(Class))
|
|
628
|
-
throw new Error(
|
|
629
|
-
`[Sigil Error] 'withSigilTyped' HOF accept only Sigil classes but used on class ${(_a = Class == null ? void 0 : Class.name) != null ? _a : "unknown"}`
|
|
630
|
-
);
|
|
631
|
-
let l;
|
|
632
|
-
if (label) {
|
|
633
|
-
verifyLabel(label, opts);
|
|
634
|
-
l = label;
|
|
635
|
-
} else l = generateRandomLabel();
|
|
636
|
-
const ctor = Class;
|
|
637
|
-
decorateCtor(ctor, l);
|
|
638
|
-
checkInheritance(ctor, opts);
|
|
639
|
-
return Class;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
export { DEFAULT_LABEL_REGEX, Sigil, SigilError, Sigilify, SigilifyAbstract, WithSigil, isDecorated, isInheritanceChecked, isSigilBaseCtor, isSigilBaseInstance, isSigilCtor, isSigilInstance, updateSigilOptions, withSigil, withSigilTyped };
|
|
643
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import {createId}from'@paralleldrive/cuid2';var w={labelValidation:null,skipLabelInheritanceCheck:false,autofillLabels:true},V=i=>{if("autofillLabels"in i){if(typeof i.autofillLabels!="boolean")throw new Error("'updateSigilOptions.autofillLabels' must be boolean");w.autofillLabels=i.autofillLabels;}if("skipLabelInheritanceCheck"in i){if(typeof i.skipLabelInheritanceCheck!="boolean")throw new Error("'updateSigilOptions.skipLabelInheritanceCheck' must be boolean");w.skipLabelInheritanceCheck=i.skipLabelInheritanceCheck;}if("labelValidation"in i){let t=i.labelValidation;if(t!==null&&typeof t!="function"&&!(t instanceof RegExp))throw new Error("'updateSigilOptions.labelValidation' must be null, function or RegExp");w.labelValidation=t!=null?t:null;}},P=/^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;var k=Symbol.for("@vicin/sigil.__SIGIL__"),T=Symbol.for("@vicin/sigil.__SIGIL_BASE__"),C=Symbol.for("@vicin/sigil.__DECORATED__"),v=Symbol.for("@vicin/sigil.__INHERITANCE_CHECKED__"),p=Symbol.for("@vicin/sigil.__LABEL__"),O=Symbol.for("@vicin/sigil.__EFFECTIVE_LABEL__"),g=Symbol.for("@vicin/sigil.__LABEL_LINEAGE__"),_=Symbol.for("@vicin/sigil.__LABEL_SET__");function L(i,t,n){if(process.env.NODE_ENV!=="production"&&B(i))throw new Error(`Constructor ${i} is already decorated. if you are using 'withSigilTyped()' & '@WithSigil()' at the same time remove one of them.`);Object.defineProperty(i,p,{value:t,configurable:true,enumerable:false,writable:false}),n!=null&&n.isInheritanceCheck||Object.defineProperty(i,O,{value:t,configurable:true,enumerable:false,writable:false});let o=Object.getPrototypeOf(i),l=o&&o[g]?o[g]:[],S=n!=null&&n.isMixin&&t!=="Sigil"?["Sigil",...l,t]:[...l,t];Object.defineProperty(i,g,{value:S,configurable:true,enumerable:false,writable:false}),Object.defineProperty(i,_,{value:new Set(S),configurable:true,enumerable:false,writable:false}),n!=null&&n.isInheritanceCheck||F(i);}function f(i,t){var S,e;if(b(i)||((S=t==null?void 0:t.skipLabelInheritanceCheck)!=null?S:w.skipLabelInheritanceCheck))return;let n=[i],o=Object.getPrototypeOf(i);for(;h(o);)n.push(o),o=Object.getPrototypeOf(o);let l=new Map;for(let r=n.length-1;r>=0;r--){let c=n[r];if(!c)continue;let s=c[p];if(l.has(s)){if(process.env.NODE_ENV!=="production"&&(B(c)||!((e=t==null?void 0:t.autofillLabels)!=null?e:w.autofillLabels)))throw new Error(`[Sigil Error] Class "${c.name}" re-uses Sigil label "${s}" from ancestor "${l.get(s)}". Each Sigil subclass must use a unique label. Did you forget to use "WithSigil(newLabel)" on the subclass?`);s=y(),L(c,s,{isInheritanceCheck:true});}l.set(s,c.name);}R(i);}function I(i,t){var o;let n=(o=t==null?void 0:t.labelValidation)!=null?o:w.labelValidation;if(n){let l;if(n instanceof RegExp?l=n.test(i):l=n(i),process.env.NODE_ENV!=="production"&&!l)throw new Error(`[Sigil] Invalid identity label "${i}". Make sure that supplied label matches validation regex or function.`)}}function y(){return `@Sigil.auto-${createId()}`}function A(i){Object.defineProperty(i,k,{value:true,configurable:false,enumerable:false,writable:false});}function N(i){Object.defineProperty(i,T,{value:true,configurable:false,enumerable:false,writable:false});}function F(i){Object.defineProperty(i,C,{value:true,configurable:false,enumerable:false,writable:false});}function R(i){Object.defineProperty(i,v,{value:true,configurable:false,enumerable:false,writable:false});}function h(i){return typeof i=="function"&&i[k]===true}function u(i){if(!i||typeof i!="object")return false;let t=a(i);return h(t)}function D(i){return Object.hasOwn(i,T)}function $(i){if(!i||typeof i!="object")return false;let t=a(i);return D(t)}function B(i){return Object.hasOwn(i,C)}function b(i){return Object.hasOwn(i,v)}function a(i){var t,n,o;return !i||typeof i!="object"?null:(o=(n=i.constructor)!=null?n:(t=Object.getPrototypeOf(i))==null?void 0:t.constructor)!=null?o:null}function m(i,t,n){if(h(i))throw new Error(`[Sigil Error] 'Sigilify(${t})' already sigilified.`);let o;t?(I(t,n),o=t):o=y();class l extends i{static get SigilLabel(){return b(this)||f(this),this[p]}static get SigilEffectiveLabel(){return this[O]}static get SigilLabelLineage(){var e;return b(this)||f(this),[...(e=this[g])!=null?e:[]]}static get SigilLabelSet(){b(this)||f(this);let e=new Set;for(let r of this[_])e.add(r);return e}constructor(...e){super(...e),Object.getPrototypeOf(this)!==new.target.prototype&&Object.setPrototypeOf(this,new.target.prototype);let r=a(this);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`[Sigil Error] 'Sigilify(${t})' instance without constructor`);return}f(r);}static isSigilified(e){return u(e)}static isOfType(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[_],c=this[p];return !!r&&r.has(c)}static isOfTypeStrict(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[g],c=this[g];return !!r&&c.every((E,d)=>E===r[d])}isOfType(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[_],c=a(this)[p];return !!r&&r.has(c)}isOfTypeStrict(e){var s,E;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[g],c=(E=a(this))==null?void 0:E[g];return !!r&&c.every((d,x)=>d===r[x])}getSigilLabel(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return "@Sigil.unknown"}return e.SigilLabel}getSigilEffectiveLabel(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return "@Sigil.unknown"}return e.SigilEffectiveLabel}getSigilLabelLineage(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return ["@Sigil.unknown"]}return e.SigilLabelLineage}getSigilLabelSet(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return new Set(["@Sigil.unknown"])}return e.SigilLabelSet}}return L(l,o,{isMixin:true}),A(l),N(l),l}function G(i,t,n){if(h(i))throw new Error(`[Sigil Error] 'Sigilify(${t})' already sigilified.`);let o;t?(I(t,n),o=t):o=y();class l extends i{static get SigilLabel(){return b(this)||f(this),this[p]}static get SigilEffectiveLabel(){return this[O]}static get SigilLabelLineage(){var e;return b(this)||f(this),[...(e=this[g])!=null?e:[]]}static get SigilLabelSet(){b(this)||f(this);let e=new Set;for(let r of this[_])e.add(r);return e}constructor(...e){super(...e),Object.getPrototypeOf(this)!==new.target.prototype&&Object.setPrototypeOf(this,new.target.prototype);let r=a(this);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`[Sigil Error] 'Sigilify(${t})' instance without constructor`);return}f(r);}static isSigilified(e){return u(e)}static isOfType(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[_],c=this[p];return !!r&&r.has(c)}static isOfTypeStrict(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[g],c=this[g];return !!r&&c.every((E,d)=>E===r[d])}isOfType(e){var s;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[_],c=a(this)[p];return !!r&&r.has(c)}isOfTypeStrict(e){var s,E;if(!u(e))return false;let r=(s=a(e))==null?void 0:s[g],c=(E=a(this))==null?void 0:E[g];return !!r&&c.every((d,x)=>d===r[x])}getSigilLabel(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return "@Sigil.unknown"}return e.SigilLabel}getSigilEffectiveLabel(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return "@Sigil.unknown"}return e.SigilEffectiveLabel}getSigilLabelLineage(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return ["@Sigil.unknown"]}return e.SigilLabelLineage}getSigilLabelSet(){let e=a(this);if(!e){if(process.env.NODE_ENV!=="production")throw new Error("[Sigil Error] Sigil class instance without constructor");return new Set(["@Sigil.unknown"])}return e.SigilLabelSet}}return L(l,o,{isMixin:true}),A(l),N(l),l}var H=m(class{},"Sigil"),M=m(Error,"SigilError");function K(i,t){let n;return i?(I(i,t),n=i):n=y(),function(o,l){if(l.kind==="class"){if(!h(o))throw new Error(`[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${o.name}`);L(o,n),f(o,t);}}}function W(i,t,n){var S;if(!h(i))throw new Error(`[Sigil Error] 'withSigil' HOF accept only Sigil classes but used on class ${(S=i==null?void 0:i.name)!=null?S:"unknown"}`);let o;t?(I(t,n),o=t):o=y();let l=i;return L(l,o),f(l,n),i}export{P as DEFAULT_LABEL_REGEX,H as Sigil,M as SigilError,m as Sigilify,G as SigilifyAbstract,K as WithSigil,B as isDecorated,b as isInheritanceChecked,D as isSigilBaseCtor,$ as isSigilBaseInstance,h as isSigilCtor,u as isSigilInstance,V as updateSigilOptions,W as withSigil};//# sourceMappingURL=index.mjs.map
|
|
644
2
|
//# sourceMappingURL=index.mjs.map
|