sunpeak 0.15.4 → 0.16.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.
- package/README.md +51 -48
- package/bin/commands/build.mjs +13 -4
- package/bin/commands/dev.mjs +64 -19
- package/bin/commands/new.mjs +13 -3
- package/bin/lib/extract-resource.mjs +1 -1
- package/bin/lib/extract-tool.mjs +78 -0
- package/bin/lib/patterns.mjs +2 -26
- package/dist/chatgpt/index.cjs +3 -6
- package/dist/chatgpt/index.cjs.map +1 -1
- package/dist/chatgpt/index.d.ts +1 -1
- package/dist/chatgpt/index.js +6 -9
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/discovery-CH80W5l9.js +217 -0
- package/dist/discovery-CH80W5l9.js.map +1 -0
- package/dist/discovery-DmB8_4QL.cjs +216 -0
- package/dist/discovery-DmB8_4QL.cjs.map +1 -0
- package/dist/{index-CutQgPzR.js → index-BjnAsaqp.js} +3 -6
- package/dist/index-BjnAsaqp.js.map +1 -0
- package/dist/{index-Cngntkp2.cjs → index-BvQ_ZuOO.cjs} +3 -6
- package/dist/{index-Cngntkp2.cjs.map → index-BvQ_ZuOO.cjs.map} +1 -1
- package/dist/{index-B0dxRJvS.cjs → index-C9CVbGFt.cjs} +3 -6
- package/dist/index-C9CVbGFt.cjs.map +1 -0
- package/dist/{index-Ce_5ZIdJ.js → index-CTGEqlgk.js} +3 -6
- package/dist/{index-Ce_5ZIdJ.js.map → index-CTGEqlgk.js.map} +1 -1
- package/dist/index.cjs +48 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3404 -3361
- package/dist/index.js.map +1 -1
- package/dist/lib/discovery-cli.cjs +58 -5
- package/dist/lib/discovery-cli.cjs.map +1 -1
- package/dist/lib/discovery-cli.d.ts +3 -2
- package/dist/lib/discovery-cli.js +61 -8
- package/dist/lib/discovery-cli.js.map +1 -1
- package/dist/lib/discovery.d.ts +42 -43
- package/dist/lib/extract-tool.d.ts +12 -0
- package/dist/mcp/favicon.d.ts +1 -1
- package/dist/mcp/index.cjs +3 -2
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +3 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +24 -1
- package/dist/platform/chatgpt/index.cjs +1 -1
- package/dist/platform/chatgpt/index.js +1 -1
- package/dist/simulator/index.cjs +2 -5
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.ts +1 -1
- package/dist/simulator/index.js +5 -8
- package/dist/simulator/simulator-url.d.ts +9 -9
- package/dist/{simulator-DcfQBRXE.cjs → simulator-B56j5P8W.cjs} +8 -2
- package/dist/{simulator-DcfQBRXE.cjs.map → simulator-B56j5P8W.cjs.map} +1 -1
- package/dist/{simulator-CxrtnguM.js → simulator-C0H_k092.js} +8 -2
- package/dist/{simulator-CxrtnguM.js.map → simulator-C0H_k092.js.map} +1 -1
- package/dist/simulator-url-CuLqtnSS.js.map +1 -1
- package/dist/simulator-url-rgg_KYOg.cjs.map +1 -1
- package/dist/types/resource-config.d.ts +7 -5
- package/dist/{use-app-D_TeaMFG.js → use-app-BThbgFFT.js} +51 -22
- package/dist/{use-app-D_TeaMFG.js.map → use-app-BThbgFFT.js.map} +1 -1
- package/dist/{use-app-BnoSPiUT.cjs → use-app-BuufpXTQ.cjs} +49 -20
- package/dist/{use-app-BnoSPiUT.cjs.map → use-app-BuufpXTQ.cjs.map} +1 -1
- package/package.json +1 -1
- package/template/.sunpeak/dev.tsx +8 -4
- package/template/.sunpeak/resource-loader.tsx +2 -1
- package/template/README.md +14 -10
- package/template/package.json +2 -1
- package/template/src/resources/albums/{albums-resource.test.tsx → albums.test.tsx} +1 -1
- package/template/src/resources/albums/{albums-resource.tsx → albums.tsx} +0 -1
- package/template/src/resources/carousel/{carousel-resource.test.tsx → carousel.test.tsx} +1 -1
- package/template/src/resources/carousel/{carousel-resource.tsx → carousel.tsx} +0 -1
- package/template/src/resources/index.ts +4 -4
- package/template/src/resources/map/{map-resource.test.tsx → map.test.tsx} +1 -1
- package/template/src/resources/map/{map-resource.tsx → map.tsx} +0 -1
- package/template/src/resources/review/{review-resource.test.tsx → review.test.tsx} +1 -1
- package/template/src/resources/review/{review-resource.tsx → review.tsx} +1 -2
- package/template/src/server.ts +15 -0
- package/template/src/tools/review-diff.ts +24 -0
- package/template/src/tools/review-post.ts +26 -0
- package/template/src/tools/review-purchase.ts +31 -0
- package/template/src/tools/show-albums.ts +22 -0
- package/template/src/tools/show-carousel.ts +25 -0
- package/template/src/tools/show-map.ts +29 -0
- package/template/tests/e2e/albums.spec.ts +6 -6
- package/template/tests/e2e/carousel.spec.ts +6 -6
- package/template/tests/e2e/map.spec.ts +11 -11
- package/template/tests/simulations/{review/review-diff-simulation.json → review-diff.json} +1 -31
- package/template/tests/simulations/{review/review-post-simulation.json → review-post.json} +1 -37
- package/template/tests/simulations/{review/review-purchase-simulation.json → review-purchase.json} +1 -38
- package/template/tests/simulations/{albums/albums-show-simulation.json → show-albums.json} +1 -24
- package/template/tests/simulations/{carousel/carousel-show-simulation.json → show-carousel.json} +1 -24
- package/template/tests/simulations/{map/map-show-simulation.json → show-map.json} +1 -35
- package/dist/discovery-CRR3SlyI.cjs +0 -156
- package/dist/discovery-CRR3SlyI.cjs.map +0 -1
- package/dist/discovery-DzV3HLXs.js +0 -157
- package/dist/discovery-DzV3HLXs.js.map +0 -1
- package/dist/index-B0dxRJvS.cjs.map +0 -1
- package/dist/index-CutQgPzR.js.map +0 -1
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"tool": "review-post",
|
|
2
3
|
"userMessage": "Write a launch announcement for X and LinkedIn.",
|
|
3
|
-
"tool": {
|
|
4
|
-
"name": "review-post",
|
|
5
|
-
"description": "Review a social media post before publishing",
|
|
6
|
-
"inputSchema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"content": { "type": "string", "description": "The text content of the post" },
|
|
10
|
-
"platforms": {
|
|
11
|
-
"type": "array",
|
|
12
|
-
"items": { "type": "string", "enum": ["x", "linkedin", "facebook", "instagram"] },
|
|
13
|
-
"description": "Social media platforms to post to"
|
|
14
|
-
},
|
|
15
|
-
"schedule": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"enum": ["now", "scheduled"],
|
|
18
|
-
"description": "When to publish the post"
|
|
19
|
-
},
|
|
20
|
-
"scheduledTime": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"format": "date-time",
|
|
23
|
-
"description": "ISO 8601 timestamp for scheduled posts"
|
|
24
|
-
},
|
|
25
|
-
"visibility": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"enum": ["public", "connections", "private"],
|
|
28
|
-
"description": "Post visibility setting"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"required": ["content", "platforms"],
|
|
32
|
-
"additionalProperties": false
|
|
33
|
-
},
|
|
34
|
-
"title": "Review Post",
|
|
35
|
-
"annotations": { "readOnlyHint": false },
|
|
36
|
-
"_meta": {
|
|
37
|
-
"ui": { "visibility": ["model", "app"] }
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
4
|
"toolInput": {
|
|
41
5
|
"content": "Just shipped a major update to our app! \ud83d\ude80\n\nNew features include:\n\u2022 Dark mode support\n\u2022 Faster load times\n\u2022 Bug fixes and improvements\n\nThanks to everyone who provided feedback. You all are amazing! \ud83d\udcaa\n\n#ProductUpdate #TechNews #Startup",
|
|
42
6
|
"platforms": ["x", "linkedin"],
|
package/template/tests/simulations/{review/review-purchase-simulation.json → review-purchase.json}
RENAMED
|
@@ -1,43 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"tool": "review-purchase",
|
|
2
3
|
"userMessage": "Buy some wireless headphones, a USB-C cable, and a clear iPhone case.",
|
|
3
|
-
"tool": {
|
|
4
|
-
"name": "review-purchase",
|
|
5
|
-
"description": "Review a purchase before completing the transaction",
|
|
6
|
-
"inputSchema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"cartId": { "type": "string", "description": "Shopping cart identifier" },
|
|
10
|
-
"items": {
|
|
11
|
-
"type": "array",
|
|
12
|
-
"items": {
|
|
13
|
-
"type": "object",
|
|
14
|
-
"properties": {
|
|
15
|
-
"productId": { "type": "string" },
|
|
16
|
-
"quantity": { "type": "number" }
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"description": "List of items to purchase"
|
|
20
|
-
},
|
|
21
|
-
"shippingAddressId": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "ID of the saved shipping address"
|
|
24
|
-
},
|
|
25
|
-
"shippingMethod": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"enum": ["standard", "express", "overnight"],
|
|
28
|
-
"description": "Shipping speed"
|
|
29
|
-
},
|
|
30
|
-
"paymentMethodId": { "type": "string", "description": "ID of the saved payment method" }
|
|
31
|
-
},
|
|
32
|
-
"required": ["items"],
|
|
33
|
-
"additionalProperties": false
|
|
34
|
-
},
|
|
35
|
-
"title": "Review Purchase",
|
|
36
|
-
"annotations": { "readOnlyHint": false },
|
|
37
|
-
"_meta": {
|
|
38
|
-
"ui": { "visibility": ["model", "app"] }
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
4
|
"toolInput": {
|
|
42
5
|
"cartId": "cart_abc123",
|
|
43
6
|
"items": [
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"tool": "show-albums",
|
|
2
3
|
"userMessage": "Show me photos from my Austin pizza tour.",
|
|
3
|
-
"tool": {
|
|
4
|
-
"name": "show-albums",
|
|
5
|
-
"description": "Show photo albums",
|
|
6
|
-
"inputSchema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"category": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "Filter albums by category (e.g., travel, food, family)"
|
|
12
|
-
},
|
|
13
|
-
"search": {
|
|
14
|
-
"type": "string",
|
|
15
|
-
"description": "Search term to filter albums by title or description"
|
|
16
|
-
},
|
|
17
|
-
"limit": { "type": "number", "description": "Maximum number of albums to return" }
|
|
18
|
-
},
|
|
19
|
-
"additionalProperties": false
|
|
20
|
-
},
|
|
21
|
-
"title": "Show Albums",
|
|
22
|
-
"annotations": { "readOnlyHint": true },
|
|
23
|
-
"_meta": {
|
|
24
|
-
"ui": { "visibility": ["model", "app"] }
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
4
|
"toolInput": {
|
|
28
5
|
"category": "food",
|
|
29
6
|
"search": "Austin pizza tour",
|
package/template/tests/simulations/{carousel/carousel-show-simulation.json → show-carousel.json}
RENAMED
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"tool": "show-carousel",
|
|
2
3
|
"userMessage": "Show me popular places to visit in Austin Texas.",
|
|
3
|
-
"tool": {
|
|
4
|
-
"name": "show-carousel",
|
|
5
|
-
"description": "Show popular places to visit",
|
|
6
|
-
"inputSchema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"city": { "type": "string", "description": "City name to search for places" },
|
|
10
|
-
"state": { "type": "string", "description": "State or region" },
|
|
11
|
-
"categories": {
|
|
12
|
-
"type": "array",
|
|
13
|
-
"items": { "type": "string" },
|
|
14
|
-
"description": "Filter by categories (e.g., parks, restaurants, landmarks)"
|
|
15
|
-
},
|
|
16
|
-
"limit": { "type": "number", "description": "Maximum number of places to return" }
|
|
17
|
-
},
|
|
18
|
-
"required": ["city"],
|
|
19
|
-
"additionalProperties": false
|
|
20
|
-
},
|
|
21
|
-
"title": "Show Carousel",
|
|
22
|
-
"annotations": { "readOnlyHint": true },
|
|
23
|
-
"_meta": {
|
|
24
|
-
"ui": { "visibility": ["model", "app"] }
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
4
|
"toolInput": {
|
|
28
5
|
"city": "Austin",
|
|
29
6
|
"state": "Texas",
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"tool": "show-map",
|
|
2
3
|
"userMessage": "Where's the best pizza in San Francisco?",
|
|
3
|
-
"tool": {
|
|
4
|
-
"name": "show-map",
|
|
5
|
-
"description": "Show the map",
|
|
6
|
-
"inputSchema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"query": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "Search query for places (e.g., pizza, coffee, restaurants)"
|
|
12
|
-
},
|
|
13
|
-
"location": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"properties": {
|
|
16
|
-
"lat": { "type": "number" },
|
|
17
|
-
"lng": { "type": "number" }
|
|
18
|
-
},
|
|
19
|
-
"description": "Center location for the search"
|
|
20
|
-
},
|
|
21
|
-
"radius": { "type": "number", "description": "Search radius in miles" },
|
|
22
|
-
"minRating": { "type": "number", "description": "Minimum rating filter (1-5)" },
|
|
23
|
-
"priceRange": {
|
|
24
|
-
"type": "array",
|
|
25
|
-
"items": { "type": "string", "enum": ["$", "$$", "$$$", "$$$$"] },
|
|
26
|
-
"description": "Price range filter"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"required": ["query"],
|
|
30
|
-
"additionalProperties": false
|
|
31
|
-
},
|
|
32
|
-
"title": "Show Map",
|
|
33
|
-
"annotations": { "readOnlyHint": true },
|
|
34
|
-
"_meta": {
|
|
35
|
-
"ui": { "visibility": ["model", "app"] }
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
4
|
"toolInput": {
|
|
39
5
|
"query": "pizza",
|
|
40
6
|
"location": { "lat": 37.7749, "lng": -122.4194 },
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function toPascalCase(str) {
|
|
3
|
-
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
4
|
-
}
|
|
5
|
-
function extractResourceKey(path) {
|
|
6
|
-
const match = path.match(/([^/]+)-resource\.(tsx|json)$/);
|
|
7
|
-
return match?.[1];
|
|
8
|
-
}
|
|
9
|
-
function extractSimulationKey(path) {
|
|
10
|
-
const match = path.match(/([^/]+)-simulation\.json$/);
|
|
11
|
-
return match?.[1];
|
|
12
|
-
}
|
|
13
|
-
function findResourceKey(simulationKey, resourceKeys) {
|
|
14
|
-
const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);
|
|
15
|
-
for (const resourceKey of sorted) {
|
|
16
|
-
if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + "-")) {
|
|
17
|
-
return resourceKey;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
function getComponentName(resourceKey) {
|
|
23
|
-
return `${toPascalCase(resourceKey)}Resource`;
|
|
24
|
-
}
|
|
25
|
-
function createResourceExports(modules) {
|
|
26
|
-
const resources = {};
|
|
27
|
-
for (const [path, module2] of Object.entries(modules)) {
|
|
28
|
-
const key = extractResourceKey(path);
|
|
29
|
-
if (!key) continue;
|
|
30
|
-
const exportName = getComponentName(key);
|
|
31
|
-
const mod = module2;
|
|
32
|
-
const component = mod.default ?? mod[exportName];
|
|
33
|
-
if (component && (typeof component === "function" || typeof component === "object")) {
|
|
34
|
-
resources[exportName] = component;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return resources;
|
|
38
|
-
}
|
|
39
|
-
function buildResourceMap(modules) {
|
|
40
|
-
const map = /* @__PURE__ */ new Map();
|
|
41
|
-
for (const [path, module2] of Object.entries(modules)) {
|
|
42
|
-
const key = extractResourceKey(path);
|
|
43
|
-
if (key) {
|
|
44
|
-
map.set(key, module2.resource);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return map;
|
|
48
|
-
}
|
|
49
|
-
function buildSimulations(options) {
|
|
50
|
-
const {
|
|
51
|
-
simulationModules,
|
|
52
|
-
resourcesMap,
|
|
53
|
-
resourceComponents,
|
|
54
|
-
createSimulation,
|
|
55
|
-
onMissingResource = (key, prefix) => console.warn(
|
|
56
|
-
`No matching resource found for simulation "${key}". Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`
|
|
57
|
-
)
|
|
58
|
-
} = options;
|
|
59
|
-
const resourceKeys = Array.from(resourcesMap.keys());
|
|
60
|
-
const simulations = {};
|
|
61
|
-
for (const [path, module2] of Object.entries(simulationModules)) {
|
|
62
|
-
const simulationKey = extractSimulationKey(path);
|
|
63
|
-
if (!simulationKey) continue;
|
|
64
|
-
const simulationData = module2.default;
|
|
65
|
-
const resourceKey = findResourceKey(simulationKey, resourceKeys);
|
|
66
|
-
if (!resourceKey) {
|
|
67
|
-
onMissingResource(simulationKey, simulationKey.split("-")[0]);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
const resource = resourcesMap.get(resourceKey);
|
|
71
|
-
const componentName = getComponentName(resourceKey);
|
|
72
|
-
const resourceComponent = resourceComponents[componentName];
|
|
73
|
-
if (!resourceComponent) {
|
|
74
|
-
console.warn(
|
|
75
|
-
`Resource component "${componentName}" not found for resource "${resourceKey}". Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`
|
|
76
|
-
);
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
simulations[simulationKey] = createSimulation(
|
|
80
|
-
simulationKey,
|
|
81
|
-
simulationData,
|
|
82
|
-
resource,
|
|
83
|
-
resourceComponent
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
return simulations;
|
|
87
|
-
}
|
|
88
|
-
function buildDevSimulations(options) {
|
|
89
|
-
const { simulationModules, resourceModules, resourceComponents } = options;
|
|
90
|
-
const resourcesMap = buildResourceMap(resourceModules);
|
|
91
|
-
return buildSimulations({
|
|
92
|
-
simulationModules,
|
|
93
|
-
resourcesMap,
|
|
94
|
-
resourceComponents,
|
|
95
|
-
createSimulation: (simulationKey, simulationData, resource) => {
|
|
96
|
-
const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));
|
|
97
|
-
const componentName = resourceKey ? getComponentName(resourceKey) : "";
|
|
98
|
-
return {
|
|
99
|
-
...simulationData,
|
|
100
|
-
name: simulationKey,
|
|
101
|
-
resource: {
|
|
102
|
-
uri: `ui://${resource.name}`,
|
|
103
|
-
...resource
|
|
104
|
-
},
|
|
105
|
-
// Generate URL to the resource loader with component name as query param
|
|
106
|
-
resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function findResourceDirs(baseDir, filePattern, fs) {
|
|
112
|
-
if (!fs.existsSync(baseDir)) {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
116
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => {
|
|
117
|
-
const key = entry.name;
|
|
118
|
-
const dir = `${baseDir}/${key}`;
|
|
119
|
-
const resourcePath = `${dir}/${filePattern(key)}`;
|
|
120
|
-
if (!fs.existsSync(resourcePath)) {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
return { key, dir, resourcePath };
|
|
124
|
-
}).filter((info) => info !== null);
|
|
125
|
-
}
|
|
126
|
-
function isSimulationFile(filename, resourceKey) {
|
|
127
|
-
return filename.startsWith(`${resourceKey}-`) && filename.endsWith("-simulation.json");
|
|
128
|
-
}
|
|
129
|
-
function extractSimulationName(filename, resourceKey) {
|
|
130
|
-
return filename.replace(`${resourceKey}-`, "").replace("-simulation.json", "");
|
|
131
|
-
}
|
|
132
|
-
function findSimulationFiles(resourceDir, resourceKey, fs) {
|
|
133
|
-
if (!fs.existsSync(resourceDir)) {
|
|
134
|
-
return [];
|
|
135
|
-
}
|
|
136
|
-
const entries = fs.readdirSync(resourceDir, { withFileTypes: true });
|
|
137
|
-
return entries.filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey)).map((entry) => ({
|
|
138
|
-
filename: entry.name,
|
|
139
|
-
name: extractSimulationName(entry.name, resourceKey),
|
|
140
|
-
path: `${resourceDir}/${entry.name}`
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
exports.buildDevSimulations = buildDevSimulations;
|
|
144
|
-
exports.buildResourceMap = buildResourceMap;
|
|
145
|
-
exports.buildSimulations = buildSimulations;
|
|
146
|
-
exports.createResourceExports = createResourceExports;
|
|
147
|
-
exports.extractResourceKey = extractResourceKey;
|
|
148
|
-
exports.extractSimulationKey = extractSimulationKey;
|
|
149
|
-
exports.extractSimulationName = extractSimulationName;
|
|
150
|
-
exports.findResourceDirs = findResourceDirs;
|
|
151
|
-
exports.findResourceKey = findResourceKey;
|
|
152
|
-
exports.findSimulationFiles = findSimulationFiles;
|
|
153
|
-
exports.getComponentName = getComponentName;
|
|
154
|
-
exports.isSimulationFile = isSimulationFile;
|
|
155
|
-
exports.toPascalCase = toPascalCase;
|
|
156
|
-
//# sourceMappingURL=discovery-CRR3SlyI.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-CRR3SlyI.cjs","sources":["../src/lib/discovery.ts"],"sourcesContent":["/**\n * Discovery utilities for auto-discovering resources and simulations\n *\n * These helpers process the results of import.meta.glob() calls to extract\n * keys, build component maps, and connect simulations to resources.\n *\n * The glob calls themselves must remain in the template (Vite compile-time),\n * but all the processing logic lives here for easy updates across templates.\n *\n * Node.js utilities (findResourceDirs, isSimulationFile, etc.) can be used\n * by CLI commands for build-time and runtime discovery.\n */\n\nimport type { Simulation } from '../types/simulation.js';\n\n/**\n * Convert a kebab-case string to PascalCase\n * @example toPascalCase('review') // 'Review'\n * @example toPascalCase('album-art') // 'AlbumArt'\n */\nexport function toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Extract the resource key from a resource file path\n * @example extractResourceKey('./review-resource.tsx') // 'review'\n * @example extractResourceKey('../src/resources/albums-resource.tsx') // 'albums'\n */\nexport function extractResourceKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-resource\\.(tsx|json)$/);\n return match?.[1];\n}\n\n/**\n * Extract the simulation key from a simulation file path\n * @example extractSimulationKey('./albums-show-simulation.json') // 'albums-show'\n */\nexport function extractSimulationKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-simulation\\.json$/);\n return match?.[1];\n}\n\n/**\n * Find the best matching resource key for a simulation key.\n * Matches the longest resource name that is a prefix of the simulation key.\n * @example findResourceKey('albums-show', ['albums', 'album']) // 'albums'\n * @example findResourceKey('review-diff', ['review', 'carousel']) // 'review'\n */\nexport function findResourceKey(simulationKey: string, resourceKeys: string[]): string | undefined {\n // Sort by length descending to find longest match first\n const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);\n for (const resourceKey of sorted) {\n if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + '-')) {\n return resourceKey;\n }\n }\n return undefined;\n}\n\n/**\n * Get the expected component export name for a resource\n * @example getComponentName('review') // 'ReviewResource'\n * @example getComponentName('album-art') // 'AlbumArtResource'\n */\nexport function getComponentName(resourceKey: string): string {\n return `${toPascalCase(resourceKey)}Resource`;\n}\n\n// --- Glob processing helpers ---\n\ntype GlobModules = Record<string, unknown>;\n\n/**\n * Process resource component modules from import.meta.glob() result.\n * Extracts components and exports them with PascalCase names.\n *\n * @example\n * const modules = import.meta.glob('./**\\/*-resource.tsx', { eager: true });\n * export default createResourceExports(modules);\n */\nexport function createResourceExports(modules: GlobModules): Record<string, React.ComponentType> {\n const resources: Record<string, React.ComponentType> = {};\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (!key) continue;\n\n const exportName = getComponentName(key);\n const mod = module as Record<string, unknown>;\n\n // Try default export first, then named export matching the expected name\n const component = mod.default ?? mod[exportName];\n\n // Accept functions (regular components) or objects (forwardRef/memo components)\n if (component && (typeof component === 'function' || typeof component === 'object')) {\n resources[exportName] = component as React.ComponentType;\n }\n }\n\n return resources;\n}\n\n/**\n * Build a resource metadata map from import.meta.glob() result.\n * Used for connecting simulations to their resource definitions.\n *\n * @example\n * const modules = import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true });\n * const resourcesMap = buildResourceMap(modules);\n */\nexport function buildResourceMap<T>(modules: GlobModules): Map<string, T> {\n const map = new Map<string, T>();\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (key) {\n map.set(key, (module as { resource: T }).resource);\n }\n }\n\n return map;\n}\n\n/**\n * Options for building simulations from discovered modules\n */\nexport interface BuildSimulationsOptions<TResource, TSimulation> {\n /** Glob result of simulation JSON files */\n simulationModules: GlobModules;\n /** Map of resource key -> resource metadata */\n resourcesMap: Map<string, TResource>;\n /** Map of component name -> React component */\n resourceComponents: Record<string, React.ComponentType>;\n /** Create the final simulation object */\n createSimulation: (\n simulationKey: string,\n simulationData: unknown,\n resource: TResource,\n resourceComponent: React.ComponentType\n ) => TSimulation;\n /** Optional warning handler for missing resources */\n onMissingResource?: (simulationKey: string, expectedPrefix: string) => void;\n}\n\n/**\n * Build simulations by connecting simulation data with resources and components.\n * This is the main orchestration function for dev server bootstrap.\n */\nexport function buildSimulations<TResource, TSimulation>(\n options: BuildSimulationsOptions<TResource, TSimulation>\n): Record<string, TSimulation> {\n const {\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation,\n onMissingResource = (key, prefix) =>\n console.warn(\n `No matching resource found for simulation \"${key}\". ` +\n `Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`\n ),\n } = options;\n\n const resourceKeys = Array.from(resourcesMap.keys());\n const simulations: Record<string, TSimulation> = {};\n\n for (const [path, module] of Object.entries(simulationModules)) {\n const simulationKey = extractSimulationKey(path);\n if (!simulationKey) continue;\n\n const simulationData = (module as { default: unknown }).default;\n\n // Find matching resource\n const resourceKey = findResourceKey(simulationKey, resourceKeys);\n if (!resourceKey) {\n onMissingResource(simulationKey, simulationKey.split('-')[0]);\n continue;\n }\n\n const resource = resourcesMap.get(resourceKey)!;\n\n // Get component\n const componentName = getComponentName(resourceKey);\n const resourceComponent = resourceComponents[componentName];\n\n if (!resourceComponent) {\n console.warn(\n `Resource component \"${componentName}\" not found for resource \"${resourceKey}\". ` +\n `Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`\n );\n continue;\n }\n\n simulations[simulationKey] = createSimulation(\n simulationKey,\n simulationData,\n resource,\n resourceComponent\n );\n }\n\n return simulations;\n}\n\n// --- Dev server helpers ---\n\n/**\n * Resource metadata from *-resource.tsx files\n */\nexport interface ResourceMetadata {\n name: string;\n [key: string]: unknown;\n}\n\n/**\n * Options for building dev simulations\n */\nexport interface BuildDevSimulationsOptions {\n /** Glob result of simulation JSON files: import.meta.glob('*-simulation.json', { eager: true }) */\n simulationModules: GlobModules;\n /** Glob result of resource JSON files: import.meta.glob('*-resource.tsx', { eager: true }) */\n resourceModules: GlobModules;\n /** Resource components map from src/resources/index.ts */\n resourceComponents: Record<string, React.ComponentType>;\n}\n\n/**\n * Build simulations for the dev server from glob results.\n * This is the main entry point for dev.tsx bootstrap.\n *\n * @example\n * const simulations = buildDevSimulations({\n * simulationModules: import.meta.glob('../src/resources/**\\/*-simulation.json', { eager: true }),\n * resourceModules: import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true }),\n * resourceComponents: resourceComponents,\n * });\n */\nexport function buildDevSimulations(\n options: BuildDevSimulationsOptions\n): Record<string, Simulation> {\n const { simulationModules, resourceModules, resourceComponents } = options;\n\n // Build resource metadata map\n const resourcesMap = buildResourceMap<ResourceMetadata>(resourceModules);\n\n // Build simulations with the standard dev server format\n return buildSimulations<ResourceMetadata, Simulation>({\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation: (simulationKey, simulationData, resource) => {\n // Get the component name for the resource URL\n const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));\n const componentName = resourceKey ? getComponentName(resourceKey) : '';\n\n return {\n ...(simulationData as Omit<Simulation, 'name' | 'resourceUrl' | 'resource'>),\n name: simulationKey,\n resource: {\n uri: `ui://${resource.name}`,\n ...resource,\n },\n // Generate URL to the resource loader with component name as query param\n resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`,\n } as Simulation;\n },\n });\n}\n\n// --- Node.js utilities for CLI commands ---\n// These utilities use standard Node.js APIs and can be imported by build/push/mcp commands.\n\n/**\n * Information about a discovered resource directory\n */\nexport interface ResourceDirInfo {\n /** Resource key (directory name), e.g., 'albums', 'carousel' */\n key: string;\n /** Full path to the resource directory */\n dir: string;\n /** Full path to the main resource file (tsx or json depending on context) */\n resourcePath: string;\n}\n\n/**\n * File system operations interface for dependency injection in tests\n */\nexport interface FsOps {\n readdirSync: (\n path: string,\n options: { withFileTypes: true }\n ) => Array<{ name: string; isDirectory: () => boolean }>;\n existsSync: (path: string) => boolean;\n}\n\n/**\n * Find all resource directories in a base directory.\n * Each valid resource directory contains a file matching the expected pattern.\n *\n * @param baseDir - Base directory to scan (e.g., 'src/resources' or 'dist')\n * @param filePattern - Function to generate expected filename from resource key\n * @param fs - File system operations (for testing)\n *\n * @example\n * // Find source resources (tsx files)\n * const resources = findResourceDirs('src/resources', key => `${key}-resource.tsx`);\n *\n * @example\n * // Find built resources (js files)\n * const resources = findResourceDirs('dist', key => `${key}.js`);\n */\nexport function findResourceDirs(\n baseDir: string,\n filePattern: (key: string) => string,\n fs: FsOps\n): ResourceDirInfo[] {\n if (!fs.existsSync(baseDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(baseDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => {\n const key = entry.name;\n const dir = `${baseDir}/${key}`;\n const resourcePath = `${dir}/${filePattern(key)}`;\n\n if (!fs.existsSync(resourcePath)) {\n return null;\n }\n\n return { key, dir, resourcePath };\n })\n .filter((info): info is ResourceDirInfo => info !== null);\n}\n\n/**\n * Check if a filename is a simulation file for a given resource.\n * Matches pattern: {resourceKey}-*-simulation.json\n *\n * @example\n * isSimulationFile('albums-show-simulation.json', 'albums') // true\n * isSimulationFile('albums-show-simulation.json', 'carousel') // false\n * isSimulationFile('albums-resource.tsx', 'albums') // false\n */\nexport function isSimulationFile(filename: string, resourceKey: string): boolean {\n return filename.startsWith(`${resourceKey}-`) && filename.endsWith('-simulation.json');\n}\n\n/**\n * Extract the simulation name from a simulation filename.\n * Given \"{resourceKey}-{name}-simulation.json\", returns \"{name}\".\n *\n * @example\n * extractSimulationName('albums-show-simulation.json', 'albums') // 'show'\n * extractSimulationName('carousel-hero-simulation.json', 'carousel') // 'hero'\n */\nexport function extractSimulationName(filename: string, resourceKey: string): string {\n return filename.replace(`${resourceKey}-`, '').replace('-simulation.json', '');\n}\n\n/**\n * Find all simulation files in a resource directory.\n *\n * @param resourceDir - Path to the resource directory\n * @param resourceKey - Resource key (e.g., 'albums')\n * @param fs - File system operations (for testing)\n * @returns Array of { filename, name } objects\n */\nexport function findSimulationFiles(\n resourceDir: string,\n resourceKey: string,\n fs: Pick<FsOps, 'readdirSync' | 'existsSync'>\n): Array<{ filename: string; name: string; path: string }> {\n if (!fs.existsSync(resourceDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(resourceDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey))\n .map((entry) => ({\n filename: entry.name,\n name: extractSimulationName(entry.name, resourceKey),\n path: `${resourceDir}/${entry.name}`,\n }));\n}\n"],"names":["module"],"mappings":";AAoBO,SAAS,aAAa,KAAqB;AAChD,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,EAAE;AACZ;AAOO,SAAS,mBAAmB,MAAkC;AACnE,QAAM,QAAQ,KAAK,MAAM,+BAA+B;AACxD,SAAO,QAAQ,CAAC;AAClB;AAMO,SAAS,qBAAqB,MAAkC;AACrE,QAAM,QAAQ,KAAK,MAA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
|
1
|
-
function toPascalCase(str) {
|
|
2
|
-
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
3
|
-
}
|
|
4
|
-
function extractResourceKey(path) {
|
|
5
|
-
const match = path.match(/([^/]+)-resource\.(tsx|json)$/);
|
|
6
|
-
return match?.[1];
|
|
7
|
-
}
|
|
8
|
-
function extractSimulationKey(path) {
|
|
9
|
-
const match = path.match(/([^/]+)-simulation\.json$/);
|
|
10
|
-
return match?.[1];
|
|
11
|
-
}
|
|
12
|
-
function findResourceKey(simulationKey, resourceKeys) {
|
|
13
|
-
const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);
|
|
14
|
-
for (const resourceKey of sorted) {
|
|
15
|
-
if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + "-")) {
|
|
16
|
-
return resourceKey;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return void 0;
|
|
20
|
-
}
|
|
21
|
-
function getComponentName(resourceKey) {
|
|
22
|
-
return `${toPascalCase(resourceKey)}Resource`;
|
|
23
|
-
}
|
|
24
|
-
function createResourceExports(modules) {
|
|
25
|
-
const resources = {};
|
|
26
|
-
for (const [path, module] of Object.entries(modules)) {
|
|
27
|
-
const key = extractResourceKey(path);
|
|
28
|
-
if (!key) continue;
|
|
29
|
-
const exportName = getComponentName(key);
|
|
30
|
-
const mod = module;
|
|
31
|
-
const component = mod.default ?? mod[exportName];
|
|
32
|
-
if (component && (typeof component === "function" || typeof component === "object")) {
|
|
33
|
-
resources[exportName] = component;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return resources;
|
|
37
|
-
}
|
|
38
|
-
function buildResourceMap(modules) {
|
|
39
|
-
const map = /* @__PURE__ */ new Map();
|
|
40
|
-
for (const [path, module] of Object.entries(modules)) {
|
|
41
|
-
const key = extractResourceKey(path);
|
|
42
|
-
if (key) {
|
|
43
|
-
map.set(key, module.resource);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return map;
|
|
47
|
-
}
|
|
48
|
-
function buildSimulations(options) {
|
|
49
|
-
const {
|
|
50
|
-
simulationModules,
|
|
51
|
-
resourcesMap,
|
|
52
|
-
resourceComponents,
|
|
53
|
-
createSimulation,
|
|
54
|
-
onMissingResource = (key, prefix) => console.warn(
|
|
55
|
-
`No matching resource found for simulation "${key}". Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`
|
|
56
|
-
)
|
|
57
|
-
} = options;
|
|
58
|
-
const resourceKeys = Array.from(resourcesMap.keys());
|
|
59
|
-
const simulations = {};
|
|
60
|
-
for (const [path, module] of Object.entries(simulationModules)) {
|
|
61
|
-
const simulationKey = extractSimulationKey(path);
|
|
62
|
-
if (!simulationKey) continue;
|
|
63
|
-
const simulationData = module.default;
|
|
64
|
-
const resourceKey = findResourceKey(simulationKey, resourceKeys);
|
|
65
|
-
if (!resourceKey) {
|
|
66
|
-
onMissingResource(simulationKey, simulationKey.split("-")[0]);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const resource = resourcesMap.get(resourceKey);
|
|
70
|
-
const componentName = getComponentName(resourceKey);
|
|
71
|
-
const resourceComponent = resourceComponents[componentName];
|
|
72
|
-
if (!resourceComponent) {
|
|
73
|
-
console.warn(
|
|
74
|
-
`Resource component "${componentName}" not found for resource "${resourceKey}". Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`
|
|
75
|
-
);
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
simulations[simulationKey] = createSimulation(
|
|
79
|
-
simulationKey,
|
|
80
|
-
simulationData,
|
|
81
|
-
resource,
|
|
82
|
-
resourceComponent
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
return simulations;
|
|
86
|
-
}
|
|
87
|
-
function buildDevSimulations(options) {
|
|
88
|
-
const { simulationModules, resourceModules, resourceComponents } = options;
|
|
89
|
-
const resourcesMap = buildResourceMap(resourceModules);
|
|
90
|
-
return buildSimulations({
|
|
91
|
-
simulationModules,
|
|
92
|
-
resourcesMap,
|
|
93
|
-
resourceComponents,
|
|
94
|
-
createSimulation: (simulationKey, simulationData, resource) => {
|
|
95
|
-
const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));
|
|
96
|
-
const componentName = resourceKey ? getComponentName(resourceKey) : "";
|
|
97
|
-
return {
|
|
98
|
-
...simulationData,
|
|
99
|
-
name: simulationKey,
|
|
100
|
-
resource: {
|
|
101
|
-
uri: `ui://${resource.name}`,
|
|
102
|
-
...resource
|
|
103
|
-
},
|
|
104
|
-
// Generate URL to the resource loader with component name as query param
|
|
105
|
-
resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function findResourceDirs(baseDir, filePattern, fs) {
|
|
111
|
-
if (!fs.existsSync(baseDir)) {
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
115
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => {
|
|
116
|
-
const key = entry.name;
|
|
117
|
-
const dir = `${baseDir}/${key}`;
|
|
118
|
-
const resourcePath = `${dir}/${filePattern(key)}`;
|
|
119
|
-
if (!fs.existsSync(resourcePath)) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
return { key, dir, resourcePath };
|
|
123
|
-
}).filter((info) => info !== null);
|
|
124
|
-
}
|
|
125
|
-
function isSimulationFile(filename, resourceKey) {
|
|
126
|
-
return filename.startsWith(`${resourceKey}-`) && filename.endsWith("-simulation.json");
|
|
127
|
-
}
|
|
128
|
-
function extractSimulationName(filename, resourceKey) {
|
|
129
|
-
return filename.replace(`${resourceKey}-`, "").replace("-simulation.json", "");
|
|
130
|
-
}
|
|
131
|
-
function findSimulationFiles(resourceDir, resourceKey, fs) {
|
|
132
|
-
if (!fs.existsSync(resourceDir)) {
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
135
|
-
const entries = fs.readdirSync(resourceDir, { withFileTypes: true });
|
|
136
|
-
return entries.filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey)).map((entry) => ({
|
|
137
|
-
filename: entry.name,
|
|
138
|
-
name: extractSimulationName(entry.name, resourceKey),
|
|
139
|
-
path: `${resourceDir}/${entry.name}`
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
export {
|
|
143
|
-
buildResourceMap as a,
|
|
144
|
-
buildDevSimulations as b,
|
|
145
|
-
buildSimulations as c,
|
|
146
|
-
createResourceExports as d,
|
|
147
|
-
extractResourceKey as e,
|
|
148
|
-
extractSimulationKey as f,
|
|
149
|
-
extractSimulationName as g,
|
|
150
|
-
findResourceDirs as h,
|
|
151
|
-
findResourceKey as i,
|
|
152
|
-
findSimulationFiles as j,
|
|
153
|
-
getComponentName as k,
|
|
154
|
-
isSimulationFile as l,
|
|
155
|
-
toPascalCase as t
|
|
156
|
-
};
|
|
157
|
-
//# sourceMappingURL=discovery-DzV3HLXs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-DzV3HLXs.js","sources":["../src/lib/discovery.ts"],"sourcesContent":["/**\n * Discovery utilities for auto-discovering resources and simulations\n *\n * These helpers process the results of import.meta.glob() calls to extract\n * keys, build component maps, and connect simulations to resources.\n *\n * The glob calls themselves must remain in the template (Vite compile-time),\n * but all the processing logic lives here for easy updates across templates.\n *\n * Node.js utilities (findResourceDirs, isSimulationFile, etc.) can be used\n * by CLI commands for build-time and runtime discovery.\n */\n\nimport type { Simulation } from '../types/simulation.js';\n\n/**\n * Convert a kebab-case string to PascalCase\n * @example toPascalCase('review') // 'Review'\n * @example toPascalCase('album-art') // 'AlbumArt'\n */\nexport function toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Extract the resource key from a resource file path\n * @example extractResourceKey('./review-resource.tsx') // 'review'\n * @example extractResourceKey('../src/resources/albums-resource.tsx') // 'albums'\n */\nexport function extractResourceKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-resource\\.(tsx|json)$/);\n return match?.[1];\n}\n\n/**\n * Extract the simulation key from a simulation file path\n * @example extractSimulationKey('./albums-show-simulation.json') // 'albums-show'\n */\nexport function extractSimulationKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-simulation\\.json$/);\n return match?.[1];\n}\n\n/**\n * Find the best matching resource key for a simulation key.\n * Matches the longest resource name that is a prefix of the simulation key.\n * @example findResourceKey('albums-show', ['albums', 'album']) // 'albums'\n * @example findResourceKey('review-diff', ['review', 'carousel']) // 'review'\n */\nexport function findResourceKey(simulationKey: string, resourceKeys: string[]): string | undefined {\n // Sort by length descending to find longest match first\n const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);\n for (const resourceKey of sorted) {\n if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + '-')) {\n return resourceKey;\n }\n }\n return undefined;\n}\n\n/**\n * Get the expected component export name for a resource\n * @example getComponentName('review') // 'ReviewResource'\n * @example getComponentName('album-art') // 'AlbumArtResource'\n */\nexport function getComponentName(resourceKey: string): string {\n return `${toPascalCase(resourceKey)}Resource`;\n}\n\n// --- Glob processing helpers ---\n\ntype GlobModules = Record<string, unknown>;\n\n/**\n * Process resource component modules from import.meta.glob() result.\n * Extracts components and exports them with PascalCase names.\n *\n * @example\n * const modules = import.meta.glob('./**\\/*-resource.tsx', { eager: true });\n * export default createResourceExports(modules);\n */\nexport function createResourceExports(modules: GlobModules): Record<string, React.ComponentType> {\n const resources: Record<string, React.ComponentType> = {};\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (!key) continue;\n\n const exportName = getComponentName(key);\n const mod = module as Record<string, unknown>;\n\n // Try default export first, then named export matching the expected name\n const component = mod.default ?? mod[exportName];\n\n // Accept functions (regular components) or objects (forwardRef/memo components)\n if (component && (typeof component === 'function' || typeof component === 'object')) {\n resources[exportName] = component as React.ComponentType;\n }\n }\n\n return resources;\n}\n\n/**\n * Build a resource metadata map from import.meta.glob() result.\n * Used for connecting simulations to their resource definitions.\n *\n * @example\n * const modules = import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true });\n * const resourcesMap = buildResourceMap(modules);\n */\nexport function buildResourceMap<T>(modules: GlobModules): Map<string, T> {\n const map = new Map<string, T>();\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (key) {\n map.set(key, (module as { resource: T }).resource);\n }\n }\n\n return map;\n}\n\n/**\n * Options for building simulations from discovered modules\n */\nexport interface BuildSimulationsOptions<TResource, TSimulation> {\n /** Glob result of simulation JSON files */\n simulationModules: GlobModules;\n /** Map of resource key -> resource metadata */\n resourcesMap: Map<string, TResource>;\n /** Map of component name -> React component */\n resourceComponents: Record<string, React.ComponentType>;\n /** Create the final simulation object */\n createSimulation: (\n simulationKey: string,\n simulationData: unknown,\n resource: TResource,\n resourceComponent: React.ComponentType\n ) => TSimulation;\n /** Optional warning handler for missing resources */\n onMissingResource?: (simulationKey: string, expectedPrefix: string) => void;\n}\n\n/**\n * Build simulations by connecting simulation data with resources and components.\n * This is the main orchestration function for dev server bootstrap.\n */\nexport function buildSimulations<TResource, TSimulation>(\n options: BuildSimulationsOptions<TResource, TSimulation>\n): Record<string, TSimulation> {\n const {\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation,\n onMissingResource = (key, prefix) =>\n console.warn(\n `No matching resource found for simulation \"${key}\". ` +\n `Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`\n ),\n } = options;\n\n const resourceKeys = Array.from(resourcesMap.keys());\n const simulations: Record<string, TSimulation> = {};\n\n for (const [path, module] of Object.entries(simulationModules)) {\n const simulationKey = extractSimulationKey(path);\n if (!simulationKey) continue;\n\n const simulationData = (module as { default: unknown }).default;\n\n // Find matching resource\n const resourceKey = findResourceKey(simulationKey, resourceKeys);\n if (!resourceKey) {\n onMissingResource(simulationKey, simulationKey.split('-')[0]);\n continue;\n }\n\n const resource = resourcesMap.get(resourceKey)!;\n\n // Get component\n const componentName = getComponentName(resourceKey);\n const resourceComponent = resourceComponents[componentName];\n\n if (!resourceComponent) {\n console.warn(\n `Resource component \"${componentName}\" not found for resource \"${resourceKey}\". ` +\n `Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`\n );\n continue;\n }\n\n simulations[simulationKey] = createSimulation(\n simulationKey,\n simulationData,\n resource,\n resourceComponent\n );\n }\n\n return simulations;\n}\n\n// --- Dev server helpers ---\n\n/**\n * Resource metadata from *-resource.tsx files\n */\nexport interface ResourceMetadata {\n name: string;\n [key: string]: unknown;\n}\n\n/**\n * Options for building dev simulations\n */\nexport interface BuildDevSimulationsOptions {\n /** Glob result of simulation JSON files: import.meta.glob('*-simulation.json', { eager: true }) */\n simulationModules: GlobModules;\n /** Glob result of resource JSON files: import.meta.glob('*-resource.tsx', { eager: true }) */\n resourceModules: GlobModules;\n /** Resource components map from src/resources/index.ts */\n resourceComponents: Record<string, React.ComponentType>;\n}\n\n/**\n * Build simulations for the dev server from glob results.\n * This is the main entry point for dev.tsx bootstrap.\n *\n * @example\n * const simulations = buildDevSimulations({\n * simulationModules: import.meta.glob('../src/resources/**\\/*-simulation.json', { eager: true }),\n * resourceModules: import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true }),\n * resourceComponents: resourceComponents,\n * });\n */\nexport function buildDevSimulations(\n options: BuildDevSimulationsOptions\n): Record<string, Simulation> {\n const { simulationModules, resourceModules, resourceComponents } = options;\n\n // Build resource metadata map\n const resourcesMap = buildResourceMap<ResourceMetadata>(resourceModules);\n\n // Build simulations with the standard dev server format\n return buildSimulations<ResourceMetadata, Simulation>({\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation: (simulationKey, simulationData, resource) => {\n // Get the component name for the resource URL\n const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));\n const componentName = resourceKey ? getComponentName(resourceKey) : '';\n\n return {\n ...(simulationData as Omit<Simulation, 'name' | 'resourceUrl' | 'resource'>),\n name: simulationKey,\n resource: {\n uri: `ui://${resource.name}`,\n ...resource,\n },\n // Generate URL to the resource loader with component name as query param\n resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`,\n } as Simulation;\n },\n });\n}\n\n// --- Node.js utilities for CLI commands ---\n// These utilities use standard Node.js APIs and can be imported by build/push/mcp commands.\n\n/**\n * Information about a discovered resource directory\n */\nexport interface ResourceDirInfo {\n /** Resource key (directory name), e.g., 'albums', 'carousel' */\n key: string;\n /** Full path to the resource directory */\n dir: string;\n /** Full path to the main resource file (tsx or json depending on context) */\n resourcePath: string;\n}\n\n/**\n * File system operations interface for dependency injection in tests\n */\nexport interface FsOps {\n readdirSync: (\n path: string,\n options: { withFileTypes: true }\n ) => Array<{ name: string; isDirectory: () => boolean }>;\n existsSync: (path: string) => boolean;\n}\n\n/**\n * Find all resource directories in a base directory.\n * Each valid resource directory contains a file matching the expected pattern.\n *\n * @param baseDir - Base directory to scan (e.g., 'src/resources' or 'dist')\n * @param filePattern - Function to generate expected filename from resource key\n * @param fs - File system operations (for testing)\n *\n * @example\n * // Find source resources (tsx files)\n * const resources = findResourceDirs('src/resources', key => `${key}-resource.tsx`);\n *\n * @example\n * // Find built resources (js files)\n * const resources = findResourceDirs('dist', key => `${key}.js`);\n */\nexport function findResourceDirs(\n baseDir: string,\n filePattern: (key: string) => string,\n fs: FsOps\n): ResourceDirInfo[] {\n if (!fs.existsSync(baseDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(baseDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => {\n const key = entry.name;\n const dir = `${baseDir}/${key}`;\n const resourcePath = `${dir}/${filePattern(key)}`;\n\n if (!fs.existsSync(resourcePath)) {\n return null;\n }\n\n return { key, dir, resourcePath };\n })\n .filter((info): info is ResourceDirInfo => info !== null);\n}\n\n/**\n * Check if a filename is a simulation file for a given resource.\n * Matches pattern: {resourceKey}-*-simulation.json\n *\n * @example\n * isSimulationFile('albums-show-simulation.json', 'albums') // true\n * isSimulationFile('albums-show-simulation.json', 'carousel') // false\n * isSimulationFile('albums-resource.tsx', 'albums') // false\n */\nexport function isSimulationFile(filename: string, resourceKey: string): boolean {\n return filename.startsWith(`${resourceKey}-`) && filename.endsWith('-simulation.json');\n}\n\n/**\n * Extract the simulation name from a simulation filename.\n * Given \"{resourceKey}-{name}-simulation.json\", returns \"{name}\".\n *\n * @example\n * extractSimulationName('albums-show-simulation.json', 'albums') // 'show'\n * extractSimulationName('carousel-hero-simulation.json', 'carousel') // 'hero'\n */\nexport function extractSimulationName(filename: string, resourceKey: string): string {\n return filename.replace(`${resourceKey}-`, '').replace('-simulation.json', '');\n}\n\n/**\n * Find all simulation files in a resource directory.\n *\n * @param resourceDir - Path to the resource directory\n * @param resourceKey - Resource key (e.g., 'albums')\n * @param fs - File system operations (for testing)\n * @returns Array of { filename, name } objects\n */\nexport function findSimulationFiles(\n resourceDir: string,\n resourceKey: string,\n fs: Pick<FsOps, 'readdirSync' | 'existsSync'>\n): Array<{ filename: string; name: string; path: string }> {\n if (!fs.existsSync(resourceDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(resourceDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey))\n .map((entry) => ({\n filename: entry.name,\n name: extractSimulationName(entry.name, resourceKey),\n path: `${resourceDir}/${entry.name}`,\n }));\n}\n"],"names":[],"mappings":"AAoBO,SAAS,aAAa,KAAqB;AAChD,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,EAAE;AACZ;AAOO,SAAS,mBAAmB,MAAkC;AACnE,QAAM,QAAQ,KAAK,MAAM,+BAA+B;AACxD,SAAO,QAAQ,CAAC;AAClB;AAMO,SAAS,qBAAqB,MAAkC;A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
|
|
1
|
-
{"version":3,"file":"index-B0dxRJvS.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-CutQgPzR.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|