@sanity/plugin-kit
10.0.1210.0.13
−
Removed (12 files)
+
Added (12 files)
~
Modified (5 files)
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -2,21 +2,21 @@
import { n as sharedFlags_default, t as log_default } from "./log-2MbSIFbq.js";
import meow from "meow";
var cmds_default = {
init: async (options) => {
- await (await import("./init-WmxcDIkl.js")).default(options);
+ await (await import("./init-CmLzG_uP.js")).default(options);
},
inject: async (options) => {
- await (await import("./inject-DtLJw1DI.js")).default(options);
+ await (await import("./inject-upXvK5-e.js")).default(options);
},
"link-watch": async (options) => {
- await (await import("./link-watch-B71tX7Xt.js")).default(options);
+ await (await import("./link-watch-4lqfML3b.js")).default(options);
},
"verify-package": async (options) => {
await (await import("./verify-package-Cm62CGGp.js")).default(options);
},
version: async (options) => {
- (await import("./version-C7z02W2J.js")).default(options);
+ (await import("./version-CnH-PHou.js")).default(options);
}
};
/** @public */
async function cliEntry(argv = process.argv) { Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@sanity/plugin-kit",
- "version": "10.0.12",
+ "version": "10.0.13",
"description": "Enhanced Sanity.io plugin development experience",
"keywords": [
"bootstrap",
"development",
@@ -49,27 +49,27 @@
"validate-npm-package-name": "^8.0.0",
"yalc": "1.0.0-pre.53"
},
"devDependencies": {
- "@sanity/pkg-utils": "^12.3.4",
+ "@sanity/pkg-utils": "^13.0.9",
"@sanity/tsconfig": "^2.2.1",
- "@sanity/tsdown-config": "^0.27.1",
+ "@sanity/tsdown-config": "^0.28.8",
"@types/node": "^24.13.3",
"@types/react": "^19.3.0",
"@types/validate-npm-package-name": "^4.0.2",
- "oxfmt": "^0.71.0",
+ "oxfmt": "^0.72.0",
"oxlint": "^1.83.0",
"oxlint-tsgolint": "^7.0.2003",
"react": "^19.3.0",
"react-dom": "^19.3.0",
- "sanity": "^6.16.0",
+ "sanity": "^6.18.0",
"styled-components": "^6.5.3",
- "tsdown": "^0.22.14",
+ "tsdown": "^0.23.1",
"typescript": "7.0.2"
},
"peerDependencies": {
- "@sanity/pkg-utils": "^12.3.4",
- "oxfmt": "^0.71.0",
+ "@sanity/pkg-utils": "^13.0.9",
+ "oxfmt": "^0.72.0",
"oxlint": "^1.83.0"
},
"peerDependenciesMeta": {
"oxfmt": { Index: package/dist/index.d.ts.map
===================================================================
--- package/dist/index.d.ts.map
+++ package/dist/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":"AAQA;iBAAsB,SAAS,kBAAmB"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","names":[],"sources":["../src/cli.ts"],"mappings":"AAQA;wBAAsB,SAAS,kBAAmB"}
\ No newline at end of file Index: package/dist/package-8cUY5BVf.js.map
===================================================================
--- package/dist/package-8cUY5BVf.js.map
+++ package/dist/package-8cUY5BVf.js.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"package-8cUY5BVf.js","names":["URL","readFile","validatePackageName","validateNpmPackageName","readFile","validateNpmPackageName","\"build\"","\"watch\"","\"prepublishOnly\"","\"react\"","\"sanity\"","\"eslint\"","\"typescript\""],"sources":["../src/util/outdent.ts","../src/configs/banned-packages.ts","../src/util/github-url.ts","../src/util/prompt.ts","../src/util/files.ts","../src/actions/verify/validations.ts","../src/configs/forced-package-versions.ts","../src/npm/resolveLatestVersions.ts","../src/npm/package.ts"],"sourcesContent":["/**\n * Tagged-template helper that strips the common leading indentation from\n * multi-line strings (same semantics as the `outdent` package for the\n * patterns used in this package).\n */\nexport function outdent(strings: TemplateStringsArray, ...values: unknown[]): string {\n const match = strings[0].match(/(\\r\\n|\\r|\\n)([ \\t]*)(?:[^ \\t\\r\\n]|$)/)\n const indentationLevel = match ? match[2].length : 0\n // Only strip spaces/tabs — never consume non-whitespace from under-indented lines\n const reMatchIndent = new RegExp(`(\\\\r\\\\n|\\\\r|\\\\n)[ \\\\t]{0,${indentationLevel}}`, 'g')\n\n const outdented = strings.map((v, i) => {\n let s = v.replace(reMatchIndent, '$1')\n if (i === 0) {\n s = s.replace(/^[ \\t]*(?:\\r\\n|\\r|\\n)/, '')\n }\n if (i === strings.length - 1) {\n s = s.replace(/(?:\\r\\n|\\r|\\n)[ \\t]*$/, '')\n }\n return s\n })\n\n let result = ''\n for (let i = 0; i < outdented.length; i++) {\n result += outdented[i]\n if (i < values.length) {\n result += values[i]\n }\n }\n return result\n}\n","export const deprecatedDevDeps = [\n 'tsdx',\n 'sanipack',\n 'parcel',\n '@parcel/packager-ts',\n '@parcel/transformer-typescript-types',\n]\n","/**\n * Parse a GitHub remote URL (https, git+ssh, or scp-style) into user/repo.\n * Replaces the untyped `github-url-to-object` package.\n */\nexport function githubUrlToObject(url: string): {user: string; repo: string} | undefined {\n if (!url) {\n return undefined\n }\n\n const trimmed = url.trim()\n\n // [email protected]:user/repo(.git)\n const scp = trimmed.match(/^git@github\\.com:([^/]+)\\/(.+?)(?:\\.git)?$/i)\n if (scp) {\n return {user: scp[1], repo: scp[2]}\n }\n\n try {\n const normalized = trimmed\n .replace(/^git\\+/, '')\n .replace(/^ssh:\\/\\/git@github\\.com\\//i, 'https://github.com/')\n .replace(/^git:\\/\\/github\\.com\\//i, 'https://github.com/')\n const parsed = new URL(normalized)\n if (!/(^|\\.)github\\.com$/i.test(parsed.hostname)) {\n return undefined\n }\n const [, user, repoWithGit] = parsed.pathname.split('/')\n if (!user || !repoWithGit) {\n return undefined\n }\n return {user, repo: repoWithGit.replace(/\\.git$/i, '')}\n } catch {\n return undefined\n }\n}\n","import path from 'path'\nimport {URL} from 'url'\n\nimport inquirer, {type Question} from 'inquirer'\nimport validNpmName from 'validate-npm-package-name'\n\nimport type {InjectOptions} from '../actions/inject'\nimport {githubUrlToObject} from './github-url'\n\ninterface PromptOptions {\n choices?: any\n type?: string\n default?: any\n filter?: (val: any) => any\n validate?: (val: any) => boolean | string\n}\n\nexport async function prompt(message: string, options: PromptOptions) {\n const type = options.choices ? 'select' : (options.type ?? 'input')\n const question: Question & Pick<PromptOptions, 'validate'> = {\n ...options,\n type,\n message,\n name: 'single',\n }\n const {filter, validate} = options\n if (validate) {\n // Classic inquirer ran `validate` on the filtered value; the modern rewrite applies\n // `filter` only after the prompt resolves, so restore the original semantics here\n // (all filters used with `prompt` are idempotent)\n question.validate = (value: any) => validate(filter ? filter(value) : value)\n }\n const result = await inquirer.prompt([question])\n return result && result.single\n}\n\nprompt.separator = () => new inquirer.Separator()\n\nexport function promptForPackageName({basePath}: InjectOptions, defaultVal?: string) {\n return prompt('Plugin name (sanity-plugin-...)', {\n default: defaultVal || path.basename(basePath),\n filter: (name) => {\n const prefixless = name.trim().replace(/^sanity-plugin-/, '')\n return name[0] === '@' ? name : `sanity-plugin-${prefixless}`\n },\n validate: (name) => {\n const valid: {errors?: string[]} = validNpmName(name)\n if (valid.errors) {\n return valid.errors[0]\n }\n\n if (name[0] !== '@' && name.endsWith('plugin')) {\n return `Name shouldn't include \"plugin\" multiple times (${name})`\n }\n\n return true\n },\n })\n}\n\nexport function promptForRepoOrigin(_options: InjectOptions, defaultVal?: string) {\n return prompt('Git repository URL', {\n default: defaultVal,\n filter: (raw) => {\n const url = (raw || '').trim()\n const gh = githubUrlToObject(url)\n return gh ? `git+ssh://[email protected]/${gh.user}/${gh.repo}.git` : url\n },\n validate: (url) => {\n if (!url) {\n return true\n }\n\n try {\n const parsed = new URL(url)\n return parsed ? true : 'Invalid URL'\n } catch {\n return 'Invalid URL'\n }\n },\n })\n}\n","import crypto from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport util from 'util'\n\nimport type {InitFlags} from '../actions/init'\nimport {prompt} from './prompt'\n\nconst stat = util.promisify(fs.stat)\nexport const mkdir = util.promisify(fs.mkdir)\nconst readdir = util.promisify(fs.readdir)\nconst copyFile = util.promisify(fs.copyFile)\nexport const readFile = util.promisify(fs.readFile)\nexport const writeFile = util.promisify(fs.writeFile)\n\nexport function fileExists(filePath: string) {\n return stat(filePath)\n .then(() => true)\n .catch(() => false)\n}\n\nexport async function readJsonFile<T>(filePath: string) {\n const content = await readFile(filePath, 'utf8')\n return JSON.parse(content) as T\n}\n\nexport function writeJsonFile(filePath: string, content: Record<string, unknown>) {\n const data = JSON.stringify(content, null, 2) + '\\n'\n return writeFile(filePath, data, {encoding: 'utf8'})\n}\n\nexport async function writeFileWithOverwritePrompt(\n filePath: string,\n content: string,\n options: {default?: any; force?: boolean} & fs.ObjectEncodingOptions,\n) {\n const {default: defaultVal, force = false, ...writeOptions} = options\n const withinCwd = filePath.startsWith(process.cwd())\n const printablePath = withinCwd ? path.relative(process.cwd(), filePath) : filePath\n\n if (await fileEqualsData(filePath, content)) {\n return false\n }\n\n if (\n !force &&\n (await fileExists(filePath)) &&\n !(await prompt(`File \"${printablePath}\" already exists. Overwrite?`, {\n type: 'confirm',\n default: defaultVal,\n }))\n ) {\n return false\n }\n\n await writeFile(filePath, content, writeOptions)\n return true\n}\n\nexport async function copyFileWithOverwritePrompt(from: string, to: string, flags: InitFlags) {\n const withinCwd = to.startsWith(process.cwd())\n const printablePath = withinCwd ? path.relative(process.cwd(), to) : to\n\n if (await filesAreEqual(from, to)) {\n return false\n }\n\n await ensureDirectoryExists(to)\n\n if (\n !flags.force &&\n (await fileExists(to)) &&\n !(await prompt(`File \"${printablePath}\" already exists. Overwrite?`, {\n type: 'confirm',\n default: false,\n }))\n ) {\n return false\n }\n\n await copyFile(from, to)\n return true\n}\n\nasync function ensureDirectoryExists(filePath: string): Promise<void> {\n const dirname = path.dirname(filePath)\n if (await fileExists(dirname)) {\n return\n }\n await ensureDirectoryExists(dirname)\n await mkdir(dirname)\n}\n\nasync function fileEqualsData(filePath: string, content: string) {\n const contentHash = crypto.createHash('sha1').update(content).digest('hex')\n const remoteHash = await getFileHash(filePath)\n return contentHash === remoteHash\n}\n\nasync function filesAreEqual(file1: string, file2: string) {\n const [hash1, hash2] = await Promise.all([getFileHash(file1, false), getFileHash(file2)])\n return hash1 === hash2\n}\n\nfunction getFileHash(filePath: string, allowMissing = true) {\n return new Promise((resolve, reject) => {\n const hash = crypto.createHash('sha1')\n const stream = fs.createReadStream(filePath)\n stream.on('error', (err) => {\n if ((err as {code?: string}).code === 'ENOENT' && allowMissing) {\n resolve(null)\n } else {\n reject(err)\n }\n })\n\n stream.on('end', () => resolve(hash.digest('hex')))\n stream.on('data', (chunk) => hash.update(chunk))\n })\n}\n\nexport async function ensureDir(dirPath: string) {\n try {\n await mkdir(dirPath)\n } catch (err) {\n if ((err as {code?: string}).code !== 'EEXIST') {\n throw err\n }\n }\n}\n\nexport async function isEmptyish(dirPath: string) {\n const ignoredFiles = ['.git', '.gitignore', 'license', 'readme.md']\n const allFiles = await readdir(dirPath).catch(() => [])\n const files = allFiles.filter((file) => !ignoredFiles.includes(file.toLowerCase()))\n return files.length === 0\n}\n","import {createRequire} from 'node:module'\nimport path from 'path'\n\nimport type {ParsedCommandLine} from '@typescript/typescript6'\nimport validateNpmPackageName from 'validate-npm-package-name'\n\nimport {deprecatedDevDeps} from '../../configs/banned-packages'\nimport {minPkgUtilsMajor, requiredNodeEngine} from '../../constants'\nimport {fileExists, readFile, readJsonFile} from '../../util/files'\nimport {outdent} from '../../util/outdent'\nimport type {PackageJson} from './types'\n\nexport const expectedScripts = {\n 'build': 'plugin-kit verify-package --silent && pkg-utils build --strict --check --clean',\n 'watch': 'pkg-utils watch --strict',\n 'link-watch': 'plugin-kit link-watch',\n 'prepublishOnly': 'npm run build',\n}\n\nfunction filesWithSuffixes(fileBases: string[], suffixes: string[]): string[] {\n return fileBases.flatMap((file) => suffixes.map((suffix) => `${file}.${suffix}`))\n}\n\nexport function validateNodeEngine(packageJson: PackageJson) {\n if (packageJson.engines?.node !== requiredNodeEngine) {\n return [\n outdent`\n Expected package.json to contain engines.node: \"${requiredNodeEngine}\" to match @sanity/pkg-utils,\n but it was: ${packageJson.engines?.node}\n\n Please add the following to package.json:\n\n \"engines\": {\n \"node\": \"${requiredNodeEngine}\"\n }`.trimStart(),\n ]\n }\n return []\n}\n\nexport function validateScripts(packageJson: PackageJson): string[] {\n const errors: string[] = []\n\n const divergentScripts = Object.entries(expectedScripts).filter(([key, expectedCommand]) => {\n const command = packageJson.scripts?.[key]\n // check for includes instead of equals to give some leniency in command params and such\n return !command || !command.includes(expectedCommand)\n })\n\n if (divergentScripts.length) {\n errors.push(\n outdent`\n The following script commands did not contain expected defaults: ${divergentScripts\n .map(([key]) => key)\n .join(', ')}\n\n This checks for that the commands-strings includes these terms.\n\n Please add the following to your package.json \"scripts\":\n\n ${divergentScripts.map(([key, value]) => `\"${key}\": \"${value}\"`).join(',\\n')}\n `.trimStart(),\n )\n }\n return errors\n}\n\nexport async function validateTsConfig(\n ts: ParsedCommandLine,\n options: {basePath: string; outDir: string; tsconfig: string},\n) {\n const {basePath, outDir, tsconfig} = options\n\n const errors: string[] = []\n\n const expectedCompilerOptions = {\n target: 'esnext',\n jsx: 'preserve',\n module: 'preserve',\n rootDir: '.',\n outDir,\n noEmit: true,\n }\n\n const wrongEntries = Object.entries(expectedCompilerOptions).filter(([key, value]) => {\n let option: any = ts.options[key]\n\n if (key === 'rootDir' && typeof option === 'string') {\n option = path.relative(basePath, option) || '.'\n }\n\n if (key === 'outDir' && typeof option === 'string') {\n option = path.relative(basePath, option) || '.'\n }\n\n if (key === 'target' && option === 99) {\n option = 'esnext'\n }\n\n if (key === 'module' && option === 200) {\n option = 'preserve'\n }\n\n if (key === 'jsx' && option === 1) {\n option = 'preserve'\n }\n\n return typeof value === 'string' && typeof option === 'string'\n ? value.toLowerCase() !== option?.toLowerCase()\n : value !== option\n })\n\n if (wrongEntries.length) {\n const expectedOutput = wrongEntries\n .map(([key, value]) => `\"${key}\": ${typeof value === 'string' ? `\"${value}\"` : value},`)\n .join('\\n')\n\n errors.push(\n outdent`\n Recommended ${tsconfig} compilerOptions missing:\n\n The following fields had unexpected values: [${wrongEntries.map(([key]) => key).join(', ')}]\n Expected to find these values:\n ${expectedOutput}\n\n Please update your ${tsconfig} accordingly.\n `.trimStart(),\n )\n }\n\n return errors\n}\n\n/**\n * Hard requirement: plugins must be ESM (`\"type\": \"module\"`).\n *\n * plugin-kit loads `package.config.ts` through `@sanity/pkg-utils`, which can only load ESM\n * TypeScript configs reliably when the plugin itself is ESM. CommonJS (or an omitted `type`)\n * is not supported and cannot be opted out of.\n */\nexport function validatePackageType({type}: PackageJson): string[] {\n if (type === 'module') {\n return []\n }\n\n return [\n outdent`\n package.json must set \"type\": \"module\" — plugins built with @sanity/plugin-kit are ESM-only.\n Found: ${type ? `\"type\": \"${type}\"` : 'no \"type\" field (defaults to \"commonjs\")'}\n\n Please add the following to package.json:\n\n \"type\": \"module\"\n `.trimStart(),\n ]\n}\n\n/**\n * Recursively collects the locations of any `require` condition within a package.json `exports`\n * field. Conditions can be nested arbitrarily deep (and inside fallback arrays), so we walk the\n * whole tree rather than only inspecting the first level.\n *\n * Subpath keys always start with `.` (e.g. `\"./feature\"`), while condition keys never do, so an\n * exact `require` key is unambiguously a CommonJS export condition.\n */\nfunction findRequireConditions(node: unknown, pathSegments: string[]): string[] {\n if (Array.isArray(node)) {\n return node.flatMap((entry, index) =>\n findRequireConditions(entry, [...pathSegments, String(index)]),\n )\n }\n\n if (!node || typeof node !== 'object') {\n return []\n }\n\n const found: string[] = []\n for (const [key, value] of Object.entries(node)) {\n if (key === 'require') {\n found.push(formatExportsPath(pathSegments))\n }\n found.push(...findRequireConditions(value, [...pathSegments, key]))\n }\n return found\n}\n\nfunction formatExportsPath(segments: string[]): string {\n return `exports${segments.map((segment) => `[${JSON.stringify(segment)}]`).join('')}`\n}\n\n/**\n * Bans CommonJS interop in package.json. The plugin baseline is Sanity Studio v5 or later, which is\n * pure ESM, so there is no reason to publish a parallel CJS build anymore. This flags:\n *\n * - `require` export conditions\n * - the top-level `main` field\n * - the top-level `module` field\n */\nexport function validateEsmOnly(packageJson: PackageJson): string[] {\n const offenders: string[] = []\n\n if (typeof packageJson.main !== 'undefined') {\n offenders.push(`- the top-level \"main\" field (${JSON.stringify(packageJson.main)})`)\n }\n\n if (typeof packageJson.module !== 'undefined') {\n offenders.push(`- the top-level \"module\" field (${JSON.stringify(packageJson.module)})`)\n }\n\n const requireConditions = [...new Set(findRequireConditions(packageJson.exports, []))]\n for (const conditionPath of requireConditions) {\n offenders.push(`- a \"require\" export condition at ${conditionPath}`)\n }\n\n if (!offenders.length) {\n return []\n }\n\n return [\n outdent`\n package.json ships CommonJS (CJS) output, but Sanity plugins target Sanity Studio v5+, which is pure ESM.\n\n Remove the following so the package stays ESM-only:\n ${offenders.join('\\n')}\n\n Supporting CJS is not worth it:\n - It can have unintended side-effects.\n - The Node.js versions plugin-kit supports (${requiredNodeEngine}) fully support require(esm), so a\n consumer that still uses require() loads the ESM build directly — which is far more predictable.\n - Publishing a single format guarantees two copies of the plugin's code (ESM + CJS) can't both end up\n in the module tree, bloating bundles and slowing down builds.\n\n Rely on \"exports\" together with \"type\": \"module\", and drop \"main\", \"module\" and any \"require\" conditions.\n `.trimStart(),\n ]\n}\n\nexport function validatePkgUtilsDependency({devDependencies}: PackageJson): string[] {\n if (!devDependencies?.['@sanity/pkg-utils']) {\n return [\n outdent`\n package.json does not list @sanity/pkg-utils as a devDependency.\n @sanity/pkg-utils replaced parcel as the recommended build tool in @sanity/plugin-kit 2.0.0\n\n Please add it by running 'npm install --save-dev @sanity/pkg-utils'.\n `.trimStart(),\n ]\n }\n return []\n}\n\n/**\n * Verifies that the installed `@sanity/pkg-utils` (the peer dependency plugin-kit loads\n * `package.config.ts` with) is recent enough to expose the `loadConfig({cwd, pkgPath})` API.\n */\nexport function validatePkgUtilsVersion({basePath}: {basePath: string}): string[] {\n const require = createRequire(path.join(basePath, 'package.json'))\n\n let installedVersion: string | undefined\n try {\n const pkgUtilsManifest = require('@sanity/pkg-utils/package.json') as {version?: string}\n installedVersion = pkgUtilsManifest.version\n } catch {\n return [\n outdent`\n @sanity/pkg-utils is not installed.\n plugin-kit loads package.config.ts through @sanity/pkg-utils (a peer dependency).\n\n Please install it by running 'npm install --save-dev @sanity/pkg-utils'.\n `.trimStart(),\n ]\n }\n\n const major = Number.parseInt(installedVersion?.split('.')[0] ?? '', 10)\n if (!Number.isFinite(major) || major < minPkgUtilsMajor) {\n return [\n outdent`\n @sanity/pkg-utils ${installedVersion} is too old.\n plugin-kit requires @sanity/pkg-utils >=${minPkgUtilsMajor} to load package.config.ts.\n\n Please upgrade it by running 'npm install --save-dev @sanity/pkg-utils@latest'.\n `.trimStart(),\n ]\n }\n\n return []\n}\n\nexport function validateDeprecatedDependencies(packageJson: PackageJson): string[] {\n const {dependencies, devDependencies, peerDependencies} = packageJson\n const allDependencies = {...dependencies, ...devDependencies, ...peerDependencies}\n\n const illegalDeps = Object.keys(allDependencies).filter((dep) => deprecatedDevDeps.includes(dep))\n const deps = new Set<string>(illegalDeps)\n const unique = [...deps.values()]\n if (unique.length) {\n return [\n outdent`\n package.json contains deprecated dependencies that should be removed:\n - ${unique.join('\\n- ')}\n `.trimStart(),\n ]\n }\n\n return []\n}\n\nexport async function validateBabelConfig({basePath}: {basePath: string}) {\n const suffixes = ['json', 'js', 'cjs', 'mjs']\n const babelFileNames = ['.babelrc', 'babel.config']\n const filenames = ['.babelrc', ...filesWithSuffixes(babelFileNames, suffixes)]\n\n const babelFiles: string[] = []\n for (const filename of filenames) {\n const filepath = path.normalize(path.join(basePath, filename))\n if (await fileExists(filepath)) {\n babelFiles.push(filename)\n }\n }\n\n if (babelFiles.length) {\n return [\n outdent`\n Found babel-config file: [${babelFiles.join(\n ', ',\n )}]. When using default @sanity/plugin-kit build command,\n this is probably not needed.\n\n Delete the file, or disable this check.\n `.trimStart(),\n ]\n }\n return []\n}\n\nexport function validatePackageName(packageJson: PackageJson) {\n const valid = validateNpmPackageName(packageJson.name ?? '')\n if (!valid.validForNewPackages) {\n const messages = valid.errors ?? valid.warnings ?? []\n return [`Invalid package.json: \"name\" is invalid: ${messages.join(', ')}`]\n }\n\n const isScoped = packageJson.name?.startsWith('@')\n if (!isScoped && !packageJson.name?.startsWith('sanity-plugin-')) {\n return [\n `Invalid package.json: \"name\" should be prefixed with \"sanity-plugin-\" (or scoped - @your-company/plugin-name)`,\n ]\n }\n return []\n}\n\n/**\n * Plugins built with @sanity/plugin-kit publish the compiled output (the `dist` directory).\n * The `src` directory should not be published: it bloats the package and can cause bundlers that\n * resolve the `source` export condition to pull in raw, uncompiled TypeScript.\n */\nexport function validateBannedFiles(packageJson: PackageJson): string[] {\n const {files} = packageJson\n if (!Array.isArray(files)) {\n return []\n }\n\n const hasSrc = files.some((entry) => {\n if (typeof entry !== 'string') {\n return false\n }\n // Normalize entries like \"./src\", \"src/\", \"/src\" before comparing.\n const normalized = entry\n .trim()\n .replace(/^\\.?\\/+/, '')\n .replace(/\\/+$/, '')\n return normalized === 'src'\n })\n\n if (!hasSrc) {\n return []\n }\n\n return [\n outdent`\n package.json \"files\" must not include \"src\".\n\n Plugins built with @sanity/plugin-kit publish the compiled output in \"dist\".\n Shipping the \"src\" directory bloats the published package and can cause bundlers that resolve the\n \"source\" export condition to import raw, uncompiled TypeScript.\n\n Please remove \"src\" from the \"files\" array in package.json.\n `.trimStart(),\n ]\n}\n\nexport async function validateSrcIndexFile(basePath: string) {\n const paths = ['index.js', 'index.ts'].map((p) => path.join('src', p))\n const allowedIndexFiles = paths.map((file) => path.join(basePath, file))\n\n let hasIndex = false\n for (const indexFile of allowedIndexFiles) {\n hasIndex = hasIndex || (await fileExists(indexFile))\n }\n if (!hasIndex) {\n return [\n outdent`\n Expected one of [${paths.join(', ')}] to exist.\n\n @sanity/pkg-utils expects a non-jsx file to be the source entry-point for the plugin.\n If you currently have JSX in your index file, extract it into a separate file and import it.\n `,\n ]\n }\n\n return []\n}\n\n/**\n * Config filenames oxfmt discovers automatically (in addition to explicit `-c` paths).\n */\nconst oxfmtConfigFiles = [\n 'oxfmt.config.ts',\n 'oxfmt.config.js',\n 'oxfmt.config.mjs',\n '.oxfmtrc.json',\n '.oxfmtrc.jsonc',\n]\n\nconst legacyPrettierConfigFiles = [\n '.prettierrc',\n '.prettierrc.json5',\n '.prettierrc.json',\n '.prettierrc.yaml',\n '.prettierrc.yml',\n '.prettierrc.js',\n '.prettierrc.cjs',\n '.prettierrc.mjs',\n '.prettierrc.toml',\n 'prettier.config.js',\n 'prettier.config.cjs',\n 'prettier.config.mjs',\n]\n\nconst oxfmtPresetSpecifier = '@sanity/plugin-kit/oxfmt'\n\nconst oxfmtSetupSnippet = outdent`\n export {default} from '${oxfmtPresetSpecifier}'\n`\n\n/**\n * Walks up from `basePath` (inclusive) looking for a workspace (monorepo) root: a directory\n * containing `pnpm-workspace.yaml`, or a `package.json` with a `workspaces` field.\n */\nasync function findWorkspaceRoot(basePath: string): Promise<string | undefined> {\n let dir = path.resolve(basePath)\n let prev: string | undefined\n while (dir !== prev) {\n if (await isWorkspaceRoot(dir)) {\n return dir\n }\n prev = dir\n dir = path.dirname(dir)\n }\n return undefined\n}\n\nasync function isWorkspaceRoot(dir: string): Promise<boolean> {\n if (await fileExists(path.join(dir, 'pnpm-workspace.yaml'))) {\n return true\n }\n const pkgPath = path.join(dir, 'package.json')\n if (await fileExists(pkgPath)) {\n try {\n const pkg = await readJsonFile<PackageJson>(pkgPath)\n return Boolean(pkg && typeof pkg === 'object' && pkg.workspaces)\n } catch {\n // an unparseable package.json is not a workspace root marker\n }\n }\n return false\n}\n\n/**\n * Finds leftover config files from a replaced tool, both next to the plugin's package.json and\n * (in a monorepo) at the workspace root, where the replacement config is expected to live.\n */\nasync function findLegacyConfigFiles(\n basePath: string,\n workspaceRoot: string | undefined,\n files: string[],\n): Promise<string[]> {\n const found: string[] = []\n for (const file of files) {\n if (await fileExists(path.join(basePath, file))) {\n found.push(file)\n }\n }\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n for (const file of files) {\n if (await fileExists(path.join(workspaceRoot, file))) {\n found.push(`${file} (in the workspace root)`)\n }\n }\n }\n return found\n}\n\n/**\n * Finds a leftover config key from a replaced tool in the plugin's package.json and (in a\n * monorepo) the workspace root package.json, where such keys used to configure the whole\n * workspace.\n */\nasync function findLegacyPackageJsonKey(\n pkgJson: PackageJson,\n basePath: string,\n workspaceRoot: string | undefined,\n key: string,\n): Promise<string[]> {\n const found: string[] = []\n if (pkgJson[key]) {\n found.push(`package.json (\"${key}\" key)`)\n }\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const rootPkgPath = path.join(workspaceRoot, 'package.json')\n if (await fileExists(rootPkgPath)) {\n try {\n const rootPkg = await readJsonFile<PackageJson>(rootPkgPath)\n if (rootPkg && typeof rootPkg === 'object' && rootPkg[key]) {\n found.push(`package.json (\"${key}\" key, in the workspace root)`)\n }\n } catch {\n // an unparseable root package.json is not this check's concern\n }\n }\n }\n return found\n}\n\ntype ConfigDirResult = {ok: true} | {ok: false; found: boolean; error: string}\n\nasync function checkOxfmtConfigDir(dir: string, describeDir: string): Promise<ConfigDirResult> {\n const found: string[] = []\n for (const file of oxfmtConfigFiles) {\n if (await fileExists(path.join(dir, file))) {\n found.push(file)\n }\n }\n\n if (found.length === 0) {\n return {\n ok: false,\n found: false,\n error: outdent`\n Could not find an oxfmt config file ${describeDir}.\n\n plugin-kit ships a shared oxfmt preset. Create an oxfmt.config.ts there containing:\n\n ${oxfmtSetupSnippet}\n `,\n }\n }\n\n if (found.length > 1) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found multiple oxfmt config files ${describeDir}: [${found.join(', ')}].\n\n There should be at most one of these files. Delete the rest.\n `,\n }\n }\n\n const file = found[0]\n if (file.startsWith('.oxfmtrc')) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but JSON configs cannot reuse the shared plugin-kit preset.\n\n Replace it with an oxfmt.config.ts containing:\n\n ${oxfmtSetupSnippet}\n `,\n }\n }\n\n const content = await readFile(path.join(dir, file), 'utf8')\n if (!content.includes(oxfmtPresetSpecifier)) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but it does not use the shared plugin-kit preset (${oxfmtPresetSpecifier}).\n\n Re-export the preset:\n\n ${oxfmtSetupSnippet}\n\n or spread it into your own config to customize options.\n `,\n }\n }\n\n return {ok: true}\n}\n\n/**\n * Verifies the plugin is formatted with oxfmt using the shared plugin-kit preset, and that no\n * legacy prettier configuration remains.\n *\n * In a monorepo (a workspace root is found above the plugin), the oxfmt config is expected at the\n * workspace root; otherwise it should sit next to the package.json that installs and runs\n * plugin-kit. Since oxfmt discovers nested configs, a config next to package.json overrides the\n * workspace root config for this package — so in a monorepo the local config is validated when it\n * exists, and the workspace root config otherwise.\n */\nexport async function validateOxfmtConfig(\n basePath: string,\n pkgJson: PackageJson,\n): Promise<string[]> {\n const errors: string[] = []\n const workspaceRoot = await findWorkspaceRoot(basePath)\n\n const legacyFound = await findLegacyConfigFiles(\n basePath,\n workspaceRoot,\n legacyPrettierConfigFiles,\n )\n legacyFound.push(\n ...(await findLegacyPackageJsonKey(pkgJson, basePath, workspaceRoot, 'prettier')),\n )\n if (legacyFound.length) {\n errors.push(\n outdent`\n Found legacy prettier configuration: [${legacyFound.join(', ')}].\n\n plugin-kit has replaced prettier with oxfmt. Remove the prettier config (custom options can\n be migrated with \\`npx oxfmt --migrate=prettier\\`), drop the prettier, prettier-plugin-packagejson\n and eslint-plugin-prettier devDependencies, and format with oxfmt instead:\n\n ${oxfmtSetupSnippet}\n `,\n )\n }\n const primaryDir = workspaceRoot ?? basePath\n const primaryResult = await checkOxfmtConfigDir(\n primaryDir,\n workspaceRoot ? `in the workspace root (${workspaceRoot})` : 'next to package.json',\n )\n\n // In a monorepo, oxfmt discovers nested configs: a config next to the plugin's package.json\n // overrides the workspace root config for this package's files, so when one exists it is the\n // config that must use the shared preset.\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const localResult = await checkOxfmtConfigDir(basePath, 'next to package.json')\n if (localResult.ok) {\n return errors\n }\n if (localResult.found) {\n errors.push(\n primaryResult.ok\n ? outdent`\n ${localResult.error}\n\n Note: this config overrides the workspace root config (${primaryDir}) for this\n package's files, since oxfmt discovers nested configs. Either make it use the shared\n preset, or delete it to fall back to the workspace root config.\n `\n : localResult.error,\n )\n return errors\n }\n }\n\n if (primaryResult.ok) {\n return errors\n }\n\n errors.push(primaryResult.error)\n return errors\n}\n\n/**\n * Config filenames oxlint discovers automatically (in addition to explicit `-c` paths).\n */\nconst oxlintConfigFiles = ['oxlint.config.ts', '.oxlintrc.json', '.oxlintrc.jsonc']\n\nconst legacyEslintConfigFiles = [\n '.eslintrc',\n '.eslintrc.js',\n '.eslintrc.cjs',\n '.eslintrc.yaml',\n '.eslintrc.yml',\n '.eslintrc.json',\n '.eslintignore',\n 'eslint.config.js',\n 'eslint.config.mjs',\n 'eslint.config.cjs',\n 'eslint.config.ts',\n 'eslint.config.mts',\n 'eslint.config.cts',\n]\n\nconst oxlintSharedConfig = '@sanity/plugin-kit/oxlint'\n\nconst oxlintSetupSnippet = outdent`\n export {default} from '${oxlintSharedConfig}'\n`\n\nasync function checkOxlintConfigDir(dir: string, describeDir: string): Promise<ConfigDirResult> {\n const found: string[] = []\n for (const file of oxlintConfigFiles) {\n if (await fileExists(path.join(dir, file))) {\n found.push(file)\n }\n }\n\n if (found.length === 0) {\n return {\n ok: false,\n found: false,\n error: outdent`\n Could not find an oxlint config file ${describeDir}.\n\n plugin-kit ships a shared oxlint config (type-aware rules, type checking and no warnings).\n Create an oxlint.config.ts there containing:\n\n ${oxlintSetupSnippet}\n `,\n }\n }\n\n if (found.length > 1) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found multiple oxlint config files ${describeDir}: [${found.join(', ')}].\n\n There should be at most one of these files. Delete the rest.\n `,\n }\n }\n\n const file = found[0]\n if (file.startsWith('.oxlintrc')) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but JSON configs cannot reuse the shared plugin-kit config\n (package imports are only supported in oxlint.config.ts).\n\n Replace it with an oxlint.config.ts containing:\n\n ${oxlintSetupSnippet}\n `,\n }\n }\n\n const content = await readFile(path.join(dir, file), 'utf8')\n if (!content.includes(oxlintSharedConfig)) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but it does not use the shared plugin-kit config (${oxlintSharedConfig}).\n\n Re-export the shared config:\n\n ${oxlintSetupSnippet}\n\n or extend it with your own options:\n\n import sanityPluginKitOxlint from '${oxlintSharedConfig}'\n import {defineConfig} from 'oxlint'\n\n export default defineConfig({\n extends: [sanityPluginKitOxlint],\n })\n `,\n }\n }\n\n return {ok: true}\n}\n\n/**\n * Verifies the plugin lints with oxlint using the shared plugin-kit config, and that no legacy\n * eslint configuration remains.\n *\n * In a monorepo (a workspace root is found above the plugin), the oxlint config is expected at the\n * workspace root; otherwise it should sit next to the package.json that installs and runs\n * plugin-kit. Since oxlint discovers nested configs, a config next to package.json overrides the\n * workspace root config for this package — so in a monorepo the local config is validated when it\n * exists, and the workspace root config otherwise.\n */\nexport async function validateOxlintConfig(\n basePath: string,\n pkgJson: PackageJson,\n): Promise<string[]> {\n const errors: string[] = []\n const workspaceRoot = await findWorkspaceRoot(basePath)\n\n const legacyFound = await findLegacyConfigFiles(basePath, workspaceRoot, legacyEslintConfigFiles)\n legacyFound.push(\n ...(await findLegacyPackageJsonKey(pkgJson, basePath, workspaceRoot, 'eslintConfig')),\n )\n if (legacyFound.length) {\n errors.push(\n outdent`\n Found legacy eslint configuration: [${legacyFound.join(', ')}].\n\n plugin-kit has replaced eslint with oxlint. Remove the eslint config files and the eslint\n devDependencies (eslint, eslint-config-*, eslint-plugin-*, @typescript-eslint/*), and lint\n with oxlint instead, via an oxlint.config.ts containing:\n\n ${oxlintSetupSnippet}\n `,\n )\n }\n const primaryDir = workspaceRoot ?? basePath\n const primaryResult = await checkOxlintConfigDir(\n primaryDir,\n workspaceRoot ? `in the workspace root (${workspaceRoot})` : 'next to package.json',\n )\n\n // In a monorepo, oxlint discovers nested configs: a config next to the plugin's package.json\n // overrides the workspace root config for this package's files, so when one exists it is the\n // config that must use the shared config.\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const localResult = await checkOxlintConfigDir(basePath, 'next to package.json')\n if (localResult.ok) {\n return errors\n }\n if (localResult.found) {\n errors.push(\n primaryResult.ok\n ? outdent`\n ${localResult.error}\n\n Note: this config overrides the workspace root config (${primaryDir}) for this\n package's files, since oxlint discovers nested configs. Either make it use the shared\n config, or delete it to fall back to the workspace root config.\n `\n : localResult.error,\n )\n return errors\n }\n }\n\n if (primaryResult.ok) {\n return errors\n }\n\n errors.push(primaryResult.error)\n return errors\n}\n","export const forcedPackageVersions = {}\n\nexport const forcedDevPackageVersions = {}\n\nexport const forcedPeerPackageVersions = {\n 'react': '^18',\n 'react-dom': '^18',\n '@types/react': '^18',\n '@types/react-dom': '^18',\n 'sanity': '^5 || ^6.0.0-0',\n 'styled-components': '^5.2',\n}\n","import {getLatestVersion} from 'get-latest-version'\n\n// We may want to lock certain dependencies to specific versions\nconst lockedDependencies: Record<string, string> = {\n 'styled-components': '^6.1',\n 'eslint': '^8.57.0',\n // The scaffolded ESLint toolchain (@typescript-eslint v8) requires the classic JS compiler API,\n // which TypeScript 7 (the Go-native compiler) no longer ships. Unlock once typescript-eslint\n // supports TypeScript 7.\n 'typescript': '^6',\n}\n\nexport async function resolveLatestVersions(packages: string[]) {\n const versions: Record<string, string> = {}\n for (const pkgName of packages) {\n versions[pkgName] = pkgName in lockedDependencies ? lockedDependencies[pkgName] : 'latest'\n }\n\n const entries = await Promise.all(\n Object.entries(versions).map(async ([pkgName, range]) => {\n const version = await getLatestVersion(pkgName, {range})\n if (!version) {\n throw new Error(`Found no version for ${pkgName}`)\n }\n return [pkgName, rangeify(version)] as const\n }),\n )\n\n return Object.fromEntries(entries)\n}\n\nfunction rangeify(version: string) {\n return `^${version}`\n}\n","import fs from 'fs'\nimport path from 'path'\nimport util from 'util'\n\nimport validateNpmPackageName from 'validate-npm-package-name'\n\nimport type {InjectOptions, PackageData} from '../actions/inject'\nimport type {PackageJson, SanityPlugin} from '../actions/verify/types'\nimport {expectedScripts} from '../actions/verify/validations'\nimport {\n forcedDevPackageVersions,\n forcedPackageVersions,\n forcedPeerPackageVersions,\n} from '../configs/forced-package-versions'\nimport {cliName, requiredNodeEngine} from '../constants'\nimport {writeJsonFile} from '../util/files'\nimport {githubUrlToObject} from '../util/github-url'\nimport log from '../util/log'\nimport {resolveLatestVersions} from './resolveLatestVersions'\n\nexport interface GetPackageOptions {\n basePath: string\n validate?: boolean\n isPlugin?: boolean\n}\n\nconst defaultDependencies: string[] = []\n\nconst defaultDevDependencies = [\n 'sanity',\n\n // peer dependencies of `sanity`\n 'react',\n 'react-dom',\n 'styled-components',\n]\n\nconst defaultPeerDependencies = ['react', 'sanity']\n\nconst readFile = util.promisify(fs.readFile)\n\nexport async function getPackage(opts: GetPackageOptions): Promise<PackageJson> {\n validateOptions(opts)\n\n const {basePath, validate = true} = opts\n const manifestPath = path.normalize(path.join(basePath, 'package.json'))\n\n let content\n try {\n content = await readFile(manifestPath, 'utf8')\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n throw new Error(\n `No package.json found. package.json is required to publish to npm. Use \\`${cliName} init\\` for a new plugin, or \\`npm init\\` for an existing one`,\n )\n }\n\n throw new Error(`Failed to read \"${manifestPath}\": ${err.message}`)\n }\n\n let parsed\n try {\n parsed = JSON.parse(content)\n } catch (err: any) {\n throw new Error(`Error parsing \"${manifestPath}\": ${err.message}`)\n }\n\n if (!isObject(parsed)) {\n throw new Error(`Invalid package.json: Root must be an object`)\n }\n\n if (validate) {\n validatePackage(parsed, opts)\n }\n\n return parsed\n}\n\nfunction validatePackage(manifest: PackageJson, opts: GetPackageOptions) {\n validateOptions(opts)\n\n const options = {isPlugin: true, ...opts}\n\n if (options.isPlugin) {\n validatePackageName(manifest)\n }\n\n validateLockFiles(options)\n}\n\nfunction validateOptions(opts: {basePath: string}) {\n const options = opts || {}\n if (!isObject(options)) {\n throw new Error(`Options must be an object`)\n }\n\n if (typeof options.basePath !== 'string') {\n throw new Error(`\"options.basePath\" must be a string (path to plugin base path)`)\n }\n}\n\nfunction validatePackageName(manifest: PackageJson) {\n if (typeof manifest.name !== 'string') {\n throw new Error(`Invalid package.json: \"name\" must be a string`)\n }\n\n const valid = validateNpmPackageName(manifest.name)\n if (!valid.validForNewPackages) {\n throw new Error(`Invalid package.json: \"name\" is invalid: ${(valid.errors ?? []).join(', ')}`)\n }\n\n const isScoped = manifest.name[0] === '@'\n if (!isScoped && !manifest.name.startsWith('sanity-plugin-')) {\n throw new Error(\n `Invalid package.json: \"name\" should be prefixed with \"sanity-plugin-\" (or scoped - @your-company/plugin-name)`,\n )\n }\n}\n\nfunction isObject(obj: unknown): obj is Record<string, unknown> {\n return !Array.isArray(obj) && obj !== null && typeof obj === 'object'\n}\n\nfunction validateLockFiles(options: {basePath: string}) {\n const npm = fs.existsSync(path.join(options.basePath, 'package-lock.json'))\n const yarn = fs.existsSync(path.join(options.basePath, 'yarn.lock'))\n if (npm && yarn) {\n throw new Error(`Invalid plugin: contains both package-lock.json and yarn.lock`)\n }\n}\n\nexport async function writePackageJson(data: PackageData, options: InjectOptions) {\n const {user, pluginName, license, description, pkg: prevPkg, gitOrigin} = data\n const {\n outDir,\n peerDependencies: addPeers,\n dependencies: addDeps,\n devDependencies: addDevDeps,\n } = options\n const {flags} = options\n const prev = prevPkg || {}\n\n const useOxfmt = flags.oxfmt !== false\n const useOxlint = flags.oxlint !== false\n const useTypescript = flags.typescript !== false\n\n const newDevDependencies = [cliName, '@sanity/pkg-utils']\n\n if (useTypescript) {\n log.debug('Using TypeScript. Adding to dev dependencies.')\n newDevDependencies.push('@types/react', 'typescript')\n }\n\n if (useOxfmt) {\n log.debug('Using oxfmt. Adding to dev dependencies.')\n newDevDependencies.push('oxfmt')\n }\n\n if (useOxlint) {\n log.debug('Using oxlint. Adding to dev dependencies.')\n // oxlint-tsgolint powers the type-aware rules and type checking enabled in the shared config\n newDevDependencies.push('oxlint', 'oxlint-tsgolint')\n }\n\n log.debug('Resolving latest versions for %s', newDevDependencies.join(', '))\n const dependencies = forceDependencyVersions(\n {\n ...(prev.dependencies || {}),\n ...(addDeps || {}),\n ...(await resolveLatestVersions(defaultDependencies)),\n },\n forcedPackageVersions,\n )\n const devDependencies = forceDependencyVersions(\n {\n ...(addDevDeps || {}),\n ...(prev.devDependencies || {}),\n ...(await resolveLatestVersions([...newDevDependencies, ...defaultDevDependencies])),\n },\n forcedDevPackageVersions,\n )\n const peerDependencies = forceDependencyVersions(\n {\n ...(prev.peerDependencies || {}),\n ...(addPeers || {}),\n ...(await resolveLatestVersions(defaultPeerDependencies)),\n },\n forcedPeerPackageVersions,\n )\n\n const source = flags.typescript ? './src/index.ts' : './src/index.js'\n\n const files = [outDir]\n\n // sort alphabetically for scanability\n files.sort()\n\n // Opting out of oxfmt/oxlint must also disable the corresponding verify-package checks,\n // otherwise the scaffolded `build` script (which runs verify-package) fails out of the box\n const verifyPackageOptOuts = {\n ...(useOxfmt ? {} : {oxfmt: false}),\n ...(useOxlint ? {} : {oxlint: false}),\n }\n const prevSanityPlugin: SanityPlugin = prev.sanityPlugin ?? {}\n const sanityPlugin: SanityPlugin | undefined = Object.keys(verifyPackageOptOuts).length\n ? {\n ...prevSanityPlugin,\n verifyPackage: {...prevSanityPlugin.verifyPackage, ...verifyPackageOptOuts},\n }\n : prev.sanityPlugin\n\n // order should be compatible with oxfmt's sortPackageJson\n const forcedOrder = {\n name: pluginName,\n version: prev.version ?? '1.0.0',\n description: description || '',\n keywords: prev.keywords ?? ['sanity', 'sanity-plugin'],\n ...urlsFromOrigin(gitOrigin),\n ...repoFromOrigin(gitOrigin),\n license: license ? license.id : 'UNLICENSED',\n author: user?.email ? `${user.name} <${user.email}>` : user?.name,\n sideEffects: false,\n type: 'module',\n exports: {\n '.': {\n source,\n default: `./${outDir}/index.js`,\n },\n './package.json': './package.json',\n },\n ...(flags.typescript ? {types: `./${outDir}/index.d.ts`} : {}),\n files,\n scripts: {...prev.scripts},\n dependencies: sortKeys(dependencies),\n devDependencies: sortKeys(devDependencies),\n peerDependencies: sortKeys(peerDependencies),\n engines: {\n node: requiredNodeEngine,\n },\n ...(sanityPlugin ? {sanityPlugin} : {}),\n }\n\n const manifest: PackageJson = {\n ...forcedOrder,\n // Use already configured values by default (if not otherwise specified)\n ...(prev || {}),\n // We're de-declaring properties because of key order in package.json\n ...forcedOrder,\n }\n\n const differs = JSON.stringify(prev) !== JSON.stringify(manifest)\n log.debug('Does manifest differ? %s', differs ? 'yes' : 'no')\n if (differs) {\n await writePackageJsonDirect(manifest, options)\n }\n\n return differs ? manifest : prev\n}\n\nfunction urlsFromOrigin(gitOrigin?: string): {bugs?: {url: string}; homepage?: string} {\n if (!gitOrigin) {\n return {}\n }\n\n const details = githubUrlToObject(gitOrigin)\n if (!details) {\n return {}\n }\n\n return {\n homepage: `https://github.com/${details.user}/${details.repo}#readme`,\n bugs: {\n url: `https://github.com/${details.user}/${details.repo}/issues`,\n },\n }\n}\n\nfunction repoFromOrigin(gitOrigin?: string) {\n if (!gitOrigin) {\n return {}\n }\n\n return {\n repository: {\n type: 'git',\n url: gitOrigin,\n },\n }\n}\n\nexport function addScript(cmd: string, existing: string) {\n if (existing && existing.includes(cmd)) {\n return existing\n }\n\n return cmd\n}\n\nexport async function addPackageJsonScripts(\n manifest: PackageJson,\n options: InjectOptions,\n updateScripts: (currentScripts: Record<string, string>) => Record<string, string>,\n) {\n const originalScripts = manifest.scripts || {}\n const scripts = updateScripts({...originalScripts})\n\n const differs = Object.keys(scripts).some((key) => scripts[key] !== originalScripts[key])\n\n if (differs) {\n await writePackageJsonDirect({...manifest, scripts}, options)\n }\n\n return differs\n}\n\nexport async function writePackageJsonDirect(manifest: PackageJson, {basePath}: InjectOptions) {\n await writeJsonFile(path.join(basePath, 'package.json'), manifest)\n}\n\nexport async function addBuildScripts(manifest: PackageJson, options: InjectOptions) {\n if (!options.flags.scripts) {\n return false\n }\n return addPackageJsonScripts(manifest, options, (scripts) => {\n scripts.build = addScript(expectedScripts.build, scripts.build)\n if (options.flags.oxfmt !== false) {\n scripts.format = addScript(`oxfmt`, scripts.format)\n }\n scripts['link-watch'] = addScript(expectedScripts['link-watch'], scripts['link-watch'])\n if (options.flags.oxlint !== false) {\n scripts.lint = addScript(`oxlint`, scripts.lint)\n }\n scripts.prepublishOnly = addScript(expectedScripts.prepublishOnly, scripts.prepublishOnly)\n scripts.watch = addScript(expectedScripts.watch, scripts.watch)\n return scripts\n })\n}\n\nexport function sortKeys<T extends Record<string, unknown>>(unordered: T): T {\n return Object.keys(unordered)\n .sort()\n .reduce((obj, key) => {\n // @ts-expect-error this WILL work\n obj[key] = unordered[key]\n return obj\n }, {} as T)\n}\n\n/** @internal */\nexport function forceDependencyVersions(\n deps: Record<string, string>,\n versions = forcedPackageVersions,\n): Record<string, string> {\n const entries = Object.entries(deps).map((entry) => {\n const [pkg] = entry\n const forceVersion = versions[pkg as keyof typeof versions]\n if (forceVersion) {\n return [pkg, forceVersion]\n }\n return entry\n })\n return Object.fromEntries(entries)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAgB,QAAQ,SAA+B,GAAG,QAA2B;CACnF,IAAM,QAAQ,QAAQ,EAAE,CAAC,MAAM,sCAAsC,GAC/D,mBAAmB,QAAQ,MAAM,EAAE,CAAC,SAAS,GAE7C,gBAAoB,OAAO,4BAA4B,iBAAiB,IAAI,GAAG,GAE/E,YAAY,QAAQ,KAAK,GAAG,MAAM;EACtC,IAAI,IAAI,EAAE,QAAQ,eAAe,IAAI;EAOrC,OANI,MAAM,MACR,IAAI,EAAE,QAAQ,yBAAyB,EAAE,IAEvC,MAAM,QAAQ,SAAS,MACzB,IAAI,EAAE,QAAQ,yBAAyB,EAAE,IAEpC;CACT,CAAC,GAEG,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAEpC,AADA,UAAU,UAAU,IAChB,IAAI,OAAO,WACb,UAAU,OAAO;CAGrB,OAAO;AACT;AC9BA,MAAa,oBAAoB;CAC/B;CACA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,MAAM,uBAAuB;EAAC,GAAG;EAAU;CAAO,GAAG,OAAO,GAGvD;AACT;AAEA,eAAsB,uBAAuB,UAAuB,EAAC,YAA0B;CAC7F,MAAM,cAAc,KAAK,KAAK,UAAU,cAAc,GAAG,QAAQ;AACnE;AAEA,eAAsB,gBAAgB,UAAuB,SAAwB;CAInF,OAHK,QAAQ,MAAM,UAGZ,sBAAsB,UAAU,UAAU,aAC/C,QAAQ,QAAQ,UAAU,gBAAgB,OAAO,QAAQ,KAAK,GAC1D,QAAQ,MAAM,UAAU,OAC1B,QAAQ,SAAS,UAAU,SAAS,QAAQ,MAAM,IAEpD,QAAQ,gBAAgB,UAAU,gBAAgB,eAAe,QAAQ,aAAa,GAClF,QAAQ,MAAM,WAAW,OAC3B,QAAQ,OAAO,UAAU,UAAU,QAAQ,IAAI,IAEjD,QAAQ,iBAAiB,UAAU,gBAAgB,gBAAgB,QAAQ,cAAc,GACzF,QAAQ,QAAQ,UAAU,gBAAgB,OAAO,QAAQ,KAAK,GACvD,QACR,IAdQ;AAeX;AAEA,SAAgB,SAA4C,WAAiB;CAC3E,OAAO,OAAO,KAAK,SAAS,CAAC,CAC1B,KAAK,CAAC,CACN,QAAQ,KAAK,SAEZ,IAAI,OAAO,UAAU,MACd,MACN,CAAC,CAAM;AACd;;AAGA,SAAgB,wBACd,MACA,WAAW,uBACa;CACxB,IAAM,UAAU,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,UAAU;EAClD,IAAM,CAAC,OAAO,OACR,eAAe,SAAS;EAI9B,OAHI,eACK,CAAC,KAAK,YAAY,IAEpB;CACT,CAAC;CACD,OAAO,OAAO,YAAY,OAAO;AACnC"}
\ No newline at end of file
+{"version":3,"file":"package-8cUY5BVf.js","names":["URL","readFile","validatePackageName","validateNpmPackageName","readFile","validateNpmPackageName","\"build\"","\"watch\"","\"prepublishOnly\"","\"react\"","\"sanity\"","\"eslint\"","\"typescript\""],"sources":["../src/util/outdent.ts","../src/configs/banned-packages.ts","../src/util/github-url.ts","../src/util/prompt.ts","../src/util/files.ts","../src/actions/verify/validations.ts","../src/configs/forced-package-versions.ts","../src/npm/resolveLatestVersions.ts","../src/npm/package.ts"],"sourcesContent":["/**\n * Tagged-template helper that strips the common leading indentation from\n * multi-line strings (same semantics as the `outdent` package for the\n * patterns used in this package).\n */\nexport function outdent(strings: TemplateStringsArray, ...values: unknown[]): string {\n const match = strings[0].match(/(\\r\\n|\\r|\\n)([ \\t]*)(?:[^ \\t\\r\\n]|$)/)\n const indentationLevel = match ? match[2].length : 0\n // Only strip spaces/tabs — never consume non-whitespace from under-indented lines\n const reMatchIndent = new RegExp(`(\\\\r\\\\n|\\\\r|\\\\n)[ \\\\t]{0,${indentationLevel}}`, 'g')\n\n const outdented = strings.map((v, i) => {\n let s = v.replace(reMatchIndent, '$1')\n if (i === 0) {\n s = s.replace(/^[ \\t]*(?:\\r\\n|\\r|\\n)/, '')\n }\n if (i === strings.length - 1) {\n s = s.replace(/(?:\\r\\n|\\r|\\n)[ \\t]*$/, '')\n }\n return s\n })\n\n let result = ''\n for (let i = 0; i < outdented.length; i++) {\n result += outdented[i]\n if (i < values.length) {\n result += values[i]\n }\n }\n return result\n}\n","export const deprecatedDevDeps = [\n 'tsdx',\n 'sanipack',\n 'parcel',\n '@parcel/packager-ts',\n '@parcel/transformer-typescript-types',\n]\n","/**\n * Parse a GitHub remote URL (https, git+ssh, or scp-style) into user/repo.\n * Replaces the untyped `github-url-to-object` package.\n */\nexport function githubUrlToObject(url: string): {user: string; repo: string} | undefined {\n if (!url) {\n return undefined\n }\n\n const trimmed = url.trim()\n\n // [email protected]:user/repo(.git)\n const scp = trimmed.match(/^git@github\\.com:([^/]+)\\/(.+?)(?:\\.git)?$/i)\n if (scp) {\n return {user: scp[1], repo: scp[2]}\n }\n\n try {\n const normalized = trimmed\n .replace(/^git\\+/, '')\n .replace(/^ssh:\\/\\/git@github\\.com\\//i, 'https://github.com/')\n .replace(/^git:\\/\\/github\\.com\\//i, 'https://github.com/')\n const parsed = new URL(normalized)\n if (!/(^|\\.)github\\.com$/i.test(parsed.hostname)) {\n return undefined\n }\n const [, user, repoWithGit] = parsed.pathname.split('/')\n if (!user || !repoWithGit) {\n return undefined\n }\n return {user, repo: repoWithGit.replace(/\\.git$/i, '')}\n } catch {\n return undefined\n }\n}\n","import path from 'path'\nimport {URL} from 'url'\n\nimport inquirer, {type Question} from 'inquirer'\nimport validNpmName from 'validate-npm-package-name'\n\nimport type {InjectOptions} from '../actions/inject'\nimport {githubUrlToObject} from './github-url'\n\ninterface PromptOptions {\n choices?: any\n type?: string\n default?: any\n filter?: (val: any) => any\n validate?: (val: any) => boolean | string\n}\n\nexport async function prompt(message: string, options: PromptOptions) {\n const type = options.choices ? 'select' : (options.type ?? 'input')\n const question: Question & Pick<PromptOptions, 'validate'> = {\n ...options,\n type,\n message,\n name: 'single',\n }\n const {filter, validate} = options\n if (validate) {\n // Classic inquirer ran `validate` on the filtered value; the modern rewrite applies\n // `filter` only after the prompt resolves, so restore the original semantics here\n // (all filters used with `prompt` are idempotent)\n question.validate = (value: any) => validate(filter ? filter(value) : value)\n }\n const result = await inquirer.prompt([question])\n return result && result.single\n}\n\nprompt.separator = () => new inquirer.Separator()\n\nexport function promptForPackageName({basePath}: InjectOptions, defaultVal?: string) {\n return prompt('Plugin name (sanity-plugin-...)', {\n default: defaultVal || path.basename(basePath),\n filter: (name) => {\n const prefixless = name.trim().replace(/^sanity-plugin-/, '')\n return name[0] === '@' ? name : `sanity-plugin-${prefixless}`\n },\n validate: (name) => {\n const valid: {errors?: string[]} = validNpmName(name)\n if (valid.errors) {\n return valid.errors[0]\n }\n\n if (name[0] !== '@' && name.endsWith('plugin')) {\n return `Name shouldn't include \"plugin\" multiple times (${name})`\n }\n\n return true\n },\n })\n}\n\nexport function promptForRepoOrigin(_options: InjectOptions, defaultVal?: string) {\n return prompt('Git repository URL', {\n default: defaultVal,\n filter: (raw) => {\n const url = (raw || '').trim()\n const gh = githubUrlToObject(url)\n return gh ? `git+ssh://[email protected]/${gh.user}/${gh.repo}.git` : url\n },\n validate: (url) => {\n if (!url) {\n return true\n }\n\n try {\n const parsed = new URL(url)\n return parsed ? true : 'Invalid URL'\n } catch {\n return 'Invalid URL'\n }\n },\n })\n}\n","import crypto from 'crypto'\nimport fs from 'fs'\nimport path from 'path'\nimport util from 'util'\n\nimport type {InitFlags} from '../actions/init'\nimport {prompt} from './prompt'\n\nconst stat = util.promisify(fs.stat)\nexport const mkdir = util.promisify(fs.mkdir)\nconst readdir = util.promisify(fs.readdir)\nconst copyFile = util.promisify(fs.copyFile)\nexport const readFile = util.promisify(fs.readFile)\nexport const writeFile = util.promisify(fs.writeFile)\n\nexport function fileExists(filePath: string) {\n return stat(filePath)\n .then(() => true)\n .catch(() => false)\n}\n\nexport async function readJsonFile<T>(filePath: string) {\n const content = await readFile(filePath, 'utf8')\n return JSON.parse(content) as T\n}\n\nexport function writeJsonFile(filePath: string, content: Record<string, unknown>) {\n const data = JSON.stringify(content, null, 2) + '\\n'\n return writeFile(filePath, data, {encoding: 'utf8'})\n}\n\nexport async function writeFileWithOverwritePrompt(\n filePath: string,\n content: string,\n options: {default?: any; force?: boolean} & fs.ObjectEncodingOptions,\n) {\n const {default: defaultVal, force = false, ...writeOptions} = options\n const withinCwd = filePath.startsWith(process.cwd())\n const printablePath = withinCwd ? path.relative(process.cwd(), filePath) : filePath\n\n if (await fileEqualsData(filePath, content)) {\n return false\n }\n\n if (\n !force &&\n (await fileExists(filePath)) &&\n !(await prompt(`File \"${printablePath}\" already exists. Overwrite?`, {\n type: 'confirm',\n default: defaultVal,\n }))\n ) {\n return false\n }\n\n await writeFile(filePath, content, writeOptions)\n return true\n}\n\nexport async function copyFileWithOverwritePrompt(from: string, to: string, flags: InitFlags) {\n const withinCwd = to.startsWith(process.cwd())\n const printablePath = withinCwd ? path.relative(process.cwd(), to) : to\n\n if (await filesAreEqual(from, to)) {\n return false\n }\n\n await ensureDirectoryExists(to)\n\n if (\n !flags.force &&\n (await fileExists(to)) &&\n !(await prompt(`File \"${printablePath}\" already exists. Overwrite?`, {\n type: 'confirm',\n default: false,\n }))\n ) {\n return false\n }\n\n await copyFile(from, to)\n return true\n}\n\nasync function ensureDirectoryExists(filePath: string): Promise<void> {\n const dirname = path.dirname(filePath)\n if (await fileExists(dirname)) {\n return\n }\n await ensureDirectoryExists(dirname)\n await mkdir(dirname)\n}\n\nasync function fileEqualsData(filePath: string, content: string) {\n const contentHash = crypto.createHash('sha1').update(content).digest('hex')\n const remoteHash = await getFileHash(filePath)\n return contentHash === remoteHash\n}\n\nasync function filesAreEqual(file1: string, file2: string) {\n const [hash1, hash2] = await Promise.all([getFileHash(file1, false), getFileHash(file2)])\n return hash1 === hash2\n}\n\nfunction getFileHash(filePath: string, allowMissing = true) {\n return new Promise((resolve, reject) => {\n const hash = crypto.createHash('sha1')\n const stream = fs.createReadStream(filePath)\n stream.on('error', (err) => {\n if ((err as {code?: string}).code === 'ENOENT' && allowMissing) {\n resolve(null)\n } else {\n reject(err)\n }\n })\n\n stream.on('end', () => resolve(hash.digest('hex')))\n stream.on('data', (chunk) => hash.update(chunk))\n })\n}\n\nexport async function ensureDir(dirPath: string) {\n try {\n await mkdir(dirPath)\n } catch (err) {\n if ((err as {code?: string}).code !== 'EEXIST') {\n throw err\n }\n }\n}\n\nexport async function isEmptyish(dirPath: string) {\n const ignoredFiles = ['.git', '.gitignore', 'license', 'readme.md']\n const allFiles = await readdir(dirPath).catch(() => [])\n const files = allFiles.filter((file) => !ignoredFiles.includes(file.toLowerCase()))\n return files.length === 0\n}\n","import {createRequire} from 'node:module'\nimport path from 'path'\n\nimport type {ParsedCommandLine} from '@typescript/typescript6'\nimport validateNpmPackageName from 'validate-npm-package-name'\n\nimport {deprecatedDevDeps} from '../../configs/banned-packages'\nimport {minPkgUtilsMajor, requiredNodeEngine} from '../../constants'\nimport {fileExists, readFile, readJsonFile} from '../../util/files'\nimport {outdent} from '../../util/outdent'\nimport type {PackageJson} from './types'\n\nexport const expectedScripts = {\n 'build': 'plugin-kit verify-package --silent && pkg-utils build --strict --check --clean',\n 'watch': 'pkg-utils watch --strict',\n 'link-watch': 'plugin-kit link-watch',\n 'prepublishOnly': 'npm run build',\n}\n\nfunction filesWithSuffixes(fileBases: string[], suffixes: string[]): string[] {\n return fileBases.flatMap((file) => suffixes.map((suffix) => `${file}.${suffix}`))\n}\n\nexport function validateNodeEngine(packageJson: PackageJson) {\n if (packageJson.engines?.node !== requiredNodeEngine) {\n return [\n outdent`\n Expected package.json to contain engines.node: \"${requiredNodeEngine}\" to match @sanity/pkg-utils,\n but it was: ${packageJson.engines?.node}\n\n Please add the following to package.json:\n\n \"engines\": {\n \"node\": \"${requiredNodeEngine}\"\n }`.trimStart(),\n ]\n }\n return []\n}\n\nexport function validateScripts(packageJson: PackageJson): string[] {\n const errors: string[] = []\n\n const divergentScripts = Object.entries(expectedScripts).filter(([key, expectedCommand]) => {\n const command = packageJson.scripts?.[key]\n // check for includes instead of equals to give some leniency in command params and such\n return !command || !command.includes(expectedCommand)\n })\n\n if (divergentScripts.length) {\n errors.push(\n outdent`\n The following script commands did not contain expected defaults: ${divergentScripts\n .map(([key]) => key)\n .join(', ')}\n\n This checks for that the commands-strings includes these terms.\n\n Please add the following to your package.json \"scripts\":\n\n ${divergentScripts.map(([key, value]) => `\"${key}\": \"${value}\"`).join(',\\n')}\n `.trimStart(),\n )\n }\n return errors\n}\n\nexport async function validateTsConfig(\n ts: ParsedCommandLine,\n options: {basePath: string; outDir: string; tsconfig: string},\n) {\n const {basePath, outDir, tsconfig} = options\n\n const errors: string[] = []\n\n const expectedCompilerOptions = {\n target: 'esnext',\n jsx: 'preserve',\n module: 'preserve',\n rootDir: '.',\n outDir,\n noEmit: true,\n }\n\n const wrongEntries = Object.entries(expectedCompilerOptions).filter(([key, value]) => {\n let option: any = ts.options[key]\n\n if (key === 'rootDir' && typeof option === 'string') {\n option = path.relative(basePath, option) || '.'\n }\n\n if (key === 'outDir' && typeof option === 'string') {\n option = path.relative(basePath, option) || '.'\n }\n\n if (key === 'target' && option === 99) {\n option = 'esnext'\n }\n\n if (key === 'module' && option === 200) {\n option = 'preserve'\n }\n\n if (key === 'jsx' && option === 1) {\n option = 'preserve'\n }\n\n return typeof value === 'string' && typeof option === 'string'\n ? value.toLowerCase() !== option?.toLowerCase()\n : value !== option\n })\n\n if (wrongEntries.length) {\n const expectedOutput = wrongEntries\n .map(([key, value]) => `\"${key}\": ${typeof value === 'string' ? `\"${value}\"` : value},`)\n .join('\\n')\n\n errors.push(\n outdent`\n Recommended ${tsconfig} compilerOptions missing:\n\n The following fields had unexpected values: [${wrongEntries.map(([key]) => key).join(', ')}]\n Expected to find these values:\n ${expectedOutput}\n\n Please update your ${tsconfig} accordingly.\n `.trimStart(),\n )\n }\n\n return errors\n}\n\n/**\n * Hard requirement: plugins must be ESM (`\"type\": \"module\"`).\n *\n * plugin-kit loads `package.config.ts` through `@sanity/pkg-utils`, which can only load ESM\n * TypeScript configs reliably when the plugin itself is ESM. CommonJS (or an omitted `type`)\n * is not supported and cannot be opted out of.\n */\nexport function validatePackageType({type}: PackageJson): string[] {\n if (type === 'module') {\n return []\n }\n\n return [\n outdent`\n package.json must set \"type\": \"module\" — plugins built with @sanity/plugin-kit are ESM-only.\n Found: ${type ? `\"type\": \"${type}\"` : 'no \"type\" field (defaults to \"commonjs\")'}\n\n Please add the following to package.json:\n\n \"type\": \"module\"\n `.trimStart(),\n ]\n}\n\n/**\n * Recursively collects the locations of any `require` condition within a package.json `exports`\n * field. Conditions can be nested arbitrarily deep (and inside fallback arrays), so we walk the\n * whole tree rather than only inspecting the first level.\n *\n * Subpath keys always start with `.` (e.g. `\"./feature\"`), while condition keys never do, so an\n * exact `require` key is unambiguously a CommonJS export condition.\n */\nfunction findRequireConditions(node: unknown, pathSegments: string[]): string[] {\n if (Array.isArray(node)) {\n return node.flatMap((entry, index) =>\n findRequireConditions(entry, [...pathSegments, String(index)]),\n )\n }\n\n if (!node || typeof node !== 'object') {\n return []\n }\n\n const found: string[] = []\n for (const [key, value] of Object.entries(node)) {\n if (key === 'require') {\n found.push(formatExportsPath(pathSegments))\n }\n found.push(...findRequireConditions(value, [...pathSegments, key]))\n }\n return found\n}\n\nfunction formatExportsPath(segments: string[]): string {\n return `exports${segments.map((segment) => `[${JSON.stringify(segment)}]`).join('')}`\n}\n\n/**\n * Bans CommonJS interop in package.json. The plugin baseline is Sanity Studio v5 or later, which is\n * pure ESM, so there is no reason to publish a parallel CJS build anymore. This flags:\n *\n * - `require` export conditions\n * - the top-level `main` field\n * - the top-level `module` field\n */\nexport function validateEsmOnly(packageJson: PackageJson): string[] {\n const offenders: string[] = []\n\n if (typeof packageJson.main !== 'undefined') {\n offenders.push(`- the top-level \"main\" field (${JSON.stringify(packageJson.main)})`)\n }\n\n if (typeof packageJson.module !== 'undefined') {\n offenders.push(`- the top-level \"module\" field (${JSON.stringify(packageJson.module)})`)\n }\n\n const requireConditions = [...new Set(findRequireConditions(packageJson.exports, []))]\n for (const conditionPath of requireConditions) {\n offenders.push(`- a \"require\" export condition at ${conditionPath}`)\n }\n\n if (!offenders.length) {\n return []\n }\n\n return [\n outdent`\n package.json ships CommonJS (CJS) output, but Sanity plugins target Sanity Studio v5+, which is pure ESM.\n\n Remove the following so the package stays ESM-only:\n ${offenders.join('\\n')}\n\n Supporting CJS is not worth it:\n - It can have unintended side-effects.\n - The Node.js versions plugin-kit supports (${requiredNodeEngine}) fully support require(esm), so a\n consumer that still uses require() loads the ESM build directly — which is far more predictable.\n - Publishing a single format guarantees two copies of the plugin's code (ESM + CJS) can't both end up\n in the module tree, bloating bundles and slowing down builds.\n\n Rely on \"exports\" together with \"type\": \"module\", and drop \"main\", \"module\" and any \"require\" conditions.\n `.trimStart(),\n ]\n}\n\nexport function validatePkgUtilsDependency({devDependencies}: PackageJson): string[] {\n if (!devDependencies?.['@sanity/pkg-utils']) {\n return [\n outdent`\n package.json does not list @sanity/pkg-utils as a devDependency.\n @sanity/pkg-utils replaced parcel as the recommended build tool in @sanity/plugin-kit 2.0.0\n\n Please add it by running 'npm install --save-dev @sanity/pkg-utils'.\n `.trimStart(),\n ]\n }\n return []\n}\n\n/**\n * Verifies that the installed `@sanity/pkg-utils` (the peer dependency plugin-kit loads\n * `package.config.ts` with) is recent enough to expose the `loadConfig({cwd, pkgPath})` API.\n */\nexport function validatePkgUtilsVersion({basePath}: {basePath: string}): string[] {\n const require = createRequire(path.join(basePath, 'package.json'))\n\n let installedVersion: string | undefined\n try {\n const pkgUtilsManifest = require('@sanity/pkg-utils/package.json') as {version?: string}\n installedVersion = pkgUtilsManifest.version\n } catch {\n return [\n outdent`\n @sanity/pkg-utils is not installed.\n plugin-kit loads package.config.ts through @sanity/pkg-utils (a peer dependency).\n\n Please install it by running 'npm install --save-dev @sanity/pkg-utils'.\n `.trimStart(),\n ]\n }\n\n const major = Number.parseInt(installedVersion?.split('.')[0] ?? '', 10)\n if (!Number.isFinite(major) || major < minPkgUtilsMajor) {\n return [\n outdent`\n @sanity/pkg-utils ${installedVersion} is too old.\n plugin-kit requires @sanity/pkg-utils >=${minPkgUtilsMajor} to load package.config.ts.\n\n Please upgrade it by running 'npm install --save-dev @sanity/pkg-utils@latest'.\n `.trimStart(),\n ]\n }\n\n return []\n}\n\nexport function validateDeprecatedDependencies(packageJson: PackageJson): string[] {\n const {dependencies, devDependencies, peerDependencies} = packageJson\n const allDependencies = {...dependencies, ...devDependencies, ...peerDependencies}\n\n const illegalDeps = Object.keys(allDependencies).filter((dep) => deprecatedDevDeps.includes(dep))\n const deps = new Set<string>(illegalDeps)\n const unique = [...deps.values()]\n if (unique.length) {\n return [\n outdent`\n package.json contains deprecated dependencies that should be removed:\n - ${unique.join('\\n- ')}\n `.trimStart(),\n ]\n }\n\n return []\n}\n\nexport async function validateBabelConfig({basePath}: {basePath: string}) {\n const suffixes = ['json', 'js', 'cjs', 'mjs']\n const babelFileNames = ['.babelrc', 'babel.config']\n const filenames = ['.babelrc', ...filesWithSuffixes(babelFileNames, suffixes)]\n\n const babelFiles: string[] = []\n for (const filename of filenames) {\n const filepath = path.normalize(path.join(basePath, filename))\n if (await fileExists(filepath)) {\n babelFiles.push(filename)\n }\n }\n\n if (babelFiles.length) {\n return [\n outdent`\n Found babel-config file: [${babelFiles.join(\n ', ',\n )}]. When using default @sanity/plugin-kit build command,\n this is probably not needed.\n\n Delete the file, or disable this check.\n `.trimStart(),\n ]\n }\n return []\n}\n\nexport function validatePackageName(packageJson: PackageJson) {\n const valid = validateNpmPackageName(packageJson.name ?? '')\n if (!valid.validForNewPackages) {\n const messages = valid.errors ?? valid.warnings ?? []\n return [`Invalid package.json: \"name\" is invalid: ${messages.join(', ')}`]\n }\n\n const isScoped = packageJson.name?.startsWith('@')\n if (!isScoped && !packageJson.name?.startsWith('sanity-plugin-')) {\n return [\n `Invalid package.json: \"name\" should be prefixed with \"sanity-plugin-\" (or scoped - @your-company/plugin-name)`,\n ]\n }\n return []\n}\n\n/**\n * Plugins built with @sanity/plugin-kit publish the compiled output (the `dist` directory).\n * The `src` directory should not be published: it bloats the package and can cause bundlers that\n * resolve the `source` export condition to pull in raw, uncompiled TypeScript.\n */\nexport function validateBannedFiles(packageJson: PackageJson): string[] {\n const {files} = packageJson\n if (!Array.isArray(files)) {\n return []\n }\n\n const hasSrc = files.some((entry) => {\n if (typeof entry !== 'string') {\n return false\n }\n // Normalize entries like \"./src\", \"src/\", \"/src\" before comparing.\n const normalized = entry\n .trim()\n .replace(/^\\.?\\/+/, '')\n .replace(/\\/+$/, '')\n return normalized === 'src'\n })\n\n if (!hasSrc) {\n return []\n }\n\n return [\n outdent`\n package.json \"files\" must not include \"src\".\n\n Plugins built with @sanity/plugin-kit publish the compiled output in \"dist\".\n Shipping the \"src\" directory bloats the published package and can cause bundlers that resolve the\n \"source\" export condition to import raw, uncompiled TypeScript.\n\n Please remove \"src\" from the \"files\" array in package.json.\n `.trimStart(),\n ]\n}\n\nexport async function validateSrcIndexFile(basePath: string) {\n const paths = ['index.js', 'index.ts'].map((p) => path.join('src', p))\n const allowedIndexFiles = paths.map((file) => path.join(basePath, file))\n\n let hasIndex = false\n for (const indexFile of allowedIndexFiles) {\n hasIndex = hasIndex || (await fileExists(indexFile))\n }\n if (!hasIndex) {\n return [\n outdent`\n Expected one of [${paths.join(', ')}] to exist.\n\n @sanity/pkg-utils expects a non-jsx file to be the source entry-point for the plugin.\n If you currently have JSX in your index file, extract it into a separate file and import it.\n `,\n ]\n }\n\n return []\n}\n\n/**\n * Config filenames oxfmt discovers automatically (in addition to explicit `-c` paths).\n */\nconst oxfmtConfigFiles = [\n 'oxfmt.config.ts',\n 'oxfmt.config.js',\n 'oxfmt.config.mjs',\n '.oxfmtrc.json',\n '.oxfmtrc.jsonc',\n]\n\nconst legacyPrettierConfigFiles = [\n '.prettierrc',\n '.prettierrc.json5',\n '.prettierrc.json',\n '.prettierrc.yaml',\n '.prettierrc.yml',\n '.prettierrc.js',\n '.prettierrc.cjs',\n '.prettierrc.mjs',\n '.prettierrc.toml',\n 'prettier.config.js',\n 'prettier.config.cjs',\n 'prettier.config.mjs',\n]\n\nconst oxfmtPresetSpecifier = '@sanity/plugin-kit/oxfmt'\n\nconst oxfmtSetupSnippet = outdent`\n export {default} from '${oxfmtPresetSpecifier}'\n`\n\n/**\n * Walks up from `basePath` (inclusive) looking for a workspace (monorepo) root: a directory\n * containing `pnpm-workspace.yaml`, or a `package.json` with a `workspaces` field.\n */\nasync function findWorkspaceRoot(basePath: string): Promise<string | undefined> {\n let dir = path.resolve(basePath)\n let prev: string | undefined\n while (dir !== prev) {\n if (await isWorkspaceRoot(dir)) {\n return dir\n }\n prev = dir\n dir = path.dirname(dir)\n }\n return undefined\n}\n\nasync function isWorkspaceRoot(dir: string): Promise<boolean> {\n if (await fileExists(path.join(dir, 'pnpm-workspace.yaml'))) {\n return true\n }\n const pkgPath = path.join(dir, 'package.json')\n if (await fileExists(pkgPath)) {\n try {\n const pkg = await readJsonFile<PackageJson>(pkgPath)\n return Boolean(pkg && typeof pkg === 'object' && pkg.workspaces)\n } catch {\n // an unparseable package.json is not a workspace root marker\n }\n }\n return false\n}\n\n/**\n * Finds leftover config files from a replaced tool, both next to the plugin's package.json and\n * (in a monorepo) at the workspace root, where the replacement config is expected to live.\n */\nasync function findLegacyConfigFiles(\n basePath: string,\n workspaceRoot: string | undefined,\n files: string[],\n): Promise<string[]> {\n const found: string[] = []\n for (const file of files) {\n if (await fileExists(path.join(basePath, file))) {\n found.push(file)\n }\n }\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n for (const file of files) {\n if (await fileExists(path.join(workspaceRoot, file))) {\n found.push(`${file} (in the workspace root)`)\n }\n }\n }\n return found\n}\n\n/**\n * Finds a leftover config key from a replaced tool in the plugin's package.json and (in a\n * monorepo) the workspace root package.json, where such keys used to configure the whole\n * workspace.\n */\nasync function findLegacyPackageJsonKey(\n pkgJson: PackageJson,\n basePath: string,\n workspaceRoot: string | undefined,\n key: string,\n): Promise<string[]> {\n const found: string[] = []\n if (pkgJson[key]) {\n found.push(`package.json (\"${key}\" key)`)\n }\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const rootPkgPath = path.join(workspaceRoot, 'package.json')\n if (await fileExists(rootPkgPath)) {\n try {\n const rootPkg = await readJsonFile<PackageJson>(rootPkgPath)\n if (rootPkg && typeof rootPkg === 'object' && rootPkg[key]) {\n found.push(`package.json (\"${key}\" key, in the workspace root)`)\n }\n } catch {\n // an unparseable root package.json is not this check's concern\n }\n }\n }\n return found\n}\n\ntype ConfigDirResult = {ok: true} | {ok: false; found: boolean; error: string}\n\nasync function checkOxfmtConfigDir(dir: string, describeDir: string): Promise<ConfigDirResult> {\n const found: string[] = []\n for (const file of oxfmtConfigFiles) {\n if (await fileExists(path.join(dir, file))) {\n found.push(file)\n }\n }\n\n if (found.length === 0) {\n return {\n ok: false,\n found: false,\n error: outdent`\n Could not find an oxfmt config file ${describeDir}.\n\n plugin-kit ships a shared oxfmt preset. Create an oxfmt.config.ts there containing:\n\n ${oxfmtSetupSnippet}\n `,\n }\n }\n\n if (found.length > 1) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found multiple oxfmt config files ${describeDir}: [${found.join(', ')}].\n\n There should be at most one of these files. Delete the rest.\n `,\n }\n }\n\n const file = found[0]\n if (file.startsWith('.oxfmtrc')) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but JSON configs cannot reuse the shared plugin-kit preset.\n\n Replace it with an oxfmt.config.ts containing:\n\n ${oxfmtSetupSnippet}\n `,\n }\n }\n\n const content = await readFile(path.join(dir, file), 'utf8')\n if (!content.includes(oxfmtPresetSpecifier)) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but it does not use the shared plugin-kit preset (${oxfmtPresetSpecifier}).\n\n Re-export the preset:\n\n ${oxfmtSetupSnippet}\n\n or spread it into your own config to customize options.\n `,\n }\n }\n\n return {ok: true}\n}\n\n/**\n * Verifies the plugin is formatted with oxfmt using the shared plugin-kit preset, and that no\n * legacy prettier configuration remains.\n *\n * In a monorepo (a workspace root is found above the plugin), the oxfmt config is expected at the\n * workspace root; otherwise it should sit next to the package.json that installs and runs\n * plugin-kit. Since oxfmt discovers nested configs, a config next to package.json overrides the\n * workspace root config for this package — so in a monorepo the local config is validated when it\n * exists, and the workspace root config otherwise.\n */\nexport async function validateOxfmtConfig(\n basePath: string,\n pkgJson: PackageJson,\n): Promise<string[]> {\n const errors: string[] = []\n const workspaceRoot = await findWorkspaceRoot(basePath)\n\n const legacyFound = await findLegacyConfigFiles(\n basePath,\n workspaceRoot,\n legacyPrettierConfigFiles,\n )\n legacyFound.push(\n ...(await findLegacyPackageJsonKey(pkgJson, basePath, workspaceRoot, 'prettier')),\n )\n if (legacyFound.length) {\n errors.push(\n outdent`\n Found legacy prettier configuration: [${legacyFound.join(', ')}].\n\n plugin-kit has replaced prettier with oxfmt. Remove the prettier config (custom options can\n be migrated with \\`npx oxfmt --migrate=prettier\\`), drop the prettier, prettier-plugin-packagejson\n and eslint-plugin-prettier devDependencies, and format with oxfmt instead:\n\n ${oxfmtSetupSnippet}\n `,\n )\n }\n const primaryDir = workspaceRoot ?? basePath\n const primaryResult = await checkOxfmtConfigDir(\n primaryDir,\n workspaceRoot ? `in the workspace root (${workspaceRoot})` : 'next to package.json',\n )\n\n // In a monorepo, oxfmt discovers nested configs: a config next to the plugin's package.json\n // overrides the workspace root config for this package's files, so when one exists it is the\n // config that must use the shared preset.\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const localResult = await checkOxfmtConfigDir(basePath, 'next to package.json')\n if (localResult.ok) {\n return errors\n }\n if (localResult.found) {\n errors.push(\n primaryResult.ok\n ? outdent`\n ${localResult.error}\n\n Note: this config overrides the workspace root config (${primaryDir}) for this\n package's files, since oxfmt discovers nested configs. Either make it use the shared\n preset, or delete it to fall back to the workspace root config.\n `\n : localResult.error,\n )\n return errors\n }\n }\n\n if (primaryResult.ok) {\n return errors\n }\n\n errors.push(primaryResult.error)\n return errors\n}\n\n/**\n * Config filenames oxlint discovers automatically (in addition to explicit `-c` paths).\n */\nconst oxlintConfigFiles = ['oxlint.config.ts', '.oxlintrc.json', '.oxlintrc.jsonc']\n\nconst legacyEslintConfigFiles = [\n '.eslintrc',\n '.eslintrc.js',\n '.eslintrc.cjs',\n '.eslintrc.yaml',\n '.eslintrc.yml',\n '.eslintrc.json',\n '.eslintignore',\n 'eslint.config.js',\n 'eslint.config.mjs',\n 'eslint.config.cjs',\n 'eslint.config.ts',\n 'eslint.config.mts',\n 'eslint.config.cts',\n]\n\nconst oxlintSharedConfig = '@sanity/plugin-kit/oxlint'\n\nconst oxlintSetupSnippet = outdent`\n export {default} from '${oxlintSharedConfig}'\n`\n\nasync function checkOxlintConfigDir(dir: string, describeDir: string): Promise<ConfigDirResult> {\n const found: string[] = []\n for (const file of oxlintConfigFiles) {\n if (await fileExists(path.join(dir, file))) {\n found.push(file)\n }\n }\n\n if (found.length === 0) {\n return {\n ok: false,\n found: false,\n error: outdent`\n Could not find an oxlint config file ${describeDir}.\n\n plugin-kit ships a shared oxlint config (type-aware rules, type checking and no warnings).\n Create an oxlint.config.ts there containing:\n\n ${oxlintSetupSnippet}\n `,\n }\n }\n\n if (found.length > 1) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found multiple oxlint config files ${describeDir}: [${found.join(', ')}].\n\n There should be at most one of these files. Delete the rest.\n `,\n }\n }\n\n const file = found[0]\n if (file.startsWith('.oxlintrc')) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but JSON configs cannot reuse the shared plugin-kit config\n (package imports are only supported in oxlint.config.ts).\n\n Replace it with an oxlint.config.ts containing:\n\n ${oxlintSetupSnippet}\n `,\n }\n }\n\n const content = await readFile(path.join(dir, file), 'utf8')\n if (!content.includes(oxlintSharedConfig)) {\n return {\n ok: false,\n found: true,\n error: outdent`\n Found ${file} ${describeDir}, but it does not use the shared plugin-kit config (${oxlintSharedConfig}).\n\n Re-export the shared config:\n\n ${oxlintSetupSnippet}\n\n or extend it with your own options:\n\n import sanityPluginKitOxlint from '${oxlintSharedConfig}'\n import {defineConfig} from 'oxlint'\n\n export default defineConfig({\n extends: [sanityPluginKitOxlint],\n })\n `,\n }\n }\n\n return {ok: true}\n}\n\n/**\n * Verifies the plugin lints with oxlint using the shared plugin-kit config, and that no legacy\n * eslint configuration remains.\n *\n * In a monorepo (a workspace root is found above the plugin), the oxlint config is expected at the\n * workspace root; otherwise it should sit next to the package.json that installs and runs\n * plugin-kit. Since oxlint discovers nested configs, a config next to package.json overrides the\n * workspace root config for this package — so in a monorepo the local config is validated when it\n * exists, and the workspace root config otherwise.\n */\nexport async function validateOxlintConfig(\n basePath: string,\n pkgJson: PackageJson,\n): Promise<string[]> {\n const errors: string[] = []\n const workspaceRoot = await findWorkspaceRoot(basePath)\n\n const legacyFound = await findLegacyConfigFiles(basePath, workspaceRoot, legacyEslintConfigFiles)\n legacyFound.push(\n ...(await findLegacyPackageJsonKey(pkgJson, basePath, workspaceRoot, 'eslintConfig')),\n )\n if (legacyFound.length) {\n errors.push(\n outdent`\n Found legacy eslint configuration: [${legacyFound.join(', ')}].\n\n plugin-kit has replaced eslint with oxlint. Remove the eslint config files and the eslint\n devDependencies (eslint, eslint-config-*, eslint-plugin-*, @typescript-eslint/*), and lint\n with oxlint instead, via an oxlint.config.ts containing:\n\n ${oxlintSetupSnippet}\n `,\n )\n }\n const primaryDir = workspaceRoot ?? basePath\n const primaryResult = await checkOxlintConfigDir(\n primaryDir,\n workspaceRoot ? `in the workspace root (${workspaceRoot})` : 'next to package.json',\n )\n\n // In a monorepo, oxlint discovers nested configs: a config next to the plugin's package.json\n // overrides the workspace root config for this package's files, so when one exists it is the\n // config that must use the shared config.\n if (workspaceRoot && workspaceRoot !== path.resolve(basePath)) {\n const localResult = await checkOxlintConfigDir(basePath, 'next to package.json')\n if (localResult.ok) {\n return errors\n }\n if (localResult.found) {\n errors.push(\n primaryResult.ok\n ? outdent`\n ${localResult.error}\n\n Note: this config overrides the workspace root config (${primaryDir}) for this\n package's files, since oxlint discovers nested configs. Either make it use the shared\n config, or delete it to fall back to the workspace root config.\n `\n : localResult.error,\n )\n return errors\n }\n }\n\n if (primaryResult.ok) {\n return errors\n }\n\n errors.push(primaryResult.error)\n return errors\n}\n","export const forcedPackageVersions = {}\n\nexport const forcedDevPackageVersions = {}\n\nexport const forcedPeerPackageVersions = {\n 'react': '^18',\n 'react-dom': '^18',\n '@types/react': '^18',\n '@types/react-dom': '^18',\n 'sanity': '^5 || ^6.0.0-0',\n 'styled-components': '^5.2',\n}\n","import {getLatestVersion} from 'get-latest-version'\n\n// We may want to lock certain dependencies to specific versions\nconst lockedDependencies: Record<string, string> = {\n 'styled-components': '^6.1',\n 'eslint': '^8.57.0',\n // The scaffolded ESLint toolchain (@typescript-eslint v8) requires the classic JS compiler API,\n // which TypeScript 7 (the Go-native compiler) no longer ships. Unlock once typescript-eslint\n // supports TypeScript 7.\n 'typescript': '^6',\n}\n\nexport async function resolveLatestVersions(packages: string[]) {\n const versions: Record<string, string> = {}\n for (const pkgName of packages) {\n versions[pkgName] = pkgName in lockedDependencies ? lockedDependencies[pkgName] : 'latest'\n }\n\n const entries = await Promise.all(\n Object.entries(versions).map(async ([pkgName, range]) => {\n const version = await getLatestVersion(pkgName, {range})\n if (!version) {\n throw new Error(`Found no version for ${pkgName}`)\n }\n return [pkgName, rangeify(version)] as const\n }),\n )\n\n return Object.fromEntries(entries)\n}\n\nfunction rangeify(version: string) {\n return `^${version}`\n}\n","import fs from 'fs'\nimport path from 'path'\nimport util from 'util'\n\nimport validateNpmPackageName from 'validate-npm-package-name'\n\nimport type {InjectOptions, PackageData} from '../actions/inject'\nimport type {PackageJson, SanityPlugin} from '../actions/verify/types'\nimport {expectedScripts} from '../actions/verify/validations'\nimport {\n forcedDevPackageVersions,\n forcedPackageVersions,\n forcedPeerPackageVersions,\n} from '../configs/forced-package-versions'\nimport {cliName, requiredNodeEngine} from '../constants'\nimport {writeJsonFile} from '../util/files'\nimport {githubUrlToObject} from '../util/github-url'\nimport log from '../util/log'\nimport {resolveLatestVersions} from './resolveLatestVersions'\n\nexport interface GetPackageOptions {\n basePath: string\n validate?: boolean\n isPlugin?: boolean\n}\n\nconst defaultDependencies: string[] = []\n\nconst defaultDevDependencies = [\n 'sanity',\n\n // peer dependencies of `sanity`\n 'react',\n 'react-dom',\n 'styled-components',\n]\n\nconst defaultPeerDependencies = ['react', 'sanity']\n\nconst readFile = util.promisify(fs.readFile)\n\nexport async function getPackage(opts: GetPackageOptions): Promise<PackageJson> {\n validateOptions(opts)\n\n const {basePath, validate = true} = opts\n const manifestPath = path.normalize(path.join(basePath, 'package.json'))\n\n let content\n try {\n content = await readFile(manifestPath, 'utf8')\n } catch (err: any) {\n if (err.code === 'ENOENT') {\n throw new Error(\n `No package.json found. package.json is required to publish to npm. Use \\`${cliName} init\\` for a new plugin, or \\`npm init\\` for an existing one`,\n )\n }\n\n throw new Error(`Failed to read \"${manifestPath}\": ${err.message}`)\n }\n\n let parsed\n try {\n parsed = JSON.parse(content)\n } catch (err: any) {\n throw new Error(`Error parsing \"${manifestPath}\": ${err.message}`)\n }\n\n if (!isObject(parsed)) {\n throw new Error(`Invalid package.json: Root must be an object`)\n }\n\n if (validate) {\n validatePackage(parsed, opts)\n }\n\n return parsed\n}\n\nfunction validatePackage(manifest: PackageJson, opts: GetPackageOptions) {\n validateOptions(opts)\n\n const options = {isPlugin: true, ...opts}\n\n if (options.isPlugin) {\n validatePackageName(manifest)\n }\n\n validateLockFiles(options)\n}\n\nfunction validateOptions(opts: {basePath: string}) {\n const options = opts || {}\n if (!isObject(options)) {\n throw new Error(`Options must be an object`)\n }\n\n if (typeof options.basePath !== 'string') {\n throw new Error(`\"options.basePath\" must be a string (path to plugin base path)`)\n }\n}\n\nfunction validatePackageName(manifest: PackageJson) {\n if (typeof manifest.name !== 'string') {\n throw new Error(`Invalid package.json: \"name\" must be a string`)\n }\n\n const valid = validateNpmPackageName(manifest.name)\n if (!valid.validForNewPackages) {\n throw new Error(`Invalid package.json: \"name\" is invalid: ${(valid.errors ?? []).join(', ')}`)\n }\n\n const isScoped = manifest.name[0] === '@'\n if (!isScoped && !manifest.name.startsWith('sanity-plugin-')) {\n throw new Error(\n `Invalid package.json: \"name\" should be prefixed with \"sanity-plugin-\" (or scoped - @your-company/plugin-name)`,\n )\n }\n}\n\nfunction isObject(obj: unknown): obj is Record<string, unknown> {\n return !Array.isArray(obj) && obj !== null && typeof obj === 'object'\n}\n\nfunction validateLockFiles(options: {basePath: string}) {\n const npm = fs.existsSync(path.join(options.basePath, 'package-lock.json'))\n const yarn = fs.existsSync(path.join(options.basePath, 'yarn.lock'))\n if (npm && yarn) {\n throw new Error(`Invalid plugin: contains both package-lock.json and yarn.lock`)\n }\n}\n\nexport async function writePackageJson(data: PackageData, options: InjectOptions) {\n const {user, pluginName, license, description, pkg: prevPkg, gitOrigin} = data\n const {\n outDir,\n peerDependencies: addPeers,\n dependencies: addDeps,\n devDependencies: addDevDeps,\n } = options\n const {flags} = options\n const prev = prevPkg || {}\n\n const useOxfmt = flags.oxfmt !== false\n const useOxlint = flags.oxlint !== false\n const useTypescript = flags.typescript !== false\n\n const newDevDependencies = [cliName, '@sanity/pkg-utils']\n\n if (useTypescript) {\n log.debug('Using TypeScript. Adding to dev dependencies.')\n newDevDependencies.push('@types/react', 'typescript')\n }\n\n if (useOxfmt) {\n log.debug('Using oxfmt. Adding to dev dependencies.')\n newDevDependencies.push('oxfmt')\n }\n\n if (useOxlint) {\n log.debug('Using oxlint. Adding to dev dependencies.')\n // oxlint-tsgolint powers the type-aware rules and type checking enabled in the shared config\n newDevDependencies.push('oxlint', 'oxlint-tsgolint')\n }\n\n log.debug('Resolving latest versions for %s', newDevDependencies.join(', '))\n const dependencies = forceDependencyVersions(\n {\n ...(prev.dependencies || {}),\n ...(addDeps || {}),\n ...(await resolveLatestVersions(defaultDependencies)),\n },\n forcedPackageVersions,\n )\n const devDependencies = forceDependencyVersions(\n {\n ...(addDevDeps || {}),\n ...(prev.devDependencies || {}),\n ...(await resolveLatestVersions([...newDevDependencies, ...defaultDevDependencies])),\n },\n forcedDevPackageVersions,\n )\n const peerDependencies = forceDependencyVersions(\n {\n ...(prev.peerDependencies || {}),\n ...(addPeers || {}),\n ...(await resolveLatestVersions(defaultPeerDependencies)),\n },\n forcedPeerPackageVersions,\n )\n\n const source = flags.typescript ? './src/index.ts' : './src/index.js'\n\n const files = [outDir]\n\n // sort alphabetically for scanability\n files.sort()\n\n // Opting out of oxfmt/oxlint must also disable the corresponding verify-package checks,\n // otherwise the scaffolded `build` script (which runs verify-package) fails out of the box\n const verifyPackageOptOuts = {\n ...(useOxfmt ? {} : {oxfmt: false}),\n ...(useOxlint ? {} : {oxlint: false}),\n }\n const prevSanityPlugin: SanityPlugin = prev.sanityPlugin ?? {}\n const sanityPlugin: SanityPlugin | undefined = Object.keys(verifyPackageOptOuts).length\n ? {\n ...prevSanityPlugin,\n verifyPackage: {...prevSanityPlugin.verifyPackage, ...verifyPackageOptOuts},\n }\n : prev.sanityPlugin\n\n // order should be compatible with oxfmt's sortPackageJson\n const forcedOrder = {\n name: pluginName,\n version: prev.version ?? '1.0.0',\n description: description || '',\n keywords: prev.keywords ?? ['sanity', 'sanity-plugin'],\n ...urlsFromOrigin(gitOrigin),\n ...repoFromOrigin(gitOrigin),\n license: license ? license.id : 'UNLICENSED',\n author: user?.email ? `${user.name} <${user.email}>` : user?.name,\n sideEffects: false,\n type: 'module',\n exports: {\n '.': {\n source,\n default: `./${outDir}/index.js`,\n },\n './package.json': './package.json',\n },\n ...(flags.typescript ? {types: `./${outDir}/index.d.ts`} : {}),\n files,\n scripts: {...prev.scripts},\n dependencies: sortKeys(dependencies),\n devDependencies: sortKeys(devDependencies),\n peerDependencies: sortKeys(peerDependencies),\n engines: {\n node: requiredNodeEngine,\n },\n ...(sanityPlugin ? {sanityPlugin} : {}),\n }\n\n const manifest: PackageJson = {\n ...forcedOrder,\n // Use already configured values by default (if not otherwise specified)\n ...(prev || {}),\n // We're de-declaring properties because of key order in package.json\n ...forcedOrder,\n }\n\n const differs = JSON.stringify(prev) !== JSON.stringify(manifest)\n log.debug('Does manifest differ? %s', differs ? 'yes' : 'no')\n if (differs) {\n await writePackageJsonDirect(manifest, options)\n }\n\n return differs ? manifest : prev\n}\n\nfunction urlsFromOrigin(gitOrigin?: string): {bugs?: {url: string}; homepage?: string} {\n if (!gitOrigin) {\n return {}\n }\n\n const details = githubUrlToObject(gitOrigin)\n if (!details) {\n return {}\n }\n\n return {\n homepage: `https://github.com/${details.user}/${details.repo}#readme`,\n bugs: {\n url: `https://github.com/${details.user}/${details.repo}/issues`,\n },\n }\n}\n\nfunction repoFromOrigin(gitOrigin?: string) {\n if (!gitOrigin) {\n return {}\n }\n\n return {\n repository: {\n type: 'git',\n url: gitOrigin,\n },\n }\n}\n\nexport function addScript(cmd: string, existing: string) {\n if (existing && existing.includes(cmd)) {\n return existing\n }\n\n return cmd\n}\n\nexport async function addPackageJsonScripts(\n manifest: PackageJson,\n options: InjectOptions,\n updateScripts: (currentScripts: Record<string, string>) => Record<string, string>,\n) {\n const originalScripts = manifest.scripts || {}\n const scripts = updateScripts({...originalScripts})\n\n const differs = Object.keys(scripts).some((key) => scripts[key] !== originalScripts[key])\n\n if (differs) {\n await writePackageJsonDirect({...manifest, scripts}, options)\n }\n\n return differs\n}\n\nexport async function writePackageJsonDirect(manifest: PackageJson, {basePath}: InjectOptions) {\n await writeJsonFile(path.join(basePath, 'package.json'), manifest)\n}\n\nexport async function addBuildScripts(manifest: PackageJson, options: InjectOptions) {\n if (!options.flags.scripts) {\n return false\n }\n return addPackageJsonScripts(manifest, options, (scripts) => {\n scripts.build = addScript(expectedScripts.build, scripts.build)\n if (options.flags.oxfmt !== false) {\n scripts.format = addScript(`oxfmt`, scripts.format)\n }\n scripts['link-watch'] = addScript(expectedScripts['link-watch'], scripts['link-watch'])\n if (options.flags.oxlint !== false) {\n scripts.lint = addScript(`oxlint`, scripts.lint)\n }\n scripts.prepublishOnly = addScript(expectedScripts.prepublishOnly, scripts.prepublishOnly)\n scripts.watch = addScript(expectedScripts.watch, scripts.watch)\n return scripts\n })\n}\n\nexport function sortKeys<T extends Record<string, unknown>>(unordered: T): T {\n return Object.keys(unordered)\n .sort()\n .reduce((obj, key) => {\n // @ts-expect-error this WILL work\n obj[key] = unordered[key]\n return obj\n }, {} as T)\n}\n\n/** @internal */\nexport function forceDependencyVersions(\n deps: Record<string, string>,\n versions = forcedPackageVersions,\n): Record<string, string> {\n const entries = Object.entries(deps).map((entry) => {\n const [pkg] = entry\n const forceVersion = versions[pkg as keyof typeof versions]\n if (forceVersion) {\n return [pkg, forceVersion]\n }\n return entry\n })\n return Object.fromEntries(entries)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAgB,QAAQ,SAA+B,GAAG,QAA2B;CACnF,IAAM,QAAQ,QAAQ,EAAE,CAAC,MAAM,sCAAsC,GAC/D,mBAAmB,QAAQ,M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UAAU,MACd,MACN,CAAC,CAAM;AACd;;AAGA,SAAgB,wBACd,MACA,WAAW,uBACa;CACxB,IAAM,UAAU,OAAO,QAAQ,IAAI,CAAC,CAAC,KAAK,UAAU;EAClD,IAAM,CAAC,OAAO,OACR,eAAe,SAAS;EAI9B,OAHI,eACK,CAAC,KAAK,YAAY,IAEpB;CACT,CAAC;CACD,OAAO,OAAO,YAAY,OAAO;AACnC"}
\ No newline at end of file Index: package/dist/index.d.ts
===================================================================
--- package/dist/index.d.ts
+++ package/dist/index.d.ts
@@ -1,4 +1,3 @@
/** @public */
-declare function cliEntry(argv?: string[]): Promise<void>;
-export { cliEntry };
+export declare function cliEntry(argv?: string[]): Promise<void>;
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file