usepilot 0.16.0 → 0.17.0

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/cli/next.js ADDED
@@ -0,0 +1,19 @@
1
+ import { createRequire as __pilotRequire } from "node:module"; const require = __pilotRequire(import.meta.url);
2
+ import {
3
+ startWithDevServer
4
+ } from "./chunk-B43K6Q5Y.js";
5
+
6
+ // src/next.ts
7
+ var DEV_PHASE = "phase-development-server";
8
+ function withPilot(config) {
9
+ return (phase, context) => {
10
+ if (phase === DEV_PHASE) startWithDevServer({ cwd: process.cwd() });
11
+ return typeof config === "function" ? config(phase, context) : config;
12
+ };
13
+ }
14
+ var next_default = withPilot;
15
+ export {
16
+ DEV_PHASE,
17
+ next_default as default,
18
+ withPilot
19
+ };
package/cli/vite.js ADDED
@@ -0,0 +1,30 @@
1
+ import { createRequire as __pilotRequire } from "node:module"; const require = __pilotRequire(import.meta.url);
2
+ import {
3
+ startWithDevServer
4
+ } from "./chunk-B43K6Q5Y.js";
5
+
6
+ // src/vite.ts
7
+ function pilot() {
8
+ return {
9
+ name: "usepilot",
10
+ apply: "serve",
11
+ configureServer(server) {
12
+ const start = () => {
13
+ const runner = startWithDevServer({
14
+ cwd: server.config.root,
15
+ // Vite's own address for the app, once it listens (none in middleware mode: Pilot finds the page by project).
16
+ ...server.resolvedUrls?.local[0] ? { url: server.resolvedUrls.local[0] } : {},
17
+ out: (line) => server.config.logger.info(`[pilot] ${line}`, { timestamp: true })
18
+ });
19
+ server.httpServer?.once("close", () => void runner?.close());
20
+ };
21
+ if (server.httpServer) server.httpServer.once("listening", () => setTimeout(start, 0));
22
+ else start();
23
+ }
24
+ };
25
+ }
26
+ var vite_default = pilot;
27
+ export {
28
+ vite_default as default,
29
+ pilot
30
+ };