@visulima/package 1.7.6 → 1.8.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 (64) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/chunk-5VO6NTKJ.js +361 -0
  3. package/dist/chunk-5VO6NTKJ.js.map +1 -0
  4. package/dist/chunk-7IOK6YPW.cjs +52 -0
  5. package/dist/chunk-7IOK6YPW.cjs.map +1 -0
  6. package/dist/chunk-CVVFWSMT.cjs +65 -0
  7. package/dist/chunk-CVVFWSMT.cjs.map +1 -0
  8. package/dist/chunk-E2PKJX3Q.js +54 -0
  9. package/dist/chunk-E2PKJX3Q.js.map +1 -0
  10. package/dist/chunk-EYMR7Z2I.js +62 -0
  11. package/dist/chunk-EYMR7Z2I.js.map +1 -0
  12. package/dist/chunk-G3SI24AJ.cjs +88 -0
  13. package/dist/{chunk-6KT7465D.cjs.map → chunk-G3SI24AJ.cjs.map} +1 -1
  14. package/dist/chunk-IIYQBLPC.js +119 -0
  15. package/dist/chunk-IIYQBLPC.js.map +1 -0
  16. package/dist/chunk-IK5YSYLX.cjs +126 -0
  17. package/dist/chunk-IK5YSYLX.cjs.map +1 -0
  18. package/dist/chunk-UZ2FN6C5.js +78 -0
  19. package/dist/{chunk-U4YVB3GU.js.map → chunk-UZ2FN6C5.js.map} +1 -1
  20. package/dist/chunk-WXFZK4G3.cjs +374 -0
  21. package/dist/chunk-WXFZK4G3.cjs.map +1 -0
  22. package/dist/chunk-YLCN7EVV.js +50 -0
  23. package/dist/chunk-YLCN7EVV.js.map +1 -0
  24. package/dist/chunk-YOQXHFU3.cjs +56 -0
  25. package/dist/chunk-YOQXHFU3.cjs.map +1 -0
  26. package/dist/error.cjs +5 -5
  27. package/dist/error.js +3 -3
  28. package/dist/index.cjs +102 -53
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +58 -9
  31. package/dist/index.js.map +1 -1
  32. package/dist/monorepo.cjs +5 -5
  33. package/dist/monorepo.js +3 -3
  34. package/dist/package-json.cjs +11 -11
  35. package/dist/package-json.js +1 -1
  36. package/dist/package-manager.cjs +14 -14
  37. package/dist/package-manager.js +2 -2
  38. package/dist/package.cjs +7 -7
  39. package/dist/package.js +3 -3
  40. package/dist/tsconfig.cjs +15 -15
  41. package/dist/tsconfig.js +1 -1
  42. package/package.json +7 -7
  43. package/dist/chunk-44SW4DFI.js +0 -12
  44. package/dist/chunk-44SW4DFI.js.map +0 -1
  45. package/dist/chunk-5YG33J5B.cjs +0 -13
  46. package/dist/chunk-5YG33J5B.cjs.map +0 -1
  47. package/dist/chunk-6KT7465D.cjs +0 -22
  48. package/dist/chunk-DNYCFU7L.cjs +0 -9
  49. package/dist/chunk-DNYCFU7L.cjs.map +0 -1
  50. package/dist/chunk-GMIFPTPB.js +0 -11
  51. package/dist/chunk-GMIFPTPB.js.map +0 -1
  52. package/dist/chunk-I3QTPGJY.js +0 -10
  53. package/dist/chunk-I3QTPGJY.js.map +0 -1
  54. package/dist/chunk-KSXRMTAQ.cjs +0 -19
  55. package/dist/chunk-KSXRMTAQ.cjs.map +0 -1
  56. package/dist/chunk-NKFQML4S.js +0 -15
  57. package/dist/chunk-NKFQML4S.js.map +0 -1
  58. package/dist/chunk-PGLLS3ER.cjs +0 -28
  59. package/dist/chunk-PGLLS3ER.cjs.map +0 -1
  60. package/dist/chunk-U4YVB3GU.js +0 -12
  61. package/dist/chunk-WOLHGXXJ.cjs +0 -13
  62. package/dist/chunk-WOLHGXXJ.cjs.map +0 -1
  63. package/dist/chunk-ZDLZRGSC.js +0 -7
  64. package/dist/chunk-ZDLZRGSC.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,107 +1,156 @@
1
1
  'use strict';
2
2
 
3
- var chunkDNYCFU7L_cjs = require('./chunk-DNYCFU7L.cjs');
4
- var chunkWOLHGXXJ_cjs = require('./chunk-WOLHGXXJ.cjs');
5
- var chunk5YG33J5B_cjs = require('./chunk-5YG33J5B.cjs');
6
- var chunkKSXRMTAQ_cjs = require('./chunk-KSXRMTAQ.cjs');
7
- var chunk6KT7465D_cjs = require('./chunk-6KT7465D.cjs');
8
- var chunkPGLLS3ER_cjs = require('./chunk-PGLLS3ER.cjs');
3
+ var chunk7IOK6YPW_cjs = require('./chunk-7IOK6YPW.cjs');
4
+ var chunkYOQXHFU3_cjs = require('./chunk-YOQXHFU3.cjs');
5
+ var chunkCVVFWSMT_cjs = require('./chunk-CVVFWSMT.cjs');
6
+ var chunkIK5YSYLX_cjs = require('./chunk-IK5YSYLX.cjs');
7
+ var chunkG3SI24AJ_cjs = require('./chunk-G3SI24AJ.cjs');
8
+ var chunkWXFZK4G3_cjs = require('./chunk-WXFZK4G3.cjs');
9
9
  var fs = require('fs');
10
10
  var process = require('process');
11
11
  var fs$1 = require('@visulima/fs');
12
12
  var pathe = require('pathe');
13
13
 
