@sanity/cli-build 5.3.0 → 5.3.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveLocalPackage } from '@sanity/cli-core/package-manager';
|
|
3
3
|
import { buildDebug } from '../buildDebug.js';
|
|
4
4
|
import { addTimestampedImportMapScriptToHtml } from './addTimestampImportMapScriptToHtml.js';
|
|
5
5
|
import { getDocumentComponent } from './getDocumentComponent.js';
|
|
@@ -29,6 +29,7 @@ import { getDocumentComponent } from './getDocumentComponent.js';
|
|
|
29
29
|
* @internal
|
|
30
30
|
*/ export async function getDocumentHtml(parent, studioRootPath, props, importMap, isApp, autoUpdatesCssUrls) {
|
|
31
31
|
const Document = await getDocumentComponent(parent, studioRootPath, isApp);
|
|
32
|
+
const { renderToStaticMarkup } = await resolveLocalPackage('react-dom/server', studioRootPath);
|
|
32
33
|
const defaultProps = {
|
|
33
34
|
entryPath: './.sanity/runtime/app.js'
|
|
34
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/renderDocumentWorker/getDocumentHtml.tsx"],"sourcesContent":["import {type MessagePort} from 'node:worker_threads'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/renderDocumentWorker/getDocumentHtml.tsx"],"sourcesContent":["import {type MessagePort} from 'node:worker_threads'\n\nimport {resolveLocalPackage} from '@sanity/cli-core/package-manager'\n\nimport {buildDebug} from '../buildDebug.js'\nimport {addTimestampedImportMapScriptToHtml} from './addTimestampImportMapScriptToHtml.js'\nimport {getDocumentComponent} from './getDocumentComponent.js'\nimport {type DocumentProps} from './types.js'\n\n/**\n * Adds a base path to a URL if necessary, and returns the resulting URL.\n * @param url - The URL to prefix with a base path.\n * @param basePath - The base path to prefix the URL with. Default value is `/`.\n * @returns The resulting URL with the base path.\n * @internal\n */\nfunction _prefixUrlWithBasePath(url: string, basePath: string): string {\n // Normalize basePath by adding a leading slash if it's missing.\n const normalizedBasePath = basePath.startsWith('/') ? basePath : `/${basePath}`\n\n // If the URL starts with a slash, append it to the basePath, removing any trailing slash if present.\n if (url.startsWith('/')) {\n if (normalizedBasePath.endsWith('/')) {\n return `${normalizedBasePath.slice(0, -1)}${url}`\n }\n return `${normalizedBasePath}${url}`\n }\n\n // If the URL doesn't start with a slash, append it to the basePath with a slash in between.\n if (normalizedBasePath.endsWith('/')) {\n return `${normalizedBasePath}${url}`\n }\n return `${normalizedBasePath}/${url}`\n}\n\n/**\n * @internal\n */\nexport async function getDocumentHtml(\n parent: MessagePort,\n studioRootPath: string,\n props?: DocumentProps,\n importMap?: {imports?: Record<string, string>},\n isApp?: boolean,\n autoUpdatesCssUrls?: string[],\n): Promise<string> {\n const Document = await getDocumentComponent(parent, studioRootPath, isApp)\n const {renderToStaticMarkup} = await resolveLocalPackage<typeof import('react-dom/server')>(\n 'react-dom/server',\n studioRootPath,\n )\n\n const defaultProps = {\n entryPath: './.sanity/runtime/app.js',\n }\n\n // NOTE: Validate the list of CSS paths so implementers of `_document.tsx` don't have to\n // - If the path is not a full URL, check if it starts with `/`\n // - If not, then prepend a `/` to the string\n const css = props?.css?.map((url) => {\n try {\n // If the URL is absolute, we don't need to prefix it\n return new URL(url).toString()\n } catch {\n return _prefixUrlWithBasePath(url, props.basePath)\n }\n })\n\n buildDebug('Rendering document component using React')\n const result = addTimestampedImportMapScriptToHtml(\n renderToStaticMarkup(<Document {...defaultProps} {...props} css={css} />),\n importMap,\n autoUpdatesCssUrls,\n )\n\n return `<!DOCTYPE html>${result}`\n}\n"],"names":["resolveLocalPackage","buildDebug","addTimestampedImportMapScriptToHtml","getDocumentComponent","_prefixUrlWithBasePath","url","basePath","normalizedBasePath","startsWith","endsWith","slice","getDocumentHtml","parent","studioRootPath","props","importMap","isApp","autoUpdatesCssUrls","Document","renderToStaticMar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,SAASxB,oCACbiB,mCAAqB,KAACD;QAAU,GAAGE,YAAY;QAAG,GAAGN,KAAK;QAAEQ,KAAKA;SACjEP,WACAE;IAGF,OAAO,CAAC,eAAe,EAAES,QAAQ;AACnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-build",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Internal Sanity package for building studios and apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -61,12 +61,11 @@
|
|
|
61
61
|
"oneline": "^2.0.0",
|
|
62
62
|
"picomatch": "^4.0.4",
|
|
63
63
|
"react": "^19.2.7",
|
|
64
|
-
"react-dom": "^19.2.7",
|
|
65
64
|
"semver": "^7.8.1",
|
|
66
65
|
"vite": "^8.2.1",
|
|
67
66
|
"zod": "^4.4.3",
|
|
68
|
-
"@sanity/cli-core": "^3.
|
|
69
|
-
"@sanity/workbench-cli": "^2.0
|
|
67
|
+
"@sanity/cli-core": "^3.3.0",
|
|
68
|
+
"@sanity/workbench-cli": "^2.1.0"
|
|
70
69
|
},
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@eslint/compat": "^2.1.0",
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
"vitest": "^4.1.11",
|
|
92
91
|
"@repo/package.config": "0.0.1",
|
|
93
92
|
"@repo/tsconfig": "3.70.0",
|
|
94
|
-
"@sanity/cli-test": "
|
|
93
|
+
"@sanity/cli-test": "13.0.0",
|
|
95
94
|
"@sanity/eslint-config-cli": "^1.1.3"
|
|
96
95
|
},
|
|
97
96
|
"peerDependencies": {
|