@depup/typebox 1.3.16-depup.0 → 1.3.22-depup.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 CHANGED
@@ -13,8 +13,8 @@ npm install @depup/typebox
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [typebox](https://www.npmjs.com/package/typebox) @ 1.3.16 |
17
- | Processed | 2026-08-23 |
16
+ | Original | [typebox](https://www.npmjs.com/package/typebox) @ 1.3.22 |
17
+ | Processed | 2026-08-30 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 0 |
20
20
 
@@ -1,4 +1,4 @@
1
- const Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\.)*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
1
+ const Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
2
2
  /**
3
3
  * Returns true if the value is an Email
4
4
  * @specification https://datatracker.ietf.org/doc/html/rfc5322
@@ -1,6 +1,9 @@
1
1
  import * as FormatBidi from './format/bidi.mjs';
2
2
  import * as LabelUnicode from './label/unicode.mjs';
3
3
  import * as LabelPuny from './label/puny.mjs';
4
+ // ------------------------------------------------------------------
5
+ // IsLabel
6
+ // ------------------------------------------------------------------
4
7
  function IsValidLabelLength(value) {
5
8
  return value.length > 0 && value.length <= 63;
6
9
  }
@@ -8,9 +11,26 @@ function IsLabel(value) {
8
11
  return IsValidLabelLength(value) && (LabelPuny.IsPunyLabel(value) ||
9
12
  LabelUnicode.IsUnicodeLabel(value));
10
13
  }
14
+ // ------------------------------------------------------------------
15
+ // NormalizeHostname
16
+ //
17
+ // Normalizes a hostname for label validation. Maps fullwidth
18
+ // codepoints to their ASCII equivalent (e.g. 'a' U+FF41 maps to
19
+ // 'a'), then normalizes for NFC such that equivalent codepoint
20
+ // sequences can be uniformly compared. It also removes codepoints
21
+ // that IDNA mapping ignores, and converts full stop variants to
22
+ // ASCII '.' so the hostname can be split into labels.
23
+ // ------------------------------------------------------------------
11
24
  function NormalizeHostname(value) {
12
- return value.normalize('NFC').replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.');
25
+ return value
26
+ .replace(/[\uff01-\uff5e]/g, (char) => String.fromCharCode(char.charCodeAt(0) - 0xfee0)) // RE_FULLWIDTH_MAPPING
27
+ .normalize('NFC')
28
+ .replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu, '') // RE_IGNORED_MAPPING
29
+ .replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.'); // RE_FULL_STOP_MAPPING
13
30
  }
31
+ // ------------------------------------------------------------------
32
+ // IsIdnHostname
33
+ // ------------------------------------------------------------------
14
34
  export function IsIdnHostname(value) {
15
35
  if (value.length === 0 || value.includes(' '))
16
36
  return false;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Returns true if the value is a json pointer
3
- * @specification
4
- * @source ajv-formats
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
4
+ * @source https://github.com/ajv-validator/ajv-formats
5
5
  */
6
6
  export declare function IsJsonPointer(value: string): boolean;
@@ -1,8 +1,8 @@
1
1
  const JsonPointer = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
2
2
  /**
3
3
  * Returns true if the value is a json pointer
4
- * @specification
5
- * @source ajv-formats
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
5
+ * @source https://github.com/ajv-validator/ajv-formats
6
6
  */
7
7
  export function IsJsonPointer(value) {
8
8
  return JsonPointer.test(value);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Returns true if the value is a json pointer uri fragment
3
- * @specification
4
- * @source ajv-formats
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
4
+ * @source https://github.com/ajv-validator/ajv-formats
5
5
  */
6
6
  export declare function IsJsonPointerUriFragment(value: string): boolean;
@@ -1,8 +1,8 @@
1
1
  const JsonPointerUriFragment = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
2
2
  /**
3
3
  * Returns true if the value is a json pointer uri fragment
4
- * @specification
5
- * @source ajv-formats
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
5
+ * @source https://github.com/ajv-validator/ajv-formats
6
6
  */
7
7
  export function IsJsonPointerUriFragment(value) {
8
8
  return JsonPointerUriFragment.test(value);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Returns true if the value is a relative json pointer
3
- * @specification
4
- * @source ajv-formats
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
4
+ * @source https://github.com/ajv-validator/ajv-formats
5
5
  */
6
6
  export declare function IsRelativeJsonPointer(value: string): boolean;
@@ -1,8 +1,8 @@
1
1
  const RelativeJsonPointer = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
2
2
  /**
3
3
  * Returns true if the value is a relative json pointer
4
- * @specification
5
- * @source ajv-formats
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc6901
5
+ * @source https://github.com/ajv-validator/ajv-formats
6
6
  */
7
7
  export function IsRelativeJsonPointer(value) {
8
8
  return RelativeJsonPointer.test(value);
@@ -106,15 +106,13 @@ export function IsMaxLength(value, length) {
106
106
  // Array
107
107
  // --------------------------------------------------------------------------
108
108
  export function Every(value, offset, params, expression) {
109
- return G.IsEqual(offset, '0')
110
- ? `${value}.every((${params[0]}, ${params[1]}) => ${expression})`
111
- : `((value, callback) => { for(let index = ${offset}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
109
+ return G.IsEqual(offset, '0') ? `${value}.every((${params[0]}, ${params[1]}) => (${expression}))` : `${value}.every((${params[0]}, ${params[1]}) => (${params[1]} < ${offset}) || (${expression}))`;
112
110
  }
113
111
  export function Some(value, params, expression) {
114
112
  return `${value}.some((${params[0]}, ${params[1]}) => ${expression})`;
115
113
  }
116
114
  export function SomeAll(value, params, expression) {
117
- return `((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
115
+ return `((value) => { let result = false; value.forEach((${params[0]}, ${params[1]}) => { if (${expression}) result = true }); return result })(${value})`;
118
116
  }
119
117
  export function Counted(value, params, expression) {
120
118
  return `${value}.reduce((result, ${params[0]}, ${params[1]}) => (${expression}) ? ++result : result, 0)`;
@@ -140,36 +140,24 @@ export function IsMinLength(value, length) {
140
140
  // --------------------------------------------------------------------------
141
141
  /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
142
142
  export function Every(value, offset, callback) {
143
- for (let index = offset; index < value.length; index++) {
144
- if (!callback(value[index], index))
145
- return false;
146
- }
147
- return true;
143
+ return value.every((item, index) => (index < offset) || callback(item, index));
148
144
  }
149
145
  /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
150
146
  export function EveryAll(value, offset, callback) {
151
147
  let result = true;
152
- for (let index = offset; index < value.length; index++) {
153
- if (!callback(value[index], index))
154
- result = false;
155
- }
148
+ value.forEach((item, index) => { if ((index >= offset) && !callback(item, index))
149
+ result = false; });
156
150
  return result;
157
151
  }
158
152
  /** Returns true if some element satisfies the callback, short-circuiting on the first success */
159
153
  export function Some(value, callback) {
160
- for (let index = 0; index < value.length; index++) {
161
- if (callback(value[index], index))
162
- return true;
163
- }
164
- return false;
154
+ return value.some((value, index) => callback(value, index));
165
155
  }
166
156
  /** Returns true if some element satisfies the callback, using exhaustive enumeration */
167
157
  export function SomeAll(value, callback) {
168
158
  let result = false;
169
- for (let index = 0; index < value.length; index++) {
170
- if (callback(value[index], index))
171
- result = true;
172
- }
159
+ value.forEach((item, index) => { if (callback(item, index))
160
+ result = true; });
173
161
  return result;
174
162
  }
175
163
  /** Returns the count of elements that satisfy the callback */
@@ -84,10 +84,11 @@ function NextGraphemeClusterIndex(value, clusterStart) {
84
84
  // IsGraphemeCodePoint
85
85
  // --------------------------------------------------------------------------
86
86
  function IsGraphemeCodePoint(value) {
87
- return (IsHighSurrogate(value) ||
87
+ return ((value >= 0x0300) && ( // above special range
88
+ IsHighSurrogate(value) ||
88
89
  IsCombiningMark(value) ||
89
90
  IsVariationSelector(value) ||
90
- IsZeroWidthJoiner(value));
91
+ IsZeroWidthJoiner(value)));
91
92
  }
92
93
  // --------------------------------------------------------------------------
93
94
  // GraphemeCount
@@ -103,30 +104,22 @@ export function GraphemeCount(value) {
103
104
  return count;
104
105
  }
105
106
  // --------------------------------------------------------------------------
106
- // IsMinLength
107
+ // IsMinLengthSegmented
107
108
  // --------------------------------------------------------------------------
108
109
  /** Checks if a string has at least a minimum number of grapheme clusters */
109
110
  function IsMinLengthSegmented(value, minLength) {
110
- // ----------------------------------------------------------------
111
- // Inaccessible via public interface (review)
112
- //
113
- // deno-coverage-ignore-start
114
- // ----------------------------------------------------------------
115
- if (minLength === 0)
116
- return true; // 0-length
117
- // deno-coverage-ignore-stop
111
+ // if (minLength === 0) return true // 0-length (unreachable)
118
112
  let count = 0;
119
113
  let index = 0;
120
114
  while (index < value.length) {
121
115
  index = NextGraphemeClusterIndex(value, index);
122
- count++;
123
- if (count >= minLength)
116
+ if ((++count) >= minLength)
124
117
  return true;
125
118
  }
126
119
  return false;
127
120
  }
128
121
  // --------------------------------------------------------------------------
129
- // IsMaxLength
122
+ // IsMaxLengthSegmented
130
123
  // --------------------------------------------------------------------------
131
124
  /** Checks if a string has at most a maximum number of grapheme clusters */
132
125
  function IsMaxLengthSegmented(value, maxLength) {
@@ -134,8 +127,7 @@ function IsMaxLengthSegmented(value, maxLength) {
134
127
  let index = 0;
135
128
  while (index < value.length) {
136
129
  index = NextGraphemeClusterIndex(value, index);
137
- count++;
138
- if (count > maxLength)
130
+ if ((++count) > maxLength)
139
131
  return false;
140
132
  }
141
133
  return true;
@@ -147,30 +139,30 @@ function IsMaxLengthSegmented(value, maxLength) {
147
139
  export function IsMinLength(value, minLength) {
148
140
  if (minLength === 0)
149
141
  return true; // 0-length
142
+ if (value.length < minLength)
143
+ return false; // length is upper bound on grapheme count
150
144
  let index = 0;
151
- while (index < value.length) {
145
+ while (true) {
152
146
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
153
147
  return IsMinLengthSegmented(value, minLength);
154
148
  }
155
- index++;
156
- if (index >= minLength)
149
+ if ((++index) >= minLength)
157
150
  return true;
158
151
  }
159
- return false;
160
152
  }
161
153
  // --------------------------------------------------------------------------
162
154
  // IsMaxLengthFast
163
155
  // --------------------------------------------------------------------------
164
156
  /** Fast check for maximum grapheme length, falls back to full check if needed */
165
157
  export function IsMaxLength(value, maxLength) {
158
+ if (value.length <= maxLength)
159
+ return true; // length is upper bound on grapheme count
166
160
  let index = 0;
167
- while (index < value.length) {
161
+ while (true) {
168
162
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
169
163
  return IsMaxLengthSegmented(value, maxLength);
170
164
  }
171
- index++;
172
- if (index > maxLength)
165
+ if ((++index) > maxLength)
173
166
  return false;
174
167
  }
175
- return true;
176
168
  }
@@ -7,7 +7,19 @@ import { UnicodeRegExp } from './_regexp.mjs';
7
7
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
8
8
  import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
9
9
  // ------------------------------------------------------------------
10
- // Common: GetPropertiesPattern
10
+ // Optimization: IsAdditionalPropertiesIgnored
11
+ //
12
+ // We can ignore additionalProperties if the schema is true-like and
13
+ // we are not in an unevaluated context, noting that additional
14
+ // properties are considered tracked, evaluated keys.
15
+ // ------------------------------------------------------------------
16
+ function IsAdditionalPropertiesIgnored(context, additionalProperties) {
17
+ return !context.UseUnevaluated() &&
18
+ (G.IsEqual(additionalProperties, true) ||
19
+ (G.IsObject(additionalProperties) && G.IsEqual(G.Keys(additionalProperties).length, 0)));
20
+ }
21
+ // ------------------------------------------------------------------
22
+ // Optimization: GetPropertiesPattern
11
23
  //
12
24
  // Constructs a regular expression that matches all property keys
13
25
  // and pattern properties defined in a schema. This approach unifies
@@ -71,6 +83,8 @@ export function BuildAdditionalPropertiesStandard(stack, context, schema, value)
71
83
  // Build
72
84
  // ------------------------------------------------------------------
73
85
  export function BuildAdditionalProperties(stack, context, schema, value) {
86
+ if (IsAdditionalPropertiesIgnored(context, schema.additionalProperties))
87
+ return E.Constant(true);
74
88
  return CanAdditionalPropertiesFast(context, schema, value)
75
89
  ? BuildAdditionalPropertiesFast(context, schema, value)
76
90
  : BuildAdditionalPropertiesStandard(stack, context, schema, value);
@@ -1,11 +1,12 @@
1
1
  // deno-lint-ignore-file ban-types no-explicit-any
2
2
  // deno-fmt-ignore-file
3
3
  import { Metrics } from './metrics.mjs';
4
+ import { Freeze } from './freeze.mjs';
4
5
  /**
5
6
  * Performs an Object assign using the Left and Right object types. We track this operation as it
6
7
  * creates a new GC handle per assignment.
7
8
  */
8
9
  export function Assign(left, right) {
9
10
  Metrics.assign += 1;
10
- return { ...left, ...right };
11
+ return Freeze({ ...left, ...right });
11
12
  }
@@ -1,7 +1,7 @@
1
1
  // deno-lint-ignore-file no-explicit-any
2
- // deno-fmt-ignore-file
3
2
  import { Settings } from '../settings/index.mjs';
4
3
  import { Metrics } from './metrics.mjs';
4
+ import { Freeze } from './freeze.mjs';
5
5
  function MergeHidden(left, right) {
6
6
  for (const key of Object.keys(right)) {
7
7
  Object.defineProperty(left, key, {
@@ -23,8 +23,7 @@ function Merge(left, right) {
23
23
  */
24
24
  export function Create(hidden, enumerable, options = {}) {
25
25
  Metrics.create += 1;
26
- const settings = Settings.Get();
27
26
  const withOptions = Merge(enumerable, options);
28
- const withHidden = settings.enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
29
- return settings.immutableTypes ? Object.freeze(withHidden) : withHidden;
27
+ const withHidden = Settings.Get().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
28
+ return Freeze(withHidden);
30
29
  }
@@ -1,7 +1,7 @@
1
1
  // deno-lint-ignore-file no-explicit-any
2
- // deno-fmt-ignore-file
3
2
  import { Guard } from '../../guard/index.mjs';
4
3
  import { Metrics } from './metrics.mjs';
4
+ import { Freeze } from './freeze.mjs';
5
5
  import { Clone } from './clone.mjs';
6
6
  /** Discards multiple property keys from the given object value */
7
7
  export function Discard(value, propertyKeys) {
@@ -14,5 +14,5 @@ export function Discard(value, propertyKeys) {
14
14
  descriptor.value = Clone(descriptor.value);
15
15
  Object.defineProperty(result, key, descriptor);
16
16
  }
17
- return result;
17
+ return Freeze(result);
18
18
  }
@@ -0,0 +1,4 @@
1
+ type ObjectLike = Record<PropertyKey, any>;
2
+ /** Conditionally freezes the value if `immutableTypes` is true, otherwise no action. */
3
+ export declare function Freeze(value: ObjectLike): ObjectLike;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ // deno-lint-ignore-file no-explicit-any
2
+ import { Settings } from '../settings/index.mjs';
3
+ /** Conditionally freezes the value if `immutableTypes` is true, otherwise no action. */
4
+ export function Freeze(value) {
5
+ return Settings.Get().immutableTypes ? Object.freeze(value) : value;
6
+ }
@@ -1,6 +1,7 @@
1
- // deno-fmt-ignore-file
1
+ // deno-lint-ignore-file no-explicit-any
2
2
  import { Settings } from '../settings/index.mjs';
3
3
  import { Metrics } from './metrics.mjs';
4
+ import { Freeze } from './freeze.mjs';
4
5
  import { Clone } from './clone.mjs';
5
6
  /**
6
7
  * Updates a value with new properties while preserving property enumerability. Use this function to modify
@@ -28,5 +29,5 @@ export function Update(current, hidden, enumerable) {
28
29
  value: enumerable[key]
29
30
  });
30
31
  }
31
- return result;
32
+ return Freeze(result);
32
33
  }
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-08-23T00:29:17.047Z",
3
+ "timestamp": "2026-08-30T00:59:40.420Z",
4
4
  "totalUpdated": 0
5
5
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depup/typebox",
3
3
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript (with updated dependencies)",
4
- "version": "1.3.16-depup.0",
4
+ "version": "1.3.22-depup.0",
5
5
  "keywords": [
6
6
  "typebox",
7
7
  "depup",
@@ -94,8 +94,8 @@
94
94
  "changes": {},
95
95
  "depsUpdated": 0,
96
96
  "originalPackage": "typebox",
97
- "originalVersion": "1.3.16",
98
- "processedAt": "2026-08-23T00:29:17.766Z",
97
+ "originalVersion": "1.3.22",
98
+ "processedAt": "2026-08-30T00:59:41.143Z",
99
99
  "smokeTest": "passed"
100
100
  }
101
101
  }