sanity 5.0.0-next-major.20251215093220 → 5.0.0-next-major.20251215132654
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/sanity +152 -38
- package/lib/_chunks-es/buildAction.js +2 -2
- package/lib/_chunks-es/buildAction2.js +2 -2
- package/lib/_chunks-es/deployAction.js +1 -1
- package/lib/_chunks-es/deployAction2.js +1 -1
- package/lib/_chunks-es/devAction2.js +3 -9
- package/lib/_chunks-es/devAction2.js.map +1 -1
- package/lib/_chunks-es/index3.js +70 -38
- package/lib/_chunks-es/index3.js.map +1 -1
- package/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/pane.js +48 -50
- package/lib/_chunks-es/pane.js.map +1 -1
- package/lib/_chunks-es/shouldAutoUpdate.js +107 -0
- package/lib/_chunks-es/shouldAutoUpdate.js.map +1 -0
- package/lib/_chunks-es/upgradePackages.js +2 -2
- package/lib/_chunks-es/upgradePackages.js.map +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/_chunks-es/warnAboutMissingAppId.js +135 -93
- package/lib/_chunks-es/warnAboutMissingAppId.js.map +1 -1
- package/lib/_internal.d.ts +1 -1
- package/lib/_singletons.d.ts +1 -1
- package/lib/index.d.ts +21 -21
- package/lib/presentation.d.ts +1 -1
- package/lib/structure.d.ts +1 -1
- package/package.json +23 -23
- package/lib/_chunks-es/moduleFormatUtils.js +0 -149
- package/lib/_chunks-es/moduleFormatUtils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warnAboutMissingAppId.js","sources":["../../src/_internal/cli/util/getAutoUpdatesImportMap.ts","../../src/_internal/cli/util/compareDependencyVersions.ts","../../src/_internal/cli/util/shouldAutoUpdate.ts","../../src/_internal/cli/util/baseUrl.ts","../../src/_internal/cli/util/warnAboutMissingAppId.ts"],"sourcesContent":["const MODULES_HOST =\n process.env.SANITY_MODULES_HOST ||\n (process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://sanity-cdn.work'\n : 'https://sanity-cdn.com')\n\nfunction currentUnixTime(): number {\n return Math.floor(Date.now() / 1000)\n}\n\ntype Package = {version: string; name: string}\n/**\n * @internal\n */\nexport function getAutoUpdatesImportMap<const Pkg extends Package>(\n packages: Pkg[],\n options: {timestamp?: number; baseUrl?: string; appId?: string} = {},\n) {\n return Object.fromEntries(\n packages.flatMap((pkg) => getAppAutoUpdateImportMapForPackage(pkg, options)),\n ) as {[K in Pkg['name'] | `${Pkg['name']}/`]: string}\n}\n\nfunction getAppAutoUpdateImportMapForPackage<const Pkg extends Package>(\n pkg: Pkg,\n options: {timestamp?: number; baseUrl?: string; appId?: string} = {},\n): [[Pkg['name'], string], [`${Pkg['name']}/`, string]] {\n const moduleUrl = getModuleUrl(pkg, options)\n\n return [\n [pkg.name, moduleUrl],\n [`${pkg.name}/`, `${moduleUrl}/`],\n ]\n}\n\nexport function getModuleUrl(\n pkg: Package,\n options: {timestamp?: number; baseUrl?: string; appId?: string} = {},\n) {\n const {timestamp = currentUnixTime()} = options\n return options.appId\n ? getByAppModuleUrl(pkg, {appId: options.appId, baseUrl: options.baseUrl, timestamp})\n : getLegacyModuleUrl(pkg, {timestamp, baseUrl: options.baseUrl})\n}\n\nfunction getLegacyModuleUrl(pkg: Package, options: {timestamp: number; baseUrl?: string}) {\n const encodedMinVer = encodeURIComponent(`^${pkg.version}`)\n return `${options.baseUrl || MODULES_HOST}/v1/modules/${rewriteScopedPackage(pkg.name)}/default/${encodedMinVer}/t${options.timestamp}`\n}\n\nfunction getByAppModuleUrl(\n pkg: Package,\n options: {appId: string; baseUrl?: string; timestamp: number},\n) {\n const encodedMinVer = encodeURIComponent(`^${pkg.version}`)\n return `${options.baseUrl || MODULES_HOST}/v1/modules/by-app/${options.appId}/t${options.timestamp}/${encodedMinVer}/${rewriteScopedPackage(pkg.name)}`\n}\n\n/**\n * replaces '/' with '__' similar to how eg `@types/scope__pkg` are rewritten\n * scoped packages are stored this way both in the manifest and in the cloud storage bucket\n */\nfunction rewriteScopedPackage(pkgName: string) {\n if (!pkgName.includes('@')) {\n return pkgName\n }\n const [scope, ...pkg] = pkgName.split('/')\n return `${scope}__${pkg.join('')}`\n}\n","import path from 'node:path'\n\nimport resolveFrom from 'resolve-from'\nimport semver from 'semver'\n\nimport {getModuleUrl} from './getAutoUpdatesImportMap'\nimport {readPackageManifest} from './readPackageManifest'\n\nfunction getRemoteResolvedVersion(fetchFn: typeof fetch, url: string) {\n return fetchFn(url, {\n method: 'HEAD',\n redirect: 'manual',\n }).then(\n (res) => {\n // 302 is expected, but lets also handle 2xx\n if (res.ok || res.status < 400) {\n const resolved = res.headers.get('x-resolved-version')\n if (!resolved) {\n throw new Error(`Missing 'x-resolved-version' header on response from HEAD ${url}`)\n }\n return resolved\n }\n throw new Error(`Unexpected HTTP response: ${res.status} ${res.statusText}`)\n },\n (err) => {\n throw new Error(`Failed to fetch remote version for ${url}: ${err.message}`, {cause: err})\n },\n )\n}\n\ninterface CompareDependencyVersions {\n pkg: string\n installed: string\n remote: string\n}\n\n/**\n * Compares the versions of dependencies in the studio or app 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 compareDependencyVersions(\n packages: {version: string; name: string}[],\n workDir: string,\n {fetchFn = globalThis.fetch}: {appId?: string; fetchFn?: typeof fetch} = {},\n): Promise<Array<CompareDependencyVersions>> {\n const manifest = await readPackageManifest(path.join(workDir, 'package.json'))\n const dependencies = {...manifest.dependencies, ...manifest.devDependencies}\n\n const failedDependencies: Array<CompareDependencyVersions> = []\n\n for (const pkg of packages) {\n const resolvedVersion = await getRemoteResolvedVersion(fetchFn, getModuleUrl(pkg))\n\n const manifestPath = resolveFrom.silent(workDir, path.join(pkg.name, 'package.json'))\n\n const manifestVersion = dependencies[pkg.name]\n\n const installed = semver.coerce(\n manifestPath\n ? semver.parse((await readPackageManifest(manifestPath)).version)\n : semver.coerce(manifestVersion),\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({\n pkg: pkg.name,\n installed: installed.version,\n remote: resolvedVersion,\n })\n }\n }\n\n return failedDependencies\n}\n","import {type CliConfig} from '@sanity/cli'\nimport chalk from 'chalk'\n\ninterface AutoUpdateSources {\n flags: {['auto-updates']?: boolean}\n cliConfig?: CliConfig\n output?: {warn: (message: string) => void}\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, output}: AutoUpdateSources): boolean {\n // cli flags (for example, '--no-auto-updates') should take precedence\n if ('auto-updates' in flags) {\n if (output) {\n const flagUsed = flags['auto-updates'] ? '--auto-updates' : '--no-auto-updates'\n output.warn(\n chalk.yellow(\n `The ${flagUsed} flag is deprecated for \\`deploy\\` and \\`build\\` commands. Set the \\`autoUpdates\\` option in \\`sanity.cli.ts\\` or \\`sanity.cli.js\\` instead.`,\n ),\n )\n }\n return Boolean(flags['auto-updates'])\n }\n\n const hasOldCliConfigFlag = cliConfig && 'autoUpdates' in cliConfig\n const hasNewCliConfigFlag =\n cliConfig &&\n 'deployment' in cliConfig &&\n cliConfig.deployment &&\n 'autoUpdates' in cliConfig.deployment\n\n if (hasOldCliConfigFlag && hasNewCliConfigFlag) {\n throw new Error(\n 'Found both `autoUpdates` (deprecated) and `deployment.autoUpdates` in sanity.cli.js. Please remove the deprecated top level `autoUpdates` config.',\n )\n }\n if (hasOldCliConfigFlag) {\n output?.warn(\n chalk.yellow(\n `The \\`autoUpdates\\` config has moved to \\`deployment.autoUpdates\\`.\nPlease update \\`sanity.cli.ts\\` or \\`sanity.cli.js\\` and make the following change:\n${chalk.red(`- autoUpdates: ${cliConfig.autoUpdates},`)}\n${chalk.green(`+ deployment: {autoUpdates: ${cliConfig.autoUpdates}}}`)}\n`,\n ),\n )\n }\n return Boolean(hasOldCliConfigFlag ? cliConfig.autoUpdates : cliConfig?.deployment?.autoUpdates)\n}\n","export const baseUrl =\n process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://www.sanity.work'\n : 'https://www.sanity.io'\n","import path from 'node:path'\n\nimport {type CliOutputter} from '@sanity/cli'\nimport chalk from 'chalk'\nimport logSymbols from 'log-symbols'\n\nimport {baseUrl} from './baseUrl'\n\nexport function warnAboutMissingAppId({\n appType,\n projectId,\n output,\n cliConfigPath,\n}: {\n appType: 'studio' | 'app'\n output: CliOutputter\n projectId: string | undefined\n cliConfigPath: string | undefined\n}) {\n const manageUrl = `${baseUrl}/manage${projectId ? `/project/${projectId}/studios` : ''}`\n const cliConfigFile = cliConfigPath ? path.basename(cliConfigPath) : 'sanity.cli.js'\n output.print(\n `${logSymbols.warning} No ${chalk.bold('appId')} configured. This ${appType} will auto-update to the ${chalk.green.bold('latest')} channel. To enable fine grained version selection, head over to ${chalk.cyan(manageUrl)} and add the appId to the ${chalk.bold('deployment')} section in ${chalk.bold(cliConfigFile)}.\n `,\n )\n}\n"],"names":["MODULES_HOST","process","env","SANITY_MODULES_HOST","SANITY_INTERNAL_ENV","currentUnixTime","Math","floor","Date","now","getAutoUpdatesImportMap","packages","options","Object","fromEntries","flatMap","pkg","getAppAutoUpdateImportMapForPackage","moduleUrl","getModuleUrl","name","timestamp","appId","getByAppModuleUrl","baseUrl","getLegacyModuleUrl","encodedMinVer","encodeURIComponent","version","rewriteScopedPackage","pkgName","includes","scope","split","join","getRemoteResolvedVersion","fetchFn","url","method","redirect","then","res","ok","status","resolved","headers","get","Error","statusText","err","message","cause","compareDependencyVersions","workDir","globalThis","fetch","manifest","readPackageManifest","path","dependencies","devDependencies","failedDependencies","resolvedVersion","manifestPath","resolveFrom","silent","manifestVersion","installed","semver","coerce","parse","eq","push","remote","shouldAutoUpdate","flags","cliConfig","output","flagUsed","warn","chalk","yellow","Boolean","hasOldCliConfigFlag","hasNewCliConfigFlag","deployment","red","autoUpdates","green","warnAboutMissingAppId","appType","projectId","cliConfigPath","manageUrl","cliConfigFile","basename","print","logSymbols","warning","bold","cyan"],"mappings":";;;;;;AAAA,MAAMA,eACJC,QAAQC,IAAIC,wBACXF,QAAQC,IAAIE,wBAAwB,YACjC,4BACA;AAEN,SAASC,kBAA0B;AACjC,SAAOC,KAAKC,MAAMC,KAAKC,IAAAA,IAAQ,GAAI;AACrC;AAMO,SAASC,wBACdC,UACAC,UAAkE,IAClE;AACA,SAAOC,OAAOC,YACZH,SAASI,QAASC,SAAQC,oCAAoCD,KAAKJ,OAAO,CAAC,CAC7E;AACF;AAEA,SAASK,oCACPD,KACAJ,UAAkE,IACZ;AACtD,QAAMM,YAAYC,aAAaH,KAAKJ,OAAO;AAE3C,SAAO,CACL,CAACI,IAAII,MAAMF,SAAS,GACpB,CAAC,GAAGF,IAAII,IAAI,KAAK,GAAGF,SAAS,GAAG,CAAC;AAErC;AAEO,SAASC,aACdH,KACAJ,UAAkE,IAClE;AACA,QAAM;AAAA,IAACS,YAAYhB,gBAAAA;AAAAA,EAAgB,IAAKO;AACxC,SAAOA,QAAQU,QACXC,kBAAkBP,KAAK;AAAA,IAACM,OAAOV,QAAQU;AAAAA,IAAOE,SAASZ,QAAQY;AAAAA,IAASH;AAAAA,EAAAA,CAAU,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AAc;AAAA,EACrC;AAEA,QAAMQ,sBAAsBP,aAAa,iBAAiBA,WACpDQ,sBACJR,aACA,gBAAgBA,aAChBA,UAAUS,cACV,iBAAiBT,UAAUS;AAE7B,MAAIF,uBAAuBC;AACzB,UAAM,IAAIrC,MACR,mJACF;AAEF,SAAIoC,uBACFN,QAAQE,KACNC,MAAMC,OACJ;AAAA;AAAA,EAEND,MAAMM,IAAI,mBAAmBV,UAAUW,WAAW,GAAG,CAAC;AAAA,EACtDP,MAAMQ,MAAM,gCAAgCZ,UAAUW,WAAW,IAAI,CAAC;AAAA,CAElE,CACF,GAEKL,CAAAA,EAAQC,sBAAsBP,UAAUW,cAAcX,WAAWS,YAAYE;AACtF;ACrDO,MAAM/D,UACXvB,QAAQC,IAAIE,wBAAwB,YAChC,4BACA;ACKC,SAASqF,sBAAsB;AAAA,EACpCC;AAAAA,EACAC;AAAAA,EACAd;AAAAA,EACAe;AAMF,GAAG;AACD,QAAMC,YAAY,GAAGrE,OAAO,UAAUmE,YAAY,YAAYA,SAAS,aAAa,EAAE,IAChFG,gBAAgBF,gBAAgBlC,KAAKqC,SAASH,aAAa,IAAI;AACrEf,SAAOmB,MACL,GAAGC,WAAWC,OAAO,OAAOlB,MAAMmB,KAAK,OAAO,CAAC,qBAAqBT,OAAO,4BAA4BV,MAAMQ,MAAMW,KAAK,QAAQ,CAAC,oEAAoEnB,MAAMoB,KAAKP,SAAS,CAAC,6BAA6Bb,MAAMmB,KAAK,YAAY,CAAC,eAAenB,MAAMmB,KAAKL,aAAa,CAAC;AAAA,SAEzT;AACF;"}
|
|
1
|
+
{"version":3,"file":"warnAboutMissingAppId.js","sources":["../../src/_internal/cli/server/buildVendorDependencies.ts","../../src/_internal/cli/util/formatSize.ts","../../src/_internal/cli/util/moduleFormatUtils.ts","../../src/_internal/cli/util/baseUrl.ts","../../src/_internal/cli/util/warnAboutMissingAppId.ts"],"sourcesContent":["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.2.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 },\n 'react-dom': {\n '^19.2.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 },\n 'styled-components': {\n '^6.1.0': {\n '.': './dist/styled-components.browser.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 chalk from 'chalk'\n\nexport function formatSize(bytes: number): string {\n return chalk.cyan(`${(bytes / 1024).toFixed()} kB`)\n}\n","import {type ChunkModule, type ChunkStats} from '../server'\nimport {formatSize} from './formatSize'\n\nexport function 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\nexport function 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\nexport function sortModulesBySize(chunks: ChunkStats[]): ChunkModule[] {\n return chunks\n .flatMap((chunk) => chunk.modules)\n .sort((modA, modB) => modB.renderedLength - modA.renderedLength)\n}\n","export const baseUrl =\n process.env.SANITY_INTERNAL_ENV === 'staging'\n ? 'https://www.sanity.work'\n : 'https://www.sanity.io'\n","import path from 'node:path'\n\nimport {type CliOutputter} from '@sanity/cli'\nimport chalk from 'chalk'\nimport logSymbols from 'log-symbols'\n\nimport {baseUrl} from './baseUrl'\n\nexport function warnAboutMissingAppId({\n appType,\n projectId,\n output,\n cliConfigPath,\n}: {\n appType: 'studio' | 'app'\n output: CliOutputter\n projectId: string | undefined\n cliConfigPath: string | undefined\n}) {\n const manageUrl = `${baseUrl}/manage${projectId ? `/project/${projectId}/studios` : ''}`\n const cliConfigFile = cliConfigPath ? path.basename(cliConfigPath) : 'sanity.cli.js'\n output.print(\n `${logSymbols.warning} No ${chalk.bold('appId')} configured. This ${appType} will auto-update to the ${chalk.green.bold('latest')} channel. To enable fine grained version selection, head over to ${chalk.cyan(manageUrl)} and add the appId to the ${chalk.bold('deployment')} section in ${chalk.bold(cliConfigFile)}.\n `,\n )\n}\n"],"names":["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","version","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","name","fileName","formatSize","bytes","chalk","cyan","toFixed","formatModuleSizes","modules","lines","mod","push","formatModuleName","renderedLength","modName","delimiter","nodeIndex","lastIndexOf","slice","sortModulesBySize","chunks","modA","modB","baseUrl","env","SANITY_INTERNAL_ENV","warnAboutMissingAppId","projectId","cliConfigPath","manageUrl","cliConfigFile","basename","print","logSymbols","warning","bold","green"],"mappings":";;;;;;;AASA,MAAMA,aAAa,UAqDbC,iBAAgC;AAAA,EACpC,OAAS;AAAA,IACP,WAA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O,CAAC,qBAAqBjE,OAAO,4BAA4BkC,MAAMgC,MAAMD,KAAK,QAAQ,CAAC,oEAAoE/B,MAAMC,KAAKwB,SAAS,CAAC,6BAA6BzB,MAAM+B,KAAK,YAAY,CAAC,eAAe/B,MAAM+B,KAAKL,aAAa,CAAC;AAAA,SAEzT;AACF;"}
|
package/lib/_internal.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {CliCommandGroupDefinition} from '@sanity/cli'
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const cliProjectCommands: {
|
|
9
9
|
requiredCliVersionRange: string
|
|
10
|
-
commands: (
|
|
10
|
+
commands: (CliCommandDefinition<Record<string, unknown>> | CliCommandGroupDefinition)[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export {}
|
package/lib/_singletons.d.ts
CHANGED
|
@@ -11009,8 +11009,8 @@ declare const presentationMachine: StateMachine<
|
|
|
11009
11009
|
never,
|
|
11010
11010
|
never,
|
|
11011
11011
|
never,
|
|
11012
|
-
| 'error'
|
|
11013
11012
|
| 'loading'
|
|
11013
|
+
| 'error'
|
|
11014
11014
|
| {
|
|
11015
11015
|
loaded: 'idle' | 'refreshing' | 'reloading'
|
|
11016
11016
|
},
|
package/lib/index.d.ts
CHANGED
|
@@ -2088,45 +2088,45 @@ declare const Button: ForwardRefExoticComponent<
|
|
|
2088
2088
|
| Omit<
|
|
2089
2089
|
Pick<
|
|
2090
2090
|
ButtonProps_2,
|
|
2091
|
-
| 'type'
|
|
2092
|
-
| 'mode'
|
|
2093
|
-
| 'icon'
|
|
2094
2091
|
| 'as'
|
|
2095
2092
|
| 'selected'
|
|
2093
|
+
| 'type'
|
|
2096
2094
|
| 'width'
|
|
2097
|
-
| '
|
|
2098
|
-
| '
|
|
2099
|
-
| 'paddingLeft'
|
|
2095
|
+
| 'icon'
|
|
2096
|
+
| 'iconRight'
|
|
2100
2097
|
| 'justify'
|
|
2101
2098
|
| 'loading'
|
|
2102
|
-
| '
|
|
2099
|
+
| 'mode'
|
|
2100
|
+
| 'paddingY'
|
|
2101
|
+
| 'paddingLeft'
|
|
2102
|
+
| 'tone'
|
|
2103
2103
|
> & {
|
|
2104
2104
|
size?: 'default' | 'large'
|
|
2105
2105
|
radius?: 'full'
|
|
2106
2106
|
} & ButtonWithText &
|
|
2107
|
-
Omit<HTMLProps<HTMLButtonElement>, '
|
|
2107
|
+
Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size' | 'title'>,
|
|
2108
2108
|
'ref'
|
|
2109
2109
|
>
|
|
2110
2110
|
| Omit<
|
|
2111
2111
|
Pick<
|
|
2112
2112
|
ButtonProps_2,
|
|
2113
|
-
| 'type'
|
|
2114
|
-
| 'mode'
|
|
2115
|
-
| 'icon'
|
|
2116
2113
|
| 'as'
|
|
2117
2114
|
| 'selected'
|
|
2115
|
+
| 'type'
|
|
2118
2116
|
| 'width'
|
|
2119
|
-
| '
|
|
2120
|
-
| '
|
|
2121
|
-
| 'paddingLeft'
|
|
2117
|
+
| 'icon'
|
|
2118
|
+
| 'iconRight'
|
|
2122
2119
|
| 'justify'
|
|
2123
2120
|
| 'loading'
|
|
2124
|
-
| '
|
|
2121
|
+
| 'mode'
|
|
2122
|
+
| 'paddingY'
|
|
2123
|
+
| 'paddingLeft'
|
|
2124
|
+
| 'tone'
|
|
2125
2125
|
> & {
|
|
2126
2126
|
size?: 'default' | 'large'
|
|
2127
2127
|
radius?: 'full'
|
|
2128
2128
|
} & IconButton &
|
|
2129
|
-
Omit<HTMLProps<HTMLButtonElement>, '
|
|
2129
|
+
Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size' | 'title'>,
|
|
2130
2130
|
'ref'
|
|
2131
2131
|
>
|
|
2132
2132
|
) &
|
|
@@ -3389,7 +3389,7 @@ export declare interface ConnectorContextValue {
|
|
|
3389
3389
|
*/
|
|
3390
3390
|
export declare const ContextMenuButton: ForwardRefExoticComponent<
|
|
3391
3391
|
ContextMenuButtonProps &
|
|
3392
|
-
Pick<HTMLProps<HTMLButtonElement>, '
|
|
3392
|
+
Pick<HTMLProps<HTMLButtonElement>, 'disabled' | 'hidden' | 'onClick'> &
|
|
3393
3393
|
RefAttributes<HTMLButtonElement>
|
|
3394
3394
|
>
|
|
3395
3395
|
|
|
@@ -3619,7 +3619,7 @@ export declare function createMockAuthStore({client, currentUser}: MockAuthStore
|
|
|
3619
3619
|
export declare const createObservableBufferedDocument: (
|
|
3620
3620
|
listenerEvent$: Observable<ListenerEvent>,
|
|
3621
3621
|
) => {
|
|
3622
|
-
updates$: Observable<
|
|
3622
|
+
updates$: Observable<DocumentMutationEvent | DocumentRebaseEvent | SnapshotEvent>
|
|
3623
3623
|
consistency$: Observable<boolean>
|
|
3624
3624
|
remoteSnapshot$: Observable<RemoteSnapshotEvent>
|
|
3625
3625
|
commitRequest$: Subject<CommitRequest>
|
|
@@ -12883,7 +12883,7 @@ export declare type Status = 'online' | 'editing' | 'inactive'
|
|
|
12883
12883
|
|
|
12884
12884
|
/** @hidden @beta */
|
|
12885
12885
|
export declare const StatusButton: ForwardRefExoticComponent<
|
|
12886
|
-
(StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'ref' | '
|
|
12886
|
+
(StatusButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'ref' | 'disabled' | 'size' | 'title'>) &
|
|
12887
12887
|
RefAttributes<HTMLButtonElement>
|
|
12888
12888
|
>
|
|
12889
12889
|
|
|
@@ -16367,7 +16367,7 @@ export declare function useClient(clientOptions: SourceClientOptions): SanityCli
|
|
|
16367
16367
|
* @internal
|
|
16368
16368
|
*/
|
|
16369
16369
|
export declare function useColorScheme(): {
|
|
16370
|
-
scheme: '
|
|
16370
|
+
scheme: 'light' | 'dark'
|
|
16371
16371
|
setScheme: false | ((nextScheme: StudioThemeColorSchemeKey) => void)
|
|
16372
16372
|
}
|
|
16373
16373
|
|
|
@@ -17303,7 +17303,7 @@ export declare function useReferenceInputOptions(): ReferenceInputOptions
|
|
|
17303
17303
|
export declare function useReferringDocuments<DocumentType extends SanityDocument_2>(
|
|
17304
17304
|
id: string,
|
|
17305
17305
|
fields?: DocumentField[],
|
|
17306
|
-
): ReferringDocumentsState<
|
|
17306
|
+
): ReferringDocumentsState<DocumentType> | ReferringDocumentsState<never>
|
|
17307
17307
|
|
|
17308
17308
|
/** @internal */
|
|
17309
17309
|
export declare function useRelativeTime(time: Date | string, options?: RelativeTimeOptions): string
|
package/lib/presentation.d.ts
CHANGED
package/lib/structure.d.ts
CHANGED
|
@@ -5575,7 +5575,7 @@ export declare const Pane: ForwardRefExoticComponent<
|
|
|
5575
5575
|
Omit<
|
|
5576
5576
|
PaneProps &
|
|
5577
5577
|
Omit<CardProps, 'as' | 'overflow'> &
|
|
5578
|
-
Omit<HTMLProps<HTMLDivElement>, '
|
|
5578
|
+
Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'hidden' | 'id' | 'style'>,
|
|
5579
5579
|
'ref'
|
|
5580
5580
|
> &
|
|
5581
5581
|
RefAttributes<HTMLDivElement>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity",
|
|
3
|
-
"version": "5.0.0-next-major.
|
|
3
|
+
"version": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
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",
|
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
"@isaacs/ttlcache": "^1.4.1",
|
|
121
121
|
"@juggle/resize-observer": "^3.4.0",
|
|
122
122
|
"@mux/mux-player-react": "^3.8.0",
|
|
123
|
-
"@portabletext/block-tools": "^4.1.
|
|
124
|
-
"@portabletext/editor": "^3.3.
|
|
125
|
-
"@portabletext/patches": "^2.0.
|
|
126
|
-
"@portabletext/plugin-markdown-shortcuts": "^4.0.
|
|
127
|
-
"@portabletext/plugin-one-line": "^3.0.
|
|
128
|
-
"@portabletext/plugin-typography": "^4.0.
|
|
123
|
+
"@portabletext/block-tools": "^4.1.11",
|
|
124
|
+
"@portabletext/editor": "^3.3.13",
|
|
125
|
+
"@portabletext/patches": "^2.0.2",
|
|
126
|
+
"@portabletext/plugin-markdown-shortcuts": "^4.0.33",
|
|
127
|
+
"@portabletext/plugin-one-line": "^3.0.33",
|
|
128
|
+
"@portabletext/plugin-typography": "^4.0.33",
|
|
129
129
|
"@portabletext/react": "^6.0.0",
|
|
130
130
|
"@portabletext/toolkit": "^5.0.0",
|
|
131
131
|
"@rexxars/react-json-inspector": "^9.0.1",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"import-fresh": "^3.3.1",
|
|
190
190
|
"is-hotkey-esm": "^1.0.0",
|
|
191
191
|
"is-tar": "^1.0.0",
|
|
192
|
-
"isomorphic-dompurify": "
|
|
192
|
+
"isomorphic-dompurify": "2.26.0",
|
|
193
193
|
"jsdom": "^26.1.0",
|
|
194
194
|
"jsdom-global": "^3.0.2",
|
|
195
195
|
"json-lexer": "^1.2.0",
|
|
@@ -250,13 +250,13 @@
|
|
|
250
250
|
"which": "^5.0.0",
|
|
251
251
|
"xstate": "^5.24.0",
|
|
252
252
|
"yargs": "^17.7.2",
|
|
253
|
-
"@sanity/
|
|
254
|
-
"@sanity/
|
|
255
|
-
"@sanity/
|
|
256
|
-
"@sanity/mutator": "5.0.0-next-major.
|
|
257
|
-
"@sanity/schema": "5.0.0-next-major.
|
|
258
|
-
"@sanity/types": "5.0.0-next-major.
|
|
259
|
-
"@sanity/util": "5.0.0-next-major.
|
|
253
|
+
"@sanity/cli": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
254
|
+
"@sanity/migrate": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
255
|
+
"@sanity/diff": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
256
|
+
"@sanity/mutator": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
257
|
+
"@sanity/schema": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
258
|
+
"@sanity/types": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
259
|
+
"@sanity/util": "5.0.0-next-major.20251215132654+534d769f6c"
|
|
260
260
|
},
|
|
261
261
|
"devDependencies": {
|
|
262
262
|
"@playwright/experimental-ct-react": "1.56.1",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"@sanity/descriptors": "^1.2.1",
|
|
265
265
|
"@sanity/eslint-config-i18n": "^2.0.0",
|
|
266
266
|
"@sanity/generate-help-url": "^3.0.1",
|
|
267
|
-
"@sanity/pkg-utils": "^10.
|
|
267
|
+
"@sanity/pkg-utils": "^10.2.0",
|
|
268
268
|
"@sanity/ui-workshop": "^3.4.0",
|
|
269
269
|
"@sanity/visual-editing-csm": "^2.0.26",
|
|
270
270
|
"@sentry/types": "^8.55.0",
|
|
@@ -302,13 +302,13 @@
|
|
|
302
302
|
"swr": "2.2.5",
|
|
303
303
|
"vitest": "^3.2.4",
|
|
304
304
|
"vitest-package-exports": "^0.1.1",
|
|
305
|
-
"@repo/dev-aliases": "5.0.0-next-major.
|
|
306
|
-
"@repo/
|
|
307
|
-
"@repo/package.
|
|
308
|
-
"@repo/
|
|
309
|
-
"@repo/
|
|
310
|
-
"@
|
|
311
|
-
"@
|
|
305
|
+
"@repo/dev-aliases": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
306
|
+
"@repo/package.bundle": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
307
|
+
"@repo/package.config": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
308
|
+
"@repo/test-config": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
309
|
+
"@repo/tsconfig": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
310
|
+
"@sanity/codegen": "5.0.0-next-major.20251215132654+534d769f6c",
|
|
311
|
+
"@repo/eslint-config": "5.0.0-next-major.20251215132654+534d769f6c"
|
|
312
312
|
},
|
|
313
313
|
"peerDependencies": {
|
|
314
314
|
"react": "^19.2.2",
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import resolveFrom from "resolve-from";
|
|
4
|
-
import semver from "semver";
|
|
5
|
-
import { createExternalFromImportMap } from "./runtime.js";
|
|
6
|
-
import chalk from "chalk";
|
|
7
|
-
const VENDOR_DIR = "vendor", VENDOR_IMPORTS = {
|
|
8
|
-
react: {
|
|
9
|
-
"^19.2.0": {
|
|
10
|
-
".": "./cjs/react.production.js",
|
|
11
|
-
"./jsx-runtime": "./cjs/react-jsx-runtime.production.js",
|
|
12
|
-
"./jsx-dev-runtime": "./cjs/react-jsx-dev-runtime.production.js",
|
|
13
|
-
"./compiler-runtime": "./cjs/react-compiler-runtime.production.js",
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"react-dom": {
|
|
18
|
-
"^19.2.0": {
|
|
19
|
-
".": "./cjs/react-dom.production.js",
|
|
20
|
-
"./client": "./cjs/react-dom-client.production.js",
|
|
21
|
-
"./server": "./cjs/react-dom-server-legacy.browser.production.js",
|
|
22
|
-
"./server.browser": "./cjs/react-dom-server-legacy.browser.production.js",
|
|
23
|
-
"./static": "./cjs/react-dom-server.browser.production.js",
|
|
24
|
-
"./static.browser": "./cjs/react-dom-server.browser.production.js",
|
|
25
|
-
"./package.json": "./package.json"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"styled-components": {
|
|
29
|
-
"^6.1.0": {
|
|
30
|
-
".": "./dist/styled-components.browser.esm.js",
|
|
31
|
-
"./package.json": "./package.json"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
async function buildVendorDependencies({
|
|
36
|
-
cwd,
|
|
37
|
-
outputDir,
|
|
38
|
-
basePath
|
|
39
|
-
}) {
|
|
40
|
-
const dir = path.relative(process.cwd(), path.resolve(cwd)), entry = {}, imports = {};
|
|
41
|
-
for (const [packageName, ranges] of Object.entries(VENDOR_IMPORTS)) {
|
|
42
|
-
const packageJsonPath = resolveFrom.silent(cwd, path.join(packageName, "package.json"));
|
|
43
|
-
if (!packageJsonPath)
|
|
44
|
-
throw new Error(`Could not find package.json for package '${packageName}' from directory '${dir}'. Is it installed?`);
|
|
45
|
-
let packageJson;
|
|
46
|
-
try {
|
|
47
|
-
packageJson = JSON.parse(await fs.promises.readFile(packageJsonPath, "utf-8"));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
const message = `Could not read package.json for package '${packageName}' from directory '${dir}'`;
|
|
50
|
-
throw typeof e?.message == "string" ? (e.message = `${message}: ${e.message}`, e) : new Error(message, {
|
|
51
|
-
cause: e
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
const version = semver.coerce(packageJson.version)?.version;
|
|
55
|
-
if (!version)
|
|
56
|
-
throw new Error(`Could not parse version '${packageJson.version}' from '${packageName}'`);
|
|
57
|
-
const sortedRanges = Object.keys(ranges).sort((range1, range2) => {
|
|
58
|
-
const min1 = semver.minVersion(range1), min2 = semver.minVersion(range2);
|
|
59
|
-
if (!min1) throw new Error(`Could not parse range '${range1}'`);
|
|
60
|
-
if (!min2) throw new Error(`Could not parse range '${range2}'`);
|
|
61
|
-
return semver.rcompare(min1.version, min2.version);
|
|
62
|
-
}), matchedRange = sortedRanges.find((range) => semver.satisfies(version, range));
|
|
63
|
-
if (!matchedRange) {
|
|
64
|
-
const min = semver.minVersion(sortedRanges[sortedRanges.length - 1]);
|
|
65
|
-
throw min ? semver.gt(min.version, version) ? new Error(`Package '${packageName}' requires at least ${min.version}.`) : new Error(`Version '${version}' of package '${packageName}' is not supported yet.`) : new Error(`Could not find a minimum version for package '${packageName}'`);
|
|
66
|
-
}
|
|
67
|
-
const subpaths = ranges[matchedRange];
|
|
68
|
-
for (const [subpath, relativeEntryPoint] of Object.entries(subpaths)) {
|
|
69
|
-
const packagePath = path.dirname(packageJsonPath), entryPoint = resolveFrom.silent(packagePath, relativeEntryPoint);
|
|
70
|
-
if (!entryPoint)
|
|
71
|
-
throw new Error(`Failed to resolve entry point '${path.join(packageName, relativeEntryPoint)}'. `);
|
|
72
|
-
const specifier = path.posix.join(packageName, subpath), chunkName = path.posix.join(packageName, path.relative(packageName, specifier) || "index");
|
|
73
|
-
entry[chunkName] = entryPoint, imports[specifier] = path.posix.join("/", basePath, VENDOR_DIR, `${chunkName}.mjs`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const {
|
|
77
|
-
build
|
|
78
|
-
} = await import("vite");
|
|
79
|
-
let buildResult = await build({
|
|
80
|
-
// Define a custom cache directory so that sanity's vite cache
|
|
81
|
-
// does not conflict with any potential local vite projects
|
|
82
|
-
cacheDir: "node_modules/.sanity/vite-vendor",
|
|
83
|
-
root: cwd,
|
|
84
|
-
configFile: !1,
|
|
85
|
-
logLevel: "silent",
|
|
86
|
-
appType: "custom",
|
|
87
|
-
mode: "production",
|
|
88
|
-
define: {
|
|
89
|
-
"process.env.NODE_ENV": JSON.stringify("production")
|
|
90
|
-
},
|
|
91
|
-
build: {
|
|
92
|
-
commonjsOptions: {
|
|
93
|
-
strictRequires: "auto"
|
|
94
|
-
},
|
|
95
|
-
minify: !0,
|
|
96
|
-
emptyOutDir: !1,
|
|
97
|
-
// Rely on CLI to do this
|
|
98
|
-
outDir: path.join(outputDir, VENDOR_DIR),
|
|
99
|
-
lib: {
|
|
100
|
-
entry,
|
|
101
|
-
formats: ["es"]
|
|
102
|
-
},
|
|
103
|
-
rollupOptions: {
|
|
104
|
-
external: createExternalFromImportMap({
|
|
105
|
-
imports
|
|
106
|
-
}),
|
|
107
|
-
output: {
|
|
108
|
-
entryFileNames: "[name]-[hash].mjs",
|
|
109
|
-
chunkFileNames: "[name]-[hash].mjs",
|
|
110
|
-
exports: "named",
|
|
111
|
-
format: "es"
|
|
112
|
-
},
|
|
113
|
-
treeshake: {
|
|
114
|
-
preset: "recommended"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
buildResult = Array.isArray(buildResult) ? buildResult : [buildResult];
|
|
120
|
-
const hashedImports = {}, output = buildResult.flatMap((i) => i.output);
|
|
121
|
-
for (const chunk of output)
|
|
122
|
-
if (chunk.type !== "asset")
|
|
123
|
-
for (const [specifier, originalPath] of Object.entries(imports))
|
|
124
|
-
originalPath.endsWith(`${chunk.name}.mjs`) && (hashedImports[specifier] = path.posix.join("/", basePath, VENDOR_DIR, chunk.fileName));
|
|
125
|
-
return hashedImports;
|
|
126
|
-
}
|
|
127
|
-
function formatSize(bytes) {
|
|
128
|
-
return chalk.cyan(`${(bytes / 1024).toFixed()} kB`);
|
|
129
|
-
}
|
|
130
|
-
function formatModuleSizes(modules) {
|
|
131
|
-
const lines = [];
|
|
132
|
-
for (const mod of modules)
|
|
133
|
-
lines.push(` - ${formatModuleName(mod.name)} (${formatSize(mod.renderedLength)})`);
|
|
134
|
-
return lines.join(`
|
|
135
|
-
`);
|
|
136
|
-
}
|
|
137
|
-
function formatModuleName(modName) {
|
|
138
|
-
const delimiter = "/node_modules/", nodeIndex = modName.lastIndexOf(delimiter);
|
|
139
|
-
return nodeIndex === -1 ? modName : modName.slice(nodeIndex + delimiter.length);
|
|
140
|
-
}
|
|
141
|
-
function sortModulesBySize(chunks) {
|
|
142
|
-
return chunks.flatMap((chunk) => chunk.modules).sort((modA, modB) => modB.renderedLength - modA.renderedLength);
|
|
143
|
-
}
|
|
144
|
-
export {
|
|
145
|
-
buildVendorDependencies,
|
|
146
|
-
formatModuleSizes,
|
|
147
|
-
sortModulesBySize
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=moduleFormatUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"moduleFormatUtils.js","sources":["../../src/_internal/cli/server/buildVendorDependencies.ts","../../src/_internal/cli/util/formatSize.ts","../../src/_internal/cli/util/moduleFormatUtils.ts"],"sourcesContent":["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.2.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 },\n 'react-dom': {\n '^19.2.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 },\n 'styled-components': {\n '^6.1.0': {\n '.': './dist/styled-components.browser.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 chalk from 'chalk'\n\nexport function formatSize(bytes: number): string {\n return chalk.cyan(`${(bytes / 1024).toFixed()} kB`)\n}\n","import {type ChunkModule, type ChunkStats} from '../server'\nimport {formatSize} from './formatSize'\n\nexport function 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\nexport function 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\nexport function sortModulesBySize(chunks: ChunkStats[]): ChunkModule[] {\n return chunks\n .flatMap((chunk) => chunk.modules)\n .sort((modA, modB) => modB.renderedLength - modA.renderedLength)\n}\n"],"names":["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","version","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","name","fileName","formatSize","bytes","chalk","cyan","toFixed","formatModuleSizes","modules","lines","mod","push","formatModuleName","renderedLength","modName","delimiter","nodeIndex","lastIndexOf","slice","sortModulesBySize","chunks","modA","modB"],"mappings":";;;;;;AASA,MAAMA,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,IAAA;AAAA,EACpB;AAAA,EAEF,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,IAAA;AAAA,EACpB;AAAA,EAEF,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,MAAMC,KAAKC,SAASC,QAAQN,OAAOI,KAAKG,QAAQP,GAAG,CAAC,GACpDQ,QAAgC,CAAA,GAChCC,UAAkC,CAAA;AAGxC,aAAW,CAACC,aAAaC,MAAM,KAAKC,OAAOC,QAAQf,cAAc,GAAG;AAClE,UA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