14
- var d=(r,e)=>(e?.create&&fs$1.ensureDirSync(r),r),L=async(r,e)=>{if(process.env.CACHE_DIR&&!["0","1","false","true"].includes(process.env.CACHE_DIR))return d(pathe.join(process.env.CACHE_DIR,r),e);let s=await chunk5YG33J5B_cjs.a(e?.cwd??process.cwd());if(!s)return;let o=pathe.join(s,"node_modules"),t=pathe.join(o,".cache"),i=pathe.join(t,r);if(!(fs.existsSync(i)&&!await fs$1.isAccessible(i,fs$1.W_OK))&&!(fs.existsSync(t)&&!await fs$1.isAccessible(t,fs$1.W_OK))&&!(fs.existsSync(o)&&!await fs$1.isAccessible(o,fs$1.W_OK)))return d(i,e)},j=(r,e)=>{if(process.env.CACHE_DIR&&!["0","1","false","true"].includes(process.env.CACHE_DIR))return d(pathe.join(process.env.CACHE_DIR,r),e);let s=chunk5YG33J5B_cjs.b(e?.cwd??process.cwd());if(!s)return;let o=pathe.join(s,"node_modules"),t=pathe.join(o,".cache"),i=pathe.join(t,r);if(!(fs.existsSync(i)&&!fs$1.isAccessibleSync(i,fs$1.W_OK))&&!(fs.existsSync(t)&&!fs$1.isAccessibleSync(t,fs$1.W_OK))&&!(fs.existsSync(o)&&!fs$1.isAccessibleSync(o,fs$1.W_OK)))return d(i,e)};
14
+ var useDirectory = (directory, options) => {
15
+ if (options?.create) {
16
+ fs$1.ensureDirSync(directory);
17
+ }
18
+ return directory;
19
+ };
20
+ var findCacheDirectory = async (name, options) => {
21
+ if (process.env.CACHE_DIR && !["0", "1", "false", "true"].includes(process.env.CACHE_DIR)) {
22
+ return useDirectory(pathe.join(process.env.CACHE_DIR, name), options);
23
+ }
24
+ const rootDirectory = await chunkCVVFWSMT_cjs.findPackageRoot(options?.cwd ?? process.cwd());
25
+ if (!rootDirectory) {
26
+ return void 0;
27
+ }
28
+ const nodeModulesDirectory = pathe.join(rootDirectory, "node_modules");
29
+ const cacheDirectory = pathe.join(nodeModulesDirectory, ".cache");
30
+ const cacheNameDirectory = pathe.join(cacheDirectory, name);
31
+ if (fs.existsSync(cacheNameDirectory) && !await fs$1.isAccessible(cacheNameDirectory, fs$1.W_OK)) {
32
+ return void 0;
33
+ }
34
+ if (fs.existsSync(cacheDirectory) && !await fs$1.isAccessible(cacheDirectory, fs$1.W_OK)) {
35
+ return void 0;
36
+ }
37
+ if (fs.existsSync(nodeModulesDirectory) && !await fs$1.isAccessible(nodeModulesDirectory, fs$1.W_OK)) {
38
+ return void 0;
39
+ }
40
+ return useDirectory(cacheNameDirectory, options);
41
+ };
42
+ var findCacheDirectorySync = (name, options) => {
43
+ if (process.env.CACHE_DIR && !["0", "1", "false", "true"].includes(process.env.CACHE_DIR)) {
44
+ return useDirectory(pathe.join(process.env.CACHE_DIR, name), options);
45
+ }
46
+ const rootDirectory = chunkCVVFWSMT_cjs.findPackageRootSync(options?.cwd ?? process.cwd());
47
+ if (!rootDirectory) {
48
+ return void 0;
49
+ }
50
+ const nodeModulesDirectory = pathe.join(rootDirectory, "node_modules");
51
+ const cacheDirectory = pathe.join(nodeModulesDirectory, ".cache");
52
+ const cacheNameDirectory = pathe.join(cacheDirectory, name);
53
+ if (fs.existsSync(cacheNameDirectory) && !fs$1.isAccessibleSync(cacheNameDirectory, fs$1.W_OK)) {
54
+ return void 0;
55
+ }
56
+ if (fs.existsSync(cacheDirectory) && !fs$1.isAccessibleSync(cacheDirectory, fs$1.W_OK)) {
57
+ return void 0;
58
+ }
59
+ if (fs.existsSync(nodeModulesDirectory) && !fs$1.isAccessibleSync(nodeModulesDirectory, fs$1.W_OK)) {
60
+ return void 0;
61
+ }
62
+ return useDirectory(cacheNameDirectory, options);
63
+ };
15
64
 
16
65
  Object.defineProperty(exports, 'PackageNotFoundError', {
17
- enumerable: true,
18
- get: function () { return chunkDNYCFU7L_cjs.a; }
66
+ enumerable: true,
67
+ get: function () { return chunk7IOK6YPW_cjs.package_not_found_error_default; }
19
68
  });
20
69
  Object.defineProperty(exports, 'findMonorepoRoot', {
21
- enumerable: true,
22
- get: function () { return chunkWOLHGXXJ_cjs.a; }
70
+ enumerable: true,
71
+ get: function () { return chunkYOQXHFU3_cjs.findMonorepoRoot; }
23
72
  });
24
73
  Object.defineProperty(exports, 'findPackageRoot', {
25
- enumerable: true,
26
- get: function () { return chunk5YG33J5B_cjs.a; }
74
+ enumerable: true,
75
+ get: function () { return chunkCVVFWSMT_cjs.findPackageRoot; }
27
76
  });
28
77
  Object.defineProperty(exports, 'findPackageRootSync', {
29
- enumerable: true,
30
- get: function () { return chunk5YG33J5B_cjs.b; }
78
+ enumerable: true,
79
+ get: function () { return chunkCVVFWSMT_cjs.findPackageRootSync; }
31
80
  });
32
81
  Object.defineProperty(exports, 'findLockFile', {
33
- enumerable: true,
34
- get: function () { return chunkKSXRMTAQ_cjs.a; }
82
+ enumerable: true,
83
+ get: function () { return chunkIK5YSYLX_cjs.findLockFile; }
35
84
  });
36
85
  Object.defineProperty(exports, 'findLockFileSync', {
37
- enumerable: true,
38
- get: function () { return chunkKSXRMTAQ_cjs.b; }
86
+ enumerable: true,
87
+ get: function () { return chunkIK5YSYLX_cjs.findLockFileSync; }
39
88
  });
40
89
  Object.defineProperty(exports, 'findPackageManager', {
41
- enumerable: true,
42
- get: function () { return chunkKSXRMTAQ_cjs.c; }
90
+ enumerable: true,
91
+ get: function () { return chunkIK5YSYLX_cjs.findPackageManager; }
43
92
  });
44
93
  Object.defineProperty(exports, 'findPackageManagerSync', {
45
- enumerable: true,
46
- get: function () { return chunkKSXRMTAQ_cjs.d; }
94
+ enumerable: true,
95
+ get: function () { return chunkIK5YSYLX_cjs.findPackageManagerSync; }
47
96
  });
48
97
  Object.defineProperty(exports, 'getPackageManagerVersion', {
49
- enumerable: true,
50
- get: function () { return chunkKSXRMTAQ_cjs.e; }
98
+ enumerable: true,
99
+ get: function () { return chunkIK5YSYLX_cjs.getPackageManagerVersion; }
51
100
  });
