@stryke/prisma-trpc-generator 0.8.1 → 0.8.2
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/generator.cjs +715 -718
- package/dist/generator.js +692 -695
- package/dist/index.cjs +715 -718
- package/dist/index.js +692 -695
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2504,21 +2504,6 @@ async function removeDirectory(path5) {
|
|
|
2504
2504
|
}
|
|
2505
2505
|
__name(removeDirectory, "removeDirectory");
|
|
2506
2506
|
|
|
2507
|
-
// ../path/src/file-path-fns.ts
|
|
2508
|
-
init_esm_shims();
|
|
2509
|
-
|
|
2510
|
-
// ../types/src/base.ts
|
|
2511
|
-
init_esm_shims();
|
|
2512
|
-
var EMPTY_STRING = "";
|
|
2513
|
-
var $NestedValue = Symbol("NestedValue");
|
|
2514
|
-
|
|
2515
|
-
// ../path/src/correct-path.ts
|
|
2516
|
-
init_esm_shims();
|
|
2517
|
-
|
|
2518
|
-
// ../path/src/is-file.ts
|
|
2519
|
-
init_esm_shims();
|
|
2520
|
-
import { lstatSync, statSync } from "node:fs";
|
|
2521
|
-
|
|
2522
2507
|
// ../path/src/join-paths.ts
|
|
2523
2508
|
init_esm_shims();
|
|
2524
2509
|
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
@@ -2647,375 +2632,45 @@ function normalizeString(path5, allowAboveRoot) {
|
|
|
2647
2632
|
}
|
|
2648
2633
|
__name(normalizeString, "normalizeString");
|
|
2649
2634
|
|
|
2650
|
-
// ../
|
|
2651
|
-
function isFile(path5, additionalPath) {
|
|
2652
|
-
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
2653
|
-
throwIfNoEntry: false
|
|
2654
|
-
})?.isFile());
|
|
2655
|
-
}
|
|
2656
|
-
__name(isFile, "isFile");
|
|
2657
|
-
function isDirectory(path5, additionalPath) {
|
|
2658
|
-
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
2659
|
-
throwIfNoEntry: false
|
|
2660
|
-
})?.isDirectory());
|
|
2661
|
-
}
|
|
2662
|
-
__name(isDirectory, "isDirectory");
|
|
2663
|
-
function isAbsolutePath(path5) {
|
|
2664
|
-
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
|
|
2665
|
-
}
|
|
2666
|
-
__name(isAbsolutePath, "isAbsolutePath");
|
|
2667
|
-
|
|
2668
|
-
// ../path/src/correct-path.ts
|
|
2669
|
-
var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
|
|
2670
|
-
function normalizeWindowsPath2(input = "") {
|
|
2671
|
-
if (!input) {
|
|
2672
|
-
return input;
|
|
2673
|
-
}
|
|
2674
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
2675
|
-
}
|
|
2676
|
-
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
2677
|
-
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
2678
|
-
var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
|
|
2679
|
-
function correctPath(path5) {
|
|
2680
|
-
if (!path5 || path5.length === 0) {
|
|
2681
|
-
return ".";
|
|
2682
|
-
}
|
|
2683
|
-
path5 = normalizeWindowsPath2(path5);
|
|
2684
|
-
const isUNCPath = path5.match(_UNC_REGEX2);
|
|
2685
|
-
const isPathAbsolute = isAbsolutePath(path5);
|
|
2686
|
-
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
2687
|
-
path5 = normalizeString2(path5, !isPathAbsolute);
|
|
2688
|
-
if (path5.length === 0) {
|
|
2689
|
-
if (isPathAbsolute) {
|
|
2690
|
-
return "/";
|
|
2691
|
-
}
|
|
2692
|
-
return trailingSeparator ? "./" : ".";
|
|
2693
|
-
}
|
|
2694
|
-
if (trailingSeparator) {
|
|
2695
|
-
path5 += "/";
|
|
2696
|
-
}
|
|
2697
|
-
if (_DRIVE_LETTER_RE2.test(path5)) {
|
|
2698
|
-
path5 += "/";
|
|
2699
|
-
}
|
|
2700
|
-
if (isUNCPath) {
|
|
2701
|
-
if (!isPathAbsolute) {
|
|
2702
|
-
return `//./${path5}`;
|
|
2703
|
-
}
|
|
2704
|
-
return `//${path5}`;
|
|
2705
|
-
}
|
|
2706
|
-
return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
|
|
2707
|
-
}
|
|
2708
|
-
__name(correctPath, "correctPath");
|
|
2709
|
-
function normalizeString2(path5, allowAboveRoot) {
|
|
2710
|
-
let res = "";
|
|
2711
|
-
let lastSegmentLength = 0;
|
|
2712
|
-
let lastSlash = -1;
|
|
2713
|
-
let dots = 0;
|
|
2714
|
-
let char = null;
|
|
2715
|
-
for (let index = 0; index <= path5.length; ++index) {
|
|
2716
|
-
if (index < path5.length) {
|
|
2717
|
-
char = path5[index];
|
|
2718
|
-
} else if (char === "/") {
|
|
2719
|
-
break;
|
|
2720
|
-
} else {
|
|
2721
|
-
char = "/";
|
|
2722
|
-
}
|
|
2723
|
-
if (char === "/") {
|
|
2724
|
-
if (lastSlash === index - 1 || dots === 1) {
|
|
2725
|
-
} else if (dots === 2) {
|
|
2726
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
2727
|
-
if (res.length > 2) {
|
|
2728
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
2729
|
-
if (lastSlashIndex === -1) {
|
|
2730
|
-
res = "";
|
|
2731
|
-
lastSegmentLength = 0;
|
|
2732
|
-
} else {
|
|
2733
|
-
res = res.slice(0, lastSlashIndex);
|
|
2734
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2735
|
-
}
|
|
2736
|
-
lastSlash = index;
|
|
2737
|
-
dots = 0;
|
|
2738
|
-
continue;
|
|
2739
|
-
} else if (res.length > 0) {
|
|
2740
|
-
res = "";
|
|
2741
|
-
lastSegmentLength = 0;
|
|
2742
|
-
lastSlash = index;
|
|
2743
|
-
dots = 0;
|
|
2744
|
-
continue;
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
if (allowAboveRoot) {
|
|
2748
|
-
res += res.length > 0 ? "/.." : "..";
|
|
2749
|
-
lastSegmentLength = 2;
|
|
2750
|
-
}
|
|
2751
|
-
} else {
|
|
2752
|
-
if (res.length > 0) {
|
|
2753
|
-
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
2754
|
-
} else {
|
|
2755
|
-
res = path5.slice(lastSlash + 1, index);
|
|
2756
|
-
}
|
|
2757
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
2758
|
-
}
|
|
2759
|
-
lastSlash = index;
|
|
2760
|
-
dots = 0;
|
|
2761
|
-
} else if (char === "." && dots !== -1) {
|
|
2762
|
-
++dots;
|
|
2763
|
-
} else {
|
|
2764
|
-
dots = -1;
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
|
-
return res;
|
|
2768
|
-
}
|
|
2769
|
-
__name(normalizeString2, "normalizeString");
|
|
2770
|
-
|
|
2771
|
-
// ../path/src/get-workspace-root.ts
|
|
2772
|
-
init_esm_shims();
|
|
2773
|
-
|
|
2774
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
|
|
2775
|
-
init_esm_shims();
|
|
2776
|
-
|
|
2777
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
2635
|
+
// ../string-format/src/lower-case-first.ts
|
|
2778
2636
|
init_esm_shims();
|
|
2637
|
+
var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
2638
|
+
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
2639
|
+
}, "lowerCaseFirst");
|
|
2779
2640
|
|
|
2780
|
-
//
|
|
2781
|
-
|
|
2641
|
+
// src/prisma-generator.ts
|
|
2642
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
2643
|
+
import path4 from "node:path";
|
|
2782
2644
|
|
|
2783
|
-
//
|
|
2645
|
+
// src/config.ts
|
|
2784
2646
|
init_esm_shims();
|
|
2785
|
-
var __defProp2 = Object.defineProperty;
|
|
2786
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
2787
|
-
value,
|
|
2788
|
-
configurable: true
|
|
2789
|
-
}), "__name");
|
|
2790
|
-
|
|
2791
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
|
|
2792
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
2793
|
-
import { join } from "node:path";
|
|
2794
|
-
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
2795
|
-
var depth = 0;
|
|
2796
|
-
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
2797
|
-
const _startPath = startPath ?? process.cwd();
|
|
2798
|
-
if (endDirectoryNames.some((endDirName) => existsSync2(join(_startPath, endDirName)))) {
|
|
2799
|
-
return _startPath;
|
|
2800
|
-
}
|
|
2801
|
-
if (endFileNames.some((endFileName) => existsSync2(join(_startPath, endFileName)))) {
|
|
2802
|
-
return _startPath;
|
|
2803
|
-
}
|
|
2804
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
2805
|
-
const parent = join(_startPath, "..");
|
|
2806
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
2807
|
-
}
|
|
2808
|
-
return void 0;
|
|
2809
|
-
}
|
|
2810
|
-
__name(findFolderUp, "findFolderUp");
|
|
2811
|
-
__name2(findFolderUp, "findFolderUp");
|
|
2812
2647
|
|
|
2813
|
-
// ../../node_modules/.pnpm
|
|
2648
|
+
// ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
|
|
2814
2649
|
init_esm_shims();
|
|
2815
|
-
var
|
|
2816
|
-
function
|
|
2817
|
-
|
|
2818
|
-
|
|
2650
|
+
var util;
|
|
2651
|
+
(function(util2) {
|
|
2652
|
+
util2.assertEqual = (val) => val;
|
|
2653
|
+
function assertIs(_arg) {
|
|
2819
2654
|
}
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
var _UNC_REGEX3 = /^[/\\]{2}/;
|
|
2825
|
-
var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
2826
|
-
var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
|
|
2827
|
-
var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
2828
|
-
if (!path5 || path5.length === 0) {
|
|
2829
|
-
return ".";
|
|
2655
|
+
__name(assertIs, "assertIs");
|
|
2656
|
+
util2.assertIs = assertIs;
|
|
2657
|
+
function assertNever(_x) {
|
|
2658
|
+
throw new Error();
|
|
2830
2659
|
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
if (isPathAbsolute) {
|
|
2838
|
-
return "/";
|
|
2660
|
+
__name(assertNever, "assertNever");
|
|
2661
|
+
util2.assertNever = assertNever;
|
|
2662
|
+
util2.arrayToEnum = (items) => {
|
|
2663
|
+
const obj = {};
|
|
2664
|
+
for (const item of items) {
|
|
2665
|
+
obj[item] = item;
|
|
2839
2666
|
}
|
|
2840
|
-
return
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
}
|
|
2848
|
-
if (isUNCPath) {
|
|
2849
|
-
if (!isPathAbsolute) {
|
|
2850
|
-
return `//./${path5}`;
|
|
2851
|
-
}
|
|
2852
|
-
return `//${path5}`;
|
|
2853
|
-
}
|
|
2854
|
-
return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
|
|
2855
|
-
}, "correctPaths");
|
|
2856
|
-
function cwd() {
|
|
2857
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
2858
|
-
return process.cwd().replace(/\\/g, "/");
|
|
2859
|
-
}
|
|
2860
|
-
return "/";
|
|
2861
|
-
}
|
|
2862
|
-
__name(cwd, "cwd");
|
|
2863
|
-
__name2(cwd, "cwd");
|
|
2864
|
-
function normalizeString3(path5, allowAboveRoot) {
|
|
2865
|
-
let res = "";
|
|
2866
|
-
let lastSegmentLength = 0;
|
|
2867
|
-
let lastSlash = -1;
|
|
2868
|
-
let dots = 0;
|
|
2869
|
-
let char = null;
|
|
2870
|
-
for (let index = 0; index <= path5.length; ++index) {
|
|
2871
|
-
if (index < path5.length) {
|
|
2872
|
-
char = path5[index];
|
|
2873
|
-
} else if (char === "/") {
|
|
2874
|
-
break;
|
|
2875
|
-
} else {
|
|
2876
|
-
char = "/";
|
|
2877
|
-
}
|
|
2878
|
-
if (char === "/") {
|
|
2879
|
-
if (lastSlash === index - 1 || dots === 1) {
|
|
2880
|
-
} else if (dots === 2) {
|
|
2881
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
2882
|
-
if (res.length > 2) {
|
|
2883
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
2884
|
-
if (lastSlashIndex === -1) {
|
|
2885
|
-
res = "";
|
|
2886
|
-
lastSegmentLength = 0;
|
|
2887
|
-
} else {
|
|
2888
|
-
res = res.slice(0, lastSlashIndex);
|
|
2889
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2890
|
-
}
|
|
2891
|
-
lastSlash = index;
|
|
2892
|
-
dots = 0;
|
|
2893
|
-
continue;
|
|
2894
|
-
} else if (res.length > 0) {
|
|
2895
|
-
res = "";
|
|
2896
|
-
lastSegmentLength = 0;
|
|
2897
|
-
lastSlash = index;
|
|
2898
|
-
dots = 0;
|
|
2899
|
-
continue;
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
if (allowAboveRoot) {
|
|
2903
|
-
res += res.length > 0 ? "/.." : "..";
|
|
2904
|
-
lastSegmentLength = 2;
|
|
2905
|
-
}
|
|
2906
|
-
} else {
|
|
2907
|
-
if (res.length > 0) {
|
|
2908
|
-
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
2909
|
-
} else {
|
|
2910
|
-
res = path5.slice(lastSlash + 1, index);
|
|
2911
|
-
}
|
|
2912
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
2913
|
-
}
|
|
2914
|
-
lastSlash = index;
|
|
2915
|
-
dots = 0;
|
|
2916
|
-
} else if (char === "." && dots !== -1) {
|
|
2917
|
-
++dots;
|
|
2918
|
-
} else {
|
|
2919
|
-
dots = -1;
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
return res;
|
|
2923
|
-
}
|
|
2924
|
-
__name(normalizeString3, "normalizeString");
|
|
2925
|
-
__name2(normalizeString3, "normalizeString");
|
|
2926
|
-
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
2927
|
-
return _IS_ABSOLUTE_RE2.test(p);
|
|
2928
|
-
}, "isAbsolute");
|
|
2929
|
-
|
|
2930
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
2931
|
-
var rootFiles = [
|
|
2932
|
-
"storm-workspace.json",
|
|
2933
|
-
"storm-workspace.json",
|
|
2934
|
-
"storm-workspace.yaml",
|
|
2935
|
-
"storm-workspace.yml",
|
|
2936
|
-
"storm-workspace.js",
|
|
2937
|
-
"storm-workspace.ts",
|
|
2938
|
-
".storm-workspace.json",
|
|
2939
|
-
".storm-workspace.yaml",
|
|
2940
|
-
".storm-workspace.yml",
|
|
2941
|
-
".storm-workspace.js",
|
|
2942
|
-
".storm-workspace.ts",
|
|
2943
|
-
"lerna.json",
|
|
2944
|
-
"nx.json",
|
|
2945
|
-
"turbo.json",
|
|
2946
|
-
"npm-workspace.json",
|
|
2947
|
-
"yarn-workspace.json",
|
|
2948
|
-
"pnpm-workspace.json",
|
|
2949
|
-
"npm-workspace.yaml",
|
|
2950
|
-
"yarn-workspace.yaml",
|
|
2951
|
-
"pnpm-workspace.yaml",
|
|
2952
|
-
"npm-workspace.yml",
|
|
2953
|
-
"yarn-workspace.yml",
|
|
2954
|
-
"pnpm-workspace.yml",
|
|
2955
|
-
"npm-lock.json",
|
|
2956
|
-
"yarn-lock.json",
|
|
2957
|
-
"pnpm-lock.json",
|
|
2958
|
-
"npm-lock.yaml",
|
|
2959
|
-
"yarn-lock.yaml",
|
|
2960
|
-
"pnpm-lock.yaml",
|
|
2961
|
-
"npm-lock.yml",
|
|
2962
|
-
"yarn-lock.yml",
|
|
2963
|
-
"pnpm-lock.yml",
|
|
2964
|
-
"bun.lockb"
|
|
2965
|
-
];
|
|
2966
|
-
var rootDirectories = [
|
|
2967
|
-
".storm-workspace",
|
|
2968
|
-
".nx",
|
|
2969
|
-
".github",
|
|
2970
|
-
".vscode",
|
|
2971
|
-
".verdaccio"
|
|
2972
|
-
];
|
|
2973
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
2974
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
2975
|
-
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
2976
|
-
}
|
|
2977
|
-
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
2978
|
-
}
|
|
2979
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
2980
|
-
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
2981
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
2982
|
-
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
2983
|
-
if (!result) {
|
|
2984
|
-
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
2985
|
-
${rootFiles.join("\n")}
|
|
2986
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
2987
|
-
}
|
|
2988
|
-
return result;
|
|
2989
|
-
}
|
|
2990
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
2991
|
-
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
2992
|
-
|
|
2993
|
-
// ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
|
|
2994
|
-
init_esm_shims();
|
|
2995
|
-
var util;
|
|
2996
|
-
(function(util2) {
|
|
2997
|
-
util2.assertEqual = (val) => val;
|
|
2998
|
-
function assertIs(_arg) {
|
|
2999
|
-
}
|
|
3000
|
-
__name(assertIs, "assertIs");
|
|
3001
|
-
util2.assertIs = assertIs;
|
|
3002
|
-
function assertNever(_x) {
|
|
3003
|
-
throw new Error();
|
|
3004
|
-
}
|
|
3005
|
-
__name(assertNever, "assertNever");
|
|
3006
|
-
util2.assertNever = assertNever;
|
|
3007
|
-
util2.arrayToEnum = (items) => {
|
|
3008
|
-
const obj = {};
|
|
3009
|
-
for (const item of items) {
|
|
3010
|
-
obj[item] = item;
|
|
3011
|
-
}
|
|
3012
|
-
return obj;
|
|
3013
|
-
};
|
|
3014
|
-
util2.getValidEnumValues = (obj) => {
|
|
3015
|
-
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
3016
|
-
const filtered = {};
|
|
3017
|
-
for (const k of validKeys) {
|
|
3018
|
-
filtered[k] = obj[k];
|
|
2667
|
+
return obj;
|
|
2668
|
+
};
|
|
2669
|
+
util2.getValidEnumValues = (obj) => {
|
|
2670
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
2671
|
+
const filtered = {};
|
|
2672
|
+
for (const k of validKeys) {
|
|
2673
|
+
filtered[k] = obj[k];
|
|
3019
2674
|
}
|
|
3020
2675
|
return util2.objectValues(filtered);
|
|
3021
2676
|
};
|
|
@@ -7196,213 +6851,48 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
7196
6851
|
ZodError
|
|
7197
6852
|
});
|
|
7198
6853
|
|
|
7199
|
-
//
|
|
6854
|
+
// src/config.ts
|
|
6855
|
+
var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
6856
|
+
ModelAction2["findUnique"] = "findUnique";
|
|
6857
|
+
ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
|
|
6858
|
+
ModelAction2["findFirst"] = "findFirst";
|
|
6859
|
+
ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
|
|
6860
|
+
ModelAction2["findMany"] = "findMany";
|
|
6861
|
+
ModelAction2["create"] = "create";
|
|
6862
|
+
ModelAction2["createMany"] = "createMany";
|
|
6863
|
+
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6864
|
+
ModelAction2["update"] = "update";
|
|
6865
|
+
ModelAction2["updateMany"] = "updateMany";
|
|
6866
|
+
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6867
|
+
ModelAction2["upsert"] = "upsert";
|
|
6868
|
+
ModelAction2["delete"] = "delete";
|
|
6869
|
+
ModelAction2["deleteMany"] = "deleteMany";
|
|
6870
|
+
ModelAction2["groupBy"] = "groupBy";
|
|
6871
|
+
ModelAction2["count"] = "count";
|
|
6872
|
+
ModelAction2["aggregate"] = "aggregate";
|
|
6873
|
+
ModelAction2["findRaw"] = "findRaw";
|
|
6874
|
+
ModelAction2["aggregateRaw"] = "aggregateRaw";
|
|
6875
|
+
return ModelAction2;
|
|
6876
|
+
}(ModelAction || {});
|
|
6877
|
+
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6878
|
+
var configSchema = z.object({
|
|
6879
|
+
debug: z.coerce.boolean().or(z.string()).default(false),
|
|
6880
|
+
withMiddleware: z.coerce.boolean().or(z.string()).default(false),
|
|
6881
|
+
withShield: z.coerce.boolean().or(z.string()).default(true),
|
|
6882
|
+
withZod: z.coerce.boolean().or(z.string()).default(true),
|
|
6883
|
+
withNext: z.coerce.boolean().or(z.string()).default(true),
|
|
6884
|
+
contextPath: z.string().default("../src/trpc/context"),
|
|
6885
|
+
trpcOptions: z.coerce.boolean().or(z.string()).default(true),
|
|
6886
|
+
showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
|
|
6887
|
+
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
6888
|
+
return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
|
|
6889
|
+
})
|
|
6890
|
+
});
|
|
6891
|
+
|
|
6892
|
+
// src/helpers.ts
|
|
7200
6893
|
init_esm_shims();
|
|
7201
|
-
var resolveParentPath = /* @__PURE__ */ __name((path5) => {
|
|
7202
|
-
return resolvePaths(path5, "..");
|
|
7203
|
-
}, "resolveParentPath");
|
|
7204
|
-
var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
|
|
7205
|
-
const ignoreCase = options?.ignoreCase ?? true;
|
|
7206
|
-
const skipCwd = options?.skipCwd ?? false;
|
|
7207
|
-
const targetType = options?.targetType ?? "both";
|
|
7208
|
-
let dir = cwd2;
|
|
7209
|
-
if (skipCwd) {
|
|
7210
|
-
dir = resolveParentPath(cwd2);
|
|
7211
|
-
}
|
|
7212
|
-
let names = Array.isArray(name) ? name : [
|
|
7213
|
-
name
|
|
7214
|
-
];
|
|
7215
|
-
if (ignoreCase) {
|
|
7216
|
-
names = names.map((name2) => name2.toLowerCase());
|
|
7217
|
-
}
|
|
7218
|
-
while (true) {
|
|
7219
|
-
const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
|
|
7220
|
-
if (target) {
|
|
7221
|
-
return joinPaths(dir, target);
|
|
7222
|
-
}
|
|
7223
|
-
const parentDir = resolveParentPath(dir);
|
|
7224
|
-
if (parentDir === dir) {
|
|
7225
|
-
return void 0;
|
|
7226
|
-
}
|
|
7227
|
-
dir = parentDir;
|
|
7228
|
-
}
|
|
7229
|
-
}, "getParentPath");
|
|
7230
6894
|
|
|
7231
|
-
//
|
|
7232
|
-
init_esm_shims();
|
|
7233
|
-
var isSystemRoot = /* @__PURE__ */ __name((dir) => {
|
|
7234
|
-
return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
|
|
7235
|
-
}, "isSystemRoot");
|
|
7236
|
-
|
|
7237
|
-
// ../path/src/get-workspace-root.ts
|
|
7238
|
-
var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
|
|
7239
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7240
|
-
return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
|
|
7241
|
-
}
|
|
7242
|
-
const root = findWorkspaceRootSafe(dir);
|
|
7243
|
-
if (root) {
|
|
7244
|
-
return root;
|
|
7245
|
-
}
|
|
7246
|
-
let result = getParentPath([
|
|
7247
|
-
"package-lock.json",
|
|
7248
|
-
"yarn.lock",
|
|
7249
|
-
"pnpm-lock.yaml",
|
|
7250
|
-
"bun.lock",
|
|
7251
|
-
"nx.json",
|
|
7252
|
-
"knip.json",
|
|
7253
|
-
"pnpm-workspace.yaml",
|
|
7254
|
-
"LICENSE",
|
|
7255
|
-
".all-contributorsrc",
|
|
7256
|
-
".whitesource",
|
|
7257
|
-
"syncpack.config.js",
|
|
7258
|
-
"syncpack.json",
|
|
7259
|
-
"socket.yaml",
|
|
7260
|
-
"lefthook.yaml",
|
|
7261
|
-
".npmrc",
|
|
7262
|
-
".log4brains.yml",
|
|
7263
|
-
".huskyrc",
|
|
7264
|
-
".husky",
|
|
7265
|
-
".lintstagedrc",
|
|
7266
|
-
".commitlintrc",
|
|
7267
|
-
"lefthook.yml",
|
|
7268
|
-
".github",
|
|
7269
|
-
".nx",
|
|
7270
|
-
".vscode",
|
|
7271
|
-
"patches"
|
|
7272
|
-
], dir);
|
|
7273
|
-
if (result) {
|
|
7274
|
-
return result;
|
|
7275
|
-
}
|
|
7276
|
-
result = dir;
|
|
7277
|
-
while (result && !isSystemRoot(result)) {
|
|
7278
|
-
result = getParentPath("storm.json", result, {
|
|
7279
|
-
skipCwd: true
|
|
7280
|
-
});
|
|
7281
|
-
if (result) {
|
|
7282
|
-
return result;
|
|
7283
|
-
}
|
|
7284
|
-
}
|
|
7285
|
-
return dir;
|
|
7286
|
-
}, "getWorkspaceRoot");
|
|
7287
|
-
|
|
7288
|
-
// ../path/src/file-path-fns.ts
|
|
7289
|
-
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
7290
|
-
const result = normalizeWindowsPath2(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
7291
|
-
if (requireExtension === true && !result.includes(".")) {
|
|
7292
|
-
return EMPTY_STRING;
|
|
7293
|
-
}
|
|
7294
|
-
if (withExtension === false && result.includes(".")) {
|
|
7295
|
-
return result.split(".").slice(-1).join(".") || EMPTY_STRING;
|
|
7296
|
-
}
|
|
7297
|
-
return result;
|
|
7298
|
-
}
|
|
7299
|
-
__name(findFileName, "findFileName");
|
|
7300
|
-
function findFilePath(filePath) {
|
|
7301
|
-
const normalizedPath = normalizeWindowsPath2(filePath);
|
|
7302
|
-
return normalizedPath.replace(findFileName(normalizedPath, {
|
|
7303
|
-
requireExtension: true
|
|
7304
|
-
}), "");
|
|
7305
|
-
}
|
|
7306
|
-
__name(findFilePath, "findFilePath");
|
|
7307
|
-
function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
|
|
7308
|
-
const paths = normalizeWindowsPath2(path5).split("/");
|
|
7309
|
-
let resolvedPath = "";
|
|
7310
|
-
let resolvedAbsolute = false;
|
|
7311
|
-
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
7312
|
-
const path6 = index >= 0 ? paths[index] : cwd2;
|
|
7313
|
-
if (!path6 || path6.length === 0) {
|
|
7314
|
-
continue;
|
|
7315
|
-
}
|
|
7316
|
-
resolvedPath = joinPaths(path6, resolvedPath);
|
|
7317
|
-
resolvedAbsolute = isAbsolutePath(path6);
|
|
7318
|
-
}
|
|
7319
|
-
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
7320
|
-
if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
|
|
7321
|
-
return `/${resolvedPath}`;
|
|
7322
|
-
}
|
|
7323
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
7324
|
-
}
|
|
7325
|
-
__name(resolvePath, "resolvePath");
|
|
7326
|
-
function resolvePaths(...paths) {
|
|
7327
|
-
return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath2(path5))));
|
|
7328
|
-
}
|
|
7329
|
-
__name(resolvePaths, "resolvePaths");
|
|
7330
|
-
function relativePath(from, to) {
|
|
7331
|
-
const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7332
|
-
const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7333
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
7334
|
-
return _to.join("/");
|
|
7335
|
-
}
|
|
7336
|
-
const _fromCopy = [
|
|
7337
|
-
..._from
|
|
7338
|
-
];
|
|
7339
|
-
for (const segment of _fromCopy) {
|
|
7340
|
-
if (_to[0] !== segment) {
|
|
7341
|
-
break;
|
|
7342
|
-
}
|
|
7343
|
-
_from.shift();
|
|
7344
|
-
_to.shift();
|
|
7345
|
-
}
|
|
7346
|
-
return [
|
|
7347
|
-
..._from.map(() => ".."),
|
|
7348
|
-
..._to
|
|
7349
|
-
].join("/");
|
|
7350
|
-
}
|
|
7351
|
-
__name(relativePath, "relativePath");
|
|
7352
|
-
|
|
7353
|
-
// ../string-format/src/lower-case-first.ts
|
|
7354
|
-
init_esm_shims();
|
|
7355
|
-
var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
7356
|
-
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
7357
|
-
}, "lowerCaseFirst");
|
|
7358
|
-
|
|
7359
|
-
// src/prisma-generator.ts
|
|
7360
|
-
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
7361
|
-
import path4 from "node:path";
|
|
7362
|
-
|
|
7363
|
-
// src/config.ts
|
|
7364
|
-
init_esm_shims();
|
|
7365
|
-
var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
7366
|
-
ModelAction2["findUnique"] = "findUnique";
|
|
7367
|
-
ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
|
|
7368
|
-
ModelAction2["findFirst"] = "findFirst";
|
|
7369
|
-
ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
|
|
7370
|
-
ModelAction2["findMany"] = "findMany";
|
|
7371
|
-
ModelAction2["create"] = "create";
|
|
7372
|
-
ModelAction2["createMany"] = "createMany";
|
|
7373
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
7374
|
-
ModelAction2["update"] = "update";
|
|
7375
|
-
ModelAction2["updateMany"] = "updateMany";
|
|
7376
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
7377
|
-
ModelAction2["upsert"] = "upsert";
|
|
7378
|
-
ModelAction2["delete"] = "delete";
|
|
7379
|
-
ModelAction2["deleteMany"] = "deleteMany";
|
|
7380
|
-
ModelAction2["groupBy"] = "groupBy";
|
|
7381
|
-
ModelAction2["count"] = "count";
|
|
7382
|
-
ModelAction2["aggregate"] = "aggregate";
|
|
7383
|
-
ModelAction2["findRaw"] = "findRaw";
|
|
7384
|
-
ModelAction2["aggregateRaw"] = "aggregateRaw";
|
|
7385
|
-
return ModelAction2;
|
|
7386
|
-
}(ModelAction || {});
|
|
7387
|
-
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
7388
|
-
var configSchema = z.object({
|
|
7389
|
-
debug: z.coerce.boolean().or(z.string()).default(false),
|
|
7390
|
-
withMiddleware: z.coerce.boolean().or(z.string()).default(false),
|
|
7391
|
-
withShield: z.coerce.boolean().or(z.string()).default(true),
|
|
7392
|
-
withZod: z.coerce.boolean().or(z.string()).default(true),
|
|
7393
|
-
withNext: z.coerce.boolean().or(z.string()).default(true),
|
|
7394
|
-
contextPath: z.string().default("../src/trpc/context.ts"),
|
|
7395
|
-
trpcOptions: z.coerce.boolean().or(z.string()).default(true),
|
|
7396
|
-
showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
|
|
7397
|
-
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
7398
|
-
return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
|
|
7399
|
-
})
|
|
7400
|
-
});
|
|
7401
|
-
|
|
7402
|
-
// src/helpers.ts
|
|
7403
|
-
init_esm_shims();
|
|
7404
|
-
|
|
7405
|
-
// src/utils/get-prisma-internals.ts
|
|
6895
|
+
// src/utils/get-prisma-internals.ts
|
|
7406
6896
|
init_esm_shims();
|
|
7407
6897
|
|
|
7408
6898
|
// src/utils/get-jiti.ts
|
|
@@ -7470,103 +6960,615 @@ var titleCase = /* @__PURE__ */ __name((input) => {
|
|
|
7470
6960
|
if (!input) {
|
|
7471
6961
|
return "";
|
|
7472
6962
|
}
|
|
7473
|
-
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
7474
|
-
}, "titleCase");
|
|
6963
|
+
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
6964
|
+
}, "titleCase");
|
|
6965
|
+
|
|
6966
|
+
// ../type-checks/src/is-string.ts
|
|
6967
|
+
init_esm_shims();
|
|
6968
|
+
var isString = /* @__PURE__ */ __name((value) => {
|
|
6969
|
+
try {
|
|
6970
|
+
return typeof value === "string";
|
|
6971
|
+
} catch {
|
|
6972
|
+
return false;
|
|
6973
|
+
}
|
|
6974
|
+
}, "isString");
|
|
6975
|
+
|
|
6976
|
+
// ../env/src/get-env-paths.ts
|
|
6977
|
+
import os from "node:os";
|
|
6978
|
+
import path from "node:path";
|
|
6979
|
+
var homedir = os.homedir();
|
|
6980
|
+
var tmpdir = os.tmpdir();
|
|
6981
|
+
var macos = /* @__PURE__ */ __name((orgId) => {
|
|
6982
|
+
const library = joinPaths(homedir, "Library");
|
|
6983
|
+
return {
|
|
6984
|
+
data: joinPaths(library, "Application Support", orgId),
|
|
6985
|
+
config: joinPaths(library, "Preferences", orgId),
|
|
6986
|
+
cache: joinPaths(library, "Caches", orgId),
|
|
6987
|
+
log: joinPaths(library, "Logs", orgId),
|
|
6988
|
+
temp: joinPaths(tmpdir, orgId)
|
|
6989
|
+
};
|
|
6990
|
+
}, "macos");
|
|
6991
|
+
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
6992
|
+
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
6993
|
+
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
6994
|
+
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
6995
|
+
return {
|
|
6996
|
+
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
6997
|
+
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
6998
|
+
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
6999
|
+
cache: joinPaths(localAppData, "Cache", orgId),
|
|
7000
|
+
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7001
|
+
temp: joinPaths(tmpdir, orgId)
|
|
7002
|
+
};
|
|
7003
|
+
}, "windows");
|
|
7004
|
+
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7005
|
+
const username = path.basename(homedir);
|
|
7006
|
+
return {
|
|
7007
|
+
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7008
|
+
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7009
|
+
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7010
|
+
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7011
|
+
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7012
|
+
temp: joinPaths(tmpdir, username, orgId)
|
|
7013
|
+
};
|
|
7014
|
+
}, "linux");
|
|
7015
|
+
function getEnvPaths(options = {}) {
|
|
7016
|
+
let orgId = options.orgId || "storm-software";
|
|
7017
|
+
if (!orgId) {
|
|
7018
|
+
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7019
|
+
}
|
|
7020
|
+
if (options.suffix) {
|
|
7021
|
+
orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
|
|
7022
|
+
}
|
|
7023
|
+
let result = {};
|
|
7024
|
+
if (process.platform === "darwin") {
|
|
7025
|
+
result = macos(orgId);
|
|
7026
|
+
} else if (process.platform === "win32") {
|
|
7027
|
+
result = windows(orgId);
|
|
7028
|
+
} else {
|
|
7029
|
+
result = linux(orgId);
|
|
7030
|
+
}
|
|
7031
|
+
if (process.env.STORM_DATA_DIRECTORY) {
|
|
7032
|
+
result.data = process.env.STORM_DATA_DIRECTORY;
|
|
7033
|
+
} else if (process.env.STORM_CONFIG_DIRECTORY) {
|
|
7034
|
+
result.config = process.env.STORM_CONFIG_DIRECTORY;
|
|
7035
|
+
} else if (process.env.STORM_CACHE_DIRECTORY) {
|
|
7036
|
+
result.cache = process.env.STORM_CACHE_DIRECTORY;
|
|
7037
|
+
} else if (process.env.STORM_LOG_DIRECTORY) {
|
|
7038
|
+
result.log = process.env.STORM_LOG_DIRECTORY;
|
|
7039
|
+
} else if (process.env.STORM_TEMP_DIRECTORY) {
|
|
7040
|
+
result.temp = process.env.STORM_TEMP_DIRECTORY;
|
|
7041
|
+
}
|
|
7042
|
+
if (options.workspaceRoot) {
|
|
7043
|
+
result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
|
|
7044
|
+
result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
|
|
7045
|
+
result.log ??= joinPaths(result.temp, "logs");
|
|
7046
|
+
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7047
|
+
}
|
|
7048
|
+
return Object.keys(result).reduce((ret, key) => {
|
|
7049
|
+
if (result[key]) {
|
|
7050
|
+
const filePath = result[key];
|
|
7051
|
+
ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
|
|
7052
|
+
if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
|
|
7053
|
+
ret[key] = joinPaths(ret[key], options.nestedDir);
|
|
7054
|
+
}
|
|
7055
|
+
}
|
|
7056
|
+
return ret;
|
|
7057
|
+
}, {});
|
|
7058
|
+
}
|
|
7059
|
+
__name(getEnvPaths, "getEnvPaths");
|
|
7060
|
+
|
|
7061
|
+
// ../path/src/get-workspace-root.ts
|
|
7062
|
+
init_esm_shims();
|
|
7063
|
+
|
|
7064
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
|
|
7065
|
+
init_esm_shims();
|
|
7066
|
+
|
|
7067
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
7068
|
+
init_esm_shims();
|
|
7069
|
+
|
|
7070
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
|
|
7071
|
+
init_esm_shims();
|
|
7072
|
+
|
|
7073
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
|
|
7074
|
+
init_esm_shims();
|
|
7075
|
+
var __defProp2 = Object.defineProperty;
|
|
7076
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7077
|
+
value,
|
|
7078
|
+
configurable: true
|
|
7079
|
+
}), "__name");
|
|
7080
|
+
|
|
7081
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
|
|
7082
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
7083
|
+
import { join } from "node:path";
|
|
7084
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
7085
|
+
var depth = 0;
|
|
7086
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
7087
|
+
const _startPath = startPath ?? process.cwd();
|
|
7088
|
+
if (endDirectoryNames.some((endDirName) => existsSync2(join(_startPath, endDirName)))) {
|
|
7089
|
+
return _startPath;
|
|
7090
|
+
}
|
|
7091
|
+
if (endFileNames.some((endFileName) => existsSync2(join(_startPath, endFileName)))) {
|
|
7092
|
+
return _startPath;
|
|
7093
|
+
}
|
|
7094
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7095
|
+
const parent = join(_startPath, "..");
|
|
7096
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7097
|
+
}
|
|
7098
|
+
return void 0;
|
|
7099
|
+
}
|
|
7100
|
+
__name(findFolderUp, "findFolderUp");
|
|
7101
|
+
__name2(findFolderUp, "findFolderUp");
|
|
7102
|
+
|
|
7103
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
|
|
7104
|
+
init_esm_shims();
|
|
7105
|
+
var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
7106
|
+
function normalizeWindowsPath2(input = "") {
|
|
7107
|
+
if (!input) {
|
|
7108
|
+
return input;
|
|
7109
|
+
}
|
|
7110
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
7111
|
+
}
|
|
7112
|
+
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7113
|
+
__name2(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7114
|
+
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
7115
|
+
var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
7116
|
+
var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
|
|
7117
|
+
var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
7118
|
+
if (!path5 || path5.length === 0) {
|
|
7119
|
+
return ".";
|
|
7120
|
+
}
|
|
7121
|
+
path5 = normalizeWindowsPath2(path5);
|
|
7122
|
+
const isUNCPath = path5.match(_UNC_REGEX2);
|
|
7123
|
+
const isPathAbsolute = isAbsolute2(path5);
|
|
7124
|
+
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
7125
|
+
path5 = normalizeString2(path5, !isPathAbsolute);
|
|
7126
|
+
if (path5.length === 0) {
|
|
7127
|
+
if (isPathAbsolute) {
|
|
7128
|
+
return "/";
|
|
7129
|
+
}
|
|
7130
|
+
return trailingSeparator ? "./" : ".";
|
|
7131
|
+
}
|
|
7132
|
+
if (trailingSeparator) {
|
|
7133
|
+
path5 += "/";
|
|
7134
|
+
}
|
|
7135
|
+
if (_DRIVE_LETTER_RE2.test(path5)) {
|
|
7136
|
+
path5 += "/";
|
|
7137
|
+
}
|
|
7138
|
+
if (isUNCPath) {
|
|
7139
|
+
if (!isPathAbsolute) {
|
|
7140
|
+
return `//./${path5}`;
|
|
7141
|
+
}
|
|
7142
|
+
return `//${path5}`;
|
|
7143
|
+
}
|
|
7144
|
+
return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
|
|
7145
|
+
}, "correctPaths");
|
|
7146
|
+
function cwd() {
|
|
7147
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7148
|
+
return process.cwd().replace(/\\/g, "/");
|
|
7149
|
+
}
|
|
7150
|
+
return "/";
|
|
7151
|
+
}
|
|
7152
|
+
__name(cwd, "cwd");
|
|
7153
|
+
__name2(cwd, "cwd");
|
|
7154
|
+
function normalizeString2(path5, allowAboveRoot) {
|
|
7155
|
+
let res = "";
|
|
7156
|
+
let lastSegmentLength = 0;
|
|
7157
|
+
let lastSlash = -1;
|
|
7158
|
+
let dots = 0;
|
|
7159
|
+
let char = null;
|
|
7160
|
+
for (let index = 0; index <= path5.length; ++index) {
|
|
7161
|
+
if (index < path5.length) {
|
|
7162
|
+
char = path5[index];
|
|
7163
|
+
} else if (char === "/") {
|
|
7164
|
+
break;
|
|
7165
|
+
} else {
|
|
7166
|
+
char = "/";
|
|
7167
|
+
}
|
|
7168
|
+
if (char === "/") {
|
|
7169
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
7170
|
+
} else if (dots === 2) {
|
|
7171
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
7172
|
+
if (res.length > 2) {
|
|
7173
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
7174
|
+
if (lastSlashIndex === -1) {
|
|
7175
|
+
res = "";
|
|
7176
|
+
lastSegmentLength = 0;
|
|
7177
|
+
} else {
|
|
7178
|
+
res = res.slice(0, lastSlashIndex);
|
|
7179
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
7180
|
+
}
|
|
7181
|
+
lastSlash = index;
|
|
7182
|
+
dots = 0;
|
|
7183
|
+
continue;
|
|
7184
|
+
} else if (res.length > 0) {
|
|
7185
|
+
res = "";
|
|
7186
|
+
lastSegmentLength = 0;
|
|
7187
|
+
lastSlash = index;
|
|
7188
|
+
dots = 0;
|
|
7189
|
+
continue;
|
|
7190
|
+
}
|
|
7191
|
+
}
|
|
7192
|
+
if (allowAboveRoot) {
|
|
7193
|
+
res += res.length > 0 ? "/.." : "..";
|
|
7194
|
+
lastSegmentLength = 2;
|
|
7195
|
+
}
|
|
7196
|
+
} else {
|
|
7197
|
+
if (res.length > 0) {
|
|
7198
|
+
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
7199
|
+
} else {
|
|
7200
|
+
res = path5.slice(lastSlash + 1, index);
|
|
7201
|
+
}
|
|
7202
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
7203
|
+
}
|
|
7204
|
+
lastSlash = index;
|
|
7205
|
+
dots = 0;
|
|
7206
|
+
} else if (char === "." && dots !== -1) {
|
|
7207
|
+
++dots;
|
|
7208
|
+
} else {
|
|
7209
|
+
dots = -1;
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
return res;
|
|
7213
|
+
}
|
|
7214
|
+
__name(normalizeString2, "normalizeString");
|
|
7215
|
+
__name2(normalizeString2, "normalizeString");
|
|
7216
|
+
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7217
|
+
return _IS_ABSOLUTE_RE2.test(p);
|
|
7218
|
+
}, "isAbsolute");
|
|
7219
|
+
|
|
7220
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
7221
|
+
var rootFiles = [
|
|
7222
|
+
"storm-workspace.json",
|
|
7223
|
+
"storm-workspace.json",
|
|
7224
|
+
"storm-workspace.yaml",
|
|
7225
|
+
"storm-workspace.yml",
|
|
7226
|
+
"storm-workspace.js",
|
|
7227
|
+
"storm-workspace.ts",
|
|
7228
|
+
".storm-workspace.json",
|
|
7229
|
+
".storm-workspace.yaml",
|
|
7230
|
+
".storm-workspace.yml",
|
|
7231
|
+
".storm-workspace.js",
|
|
7232
|
+
".storm-workspace.ts",
|
|
7233
|
+
"lerna.json",
|
|
7234
|
+
"nx.json",
|
|
7235
|
+
"turbo.json",
|
|
7236
|
+
"npm-workspace.json",
|
|
7237
|
+
"yarn-workspace.json",
|
|
7238
|
+
"pnpm-workspace.json",
|
|
7239
|
+
"npm-workspace.yaml",
|
|
7240
|
+
"yarn-workspace.yaml",
|
|
7241
|
+
"pnpm-workspace.yaml",
|
|
7242
|
+
"npm-workspace.yml",
|
|
7243
|
+
"yarn-workspace.yml",
|
|
7244
|
+
"pnpm-workspace.yml",
|
|
7245
|
+
"npm-lock.json",
|
|
7246
|
+
"yarn-lock.json",
|
|
7247
|
+
"pnpm-lock.json",
|
|
7248
|
+
"npm-lock.yaml",
|
|
7249
|
+
"yarn-lock.yaml",
|
|
7250
|
+
"pnpm-lock.yaml",
|
|
7251
|
+
"npm-lock.yml",
|
|
7252
|
+
"yarn-lock.yml",
|
|
7253
|
+
"pnpm-lock.yml",
|
|
7254
|
+
"bun.lockb"
|
|
7255
|
+
];
|
|
7256
|
+
var rootDirectories = [
|
|
7257
|
+
".storm-workspace",
|
|
7258
|
+
".nx",
|
|
7259
|
+
".github",
|
|
7260
|
+
".vscode",
|
|
7261
|
+
".verdaccio"
|
|
7262
|
+
];
|
|
7263
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7264
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7265
|
+
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7266
|
+
}
|
|
7267
|
+
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7268
|
+
}
|
|
7269
|
+
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7270
|
+
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7271
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7272
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7273
|
+
if (!result) {
|
|
7274
|
+
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7275
|
+
${rootFiles.join("\n")}
|
|
7276
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7277
|
+
}
|
|
7278
|
+
return result;
|
|
7279
|
+
}
|
|
7280
|
+
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7281
|
+
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7282
|
+
|
|
7283
|
+
// ../path/src/get-parent-path.ts
|
|
7284
|
+
init_esm_shims();
|
|
7285
|
+
|
|
7286
|
+
// ../path/src/file-path-fns.ts
|
|
7287
|
+
init_esm_shims();
|
|
7288
|
+
|
|
7289
|
+
// ../types/src/base.ts
|
|
7290
|
+
init_esm_shims();
|
|
7291
|
+
var EMPTY_STRING = "";
|
|
7292
|
+
var $NestedValue = Symbol("NestedValue");
|
|
7293
|
+
|
|
7294
|
+
// ../path/src/correct-path.ts
|
|
7295
|
+
init_esm_shims();
|
|
7296
|
+
|
|
7297
|
+
// ../path/src/is-file.ts
|
|
7298
|
+
init_esm_shims();
|
|
7299
|
+
import { lstatSync, statSync } from "node:fs";
|
|
7300
|
+
function isFile(path5, additionalPath) {
|
|
7301
|
+
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
7302
|
+
throwIfNoEntry: false
|
|
7303
|
+
})?.isFile());
|
|
7304
|
+
}
|
|
7305
|
+
__name(isFile, "isFile");
|
|
7306
|
+
function isDirectory(path5, additionalPath) {
|
|
7307
|
+
return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
7308
|
+
throwIfNoEntry: false
|
|
7309
|
+
})?.isDirectory());
|
|
7310
|
+
}
|
|
7311
|
+
__name(isDirectory, "isDirectory");
|
|
7312
|
+
function isAbsolutePath(path5) {
|
|
7313
|
+
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
|
|
7314
|
+
}
|
|
7315
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
7316
|
+
|
|
7317
|
+
// ../path/src/correct-path.ts
|
|
7318
|
+
var _DRIVE_LETTER_START_RE3 = /^[A-Z]:\//i;
|
|
7319
|
+
function normalizeWindowsPath3(input = "") {
|
|
7320
|
+
if (!input) {
|
|
7321
|
+
return input;
|
|
7322
|
+
}
|
|
7323
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
|
|
7324
|
+
}
|
|
7325
|
+
__name(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7326
|
+
var _UNC_REGEX3 = /^[/\\]{2}/;
|
|
7327
|
+
var _DRIVE_LETTER_RE3 = /^[A-Z]:$/i;
|
|
7328
|
+
function correctPath(path5) {
|
|
7329
|
+
if (!path5 || path5.length === 0) {
|
|
7330
|
+
return ".";
|
|
7331
|
+
}
|
|
7332
|
+
path5 = normalizeWindowsPath3(path5);
|
|
7333
|
+
const isUNCPath = path5.match(_UNC_REGEX3);
|
|
7334
|
+
const isPathAbsolute = isAbsolutePath(path5);
|
|
7335
|
+
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
7336
|
+
path5 = normalizeString3(path5, !isPathAbsolute);
|
|
7337
|
+
if (path5.length === 0) {
|
|
7338
|
+
if (isPathAbsolute) {
|
|
7339
|
+
return "/";
|
|
7340
|
+
}
|
|
7341
|
+
return trailingSeparator ? "./" : ".";
|
|
7342
|
+
}
|
|
7343
|
+
if (trailingSeparator) {
|
|
7344
|
+
path5 += "/";
|
|
7345
|
+
}
|
|
7346
|
+
if (_DRIVE_LETTER_RE3.test(path5)) {
|
|
7347
|
+
path5 += "/";
|
|
7348
|
+
}
|
|
7349
|
+
if (isUNCPath) {
|
|
7350
|
+
if (!isPathAbsolute) {
|
|
7351
|
+
return `//./${path5}`;
|
|
7352
|
+
}
|
|
7353
|
+
return `//${path5}`;
|
|
7354
|
+
}
|
|
7355
|
+
return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
|
|
7356
|
+
}
|
|
7357
|
+
__name(correctPath, "correctPath");
|
|
7358
|
+
function normalizeString3(path5, allowAboveRoot) {
|
|
7359
|
+
let res = "";
|
|
7360
|
+
let lastSegmentLength = 0;
|
|
7361
|
+
let lastSlash = -1;
|
|
7362
|
+
let dots = 0;
|
|
7363
|
+
let char = null;
|
|
7364
|
+
for (let index = 0; index <= path5.length; ++index) {
|
|
7365
|
+
if (index < path5.length) {
|
|
7366
|
+
char = path5[index];
|
|
7367
|
+
} else if (char === "/") {
|
|
7368
|
+
break;
|
|
7369
|
+
} else {
|
|
7370
|
+
char = "/";
|
|
7371
|
+
}
|
|
7372
|
+
if (char === "/") {
|
|
7373
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
7374
|
+
} else if (dots === 2) {
|
|
7375
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
7376
|
+
if (res.length > 2) {
|
|
7377
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
7378
|
+
if (lastSlashIndex === -1) {
|
|
7379
|
+
res = "";
|
|
7380
|
+
lastSegmentLength = 0;
|
|
7381
|
+
} else {
|
|
7382
|
+
res = res.slice(0, lastSlashIndex);
|
|
7383
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
7384
|
+
}
|
|
7385
|
+
lastSlash = index;
|
|
7386
|
+
dots = 0;
|
|
7387
|
+
continue;
|
|
7388
|
+
} else if (res.length > 0) {
|
|
7389
|
+
res = "";
|
|
7390
|
+
lastSegmentLength = 0;
|
|
7391
|
+
lastSlash = index;
|
|
7392
|
+
dots = 0;
|
|
7393
|
+
continue;
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7396
|
+
if (allowAboveRoot) {
|
|
7397
|
+
res += res.length > 0 ? "/.." : "..";
|
|
7398
|
+
lastSegmentLength = 2;
|
|
7399
|
+
}
|
|
7400
|
+
} else {
|
|
7401
|
+
if (res.length > 0) {
|
|
7402
|
+
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
7403
|
+
} else {
|
|
7404
|
+
res = path5.slice(lastSlash + 1, index);
|
|
7405
|
+
}
|
|
7406
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
7407
|
+
}
|
|
7408
|
+
lastSlash = index;
|
|
7409
|
+
dots = 0;
|
|
7410
|
+
} else if (char === "." && dots !== -1) {
|
|
7411
|
+
++dots;
|
|
7412
|
+
} else {
|
|
7413
|
+
dots = -1;
|
|
7414
|
+
}
|
|
7415
|
+
}
|
|
7416
|
+
return res;
|
|
7417
|
+
}
|
|
7418
|
+
__name(normalizeString3, "normalizeString");
|
|
7475
7419
|
|
|
7476
|
-
// ../
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
return
|
|
7481
|
-
} catch {
|
|
7482
|
-
return false;
|
|
7420
|
+
// ../path/src/file-path-fns.ts
|
|
7421
|
+
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
7422
|
+
const result = normalizeWindowsPath3(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
7423
|
+
if (requireExtension === true && !result.includes(".")) {
|
|
7424
|
+
return EMPTY_STRING;
|
|
7483
7425
|
}
|
|
7484
|
-
|
|
7426
|
+
if (withExtension === false && result.includes(".")) {
|
|
7427
|
+
return result.split(".").slice(-1).join(".") || EMPTY_STRING;
|
|
7428
|
+
}
|
|
7429
|
+
return result;
|
|
7430
|
+
}
|
|
7431
|
+
__name(findFileName, "findFileName");
|
|
7432
|
+
function findFilePath(filePath) {
|
|
7433
|
+
const normalizedPath = normalizeWindowsPath3(filePath);
|
|
7434
|
+
return normalizedPath.replace(findFileName(normalizedPath, {
|
|
7435
|
+
requireExtension: true
|
|
7436
|
+
}), "");
|
|
7437
|
+
}
|
|
7438
|
+
__name(findFilePath, "findFilePath");
|
|
7439
|
+
function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
|
|
7440
|
+
const paths = normalizeWindowsPath3(path5).split("/");
|
|
7441
|
+
let resolvedPath = "";
|
|
7442
|
+
let resolvedAbsolute = false;
|
|
7443
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
7444
|
+
const path6 = index >= 0 ? paths[index] : cwd2;
|
|
7445
|
+
if (!path6 || path6.length === 0) {
|
|
7446
|
+
continue;
|
|
7447
|
+
}
|
|
7448
|
+
resolvedPath = joinPaths(path6, resolvedPath);
|
|
7449
|
+
resolvedAbsolute = isAbsolutePath(path6);
|
|
7450
|
+
}
|
|
7451
|
+
resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
|
|
7452
|
+
if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
|
|
7453
|
+
return `/${resolvedPath}`;
|
|
7454
|
+
}
|
|
7455
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
7456
|
+
}
|
|
7457
|
+
__name(resolvePath, "resolvePath");
|
|
7458
|
+
function resolvePaths(...paths) {
|
|
7459
|
+
return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath3(path5))));
|
|
7460
|
+
}
|
|
7461
|
+
__name(resolvePaths, "resolvePaths");
|
|
7462
|
+
function relativePath(from, to) {
|
|
7463
|
+
const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7464
|
+
const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7465
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
7466
|
+
return _to.join("/");
|
|
7467
|
+
}
|
|
7468
|
+
const _fromCopy = [
|
|
7469
|
+
..._from
|
|
7470
|
+
];
|
|
7471
|
+
for (const segment of _fromCopy) {
|
|
7472
|
+
if (_to[0] !== segment) {
|
|
7473
|
+
break;
|
|
7474
|
+
}
|
|
7475
|
+
_from.shift();
|
|
7476
|
+
_to.shift();
|
|
7477
|
+
}
|
|
7478
|
+
return [
|
|
7479
|
+
..._from.map(() => ".."),
|
|
7480
|
+
..._to
|
|
7481
|
+
].join("/");
|
|
7482
|
+
}
|
|
7483
|
+
__name(relativePath, "relativePath");
|
|
7485
7484
|
|
|
7486
|
-
// ../
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
var
|
|
7491
|
-
|
|
7492
|
-
const
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
log: joinPaths(library, "Logs", orgId),
|
|
7498
|
-
temp: joinPaths(tmpdir, orgId)
|
|
7499
|
-
};
|
|
7500
|
-
}, "macos");
|
|
7501
|
-
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
7502
|
-
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
7503
|
-
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
7504
|
-
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
7505
|
-
return {
|
|
7506
|
-
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
7507
|
-
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
7508
|
-
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
7509
|
-
cache: joinPaths(localAppData, "Cache", orgId),
|
|
7510
|
-
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7511
|
-
temp: joinPaths(tmpdir, orgId)
|
|
7512
|
-
};
|
|
7513
|
-
}, "windows");
|
|
7514
|
-
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7515
|
-
const username = path.basename(homedir);
|
|
7516
|
-
return {
|
|
7517
|
-
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7518
|
-
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7519
|
-
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7520
|
-
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7521
|
-
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7522
|
-
temp: joinPaths(tmpdir, username, orgId)
|
|
7523
|
-
};
|
|
7524
|
-
}, "linux");
|
|
7525
|
-
function getEnvPaths(options = {}) {
|
|
7526
|
-
let orgId = options.orgId || "storm-software";
|
|
7527
|
-
if (!orgId) {
|
|
7528
|
-
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7485
|
+
// ../path/src/get-parent-path.ts
|
|
7486
|
+
var resolveParentPath = /* @__PURE__ */ __name((path5) => {
|
|
7487
|
+
return resolvePaths(path5, "..");
|
|
7488
|
+
}, "resolveParentPath");
|
|
7489
|
+
var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
|
|
7490
|
+
const ignoreCase = options?.ignoreCase ?? true;
|
|
7491
|
+
const skipCwd = options?.skipCwd ?? false;
|
|
7492
|
+
const targetType = options?.targetType ?? "both";
|
|
7493
|
+
let dir = cwd2;
|
|
7494
|
+
if (skipCwd) {
|
|
7495
|
+
dir = resolveParentPath(cwd2);
|
|
7529
7496
|
}
|
|
7530
|
-
|
|
7531
|
-
|
|
7497
|
+
let names = Array.isArray(name) ? name : [
|
|
7498
|
+
name
|
|
7499
|
+
];
|
|
7500
|
+
if (ignoreCase) {
|
|
7501
|
+
names = names.map((name2) => name2.toLowerCase());
|
|
7532
7502
|
}
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7503
|
+
while (true) {
|
|
7504
|
+
const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
|
|
7505
|
+
if (target) {
|
|
7506
|
+
return joinPaths(dir, target);
|
|
7507
|
+
}
|
|
7508
|
+
const parentDir = resolveParentPath(dir);
|
|
7509
|
+
if (parentDir === dir) {
|
|
7510
|
+
return void 0;
|
|
7511
|
+
}
|
|
7512
|
+
dir = parentDir;
|
|
7540
7513
|
}
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7514
|
+
}, "getParentPath");
|
|
7515
|
+
|
|
7516
|
+
// ../path/src/is-root-dir.ts
|
|
7517
|
+
init_esm_shims();
|
|
7518
|
+
var isSystemRoot = /* @__PURE__ */ __name((dir) => {
|
|
7519
|
+
return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
|
|
7520
|
+
}, "isSystemRoot");
|
|
7521
|
+
|
|
7522
|
+
// ../path/src/get-workspace-root.ts
|
|
7523
|
+
var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
|
|
7524
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7525
|
+
return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
|
|
7551
7526
|
}
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
result.log ??= joinPaths(result.temp, "logs");
|
|
7556
|
-
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7527
|
+
const root = findWorkspaceRootSafe(dir);
|
|
7528
|
+
if (root) {
|
|
7529
|
+
return root;
|
|
7557
7530
|
}
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7531
|
+
let result = getParentPath([
|
|
7532
|
+
"package-lock.json",
|
|
7533
|
+
"yarn.lock",
|
|
7534
|
+
"pnpm-lock.yaml",
|
|
7535
|
+
"bun.lock",
|
|
7536
|
+
"nx.json",
|
|
7537
|
+
"knip.json",
|
|
7538
|
+
"pnpm-workspace.yaml",
|
|
7539
|
+
"LICENSE",
|
|
7540
|
+
".all-contributorsrc",
|
|
7541
|
+
".whitesource",
|
|
7542
|
+
"syncpack.config.js",
|
|
7543
|
+
"syncpack.json",
|
|
7544
|
+
"socket.yaml",
|
|
7545
|
+
"lefthook.yaml",
|
|
7546
|
+
".npmrc",
|
|
7547
|
+
".log4brains.yml",
|
|
7548
|
+
".huskyrc",
|
|
7549
|
+
".husky",
|
|
7550
|
+
".lintstagedrc",
|
|
7551
|
+
".commitlintrc",
|
|
7552
|
+
"lefthook.yml",
|
|
7553
|
+
".github",
|
|
7554
|
+
".nx",
|
|
7555
|
+
".vscode",
|
|
7556
|
+
"patches"
|
|
7557
|
+
], dir);
|
|
7558
|
+
if (result) {
|
|
7559
|
+
return result;
|
|
7560
|
+
}
|
|
7561
|
+
result = dir;
|
|
7562
|
+
while (result && !isSystemRoot(result)) {
|
|
7563
|
+
result = getParentPath("storm.json", result, {
|
|
7564
|
+
skipCwd: true
|
|
7565
|
+
});
|
|
7566
|
+
if (result) {
|
|
7567
|
+
return result;
|
|
7565
7568
|
}
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
}
|
|
7569
|
-
__name(getEnvPaths, "getEnvPaths");
|
|
7569
|
+
}
|
|
7570
|
+
return dir;
|
|
7571
|
+
}, "getWorkspaceRoot");
|
|
7570
7572
|
|
|
7571
7573
|
// src/utils/get-jiti.ts
|
|
7572
7574
|
import { createJiti } from "jiti";
|
|
@@ -7620,18 +7622,6 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
|
|
|
7620
7622
|
namedImports: imports
|
|
7621
7623
|
});
|
|
7622
7624
|
}, "generateCreateRouterImport");
|
|
7623
|
-
var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, outputDir, value) => {
|
|
7624
|
-
let shieldPath = joinPaths(outputDir, "shield");
|
|
7625
|
-
if (typeof value === "string") {
|
|
7626
|
-
shieldPath = getRelativePath(outputDir, value, true, options.schemaPath);
|
|
7627
|
-
}
|
|
7628
|
-
sourceFile.addImportDeclaration({
|
|
7629
|
-
moduleSpecifier: shieldPath,
|
|
7630
|
-
namedImports: [
|
|
7631
|
-
"permissions"
|
|
7632
|
-
]
|
|
7633
|
-
});
|
|
7634
|
-
}, "generateShieldImport");
|
|
7635
7625
|
var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
|
|
7636
7626
|
sourceFile.addImportDeclaration({
|
|
7637
7627
|
moduleSpecifier: `./${modelNameCamelCase}.router`,
|
|
@@ -7640,9 +7630,22 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
|
|
|
7640
7630
|
]
|
|
7641
7631
|
});
|
|
7642
7632
|
}, "generateRouterImport");
|
|
7643
|
-
async function
|
|
7644
|
-
|
|
7645
|
-
|
|
7633
|
+
async function generateTRPCExports(sourceFile, config, options, outputDir) {
|
|
7634
|
+
if (config.withShield) {
|
|
7635
|
+
let shieldPath = joinPaths(outputDir, "shield");
|
|
7636
|
+
if (typeof config.withShield === "string") {
|
|
7637
|
+
shieldPath = getRelativePath(outputDir, config.withShield, true, options.schemaPath);
|
|
7638
|
+
}
|
|
7639
|
+
sourceFile.addImportDeclaration({
|
|
7640
|
+
moduleSpecifier: shieldPath,
|
|
7641
|
+
namedImports: [
|
|
7642
|
+
"permissions"
|
|
7643
|
+
]
|
|
7644
|
+
});
|
|
7645
|
+
sourceFile.formatText({
|
|
7646
|
+
indentSize: 2
|
|
7647
|
+
});
|
|
7648
|
+
}
|
|
7646
7649
|
sourceFile.addStatements(
|
|
7647
7650
|
/* ts */
|
|
7648
7651
|
`
|
|
@@ -7762,7 +7765,7 @@ export const createCallerFactory = t.createCallerFactory;`
|
|
|
7762
7765
|
);
|
|
7763
7766
|
}
|
|
7764
7767
|
}
|
|
7765
|
-
__name(
|
|
7768
|
+
__name(generateTRPCExports, "generateTRPCExports");
|
|
7766
7769
|
function generateProcedure(sourceFile, name, typeName, modelName, opType, baseOpType, config) {
|
|
7767
7770
|
let input = `input${!config.withZod ? " as any" : ""}`;
|
|
7768
7771
|
const nameWithoutModel = name.replace(modelName, "");
|
|
@@ -11648,11 +11651,11 @@ async function generate(options) {
|
|
|
11648
11651
|
subscriptions.sort();
|
|
11649
11652
|
if (config.withShield !== false) {
|
|
11650
11653
|
consoleLog("Generating tRPC Shield");
|
|
11651
|
-
if (typeof config.withShield === "string" && (existsSync(
|
|
11654
|
+
if (typeof config.withShield === "string" && (existsSync(config.withShield) || existsSync(`${config.withShield}.ts`) || existsSync(joinPaths(config.withShield, "shield.ts")))) {
|
|
11652
11655
|
consoleLog("Skipping tRPC Shield generation as path provided already exists");
|
|
11653
11656
|
} else {
|
|
11654
|
-
consoleLog("Constructing tRPC Shield source file");
|
|
11655
11657
|
const shieldOutputDir = typeof config.withShield === "string" ? config.withShield : outputDir;
|
|
11658
|
+
consoleLog(`Constructing tRPC Shield source file in ${shieldOutputDir}`);
|
|
11656
11659
|
const shieldText = await constructShield({
|
|
11657
11660
|
queries,
|
|
11658
11661
|
mutations,
|
|
@@ -11671,18 +11674,12 @@ async function generate(options) {
|
|
|
11671
11674
|
await writeFileSafely(trpcOptionsOutputPath, constructDefaultOptions(config, options, trpcOptionsOutputPath));
|
|
11672
11675
|
}
|
|
11673
11676
|
resolveModelsComments(models, hiddenModels);
|
|
11677
|
+
consoleLog("Generating tRPC export file");
|
|
11674
11678
|
const trpcExports = project.createSourceFile(path4.resolve(outputDir, "trpc.ts"), void 0, {
|
|
11675
11679
|
overwrite: true
|
|
11676
11680
|
});
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
await generateShieldImport(trpcExports, options, outputDir, config.withShield);
|
|
11680
|
-
}
|
|
11681
|
-
consoleLog("Generating tRPC base router");
|
|
11682
|
-
await generateBaseRouter(trpcExports, config, options);
|
|
11683
|
-
trpcExports.formatText({
|
|
11684
|
-
indentSize: 2
|
|
11685
|
-
});
|
|
11681
|
+
await generateTRPCExports(trpcExports, config, options, outputDir);
|
|
11682
|
+
consoleLog("Generating tRPC app router");
|
|
11686
11683
|
const appRouter = project.createSourceFile(path4.resolve(outputDir, "routers", `index.ts`), void 0, {
|
|
11687
11684
|
overwrite: true
|
|
11688
11685
|
});
|