@power-plant/schema 0.0.52 → 0.0.54

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/codegen.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers = require('./helpers-on-hD-7R.cjs');
2
+ const require_helpers = require('./helpers-LhLPb88g.cjs');
3
3
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
4
  let _stryke_type_checks = require("@stryke/type-checks");
5
5
  let _stryke_string_format_list = require("@stryke/string-format/list");
@@ -205,9 +205,7 @@ function generateParserCode(schema, options = {}) {
205
205
  lines.push(`if (${valueVar} === null) {`, ` ${targetVar} = null;`, `} else {`, ` ${errorsVar}.push({ path: ${pathVar}, failure: "Expected a null value" });`, ` ${targetVar} = ${valueVar};`, `}`);
206
206
  break;
207
207
  case void 0:
208
- default:
209
- lines.push(`${targetVar} = ${valueVar};`);
210
- break;
208
+ default: lines.push(`${targetVar} = ${valueVar};`);
211
209
  }
212
210
  return lines;
213
211
  }
package/dist/codegen.mjs CHANGED
@@ -204,9 +204,7 @@ function generateParserCode(schema, options = {}) {
204
204
  lines.push(`if (${valueVar} === null) {`, ` ${targetVar} = null;`, `} else {`, ` ${errorsVar}.push({ path: ${pathVar}, failure: "Expected a null value" });`, ` ${targetVar} = ${valueVar};`, `}`);
205
205
  break;
206
206
  case void 0:
207
- default:
208
- lines.push(`${targetVar} = ${valueVar};`);
209
- break;
207
+ default: lines.push(`${targetVar} = ${valueVar};`);
210
208
  }
211
209
  return lines;
