@hoardodile/workbench 0.1.4 → 0.1.6

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/index.html CHANGED
@@ -41,8 +41,8 @@
41
41
  }
42
42
  })()
43
43
  </script>
44
- <script type="module" crossorigin src="/assets/index-B-oJo2ZZ.js"></script>
45
- <link rel="stylesheet" crossorigin href="/assets/index-C9ltfJNl.css">
44
+ <script type="module" crossorigin src="/assets/index-NgcDskUx.js"></script>
45
+ <link rel="stylesheet" crossorigin href="/assets/index-DtIQCj0S.css">
46
46
  </head>
47
47
  <body>
48
48
  <div id="root"></div>
package/dist/serve.d.mts CHANGED
@@ -142,8 +142,18 @@ export type ServeWorkbenchOptions = {
142
142
  * URL reports the actual one; read `server.address()` for it.
143
143
  */
144
144
  readonly port?: number
145
- /** Bind host. Defaults to 127.0.0.1. */
145
+ /**
146
+ * Bind host. Defaults to 127.0.0.1.
147
+ */
146
148
  readonly host?: string
149
+ /**
150
+ * Called once with the actual bound URL (`http://<host>:<port>`) once
151
+ * the server is listening. When provided it replaces the default
152
+ * `[workbench] serving on ...` log line — the caller owns the startup
153
+ * message, so it can print it only after e.g. the plugin build has
154
+ * settled, instead of being buried under the watcher's output.
155
+ */
156
+ readonly onReady?: (url: string) => void
147
157
  }
148
158
 
149
159
  /**
package/dist/serve.mjs CHANGED
@@ -34,7 +34,7 @@ const MAX_PORT_ATTEMPTS = 20
34
34
  * Returns the http.Server.
35
35
  */
36
36
  export function serveWorkbench(opts) {
37
- const { pluginDir, dataDir, port = 5199, host = "127.0.0.1" } = opts
37
+ const { pluginDir, dataDir, port = 5199, host = "127.0.0.1", onReady } = opts
38
38
  if (pluginDir === undefined) {
39
39
  console.warn("[workbench] no plugin dir — pass --plugin <dist-dir>")
40
40
  }
@@ -86,7 +86,13 @@ export function serveWorkbench(opts) {
86
86
  const address = server.address()
87
87
  const bound =
88
88
  address === null || typeof address === "string" ? attempt : address.port
89
- console.log(`[workbench] serving on http://${host}:${bound}`)
89
+ const url = `http://${host}:${bound}`
90
+ // The caller may own the startup message so it can print it only
91
+ // after the plugin build settles (the CLI does, otherwise vite's
92
+ // watch-build output buries the URL). Standalone servers keep the
93
+ // plain log line.
94
+ if (onReady) onReady(url)
95
+ else console.log(`[workbench] serving on ${url}`)
90
96
  resolveStart(server)
91
97
  }
92
98
  function onError(err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoardodile/workbench",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "description": "Offline dev workbench for hoardodile content plugins.",
6
6
  "keywords": [
@@ -50,11 +50,11 @@
50
50
  "vite": "^8.2.2",
51
51
  "vitest": "^4.1.11",
52
52
  "zod": "^4.4.3",
53
- "@hoardodile/host-web": "0.1.4",
54
- "@hoardodile/i18n": "0.1.4",
55
- "@hoardodile/sdk-types": "0.1.4",
56
- "@hoardodile/sdk-web": "0.1.4",
57
- "@hoardodile/ui": "0.1.4"
53
+ "@hoardodile/host-web": "0.1.6",
54
+ "@hoardodile/i18n": "0.1.6",
55
+ "@hoardodile/sdk-web": "0.1.6",
56
+ "@hoardodile/sdk-types": "0.1.6",
57
+ "@hoardodile/ui": "0.1.6"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "node scripts/dev.mjs",