@vitejs/devtools 0.0.0-alpha.17 → 0.0.0-alpha.18
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/dist/{cli-commands-CTAWbGQg.js → cli-commands-zRt72Hns.js} +1 -1
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +1 -1
- package/dist/client/standalone/assets/index-SrlfcErH.js +1 -0
- package/dist/client/standalone/assets/index-t2O2s5Eq.css +1 -0
- package/dist/client/standalone/index.html +2 -2
- package/dist/client/webcomponents.d.ts +1 -1
- package/dist/client/webcomponents.js +1 -1
- package/dist/{index-DFE-IX9X.d.ts → index-Dt5HYF60.d.ts} +52 -34
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/{plugins-B_YgEdT2.js → plugins-LceePuMU.js} +59 -10
- package/dist/{webcomponents-CTuBoMCb.js → webcomponents-DheoZ3qc.js} +110 -57
- package/package.json +10 -10
- package/dist/client/standalone/assets/index-a0rXXhly.js +0 -1
- package/dist/client/standalone/assets/index-cEBqyH_x.css +0 -1
|
@@ -57,7 +57,7 @@ var DevToolsDockHost = class {
|
|
|
57
57
|
constructor(context) {
|
|
58
58
|
this.context = context;
|
|
59
59
|
this._sendOnChange = debounce(() => {
|
|
60
|
-
context.rpc
|
|
60
|
+
context.rpc?.boardcast?.$callOptional("vite:core:list-dock-entries:updated");
|
|
61
61
|
}, 10);
|
|
62
62
|
}
|
|
63
63
|
values() {
|
|
@@ -132,6 +132,53 @@ const listRpcFunctions = defineRpcFunction({
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/node/rpc/on-dock-launch.ts
|
|
137
|
+
const onDockLaunch = defineRpcFunction({
|
|
138
|
+
name: "vite:core:on-dock-launch",
|
|
139
|
+
type: "action",
|
|
140
|
+
setup: (context) => {
|
|
141
|
+
const launchMap = /* @__PURE__ */ new Map();
|
|
142
|
+
return { handler: async (entryId) => {
|
|
143
|
+
if (launchMap.has(entryId)) return launchMap.get(entryId);
|
|
144
|
+
const entry = context.docks.values().find((entry$1) => entry$1.id === entryId);
|
|
145
|
+
if (!entry) throw new Error(`Dock entry with id "${entryId}" not found`);
|
|
146
|
+
if (entry.type !== "launcher") throw new Error(`Dock entry with id "${entryId}" is not a launcher`);
|
|
147
|
+
try {
|
|
148
|
+
context.docks.update({
|
|
149
|
+
...entry,
|
|
150
|
+
launcher: {
|
|
151
|
+
...entry.launcher,
|
|
152
|
+
status: "loading"
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const promise = entry.launcher.onLaunch();
|
|
156
|
+
launchMap.set(entryId, promise);
|
|
157
|
+
const result = await promise;
|
|
158
|
+
const newEntry = context.docks.values().find((entry$1) => entry$1.id === entryId) || entry;
|
|
159
|
+
if (newEntry.type === "launcher") context.docks.update({
|
|
160
|
+
...newEntry,
|
|
161
|
+
launcher: {
|
|
162
|
+
...newEntry.launcher,
|
|
163
|
+
status: "success"
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return result;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error(`[VITE DEVTOOLS] Error launching dock entry "${entryId}"`, error);
|
|
169
|
+
context.docks.update({
|
|
170
|
+
...entry,
|
|
171
|
+
launcher: {
|
|
172
|
+
...entry.launcher,
|
|
173
|
+
status: "error",
|
|
174
|
+
error: error instanceof Error ? error.message : String(error)
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
} };
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
135
182
|
//#endregion
|
|
136
183
|
//#region src/node/rpc/open-in-editor.ts
|
|
137
184
|
const openInEditor = defineRpcFunction({
|
|
@@ -162,7 +209,8 @@ const builtinRpcFunctions = [
|
|
|
162
209
|
listRpcFunctions,
|
|
163
210
|
listDockEntries,
|
|
164
211
|
openInEditor,
|
|
165
|
-
openInFinder
|
|
212
|
+
openInFinder,
|
|
213
|
+
onDockLaunch
|
|
166
214
|
];
|
|
167
215
|
|
|
168
216
|
//#endregion
|
|
@@ -1275,20 +1323,21 @@ async function createWsServer(options) {
|
|
|
1275
1323
|
//#endregion
|
|
1276
1324
|
//#region src/node/server.ts
|
|
1277
1325
|
async function createDevToolsMiddleware(options) {
|
|
1278
|
-
const
|
|
1279
|
-
const { rpc, getConnectionMeta
|
|
1280
|
-
|
|
1326
|
+
const h3 = createApp();
|
|
1327
|
+
const { rpc, getConnectionMeta } = await createWsServer(options);
|
|
1328
|
+
h3.use("/.vdt-connection.json", eventHandler(async (event) => {
|
|
1281
1329
|
event.node.res.setHeader("Content-Type", "application/json");
|
|
1282
|
-
return event.node.res.end(JSON.stringify(await
|
|
1330
|
+
return event.node.res.end(JSON.stringify(await getConnectionMeta()));
|
|
1283
1331
|
}));
|
|
1284
|
-
|
|
1332
|
+
h3.use(fromNodeMiddleware(sirv(dirClientStandalone, {
|
|
1285
1333
|
dev: true,
|
|
1286
1334
|
single: true
|
|
1287
1335
|
})));
|
|
1288
1336
|
return {
|
|
1289
|
-
h3
|
|
1290
|
-
|
|
1291
|
-
|
|
1337
|
+
h3,
|
|
1338
|
+
rpc,
|
|
1339
|
+
middleware: toNodeListener(h3),
|
|
1340
|
+
getConnectionMeta
|
|
1292
1341
|
};
|
|
1293
1342
|
}
|
|
1294
1343
|
|