sanity 3.77.3-server-side-schemas.15 → 3.77.3-server-side-schemas.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/lib/_chunks-cjs/_internal.js +420 -142
  2. package/lib/_chunks-cjs/_internal.js.map +1 -1
  3. package/lib/_chunks-cjs/buildAction.js +2 -2
  4. package/lib/_chunks-cjs/buildAction.js.map +1 -1
  5. package/lib/_chunks-cjs/deleteSchemaAction.js +6 -4
  6. package/lib/_chunks-cjs/deleteSchemaAction.js.map +1 -1
  7. package/lib/_chunks-cjs/deployAction.js +3 -3
  8. package/lib/_chunks-cjs/deployAction.js.map +1 -1
  9. package/lib/_chunks-cjs/devAction.js +2 -2
  10. package/lib/_chunks-cjs/devAction.js.map +1 -1
  11. package/lib/_chunks-cjs/version.js +1 -1
  12. package/lib/_chunks-es/version.mjs +1 -1
  13. package/lib/_legacy/version.esm.js +1 -1
  14. package/lib/index.d.mts +3 -3
  15. package/lib/index.d.ts +3 -3
  16. package/lib/structure.d.mts +1 -1
  17. package/lib/structure.d.ts +1 -1
  18. package/package.json +10 -10
  19. package/src/_internal/cli/actions/manifest/extractManifestAction.ts +3 -3
  20. package/src/_internal/cli/actions/schema/deleteSchemaAction.ts +16 -7
  21. package/src/_internal/cli/actions/schema/schemaListAction.ts +23 -9
  22. package/src/_internal/cli/actions/schema/storeSchemasAction.ts +60 -13
  23. package/src/_internal/cli/commands/app/deployCommand.ts +2 -0
  24. package/src/_internal/cli/commands/index.ts +12 -4
  25. package/src/_internal/cli/commands/schema/deleteSchemaCommand.ts +1 -1
  26. package/src/_internal/cli/commands/schema/schemaListCommand.ts +1 -1
  27. package/src/_internal/cli/commands/schema/storeSchemaCommand.ts +6 -5
  28. package/lib/_chunks-cjs/extractManifestAction.js +0 -99
  29. package/lib/_chunks-cjs/extractManifestAction.js.map +0 -1
  30. package/lib/_chunks-cjs/storeSchemasAction.js +0 -147
  31. package/lib/_chunks-cjs/storeSchemasAction.js.map +0 -1
  32. package/lib/_chunks-cjs/timing.js +0 -22
  33. package/lib/_chunks-cjs/timing.js.map +0 -1
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
18
18
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
19
19
  mod
20
20
  ));
21
- var path = require("node:path"), chalk = require("chalk"), logSymbols = require("log-symbols"), semver = require("semver"), telemetry = require("@sanity/telemetry"), rimraf = require("rimraf"), previewServer = require("./previewServer.js"), runtime = require("./runtime.js"), checkRequiredDependencies = require("./checkRequiredDependencies.js"), timing = require("./timing.js"), fs = require("node:fs"), resolveFrom = require("resolve-from");
21
+ var path = require("node:path"), chalk = require("chalk"), logSymbols = require("log-symbols"), semver = require("semver"), telemetry = require("@sanity/telemetry"), rimraf = require("rimraf"), previewServer = require("./previewServer.js"), runtime = require("./runtime.js"), checkRequiredDependencies = require("./checkRequiredDependencies.js"), _internal = require("./_internal.js"), fs = require("node:fs"), resolveFrom = require("resolve-from");
22
22
  function _interopDefaultCompat(e) {
23
23
  return e && typeof e == "object" && "default" in e ? e : { default: e };
24
24
  }
