@visulima/package 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/chunk-5UU4RIJA.js +11 -0
- package/dist/chunk-5UU4RIJA.js.map +1 -0
- package/dist/chunk-BGVUNBLL.js +12 -0
- package/dist/chunk-BGVUNBLL.js.map +1 -0
- package/dist/chunk-BHDWBI3F.cjs +22 -0
- package/dist/chunk-BHDWBI3F.cjs.map +1 -0
- package/dist/chunk-C36BYRSZ.cjs +19 -0
- package/dist/chunk-C36BYRSZ.cjs.map +1 -0
- package/dist/chunk-EY5KVLRL.js +10 -0
- package/dist/chunk-EY5KVLRL.js.map +1 -0
- package/dist/chunk-HGV2BL7M.js +12 -0
- package/dist/chunk-HGV2BL7M.js.map +1 -0
- package/dist/chunk-I3EKI236.cjs +13 -0
- package/dist/chunk-I3EKI236.cjs.map +1 -0
- package/dist/chunk-J5ERILYG.cjs +9 -0
- package/dist/chunk-J5ERILYG.cjs.map +1 -0
- package/dist/chunk-KMWIKANF.js +7 -0
- package/dist/chunk-KMWIKANF.js.map +1 -0
- package/dist/chunk-RETLQXQB.cjs +13 -0
- package/dist/chunk-RETLQXQB.cjs.map +1 -0
- package/dist/chunk-W3Z24XII.js +14 -0
- package/dist/chunk-W3Z24XII.js.map +1 -0
- package/dist/chunk-W7A6C74U.cjs +27 -0
- package/dist/chunk-W7A6C74U.cjs.map +1 -0
- package/dist/error.cjs +5 -5
- package/dist/error.js +3 -3
- package/dist/index.cjs +54 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -59
- package/dist/index.js.map +1 -1
- package/dist/monorepo.cjs +5 -5
- package/dist/monorepo.js +3 -3
- package/dist/package-json.cjs +11 -11
- package/dist/package-json.js +1 -1
- package/dist/package-manager.cjs +14 -14
- package/dist/package-manager.js +2 -2
- package/dist/package.cjs +7 -7
- package/dist/package.js +3 -3
- package/dist/tsconfig.cjs +15 -15
- package/dist/tsconfig.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-5VO6NTKJ.js +0 -361
- package/dist/chunk-5VO6NTKJ.js.map +0 -1
- package/dist/chunk-7IOK6YPW.cjs +0 -52
- package/dist/chunk-7IOK6YPW.cjs.map +0 -1
- package/dist/chunk-CVVFWSMT.cjs +0 -65
- package/dist/chunk-CVVFWSMT.cjs.map +0 -1
- package/dist/chunk-E2PKJX3Q.js +0 -54
- package/dist/chunk-E2PKJX3Q.js.map +0 -1
- package/dist/chunk-EYMR7Z2I.js +0 -62
- package/dist/chunk-EYMR7Z2I.js.map +0 -1
- package/dist/chunk-G3SI24AJ.cjs +0 -88
- package/dist/chunk-G3SI24AJ.cjs.map +0 -1
- package/dist/chunk-IIYQBLPC.js +0 -119
- package/dist/chunk-IIYQBLPC.js.map +0 -1
- package/dist/chunk-IK5YSYLX.cjs +0 -126
- package/dist/chunk-IK5YSYLX.cjs.map +0 -1
- package/dist/chunk-UZ2FN6C5.js +0 -78
- package/dist/chunk-UZ2FN6C5.js.map +0 -1
- package/dist/chunk-WXFZK4G3.cjs +0 -374
- package/dist/chunk-WXFZK4G3.cjs.map +0 -1
- package/dist/chunk-YLCN7EVV.js +0 -50
- package/dist/chunk-YLCN7EVV.js.map +0 -1
- package/dist/chunk-YOQXHFU3.cjs +0 -56
- package/dist/chunk-YOQXHFU3.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
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,eCHtB,OAAS,cAAAC,EAAY,YAAAC,MAAgB,KACrC,OAAOC,MAAY,SAEnB,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,CAAW,EAExEC,EAAY,IAAM,CACpB,GAAM,CAAE,WAAAC,CAAW,EAAIN,EAGvB,OAAOM,IAAa,QAAQ,IAAI,CAAC,CACrC,EAEMC,EAA6B,CAACC,EAAyBC,EAAiBC,EAAyBC,IAA0B,CAC7H,IAAMC,EAAW,8BAA8BJ,CAAe,I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CAAQ,EAC7B,KAAMA,CACV,EAEA,OAAIqB,EAAQ,OACR/B,EAAM,IAAIU,EAAU+C,CAAM,EAGvBA,CACX,EAGaC,GAAeJ,GAEfK,GAAmB,CAACJ,EAAoBxB,EAAmB,CAAC,IAAsB,CAC3F,IAAMyB,EAAiBzB,EAAQ,gBAAkB,gBAE7CrB,EAAWnC,EAAWiF,EAAgB,CACtC,GAAID,GAAO,CAAE,IAAAA,CAAI,EACjB,KAAM,MACV,CAAC,EASD,GAPK7C,IACDA,EAAWnC,EAAW,gBAAiB,CACnC,GAAIgF,GAAO,CAAE,IAAAA,CAAI,EACjB,KAAM,MACV,CAAC,GAGD,CAAC7C,EACD,MAAM,IAAIjC,EAAc,kCAAkC+E,CAAc,0BAA0B,EAGtG,IAAMxD,EAAQ+B,EAAQ,OAAS,OAAOA,EAAQ,OAAU,UAAYA,EAAQ,MAAQsB,EAEpF,GAAItB,EAAQ,OAAS/B,EAAM,IAAIU,CAAQ,EACnC,OAAOV,EAAM,IAAIU,CAAQ,EAG7B,IAAM+C,EAAS,CACX,OAAQL,EAAa1C,CAAQ,EAC7B,KAAMA,CACV,EAEA,OAAIqB,EAAQ,OACR/B,EAAM,IAAIU,EAAU+C,CAAM,EAGvBA,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"]}
|
package/dist/error.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkJ5ERILYG_cjs = require('./chunk-J5ERILYG.cjs');
|
|
4
|
+
require('./chunk-C36BYRSZ.cjs');
|
|
5
|
+
require('./chunk-BHDWBI3F.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, 'PackageNotFoundError', {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkJ5ERILYG_cjs.a; }
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=out.js.map
|
|
14
14
|
//# sourceMappingURL=error.cjs.map
|
package/dist/error.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { a as PackageNotFoundError } from './chunk-KMWIKANF.js';
|
|
2
|
+
import './chunk-BGVUNBLL.js';
|
|
3
|
+
import './chunk-HGV2BL7M.js';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=error.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,156 +1,107 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var chunkJ5ERILYG_cjs = require('./chunk-J5ERILYG.cjs');
|
|
4
|
+
var chunkRETLQXQB_cjs = require('./chunk-RETLQXQB.cjs');
|
|
5
|
+
var chunkI3EKI236_cjs = require('./chunk-I3EKI236.cjs');
|
|
6
|
+
var chunkC36BYRSZ_cjs = require('./chunk-C36BYRSZ.cjs');
|
|
7
|
+
var chunkBHDWBI3F_cjs = require('./chunk-BHDWBI3F.cjs');
|
|
8
|
+
var chunkW7A6C74U_cjs = require('./chunk-W7A6C74U.cjs');
|
|
9
9
|
var fs = require('fs');
|
|
10
10
|
var process = require('process');
|
|
11
11
|
var fs$1 = require('@visulima/fs');
|
|
12
|
-
var
|
|
12
|
+
var path = require('@visulima/path');
|
|
13
13
|
|
|
14
|
-
var
|
|
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
|
-
};
|
|
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(path.join(process.env.CACHE_DIR,r),e);let s=await chunkI3EKI236_cjs.a(e?.cwd??process.cwd());if(!s)return;let o=path.join(s,"node_modules"),t=path.join(o,".cache"),i=path.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(path.join(process.env.CACHE_DIR,r),e);let s=chunkI3EKI236_cjs.b(e?.cwd??process.cwd());if(!s)return;let o=path.join(s,"node_modules"),t=path.join(o,".cache"),i=path.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)};
|
|
64
15
|
|
|
65
16
|
Object.defineProperty(exports, 'PackageNotFoundError', {
|
|
66
|
-
|
|
67
|
-
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkJ5ERILYG_cjs.a; }
|
|
68
19
|
});
|
|
69
20
|
Object.defineProperty(exports, 'findMonorepoRoot', {
|
|
70
|
-
|
|
71
|
-
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkRETLQXQB_cjs.a; }
|
|
72
23
|
});
|
|
73
24
|
Object.defineProperty(exports, 'findPackageRoot', {
|
|
74
|
-
|
|
75
|
-
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkI3EKI236_cjs.a; }
|
|
76
27
|
});
|
|
77
28
|
Object.defineProperty(exports, 'findPackageRootSync', {
|
|
78
|
-
|
|
79
|
-
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkI3EKI236_cjs.b; }
|
|
80
31
|
});
|
|
81
32
|
Object.defineProperty(exports, 'findLockFile', {
|
|
82
|
-
|
|
83
|
-
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkC36BYRSZ_cjs.a; }
|
|
84
35
|
});
|
|
85
36
|
Object.defineProperty(exports, 'findLockFileSync', {
|
|
86
|
-
|
|
87
|
-
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkC36BYRSZ_cjs.b; }
|
|
88
39
|
});
|
|
89
40
|
Object.defineProperty(exports, 'findPackageManager', {
|
|
90
|
-
|
|
91
|
-
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkC36BYRSZ_cjs.c; }
|
|
92
43
|
});
|
|
93
44
|
Object.defineProperty(exports, 'findPackageManagerSync', {
|
|
94
|
-
|
|
95
|
-
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunkC36BYRSZ_cjs.d; }
|
|
96
47
|
});
|
|
97
48
|
Object.defineProperty(exports, 'getPackageManagerVersion', {
|
|
98
|
-
|
|
99
|
-
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunkC36BYRSZ_cjs.e; }
|
|
100
51
|
});
|
|
101
52
|
Object.defineProperty(exports, 'identifyInitiatingPackageManager', {
|
|
102
|
-
|
|
103
|
-
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunkC36BYRSZ_cjs.f; }
|
|
104
55
|
});
|
|
105
56
|
Object.defineProperty(exports, 'findPackageJson', {
|
|
106
|
-
|
|
107
|
-
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunkBHDWBI3F_cjs.a; }
|
|
108
59
|
});
|
|
109
60
|
Object.defineProperty(exports, 'findPackageJsonSync', {
|
|
110
|
-
|
|
111
|
-
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunkBHDWBI3F_cjs.b; }
|
|
112
63
|
});
|
|
113
64
|
Object.defineProperty(exports, 'parsePackageJson', {
|
|
114
|
-
|
|
115
|
-
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunkBHDWBI3F_cjs.e; }
|
|
116
67
|
});
|
|
117
68
|
Object.defineProperty(exports, 'writePackageJson', {
|
|
118
|
-
|
|
119
|
-
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return chunkBHDWBI3F_cjs.c; }
|
|
120
71
|
});
|
|
121
72
|
Object.defineProperty(exports, 'writePackageJsonSync', {
|
|
122
|
-
|
|
123
|
-
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return chunkBHDWBI3F_cjs.d; }
|
|
124
75
|
});
|
|
125
76
|
Object.defineProperty(exports, 'findTSConfig', {
|
|
126
|
-
|
|
127
|
-
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return chunkW7A6C74U_cjs.d; }
|
|
128
79
|
});
|
|
129
80
|
Object.defineProperty(exports, 'findTSConfigSync', {
|
|
130
|
-
|
|
131
|
-
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return chunkW7A6C74U_cjs.f; }
|
|
132
83
|
});
|
|
133
84
|
Object.defineProperty(exports, 'findTsConfig', {
|
|
134
|
-
|
|
135
|
-
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return chunkW7A6C74U_cjs.c; }
|
|
136
87
|
});
|
|
137
88
|
Object.defineProperty(exports, 'findTsConfigSync', {
|
|
138
|
-
|
|
139
|
-
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return chunkW7A6C74U_cjs.e; }
|
|
140
91
|
});
|
|
141
92
|
Object.defineProperty(exports, 'implicitBaseUrlSymbol', {
|
|
142
|
-
|
|
143
|
-
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return chunkW7A6C74U_cjs.a; }
|
|
144
95
|
});
|
|
145
96
|
Object.defineProperty(exports, 'readTsConfig', {
|
|
146
|
-
|
|
147
|
-
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return chunkW7A6C74U_cjs.b; }
|
|
148
99
|
});
|
|
149
100
|
Object.defineProperty(exports, 'writeTSConfig', {
|
|
150
|
-
|
|
151
|
-
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return chunkW7A6C74U_cjs.h; }
|
|
152
103
|
});
|
|
153
|
-
exports.findCacheDirectory =
|
|
154
|
-
exports.findCacheDirectorySync =
|
|
104
|
+
exports.findCacheDirectory = L;
|
|
105
|
+
exports.findCacheDirectorySync = j;
|
|
155
106
|
//# sourceMappingURL=out.js.map
|
|
156
107
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/find-cache-dir.ts"],"names":[],"mappings":"
|
|
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
CHANGED
|
@@ -1,66 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { findMonorepoRoot } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
export { findPackageRoot, findPackageRootSync } from './chunk-
|
|
5
|
-
export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './chunk-
|
|
6
|
-
export { findPackageJson, findPackageJsonSync, parsePackageJson, writePackageJson, writePackageJsonSync } from './chunk-
|
|
7
|
-
export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig } from './chunk-
|
|
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
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
|
-
import { join } from '
|
|
11
|
+
import { join } from '@visulima/path';
|
|
12
12
|
|
|
13
|
-
var
|
|
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
|
-
};
|
|
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)};
|
|
63
14
|
|
|
64
|
-
export { findCacheDirectory, findCacheDirectorySync };
|
|
15
|
+
export { j as findCacheDirectory, v as findCacheDirectorySync };
|
|
65
16
|
//# sourceMappingURL=out.js.map
|
|
66
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/find-cache-dir.ts"],"names":[],"mappings":"
|
|
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"]}
|
package/dist/monorepo.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkRETLQXQB_cjs = require('./chunk-RETLQXQB.cjs');
|
|
4
|
+
require('./chunk-C36BYRSZ.cjs');
|
|
5
|
+
require('./chunk-BHDWBI3F.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, 'findMonorepoRoot', {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkRETLQXQB_cjs.a; }
|
|
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 { findMonorepoRoot } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { a as findMonorepoRoot } from './chunk-5UU4RIJA.js';
|
|
2
|
+
import './chunk-BGVUNBLL.js';
|
|
3
|
+
import './chunk-HGV2BL7M.js';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=monorepo.js.map
|
package/dist/package-json.cjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBHDWBI3F_cjs = require('./chunk-BHDWBI3F.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, 'findPackageJson', {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkBHDWBI3F_cjs.a; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, 'findPackageJsonSync', {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkBHDWBI3F_cjs.b; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, 'parsePackageJson', {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkBHDWBI3F_cjs.e; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, 'writePackageJson', {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkBHDWBI3F_cjs.c; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, 'writePackageJsonSync', {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkBHDWBI3F_cjs.d; }
|
|
26
26
|
});
|
|
27
27
|
//# sourceMappingURL=out.js.map
|
|
28
28
|
//# sourceMappingURL=package-json.cjs.map
|
package/dist/package-json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { findPackageJson, findPackageJsonSync, parsePackageJson, writePackageJson, writePackageJsonSync } from './chunk-
|
|
1
|
+
export { a as findPackageJson, b as findPackageJsonSync, e as parsePackageJson, c as writePackageJson, d as writePackageJsonSync } from './chunk-HGV2BL7M.js';
|
|
2
2
|
//# sourceMappingURL=out.js.map
|
|
3
3
|
//# sourceMappingURL=package-json.js.map
|
package/dist/package-manager.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkC36BYRSZ_cjs = require('./chunk-C36BYRSZ.cjs');
|
|
4
|
+
require('./chunk-BHDWBI3F.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, 'findLockFile', {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkC36BYRSZ_cjs.a; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, 'findLockFileSync', {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkC36BYRSZ_cjs.b; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, 'findPackageManager', {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkC36BYRSZ_cjs.c; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, 'findPackageManagerSync', {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkC36BYRSZ_cjs.d; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, 'getPackageManagerVersion', {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkC36BYRSZ_cjs.e; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, 'identifyInitiatingPackageManager', {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkC36BYRSZ_cjs.f; }
|
|
31
31
|
});
|
|
32
32
|
//# sourceMappingURL=out.js.map
|
|
33
33
|
//# sourceMappingURL=package-manager.cjs.map
|
package/dist/package-manager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './chunk-
|
|
2
|
-
import './chunk-
|
|
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
3
|
//# sourceMappingURL=out.js.map
|
|
4
4
|
//# sourceMappingURL=package-manager.js.map
|