@vicin/sigil 2.0.0 → 2.0.1
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 +11 -1
- package/README.md +1 -2
- package/dist/index.d.mts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.global.js +21 -30
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +23 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.0.1] - 2026-02-21
|
|
6
|
+
|
|
7
|
+
### Removed
|
|
8
|
+
|
|
9
|
+
- `updateOptions.devMarker`
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Now dev checks are internal only
|
|
14
|
+
|
|
5
15
|
## [2.0.0] - 2026-02-20
|
|
6
16
|
|
|
7
17
|
### Breaking changes
|
|
8
18
|
|
|
9
|
-
All `SigilRegistry`options, methods and classes are removed.
|
|
19
|
+
- All `SigilRegistry`options, methods and classes are removed.
|
|
10
20
|
|
|
11
21
|
## [1.3.0] - 2026-02-18
|
|
12
22
|
|
package/README.md
CHANGED
|
@@ -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
|
-
- `updateOptions(opts)`: change global runtime options before `Sigil` decoration (e.g., `autofillLabels
|
|
410
|
+
- `updateOptions(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
|
|
@@ -443,7 +443,6 @@ updateOptions({
|
|
|
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
|
|
446
|
-
devMarker: process.env.NODE_ENV !== 'production', // Toggle dev safeguards
|
|
447
446
|
});
|
|
448
447
|
```
|
|
449
448
|
|
package/dist/index.d.mts
CHANGED
|
@@ -290,12 +290,6 @@ interface SigilOptions {
|
|
|
290
290
|
* will be assigned an autogenerated random label (so that explicit labels stay unique).
|
|
291
291
|
*/
|
|
292
292
|
autofillLabels?: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Marker used internally to control dev only checks to optimize performace while preserving
|
|
295
|
-
* consistency for things like inheritance checks.
|
|
296
|
-
* defaults to 'process.env.NODE_ENV !== "production'.
|
|
297
|
-
*/
|
|
298
|
-
devMarker?: boolean;
|
|
299
293
|
}
|
|
300
294
|
/**
|
|
301
295
|
* Update runtime options for the Sigil library.
|
package/dist/index.d.ts
CHANGED
|
@@ -290,12 +290,6 @@ interface SigilOptions {
|
|
|
290
290
|
* will be assigned an autogenerated random label (so that explicit labels stay unique).
|
|
291
291
|
*/
|
|
292
292
|
autofillLabels?: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Marker used internally to control dev only checks to optimize performace while preserving
|
|
295
|
-
* consistency for things like inheritance checks.
|
|
296
|
-
* defaults to 'process.env.NODE_ENV !== "production'.
|
|
297
|
-
*/
|
|
298
|
-
devMarker?: boolean;
|
|
299
293
|
}
|
|
300
294
|
/**
|
|
301
295
|
* Update runtime options for the Sigil library.
|
package/dist/index.global.js
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
var OPTIONS = {
|
|
10
10
|
labelValidation: null,
|
|
11
11
|
skipLabelInheritanceCheck: false,
|
|
12
|
-
autofillLabels: false
|
|
13
|
-
devMarker: false
|
|
12
|
+
autofillLabels: false
|
|
14
13
|
};
|
|
15
14
|
var updateOptions = (opts) => {
|
|
16
15
|
for (const [k, v] of Object.entries(opts)) OPTIONS[k] = v;
|
|
@@ -18,8 +17,7 @@
|
|
|
18
17
|
var DEFAULT_OPTIONS = {
|
|
19
18
|
labelValidation: null,
|
|
20
19
|
skipLabelInheritanceCheck: false,
|
|
21
|
-
autofillLabels: false
|
|
22
|
-
devMarker: process.env.NODE_ENV !== "production"
|
|
20
|
+
autofillLabels: false
|
|
23
21
|
};
|
|
24
22
|
updateOptions(DEFAULT_OPTIONS);
|
|
25
23
|
var DEFAULT_LABEL_REGEX = /^@[\w-]+(?:\/[\w-]+)*\.[A-Z][A-Za-z0-9]*$/;
|
|
@@ -1740,6 +1738,9 @@
|
|
|
1740
1738
|
};
|
|
1741
1739
|
}
|
|
1742
1740
|
|
|
1741
|
+
// src/core/constants.ts
|
|
1742
|
+
var __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV === "development";
|
|
1743
|
+
|
|
1743
1744
|
// src/core/helpers.ts
|
|
1744
1745
|
function decorateCtor(ctor, label, isMixin = false) {
|
|
1745
1746
|
if (isDecorated(ctor))
|
|
@@ -1770,11 +1771,9 @@
|
|
|
1770
1771
|
markDecorated(ctor);
|
|
1771
1772
|
}
|
|
1772
1773
|
function checkInheritance(ctor, opts) {
|
|
1773
|
-
var _a, _b
|
|
1774
|
-
const
|
|
1775
|
-
const
|
|
1776
|
-
const autofillLabels = (_c = opts == null ? void 0 : opts.autofillLabels) != null ? _c : OPTIONS.autofillLabels;
|
|
1777
|
-
if (!devMarker) return;
|
|
1774
|
+
var _a, _b;
|
|
1775
|
+
const skipLabelInheritanceCheck = (_a = opts == null ? void 0 : opts.skipLabelInheritanceCheck) != null ? _a : OPTIONS.skipLabelInheritanceCheck;
|
|
1776
|
+
const autofillLabels = (_b = opts == null ? void 0 : opts.autofillLabels) != null ? _b : OPTIONS.autofillLabels;
|
|
1778
1777
|
if (!isSigilCtor(ctor)) return;
|
|
1779
1778
|
if (isInheritanceChecked(ctor) || skipLabelInheritanceCheck) return;
|
|
1780
1779
|
const ctors = [ctor];
|
|
@@ -1918,17 +1917,16 @@
|
|
|
1918
1917
|
return set;
|
|
1919
1918
|
}
|
|
1920
1919
|
constructor(...args) {
|
|
1921
|
-
var _a;
|
|
1922
1920
|
super(...args);
|
|
1923
1921
|
if (Object.getPrototypeOf(this) !== new.target.prototype)
|
|
1924
1922
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
1925
1923
|
const ctor = getConstructor(this);
|
|
1926
1924
|
if (!ctor) {
|
|
1927
|
-
if (
|
|
1925
|
+
if (__DEV__)
|
|
1928
1926
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
1929
1927
|
return;
|
|
1930
1928
|
}
|
|
1931
|
-
checkInheritance(ctor);
|
|
1929
|
+
if (__DEV__) checkInheritance(ctor);
|
|
1932
1930
|
}
|
|
1933
1931
|
/**
|
|
1934
1932
|
* Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
|
|
@@ -2012,10 +2010,9 @@
|
|
|
2012
2010
|
* @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
|
|
2013
2011
|
*/
|
|
2014
2012
|
getSigilLabel() {
|
|
2015
|
-
var _a;
|
|
2016
2013
|
const ctor = getConstructor(this);
|
|
2017
2014
|
if (!ctor) {
|
|
2018
|
-
if (
|
|
2015
|
+
if (__DEV__)
|
|
2019
2016
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2020
2017
|
return "@Sigil.unknown";
|
|
2021
2018
|
}
|
|
@@ -2027,10 +2024,9 @@
|
|
|
2027
2024
|
* @returns readonly array of labels representing the type lineage.
|
|
2028
2025
|
*/
|
|
2029
2026
|
getSigilLabelLineage() {
|
|
2030
|
-
var _a;
|
|
2031
2027
|
const ctor = getConstructor(this);
|
|
2032
2028
|
if (!ctor) {
|
|
2033
|
-
if (
|
|
2029
|
+
if (__DEV__)
|
|
2034
2030
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2035
2031
|
return ["@Sigil.unknown"];
|
|
2036
2032
|
}
|
|
@@ -2042,10 +2038,9 @@
|
|
|
2042
2038
|
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
2043
2039
|
*/
|
|
2044
2040
|
getSigilLabelSet() {
|
|
2045
|
-
var _a;
|
|
2046
2041
|
const ctor = getConstructor(this);
|
|
2047
2042
|
if (!ctor) {
|
|
2048
|
-
if (
|
|
2043
|
+
if (__DEV__)
|
|
2049
2044
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2050
2045
|
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
2051
2046
|
}
|
|
@@ -2095,17 +2090,16 @@
|
|
|
2095
2090
|
return set;
|
|
2096
2091
|
}
|
|
2097
2092
|
constructor(...args) {
|
|
2098
|
-
var _a;
|
|
2099
2093
|
super(...args);
|
|
2100
2094
|
if (Object.getPrototypeOf(this) !== new.target.prototype)
|
|
2101
2095
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
2102
2096
|
const ctor = getConstructor(this);
|
|
2103
2097
|
if (!ctor) {
|
|
2104
|
-
if (
|
|
2098
|
+
if (__DEV__)
|
|
2105
2099
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2106
2100
|
return;
|
|
2107
2101
|
}
|
|
2108
|
-
checkInheritance(ctor);
|
|
2102
|
+
if (__DEV__) checkInheritance(ctor);
|
|
2109
2103
|
}
|
|
2110
2104
|
/**
|
|
2111
2105
|
* Runtime predicate indicating whether `obj` is an instance produced by a sigil class.
|
|
@@ -2197,10 +2191,9 @@
|
|
|
2197
2191
|
* @returns The label string (e.g. '@scope/pkg.ClassName') or '@Sigil.unknown' in DEV when constructor is missing.
|
|
2198
2192
|
*/
|
|
2199
2193
|
getSigilLabel() {
|
|
2200
|
-
var _a;
|
|
2201
2194
|
const ctor = getConstructor(this);
|
|
2202
2195
|
if (!ctor) {
|
|
2203
|
-
if (
|
|
2196
|
+
if (__DEV__)
|
|
2204
2197
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2205
2198
|
return "@Sigil.unknown";
|
|
2206
2199
|
}
|
|
@@ -2212,10 +2205,9 @@
|
|
|
2212
2205
|
* @returns readonly array of labels representing the type lineage.
|
|
2213
2206
|
*/
|
|
2214
2207
|
getSigilLabelLineage() {
|
|
2215
|
-
var _a;
|
|
2216
2208
|
const ctor = getConstructor(this);
|
|
2217
2209
|
if (!ctor) {
|
|
2218
|
-
if (
|
|
2210
|
+
if (__DEV__)
|
|
2219
2211
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2220
2212
|
return ["@Sigil.unknown"];
|
|
2221
2213
|
}
|
|
@@ -2227,10 +2219,9 @@
|
|
|
2227
2219
|
* @returns A Readonly Set of labels representing the type lineage for O(1) membership tests.
|
|
2228
2220
|
*/
|
|
2229
2221
|
getSigilLabelSet() {
|
|
2230
|
-
var _a;
|
|
2231
2222
|
const ctor = getConstructor(this);
|
|
2232
2223
|
if (!ctor) {
|
|
2233
|
-
if (
|
|
2224
|
+
if (__DEV__)
|
|
2234
2225
|
throw new Error(`[Sigil Error] 'Sigilify(${label})' instance without constructor`);
|
|
2235
2226
|
return /* @__PURE__ */ new Set(["@Sigil.unknown"]);
|
|
2236
2227
|
}
|
|
@@ -2262,7 +2253,7 @@
|
|
|
2262
2253
|
`[Sigil Error] 'WithSigil' decorator accept only Sigil classes but used on class ${value.name}`
|
|
2263
2254
|
);
|
|
2264
2255
|
decorateCtor(value, l);
|
|
2265
|
-
checkInheritance(value, opts);
|
|
2256
|
+
if (__DEV__) checkInheritance(value, opts);
|
|
2266
2257
|
};
|
|
2267
2258
|
}
|
|
2268
2259
|
|
|
@@ -2280,7 +2271,7 @@
|
|
|
2280
2271
|
} else l = generateRandomLabel();
|
|
2281
2272
|
const ctor = Class;
|
|
2282
2273
|
decorateCtor(ctor, l);
|
|
2283
|
-
checkInheritance(ctor, opts);
|
|
2274
|
+
if (__DEV__) checkInheritance(ctor, opts);
|
|
2284
2275
|
return Class;
|
|
2285
2276
|
}
|
|
2286
2277
|
function withSigilTyped(Class, label, opts) {
|
|
@@ -2296,7 +2287,7 @@
|
|
|
2296
2287
|
} else l = generateRandomLabel();
|
|
2297
2288
|
const ctor = Class;
|
|
2298
2289
|
decorateCtor(ctor, l);
|
|
2299
|
-
checkInheritance(ctor, opts);
|
|
2290
|
+
if (__DEV__) checkInheritance(ctor, opts);
|
|
2300
2291
|
return Class;
|
|
2301
2292
|
}
|
|
2302
2293
|
/*! Bundled license information:
|