tsgonest 0.11.2 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/migrate.cjs +220 -15
  2. package/package.json +10 -10
package/bin/migrate.cjs CHANGED
@@ -26,9 +26,6 @@ var require_typescript = /* @__PURE__ */ __commonJSMin(((exports, module) => {
26
26
  ((module$1) => {
27
27
  "use strict";
28
28
  var __defProp = Object.defineProperty;
29
- Object.getOwnPropertyDescriptor;
30
- Object.getOwnPropertyNames;
31
- Object.prototype.hasOwnProperty;
32
29
  var __export = (target, all) => {
33
30
  for (var name in all) __defProp(target, name, {
34
31
  get: all[name],
@@ -147182,7 +147179,7 @@ var require_commonjs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
147182
147179
  exports.range = range;
147183
147180
  }));
147184
147181
  //#endregion
147185
- //#region ../../node_modules/.pnpm/brace-expansion@5.0.4/node_modules/brace-expansion/dist/commonjs/index.js
147182
+ //#region ../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js
147186
147183
  var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
147187
147184
  Object.defineProperty(exports, "__esModule", { value: true });
147188
147185
  exports.EXPANSION_MAX = void 0;
@@ -147290,7 +147287,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
147290
147287
  const x = numeric(n[0]);
147291
147288
  const y = numeric(n[1]);
147292
147289
  const width = Math.max(n[0].length, n[1].length);
147293
- let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
147290
+ let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
147294
147291
  let test = lte;
147295
147292
  if (y < x) {
147296
147293
  incr *= -1;
@@ -149023,10 +149020,11 @@ var require_path_browserify = /* @__PURE__ */ __commonJSMin(((exports, module) =
149023
149020
  module.exports = posix;
149024
149021
  }));
149025
149022
  //#endregion
149026
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
149023
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
149027
149024
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149028
149025
  const WIN_SLASH = "\\\\/";
149029
149026
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
149027
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
149030
149028
  /**
149031
149029
  * Posix glob regex
149032
149030
  */
@@ -149076,8 +149074,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149076
149074
  SEP: "\\"
149077
149075
  };
149078
149076
  module.exports = {
149077
+ DEFAULT_MAX_EXTGLOB_RECURSION,
149079
149078
  MAX_LENGTH: 1024 * 64,
149080
149079
  POSIX_REGEX_SOURCE: {
149080
+ __proto__: null,
149081
149081
  alnum: "a-zA-Z0-9",
149082
149082
  alpha: "a-zA-Z",
149083
149083
  ascii: "\\x00-\\x7F",
@@ -149183,7 +149183,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149183
149183
  };
149184
149184
  }));
149185
149185
  //#endregion
149186
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
149186
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
149187
149187
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
149188
149188
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
149189
149189
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -149231,7 +149231,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
149231
149231
  };
149232
149232
  }));
149233
149233
  //#endregion
149234
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
149234
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
149235
149235
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149236
149236
  const utils = require_utils();
149237
149237
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
@@ -149518,7 +149518,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149518
149518
  module.exports = scan;
149519
149519
  }));
149520
149520
  //#endregion
149521
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
149521
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
149522
149522
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149523
149523
  const constants = require_constants();
149524
149524
  const utils = require_utils();
@@ -149546,6 +149546,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149546
149546
  const syntaxError = (type, char) => {
149547
149547
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
149548
149548
  };
