@inupedia/spotlight-client 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlightCapabilities.d.ts","sourceRoot":"","sources":["../../src/vite/spotlightCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAKlE,OAAO,EAGL,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACvC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"spotlightCapabilities.d.ts","sourceRoot":"","sources":["../../src/vite/spotlightCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiC,MAAM,MAAM,CAAC;AAKlE,OAAO,EAGL,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACvC,MAAM,sBAAsB,CAAC;AA0B9B,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,iCAAiC,EAC1C,OAAO,CAAC,EAAE,8BAA8B,GACvC,MAAM,CA0LR"}
|
|
@@ -3,6 +3,7 @@ import { DEFAULT_SKILL_ROOTS } from "../node/index.js";
|
|
|
3
3
|
import { createCapabilityDevMiddlewareV1 } from "./capabilityDevMiddleware.js";
|
|
4
4
|
import { buildViteCapabilitiesV1, } from "./capabilityBuild.js";
|
|
5
5
|
import { buildCapabilityVirtualModuleV1, RESOLVED_SPOTLIGHT_CAPABILITIES_MODULE_ID, SPOTLIGHT_CAPABILITIES_MODULE_ID, } from "./capabilityVirtualModule.js";
|
|
6
|
+
const SPOTLIGHT_CAPABILITIES_RUNTIME_MODULE_PATH = "/@spotlight/capabilities-runtime";
|
|
6
7
|
function isAtOrBelow(candidate, directory) {
|
|
7
8
|
const relativePath = relative(directory, candidate);
|
|
8
9
|
return (relativePath === "" ||
|
|
@@ -142,17 +143,20 @@ export function spotlightCapabilities(project, options) {
|
|
|
142
143
|
viteServer.middlewares.use(createCapabilityDevMiddlewareV1(() => currentState().result));
|
|
143
144
|
},
|
|
144
145
|
resolveId(id) {
|
|
145
|
-
return id === SPOTLIGHT_CAPABILITIES_MODULE_ID
|
|
146
|
+
return id === SPOTLIGHT_CAPABILITIES_MODULE_ID ||
|
|
147
|
+
id === SPOTLIGHT_CAPABILITIES_RUNTIME_MODULE_PATH
|
|
146
148
|
? RESOLVED_SPOTLIGHT_CAPABILITIES_MODULE_ID
|
|
147
149
|
: null;
|
|
148
150
|
},
|
|
149
|
-
transformIndexHtml
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
transformIndexHtml: {
|
|
152
|
+
order: "pre",
|
|
153
|
+
handler(html) {
|
|
154
|
+
const runtimeScript = `<script type="module" src="${SPOTLIGHT_CAPABILITIES_RUNTIME_MODULE_PATH}"></script>`;
|
|
155
|
+
const head = /<head(?:\s[^>]*)?>/i;
|
|
156
|
+
return head.test(html)
|
|
157
|
+
? html.replace(head, (openingHead) => `${openingHead}\n ${runtimeScript}`)
|
|
158
|
+
: `${runtimeScript}\n${html}`;
|
|
159
|
+
},
|
|
156
160
|
},
|
|
157
161
|
load(id) {
|
|
158
162
|
if (id !== RESOLVED_SPOTLIGHT_CAPABILITIES_MODULE_ID)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inupedia/spotlight-client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "HTTP/SSE helpers and host tool bridge for Inupedia Spotlight (monorepo workspace package)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"fflate": "0.8.3",
|
|
48
48
|
"magic-string": "^0.30.21",
|
|
49
49
|
"yaml": "^2.8.4",
|
|
50
|
-
"@inupedia/spotlight-protocol": "0.3.
|
|
50
|
+
"@inupedia/spotlight-protocol": "0.3.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|