52
101
  Object.defineProperty(exports, 'identifyInitiatingPackageManager', {
53
- enumerable: true,
54
- get: function () { return chunkKSXRMTAQ_cjs.f; }
102
+ enumerable: true,
103
+ get: function () { return chunkIK5YSYLX_cjs.identifyInitiatingPackageManager; }
55
104
  });
56
105
  Object.defineProperty(exports, 'findPackageJson', {
57
- enumerable: true,
58
- get: function () { return chunk6KT7465D_cjs.a; }
106
+ enumerable: true,
107
+ get: function () { return chunkG3SI24AJ_cjs.findPackageJson; }
59
108
  });
60
109
  Object.defineProperty(exports, 'findPackageJsonSync', {
61
- enumerable: true,
62
- get: function () { return chunk6KT7465D_cjs.b; }
110
+ enumerable: true,
111
+ get: function () { return chunkG3SI24AJ_cjs.findPackageJsonSync; }
63
112
  });
64
113
  Object.defineProperty(exports, 'parsePackageJson', {
65
- enumerable: true,
66
- get: function () { return chunk6KT7465D_cjs.e; }
114
+ enumerable: true,
115
+ get: function () { return chunkG3SI24AJ_cjs.parsePackageJson; }
67
116
  });
68
117
  Object.defineProperty(exports, 'writePackageJson', {
69
- enumerable: true,
70
- get: function () { return chunk6KT7465D_cjs.c; }
118
+ enumerable: true,
119
+ get: function () { return chunkG3SI24AJ_cjs.writePackageJson; }
71
120
  });
72
121
  Object.defineProperty(exports, 'writePackageJsonSync', {
73
- enumerable: true,
74
- get: function () { return chunk6KT7465D_cjs.d; }
122
+ enumerable: true,
123
+ get: function () { return chunkG3SI24AJ_cjs.writePackageJsonSync; }
75
124
  });
76
125
  Object.defineProperty(exports, 'findTSConfig', {
77
- enumerable: true,
78
- get: function () { return chunkPGLLS3ER_cjs.d; }
126
+ enumerable: true,
127
+ get: function () { return chunkWXFZK4G3_cjs.findTSConfig; }
79
128
  });
80
129
  Object.defineProperty(exports, 'findTSConfigSync', {
81
- enumerable: true,
82
- get: function () { return chunkPGLLS3ER_cjs.f; }
130
+ enumerable: true,
131
+ get: function () { return chunkWXFZK4G3_cjs.findTSConfigSync; }
83
132
  });
84
133
  Object.defineProperty(exports, 'findTsConfig', {
85
- enumerable: true,
86
- get: function () { return chunkPGLLS3ER_cjs.c; }
134
+ enumerable: true,
135
+ get: function () { return chunkWXFZK4G3_cjs.findTsConfig; }
87
136
  });
88
137
  Object.defineProperty(exports, 'findTsConfigSync', {
89
- enumerable: true,
90
- get: function () { return chunkPGLLS3ER_cjs.e; }
138
+ enumerable: true,
139
+ get: function () { return chunkWXFZK4G3_cjs.findTsConfigSync; }
91
140
  });
92
141
  Object.defineProperty(exports, 'implicitBaseUrlSymbol', {
93
- enumerable: true,
94
- get: function () { return chunkPGLLS3ER_cjs.a; }
142
+ enumerable: true,
143
+ get: function () { return chunkWXFZK4G3_cjs.implicitBaseUrlSymbol; }
95
144
  });
96
145
  Object.defineProperty(exports, 'readTsConfig', {
97
- enumerable: true,
98
- get: function () { return chunkPGLLS3ER_cjs.b; }
146
+ enumerable: true,
147
+ get: function () { return chunkWXFZK4G3_cjs.readTsConfig; }
99
148
  });
100
149
  Object.defineProperty(exports, 'writeTSConfig', {
101
- enumerable: true,
102
- get: function () { return chunkPGLLS3ER_cjs.h; }
150
+ enumerable: true,
151
+ get: function () { return chunkWXFZK4G3_cjs.writeTSConfig; }
103
152
  });
104
- exports.findCacheDirectory = L;
105
- exports.findCacheDirectorySync = j;
153
+ exports.findCacheDirectory = findCacheDirectory;
154
+ exports.findCacheDirectorySync = findCacheDirectorySync;
106
155
  //# sourceMappingURL=out.js.map