149549
+ const splitTopLevel = (input) => {
149550
+ const parts = [];
149551
+ let bracket = 0;
149552
+ let paren = 0;
149553
+ let quote = 0;
149554
+ let value = "";
149555
+ let escaped = false;
149556
+ for (const ch of input) {
149557
+ if (escaped === true) {
149558
+ value += ch;
149559
+ escaped = false;
149560
+ continue;
149561
+ }
149562
+ if (ch === "\\") {
149563
+ value += ch;
149564
+ escaped = true;
149565
+ continue;
149566
+ }
149567
+ if (ch === "\"") {
149568
+ quote = quote === 1 ? 0 : 1;
149569
+ value += ch;
149570
+ continue;
149571
+ }
149572
+ if (quote === 0) {
149573
+ if (ch === "[") bracket++;
149574
+ else if (ch === "]" && bracket > 0) bracket--;
149575
+ else if (bracket === 0) {
149576
+ if (ch === "(") paren++;
149577
+ else if (ch === ")" && paren > 0) paren--;
149578
+ else if (ch === "|" && paren === 0) {
149579
+ parts.push(value);
149580
+ value = "";
149581
+ continue;
149582
+ }
149583
+ }
149584
+ }
149585
+ value += ch;
149586
+ }
149587
+ parts.push(value);
149588
+ return parts;
149589
+ };
149590
+ const isPlainBranch = (branch) => {
149591
+ let escaped = false;
149592
+ for (const ch of branch) {
149593
+ if (escaped === true) {
149594
+ escaped = false;
149595
+ continue;
149596
+ }
149597
+ if (ch === "\\") {
149598
+ escaped = true;
149599
+ continue;
149600
+ }
149601
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
149602
+ }
149603
+ return true;
149604
+ };
149605
+ const normalizeSimpleBranch = (branch) => {
149606
+ let value = branch.trim();
149607
+ let changed = true;
149608
+ while (changed === true) {
149609
+ changed = false;
149610
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
149611
+ value = value.slice(2, -1);
149612
+ changed = true;
149613
+ }
149614
+ }
149615
+ if (!isPlainBranch(value)) return;
149616
+ return value.replace(/\\(.)/g, "$1");
149617
+ };
149618
+ const hasRepeatedCharPrefixOverlap = (branches) => {
149619
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
149620
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
149621
+ const a = values[i];
149622
+ const b = values[j];
149623
+ const char = a[0];
149624
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
149625
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
149626
+ }
149627
+ return false;
149628
+ };
149629
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
149630
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
149631
+ let bracket = 0;
149632
+ let paren = 0;
149633
+ let quote = 0;
149634
+ let escaped = false;
149635
+ for (let i = 1; i < pattern.length; i++) {
149636
+ const ch = pattern[i];
149637
+ if (escaped === true) {
149638
+ escaped = false;
149639
+ continue;
149640
+ }
149641
+ if (ch === "\\") {
149642
+ escaped = true;
149643
+ continue;
149644
+ }
149645
+ if (ch === "\"") {
149646
+ quote = quote === 1 ? 0 : 1;
149647
+ continue;
149648
+ }
149649
+ if (quote === 1) continue;
149650
+ if (ch === "[") {
149651
+ bracket++;
149652
+ continue;
149653
+ }
149654
+ if (ch === "]" && bracket > 0) {
149655
+ bracket--;
149656
+ continue;
149657
+ }
149658
+ if (bracket > 0) continue;
149659
+ if (ch === "(") {
149660
+ paren++;
149661
+ continue;
149662
+ }
149663
+ if (ch === ")") {
149664
+ paren--;
149665
+ if (paren === 0) {
149666
+ if (requireEnd === true && i !== pattern.length - 1) return;
149667
+ return {
149668
+ type: pattern[0],
149669
+ body: pattern.slice(2, i),
149670
+ end: i
149671
+ };
149672
+ }
149673
+ }
149674
+ }
149675
+ };
149676
+ const getStarExtglobSequenceOutput = (pattern) => {
149677
+ let index = 0;
149678
+ const chars = [];
149679
+ while (index < pattern.length) {
149680
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
149681
+ if (!match || match.type !== "*") return;
149682
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
149683
+ if (branches.length !== 1) return;
149684
+ const branch = normalizeSimpleBranch(branches[0]);
149685
+ if (!branch || branch.length !== 1) return;
149686
+ chars.push(branch);
149687
+ index += match.end + 1;
149688
+ }
149689
+ if (chars.length < 1) return;
149690
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
149691
+ };
149692
+ const repeatedExtglobRecursion = (pattern) => {
149693
+ let depth = 0;
149694
+ let value = pattern.trim();
149695
+ let match = parseRepeatedExtglob(value);
149696
+ while (match) {
149697
+ depth++;
149698
+ value = match.body.trim();
149699
+ match = parseRepeatedExtglob(value);
149700
+ }
149701
+ return depth;
149702
+ };
149703
+ const analyzeRepeatedExtglob = (body, options) => {
149704
+ if (options.maxExtglobRecursion === false) return { risky: false };
149705
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
149706
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
149707
+ if (branches.length > 1) {
149708
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
149709
+ }
149710
+ for (const branch of branches) {
149711
+ const safeOutput = getStarExtglobSequenceOutput(branch);
149712
+ if (safeOutput) return {
149713
+ risky: true,
149714
+ safeOutput
149715
+ };
149716
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
149717
+ }
149718
+ return { risky: false };
149719
+ };
149549
149720
  /**
149550
149721
  * Parse the given input string.
149551
149722
  * @param {String} input
@@ -149675,6 +149846,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149675
149846
  token.prev = prev;
149676
149847
  token.parens = state.parens;
149677
149848
  token.output = state.output;
149849
+ token.startIndex = state.index;
149850
+ token.tokensIndex = tokens.length;
149678
149851
  const output = (opts.capture ? "(" : "") + token.open;
149679
149852
  increment("parens");
149680
149853
  push({
@@ -149691,6 +149864,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149691
149864
  extglobs.push(token);
149692
149865
  };
149693
149866
  const extglobClose = (token) => {
149867
+ const literal = input.slice(token.startIndex, state.index + 1);
149868
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
149869
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
149870
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
149871
+ const open = tokens[token.tokensIndex];
149872
+ open.type = "text";
149873
+ open.value = literal;
149874
+ open.output = safeOutput || utils.escapeRegex(literal);
149875
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
149876
+ tokens[i].value = "";
149877
+ tokens[i].output = "";
149878
+ delete tokens[i].suffix;
149879
+ }
149880
+ state.output = token.output + open.output;
149881
+ state.backtrack = true;
149882
+ push({
149883
+ type: "paren",
149884
+ extglob: true,
149885
+ value,
149886
+ output: ""
149887
+ });
149888
+ decrement("parens");
149889
+ return;
149890
+ }
149694
149891
  let output = token.close + (opts.capture ? ")" : "");
149695
149892
  let rest;
149696
149893
  if (token.type === "negate") {
@@ -150376,7 +150573,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150376
150573
  module.exports = parse;
150377
150574
  }));
150378
150575
  //#endregion
150379
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
150576
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
150380
150577
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150381
150578
  const scan = require_scan();
150382
150579
  const parse = require_parse();
@@ -150586,6 +150783,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150586
150783
  * Compile a regular expression from the `state` object returned by the
150587
150784
  * [parse()](#parse) method.
150588
150785
  *
150786
+ * ```js
150787
+ * const picomatch = require('picomatch');
150788
+ * const state = picomatch.parse('*.js');
150789
+ * // picomatch.compileRe(state[, options]);
150790
+ *
150791
+ * console.log(picomatch.compileRe(state));
150792
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
150793
+ * ```
150589
150794
  * @param {Object} `state`
150590
150795
  * @param {Object} `options`
150591
150796
  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
@@ -150609,10 +150814,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150609
150814
  *
150610
150815
  * ```js
150611
150816
  * const picomatch = require('picomatch');
150612
- * const state = picomatch.parse('*.js');
150613
- * // picomatch.compileRe(state[, options]);
150817
+ * // picomatch.makeRe(state[, options]);
150614
150818
  *
150615
- * console.log(picomatch.compileRe(state));
150819
+ * const result = picomatch.makeRe('*.js');
150820
+ * console.log(result);
150616
150821
  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
150617
150822
  * ```
150618
150823
  * @param {String} `state` The object returned from the `.parse` method.
@@ -150668,7 +150873,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150668
150873
  module.exports = picomatch;
150669
150874
  }));
150670
150875
  //#endregion
150671
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
150876
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js
150672
150877
  var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150673
150878
  const pico = require_picomatch$1();
150674
150879
  const utils = require_utils();
@@ -150683,7 +150888,7 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150683
150888
  module.exports = picomatch;
150684
150889
  }));
150685
150890
  //#endregion
150686
- //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.cjs
150891
+ //#region ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.cjs
150687
150892
  var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
150688
150893
  var __create = Object.create;
150689
150894
  var __defProp = Object.defineProperty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsgonest",
3
- "version": "0.11.2",
3
+ "version": "0.12.0",
4
4
  "description": "TypeScript compiler with runtime validation, serialization, and OpenAPI generation for NestJS",
5
5
  "keywords": [
6
6
  "typescript",
@@ -32,22 +32,22 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "jsonc-parser": "^3.3.1",
35
- "@tsgonest/runtime": "0.11.2",
36
- "@tsgonest/types": "0.11.2"
35
+ "@tsgonest/runtime": "0.12.0",
36
+ "@tsgonest/types": "0.12.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "ts-morph": "^27.0.2",
40
- "tsdown": "^0.21.4",
40
+ "tsdown": "^0.21.7",
41
41
  "typescript": "^5.8.0",
42
42
  "vitest": "^4.1.0"
43
43
  },
44
44
  "optionalDependencies": {
45
- "@tsgonest/cli-linux-arm64": "0.11.2",
46
- "@tsgonest/cli-darwin-arm64": "0.11.2",
47
- "@tsgonest/cli-win32-arm64": "0.11.2",
48
- "@tsgonest/cli-darwin-x64": "0.11.2",
49
- "@tsgonest/cli-win32-x64": "0.11.2",
50
- "@tsgonest/cli-linux-x64": "0.11.2"
45
+ "@tsgonest/cli-darwin-arm64": "0.12.0",
46
+ "@tsgonest/cli-darwin-x64": "0.12.0",
47
+ "@tsgonest/cli-linux-arm64": "0.12.0",
48
+ "@tsgonest/cli-win32-x64": "0.12.0",
49
+ "@tsgonest/cli-win32-arm64": "0.12.0",
50
+ "@tsgonest/cli-linux-x64": "0.12.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsdown",