@inlang/paraglide-js 1.2.2 → 1.2.3

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/dist/index.js CHANGED
@@ -2146,23 +2146,23 @@ var require_errors = __commonJS({
2146
2146
  }
2147
2147
  };
2148
2148
  exports.ValueErrorIterator = ValueErrorIterator;
2149
- function Create(type, schema, path3, value) {
2150
- return { type, schema, path: path3, value, message: system_1.TypeSystemErrorFunction.Get()(schema, type) };
2149
+ function Create(type, schema, path4, value) {
2150
+ return { type, schema, path: path4, value, message: system_1.TypeSystemErrorFunction.Get()(schema, type) };
2151
2151
  }
2152
- function* TAny(schema, references, path3, value) {
2152
+ function* TAny(schema, references, path4, value) {
2153
2153
  }
2154
- function* TArray(schema, references, path3, value) {
2154
+ function* TArray(schema, references, path4, value) {
2155
2155
  if (!(0, guard_1.IsArray)(value)) {
2156
- return yield Create(ValueErrorType2.Array, schema, path3, value);
2156
+ return yield Create(ValueErrorType2.Array, schema, path4, value);
2157
2157
  }
2158
2158
  if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
2159
- yield Create(ValueErrorType2.ArrayMinItems, schema, path3, value);
2159
+ yield Create(ValueErrorType2.ArrayMinItems, schema, path4, value);
2160
2160
  }
2161
2161
  if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) {
2162
- yield Create(ValueErrorType2.ArrayMaxItems, schema, path3, value);
2162
+ yield Create(ValueErrorType2.ArrayMaxItems, schema, path4, value);
2163
2163
  }
2164
2164
  for (let i2 = 0; i2 < value.length; i2++) {
2165
- yield* Visit(schema.items, references, `${path3}/${i2}`, value[i2]);
2165
+ yield* Visit(schema.items, references, `${path4}/${i2}`, value[i2]);
2166
2166
  }
2167
2167
  if (schema.uniqueItems === true && !function() {
2168
2168
  const set = /* @__PURE__ */ new Set();
@@ -2176,100 +2176,100 @@ var require_errors = __commonJS({
2176
2176
  }
2177
2177
  return true;
2178
2178
  }()) {
2179
- yield Create(ValueErrorType2.ArrayUniqueItems, schema, path3, value);
2179
+ yield Create(ValueErrorType2.ArrayUniqueItems, schema, path4, value);
2180
2180
  }
2181
2181
  if (!(IsDefined(schema.contains) || IsDefined(schema.minContains) || IsDefined(schema.maxContains))) {
2182
2182
  return;
2183
2183
  }
2184
2184
  const containsSchema = IsDefined(schema.contains) ? schema.contains : Types.Type.Never();
2185
- const containsCount = value.reduce((acc, value2, index) => Visit(containsSchema, references, `${path3}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
2185
+ const containsCount = value.reduce((acc, value2, index) => Visit(containsSchema, references, `${path4}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
2186
2186
  if (containsCount === 0) {
2187
- yield Create(ValueErrorType2.ArrayContains, schema, path3, value);
2187
+ yield Create(ValueErrorType2.ArrayContains, schema, path4, value);
2188
2188
  }
2189
2189
  if ((0, guard_1.IsNumber)(schema.minContains) && containsCount < schema.minContains) {
2190
- yield Create(ValueErrorType2.ArrayMinContains, schema, path3, value);
2190
+ yield Create(ValueErrorType2.ArrayMinContains, schema, path4, value);
2191
2191
  }
2192
2192
  if ((0, guard_1.IsNumber)(schema.maxContains) && containsCount > schema.maxContains) {
2193
- yield Create(ValueErrorType2.ArrayMaxContains, schema, path3, value);
2193
+ yield Create(ValueErrorType2.ArrayMaxContains, schema, path4, value);
2194
2194
  }
2195
2195
  }
2196
- function* TAsyncIterator(schema, references, path3, value) {
2196
+ function* TAsyncIterator(schema, references, path4, value) {
2197
2197
  if (!(0, guard_1.IsAsyncIterator)(value))
2198
- yield Create(ValueErrorType2.AsyncIterator, schema, path3, value);
2198
+ yield Create(ValueErrorType2.AsyncIterator, schema, path4, value);
2199
2199
  }
2200
- function* TBigInt(schema, references, path3, value) {
2200
+ function* TBigInt(schema, references, path4, value) {
2201
2201
  if (!(0, guard_1.IsBigInt)(value))
2202
- return yield Create(ValueErrorType2.BigInt, schema, path3, value);
2202
+ return yield Create(ValueErrorType2.BigInt, schema, path4, value);
2203
2203
  if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
2204
- yield Create(ValueErrorType2.BigIntExclusiveMaximum, schema, path3, value);
2204
+ yield Create(ValueErrorType2.BigIntExclusiveMaximum, schema, path4, value);
2205
2205
  }
2206
2206
  if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
2207
- yield Create(ValueErrorType2.BigIntExclusiveMinimum, schema, path3, value);
2207
+ yield Create(ValueErrorType2.BigIntExclusiveMinimum, schema, path4, value);
2208
2208
  }
2209
2209
  if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
2210
- yield Create(ValueErrorType2.BigIntMaximum, schema, path3, value);
2210
+ yield Create(ValueErrorType2.BigIntMaximum, schema, path4, value);
2211
2211
  }
2212
2212
  if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
2213
- yield Create(ValueErrorType2.BigIntMinimum, schema, path3, value);
2213
+ yield Create(ValueErrorType2.BigIntMinimum, schema, path4, value);
2214
2214
  }
2215
2215
  if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
2216
- yield Create(ValueErrorType2.BigIntMultipleOf, schema, path3, value);
2216
+ yield Create(ValueErrorType2.BigIntMultipleOf, schema, path4, value);
2217
2217
  }
2218
2218
  }
2219
- function* TBoolean(schema, references, path3, value) {
2219
+ function* TBoolean(schema, references, path4, value) {
2220
2220
  if (!(0, guard_1.IsBoolean)(value))
2221
- yield Create(ValueErrorType2.Boolean, schema, path3, value);
2221
+ yield Create(ValueErrorType2.Boolean, schema, path4, value);
2222
2222
  }
2223
- function* TConstructor(schema, references, path3, value) {
2224
- yield* Visit(schema.returns, references, path3, value.prototype);
2223
+ function* TConstructor(schema, references, path4, value) {
2224
+ yield* Visit(schema.returns, references, path4, value.prototype);
2225
2225
  }
2226
- function* TDate(schema, references, path3, value) {
2226
+ function* TDate(schema, references, path4, value) {
2227
2227
  if (!(0, guard_1.IsDate)(value))
2228
- return yield Create(ValueErrorType2.Date, schema, path3, value);
2228
+ return yield Create(ValueErrorType2.Date, schema, path4, value);
2229
2229
  if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
2230
- yield Create(ValueErrorType2.DateExclusiveMaximumTimestamp, schema, path3, value);
2230
+ yield Create(ValueErrorType2.DateExclusiveMaximumTimestamp, schema, path4, value);
2231
2231
  }
2232
2232
  if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
2233
- yield Create(ValueErrorType2.DateExclusiveMinimumTimestamp, schema, path3, value);
2233
+ yield Create(ValueErrorType2.DateExclusiveMinimumTimestamp, schema, path4, value);
2234
2234
  }
2235
2235
  if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
2236
- yield Create(ValueErrorType2.DateMaximumTimestamp, schema, path3, value);
2236
+ yield Create(ValueErrorType2.DateMaximumTimestamp, schema, path4, value);
2237
2237
  }
2238
2238
  if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
2239
- yield Create(ValueErrorType2.DateMinimumTimestamp, schema, path3, value);
2239
+ yield Create(ValueErrorType2.DateMinimumTimestamp, schema, path4, value);
2240
2240
  }
2241
2241
  if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
2242
- yield Create(ValueErrorType2.DateMultipleOfTimestamp, schema, path3, value);
2242
+ yield Create(ValueErrorType2.DateMultipleOfTimestamp, schema, path4, value);
2243
2243
  }
2244
2244
  }
2245
- function* TFunction(schema, references, path3, value) {
2245
+ function* TFunction(schema, references, path4, value) {
2246
2246
  if (!(0, guard_1.IsFunction)(value))
2247
- yield Create(ValueErrorType2.Function, schema, path3, value);
2247
+ yield Create(ValueErrorType2.Function, schema, path4, value);
2248
2248
  }
2249
- function* TInteger(schema, references, path3, value) {
2249
+ function* TInteger(schema, references, path4, value) {
2250
2250
  if (!(0, guard_1.IsInteger)(value))
2251
- return yield Create(ValueErrorType2.Integer, schema, path3, value);
2251
+ return yield Create(ValueErrorType2.Integer, schema, path4, value);
2252
2252
  if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
2253
- yield Create(ValueErrorType2.IntegerExclusiveMaximum, schema, path3, value);
2253
+ yield Create(ValueErrorType2.IntegerExclusiveMaximum, schema, path4, value);
2254
2254
  }
2255
2255
  if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
2256
- yield Create(ValueErrorType2.IntegerExclusiveMinimum, schema, path3, value);
2256
+ yield Create(ValueErrorType2.IntegerExclusiveMinimum, schema, path4, value);
2257
2257
  }
2258
2258
  if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
2259
- yield Create(ValueErrorType2.IntegerMaximum, schema, path3, value);
2259
+ yield Create(ValueErrorType2.IntegerMaximum, schema, path4, value);
2260
2260
  }
2261
2261
  if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
2262
- yield Create(ValueErrorType2.IntegerMinimum, schema, path3, value);
2262
+ yield Create(ValueErrorType2.IntegerMinimum, schema, path4, value);
2263
2263
  }
2264
2264
  if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
2265
- yield Create(ValueErrorType2.IntegerMultipleOf, schema, path3, value);
2265
+ yield Create(ValueErrorType2.IntegerMultipleOf, schema, path4, value);
2266
2266
  }
2267
2267
  }