212
210
  }
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/constants.ts
3
2
  /**
4
3
  * Runtime value for an unconstrained {@link JsonSchemaAny} schema.
@@ -1,7 +1,7 @@
1
- import { createRequire } from "node:module";
2
1
  import ts, { isBigIntLiteral, isJSDocImportTag } from "typescript";
3
2
  import { ReflectionOp, TypeNumberBrand } from "@deepkit/type-spec";
4
3
  import { dirname, isAbsolute, join } from "path";
4
+ import { knownLibFilesForCompilerOptions } from "@typescript/vfs";
5
5
 
6
6
  //#region \0rolldown/runtime.js
7
7
  var __create = Object.create;
@@ -25,11 +25,14 @@ var __copyProps = (to, from, except, desc) => {
25
25
  }
26
26
  return to;
27
27
  };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
29
29
  value: mod,
30
30
  enumerable: true
31
31
  }) : target, mod));
32
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
32
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
33
+ if (typeof require !== "undefined") return require.apply(this, arguments);
34
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
35
+ });
33
36
 
34
37
  //#endregion
35
38
  //#region ../../../node_modules/.pnpm/compatfactory@2.0.9_typescript@6.0.3/node_modules/compatfactory/dist/esm/index.js
@@ -4979,7 +4982,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4979
4982
  };
4980
4983
  module.exports = {
4981
4984
  DEFAULT_MAX_EXTGLOB_RECURSION,
4982
- MAX_LENGTH: 1024 * 64,
4985
+ MAX_LENGTH: 65536,
4983
4986
  POSIX_REGEX_SOURCE,
4984
4987
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
4985
4988
  REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
@@ -7228,960 +7231,8 @@ var Resolver = class {
7228
7231
  }
7229
7232
  };
7230
7233
 
7231
- //#endregion
7232
- //#region ../../../node_modules/.pnpm/@typescript+vfs@1.5.0/node_modules/@typescript/vfs/dist/vfs.cjs.production.min.js
7233
- var require_vfs_cjs_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
7234
- function e() {
7235
- return (e = Object.assign || function(e) {
7236
- for (var t = 1; t < arguments.length; t++) {
7237
- var r = arguments[t];
7238
- for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
7239
- }
7240
- return e;
7241
- }).apply(this, arguments);
7242
- }
7243
- Object.defineProperty(exports, "__esModule", { value: !0 });
7244
- var t = !1;
7245
- try {
7246
- t = "undefined" != typeof localStorage;
7247
- } catch (e) {}
7248
- var r = "undefined" != typeof process;
7249
- var i = t && localStorage.getItem("DEBUG") || r && process.env.DEBUG ? console.log : function(e) {
7250
- return "";
7251
- };
7252
- var n = function(e, t) {
7253
- var r, i = e.lib || [], n = [
7254
- "lib.d.ts",
7255
- "lib.decorators.d.ts",
7256
- "lib.decorators.legacy.d.ts",
7257
- "lib.dom.d.ts",
7258
- "lib.dom.iterable.d.ts",
7259
- "lib.webworker.d.ts",
7260
- "lib.webworker.importscripts.d.ts",
7261
- "lib.webworker.iterable.d.ts",
7262
- "lib.scripthost.d.ts",
7263
- "lib.es5.d.ts",
7264
- "lib.es6.d.ts",
7265
- "lib.es2015.collection.d.ts",
7266
- "lib.es2015.core.d.ts",
7267
- "lib.es2015.d.ts",
7268
- "lib.es2015.generator.d.ts",
7269
- "lib.es2015.iterable.d.ts",
7270
- "lib.es2015.promise.d.ts",
7271
- "lib.es2015.proxy.d.ts",
7272
- "lib.es2015.reflect.d.ts",
7273
- "lib.es2015.symbol.d.ts",
7274
- "lib.es2015.symbol.wellknown.d.ts",
7275
- "lib.es2016.array.include.d.ts",
7276
- "lib.es2016.d.ts",
7277
- "lib.es2016.full.d.ts",
7278
- "lib.es2017.d.ts",
7279
- "lib.es2017.date.d.ts",
7280
- "lib.es2017.full.d.ts",
7281
- "lib.es2017.intl.d.ts",
7282
- "lib.es2017.object.d.ts",
7283
- "lib.es2017.sharedmemory.d.ts",
7284
- "lib.es2017.string.d.ts",
7285
- "lib.es2017.typedarrays.d.ts",
7286
- "lib.es2018.asyncgenerator.d.ts",
7287
- "lib.es2018.asynciterable.d.ts",
7288
- "lib.es2018.d.ts",
7289
- "lib.es2018.full.d.ts",
7290
- "lib.es2018.intl.d.ts",
7291
- "lib.es2018.promise.d.ts",
7292
- "lib.es2018.regexp.d.ts",
7293
- "lib.es2019.array.d.ts",
7294
- "lib.es2019.d.ts",
7295
- "lib.es2019.full.d.ts",
7296
- "lib.es2019.intl.d.ts",
7297
- "lib.es2019.object.d.ts",
7298
- "lib.es2019.string.d.ts",
7299
- "lib.es2019.symbol.d.ts",
7300
- "lib.es2020.bigint.d.ts",
7301
- "lib.es2020.d.ts",
7302
- "lib.es2020.date.d.ts",
7303
- "lib.es2020.full.d.ts",
7304
- "lib.es2020.intl.d.ts",
7305
- "lib.es2020.number.d.ts",
7306
- "lib.es2020.promise.d.ts",
7307
- "lib.es2020.sharedmemory.d.ts",
7308
- "lib.es2020.string.d.ts",
7309
- "lib.es2020.symbol.wellknown.d.ts",
7310
- "lib.es2021.d.ts",
7311
- "lib.es2021.full.d.ts",
7312
- "lib.es2021.intl.d.ts",
7313
- "lib.es2021.promise.d.ts",
7314
- "lib.es2021.string.d.ts",
7315
- "lib.es2021.weakref.d.ts",
7316
- "lib.es2022.array.d.ts",
7317
- "lib.es2022.d.ts",
7318
- "lib.es2022.error.d.ts",
7319
- "lib.es2022.full.d.ts",
7320
- "lib.es2022.intl.d.ts",
7321
- "lib.es2022.object.d.ts",
7322
- "lib.es2022.regexp.d.ts",
7323
- "lib.es2022.sharedmemory.d.ts",
7324
- "lib.es2022.string.d.ts",
7325
- "lib.es2023.array.d.ts",
7326
- "lib.es2023.collection.d.ts",
7327
- "lib.es2023.d.ts",
7328
- "lib.es2023.full.d.ts",
7329
- "lib.esnext.array.d.ts",
7330
- "lib.esnext.asynciterable.d.ts",
7331
- "lib.esnext.bigint.d.ts",
7332
- "lib.esnext.d.ts",
7333
- "lib.esnext.decorators.d.ts",
7334
- "lib.esnext.disposable.d.ts",
7335
- "lib.esnext.full.d.ts",
7336
- "lib.esnext.intl.d.ts",
7337
- "lib.esnext.promise.d.ts",
7338
- "lib.esnext.string.d.ts",
7339
- "lib.esnext.symbol.d.ts",
7340
- "lib.esnext.weakref.d.ts"
7341
- ], s = t.ScriptTarget[e.target || t.ScriptTarget.ES5], o = n.filter((function(e) {
7342
- return e.startsWith("lib." + s.toLowerCase());
7343
- })), l = n.indexOf(o.pop()), a = ((r = i.map((function(e) {
7344
- var t = n.filter((function(t) {
7345
- return t.startsWith("lib." + e.toLowerCase());
7346
- }));
7347
- return 0 === t.length ? 0 : n.indexOf(t.pop());
7348
- }))) && r.length ? r.reduce((function(e, t) {
7349
- return t > e ? t : e;
7350
- })) : void 0) || 0, u = Math.max(l, a);
7351
- return n.slice(0, u + 1);
7352
- };
7353
- var s = function(e, t) {
7354
- var r = f(), i = b();
7355
- (function e(t) {
7356
- var n = [];
7357
- return i.readdirSync(t).forEach((function(s) {
7358
- s = r.join(t, s);
7359
- var o = i.statSync(s);
7360
- o && o.isDirectory() ? n = n.concat(e(s)) : n.push(s);
7361
- })), n;
7362
- })(t).forEach((function(n) {
7363
- var s = "/node_modules/@types" + n.replace(t, ""), o = i.readFileSync(n, "utf8");
7364
- [".ts", ".tsx"].includes(r.extname(s)) && e.set(s, o);
7365
- }));
7366
- };
7367
- function o(e) {
7368
- throw new Error("Method '" + e + "' is not implemented.");
7369
- }
7370
- function l(e, t) {
7371
- return function() {
7372
- for (var r = arguments.length, n = new Array(r), s = 0; s < r; s++) n[s] = arguments[s];
7373
- var o = t.apply(void 0, n), l = "string" == typeof o ? o.slice(0, 80) + "..." : o;
7374
- return i.apply(void 0, ["> " + e].concat(n)), i("< " + l), o;
7375
- };
7376
- }
7377
- var a = function(t) {
7378
- return e({}, t.getDefaultCompilerOptions(), {
7379
- jsx: t.JsxEmit.React,
7380
- strict: !0,
7381
- esModuleInterop: !0,
7382
- module: t.ModuleKind.ESNext,
7383
- suppressOutputPathCheck: !0,
7384
- skipLibCheck: !0,
7385
- skipDefaultLibCheck: !0,
7386
- moduleResolution: t.ModuleResolutionKind.NodeJs
7387
- });
7388
- };
7389
- var u = function(e) {
7390
- return e.replace("/", "/lib.").toLowerCase();
7391
- };
7392
- function c(t, r, i) {
7393
- var n = /* @__PURE__ */ new Map();
7394
- return {
7395
- compilerHost: e({}, t, {
7396
- getCanonicalFileName: function(e) {
7397
- return e;
7398
- },
7399
- getDefaultLibFileName: function() {
7400
- return "/" + i.getDefaultLibFileName(r);
7401
- },
7402
- getDirectories: function() {
7403
- return [];
7404
- },
7405
- getNewLine: function() {
7406
- return t.newLine;
7407
- },
7408
- getSourceFile: function(e) {
7409
- return n.get(e) || (s = i.createSourceFile(e, t.readFile(e), r.target || a(i).target, !1), n.set(s.fileName, s), s);
7410
- var s;
7411
- },
7412
- useCaseSensitiveFileNames: function() {
7413
- return t.useCaseSensitiveFileNames;
7414
- }
7415
- }),
7416
- updateFile: function(e) {
7417
- var r = n.has(e.fileName);
7418
- return t.writeFile(e.fileName, e.text), n.set(e.fileName, e), r;
7419
- }
7420
- };
7421
- }
7422
- function d(t, r, i, n, s) {
7423
- var o = [].concat(r), l = c(t, i, n), a = l.compilerHost, u = l.updateFile, d = /* @__PURE__ */ new Map(), f = 0;
7424
- return {
7425
- languageServiceHost: e({}, a, {
7426
- getProjectVersion: function() {
7427
- return f.toString();
7428
- },
7429
- getCompilationSettings: function() {
7430
- return i;
7431
- },
7432
- getCustomTransformers: function() {
7433
- return s;
7434
- },
7435
- getScriptFileNames: function() {
7436
- return o.slice();
7437
- },
7438
- getScriptSnapshot: function(e) {
7439
- var r = t.readFile(e);
7440
- if (r) return n.ScriptSnapshot.fromString(r);
7441
- },
7442
- getScriptVersion: function(e) {
7443
- return d.get(e) || "0";
7444
- },
7445
- writeFile: t.writeFile
7446
- }),
7447
- updateFile: function(e) {
7448
- f++, d.set(e.fileName, f.toString()), o.includes(e.fileName) || o.push(e.fileName), u(e);
7449
- }
7450
- };
7451
- }
7452
- var f = function() {
7453
- return __require(String.fromCharCode(112, 97, 116, 104));
7454
- };
7455
- var b = function() {
7456
- return __require(String.fromCharCode(102, 115));
7457
- };
7458
- exports.addAllFilesFromFolder = s, exports.addFilesForTypesIntoFolder = function(e) {
7459
- return s(e, "node_modules/@types");
7460
- }, exports.createDefaultMapFromCDN = function(e, t, r, i, s, o, l) {
7461
- var a = o || fetch, u = /* @__PURE__ */ new Map(), c = n(e, i), d = "https://typescript.azureedge.net/cdn/" + t + "/typescript/lib/";
7462
- return (r ? function() {
7463
- var e = l || localStorage;
7464
- return Object.keys(e).forEach((function(r) {
7465
- r.startsWith("ts-lib-") && !r.startsWith("ts-lib-" + t) && e.removeItem(r);
7466
- })), Promise.all(c.map((function(r) {
7467
- var i, n = "ts-lib-" + t + "-" + r, o = e.getItem(n);
7468
- return o ? Promise.resolve((i = o, s ? s.decompressFromUTF16(i) : i)) : a(d + r).then((function(e) {
7469
- return e.text();
7470
- })).then((function(t) {
7471
- var r;
7472
- return e.setItem(n, (r = t, s ? s.compressToUTF16(r) : r)), t;
7473
- })).catch((function() {}));
7474
- }))).then((function(e) {
7475
- e.forEach((function(e, t) {
7476
- e && u.set("/" + c[t], e);
7477
- }));
7478
- }));
7479
- } : function() {
7480
- return Promise.all(c.map((function(e) {
7481
- return a(d + e).then((function(e) {
7482
- return e.text();
7483
- }));
7484
- }))).then((function(e) {
7485
- e.forEach((function(e, t) {
7486
- return u.set("/" + c[t], e);
7487
- }));
7488
- })).catch((function() {}));
7489
- })().then((function() {
7490
- return u;
7491
- }));
7492
- }, exports.createDefaultMapFromNodeModules = function(e, t, r) {
7493
- var i = f(), n = b(), s = n.readdirSync(r || i.dirname(__require.resolve("typescript"))).filter((function(e) {
7494
- return e.startsWith("lib.") && e.endsWith(".d.ts");
7495
- })), o = /* @__PURE__ */ new Map();
7496
- return s.forEach((function(e) {
7497
- o.set("/" + e, function(e) {
7498
- var t = r || i.dirname(__require.resolve("typescript"));
7499
- return n.readFileSync(i.join(t, e), "utf8");
7500
- }(e));
7501
- })), o;
7502
- }, exports.createFSBackedSystem = function(e, t, r, i) {
7503
- var n = t + "/vfs", s = f(), a = r.sys, u = null != i ? i : s.dirname(__require.resolve("typescript"));
7504
- return {
7505
- name: "fs-vfs",
7506
- root: n,
7507
- args: [],
7508
- createDirectory: function() {
7509
- return o("createDirectory");
7510
- },
7511
- directoryExists: l("directoryExists", (function(t) {
7512
- return Array.from(e.keys()).some((function(e) {
7513
- return e.startsWith(t);
7514
- })) || a.directoryExists(t);
7515
- })),
7516
- exit: a.exit,
7517
- fileExists: l("fileExists", (function(t) {
7518
- if (e.has(t)) return !0;
7519
- if (t.includes("tsconfig.json") || t.includes("tsconfig.json")) return !1;
7520
- if (t.startsWith("/lib")) {
7521
- var r = u + "/" + t.replace("/", "");
7522
- return a.fileExists(r);
7523
- }
7524
- return a.fileExists(t);
7525
- })),
7526
- getCurrentDirectory: function() {
7527
- return n;
7528
- },
7529
- getDirectories: a.getDirectories,
7530
- getExecutingFilePath: function() {
7531
- return o("getExecutingFilePath");
7532
- },
7533
- readDirectory: l("readDirectory", (function() {
7534
- return "/" === (arguments.length <= 0 ? void 0 : arguments[0]) ? Array.from(e.keys()) : a.readDirectory.apply(a, arguments);
7535
- })),
7536
- readFile: l("readFile", (function(t) {
7537
- if (e.has(t)) return e.get(t);
7538
- if (t.startsWith("/lib")) {
7539
- var r = u + "/" + t.replace("/", ""), i = a.readFile(r);
7540
- if (!i) {
7541
- var n = a.readDirectory(u);
7542
- throw new Error("TSVFS: A request was made for " + r + " but there wasn't a file found in the file map. You likely have a mismatch in the compiler options for the CDN download vs the compiler program. Existing Libs: " + n + ".");
7543
- }
7544
- return i;
7545
- }
7546
- return a.readFile(t);
7547
- })),
7548
- resolvePath: function(t) {
7549
- return e.has(t) ? t : a.resolvePath(t);
7550
- },
7551
- newLine: "\n",
7552
- useCaseSensitiveFileNames: !0,
7553
- write: function() {
7554
- return o("write");
7555
- },
7556
- writeFile: function(t, r) {
7557
- e.set(t, r);
7558
- }
7559
- };
7560
- }, exports.createSystem = function(e) {
7561
- return {
7562
- args: [],
7563
- createDirectory: function() {
7564
- return o("createDirectory");
7565
- },
7566
- directoryExists: l("directoryExists", (function(t) {
7567
- return Array.from(e.keys()).some((function(e) {
7568
- return e.startsWith(t);
7569
- }));
7570
- })),
7571
- exit: function() {
7572
- return o("exit");
7573
- },
7574
- fileExists: l("fileExists", (function(t) {
7575
- return e.has(t) || e.has(u(t));
7576
- })),
7577
- getCurrentDirectory: function() {
7578
- return "/";
7579
- },
7580
- getDirectories: function() {
7581
- return [];
7582
- },
7583
- getExecutingFilePath: function() {
7584
- return o("getExecutingFilePath");
7585
- },
7586
- readDirectory: l("readDirectory", (function(t) {
7587
- return "/" === t ? Array.from(e.keys()) : [];
7588
- })),
7589
- readFile: l("readFile", (function(t) {
7590
- return e.get(t) || e.get(u(t));
7591
- })),
7592
- resolvePath: function(e) {
7593
- return e;
7594
- },
7595
- newLine: "\n",
7596
- useCaseSensitiveFileNames: !0,
7597
- write: function() {
7598
- return o("write");
7599
- },
7600
- writeFile: function(t, r) {
7601
- e.set(t, r);
7602
- }
7603
- };
7604
- }, exports.createVirtualCompilerHost = c, exports.createVirtualLanguageServiceHost = d, exports.createVirtualTypeScriptEnvironment = function(t, r, i, n, s) {
7605
- void 0 === n && (n = {});
7606
- var o = e({}, a(i), n), l = d(t, r, o, i, s), u = l.updateFile, f = i.createLanguageService(l.languageServiceHost), b = f.getCompilerOptionsDiagnostics();
7607
- if (b.length) {
7608
- var p = c(t, n, i);
7609
- throw new Error(i.formatDiagnostics(b, p.compilerHost));
7610
- }
7611
- return {
7612
- name: "vfs",
7613
- sys: t,
7614
- languageService: f,
7615
- getSourceFile: function(e) {
7616
- var t;
7617
- return null == (t = f.getProgram()) ? void 0 : t.getSourceFile(e);
7618
- },
7619
- createFile: function(e, t) {
7620
- u(i.createSourceFile(e, t, o.target, !1));
7621
- },
7622
- updateFile: function(e, t, r) {
7623
- var n = f.getProgram().getSourceFile(e);
7624
- if (!n) throw new Error("Did not find a source file for " + e);
7625
- var s = n.text, o = null != r ? r : i.createTextSpan(0, s.length), l = s.slice(0, o.start) + t + s.slice(o.start + o.length);
7626
- u(i.updateSourceFile(n, l, {
7627
- span: o,
7628
- newLength: t.length
7629
- }));
7630
- }
7631
- };
7632
- }, exports.knownLibFilesForCompilerOptions = n;
7633
- }));
7634
-
7635
- //#endregion
7636
- //#region ../../../node_modules/.pnpm/@typescript+vfs@1.5.0/node_modules/@typescript/vfs/dist/vfs.cjs.development.js
7637
- var require_vfs_cjs_development = /* @__PURE__ */ __commonJSMin(((exports) => {
7638
- Object.defineProperty(exports, "__esModule", { value: true });
7639
- function _extends() {
7640
- _extends = Object.assign || function(target) {
7641
- for (var i = 1; i < arguments.length; i++) {
7642
- var source = arguments[i];
7643
- for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
7644
- }
7645
- return target;
7646
- };
7647
- return _extends.apply(this, arguments);
7648
- }
7649
- var hasLocalStorage = false;
7650
- try {
7651
- hasLocalStorage = typeof localStorage !== "undefined";
7652
- } catch (error) {}
7653
- var hasProcess = typeof process !== "undefined";
7654
- var debugLog = hasLocalStorage && /*#__PURE__*/ localStorage.getItem("DEBUG") || hasProcess && process.env.DEBUG ? console.log : function(_message) {
7655
- return "";
7656
- };
7657
- /**
7658
- * Makes a virtual copy of the TypeScript environment. This is the main API you want to be using with
7659
- * @typescript/vfs. A lot of the other exposed functions are used by this function to get set up.
7660
- *
7661
- * @param sys an object which conforms to the TS Sys (a shim over read/write access to the fs)
7662
- * @param rootFiles a list of files which are considered inside the project
7663
- * @param ts a copy pf the TypeScript module
7664
- * @param compilerOptions the options for this compiler run
7665
- * @param customTransformers custom transformers for this compiler run
7666
- */
7667
- function createVirtualTypeScriptEnvironment(sys, rootFiles, ts, compilerOptions, customTransformers) {
7668
- if (compilerOptions === void 0) compilerOptions = {};
7669
- var mergedCompilerOpts = _extends({}, defaultCompilerOptions(ts), compilerOptions);
7670
- var _createVirtualLanguag = createVirtualLanguageServiceHost(sys, rootFiles, mergedCompilerOpts, ts, customTransformers), languageServiceHost = _createVirtualLanguag.languageServiceHost, _updateFile = _createVirtualLanguag.updateFile;
7671
- var languageService = ts.createLanguageService(languageServiceHost);
7672
- var diagnostics = languageService.getCompilerOptionsDiagnostics();
7673
- if (diagnostics.length) {
7674
- var compilerHost = createVirtualCompilerHost(sys, compilerOptions, ts);
7675
- throw new Error(ts.formatDiagnostics(diagnostics, compilerHost.compilerHost));
7676
- }
7677
- return {
7678
- name: "vfs",
7679
- sys,
7680
- languageService,
7681
- getSourceFile: function getSourceFile(fileName) {
7682
- var _languageService$getP;
7683
- return (_languageService$getP = languageService.getProgram()) == null ? void 0 : _languageService$getP.getSourceFile(fileName);
7684
- },
7685
- createFile: function createFile(fileName, content) {
7686
- _updateFile(ts.createSourceFile(fileName, content, mergedCompilerOpts.target, false));
7687
- },
7688
- updateFile: function updateFile(fileName, content, optPrevTextSpan) {
7689
- var prevSourceFile = languageService.getProgram().getSourceFile(fileName);
7690
- if (!prevSourceFile) throw new Error("Did not find a source file for " + fileName);
7691
- var prevFullContents = prevSourceFile.text;
7692
- var prevTextSpan = optPrevTextSpan != null ? optPrevTextSpan : ts.createTextSpan(0, prevFullContents.length);
7693
- var newText = prevFullContents.slice(0, prevTextSpan.start) + content + prevFullContents.slice(prevTextSpan.start + prevTextSpan.length);
7694
- _updateFile(ts.updateSourceFile(prevSourceFile, newText, {
7695
- span: prevTextSpan,
7696
- newLength: content.length
7697
- }));
7698
- }
7699
- };
7700
- }
7701
- /**
7702
- * Grab the list of lib files for a particular target, will return a bit more than necessary (by including
7703
- * the dom) but that's OK, we're really working with the constraint that you can't get a list of files
7704
- * when running in a browser.
7705
- *
7706
- * @param target The compiler settings target baseline
7707
- * @param ts A copy of the TypeScript module
7708
- */
7709
- var knownLibFilesForCompilerOptions = function knownLibFilesForCompilerOptions(compilerOptions, ts) {
7710
- var target = compilerOptions.target || ts.ScriptTarget.ES5;
7711
- var lib = compilerOptions.lib || [];
7712
- var files = [
7713
- "lib.d.ts",
7714
- "lib.decorators.d.ts",
7715
- "lib.decorators.legacy.d.ts",
7716
- "lib.dom.d.ts",
7717
- "lib.dom.iterable.d.ts",
7718
- "lib.webworker.d.ts",
7719
- "lib.webworker.importscripts.d.ts",
7720
- "lib.webworker.iterable.d.ts",
7721
- "lib.scripthost.d.ts",
7722
- "lib.es5.d.ts",
7723
- "lib.es6.d.ts",
7724
- "lib.es2015.collection.d.ts",
7725
- "lib.es2015.core.d.ts",
7726
- "lib.es2015.d.ts",
7727
- "lib.es2015.generator.d.ts",
7728
- "lib.es2015.iterable.d.ts",
7729
- "lib.es2015.promise.d.ts",
7730
- "lib.es2015.proxy.d.ts",
7731
- "lib.es2015.reflect.d.ts",
7732
- "lib.es2015.symbol.d.ts",
7733
- "lib.es2015.symbol.wellknown.d.ts",
7734
- "lib.es2016.array.include.d.ts",
7735
- "lib.es2016.d.ts",
7736
- "lib.es2016.full.d.ts",
7737
- "lib.es2017.d.ts",
7738
- "lib.es2017.date.d.ts",
7739
- "lib.es2017.full.d.ts",
7740
- "lib.es2017.intl.d.ts",
7741
- "lib.es2017.object.d.ts",
7742
- "lib.es2017.sharedmemory.d.ts",
7743
- "lib.es2017.string.d.ts",
7744
- "lib.es2017.typedarrays.d.ts",
7745
- "lib.es2018.asyncgenerator.d.ts",
7746
- "lib.es2018.asynciterable.d.ts",
7747
- "lib.es2018.d.ts",
7748
- "lib.es2018.full.d.ts",
7749
- "lib.es2018.intl.d.ts",
7750
- "lib.es2018.promise.d.ts",
7751
- "lib.es2018.regexp.d.ts",
7752
- "lib.es2019.array.d.ts",
7753
- "lib.es2019.d.ts",
7754
- "lib.es2019.full.d.ts",
7755
- "lib.es2019.intl.d.ts",
7756
- "lib.es2019.object.d.ts",
7757
- "lib.es2019.string.d.ts",
7758
- "lib.es2019.symbol.d.ts",
7759
- "lib.es2020.bigint.d.ts",
7760
- "lib.es2020.d.ts",
7761
- "lib.es2020.date.d.ts",
7762
- "lib.es2020.full.d.ts",
7763
- "lib.es2020.intl.d.ts",
7764
- "lib.es2020.number.d.ts",
7765
- "lib.es2020.promise.d.ts",
7766
- "lib.es2020.sharedmemory.d.ts",
7767
- "lib.es2020.string.d.ts",
7768
- "lib.es2020.symbol.wellknown.d.ts",
7769
- "lib.es2021.d.ts",
7770
- "lib.es2021.full.d.ts",
7771
- "lib.es2021.intl.d.ts",
7772
- "lib.es2021.promise.d.ts",
7773
- "lib.es2021.string.d.ts",
7774
- "lib.es2021.weakref.d.ts",
7775
- "lib.es2022.array.d.ts",
7776
- "lib.es2022.d.ts",
7777
- "lib.es2022.error.d.ts",
7778
- "lib.es2022.full.d.ts",
7779
- "lib.es2022.intl.d.ts",
7780
- "lib.es2022.object.d.ts",
7781
- "lib.es2022.regexp.d.ts",
7782
- "lib.es2022.sharedmemory.d.ts",
7783
- "lib.es2022.string.d.ts",
7784
- "lib.es2023.array.d.ts",
7785
- "lib.es2023.collection.d.ts",
7786
- "lib.es2023.d.ts",
7787
- "lib.es2023.full.d.ts",
7788
- "lib.esnext.array.d.ts",
7789
- "lib.esnext.asynciterable.d.ts",
7790
- "lib.esnext.bigint.d.ts",
7791
- "lib.esnext.d.ts",
7792
- "lib.esnext.decorators.d.ts",
7793
- "lib.esnext.disposable.d.ts",
7794
- "lib.esnext.full.d.ts",
7795
- "lib.esnext.intl.d.ts",
7796
- "lib.esnext.promise.d.ts",
7797
- "lib.esnext.string.d.ts",
7798
- "lib.esnext.symbol.d.ts",
7799
- "lib.esnext.weakref.d.ts"
7800
- ];
7801
- var targetToCut = ts.ScriptTarget[target];
7802
- var matches = files.filter(function(f) {
7803
- return f.startsWith("lib." + targetToCut.toLowerCase());
7804
- });
7805
- var targetCutIndex = files.indexOf(matches.pop());
7806
- var libCutIndex = function getMax(array) {
7807
- return array && array.length ? array.reduce(function(max, current) {
7808
- return current > max ? current : max;
7809
- }) : void 0;
7810
- }(lib.map(function(lib) {
7811
- var matches = files.filter(function(f) {
7812
- return f.startsWith("lib." + lib.toLowerCase());
7813
- });
7814
- if (matches.length === 0) return 0;
7815
- return files.indexOf(matches.pop());
7816
- })) || 0;
7817
- var finalCutIndex = Math.max(targetCutIndex, libCutIndex);
7818
- return files.slice(0, finalCutIndex + 1);
7819
- };
7820
- /**
7821
- * Sets up a Map with lib contents by grabbing the necessary files from
7822
- * the local copy of typescript via the file system.
7823
- *
7824
- * The first two args are un-used, but kept around so as to not cause a
7825
- * semver major bump for no gain to module users.
7826
- */
7827
- var createDefaultMapFromNodeModules = function createDefaultMapFromNodeModules(_compilerOptions, _ts, tsLibDirectory) {
7828
- var path = requirePath();
7829
- var fs = requireFS();
7830
- var getLib = function getLib(name) {
7831
- var lib = tsLibDirectory || path.dirname(__require.resolve("typescript"));
7832
- return fs.readFileSync(path.join(lib, name), "utf8");
7833
- };
7834
- var knownLibFiles = fs.readdirSync(tsLibDirectory || path.dirname(__require.resolve("typescript"))).filter(function(f) {
7835
- return f.startsWith("lib.") && f.endsWith(".d.ts");
7836
- });
7837
- var fsMap = /* @__PURE__ */ new Map();
7838
- knownLibFiles.forEach(function(lib) {
7839
- fsMap.set("/" + lib, getLib(lib));
7840
- });
7841
- return fsMap;
7842
- };
7843
- /**
7844
- * Adds recursively files from the FS into the map based on the folder
7845
- */
7846
- var addAllFilesFromFolder = function addAllFilesFromFolder(map, workingDir) {
7847
- var path = requirePath();
7848
- var fs = requireFS();
7849
- (function walk(dir) {
7850
- var results = [];
7851
- fs.readdirSync(dir).forEach(function(file) {
7852
- file = path.join(dir, file);
7853
- var stat = fs.statSync(file);
7854
- if (stat && stat.isDirectory()) results = results.concat(walk(file));
7855
- else results.push(file);
7856
- });
7857
- return results;
7858
- })(workingDir).forEach(function(lib) {
7859
- var fsPath = "/node_modules/@types" + lib.replace(workingDir, "");
7860
- var content = fs.readFileSync(lib, "utf8");
7861
- if ([".ts", ".tsx"].includes(path.extname(fsPath))) map.set(fsPath, content);
7862
- });
7863
- };
7864
- /** Adds all files from node_modules/@types into the FS Map */
7865
- var addFilesForTypesIntoFolder = function addFilesForTypesIntoFolder(map) {
7866
- return addAllFilesFromFolder(map, "node_modules/@types");
7867
- };
7868
- /**
7869
- * Create a virtual FS Map with the lib files from a particular TypeScript
7870
- * version based on the target, Always includes dom ATM.
7871
- *
7872
- * @param options The compiler target, which dictates the libs to set up
7873
- * @param version the versions of TypeScript which are supported
7874
- * @param cache should the values be stored in local storage
7875
- * @param ts a copy of the typescript import
7876
- * @param lzstring an optional copy of the lz-string import
7877
- * @param fetcher an optional replacement for the global fetch function (tests mainly)
7878
- * @param storer an optional replacement for the localStorage global (tests mainly)
7879
- */
7880
- var createDefaultMapFromCDN = function createDefaultMapFromCDN(options, version, cache, ts, lzstring, fetcher, storer) {
7881
- var fetchlike = fetcher || fetch;
7882
- var fsMap = /* @__PURE__ */ new Map();
7883
- var files = knownLibFilesForCompilerOptions(options, ts);
7884
- var prefix = "https://typescript.azureedge.net/cdn/" + version + "/typescript/lib/";
7885
- function zip(str) {
7886
- return lzstring ? lzstring.compressToUTF16(str) : str;
7887
- }
7888
- function unzip(str) {
7889
- return lzstring ? lzstring.decompressFromUTF16(str) : str;
7890
- }
7891
- function uncached() {
7892
- return Promise.all(files.map(function(lib) {
7893
- return fetchlike(prefix + lib).then(function(resp) {
7894
- return resp.text();
7895
- });
7896
- })).then(function(contents) {
7897
- contents.forEach(function(text, index) {
7898
- return fsMap.set("/" + files[index], text);
7899
- });
7900
- })["catch"](function() {});
7901
- }
7902
- function cached() {
7903
- var storelike = storer || localStorage;
7904
- Object.keys(storelike).forEach(function(key) {
7905
- if (key.startsWith("ts-lib-") && !key.startsWith("ts-lib-" + version)) storelike.removeItem(key);
7906
- });
7907
- return Promise.all(files.map(function(lib) {
7908
- var cacheKey = "ts-lib-" + version + "-" + lib;
7909
- var content = storelike.getItem(cacheKey);
7910
- if (!content) return fetchlike(prefix + lib).then(function(resp) {
7911
- return resp.text();
7912
- }).then(function(t) {
7913
- storelike.setItem(cacheKey, zip(t));
7914
- return t;
7915
- })["catch"](function() {});
7916
- else return Promise.resolve(unzip(content));
7917
- })).then(function(contents) {
7918
- contents.forEach(function(text, index) {
7919
- if (text) {
7920
- var name = "/" + files[index];
7921
- fsMap.set(name, text);
7922
- }
7923
- });
7924
- });
7925
- }
7926
- return (cache ? cached : uncached)().then(function() {
7927
- return fsMap;
7928
- });
7929
- };
7930
- function notImplemented(methodName) {
7931
- throw new Error("Method '" + methodName + "' is not implemented.");
7932
- }
7933
- function audit(name, fn) {
7934
- return function() {
7935
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
7936
- var res = fn.apply(void 0, args);
7937
- var smallres = typeof res === "string" ? res.slice(0, 80) + "..." : res;
7938
- debugLog.apply(void 0, ["> " + name].concat(args));
7939
- debugLog("< " + smallres);
7940
- return res;
7941
- };
7942
- }
7943
- /** The default compiler options if TypeScript could ever change the compiler options */
7944
- var defaultCompilerOptions = function defaultCompilerOptions(ts) {
7945
- return _extends({}, ts.getDefaultCompilerOptions(), {
7946
- jsx: ts.JsxEmit.React,
7947
- strict: true,
7948
- esModuleInterop: true,
7949
- module: ts.ModuleKind.ESNext,
7950
- suppressOutputPathCheck: true,
7951
- skipLibCheck: true,
7952
- skipDefaultLibCheck: true,
7953
- moduleResolution: ts.ModuleResolutionKind.NodeJs
7954
- });
7955
- };
7956
- var libize = function libize(path) {
7957
- return path.replace("/", "/lib.").toLowerCase();
7958
- };
7959
- /**
7960
- * Creates an in-memory System object which can be used in a TypeScript program, this
7961
- * is what provides read/write aspects of the virtual fs
7962
- */
7963
- function createSystem(files) {
7964
- return {
7965
- args: [],
7966
- createDirectory: function createDirectory() {
7967
- return notImplemented("createDirectory");
7968
- },
7969
- directoryExists: audit("directoryExists", function(directory) {
7970
- return Array.from(files.keys()).some(function(path) {
7971
- return path.startsWith(directory);
7972
- });
7973
- }),
7974
- exit: function exit() {
7975
- return notImplemented("exit");
7976
- },
7977
- fileExists: audit("fileExists", function(fileName) {
7978
- return files.has(fileName) || files.has(libize(fileName));
7979
- }),
7980
- getCurrentDirectory: function getCurrentDirectory() {
7981
- return "/";
7982
- },
7983
- getDirectories: function getDirectories() {
7984
- return [];
7985
- },
7986
- getExecutingFilePath: function getExecutingFilePath() {
7987
- return notImplemented("getExecutingFilePath");
7988
- },
7989
- readDirectory: audit("readDirectory", function(directory) {
7990
- return directory === "/" ? Array.from(files.keys()) : [];
7991
- }),
7992
- readFile: audit("readFile", function(fileName) {
7993
- return files.get(fileName) || files.get(libize(fileName));
7994
- }),
7995
- resolvePath: function resolvePath(path) {
7996
- return path;
7997
- },
7998
- newLine: "\n",
7999
- useCaseSensitiveFileNames: true,
8000
- write: function write() {
8001
- return notImplemented("write");
8002
- },
8003
- writeFile: function writeFile(fileName, contents) {
8004
- files.set(fileName, contents);
8005
- }
8006
- };
8007
- }
8008
- /**
8009
- * Creates a file-system backed System object which can be used in a TypeScript program, you provide
8010
- * a set of virtual files which are prioritised over the FS versions, then a path to the root of your
8011
- * project (basically the folder your node_modules lives)
8012
- */
8013
- function createFSBackedSystem(files, _projectRoot, ts, tsLibDirectory) {
8014
- var root = _projectRoot + "/vfs";
8015
- var path = requirePath();
8016
- var nodeSys = ts.sys;
8017
- var tsLib = tsLibDirectory != null ? tsLibDirectory : path.dirname(__require.resolve("typescript"));
8018
- return {
8019
- name: "fs-vfs",
8020
- root,
8021
- args: [],
8022
- createDirectory: function createDirectory() {
8023
- return notImplemented("createDirectory");
8024
- },
8025
- directoryExists: audit("directoryExists", function(directory) {
8026
- return Array.from(files.keys()).some(function(path) {
8027
- return path.startsWith(directory);
8028
- }) || nodeSys.directoryExists(directory);
8029
- }),
8030
- exit: nodeSys.exit,
8031
- fileExists: audit("fileExists", function(fileName) {
8032
- if (files.has(fileName)) return true;
8033
- if (fileName.includes("tsconfig.json") || fileName.includes("tsconfig.json")) return false;
8034
- if (fileName.startsWith("/lib")) {
8035
- var tsLibName = tsLib + "/" + fileName.replace("/", "");
8036
- return nodeSys.fileExists(tsLibName);
8037
- }
8038
- return nodeSys.fileExists(fileName);
8039
- }),
8040
- getCurrentDirectory: function getCurrentDirectory() {
8041
- return root;
8042
- },
8043
- getDirectories: nodeSys.getDirectories,
8044
- getExecutingFilePath: function getExecutingFilePath() {
8045
- return notImplemented("getExecutingFilePath");
8046
- },
8047
- readDirectory: audit("readDirectory", function() {
8048
- if ((arguments.length <= 0 ? void 0 : arguments[0]) === "/") return Array.from(files.keys());
8049
- else return nodeSys.readDirectory.apply(nodeSys, arguments);
8050
- }),
8051
- readFile: audit("readFile", function(fileName) {
8052
- if (files.has(fileName)) return files.get(fileName);
8053
- if (fileName.startsWith("/lib")) {
8054
- var tsLibName = tsLib + "/" + fileName.replace("/", "");
8055
- var result = nodeSys.readFile(tsLibName);
8056
- if (!result) {
8057
- var libs = nodeSys.readDirectory(tsLib);
8058
- throw new Error("TSVFS: A request was made for " + tsLibName + " but there wasn't a file found in the file map. You likely have a mismatch in the compiler options for the CDN download vs the compiler program. Existing Libs: " + libs + ".");
8059
- }
8060
- return result;
8061
- }
8062
- return nodeSys.readFile(fileName);
8063
- }),
8064
- resolvePath: function resolvePath(path) {
8065
- if (files.has(path)) return path;
8066
- return nodeSys.resolvePath(path);
8067
- },
8068
- newLine: "\n",
8069
- useCaseSensitiveFileNames: true,
8070
- write: function write() {
8071
- return notImplemented("write");
8072
- },
8073
- writeFile: function writeFile(fileName, contents) {
8074
- files.set(fileName, contents);
8075
- }
8076
- };
8077
- }
8078
- /**
8079
- * Creates an in-memory CompilerHost -which is essentially an extra wrapper to System
8080
- * which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile
8081
- * instances to the in-memory file system.
8082
- */
8083
- function createVirtualCompilerHost(sys, compilerOptions, ts) {
8084
- var sourceFiles = /* @__PURE__ */ new Map();
8085
- var save = function save(sourceFile) {
8086
- sourceFiles.set(sourceFile.fileName, sourceFile);
8087
- return sourceFile;
8088
- };
8089
- return {
8090
- compilerHost: _extends({}, sys, {
8091
- getCanonicalFileName: function getCanonicalFileName(fileName) {
8092
- return fileName;
8093
- },
8094
- getDefaultLibFileName: function getDefaultLibFileName() {
8095
- return "/" + ts.getDefaultLibFileName(compilerOptions);
8096
- },
8097
- getDirectories: function getDirectories() {
8098
- return [];
8099
- },
8100
- getNewLine: function getNewLine() {
8101
- return sys.newLine;
8102
- },
8103
- getSourceFile: function getSourceFile(fileName) {
8104
- return sourceFiles.get(fileName) || save(ts.createSourceFile(fileName, sys.readFile(fileName), compilerOptions.target || defaultCompilerOptions(ts).target, false));
8105
- },
8106
- useCaseSensitiveFileNames: function useCaseSensitiveFileNames() {
8107
- return sys.useCaseSensitiveFileNames;
8108
- }
8109
- }),
8110
- updateFile: function updateFile(sourceFile) {
8111
- var alreadyExists = sourceFiles.has(sourceFile.fileName);
8112
- sys.writeFile(sourceFile.fileName, sourceFile.text);
8113
- sourceFiles.set(sourceFile.fileName, sourceFile);
8114
- return alreadyExists;
8115
- }
8116
- };
8117
- }
8118
- /**
8119
- * Creates an object which can host a language service against the virtual file-system
8120
- */
8121
- function createVirtualLanguageServiceHost(sys, rootFiles, compilerOptions, ts, customTransformers) {
8122
- var fileNames = [].concat(rootFiles);
8123
- var _createVirtualCompile = createVirtualCompilerHost(sys, compilerOptions, ts), compilerHost = _createVirtualCompile.compilerHost, _updateFile2 = _createVirtualCompile.updateFile;
8124
- var fileVersions = /* @__PURE__ */ new Map();
8125
- var projectVersion = 0;
8126
- return {
8127
- languageServiceHost: _extends({}, compilerHost, {
8128
- getProjectVersion: function getProjectVersion() {
8129
- return projectVersion.toString();
8130
- },
8131
- getCompilationSettings: function getCompilationSettings() {
8132
- return compilerOptions;
8133
- },
8134
- getCustomTransformers: function getCustomTransformers() {
8135
- return customTransformers;
8136
- },
8137
- getScriptFileNames: function getScriptFileNames() {
8138
- return fileNames.slice();
8139
- },
8140
- getScriptSnapshot: function getScriptSnapshot(fileName) {
8141
- var contents = sys.readFile(fileName);
8142
- if (contents) return ts.ScriptSnapshot.fromString(contents);
8143
- },
8144
- getScriptVersion: function getScriptVersion(fileName) {
8145
- return fileVersions.get(fileName) || "0";
8146
- },
8147
- writeFile: sys.writeFile
8148
- }),
8149
- updateFile: function updateFile(sourceFile) {
8150
- projectVersion++;
8151
- fileVersions.set(sourceFile.fileName, projectVersion.toString());
8152
- if (!fileNames.includes(sourceFile.fileName)) fileNames.push(sourceFile.fileName);
8153
- _updateFile2(sourceFile);
8154
- }
8155
- };
8156
- }
8157
- var requirePath = function requirePath() {
8158
- return __require(String.fromCharCode(112, 97, 116, 104));
8159
- };
8160
- var requireFS = function requireFS() {
8161
- return __require(String.fromCharCode(102, 115));
8162
- };
8163
- exports.addAllFilesFromFolder = addAllFilesFromFolder;
8164
- exports.addFilesForTypesIntoFolder = addFilesForTypesIntoFolder;
8165
- exports.createDefaultMapFromCDN = createDefaultMapFromCDN;
8166
- exports.createDefaultMapFromNodeModules = createDefaultMapFromNodeModules;
8167
- exports.createFSBackedSystem = createFSBackedSystem;
8168
- exports.createSystem = createSystem;
8169
- exports.createVirtualCompilerHost = createVirtualCompilerHost;
8170
- exports.createVirtualLanguageServiceHost = createVirtualLanguageServiceHost;
8171
- exports.createVirtualTypeScriptEnvironment = createVirtualTypeScriptEnvironment;
8172
- exports.knownLibFilesForCompilerOptions = knownLibFilesForCompilerOptions;
8173
- }));
8174
-
8175
- //#endregion
8176
- //#region ../../../node_modules/.pnpm/@typescript+vfs@1.5.0/node_modules/@typescript/vfs/dist/index.js
8177
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8178
- if (process.env.NODE_ENV === "production") module.exports = require_vfs_cjs_production_min();
8179
- else module.exports = require_vfs_cjs_development();
8180
- }));
8181
-
8182
7234
  //#endregion
