@sanity/cli-build 6.4.2 → 6.4.4
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.
|
@@ -43,7 +43,9 @@ const errorHandlerScript = `
|
|
|
43
43
|
// - If there are no subscribers, then we log the error to the console and render the error overlay.
|
|
44
44
|
if (errorChannel.subscribers.length) {
|
|
45
45
|
errorChannel.publish({error, params})
|
|
46
|
-
} else {
|
|
46
|
+
} else if (error) {
|
|
47
|
+
// Browsers fire some error events without an error object (a ResizeObserver loop,
|
|
48
|
+
// a cross-origin "Script error."), and there is nothing useful to show for them.
|
|
47
49
|
console.error(error)
|
|
48
50
|
|
|
49
51
|
_renderErrorOverlay(error, params)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/actions/build/renderDocumentWorker/components/GlobalErrorHandler.tsx"],"sourcesContent":["import {type JSX} from 'react'\n\nconst errorHandlerScript = `\n;(function () {\n var _caughtErrors = []\n\n var errorChannel = (function () {\n var subscribers = []\n\n function publish(msg) {\n for (var i = 0; i < subscribers.length; i += 1) {\n subscribers[i](msg)\n }\n }\n\n function subscribe(subscriber) {\n subscribers.push(subscriber)\n\n return function () {\n var idx = subscribers.indexOf(subscriber)\n\n if (idx > -1) {\n subscribers.splice(idx, 1)\n }\n }\n }\n\n return {publish, subscribe, subscribers}\n })()\n\n // NOTE: Store the error channel instance in the global scope so that the application can\n // access it and subscribe to errors.\n window.__sanityErrorChannel = {\n subscribe: errorChannel.subscribe,\n }\n\n function _nextTick(callback) {\n setTimeout(callback, 0)\n }\n\n function _handleError(error, params) {\n _nextTick(function () {\n // - If there are error channel subscribers, then we notify them (no console error).\n // - If there are no subscribers, then we log the error to the console and render the error overlay.\n if (errorChannel.subscribers.length) {\n errorChannel.publish({error, params})\n } else {\n console.error(error)\n\n _renderErrorOverlay(error, params)\n }\n })\n }\n\n var ERROR_BOX_STYLE = [\n 'background: #fff',\n 'border-radius: 6px',\n 'box-sizing: border-box',\n 'color: #121923',\n 'flex: 1',\n \"font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue','Liberation Sans',Helvetica,Arial,system-ui,sans-serif\",\n 'font-size: 16px',\n 'line-height: 21px',\n 'margin: 0 auto',\n 'max-width: 960px',\n 'max-height: 90dvh',\n 'overflow: auto',\n 'padding: 20px',\n 'width: 100%',\n ].join(';')\n\n var ERROR_CODE_STYLE = [\n 'color: #972E2A',\n \"font-family: -apple-system-ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace\",\n 'font-size: 13px',\n 'line-height: 17px',\n 'margin: 0',\n ].join(';')\n\n function _renderErrorOverlay(error, params) {\n var errorElement = document.querySelector('#__sanityError') || document.createElement('div')\n var colno = params.event.colno\n var lineno = params.event.lineno\n var filename = params.event.filename\n\n errorElement.id = '__sanityError'\n errorElement.innerHTML = [\n '<div style=\"' + ERROR_BOX_STYLE + '\">',\n '<div style=\"font-weight: 700;\">Uncaught error: ' + error.message + '</div>',\n '<div style=\"color: #515E72; font-size: 13px; line-height: 17px; margin: 10px 0;\">' +\n filename +\n ':' +\n lineno +\n ':' +\n colno +\n '</div>',\n '<pre style=\"' + ERROR_CODE_STYLE + '\">' + error.stack + '</pre>',\n '</div>',\n ].join('')\n\n errorElement.style.position = 'fixed'\n errorElement.style.zIndex = 1000000\n errorElement.style.top = 0\n errorElement.style.left = 0\n errorElement.style.right = 0\n errorElement.style.bottom = 0\n errorElement.style.padding = '20px'\n errorElement.style.background = 'rgba(16,17,18,0.66)'\n errorElement.style.display = 'flex'\n errorElement.style.alignItems = 'center'\n errorElement.style.justifyContent = 'center'\n\n document.body.appendChild(errorElement)\n }\n\n // NOTE:\n // Yes – we're attaching 2 error listeners below 👀\n // This is because React makes the same error throw twice (in development mode).\n // See: https://github.com/facebook/react/issues/10384\n\n // Error listener #1\n window.onerror = function (event, source, lineno, colno, error) {\n _nextTick(function () {\n if (_caughtErrors.indexOf(error) !== -1) return\n\n _caughtErrors.push(error)\n\n _handleError(error, {\n event,\n lineno,\n colno,\n source,\n })\n\n _nextTick(function () {\n var idx = _caughtErrors.indexOf(error)\n\n if (idx > -1) _caughtErrors.splice(idx, 1)\n })\n })\n\n // IMPORTANT: this callback must return \\`true\\` to prevent the error from being rendered in\n // the browser’s console.\n return true\n }\n\n // Error listener #2\n window.addEventListener('error', function (event) {\n if (_caughtErrors.indexOf(event.error) !== -1) return true\n\n _caughtErrors.push(event.error)\n\n _handleError(event.error, {\n event,\n lineno: event.lineno,\n colno: event.colno,\n })\n\n _nextTick(function () {\n _nextTick(function () {\n var idx = _caughtErrors.indexOf(event.error)\n\n if (idx > -1) _caughtErrors.splice(idx, 1)\n })\n })\n\n return true\n })\n})()\n`\n\n/** @internal */\nexport function GlobalErrorHandler(): JSX.Element {\n return <script dangerouslySetInnerHTML={{__html: errorHandlerScript}} />\n}\n"],"names":["errorHandlerScript","GlobalErrorHandler","script","dangerouslySetInnerHTML","__html"],"mappings":";AAEA,MAAMA,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"sources":["../../../../../src/actions/build/renderDocumentWorker/components/GlobalErrorHandler.tsx"],"sourcesContent":["import {type JSX} from 'react'\n\nconst errorHandlerScript = `\n;(function () {\n var _caughtErrors = []\n\n var errorChannel = (function () {\n var subscribers = []\n\n function publish(msg) {\n for (var i = 0; i < subscribers.length; i += 1) {\n subscribers[i](msg)\n }\n }\n\n function subscribe(subscriber) {\n subscribers.push(subscriber)\n\n return function () {\n var idx = subscribers.indexOf(subscriber)\n\n if (idx > -1) {\n subscribers.splice(idx, 1)\n }\n }\n }\n\n return {publish, subscribe, subscribers}\n })()\n\n // NOTE: Store the error channel instance in the global scope so that the application can\n // access it and subscribe to errors.\n window.__sanityErrorChannel = {\n subscribe: errorChannel.subscribe,\n }\n\n function _nextTick(callback) {\n setTimeout(callback, 0)\n }\n\n function _handleError(error, params) {\n _nextTick(function () {\n // - If there are error channel subscribers, then we notify them (no console error).\n // - If there are no subscribers, then we log the error to the console and render the error overlay.\n if (errorChannel.subscribers.length) {\n errorChannel.publish({error, params})\n } else if (error) {\n // Browsers fire some error events without an error object (a ResizeObserver loop,\n // a cross-origin \"Script error.\"), and there is nothing useful to show for them.\n console.error(error)\n\n _renderErrorOverlay(error, params)\n }\n })\n }\n\n var ERROR_BOX_STYLE = [\n 'background: #fff',\n 'border-radius: 6px',\n 'box-sizing: border-box',\n 'color: #121923',\n 'flex: 1',\n \"font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue','Liberation Sans',Helvetica,Arial,system-ui,sans-serif\",\n 'font-size: 16px',\n 'line-height: 21px',\n 'margin: 0 auto',\n 'max-width: 960px',\n 'max-height: 90dvh',\n 'overflow: auto',\n 'padding: 20px',\n 'width: 100%',\n ].join(';')\n\n var ERROR_CODE_STYLE = [\n 'color: #972E2A',\n \"font-family: -apple-system-ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace\",\n 'font-size: 13px',\n 'line-height: 17px',\n 'margin: 0',\n ].join(';')\n\n function _renderErrorOverlay(error, params) {\n var errorElement = document.querySelector('#__sanityError') || document.createElement('div')\n var colno = params.event.colno\n var lineno = params.event.lineno\n var filename = params.event.filename\n\n errorElement.id = '__sanityError'\n errorElement.innerHTML = [\n '<div style=\"' + ERROR_BOX_STYLE + '\">',\n '<div style=\"font-weight: 700;\">Uncaught error: ' + error.message + '</div>',\n '<div style=\"color: #515E72; font-size: 13px; line-height: 17px; margin: 10px 0;\">' +\n filename +\n ':' +\n lineno +\n ':' +\n colno +\n '</div>',\n '<pre style=\"' + ERROR_CODE_STYLE + '\">' + error.stack + '</pre>',\n '</div>',\n ].join('')\n\n errorElement.style.position = 'fixed'\n errorElement.style.zIndex = 1000000\n errorElement.style.top = 0\n errorElement.style.left = 0\n errorElement.style.right = 0\n errorElement.style.bottom = 0\n errorElement.style.padding = '20px'\n errorElement.style.background = 'rgba(16,17,18,0.66)'\n errorElement.style.display = 'flex'\n errorElement.style.alignItems = 'center'\n errorElement.style.justifyContent = 'center'\n\n document.body.appendChild(errorElement)\n }\n\n // NOTE:\n // Yes – we're attaching 2 error listeners below 👀\n // This is because React makes the same error throw twice (in development mode).\n // See: https://github.com/facebook/react/issues/10384\n\n // Error listener #1\n window.onerror = function (event, source, lineno, colno, error) {\n _nextTick(function () {\n if (_caughtErrors.indexOf(error) !== -1) return\n\n _caughtErrors.push(error)\n\n _handleError(error, {\n event,\n lineno,\n colno,\n source,\n })\n\n _nextTick(function () {\n var idx = _caughtErrors.indexOf(error)\n\n if (idx > -1) _caughtErrors.splice(idx, 1)\n })\n })\n\n // IMPORTANT: this callback must return \\`true\\` to prevent the error from being rendered in\n // the browser’s console.\n return true\n }\n\n // Error listener #2\n window.addEventListener('error', function (event) {\n if (_caughtErrors.indexOf(event.error) !== -1) return true\n\n _caughtErrors.push(event.error)\n\n _handleError(event.error, {\n event,\n lineno: event.lineno,\n colno: event.colno,\n })\n\n _nextTick(function () {\n _nextTick(function () {\n var idx = _caughtErrors.indexOf(event.error)\n\n if (idx > -1) _caughtErrors.splice(idx, 1)\n })\n })\n\n return true\n })\n})()\n`\n\n/** @internal */\nexport function GlobalErrorHandler(): JSX.Element {\n return <script dangerouslySetInnerHTML={{__html: errorHandlerScript}} />\n}\n"],"names":["errorHandlerScript","GlobalErrorHandler","script","dangerouslySetInnerHTML","__html"],"mappings":";AAEA,MAAMA,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyK5B,CAAC;AAED,cAAc,GACd,OAAO,SAASC;IACd,qBAAO,KAACC;QAAOC,yBAAyB;YAACC,QAAQJ;QAAkB;;AACrE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-build",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.4",
|
|
4
4
|
"description": "Internal Sanity package for building studios and apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@oclif/core": "^4.11.14",
|
|
54
|
-
"@rolldown/plugin-babel": "^0.2.
|
|
55
|
-
"@sanity/cli-core": "^3.8.
|
|
54
|
+
"@rolldown/plugin-babel": "^0.2.4",
|
|
55
|
+
"@sanity/cli-core": "^3.8.2",
|
|
56
56
|
"@sanity/generate-help-url": "^4.0.0",
|
|
57
57
|
"@sanity/schema": "^6.15.0",
|
|
58
58
|
"@sanity/telemetry": "^1.1.0",
|
|
59
59
|
"@sanity/types": "^6.15.0",
|
|
60
|
-
"@sanity/workbench-cli": "^2.8.
|
|
61
|
-
"@vitejs/plugin-react": "^6.1.
|
|
60
|
+
"@sanity/workbench-cli": "^2.8.3",
|
|
61
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
62
62
|
"chokidar": "^5.0.0",
|
|
63
63
|
"cjs-module-lexer": "^2.2.1",
|
|
64
64
|
"dompurify": "^3.4.14",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"react": "^19.2.7",
|
|
73
73
|
"react-is": "^19.2.7",
|
|
74
74
|
"semver": "^7.8.1",
|
|
75
|
-
"vite": "^8.3.
|
|
75
|
+
"vite": "^8.3.2",
|
|
76
76
|
"zod": "^4.5.2"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@eslint/compat": "^2.1.0",
|
|
80
80
|
"@repo/package.config": "0.0.1",
|
|
81
81
|
"@repo/tsconfig": "3.70.0",
|
|
82
|
-
"@sanity/cli-test": "18.0.
|
|
82
|
+
"@sanity/cli-test": "18.0.2",
|
|
83
83
|
"@sanity/eslint-config-cli": "^1.1.3",
|
|
84
84
|
"@sanity/pkg-utils": "^12.3.4",
|
|
85
85
|
"@sanity/ui": "^4.2.1",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
98
98
|
"eslint": "^10.7.0",
|
|
99
99
|
"magic-string": "^0.30.21",
|
|
100
|
-
"oxc-transform-react": "^0.
|
|
100
|
+
"oxc-transform-react": "^0.152.0",
|
|
101
101
|
"publint": "^0.3.21",
|
|
102
102
|
"sanity": "^6.15.0",
|
|
103
103
|
"styled-components": "^6.4.3",
|