@sanity/plugin-kit

6.0.47.0.0
dist/_chunks-es/load-package-config.js.map
+dist/_chunks-es/load-package-config.js.mapNew file
+1
Index: package/dist/_chunks-es/load-package-config.js.map
===================================================================
--- package/dist/_chunks-es/load-package-config.js.map
+++ package/dist/_chunks-es/load-package-config.js.map
@@ -0,0 +1,1 @@
+{"version":3,"file":"load-package-config.js","names":[],"sources":["../../src/util/load-package-config.ts"],"sourcesContent":["import fs from 'node:fs'\nimport {createRequire} from 'node:module'\nimport path from 'node:path'\nimport {pathToFileURL} from 'node:url'\n\nimport type {loadConfig as LoadConfig, PkgConfigOptions} from '@sanity/pkg-utils'\n\n// Config file candidates supported by `@sanity/pkg-utils`.\nconst CONFIG_FILE_NAMES = [\n  'package.config.ts',\n  'package.config.js',\n  'package.config.cjs',\n  'package.config.mts',\n  'package.config.mjs',\n]\n\n/**\n * Loads the `@sanity/pkg-utils` package.config file for the plugin in `basePath`.\n *\n * `@sanity/pkg-utils` is a peer dependency, so we resolve `loadConfig` from the plugin's own\n * installation (relative to `basePath`). This guarantees the config is parsed with the exact\n * same pkg-utils version the plugin builds with, and lets plugin-kit run via `npx` without\n * bundling its own copy of pkg-utils.\n */\nexport async function loadPackageConfig(options: {\n  basePath: string\n}): Promise<PkgConfigOptions | undefined> {\n  const {basePath} = options\n\n  // Cheap check first: avoid resolving the pkg-utils peer when there's no config to load.\n  const hasConfigFile = CONFIG_FILE_NAMES.some((file) => fs.existsSync(path.join(basePath, file)))\n  if (!hasConfigFile) {\n    return undefined\n  }\n\n  const pkgPath = path.join(basePath, 'package.json')\n  const require = createRequire(pkgPath)\n  const pkgUtilsEntry = require.resolve('@sanity/pkg-utils')\n  const {loadConfig} = (await import(pathToFileURL(pkgUtilsEntry).href)) as {\n    loadConfig: typeof LoadConfig\n  }\n\n  return loadConfig({cwd: basePath, pkgPath})\n}\n"],"mappings":";;;;AAQA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;AACF;;;;;;;;;AAUA,eAAsB,kBAAkB,SAEE;CACxC,IAAM,EAAC,aAAY;CAInB,IAAI,CADkB,kBAAkB,MAAM,SAAS,GAAG,WAAW,KAAK,KAAK,UAAU,IAAI,CAAC,CAC7E,GACf;CAGF,IAAM,UAAU,KAAK,KAAK,UAAU,cAAc,GAG5C,EAAC,eAAe,MAAM,OAAO,cAFnB,cAAc,OACF,CAAC,CAAC,QAAQ,mBACuB,CAAC,CAAC,CAAC;CAIhE,OAAO,WAAW;EAAC,KAAK;EAAU;CAAO,CAAC;AAC5C"}
\ No newline at end of file