8183
7235
  //#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=bd438188cbc12e606ed4d519c25ab921a833fbc2d92357_eb3d1bbe57b0b2f8921a5c1688746a82/node_modules/@deepkit/type-compiler/dist/esm/src/debug.js
8184
- var import_dist = require_dist();
8185
7236
  function isDebug(level = 1) {
8186
7237
  const expected = "deepkit" + (level > 1 ? "+".repeat(level - 1) : "");
8187
7238
  return "undefined" !== typeof process && "string" === typeof process.env.DEBUG && process.env.DEBUG.includes(expected);
@@ -9446,7 +8497,7 @@ var ReflectionTransformer = class {
9446
8497
  this.cache.globalSourceFiles = [];
9447
8498
  const options = { ...this.compilerOptions };
9448
8499
  if (options.target && options.target === ScriptTarget.ESNext) options.target = ScriptTarget.ES2022;
9449
- const libs = (0, import_dist.knownLibFilesForCompilerOptions)(options, ts);
8500
+ const libs = knownLibFilesForCompilerOptions(options, ts);
9450
8501
  for (const lib of libs) {
9451
8502
  if (this.isExcluded(lib)) continue;
9452
8503
  const sourceFile = this.resolver.resolveSourceFile(this.sourceFile, this.f.createStringLiteral("typescript/lib/" + lib.replace(".d.ts", "")));
@@ -9531,9 +8582,10 @@ var ReflectionTransformer = class {
9531
8582
  * via the exclude option. mainly used to exclude globals and external libraries.
9532
8583
  */
9533
8584
  isExcluded(fileName) {
8585
+ const resolver = this.overriddenConfigResolver || getConfigResolver(this.cache.resolver, this.parseConfigHost, this.compilerOptions, this.sourceFile);
9534
8586
  return reflectionModeMatcher({
9535
8587
  reflection: "default",
9536
- exclude: (this.overriddenConfigResolver || getConfigResolver(this.cache.resolver, this.parseConfigHost, this.compilerOptions, this.sourceFile)).config.exclude
8588
+ exclude: resolver.config.exclude
9537
8589
  }, fileName) === "never";
9538
8590
  }
9539
8591
  extractPackStructOfTypeReference(type, program) {
@@ -10153,4 +9205,4 @@ var DeepkitLoader = class {
10153
9205
 
10154
9206
  //#endregion
10155
9207
  export { debugPackStruct as a, packSize as c, ReflectionTransformer as i, packSizeByte as l, Cache as n, declarationTransformer as o, DeclarationTransformer as r, encodeOps as s, DeepkitLoader as t, transformer as u };
10156
- //# sourceMappingURL=deepkit-BUz4LI7V.mjs.map
9208
+ //# sourceMappingURL=deepkit-9Y_7fx_M.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepkit-9Y_7fx_M.mjs","names":[],"sources":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
1
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
2
2
  let typescript = require("typescript");
3
3
  typescript = require_rolldown_runtime.__toESM(typescript, 1);
4
4
  let _deepkit_type_spec = require("@deepkit/type-spec");
@@ -4951,7 +4951,7 @@ var require_constants = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin((
4951
4951
  };
4952
4952
  module.exports = {
4953
4953
  DEFAULT_MAX_EXTGLOB_RECURSION,
4954
- MAX_LENGTH: 1024 * 64,
4954
+ MAX_LENGTH: 65536,
4955
4955
  POSIX_REGEX_SOURCE,
4956
4956
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
4957
4957
  REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
@@ -9503,9 +9503,10 @@ var ReflectionTransformer = class {
9503
9503
  * via the exclude option. mainly used to exclude globals and external libraries.
9504
9504
  */
9505
9505
  isExcluded(fileName) {
9506
+ const resolver = this.overriddenConfigResolver || getConfigResolver(this.cache.resolver, this.parseConfigHost, this.compilerOptions, this.sourceFile);
9506
9507
  return reflectionModeMatcher({
9507
9508
  reflection: "default",
9508
- exclude: (this.overriddenConfigResolver || getConfigResolver(this.cache.resolver, this.parseConfigHost, this.compilerOptions, this.sourceFile)).config.exclude
9509
+ exclude: resolver.config.exclude
9509
9510
  }, fileName) === "never";
9510
9511
  }
9511
9512
  extractPackStructOfTypeReference(type, program) {
package/dist/deepkit.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_deepkit = require('./deepkit-CzTuG3HO.cjs');
2
+ const require_deepkit = require('./deepkit-CbloIjxN.cjs');
3
3
 
4
4
  exports.Cache = require_deepkit.Cache;
5
5
  exports.DeclarationTransformer = require_deepkit.DeclarationTransformer;
package/dist/deepkit.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as debugPackStruct, c as packSize, i as ReflectionTransformer, l as packSizeByte, n as Cache, o as declarationTransformer, r as DeclarationTransformer, s as encodeOps, t as DeepkitLoader, u as transformer } from "./deepkit-BUz4LI7V.mjs";
1
+ import { a as debugPackStruct, c as packSize, i as ReflectionTransformer, l as packSizeByte, n as Cache, o as declarationTransformer, r as DeclarationTransformer, s as encodeOps, t as DeepkitLoader, u as transformer } from "./deepkit-9Y_7fx_M.mjs";
2
2
 
3
3
  export { Cache, DeclarationTransformer, DeepkitLoader, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer };
@@ -1,5 +1,5 @@
1
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
2
- const require_constants = require('./constants-DUJjv-fA.cjs');
1
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
2
+ const require_constants = require('./constants-CPMTQEYP.cjs');
3
3
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
4
4
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
5
5
  let _stryke_type_checks = require("@stryke/type-checks");
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
3
- const require_constants = require('./constants-DUJjv-fA.cjs');
4
- const require_helpers = require('./helpers-on-hD-7R.cjs');
5
- const require_deepkit = require('./deepkit-CzTuG3HO.cjs');
2
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
3
+ const require_constants = require('./constants-CPMTQEYP.cjs');
4
+ const require_helpers = require('./helpers-LhLPb88g.cjs');
5
+ const require_deepkit = require('./deepkit-CbloIjxN.cjs');
6
6
  const require_codegen = require('./codegen.cjs');
7
- const require_storage = require('./storage-C8Lnl5Hw.cjs');
7
+ const require_storage = require('./storage-BTI2epDz.cjs');
8
8
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
9
9
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
10
10
  let _stryke_type_checks = require("@stryke/type-checks");
@@ -1106,7 +1106,7 @@ async function extractSchemaWithSource(input, options = {}) {
1106
1106
  if (extension && !_stryke_resolve_constants.VALID_OBJECT_SOURCE_EXTENSIONS.includes(extension)) throw new Error(`The provided schema file input "${fileReference.file}" has an invalid file extension (.${extension}). Please ensure that the file has one of the following extensions: ${(0, _stryke_string_format_list.list)(_stryke_resolve_constants.VALID_OBJECT_SOURCE_EXTENSIONS, { conjunction: "or" })}.`);
1107
1107
  let fs;
1108
1108
  if (options.storage) fs = require_storage.mapStorageToFileSystem(options.storage);
1109
- let resolved = await (0, _stryke_resolve_load.loadSafe)(unwrapped, {
1109
+ const loadOptions = {
1110
1110
  ...(0, _stryke_helpers_omit.omit)(options, [
1111
1111
  "storage",
1112
1112
  "logger",
@@ -1114,7 +1114,8 @@ async function extractSchemaWithSource(input, options = {}) {
1114
1114
  ]),
1115
1115
  fs,
1116
1116
  cwd: options.cwd ?? void 0
1117
- });
1117
+ };
1118
+ let resolved = await (0, _stryke_resolve_load.loadSafe)(unwrapped, loadOptions);
1118
1119
  resolved ??= await extractTSType(unwrapped, {
1119
1120
  ...options,
1120
1121
  fs
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { i as ReflectionTransformer, n as Cache, r as DeclarationTransformer } from "./deepkit-BUz4LI7V.mjs";
1
+ import { i as ReflectionTransformer, n as Cache, r as DeclarationTransformer } from "./deepkit-9Y_7fx_M.mjs";
2
2
  import { a as JSON_SCHEMA_TYPES, c as SCHEMA_RECORD_KEYWORDS, i as JSON_SCHEMA_PRIMITIVE_TYPES, l as SCHEMA_SINGLE_KEYWORDS, n as JSON_SCHEMA_CONSTRUCTOR_KEY, o as JsonSchemaTypeNames, r as JSON_SCHEMA_METADATA_KEYS, s as SCHEMA_ARRAY_CONCAT_KEYWORDS, t as JSON_SCHEMA_ANY } from "./constants-D0asFRyy.mjs";
3
3
  import { $ as isUntypedConfig, A as isJsonSchemaNativeEnum, B as isJsonSchemaSet, C as isJsonSchemaDate, D as isJsonSchemaKeywords, E as isJsonSchemaInteger, F as isJsonSchemaObject, G as isJsonSchemaUnion, H as isJsonSchemaTuple, I as isJsonSchemaPrimitiveType, J as isSchema, K as isJsonSchemaUnknown, L as isJsonSchemaPrimitiveUnion, M as isJsonSchemaNull, N as isJsonSchemaNullable, O as isJsonSchemaLiteral, P as isJsonSchemaNumber, Q as isStandardSchema, R as isJsonSchemaRecord, S as isJsonSchemaBoolean, T as isJsonSchemaEnum, U as isJsonSchemaType, V as isJsonSchemaString, W as isJsonSchemaUndefined, X as isSchemaOf, Y as isSchemaObject, Z as isSchemaWithSource, _ as isJsonSchemaAllOf, a as getPropertiesList, at as isValibotSchema, b as isJsonSchemaArray, c as isSchemaNullable, ct as readSchemaTypes, d as merge, et as isUntypedConfigStrict, f as mergeMetadata, g as isJsonSchema, h as isFileReference, i as getProperties, it as isUntypedSchemaStrict, j as isJsonSchemaNever, k as isJsonSchemaMap, l as isValidSchemaConfigFile, m as hasJsonSchemaConstructorFlag, n as getJsonSchema, nt as isUntypedInputStrict, o as getProperty, ot as applyJsonSchemaMetadata, p as traverseSchema, q as isNullOnlyJsonSchema, r as getJsonSchemaObject, rt as isUntypedSchema, s as isPropertyOptional, st as getPrimarySchemaType, t as addProperty, tt as isUntypedInput, u as isValidSchemaInputFile, v as isJsonSchemaAny, w as isJsonSchemaDecimal, x as isJsonSchemaBigint, y as isJsonSchemaAnyOf, z as isJsonSchemaRef } from "./helpers-BCP4VzlJ.mjs";
4
4
  import { getJsonSchemaType } from "./codegen.mjs";
5
- import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./storage-C3BT2Xh-.mjs";
5
+ import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./storage-DuoqLXEu.mjs";
6
6
  import { isSetObject } from "@stryke/type-checks/is-set-object";
7
7
  import { isSetString } from "@stryke/type-checks/is-set-string";
8
8
  import { isBigInt, isBoolean, isEmptyObject, isInteger, isNull, isNumber, isObject, isRegExp, isSetArray, isSetObject as isSetObject$1, isSetString as isSetString$1, isString, isUndefined } from "@stryke/type-checks";
@@ -1102,7 +1102,7 @@ async function extractSchemaWithSource(input, options = {}) {
1102
1102
  if (extension && !VALID_OBJECT_SOURCE_EXTENSIONS.includes(extension)) throw new Error(`The provided schema file input "${fileReference.file}" has an invalid file extension (.${extension}). Please ensure that the file has one of the following extensions: ${list(VALID_OBJECT_SOURCE_EXTENSIONS, { conjunction: "or" })}.`);
1103
1103
  let fs;
1104
1104
  if (options.storage) fs = mapStorageToFileSystem(options.storage);
1105
- let resolved = await loadSafe(unwrapped, {
1105
+ const loadOptions = {
1106
1106
  ...omit(options, [
1107
1107
  "storage",
1108
1108
  "logger",
@@ -1110,7 +1110,8 @@ async function extractSchemaWithSource(input, options = {}) {
1110
1110
  ]),
1111
1111
  fs,
1112
1112
  cwd: options.cwd ?? void 0
1113
- });
1113
+ };
1114
+ let resolved = await loadSafe(unwrapped, loadOptions);
1114
1115
  resolved ??= await extractTSType(unwrapped, {
1115
1116
  ...options,
1116
1117
  fs
@@ -20,13 +20,12 @@ var __copyProps = (to, from, except, desc) => {
20
20
  }
21
21
  return to;
22
22
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
24
  value: mod,
25
25
  enumerable: true
26
26
  }) : target, mod));
27
27
 
28
28
  //#endregion
29
-
30
29
  Object.defineProperty(exports, '__commonJSMin', {
31
30
  enumerable: true,
32
31
  get: function () {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_storage = require('../storage-C8Lnl5Hw.cjs');
2
+ const require_storage = require('../storage-BTI2epDz.cjs');
3
3
 
4
4
  exports.createStoragePromises = require_storage.createStoragePromises;
5
5
  exports.mapStorageToFileSystem = require_storage.mapStorageToFileSystem;
@@ -1,3 +1,3 @@
1
- import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "../storage-C3BT2Xh-.mjs";
1
+ import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "../storage-DuoqLXEu.mjs";
2
2
 
3
3
  export { createStoragePromises, mapStorageToFileSystem, normalizeKey };
@@ -1,4 +1,4 @@
1
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
1
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
2
2
  let node_events = require("node:events");
3
3
  let node_fs = require("node:fs");
4
4
  node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
@@ -176,7 +176,8 @@ function createStoragePromises(storage) {
176
176
  type: "file",
177
177
  meta
178
178
  };
179
- if (getImmediateChildren(key, (await storage.getKeys(key)).filter((storageKey) => storageKey !== key && !isMetaStorageKey(storageKey))).length > 0) return {
179
+ const keys = await storage.getKeys(key);
180
+ if (getImmediateChildren(key, keys.filter((storageKey) => storageKey !== key && !isMetaStorageKey(storageKey))).length > 0) return {
180
181
  key,
181
182
  type: "directory",
182
183
  meta
@@ -240,7 +241,8 @@ function createStoragePromises(storage) {
240
241
  const keys = await storage.getKeys(source);
241
242
  for (const key of keys) {
242
243
  if (isMetaStorageKey(key) || key === source) continue;
243
- await copyEntry(key, resolveKey(destination, key.slice(source.length).replace(/^\//, "")), true);
244
+ const relative = key.slice(source.length).replace(/^\//, "");
245
+ await copyEntry(key, resolveKey(destination, relative), true);
244
246
  }
245
247
  return;
246
248
  }
@@ -175,7 +175,8 @@ function createStoragePromises(storage) {
175
175
  type: "file",
176
176
  meta
177
177
  };
178
- if (getImmediateChildren(key, (await storage.getKeys(key)).filter((storageKey) => storageKey !== key && !isMetaStorageKey(storageKey))).length > 0) return {
178
+ const keys = await storage.getKeys(key);
179
+ if (getImmediateChildren(key, keys.filter((storageKey) => storageKey !== key && !isMetaStorageKey(storageKey))).length > 0) return {
179
180
  key,
180
181
  type: "directory",
181
182
  meta
@@ -239,7 +240,8 @@ function createStoragePromises(storage) {
239
240
  const keys = await storage.getKeys(source);
240
241
  for (const key of keys) {
241
242
  if (isMetaStorageKey(key) || key === source) continue;
242
- await copyEntry(key, resolveKey(destination, key.slice(source.length).replace(/^\//, "")), true);
243
+ const relative = key.slice(source.length).replace(/^\//, "");
244
+ await copyEntry(key, resolveKey(destination, relative), true);
243
245
  }
244
246
  return;
245
247
  }
@@ -914,4 +916,4 @@ function mapStorageToFileSystem(storage) {
914
916
 
915
917
  //#endregion
916
918
  export { createStoragePromises as n, normalizeKey as r, mapStorageToFileSystem as t };
917
- //# sourceMappingURL=storage-C3BT2Xh-.mjs.map
919
+ //# sourceMappingURL=storage-DuoqLXEu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-DuoqLXEu.mjs","names":[],"sources":[],"mappings":""}
package/dist/valibot.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
3
- const require_constants = require('./constants-DUJjv-fA.cjs');
2
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
3
+ const require_constants = require('./constants-CPMTQEYP.cjs');
4
4
  let valibot = require("valibot");
5
5
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
6
6
 
package/dist/zod.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_rolldown_runtime = require('./rolldown-runtime-fl3r8ClO.cjs');
3
- const require_constants = require('./constants-DUJjv-fA.cjs');
4
- const require_helpers = require('./helpers-on-hD-7R.cjs');
2
+ const require_rolldown_runtime = require('./rolldown-runtime-7nYvXII6.cjs');
3
+ const require_constants = require('./constants-CPMTQEYP.cjs');
4
+ const require_helpers = require('./helpers-LhLPb88g.cjs');
5
5
  let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
6
6
  let zod_mini = require("zod/mini");
7
7
  zod_mini = require_rolldown_runtime.__toESM(zod_mini, 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-plant/schema",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "private": false,
5
5
  "description": "A Power Plant utility package to help managing schemas.",
6
6
  "keywords": [
@@ -160,9 +160,9 @@
160
160
  },
161
161
  "devDependencies": {
162
162
  "@deepkit/type-compiler": "1.0.19",
163
- "@powerlines/plugin-tsdown": "^0.1.575",
163
+ "@powerlines/plugin-tsdown": "^0.1.577",
164
164
  "@types/node": "^25.9.5",
165
- "powerlines": "^0.47.174",
165
+ "powerlines": "^0.47.176",
166
166
  "valibot": "^1.4.2",
167
167
  "zod": "^4.4.3"
168
168
  },
@@ -187,5 +187,5 @@
187
187
  "picomatch": "2.3.2",
188
188
  "to-regex-range": "5.0.1"
189
189
  },
190
- "gitHead": "ab229a0aa930c1abf4b107ac76d0dc4c90a2b98c"
190
+ "gitHead": "a5044cb35d338104f8a9383a57e16f623c2eac9d"
191
191
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"deepkit-BUz4LI7V.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-C3BT2Xh-.mjs","names":[],"sources":[],"mappings":""}