107
156
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/find-cache-dir.ts"],"names":["existsSync","cwd","env","ensureDirSync","isAccessible","isAccessibleSync","W_OK","join","useDirectory","directory","options","findCacheDirectory","name","rootDirectory","findPackageRoot","nodeModulesDirectory","cacheDirectory","cacheNameDirectory","findCacheDirectorySync","findPackageRootSync"],"mappings":"sWACA,OAAS,cAAAA,MAAkB,KAC3B,OAAS,OAAAC,EAAK,OAAAC,MAAW,UAEzB,OAAS,iBAAAC,EAAe,gBAAAC,EAAc,oBAAAC,EAAkB,QAAAC,MAAY,eACpE,OAAS,QAAAC,MAAY,QASrB,IAAMC,EAAe,CAACC,EAAmBC,KACjCA,GAAS,QACTP,EAAcM,CAAS,EAGpBA,GAGEE,EAAqB,MAAOC,EAAcF,IAAmD,CACtG,GAAIR,EAAI,WAAa,CAAC,CAAC,IAAK,IAAK,QAAS,MAAM,EAAE,SAASA,EAAI,SAAS,EACpE,OAAOM,EAAaD,EAAKL,EAAI,UAAWU,CAAI,EAAGF,CAAO,EAG1D,IAAMG,EAAgB,MAAMC,EAAgBJ,GAAS,KAAOT,EAAI,CAAC,EAEjE,GAAI,CAACY,EACD,OAGJ,IAAME,EAAuBR,EAAKM,EAAe,cAAc,EACzDG,EAAiBT,EAAKQ,EAAsB,QAAQ,EACpDE,EAAqBV,EAAKS,EAAgBJ,CAAI,EAMpD,GAAI,EAAAZ,EAAWiB,CAAkB,GAAK,CAAE,MAAMb,EAAaa,EAAoBX,CAAI,IAK/E,EAAAN,EAAWgB,CAAc,GAAK,CAAE,MAAMZ,EAAaY,EAAgBV,CAAI,IAKvE,EAAAN,EAAWe,CAAoB,GAAK,CAAE,MAAMX,EAAaW,EAAsBT,CAAI,GAIvF,OAAOE,EAAaS,EAAoBP,CAAO,CACnD,EAEaQ,EAAyB,CAACN,EAAcF,IAA0C,CAC3F,GAAIR,EAAI,WAAa,CAAC,CAAC,IAAK,IAAK,QAAS,MAAM,EAAE,SAASA,EAAI,SAAS,EACpE,OAAOM,EAAaD,EAAKL,EAAI,UAAWU,CAAI,EAAGF,CAAO,EAG1D,IAAMG,EAAgBM,EAAoBT,GAAS,KAAOT,EAAI,CAAC,EAE/D,GAAI,CAACY,EACD,OAGJ,IAAME,EAAuBR,EAAKM,EAAe,cAAc,EACzDG,EAAiBT,EAAKQ,EAAsB,QAAQ,EACpDE,EAAqBV,EAAKS,EAAgBJ,CAAI,EAMpD,GAAI,EAAAZ,EAAWiB,CAAkB,GAAK,CAACZ,EAAiBY,EAAoBX,CAAI,IAK5E,EAAAN,EAAWgB,CAAc,GAAK,CAACX,EAAiBW,EAAgBV,CAAI,IAKpE,EAAAN,EAAWe,CAAoB,GAAK,CAACV,EAAiBU,EAAsBT,CAAI,GAIpF,OAAOE,EAAaS,EAAoBP,CAAO,CACnD","sourcesContent":["// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { cwd, env } from \"node:process\";\n\nimport { ensureDirSync, isAccessible, isAccessibleSync, W_OK } from \"@visulima/fs\";\nimport { join } from \"pathe\";\n\nimport { findPackageRoot, findPackageRootSync } from \"./package\";\n\ntype Options = {\n create?: boolean;\n cwd?: URL | string;\n};\n\nconst useDirectory = (directory: string, options?: Options): string => {\n if (options?.create) {\n ensureDirSync(directory);\n }\n\n return directory;\n};\n\nexport const findCacheDirectory = async (name: string, options?: Options): Promise<string | undefined> => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = await findPackageRoot(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !(await isAccessible(cacheNameDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !(await isAccessible(cacheDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !(await isAccessible(nodeModulesDirectory, W_OK))) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n\nexport const findCacheDirectorySync = (name: string, options?: Options): string | undefined => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = findPackageRootSync(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !isAccessibleSync(cacheNameDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !isAccessibleSync(cacheDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !isAccessibleSync(nodeModulesDirectory, W_OK)) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n"]}
1
+ {"version":3,"sources":["../src/find-cache-dir.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,KAAK,WAAW;AAEzB,SAAS,eAAe,cAAc,kBAAkB,YAAY;AACpE,SAAS,YAAY;AASrB,IAAM,eAAe,CAAC,WAAmB,YAA8B;AACnE,MAAI,SAAS,QAAQ;AACjB,kBAAc,SAAS;AAAA,EAC3B;AAEA,SAAO;AACX;AAEO,IAAM,qBAAqB,OAAO,MAAc,YAAmD;AACtG,MAAI,IAAI,aAAa,CAAC,CAAC,KAAK,KAAK,SAAS,MAAM,EAAE,SAAS,IAAI,SAAS,GAAG;AACvE,WAAO,aAAa,KAAK,IAAI,WAAW,IAAI,GAAG,OAAO;AAAA,EAC1D;AAEA,QAAM,gBAAgB,MAAM,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAEjE,MAAI,CAAC,eAAe;AAChB,WAAO;AAAA,EACX;AAEA,QAAM,uBAAuB,KAAK,eAAe,cAAc;AAC/D,QAAM,iBAAiB,KAAK,sBAAsB,QAAQ;AAC1D,QAAM,qBAAqB,KAAK,gBAAgB,IAAI;AAMpD,MAAI,WAAW,kBAAkB,KAAK,CAAE,MAAM,aAAa,oBAAoB,IAAI,GAAI;AACnF,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,cAAc,KAAK,CAAE,MAAM,aAAa,gBAAgB,IAAI,GAAI;AAC3E,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,oBAAoB,KAAK,CAAE,MAAM,aAAa,sBAAsB,IAAI,GAAI;AACvF,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,oBAAoB,OAAO;AACnD;AAEO,IAAM,yBAAyB,CAAC,MAAc,YAA0C;AAC3F,MAAI,IAAI,aAAa,CAAC,CAAC,KAAK,KAAK,SAAS,MAAM,EAAE,SAAS,IAAI,SAAS,GAAG;AACvE,WAAO,aAAa,KAAK,IAAI,WAAW,IAAI,GAAG,OAAO;AAAA,EAC1D;AAEA,QAAM,gBAAgB,oBAAoB,SAAS,OAAO,IAAI,CAAC;AAE/D,MAAI,CAAC,eAAe;AAChB,WAAO;AAAA,EACX;AAEA,QAAM,uBAAuB,KAAK,eAAe,cAAc;AAC/D,QAAM,iBAAiB,KAAK,sBAAsB,QAAQ;AAC1D,QAAM,qBAAqB,KAAK,gBAAgB,IAAI;AAMpD,MAAI,WAAW,kBAAkB,KAAK,CAAC,iBAAiB,oBAAoB,IAAI,GAAG;AAC/E,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,cAAc,KAAK,CAAC,iBAAiB,gBAAgB,IAAI,GAAG;AACvE,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,oBAAoB,KAAK,CAAC,iBAAiB,sBAAsB,IAAI,GAAG;AACnF,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,oBAAoB,OAAO;AACnD","sourcesContent":["// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { cwd, env } from \"node:process\";\n\nimport { ensureDirSync, isAccessible, isAccessibleSync, W_OK } from \"@visulima/fs\";\nimport { join } from \"pathe\";\n\nimport { findPackageRoot, findPackageRootSync } from \"./package\";\n\ntype Options = {\n create?: boolean;\n cwd?: URL | string;\n};\n\nconst useDirectory = (directory: string, options?: Options): string => {\n if (options?.create) {\n ensureDirSync(directory);\n }\n\n return directory;\n};\n\nexport const findCacheDirectory = async (name: string, options?: Options): Promise<string | undefined> => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = await findPackageRoot(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !(await isAccessible(cacheNameDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !(await isAccessible(cacheDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !(await isAccessible(nodeModulesDirectory, W_OK))) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n\nexport const findCacheDirectorySync = (name: string, options?: Options): string | undefined => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = findPackageRootSync(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !isAccessibleSync(cacheNameDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !isAccessibleSync(cacheDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !isAccessibleSync(nodeModulesDirectory, W_OK)) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n"]}
package/dist/index.js CHANGED
@@ -1,17 +1,66 @@
1
- export { a as PackageNotFoundError } from './chunk-ZDLZRGSC.js';
2
- export { a as findMonorepoRoot } from './chunk-GMIFPTPB.js';
3
- import { a, b } from './chunk-I3QTPGJY.js';
4
- export { a as findPackageRoot, b as findPackageRootSync } from './chunk-I3QTPGJY.js';
5
- export { a as findLockFile, b as findLockFileSync, c as findPackageManager, d as findPackageManagerSync, e as getPackageManagerVersion, f as identifyInitiatingPackageManager } from './chunk-44SW4DFI.js';
6
- export { a as findPackageJson, b as findPackageJsonSync, e as parsePackageJson, c as writePackageJson, d as writePackageJsonSync } from './chunk-U4YVB3GU.js';
7
- export { d as findTSConfig, f as findTSConfigSync, c as findTsConfig, e as findTsConfigSync, a as implicitBaseUrlSymbol, b as readTsConfig, h as writeTSConfig } from './chunk-NKFQML4S.js';
1
+ export { package_not_found_error_default as PackageNotFoundError } from './chunk-YLCN7EVV.js';
2
+ export { findMonorepoRoot } from './chunk-E2PKJX3Q.js';
3
+ import { findPackageRoot, findPackageRootSync } from './chunk-EYMR7Z2I.js';
4
+ export { findPackageRoot, findPackageRootSync } from './chunk-EYMR7Z2I.js';
5
+ export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './chunk-IIYQBLPC.js';
6
+ export { findPackageJson, findPackageJsonSync, parsePackageJson, writePackageJson, writePackageJsonSync } from './chunk-UZ2FN6C5.js';
7
+ export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig } from './chunk-5VO6NTKJ.js';
8
8
  import { existsSync } from 'node:fs';
