arktype 3.0.0-beta.1 → 3.0.0-rc.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/README.md +48 -144
- package/out/_internal/regex/charset.d.ts +24 -0
- package/out/_internal/regex/escape.d.ts +29 -0
- package/out/_internal/regex/execArray.d.ts +24 -0
- package/out/_internal/regex/group.d.ts +34 -0
- package/out/_internal/regex/index.d.ts +2 -0
- package/out/_internal/regex/internal.d.ts +9 -0
- package/out/_internal/regex/parse.d.ts +10 -0
- package/out/_internal/regex/quantify.d.ts +59 -0
- package/out/_internal/regex/regex.d.ts +38 -0
- package/out/_internal/regex/state.d.ts +383 -0
- package/out/_internal/schema/codecs.d.ts +2 -0
- package/out/_internal/schema/config.d.ts +103 -0
- package/out/_internal/schema/constraint.d.ts +78 -0
- package/out/_internal/schema/errors.d.ts +1 -0
- package/out/_internal/schema/generic.d.ts +85 -0
- package/out/_internal/schema/i18n.d.ts +3 -0
- package/out/_internal/schema/index.d.ts +54 -0
- package/out/_internal/schema/internal.d.ts +15 -0
- package/out/_internal/schema/intrinsic.d.ts +28 -0
- package/out/_internal/schema/kinds.d.ts +76 -0
- package/out/_internal/schema/module.d.ts +23 -0
- package/out/_internal/schema/mutatesInput.d.ts +2 -0
- package/out/_internal/schema/node.d.ts +349 -0
- package/out/_internal/schema/parse.d.ts +77 -0
- package/out/_internal/schema/parseSchema.d.ts +116 -0
- package/out/_internal/schema/predicate.d.ts +46 -0
- package/out/_internal/schema/refinements/after.d.ts +32 -0
- package/out/_internal/schema/refinements/before.d.ts +32 -0
- package/out/_internal/schema/refinements/divisor.d.ts +41 -0
- package/out/_internal/schema/refinements/exactLength.d.ts +43 -0
- package/out/_internal/schema/refinements/kinds.d.ts +40 -0
- package/out/_internal/schema/refinements/max.d.ts +33 -0
- package/out/_internal/schema/refinements/maxLength.d.ts +32 -0
- package/out/_internal/schema/refinements/min.d.ts +33 -0
- package/out/_internal/schema/refinements/minLength.d.ts +32 -0
- package/out/_internal/schema/refinements/notEqual.d.ts +38 -0
- package/out/_internal/schema/refinements/notEqualLength.d.ts +38 -0
- package/out/_internal/schema/refinements/pattern.d.ts +43 -0
- package/out/_internal/schema/refinements/range.d.ts +101 -0
- package/out/_internal/schema/roots/alias.d.ts +49 -0
- package/out/_internal/schema/roots/basis.d.ts +12 -0
- package/out/_internal/schema/roots/domain.d.ts +45 -0
- package/out/_internal/schema/roots/intersection.d.ts +72 -0
- package/out/_internal/schema/roots/morph.d.ts +59 -0
- package/out/_internal/schema/roots/proto.d.ts +42 -0
- package/out/_internal/schema/roots/root.d.ts +163 -0
- package/out/_internal/schema/roots/union.d.ts +146 -0
- package/out/_internal/schema/roots/unit.d.ts +36 -0
- package/out/_internal/schema/runtime.d.ts +29 -0
- package/out/_internal/schema/runtimeLean.d.ts +2 -0
- package/out/_internal/schema/runtimeNone.d.ts +2 -0
- package/out/_internal/schema/runtimeNoneLean.d.ts +2 -0
- package/out/_internal/schema/scope.d.ts +203 -0
- package/out/_internal/schema/shared/codecs.d.ts +5 -0
- package/out/_internal/schema/shared/compile.d.ts +144 -0
- package/out/_internal/schema/shared/configured.d.ts +14 -0
- package/out/_internal/schema/shared/declare.d.ts +100 -0
- package/out/_internal/schema/shared/disjoint.d.ts +45 -0
- package/out/_internal/schema/shared/enWriters.d.ts +30 -0
- package/out/_internal/schema/shared/errorModes.d.ts +25 -0
- package/out/_internal/schema/shared/errorWriters.d.ts +34 -0
- package/out/_internal/schema/shared/errors.d.ts +264 -0
- package/out/_internal/schema/shared/implement.d.ts +154 -0
- package/out/_internal/schema/shared/inPlace.d.ts +8 -0
- package/out/_internal/schema/shared/issueFeatures.d.ts +38 -0
- package/out/_internal/schema/shared/issues.d.ts +261 -0
- package/out/_internal/schema/shared/issuesLean.d.ts +80 -0
- package/out/_internal/schema/shared/issuesNone.d.ts +22 -0
- package/out/_internal/schema/shared/issuesNoneLean.d.ts +20 -0
- package/out/_internal/schema/shared/issuesUndetailed.d.ts +25 -0
- package/out/_internal/schema/shared/jsonSchema.d.ts +153 -0
- package/out/_internal/schema/shared/listed.d.ts +15 -0
- package/out/_internal/schema/shared/locale.d.ts +149 -0
- package/out/_internal/schema/shared/registry.d.ts +16 -0
- package/out/_internal/schema/shared/render.d.ts +3 -0
- package/out/_internal/schema/shared/rootApply.d.ts +19 -0
- package/out/_internal/schema/shared/sets.d.ts +26 -0
- package/out/_internal/schema/shared/standardFailure.d.ts +22 -0
- package/out/_internal/schema/shared/standardSchema.d.ts +124 -0
- package/out/_internal/schema/shared/toJsonSchema.d.ts +229 -0
- package/out/_internal/schema/shared/transform.d.ts +35 -0
- package/out/_internal/schema/shared/traversal.d.ts +288 -0
- package/out/_internal/schema/shared/utils.d.ts +59 -0
- package/out/_internal/schema/structure/index.d.ts +43 -0
- package/out/_internal/schema/structure/optional.d.ts +61 -0
- package/out/_internal/schema/structure/prop.d.ts +45 -0
- package/out/_internal/schema/structure/required.d.ts +49 -0
- package/out/_internal/schema/structure/sequence.d.ts +127 -0
- package/out/_internal/schema/structure/shared.d.ts +3 -0
- package/out/_internal/schema/structure/structure.d.ts +178 -0
- package/out/_internal/schema/units.d.ts +123 -0
- package/out/_internal/sets/algebra.d.ts +26 -0
- package/out/_internal/sets/constraint.d.ts +19 -0
- package/out/_internal/sets/engine.d.ts +2 -0
- package/out/_internal/sets/formats.d.ts +23 -0
- package/out/_internal/sets/fromJsonSchema.d.ts +15 -0
- package/out/_internal/sets/implement.d.ts +16 -0
- package/out/_internal/sets/index.d.ts +2 -0
- package/out/_internal/sets/internal.d.ts +20 -0
- package/out/_internal/sets/intersections.d.ts +5 -0
- package/out/_internal/sets/kinds.d.ts +3 -0
- package/out/_internal/sets/refinements.d.ts +14 -0
- package/out/_internal/sets/roots/alias.d.ts +3 -0
- package/out/_internal/sets/roots/domain.d.ts +3 -0
- package/out/_internal/sets/roots/intersection.d.ts +4 -0
- package/out/_internal/sets/roots/morph.d.ts +4 -0
- package/out/_internal/sets/roots/proto.d.ts +3 -0
- package/out/_internal/sets/roots/union.d.ts +16 -0
- package/out/_internal/sets/roots/unit.d.ts +3 -0
- package/out/_internal/sets/structure/index.d.ts +3 -0
- package/out/_internal/sets/structure/prop.d.ts +8 -0
- package/out/_internal/sets/structure/sequence.d.ts +3 -0
- package/out/_internal/sets/structure/structure.d.ts +3 -0
- package/out/_internal/sets/toJsonSchema.d.ts +25 -0
- package/out/_internal/util/arrays.d.ts +130 -0
- package/out/_internal/util/clone.d.ts +4 -0
- package/out/_internal/util/describe.d.ts +25 -0
- package/out/_internal/util/domain.d.ts +49 -0
- package/out/_internal/util/errors.d.ts +29 -0
- package/out/_internal/util/facts.d.ts +22 -0
- package/out/_internal/util/flatMorph.d.ts +41 -0
- package/out/_internal/util/formats.d.ts +8 -0
- package/out/_internal/util/functions.d.ts +33 -0
- package/out/_internal/util/generics.d.ts +65 -0
- package/out/_internal/util/get.d.ts +9 -0
- package/out/_internal/util/hkt.d.ts +27 -0
- package/out/_internal/util/i18n.d.ts +12 -0
- package/out/_internal/util/index.d.ts +28 -0
- package/out/_internal/util/internal.d.ts +2 -0
- package/out/_internal/util/intersections.d.ts +50 -0
- package/out/_internal/util/isomorphic.d.ts +8 -0
- package/out/_internal/util/keys.d.ts +18 -0
- package/out/_internal/util/lazily.d.ts +7 -0
- package/out/_internal/util/numbers.d.ts +82 -0
- package/out/_internal/util/objectKinds.d.ts +157 -0
- package/out/_internal/util/path.d.ts +16 -0
- package/out/_internal/util/primitive.d.ts +16 -0
- package/out/_internal/util/records.d.ts +173 -0
- package/out/_internal/util/registry.d.ts +13 -0
- package/out/_internal/util/scanner.d.ts +110 -0
- package/out/_internal/util/serialize.d.ts +40 -0
- package/out/_internal/util/strings.d.ts +35 -0
- package/out/_internal/util/traits.d.ts +89 -0
- package/out/_internal/util/unionToTuple.d.ts +14 -0
- package/out/_internal/util/weak.d.ts +8 -0
- package/out/attributes.d.ts +15 -11
- package/out/checkers.d.ts +1 -1
- package/out/chunk-22RQSVV3.js +0 -0
- package/out/chunk-3HZC67MT.js +965 -0
- package/out/chunk-3KBOPH3J.js +1564 -0
- package/out/chunk-3SH2BQ4T.js +15 -0
- package/out/chunk-46PLKNON.js +126 -0
- package/out/{chunk-G45P2CLE.js → chunk-4FTHWK63.js} +6 -1
- package/out/{chunk-UK5UGFOX.js → chunk-4HREHNIV.js} +23 -11
- package/out/chunk-4NZCLVBD.js +14 -0
- package/out/chunk-6FMBO47M.js +7 -0
- package/out/chunk-7TALAWYX.js +10 -0
- package/out/{chunk-DLWCO4RV.js → chunk-BCYKO54Z.js} +11 -2
- package/out/chunk-BDJVONP7.js +168 -0
- package/out/{chunk-E3DZXEZK.js → chunk-C2JOL5M2.js} +4 -2
- package/out/{chunk-2U2AWCI3.js → chunk-C2V6QPE3.js} +126 -97
- package/out/chunk-C3B4IFQL.js +6408 -0
- package/out/chunk-CWSF57VM.js +10 -0
- package/out/chunk-F5BACUJS.js +7 -0
- package/out/{chunk-EVCML554.js → chunk-FWRSDUJ2.js} +14 -5
- package/out/chunk-GID3FSQA.js +161 -0
- package/out/chunk-I2KLQ2HA.js +22 -0
- package/out/chunk-K7SLP5D2.js +84 -0
- package/out/chunk-KQPSKGUI.js +9 -0
- package/out/chunk-KXOC3JEX.js +8234 -0
- package/out/chunk-KXOSUYRA.js +405 -0
- package/out/chunk-LHNEY6QW.js +0 -0
- package/out/chunk-MTWKGAGO.js +323 -0
- package/out/chunk-NU73GNCX.js +170 -0
- package/out/{chunk-RAZ3TXOE.js → chunk-P5W67FQH.js} +34 -19
- package/out/chunk-PDLTEX6Z.js +1118 -0
- package/out/{chunk-VV6YDN2D.js → chunk-QUS4IAXJ.js} +304 -263
- package/out/chunk-R7WXIH5P.js +94 -0
- package/out/chunk-TACLEIDM.js +95 -0
- package/out/chunk-UJJGG4VQ.js +71 -0
- package/out/chunk-US6BWOGJ.js +109 -0
- package/out/chunk-VMMMOO4R.js +945 -0
- package/out/chunk-VYMXHSFR.js +439 -0
- package/out/chunk-W2XOI5DY.js +141 -0
- package/out/chunk-WC5L5YRP.js +25 -0
- package/out/{chunk-NRIGTMPM.js → chunk-WKOSL2G6.js} +4 -1
- package/out/chunk-XLG66ZDF.js +0 -0
- package/out/{chunk-5U2ZMDNI.js → chunk-XNUAQSJ4.js} +52 -30
- package/out/chunk-ZRYEHGSG.js +79 -0
- package/out/cli.d.ts +28 -0
- package/out/cli.js +636 -0
- package/out/codecs.d.ts +6 -5
- package/out/codecs.js +23 -7
- package/out/config.d.ts +5 -17
- package/out/config.js +11 -2
- package/out/declare.d.ts +40 -12
- package/out/deferred.d.ts +2 -2
- package/out/errors.d.ts +1 -1
- package/out/errors.js +10 -2
- package/out/fn.d.ts +20 -13
- package/out/fromJsonSchema.d.ts +18 -0
- package/out/generic.d.ts +9 -6
- package/out/i18n.d.ts +2 -2
- package/out/i18n.js +9 -2
- package/out/index.d.ts +16 -7
- package/out/index.js +25 -8
- package/out/internal.d.ts +4 -0
- package/out/internal.js +41 -17
- package/out/island.js +22 -6
- package/out/islandDependency.js +42 -18
- package/out/jsonSchema/infer.d.ts +805 -0
- package/out/jsonSchema/validate.d.ts +416 -0
- package/out/keywords/Array.d.ts +2 -2
- package/out/keywords/builtins.d.ts +3 -3
- package/out/keywords/constructors.d.ts +1 -1
- package/out/keywords/functions.d.ts +5 -192
- package/out/keywords/keywords.d.ts +3 -3
- package/out/keywords/number.d.ts +2 -2
- package/out/keywords/phrases.d.ts +4 -191
- package/out/keywords/string.d.ts +3 -3
- package/out/keywords/ts.d.ts +18 -18
- package/out/keywords/ts.js +19 -4
- package/out/locale.d.ts +6 -2
- package/out/locales/de.js +9 -2
- package/out/locales/en.js +21 -5
- package/out/match.d.ts +13 -10
- package/out/module.d.ts +2 -2
- package/out/mutatesInput.js +18 -3
- package/out/nary.d.ts +220 -194
- package/out/parser/ast/bounds.d.ts +2 -2
- package/out/parser/ast/default.d.ts +2 -2
- package/out/parser/ast/divisor.d.ts +2 -2
- package/out/parser/ast/generic.d.ts +2 -2
- package/out/parser/ast/infer.d.ts +1 -1
- package/out/parser/ast/keyof.d.ts +2 -2
- package/out/parser/ast/utils.d.ts +1 -1
- package/out/parser/ast/validate.d.ts +2 -2
- package/out/parser/definition.d.ts +4 -4
- package/out/parser/objectLiteral.d.ts +2 -2
- package/out/parser/property.d.ts +2 -2
- package/out/parser/reduce/dynamic.d.ts +2 -2
- package/out/parser/reduce/shared.d.ts +1 -1
- package/out/parser/reduce/static.d.ts +1 -1
- package/out/parser/shift/operand/enclosed.d.ts +2 -2
- package/out/parser/shift/operand/genericArgs.d.ts +2 -2
- package/out/parser/shift/operand/operand.d.ts +1 -1
- package/out/parser/shift/operand/unenclosed.d.ts +2 -2
- package/out/parser/shift/operand/unresolvable.d.ts +2 -2
- package/out/parser/shift/operator/bounds.d.ts +2 -2
- package/out/parser/shift/operator/brand.d.ts +2 -2
- package/out/parser/shift/operator/default.d.ts +4 -4
- package/out/parser/shift/operator/divisor.d.ts +1 -1
- package/out/parser/shift/operator/operator.d.ts +1 -1
- package/out/parser/shift/tokens.d.ts +1 -1
- package/out/parser/string.d.ts +2 -2
- package/out/parser/tupleExpressions.d.ts +6 -8
- package/out/parser/tupleLiteral.d.ts +2 -2
- package/out/precompiled.d.ts +1 -1
- package/out/precompiled.js +16 -2
- package/out/regex.d.ts +1 -0
- package/out/regex.js +2 -0
- package/out/runtime.d.ts +10 -8
- package/out/runtime.js +6 -4
- package/out/runtimeDevelopment.js +70 -52
- package/out/schema.d.ts +1 -0
- package/out/schema.js +15 -0
- package/out/schemaInternal.d.ts +1 -0
- package/out/schemaInternal.js +1401 -0
- package/out/schemaIssueFeatures.d.ts +1 -0
- package/out/schemaRuntime.d.ts +1 -0
- package/out/schemaRuntime.js +7 -0
- package/out/schemaRuntimeLean.d.ts +1 -0
- package/out/schemaRuntimeLean.js +1870 -0
- package/out/schemaRuntimeNone.d.ts +1 -0
- package/out/schemaRuntimeNone.js +1774 -0
- package/out/schemaRuntimeNoneLean.d.ts +1 -0
- package/out/schemaRuntimeNoneLean.js +1767 -0
- package/out/scope.d.ts +3 -4
- package/out/shared/issueFeatures.d.ts +38 -0
- package/out/shared/issueFeatures.js +40 -0
- package/out/standalone/artifact.d.ts +6 -6
- package/out/standalone/baking.d.ts +2 -2
- package/out/standalone/combinators.d.ts +1 -1
- package/out/standalone/compilers.d.ts +1 -1
- package/out/standalone/fallbacks.d.ts +1 -1
- package/out/standalone/keys.d.ts +1 -1
- package/out/standalone/sites.d.ts +3 -3
- package/out/standalone/units.d.ts +1 -1
- package/out/standalone/values.d.ts +1 -1
- package/out/type.d.ts +6 -6
- package/out/util.d.ts +1 -0
- package/out/util.js +137 -0
- package/out/variants/array.d.ts +6 -6
- package/out/variants/base.d.ts +61 -10
- package/out/variants/date.d.ts +5 -5
- package/out/variants/instantiate.d.ts +1 -1
- package/out/variants/number.d.ts +6 -6
- package/out/variants/object.d.ts +25 -12
- package/out/variants/string.d.ts +8 -8
- package/package.json +183 -8
- package/skills/arktype/SKILL.md +93 -93
- package/skills/arktype/references/migrating.md +144 -158
- package/skills/arktype/references/precompile.md +7 -7
- package/out/chunk-4CUA5XIP.js +0 -7
- package/out/chunk-GPNK5353.js +0 -2529
- package/out/chunk-MLKGABMK.js +0 -9
- package/out/chunk-PRTMQCHS.js +0 -3
- package/out/chunk-R5G57XC7.js +0 -7
- package/out/chunk-SWOOCAHN.js +0 -4
- package/out/chunk-TAHPKDNM.js +0 -3
- package/out/chunk-UETB6YE2.js +0 -14
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rootApplyRuntime
|
|
3
|
+
} from "./chunk-K7SLP5D2.js";
|
|
4
|
+
import {
|
|
5
|
+
$ark,
|
|
6
|
+
ArkErrors,
|
|
7
|
+
ArkTraversal,
|
|
8
|
+
SiteTraversal,
|
|
9
|
+
invalidError,
|
|
10
|
+
isArkError,
|
|
11
|
+
serializableErrors
|
|
12
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
13
|
+
import {
|
|
14
|
+
lineOf
|
|
15
|
+
} from "./chunk-3KBOPH3J.js";
|
|
16
|
+
|
|
17
|
+
// ../schema/out/shared/errorModes.js
|
|
18
|
+
import { findsOnRead } from "./shared/issueFeatures.js";
|
|
19
|
+
var ArkFirstIssueTraversal = class extends ArkTraversal {
|
|
20
|
+
get failFast() {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
fin(onFail) {
|
|
24
|
+
const errors = this._errors;
|
|
25
|
+
if (errors && errors._.length > 1) {
|
|
26
|
+
errors._.length = 1;
|
|
27
|
+
errors._init(this.config);
|
|
28
|
+
}
|
|
29
|
+
return super.fin(onFail);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var UndetailedErrors = class extends ArkErrors {
|
|
33
|
+
// written once read, with every field an error has
|
|
34
|
+
get issues() {
|
|
35
|
+
const issues = this._;
|
|
36
|
+
for (let i = 0; i < issues.length; i++)
|
|
37
|
+
if (!isArkError(issues[i]))
|
|
38
|
+
issues[i] = invalidError(issues[i], $ark.cfg);
|
|
39
|
+
return serializableErrors(issues);
|
|
40
|
+
}
|
|
41
|
+
get _first() {
|
|
42
|
+
return this.issues[0];
|
|
43
|
+
}
|
|
44
|
+
// an issue ctx added below the root is named by its path, as any is
|
|
45
|
+
get summary() {
|
|
46
|
+
return this._.reduce((summary, issue) => summary + (summary && "\n") + lineOf(issue), "");
|
|
47
|
+
}
|
|
48
|
+
// "is invalid" is arktype's own text, written in en whatever the locale
|
|
49
|
+
summaryIn() {
|
|
50
|
+
return this.summary;
|
|
51
|
+
}
|
|
52
|
+
// arktype's grouped issues, which merging reads
|
|
53
|
+
get _i() {
|
|
54
|
+
return this.issues;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var UndetailedTraversal = class extends SiteTraversal {
|
|
58
|
+
createErrors() {
|
|
59
|
+
return new UndetailedErrors(this.config);
|
|
60
|
+
}
|
|
61
|
+
// a root apply finalizes it only once data is invalid
|
|
62
|
+
fin(onFail) {
|
|
63
|
+
return rejectUndetailed(null, this.root, this.config, onFail);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var undetailedPrototype = UndetailedErrors.prototype;
|
|
67
|
+
var rejectUndetailed = function (node, data, config, onFail) {
|
|
68
|
+
const errors = Object.create(undetailedPrototype);
|
|
69
|
+
const issues = [
|
|
70
|
+
{ code: "predicate", path: [], data }
|
|
71
|
+
];
|
|
72
|
+
if (findsOnRead)
|
|
73
|
+
errors._f = issues;
|
|
74
|
+
else
|
|
75
|
+
errors._ = issues;
|
|
76
|
+
return onFail ? onFail(errors) : errors;
|
|
77
|
+
};
|
|
78
|
+
var errorModes = {
|
|
79
|
+
first: { ...rootApplyRuntime, Traversal: ArkFirstIssueTraversal },
|
|
80
|
+
none: {
|
|
81
|
+
...rootApplyRuntime,
|
|
82
|
+
Traversal: UndetailedTraversal,
|
|
83
|
+
applyCyclic: (node, data, ctx) => ctx,
|
|
84
|
+
applyRejected: rejectUndetailed
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
ArkFirstIssueTraversal,
|
|
90
|
+
UndetailedErrors,
|
|
91
|
+
UndetailedTraversal,
|
|
92
|
+
rejectUndetailed,
|
|
93
|
+
errorModes
|
|
94
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// ../util/out/strings.js
|
|
2
|
+
var capitalize = (s) => s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
|
|
3
|
+
var uncapitalize = (s) => s.length === 0 ? s : s[0].toLowerCase() + s.slice(1);
|
|
4
|
+
var deanchoredRegex = (regex) => new RegExp(deanchoredSource(regex), typeof regex === "string" ? "" : regex.flags);
|
|
5
|
+
var anchoredSource = (regex) => {
|
|
6
|
+
const source = typeof regex === "string" ? regex : regex.source;
|
|
7
|
+
return `^(?:${source})$`;
|
|
8
|
+
};
|
|
9
|
+
var deanchoredSource = (regex) => {
|
|
10
|
+
const source = typeof regex === "string" ? regex : regex.source;
|
|
11
|
+
if (source.startsWith("^(?:") && source.endsWith(")$"))
|
|
12
|
+
return source.slice(4, -2);
|
|
13
|
+
return source.slice(source[0] === "^" ? 1 : 0, source[source.length - 1] === "$" ? -1 : void 0);
|
|
14
|
+
};
|
|
15
|
+
var Backslash = "\\";
|
|
16
|
+
var whitespaceChars = {
|
|
17
|
+
" ": 1,
|
|
18
|
+
"\n": 1,
|
|
19
|
+
" ": 1
|
|
20
|
+
};
|
|
21
|
+
var emojiToUnicode = (emoji) => emoji.split("").map((char) => {
|
|
22
|
+
const codePoint = char.codePointAt(0);
|
|
23
|
+
return codePoint ? `\\u${codePoint.toString(16).padStart(4, "0")}` : "";
|
|
24
|
+
}).join("");
|
|
25
|
+
var alphabet = [
|
|
26
|
+
"a",
|
|
27
|
+
"b",
|
|
28
|
+
"c",
|
|
29
|
+
"d",
|
|
30
|
+
"e",
|
|
31
|
+
"f",
|
|
32
|
+
"g",
|
|
33
|
+
"h",
|
|
34
|
+
"i",
|
|
35
|
+
"j",
|
|
36
|
+
"k",
|
|
37
|
+
"l",
|
|
38
|
+
"m",
|
|
39
|
+
"n",
|
|
40
|
+
"o",
|
|
41
|
+
"p",
|
|
42
|
+
"q",
|
|
43
|
+
"r",
|
|
44
|
+
"s",
|
|
45
|
+
"t",
|
|
46
|
+
"u",
|
|
47
|
+
"v",
|
|
48
|
+
"w",
|
|
49
|
+
"x",
|
|
50
|
+
"y",
|
|
51
|
+
"z"
|
|
52
|
+
];
|
|
53
|
+
var hashOf = (input) => {
|
|
54
|
+
let h1 = 3735928559;
|
|
55
|
+
let h2 = 1103547991;
|
|
56
|
+
for (let i = 0; i < input.length; i++) {
|
|
57
|
+
const code = input.charCodeAt(i);
|
|
58
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
59
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
60
|
+
}
|
|
61
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
62
|
+
h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
63
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
64
|
+
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
65
|
+
return (h2 >>> 0).toString(36) + (h1 >>> 0).toString(36).padStart(7, "0");
|
|
66
|
+
};
|
|
67
|
+
var editsBetween = (a, b) => {
|
|
68
|
+
if (Math.abs(a.length - b.length) > 2)
|
|
69
|
+
return 3;
|
|
70
|
+
let twoBack = [];
|
|
71
|
+
let last = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
72
|
+
for (let i = 1; i <= a.length; i++) {
|
|
73
|
+
const row = [i];
|
|
74
|
+
for (let j = 1; j <= b.length; j++) {
|
|
75
|
+
row[j] = Math.min(last[j] + 1, row[j - 1] + 1, last[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1), i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1] ? twoBack[j - 2] + 1 : 3);
|
|
76
|
+
}
|
|
77
|
+
twoBack = last;
|
|
78
|
+
last = row;
|
|
79
|
+
}
|
|
80
|
+
return Math.min(last[b.length], 3);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
capitalize,
|
|
85
|
+
uncapitalize,
|
|
86
|
+
deanchoredRegex,
|
|
87
|
+
anchoredSource,
|
|
88
|
+
deanchoredSource,
|
|
89
|
+
Backslash,
|
|
90
|
+
whitespaceChars,
|
|
91
|
+
emojiToUnicode,
|
|
92
|
+
alphabet,
|
|
93
|
+
hashOf,
|
|
94
|
+
editsBetween
|
|
95
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineValue,
|
|
3
|
+
unset
|
|
4
|
+
} from "./chunk-3HZC67MT.js";
|
|
5
|
+
|
|
6
|
+
// ../util/out/lazily.js
|
|
7
|
+
var lazily = (thunk) => {
|
|
8
|
+
let cached;
|
|
9
|
+
return new Proxy({}, {
|
|
10
|
+
get: (_, prop) => {
|
|
11
|
+
if (!cached)
|
|
12
|
+
cached = thunk();
|
|
13
|
+
return cached[prop];
|
|
14
|
+
},
|
|
15
|
+
set: (_, prop, value) => {
|
|
16
|
+
if (!cached)
|
|
17
|
+
cached = thunk();
|
|
18
|
+
cached[prop] = value;
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var defineLazily = (o, k, thunk, isFinal) => {
|
|
24
|
+
let result = unset;
|
|
25
|
+
Object.defineProperty(o, k, {
|
|
26
|
+
get() {
|
|
27
|
+
if (result === unset) {
|
|
28
|
+
const computed = thunk(k);
|
|
29
|
+
if (isFinal && !isFinal(computed))
|
|
30
|
+
return computed;
|
|
31
|
+
result = computed;
|
|
32
|
+
}
|
|
33
|
+
if (Object.getOwnPropertyDescriptor(this, k)?.configurable)
|
|
34
|
+
defineValue(this, k, result);
|
|
35
|
+
return result;
|
|
36
|
+
},
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// ../util/out/weak.js
|
|
43
|
+
var holdsWeakly = typeof WeakRef === "function" && typeof FinalizationRegistry === "function";
|
|
44
|
+
var WeakCache = class {
|
|
45
|
+
refs = /* @__PURE__ */ new Map();
|
|
46
|
+
cleanup = holdsWeakly ? new FinalizationRegistry((key) => {
|
|
47
|
+
if (!this.refs.get(key)?.deref())
|
|
48
|
+
this.refs.delete(key);
|
|
49
|
+
}) : void 0;
|
|
50
|
+
get(key) {
|
|
51
|
+
return this.refs.get(key)?.deref();
|
|
52
|
+
}
|
|
53
|
+
set(key, value) {
|
|
54
|
+
if (!this.cleanup)
|
|
55
|
+
return this.pin(key, value);
|
|
56
|
+
this.refs.set(key, new WeakRef(value));
|
|
57
|
+
this.cleanup.register(value, key);
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
pin(key, value) {
|
|
61
|
+
this.refs.set(key, { deref: () => value });
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
lazily,
|
|
68
|
+
defineLazily,
|
|
69
|
+
holdsWeakly,
|
|
70
|
+
WeakCache
|
|
71
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isDigitCode
|
|
3
|
+
} from "./chunk-3HZC67MT.js";
|
|
4
|
+
|
|
5
|
+
// ../util/out/formats.js
|
|
6
|
+
var isHexCode = (code) => code - 48 >>> 0 < 10 || (code | 32) - 97 >>> 0 < 6;
|
|
7
|
+
var uuidMatcher = /^(?:[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}|0{8}-(?:0{4}-){3}0{12}|[Ff]{8}-(?:[Ff]{4}-){3}[Ff]{12})$/;
|
|
8
|
+
var uuidWrittenOut = (
|
|
9
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
10
|
+
/^(?:[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[1-8][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[89ABab][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]|0{8}-(?:0{4}-){3}0{12}|[Ff]{8}-(?:[Ff]{4}-){3}[Ff]{12})$/
|
|
11
|
+
);
|
|
12
|
+
var isUuid = (s) => s.length === 36 && uuidWrittenOut.test(s);
|
|
13
|
+
var ipv4Matcher = /^((?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])\.){3}(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])$/;
|
|
14
|
+
var ipv4SegmentEnd = (s, i, length) => {
|
|
15
|
+
const first = i < length ? s.charCodeAt(i++) - 48 : -1;
|
|
16
|
+
if (!(first >= 0 && first <= 9))
|
|
17
|
+
return -1;
|
|
18
|
+
if (first === 0 || i === length)
|
|
19
|
+
return i;
|
|
20
|
+
const second = s.charCodeAt(i) - 48;
|
|
21
|
+
if (!(second >= 0 && second <= 9) || ++i === length)
|
|
22
|
+
return i;
|
|
23
|
+
const third = s.charCodeAt(i) - 48;
|
|
24
|
+
if (!(third >= 0 && third <= 9))
|
|
25
|
+
return i;
|
|
26
|
+
return first * 100 + second * 10 + third <= 255 ? i + 1 : -1;
|
|
27
|
+
};
|
|
28
|
+
var ipv4AddressEnd = (s, i, length) => {
|
|
29
|
+
i = ipv4SegmentEnd(s, i, length);
|
|
30
|
+
for (let dots = 0; dots < 3; dots++) {
|
|
31
|
+
if (i === -1 || i === length || s.charCodeAt(i) !== 46)
|
|
32
|
+
return -1;
|
|
33
|
+
i = ipv4SegmentEnd(s, i + 1, length);
|
|
34
|
+
}
|
|
35
|
+
return i;
|
|
36
|
+
};
|
|
37
|
+
var isIpv4 = (s) => ipv4AddressEnd(s, 0, s.length) === s.length;
|
|
38
|
+
var ipv6Matcher = /^(?:(?:(?:[\dA-Fa-f]{1,4}:){6}|::(?:[\dA-Fa-f]{1,4}:){0,5}|[\dA-Fa-f]{1,4}::(?:[\dA-Fa-f]{1,4}:){0,4}|([\dA-Fa-f]{1,4}:){2}:([\dA-Fa-f]{1,4}:){0,3}|([\dA-Fa-f]{1,4}:){3}:([\dA-Fa-f]{1,4}:){0,2}|(?:[\dA-Fa-f]{1,4}:){4}:([\dA-Fa-f]{1,4}:)?|(?:[\dA-Fa-f]{1,4}:){5}:)(?:[\dA-Fa-f]{1,4}:[\dA-Fa-f]{1,4}|((?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])\.){3}(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5]))|(?:([\dA-Fa-f]{1,4}:){1,6}|:):[\dA-Fa-f]{0,4}|(?:[\dA-Fa-f]{1,4}:){7}:)(%[\d.A-Za-z]+)?$/;
|
|
39
|
+
var isZoneFrom = (s, i, length) => {
|
|
40
|
+
if (i === length)
|
|
41
|
+
return false;
|
|
42
|
+
while (i < length) {
|
|
43
|
+
const code = s.charCodeAt(i++);
|
|
44
|
+
if (!(isDigitCode(code) || code === 46 || (code | 32) - 97 >>> 0 < 26))
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
};
|
|
49
|
+
var isIpv6 = (s) => {
|
|
50
|
+
const length = s.length;
|
|
51
|
+
let segments = 0;
|
|
52
|
+
let isCompressed = false;
|
|
53
|
+
let start = 0;
|
|
54
|
+
let end = 0;
|
|
55
|
+
for (; end < length; end++) {
|
|
56
|
+
const code = s.charCodeAt(end);
|
|
57
|
+
if (code === 58) {
|
|
58
|
+
if (end !== start) {
|
|
59
|
+
if (end - start > 4)
|
|
60
|
+
return false;
|
|
61
|
+
segments++;
|
|
62
|
+
} else if (end === 0) {
|
|
63
|
+
if (s.charCodeAt(1) !== 58)
|
|
64
|
+
return false;
|
|
65
|
+
} else if (isCompressed)
|
|
66
|
+
return false;
|
|
67
|
+
else
|
|
68
|
+
isCompressed = true;
|
|
69
|
+
start = end + 1;
|
|
70
|
+
} else if (!isHexCode(code)) {
|
|
71
|
+
if (code === 46) {
|
|
72
|
+
end = ipv4AddressEnd(s, start, length);
|
|
73
|
+
if (end === -1 || end !== length && s.charCodeAt(end) !== 37)
|
|
74
|
+
return false;
|
|
75
|
+
segments += 2;
|
|
76
|
+
start = end;
|
|
77
|
+
} else if (code !== 37)
|
|
78
|
+
return false;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (start !== end) {
|
|
83
|
+
if (end - start > 4)
|
|
84
|
+
return false;
|
|
85
|
+
segments++;
|
|
86
|
+
} else if (s.charCodeAt(end - 1) === 58 && s.charCodeAt(end - 2) !== 58)
|
|
87
|
+
return false;
|
|
88
|
+
return (isCompressed ? segments < 8 : segments === 8) && (end === length || isZoneFrom(s, end + 1, length));
|
|
89
|
+
};
|
|
90
|
+
var iso8601Matcher = /^[+-]?(?:(?:\d{4}(?:-(?:(?:(?:0[13578]|1[02])(?:-(?:[12]\d|0[1-9]|3[01]))?|(?:0[469]|11)(?:-(?:[12]\d|0[1-9]|30))?|02(?:-(?:1\d|0[1-9]|2[0-8]))?)|W(?:[0-4]\d|5[0-3])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))|(?:(?:0[13578]|1[02])(?:[12]\d|0[1-9]|3[01])|(?:0[469]|11)(?:[12]\d|0[1-9]|30)|02(?:1\d|0[1-9]|2[0-8]))|W(?:[0-4]\d|5[0-3])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))|(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:[02468][048]|[13579][26])00)(?:-02-29|0229))(?:T(?:(?:[01]\d|2[0-3]):[0-5]\d(?:[,.]\d+|:[0-5]\d(?:[,.]\d+)?)?|(?:(?:(?:[01]\d|2[0-3])(?:[0-5]\d)?|24:?00)(?:[,.]\d+)?)?(?:[0-5]\d(?:[,.]\d+)?)?)(?:[Zz]|[+-](?:[01]\d|2[0-3]):?(?:[0-5]\d)?)?)?|\d{4}(?:(?:0[1-9]|1[0-2])T(?:(?:[01]\d|2[0-3]):[0-5]\d(?:[,.]\d+|:[0-5]\d(?:[,.]\d+)?)?|(?:(?:(?:[01]\d|2[0-3])(?:[0-5]\d)?|24:?00)(?:[,.]\d+)?)?(?:[0-5]\d(?:[,.]\d+)?)?)(?:[Zz]|[+-](?:[01]\d|2[0-3]):?(?:[0-5]\d)?)?)?)$/;
|
|
91
|
+
var commonIso8601 = (
|
|
92
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
93
|
+
/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:1\d|0[1-9]|2[0-8])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:[,.]\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)?)?$/
|
|
94
|
+
);
|
|
95
|
+
var isIso8601 = (s) => {
|
|
96
|
+
const code = s.charCodeAt(0);
|
|
97
|
+
return (isDigitCode(code) || code === 43 || code === 45) && (commonIso8601.test(s) || iso8601Matcher.test(s));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
uuidMatcher,
|
|
102
|
+
isUuid,
|
|
103
|
+
ipv4Matcher,
|
|
104
|
+
isIpv4,
|
|
105
|
+
ipv6Matcher,
|
|
106
|
+
isIpv6,
|
|
107
|
+
iso8601Matcher,
|
|
108
|
+
isIso8601
|
|
109
|
+
};
|