sunpeak 0.5.24 → 0.5.26
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/package.json +1 -4
- package/template/.sunpeak/dev.tsx +48 -2
- package/template/dist/chatgpt/albums.js +1 -1
- package/template/dist/chatgpt/carousel.js +1 -1
- package/template/dist/chatgpt/counter.js +1 -1
- package/template/node_modules/.vite/deps/_metadata.json +17 -17
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/src/styles/globals.css +2 -2
- package/dist/dev/entry.d.ts +0 -0
- package/src/dev/entry.tsx +0 -55
- package/src/vite-env.d.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunpeak",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.26",
|
|
4
4
|
"description": "The MCP App SDK. Quickstart, build, & test your ChatGPT App locally!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"default": "./dist/mcp/index.js"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
"./dev/entry": "./src/dev/entry.tsx",
|
|
29
28
|
"./mcp/entry": "./dist/mcp/entry.js",
|
|
30
29
|
"./package.json": "./package.json"
|
|
31
30
|
},
|
|
@@ -35,8 +34,6 @@
|
|
|
35
34
|
"files": [
|
|
36
35
|
"dist",
|
|
37
36
|
"bin",
|
|
38
|
-
"src/dev",
|
|
39
|
-
"src/vite-env.d.ts",
|
|
40
37
|
"template",
|
|
41
38
|
"README.md"
|
|
42
39
|
],
|
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bootstrap file for Sunpeak dev server
|
|
3
|
-
* This file
|
|
3
|
+
* This file bootstraps the ChatGPT simulator for development
|
|
4
4
|
*/
|
|
5
|
-
import '
|
|
5
|
+
import { StrictMode } from 'react';
|
|
6
|
+
import { createRoot } from 'react-dom/client';
|
|
7
|
+
import { ChatGPTSimulator, type Simulation } from 'sunpeak';
|
|
8
|
+
import { SIMULATIONS } from '../src/simulations';
|
|
9
|
+
import * as Resources from '../src/components/resources';
|
|
10
|
+
import '../src/styles/globals.css';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Extract the resource component name from a URI
|
|
14
|
+
* Example: 'ui://CounterResource' -> 'CounterResource'
|
|
15
|
+
*/
|
|
16
|
+
function getResourceComponentFromURI(uri: string): React.ComponentType {
|
|
17
|
+
const match = uri.match(/^ui:\/\/(.+)$/);
|
|
18
|
+
if (!match) {
|
|
19
|
+
throw new Error(`Invalid resource URI format: ${uri}. Expected format: ui://ComponentName`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const componentName = match[1];
|
|
23
|
+
const component = Resources[componentName as keyof typeof Resources];
|
|
24
|
+
|
|
25
|
+
if (!component) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Resource component "${componentName}" not found. ` +
|
|
28
|
+
`Make sure it's exported from src/components/resources/index.ts`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return component as React.ComponentType;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Package the resource component with the simulation
|
|
36
|
+
const simulations: Simulation[] = Object.values(
|
|
37
|
+
SIMULATIONS as Record<string, Omit<Simulation, 'resourceComponent'>>
|
|
38
|
+
).map((simulation) => ({
|
|
39
|
+
...simulation,
|
|
40
|
+
resourceComponent: getResourceComponentFromURI(simulation.resource.uri),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
// Read app config from package.json or use defaults
|
|
44
|
+
const appName = import.meta.env?.VITE_APP_NAME || 'Sunpeak App';
|
|
45
|
+
const appIcon = import.meta.env?.VITE_APP_ICON || '🌄';
|
|
46
|
+
|
|
47
|
+
createRoot(document.getElementById('root')!).render(
|
|
48
|
+
<StrictMode>
|
|
49
|
+
<ChatGPTSimulator simulations={simulations} appName={appName} appIcon={appIcon} />
|
|
50
|
+
</StrictMode>
|
|
51
|
+
);
|