9
9
  import { env, cwd } from 'node:process';
10
10
  import { isAccessible, W_OK, isAccessibleSync, ensureDirSync } from '@visulima/fs';
11
11
  import { join } from 'pathe';
12
12
 
13
- var d=(r,e)=>(e?.create&&ensureDirSync(r),r),j=async(r,e)=>{if(env.CACHE_DIR&&!["0","1","false","true"].includes(env.CACHE_DIR))return d(join(env.CACHE_DIR,r),e);let s=await a(e?.cwd??cwd());if(!s)return;let o=join(s,"node_modules"),t=join(o,".cache"),i=join(t,r);if(!(existsSync(i)&&!await isAccessible(i,W_OK))&&!(existsSync(t)&&!await isAccessible(t,W_OK))&&!(existsSync(o)&&!await isAccessible(o,W_OK)))return d(i,e)},v=(r,e)=>{if(env.CACHE_DIR&&!["0","1","false","true"].includes(env.CACHE_DIR))return d(join(env.CACHE_DIR,r),e);let s=b(e?.cwd??cwd());if(!s)return;let o=join(s,"node_modules"),t=join(o,".cache"),i=join(t,r);if(!(existsSync(i)&&!isAccessibleSync(i,W_OK))&&!(existsSync(t)&&!isAccessibleSync(t,W_OK))&&!(existsSync(o)&&!isAccessibleSync(o,W_OK)))return d(i,e)};
13
+ var useDirectory = (directory, options) => {
14
+ if (options?.create) {
15
+ ensureDirSync(directory);
16
+ }
17
+ return directory;
18
+ };
19
+ var findCacheDirectory = async (name, options) => {
20
+ if (env.CACHE_DIR && !["0", "1", "false", "true"].includes(env.CACHE_DIR)) {
21
+ return useDirectory(join(env.CACHE_DIR, name), options);
22
+ }
23
+ const rootDirectory = await findPackageRoot(options?.cwd ?? cwd());
24
+ if (!rootDirectory) {
25
+ return void 0;
26
+ }
27
+ const nodeModulesDirectory = join(rootDirectory, "node_modules");
28
+ const cacheDirectory = join(nodeModulesDirectory, ".cache");
29
+ const cacheNameDirectory = join(cacheDirectory, name);
30
+ if (existsSync(cacheNameDirectory) && !await isAccessible(cacheNameDirectory, W_OK)) {
31
+ return void 0;
32
+ }
33
+ if (existsSync(cacheDirectory) && !await isAccessible(cacheDirectory, W_OK)) {
34
+ return void 0;
35
+ }
36
+ if (existsSync(nodeModulesDirectory) && !await isAccessible(nodeModulesDirectory, W_OK)) {
37
+ return void 0;
38
+ }
39
+ return useDirectory(cacheNameDirectory, options);
40
+ };
41
+ var findCacheDirectorySync = (name, options) => {
42
+ if (env.CACHE_DIR && !["0", "1", "false", "true"].includes(env.CACHE_DIR)) {
43
+ return useDirectory(join(env.CACHE_DIR, name), options);
44
+ }
45
+ const rootDirectory = findPackageRootSync(options?.cwd ?? cwd());
46
+ if (!rootDirectory) {
47
+ return void 0;
48
+ }
49
+ const nodeModulesDirectory = join(rootDirectory, "node_modules");
50
+ const cacheDirectory = join(nodeModulesDirectory, ".cache");
51
+ const cacheNameDirectory = join(cacheDirectory, name);
52
+ if (existsSync(cacheNameDirectory) && !isAccessibleSync(cacheNameDirectory, W_OK)) {
53
+ return void 0;
54
+ }
55
+ if (existsSync(cacheDirectory) && !isAccessibleSync(cacheDirectory, W_OK)) {
56
+ return void 0;
57
+ }
58
+ if (existsSync(nodeModulesDirectory) && !isAccessibleSync(nodeModulesDirectory, W_OK)) {
59
+ return void 0;
60
+ }
61
+ return useDirectory(cacheNameDirectory, options);
62
+ };
14
63
 
15
- export { j as findCacheDirectory, v as findCacheDirectorySync };
64
+ export { findCacheDirectory, findCacheDirectorySync };
16
65
  //# sourceMappingURL=out.js.map
