@osdk/widget.vite-plugin 3.3.0 → 3.3.2
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/CHANGELOG.md +13 -0
- package/build/esm/client/app.js +8 -4
- package/build/esm/client/app.js.map +1 -1
- package/build/esm/dev-plugin/publishDevModeSettings.js +15 -2
- package/build/esm/dev-plugin/publishDevModeSettings.js.map +1 -1
- package/build/site/assets/{allPaths-DAStXfot.js → allPaths-DIfrnzgS.js} +1 -1
- package/build/site/assets/{allPathsLoader-Xesz75gG.js → allPathsLoader-D2qNtTEN.js} +2 -2
- package/build/site/assets/{index-DjCw4U9Z.css → index-7niI6nVb.css} +1 -1
- package/build/site/assets/{index-C5U_5Xge.js → index-D6Sm-vP3.js} +9 -9
- package/build/site/assets/{splitPathsBySizeLoader-DLaQMX-t.js → splitPathsBySizeLoader-CuGV5Hrn.js} +1 -1
- package/build/site/index.html +2 -2
- package/build/types/client/app.d.ts.map +1 -1
- package/build/types/dev-plugin/publishDevModeSettings.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdk/widget.vite-plugin
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @osdk/widget.api@3.3.2
|
|
8
|
+
|
|
9
|
+
## 3.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 275b70d: Show hint for WidgetIdNotFound errors
|
|
14
|
+
- @osdk/widget.api@3.3.1
|
|
15
|
+
|
|
3
16
|
## 3.3.0
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/build/esm/client/app.js
CHANGED
|
@@ -20,9 +20,10 @@ import { EntrypointIframe } from "./entrypointIframe.js";
|
|
|
20
20
|
const POLLING_INTERVAL = 250;
|
|
21
21
|
const REDIRECT_DELAY = 500;
|
|
22
22
|
class ResponseError extends Error {
|
|
23
|
-
constructor(message, response) {
|
|
23
|
+
constructor(message, response, hint) {
|
|
24
24
|
super(message);
|
|
25
25
|
this.response = response;
|
|
26
|
+
this.hint = hint;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
export const App = () => {
|
|
@@ -47,7 +48,7 @@ export const App = () => {
|
|
|
47
48
|
}
|
|
48
49
|
if (result.status === "error") {
|
|
49
50
|
if (result.response != null) {
|
|
50
|
-
throw new ResponseError(result.error, result.response);
|
|
51
|
+
throw new ResponseError(result.error, result.response, result.hint);
|
|
51
52
|
}
|
|
52
53
|
throw new Error(result.error);
|
|
53
54
|
}
|
|
@@ -72,7 +73,8 @@ export const App = () => {
|
|
|
72
73
|
setPageState({
|
|
73
74
|
state: "failed",
|
|
74
75
|
error: error instanceof Error ? error.message : undefined,
|
|
75
|
-
response: error instanceof ResponseError ? error.response : undefined
|
|
76
|
+
response: error instanceof ResponseError ? error.response : undefined,
|
|
77
|
+
hint: error instanceof ResponseError ? error.hint : undefined
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
80
|
}, POLLING_INTERVAL);
|
|
@@ -97,7 +99,9 @@ export const App = () => {
|
|
|
97
99
|
}), pageState.state === "failed" && /*#__PURE__*/React.createElement(NonIdealState, {
|
|
98
100
|
title: "Failed to start dev mode",
|
|
99
101
|
icon: "error",
|
|
100
|
-
description: /*#__PURE__*/React.createElement(React.Fragment, null, pageState.
|
|
102
|
+
description: /*#__PURE__*/React.createElement(React.Fragment, null, pageState.hint != null && /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: "hint-block"
|
|
104
|
+
}, pageState.hint), pageState.response != null && /*#__PURE__*/React.createElement(Pre, {
|
|
101
105
|
className: "response-block"
|
|
102
106
|
}, pageState.response), /*#__PURE__*/React.createElement(Pre, {
|
|
103
107
|
className: "response-block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","names":["NonIdealState","Pre","Spinner","SpinnerSize","React","useEffect","EntrypointIframe","POLLING_INTERVAL","REDIRECT_DELAY","ResponseError","Error","constructor","message","response","App","entrypointPaths","setEntrypointPaths","useState","pageState","setPageState","state","numAttempts","useRef","loadEntrypoints","then","poll","window","setInterval","finish","current","result","status","error","clearInterval","isRedirecting","redirectUrl","setTimeout","location","href","catch","console","undefined","createElement","className","title","icon","intent","description","size","SMALL","Fragment","map","entrypointPath","src","key","fetch","res","json","attempt"],"sources":["app.tsx"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NonIdealState, Pre, Spinner, SpinnerSize } from \"@blueprintjs/core\";\nimport React, { useEffect } from \"react\";\nimport { EntrypointIframe } from \"./entrypointIframe.js\";\n\ntype PageState =\n | {\n state: \"loading\";\n }\n | {\n state: \"failed\";\n error?: string;\n response?: string;\n }\n | {\n state: \"success\";\n isRedirecting: boolean;\n };\n\nconst POLLING_INTERVAL = 250;\nconst REDIRECT_DELAY = 500;\n\nclass ResponseError extends Error {\n public readonly response: string;\n\n constructor(message: string, response: string) {\n super(message);\n this.response = response;\n }\n}\n\nexport const App: React.FC = () => {\n const [entrypointPaths, setEntrypointPaths] = React.useState<string[]>([]);\n const [pageState, setPageState] = React.useState<PageState>({\n state: \"loading\",\n });\n const numAttempts = React.useRef(0);\n\n // Load entrypoints values on mount\n useEffect(() => {\n void loadEntrypoints().then(setEntrypointPaths);\n }, []);\n\n // Poll the finish endpoint until it returns a success or error\n useEffect(() => {\n const poll = window.setInterval(() => {\n void finish(numAttempts.current)\n .then((result) => {\n if (result.status === \"pending\") {\n numAttempts.current++;\n return;\n }\n if (result.status === \"error\") {\n if (result.response != null) {\n throw new ResponseError(result.error, result.response);\n }\n throw new Error(result.error);\n }\n\n // On success, we clear the poll and end the loading state\n window.clearInterval(poll);\n setPageState({\n state: \"success\",\n isRedirecting: result.redirectUrl != null,\n });\n\n // When running in Code Workspaces the parent app will handle the redirect\n if (result.status === \"success\" && result.redirectUrl != null) {\n setTimeout(() => {\n window.location.href = result.redirectUrl!;\n }, REDIRECT_DELAY);\n }\n })\n .catch((error: unknown) => {\n window.clearInterval(poll);\n // eslint-disable-next-line no-console\n console.error(\"Failed to finish dev mode setup:\", error);\n setPageState({\n state: \"failed\",\n error: error instanceof Error ? error.message : undefined,\n response: error instanceof ResponseError\n ? error.response\n : undefined,\n });\n });\n }, POLLING_INTERVAL);\n return () => window.clearInterval(poll);\n }, []);\n\n return (\n <div className=\"body\">\n {pageState.state === \"loading\" && (\n <NonIdealState\n title=\"Generating developer mode manifest…\"\n icon={<Spinner intent=\"primary\" />}\n />\n )}\n {pageState.state === \"success\" && (\n <NonIdealState\n title=\"Started dev mode\"\n icon=\"tick-circle\"\n description={\n <div className=\"description\">\n <Spinner intent=\"primary\" size={SpinnerSize.SMALL} />{\" \"}\n {pageState.isRedirecting\n ? <span>Redirecting you…</span>\n : <span>Loading preview…</span>}\n </div>\n }\n />\n )}\n {pageState.state === \"failed\" && (\n <NonIdealState\n title=\"Failed to start dev mode\"\n icon=\"error\"\n description={\n <>\n {pageState.response != null && (\n <Pre className=\"response-block\">{pageState.response}</Pre>\n )}\n <Pre className=\"response-block\">{pageState.error}</Pre>\n </>\n }\n />\n )}\n {/* To load the entrypoint info, we have to actually load it in the browser to get vite to follow the module graph. Since we know these files will fail, we just load them in iframes set to display: none to trigger the load hook in vite */}\n {entrypointPaths.map((entrypointPath) => (\n <EntrypointIframe src={entrypointPath} key={entrypointPath} />\n ))}\n </div>\n );\n};\n\nfunction loadEntrypoints(): Promise<string[]> {\n return fetch(\"../entrypoints\").then((res) => res.json());\n}\n\nfunction finish(attempt: number): Promise<\n | {\n status: \"success\";\n redirectUrl: string | null;\n }\n | {\n status: \"error\";\n error: string;\n response?: string;\n }\n | {\n status: \"pending\";\n }\n> {\n return fetch(`../finish?attempt=${attempt}`).then((res) => res.json());\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,GAAG,EAAEC,OAAO,EAAEC,WAAW,QAAQ,mBAAmB;AAC5E,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,gBAAgB,QAAQ,uBAAuB;AAgBxD,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,cAAc,GAAG,GAAG;AAE1B,MAAMC,aAAa,SAASC,KAAK,CAAC;EAGhCC,WAAWA,CAACC,OAAe,EAAEC,QAAgB,EAAE;IAC7C,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;AACF;AAEA,OAAO,MAAMC,GAAa,GAAGA,CAAA,KAAM;EACjC,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGZ,KAAK,CAACa,QAAQ,CAAW,EAAE,CAAC;EAC1E,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGf,KAAK,CAACa,QAAQ,CAAY;IAC1DG,KAAK,EAAE;EACT,CAAC,CAAC;EACF,MAAMC,WAAW,GAAGjB,KAAK,CAACkB,MAAM,CAAC,CAAC,CAAC;;EAEnC;EACAjB,SAAS,CAAC,MAAM;IACd,KAAKkB,eAAe,CAAC,CAAC,CAACC,IAAI,CAACR,kBAAkB,CAAC;EACjD,CAAC,EAAE,EAAE,CAAC;;EAEN;EACAX,SAAS,CAAC,MAAM;IACd,MAAMoB,IAAI,GAAGC,MAAM,CAACC,WAAW,CAAC,MAAM;MACpC,KAAKC,MAAM,CAACP,WAAW,CAACQ,OAAO,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GAAEzB,SAAS,CAACc,KAAW,CACtD;EACH,CACF,CACF,EAEAjB,eAAe,CAACoC,GAAG,CAAEC,cAAc,iBAClChD,KAAA,CAAAsC,aAAA,CAACpC,gBAAgB;IAAC+C,GAAG,EAAED,cAAe;IAACE,GAAG,EAAEF;EAAe,CAAE,CAC9D,CACE,CAAC;AAEV,CAAC;AAED,SAAS7B,eAAeA,CAAA,EAAsB;EAC5C,OAAOgC,KAAK,CAAC,gBAAgB,CAAC,CAAC/B,IAAI,CAAEgC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AAC1D;AAEA,SAAS7B,MAAMA,CAAC8B,OAAe,EAa7B;EACA,OAAOH,KAAK,CAAC,qBAAqBG,OAAO,EAAE,CAAC,CAAClC,IAAI,CAAEgC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AACxE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"app.js","names":["NonIdealState","Pre","Spinner","SpinnerSize","React","useEffect","EntrypointIframe","POLLING_INTERVAL","REDIRECT_DELAY","ResponseError","Error","constructor","message","response","hint","App","entrypointPaths","setEntrypointPaths","useState","pageState","setPageState","state","numAttempts","useRef","loadEntrypoints","then","poll","window","setInterval","finish","current","result","status","error","clearInterval","isRedirecting","redirectUrl","setTimeout","location","href","catch","console","undefined","createElement","className","title","icon","intent","description","size","SMALL","Fragment","map","entrypointPath","src","key","fetch","res","json","attempt"],"sources":["app.tsx"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NonIdealState, Pre, Spinner, SpinnerSize } from \"@blueprintjs/core\";\nimport React, { useEffect } from \"react\";\nimport { EntrypointIframe } from \"./entrypointIframe.js\";\n\ntype PageState =\n | {\n state: \"loading\";\n }\n | {\n state: \"failed\";\n error?: string;\n response?: string;\n hint?: string;\n }\n | {\n state: \"success\";\n isRedirecting: boolean;\n };\n\nconst POLLING_INTERVAL = 250;\nconst REDIRECT_DELAY = 500;\n\nclass ResponseError extends Error {\n public readonly response: string;\n public readonly hint: string | undefined;\n\n constructor(message: string, response: string, hint?: string) {\n super(message);\n this.response = response;\n this.hint = hint;\n }\n}\n\nexport const App: React.FC = () => {\n const [entrypointPaths, setEntrypointPaths] = React.useState<string[]>([]);\n const [pageState, setPageState] = React.useState<PageState>({\n state: \"loading\",\n });\n const numAttempts = React.useRef(0);\n\n // Load entrypoints values on mount\n useEffect(() => {\n void loadEntrypoints().then(setEntrypointPaths);\n }, []);\n\n // Poll the finish endpoint until it returns a success or error\n useEffect(() => {\n const poll = window.setInterval(() => {\n void finish(numAttempts.current)\n .then((result) => {\n if (result.status === \"pending\") {\n numAttempts.current++;\n return;\n }\n if (result.status === \"error\") {\n if (result.response != null) {\n throw new ResponseError(\n result.error,\n result.response,\n result.hint,\n );\n }\n throw new Error(result.error);\n }\n\n // On success, we clear the poll and end the loading state\n window.clearInterval(poll);\n setPageState({\n state: \"success\",\n isRedirecting: result.redirectUrl != null,\n });\n\n // When running in Code Workspaces the parent app will handle the redirect\n if (result.status === \"success\" && result.redirectUrl != null) {\n setTimeout(() => {\n window.location.href = result.redirectUrl!;\n }, REDIRECT_DELAY);\n }\n })\n .catch((error: unknown) => {\n window.clearInterval(poll);\n // eslint-disable-next-line no-console\n console.error(\"Failed to finish dev mode setup:\", error);\n setPageState({\n state: \"failed\",\n error: error instanceof Error ? error.message : undefined,\n response: error instanceof ResponseError\n ? error.response\n : undefined,\n hint: error instanceof ResponseError ? error.hint : undefined,\n });\n });\n }, POLLING_INTERVAL);\n return () => window.clearInterval(poll);\n }, []);\n\n return (\n <div className=\"body\">\n {pageState.state === \"loading\" && (\n <NonIdealState\n title=\"Generating developer mode manifest…\"\n icon={<Spinner intent=\"primary\" />}\n />\n )}\n {pageState.state === \"success\" && (\n <NonIdealState\n title=\"Started dev mode\"\n icon=\"tick-circle\"\n description={\n <div className=\"description\">\n <Spinner intent=\"primary\" size={SpinnerSize.SMALL} />{\" \"}\n {pageState.isRedirecting\n ? <span>Redirecting you…</span>\n : <span>Loading preview…</span>}\n </div>\n }\n />\n )}\n {pageState.state === \"failed\" && (\n <NonIdealState\n title=\"Failed to start dev mode\"\n icon=\"error\"\n description={\n <>\n {pageState.hint != null && (\n <div className=\"hint-block\">{pageState.hint}</div>\n )}\n {pageState.response != null && (\n <Pre className=\"response-block\">{pageState.response}</Pre>\n )}\n <Pre className=\"response-block\">{pageState.error}</Pre>\n </>\n }\n />\n )}\n {/* To load the entrypoint info, we have to actually load it in the browser to get vite to follow the module graph. Since we know these files will fail, we just load them in iframes set to display: none to trigger the load hook in vite */}\n {entrypointPaths.map((entrypointPath) => (\n <EntrypointIframe src={entrypointPath} key={entrypointPath} />\n ))}\n </div>\n );\n};\n\nfunction loadEntrypoints(): Promise<string[]> {\n return fetch(\"../entrypoints\").then((res) => res.json());\n}\n\nfunction finish(attempt: number): Promise<\n | {\n status: \"success\";\n redirectUrl: string | null;\n }\n | {\n status: \"error\";\n error: string;\n response?: string;\n hint?: string;\n }\n | {\n status: \"pending\";\n }\n> {\n return fetch(`../finish?attempt=${attempt}`).then((res) => res.json());\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,GAAG,EAAEC,OAAO,EAAEC,WAAW,QAAQ,mBAAmB;AAC5E,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,gBAAgB,QAAQ,uBAAuB;AAiBxD,MAAMC,gBAAgB,GAAG,GAAG;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G,EAAEF;EAAe,CAAE,CAC9D,CACE,CAAC;AAEV,CAAC;AAED,SAAS7B,eAAeA,CAAA,EAAsB;EAC5C,OAAOgC,KAAK,CAAC,gBAAgB,CAAC,CAAC/B,IAAI,CAAEgC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AAC1D;AAEA,SAAS7B,MAAMA,CAAC8B,OAAe,EAc7B;EACA,OAAOH,KAAK,CAAC,qBAAqBG,OAAO,EAAE,CAAC,CAAClC,IAAI,CAAEgC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AACxE","ignoreList":[]}
|
|
@@ -21,10 +21,13 @@ import { enableDevMode, setWidgetSetSettings } from "./network.js";
|
|
|
21
21
|
class ResponseError extends Error {
|
|
22
22
|
// To avoid inspect() from logging the error response since it's already logged
|
|
23
23
|
#response;
|
|
24
|
+
#hint;
|
|
24
25
|
constructor(message, response) {
|
|
25
26
|
super(message);
|
|
26
27
|
try {
|
|
27
|
-
|
|
28
|
+
const parsed = JSON.parse(response);
|
|
29
|
+
this.#response = JSON.stringify(parsed, null, 4);
|
|
30
|
+
this.#hint = getHintForError(parsed);
|
|
28
31
|
} catch {
|
|
29
32
|
this.#response = response;
|
|
30
33
|
}
|
|
@@ -32,6 +35,15 @@ class ResponseError extends Error {
|
|
|
32
35
|
get response() {
|
|
33
36
|
return this.#response;
|
|
34
37
|
}
|
|
38
|
+
get hint() {
|
|
39
|
+
return this.#hint;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getHintForError(parsed) {
|
|
43
|
+
if (parsed.errorName === "Api:WidgetIdNotFound" || parsed.errorName === "WidgetIdNotFound") {
|
|
44
|
+
return "You first need to publish changes to your widget configuration files before you can develop against them.";
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
/**
|
|
@@ -72,7 +84,8 @@ export async function publishDevModeSettings(server, widgetIdToOverrides, baseHr
|
|
|
72
84
|
res.end(JSON.stringify({
|
|
73
85
|
status: "error",
|
|
74
86
|
error: inspect(error),
|
|
75
|
-
response: error instanceof ResponseError ? error.response : undefined
|
|
87
|
+
response: error instanceof ResponseError ? error.response : undefined,
|
|
88
|
+
hint: error instanceof ResponseError ? error.hint : undefined
|
|
76
89
|
}));
|
|
77
90
|
}
|
|
78
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishDevModeSettings.js","names":["loadFoundryConfig","inspect","getCodeWorkspacesFoundryUrl","isCodeWorkspacesMode","enableDevMode","setWidgetSetSettings","ResponseError","Error","response","constructor","message","JSON","stringify","
|
|
1
|
+
{"version":3,"file":"publishDevModeSettings.js","names":["loadFoundryConfig","inspect","getCodeWorkspacesFoundryUrl","isCodeWorkspacesMode","enableDevMode","setWidgetSetSettings","ResponseError","Error","response","hint","constructor","message","parsed","JSON","parse","stringify","getHintForError","errorName","undefined","publishDevModeSettings","server","widgetIdToOverrides","baseHref","res","foundryConfig","foundryUrl","config","mode","widgetSetRid","widgetSet","rid","settingsResponse","status","logger","warn","statusText","responseContent","text","enableResponse","setHeader","end","redirectUrl","error","statusCode"],"sources":["publishDevModeSettings.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { loadFoundryConfig } from \"@osdk/foundry-config-json\";\nimport type { ServerResponse } from \"node:http\";\nimport { inspect } from \"node:util\";\nimport type { ViteDevServer } from \"vite\";\nimport {\n getCodeWorkspacesFoundryUrl,\n isCodeWorkspacesMode,\n} from \"./codeWorkspacesMode.js\";\nimport { enableDevMode, setWidgetSetSettings } from \"./network.js\";\n\nclass ResponseError extends Error {\n // To avoid inspect() from logging the error response since it's already logged\n #response: string;\n #hint: string | undefined;\n\n constructor(message: string, response: string) {\n super(message);\n try {\n const parsed = JSON.parse(response);\n this.#response = JSON.stringify(parsed, null, 4);\n this.#hint = getHintForError(parsed);\n } catch {\n this.#response = response;\n }\n }\n\n get response(): string {\n return this.#response;\n }\n\n get hint(): string | undefined {\n return this.#hint;\n }\n}\n\nfunction getHintForError(\n parsed: { errorName?: string },\n): string | undefined {\n if (\n parsed.errorName === \"Api:WidgetIdNotFound\"\n || parsed.errorName === \"WidgetIdNotFound\"\n ) {\n return \"You first need to publish changes to your widget configuration files before you can develop against them.\";\n }\n return undefined;\n}\n\n/**\n * Finish the setup process by setting the widget overrides in Foundry and enabling dev mode.\n */\nexport async function publishDevModeSettings(\n server: ViteDevServer,\n widgetIdToOverrides: Record<string, string[]>,\n baseHref: string,\n res: ServerResponse,\n): Promise<void> {\n try {\n const foundryConfig = await loadFoundryConfig(\"widgetSet\");\n if (foundryConfig == null) {\n throw new Error(\n \"foundry.config.json file not found.\",\n );\n }\n const foundryUrl = isCodeWorkspacesMode(server.config.mode)\n ? getCodeWorkspacesFoundryUrl()\n : foundryConfig.foundryConfig.foundryUrl;\n\n const widgetSetRid = foundryConfig.foundryConfig.widgetSet.rid;\n const settingsResponse = await setWidgetSetSettings(\n foundryUrl,\n widgetSetRid,\n widgetIdToOverrides,\n baseHref,\n server.config.mode,\n );\n if (settingsResponse.status !== 200) {\n server.config.logger.warn(\n `Unable to set widget settings in Foundry: ${settingsResponse.statusText}`,\n );\n const responseContent = await settingsResponse.text();\n server.config.logger.warn(responseContent);\n throw new ResponseError(\n `Unable to set widget settings in Foundry: ${settingsResponse.statusText}`,\n responseContent,\n );\n }\n\n const enableResponse = await enableDevMode(\n foundryUrl,\n server.config.mode,\n );\n if (enableResponse.status !== 200) {\n server.config.logger.warn(\n `Unable to enable dev mode in Foundry: ${enableResponse.statusText}`,\n );\n const responseContent = await enableResponse.text();\n server.config.logger.warn(responseContent);\n throw new ResponseError(\n `Unable to enable dev mode in Foundry: ${enableResponse.statusText}`,\n responseContent,\n );\n }\n\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify({\n status: \"success\",\n // In Code Workspaces the preview UI automatically handles this redirect\n redirectUrl: isCodeWorkspacesMode(server.config.mode)\n ? null\n : `${foundryUrl}/workspace/custom-widgets/preview/${widgetSetRid}`,\n }));\n } catch (error: unknown) {\n server.config.logger.error(\n `Failed to start dev mode: ${(error as Error)}\\n\\n${inspect(error)}`,\n );\n res.setHeader(\"Content-Type\", \"application/json\");\n res.statusCode = 500;\n res.end(\n JSON.stringify(\n {\n status: \"error\",\n error: inspect(error),\n response: error instanceof ResponseError ? error.response : undefined,\n hint: error instanceof ResponseError ? error.hint : undefined,\n },\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,OAAO,QAAQ,WAAW;AAEnC,SACEC,2BAA2B,EAC3BC,oBAAoB,QACf,yBAAyB;AAChC,SAASC,aAAa,EAAEC,oBAAoB,QAAQ,cAAc;AAElE,MAAMC,aAAa,SAASC,KAAK,CAAC;EAChC;EACA,CAACC,QAAQ;EACT,CAACC,IAAI;EAELC,WAAWA,CAACC,OAAe,EAAEH,QAAgB,EAAE;IAC7C,KAAK,CAACG,OAAO,CAAC;IACd,IAAI;MACF,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACN,QAAQ,CAAC;MACnC,IAAI,CAAC,CAACA,QAAQ,GAAGK,IAAI,CAACE,SAAS,CAACH,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;MAChD,IAAI,CAAC,CAACH,IAAI,GAAGO,eAAe,CAACJ,MAAM,CAAC;IACtC,CAAC,CAAC,MAAM;MACN,I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MACEiB,MAAM,EAAE,OAAO;MACfU,KAAK,EAAEzC,OAAO,CAACyC,KAAK,CAAC;MACrBlC,QAAQ,EAAEkC,KAAK,YAAYpC,aAAa,GAAGoC,KAAK,CAAClC,QAAQ,GAAGU,SAAS;MACrET,IAAI,EAAEiC,KAAK,YAAYpC,aAAa,GAAGoC,KAAK,CAACjC,IAAI,GAAGS;IACtD,CACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as n}from"./index-DLOviMB1.js";import{I as e}from"./index-B-fsa5Ru.js";import{p as r,I as s}from"./index-
|
|
1
|
+
import{I as n}from"./index-DLOviMB1.js";import{I as e}from"./index-B-fsa5Ru.js";import{p as r,I as s}from"./index-D6Sm-vP3.js";function I(o,t){var a=r(o);return t===s.STANDARD?n[a]:e[a]}function p(o){return r(o)}export{n as IconSvgPaths16,e as IconSvgPaths20,I as getIconPaths,p as iconNameToPathsRecordKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./allPaths-
|
|
2
|
-
import{_ as o,a as i,b as n}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./allPaths-DIfrnzgS.js","./index-DLOviMB1.js","./index-B-fsa5Ru.js","./index-D6Sm-vP3.js","./index-7niI6nVb.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as o,a as i,b as n}from"./index-D6Sm-vP3.js";var _=function(e,a){return o(void 0,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return[4,n(()=>import("./allPaths-DIfrnzgS.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url)];case 1:return t=r.sent().getIconPaths,[2,t(e,a)]}})})};export{_ as allPathsLoader};
|