sanity 5.0.0-next-major.20251215093220 → 5.0.0-next-major.20251215141517
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/index.js +1 -1
- package/lib/index.js.map +1 -1
- 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
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.20251215141517+afca06069e",
|
|
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/migrate": "5.0.0-next-major.
|
|
256
|
-
"@sanity/mutator": "5.0.0-next-major.
|
|
257
|
-
"@sanity/
|
|
258
|
-
"@sanity/
|
|
259
|
-
"@sanity/util": "5.0.0-next-major.
|
|
253
|
+
"@sanity/cli": "5.0.0-next-major.20251215141517+afca06069e",
|
|
254
|
+
"@sanity/diff": "5.0.0-next-major.20251215141517+afca06069e",
|
|
255
|
+
"@sanity/migrate": "5.0.0-next-major.20251215141517+afca06069e",
|
|
256
|
+
"@sanity/mutator": "5.0.0-next-major.20251215141517+afca06069e",
|
|
257
|
+
"@sanity/types": "5.0.0-next-major.20251215141517+afca06069e",
|
|
258
|
+
"@sanity/schema": "5.0.0-next-major.20251215141517+afca06069e",
|
|
259
|
+
"@sanity/util": "5.0.0-next-major.20251215141517+afca06069e"
|
|
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/
|
|
306
|
-
"@repo/
|
|
307
|
-
"@repo/package.bundle": "5.0.0-next-major.
|
|
308
|
-
"@repo/package.config": "5.0.0-next-major.
|
|
309
|
-
"@repo/test-config": "5.0.0-next-major.
|
|
310
|
-
"@
|
|
311
|
-
"@
|
|
305
|
+
"@repo/eslint-config": "5.0.0-next-major.20251215141517+afca06069e",
|
|
306
|
+
"@repo/dev-aliases": "5.0.0-next-major.20251215141517+afca06069e",
|
|
307
|
+
"@repo/package.bundle": "5.0.0-next-major.20251215141517+afca06069e",
|
|
308
|
+
"@repo/package.config": "5.0.0-next-major.20251215141517+afca06069e",
|
|
309
|
+
"@repo/test-config": "5.0.0-next-major.20251215141517+afca06069e",
|
|
310
|
+
"@sanity/codegen": "5.0.0-next-major.20251215141517+afca06069e",
|
|
311
|
+
"@repo/tsconfig": "5.0.0-next-major.20251215141517+afca06069e"
|
|
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,iBAAg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