17
66
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/find-cache-dir.ts"],"names":["existsSync","cwd","env","ensureDirSync","isAccessible","isAccessibleSync","W_OK","join","useDirectory","directory","options","findCacheDirectory","name","rootDirectory","findPackageRoot","nodeModulesDirectory","cacheDirectory","cacheNameDirectory","findCacheDirectorySync","findPackageRootSync"],"mappings":"gWACA,OAAS,cAAAA,MAAkB,UAC3B,OAAS,OAAAC,EAAK,OAAAC,MAAW,eAEzB,OAAS,iBAAAC,EAAe,gBAAAC,EAAc,oBAAAC,EAAkB,QAAAC,MAAY,eACpE,OAAS,QAAAC,MAAY,QASrB,IAAMC,EAAe,CAACC,EAAmBC,KACjCA,GAAS,QACTP,EAAcM,CAAS,EAGpBA,GAGEE,EAAqB,MAAOC,EAAcF,IAAmD,CACtG,GAAIR,EAAI,WAAa,CAAC,CAAC,IAAK,IAAK,QAAS,MAAM,EAAE,SAASA,EAAI,SAAS,EACpE,OAAOM,EAAaD,EAAKL,EAAI,UAAWU,CAAI,EAAGF,CAAO,EAG1D,IAAMG,EAAgB,MAAMC,EAAgBJ,GAAS,KAAOT,EAAI,CAAC,EAEjE,GAAI,CAACY,EACD,OAGJ,IAAME,EAAuBR,EAAKM,EAAe,cAAc,EACzDG,EAAiBT,EAAKQ,EAAsB,QAAQ,EACpDE,EAAqBV,EAAKS,EAAgBJ,CAAI,EAMpD,GAAI,EAAAZ,EAAWiB,CAAkB,GAAK,CAAE,MAAMb,EAAaa,EAAoBX,CAAI,IAK/E,EAAAN,EAAWgB,CAAc,GAAK,CAAE,MAAMZ,EAAaY,EAAgBV,CAAI,IAKvE,EAAAN,EAAWe,CAAoB,GAAK,CAAE,MAAMX,EAAaW,EAAsBT,CAAI,GAIvF,OAAOE,EAAaS,EAAoBP,CAAO,CACnD,EAEaQ,EAAyB,CAACN,EAAcF,IAA0C,CAC3F,GAAIR,EAAI,WAAa,CAAC,CAAC,IAAK,IAAK,QAAS,MAAM,EAAE,SAASA,EAAI,SAAS,EACpE,OAAOM,EAAaD,EAAKL,EAAI,UAAWU,CAAI,EAAGF,CAAO,EAG1D,IAAMG,EAAgBM,EAAoBT,GAAS,KAAOT,EAAI,CAAC,EAE/D,GAAI,CAACY,EACD,OAGJ,IAAME,EAAuBR,EAAKM,EAAe,cAAc,EACzDG,EAAiBT,EAAKQ,EAAsB,QAAQ,EACpDE,EAAqBV,EAAKS,EAAgBJ,CAAI,EAMpD,GAAI,EAAAZ,EAAWiB,CAAkB,GAAK,CAACZ,EAAiBY,EAAoBX,CAAI,IAK5E,EAAAN,EAAWgB,CAAc,GAAK,CAACX,EAAiBW,EAAgBV,CAAI,IAKpE,EAAAN,EAAWe,CAAoB,GAAK,CAACV,EAAiBU,EAAsBT,CAAI,GAIpF,OAAOE,EAAaS,EAAoBP,CAAO,CACnD","sourcesContent":["// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { cwd, env } from \"node:process\";\n\nimport { ensureDirSync, isAccessible, isAccessibleSync, W_OK } from \"@visulima/fs\";\nimport { join } from \"pathe\";\n\nimport { findPackageRoot, findPackageRootSync } from \"./package\";\n\ntype Options = {\n create?: boolean;\n cwd?: URL | string;\n};\n\nconst useDirectory = (directory: string, options?: Options): string => {\n if (options?.create) {\n ensureDirSync(directory);\n }\n\n return directory;\n};\n\nexport const findCacheDirectory = async (name: string, options?: Options): Promise<string | undefined> => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = await findPackageRoot(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !(await isAccessible(cacheNameDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !(await isAccessible(cacheDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !(await isAccessible(nodeModulesDirectory, W_OK))) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n\nexport const findCacheDirectorySync = (name: string, options?: Options): string | undefined => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = findPackageRootSync(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !isAccessibleSync(cacheNameDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !isAccessibleSync(cacheDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !isAccessibleSync(nodeModulesDirectory, W_OK)) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n"]}
1
+ {"version":3,"sources":["../src/find-cache-dir.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,KAAK,WAAW;AAEzB,SAAS,eAAe,cAAc,kBAAkB,YAAY;AACpE,SAAS,YAAY;AASrB,IAAM,eAAe,CAAC,WAAmB,YAA8B;AACnE,MAAI,SAAS,QAAQ;AACjB,kBAAc,SAAS;AAAA,EAC3B;AAEA,SAAO;AACX;AAEO,IAAM,qBAAqB,OAAO,MAAc,YAAmD;AACtG,MAAI,IAAI,aAAa,CAAC,CAAC,KAAK,KAAK,SAAS,MAAM,EAAE,SAAS,IAAI,SAAS,GAAG;AACvE,WAAO,aAAa,KAAK,IAAI,WAAW,IAAI,GAAG,OAAO;AAAA,EAC1D;AAEA,QAAM,gBAAgB,MAAM,gBAAgB,SAAS,OAAO,IAAI,CAAC;AAEjE,MAAI,CAAC,eAAe;AAChB,WAAO;AAAA,EACX;AAEA,QAAM,uBAAuB,KAAK,eAAe,cAAc;AAC/D,QAAM,iBAAiB,KAAK,sBAAsB,QAAQ;AAC1D,QAAM,qBAAqB,KAAK,gBAAgB,IAAI;AAMpD,MAAI,WAAW,kBAAkB,KAAK,CAAE,MAAM,aAAa,oBAAoB,IAAI,GAAI;AACnF,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,cAAc,KAAK,CAAE,MAAM,aAAa,gBAAgB,IAAI,GAAI;AAC3E,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,oBAAoB,KAAK,CAAE,MAAM,aAAa,sBAAsB,IAAI,GAAI;AACvF,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,oBAAoB,OAAO;AACnD;AAEO,IAAM,yBAAyB,CAAC,MAAc,YAA0C;AAC3F,MAAI,IAAI,aAAa,CAAC,CAAC,KAAK,KAAK,SAAS,MAAM,EAAE,SAAS,IAAI,SAAS,GAAG;AACvE,WAAO,aAAa,KAAK,IAAI,WAAW,IAAI,GAAG,OAAO;AAAA,EAC1D;AAEA,QAAM,gBAAgB,oBAAoB,SAAS,OAAO,IAAI,CAAC;AAE/D,MAAI,CAAC,eAAe;AAChB,WAAO;AAAA,EACX;AAEA,QAAM,uBAAuB,KAAK,eAAe,cAAc;AAC/D,QAAM,iBAAiB,KAAK,sBAAsB,QAAQ;AAC1D,QAAM,qBAAqB,KAAK,gBAAgB,IAAI;AAMpD,MAAI,WAAW,kBAAkB,KAAK,CAAC,iBAAiB,oBAAoB,IAAI,GAAG;AAC/E,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,cAAc,KAAK,CAAC,iBAAiB,gBAAgB,IAAI,GAAG;AACvE,WAAO;AAAA,EACX;AAGA,MAAI,WAAW,oBAAoB,KAAK,CAAC,iBAAiB,sBAAsB,IAAI,GAAG;AACnF,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,oBAAoB,OAAO;AACnD","sourcesContent":["// eslint-disable-next-line unicorn/prevent-abbreviations\nimport { existsSync } from \"node:fs\";\nimport { cwd, env } from \"node:process\";\n\nimport { ensureDirSync, isAccessible, isAccessibleSync, W_OK } from \"@visulima/fs\";\nimport { join } from \"pathe\";\n\nimport { findPackageRoot, findPackageRootSync } from \"./package\";\n\ntype Options = {\n create?: boolean;\n cwd?: URL | string;\n};\n\nconst useDirectory = (directory: string, options?: Options): string => {\n if (options?.create) {\n ensureDirSync(directory);\n }\n\n return directory;\n};\n\nexport const findCacheDirectory = async (name: string, options?: Options): Promise<string | undefined> => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = await findPackageRoot(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !(await isAccessible(cacheNameDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !(await isAccessible(cacheDirectory, W_OK))) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !(await isAccessible(nodeModulesDirectory, W_OK))) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n\nexport const findCacheDirectorySync = (name: string, options?: Options): string | undefined => {\n if (env.CACHE_DIR && ![\"0\", \"1\", \"false\", \"true\"].includes(env.CACHE_DIR)) {\n return useDirectory(join(env.CACHE_DIR, name), options);\n }\n\n const rootDirectory = findPackageRootSync(options?.cwd ?? cwd());\n\n if (!rootDirectory) {\n return undefined;\n }\n\n const nodeModulesDirectory = join(rootDirectory, \"node_modules\");\n const cacheDirectory = join(nodeModulesDirectory, \".cache\");\n const cacheNameDirectory = join(cacheDirectory, name);\n\n // If node_modules/.cache/${name} exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise, if node_modules/.cache exists: If it is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // Otherwise: If node_modules is writeable, return node_modules/.cache/${name}, otherwise return undefined\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheNameDirectory) && !isAccessibleSync(cacheNameDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(cacheDirectory) && !isAccessibleSync(cacheDirectory, W_OK)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(nodeModulesDirectory) && !isAccessibleSync(nodeModulesDirectory, W_OK)) {\n return undefined;\n }\n\n return useDirectory(cacheNameDirectory, options);\n};\n"]}
package/dist/monorepo.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkWOLHGXXJ_cjs = require('./chunk-WOLHGXXJ.cjs');
4
- require('./chunk-KSXRMTAQ.cjs');
5
- require('./chunk-6KT7465D.cjs');
3
+ var chunkYOQXHFU3_cjs = require('./chunk-YOQXHFU3.cjs');
4
+ require('./chunk-IK5YSYLX.cjs');
5
+ require('./chunk-G3SI24AJ.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, 'findMonorepoRoot', {
10
- enumerable: true,
11
- get: function () { return chunkWOLHGXXJ_cjs.a; }
10
+ enumerable: true,
11
+ get: function () { return chunkYOQXHFU3_cjs.findMonorepoRoot; }
12
12
  });