@@ -207,7 +207,7 @@ function shouldAutoUpdate({
207
207
  return "auto-updates" in flags ? !!flags["auto-updates"] : cliConfig && "autoUpdates" in cliConfig ? !!cliConfig.autoUpdates : !1;
208
208
  }
209
209
  async function buildSanityStudio(args, context, overrides) {
210
- const timer = timing.getTimer(), {
210
+ const timer = _internal.getTimer(), {
211
211
  output,
212
212
  prompt,
213
213
  workDir,
@@ -1 +1 @@
1
- {"version":3,"file":"buildAction.js","sources":["../../src/_internal/cli/actions/build/build.telemetry.ts","../../src/_internal/cli/server/buildVendorDependencies.ts","../../src/_internal/cli/util/compareStudioDependencyVersions.ts","../../src/_internal/cli/util/getAutoUpdatesImportMap.ts","../../src/_internal/cli/util/shouldAutoUpdate.ts","../../src/_internal/cli/actions/build/buildAction.ts"],"sourcesContent":["import {defineTrace} from '@sanity/telemetry'\n\nexport const BuildTrace = defineTrace<{outputSize: number}>({\n name: 'Studio Build Completed',\n version: 0,\n description: 'A Studio build completed',\n})\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport resolveFrom from 'resolve-from'\nimport semver from 'semver'\n\nimport {createExternalFromImportMap} from './createExternalFromImportMap'\n\n// Directory where vendor packages will be stored\nconst VENDOR_DIR = 'vendor'\n\n/**\n * A type representing the imports of vendor packages, defining specific entry\n * points for various versions and subpaths of the packages.\n *\n * The `VendorImports` object is used to build ESM browser-compatible versions\n * of the specified packages. This approach ensures that the appropriate version\n * and entry points are used for each package, enabling compatibility and proper\n * functionality in the browser environment.\n *\n * ## Rationale\n *\n * The rationale for this structure is to handle different versions of the\n * packages carefully, especially major versions. Major version bumps often\n * introduce breaking changes, so the module scheme for the package needs to be\n * checked when there is a major version update. However, minor and patch\n * versions are generally backward compatible, so they are handled more\n * leniently. By assuming that new minor versions are compatible, we avoid\n * unnecessary warnings and streamline the update process.\n *\n * If a new minor version introduces an additional subpath export within the\n * package of this version range, the corresponding package can add a more\n * specific version range that includes the new subpath. This design allows for\n * flexibility and ease of maintenance, ensuring that the latest features and\n * fixes are incorporated without extensive manual intervention.\n *\n * An additional subpath export within the package of this version range that\n * could cause the build to break if that new export is used, can be treated as\n * a bug fix. It might make more sense to our users that this new subpath isn't\n * supported yet until we address it as a bug fix. This approach helps maintain\n * stability and prevents unexpected issues during the build process.\n *\n * ## Structure\n * The `VendorImports` type is a nested object where:\n * - The keys at the first level represent the package names.\n * - The keys at the second level represent the version ranges (e.g., `^19.0.0`).\n * - The keys at the third level represent the subpaths within the package (e.g., `.` for the main entry point).\n * - The values at the third level are the relative paths to the corresponding entry points within the package.\n *\n * This structure allows for precise specification of the entry points for\n * different versions and subpaths, ensuring that the correct files are used\n * during the build process.\n */\ntype VendorImports = {\n [packageName: string]: {\n [versionRange: string]: {\n [subpath: string]: string\n }\n }\n}\n\n// Define the vendor packages and their corresponding versions and entry points\nconst VENDOR_IMPORTS: VendorImports = {\n 'react': {\n '^19.0.0': {\n '.': './cjs/react.production.js',\n './jsx-runtime': './cjs/react-jsx-runtime.production.js',\n './jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.js',\n './compiler-runtime': './cjs/react-compiler-runtime.production.js',\n './package.json': './package.json',\n },\n '^18.0.0': {\n '.': './cjs/react.production.min.js',\n './jsx-runtime': './cjs/react-jsx-runtime.production.min.js',\n './jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.min.js',\n './package.json': './package.json',\n },\n },\n 'react-dom': {\n '^19.0.0': {\n '.': './cjs/react-dom.production.js',\n './client': './cjs/react-dom-client.production.js',\n './server': './cjs/react-dom-server-legacy.browser.production.js',\n './server.browser': './cjs/react-dom-server-legacy.browser.production.js',\n './static': './cjs/react-dom-server.browser.production.js',\n './static.browser': './cjs/react-dom-server.browser.production.js',\n './package.json': './package.json',\n },\n '^18.0.0': {\n '.': './cjs/react-dom.production.min.js',\n './client': './cjs/react-dom.production.min.js',\n './server': './cjs/react-dom-server-legacy.browser.production.min.js',\n './server.browser': './cjs/react-dom-server-legacy.browser.production.min.js',\n './package.json': './package.json',\n },\n },\n 'styled-components': {\n '^6.1.0': {\n '.': './dist/styled-components.esm.js',\n './package.json': './package.json',\n },\n },\n}\n\ninterface VendorBuildOptions {\n cwd: string\n outputDir: string\n basePath: string\n}\n\n/**\n * Builds the ESM browser compatible versions of the vendor packages\n * specified in VENDOR_IMPORTS. Returns the `imports` object of an import map.\n */\nexport async function buildVendorDependencies({\n cwd,\n outputDir,\n basePath,\n}: VendorBuildOptions): Promise<Record<string, string>> {\n // normalize the CWD to a relative dir for better error messages\n const dir = path.relative(process.cwd(), path.resolve(cwd))\n const entry: Record<string, string> = {}\n const imports: Record<string, string> = {}\n\n // Iterate over each package and its version ranges in VENDOR_IMPORTS\n for (const [packageName, ranges] of Object.entries(VENDOR_IMPORTS)) {\n const packageJsonPath = resolveFrom.silent(cwd, path.join(packageName, 'package.json'))\n if (!packageJsonPath) {\n throw new Error(\n `Could not find package.json for package '${packageName}' from directory '${dir}'. Is it installed?`,\n )\n }\n\n let packageJson\n\n try {\n // Read and parse the package.json file\n packageJson = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf-8'))\n } catch (e) {\n const message = `Could not read package.json for package '${packageName}' from directory '${dir}'`\n if (typeof e?.message === 'string') {\n // Re-assign the error message so the stack trace is more visible\n e.message = `${message}: ${e.message}`\n throw e\n }\n\n throw new Error(message, {cause: e})\n }\n\n // Coerce the version to a semver-compatible version\n const version = semver.coerce(packageJson.version)?.version\n if (!version) {\n throw new Error(`Could not parse version '${packageJson.version}' from '${packageName}'`)\n }\n\n // Sort version ranges in descending order\n const sortedRanges = Object.keys(ranges).sort((range1, range2) => {\n const min1 = semver.minVersion(range1)\n const min2 = semver.minVersion(range2)\n\n if (!min1) throw new Error(`Could not parse range '${range1}'`)\n if (!min2) throw new Error(`Could not parse range '${range2}'`)\n\n // sort them in reverse so we can rely on array `.find` below\n return semver.rcompare(min1.version, min2.version)\n })\n\n // Find the first version range that satisfies the package version\n const matchedRange = sortedRanges.find((range) => semver.satisfies(version, range))\n\n if (!matchedRange) {\n const min = semver.minVersion(sortedRanges[sortedRanges.length - 1])\n if (!min) {\n throw new Error(`Could not find a minimum version for package '${packageName}'`)\n }\n\n if (semver.gt(min.version, version)) {\n throw new Error(`Package '${packageName}' requires at least ${min.version}.`)\n }\n\n throw new Error(`Version '${version}' of package '${packageName}' is not supported yet.`)\n }\n\n const subpaths = ranges[matchedRange]\n\n // Iterate over each subpath and its corresponding entry point\n for (const [subpath, relativeEntryPoint] of Object.entries(subpaths)) {\n const packagePath = path.dirname(packageJsonPath)\n const entryPoint = resolveFrom.silent(packagePath, relativeEntryPoint)\n\n if (!entryPoint) {\n throw new Error(\n `Failed to resolve entry point '${path.join(packageName, relativeEntryPoint)}'. `,\n )\n }\n\n const specifier = path.posix.join(packageName, subpath)\n const chunkName = path.posix.join(\n packageName,\n path.relative(packageName, specifier) || 'index',\n )\n\n entry[chunkName] = entryPoint\n imports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, `${chunkName}.mjs`)\n }\n }\n\n // removes the `RollupWatcher` type\n type BuildResult = Exclude<Awaited<ReturnType<typeof build>>, {close: unknown}>\n\n const {build} = await import('vite')\n // Use Vite to build the packages into the output directory\n let buildResult = (await build({\n // Define a custom cache directory so that sanity's vite cache\n // does not conflict with any potential local vite projects\n cacheDir: 'node_modules/.sanity/vite-vendor',\n root: cwd,\n configFile: false,\n logLevel: 'silent',\n\n appType: 'custom',\n mode: 'production',\n define: {'process.env.NODE_ENV': JSON.stringify('production')},\n\n build: {\n commonjsOptions: {strictRequires: 'auto'},\n minify: true,\n emptyOutDir: false, // Rely on CLI to do this\n outDir: path.join(outputDir, VENDOR_DIR),\n lib: {entry, formats: ['es']},\n rollupOptions: {\n external: createExternalFromImportMap({imports}),\n output: {\n entryFileNames: '[name]-[hash].mjs',\n chunkFileNames: '[name]-[hash].mjs',\n exports: 'named',\n format: 'es',\n },\n treeshake: {preset: 'recommended'},\n },\n },\n })) as BuildResult\n\n buildResult = Array.isArray(buildResult) ? buildResult : [buildResult]\n\n // Create a map of the original import specifiers to their hashed filenames\n const hashedImports: Record<string, string> = {}\n const output = buildResult.flatMap((i) => i.output)\n\n for (const chunk of output) {\n if (chunk.type === 'asset') continue\n\n for (const [specifier, originalPath] of Object.entries(imports)) {\n if (originalPath.endsWith(`${chunk.name}.mjs`)) {\n hashedImports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, chunk.fileName)\n }\n }\n }\n\n return hashedImports\n}\n","import path from 'node:path'\n\nimport resolveFrom from 'resolve-from'\nimport semver from 'semver'\n\nimport {type AutoUpdatesImportMap} from './getAutoUpdatesImportMap'\nimport {readPackageJson} from './readPackageJson'\n\nasync function getRemoteResolvedVersion(fetchFn: typeof fetch, url: string) {\n try {\n const res = await fetchFn(url, {method: 'HEAD', redirect: 'manual'})\n return res.headers.get('x-resolved-version')\n } catch (err) {\n throw new Error(`Failed to fetch remote version for ${url}: ${err.message}`)\n }\n}\n\ninterface CompareStudioDependencyVersions {\n pkg: string\n installed: string\n remote: string\n}\n\n/**\n * Compares the versions of dependencies in the studio with their remote versions.\n *\n * This function reads the package.json file in the provided working directory, and compares the versions of the dependencies\n * specified in the `autoUpdatesImports` parameter with their remote versions. If the versions do not match, the dependency is\n * added to a list of failed dependencies, which is returned by the function.\n *\n * The failed dependencies are anything that does not strictly match the remote version.\n * This means that if a version is lower or greater by even a patch it will be marked as failed.\n *\n * @param autoUpdatesImports - An object mapping package names to their remote import URLs.\n * @param workDir - The path to the working directory containing the package.json file.\n * @param fetchFn - Optional {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch}-compatible function to use for requesting the current remote version of a module\n *\n * @returns A promise that resolves to an array of objects, each containing\n * the name of a package whose local and remote versions do not match, along with the local and remote versions.\n *\n * @throws Throws an error if the remote version of a package cannot be fetched, or if the local version of a package\n * cannot be parsed.\n */\nexport async function compareStudioDependencyVersions(\n autoUpdatesImports: AutoUpdatesImportMap,\n workDir: string,\n fetchFn = globalThis.fetch,\n): Promise<Array<CompareStudioDependencyVersions>> {\n const manifest = readPackageJson(path.join(workDir, 'package.json'))\n const dependencies = {...manifest.dependencies, ...manifest.devDependencies}\n\n const failedDependencies: Array<CompareStudioDependencyVersions> = []\n\n // Filter out the packages that are wildcards in the import map\n const filteredAutoUpdatesImports = Object.entries(autoUpdatesImports).filter(\n ([pkg]) => !pkg.endsWith('/'),\n ) as Array<[string, string]>\n\n for (const [pkg, value] of filteredAutoUpdatesImports) {\n const resolvedVersion = await getRemoteResolvedVersion(fetchFn, value)\n\n if (!resolvedVersion) {\n throw new Error(`Failed to fetch remote version for ${value}`)\n }\n\n const dependency = dependencies[pkg]\n const manifestPath = resolveFrom.silent(workDir, path.join(pkg, 'package.json'))\n\n const installed = semver.coerce(\n manifestPath ? readPackageJson(manifestPath).version : dependency,\n )\n\n if (!installed) {\n throw new Error(`Failed to parse installed version for ${pkg}`)\n }\n\n if (!semver.eq(resolvedVersion, installed.version)) {\n failedDependencies.push({pkg, installed: installed.version, remote: resolvedVersion})\n }\n }\n\n return failedDependencies\n}\n","/**\n * @internal\n */\nexport interface AutoUpdatesImportMap {\n 'sanity': string\n 'sanity/': string\n '@sanity/vision': string\n '@sanity/vision/': string\n}\n\nconst MODULES_HOST =\n process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://sanity-cdn.work'\n : 'https://sanity-cdn.com'\n\n/**\n * @internal\n */\nexport function getAutoUpdateImportMap(version: string): AutoUpdatesImportMap {\n const timestamp = `t${Math.floor(Date.now() / 1000)}`\n\n const autoUpdatesImports = {\n 'sanity': `${MODULES_HOST}/v1/modules/sanity/default/${version}/${timestamp}`,\n 'sanity/': `${MODULES_HOST}/v1/modules/sanity/default/${version}/${timestamp}/`,\n '@sanity/vision': `${MODULES_HOST}/v1/modules/@sanity__vision/default/${version}/${timestamp}`,\n '@sanity/vision/': `${MODULES_HOST}/v1/modules/@sanity__vision/default/${version}/${timestamp}/`,\n }\n\n return autoUpdatesImports\n}\n","import {type CliConfig} from '@sanity/cli'\n\nimport {type BuildSanityStudioCommandFlags} from '../actions/build/buildAction'\n\ninterface AutoUpdateSources {\n flags: BuildSanityStudioCommandFlags\n cliConfig?: CliConfig\n}\n\n/**\n * Compares parameters from various sources to determine whether or not to auto-update\n * @param sources - The sources of the auto-update parameter, including CLI flags and the CLI config\n * @returns boolean\n * @internal\n */\nexport function shouldAutoUpdate({flags, cliConfig}: AutoUpdateSources): boolean {\n // cli flags (for example, '--no-auto-updates') should take precedence\n if ('auto-updates' in flags) {\n return Boolean(flags['auto-updates'])\n }\n\n if (cliConfig && 'autoUpdates' in cliConfig) {\n return Boolean(cliConfig.autoUpdates)\n }\n\n return false\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport {info} from 'log-symbols'\nimport semver from 'semver'\nimport {noopLogger} from '@sanity/telemetry'\nimport {rimraf} from 'rimraf'\nimport type {CliCommandArguments, CliCommandContext} from '@sanity/cli'\n\nimport {buildStaticFiles, ChunkModule, ChunkStats} from '../../server'\nimport {checkStudioDependencyVersions} from '../../util/checkStudioDependencyVersions'\nimport {checkRequiredDependencies} from '../../util/checkRequiredDependencies'\nimport {getTimer} from '../../util/timing'\nimport {BuildTrace} from './build.telemetry'\nimport {buildVendorDependencies} from '../../server/buildVendorDependencies'\nimport {compareStudioDependencyVersions} from '../../util/compareStudioDependencyVersions'\nimport {getAutoUpdateImportMap} from '../../util/getAutoUpdatesImportMap'\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\n\nexport interface BuildSanityStudioCommandFlags {\n 'yes'?: boolean\n 'y'?: boolean\n 'minify'?: boolean\n 'stats'?: boolean\n 'source-maps'?: boolean\n 'auto-updates'?: boolean\n}\n\nexport default async function buildSanityStudio(\n args: CliCommandArguments<BuildSanityStudioCommandFlags>,\n context: CliCommandContext,\n overrides?: {basePath?: string},\n): Promise<{didCompile: boolean}> {\n const timer = getTimer()\n const {output, prompt, workDir, cliConfig, telemetry = noopLogger} = context\n const flags: BuildSanityStudioCommandFlags = {\n 'minify': true,\n 'stats': false,\n 'source-maps': false,\n ...args.extOptions,\n }\n\n /**\n * Unattended mode means that if there are any prompts it will use `YES` for them but will no change anything that doesn't have a prompt\n */\n const unattendedMode = Boolean(flags.yes || flags.y)\n const defaultOutputDir = path.resolve(path.join(workDir, 'dist'))\n const outputDir = path.resolve(args.argsWithoutOptions[0] || defaultOutputDir)\n const isCoreApp = cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n\n await checkStudioDependencyVersions(workDir)\n\n // If the check resulted in a dependency install, the CLI command will be re-run,\n // thus we want to exit early\n const {didInstall, installedSanityVersion} = await checkRequiredDependencies(context)\n if (didInstall) {\n return {didCompile: false}\n }\n\n const autoUpdatesEnabled = shouldAutoUpdate({flags, cliConfig})\n\n // Get the version without any tags if any\n const coercedSanityVersion = semver.coerce(installedSanityVersion)?.version\n if (autoUpdatesEnabled && !coercedSanityVersion) {\n throw new Error(`Failed to parse installed Sanity version: ${installedSanityVersion}`)\n }\n const version = encodeURIComponent(`^${coercedSanityVersion}`)\n const autoUpdatesImports = getAutoUpdateImportMap(version)\n\n if (autoUpdatesEnabled) {\n output.print(`${info} Building with auto-updates enabled`)\n\n // Check the versions\n try {\n const result = await compareStudioDependencyVersions(autoUpdatesImports, workDir)\n\n // If it is in unattended mode, we don't want to prompt\n if (result?.length && !unattendedMode) {\n const shouldContinue = await prompt.single({\n type: 'confirm',\n message: chalk.yellow(\n `The following local package versions are different from the versions currently served at runtime.\\n` +\n `When using auto updates, we recommend that you test locally with the same versions before deploying. \\n\\n` +\n `${result.map((mod) => ` - ${mod.pkg} (local version: ${mod.installed}, runtime version: ${mod.remote})`).join('\\n')} \\n\\n` +\n `Continue anyway?`,\n ),\n default: false,\n })\n\n if (!shouldContinue) {\n return process.exit(0)\n }\n }\n } catch (err) {\n throw err\n }\n }\n\n const envVarKeys = getSanityEnvVars()\n if (envVarKeys.length > 0) {\n output.print(\n '\\nIncluding the following environment variables as part of the JavaScript bundle:',\n )\n envVarKeys.forEach((key) => output.print(`- ${key}`))\n output.print('')\n }\n\n let shouldClean = true\n if (outputDir !== defaultOutputDir && !unattendedMode) {\n shouldClean = await prompt.single({\n type: 'confirm',\n message: `Do you want to delete the existing directory (${outputDir}) first?`,\n default: true,\n })\n }\n\n // Determine base path for built studio\n let basePath = '/'\n const envBasePath = process.env.SANITY_STUDIO_BASEPATH\n const configBasePath = cliConfig?.project?.basePath\n\n // Allow `sanity deploy` to override base path\n if (overrides?.basePath) {\n basePath = overrides.basePath\n } else if (envBasePath) {\n // Environment variable (SANITY_STUDIO_BASEPATH)\n basePath = envBasePath\n } else if (configBasePath) {\n // `sanity.cli.ts`\n basePath = configBasePath\n }\n\n if (envBasePath && configBasePath) {\n output.warn(\n `Overriding configured base path (${configBasePath}) with value from environment variable (${envBasePath})`,\n )\n }\n\n let spin\n\n if (shouldClean) {\n timer.start('cleanOutputFolder')\n spin = output.spinner('Clean output folder').start()\n await rimraf(outputDir)\n const cleanDuration = timer.end('cleanOutputFolder')\n spin.text = `Clean output folder (${cleanDuration.toFixed()}ms)`\n spin.succeed()\n }\n\n spin = output.spinner(`Build Sanity ${isCoreApp ? 'application' : 'Studio'}`).start()\n\n const trace = telemetry.trace(BuildTrace)\n trace.start()\n\n let importMap\n\n if (autoUpdatesEnabled) {\n importMap = {\n imports: {\n ...(await buildVendorDependencies({cwd: workDir, outputDir, basePath})),\n ...autoUpdatesImports,\n },\n }\n }\n\n try {\n timer.start('bundleStudio')\n\n const bundle = await buildStaticFiles({\n cwd: workDir,\n outputDir,\n basePath,\n sourceMap: Boolean(flags['source-maps']),\n minify: Boolean(flags.minify),\n vite: cliConfig && 'vite' in cliConfig ? cliConfig.vite : undefined,\n importMap,\n reactCompiler:\n cliConfig && 'reactCompiler' in cliConfig ? cliConfig.reactCompiler : undefined,\n appLocation:\n cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n ? cliConfig.__experimental_coreAppConfiguration?.appLocation\n : undefined,\n isCoreApp,\n })\n\n trace.log({\n outputSize: bundle.chunks\n .flatMap((chunk) => chunk.modules.flatMap((mod) => mod.renderedLength))\n .reduce((sum, n) => sum + n, 0),\n })\n const buildDuration = timer.end('bundleStudio')\n\n spin.text = `Build Sanity ${isCoreApp ? 'application' : 'Studio'} (${buildDuration.toFixed()}ms)`\n spin.succeed()\n\n trace.complete()\n if (flags.stats) {\n output.print('\\nLargest module files:')\n output.print(formatModuleSizes(sortModulesBySize(bundle.chunks).slice(0, 15)))\n }\n } catch (err) {\n spin.fail()\n trace.error(err)\n throw err\n }\n\n return {didCompile: true}\n}\n\n// eslint-disable-next-line no-process-env\nfunction getSanityEnvVars(env: Record<string, string | undefined> = process.env): string[] {\n return Object.keys(env).filter((key) => key.toUpperCase().startsWith('SANITY_STUDIO_'))\n}\n\nfunction sortModulesBySize(chunks: ChunkStats[]): ChunkModule[] {\n return chunks\n .flatMap((chunk) => chunk.modules)\n .sort((modA, modB) => modB.renderedLength - modA.renderedLength)\n}\n\nfunction formatModuleSizes(modules: ChunkModule[]): string {\n const lines: string[] = []\n for (const mod of modules) {\n lines.push(` - ${formatModuleName(mod.name)} (${formatSize(mod.renderedLength)})`)\n }\n\n return lines.join('\\n')\n}\n\nfunction formatModuleName(modName: string): string {\n const delimiter = '/node_modules/'\n const nodeIndex = modName.lastIndexOf(delimiter)\n return nodeIndex === -1 ? modName : modName.slice(nodeIndex + delimiter.length)\n}\n\nfunction formatSize(bytes: number): string {\n return chalk.cyan(`${(bytes / 1024).toFixed()} kB`)\n}\n"],"names":["BuildTrace","defineTrace","name","version","description","VENDOR_DIR","VENDOR_IMPORTS","buildVendorDependencies","cwd","outputDir","basePath","dir","path","relative","process","resolve","entry","imports","packageName","ranges","Object","entries","packageJsonPath","resolveFrom","silent","join","Error","packageJson","JSON","parse","fs","promises","readFile","e","message","cause","semver","coerce","sortedRanges","keys","sort","range1","range2","min1","minVersion","min2","rcompare","matchedRange","find","range","satisfies","min","length","gt","subpaths","subpath","relativeEntryPoint","packagePath","dirname","entryPoint","specifier","posix","chunkName","build","buildResult","cacheDir","root","configFile","logLevel","appType","mode","define","stringify","commonjsOptions","strictRequires","minify","emptyOutDir","outDir","lib","formats","rollupOptions","external","createExternalFromImportMap","output","entryFileNames","chunkFileNames","exports","format","treeshake","preset","Array","isArray","hashedImports","flatMap","i","chunk","type","originalPath","endsWith","fileName","getRemoteResolvedVersion","fetchFn","url","method","redirect","headers","get","err","compareStudioDependencyVersions","autoUpdatesImports","workDir","globalThis","fetch","manifest","readPackageJson","dependencies","devDependencies","failedDependencies","filteredAutoUpdatesImports","filter","pkg","value","resolvedVersion","dependency","manifestPath","installed","eq","push","remote","MODULES_HOST","env","SANITY_INTERNAL_ENV","getAutoUpdateImportMap","timestamp","Math","floor","Date","now","shouldAutoUpdate","flags","cliConfig","Boolean","autoUpdates","buildSanityStudio","args","context","overrides","timer","getTimer","prompt","telemetry","noopLogger","extOptions","unattendedMode","yes","y","defaultOutputDir","argsWithoutOptions","isCoreApp","checkStudioDependencyVersions","didInstall","installedSanityVersion","checkRequiredDependencies","didCompile","autoUpdatesEnabled","coercedSanityVersion","encodeURIComponent","print","info","result","single","chalk","yellow","map","mod","default","exit","envVarKeys","getSanityEnvVars","forEach","key","shouldClean","envBasePath","SANITY_STUDIO_BASEPATH","configBasePath","project","warn","spin","start","spinner","rimraf","cleanDuration","end","text","toFixed","succeed","trace","importMap","bundle","buildStaticFiles","sourceMap","vite","undefined","reactCompiler","appLocation","__experimental_coreAppConfiguration","log","outputSize","chunks","modules","renderedLength","reduce","sum","n","buildDuration","complete","stats","formatModuleSizes","sortModulesBySize","slice","fail","error","toUpperCase","startsWith","modA","modB","lines","formatModuleName","formatSize","modName","delimiter","nodeIndex","lastIndexOf","bytes","cyan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,aAAaC,UAAAA,YAAkC;AAAA,EAC1DC,MAAM;AAAA,EACNC,SAAS;AAAA,EACTC,aAAa;AACf,CAAC,GCGKC,aAAa,UAqDbC,iBAAgC;AAAA,EACpC,OAAS;AAAA,IACP,WAAW;AAAA,MACT,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,kBAAkB;AAAA,IACpB;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,IAAA;AAAA,EAEtB;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,MACT,KAAK;AAAA,MACL,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,IACpB;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,MACL,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,oBAA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KAAK2F,GAAG,EAAEX,OAAQ6D,CAAQA,QAAAA,IAAI0C,YAAY,EAAEC,WAAW,gBAAgB,CAAC;AACxF;AAEA,SAASL,kBAAkBV,QAAqC;AAC9D,SAAOA,OACJnH,QAASE,CAAUA,UAAAA,MAAMkH,OAAO,EAChCzK,KAAK,CAACwL,MAAMC,SAASA,KAAKf,iBAAiBc,KAAKd,cAAc;AACnE;AAEA,SAASO,kBAAkBR,SAAgC;AACzD,QAAMiB,QAAkB,CAAE;AAC1B,aAAWpD,OAAOmC;AACVlF,UAAAA,KAAK,MAAMoG,iBAAiBrD,IAAI5K,IAAI,CAAC,KAAKkO,WAAWtD,IAAIoC,cAAc,CAAC,GAAG;AAGnF,SAAOgB,MAAMzM,KAAK;AAAA,CAAI;AACxB;AAEA,SAAS0M,iBAAiBE,SAAyB;AACjD,QAAMC,YAAY,kBACZC,YAAYF,QAAQG,YAAYF,SAAS;AAC/C,SAAOC,cAAc,KAAKF,UAAUA,QAAQV,MAAMY,YAAYD,UAAUlL,MAAM;AAChF;AAEA,SAASgL,WAAWK,OAAuB;AACzC,SAAO9D,uBAAM+D,KAAK,IAAID,QAAQ,MAAMvC,SAAS,KAAK;AACpD;;;;;;;;"}
1
+ {"version":3,"file":"buildAction.js","sources":["../../src/_internal/cli/actions/build/build.telemetry.ts","../../src/_internal/cli/server/buildVendorDependencies.ts","../../src/_internal/cli/util/compareStudioDependencyVersions.ts","../../src/_internal/cli/util/getAutoUpdatesImportMap.ts","../../src/_internal/cli/util/shouldAutoUpdate.ts","../../src/_internal/cli/actions/build/buildAction.ts"],"sourcesContent":["import {defineTrace} from '@sanity/telemetry'\n\nexport const BuildTrace = defineTrace<{outputSize: number}>({\n name: 'Studio Build Completed',\n version: 0,\n description: 'A Studio build completed',\n})\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport resolveFrom from 'resolve-from'\nimport semver from 'semver'\n\nimport {createExternalFromImportMap} from './createExternalFromImportMap'\n\n// Directory where vendor packages will be stored\nconst VENDOR_DIR = 'vendor'\n\n/**\n * A type representing the imports of vendor packages, defining specific entry\n * points for various versions and subpaths of the packages.\n *\n * The `VendorImports` object is used to build ESM browser-compatible versions\n * of the specified packages. This approach ensures that the appropriate version\n * and entry points are used for each package, enabling compatibility and proper\n * functionality in the browser environment.\n *\n * ## Rationale\n *\n * The rationale for this structure is to handle different versions of the\n * packages carefully, especially major versions. Major version bumps often\n * introduce breaking changes, so the module scheme for the package needs to be\n * checked when there is a major version update. However, minor and patch\n * versions are generally backward compatible, so they are handled more\n * leniently. By assuming that new minor versions are compatible, we avoid\n * unnecessary warnings and streamline the update process.\n *\n * If a new minor version introduces an additional subpath export within the\n * package of this version range, the corresponding package can add a more\n * specific version range that includes the new subpath. This design allows for\n * flexibility and ease of maintenance, ensuring that the latest features and\n * fixes are incorporated without extensive manual intervention.\n *\n * An additional subpath export within the package of this version range that\n * could cause the build to break if that new export is used, can be treated as\n * a bug fix. It might make more sense to our users that this new subpath isn't\n * supported yet until we address it as a bug fix. This approach helps maintain\n * stability and prevents unexpected issues during the build process.\n *\n * ## Structure\n * The `VendorImports` type is a nested object where:\n * - The keys at the first level represent the package names.\n * - The keys at the second level represent the version ranges (e.g., `^19.0.0`).\n * - The keys at the third level represent the subpaths within the package (e.g., `.` for the main entry point).\n * - The values at the third level are the relative paths to the corresponding entry points within the package.\n *\n * This structure allows for precise specification of the entry points for\n * different versions and subpaths, ensuring that the correct files are used\n * during the build process.\n */\ntype VendorImports = {\n [packageName: string]: {\n [versionRange: string]: {\n [subpath: string]: string\n }\n }\n}\n\n// Define the vendor packages and their corresponding versions and entry points\nconst VENDOR_IMPORTS: VendorImports = {\n 'react': {\n '^19.0.0': {\n '.': './cjs/react.production.js',\n './jsx-runtime': './cjs/react-jsx-runtime.production.js',\n './jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.js',\n './compiler-runtime': './cjs/react-compiler-runtime.production.js',\n './package.json': './package.json',\n },\n '^18.0.0': {\n '.': './cjs/react.production.min.js',\n './jsx-runtime': './cjs/react-jsx-runtime.production.min.js',\n './jsx-dev-runtime': './cjs/react-jsx-dev-runtime.production.min.js',\n './package.json': './package.json',\n },\n },\n 'react-dom': {\n '^19.0.0': {\n '.': './cjs/react-dom.production.js',\n './client': './cjs/react-dom-client.production.js',\n './server': './cjs/react-dom-server-legacy.browser.production.js',\n './server.browser': './cjs/react-dom-server-legacy.browser.production.js',\n './static': './cjs/react-dom-server.browser.production.js',\n './static.browser': './cjs/react-dom-server.browser.production.js',\n './package.json': './package.json',\n },\n '^18.0.0': {\n '.': './cjs/react-dom.production.min.js',\n './client': './cjs/react-dom.production.min.js',\n './server': './cjs/react-dom-server-legacy.browser.production.min.js',\n './server.browser': './cjs/react-dom-server-legacy.browser.production.min.js',\n './package.json': './package.json',\n },\n },\n 'styled-components': {\n '^6.1.0': {\n '.': './dist/styled-components.esm.js',\n './package.json': './package.json',\n },\n },\n}\n\ninterface VendorBuildOptions {\n cwd: string\n outputDir: string\n basePath: string\n}\n\n/**\n * Builds the ESM browser compatible versions of the vendor packages\n * specified in VENDOR_IMPORTS. Returns the `imports` object of an import map.\n */\nexport async function buildVendorDependencies({\n cwd,\n outputDir,\n basePath,\n}: VendorBuildOptions): Promise<Record<string, string>> {\n // normalize the CWD to a relative dir for better error messages\n const dir = path.relative(process.cwd(), path.resolve(cwd))\n const entry: Record<string, string> = {}\n const imports: Record<string, string> = {}\n\n // Iterate over each package and its version ranges in VENDOR_IMPORTS\n for (const [packageName, ranges] of Object.entries(VENDOR_IMPORTS)) {\n const packageJsonPath = resolveFrom.silent(cwd, path.join(packageName, 'package.json'))\n if (!packageJsonPath) {\n throw new Error(\n `Could not find package.json for package '${packageName}' from directory '${dir}'. Is it installed?`,\n )\n }\n\n let packageJson\n\n try {\n // Read and parse the package.json file\n packageJson = JSON.parse(await fs.promises.readFile(packageJsonPath, 'utf-8'))\n } catch (e) {\n const message = `Could not read package.json for package '${packageName}' from directory '${dir}'`\n if (typeof e?.message === 'string') {\n // Re-assign the error message so the stack trace is more visible\n e.message = `${message}: ${e.message}`\n throw e\n }\n\n throw new Error(message, {cause: e})\n }\n\n // Coerce the version to a semver-compatible version\n const version = semver.coerce(packageJson.version)?.version\n if (!version) {\n throw new Error(`Could not parse version '${packageJson.version}' from '${packageName}'`)\n }\n\n // Sort version ranges in descending order\n const sortedRanges = Object.keys(ranges).sort((range1, range2) => {\n const min1 = semver.minVersion(range1)\n const min2 = semver.minVersion(range2)\n\n if (!min1) throw new Error(`Could not parse range '${range1}'`)\n if (!min2) throw new Error(`Could not parse range '${range2}'`)\n\n // sort them in reverse so we can rely on array `.find` below\n return semver.rcompare(min1.version, min2.version)\n })\n\n // Find the first version range that satisfies the package version\n const matchedRange = sortedRanges.find((range) => semver.satisfies(version, range))\n\n if (!matchedRange) {\n const min = semver.minVersion(sortedRanges[sortedRanges.length - 1])\n if (!min) {\n throw new Error(`Could not find a minimum version for package '${packageName}'`)\n }\n\n if (semver.gt(min.version, version)) {\n throw new Error(`Package '${packageName}' requires at least ${min.version}.`)\n }\n\n throw new Error(`Version '${version}' of package '${packageName}' is not supported yet.`)\n }\n\n const subpaths = ranges[matchedRange]\n\n // Iterate over each subpath and its corresponding entry point\n for (const [subpath, relativeEntryPoint] of Object.entries(subpaths)) {\n const packagePath = path.dirname(packageJsonPath)\n const entryPoint = resolveFrom.silent(packagePath, relativeEntryPoint)\n\n if (!entryPoint) {\n throw new Error(\n `Failed to resolve entry point '${path.join(packageName, relativeEntryPoint)}'. `,\n )\n }\n\n const specifier = path.posix.join(packageName, subpath)\n const chunkName = path.posix.join(\n packageName,\n path.relative(packageName, specifier) || 'index',\n )\n\n entry[chunkName] = entryPoint\n imports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, `${chunkName}.mjs`)\n }\n }\n\n // removes the `RollupWatcher` type\n type BuildResult = Exclude<Awaited<ReturnType<typeof build>>, {close: unknown}>\n\n const {build} = await import('vite')\n // Use Vite to build the packages into the output directory\n let buildResult = (await build({\n // Define a custom cache directory so that sanity's vite cache\n // does not conflict with any potential local vite projects\n cacheDir: 'node_modules/.sanity/vite-vendor',\n root: cwd,\n configFile: false,\n logLevel: 'silent',\n\n appType: 'custom',\n mode: 'production',\n define: {'process.env.NODE_ENV': JSON.stringify('production')},\n\n build: {\n commonjsOptions: {strictRequires: 'auto'},\n minify: true,\n emptyOutDir: false, // Rely on CLI to do this\n outDir: path.join(outputDir, VENDOR_DIR),\n lib: {entry, formats: ['es']},\n rollupOptions: {\n external: createExternalFromImportMap({imports}),\n output: {\n entryFileNames: '[name]-[hash].mjs',\n chunkFileNames: '[name]-[hash].mjs',\n exports: 'named',\n format: 'es',\n },\n treeshake: {preset: 'recommended'},\n },\n },\n })) as BuildResult\n\n buildResult = Array.isArray(buildResult) ? buildResult : [buildResult]\n\n // Create a map of the original import specifiers to their hashed filenames\n const hashedImports: Record<string, string> = {}\n const output = buildResult.flatMap((i) => i.output)\n\n for (const chunk of output) {\n if (chunk.type === 'asset') continue\n\n for (const [specifier, originalPath] of Object.entries(imports)) {\n if (originalPath.endsWith(`${chunk.name}.mjs`)) {\n hashedImports[specifier] = path.posix.join('/', basePath, VENDOR_DIR, chunk.fileName)\n }\n }\n }\n\n return hashedImports\n}\n","import path from 'node:path'\n\nimport resolveFrom from 'resolve-from'\nimport semver from 'semver'\n\nimport {type AutoUpdatesImportMap} from './getAutoUpdatesImportMap'\nimport {readPackageJson} from './readPackageJson'\n\nasync function getRemoteResolvedVersion(fetchFn: typeof fetch, url: string) {\n try {\n const res = await fetchFn(url, {method: 'HEAD', redirect: 'manual'})\n return res.headers.get('x-resolved-version')\n } catch (err) {\n throw new Error(`Failed to fetch remote version for ${url}: ${err.message}`)\n }\n}\n\ninterface CompareStudioDependencyVersions {\n pkg: string\n installed: string\n remote: string\n}\n\n/**\n * Compares the versions of dependencies in the studio with their remote versions.\n *\n * This function reads the package.json file in the provided working directory, and compares the versions of the dependencies\n * specified in the `autoUpdatesImports` parameter with their remote versions. If the versions do not match, the dependency is\n * added to a list of failed dependencies, which is returned by the function.\n *\n * The failed dependencies are anything that does not strictly match the remote version.\n * This means that if a version is lower or greater by even a patch it will be marked as failed.\n *\n * @param autoUpdatesImports - An object mapping package names to their remote import URLs.\n * @param workDir - The path to the working directory containing the package.json file.\n * @param fetchFn - Optional {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch}-compatible function to use for requesting the current remote version of a module\n *\n * @returns A promise that resolves to an array of objects, each containing\n * the name of a package whose local and remote versions do not match, along with the local and remote versions.\n *\n * @throws Throws an error if the remote version of a package cannot be fetched, or if the local version of a package\n * cannot be parsed.\n */\nexport async function compareStudioDependencyVersions(\n autoUpdatesImports: AutoUpdatesImportMap,\n workDir: string,\n fetchFn = globalThis.fetch,\n): Promise<Array<CompareStudioDependencyVersions>> {\n const manifest = readPackageJson(path.join(workDir, 'package.json'))\n const dependencies = {...manifest.dependencies, ...manifest.devDependencies}\n\n const failedDependencies: Array<CompareStudioDependencyVersions> = []\n\n // Filter out the packages that are wildcards in the import map\n const filteredAutoUpdatesImports = Object.entries(autoUpdatesImports).filter(\n ([pkg]) => !pkg.endsWith('/'),\n ) as Array<[string, string]>\n\n for (const [pkg, value] of filteredAutoUpdatesImports) {\n const resolvedVersion = await getRemoteResolvedVersion(fetchFn, value)\n\n if (!resolvedVersion) {\n throw new Error(`Failed to fetch remote version for ${value}`)\n }\n\n const dependency = dependencies[pkg]\n const manifestPath = resolveFrom.silent(workDir, path.join(pkg, 'package.json'))\n\n const installed = semver.coerce(\n manifestPath ? readPackageJson(manifestPath).version : dependency,\n )\n\n if (!installed) {\n throw new Error(`Failed to parse installed version for ${pkg}`)\n }\n\n if (!semver.eq(resolvedVersion, installed.version)) {\n failedDependencies.push({pkg, installed: installed.version, remote: resolvedVersion})\n }\n }\n\n return failedDependencies\n}\n","/**\n * @internal\n */\nexport interface AutoUpdatesImportMap {\n 'sanity': string\n 'sanity/': string\n '@sanity/vision': string\n '@sanity/vision/': string\n}\n\nconst MODULES_HOST =\n process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://sanity-cdn.work'\n : 'https://sanity-cdn.com'\n\n/**\n * @internal\n */\nexport function getAutoUpdateImportMap(version: string): AutoUpdatesImportMap {\n const timestamp = `t${Math.floor(Date.now() / 1000)}`\n\n const autoUpdatesImports = {\n 'sanity': `${MODULES_HOST}/v1/modules/sanity/default/${version}/${timestamp}`,\n 'sanity/': `${MODULES_HOST}/v1/modules/sanity/default/${version}/${timestamp}/`,\n '@sanity/vision': `${MODULES_HOST}/v1/modules/@sanity__vision/default/${version}/${timestamp}`,\n '@sanity/vision/': `${MODULES_HOST}/v1/modules/@sanity__vision/default/${version}/${timestamp}/`,\n }\n\n return autoUpdatesImports\n}\n","import {type CliConfig} from '@sanity/cli'\n\nimport {type BuildSanityStudioCommandFlags} from '../actions/build/buildAction'\n\ninterface AutoUpdateSources {\n flags: BuildSanityStudioCommandFlags\n cliConfig?: CliConfig\n}\n\n/**\n * Compares parameters from various sources to determine whether or not to auto-update\n * @param sources - The sources of the auto-update parameter, including CLI flags and the CLI config\n * @returns boolean\n * @internal\n */\nexport function shouldAutoUpdate({flags, cliConfig}: AutoUpdateSources): boolean {\n // cli flags (for example, '--no-auto-updates') should take precedence\n if ('auto-updates' in flags) {\n return Boolean(flags['auto-updates'])\n }\n\n if (cliConfig && 'autoUpdates' in cliConfig) {\n return Boolean(cliConfig.autoUpdates)\n }\n\n return false\n}\n","import path from 'node:path'\n\nimport chalk from 'chalk'\nimport {info} from 'log-symbols'\nimport semver from 'semver'\nimport {noopLogger} from '@sanity/telemetry'\nimport {rimraf} from 'rimraf'\nimport type {CliCommandArguments, CliCommandContext} from '@sanity/cli'\n\nimport {buildStaticFiles, ChunkModule, ChunkStats} from '../../server'\nimport {checkStudioDependencyVersions} from '../../util/checkStudioDependencyVersions'\nimport {checkRequiredDependencies} from '../../util/checkRequiredDependencies'\nimport {getTimer} from '../../util/timing'\nimport {BuildTrace} from './build.telemetry'\nimport {buildVendorDependencies} from '../../server/buildVendorDependencies'\nimport {compareStudioDependencyVersions} from '../../util/compareStudioDependencyVersions'\nimport {getAutoUpdateImportMap} from '../../util/getAutoUpdatesImportMap'\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\n\nexport interface BuildSanityStudioCommandFlags {\n 'yes'?: boolean\n 'y'?: boolean\n 'minify'?: boolean\n 'stats'?: boolean\n 'source-maps'?: boolean\n 'auto-updates'?: boolean\n}\n\nexport default async function buildSanityStudio(\n args: CliCommandArguments<BuildSanityStudioCommandFlags>,\n context: CliCommandContext,\n overrides?: {basePath?: string},\n): Promise<{didCompile: boolean}> {\n const timer = getTimer()\n const {output, prompt, workDir, cliConfig, telemetry = noopLogger} = context\n const flags: BuildSanityStudioCommandFlags = {\n 'minify': true,\n 'stats': false,\n 'source-maps': false,\n ...args.extOptions,\n }\n\n /**\n * Unattended mode means that if there are any prompts it will use `YES` for them but will no change anything that doesn't have a prompt\n */\n const unattendedMode = Boolean(flags.yes || flags.y)\n const defaultOutputDir = path.resolve(path.join(workDir, 'dist'))\n const outputDir = path.resolve(args.argsWithoutOptions[0] || defaultOutputDir)\n const isCoreApp = cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n\n await checkStudioDependencyVersions(workDir)\n\n // If the check resulted in a dependency install, the CLI command will be re-run,\n // thus we want to exit early\n const {didInstall, installedSanityVersion} = await checkRequiredDependencies(context)\n if (didInstall) {\n return {didCompile: false}\n }\n\n const autoUpdatesEnabled = shouldAutoUpdate({flags, cliConfig})\n\n // Get the version without any tags if any\n const coercedSanityVersion = semver.coerce(installedSanityVersion)?.version\n if (autoUpdatesEnabled && !coercedSanityVersion) {\n throw new Error(`Failed to parse installed Sanity version: ${installedSanityVersion}`)\n }\n const version = encodeURIComponent(`^${coercedSanityVersion}`)\n const autoUpdatesImports = getAutoUpdateImportMap(version)\n\n if (autoUpdatesEnabled) {\n output.print(`${info} Building with auto-updates enabled`)\n\n // Check the versions\n try {\n const result = await compareStudioDependencyVersions(autoUpdatesImports, workDir)\n\n // If it is in unattended mode, we don't want to prompt\n if (result?.length && !unattendedMode) {\n const shouldContinue = await prompt.single({\n type: 'confirm',\n message: chalk.yellow(\n `The following local package versions are different from the versions currently served at runtime.\\n` +\n `When using auto updates, we recommend that you test locally with the same versions before deploying. \\n\\n` +\n `${result.map((mod) => ` - ${mod.pkg} (local version: ${mod.installed}, runtime version: ${mod.remote})`).join('\\n')} \\n\\n` +\n `Continue anyway?`,\n ),\n default: false,\n })\n\n if (!shouldContinue) {\n return process.exit(0)\n }\n }\n } catch (err) {\n throw err\n }\n }\n\n const envVarKeys = getSanityEnvVars()\n if (envVarKeys.length > 0) {\n output.print(\n '\\nIncluding the following environment variables as part of the JavaScript bundle:',\n )\n envVarKeys.forEach((key) => output.print(`- ${key}`))\n output.print('')\n }\n\n let shouldClean = true\n if (outputDir !== defaultOutputDir && !unattendedMode) {\n shouldClean = await prompt.single({\n type: 'confirm',\n message: `Do you want to delete the existing directory (${outputDir}) first?`,\n default: true,\n })\n }\n\n // Determine base path for built studio\n let basePath = '/'\n const envBasePath = process.env.SANITY_STUDIO_BASEPATH\n const configBasePath = cliConfig?.project?.basePath\n\n // Allow `sanity deploy` to override base path\n if (overrides?.basePath) {\n basePath = overrides.basePath\n } else if (envBasePath) {\n // Environment variable (SANITY_STUDIO_BASEPATH)\n basePath = envBasePath\n } else if (configBasePath) {\n // `sanity.cli.ts`\n basePath = configBasePath\n }\n\n if (envBasePath && configBasePath) {\n output.warn(\n `Overriding configured base path (${configBasePath}) with value from environment variable (${envBasePath})`,\n )\n }\n\n let spin\n\n if (shouldClean) {\n timer.start('cleanOutputFolder')\n spin = output.spinner('Clean output folder').start()\n await rimraf(outputDir)\n const cleanDuration = timer.end('cleanOutputFolder')\n spin.text = `Clean output folder (${cleanDuration.toFixed()}ms)`\n spin.succeed()\n }\n\n spin = output.spinner(`Build Sanity ${isCoreApp ? 'application' : 'Studio'}`).start()\n\n const trace = telemetry.trace(BuildTrace)\n trace.start()\n\n let importMap\n\n if (autoUpdatesEnabled) {\n importMap = {\n imports: {\n ...(await buildVendorDependencies({cwd: workDir, outputDir, basePath})),\n ...autoUpdatesImports,\n },\n }\n }\n\n try {\n timer.start('bundleStudio')\n\n const bundle = await buildStaticFiles({\n cwd: workDir,\n outputDir,\n basePath,\n sourceMap: Boolean(flags['source-maps']),\n minify: Boolean(flags.minify),\n vite: cliConfig && 'vite' in cliConfig ? cliConfig.vite : undefined,\n importMap,\n reactCompiler:\n cliConfig && 'reactCompiler' in cliConfig ? cliConfig.reactCompiler : undefined,\n appLocation:\n cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n ? cliConfig.__experimental_coreAppConfiguration?.appLocation\n : undefined,\n isCoreApp,\n })\n\n trace.log({\n outputSize: bundle.chunks\n .flatMap((chunk) => chunk.modules.flatMap((mod) => mod.renderedLength))\n .reduce((sum, n) => sum + n, 0),\n })\n const buildDuration = timer.end('bundleStudio')\n\n spin.text = `Build Sanity ${isCoreApp ? 'application' : 'Studio'} (${buildDuration.toFixed()}ms)`\n spin.succeed()\n\n trace.complete()\n if (flags.stats) {\n output.print('\\nLargest module files:')\n output.print(formatModuleSizes(sortModulesBySize(bundle.chunks).slice(0, 15)))\n }\n } catch (err) {\n spin.fail()\n trace.error(err)\n throw err\n }\n\n return {didCompile: true}\n}\n\n// eslint-disable-next-line no-process-env\nfunction getSanityEnvVars(env: Record<string, string | undefined> = process.env): string[] {\n return Object.keys(env).filter((key) => key.toUpperCase().startsWith('SANITY_STUDIO_'))\n}\n\nfunction sortModulesBySize(chunks: ChunkStats[]): ChunkModule[] {\n return chunks\n .flatMap((chunk) => chunk.modules)\n .sort((modA, modB) => modB.renderedLength - modA.renderedLength)\n}\n\nfunction formatModuleSizes(modules: ChunkModule[]): string {\n const lines: string[] = []\n for (const mod of modules) {\n lines.push(` - ${formatModuleName(mod.name)} (${formatSize(mod.renderedLength)})`)\n }\n\n return lines.join('\\n')\n}\n\nfunction formatModuleName(modName: string): string {\n const delimiter = '/node_modules/'\n const nodeIndex = modName.lastIndexOf(delimiter)\n return nodeIndex === -1 ? modName : modName.slice(nodeIndex + delimiter.length)\n}\n\nfunction formatSize(bytes: number): string {\n return chalk.cyan(`${(bytes / 1024).toFixed()} kB`)\n}\n"],"names":["BuildTrace","defineTrace","name","version","description","VENDOR_DIR","VENDOR_IMPORTS","buildVendorDependencies","cwd","outputDir","basePath","dir","path","relative","process","resolve","entry","imports","packageName","ranges","Object","entries","packageJsonPath","resolveFrom","silent","join","Error","packageJson","JSON","parse","fs","promises","readFile","e","message","cause","semver","coerce","sortedRanges","keys","sort","range1","range2","min1","minVersion","min2","rcompare","matchedRange","find","range","satisfies","min","length","gt","subpaths","subpath","relativeEntryPoint","packagePath","dirname","entryPoint","specifier","posix","chunkName","build","buildResult","cacheDir","root","configFile","logLevel","appType","mode","define","stringify","commonjsOptions","strictRequires","minify","emptyOutDir","outDir","lib","formats","rollupOptions","external","createExternalFromImportMap","output","entryFileNames","chunkFileNames","exports","format","treeshake","preset","Array","isArray","hashedImports","flatMap","i","chunk","type","originalPath","endsWith","fileName","getRemoteResolvedVersion","fetchFn","url","method","redirect","headers","get","err","compareStudioDependencyVersions","autoUpdatesImports","workDir","globalThis","fetch","manifest","readPackageJson","dependencies","devDependencies","failedDependencies","filteredAutoUpdatesImports","filter","pkg","value","resolvedVersion","dependency","manifestPath","installed","eq","push","remote","MODULES_HOST","env","SANITY_INTERNAL_ENV","getAutoUpdateImportMap","timestamp","Math","floor","Date","now","shouldAutoUpdate","flags","cliConfig","Boolean","autoUpdates","buildSanityStudio","args","context","overrides","timer","getTimer","prompt","telemetry","noopLogger","extOptions","unattendedMode","yes","y","defaultOutputDir","argsWithoutOptions","isCoreApp","checkStudioDependencyVersions","didInstall","installedSanityVersion","checkRequiredDependencies","didCompile","autoUpdatesEnabled","coercedSanityVersion","encodeURIComponent","print","info","result","single","chalk","yellow","map","mod","default","exit","envVarKeys","getSanityEnvVars","forEach","key","shouldClean","envBasePath","SANITY_STUDIO_BASEPATH","configBasePath","project","warn","spin","start","spinner","rimraf","cleanDuration","end","text","toFixed","succeed","trace","importMap","bundle","buildStaticFiles","sourceMap","vite","undefined","reactCompiler","appLocation","__experimental_coreAppConfiguration","log","outputSize","chunks","modules","renderedLength","reduce","sum","n","buildDuration","complete","stats","formatModuleSizes","sortModulesBySize","slice","fail","error","toUpperCase","startsWith","modA","modB","lines","formatModuleName","formatSize","modName","delimiter","nodeIndex","lastIndexOf","bytes","cyan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,aAAaC,UAAAA,YAAkC;AAAA,EAC1DC,MAAM;AAAA,EACNC,SAAS;AAAA,EACTC,aAAa;AACf,CAAC,GCGKC,aAAa,UAqDbC,iBAAgC;AAAA,EACpC,OAAS;AAAA,IACP,WAAW;AAAA,MACT,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,kBAAkB;AAAA,IACpB;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,IAAA;AAAA,EAEtB;AAAA,EACA,aAAa;AAAA,IACX,WAAW;AAAA,MACT,KAAK;AAAA,MACL,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,IACpB;AAAA,IACA,WAAW;AAAA,MACT,KAAK;AAAA,MACL,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,IAAA;AAAA,EAEtB;AAAA,EACA,qBAAqB;AAAA,IACnB,UAAU;AAAA,MACR,KAAK;AAAA,MACL,kBAAkB;AAAA,IAAA;AAAA,EACpB;AAEJ;AAYA,eAAsBC,wBAAwB;AAAA,EAC5CC;AAAAA,EACAC;AAAAA,EACAC;AACkB,GAAoC;AAEtD,QAAMC,MA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E;AAEA,SAASO,kBAAkBR,SAAgC;AACzD,QAAMiB,QAAkB,CAAE;AAC1B,aAAWpD,OAAOmC;AACVlF,UAAAA,KAAK,MAAMoG,iBAAiBrD,IAAI5K,IAAI,CAAC,KAAKkO,WAAWtD,IAAIoC,cAAc,CAAC,GAAG;AAGnF,SAAOgB,MAAMzM,KAAK;AAAA,CAAI;AACxB;AAEA,SAAS0M,iBAAiBE,SAAyB;AACjD,QAAMC,YAAY,kBACZC,YAAYF,QAAQG,YAAYF,SAAS;AAC/C,SAAOC,cAAc,KAAKF,UAAUA,QAAQV,MAAMY,YAAYD,UAAUlL,MAAM;AAChF;AAEA,SAASgL,WAAWK,OAAuB;AACzC,SAAO9D,uBAAM+D,KAAK,IAAID,QAAQ,MAAMvC,SAAS,KAAK;AACpD;;;;;;;;"}
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
- var chalk = require("chalk"), schemaListAction = require("./storeSchemasAction.js");
2
+ var chalk = require("chalk"), _internal = require("./_internal.js");
3
3
  function _interopDefaultCompat(e) {
4
4
  return e && typeof e == "object" && "default" in e ? e : { default: e };
5
5
  }
6
6
  var chalk__default = /* @__PURE__ */ _interopDefaultCompat(chalk);
7
7
  async function deleteSchemaAction(args, context) {
8
+ if (!_internal.SCHEMA_STORE_ENABLED)
9
+ return;
8
10
  const flags = args.extOptions;
9
11
  if (typeof flags.dataset == "boolean") throw new Error("Dataset is empty");
10
12
  if (typeof flags.ids == "boolean") throw new Error("Ids are empty");
11
- if (typeof flags.path == "boolean") throw new Error("Path is empty");
13
+ if (typeof flags["manifest-dir"] == "boolean") throw new Error("Manifest directory is empty");
12
14
  const {
13
15
  apiClient,
14
16
  output
@@ -22,11 +24,11 @@ async function deleteSchemaAction(args, context) {
22
24
  output.error("Project ID must be defined.");
23
25
  return;
24
26
  }
25
- const manifestPath = schemaListAction.getManifestPath(context, flags.path), manifest = schemaListAction.readManifest(manifestPath, output), deletedCount = (await Promise.allSettled(manifest.workspaces.flatMap((workspace) => flags.dataset && workspace.dataset !== flags.dataset ? [] : schemaIds.map(async (schemaId) => {
27
+ const manifestDir = flags["manifest-dir"], manifestPath = _internal.getManifestPath(context, manifestDir), manifest = await _internal.readManifest(manifestPath, context), deletedCount = (await Promise.allSettled(manifest.workspaces.flatMap((workspace) => flags.dataset && workspace.dataset !== flags.dataset ? [] : schemaIds.map(async (schemaId) => {
26
28
  if (schemaId.split(".").at(-1) !== workspace.name && !flags.dataset)
27
29
  return !1;
28
30
  try {
29
- return schemaListAction.throwIfProjectIdMismatch(workspace, projectId), (await client.withConfig({
31
+ return _internal.throwIfProjectIdMismatch(workspace, projectId), (await client.withConfig({
30
32
  dataset: flags.dataset || workspace.dataset,
31
33
  projectId: workspace.projectId
32
34
  }).delete(schemaId.trim())).results.length ? (output.success(`Schema ${schemaId} deleted from workspace: ${workspace.name}`), !0) : !1;
@@ -1 +1 @@
1
- {"version":3,"file":"deleteSchemaAction.js","sources":["../../src/_internal/cli/actions/schema/deleteSchemaAction.ts"],"sourcesContent":["import {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport chalk from 'chalk'\n\nimport {type ManifestWorkspaceFile} from '../../../manifest/manifestTypes'\nimport {getManifestPath, readManifest, throwIfProjectIdMismatch} from './storeSchemasAction'\n\nexport interface DeleteSchemaFlags {\n ids: string\n path: string\n dataset: string\n}\n\nexport default async function deleteSchemaAction(\n args: CliCommandArguments<DeleteSchemaFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const flags = args.extOptions\n if (typeof flags.dataset === 'boolean') throw new Error('Dataset is empty')\n if (typeof flags.ids === 'boolean') throw new Error('Ids are empty')\n if (typeof flags.path === 'boolean') throw new Error('Path is empty')\n\n const {apiClient, output} = context\n\n //split ids by comma\n const schemaIds = flags.ids.split(',')\n\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n const projectId = client.config().projectId\n\n if (!projectId) {\n output.error('Project ID must be defined.')\n return\n }\n\n const manifestPath = getManifestPath(context, flags.path)\n const manifest = readManifest(manifestPath, output)\n\n const results = await Promise.allSettled(\n manifest.workspaces.flatMap((workspace: ManifestWorkspaceFile) => {\n if (flags.dataset && workspace.dataset !== flags.dataset) {\n return []\n }\n return schemaIds.map(async (schemaId) => {\n const idWorkspace = schemaId.split('.').at(-1)\n if (idWorkspace !== workspace.name && !flags.dataset) {\n return false\n }\n try {\n throwIfProjectIdMismatch(workspace, projectId)\n const deletedSchema = await client\n .withConfig({\n dataset: flags.dataset || workspace.dataset,\n projectId: workspace.projectId,\n })\n .delete(schemaId.trim())\n\n if (!deletedSchema.results.length) {\n return false\n }\n\n output.success(`Schema ${schemaId} deleted from workspace: ${workspace.name}`)\n return true\n } catch (err) {\n output.error(\n `Failed to delete schema ${schemaId} from workspace ${workspace.name}:\\n ${err.message}`,\n )\n throw err\n }\n })\n }),\n )\n\n // Log errors and collect results\n const deletedCount = results\n .map((result, index) => {\n if (result.status === 'rejected') {\n const schemaId = schemaIds[index]\n output.error(chalk.red(`Failed to delete schema '${schemaId}':\\n${result.reason.message}`))\n return false\n }\n return result.value\n })\n .filter(Boolean).length\n\n output.print(`Successfully deleted ${deletedCount} schemas`)\n}\n"],"names":["deleteSchemaAction","args","context","flags","extOptions","dataset","Error","ids","path","apiClient","output","schemaIds","split","client","requireUser","requireProject","withConfig","apiVersion","projectId","config","error","manifestPath","getManifestPath","manifest","readManifest","deletedCount","Promise","allSettled","workspaces","flatMap","workspace","map","schemaId","at","name","throwIfProjectIdMismatch","delete","trim","results","length","success","err","message","result","index","status","chalk","red","reason","value","filter","Boolean","print"],"mappings":";;;;;;AAY8BA,eAAAA,mBAC5BC,MACAC,SACe;AACf,QAAMC,QAAQF,KAAKG;AACnB,MAAI,OAAOD,MAAME,WAAY,UAAiB,OAAA,IAAIC,MAAM,kBAAkB;AAC1E,MAAI,OAAOH,MAAMI,OAAQ,UAAiB,OAAA,IAAID,MAAM,eAAe;AACnE,MAAI,OAAOH,MAAMK,QAAS,UAAiB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AClBD,QAAAA,OAAOE,WAAW,YAAY;AAC1Bb,YAAAA,WAAWrB,UAAUiC,KAAK;AAChClC,aAAAA,OAAOU,MAAM0B,eAAAA,QAAMC,IAAI,4BAA4Bf,QAAQ;AAAA,EAAOW,OAAOK,OAAON,OAAO,EAAE,CAAC,GACnF;AAAA,IAAA;AAET,WAAOC,OAAOM;AAAAA,EAAAA,CACf,EACAC,OAAOC,OAAO,EAAEZ;AAEZa,SAAAA,MAAM,wBAAwB3B,YAAY,UAAU;AAC7D;;"}
1
+ {"version":3,"file":"deleteSchemaAction.js","sources":["../../src/_internal/cli/actions/schema/deleteSchemaAction.ts"],"sourcesContent":["import {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport chalk from 'chalk'\n\nimport {type ManifestWorkspaceFile} from '../../../manifest/manifestTypes'\nimport {\n getManifestPath,\n readManifest,\n SCHEMA_STORE_ENABLED,\n throwIfProjectIdMismatch,\n} from './storeSchemasAction'\n\nexport interface DeleteSchemaFlags {\n 'ids': string\n 'manifest-dir': string\n 'dataset': string\n}\n\nexport default async function deleteSchemaAction(\n args: CliCommandArguments<DeleteSchemaFlags>,\n context: CliCommandContext,\n): Promise<void> {\n if (!SCHEMA_STORE_ENABLED) {\n return\n }\n const flags = args.extOptions\n if (typeof flags.dataset === 'boolean') throw new Error('Dataset is empty')\n if (typeof flags.ids === 'boolean') throw new Error('Ids are empty')\n if (typeof flags['manifest-dir'] === 'boolean') throw new Error('Manifest directory is empty')\n\n const {apiClient, output} = context\n\n //split ids by comma\n const schemaIds = flags.ids.split(',')\n\n const client = apiClient({\n requireUser: true,\n requireProject: true,\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n const projectId = client.config().projectId\n\n if (!projectId) {\n output.error('Project ID must be defined.')\n return\n }\n\n const manifestDir = flags['manifest-dir']\n const manifestPath = getManifestPath(context, manifestDir)\n const manifest = await readManifest(manifestPath, context)\n\n const results = await Promise.allSettled(\n manifest.workspaces.flatMap((workspace: ManifestWorkspaceFile) => {\n if (flags.dataset && workspace.dataset !== flags.dataset) {\n return []\n }\n return schemaIds.map(async (schemaId) => {\n const idWorkspace = schemaId.split('.').at(-1)\n if (idWorkspace !== workspace.name && !flags.dataset) {\n return false\n }\n try {\n throwIfProjectIdMismatch(workspace, projectId)\n const deletedSchema = await client\n .withConfig({\n dataset: flags.dataset || workspace.dataset,\n projectId: workspace.projectId,\n })\n .delete(schemaId.trim())\n\n if (!deletedSchema.results.length) {\n return false\n }\n\n output.success(`Schema ${schemaId} deleted from workspace: ${workspace.name}`)\n return true\n } catch (err) {\n output.error(\n `Failed to delete schema ${schemaId} from workspace ${workspace.name}:\\n ${err.message}`,\n )\n throw err\n }\n })\n }),\n )\n\n // Log errors and collect results\n const deletedCount = results\n .map((result, index) => {\n if (result.status === 'rejected') {\n const schemaId = schemaIds[index]\n output.error(chalk.red(`Failed to delete schema '${schemaId}':\\n${result.reason.message}`))\n return false\n }\n return result.value\n })\n .filter(Boolean).length\n\n output.print(`Successfully deleted ${deletedCount} schemas`)\n}\n"],"names":["deleteSchemaAction","args","context","SCHEMA_STORE_ENABLED","flags","extOptions","dataset","Error","ids","apiClient","output","schemaIds","split","client","requireUser","requireProject","withConfig","apiVersion","projectId","config","error","manifestDir","manifestPath","getManifestPath","manifest","readManifest","deletedCount","Promise","allSettled","workspaces","flatMap","workspace","map","schemaId","at","name","throwIfProjectIdMismatch","delete","trim","results","length","success","err","message","result","index","status","chalk","red","reason","value","filter","Boolean","print"],"mappings":";;;;;;AAiB8BA,eAAAA,mBAC5BC,MACAC,SACe;AACf,MAAI,CAACC,UAAAA;AACH;AAEF,QAAMC,QAAQH,KAAKI;AACnB,MAAI,OAAOD,MAAME,WAAY,UAAiB,OAAA,IAAIC,MAAM,kBAAkB;AAC1E,MAAI,OAAOH,MAAMI,OAAQ,UAAiB,OAAA,IAAID,MAAM,eAAe;AAC/D,MAAA,OAAOH,MAAM,cAAc,KAAM,UAAiB,OAAA,IAAIG,MAAM,6BAA6B;AAEvF,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A,OAAOE,WAAW,YAAY;AAC1Bb,YAAAA,WAAWtB,UAAUkC,KAAK;AAChCnC,aAAAA,OAAOU,MAAM2B,eAAAA,QAAMC,IAAI,4BAA4Bf,QAAQ;AAAA,EAAOW,OAAOK,OAAON,OAAO,EAAE,CAAC,GACnF;AAAA,IAAA;AAET,WAAOC,OAAOM;AAAAA,EAAAA,CACf,EACAC,OAAOC,OAAO,EAAEZ;AAEZa,SAAAA,MAAM,wBAAwB3B,YAAY,UAAU;AAC7D;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var path = require("node:path"), zlib = require("node:zlib"), tar = require("tar-fs"), buildAction = require("./buildAction.js"), extractManifestAction = require("./extractManifestAction.js"), schemaListAction = require("./storeSchemasAction.js"), helpers = require("./helpers.js");
2
+ var path = require("node:path"), zlib = require("node:zlib"), tar = require("tar-fs"), buildAction = require("./buildAction.js"), _internal = require("./_internal.js"), helpers = require("./helpers.js");
3
3
  function _interopDefaultCompat(e) {
4
4
  return e && typeof e == "object" && "default" in e ? e : { default: e };
5
5
  }
@@ -76,7 +76,7 @@ async function deployStudioAction(args, context) {
76
76
  if (!didCompile)
77
77
  return;
78
78
  if (!isCoreApp) {
79
- const extractManifestError = await extractManifestAction.extractManifestSafe({
79
+ const extractManifestError = await _internal.extractManifestSafe({
80
80
  ...buildArgs,
81
81
  extOptions: {},
82
82
  extraArguments: []
@@ -93,7 +93,7 @@ async function deployStudioAction(args, context) {
93
93
  verbose: flags.verbose
94
94
  }
95
95
  };
96
- await schemaListAction.storeSchemasAction(storeManifestSchemasArgs, context);
96
+ await _internal.storeSchemasAction(storeManifestSchemasArgs, context);
97
97
  }
98
98
  spinner = output.spinner("Verifying local content").start();
99
99
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"deployAction.js","sources":["../../src/_internal/cli/actions/deploy/deployAction.ts"],"sourcesContent":["/* eslint-disable max-statements */\nimport path from 'node:path'\nimport zlib from 'node:zlib'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport tar from 'tar-fs'\n\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\nimport buildSanityStudio, {type BuildSanityStudioCommandFlags} from '../build/buildAction'\nimport {extractManifestSafe} from '../manifest/extractManifestAction'\nimport storeManifestSchemas from '../schema/storeSchemasAction'\nimport {\n type BaseConfigOptions,\n checkDir,\n createDeployment,\n debug,\n dirIsEmptyOrNonExistent,\n getInstalledSanityVersion,\n getOrCreateCoreApplication,\n getOrCreateStudio,\n getOrCreateUserApplicationFromConfig,\n type UserApplication,\n} from './helpers'\n\nexport interface DeployStudioActionFlags extends BuildSanityStudioCommandFlags {\n 'build'?: boolean\n 'schema-required'?: boolean\n 'verbose'?: boolean\n}\n\n// eslint-disable-next-line complexity\nexport default async function deployStudioAction(\n args: CliCommandArguments<DeployStudioActionFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const {apiClient, workDir, chalk, output, prompt, cliConfig} = context\n const flags = {build: true, ...args.extOptions}\n const customSourceDir = args.argsWithoutOptions[0]\n const sourceDir = path.resolve(process.cwd(), customSourceDir || path.join(workDir, 'dist'))\n const isAutoUpdating = shouldAutoUpdate({flags, cliConfig})\n const isCoreApp = cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n\n const installedSanityVersion = await getInstalledSanityVersion()\n const configStudioHost = cliConfig && 'studioHost' in cliConfig && cliConfig.studioHost\n const appId =\n cliConfig &&\n '__experimental_coreAppConfiguration' in cliConfig &&\n cliConfig.__experimental_coreAppConfiguration?.appId\n\n const client = apiClient({\n requireUser: true,\n requireProject: !isCoreApp, // core apps are not project-specific\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n if (customSourceDir === 'graphql') {\n throw new Error('Did you mean `sanity graphql deploy`?')\n }\n\n if (customSourceDir) {\n let relativeOutput = path.relative(process.cwd(), sourceDir)\n if (relativeOutput[0] !== '.') {\n relativeOutput = `./${relativeOutput}`\n }\n\n const isEmpty = await dirIsEmptyOrNonExistent(sourceDir)\n const shouldProceed =\n isEmpty ||\n (await prompt.single({\n type: 'confirm',\n message: `\"${relativeOutput}\" is not empty, do you want to proceed?`,\n default: false,\n }))\n\n if (!shouldProceed) {\n output.print('Cancelled.')\n return\n }\n\n output.print(`Building to ${relativeOutput}\\n`)\n }\n\n // Check that the project has a studio hostname\n let spinner = output.spinner('Checking project info').start()\n\n let userApplication: UserApplication\n\n try {\n const configParams: BaseConfigOptions & {\n appHost?: string\n appId?: string\n } = {\n client,\n context,\n spinner,\n }\n\n if (isCoreApp && appId) {\n configParams.appId = appId\n } else if (configStudioHost) {\n configParams.appHost = configStudioHost\n }\n // If the user has provided a studioHost / appId in the config, use that\n if (configStudioHost || appId) {\n userApplication = await getOrCreateUserApplicationFromConfig(configParams)\n } else {\n userApplication = isCoreApp\n ? await getOrCreateCoreApplication({client, context, spinner})\n : await getOrCreateStudio({client, context, spinner})\n }\n } catch (err) {\n if (err.message) {\n output.error(chalk.red(err.message))\n return\n }\n\n debug('Error creating user application', err)\n throw err\n }\n\n // Always build the project, unless --no-build is passed\n const shouldBuild = flags.build\n if (shouldBuild) {\n const buildArgs = {\n ...args,\n extOptions: flags,\n argsWithoutOptions: [customSourceDir].filter(Boolean),\n }\n const {didCompile} = await buildSanityStudio(buildArgs, context, {basePath: '/'})\n\n if (!didCompile) {\n return\n }\n\n if (!isCoreApp) {\n const extractManifestError = await extractManifestSafe(\n {\n ...buildArgs,\n extOptions: {},\n extraArguments: [],\n },\n context,\n )\n\n if (flags['schema-required'] && extractManifestError) {\n output.error(`Schema extraction error: ${extractManifestError.message}`)\n throw extractManifestError\n }\n }\n }\n\n if (!isCoreApp) {\n const storeManifestSchemasArgs = {\n ...args,\n extOptions: {\n 'path': `${sourceDir}/static`,\n 'schema-required': flags['schema-required'],\n 'verbose': flags.verbose,\n },\n extraArguments: [],\n }\n\n await storeManifestSchemas(storeManifestSchemasArgs, context)\n }\n\n // Ensure that the directory exists, is a directory and seems to have valid content\n spinner = output.spinner('Verifying local content').start()\n try {\n await checkDir(sourceDir)\n spinner.succeed()\n } catch (err) {\n spinner.fail()\n debug('Error checking directory', err)\n throw err\n }\n\n // Now create a tarball of the given directory\n const parentDir = path.dirname(sourceDir)\n const base = path.basename(sourceDir)\n const tarball = tar.pack(parentDir, {entries: [base]}).pipe(zlib.createGzip())\n\n spinner = output.spinner(`Deploying to ${isCoreApp ? 'CORE' : 'Sanity.Studio'}`).start()\n try {\n const {location} = await createDeployment({\n client,\n applicationId: userApplication.id,\n version: installedSanityVersion,\n isAutoUpdating,\n tarball,\n isCoreApp,\n })\n\n spinner.succeed()\n\n output.print()\n\n // And let the user know we're done\n output.print(\n `\\nSuccess! ${isCoreApp ? 'Application deployed' : `Studio deployed to ${chalk.cyan(location)}`}`,\n )\n\n if ((isCoreApp && !appId) || (!isCoreApp && !configStudioHost)) {\n output.print(\n `\\nAdd ${chalk.cyan(isCoreApp ? `appId: '${userApplication.id}'` : `studioHost: '${userApplication.appHost}'`)}`,\n )\n output.print(\n `to ${isCoreApp ? '__experimental_coreAppConfiguration' : 'defineCliConfig root properties'} in sanity.cli.js or sanity.cli.ts`,\n )\n output.print(`to avoid prompting ${isCoreApp ? '' : 'for hostname'} on next deploy.`)\n }\n } catch (err) {\n spinner.fail()\n debug('Error deploying studio', err)\n throw err\n }\n}\n"],"names":["deployStudioAction","args","context","apiClient","workDir","chalk","output","prompt","cliConfig","flags","build","extOptions","customSourceDir","argsWithoutOptions","sourceDir","path","resolve","process","cwd","join","isAutoUpdating","shouldAutoUpdate","isCoreApp","installedSanityVersion","getInstalledSanityVersion","configStudioHost","studioHost","appId","__experimental_coreAppConfiguration","client","requireUser","requireProject","withConfig","apiVersion","Error","relativeOutput","relative","dirIsEmptyOrNonExistent","single","type","message","default","print","spinner","start","userApplication","configParams","appHost","getOrCreateUserApplicationFromConfig","getOrCreateCoreApplication","getOrCreateStudio","err","error","red","debug","buildArgs","filter","Boolean","didCompile","buildSanityStudio","basePath","extractManifestError","extractManifestSafe","extraArguments","storeManifestSchemasArgs","verbose","storeManifestSchemas","checkDir","succeed","fail","parentDir","dirname","base","basename","tarball","tar","pack","entries","pipe","zlib","createGzip","location","createDeployment","applicationId","id","version","cyan"],"mappings":";;;;;;AA+B8BA,eAAAA,mBAC5BC,MACAC,SACe;AACT,QAAA;AAAA,IAACC;AAAAA,IAAWC;AAAAA,IAASC;AAAAA,IAAOC;AAAAA,IAAQC;AAAAA,IAAQC;AAAAA,EAAAA,IAAaN,SACzDO,QAAQ;AAAA,IAACC,OAAO;AAAA,IAAM,GAAGT,KAAKU;AAAAA,EAAAA,GAC9BC,kBAAkBX,KAAKY,mBAAmB,CAAC,GAC3CC,YAAYC,cAAAA,QAAKC,QAAQC,QAAQC,OAAON,mBAAmBG,sBAAKI,KAAKf,SAAS,MAAM,CAAC,GACrFgB,iBAAiBC,6BAAiB;AAAA,IAACZ;AAAAA,IAAOD;AAAAA,EAAU,CAAA,GACpDc,YAAYd,aAAa,yCAAyCA,WAElEe,yBAAyB,MAAMC,kCAA0B,GACzDC,mBAAmBjB,aAAa,gBAAgBA,aAAaA,UAAUkB,YACvEC,QACJnB,aACA,yCAAyCA,aACzCA,UAAUoB,qCAAqCD,OAE3CE,SAAS1B,UAAU;AAAA,IACvB2B,aAAa;AAAA,IACbC,gBAAgB,CAACT;AAAAA;AAAAA,EAClB,CAAA,EAAEU,WAAW;AAAA,IAACC,YAAY;AAAA,EAAA,CAAc;AAEzC,MAAIrB,oBAAoB;AAChB,UAAA,IAAIsB,MAAM,uCAAuC;AAGzD,MAAItB,iBAAiB;AACnB,QAAIuB,iBAAiBpB,cAAAA,QAAKqB,SAASnB,QAAQC,OAAOJ,SAAS;AAc3D,QAbIqB,eAAe,CAAC,MAAM,QACxBA,iBAAiB,KAAKA,cAAc,KAYlC,EATY,MAAME,QAAwBvB,wBAAAA,SAAS,KAGpD,MAAMP,OAAO+B,OAAO;AAAA,MACnBC,MAAM;AAAA,MACNC,SAAS,IAAIL,cAAc;AAAA,MAC3BM,SAAS;AAAA,IACV,CAAA,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AAKL,QAAQ,CAAC,EAAE,EACjG,IAEK3D,aAAa,CAACK,SAAW,CAACL,aAAa,CAACG,sBAC3CnB,OAAOoC,MACL;AAAA,MAASrC,MAAMiF,KAAKhE,YAAY,WAAWuB,gBAAgBuC,EAAE,MAAM,gBAAgBvC,gBAAgBE,OAAO,GAAG,CAAC,EAChH,GACAzC,OAAOoC,MACL,MAAMpB,YAAY,wCAAwC,iCAAiC,oCAC7F,GACAhB,OAAOoC,MAAM,sBAAsBpB,YAAY,KAAK,cAAc,kBAAkB;AAAA,WAE/E6B,KAAK;AACZR,UAAAA,QAAQ0B,KAAK,GACbf,QAAM,MAAA,0BAA0BH,GAAG,GAC7BA;AAAAA,EAAAA;AAEV;;"}
1
+ {"version":3,"file":"deployAction.js","sources":["../../src/_internal/cli/actions/deploy/deployAction.ts"],"sourcesContent":["/* eslint-disable max-statements */\nimport path from 'node:path'\nimport zlib from 'node:zlib'\n\nimport {type CliCommandArguments, type CliCommandContext} from '@sanity/cli'\nimport tar from 'tar-fs'\n\nimport {shouldAutoUpdate} from '../../util/shouldAutoUpdate'\nimport buildSanityStudio, {type BuildSanityStudioCommandFlags} from '../build/buildAction'\nimport {extractManifestSafe} from '../manifest/extractManifestAction'\nimport storeManifestSchemas from '../schema/storeSchemasAction'\nimport {\n type BaseConfigOptions,\n checkDir,\n createDeployment,\n debug,\n dirIsEmptyOrNonExistent,\n getInstalledSanityVersion,\n getOrCreateCoreApplication,\n getOrCreateStudio,\n getOrCreateUserApplicationFromConfig,\n type UserApplication,\n} from './helpers'\n\nexport interface DeployStudioActionFlags extends BuildSanityStudioCommandFlags {\n 'build'?: boolean\n 'schema-required'?: boolean\n 'verbose'?: boolean\n}\n\n// eslint-disable-next-line complexity\nexport default async function deployStudioAction(\n args: CliCommandArguments<DeployStudioActionFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const {apiClient, workDir, chalk, output, prompt, cliConfig} = context\n const flags = {build: true, ...args.extOptions}\n const customSourceDir = args.argsWithoutOptions[0]\n const sourceDir = path.resolve(process.cwd(), customSourceDir || path.join(workDir, 'dist'))\n const isAutoUpdating = shouldAutoUpdate({flags, cliConfig})\n const isCoreApp = cliConfig && '__experimental_coreAppConfiguration' in cliConfig\n\n const installedSanityVersion = await getInstalledSanityVersion()\n const configStudioHost = cliConfig && 'studioHost' in cliConfig && cliConfig.studioHost\n const appId =\n cliConfig &&\n '__experimental_coreAppConfiguration' in cliConfig &&\n cliConfig.__experimental_coreAppConfiguration?.appId\n\n const client = apiClient({\n requireUser: true,\n requireProject: !isCoreApp, // core apps are not project-specific\n }).withConfig({apiVersion: 'v2024-08-01'})\n\n if (customSourceDir === 'graphql') {\n throw new Error('Did you mean `sanity graphql deploy`?')\n }\n\n if (customSourceDir) {\n let relativeOutput = path.relative(process.cwd(), sourceDir)\n if (relativeOutput[0] !== '.') {\n relativeOutput = `./${relativeOutput}`\n }\n\n const isEmpty = await dirIsEmptyOrNonExistent(sourceDir)\n const shouldProceed =\n isEmpty ||\n (await prompt.single({\n type: 'confirm',\n message: `\"${relativeOutput}\" is not empty, do you want to proceed?`,\n default: false,\n }))\n\n if (!shouldProceed) {\n output.print('Cancelled.')\n return\n }\n\n output.print(`Building to ${relativeOutput}\\n`)\n }\n\n // Check that the project has a studio hostname\n let spinner = output.spinner('Checking project info').start()\n\n let userApplication: UserApplication\n\n try {\n const configParams: BaseConfigOptions & {\n appHost?: string\n appId?: string\n } = {\n client,\n context,\n spinner,\n }\n\n if (isCoreApp && appId) {\n configParams.appId = appId\n } else if (configStudioHost) {\n configParams.appHost = configStudioHost\n }\n // If the user has provided a studioHost / appId in the config, use that\n if (configStudioHost || appId) {\n userApplication = await getOrCreateUserApplicationFromConfig(configParams)\n } else {\n userApplication = isCoreApp\n ? await getOrCreateCoreApplication({client, context, spinner})\n : await getOrCreateStudio({client, context, spinner})\n }\n } catch (err) {\n if (err.message) {\n output.error(chalk.red(err.message))\n return\n }\n\n debug('Error creating user application', err)\n throw err\n }\n\n // Always build the project, unless --no-build is passed\n const shouldBuild = flags.build\n if (shouldBuild) {\n const buildArgs = {\n ...args,\n extOptions: flags,\n argsWithoutOptions: [customSourceDir].filter(Boolean),\n }\n const {didCompile} = await buildSanityStudio(buildArgs, context, {basePath: '/'})\n\n if (!didCompile) {\n return\n }\n\n if (!isCoreApp) {\n const extractManifestError = await extractManifestSafe(\n {\n ...buildArgs,\n extOptions: {},\n extraArguments: [],\n },\n context,\n )\n\n if (flags['schema-required'] && extractManifestError) {\n output.error(`Schema extraction error: ${extractManifestError.message}`)\n throw extractManifestError\n }\n }\n }\n\n if (!isCoreApp) {\n const storeManifestSchemasArgs = {\n ...args,\n extOptions: {\n 'path': `${sourceDir}/static`,\n 'schema-required': flags['schema-required'],\n 'verbose': flags.verbose,\n },\n extraArguments: [],\n }\n\n await storeManifestSchemas(storeManifestSchemasArgs, context)\n }\n\n // Ensure that the directory exists, is a directory and seems to have valid content\n spinner = output.spinner('Verifying local content').start()\n try {\n await checkDir(sourceDir)\n spinner.succeed()\n } catch (err) {\n spinner.fail()\n debug('Error checking directory', err)\n throw err\n }\n\n // Now create a tarball of the given directory\n const parentDir = path.dirname(sourceDir)\n const base = path.basename(sourceDir)\n const tarball = tar.pack(parentDir, {entries: [base]}).pipe(zlib.createGzip())\n\n spinner = output.spinner(`Deploying to ${isCoreApp ? 'CORE' : 'Sanity.Studio'}`).start()\n try {\n const {location} = await createDeployment({\n client,\n applicationId: userApplication.id,\n version: installedSanityVersion,\n isAutoUpdating,\n tarball,\n isCoreApp,\n })\n\n spinner.succeed()\n\n output.print()\n\n // And let the user know we're done\n output.print(\n `\\nSuccess! ${isCoreApp ? 'Application deployed' : `Studio deployed to ${chalk.cyan(location)}`}`,\n )\n\n if ((isCoreApp && !appId) || (!isCoreApp && !configStudioHost)) {\n output.print(\n `\\nAdd ${chalk.cyan(isCoreApp ? `appId: '${userApplication.id}'` : `studioHost: '${userApplication.appHost}'`)}`,\n )\n output.print(\n `to ${isCoreApp ? '__experimental_coreAppConfiguration' : 'defineCliConfig root properties'} in sanity.cli.js or sanity.cli.ts`,\n )\n output.print(`to avoid prompting ${isCoreApp ? '' : 'for hostname'} on next deploy.`)\n }\n } catch (err) {\n spinner.fail()\n debug('Error deploying studio', err)\n throw err\n }\n}\n"],"names":["deployStudioAction","args","context","apiClient","workDir","chalk","output","prompt","cliConfig","flags","build","extOptions","customSourceDir","argsWithoutOptions","sourceDir","path","resolve","process","cwd","join","isAutoUpdating","shouldAutoUpdate","isCoreApp","installedSanityVersion","getInstalledSanityVersion","configStudioHost","studioHost","appId","__experimental_coreAppConfiguration","client","requireUser","requireProject","withConfig","apiVersion","Error","relativeOutput","relative","dirIsEmptyOrNonExistent","single","type","message","default","print","spinner","start","userApplication","configParams","appHost","getOrCreateUserApplicationFromConfig","getOrCreateCoreApplication","getOrCreateStudio","err","error","red","debug","buildArgs","filter","Boolean","didCompile","buildSanityStudio","basePath","extractManifestError","extractManifestSafe","extraArguments","storeManifestSchemasArgs","verbose","storeManifestSchemas","checkDir","succeed","fail","parentDir","dirname","base","basename","tarball","tar","pack","entries","pipe","zlib","createGzip","location","createDeployment","applicationId","id","version","cyan"],"mappings":";;;;;;AA+B8BA,eAAAA,mBAC5BC,MACAC,SACe;AACT,QAAA;AAAA,IAACC;AAAAA,IAAWC;AAAAA,IAASC;AAAAA,IAAOC;AAAAA,IAAQC;AAAAA,IAAQC;AAAAA,EAAAA,IAAaN,SACzDO,QAAQ;AAAA,IAACC,OAAO;AAAA,IAAM,GAAGT,KAAKU;AAAAA,EAAAA,GAC9BC,kBAAkBX,KAAKY,mBAAmB,CAAC,GAC3CC,YAAYC,cAAAA,QAAKC,QAAQC,QAAQC,OAAON,mBAAmBG,sBAAKI,KAAKf,SAAS,MAAM,CAAC,GACrFgB,iBAAiBC,6BAAiB;AAAA,IAACZ;AAAAA,IAAOD;AAAAA,EAAU,CAAA,GACpDc,YAAYd,aAAa,yCAAyCA,WAElEe,yBAAyB,MAAMC,kCAA0B,GACzDC,mBAAmBjB,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D,cAAAA,QAAKwD,QAAQzD,SAAS,GAClC0D,OAAOzD,cAAAA,QAAK0D,SAAS3D,SAAS,GAC9B4D,UAAUC,aAAAA,QAAIC,KAAKN,WAAW;AAAA,IAACO,SAAS,CAACL,IAAI;AAAA,EAAE,CAAA,EAAEM,KAAKC,sBAAKC,YAAY;AAEnE1E,YAAAA,OAAOqC,QAAQ,gBAAgBrB,YAAY,SAAS,eAAe,EAAE,EAAEsB,MAAM;AACnF,MAAA;AACI,UAAA;AAAA,MAACqC;AAAAA,IAAQ,IAAI,MAAMC,QAAAA,iBAAiB;AAAA,MACxCrD;AAAAA,MACAsD,eAAetC,gBAAgBuC;AAAAA,MAC/BC,SAAS9D;AAAAA,MACTH;AAAAA,MACAsD;AAAAA,MACApD;AAAAA,IAAAA,CACD;AAEDqB,YAAQyB,WAER9D,OAAOoC,MAAM,GAGbpC,OAAOoC,MACL;AAAA,WAAcpB,YAAY,yBAAyB,sBAAsBjB,MAAMiF,KAAKL,QAAQ,CAAC,EAAE,EACjG,IAEK3D,aAAa,CAACK,SAAW,CAACL,aAAa,CAACG,sBAC3CnB,OAAOoC,MACL;AAAA,MAASrC,MAAMiF,KAAKhE,YAAY,WAAWuB,gBAAgBuC,EAAE,MAAM,gBAAgBvC,gBAAgBE,OAAO,GAAG,CAAC,EAChH,GACAzC,OAAOoC,MACL,MAAMpB,YAAY,wCAAwC,iCAAiC,oCAC7F,GACAhB,OAAOoC,MAAM,sBAAsBpB,YAAY,KAAK,cAAc,kBAAkB;AAAA,WAE/E6B,KAAK;AACZR,UAAAA,QAAQ0B,KAAK,GACbf,QAAM,MAAA,0BAA0BH,GAAG,GAC7BA;AAAAA,EAAAA;AAEV;;"}
@@ -18,7 +18,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
18
18
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
19
19
  mod
20
20
  ));
21
- var path = require("node:path"), chalk = require("chalk"), runtime = require("./runtime.js"), checkRequiredDependencies = require("./checkRequiredDependencies.js"), servers = require("./servers.js"), timing = require("./timing.js");
21
+ var path = require("node:path"), chalk = require("chalk"), runtime = require("./runtime.js"), checkRequiredDependencies = require("./checkRequiredDependencies.js"), servers = require("./servers.js"), _internal = require("./_internal.js");
22
22
  function _interopDefaultCompat(e) {
23
23
  return e && typeof e == "object" && "default" in e ? e : { default: e };
24
24
  }
@@ -69,7 +69,7 @@ async function startDevServer(options) {
69
69
  };
70
70
  }
71
71
  async function startSanityDevServer(args, context) {
72
- const timers = timing.getTimer(), flags = args.extOptions, {
72
+ const timers = _internal.getTimer(), flags = args.extOptions, {
73
73
  output,
74
74
  workDir,
75
75
  cliConfig
@@ -1 +1 @@
1
- {"version":3,"file":"devAction.js","sources":["../../src/_internal/cli/server/devServer.ts","../../src/_internal/cli/actions/dev/devAction.ts"],"sourcesContent":["import {type ReactCompilerConfig, type UserViteConfig} from '@sanity/cli'\nimport chalk from 'chalk'\n\nimport {debug} from './debug'\nimport {extendViteConfigWithUserConfig, getViteConfig} from './getViteConfig'\nimport {writeSanityRuntime} from './runtime'\n\nexport interface DevServerOptions {\n cwd: string\n basePath: string\n staticPath: string\n\n httpPort: number\n httpHost?: string\n projectName?: string\n\n reactStrictMode: boolean\n reactCompiler: ReactCompilerConfig | undefined\n vite?: UserViteConfig\n appLocation?: string\n isCoreApp?: boolean\n}\n\nexport interface DevServer {\n close(): Promise<void>\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<DevServer> {\n const {\n cwd,\n httpPort,\n httpHost,\n basePath,\n reactStrictMode,\n vite: extendViteConfig,\n reactCompiler,\n appLocation,\n isCoreApp,\n } = options\n\n const startTime = Date.now()\n debug('Writing Sanity runtime files')\n await writeSanityRuntime({cwd, reactStrictMode, watch: true, basePath, appLocation, isCoreApp})\n\n debug('Resolving vite config')\n const mode = 'development'\n\n let viteConfig = await getViteConfig({\n basePath,\n mode: 'development',\n server: {port: httpPort, host: httpHost},\n cwd,\n reactCompiler,\n isCoreApp,\n })\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const {createServer} = await import('vite')\n const server = await createServer(viteConfig)\n const info = server.config.logger.info\n\n debug('Listening on specified port')\n await server.listen()\n\n const startupDuration = Date.now() - startTime\n const url = `http://${httpHost || 'localhost'}:${httpPort || '3333'}${basePath}`\n const appType = isCoreApp ? 'Sanity application' : 'Sanity Studio'\n info(\n `${appType} ` +\n `using ${chalk.cyan(`vite@${require('vite/package.json').version}`)} ` +\n `ready in ${chalk.cyan(`${Math.ceil(startupDuration)}ms`)} ` +\n `and running at ${chalk.cyan(url)}`,\n )\n\n return {close: () => server.close()}\n}\n","import path from 'node:path'\n\nimport {\n type CliCommandArguments,\n type CliCommandContext,\n type CliConfig,\n type CliOutputter,\n} from '@sanity/cli'\n\nimport {type DevServerOptions, startDevServer} from '../../server/devServer'\nimport {checkRequiredDependencies} from '../../util/checkRequiredDependencies'\nimport {checkStudioDependencyVersions} from '../../util/checkStudioDependencyVersions'\nimport {getSharedServerConfig, gracefulServerDeath} from '../../util/servers'\nimport {getTimer} from '../../util/timing'\n\nexport interface StartDevServerCommandFlags {\n host?: string\n port?: string\n}\n\nexport default async function startSanityDevServer(\n args: CliCommandArguments<StartDevServerCommandFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const timers = getTimer()\n const flags = args.extOptions\n const {output, workDir, cliConfig} = context\n\n timers.start('checkStudioDependencyVersions')\n checkStudioDependencyVersions(workDir)\n timers.end('checkStudioDependencyVersions')\n\n // If the check resulted in a dependency install, the CLI command will be re-run,\n // thus we want to exit early\n if ((await checkRequiredDependencies(context)).didInstall) {\n return\n }\n\n // Try to load CLI configuration from sanity.cli.(js|ts)\n const config = getDevServerConfig({flags, workDir, cliConfig, output})\n\n try {\n await startDevServer(config)\n } catch (err) {\n gracefulServerDeath('dev', config.httpHost, config.httpPort, err)\n }\n}\n\nfunction getDevServerConfig({\n flags,\n workDir,\n cliConfig,\n output,\n}: {\n flags: StartDevServerCommandFlags\n workDir: string\n cliConfig?: CliConfig\n output: CliOutputter\n}): DevServerOptions {\n const configSpinner = output.spinner('Checking configuration files...')\n const baseConfig = getSharedServerConfig({flags, workDir, cliConfig})\n configSpinner.succeed()\n\n const env = process.env // eslint-disable-line no-process-env\n const reactStrictMode = env.SANITY_STUDIO_REACT_STRICT_MODE\n ? env.SANITY_STUDIO_REACT_STRICT_MODE === 'true'\n : Boolean(cliConfig?.reactStrictMode)\n\n if (env.SANITY_STUDIO_BASEPATH && cliConfig?.project?.basePath) {\n output.warn(\n `Overriding configured base path (${cliConfig.project.basePath}) with value from environment variable (${env.SANITY_STUDIO_BASEPATH})`,\n )\n }\n\n return {\n ...baseConfig,\n staticPath: path.join(workDir, 'static'),\n reactStrictMode,\n reactCompiler: cliConfig && 'reactCompiler' in cliConfig ? cliConfig.reactCompiler : undefined,\n }\n}\n"],"names":["startDevServer","options","cwd","httpPort","httpHost","basePath","reactStrictMode","vite","extendViteConfig","reactCompiler","appLocation","isCoreApp","startTime","Date","now","debug","writeSanityRuntime","watch","mode","viteConfig","getViteConfig","server","port","host","extendViteConfigWithUserConfig","command","createServer","info","config","logger","listen","startupDuration","url","chalk","cyan","require","version","Math","ceil","close","startSanityDevServer","args","context","timers","getTimer","flags","extOptions","output","workDir","cliConfig","start","checkStudioDependencyVersions","end","checkRequiredDependencies","didInstall","getDevServerConfig","err","gracefulServerDeath","configSpinner","spinner","baseConfig","getSharedServerConfig","succeed","env","process","SANITY_STUDIO_REACT_STRICT_MODE","Boolean","SANITY_STUDIO_BASEPATH","project","warn","staticPath","path","join","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,eAAsBA,eAAeC,SAA+C;AAC5E,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IAC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AA,EACvF;AACF;;"}
1
+ {"version":3,"file":"devAction.js","sources":["../../src/_internal/cli/server/devServer.ts","../../src/_internal/cli/actions/dev/devAction.ts"],"sourcesContent":["import {type ReactCompilerConfig, type UserViteConfig} from '@sanity/cli'\nimport chalk from 'chalk'\n\nimport {debug} from './debug'\nimport {extendViteConfigWithUserConfig, getViteConfig} from './getViteConfig'\nimport {writeSanityRuntime} from './runtime'\n\nexport interface DevServerOptions {\n cwd: string\n basePath: string\n staticPath: string\n\n httpPort: number\n httpHost?: string\n projectName?: string\n\n reactStrictMode: boolean\n reactCompiler: ReactCompilerConfig | undefined\n vite?: UserViteConfig\n appLocation?: string\n isCoreApp?: boolean\n}\n\nexport interface DevServer {\n close(): Promise<void>\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<DevServer> {\n const {\n cwd,\n httpPort,\n httpHost,\n basePath,\n reactStrictMode,\n vite: extendViteConfig,\n reactCompiler,\n appLocation,\n isCoreApp,\n } = options\n\n const startTime = Date.now()\n debug('Writing Sanity runtime files')\n await writeSanityRuntime({cwd, reactStrictMode, watch: true, basePath, appLocation, isCoreApp})\n\n debug('Resolving vite config')\n const mode = 'development'\n\n let viteConfig = await getViteConfig({\n basePath,\n mode: 'development',\n server: {port: httpPort, host: httpHost},\n cwd,\n reactCompiler,\n isCoreApp,\n })\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const {createServer} = await import('vite')\n const server = await createServer(viteConfig)\n const info = server.config.logger.info\n\n debug('Listening on specified port')\n await server.listen()\n\n const startupDuration = Date.now() - startTime\n const url = `http://${httpHost || 'localhost'}:${httpPort || '3333'}${basePath}`\n const appType = isCoreApp ? 'Sanity application' : 'Sanity Studio'\n info(\n `${appType} ` +\n `using ${chalk.cyan(`vite@${require('vite/package.json').version}`)} ` +\n `ready in ${chalk.cyan(`${Math.ceil(startupDuration)}ms`)} ` +\n `and running at ${chalk.cyan(url)}`,\n )\n\n return {close: () => server.close()}\n}\n","import path from 'node:path'\n\nimport {\n type CliCommandArguments,\n type CliCommandContext,\n type CliConfig,\n type CliOutputter,\n} from '@sanity/cli'\n\nimport {type DevServerOptions, startDevServer} from '../../server/devServer'\nimport {checkRequiredDependencies} from '../../util/checkRequiredDependencies'\nimport {checkStudioDependencyVersions} from '../../util/checkStudioDependencyVersions'\nimport {getSharedServerConfig, gracefulServerDeath} from '../../util/servers'\nimport {getTimer} from '../../util/timing'\n\nexport interface StartDevServerCommandFlags {\n host?: string\n port?: string\n}\n\nexport default async function startSanityDevServer(\n args: CliCommandArguments<StartDevServerCommandFlags>,\n context: CliCommandContext,\n): Promise<void> {\n const timers = getTimer()\n const flags = args.extOptions\n const {output, workDir, cliConfig} = context\n\n timers.start('checkStudioDependencyVersions')\n checkStudioDependencyVersions(workDir)\n timers.end('checkStudioDependencyVersions')\n\n // If the check resulted in a dependency install, the CLI command will be re-run,\n // thus we want to exit early\n if ((await checkRequiredDependencies(context)).didInstall) {\n return\n }\n\n // Try to load CLI configuration from sanity.cli.(js|ts)\n const config = getDevServerConfig({flags, workDir, cliConfig, output})\n\n try {\n await startDevServer(config)\n } catch (err) {\n gracefulServerDeath('dev', config.httpHost, config.httpPort, err)\n }\n}\n\nfunction getDevServerConfig({\n flags,\n workDir,\n cliConfig,\n output,\n}: {\n flags: StartDevServerCommandFlags\n workDir: string\n cliConfig?: CliConfig\n output: CliOutputter\n}): DevServerOptions {\n const configSpinner = output.spinner('Checking configuration files...')\n const baseConfig = getSharedServerConfig({flags, workDir, cliConfig})\n configSpinner.succeed()\n\n const env = process.env // eslint-disable-line no-process-env\n const reactStrictMode = env.SANITY_STUDIO_REACT_STRICT_MODE\n ? env.SANITY_STUDIO_REACT_STRICT_MODE === 'true'\n : Boolean(cliConfig?.reactStrictMode)\n\n if (env.SANITY_STUDIO_BASEPATH && cliConfig?.project?.basePath) {\n output.warn(\n `Overriding configured base path (${cliConfig.project.basePath}) with value from environment variable (${env.SANITY_STUDIO_BASEPATH})`,\n )\n }\n\n return {\n ...baseConfig,\n staticPath: path.join(workDir, 'static'),\n reactStrictMode,\n reactCompiler: cliConfig && 'reactCompiler' in cliConfig ? cliConfig.reactCompiler : undefined,\n }\n}\n"],"names":["startDevServer","options","cwd","httpPort","httpHost","basePath","reactStrictMode","vite","extendViteConfig","reactCompiler","appLocation","isCoreApp","startTime","Date","now","debug","writeSanityRuntime","watch","mode","viteConfig","getViteConfig","server","port","host","extendViteConfigWithUserConfig","command","createServer","info","config","logger","listen","startupDuration","url","chalk","cyan","require","version","Math","ceil","close","startSanityDevServer","args","context","timers","getTimer","flags","extOptions","output","workDir","cliConfig","start","checkStudioDependencyVersions","end","checkRequiredDependencies","didInstall","getDevServerConfig","err","gracefulServerDeath","configSpinner","spinner","baseConfig","getSharedServerConfig","succeed","env","process","SANITY_STUDIO_REACT_STRICT_MODE","Boolean","SANITY_STUDIO_BASEPATH","project","warn","staticPath","path","join","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,eAAsBA,eAAeC,SAA+C;AAC5E,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,MAAMC;AAAAA,IACNC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,EACEV,IAAAA,SAEEW,YAAYC,KAAKC,IAAI;AACrBC,gBAAA,8BAA8B,GACpC,MAAMC,2BAAmB;AAAA,IAACd;AAAAA,IAAKI;AAAAA,IAAiBW,OAAO;AAAA,IAAMZ;AAAAA,IAAUK;AAAAA,IAAaC;AAAAA,EAAAA,CAAU,GAE9FI,QAAAA,MAAM,uBAAuB;AAC7B,QAAMG,OAAO;AAETC,MAAAA,aAAa,MAAMC,sBAAc;AAAA,IACnCf;AAAAA,IACAa,MAAM;AAAA,IACNG,QAAQ;AAAA,MAACC,MAAMnB;AAAAA,MAAUoB,MAAMnB;A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jE,MAAA;AACF,UAAM/C,eAAe4B,MAAM;AAAA,WACpB4B,KAAK;AACZC,YAAAA,oBAAoB,OAAO7B,OAAOxB,UAAUwB,OAAOzB,UAAUqD,GAAG;AAAA,EAAA;AAEpE;AAEA,SAASD,mBAAmB;AAAA,EAC1BV;AAAAA,EACAG;AAAAA,EACAC;AAAAA,EACAF;AAMF,GAAqB;AACnB,QAAMW,gBAAgBX,OAAOY,QAAQ,iCAAiC,GAChEC,aAAaC,8BAAsB;AAAA,IAAChB;AAAAA,IAAOG;AAAAA,IAASC;AAAAA,EAAAA,CAAU;AACpES,gBAAcI,QAAQ;AAEhBC,QAAAA,MAAMC,QAAQD,KACdzD,kBAAkByD,IAAIE,kCACxBF,IAAIE,oCAAoC,SACxCC,CAAAA,CAAQjB,WAAW3C;AAEvB,SAAIyD,IAAII,0BAA0BlB,WAAWmB,SAAS/D,YACpD0C,OAAOsB,KACL,oCAAoCpB,UAAUmB,QAAQ/D,QAAQ,2CAA2C0D,IAAII,sBAAsB,GACrI,GAGK;AAAA,IACL,GAAGP;AAAAA,IACHU,YAAYC,cAAAA,QAAKC,KAAKxB,SAAS,QAAQ;AAAA,IACvC1C;AAAAA,IACAG,eAAewC,aAAa,mBAAmBA,YAAYA,UAAUxC,gBAAgBgE;AAAAA,EACvF;AACF;;"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const SANITY_VERSION = "3.77.3-server-side-schemas.15+9ffaf1fe9f";
2
+ const SANITY_VERSION = "3.77.3-server-side-schemas.16+4e37d76ae5";
3
3
  exports.SANITY_VERSION = SANITY_VERSION;
4
4
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- const SANITY_VERSION = "3.77.3-server-side-schemas.15+9ffaf1fe9f";
1
+ const SANITY_VERSION = "3.77.3-server-side-schemas.16+4e37d76ae5";
2
2
  export {
3
3
  SANITY_VERSION
4
4
  };
@@ -1,4 +1,4 @@
1
- const SANITY_VERSION = "3.77.3-server-side-schemas.15+9ffaf1fe9f";
1
+ const SANITY_VERSION = "3.77.3-server-side-schemas.16+4e37d76ae5";
2
2
  export {
3
3
  SANITY_VERSION
4
4
  };
package/lib/index.d.mts CHANGED
@@ -1960,9 +1960,9 @@ declare const Button: ForwardRefExoticComponent<
1960
1960
  | Omit<
1961
1961
  Pick<
1962
1962
  ButtonProps_2,
1963
+ | 'icon'
1963
1964
  | 'type'
1964
1965
  | 'mode'
1965
- | 'icon'
1966
1966
  | 'as'
1967
1967
  | 'selected'
1968
1968
  | 'width'
@@ -1981,9 +1981,9 @@ declare const Button: ForwardRefExoticComponent<
1981
1981
  | Omit<
1982
1982
  Pick<
1983
1983
  ButtonProps_2,
1984
+ | 'icon'
1984
1985
  | 'type'
1985
1986
  | 'mode'
1986
- | 'icon'
1987
1987
  | 'as'
1988
1988
  | 'selected'
1989
1989
  | 'width'
@@ -12653,7 +12653,7 @@ export declare type Status = 'online' | 'editing' | 'inactive'
12653
12653
 
12654
12654
  /** @hidden @beta */
12655
12655
  export declare const StatusButton: ForwardRefExoticComponent<
12656
- (StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'ref' | 'title' | 'disabled' | 'size'>) &
12656
+ (StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'title' | 'ref' | 'disabled' | 'size'>) &
12657
12657
  RefAttributes<HTMLButtonElement>
12658
12658
  >
12659
12659
 
package/lib/index.d.ts CHANGED
@@ -1960,9 +1960,9 @@ declare const Button: ForwardRefExoticComponent<
1960
1960
  | Omit<
1961
1961
  Pick<
1962
1962
  ButtonProps_2,
1963
+ | 'icon'
1963
1964
  | 'type'
1964
1965
  | 'mode'
1965
- | 'icon'
1966
1966
  | 'as'
1967
1967
  | 'selected'
1968
1968
  | 'width'
@@ -1981,9 +1981,9 @@ declare const Button: ForwardRefExoticComponent<
1981
1981
  | Omit<
1982
1982
  Pick<
1983
1983
  ButtonProps_2,
1984
+ | 'icon'
1984
1985
  | 'type'
1985
1986
  | 'mode'
1986
- | 'icon'
1987
1987
  | 'as'
1988
1988
  | 'selected'
1989
1989
  | 'width'
@@ -12653,7 +12653,7 @@ export declare type Status = 'online' | 'editing' | 'inactive'
12653
12653
 
12654
12654
  /** @hidden @beta */
12655
12655
  export declare const StatusButton: ForwardRefExoticComponent<
12656
- (StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'ref' | 'title' | 'disabled' | 'size'>) &
12656
+ (StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'title' | 'ref' | 'disabled' | 'size'>) &
12657
12657
  RefAttributes<HTMLButtonElement>
12658
12658
  >
12659
12659
 
@@ -2157,7 +2157,7 @@ export declare const Pane: ForwardRefExoticComponent<
2157
2157
  Omit<
2158
2158
  PaneProps &
2159
2159
  Omit<CardProps, 'as' | 'overflow'> &
2160
- Omit<HTMLProps<HTMLDivElement>, 'id' | 'hidden' | 'as' | 'height' | 'style'>,
2160
+ Omit<HTMLProps<HTMLDivElement>, 'hidden' | 'id' | 'as' | 'height' | 'style'>,
2161
2161
  'ref'
2162
2162
  > &
2163
2163
  RefAttributes<HTMLDivElement>
@@ -2157,7 +2157,7 @@ export declare const Pane: ForwardRefExoticComponent<
2157
2157
  Omit<
2158
2158
  PaneProps &
2159
2159
  Omit<CardProps, 'as' | 'overflow'> &
2160
- Omit<HTMLProps<HTMLDivElement>, 'id' | 'hidden' | 'as' | 'height' | 'style'>,
2160
+ Omit<HTMLProps<HTMLDivElement>, 'hidden' | 'id' | 'as' | 'height' | 'style'>,
2161
2161
  'ref'
2162
2162
  > &
2163
2163
  RefAttributes<HTMLDivElement>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity",
3
- "version": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
3
+ "version": "3.77.3-server-side-schemas.16+4e37d76ae5",
4
4
  "description": "Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches",
5
5
  "keywords": [
6
6
  "sanity",
@@ -160,11 +160,11 @@
160
160
  "@rexxars/react-json-inspector": "^9.0.1",
161
161
  "@sanity/asset-utils": "^2.0.6",
162
162
  "@sanity/bifur-client": "^0.4.1",
163
- "@sanity/cli": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
163
+ "@sanity/cli": "3.77.3-server-side-schemas.16+4e37d76ae5",
164
164
  "@sanity/client": "^6.28.1",
165
165
  "@sanity/color": "^3.0.0",
166
166
  "@sanity/comlink": "^3.0.1",
167
- "@sanity/diff": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
167
+ "@sanity/diff": "3.77.3-server-side-schemas.16+4e37d76ae5",
168
168
  "@sanity/diff-match-patch": "^3.1.1",
169
169
  "@sanity/diff-patch": "^5.0.0",
170
170
  "@sanity/eventsource": "^5.0.0",
@@ -174,15 +174,15 @@
174
174
  "@sanity/import": "^3.37.9",
175
175
  "@sanity/insert-menu": "^1.1.3",
176
176
  "@sanity/logos": "^2.1.13",
177
- "@sanity/migrate": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
178
- "@sanity/mutator": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
177
+ "@sanity/migrate": "3.77.3-server-side-schemas.16+4e37d76ae5",
178
+ "@sanity/mutator": "3.77.3-server-side-schemas.16+4e37d76ae5",
179
179
  "@sanity/presentation-comlink": "^1.0.8",
180
180
  "@sanity/preview-url-secret": "^2.1.4",
181
- "@sanity/schema": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
181
+ "@sanity/schema": "3.77.3-server-side-schemas.16+4e37d76ae5",
182
182
  "@sanity/telemetry": "^0.7.7",
183
- "@sanity/types": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
183
+ "@sanity/types": "3.77.3-server-side-schemas.16+4e37d76ae5",
184
184
  "@sanity/ui": "^2.14.3",
185
- "@sanity/util": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
185
+ "@sanity/util": "3.77.3-server-side-schemas.16+4e37d76ae5",
186
186
  "@sanity/uuid": "^3.0.2",
187
187
  "@sentry/react": "^8.33.0",
188
188
  "@tanstack/react-table": "^8.16.0",
@@ -280,7 +280,7 @@
280
280
  "@repo/dev-aliases": "3.77.2",
281
281
  "@repo/package.config": "3.77.2",
282
282
  "@repo/test-config": "3.77.2",
283
- "@sanity/codegen": "3.77.3-server-side-schemas.15+9ffaf1fe9f",
283
+ "@sanity/codegen": "3.77.3-server-side-schemas.16+4e37d76ae5",
284
284
  "@sanity/generate-help-url": "^3.0.0",
285
285
  "@sanity/pkg-utils": "6.13.4",
286
286
  "@sanity/tsdoc": "1.0.169",
@@ -325,5 +325,5 @@
325
325
  "engines": {
326
326
  "node": ">=18"
327
327
  },
328
- "gitHead": "9ffaf1fe9f0b8eecb91741bc04a8ebdd13190ec7"
328
+ "gitHead": "4e37d76ae567564c93d65e3f13422a852b525067"
329
329
  }