@visulima/package 1.8.2 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +17 -0
  3. package/dist/error.cjs +1 -14
  4. package/dist/error.d.mts +9 -0
  5. package/dist/error.mjs +1 -0
  6. package/dist/index.cjs +1 -107
  7. package/dist/index.d.cts +2 -3
  8. package/dist/index.d.mts +18 -0
  9. package/dist/index.d.ts +2 -3
  10. package/dist/index.mjs +1 -0
  11. package/dist/monorepo.cjs +1 -14
  12. package/dist/monorepo.d.mts +8 -0
  13. package/dist/monorepo.mjs +1 -0
  14. package/dist/package-json.cjs +1 -28
  15. package/dist/package-json.d.cts +3 -5
  16. package/dist/package-json.d.mts +22 -0
  17. package/dist/package-json.d.ts +3 -5
  18. package/dist/package-json.mjs +1 -0
  19. package/dist/package-manager.cjs +1 -33
  20. package/dist/package-manager.d.mts +16 -0
  21. package/dist/package-manager.mjs +1 -0
  22. package/dist/package.cjs +1 -18
  23. package/dist/package.d.mts +4 -0
  24. package/dist/package.mjs +1 -0
  25. package/dist/shared/package.DipMHw9r.cjs +1 -0
  26. package/dist/shared/package.DvbNGF15.mjs +1 -0
  27. package/dist/shared/package.SZmjOQBM.d.cts +2076 -0
  28. package/dist/shared/package.SZmjOQBM.d.mts +2076 -0
  29. package/dist/shared/package.SZmjOQBM.d.ts +2076 -0
  30. package/dist/shared/package.Xn4v2Y_g.cjs +1 -0
  31. package/dist/shared/package.zhGeUcxO.mjs +1 -0
  32. package/dist/tsconfig/index.cjs +1 -0
  33. package/dist/tsconfig/index.d.cts +34 -0
  34. package/dist/tsconfig/index.d.mts +34 -0
  35. package/dist/tsconfig/index.d.ts +34 -0
  36. package/dist/tsconfig/index.mjs +1 -0
  37. package/package.json +25 -33
  38. package/dist/chunk-5UU4RIJA.js +0 -11
  39. package/dist/chunk-5UU4RIJA.js.map +0 -1
  40. package/dist/chunk-BGVUNBLL.js +0 -12
  41. package/dist/chunk-BGVUNBLL.js.map +0 -1
  42. package/dist/chunk-BHDWBI3F.cjs +0 -22
  43. package/dist/chunk-BHDWBI3F.cjs.map +0 -1
  44. package/dist/chunk-C36BYRSZ.cjs +0 -19
  45. package/dist/chunk-C36BYRSZ.cjs.map +0 -1
  46. package/dist/chunk-EY5KVLRL.js +0 -10
  47. package/dist/chunk-EY5KVLRL.js.map +0 -1
  48. package/dist/chunk-HGV2BL7M.js +0 -12
  49. package/dist/chunk-HGV2BL7M.js.map +0 -1
  50. package/dist/chunk-I3EKI236.cjs +0 -13
  51. package/dist/chunk-I3EKI236.cjs.map +0 -1
  52. package/dist/chunk-J5ERILYG.cjs +0 -9
  53. package/dist/chunk-J5ERILYG.cjs.map +0 -1
  54. package/dist/chunk-KMWIKANF.js +0 -7
  55. package/dist/chunk-KMWIKANF.js.map +0 -1
  56. package/dist/chunk-RETLQXQB.cjs +0 -13
  57. package/dist/chunk-RETLQXQB.cjs.map +0 -1
  58. package/dist/chunk-W3Z24XII.js +0 -14
  59. package/dist/chunk-W3Z24XII.js.map +0 -1
  60. package/dist/chunk-W7A6C74U.cjs +0 -27
  61. package/dist/chunk-W7A6C74U.cjs.map +0 -1
  62. package/dist/error.cjs.map +0 -1
  63. package/dist/error.js +0 -5
  64. package/dist/error.js.map +0 -1
  65. package/dist/index.cjs.map +0 -1
  66. package/dist/index.js +0 -17
  67. package/dist/index.js.map +0 -1
  68. package/dist/monorepo.cjs.map +0 -1
  69. package/dist/monorepo.js +0 -5
  70. package/dist/monorepo.js.map +0 -1
  71. package/dist/package-json.cjs.map +0 -1
  72. package/dist/package-json.js +0 -3
  73. package/dist/package-json.js.map +0 -1
  74. package/dist/package-manager.cjs.map +0 -1
  75. package/dist/package-manager.js +0 -4
  76. package/dist/package-manager.js.map +0 -1
  77. package/dist/package.cjs.map +0 -1
  78. package/dist/package.js +0 -5
  79. package/dist/package.js.map +0 -1
  80. package/dist/tsconfig-G-HInwrt.d.ts +0 -30
  81. package/dist/tsconfig-d4zwQgCH.d.cts +0 -30
  82. package/dist/tsconfig.cjs +0 -36
  83. package/dist/tsconfig.cjs.map +0 -1
  84. package/dist/tsconfig.d.cts +0 -5
  85. package/dist/tsconfig.d.ts +0 -5
  86. package/dist/tsconfig.js +0 -3
  87. package/dist/tsconfig.js.map +0 -1
  88. package/dist/types-hoigZ9HA.d.cts +0 -9
  89. package/dist/types-hoigZ9HA.d.ts +0 -9
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/monorepo.ts"],"names":["existsSync","readFileSync","findUp","readJson","NotFoundError","dirname","join","findMonorepoRoot","cwd","workspaceFilePath","lerna","isTurbo","packageManager","path","findPackageManager","packageJsonFilePath","pnpmWorkspacesFilePath","error"],"mappings":"yCAAA,OAAS,cAAAA,EAAY,gBAAAC,MAAoB,KAEzC,OAAS,UAAAC,EAAQ,YAAAC,MAAgB,eACjC,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,WAAAC,EAAS,QAAAC,MAAY,iBAsBvB,IAAMC,EAAmB,MAAOC,GAA8C,CACjF,IAAMC,EAAoB,MAAMP,EAAO,CAAC,aAAc,YAAY,EAAG,CACjE,KAAM,OACN,GAAIM,GAAO,CAAE,IAAAA,CAAI,CACrB,CAAC,EAED,GAAIC,GAAmB,SAAS,YAAY,EAAG,CAC3C,IAAMC,EAAQ,MAAMP,EAA2DM,CAAiB,EAEhG,GAAIC,EAAM,eAAiBA,EAAM,SAC7B,MAAO,CACH,KAAML,EAAQI,CAAiB,EAC/B,SAAU,OACd,CAER,CAEA,IAAME,EAAUF,GAAmB,SAAS,YAAY,EAExD,GAAI,CACA,GAAM,CAAE,eAAAG,EAAgB,KAAAC,CAAK,EAAI,MAAMC,EAAmBN,CAAG,EAE7D,GAAI,CAAC,MAAO,MAAM,EAAE,SAASI,CAAc,EAAG,CAC1C,IAAMG,EAAsBT,EAAKO,EAAM,cAAc,EAGrD,GAAIb,EAAWe,CAAmB,GAEVd,EAAaK,EAAKO,EAAM,cAAc,EAAG,MAAM,EAEnD,SAAS,YAAY,EACjC,MAAO,CACH,KAAAA,EACA,SAAUF,EAAU,QAAWC,CACnC,CAGZ,SAAWA,IAAmB,OAAQ,CAClC,IAAMI,EAAyBV,EAAKO,EAAM,qBAAqB,EAG/D,GAAIb,EAAWgB,CAAsB,EACjC,MAAO,CACH,KAAAH,EACA,SAAUF,EAAU,QAAU,MAClC,CAER,CAEJ,OAASM,EAAY,CAEjB,GAAI,EAAEA,aAAiBb,GACnB,MAAMa,CAEd,CAEA,MAAM,IAAI,MAAM,8DAA8DT,CAAa,iDAAiD,CAChJ","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\n\nimport { findUp, readJson } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { dirname, join } from \"@visulima/path\";\n\nimport { findPackageManager } from \"./package-manager\";\n\nexport type Strategy = \"lerna\" | \"npm\" | \"pnpm\" | \"turbo\" | \"yarn\";\n\nexport interface RootMonorepo<T extends Strategy = Strategy> {\n path: string;\n strategy: T;\n}\n\n/**\n * An asynchronous function to find the root directory path and strategy for a monorepo based on\n * the given current working directory (cwd).\n *\n * @param cwd - The current working directory. The type of `cwd` is part of an `Options` type, specifically `Options[\"cwd\"]`.\n * Default is undefined.\n * @returns A `Promise` that resolves to the root directory path and strategy for the monorepo.\n * The type of the returned promise is `Promise<RootMonorepo>`.\n * @throws An `Error` if no monorepo root can be found using lerna, yarn, pnpm, or npm as indicators.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const findMonorepoRoot = async (cwd?: URL | string): Promise<RootMonorepo> => {\n const workspaceFilePath = await findUp([\"lerna.json\", \"turbo.json\"], {\n type: \"file\",\n ...(cwd && { cwd }),\n });\n\n if (workspaceFilePath?.endsWith(\"lerna.json\")) {\n const lerna = await readJson<{ packages?: string[]; useWorkspaces?: boolean }>(workspaceFilePath);\n\n if (lerna.useWorkspaces || lerna.packages) {\n return {\n path: dirname(workspaceFilePath),\n strategy: \"lerna\",\n };\n }\n }\n\n const isTurbo = workspaceFilePath?.endsWith(\"turbo.json\");\n\n try {\n const { packageManager, path } = await findPackageManager(cwd);\n\n if ([\"npm\", \"yarn\"].includes(packageManager)) {\n const packageJsonFilePath = join(path, \"package.json\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(packageJsonFilePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n const packageJson = readFileSync(join(path, \"package.json\"), \"utf8\");\n\n if (packageJson.includes(\"workspaces\")) {\n return {\n path,\n strategy: isTurbo ? \"turbo\" : (packageManager as \"npm\" | \"yarn\"),\n };\n }\n }\n } else if (packageManager === \"pnpm\") {\n const pnpmWorkspacesFilePath = join(path, \"pnpm-workspace.yaml\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(pnpmWorkspacesFilePath)) {\n return {\n path,\n strategy: isTurbo ? \"turbo\" : \"pnpm\",\n };\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n // Skip this error to show the error message from the next block\n if (!(error instanceof NotFoundError)) {\n throw error;\n }\n }\n\n throw new Error(`No monorepo root could be found upwards from the directory ${cwd as string} using lerna, yarn, pnpm, or npm as indicators.`);\n};\n"]}
@@ -1,14 +0,0 @@
1
- import { findUp, findUpSync, writeJson, readFileSync } from '@visulima/fs';
2
- import { NotFoundError } from '@visulima/fs/error';
3
- import { toPath } from '@visulima/fs/utils';
4
- import { join, dirname, resolve, relative, normalize, toNamespacedPath, isAbsolute } from '@visulima/path';
5
- import { parse } from 'jsonc-parser';
6
- import { existsSync, statSync } from 'node:fs';
7
- import $ from 'node:module';
8
- import { resolveExports } from 'resolve-pkg-maps';
9
-
10
- var L=o=>parse(readFileSync(o)),G=()=>{let{findPnpApi:o}=$;return o?.(process.cwd())},w=(o,s,c,t)=>{let n=`resolveFromPackageJsonPath:${o}:${s}:${c}`;if(t?.has(n))return t.get(n);let e=L(o);if(!e)return;let i=s||"tsconfig.json";if(!c&&e.exports)try{let[l]=resolveExports(e.exports,s,["require","types"]);i=l;}catch{return !1}else !s&&e.tsconfig&&(i=e.tsconfig);return i=join(o,"..",i),t?.set(n,i),i},v="package.json",P="tsconfig.json",K=(o,s,c)=>{let t=o;if(o===".."&&(t=join(t,P)),o.startsWith(".")&&(t=resolve(s,t)),isAbsolute(t)){if(existsSync(t)){if(statSync(t).isFile())return t}else if(!t.endsWith(".json")){let r=`${t}.json`;if(existsSync(r))return r}return}let[n,...e]=o.split("/"),i=n.startsWith("@")?`${n}/${e.shift()}`:n,l=e.join("/"),a=G();if(a){let{resolveRequest:r}=a;try{if(i===o){let f=r(join(i,v),s);if(f){let h=w(f,l,!1,c);if(h&&existsSync(h))return h}}else {let f;try{f=r(o,s,{extensions:[".json"]});}catch{f=r(join(o,P),s);}if(f)return f}}catch{}}let u=findUpSync(r=>{let f=join(r,"node_modules",i);if(existsSync(f))return join("node_modules",i)},{cwd:s,type:"directory"});if(!u||!statSync(u).isDirectory())return;let g=join(u,v);if(existsSync(g)){let r=w(g,l,!1,c);if(r===!1)return;if(r&&existsSync(r)&&statSync(r).isFile())return r}let m=join(u,l),J=m.endsWith(".json");if(!J){let r=`${m}.json`;if(existsSync(r))return r}if(existsSync(m)){if(statSync(m).isDirectory()){let r=join(m,v);if(existsSync(r)){let h=w(r,"",!0,c);if(h&&existsSync(h))return h}let f=join(m,P);if(existsSync(f))return f}else if(J)return m}},F=K;var Z=o=>parse(readFileSync(o)),O=o=>toNamespacedPath(/^\.{1,2}(?:\/.*)?$/.test(o)?o:`./${o}`),q=(o,s,c,t)=>{let n=F(o,s);if(!n)throw new NotFoundError(`No such file or directory, for '${o}' found.`);if(c.has(n))throw new Error(`Circularity detected while resolving configuration: ${n}`);c.add(n);let e=dirname(n),i=U(n,t,c);delete i.references;let{compilerOptions:l}=i;if(l){let a=["baseUrl","outDir"];for(let u of a){let g=l[u];g&&(l[u]=relative(s,join(e,g)).replaceAll("\\","/")||"./");}}return i.files&&(i.files=i.files.map(a=>relative(s,join(e,a)))),i.include&&(i.include=i.include.map(a=>relative(s,join(e,a)))),i.exclude&&(i.exclude=i.exclude.map(a=>relative(s,join(e,a)))),i},U=(o,s,c=new Set)=>{let t;try{t=Z(o)||{};}catch{throw new Error(`Cannot resolve tsconfig at path: ${o}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${o}`);let n=dirname(o);if(t.compilerOptions){let{compilerOptions:e}=t;e.paths&&!e.baseUrl&&(e[I]=n);}if(t.extends){let e=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(let i of e.reverse()){let l=q(i,n,new Set(c),s),a={...l,...t,compilerOptions:{...l.compilerOptions,...t.compilerOptions}};l.watchOptions&&(a.watchOptions={...l.watchOptions,...t.watchOptions}),t=a;}}if(t.compilerOptions){let{compilerOptions:e}=t,i=["baseUrl","rootDir"];for(let a of i){let u=e[a];if(u){let g=resolve(n,u),m=relative(n,g);e[a]=O(m);}}let{outDir:l}=e;l&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.includes(l)||t.exclude.push(l),e.outDir=O(l)),s?.tscCompatible&&e.module==="node16"&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0,e.esModuleInterop=e.esModuleInterop??!0,e.moduleDetection=e.moduleDetection??"force",e.moduleResolution=e.moduleResolution??"node16",e.target=e.target??"es2022",e.useDefineForClassFields=e.useDefineForClassFields??!0),s?.tscCompatible&&e.strict&&(e.noImplicitAny=e.noImplicitAny??!0,e.noImplicitThis=e.noImplicitThis??!0,e.strictNullChecks=e.strictNullChecks??!0,e.strictFunctionTypes=e.strictFunctionTypes??!0,e.strictBindCallApply=e.strictBindCallApply??!0,e.strictPropertyInitialization=e.strictPropertyInitialization??!0,e.alwaysStrict=e.alwaysStrict??!0,e.useUnknownInCatchVariables=e.useUnknownInCatchVariables??!0),s?.tscCompatible&&e.isolatedModules&&(e.preserveConstEnums=e.preserveConstEnums??!0),s?.tscCompatible&&e.esModuleInterop&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0),s?.tscCompatible&&e.target==="esnext"&&(e.useDefineForClassFields=e.useDefineForClassFields??!0);}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(e=>O(e))),t.include&&(t.include=t.include.map(e=>normalize(e))),t.watchOptions){let{watchOptions:e}=t;e.excludeDirectories&&(e.excludeDirectories=e.excludeDirectories.map(i=>resolve(n,i)));}return t},I=Symbol("implicitBaseUrl"),T=(o,s)=>U(o,s);var A=new Map,se=async(o,s={})=>{let c=s.configFileName??"tsconfig.json",t=await findUp(c,{...o&&{cwd:o},type:"file"});if(t||(t=await findUp("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new NotFoundError(`No such file or directory, for ${c} or jsconfig.json found.`);let n=s.cache&&typeof s.cache!="boolean"?s.cache:A;if(s.cache&&n.has(t))return n.get(t);let e={config:T(t),path:t};return s.cache&&n.set(t,e),e},Se=se,ne=(o,s={})=>{let c=s.configFileName??"tsconfig.json",t=findUpSync(c,{...o&&{cwd:o},type:"file"});if(t||(t=findUpSync("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new NotFoundError(`No such file or directory, for ${c} or jsconfig.json found.`);let n=s.cache&&typeof s.cache!="boolean"?s.cache:A;if(s.cache&&n.has(t))return n.get(t);let e={config:T(t),path:t};return s.cache&&n.set(t,e),e},je=ne,ie=async(o,s={})=>{let{cwd:c,...t}=s,n=toPath(s.cwd??process.cwd());await writeJson(join(n,"tsconfig.json"),o,t);},Fe=ie;
11
-
12
- export { I as a, T as b, se as c, Se as d, ne as e, je as f, ie as g, Fe as h };
13
- //# sourceMappingURL=out.js.map
14
- //# sourceMappingURL=chunk-W3Z24XII.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tsconfig.ts","../src/read-tsconfig.ts","../src/utils/resolve-extends-path.ts"],"names":["findUp","findUpSync","writeJson","NotFoundError","toPath","join","readFileSync","dirname","normalize","relative","resolve","toNamespacedPath","parse","existsSync","statSync","Module","isAbsolute","resolveExports","readJsonc","jsonPath","getPnpApi","findPnpApi","resolveFromPackageJsonPath","packageJsonPath","subpath","ignoreExports","cache","cacheKey","packageJson","resolvedPath","resolvedExport","PACKAGE_JSON","TS_CONFIG_JSON","resolveExtendsPath","requestedPath","directoryPath","filePath","orgOrName","remaining","packageName","pnpApi","resolveWithPnp","resolved","packagePath","directory","path","fullPackagePath","jsonExtension","fullPackagePathWithJson","fullPackageJsonPath","tsconfigPath","resolve_extends_path_default","normalizePath","resolveExtends","extendsPath","fromDirectoryPath","circularExtendsTracker","options","resolvedExtendsPath","extendsDirectoryPath","extendsConfig","internalParseTsConfig","compilerOptions","resolvePaths","property","unresolvedPath","file","config","implicitBaseUrlSymbol","extendsPathList","merged","normalizedPaths","resolvedBaseUrl","relativeBaseUrl","outDir","element","watchOptions","excludePath","readTsConfig","TsConfigFileCache","findTsConfig","cwd","configFileName","output","findTSConfig","findTsConfigSync","findTSConfigSync","writeTsConfig","data","writeOptions","writeTSConfig"],"mappings":"AACA,OAAS,UAAAA,EAAQ,cAAAC,EAAY,aAAAC,OAAiB,eAC9C,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,UAAAC,OAAc,qBACvB,OAAS,QAAAC,OAAY,iBCErB,OAAS,gBAAAC,MAAoB,eAC7B,OAAS,iBAAAH,MAAqB,qBAC9B,OAAS,WAAAI,EAAS,QAAAF,EAAM,aAAAG,EAAW,YAAAC,EAAU,WAAAC,EAAS,oBAAAC,MAAwB,iBAC9E,OAAS,SAAAC,MAAa,eCHtB,OAAS,cAAAC,EAAY,YAAAC,MAAgB,UACrC,OAAOC,MAAY,cAEnB,OAAS,cAAAd,EAAY,gBAAAK,MAAoB,eACzC,OAAS,cAAAU,EAAY,QAAAX,EAAM,WAAAK,MAAe,iBAC1C,OAAS,SAAAE,MAAa,eAEtB,OAAS,kBAAAK,MAAsB,mBAK/B,IAAMC,EAAaC,GAAqBP,EAAMN,EAAaa,CAAQ,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aC,GAAgBH","sourcesContent":["import type { WriteJsonOptions } from \"@visulima/fs\";\nimport { findUp, findUpSync, writeJson } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { toPath } from \"@visulima/fs/utils\";\nimport { join } from \"@visulima/path\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport { readTsConfig } from \"./read-tsconfig\";\nimport type { TsConfigJsonResolved } from \"./types\";\n\ntype Options = {\n cache?: Map<string, TsConfigJsonResolved> | boolean;\n configFileName?: string;\n};\n\nconst TsConfigFileCache = new Map<string, TsConfigResult>();\n\nexport type TsConfigResult = {\n config: TsConfigJsonResolved;\n path: string;\n};\n\n/**\n * An asynchronous function that retrieves the TSConfig by searching for the \"tsconfig.json\" first,\n * second attempt is to look for the \"jsconfig.json\" file from a given current working directory.\n *\n * @param cwd - Optional. The current working directory from which to search for the \"tsconfig.json\" file.\n * The type of `cwd` is `string`.\n * @returns A `Promise` that resolves to the TSConfig result object.\n * The return type of the function is `Promise<TsConfigResult>`.\n * @throws An `Error` when the \"tsconfig.json\" file is not found.\n */\nexport const findTsConfig = async (cwd?: URL | string, options: Options = {}): Promise<TsConfigResult> => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = await findUp(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = await findUp(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfig` instead.\nexport const findTSConfig = findTsConfig;\n\nexport const findTsConfigSync = (cwd?: URL | string, options: Options = {}): TsConfigResult => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = findUpSync(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = findUpSync(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfigSync` instead.\nexport const findTSConfigSync = findTsConfigSync;\n\n/**\n * An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.\n *\n * @param tsConfig - The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.\n * @param options - Optional. The write options and the current working directory. The type of `options` is an\n * intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.\n * @returns A `Promise` that resolves when the tsconfig.json file has been written.\n * The return type of function is `Promise<void>`.\n */\nexport const writeTsConfig = async (data: TsConfigJson, options: WriteJsonOptions & { cwd?: URL | string } = {}): Promise<void> => {\n const { cwd, ...writeOptions } = options;\n\n const directory = toPath(options.cwd ?? process.cwd());\n\n await writeJson(join(directory, \"tsconfig.json\"), data, writeOptions);\n};\n\n// @deprecate Please use `writeTsconfig` instead.\nexport const writeTSConfig = writeTsConfig;\n// eslint-disable-next-line import/no-unused-modules\nexport { implicitBaseUrlSymbol } from \"./read-tsconfig\";\n","/**\n * A modified version of `readTsconfig` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/index.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { readFileSync } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { dirname, join, normalize, relative, resolve, toNamespacedPath } from \"@visulima/path\";\nimport { parse } from \"jsonc-parser\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport type { TsConfigJsonResolved } from \"./types\";\nimport resolveExtendsPath from \"./utils/resolve-extends-path\";\n\ntype Options = {\n tscCompatible?: boolean;\n};\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n// eslint-disable-next-line security/detect-unsafe-regex\nconst normalizePath = (path: string): string => toNamespacedPath(/^\\.{1,2}(?:\\/.*)?$/.test(path) ? path : `./${path}`);\n\nconst resolveExtends = (extendsPath: string, fromDirectoryPath: string, circularExtendsTracker: Set<string>, options?: Options) => {\n const resolvedExtendsPath = resolveExtendsPath(extendsPath, fromDirectoryPath);\n\n if (!resolvedExtendsPath) {\n throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);\n }\n\n if (circularExtendsTracker.has(resolvedExtendsPath)) {\n throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);\n }\n\n circularExtendsTracker.add(resolvedExtendsPath);\n\n const extendsDirectoryPath = dirname(resolvedExtendsPath);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);\n\n delete extendsConfig.references;\n\n const { compilerOptions } = extendsConfig;\n\n if (compilerOptions) {\n const resolvePaths = [\"baseUrl\", \"outDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of resolvePaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = relative(fromDirectoryPath, join(extendsDirectoryPath, unresolvedPath)).replaceAll(\"\\\\\", \"/\") || \"./\";\n }\n }\n }\n\n if (extendsConfig.files) {\n extendsConfig.files = extendsConfig.files.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.include) {\n extendsConfig.include = extendsConfig.include.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.exclude) {\n extendsConfig.exclude = extendsConfig.exclude.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n return extendsConfig;\n};\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst internalParseTsConfig = (tsconfigPath: string, options?: Options, circularExtendsTracker = new Set<string>()): TsConfigJsonResolved => {\n /**\n * Decided not to cache the TsConfigJsonResolved object because it's\n * mutable.\n *\n * Note how `resolveExtends` can call `readTsconfig` rescursively\n * and actually mutates the object. It can also be mutated in\n * user-land.\n *\n * By only caching fs results, we can avoid serving mutated objects\n */\n let config: TsConfigJson;\n\n try {\n config = readJsonc(tsconfigPath) || {};\n } catch {\n throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);\n }\n\n if (typeof config !== \"object\") {\n throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);\n }\n\n const directoryPath = dirname(tsconfigPath);\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n if (compilerOptions.paths && !compilerOptions.baseUrl) {\n type WithImplicitBaseUrl = TsConfigJson.CompilerOptions & {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [implicitBaseUrlSymbol]: string;\n };\n // eslint-disable-next-line security/detect-object-injection,@typescript-eslint/no-use-before-define\n (compilerOptions as WithImplicitBaseUrl)[implicitBaseUrlSymbol] = directoryPath;\n }\n }\n\n if (config.extends) {\n const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];\n\n delete config.extends;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,etc/no-assign-mutated-array\n for (const extendsPath of extendsPathList.reverse()) {\n const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);\n const merged = {\n ...extendsConfig,\n ...config,\n\n compilerOptions: {\n ...extendsConfig.compilerOptions,\n ...config.compilerOptions,\n },\n };\n\n if (extendsConfig.watchOptions) {\n merged.watchOptions = {\n ...extendsConfig.watchOptions,\n ...config.watchOptions,\n };\n }\n\n config = merged;\n }\n }\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n const normalizedPaths = [\"baseUrl\", \"rootDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of normalizedPaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);\n const relativeBaseUrl = relative(directoryPath, resolvedBaseUrl);\n\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = normalizePath(relativeBaseUrl);\n }\n }\n\n const { outDir } = compilerOptions;\n\n if (outDir) {\n if (!Array.isArray(config.exclude)) {\n config.exclude = [];\n }\n\n if (!config.exclude.includes(outDir)) {\n config.exclude.push(outDir);\n }\n\n compilerOptions.outDir = normalizePath(outDir);\n }\n\n if (options?.tscCompatible && compilerOptions.module === \"node16\") {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n compilerOptions.esModuleInterop = compilerOptions.esModuleInterop ?? true;\n compilerOptions.moduleDetection = compilerOptions.moduleDetection ?? \"force\";\n compilerOptions.moduleResolution = compilerOptions.moduleResolution ?? \"node16\";\n compilerOptions.target = compilerOptions.target ?? \"es2022\";\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.strict) {\n compilerOptions.noImplicitAny = compilerOptions.noImplicitAny ?? true;\n compilerOptions.noImplicitThis = compilerOptions.noImplicitThis ?? true;\n compilerOptions.strictNullChecks = compilerOptions.strictNullChecks ?? true;\n compilerOptions.strictFunctionTypes = compilerOptions.strictFunctionTypes ?? true;\n compilerOptions.strictBindCallApply = compilerOptions.strictBindCallApply ?? true;\n compilerOptions.strictPropertyInitialization = compilerOptions.strictPropertyInitialization ?? true;\n compilerOptions.alwaysStrict = compilerOptions.alwaysStrict ?? true;\n compilerOptions.useUnknownInCatchVariables = compilerOptions.useUnknownInCatchVariables ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.isolatedModules) {\n compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.esModuleInterop) {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.target === \"esnext\") {\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n } else {\n config.compilerOptions = {};\n }\n\n if (config.files) {\n config.files = config.files.map((element) => normalizePath(element));\n }\n\n if (config.include) {\n config.include = config.include.map((element) => normalize(element));\n }\n\n if (config.watchOptions) {\n const { watchOptions } = config;\n\n if (watchOptions.excludeDirectories) {\n watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));\n }\n }\n\n return config;\n};\n\nexport const implicitBaseUrlSymbol = Symbol(\"implicitBaseUrl\");\nexport const readTsConfig = (tsconfigPath: string, options?: Options): TsConfigJsonResolved => internalParseTsConfig(tsconfigPath, options);\n","/**\n * A modified version of `resolveExtendsPath` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/resolve-extends-path.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { existsSync, statSync } from \"node:fs\";\nimport Module from \"node:module\";\n\nimport { findUpSync, readFileSync } from \"@visulima/fs\";\nimport { isAbsolute, join, resolve } from \"@visulima/path\";\nimport { parse } from \"jsonc-parser\";\nimport type { PathConditions } from \"resolve-pkg-maps\";\nimport { resolveExports } from \"resolve-pkg-maps\";\nimport type { PackageJson } from \"type-fest\";\n\nimport type { Cache } from \"../types\";\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n\nconst getPnpApi = () => {\n const { findPnpApi } = Module;\n\n // https://yarnpkg.com/advanced/pnpapi/#requirepnpapi\n return findPnpApi?.(process.cwd());\n};\n\nconst resolveFromPackageJsonPath = (packageJsonPath: string, subpath: string, ignoreExports?: boolean, cache?: Cache<string>) => {\n const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`;\n\n if (cache?.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n const packageJson = readJsonc(packageJsonPath);\n\n if (!packageJson) {\n return undefined;\n }\n\n let resolvedPath = subpath || \"tsconfig.json\";\n\n if (!ignoreExports && (packageJson as PackageJson).exports) {\n try {\n const [resolvedExport] = resolveExports((packageJson as PackageJson).exports as PathConditions, subpath, [\"require\", \"types\"]);\n\n resolvedPath = resolvedExport as string;\n } catch {\n // Block\n return false;\n }\n } else if (!subpath && (packageJson as PackageJson).tsconfig) {\n resolvedPath = (packageJson as PackageJson).tsconfig as string;\n }\n\n resolvedPath = join(packageJsonPath, \"..\", resolvedPath);\n\n cache?.set(cacheKey, resolvedPath);\n\n return resolvedPath;\n};\n\nconst PACKAGE_JSON = \"package.json\";\nconst TS_CONFIG_JSON = \"tsconfig.json\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst resolveExtendsPath = (requestedPath: string, directoryPath: string, cache?: Cache<string>): string | undefined => {\n let filePath = requestedPath;\n\n if (requestedPath === \"..\") {\n filePath = join(filePath, TS_CONFIG_JSON);\n }\n\n if (requestedPath.startsWith(\".\")) {\n filePath = resolve(directoryPath, filePath);\n }\n\n if (isAbsolute(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(filePath).isFile()) {\n return filePath;\n }\n } else if (!filePath.endsWith(\".json\")) {\n const jsonPath = `${filePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(jsonPath)) {\n return jsonPath;\n }\n }\n\n return undefined;\n }\n\n const [orgOrName, ...remaining] = requestedPath.split(\"/\");\n const packageName = ((orgOrName as string).startsWith(\"@\") ? `${orgOrName}/${remaining.shift()}` : orgOrName) as string;\n const subpath = remaining.join(\"/\");\n\n const pnpApi = getPnpApi();\n\n if (pnpApi) {\n const { resolveRequest: resolveWithPnp } = pnpApi;\n\n try {\n if (packageName === requestedPath) {\n const packageJsonPath = resolveWithPnp(join(packageName, PACKAGE_JSON), directoryPath);\n\n if (packageJsonPath) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n } else {\n let resolved: string | null;\n\n try {\n resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [\".json\"] });\n } catch {\n resolved = resolveWithPnp(join(requestedPath, TS_CONFIG_JSON), directoryPath);\n }\n\n if (resolved) {\n return resolved;\n }\n }\n } catch {\n /* empty */\n }\n }\n\n const packagePath = findUpSync(\n (directory) => {\n const path = join(directory, \"node_modules\", packageName);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(path)) {\n return join(\"node_modules\", packageName);\n }\n\n return undefined;\n },\n {\n cwd: directoryPath,\n type: \"directory\",\n },\n );\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!packagePath || !statSync(packagePath).isDirectory()) {\n return undefined;\n }\n\n const packageJsonPath = join(packagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(packageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // Blocked\n if (resolvedPath === false) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath) && statSync(resolvedPath).isFile()) {\n return resolvedPath;\n }\n }\n\n const fullPackagePath = join(packagePath, subpath);\n const jsonExtension = fullPackagePath.endsWith(\".json\");\n\n if (!jsonExtension) {\n const fullPackagePathWithJson = `${fullPackagePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackagePathWithJson)) {\n return fullPackagePathWithJson;\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(fullPackagePath)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(fullPackagePath).isDirectory()) {\n const fullPackageJsonPath = join(fullPackagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, \"\", true, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n\n const tsconfigPath = join(fullPackagePath, TS_CONFIG_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(tsconfigPath)) {\n return tsconfigPath;\n }\n } else if (jsonExtension) {\n return fullPackagePath;\n }\n\n return undefined;\n};\n\nexport default resolveExtendsPath;\n"]}
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('@visulima/fs');
4
- var error = require('@visulima/fs/error');
5
- var utils = require('@visulima/fs/utils');
6
- var path = require('@visulima/path');
7
- var jsoncParser = require('jsonc-parser');
8
- var fs$1 = require('fs');
9
- var A = require('module');
10
- var resolvePkgMaps = require('resolve-pkg-maps');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- var A__default = /*#__PURE__*/_interopDefault(A);
15
-
16
- var _=o=>jsoncParser.parse(fs.readFileSync(o)),L=()=>{let{findPnpApi:o}=A__default.default;return o?.(process.cwd())},w=(o,s,c,t)=>{let n=`resolveFromPackageJsonPath:${o}:${s}:${c}`;if(t?.has(n))return t.get(n);let e=_(o);if(!e)return;let i=s||"tsconfig.json";if(!c&&e.exports)try{let[l]=resolvePkgMaps.resolveExports(e.exports,s,["require","types"]);i=l;}catch{return !1}else !s&&e.tsconfig&&(i=e.tsconfig);return i=path.join(o,"..",i),t?.set(n,i),i},v="package.json",P="tsconfig.json",G=(o,s,c)=>{let t=o;if(o===".."&&(t=path.join(t,P)),o.startsWith(".")&&(t=path.resolve(s,t)),path.isAbsolute(t)){if(fs$1.existsSync(t)){if(fs$1.statSync(t).isFile())return t}else if(!t.endsWith(".json")){let r=`${t}.json`;if(fs$1.existsSync(r))return r}return}let[n,...e]=o.split("/"),i=n.startsWith("@")?`${n}/${e.shift()}`:n,l=e.join("/"),a=L();if(a){let{resolveRequest:r}=a;try{if(i===o){let f=r(path.join(i,v),s);if(f){let h=w(f,l,!1,c);if(h&&fs$1.existsSync(h))return h}}else {let f;try{f=r(o,s,{extensions:[".json"]});}catch{f=r(path.join(o,P),s);}if(f)return f}}catch{}}let u=fs.findUpSync(r=>{let f=path.join(r,"node_modules",i);if(fs$1.existsSync(f))return path.join("node_modules",i)},{cwd:s,type:"directory"});if(!u||!fs$1.statSync(u).isDirectory())return;let g=path.join(u,v);if(fs$1.existsSync(g)){let r=w(g,l,!1,c);if(r===!1)return;if(r&&fs$1.existsSync(r)&&fs$1.statSync(r).isFile())return r}let m=path.join(u,l),J=m.endsWith(".json");if(!J){let r=`${m}.json`;if(fs$1.existsSync(r))return r}if(fs$1.existsSync(m)){if(fs$1.statSync(m).isDirectory()){let r=path.join(m,v);if(fs$1.existsSync(r)){let h=w(r,"",!0,c);if(h&&fs$1.existsSync(h))return h}let f=path.join(m,P);if(fs$1.existsSync(f))return f}else if(J)return m}},j=G;var Y=o=>jsoncParser.parse(fs.readFileSync(o)),O=o=>path.toNamespacedPath(/^\.{1,2}(?:\/.*)?$/.test(o)?o:`./${o}`),Z=(o,s,c,t)=>{let n=j(o,s);if(!n)throw new error.NotFoundError(`No such file or directory, for '${o}' found.`);if(c.has(n))throw new Error(`Circularity detected while resolving configuration: ${n}`);c.add(n);let e=path.dirname(n),i=k(n,t,c);delete i.references;let{compilerOptions:l}=i;if(l){let a=["baseUrl","outDir"];for(let u of a){let g=l[u];g&&(l[u]=path.relative(s,path.join(e,g)).replaceAll("\\","/")||"./");}}return i.files&&(i.files=i.files.map(a=>path.relative(s,path.join(e,a)))),i.include&&(i.include=i.include.map(a=>path.relative(s,path.join(e,a)))),i.exclude&&(i.exclude=i.exclude.map(a=>path.relative(s,path.join(e,a)))),i},k=(o,s,c=new Set)=>{let t;try{t=Y(o)||{};}catch{throw new Error(`Cannot resolve tsconfig at path: ${o}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${o}`);let n=path.dirname(o);if(t.compilerOptions){let{compilerOptions:e}=t;e.paths&&!e.baseUrl&&(e[U]=n);}if(t.extends){let e=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(let i of e.reverse()){let l=Z(i,n,new Set(c),s),a={...l,...t,compilerOptions:{...l.compilerOptions,...t.compilerOptions}};l.watchOptions&&(a.watchOptions={...l.watchOptions,...t.watchOptions}),t=a;}}if(t.compilerOptions){let{compilerOptions:e}=t,i=["baseUrl","rootDir"];for(let a of i){let u=e[a];if(u){let g=path.resolve(n,u),m=path.relative(n,g);e[a]=O(m);}}let{outDir:l}=e;l&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.includes(l)||t.exclude.push(l),e.outDir=O(l)),s?.tscCompatible&&e.module==="node16"&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0,e.esModuleInterop=e.esModuleInterop??!0,e.moduleDetection=e.moduleDetection??"force",e.moduleResolution=e.moduleResolution??"node16",e.target=e.target??"es2022",e.useDefineForClassFields=e.useDefineForClassFields??!0),s?.tscCompatible&&e.strict&&(e.noImplicitAny=e.noImplicitAny??!0,e.noImplicitThis=e.noImplicitThis??!0,e.strictNullChecks=e.strictNullChecks??!0,e.strictFunctionTypes=e.strictFunctionTypes??!0,e.strictBindCallApply=e.strictBindCallApply??!0,e.strictPropertyInitialization=e.strictPropertyInitialization??!0,e.alwaysStrict=e.alwaysStrict??!0,e.useUnknownInCatchVariables=e.useUnknownInCatchVariables??!0),s?.tscCompatible&&e.isolatedModules&&(e.preserveConstEnums=e.preserveConstEnums??!0),s?.tscCompatible&&e.esModuleInterop&&(e.allowSyntheticDefaultImports=e.allowSyntheticDefaultImports??!0),s?.tscCompatible&&e.target==="esnext"&&(e.useDefineForClassFields=e.useDefineForClassFields??!0);}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(e=>O(e))),t.include&&(t.include=t.include.map(e=>path.normalize(e))),t.watchOptions){let{watchOptions:e}=t;e.excludeDirectories&&(e.excludeDirectories=e.excludeDirectories.map(i=>path.resolve(n,i)));}return t},U=Symbol("implicitBaseUrl"),T=(o,s)=>k(o,s);var D=new Map,oe=async(o,s={})=>{let c=s.configFileName??"tsconfig.json",t=await fs.findUp(c,{...o&&{cwd:o},type:"file"});if(t||(t=await fs.findUp("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new error.NotFoundError(`No such file or directory, for ${c} or jsconfig.json found.`);let n=s.cache&&typeof s.cache!="boolean"?s.cache:D;if(s.cache&&n.has(t))return n.get(t);let e={config:T(t),path:t};return s.cache&&n.set(t,e),e},Je=oe,se=(o,s={})=>{let c=s.configFileName??"tsconfig.json",t=fs.findUpSync(c,{...o&&{cwd:o},type:"file"});if(t||(t=fs.findUpSync("jsconfig.json",{...o&&{cwd:o},type:"file"})),!t)throw new error.NotFoundError(`No such file or directory, for ${c} or jsconfig.json found.`);let n=s.cache&&typeof s.cache!="boolean"?s.cache:D;if(s.cache&&n.has(t))return n.get(t);let e={config:T(t),path:t};return s.cache&&n.set(t,e),e},Se=se,ne=async(o,s={})=>{let{cwd:c,...t}=s,n=utils.toPath(s.cwd??process.cwd());await fs.writeJson(path.join(n,"tsconfig.json"),o,t);},je=ne;
17
-
18
- exports.a = U;
19
- exports.b = T;
20
- exports.c = oe;
21
- exports.d = Je;
22
- exports.e = se;
23
- exports.f = Se;
24
- exports.g = ne;
25
- exports.h = je;
26
- //# sourceMappingURL=out.js.map
27
- //# sourceMappingURL=chunk-W7A6C74U.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/tsconfig.ts","../src/read-tsconfig.ts","../src/utils/resolve-extends-path.ts"],"names":["findUp","findUpSync","writeJson","NotFoundError","toPath","join","readFileSync","dirname","normalize","relative","resolve","toNamespacedPath","parse","existsSync","statSync","Module","isAbsolute","resolveExports","readJsonc","jsonPath","getPnpApi","findPnpApi","resolveFromPackageJsonPath","packageJsonPath","subpath","ignoreExports","cache","cacheKey","packageJson","resolvedPath","resolvedExport","PACKAGE_JSON","TS_CONFIG_JSON","resolveExtendsPath","requestedPath","directoryPath","filePath","orgOrName","remaining","packageName","pnpApi","resolveWithPnp","resolved","packagePath","directory","path","fullPackagePath","jsonExtension","fullPackagePathWithJson","fullPackageJsonPath","tsconfigPath","resolve_extends_path_default","normalizePath","resolveExtends","extendsPath","fromDirectoryPath","circularExtendsTracker","options","resolvedExtendsPath","extendsDirectoryPath","extendsConfig","internalParseTsConfig","compilerOptions","resolvePaths","property","unresolvedPath","file","config","implicitBaseUrlSymbol","extendsPathList","merged","normalizedPaths","resolvedBaseUrl","relativeBaseUrl","outDir","element","watchOptions","excludePath","readTsConfig","TsConfigFileCache","findTsConfig","cwd","configFileName","output","findTSConfig","findTsConfigSync","findTSConfigSync","writeTsConfig","data","writeOptions","writeTSConfig"],"mappings":"AACA,OAAS,UAAAA,EAAQ,cAAAC,EAAY,aAAAC,MAAiB,eAC9C,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,UAAAC,OAAc,qBACvB,OAAS,QAAAC,OAAY,iBCErB,OAAS,gBAAAC,MAAoB,eAC7B,OAAS,iBAAAH,MAAqB,qBAC9B,OAAS,WAAAI,EAAS,QAAAF,EAAM,aAAAG,EAAW,YAAAC,EAAU,WAAAC,EAAS,oBAAAC,MAAwB,iBAC9E,OAAS,SAAAC,MAAa,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,CACX,EAGaG,GAAmBD,GAWnBE,GAAgB,MAAOC,EAAoB/B,EAAqD,CAAC,IAAqB,CAC/H,GAAM,CAAE,IAAAwB,EAAK,GAAGQ,CAAa,EAAIhC,EAE3Bb,EAAYxC,GAAOqD,EAAQ,KAAO,QAAQ,IAAI,CAAC,EAErD,MAAMvD,EAAUG,GAAKuC,EAAW,eAAe,EAAG4C,EAAMC,CAAY,CACxE,EAGaC,GAAgBH","sourcesContent":["import type { WriteJsonOptions } from \"@visulima/fs\";\nimport { findUp, findUpSync, writeJson } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { toPath } from \"@visulima/fs/utils\";\nimport { join } from \"@visulima/path\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport { readTsConfig } from \"./read-tsconfig\";\nimport type { TsConfigJsonResolved } from \"./types\";\n\ntype Options = {\n cache?: Map<string, TsConfigJsonResolved> | boolean;\n configFileName?: string;\n};\n\nconst TsConfigFileCache = new Map<string, TsConfigResult>();\n\nexport type TsConfigResult = {\n config: TsConfigJsonResolved;\n path: string;\n};\n\n/**\n * An asynchronous function that retrieves the TSConfig by searching for the \"tsconfig.json\" first,\n * second attempt is to look for the \"jsconfig.json\" file from a given current working directory.\n *\n * @param cwd - Optional. The current working directory from which to search for the \"tsconfig.json\" file.\n * The type of `cwd` is `string`.\n * @returns A `Promise` that resolves to the TSConfig result object.\n * The return type of the function is `Promise<TsConfigResult>`.\n * @throws An `Error` when the \"tsconfig.json\" file is not found.\n */\nexport const findTsConfig = async (cwd?: URL | string, options: Options = {}): Promise<TsConfigResult> => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = await findUp(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = await findUp(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfig` instead.\nexport const findTSConfig = findTsConfig;\n\nexport const findTsConfigSync = (cwd?: URL | string, options: Options = {}): TsConfigResult => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = findUpSync(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = findUpSync(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfigSync` instead.\nexport const findTSConfigSync = findTsConfigSync;\n\n/**\n * An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.\n *\n * @param tsConfig - The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.\n * @param options - Optional. The write options and the current working directory. The type of `options` is an\n * intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.\n * @returns A `Promise` that resolves when the tsconfig.json file has been written.\n * The return type of function is `Promise<void>`.\n */\nexport const writeTsConfig = async (data: TsConfigJson, options: WriteJsonOptions & { cwd?: URL | string } = {}): Promise<void> => {\n const { cwd, ...writeOptions } = options;\n\n const directory = toPath(options.cwd ?? process.cwd());\n\n await writeJson(join(directory, \"tsconfig.json\"), data, writeOptions);\n};\n\n// @deprecate Please use `writeTsconfig` instead.\nexport const writeTSConfig = writeTsConfig;\n// eslint-disable-next-line import/no-unused-modules\nexport { implicitBaseUrlSymbol } from \"./read-tsconfig\";\n","/**\n * A modified version of `readTsconfig` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/index.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { readFileSync } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { dirname, join, normalize, relative, resolve, toNamespacedPath } from \"@visulima/path\";\nimport { parse } from \"jsonc-parser\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport type { TsConfigJsonResolved } from \"./types\";\nimport resolveExtendsPath from \"./utils/resolve-extends-path\";\n\ntype Options = {\n tscCompatible?: boolean;\n};\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n// eslint-disable-next-line security/detect-unsafe-regex\nconst normalizePath = (path: string): string => toNamespacedPath(/^\\.{1,2}(?:\\/.*)?$/.test(path) ? path : `./${path}`);\n\nconst resolveExtends = (extendsPath: string, fromDirectoryPath: string, circularExtendsTracker: Set<string>, options?: Options) => {\n const resolvedExtendsPath = resolveExtendsPath(extendsPath, fromDirectoryPath);\n\n if (!resolvedExtendsPath) {\n throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);\n }\n\n if (circularExtendsTracker.has(resolvedExtendsPath)) {\n throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);\n }\n\n circularExtendsTracker.add(resolvedExtendsPath);\n\n const extendsDirectoryPath = dirname(resolvedExtendsPath);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);\n\n delete extendsConfig.references;\n\n const { compilerOptions } = extendsConfig;\n\n if (compilerOptions) {\n const resolvePaths = [\"baseUrl\", \"outDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of resolvePaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = relative(fromDirectoryPath, join(extendsDirectoryPath, unresolvedPath)).replaceAll(\"\\\\\", \"/\") || \"./\";\n }\n }\n }\n\n if (extendsConfig.files) {\n extendsConfig.files = extendsConfig.files.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.include) {\n extendsConfig.include = extendsConfig.include.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.exclude) {\n extendsConfig.exclude = extendsConfig.exclude.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n return extendsConfig;\n};\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst internalParseTsConfig = (tsconfigPath: string, options?: Options, circularExtendsTracker = new Set<string>()): TsConfigJsonResolved => {\n /**\n * Decided not to cache the TsConfigJsonResolved object because it's\n * mutable.\n *\n * Note how `resolveExtends` can call `readTsconfig` rescursively\n * and actually mutates the object. It can also be mutated in\n * user-land.\n *\n * By only caching fs results, we can avoid serving mutated objects\n */\n let config: TsConfigJson;\n\n try {\n config = readJsonc(tsconfigPath) || {};\n } catch {\n throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);\n }\n\n if (typeof config !== \"object\") {\n throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);\n }\n\n const directoryPath = dirname(tsconfigPath);\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n if (compilerOptions.paths && !compilerOptions.baseUrl) {\n type WithImplicitBaseUrl = TsConfigJson.CompilerOptions & {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [implicitBaseUrlSymbol]: string;\n };\n // eslint-disable-next-line security/detect-object-injection,@typescript-eslint/no-use-before-define\n (compilerOptions as WithImplicitBaseUrl)[implicitBaseUrlSymbol] = directoryPath;\n }\n }\n\n if (config.extends) {\n const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];\n\n delete config.extends;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,etc/no-assign-mutated-array\n for (const extendsPath of extendsPathList.reverse()) {\n const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);\n const merged = {\n ...extendsConfig,\n ...config,\n\n compilerOptions: {\n ...extendsConfig.compilerOptions,\n ...config.compilerOptions,\n },\n };\n\n if (extendsConfig.watchOptions) {\n merged.watchOptions = {\n ...extendsConfig.watchOptions,\n ...config.watchOptions,\n };\n }\n\n config = merged;\n }\n }\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n const normalizedPaths = [\"baseUrl\", \"rootDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of normalizedPaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);\n const relativeBaseUrl = relative(directoryPath, resolvedBaseUrl);\n\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = normalizePath(relativeBaseUrl);\n }\n }\n\n const { outDir } = compilerOptions;\n\n if (outDir) {\n if (!Array.isArray(config.exclude)) {\n config.exclude = [];\n }\n\n if (!config.exclude.includes(outDir)) {\n config.exclude.push(outDir);\n }\n\n compilerOptions.outDir = normalizePath(outDir);\n }\n\n if (options?.tscCompatible && compilerOptions.module === \"node16\") {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n compilerOptions.esModuleInterop = compilerOptions.esModuleInterop ?? true;\n compilerOptions.moduleDetection = compilerOptions.moduleDetection ?? \"force\";\n compilerOptions.moduleResolution = compilerOptions.moduleResolution ?? \"node16\";\n compilerOptions.target = compilerOptions.target ?? \"es2022\";\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.strict) {\n compilerOptions.noImplicitAny = compilerOptions.noImplicitAny ?? true;\n compilerOptions.noImplicitThis = compilerOptions.noImplicitThis ?? true;\n compilerOptions.strictNullChecks = compilerOptions.strictNullChecks ?? true;\n compilerOptions.strictFunctionTypes = compilerOptions.strictFunctionTypes ?? true;\n compilerOptions.strictBindCallApply = compilerOptions.strictBindCallApply ?? true;\n compilerOptions.strictPropertyInitialization = compilerOptions.strictPropertyInitialization ?? true;\n compilerOptions.alwaysStrict = compilerOptions.alwaysStrict ?? true;\n compilerOptions.useUnknownInCatchVariables = compilerOptions.useUnknownInCatchVariables ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.isolatedModules) {\n compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.esModuleInterop) {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.target === \"esnext\") {\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n } else {\n config.compilerOptions = {};\n }\n\n if (config.files) {\n config.files = config.files.map((element) => normalizePath(element));\n }\n\n if (config.include) {\n config.include = config.include.map((element) => normalize(element));\n }\n\n if (config.watchOptions) {\n const { watchOptions } = config;\n\n if (watchOptions.excludeDirectories) {\n watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));\n }\n }\n\n return config;\n};\n\nexport const implicitBaseUrlSymbol = Symbol(\"implicitBaseUrl\");\nexport const readTsConfig = (tsconfigPath: string, options?: Options): TsConfigJsonResolved => internalParseTsConfig(tsconfigPath, options);\n","/**\n * A modified version of `resolveExtendsPath` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/resolve-extends-path.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { existsSync, statSync } from \"node:fs\";\nimport Module from \"node:module\";\n\nimport { findUpSync, readFileSync } from \"@visulima/fs\";\nimport { isAbsolute, join, resolve } from \"@visulima/path\";\nimport { parse } from \"jsonc-parser\";\nimport type { PathConditions } from \"resolve-pkg-maps\";\nimport { resolveExports } from \"resolve-pkg-maps\";\nimport type { PackageJson } from \"type-fest\";\n\nimport type { Cache } from \"../types\";\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n\nconst getPnpApi = () => {\n const { findPnpApi } = Module;\n\n // https://yarnpkg.com/advanced/pnpapi/#requirepnpapi\n return findPnpApi?.(process.cwd());\n};\n\nconst resolveFromPackageJsonPath = (packageJsonPath: string, subpath: string, ignoreExports?: boolean, cache?: Cache<string>) => {\n const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`;\n\n if (cache?.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n const packageJson = readJsonc(packageJsonPath);\n\n if (!packageJson) {\n return undefined;\n }\n\n let resolvedPath = subpath || \"tsconfig.json\";\n\n if (!ignoreExports && (packageJson as PackageJson).exports) {\n try {\n const [resolvedExport] = resolveExports((packageJson as PackageJson).exports as PathConditions, subpath, [\"require\", \"types\"]);\n\n resolvedPath = resolvedExport as string;\n } catch {\n // Block\n return false;\n }\n } else if (!subpath && (packageJson as PackageJson).tsconfig) {\n resolvedPath = (packageJson as PackageJson).tsconfig as string;\n }\n\n resolvedPath = join(packageJsonPath, \"..\", resolvedPath);\n\n cache?.set(cacheKey, resolvedPath);\n\n return resolvedPath;\n};\n\nconst PACKAGE_JSON = \"package.json\";\nconst TS_CONFIG_JSON = \"tsconfig.json\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst resolveExtendsPath = (requestedPath: string, directoryPath: string, cache?: Cache<string>): string | undefined => {\n let filePath = requestedPath;\n\n if (requestedPath === \"..\") {\n filePath = join(filePath, TS_CONFIG_JSON);\n }\n\n if (requestedPath.startsWith(\".\")) {\n filePath = resolve(directoryPath, filePath);\n }\n\n if (isAbsolute(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(filePath).isFile()) {\n return filePath;\n }\n } else if (!filePath.endsWith(\".json\")) {\n const jsonPath = `${filePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(jsonPath)) {\n return jsonPath;\n }\n }\n\n return undefined;\n }\n\n const [orgOrName, ...remaining] = requestedPath.split(\"/\");\n const packageName = ((orgOrName as string).startsWith(\"@\") ? `${orgOrName}/${remaining.shift()}` : orgOrName) as string;\n const subpath = remaining.join(\"/\");\n\n const pnpApi = getPnpApi();\n\n if (pnpApi) {\n const { resolveRequest: resolveWithPnp } = pnpApi;\n\n try {\n if (packageName === requestedPath) {\n const packageJsonPath = resolveWithPnp(join(packageName, PACKAGE_JSON), directoryPath);\n\n if (packageJsonPath) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n } else {\n let resolved: string | null;\n\n try {\n resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [\".json\"] });\n } catch {\n resolved = resolveWithPnp(join(requestedPath, TS_CONFIG_JSON), directoryPath);\n }\n\n if (resolved) {\n return resolved;\n }\n }\n } catch {\n /* empty */\n }\n }\n\n const packagePath = findUpSync(\n (directory) => {\n const path = join(directory, \"node_modules\", packageName);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(path)) {\n return join(\"node_modules\", packageName);\n }\n\n return undefined;\n },\n {\n cwd: directoryPath,\n type: \"directory\",\n },\n );\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!packagePath || !statSync(packagePath).isDirectory()) {\n return undefined;\n }\n\n const packageJsonPath = join(packagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(packageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // Blocked\n if (resolvedPath === false) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath) && statSync(resolvedPath).isFile()) {\n return resolvedPath;\n }\n }\n\n const fullPackagePath = join(packagePath, subpath);\n const jsonExtension = fullPackagePath.endsWith(\".json\");\n\n if (!jsonExtension) {\n const fullPackagePathWithJson = `${fullPackagePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackagePathWithJson)) {\n return fullPackagePathWithJson;\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(fullPackagePath)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(fullPackagePath).isDirectory()) {\n const fullPackageJsonPath = join(fullPackagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, \"\", true, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n\n const tsconfigPath = join(fullPackagePath, TS_CONFIG_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(tsconfigPath)) {\n return tsconfigPath;\n }\n } else if (jsonExtension) {\n return fullPackagePath;\n }\n\n return undefined;\n};\n\nexport default resolveExtendsPath;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/error.js DELETED
@@ -1,5 +0,0 @@
1
- export { a as PackageNotFoundError } from './chunk-KMWIKANF.js';
2
- import './chunk-BGVUNBLL.js';
3
- import './chunk-HGV2BL7M.js';
4
- //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=error.js.map
package/dist/error.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
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,iBASrB,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 \"@visulima/path\";\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 DELETED
@@ -1,17 +0,0 @@
1
- export { a as PackageNotFoundError } from './chunk-KMWIKANF.js';
2
- export { a as findMonorepoRoot } from './chunk-5UU4RIJA.js';
3
- import { a, b } from './chunk-EY5KVLRL.js';
4
- export { a as findPackageRoot, b as findPackageRootSync } from './chunk-EY5KVLRL.js';
5
- export { a as findLockFile, b as findLockFileSync, c as findPackageManager, d as findPackageManagerSync, e as getPackageManagerVersion, f as identifyInitiatingPackageManager } from './chunk-BGVUNBLL.js';
6
- export { a as findPackageJson, b as findPackageJsonSync, e as parsePackageJson, c as writePackageJson, d as writePackageJsonSync } from './chunk-HGV2BL7M.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-W3Z24XII.js';
8
- import { existsSync } from 'node:fs';
9
- import { env, cwd } from 'node:process';
10
- import { isAccessible, W_OK, isAccessibleSync, ensureDirSync } from '@visulima/fs';
11
- import { join } from '@visulima/path';
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)};
14
-
15
- export { j as findCacheDirectory, v as findCacheDirectorySync };
16
- //# sourceMappingURL=out.js.map
17
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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,iBASrB,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 \"@visulima/path\";\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 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/monorepo.js DELETED
@@ -1,5 +0,0 @@
1
- export { a as findMonorepoRoot } from './chunk-5UU4RIJA.js';
2
- import './chunk-BGVUNBLL.js';
3
- import './chunk-HGV2BL7M.js';
4
- //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=monorepo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export { a as findPackageJson, b as findPackageJsonSync, e as parsePackageJson, c as writePackageJson, d as writePackageJsonSync } from './chunk-HGV2BL7M.js';
2
- //# sourceMappingURL=out.js.map
3
- //# sourceMappingURL=package-json.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export { a as findLockFile, b as findLockFileSync, c as findPackageManager, d as findPackageManagerSync, e as getPackageManagerVersion, f as identifyInitiatingPackageManager } from './chunk-BGVUNBLL.js';
2
- import './chunk-HGV2BL7M.js';
3
- //# sourceMappingURL=out.js.map
4
- //# sourceMappingURL=package-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/package.js DELETED
@@ -1,5 +0,0 @@
1
- export { a as findPackageRoot, b as findPackageRootSync } from './chunk-EY5KVLRL.js';
2
- import './chunk-BGVUNBLL.js';
3
- import './chunk-HGV2BL7M.js';
4
- //# sourceMappingURL=out.js.map
5
- //# sourceMappingURL=package.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- import { WriteJsonOptions } from '@visulima/fs';
2
- import { TsConfigJson } from 'type-fest';
3
- import { T as TsConfigJsonResolved } from './types-hoigZ9HA.js';
4
-
5
- type Options$1 = {
6
- tscCompatible?: boolean;
7
- };
8
- declare const implicitBaseUrlSymbol: unique symbol;
9
- declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
10
-
11
- type Options = {
12
- cache?: Map<string, TsConfigJsonResolved> | boolean;
13
- configFileName?: string;
14
- };
15
- type TsConfigResult = {
16
- config: TsConfigJsonResolved;
17
- path: string;
18
- };
19
- declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
20
- declare const findTSConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
21
- declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
22
- declare const findTSConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
23
- declare const writeTsConfig: (data: TsConfigJson, options?: WriteJsonOptions & {
24
- cwd?: URL | string;
25
- }) => Promise<void>;
26
- declare const writeTSConfig: (data: TsConfigJson, options?: WriteJsonOptions & {
27
- cwd?: URL | string;
28
- }) => Promise<void>;
29
-
30
- export { type TsConfigResult as T, findTsConfig as a, findTSConfigSync as b, findTsConfigSync as c, writeTsConfig as d, findTSConfig as f, implicitBaseUrlSymbol as i, readTsConfig as r, writeTSConfig as w };
@@ -1,30 +0,0 @@
1
- import { WriteJsonOptions } from '@visulima/fs';
2
- import { TsConfigJson } from 'type-fest';
3
- import { T as TsConfigJsonResolved } from './types-hoigZ9HA.cjs';
4
-
5
- type Options$1 = {
6
- tscCompatible?: boolean;
7
- };
8
- declare const implicitBaseUrlSymbol: unique symbol;
9
- declare const readTsConfig: (tsconfigPath: string, options?: Options$1) => TsConfigJsonResolved;
10
-
11
- type Options = {
12
- cache?: Map<string, TsConfigJsonResolved> | boolean;
13
- configFileName?: string;
14
- };
15
- type TsConfigResult = {
16
- config: TsConfigJsonResolved;
17
- path: string;
18
- };
19
- declare const findTsConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
20
- declare const findTSConfig: (cwd?: URL | string, options?: Options) => Promise<TsConfigResult>;
21
- declare const findTsConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
22
- declare const findTSConfigSync: (cwd?: URL | string, options?: Options) => TsConfigResult;
23
- declare const writeTsConfig: (data: TsConfigJson, options?: WriteJsonOptions & {
24
- cwd?: URL | string;
25
- }) => Promise<void>;
26
- declare const writeTSConfig: (data: TsConfigJson, options?: WriteJsonOptions & {
27
- cwd?: URL | string;
28
- }) => Promise<void>;
29
-
30
- export { type TsConfigResult as T, findTsConfig as a, findTSConfigSync as b, findTsConfigSync as c, writeTsConfig as d, findTSConfig as f, implicitBaseUrlSymbol as i, readTsConfig as r, writeTSConfig as w };
package/dist/tsconfig.cjs DELETED
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkW7A6C74U_cjs = require('./chunk-W7A6C74U.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, 'findTSConfig', {
8
- enumerable: true,
9
- get: function () { return chunkW7A6C74U_cjs.d; }
10
- });
11
- Object.defineProperty(exports, 'findTSConfigSync', {
12
- enumerable: true,
13
- get: function () { return chunkW7A6C74U_cjs.f; }
14
- });
15
- Object.defineProperty(exports, 'findTsConfig', {
16
- enumerable: true,
17
- get: function () { return chunkW7A6C74U_cjs.c; }
18
- });
19
- Object.defineProperty(exports, 'findTsConfigSync', {
20
- enumerable: true,
21
- get: function () { return chunkW7A6C74U_cjs.e; }
22
- });
23
- Object.defineProperty(exports, 'implicitBaseUrlSymbol', {
24
- enumerable: true,
25
- get: function () { return chunkW7A6C74U_cjs.a; }
26
- });
27
- Object.defineProperty(exports, 'writeTSConfig', {
28
- enumerable: true,
29
- get: function () { return chunkW7A6C74U_cjs.h; }
30
- });
31
- Object.defineProperty(exports, 'writeTsConfig', {
32
- enumerable: true,
33
- get: function () { return chunkW7A6C74U_cjs.g; }
34
- });
35
- //# sourceMappingURL=out.js.map
36
- //# sourceMappingURL=tsconfig.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import '@visulima/fs';
2
- import 'type-fest';
3
- import './types-hoigZ9HA.cjs';
4
- export { T as TsConfigResult, f as findTSConfig, b as findTSConfigSync, a as findTsConfig, c as findTsConfigSync, i as implicitBaseUrlSymbol, w as writeTSConfig, d as writeTsConfig } from './tsconfig-d4zwQgCH.cjs';
5
- import 'normalize-package-data';
@@ -1,5 +0,0 @@
1
- import '@visulima/fs';
2
- import 'type-fest';
3
- import './types-hoigZ9HA.js';
4
- export { T as TsConfigResult, f as findTSConfig, b as findTSConfigSync, a as findTsConfig, c as findTsConfigSync, i as implicitBaseUrlSymbol, w as writeTSConfig, d as writeTsConfig } from './tsconfig-G-HInwrt.js';
5
- import 'normalize-package-data';
package/dist/tsconfig.js DELETED
@@ -1,3 +0,0 @@
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-W3Z24XII.js';
2
- //# sourceMappingURL=out.js.map
3
- //# sourceMappingURL=tsconfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { Package } from 'normalize-package-data';
2
- import { PackageJson as PackageJson$1, Except, TsConfigJson } from 'type-fest';
3
-
4
- type NormalizedPackageJson = Package & PackageJson;
5
- type PackageJson = PackageJson$1;
6
- type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
7
- type Cache<T = any> = Map<string, T>;
8
-
9
- export type { Cache as C, NormalizedPackageJson as N, PackageJson as P, TsConfigJsonResolved as T };
@@ -1,9 +0,0 @@
1
- import { Package } from 'normalize-package-data';
2
- import { PackageJson as PackageJson$1, Except, TsConfigJson } from 'type-fest';
3
-
4
- type NormalizedPackageJson = Package & PackageJson;
5
- type PackageJson = PackageJson$1;
6
- type TsConfigJsonResolved = Except<TsConfigJson, "extends">;
7
- type Cache<T = any> = Map<string, T>;
8
-
9
- export type { Cache as C, NormalizedPackageJson as N, PackageJson as P, TsConfigJsonResolved as T };