13
13
  //# sourceMappingURL=out.js.map
14
14
  //# sourceMappingURL=monorepo.cjs.map
package/dist/monorepo.js CHANGED
@@ -1,5 +1,5 @@
1
- export { a as findMonorepoRoot } from './chunk-GMIFPTPB.js';
2
- import './chunk-44SW4DFI.js';
3
- import './chunk-U4YVB3GU.js';
1
+ export { findMonorepoRoot } from './chunk-E2PKJX3Q.js';
2
+ import './chunk-IIYQBLPC.js';
3
+ import './chunk-UZ2FN6C5.js';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=monorepo.js.map
@@ -1,28 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunk6KT7465D_cjs = require('./chunk-6KT7465D.cjs');
3
+ var chunkG3SI24AJ_cjs = require('./chunk-G3SI24AJ.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, 'findPackageJson', {
8
- enumerable: true,
9
- get: function () { return chunk6KT7465D_cjs.a; }
8
+ enumerable: true,
9
+ get: function () { return chunkG3SI24AJ_cjs.findPackageJson; }
10
10
  });
11
11
  Object.defineProperty(exports, 'findPackageJsonSync', {
12
- enumerable: true,
13
- get: function () { return chunk6KT7465D_cjs.b; }
12
+ enumerable: true,
13
+ get: function () { return chunkG3SI24AJ_cjs.findPackageJsonSync; }
14
14
  });
15
15
  Object.defineProperty(exports, 'parsePackageJson', {
16
- enumerable: true,
17
- get: function () { return chunk6KT7465D_cjs.e; }
16
+ enumerable: true,
17
+ get: function () { return chunkG3SI24AJ_cjs.parsePackageJson; }
18
18
  });
19
19
  Object.defineProperty(exports, 'writePackageJson', {
20
- enumerable: true,
21
- get: function () { return chunk6KT7465D_cjs.c; }
20
+ enumerable: true,
21
+ get: function () { return chunkG3SI24AJ_cjs.writePackageJson; }
22
22
  });
23
23
  Object.defineProperty(exports, 'writePackageJsonSync', {
24
- enumerable: true,
25
- get: function () { return chunk6KT7465D_cjs.d; }
24
+ enumerable: true,
25
+ get: function () { return chunkG3SI24AJ_cjs.writePackageJsonSync; }
26
26
  });
27
27
  //# sourceMappingURL=out.js.map
28
28
  //# sourceMappingURL=package-json.cjs.map
@@ -1,3 +1,3 @@
1
- export { a as findPackageJson, b as findPackageJsonSync, e as parsePackageJson, c as writePackageJson, d as writePackageJsonSync } from './chunk-U4YVB3GU.js';
1
+ export { findPackageJson, findPackageJsonSync, parsePackageJson, writePackageJson, writePackageJsonSync } from './chunk-UZ2FN6C5.js';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=package-json.js.map
@@ -1,33 +1,33 @@
1
1
  'use strict';
2
2
 
3
- var chunkKSXRMTAQ_cjs = require('./chunk-KSXRMTAQ.cjs');
4
- require('./chunk-6KT7465D.cjs');
3
+ var chunkIK5YSYLX_cjs = require('./chunk-IK5YSYLX.cjs');
4
+ require('./chunk-G3SI24AJ.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, 'findLockFile', {
9
- enumerable: true,
10
- get: function () { return chunkKSXRMTAQ_cjs.a; }
9
+ enumerable: true,
10
+ get: function () { return chunkIK5YSYLX_cjs.findLockFile; }
11
11
  });
12
12
  Object.defineProperty(exports, 'findLockFileSync', {
13
- enumerable: true,
14
- get: function () { return chunkKSXRMTAQ_cjs.b; }
13
+ enumerable: true,
14
+ get: function () { return chunkIK5YSYLX_cjs.findLockFileSync; }
15
15
  });