2268
- function* TIntersect(schema, references, path3, value) {
2268
+ function* TIntersect(schema, references, path4, value) {
2269
2269
  for (const inner of schema.allOf) {
2270
- const next = Visit(inner, references, path3, value).next();
2270
+ const next = Visit(inner, references, path4, value).next();
2271
2271
  if (!next.done) {
2272
- yield Create(ValueErrorType2.Intersect, schema, path3, value);
2272
+ yield Create(ValueErrorType2.Intersect, schema, path4, value);
2273
2273
  yield next.value;
2274
2274
  }
2275
2275
  }
@@ -2277,7 +2277,7 @@ var require_errors = __commonJS({
2277
2277
  const keyCheck = new RegExp(Types.KeyResolver.ResolvePattern(schema));
2278
2278
  for (const valueKey of Object.getOwnPropertyNames(value)) {
2279
2279
  if (!keyCheck.test(valueKey)) {
2280
- yield Create(ValueErrorType2.IntersectUnevaluatedProperties, schema, `${path3}/${valueKey}`, value);
2280
+ yield Create(ValueErrorType2.IntersectUnevaluatedProperties, schema, `${path4}/${valueKey}`, value);
2281
2281
  }
2282
2282
  }
2283
2283
  }
@@ -2285,59 +2285,59 @@ var require_errors = __commonJS({
2285
2285
  const keyCheck = new RegExp(Types.KeyResolver.ResolvePattern(schema));
2286
2286
  for (const valueKey of Object.getOwnPropertyNames(value)) {
2287
2287
  if (!keyCheck.test(valueKey)) {
2288
- const next = Visit(schema.unevaluatedProperties, references, `${path3}/${valueKey}`, value[valueKey]).next();
2288
+ const next = Visit(schema.unevaluatedProperties, references, `${path4}/${valueKey}`, value[valueKey]).next();
2289
2289
  if (!next.done)
2290
2290
  yield next.value;
2291
2291
  }
2292
2292
  }
2293
2293
  }
2294
2294
  }
2295
- function* TIterator(schema, references, path3, value) {
2295
+ function* TIterator(schema, references, path4, value) {
2296
2296
  if (!(0, guard_1.IsIterator)(value))
2297
- yield Create(ValueErrorType2.Iterator, schema, path3, value);
2297
+ yield Create(ValueErrorType2.Iterator, schema, path4, value);
2298
2298
  }
2299
- function* TLiteral(schema, references, path3, value) {
2299
+ function* TLiteral(schema, references, path4, value) {
2300
2300
  if (!(value === schema.const))
2301
- yield Create(ValueErrorType2.Literal, schema, path3, value);
2301
+ yield Create(ValueErrorType2.Literal, schema, path4, value);
2302
2302
  }
2303
- function* TNever(schema, references, path3, value) {
2304
- yield Create(ValueErrorType2.Never, schema, path3, value);
2303
+ function* TNever(schema, references, path4, value) {
2304
+ yield Create(ValueErrorType2.Never, schema, path4, value);
2305
2305
  }
2306
- function* TNot(schema, references, path3, value) {
2307
- if (Visit(schema.not, references, path3, value).next().done === true)
2308
- yield Create(ValueErrorType2.Not, schema, path3, value);
2306
+ function* TNot(schema, references, path4, value) {
2307
+ if (Visit(schema.not, references, path4, value).next().done === true)
2308
+ yield Create(ValueErrorType2.Not, schema, path4, value);
2309
2309
  }
2310
- function* TNull(schema, references, path3, value) {
2310
+ function* TNull(schema, references, path4, value) {
2311
2311
  if (!(0, guard_1.IsNull)(value))
2312
- yield Create(ValueErrorType2.Null, schema, path3, value);
2312
+ yield Create(ValueErrorType2.Null, schema, path4, value);
2313
2313
  }
2314
- function* TNumber(schema, references, path3, value) {
2314
+ function* TNumber(schema, references, path4, value) {
2315
2315
  if (!system_1.TypeSystemPolicy.IsNumberLike(value))
2316
- return yield Create(ValueErrorType2.Number, schema, path3, value);
2316
+ return yield Create(ValueErrorType2.Number, schema, path4, value);
2317
2317
  if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
2318
- yield Create(ValueErrorType2.NumberExclusiveMaximum, schema, path3, value);
2318
+ yield Create(ValueErrorType2.NumberExclusiveMaximum, schema, path4, value);
2319
2319
  }
2320
2320
  if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
2321
- yield Create(ValueErrorType2.NumberExclusiveMinimum, schema, path3, value);
2321
+ yield Create(ValueErrorType2.NumberExclusiveMinimum, schema, path4, value);
2322
2322
  }
2323
2323
  if (IsDefined(schema.maximum) && !(value <= schema.maximum)) {
2324
- yield Create(ValueErrorType2.NumberMaximum, schema, path3, value);
2324
+ yield Create(ValueErrorType2.NumberMaximum, schema, path4, value);
2325
2325
  }
2326
2326
  if (IsDefined(schema.minimum) && !(value >= schema.minimum)) {
2327
- yield Create(ValueErrorType2.NumberMinimum, schema, path3, value);
2327
+ yield Create(ValueErrorType2.NumberMinimum, schema, path4, value);
2328
2328
  }
2329
2329
  if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
2330
- yield Create(ValueErrorType2.NumberMultipleOf, schema, path3, value);
2330
+ yield Create(ValueErrorType2.NumberMultipleOf, schema, path4, value);
2331
2331
  }
2332
2332
  }
2333
- function* TObject(schema, references, path3, value) {
2333
+ function* TObject(schema, references, path4, value) {
2334
2334
  if (!system_1.TypeSystemPolicy.IsObjectLike(value))
2335
- return yield Create(ValueErrorType2.Object, schema, path3, value);
2335
+ return yield Create(ValueErrorType2.Object, schema, path4, value);
2336
2336
  if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
2337
- yield Create(ValueErrorType2.ObjectMinProperties, schema, path3, value);
2337
+ yield Create(ValueErrorType2.ObjectMinProperties, schema, path4, value);
2338
2338
  }
2339
2339
  if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
2340
- yield Create(ValueErrorType2.ObjectMaxProperties, schema, path3, value);
2340
+ yield Create(ValueErrorType2.ObjectMaxProperties, schema, path4, value);
2341
2341
  }
2342
2342
  const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
2343
2343
  const knownKeys = Object.getOwnPropertyNames(schema.properties);
@@ -2345,12 +2345,12 @@ var require_errors = __commonJS({
2345
2345
  for (const requiredKey of requiredKeys) {
2346
2346
  if (unknownKeys.includes(requiredKey))
2347
2347
  continue;
2348
- yield Create(ValueErrorType2.ObjectRequiredProperty, schema.properties[requiredKey], `${path3}/${EscapeKey(requiredKey)}`, void 0);
2348
+ yield Create(ValueErrorType2.ObjectRequiredProperty, schema.properties[requiredKey], `${path4}/${EscapeKey(requiredKey)}`, void 0);
2349
2349
  }
2350
2350
  if (schema.additionalProperties === false) {
2351
2351
  for (const valueKey of unknownKeys) {
2352
2352
  if (!knownKeys.includes(valueKey)) {
2353
- yield Create(ValueErrorType2.ObjectAdditionalProperties, schema, `${path3}/${EscapeKey(valueKey)}`, value[valueKey]);
2353
+ yield Create(ValueErrorType2.ObjectAdditionalProperties, schema, `${path4}/${EscapeKey(valueKey)}`, value[valueKey]);
2354
2354
  }
2355
2355
  }
2356
2356
  }
@@ -2358,221 +2358,221 @@ var require_errors = __commonJS({
2358
2358
  for (const valueKey of unknownKeys) {
2359
2359
  if (knownKeys.includes(valueKey))
2360
2360
  continue;
2361
- yield* Visit(schema.additionalProperties, references, `${path3}/${EscapeKey(valueKey)}`, value[valueKey]);
2361
+ yield* Visit(schema.additionalProperties, references, `${path4}/${EscapeKey(valueKey)}`, value[valueKey]);
2362
2362
  }
2363
2363
  }
2364
2364
  for (const knownKey of knownKeys) {
2365
2365
  const property = schema.properties[knownKey];
2366
2366
  if (schema.required && schema.required.includes(knownKey)) {
2367
- yield* Visit(property, references, `${path3}/${EscapeKey(knownKey)}`, value[knownKey]);
2367
+ yield* Visit(property, references, `${path4}/${EscapeKey(knownKey)}`, value[knownKey]);
2368
2368
  if (Types.ExtendsUndefined.Check(schema) && !(knownKey in value)) {
2369
- yield Create(ValueErrorType2.ObjectRequiredProperty, property, `${path3}/${EscapeKey(knownKey)}`, void 0);
2369
+ yield Create(ValueErrorType2.ObjectRequiredProperty, property, `${path4}/${EscapeKey(knownKey)}`, void 0);
2370
2370
  }
2371
2371
  } else {
2372
2372
  if (system_1.TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
2373
- yield* Visit(property, references, `${path3}/${EscapeKey(knownKey)}`, value[knownKey]);
2373
+ yield* Visit(property, references, `${path4}/${EscapeKey(knownKey)}`, value[knownKey]);
2374
2374
  }
2375
2375
  }
2376
2376
  }
2377
2377
  }
2378
- function* TPromise(schema, references, path3, value) {
2378
+ function* TPromise(schema, references, path4, value) {
2379
2379
  if (!(0, guard_1.IsPromise)(value))
2380
- yield Create(ValueErrorType2.Promise, schema, path3, value);
2380
+ yield Create(ValueErrorType2.Promise, schema, path4, value);
2381
2381
  }
2382
- function* TRecord(schema, references, path3, value) {
2382
+ function* TRecord(schema, references, path4, value) {
2383
2383
  if (!system_1.TypeSystemPolicy.IsRecordLike(value))
2384
- return yield Create(ValueErrorType2.Object, schema, path3, value);
2384
+ return yield Create(ValueErrorType2.Object, schema, path4, value);
2385
2385
  if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
2386
- yield Create(ValueErrorType2.ObjectMinProperties, schema, path3, value);
2386
+ yield Create(ValueErrorType2.ObjectMinProperties, schema, path4, value);
2387
2387
  }
2388
2388
  if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
2389
- yield Create(ValueErrorType2.ObjectMaxProperties, schema, path3, value);
2389
+ yield Create(ValueErrorType2.ObjectMaxProperties, schema, path4, value);
2390
2390
  }
2391
2391
  const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
2392
2392
  const regex = new RegExp(patternKey);
2393
2393
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
2394
2394
  if (regex.test(propertyKey))
2395
- yield* Visit(patternSchema, references, `${path3}/${EscapeKey(propertyKey)}`, propertyValue);
2395
+ yield* Visit(patternSchema, references, `${path4}/${EscapeKey(propertyKey)}`, propertyValue);
2396
2396
  }
2397
2397
  if (typeof schema.additionalProperties === "object") {
2398
2398
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
2399
2399
  if (!regex.test(propertyKey))
2400
- yield* Visit(schema.additionalProperties, references, `${path3}/${EscapeKey(propertyKey)}`, propertyValue);
2400
+ yield* Visit(schema.additionalProperties, references, `${path4}/${EscapeKey(propertyKey)}`, propertyValue);
2401
2401
  }
2402
2402
  }
2403
2403
  if (schema.additionalProperties === false) {
2404
2404
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
2405
2405
  if (regex.test(propertyKey))
2406
2406
  continue;
2407
- return yield Create(ValueErrorType2.ObjectAdditionalProperties, schema, `${path3}/${EscapeKey(propertyKey)}`, propertyValue);
2407
+ return yield Create(ValueErrorType2.ObjectAdditionalProperties, schema, `${path4}/${EscapeKey(propertyKey)}`, propertyValue);
2408
2408
  }
2409
2409
  }
2410
2410
  }
2411
- function* TRef(schema, references, path3, value) {
2412
- yield* Visit((0, deref_1.Deref)(schema, references), references, path3, value);
2411
+ function* TRef(schema, references, path4, value) {
2412
+ yield* Visit((0, deref_1.Deref)(schema, references), references, path4, value);
2413
2413
  }
2414
- function* TString(schema, references, path3, value) {
2414
+ function* TString(schema, references, path4, value) {
2415
2415
  if (!(0, guard_1.IsString)(value))
2416
- return yield Create(ValueErrorType2.String, schema, path3, value);
2416
+ return yield Create(ValueErrorType2.String, schema, path4, value);
2417
2417
  if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) {
2418
- yield Create(ValueErrorType2.StringMinLength, schema, path3, value);
2418
+ yield Create(ValueErrorType2.StringMinLength, schema, path4, value);
2419
2419
  }
2420
2420
  if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) {
2421
- yield Create(ValueErrorType2.StringMaxLength, schema, path3, value);
2421
+ yield Create(ValueErrorType2.StringMaxLength, schema, path4, value);
2422
2422
  }
2423
2423
  if ((0, guard_1.IsString)(schema.pattern)) {
2424
2424
  const regex = new RegExp(schema.pattern);
2425
2425
  if (!regex.test(value)) {
2426
- yield Create(ValueErrorType2.StringPattern, schema, path3, value);
2426
+ yield Create(ValueErrorType2.StringPattern, schema, path4, value);
2427
2427
  }
2428
2428
  }
2429
2429
  if ((0, guard_1.IsString)(schema.format)) {
2430
2430
  if (!Types.FormatRegistry.Has(schema.format)) {
2431
- yield Create(ValueErrorType2.StringFormatUnknown, schema, path3, value);
2431
+ yield Create(ValueErrorType2.StringFormatUnknown, schema, path4, value);
2432
2432
  } else {
2433
2433
  const format = Types.FormatRegistry.Get(schema.format);
2434
2434
  if (!format(value)) {
2435
- yield Create(ValueErrorType2.StringFormat, schema, path3, value);
2435
+ yield Create(ValueErrorType2.StringFormat, schema, path4, value);
2436
2436
  }
2437
2437
  }
2438
2438
  }
2439
2439
  }
2440
- function* TSymbol(schema, references, path3, value) {
2440
+ function* TSymbol(schema, references, path4, value) {
2441
2441
  if (!(0, guard_1.IsSymbol)(value))
2442
- yield Create(ValueErrorType2.Symbol, schema, path3, value);
2442
+ yield Create(ValueErrorType2.Symbol, schema, path4, value);
2443
2443
  }
2444
- function* TTemplateLiteral(schema, references, path3, value) {
2444
+ function* TTemplateLiteral(schema, references, path4, value) {
2445
2445
  if (!(0, guard_1.IsString)(value))
2446
- return yield Create(ValueErrorType2.String, schema, path3, value);
2446
+ return yield Create(ValueErrorType2.String, schema, path4, value);
2447
2447
  const regex = new RegExp(schema.pattern);
2448
2448
  if (!regex.test(value)) {
2449
- yield Create(ValueErrorType2.StringPattern, schema, path3, value);
2449
+ yield Create(ValueErrorType2.StringPattern, schema, path4, value);
2450
2450
  }
2451
2451
  }
2452
- function* TThis(schema, references, path3, value) {
2453
- yield* Visit((0, deref_1.Deref)(schema, references), references, path3, value);
2452
+ function* TThis(schema, references, path4, value) {
2453
+ yield* Visit((0, deref_1.Deref)(schema, references), references, path4, value);
2454
2454
  }
2455
- function* TTuple(schema, references, path3, value) {
2455
+ function* TTuple(schema, references, path4, value) {
2456
2456
  if (!(0, guard_1.IsArray)(value))
2457
- return yield Create(ValueErrorType2.Tuple, schema, path3, value);
2457
+ return yield Create(ValueErrorType2.Tuple, schema, path4, value);
2458
2458
  if (schema.items === void 0 && !(value.length === 0)) {
2459
- return yield Create(ValueErrorType2.TupleLength, schema, path3, value);
2459
+ return yield Create(ValueErrorType2.TupleLength, schema, path4, value);
2460
2460
  }
2461
2461
  if (!(value.length === schema.maxItems)) {
2462
- return yield Create(ValueErrorType2.TupleLength, schema, path3, value);
2462
+ return yield Create(ValueErrorType2.TupleLength, schema, path4, value);
2463
2463
  }
2464
2464
  if (!schema.items) {
2465
2465
  return;
2466
2466
  }
2467
2467
  for (let i2 = 0; i2 < schema.items.length; i2++) {
2468
- yield* Visit(schema.items[i2], references, `${path3}/${i2}`, value[i2]);
2468
+ yield* Visit(schema.items[i2], references, `${path4}/${i2}`, value[i2]);
2469
2469
  }
2470
2470
  }
2471
- function* TUndefined(schema, references, path3, value) {
2471
+ function* TUndefined(schema, references, path4, value) {
2472
2472
  if (!(0, guard_1.IsUndefined)(value))
2473
- yield Create(ValueErrorType2.Undefined, schema, path3, value);
2473
+ yield Create(ValueErrorType2.Undefined, schema, path4, value);
2474
2474
  }
2475
- function* TUnion(schema, references, path3, value) {
2475
+ function* TUnion(schema, references, path4, value) {
2476
2476
  let count = 0;
2477
2477
  for (const subschema of schema.anyOf) {
2478
- const errors = [...Visit(subschema, references, path3, value)];
2478
+ const errors = [...Visit(subschema, references, path4, value)];
2479
2479
  if (errors.length === 0)
2480
2480
  return;
2481
2481
  count += errors.length;
2482
2482
  }
2483
2483
  if (count > 0) {
2484
- yield Create(ValueErrorType2.Union, schema, path3, value);
2484
+ yield Create(ValueErrorType2.Union, schema, path4, value);
2485
2485
  }
2486
2486
  }
2487
- function* TUint8Array(schema, references, path3, value) {
2487
+ function* TUint8Array(schema, references, path4, value) {
2488
2488
  if (!(0, guard_1.IsUint8Array)(value))
2489
- return yield Create(ValueErrorType2.Uint8Array, schema, path3, value);
2489
+ return yield Create(ValueErrorType2.Uint8Array, schema, path4, value);
2490
2490
  if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
2491
- yield Create(ValueErrorType2.Uint8ArrayMaxByteLength, schema, path3, value);
2491
+ yield Create(ValueErrorType2.Uint8ArrayMaxByteLength, schema, path4, value);
2492
2492
  }
2493
2493
  if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
2494
- yield Create(ValueErrorType2.Uint8ArrayMinByteLength, schema, path3, value);
2494
+ yield Create(ValueErrorType2.Uint8ArrayMinByteLength, schema, path4, value);
2495
2495
  }
2496
2496
  }
2497
- function* TUnknown(schema, references, path3, value) {
2497
+ function* TUnknown(schema, references, path4, value) {
2498
2498
  }
2499
- function* TVoid(schema, references, path3, value) {
2499
+ function* TVoid(schema, references, path4, value) {
2500
2500
  if (!system_1.TypeSystemPolicy.IsVoidLike(value))
2501
- yield Create(ValueErrorType2.Void, schema, path3, value);
2501
+ yield Create(ValueErrorType2.Void, schema, path4, value);
2502
2502
  }
2503
- function* TKind(schema, references, path3, value) {
2503
+ function* TKind(schema, references, path4, value) {
2504
2504
  const check = Types.TypeRegistry.Get(schema[Types.Kind]);
2505
2505
  if (!check(schema, value))
2506
- yield Create(ValueErrorType2.Kind, schema, path3, value);
2506
+ yield Create(ValueErrorType2.Kind, schema, path4, value);
2507
2507
  }
2508
- function* Visit(schema, references, path3, value) {
2508
+ function* Visit(schema, references, path4, value) {
2509
2509
  const references_ = IsDefined(schema.$id) ? [...references, schema] : references;
2510
2510
  const schema_ = schema;
2511
2511
  switch (schema_[Types.Kind]) {
2512
2512
  case "Any":
2513
- return yield* TAny(schema_, references_, path3, value);
2513
+ return yield* TAny(schema_, references_, path4, value);
2514
2514
  case "Array":
2515
- return yield* TArray(schema_, references_, path3, value);
2515
+ return yield* TArray(schema_, references_, path4, value);
2516
2516
  case "AsyncIterator":
2517
- return yield* TAsyncIterator(schema_, references_, path3, value);
2517
+ return yield* TAsyncIterator(schema_, references_, path4, value);
2518
2518
  case "BigInt":
2519
- return yield* TBigInt(schema_, references_, path3, value);
2519
+ return yield* TBigInt(schema_, references_, path4, value);
2520
2520
  case "Boolean":
2521
- return yield* TBoolean(schema_, references_, path3, value);
2521
+ return yield* TBoolean(schema_, references_, path4, value);
2522
2522
  case "Constructor":
2523
- return yield* TConstructor(schema_, references_, path3, value);
2523
+ return yield* TConstructor(schema_, references_, path4, value);
2524
2524
  case "Date":
2525
- return yield* TDate(schema_, references_, path3, value);
2525
+ return yield* TDate(schema_, references_, path4, value);
2526
2526
  case "Function":
2527
- return yield* TFunction(schema_, references_, path3, value);
2527
+ return yield* TFunction(schema_, references_, path4, value);
2528
2528
  case "Integer":
2529
- return yield* TInteger(schema_, references_, path3, value);
2529
+ return yield* TInteger(schema_, references_, path4, value);
2530
2530
  case "Intersect":
2531
- return yield* TIntersect(schema_, references_, path3, value);
2531
+ return yield* TIntersect(schema_, references_, path4, value);
2532
2532
  case "Iterator":
2533
- return yield* TIterator(schema_, references_, path3, value);
2533
+ return yield* TIterator(schema_, references_, path4, value);
2534
2534
  case "Literal":
2535
- return yield* TLiteral(schema_, references_, path3, value);
2535
+ return yield* TLiteral(schema_, references_, path4, value);
2536
2536
  case "Never":
2537
- return yield* TNever(schema_, references_, path3, value);
2537
+ return yield* TNever(schema_, references_, path4, value);
2538
2538
  case "Not":
2539
- return yield* TNot(schema_, references_, path3, value);
2539
+ return yield* TNot(schema_, references_, path4, value);
2540
2540
  case "Null":
2541
- return yield* TNull(schema_, references_, path3, value);
2541
+ return yield* TNull(schema_, references_, path4, value);
2542
2542
  case "Number":
2543
- return yield* TNumber(schema_, references_, path3, value);
2543
+ return yield* TNumber(schema_, references_, path4, value);
2544
2544
  case "Object":
2545
- return yield* TObject(schema_, references_, path3, value);
2545
+ return yield* TObject(schema_, references_, path4, value);
2546
2546
  case "Promise":
2547
- return yield* TPromise(schema_, references_, path3, value);
2547
+ return yield* TPromise(schema_, references_, path4, value);
2548
2548
  case "Record":
2549
- return yield* TRecord(schema_, references_, path3, value);
2549
+ return yield* TRecord(schema_, references_, path4, value);
2550
2550
  case "Ref":
2551
- return yield* TRef(schema_, references_, path3, value);
2551
+ return yield* TRef(schema_, references_, path4, value);
2552
2552
  case "String":
2553
- return yield* TString(schema_, references_, path3, value);
2553
+ return yield* TString(schema_, references_, path4, value);
2554
2554
  case "Symbol":
2555
- return yield* TSymbol(schema_, references_, path3, value);
2555
+ return yield* TSymbol(schema_, references_, path4, value);
2556
2556
  case "TemplateLiteral":
2557
- return yield* TTemplateLiteral(schema_, references_, path3, value);
2557
+ return yield* TTemplateLiteral(schema_, references_, path4, value);
2558
2558
  case "This":
2559
- return yield* TThis(schema_, references_, path3, value);
2559
+ return yield* TThis(schema_, references_, path4, value);
2560
2560
  case "Tuple":
2561
- return yield* TTuple(schema_, references_, path3, value);
2561
+ return yield* TTuple(schema_, references_, path4, value);
2562
2562
  case "Undefined":
2563
- return yield* TUndefined(schema_, references_, path3, value);
2563
+ return yield* TUndefined(schema_, references_, path4, value);
2564
2564
  case "Union":
2565
- return yield* TUnion(schema_, references_, path3, value);
2565
+ return yield* TUnion(schema_, references_, path4, value);
2566
2566
  case "Uint8Array":
2567
- return yield* TUint8Array(schema_, references_, path3, value);
2567
+ return yield* TUint8Array(schema_, references_, path4, value);
2568
2568
  case "Unknown":
2569
- return yield* TUnknown(schema_, references_, path3, value);
2569
+ return yield* TUnknown(schema_, references_, path4, value);
2570
2570
  case "Void":
2571
- return yield* TVoid(schema_, references_, path3, value);
2571
+ return yield* TVoid(schema_, references_, path4, value);
2572
2572
  default:
2573
2573
  if (!Types.TypeRegistry.Has(schema_[Types.Kind]))
2574
2574
  throw new ValueErrorsUnknownTypeError(schema);
2575
- return yield* TKind(schema_, references_, path3, value);
2575
+ return yield* TKind(schema_, references_, path4, value);
2576
2576
  }
2577
2577
  }
2578
2578
  function Errors(...args) {
@@ -2621,19 +2621,19 @@ var require_pointer = __commonJS({
2621
2621
  Object.defineProperty(exports, "__esModule", { value: true });
2622
2622
  exports.ValuePointer = exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0;
2623
2623
  var ValuePointerRootSetError = class extends Error {
2624
- constructor(value, path3, update) {
2624
+ constructor(value, path4, update) {
2625
2625
  super("Cannot set root value");
2626
2626
  this.value = value;
2627
- this.path = path3;
2627
+ this.path = path4;
2628
2628
  this.update = update;
2629
2629
  }
2630
2630
  };
2631
2631
  exports.ValuePointerRootSetError = ValuePointerRootSetError;
2632
2632
  var ValuePointerRootDeleteError = class extends Error {
2633
- constructor(value, path3) {
2633
+ constructor(value, path4) {
2634
2634
  super("Cannot delete root value");
2635
2635
  this.value = value;
2636
- this.path = path3;
2636
+ this.path = path4;
2637
2637
  }
2638
2638
  };
2639
2639
  exports.ValuePointerRootDeleteError = ValuePointerRootDeleteError;
@@ -2807,84 +2807,84 @@ var require_delta = __commonJS({
2807
2807
  }
2808
2808
  };
2809
2809
  exports.ValueDeltaUnableToDiffUnknownValue = ValueDeltaUnableToDiffUnknownValue;
2810
- function CreateUpdate(path3, value) {
2811
- return { type: "update", path: path3, value };
2810
+ function CreateUpdate(path4, value) {
2811
+ return { type: "update", path: path4, value };
2812
2812
  }
2813
- function CreateInsert(path3, value) {
2814
- return { type: "insert", path: path3, value };
2813
+ function CreateInsert(path4, value) {
2814
+ return { type: "insert", path: path4, value };
2815
2815
  }
2816
- function CreateDelete(path3) {
2817
- return { type: "delete", path: path3 };
2816
+ function CreateDelete(path4) {
2817
+ return { type: "delete", path: path4 };
2818
2818
  }
2819
- function* ObjectType(path3, current, next) {
2819
+ function* ObjectType(path4, current, next) {
2820
2820
  if (!(0, guard_1.IsPlainObject)(next))
2821
- return yield CreateUpdate(path3, next);
2821
+ return yield CreateUpdate(path4, next);
2822
2822
  const currentKeys = [...Object.keys(current), ...Object.getOwnPropertySymbols(current)];
2823
2823
  const nextKeys = [...Object.keys(next), ...Object.getOwnPropertySymbols(next)];
2824
2824
  for (const key of currentKeys) {
2825
2825
  if ((0, guard_1.IsSymbol)(key))
2826
2826
  throw new ValueDeltaObjectWithSymbolKeyError(key);
2827
2827
  if ((0, guard_1.IsUndefined)(next[key]) && nextKeys.includes(key))
2828
- yield CreateUpdate(`${path3}/${String(key)}`, void 0);
2828
+ yield CreateUpdate(`${path4}/${String(key)}`, void 0);
2829
2829
  }
2830
2830
  for (const key of nextKeys) {
2831
2831
  if ((0, guard_1.IsUndefined)(current[key]) || (0, guard_1.IsUndefined)(next[key]))
2832
2832
  continue;
2833
2833
  if ((0, guard_1.IsSymbol)(key))
2834
2834
  throw new ValueDeltaObjectWithSymbolKeyError(key);
2835
- yield* Visit(`${path3}/${String(key)}`, current[key], next[key]);
2835
+ yield* Visit(`${path4}/${String(key)}`, current[key], next[key]);
2836
2836
  }
2837
2837
  for (const key of nextKeys) {
2838
2838
  if ((0, guard_1.IsSymbol)(key))
2839
2839
  throw new ValueDeltaObjectWithSymbolKeyError(key);
2840
2840
  if ((0, guard_1.IsUndefined)(current[key]))
2841
- yield CreateInsert(`${path3}/${String(key)}`, next[key]);
2841
+ yield CreateInsert(`${path4}/${String(key)}`, next[key]);
2842
2842
  }
2843
2843
  for (const key of currentKeys.reverse()) {
2844
2844
  if ((0, guard_1.IsSymbol)(key))
2845
2845
  throw new ValueDeltaObjectWithSymbolKeyError(key);
2846
2846
  if ((0, guard_1.IsUndefined)(next[key]) && !nextKeys.includes(key))
2847
- yield CreateDelete(`${path3}/${String(key)}`);
2847
+ yield CreateDelete(`${path4}/${String(key)}`);
2848
2848
  }
2849
2849
  }
2850
- function* ArrayType(path3, current, next) {
2850
+ function* ArrayType(path4, current, next) {
2851
2851
  if (!(0, guard_1.IsArray)(next))
2852
- return yield CreateUpdate(path3, next);
2852
+ return yield CreateUpdate(path4, next);
2853
2853
  for (let i2 = 0; i2 < Math.min(current.length, next.length); i2++) {
2854
- yield* Visit(`${path3}/${i2}`, current[i2], next[i2]);
2854
+ yield* Visit(`${path4}/${i2}`, current[i2], next[i2]);
2855
2855
  }
2856
2856
  for (let i2 = 0; i2 < next.length; i2++) {
2857
2857
  if (i2 < current.length)
2858
2858
  continue;
2859
- yield CreateInsert(`${path3}/${i2}`, next[i2]);
2859
+ yield CreateInsert(`${path4}/${i2}`, next[i2]);
2860
2860
  }
2861
2861
  for (let i2 = current.length - 1; i2 >= 0; i2--) {
2862
2862
  if (i2 < next.length)
2863
2863
  continue;
2864
- yield CreateDelete(`${path3}/${i2}`);
2864
+ yield CreateDelete(`${path4}/${i2}`);
2865
2865
  }
2866
2866
  }
2867
- function* TypedArrayType(path3, current, next) {
2867
+ function* TypedArrayType(path4, current, next) {
2868
2868
  if (!(0, guard_1.IsTypedArray)(next) || current.length !== next.length || Object.getPrototypeOf(current).constructor.name !== Object.getPrototypeOf(next).constructor.name)
2869
- return yield CreateUpdate(path3, next);
2869
+ return yield CreateUpdate(path4, next);
2870
2870
  for (let i2 = 0; i2 < Math.min(current.length, next.length); i2++) {
2871
- yield* Visit(`${path3}/${i2}`, current[i2], next[i2]);
2871
+ yield* Visit(`${path4}/${i2}`, current[i2], next[i2]);
2872
2872
  }
2873
2873
  }
2874
- function* ValueType(path3, current, next) {
2874
+ function* ValueType(path4, current, next) {
2875
2875
  if (current === next)
2876
2876
  return;
2877
- yield CreateUpdate(path3, next);
2877
+ yield CreateUpdate(path4, next);
2878
2878
  }
2879
- function* Visit(path3, current, next) {
2879
+ function* Visit(path4, current, next) {
2880
2880
  if ((0, guard_1.IsPlainObject)(current))
2881
- return yield* ObjectType(path3, current, next);
2881
+ return yield* ObjectType(path4, current, next);
2882
2882
  if ((0, guard_1.IsArray)(current))
2883
- return yield* ArrayType(path3, current, next);
2883
+ return yield* ArrayType(path4, current, next);
2884
2884
  if ((0, guard_1.IsTypedArray)(current))
2885
- return yield* TypedArrayType(path3, current, next);
2885
+ return yield* TypedArrayType(path4, current, next);
2886
2886
  if ((0, guard_1.IsValueType)(current))
2887
- return yield* ValueType(path3, current, next);
2887
+ return yield* ValueType(path4, current, next);
2888
2888
  throw new ValueDeltaUnableToDiffUnknownValue(current);
2889
2889
  }
2890
2890
  function Diff(current, next) {
@@ -2949,9 +2949,9 @@ var require_mutate = __commonJS({
2949
2949
  }
2950
2950
  };
2951
2951
  exports.ValueMutateInvalidRootMutationError = ValueMutateInvalidRootMutationError;
2952
- function ObjectType(root, path3, current, next) {
2952
+ function ObjectType(root, path4, current, next) {
2953
2953
  if (!(0, guard_1.IsPlainObject)(current)) {
2954
- pointer_1.ValuePointer.Set(root, path3, (0, clone_1.Clone)(next));
2954
+ pointer_1.ValuePointer.Set(root, path4, (0, clone_1.Clone)(next));
2955
2955
  } else {
2956
2956
  const currentKeys = Object.keys(current);
2957
2957
  const nextKeys = Object.keys(next);
@@ -2966,43 +2966,43 @@ var require_mutate = __commonJS({
2966
2966
  }
2967
2967
  }
2968
2968
  for (const nextKey of nextKeys) {
2969
- Visit(root, `${path3}/${nextKey}`, current[nextKey], next[nextKey]);
2969
+ Visit(root, `${path4}/${nextKey}`, current[nextKey], next[nextKey]);
2970
2970
  }
2971
2971
  }
2972
2972
  }
2973
- function ArrayType(root, path3, current, next) {
2973
+ function ArrayType(root, path4, current, next) {
2974
2974
  if (!(0, guard_1.IsArray)(current)) {
2975
- pointer_1.ValuePointer.Set(root, path3, (0, clone_1.Clone)(next));
2975
+ pointer_1.ValuePointer.Set(root, path4, (0, clone_1.Clone)(next));
2976
2976
  } else {
2977
2977
  for (let index = 0; index < next.length; index++) {
2978
- Visit(root, `${path3}/${index}`, current[index], next[index]);
2978
+ Visit(root, `${path4}/${index}`, current[index], next[index]);
2979
2979
  }
2980
2980
  current.splice(next.length);
2981
2981
  }
2982
2982
  }
2983
- function TypedArrayType(root, path3, current, next) {
2983
+ function TypedArrayType(root, path4, current, next) {
2984
2984
  if ((0, guard_1.IsTypedArray)(current) && current.length === next.length) {
2985
2985
  for (let i2 = 0; i2 < current.length; i2++) {
2986
2986
  current[i2] = next[i2];
2987
2987
  }
2988
2988
  } else {
2989
- pointer_1.ValuePointer.Set(root, path3, (0, clone_1.Clone)(next));
2989
+ pointer_1.ValuePointer.Set(root, path4, (0, clone_1.Clone)(next));
2990
2990
  }
2991
2991
  }
2992
- function ValueType(root, path3, current, next) {
2992
+ function ValueType(root, path4, current, next) {
2993
2993
  if (current === next)
2994
2994
  return;
2995
- pointer_1.ValuePointer.Set(root, path3, next);
2995
+ pointer_1.ValuePointer.Set(root, path4, next);
2996
2996
  }
2997
- function Visit(root, path3, current, next) {
2997
+ function Visit(root, path4, current, next) {
2998
2998
  if ((0, guard_1.IsArray)(next))
2999
- return ArrayType(root, path3, current, next);
2999
+ return ArrayType(root, path4, current, next);
3000
3000
  if ((0, guard_1.IsTypedArray)(next))
3001
- return TypedArrayType(root, path3, current, next);
3001
+ return TypedArrayType(root, path4, current, next);
3002
3002
  if ((0, guard_1.IsPlainObject)(next))
3003
- return ObjectType(root, path3, current, next);
3003
+ return ObjectType(root, path4, current, next);
3004
3004
  if ((0, guard_1.IsValueType)(next))
3005
- return ValueType(root, path3, current, next);
3005
+ return ValueType(root, path4, current, next);
3006
3006
  }
3007
3007
  function IsNonMutableValue(value) {
3008
3008
  return (0, guard_1.IsTypedArray)(value) || (0, guard_1.IsValueType)(value);
@@ -7225,7 +7225,7 @@ var require_dist_node10 = __commonJS({
7225
7225
  });
7226
7226
  module.exports = __toCommonJS(dist_src_exports);
7227
7227
  var import_core3 = require_dist_node8();
7228
- var generateMessage = (path3, cursorValue) => `The cursor at "${path3.join(
7228
+ var generateMessage = (path4, cursorValue) => `The cursor at "${path4.join(
7229
7229
  ","
7230
7230
  )}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
7231
7231
  var MissingCursorChange = class extends Error {
@@ -7266,9 +7266,9 @@ var require_dist_node10 = __commonJS({
7266
7266
  }
7267
7267
  return paginatedResourcePath;
7268
7268
  }
7269
- var deepFindPathToProperty = (object, searchProp, path3 = []) => {
7269
+ var deepFindPathToProperty = (object, searchProp, path4 = []) => {
7270
7270
  for (const key of Object.keys(object)) {
7271
- const currentPath = [...path3, key];
7271
+ const currentPath = [...path4, key];
7272
7272
  const currentValue = object[key];
7273
7273
  if (currentValue.hasOwnProperty(searchProp)) {
7274
7274
  return currentPath;
@@ -7286,12 +7286,12 @@ var require_dist_node10 = __commonJS({
7286
7286
  }
7287
7287
  return [];
7288
7288
  };
7289
- var get = (object, path3) => {
7290
- return path3.reduce((current, nextProperty) => current[nextProperty], object);
7289
+ var get = (object, path4) => {
7290
+ return path4.reduce((current, nextProperty) => current[nextProperty], object);
7291
7291
  };
7292
- var set = (object, path3, mutator) => {
7293
- const lastProperty = path3[path3.length - 1];
7294
- const parentPath = [...path3].slice(0, -1);
7292
+ var set = (object, path4, mutator) => {
7293
+ const lastProperty = path4[path4.length - 1];
7294
+ const parentPath = [...path4].slice(0, -1);
7295
7295
  const parent = get(object, parentPath);
7296
7296
  if (typeof mutator === "function") {
7297
7297
  parent[lastProperty] = mutator(parent[lastProperty]);
@@ -7346,22 +7346,22 @@ var require_dist_node10 = __commonJS({
7346
7346
  if (Object.keys(response1).length === 0) {
7347
7347
  return Object.assign(response1, response2);
7348
7348
  }
7349
- const path3 = findPaginatedResourcePath(response1);
7350
- const nodesPath = [...path3, "nodes"];
7349
+ const path4 = findPaginatedResourcePath(response1);
7350
+ const nodesPath = [...path4, "nodes"];
7351
7351
  const newNodes = get(response2, nodesPath);
7352
7352
  if (newNodes) {
7353
7353
  set(response1, nodesPath, (values) => {
7354
7354
  return [...values, ...newNodes];
7355
7355
  });
7356
7356
  }
7357
- const edgesPath = [...path3, "edges"];
7357
+ const edgesPath = [...path4, "edges"];
7358
7358
  const newEdges = get(response2, edgesPath);
7359
7359
  if (newEdges) {
7360
7360
  set(response1, edgesPath, (values) => {
7361
7361
  return [...values, ...newEdges];
7362
7362
  });
7363
7363
  }
7364
- const pageInfoPath = [...path3, "pageInfo"];
7364
+ const pageInfoPath = [...path4, "pageInfo"];
7365
7365
  set(response1, pageInfoPath, get(response2, pageInfoPath));
7366
7366
  return response1;
7367
7367
  };
@@ -11021,7 +11021,7 @@ var require_dist_node13 = __commonJS({
11021
11021
  ];
11022
11022
  function routeMatcher(paths) {
11023
11023
  const regexes = paths.map(
11024
- (path3) => path3.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")
11024
+ (path4) => path4.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")
11025
11025
  );
11026
11026
  const regex2 = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})[^/]*$`;
11027
11027
  return new RegExp(regex2, "i");
@@ -19935,11 +19935,11 @@ var require_dist_node24 = __commonJS({
19935
19935
  }
19936
19936
  }
19937
19937
  function createNodeMiddleware2(webhooks, {
19938
- path: path3 = "/api/github/webhooks",
19938
+ path: path4 = "/api/github/webhooks",
19939
19939
  log: log2 = createLogger()
19940
19940
  } = {}) {
19941
19941
  return middleware.bind(null, webhooks, {
19942
- path: path3,
19942
+ path: path4,
19943
19943
  log: log2
19944
19944
  });
19945
19945
  }
@@ -20428,8 +20428,8 @@ var require_package = __commonJS({
20428
20428
  var require_main = __commonJS({
20429
20429
  "../../../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js"(exports, module) {
20430
20430
  init_define_ENV_DEFINED_IN_BUILD_STEP();
20431
- var fs2 = __require("fs");
20432
- var path3 = __require("path");
20431
+ var fs3 = __require("fs");
20432
+ var path4 = __require("path");
20433
20433
  var os = __require("os");
20434
20434
  var crypto3 = __require("crypto");
20435
20435
  var packageJson = require_package();
@@ -20521,14 +20521,14 @@ var require_main = __commonJS({
20521
20521
  return { ciphertext, key };
20522
20522
  }
20523
20523
  function _vaultPath(options) {
20524
- let dotenvPath = path3.resolve(process.cwd(), ".env");
20524
+ let dotenvPath = path4.resolve(process.cwd(), ".env");
20525
20525
  if (options && options.path && options.path.length > 0) {
20526
20526
  dotenvPath = options.path;
20527
20527
  }
20528
20528
  return dotenvPath.endsWith(".vault") ? dotenvPath : `${dotenvPath}.vault`;
20529
20529
  }
20530
20530
  function _resolveHome(envPath) {
20531
- return envPath[0] === "~" ? path3.join(os.homedir(), envPath.slice(1)) : envPath;
20531
+ return envPath[0] === "~" ? path4.join(os.homedir(), envPath.slice(1)) : envPath;
20532
20532
  }
20533
20533
  function _configVault(options) {
20534
20534
  _log("Loading env from encrypted .env.vault");
@@ -20541,7 +20541,7 @@ var require_main = __commonJS({
20541
20541
  return { parsed };
20542
20542
  }
20543
20543
  function configDotenv(options) {
20544
- let dotenvPath = path3.resolve(process.cwd(), ".env");
20544
+ let dotenvPath = path4.resolve(process.cwd(), ".env");
20545
20545
  let encoding = "utf8";
20546
20546
  const debug = Boolean(options && options.debug);
20547
20547
  if (options) {
@@ -20553,7 +20553,7 @@ var require_main = __commonJS({
20553
20553
  }
20554
20554
  }
20555
20555
  try {
20556
- const parsed = DotenvModule.parse(fs2.readFileSync(dotenvPath, { encoding }));
20556
+ const parsed = DotenvModule.parse(fs3.readFileSync(dotenvPath, { encoding }));
20557
20557
  let processEnv = process.env;
20558
20558
  if (options && options.processEnv != null) {
20559
20559
  processEnv = options.processEnv;
@@ -20572,7 +20572,7 @@ var require_main = __commonJS({
20572
20572
  if (_dotenvKey(options).length === 0) {
20573
20573
  return DotenvModule.configDotenv(options);
20574
20574
  }
20575
- if (!fs2.existsSync(vaultPath)) {
20575
+ if (!fs3.existsSync(vaultPath)) {
20576
20576
  _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
20577
20577
  return DotenvModule.configDotenv(options);
20578
20578
  }
@@ -22709,21 +22709,21 @@ init_define_ENV_DEFINED_IN_BUILD_STEP();
22709
22709
 
22710
22710
  // ../../../../lix/source-code/fs/dist/utilities/helpers.js
22711
22711
  init_define_ENV_DEFINED_IN_BUILD_STEP();
22712
- function normalizePath(path3, stripTrailing) {
22713
- if (path3 === "\\" || path3 === "/")
22712
+ function normalizePath(path4, stripTrailing) {
22713
+ if (path4 === "\\" || path4 === "/")
22714
22714
  return "/";
22715
- const len = path3.length;
22715
+ const len = path4.length;
22716
22716
  if (len <= 1)
22717
- return path3;
22717
+ return path4;
22718
22718
  let prefix = "";
22719
- if (len > 4 && path3[3] === "\\") {
22720
- const ch = path3[2];
22721
- if ((ch === "?" || ch === ".") && path3.slice(0, 2) === "\\\\") {
22722
- path3 = path3.slice(2);
22719
+ if (len > 4 && path4[3] === "\\") {
22720
+ const ch = path4[2];
22721
+ if ((ch === "?" || ch === ".") && path4.slice(0, 2) === "\\\\") {
22722
+ path4 = path4.slice(2);
22723
22723
  prefix = "//";
22724
22724
  }
22725
22725
  }
22726
- const segs = path3.split(/[/\\]+/);
22726
+ const segs = path4.split(/[/\\]+/);
22727
22727
  const stack = [];
22728
22728
  for (const seg of segs) {
22729
22729
  if (seg === "..") {
@@ -22737,32 +22737,32 @@ function normalizePath(path3, stripTrailing) {
22737
22737
  }
22738
22738
  return prefix + stack.join("/");
22739
22739
  }
22740
- function normalPath(path3) {
22740
+ function normalPath(path4) {
22741
22741
  var _a;
22742
22742
  const dots = /(\/|^)(\.\/)+/g;
22743
22743
  const slashes = /\/+/g;
22744
22744
  const upreference = /(?<!\.\.)[^/]+\/\.\.\//;
22745
- path3 = `/${path3}/`;
22746
- path3 = path3.replace(/^\/\.\./, "");
22747
- path3 = path3.replace(dots, "/").replace(slashes, "/");
22745
+ path4 = `/${path4}/`;
22746
+ path4 = path4.replace(/^\/\.\./, "");
22747
+ path4 = path4.replace(dots, "/").replace(slashes, "/");
22748
22748
  let match;
22749
- while (match = (_a = path3.match(upreference)) == null ? void 0 : _a[0]) {
22750
- path3 = path3.replace(match, "");
22749
+ while (match = (_a = path4.match(upreference)) == null ? void 0 : _a[0]) {
22750
+ path4 = path4.replace(match, "");
22751
22751
  }
22752
- return path3;
22752
+ return path4;
22753
22753
  }
22754
- function getDirname(path3) {
22755
- return normalPath(path3.split("/").filter((x) => x).slice(0, -1).join("/") ?? path3);
22754
+ function getDirname(path4) {
22755
+ return normalPath(path4.split("/").filter((x) => x).slice(0, -1).join("/") ?? path4);
22756
22756
  }
22757
- function getBasename(path3) {
22758
- return path3.split("/").filter((x) => x).at(-1) ?? path3;
22757
+ function getBasename(path4) {
22758
+ return path4.split("/").filter((x) => x).at(-1) ?? path4;
22759
22759
  }
22760
22760
 
22761
22761
  // ../../sdk/dist/isAbsolutePath.js
22762
22762
  init_define_ENV_DEFINED_IN_BUILD_STEP();
22763
- var isAbsolutePath = (path3) => {
22763
+ var isAbsolutePath = (path4) => {
22764
22764
  const matchPosixAndWindowsAbsolutePaths = /^(?:[A-Za-z]:\\(?:[^\\]+\\)*[^\\]+|[A-Za-z]:\/(?:[^/]+\/)*[^/]+|\/(?:[^/]+\/)*[^/]+)$/;
22765
- return matchPosixAndWindowsAbsolutePaths.test(path3);
22765
+ return matchPosixAndWindowsAbsolutePaths.test(path4);
22766
22766
  };
22767
22767
 
22768
22768
  // ../../sdk/dist/createNodeishFsWithAbsolutePaths.js
@@ -22771,19 +22771,19 @@ var createNodeishFsWithAbsolutePaths = (args) => {
22771
22771
  throw new Error(`Expected an absolute path but received "${args.projectPath}".`);
22772
22772
  }
22773
22773
  const basePath = normalizePath(args.projectPath).split("/").slice(0, -1).join("/");
22774
- const makeAbsolute = (path3) => {
22775
- if (isAbsolutePath(path3)) {
22776
- return normalizePath(path3);
22774
+ const makeAbsolute = (path4) => {
22775
+ if (isAbsolutePath(path4)) {
22776
+ return normalizePath(path4);
22777
22777
  }
22778
- return normalizePath(basePath + "/" + path3);
22778
+ return normalizePath(basePath + "/" + path4);
22779
22779
  };
22780
22780
  return {
22781
22781
  // @ts-expect-error
22782
- readFile: (path3, options) => args.nodeishFs.readFile(makeAbsolute(path3), options),
22783
- readdir: (path3) => args.nodeishFs.readdir(makeAbsolute(path3)),
22784
- mkdir: (path3) => args.nodeishFs.mkdir(makeAbsolute(path3)),
22785
- writeFile: (path3, data) => args.nodeishFs.writeFile(makeAbsolute(path3), data),
22786
- watch: (path3, options) => args.nodeishFs.watch(makeAbsolute(path3), options)
22782
+ readFile: (path4, options) => args.nodeishFs.readFile(makeAbsolute(path4), options),
22783
+ readdir: (path4) => args.nodeishFs.readdir(makeAbsolute(path4)),
22784
+ mkdir: (path4) => args.nodeishFs.mkdir(makeAbsolute(path4)),
22785
+ writeFile: (path4, data) => args.nodeishFs.writeFile(makeAbsolute(path4), data),
22786
+ watch: (path4, options) => args.nodeishFs.watch(makeAbsolute(path4), options)
22787
22787
  };
22788
22788
  };
22789
22789
 
@@ -22791,11 +22791,11 @@ var createNodeishFsWithAbsolutePaths = (args) => {
22791
22791
  init_define_ENV_DEFINED_IN_BUILD_STEP();
22792
22792
  var createNodeishFsWithWatcher = (args) => {
22793
22793
  const pathList = [];
22794
- const makeWatcher = (path3) => {
22794
+ const makeWatcher = (path4) => {
22795
22795
  const abortController = new AbortController();
22796
22796
  (async () => {
22797
22797
  try {
22798
- const watcher = args.nodeishFs.watch(path3, {
22798
+ const watcher = args.nodeishFs.watch(path4, {
22799
22799
  signal: abortController.signal,
22800
22800
  persistent: false
22801
22801
  });
@@ -22813,16 +22813,16 @@ var createNodeishFsWithWatcher = (args) => {
22813
22813
  }
22814
22814
  })();
22815
22815
  };
22816
- const readFileAndExtractPath = (path3, options) => {
22817
- if (!pathList.includes(path3)) {
22818
- makeWatcher(path3);
22819
- pathList.push(path3);
22816
+ const readFileAndExtractPath = (path4, options) => {
22817
+ if (!pathList.includes(path4)) {
22818
+ makeWatcher(path4);
22819
+ pathList.push(path4);
22820
22820
  }
22821
- return args.nodeishFs.readFile(path3, options);
22821
+ return args.nodeishFs.readFile(path4, options);
22822
22822
  };
22823
22823
  return {
22824
22824
  // @ts-expect-error
22825
- readFile: (path3, options) => readFileAndExtractPath(path3, options),
22825
+ readFile: (path4, options) => readFileAndExtractPath(path4, options),
22826
22826
  readdir: args.nodeishFs.readdir,
22827
22827
  mkdir: args.nodeishFs.mkdir,
22828
22828
  writeFile: args.nodeishFs.writeFile,
@@ -23847,7 +23847,7 @@ var createEffect4 = createEffect3;
23847
23847
  // ../../../../lix/source-code/client/dist/git/commit.js
23848
23848
  init_define_ENV_DEFINED_IN_BUILD_STEP();
23849
23849
  import { walk, TREE, STAGE, writeTree, commit as doCommit } from "isomorphic-git";
23850
- async function commit({ fs: fs2, dir, ref, author, message }) {
23850
+ async function commit({ fs: fs3, dir, ref, author, message }) {
23851
23851
  const fileStates = {};
23852
23852
  async function createTree(currentFolder, fileStates2) {
23853
23853
  const entries = [];
@@ -23875,10 +23875,10 @@ async function commit({ fs: fs2, dir, ref, author, message }) {
23875
23875
  });
23876
23876
  }
23877
23877
  }
23878
- return await writeTree({ fs: fs2, dir, tree: entries });
23878
+ return await writeTree({ fs: fs3, dir, tree: entries });
23879
23879
  }
23880
23880
  await walk({
23881
- fs: fs2,
23881
+ fs: fs3,
23882
23882
  dir,
23883
23883
  // cache, gitdir,
23884
23884
  trees: [TREE({ ref }), STAGE()],
@@ -23938,7 +23938,7 @@ async function commit({ fs: fs2, dir, ref, author, message }) {
23938
23938
  });
23939
23939
  const tree = await createTree("/", fileStates);
23940
23940
  return doCommit({
23941
- fs: fs2,
23941
+ fs: fs3,
23942
23942
  dir,
23943
23943
  author,
23944
23944
  message,
@@ -24608,15 +24608,15 @@ Valid examples:
24608
24608
  - "/path/to/green-elephant.inlang
24609
24609
  `, { argument: "projectPath" });
24610
24610
  }
24611
- const fs2 = args.repo.nodeishFs;
24611
+ const fs3 = args.repo.nodeishFs;
24612
24612
  const nodeishFs = createNodeishFsWithAbsolutePaths({
24613
24613
  projectPath,
24614
- nodeishFs: fs2
24614
+ nodeishFs: fs3
24615
24615
  });
24616
- await maybeMigrateToDirectory({ nodeishFs: fs2, projectPath });
24616
+ await maybeMigrateToDirectory({ nodeishFs: fs3, projectPath });
24617
24617
  await maybeCreateFirstProjectId({ projectPath, repo: args.repo });
24618
24618
  return await createRoot2(async () => {
24619
- const { data: projectId } = await tryCatch(() => fs2.readFile(args.projectPath + "/project_id", { encoding: "utf-8" }));
24619
+ const { data: projectId } = await tryCatch(() => fs3.readFile(args.projectPath + "/project_id", { encoding: "utf-8" }));
24620
24620
  const [initialized, markInitAsComplete, markInitAsFailed] = createAwaitable();
24621
24621
  const [settings, _setSettings] = createSignal2();
24622
24622
  createEffect2(() => {
@@ -24658,10 +24658,10 @@ Valid examples:
24658
24658
  markInitAsFailed(void 0);
24659
24659
  return;
24660
24660
  }
24661
- const loadAndSetMessages = async (fs3) => {
24661
+ const loadAndSetMessages = async (fs4) => {
24662
24662
  makeTrulyAsync(_resolvedModules.resolvedPluginApi.loadMessages({
24663
24663
  settings: settingsValue,
24664
- nodeishFs: fs3
24664
+ nodeishFs: fs4
24665
24665
  })).then((messages2) => {
24666
24666
  setMessages(messages2);
24667
24667
  markInitAsComplete();
@@ -24864,13 +24864,13 @@ init_define_ENV_DEFINED_IN_BUILD_STEP();
24864
24864
  var listProjects = async (nodeishFs, from3) => {
24865
24865
  const recursionLimit = 5;
24866
24866
  const projects = [];
24867
- async function searchDir(path3, depth) {
24867
+ async function searchDir(path4, depth) {
24868
24868
  if (depth > recursionLimit) {
24869
24869
  return;
24870
24870
  }
24871
- const files = await nodeishFs.readdir(path3);
24871
+ const files = await nodeishFs.readdir(path4);
24872
24872
  for (const file of files) {
24873
- const filePath = `${path3}/${file}`;
24873
+ const filePath = `${path4}/${file}`;
24874
24874
  try {
24875
24875
  const stats = await nodeishFs.stat(filePath);
24876
24876
  if (stats.isDirectory()) {
@@ -25752,8 +25752,8 @@ function getErrorMap() {
25752
25752
  return overrideErrorMap;
25753
25753
  }
25754
25754
  var makeIssue = (params) => {
25755
- const { data, path: path3, errorMaps, issueData } = params;
25756
- const fullPath = [...path3, ...issueData.path || []];
25755
+ const { data, path: path4, errorMaps, issueData } = params;
25756
+ const fullPath = [...path4, ...issueData.path || []];
25757
25757
  const fullIssue = {
25758
25758
  ...issueData,
25759
25759
  path: fullPath
@@ -25852,11 +25852,11 @@ var errorUtil;
25852
25852
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
25853
25853
  })(errorUtil || (errorUtil = {}));
25854
25854
  var ParseInputLazyPath = class {
25855
- constructor(parent, value, path3, key) {
25855
+ constructor(parent, value, path4, key) {
25856
25856
  this._cachedPath = [];
25857
25857
  this.parent = parent;
25858
25858
  this.data = value;
25859
- this._path = path3;
25859
+ this._path = path4;
25860
25860
  this._key = key;
25861
25861
  }
25862
25862
  get path() {
@@ -29197,17 +29197,117 @@ function capture2(args) {
29197
29197
  });
29198
29198
  }
29199
29199
 
29200
+ // src/services/telemetry/stack-detection.ts
29201
+ init_define_ENV_DEFINED_IN_BUILD_STEP();
29202
+ var RelevantPackages = [
29203
+ "next",
29204
+ "solid",
29205
+ "solid-start",
29206
+ "svelte",
29207
+ "@sveltejs/kit",
29208
+ "@sveltejs/adaper-static",
29209
+ "@sveltejs/adapter-node",
29210
+ "@sveltejs/adapter-netlify",
29211
+ "@sveltejs/adapter-vercel",
29212
+ "@sveltejs/adapter-cloudflare-workers",
29213
+ "@sveltejs/adapter-auto",
29214
+ "vue",
29215
+ "nuxt",
29216
+ "react",
29217
+ "react-native",
29218
+ "remix",
29219
+ "astro",
29220
+ "flutter",
29221
+ "vite",
29222
+ "webpack",
29223
+ "rollup",
29224
+ "esbuild",
29225
+ "qwick",
29226
+ "parcel",
29227
+ "lit",
29228
+ "lit-html",
29229
+ "@angular/core"
29230
+ ];
29231
+ function getStackInfo(packageJson) {
29232
+ const packages = {};
29233
+ try {
29234
+ const pkg = packageJson;
29235
+ const dependencies = (pkg == null ? void 0 : pkg.dependencies) ?? {};
29236
+ const devDependencies = (pkg == null ? void 0 : pkg.devDependencies) ?? {};
29237
+ const peerDependencies = (pkg == null ? void 0 : pkg.peerDependencies) ?? {};
29238
+ const allDependencies = { ...dependencies, ...devDependencies, ...peerDependencies };
29239
+ for (const dependencyName of RelevantPackages) {
29240
+ if (dependencyName in allDependencies) {
29241
+ const dependencyVersion = allDependencies[dependencyName];
29242
+ if (typeof dependencyVersion !== "string")
29243
+ continue;
29244
+ packages[dependencyName] = dependencyVersion;
29245
+ }
29246
+ }
29247
+ return { packages };
29248
+ } catch (error) {
29249
+ return { packages };
29250
+ }
29251
+ }
29252
+
29253
+ // src/compiler/compile.ts
29254
+ import fs from "node:fs/promises";
29255
+
29256
+ // src/services/environment/package.ts
29257
+ init_define_ENV_DEFINED_IN_BUILD_STEP();
29258
+ import path from "node:path";
29259
+
29260
+ // src/services/file-handling/exists.ts
29261
+ init_define_ENV_DEFINED_IN_BUILD_STEP();
29262
+ async function pathExists(filePath, nodeishFs) {
29263
+ try {
29264
+ await nodeishFs.stat(filePath);
29265
+ return true;
29266
+ } catch (error) {
29267
+ if (error.code === "ENOENT") {
29268
+ return false;
29269
+ } else {
29270
+ throw new Error(`Failed to check if path exists: ${error}`, { cause: error });
29271
+ }
29272
+ }
29273
+ }
29274
+
29275
+ // src/services/environment/package.ts
29276
+ async function findPackageJson(fs3, cwd) {
29277
+ const potentialPackageJsonPath = path.resolve(cwd, "package.json");
29278
+ const packageJsonExists = await pathExists(potentialPackageJsonPath, fs3);
29279
+ if (packageJsonExists)
29280
+ return potentialPackageJsonPath;
29281
+ return void 0;
29282
+ }
29283
+ async function getPackageJson(fs3, cwd) {
29284
+ const packageJsonPath = await findPackageJson(fs3, cwd);
29285
+ if (!packageJsonPath)
29286
+ return void 0;
29287
+ try {
29288
+ const packageJsonContents = await fs3.readFile(packageJsonPath, { encoding: "utf-8" });
29289
+ return JSON.parse(packageJsonContents);
29290
+ } catch {
29291
+ return void 0;
29292
+ }
29293
+ }
29294
+
29200
29295
  // src/compiler/compile.ts
29201
29296
  var ignoreDirectory = `# ignore everything because the directory is auto-generated by inlang paraglide-js
29202
29297
  # for more info visit https://inlang.com/m/gerre34r/paraglide-js
29203
29298
  *
29204
29299
  `;
29205
- var compile = (args) => {
29300
+ var compile = async (args) => {
29206
29301
  const compiledMessages = args.messages.map(
29207
29302
  (message) => compileMessage(message, args.settings.languageTags, args.settings.sourceLanguageTag)
29208
29303
  );
29304
+ const pkgJson = await getPackageJson(fs, process.cwd());
29305
+ const stack = getStackInfo(pkgJson);
29209
29306
  telemetry.capture({
29210
- event: "PARAGLIDE-JS compile executed"
29307
+ event: "PARAGLIDE-JS compile executed",
29308
+ properties: {
29309
+ stack
29310
+ }
29211
29311
  });
29212
29312
  const resources = {};
29213
29313
  for (const compiledMessage of compiledMessages) {
@@ -29403,33 +29503,33 @@ import { Command } from "commander";
29403
29503
 
29404
29504
  // src/services/file-handling/write-output.ts
29405
29505
  init_define_ENV_DEFINED_IN_BUILD_STEP();
29406
- import path from "node:path";
29506
+ import path2 from "node:path";
29407
29507
  import crypto2 from "node:crypto";
29408
29508
  var previousOutputHash;
29409
- async function writeOutput(outputDirectory, output, fs2) {
29509
+ async function writeOutput(outputDirectory, output, fs3) {
29410
29510
  const currentOutputHash = hashOutput(output, outputDirectory);
29411
29511
  if (currentOutputHash === previousOutputHash)
29412
29512
  return;
29413
- await fs2.access(outputDirectory).catch(async () => {
29414
- await fs2.mkdir(outputDirectory, { recursive: true });
29513
+ await fs3.access(outputDirectory).catch(async () => {
29514
+ await fs3.mkdir(outputDirectory, { recursive: true });
29415
29515
  });
29416
- const files = await fs2.readdir(outputDirectory);
29516
+ const files = await fs3.readdir(outputDirectory);
29417
29517
  await Promise.allSettled(
29418
29518
  files.map(async (file) => {
29419
- await fs2.unlink(outputDirectory + "/" + file);
29519
+ await fs3.unlink(outputDirectory + "/" + file);
29420
29520
  })
29421
29521
  );
29422
29522
  await Promise.allSettled(
29423
29523
  Object.keys(output).map(async (filePath) => {
29424
- const fullPath = path.resolve(outputDirectory, filePath);
29425
- const directory = path.dirname(fullPath);
29426
- await fs2.mkdir(directory, { recursive: true });
29524
+ const fullPath = path2.resolve(outputDirectory, filePath);
29525
+ const directory = path2.dirname(fullPath);
29526
+ await fs3.mkdir(directory, { recursive: true });
29427
29527
  })
29428
29528
  );
29429
29529
  await Promise.allSettled(
29430
29530
  Object.entries(output).map(async ([filePath, fileContent]) => {
29431
- const fullPath = path.resolve(outputDirectory, filePath);
29432
- await fs2.writeFile(fullPath, fileContent);
29531
+ const fullPath = path2.resolve(outputDirectory, filePath);
29532
+ await fs3.writeFile(fullPath, fileContent);
29433
29533
  })
29434
29534
  );
29435
29535
  previousOutputHash = currentOutputHash;
@@ -29506,19 +29606,19 @@ var compileCommand = new Command().name("compile").summary("Compiles inlang Para
29506
29606
  "./src/paraglide"
29507
29607
  ).requiredOption("--watch", "Watch for changes and recompile.", false).action(async (options) => {
29508
29608
  const logger = new Logger({ silent: false, prefix: true });
29509
- const path3 = resolve(process.cwd(), options.project);
29609
+ const path4 = resolve(process.cwd(), options.project);
29510
29610
  const outputDirectory = resolve(process.cwd(), options.outdir);
29511
29611
  logger.info(`Compiling inlang project at "${options.project}".`);
29512
- const repoRoot = await findRepoRoot({ nodeishFs: nodeFsPromises, path: path3 });
29612
+ const repoRoot = await findRepoRoot({ nodeishFs: nodeFsPromises, path: path4 });
29513
29613
  const repo = await openRepository(repoRoot || process.cwd(), {
29514
29614
  nodeishFs: nodeFsPromises
29515
29615
  });
29516
29616
  if (!repoRoot) {
29517
- logger.warn(`Could not find repository root for path ${path3}`);
29617
+ logger.warn(`Could not find repository root for path ${path4}`);
29518
29618
  }
29519
29619
  const project = exitIfErrors(
29520
29620
  await loadProject({
29521
- projectPath: path3,
29621
+ projectPath: path4,
29522
29622
  repo,
29523
29623
  appId: "library.inlang.paraglideJs"
29524
29624
  }),
@@ -29546,12 +29646,12 @@ var compileCommand = new Command().name("compile").summary("Compiles inlang Para
29546
29646
  }
29547
29647
  logger.info("Sucessfully compiled the project.");
29548
29648
  });
29549
- async function executeCompilation(project, outputDirectory, fs2) {
29550
- const output = compile({
29649
+ async function executeCompilation(project, outputDirectory, fs3) {
29650
+ const output = await compile({
29551
29651
  messages: project.query.messages.getAll(),
29552
29652
  settings: project.settings()
29553
29653
  });
29554
- await writeOutput(outputDirectory, output, fs2);
29654
+ await writeOutput(outputDirectory, output, fs3);
29555
29655
  }
29556
29656
  var exitIfErrors = (project, logger) => {
29557
29657
  if (project.errors().length > 0) {
@@ -29575,16 +29675,16 @@ import childProcess from "node:child_process";
29575
29675
 
29576
29676
  // src/cli/state.ts
29577
29677
  init_define_ENV_DEFINED_IN_BUILD_STEP();
29578
- import path2 from "node:path";
29579
- import fs from "node:fs";
29678
+ import path3 from "node:path";
29679
+ import fs2 from "node:fs";
29580
29680
  import { fileURLToPath } from "node:url";
29581
29681
  var version = (() => {
29582
- const currentFilePath = fileURLToPath(import.meta.url).split(path2.sep).join(path2.posix.sep);
29682
+ const currentFilePath = fileURLToPath(import.meta.url).split(path3.sep).join(path3.posix.sep);
29583
29683
  const paraglideDirectory = currentFilePath.slice(
29584
29684
  0,
29585
29685
  currentFilePath.indexOf("/paraglide-js/") + "/paraglide-js".length
29586
29686
  );
29587
- return JSON.parse(fs.readFileSync(`${paraglideDirectory}/package.json`, "utf-8")).version;
29687
+ return JSON.parse(fs2.readFileSync(`${paraglideDirectory}/package.json`, "utf-8")).version;
29588
29688
  })();
29589
29689
 
29590
29690
  // src/cli/commands/init.ts
@@ -29676,7 +29776,7 @@ var maybeAddVsCodeExtension = async (args, ctx) => {
29676
29776
  }
29677
29777
  if (extensions.recommendations.includes("inlang.vs-code-extension") === false) {
29678
29778
  extensions.recommendations.push("inlang.vs-code-extension");
29679
- if (await fileExists("./.vscode", ctx.repo.nodeishFs) === false) {
29779
+ if (await pathExists("./.vscode", ctx.repo.nodeishFs) === false) {
29680
29780
  await ctx.repo.nodeishFs.mkdir("./.vscode");
29681
29781
  }
29682
29782
  await ctx.repo.nodeishFs.writeFile(
@@ -29706,9 +29806,9 @@ var addParaglideJsToDevDependencies = async (ctx) => {
29706
29806
  ctx.logger.success("Added @inlang/paraglide-js to the devDependencies in package.json.");
29707
29807
  };
29708
29808
  var findExistingInlangProjectPath = async (ctx) => {
29709
- for (const path3 of ["./project.inlang", "../project.inlang", "../../project.inlang"]) {
29710
- if (await fileExists(path3, ctx.repo.nodeishFs)) {
29711
- return path3;
29809
+ for (const path4 of ["./project.inlang", "../project.inlang", "../../project.inlang"]) {
29810
+ if (await pathExists(path4, ctx.repo.nodeishFs)) {
29811
+ return path4;
29712
29812
  }
29713
29813
  continue;
29714
29814
  }
@@ -29788,8 +29888,8 @@ var newProjectTemplate = {
29788
29888
  }
29789
29889
  };
29790
29890
  var checkIfPackageJsonExists = async (ctx) => {
29791
- const exists = await fileExists("./package.json", ctx.repo.nodeishFs);
29792
- if (exists === false) {
29891
+ const packageJsonPath = await findPackageJson(ctx.repo.nodeishFs, process.cwd());
29892
+ if (!packageJsonPath) {
29793
29893
  ctx.logger.warn(
29794
29894
  "No package.json found in the current working directory. Please change the working directory to the directory with a package.json file."
29795
29895
  );
@@ -29864,7 +29964,7 @@ Please add the following command to your build script manually:
29864
29964
  };
29865
29965
  var maybeChangeTsConfigModuleResolution = async (ctx) => {
29866
29966
  var _a, _b, _c;
29867
- if (await fileExists("./tsconfig.json", ctx.repo.nodeishFs) === false) {
29967
+ if (await pathExists("./tsconfig.json", ctx.repo.nodeishFs) === false) {
29868
29968
  return;
29869
29969
  }
29870
29970
  const file = await ctx.repo.nodeishFs.readFile("./tsconfig.json", { encoding: "utf-8" });
@@ -29926,7 +30026,7 @@ var maybeChangeTsConfigModuleResolution = async (ctx) => {
29926
30026
  };
29927
30027
  var maybeChangeTsConfigAllowJs = async (ctx) => {
29928
30028
  var _a, _b;
29929
- if (await fileExists("./tsconfig.json", ctx.repo.nodeishFs) === false) {
30029
+ if (await pathExists("./tsconfig.json", ctx.repo.nodeishFs) === false) {
29930
30030
  return;
29931
30031
  }
29932
30032
  const file = await ctx.repo.nodeishFs.readFile("./tsconfig.json", { encoding: "utf-8" });
@@ -29974,18 +30074,6 @@ var prompt = async (message, options) => {
29974
30074
  }
29975
30075
  return response;
29976
30076
  };
29977
- async function fileExists(filePath, nodeishFs) {
29978
- try {
29979
- await nodeishFs.stat(filePath);
29980
- return true;
29981
- } catch (error) {
29982
- if (error.code === "ENOENT") {
29983
- return false;
29984
- } else {
29985
- throw new Error(`Failed to check if file exists: ${error}`, { cause: error });
29986
- }
29987
- }
29988
- }
29989
30077
  function execAsync(command) {
29990
30078
  return new Promise((resolve3, reject) => {
29991
30079
  childProcess.exec(command, (error, stdout) => {