sanity 3.94.1-next.1.c49e1bd78d → 3.94.1-next.3.494b51faaa
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/lib/_chunks-cjs/moduleFormatUtils.js +0 -1
- package/lib/_chunks-cjs/moduleFormatUtils.js.map +1 -1
- package/lib/_chunks-cjs/previewServer.js +0 -1
- package/lib/_chunks-cjs/previewServer.js.map +1 -1
- package/lib/_chunks-cjs/version.js +1 -1
- package/lib/_chunks-es/version.mjs +1 -1
- package/package.json +10 -10
@@ -142,7 +142,6 @@ async function buildVendorDependencies({
|
|
142
142
|
exports: "named",
|
143
143
|
format: "es"
|
144
144
|
},
|
145
|
-
// @ts-expect-error - this is fine, it's a rolldown-vite thing but we're only using rolldown-vite on the monorepo, not in the regular cli
|
146
145
|
treeshake: {
|
147
146
|
preset: "recommended"
|
148
147
|
}
|
@@ -1 +1 @@
|
|
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.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 // @ts-expect-error - this is fine, it's a rolldown-vite thing but we're only using rolldown-vite on the monorepo, not in the regular cli\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,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,MAAMC,cAAAA,QAAKC,SAASC,QAAQN,OAAOI,cAAAA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,aAAWC,OAAOF;AACVG,UAAAA,KAAK,MAAMC,iBAAiBF,IAAIV,IAAI,CAAC,KAAKE,WAAWQ,IAAIG,cAAc,CAAC,GAAG;AAGnF,SAAOJ,MAAMpF,KAAK;AAAA,CAAI;AACxB;AAEO,SAASuF,iBAAiBE,SAAyB;AACxD,QAAMC,YAAY,kBACZC,YAAYF,QAAQG,YAAYF,SAAS;AAC/C,SAAOC,cAAc,KAAKF,UAAUA,QAAQI,MAAMF,YAAYD,UAAU9D,MAAM;AAChF;AAEO,SAASkE,kBAAkBC,QAAqC;AACrE,SAAOA,OACJ1B,QAASE,CAAUA,UAAAA,MAAMY,OAAO,EAChCnE,KAAK,CAACgF,MAAMC,SAASA,KAAKT,iBAAiBQ,KAAKR,cAAc;AACnE;;;;"}
|
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.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 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,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,MAAMC,cAAAA,QAAKC,SAASC,QAAQN,OAAOI,cAAAA,QAAKG,QAAQP,GAAG,CAAC,GACpDQ,QAAgC,CAAC,GACjCC,UAAkC,CAAC;AAGzC,aAAW,CAACC,aAAaC,MAAM,KAAKC,OAAOC,QAAQf,cAAc,GAAG;AAC5DgB,UAAAA,kBAAkB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ASuF,iBAAiBE,SAAyB;AACxD,QAAMC,YAAY,kBACZC,YAAYF,QAAQG,YAAYF,SAAS;AAC/C,SAAOC,cAAc,KAAKF,UAAUA,QAAQI,MAAMF,YAAYD,UAAU9D,MAAM;AAChF;AAEO,SAASkE,kBAAkBC,QAAqC;AACrE,SAAOA,OACJ1B,QAASE,CAAUA,UAAAA,MAAMY,OAAO,EAChCnE,KAAK,CAACgF,MAAMC,SAASA,KAAKT,iBAAiBQ,KAAKR,cAAc;AACnE;;;;"}
|
@@ -80,7 +80,6 @@ async function buildStaticFiles(options) {
|
|
80
80
|
const filePath = rawFilePath.startsWith("\0") ? rawFilePath.slice(1) : rawFilePath;
|
81
81
|
return {
|
82
82
|
name: path__default.default.isAbsolute(filePath) ? path__default.default.relative(cwd, filePath) : filePath,
|
83
|
-
// @ts-expect-error - this is fine, it's a rolldown-vite thing but we're only using rolldown-vite on the monorepo, not in the regular cli
|
84
83
|
originalLength: chunkModule.originalLength,
|
85
84
|
renderedLength: chunkModule.renderedLength
|
86
85
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"previewServer.js","sources":["../../src/_internal/cli/server/buildStaticFiles.ts","../../src/_internal/cli/server/vite/plugin-sanity-basepath-redirect.ts","../../src/_internal/cli/server/previewServer.ts"],"sourcesContent":["import {constants as fsConstants} from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type ReactCompilerConfig, type UserViteConfig} from '@sanity/cli'\nimport readPkgUp from 'read-pkg-up'\n\nimport {debug as serverDebug} from './debug'\nimport {extendViteConfigWithUserConfig, finalizeViteConfig, getViteConfig} from './getViteConfig'\nimport {writeSanityRuntime} from './runtime'\nimport {generateWebManifest} from './webManifest'\n\nconst debug = serverDebug.extend('static')\n\nexport interface ChunkModule {\n name: string\n originalLength: number\n renderedLength: number\n}\n\nexport interface ChunkStats {\n name: string\n modules: ChunkModule[]\n}\n\nexport interface StaticBuildOptions {\n cwd: string\n basePath: string\n outputDir: string\n minify?: boolean\n profile?: boolean\n sourceMap?: boolean\n importMap?: {imports?: Record<string, string>}\n\n vite?: UserViteConfig\n reactCompiler: ReactCompilerConfig | undefined\n entry?: string\n isApp?: boolean\n}\n\nexport async function buildStaticFiles(\n options: StaticBuildOptions,\n): Promise<{chunks: ChunkStats[]}> {\n const {\n cwd,\n outputDir,\n sourceMap = false,\n minify = true,\n basePath,\n vite: extendViteConfig,\n importMap,\n reactCompiler,\n entry,\n isApp,\n } = options\n\n debug('Writing Sanity runtime files')\n await writeSanityRuntime({\n cwd,\n reactStrictMode: false,\n watch: false,\n basePath,\n entry,\n isApp,\n })\n\n debug('Resolving vite config')\n const mode = 'production'\n let viteConfig = await getViteConfig({\n cwd,\n basePath,\n outputDir,\n minify,\n sourceMap,\n mode,\n importMap,\n reactCompiler,\n isApp,\n })\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n viteConfig = await finalizeViteConfig(viteConfig)\n }\n\n // Copy files placed in /static to the built /static\n debug('Copying static files from /static to output dir')\n const staticPath = path.join(outputDir, 'static')\n await copyDir(path.join(cwd, 'static'), staticPath)\n\n // Write favicons, not overwriting ones that already exist, to static folder\n debug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n\n debug('Bundling using vite')\n const {build} = await import('vite')\n const bundle = await build(viteConfig)\n debug('Bundling complete')\n\n // For typescript only - this shouldn't ever be the case given we're not watching\n if (Array.isArray(bundle) || !('output' in bundle)) {\n return {chunks: []}\n }\n\n const stats: ChunkStats[] = []\n bundle.output.forEach((chunk) => {\n if (chunk.type !== 'chunk') {\n return\n }\n\n stats.push({\n name: chunk.name,\n modules: Object.entries(chunk.modules).map(([rawFilePath, chunkModule]) => {\n const filePath = rawFilePath.startsWith('\\x00')\n ? rawFilePath.slice('\\x00'.length)\n : rawFilePath\n\n return {\n name: path.isAbsolute(filePath) ? path.relative(cwd, filePath) : filePath,\n // @ts-expect-error - this is fine, it's a rolldown-vite thing but we're only using rolldown-vite on the monorepo, not in the regular cli\n originalLength: chunkModule.originalLength,\n renderedLength: chunkModule.renderedLength,\n }\n }),\n })\n })\n\n return {chunks: stats}\n}\n\nasync function copyDir(srcDir: string, destDir: string, skipExisting?: boolean): Promise<void> {\n await fs.mkdir(destDir, {recursive: true})\n\n for (const file of await tryReadDir(srcDir)) {\n const srcFile = path.resolve(srcDir, file)\n if (srcFile === destDir) {\n continue\n }\n\n const destFile = path.resolve(destDir, file)\n const stat = await fs.stat(srcFile)\n\n if (stat.isDirectory()) {\n await copyDir(srcFile, destFile, skipExisting)\n } else if (skipExisting) {\n await fs.copyFile(srcFile, destFile, fsConstants.COPYFILE_EXCL).catch(skipIfExistsError)\n } else {\n await fs.copyFile(srcFile, destFile)\n }\n }\n}\n\nasync function tryReadDir(dir: string): Promise<string[]> {\n try {\n const content = await fs.readdir(dir)\n return content\n } catch (err) {\n if (err.code === 'ENOENT') {\n return []\n }\n\n throw err\n }\n}\n\nfunction skipIfExistsError(err: Error & {code: string}) {\n if (err.code === 'EEXIST') {\n return\n }\n\n throw err\n}\n\nasync function writeFavicons(basePath: string, destDir: string): Promise<void> {\n const sanityPkgPath = (await readPkgUp({cwd: __dirname}))?.path\n const faviconsPath = sanityPkgPath\n ? path.join(path.dirname(sanityPkgPath), 'static', 'favicons')\n : undefined\n\n if (!faviconsPath) {\n throw new Error('Unable to resolve `sanity` module root')\n }\n\n await fs.mkdir(destDir, {recursive: true})\n await copyDir(faviconsPath, destDir, true)\n await writeWebManifest(basePath, destDir)\n\n // Copy the /static/favicon.ico to /favicon.ico as well, because some tools/browsers\n // blindly expects it to be there before requesting the HTML containing the actual path\n await fs.copyFile(path.join(destDir, 'favicon.ico'), path.join(destDir, '..', 'favicon.ico'))\n}\n\nasync function writeWebManifest(basePath: string, destDir: string): Promise<void> {\n const content = JSON.stringify(generateWebManifest(basePath), null, 2)\n await fs\n .writeFile(path.join(destDir, 'manifest.webmanifest'), content, 'utf8')\n .catch(skipIfExistsError)\n}\n","import {type Plugin} from 'vite'\n\nexport function sanityBasePathRedirectPlugin(basePath: string | undefined): Plugin {\n return {\n name: 'sanity/server/sanity-base-path-redirect',\n apply: 'serve',\n configurePreviewServer(vitePreviewServer) {\n return () => {\n if (!basePath) {\n return\n }\n\n vitePreviewServer.middlewares.use((req, res, next) => {\n if (req.url !== '/') {\n next()\n return\n }\n\n res.writeHead(302, {Location: basePath})\n res.end()\n })\n }\n },\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type UserViteConfig} from '@sanity/cli'\nimport chalk from 'chalk'\nimport {type InlineConfig} from 'vite'\n\nimport {debug as serverDebug} from './debug'\nimport {extendViteConfigWithUserConfig} from './getViteConfig'\nimport {sanityBasePathRedirectPlugin} from './vite/plugin-sanity-basepath-redirect'\n\nconst debug = serverDebug.extend('preview')\n\nexport interface PreviewServer {\n urls: {local: string[]; network: string[]}\n close(): Promise<void>\n}\n\nexport interface PreviewServerOptions {\n root: string\n cwd: string\n\n httpPort: number\n httpHost?: string\n\n vite?: UserViteConfig\n isApp?: boolean\n}\n\nexport async function startPreviewServer(options: PreviewServerOptions): Promise<PreviewServer> {\n const {httpPort, httpHost, root, vite: extendViteConfig, isApp} = options\n const startTime = Date.now()\n\n const indexPath = path.join(root, 'index.html')\n let basePath: string | undefined\n try {\n const index = await fs.readFile(indexPath, 'utf8')\n basePath = tryResolveBasePathFromIndex(index)\n } catch (err) {\n if (err.code !== 'ENOENT') {\n throw err\n }\n\n const error = new Error(\n `Could not find a production build in the '${root}' directory.\\nTry building your ${isApp ? 'application' : 'studio '}app with 'sanity build' before starting the preview server.`,\n )\n error.name = 'BUILD_NOT_FOUND'\n throw error\n }\n\n const mode = 'production'\n let previewConfig: InlineConfig = {\n root,\n base: basePath || '/',\n plugins: [sanityBasePathRedirectPlugin(basePath)],\n configFile: false,\n preview: {\n port: httpPort,\n host: httpHost,\n strictPort: true,\n },\n // Needed for vite to not serve `root/dist`\n build: {\n outDir: root,\n },\n mode,\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n previewConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n previewConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const {preview} = await import('vite')\n const server = await preview(previewConfig)\n const warn = server.config.logger.warn\n const info = server.config.logger.info\n const url = server.resolvedUrls!.local[0]\n\n if (typeof basePath === 'undefined') {\n warn('Could not determine base path from index.html, using \"/\" as default')\n } else if (basePath && basePath !== '/') {\n info(`Using resolved base path from static build: ${chalk.cyan(basePath)}`)\n }\n\n const startupDuration = Date.now() - startTime\n\n info(\n `Sanity ${isApp ? 'application' : 'Studio'} ` +\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)} (production preview mode)`,\n )\n\n return {\n urls: server.resolvedUrls!,\n close: () =>\n new Promise((resolve, reject) =>\n server.httpServer.close((err) => (err ? reject(err) : resolve())),\n ),\n }\n}\n\nfunction tryResolveBasePathFromIndex(index: string): string | undefined {\n // <script ... src=\"/some-base-path/static/sanity-a3cc3d86.js\"></script>\n const basePath = index.match(/<script[^>]+src=\"(.*?)\\/static\\/sanity-/)?.[1]\n\n // We _expect_ to be able to find the base path. If we can't, we should warn.\n // Note that we're checking for `undefined` here, since an empty string is a\n // valid base path.\n if (typeof basePath === 'undefined') {\n return undefined\n }\n\n // In the case of an empty base path, we still want to return `/` to indicate\n // that we _found_ the basepath - it just happens to be empty. Eg:\n // <script ... src = \"/static/sanity-a3cc3d86.js\"></script>\n // Which differs from not being able to find the script tag at all, in which\n // case we'll want to show a warning to indicate that it is an abnormality.\n return basePath === '' ? '/' : basePath\n}\n"],"names":["debug","serverDebug","extend","buildStaticFiles","options","cwd","outputDir","sourceMap","minify","basePath","vite","extendViteConfig","importMap","reactCompiler","entry","isApp","writeSanityRuntime","reactStrictMode","watch","mode","viteConfig","getViteConfig","extendViteConfigWithUserConfig","command","finalizeViteConfig","staticPath","path","join","copyDir","faviconBasePath","replace","writeFavicons","build","bundle","Array","isArray","chunks","stats","output","forEach","chunk","type","push","name","modules","Object","entries","map","rawFilePath","chunkModule","filePath","startsWith","slice","isAbsolute","relative","originalLength","renderedLength","srcDir","destDir","skipExisting","fs","mkdir","recursive","file","tryReadDir","srcFile","resolve","destFile","stat","isDirectory","copyFile","fsConstants","COPYFILE_EXCL","catch","skipIfExistsError","dir","readdir","err","code","sanityPkgPath","readPkgUp","__dirname","faviconsPath","dirname","undefined","Error","writeWebManifest","content","JSON","stringify","generateWebManifest","writeFile","sanityBasePathRedirectPlugin","apply","configurePreviewServer","vitePreviewServer","middlewares","use","req","res","next","url","writeHead","Location","end","startPreviewServer","httpPort","httpHost","root","startTime","Date","now","indexPath","index","readFile","tryResolveBasePathFromIndex","error","previewConfig","base","plugins","configFile","preview","port","host","strictPort","outDir","server","warn","config","logger","info","resolvedUrls","local","chalk","cyan","startupDuration","require","version","Math","ceil","urls","close","Promise","reject","httpServer","match"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,UAAQC,QAAAA,MAAYC,OAAO,QAAQ;AA4BzC,eAAsBC,iBACpBC,SACiC;AAC3B,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,YAAY;AAAA,IACZC,SAAS;AAAA,IACTC;AAAAA,IACAC,MAAMC;AAAAA,IACNC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,EAAAA,IACEX;AAEEJ,UAAA,8BAA8B,GACpC,MAAMgB,2BAAmB;AAAA,IACvBX;AAAAA,IACAY,iBAAiB;AAAA,IACjBC,OAAO;AAAA,IACPT;AAAAA,IACAK;AAAAA,IACAC;AAAAA,EAAAA,CACD,GAEDf,QAAM,uBAAuB;AAC7B,QAAMmB,OAAO;AAC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,QAAAA,kBAAkBzB,KAAKC,IAAAA,IAAQF;AAErCqB,SAAAA,KACE,UAAUnH,QAAQ,gBAAgB,QAAQ,UAC/BsH,eAAAA,QAAMC,KAAK,QAAQE,QAAQ,mBAAmB,EAAEC,OAAO,EAAE,CAAC,aACvDJ,eAAMC,QAAAA,KAAK,GAAGI,KAAKC,KAAKJ,eAAe,CAAC,IAAI,CAAC,mBACvCF,eAAAA,QAAMC,KAAKjC,GAAG,CAAC,4BACrC,GAEO;AAAA,IACLuC,MAAMd,OAAOK;AAAAA,IACbU,OAAOA,MACL,IAAIC,QAAQ,CAAC5E,SAAS6E,WACpBjB,OAAOkB,WAAWH,MAAOhE,SAASA,MAAMkE,OAAOlE,GAAG,IAAIX,SAAU,CAClE;AAAA,EACJ;AACF;AAEA,SAASiD,4BAA4BF,OAAmC;AAEtE,QAAMxG,WAAWwG,MAAMgC,MAAM,yCAAyC,IAAI,CAAC;AAK3E,MAAI,SAAOxI,WAAa;AASjBA,WAAAA,aAAa,KAAK,MAAMA;AACjC;;;"}
|
1
|
+
{"version":3,"file":"previewServer.js","sources":["../../src/_internal/cli/server/buildStaticFiles.ts","../../src/_internal/cli/server/vite/plugin-sanity-basepath-redirect.ts","../../src/_internal/cli/server/previewServer.ts"],"sourcesContent":["import {constants as fsConstants} from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type ReactCompilerConfig, type UserViteConfig} from '@sanity/cli'\nimport readPkgUp from 'read-pkg-up'\n\nimport {debug as serverDebug} from './debug'\nimport {extendViteConfigWithUserConfig, finalizeViteConfig, getViteConfig} from './getViteConfig'\nimport {writeSanityRuntime} from './runtime'\nimport {generateWebManifest} from './webManifest'\n\nconst debug = serverDebug.extend('static')\n\nexport interface ChunkModule {\n name: string\n originalLength: number\n renderedLength: number\n}\n\nexport interface ChunkStats {\n name: string\n modules: ChunkModule[]\n}\n\nexport interface StaticBuildOptions {\n cwd: string\n basePath: string\n outputDir: string\n minify?: boolean\n profile?: boolean\n sourceMap?: boolean\n importMap?: {imports?: Record<string, string>}\n\n vite?: UserViteConfig\n reactCompiler: ReactCompilerConfig | undefined\n entry?: string\n isApp?: boolean\n}\n\nexport async function buildStaticFiles(\n options: StaticBuildOptions,\n): Promise<{chunks: ChunkStats[]}> {\n const {\n cwd,\n outputDir,\n sourceMap = false,\n minify = true,\n basePath,\n vite: extendViteConfig,\n importMap,\n reactCompiler,\n entry,\n isApp,\n } = options\n\n debug('Writing Sanity runtime files')\n await writeSanityRuntime({\n cwd,\n reactStrictMode: false,\n watch: false,\n basePath,\n entry,\n isApp,\n })\n\n debug('Resolving vite config')\n const mode = 'production'\n let viteConfig = await getViteConfig({\n cwd,\n basePath,\n outputDir,\n minify,\n sourceMap,\n mode,\n importMap,\n reactCompiler,\n isApp,\n })\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'build', mode},\n viteConfig,\n extendViteConfig,\n )\n viteConfig = await finalizeViteConfig(viteConfig)\n }\n\n // Copy files placed in /static to the built /static\n debug('Copying static files from /static to output dir')\n const staticPath = path.join(outputDir, 'static')\n await copyDir(path.join(cwd, 'static'), staticPath)\n\n // Write favicons, not overwriting ones that already exist, to static folder\n debug('Writing favicons to output dir')\n const faviconBasePath = `${basePath.replace(/\\/+$/, '')}/static`\n await writeFavicons(faviconBasePath, staticPath)\n\n debug('Bundling using vite')\n const {build} = await import('vite')\n const bundle = await build(viteConfig)\n debug('Bundling complete')\n\n // For typescript only - this shouldn't ever be the case given we're not watching\n if (Array.isArray(bundle) || !('output' in bundle)) {\n return {chunks: []}\n }\n\n const stats: ChunkStats[] = []\n bundle.output.forEach((chunk) => {\n if (chunk.type !== 'chunk') {\n return\n }\n\n stats.push({\n name: chunk.name,\n modules: Object.entries(chunk.modules).map(([rawFilePath, chunkModule]) => {\n const filePath = rawFilePath.startsWith('\\x00')\n ? rawFilePath.slice('\\x00'.length)\n : rawFilePath\n\n return {\n name: path.isAbsolute(filePath) ? path.relative(cwd, filePath) : filePath,\n originalLength: chunkModule.originalLength,\n renderedLength: chunkModule.renderedLength,\n }\n }),\n })\n })\n\n return {chunks: stats}\n}\n\nasync function copyDir(srcDir: string, destDir: string, skipExisting?: boolean): Promise<void> {\n await fs.mkdir(destDir, {recursive: true})\n\n for (const file of await tryReadDir(srcDir)) {\n const srcFile = path.resolve(srcDir, file)\n if (srcFile === destDir) {\n continue\n }\n\n const destFile = path.resolve(destDir, file)\n const stat = await fs.stat(srcFile)\n\n if (stat.isDirectory()) {\n await copyDir(srcFile, destFile, skipExisting)\n } else if (skipExisting) {\n await fs.copyFile(srcFile, destFile, fsConstants.COPYFILE_EXCL).catch(skipIfExistsError)\n } else {\n await fs.copyFile(srcFile, destFile)\n }\n }\n}\n\nasync function tryReadDir(dir: string): Promise<string[]> {\n try {\n const content = await fs.readdir(dir)\n return content\n } catch (err) {\n if (err.code === 'ENOENT') {\n return []\n }\n\n throw err\n }\n}\n\nfunction skipIfExistsError(err: Error & {code: string}) {\n if (err.code === 'EEXIST') {\n return\n }\n\n throw err\n}\n\nasync function writeFavicons(basePath: string, destDir: string): Promise<void> {\n const sanityPkgPath = (await readPkgUp({cwd: __dirname}))?.path\n const faviconsPath = sanityPkgPath\n ? path.join(path.dirname(sanityPkgPath), 'static', 'favicons')\n : undefined\n\n if (!faviconsPath) {\n throw new Error('Unable to resolve `sanity` module root')\n }\n\n await fs.mkdir(destDir, {recursive: true})\n await copyDir(faviconsPath, destDir, true)\n await writeWebManifest(basePath, destDir)\n\n // Copy the /static/favicon.ico to /favicon.ico as well, because some tools/browsers\n // blindly expects it to be there before requesting the HTML containing the actual path\n await fs.copyFile(path.join(destDir, 'favicon.ico'), path.join(destDir, '..', 'favicon.ico'))\n}\n\nasync function writeWebManifest(basePath: string, destDir: string): Promise<void> {\n const content = JSON.stringify(generateWebManifest(basePath), null, 2)\n await fs\n .writeFile(path.join(destDir, 'manifest.webmanifest'), content, 'utf8')\n .catch(skipIfExistsError)\n}\n","import {type Plugin} from 'vite'\n\nexport function sanityBasePathRedirectPlugin(basePath: string | undefined): Plugin {\n return {\n name: 'sanity/server/sanity-base-path-redirect',\n apply: 'serve',\n configurePreviewServer(vitePreviewServer) {\n return () => {\n if (!basePath) {\n return\n }\n\n vitePreviewServer.middlewares.use((req, res, next) => {\n if (req.url !== '/') {\n next()\n return\n }\n\n res.writeHead(302, {Location: basePath})\n res.end()\n })\n }\n },\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {type UserViteConfig} from '@sanity/cli'\nimport chalk from 'chalk'\nimport {type InlineConfig} from 'vite'\n\nimport {debug as serverDebug} from './debug'\nimport {extendViteConfigWithUserConfig} from './getViteConfig'\nimport {sanityBasePathRedirectPlugin} from './vite/plugin-sanity-basepath-redirect'\n\nconst debug = serverDebug.extend('preview')\n\nexport interface PreviewServer {\n urls: {local: string[]; network: string[]}\n close(): Promise<void>\n}\n\nexport interface PreviewServerOptions {\n root: string\n cwd: string\n\n httpPort: number\n httpHost?: string\n\n vite?: UserViteConfig\n isApp?: boolean\n}\n\nexport async function startPreviewServer(options: PreviewServerOptions): Promise<PreviewServer> {\n const {httpPort, httpHost, root, vite: extendViteConfig, isApp} = options\n const startTime = Date.now()\n\n const indexPath = path.join(root, 'index.html')\n let basePath: string | undefined\n try {\n const index = await fs.readFile(indexPath, 'utf8')\n basePath = tryResolveBasePathFromIndex(index)\n } catch (err) {\n if (err.code !== 'ENOENT') {\n throw err\n }\n\n const error = new Error(\n `Could not find a production build in the '${root}' directory.\\nTry building your ${isApp ? 'application' : 'studio '}app with 'sanity build' before starting the preview server.`,\n )\n error.name = 'BUILD_NOT_FOUND'\n throw error\n }\n\n const mode = 'production'\n let previewConfig: InlineConfig = {\n root,\n base: basePath || '/',\n plugins: [sanityBasePathRedirectPlugin(basePath)],\n configFile: false,\n preview: {\n port: httpPort,\n host: httpHost,\n strictPort: true,\n },\n // Needed for vite to not serve `root/dist`\n build: {\n outDir: root,\n },\n mode,\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n previewConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n previewConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const {preview} = await import('vite')\n const server = await preview(previewConfig)\n const warn = server.config.logger.warn\n const info = server.config.logger.info\n const url = server.resolvedUrls!.local[0]\n\n if (typeof basePath === 'undefined') {\n warn('Could not determine base path from index.html, using \"/\" as default')\n } else if (basePath && basePath !== '/') {\n info(`Using resolved base path from static build: ${chalk.cyan(basePath)}`)\n }\n\n const startupDuration = Date.now() - startTime\n\n info(\n `Sanity ${isApp ? 'application' : 'Studio'} ` +\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)} (production preview mode)`,\n )\n\n return {\n urls: server.resolvedUrls!,\n close: () =>\n new Promise((resolve, reject) =>\n server.httpServer.close((err) => (err ? reject(err) : resolve())),\n ),\n }\n}\n\nfunction tryResolveBasePathFromIndex(index: string): string | undefined {\n // <script ... src=\"/some-base-path/static/sanity-a3cc3d86.js\"></script>\n const basePath = index.match(/<script[^>]+src=\"(.*?)\\/static\\/sanity-/)?.[1]\n\n // We _expect_ to be able to find the base path. If we can't, we should warn.\n // Note that we're checking for `undefined` here, since an empty string is a\n // valid base path.\n if (typeof basePath === 'undefined') {\n return undefined\n }\n\n // In the case of an empty base path, we still want to return `/` to indicate\n // that we _found_ the basepath - it just happens to be empty. Eg:\n // <script ... src = \"/static/sanity-a3cc3d86.js\"></script>\n // Which differs from not being able to find the script tag at all, in which\n // case we'll want to show a warning to indicate that it is an abnormality.\n return basePath === '' ? '/' : basePath\n}\n"],"names":["debug","serverDebug","extend","buildStaticFiles","options","cwd","outputDir","sourceMap","minify","basePath","vite","extendViteConfig","importMap","reactCompiler","entry","isApp","writeSanityRuntime","reactStrictMode","watch","mode","viteConfig","getViteConfig","extendViteConfigWithUserConfig","command","finalizeViteConfig","staticPath","path","join","copyDir","faviconBasePath","replace","writeFavicons","build","bundle","Array","isArray","chunks","stats","output","forEach","chunk","type","push","name","modules","Object","entries","map","rawFilePath","chunkModule","filePath","startsWith","slice","isAbsolute","relative","originalLength","renderedLength","srcDir","destDir","skipExisting","fs","mkdir","recursive","file","tryReadDir","srcFile","resolve","destFile","stat","isDirectory","copyFile","fsConstants","COPYFILE_EXCL","catch","skipIfExistsError","dir","readdir","err","code","sanityPkgPath","readPkgUp","__dirname","faviconsPath","dirname","undefined","Error","writeWebManifest","content","JSON","stringify","generateWebManifest","writeFile","sanityBasePathRedirectPlugin","apply","configurePreviewServer","vitePreviewServer","middlewares","use","req","res","next","url","writeHead","Location","end","startPreviewServer","httpPort","httpHost","root","startTime","Date","now","indexPath","index","readFile","tryResolveBasePathFromIndex","error","previewConfig","base","plugins","configFile","preview","port","host","strictPort","outDir","server","warn","config","logger","info","resolvedUrls","local","chalk","cyan","startupDuration","require","version","Math","ceil","urls","close","Promise","reject","httpServer","match"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,UAAQC,QAAAA,MAAYC,OAAO,QAAQ;AA4BzC,eAAsBC,iBACpBC,SACiC;AAC3B,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,YAAY;AAAA,IACZC,SAAS;AAAA,IACTC;AAAAA,IACAC,MAAMC;AAAAA,IACNC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,EAAAA,IACEX;AAEEJ,UAAA,8BAA8B,GACpC,MAAMgB,2BAAmB;AAAA,IACvBX;AAAAA,IACAY,iBAAiB;AAAA,IACjBC,OAAO;AAAA,IACPT;AAAAA,IACAK;AAAAA,IACAC;AAAAA,EAAAA,CACD,GAEDf,QAAM,uBAAuB;AAC7B,QAAMmB,OAAO;AACTC,MAAAA,aAAa,MAAMC,sBAAc;AAAA,IACnChB;AAAAA,IACAI;AAAAA,IACAH;AAAAA,IACAE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,UAC/BsH,eAAAA,QAAMC,KAAK,QAAQE,QAAQ,mBAAmB,EAAEC,OAAO,EAAE,CAAC,aACvDJ,eAAMC,QAAAA,KAAK,GAAGI,KAAKC,KAAKJ,eAAe,CAAC,IAAI,CAAC,mBACvCF,eAAAA,QAAMC,KAAKjC,GAAG,CAAC,4BACrC,GAEO;AAAA,IACLuC,MAAMd,OAAOK;AAAAA,IACbU,OAAOA,MACL,IAAIC,QAAQ,CAAC5E,SAAS6E,WACpBjB,OAAOkB,WAAWH,MAAOhE,SAASA,MAAMkE,OAAOlE,GAAG,IAAIX,SAAU,CAClE;AAAA,EACJ;AACF;AAEA,SAASiD,4BAA4BF,OAAmC;AAEtE,QAAMxG,WAAWwG,MAAMgC,MAAM,yCAAyC,IAAI,CAAC;AAK3E,MAAI,SAAOxI,WAAa;AASjBA,WAAAA,aAAa,KAAK,MAAMA;AACjC;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "sanity",
|
3
|
-
"version": "3.94.1-next.
|
3
|
+
"version": "3.94.1-next.3.494b51faaa",
|
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",
|
@@ -150,11 +150,11 @@
|
|
150
150
|
"@rexxars/react-json-inspector": "^9.0.1",
|
151
151
|
"@sanity/asset-utils": "^2.2.1",
|
152
152
|
"@sanity/bifur-client": "^0.4.1",
|
153
|
-
"@sanity/cli": "3.94.1-next.
|
153
|
+
"@sanity/cli": "3.94.1-next.3.494b51faaa",
|
154
154
|
"@sanity/client": "^7.6.0",
|
155
155
|
"@sanity/color": "^3.0.6",
|
156
156
|
"@sanity/comlink": "^3.0.5",
|
157
|
-
"@sanity/diff": "3.94.1-next.
|
157
|
+
"@sanity/diff": "3.94.1-next.3.494b51faaa",
|
158
158
|
"@sanity/diff-match-patch": "^3.2.0",
|
159
159
|
"@sanity/diff-patch": "^5.0.0",
|
160
160
|
"@sanity/eventsource": "^5.0.2",
|
@@ -167,16 +167,16 @@
|
|
167
167
|
"@sanity/logos": "^2.2.0",
|
168
168
|
"@sanity/media-library-types": "^1.0.0",
|
169
169
|
"@sanity/message-protocol": "^0.13.0",
|
170
|
-
"@sanity/migrate": "3.94.1-next.
|
171
|
-
"@sanity/mutator": "3.94.1-next.
|
170
|
+
"@sanity/migrate": "3.94.1-next.3.494b51faaa",
|
171
|
+
"@sanity/mutator": "3.94.1-next.3.494b51faaa",
|
172
172
|
"@sanity/presentation-comlink": "^1.0.21",
|
173
173
|
"@sanity/preview-url-secret": "^2.1.11",
|
174
|
-
"@sanity/schema": "3.94.1-next.
|
174
|
+
"@sanity/schema": "3.94.1-next.3.494b51faaa",
|
175
175
|
"@sanity/sdk": "0.0.0-alpha.25",
|
176
176
|
"@sanity/telemetry": "^0.8.0",
|
177
|
-
"@sanity/types": "3.94.1-next.
|
177
|
+
"@sanity/types": "3.94.1-next.3.494b51faaa",
|
178
178
|
"@sanity/ui": "^2.16.2",
|
179
|
-
"@sanity/util": "3.94.1-next.
|
179
|
+
"@sanity/util": "3.94.1-next.3.494b51faaa",
|
180
180
|
"@sanity/uuid": "^3.0.2",
|
181
181
|
"@sentry/react": "^8.33.0",
|
182
182
|
"@tanstack/react-table": "^8.21.3",
|
@@ -285,7 +285,7 @@
|
|
285
285
|
"@repo/package.bundle": "3.94.0",
|
286
286
|
"@repo/package.config": "3.94.0",
|
287
287
|
"@repo/test-config": "3.94.0",
|
288
|
-
"@sanity/codegen": "3.94.1-next.
|
288
|
+
"@sanity/codegen": "3.94.1-next.3.494b51faaa",
|
289
289
|
"@sanity/eslint-config-i18n": "^2.0.0",
|
290
290
|
"@sanity/generate-help-url": "^3.0.0",
|
291
291
|
"@sanity/pkg-utils": "6.13.4",
|
@@ -334,5 +334,5 @@
|
|
334
334
|
"engines": {
|
335
335
|
"node": ">=18"
|
336
336
|
},
|
337
|
-
"gitHead": "
|
337
|
+
"gitHead": "494b51faaa02bdff3e0c0ea5e45221894a71997c"
|
338
338
|
}
|