16
16
  Object.defineProperty(exports, 'findPackageManager', {
17
- enumerable: true,
18
- get: function () { return chunkKSXRMTAQ_cjs.c; }
17
+ enumerable: true,
18
+ get: function () { return chunkIK5YSYLX_cjs.findPackageManager; }
19
19
  });
20
20
  Object.defineProperty(exports, 'findPackageManagerSync', {
21
- enumerable: true,
22
- get: function () { return chunkKSXRMTAQ_cjs.d; }
21
+ enumerable: true,
22
+ get: function () { return chunkIK5YSYLX_cjs.findPackageManagerSync; }
23
23
  });
24
24
  Object.defineProperty(exports, 'getPackageManagerVersion', {
25
- enumerable: true,
26
- get: function () { return chunkKSXRMTAQ_cjs.e; }
25
+ enumerable: true,
26
+ get: function () { return chunkIK5YSYLX_cjs.getPackageManagerVersion; }
27
27
  });
28
28
  Object.defineProperty(exports, 'identifyInitiatingPackageManager', {
29
- enumerable: true,
30
- get: function () { return chunkKSXRMTAQ_cjs.f; }
29
+ enumerable: true,
30
+ get: function () { return chunkIK5YSYLX_cjs.identifyInitiatingPackageManager; }
31
31
  });
32
32
  //# sourceMappingURL=out.js.map
33
33
  //# sourceMappingURL=package-manager.cjs.map
@@ -1,4 +1,4 @@
1
- export { a as findLockFile, b as findLockFileSync, c as findPackageManager, d as findPackageManagerSync, e as getPackageManagerVersion, f as identifyInitiatingPackageManager } from './chunk-44SW4DFI.js';
2
- import './chunk-U4YVB3GU.js';
1
+ export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './chunk-IIYQBLPC.js';
2
+ import './chunk-UZ2FN6C5.js';
3
3
  //# sourceMappingURL=out.js.map
4
4
  //# sourceMappingURL=package-manager.js.map
package/dist/package.cjs CHANGED
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunk5YG33J5B_cjs = require('./chunk-5YG33J5B.cjs');
4
- require('./chunk-KSXRMTAQ.cjs');
5
- require('./chunk-6KT7465D.cjs');
3
+ var chunkCVVFWSMT_cjs = require('./chunk-CVVFWSMT.cjs');
4
+ require('./chunk-IK5YSYLX.cjs');
5
+ require('./chunk-G3SI24AJ.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, 'findPackageRoot', {
10
- enumerable: true,
11
- get: function () { return chunk5YG33J5B_cjs.a; }
10
+ enumerable: true,
11
+ get: function () { return chunkCVVFWSMT_cjs.findPackageRoot; }
12
12
  });
13
13
  Object.defineProperty(exports, 'findPackageRootSync', {
14
- enumerable: true,
15
- get: function () { return chunk5YG33J5B_cjs.b; }
14
+ enumerable: true,
15
+ get: function () { return chunkCVVFWSMT_cjs.findPackageRootSync; }
16
16
  });
17
17
  //# sourceMappingURL=out.js.map
18
18
  //# sourceMappingURL=package.cjs.map
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
- export { a as findPackageRoot, b as findPackageRootSync } from './chunk-I3QTPGJY.js';
2
- import './chunk-44SW4DFI.js';
3
- import './chunk-U4YVB3GU.js';
1
+ export { findPackageRoot, findPackageRootSync } from './chunk-EYMR7Z2I.js';
2
+ import './chunk-IIYQBLPC.js';
3
+ import './chunk-UZ2FN6C5.js';
4
4
  //# sourceMappingURL=out.js.map
5
5
  //# sourceMappingURL=package.js.map
package/dist/tsconfig.cjs CHANGED
@@ -1,36 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunkPGLLS3ER_cjs = require('./chunk-PGLLS3ER.cjs');
3
+ var chunkWXFZK4G3_cjs = require('./chunk-WXFZK4G3.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, 'findTSConfig', {
8
- enumerable: true,
9
- get: function () { return chunkPGLLS3ER_cjs.d; }
8
+ enumerable: true,
9
+ get: function () { return chunkWXFZK4G3_cjs.findTSConfig; }
10
10
  });
11
11
  Object.defineProperty(exports, 'findTSConfigSync', {
12
- enumerable: true,
13
- get: function () { return chunkPGLLS3ER_cjs.f; }
12
+ enumerable: true,
13
+ get: function () { return chunkWXFZK4G3_cjs.findTSConfigSync; }
14
14
  });
15
15
  Object.defineProperty(exports, 'findTsConfig', {
16
- enumerable: true,
17
- get: function () { return chunkPGLLS3ER_cjs.c; }
16
+ enumerable: true,
17
+ get: function () { return chunkWXFZK4G3_cjs.findTsConfig; }
18
18
  });
19
19
  Object.defineProperty(exports, 'findTsConfigSync', {
20
- enumerable: true,
21
- get: function () { return chunkPGLLS3ER_cjs.e; }
20
+ enumerable: true,
21
+ get: function () { return chunkWXFZK4G3_cjs.findTsConfigSync; }
22
22
  });
23
23
  Object.defineProperty(exports, 'implicitBaseUrlSymbol', {
24
- enumerable: true,
25
- get: function () { return chunkPGLLS3ER_cjs.a; }
24
+ enumerable: true,
25
+ get: function () { return chunkWXFZK4G3_cjs.implicitBaseUrlSymbol; }
26
26
  });
27
27
  Object.defineProperty(exports, 'writeTSConfig', {
28
- enumerable: true,
29
- get: function () { return chunkPGLLS3ER_cjs.h; }
28
+ enumerable: true,
29
+ get: function () { return chunkWXFZK4G3_cjs.writeTSConfig; }
30
30
  });
31
31
  Object.defineProperty(exports, 'writeTsConfig', {
32
- enumerable: true,
33
- get: function () { return chunkPGLLS3ER_cjs.g; }
32
+ enumerable: true,
33
+ get: function () { return chunkWXFZK4G3_cjs.writeTsConfig; }
34
34
  });
35
35
  //# sourceMappingURL=out.js.map
36
36
  //# sourceMappingURL=tsconfig.cjs.map
package/dist/tsconfig.js CHANGED
@@ -1,3 +1,3 @@
1
- export { d as findTSConfig, f as findTSConfigSync, c as findTsConfig, e as findTsConfigSync, a as implicitBaseUrlSymbol, h as writeTSConfig, g as writeTsConfig } from './chunk-NKFQML4S.js';
1
+ export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, writeTSConfig, writeTsConfig } from './chunk-5VO6NTKJ.js';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=tsconfig.js.map