@pikku/bun-server 0.12.13 → 0.12.15

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,4 +1,4 @@
1
- import { stopSingletonServices } from '@pikku/core/utils';
1
+ import { onShutdownSignals, stopSingletonServices, } from '@pikku/core/lifecycle';
2
2
  import { pikkuState } from '@pikku/core/state';
3
3
  import { createLocalContentRequestHandler, } from '@pikku/core/services/local-content-request-handler';
4
4
  import { fetchData, PikkuFetchHTTPRequest, PikkuFetchHTTPResponse, } from '@pikku/core/http';
@@ -101,6 +101,22 @@ export class PikkuBunServer {
101
101
  }
102
102
  async start() {
103
103
  const { config, logger, options, eventHub } = this;
104
+ const handleMessage = async (ws, message) => {
105
+ const { channelHandler } = ws.data;
106
+ if (typeof message === 'string') {
107
+ const result = await channelHandler.message(message);
108
+ if (result)
109
+ ws.send(JSON.stringify(result));
110
+ }
111
+ else {
112
+ const bytes = message instanceof ArrayBuffer
113
+ ? new Uint8Array(message)
114
+ : new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
115
+ const result = await channelHandler.binaryMessage(bytes);
116
+ if (result)
117
+ channelHandler.sendBinary(result);
118
+ }
119
+ };
104
120
  this.server = Bun.serve({
105
121
  port: config.port,
106
122
  hostname: config.hostname,
@@ -172,29 +188,26 @@ export class PikkuBunServer {
172
188
  channelHandler.registerOnClose(() => {
173
189
  ws.close();
174
190
  });
175
- eventHub.onChannelOpened(channelHandler.channelId, ws);
176
- channelHandler.open();
191
+ Promise.all([
192
+ eventHub.onChannelOpened(channelHandler.channelId, ws),
193
+ channelHandler.open(),
194
+ ]).catch((error) => {
195
+ logger.error(`Error opening websocket channel: ${error}`);
196
+ });
177
197
  },
178
- message: async (ws, message) => {
179
- const { channelHandler } = ws.data;
180
- if (typeof message === 'string') {
181
- const result = await channelHandler.message(message);
182
- if (result)
183
- ws.send(JSON.stringify(result));
184
- }
185
- else {
186
- const bytes = message instanceof ArrayBuffer
187
- ? new Uint8Array(message)
188
- : new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
189
- const result = await channelHandler.binaryMessage(bytes);
190
- if (result)
191
- channelHandler.sendBinary(result);
192
- }
198
+ message: (ws, message) => {
199
+ handleMessage(ws, message).catch((error) => {
200
+ logger.error(`Error handling websocket message: ${error}`);
201
+ });
193
202
  },
194
203
  close: (ws) => {
195
204
  const { channelHandler } = ws.data;
196
- eventHub.onChannelClosed(channelHandler.channelId);
197
- channelHandler.close();
205
+ Promise.all([
206
+ eventHub.onChannelClosed(channelHandler.channelId),
207
+ channelHandler.close(),
208
+ ]).catch((error) => {
209
+ logger.error(`Error closing websocket channel: ${error}`);
210
+ });
198
211
  },
199
212
  },
200
213
  });
@@ -308,8 +321,7 @@ export class PikkuBunServer {
308
321
  process.exit(0);
309
322
  }
310
323
  };
311
- process.once('SIGINT', () => shutdown('SIGINT'));
312
- process.once('SIGTERM', () => shutdown('SIGTERM'));
324
+ onShutdownSignals((signal) => shutdown(signal));
313
325
  }
314
326
  }
315
327
  //# sourceMappingURL=pikku-bun-server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pikku-bun-server.js","sourceRoot":"","sources":["../src/pikku-bun-server.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EACL,gCAAgC,GAEjC,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,SAAS,IAAI,iBAAiB,GAE/B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,E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M,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IACjD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/bun-server",
3
- "version": "0.12.13",
3
+ "version": "0.12.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pikkujs/pikku.git",
@@ -11,18 +11,23 @@
11
11
  "author": "yasser.fadl@gmail.com",
12
12
  "module": "dist/index.js",
13
13
  "main": "dist/index.js",
14
+ "files": [
15
+ "dist",
16
+ "!dist/**/*.tsbuildinfo"
17
+ ],
14
18
  "type": "module",
15
19
  "scripts": {
16
20
  "tsc": "tsc",
17
- "build": "tsc -b",
21
+ "build": "bun run clean && tsc -b",
18
22
  "test": "bash run-tests.sh",
19
23
  "test:watch": "bash run-tests.sh --watch",
20
24
  "test:coverage": "bash run-tests.sh --coverage",
21
- "prepublishOnly": "bun run build"
25
+ "prepublishOnly": "bun run build",
26
+ "clean": "rm -rf dist tsconfig.tsbuildinfo"
22
27
  },
23
28
  "peerDependencies": {
24
- "@pikku/core": "^0.12.116",
25
- "@pikku/modelcontextprotocol": "^0.12.14"
29
+ "@pikku/core": "^0.12.144",
30
+ "@pikku/modelcontextprotocol": "^0.12.18"
26
31
  },
27
32
  "peerDependenciesMeta": {
28
33
  "@pikku/modelcontextprotocol": {
@@ -30,9 +35,9 @@
30
35
  }
31
36
  },
32
37
  "devDependencies": {
33
- "@pikku/core": "^0.12.116",
34
- "@pikku/modelcontextprotocol": "^0.12.14",
35
- "@types/bun": "^1.4.0"
38
+ "@pikku/core": "^0.12.144",
39
+ "@pikku/modelcontextprotocol": "^0.12.18",
40
+ "@types/bun": "^1.4.3"
36
41
  },
37
42
  "engines": {
38
43
  "bun": ">=1.4.0"
package/CHANGELOG.md DELETED
@@ -1,387 +0,0 @@
1
- # @pikku/bun-server
2
-
3
- ## 0.12.13
4
-
5
- ### Patch Changes
6
-
7
- - b312867: A project can now serve several MCP endpoints, one per connector.
8
-
9
- Until now every MCP tool in a project was pooled onto a single `/mcp`, so a hub offering three connectors offered one endpoint listing all three connectors' tools at once. A client pointed at it saw tools it had no business calling, and the only way to give a connector an endpoint of its own was to give it a deployment of its own — three deploys, three bills, three service graphs.
10
-
11
- `wireAddon` gains `mcpEndpoint`. `true` serves that instance's tools at `/mcp/<name>`; a string is the path, used as given. Leaving it unset keeps the tools on the shared endpoint, which is where they have always been, so nothing existing moves.
12
-
13
- A surfaced instance now gets its own manifest (`.pikku/mcp/mcp.<name>.gen.json`, carrying the path it answers on), its own deploy unit (`mcp-<name>`, routed on that path), and its own MCP server — with its own tool list, so a client pointed at one endpoint never sees another's tools. The plumbing for the per-surface manifest and unit already existed in `deploy apply`; nothing had ever produced one.
14
-
15
- `pikku dev` mounts every endpoint the generated tree describes, not just the default one. Without that a project that moved its tools onto their own endpoints would have served nothing locally at all — the default manifest it reads is empty precisely because they moved — and the only way to try a connector would have been to deploy it.
16
-
17
- The node and bun transports take `mcpSurfaces` alongside `mcpJson` and mount each at its own path, longest path first. `/mcp` claims everything beneath `/mcp/`, so without that ordering the default endpoint answers `/mcp/weather` and the surface's tools are unreachable.
18
-
19
- OAuth discovery is split between the endpoints rather than duplicated across them. RFC 9728 folds a resource's path into its well-known route, so each endpoint's own document is already distinct, but the path-less `/.well-known/oauth-protected-resource` predates that and describes whichever resource answers it. Only the default endpoint claims it — otherwise every unit registers the same route and the provider's router decides which resource a client is told about, and in dev a client probing it is described whichever surface sorted first.
20
-
21
- - Updated dependencies [87971bd]
22
- - Updated dependencies [51bd35a]
23
- - Updated dependencies [b312867]
24
- - Updated dependencies [51bd35a]
25
- - @pikku/core@0.12.116
26
- - @pikku/modelcontextprotocol@0.12.14
27
-
28
- ## 0.12.12
29
-
30
- ### Patch Changes
31
-
32
- - dfd7019: An MCP call that needs a session is refused with an OAuth challenge
33
-
34
- A tool fronting a session-requiring function used to answer an unauthenticated
35
- caller with `200` and `isError: true`, which a client reads as a tool that
36
- broke rather than one it has not authenticated for — so OAuth discovery never
37
- began. Such a call now gets `401` with a `WWW-Authenticate: Bearer` challenge
38
- naming the resource metadata, and `/.well-known/oauth-protected-resource` is
39
- served alongside the MCP endpoint.
40
-
41
- The endpoint is not gated as a whole. `mcpTargetRequiresSession` reads the
42
- declarations the runner already enforces — a `pikkuFunc` needs a session, a
43
- `pikkuSessionlessFunc` needs one only where it says `auth: true` — so public
44
- and private tools can share one server and only the private ones are
45
- challenged.
46
-
47
- `createFetchHandler` and `createHTTPRequestHandler` take an optional `auth`
48
- describing what to advertise (`authorizationServers`, `scopesSupported`,
49
- `resourceName`), surfaced on both servers as an `mcpAuth` option. Every field
50
- defaults from the request, because a pikku app is usually its own
51
- authorization server. Both handlers now also return `ownsPath`, because the
52
- discovery document lives outside `mcpPath` and a host routing on the endpoint
53
- alone would 404 the document its own challenge points at.
54
-
55
- - Updated dependencies [c842054]
56
- - Updated dependencies [dfd7019]
57
- - Updated dependencies [dfd7019]
58
- - Updated dependencies [dfd7019]
59
- - Updated dependencies [dfd7019]
60
- - Updated dependencies [9b978e7]
61
- - Updated dependencies [1469e73]
62
- - @pikku/core@0.12.113
63
- - @pikku/modelcontextprotocol@0.12.12
64
-
65
- ## 0.12.11
66
-
67
- ### Patch Changes
68
-
69
- - 3d75643: Run the app's server lifecycle in generated entries, and make an out-of-band
70
- account signable-in.
71
-
72
- `pikkuServerLifecycle` was only ever called by `pikku dev` and `pikku serve`, so
73
- an app that seeds its first admin account, probes a dependency, or warms a cache
74
- in `beforeStart` did all of that in development and silently skipped it
75
- everywhere it was actually deployed. The standalone entry and the shared node
76
- server entry — the one behind every `target: 'server'` unit — now import the
77
- app's lifecycle and call it: `beforeStart` after `init` and before the port
78
- opens, so work that must finish before the first request has, `afterStart` once
79
- the server is listening, and the stop hooks handed to the signal handler that
80
- already owns shutdown rather than a second listener racing it. Each shutdown
81
- step is isolated from the ones after it, so a hook that throws is logged without
82
- taking the service teardown and the socket close down with it.
83
-
84
- Separately, `createAuthUser` and `setAuthUserPassword` wrote credential accounts
85
- with no `issuer`. From better-auth 1.7 a credential account is matched by its
86
- issuer as well as its provider, so those accounts were invisible to sign-in,
87
- `updatePassword` and `findCredentialAccount` — a user who plainly existed in the
88
- table was reported as "user not found". The field is written only when the
89
- resolved schema has it, so older better-auth keeps working, and
90
- `setAuthUserPassword` repairs an account that predates the fix.
91
-
92
- ## 0.12.10
93
-
94
- ### Patch Changes
95
-
96
- - 80eb5c0: Generate a desktop shell from `pikku deploy apply --desktop`
97
-
98
- `pikku deploy apply --provider standalone --runtime bun --desktop` now emits a
99
- `src-tauri/` crate that ships the compiled binary as a sidecar and opens a
100
- window on the server's own HTTP origin, so cookies, CORS and OAuth behave
101
- exactly as they do in a browser. Regeneration is idempotent and leaves an
102
- edited file alone rather than overwriting it.
103
-
104
- `--desktop-url https://app.example.com` builds the other shape: a shell that
105
- points at an already-deployed server. Nothing is bundled — no sidecar, no
106
- binary, and so no bun runtime to compile one — and the window is declared in
107
- `tauri.conf.json` rather than opened from Rust, because the origin is known up
108
- front. The url can also live in `pikku.config.json` as `deploy.desktop.url`,
109
- alongside `deploy.desktop.identifier`.
110
-
111
- Supporting changes: `SERVER_READY_MARKER` moved to `@pikku/deploy` (the CLI
112
- re-exports it from its old path), both HTTP runtimes expose the port they
113
- actually bound so `--port 0` reports a real port, and the generated server
114
- entry exits when its parent process goes away.
115
-
116
- - 80eb5c0: feat: serve a built frontend from the pikku server's own origin
117
-
118
- A new `frontend` key in `pikku.config.json` names a directory of built
119
- frontend output. `pikku serve` mounts it, and `pikku deploy` ships it inside
120
- the distributable — into a directory beside the bundle for the node runtime,
121
- and embedded in the binary for a `bun build --compile` standalone. `pikku dev`
122
- deliberately ignores it and says so, because the frontend's own dev server owns
123
- that job.
124
-
125
- Pikku reads the frontend's output and never builds it, so an unbuilt directory
126
- fails with a message that says which build to run rather than booting a server
127
- that answers every page with a 404.
128
-
129
- - Updated dependencies [80eb5c0]
130
- - Updated dependencies [2252016]
131
- - @pikku/core@0.12.98
132
-
133
- ## 0.12.9
134
-
135
- ### Patch Changes
136
-
137
- - 6ff72d3: Raise the supported Bun version to 1.4.
138
-
139
- `@pikku/bun-server` and `@pikku/kysely-bun-sqlite` now declare `engines.bun: >=1.4.0`
140
- and build against `@types/bun@^1.4.0`. `create-pikku` scaffolds
141
- `"packageManager": "bun@1.4.0"`, and the fabric `smoke`/`validate` commands default to
142
- and recommend the same version. CI pins `oven-sh/setup-bun` to 1.4.0 instead of
143
- tracking `latest`.
144
-
145
- ## 0.12.8
146
-
147
- ### Patch Changes
148
-
149
- - 266e3bc: One door per name: `@pikku/core/ecosystem/*` and the package root are gone
150
-
151
- `@pikku/core` published every module twice. `ecosystem/http` re-exported
152
- `./http`, `ecosystem/services` re-exported `./services`, and a name was
153
- reachable through either — so every addition had to be made in two places, and a
154
- consumer's import said nothing about what it actually used. The package root was
155
- the same problem at a larger scale: a single barrel of 206 names that no bundler
156
- could take apart, and the one specifier that revealed nothing at all.
157
-
158
- Both are deleted. Every name now lives on the subpath that owns it, and every
159
- import carries that subpath — `@pikku/core/http`, `@pikku/core/services`,
160
- `@pikku/core/errors`, `@pikku/core/types`.
161
-
162
- Deleting the facades meant the raw subpaths had to become a superset of them,
163
- which they were not: the facade tree had accumulated 25 names with no raw home
164
- and about 26 more filed under a different area than the module they came from.
165
- Those names moved to the area that owns them, and three areas were published as
166
- new entry points rather than left on a root that is going away — `./types` (the
167
- shared type surface, the largest single destination), `./state` and
168
- `./classification`.
169
-
170
- `./classification` is one door onto one subject: what a value is and how it must
171
- be handled. Its three halves would each have been an entry point — the brands
172
- and manifest types, the stored-form helpers (`hashToken`, `unsafeAsSealed` and
173
- friends), and `SecretValue` — split by whether a name happens to be a type or a
174
- value, which is the same defect as the facades. The duration and versioned-id
175
- helpers went to `./utils`, which already published, and `PikkuRequest` went to
176
- `./function`: it is the transport-agnostic request base, not an HTTP one — HTTP
177
- has `PikkuHTTPAbstractRequest`, and the only thing outside core that extends
178
- `PikkuRequest` is Azure's timer request.
179
-
180
- `./types` inherited the root barrel's habit before it inherited its contents, so
181
- the names with an owner elsewhere were moved off it. The middleware types and the
182
- five middleware factories — `pikkuMiddleware`, `pikkuMiddlewareFactory`,
183
- `pikkuChannelMiddleware`, `pikkuChannelMiddlewareFactory` and
184
- `pikkuAgentMiddleware`, runtime values on a types entry point — are now
185
- `@pikku/core/middleware`; the function meta types are `@pikku/core/function`;
186
- `SerializedError` is `@pikku/core/errors`; and the generic TypeScript helpers
187
- (`MakeRequired`, `PickRequired`, `PickOptional`, `RequireAtLeastOne`,
188
- `JSONPrimitive`, `JSONValue`) are `@pikku/core/utils`. What is left on `./types`
189
- is the vocabulary the wirings share, which no single module owns.
190
-
191
- `pikku` was itself a root barrel — `export * from '@pikku/core'` — and
192
- now exports only the services it bundles.
193
-
194
- One module survives at the old specifier, and only for the bootstrap:
195
- `packages/cli` is generated by the _published_ CLI pinned in its `build.sh`, and
196
- that CLI still writes a bare `@pikku/core` into the files it generates for the
197
- CLI itself. `bootstrap-compat/root.ts` carries the eight types it names, a test
198
- in core fails if that list grows, and it goes when the pin moves to a CLI
199
- released from this branch. The adapter names the pinned CLI reaches for —
200
- `pikkuState` and `CreateWireServices` — are rewritten to `@pikku/core/state` and
201
- `@pikku/core/types` by the same `build.sh` patch pass, so no second shim is
202
- needed for them.
203
-
204
- A guard test keeps the root shut: it parses imports and rejects a bare
205
- `@pikku/core` rather than grepping for it, because several tests hold a user's
206
- file as a template literal, where `import … from '@pikku/core'` is fixture text
207
- rather than an import this repo makes.
208
-
209
- An agent scaffold a project generated under an older CLI is refreshed rather
210
- than left to fail: `pikku all` already deleted one importing an entry point
211
- `@pikku/core` no longer publishes, and the `#pikku` hub joins that list.
212
- Without it a project that scaffolds the agent endpoint but
213
- declares no agents keeps the old file forever — the generator that would rewrite
214
- it only runs when agents exist, and the file being present is what stops it
215
- being regenerated as missing.
216
-
217
- `pikku new addon` also wrote a tsconfig `paths` map naming only the deleted hub.
218
- An addon's `imports` map points into `dist`, so `paths` is what resolves
219
- `#pikku/<leaf>` for the addon's own source build — it now names the two leaf
220
- patterns, in both the addon and its test harness.
221
-
222
- - Updated dependencies [7722ceb]
223
- - Updated dependencies [375c1ff]
224
- - Updated dependencies [02a70cd]
225
- - Updated dependencies [aeef159]
226
- - Updated dependencies [a281de6]
227
- - Updated dependencies [266e3bc]
228
- - Updated dependencies [02a70cd]
229
- - Updated dependencies [786dae5]
230
- - Updated dependencies [6eef0a0]
231
- - Updated dependencies [3561d67]
232
- - Updated dependencies [a91c433]
233
- - Updated dependencies [02a70cd]
234
- - Updated dependencies [9537f74]
235
- - Updated dependencies [2b57ca8]
236
- - Updated dependencies [266e3bc]
237
- - Updated dependencies [9fce0f1]
238
- - Updated dependencies [83683a0]
239
- - Updated dependencies [456c88b]
240
- - Updated dependencies [456c88b]
241
- - Updated dependencies [c127273]
242
- - @pikku/core@0.12.85
243
- - @pikku/modelcontextprotocol@0.12.10
244
-
245
- ## 0.12.7
246
-
247
- ### Patch Changes
248
-
249
- - 6794681: Publish the ecosystem surface as per-area sub-barrels under `@pikku/core/ecosystem/*`, and point generated code, the CLI, the inspector and the runtime adapters at them.
250
-
251
- 348 names that only generated code, the toolchain or a runtime adapter ever imports now have a second home on `@pikku/core/ecosystem/<area>` — one sub-barrel per area, matching how core already publishes its entrypoints, so no single barrel grows without bound and a consumer only pulls in the area it uses.
252
-
253
- This step is additive: every name is still exported from the entrypoint it was published from before, so nothing downstream breaks. Removing them from the app-facing barrels is a later change, and needs a release carrying `./ecosystem/*` first.
254
-
255
- - Updated dependencies [7406bfe]
256
- - Updated dependencies [6794681]
257
- - @pikku/core@0.12.84
258
- - @pikku/modelcontextprotocol@0.12.9
259
-
260
- ## 0.12.6
261
-
262
- ### Patch Changes
263
-
264
- - fd9d834: Stop publishing internals that only their own package or file used. The declarations stay; only the entrypoint re-export is removed, so nothing that imported a name from where it is declared is affected.
265
- - Updated dependencies [063f43a]
266
- - Updated dependencies [ce66bf8]
267
- - Updated dependencies [d0307a8]
268
- - Updated dependencies [ce66bf8]
269
- - Updated dependencies [ce66bf8]
270
- - Updated dependencies [3ad2131]
271
- - Updated dependencies [b930dca]
272
- - Updated dependencies [b95e77d]
273
- - Updated dependencies [fd9d834]
274
- - Updated dependencies [8978fbd]
275
- - @pikku/core@0.12.82
276
- - @pikku/modelcontextprotocol@0.12.8
277
-
278
- ## 0.12.5
279
-
280
- ### Patch Changes
281
-
282
- - ea8aabf: Serve `LocalContent` uploads and signed reads under Bun.
283
-
284
- `LocalContent` hands the browser a `PUT <uploadUrlPrefix>/<key>` upload URL and a signed
285
- `GET <assetUrlPrefix>/<key>` read URL, but it is a `ContentService` and cannot answer
286
- either — something in the serving path has to. Only `@pikku/node-http-server` did. The
287
- same project served under Bun handed out upload URLs that 404ed, with nothing naming the
288
- cause: the config was accepted, the service was constructed, and the URLs looked right.
289
-
290
- `@pikku/core` now exports `createLocalContentRequestHandler` from
291
- `@pikku/core/services/local-content-request-handler` — the server half of `LocalContent`,
292
- expressed in Web `Request`/`Response` so every runtime shares one implementation of the
293
- signature check rather than each re-deriving it. It returns `null` for anything that is
294
- not a content request, which is the caller's signal to carry on with its normal routing.
295
-
296
- `PikkuBunServer` accepts `config.content` and a `contentSigningJWT` option, mirroring
297
- `PikkuNodeHTTPServer`, and answers both prefixes ahead of static mounts and routing.
298
- `BunServerRunner` was dropping `contentSigningJWT` on the floor, which silently disabled
299
- signed asset reads for every Bun project even once the prefixes were served — the config
300
- arrived, the service that verifies its signatures did not.
301
-
302
- Signed reads are refused unless every claim matches, the path included: without that, a
303
- signature minted for one asset would read any other.
304
-
305
- - Updated dependencies [32277d5]
306
- - Updated dependencies [ea8aabf]
307
- - Updated dependencies [33e96ab]
308
- - Updated dependencies [fd72e58]
309
- - Updated dependencies [fd72e58]
310
- - Updated dependencies [fd72e58]
311
- - Updated dependencies [894b2f8]
312
- - Updated dependencies [dd19aa7]
313
- - Updated dependencies [50ec500]
314
- - @pikku/core@0.12.75
315
-
316
- ## 0.12.4
317
-
318
- ### Patch Changes
319
-
320
- - d4a2503: Serve the console same-origin at /console (#861). Both dev servers gain
321
- `staticMounts` (prefix → directory static serving with SPA fallback and path
322
- traversal protection); `pikku serve` / `pikku dev` mount the bundled console
323
- app at `/console` on the API port whenever it is bundled, so auth cookies are
324
- first-party and no `?server=` param is needed. The console is built with
325
- `base: '/console/'` (its router already derives the basename from BASE_URL).
326
- The separate `--console <port>` static server is removed; `pikku console`
327
- serves the bundle under /console and redirects the root there.
328
- - Updated dependencies [61c9ce9]
329
- - Updated dependencies [f1f39f8]
330
- - Updated dependencies [c45e98d]
331
- - Updated dependencies [472a349]
332
- - @pikku/core@0.12.52
333
-
334
- ## 0.12.3
335
-
336
- ### Patch Changes
337
-
338
- - 6f6abfe: Mount MCP on the bun runtime. `@pikku/bun-server` now accepts `mcpJson`/`mcpPath`
339
- options and serves the MCP endpoint (default `/mcp`) via a new fetch-native
340
- handler on `PikkuMCPServer.createFetchHandler()`, which uses the MCP SDK's
341
- Web-Standard (`Request`→`Response`) streamable-HTTP transport — no `node:http`
342
- req/res. The standalone `--runtime bun` entry now wires the same `mcpImport` +
343
- `mcpJson` option the node entry already used, so a bun standalone build serves
344
- `/mcp` with the project's tools/resources/prompts instead of silently dropping
345
- them. `@pikku/modelcontextprotocol` is an optional peer dep of `@pikku/bun-server`
346
- (only imported when `mcpJson` is non-empty).
347
- - Updated dependencies [6f6abfe]
348
- - @pikku/modelcontextprotocol@0.12.6
349
-
350
- ## 0.12.2
351
-
352
- ### Patch Changes
353
-
354
- - 41ce2cb: Upgrade to TypeScript 6 and raise the minimum Node.js version to 22.
355
-
356
- All packages now build against `typescript@^6.0.3` and declare `engines.node >= 22`. Internal tooling (`ts-json-schema-generator`, `zod-to-ts`) was bumped to TypeScript 6-compatible releases.
357
-
358
- - Updated dependencies [41ce2cb]
359
- - @pikku/core@0.12.44
360
-
361
- ## 0.12.1
362
-
363
- ### Patch Changes
364
-
365
- - d5c3c85: feat: bun first-class support — new `@pikku/bun-server` runtime and `@pikku/kysely-bun-sqlite` dialect, bun template, CI matrix with `package-manager: [yarn, bun]`, and bun verifier.
366
- - e443e94: feat(deploy): standalone provider can target the bun runtime
367
-
368
- `pikku deploy plan|apply --provider standalone --runtime bun` now generates a
369
- `@pikku/bun-server` entry (native `Bun.serve` WebSockets, no `ws` package) and
370
- compiles the bundle into a single self-contained executable via
371
- `bun build --compile` — no runtime needed on the target host. The default
372
- remains `--runtime node`, which is unchanged (ships `bundle.js`, run with
373
- `node bundle.js`).
374
-
375
- `PikkuBunServer` now accepts an injectable `eventHub` in its options. Inject the
376
- same `BunEventHubService` you pass to `createSingletonServices` so functions and
377
- the WebSocket transport share one hub — otherwise a function's
378
- `eventHub.publish(...)` targets a different hub than the one holding the live
379
- sockets and broadcasts never reach connected clients. The standalone bun entry
380
- and the `bun` template now wire this shared hub, fixing cross-connection /
381
- cross-transport channel pub-sub on bun.
382
-
383
- Also removes the unused `@yao-pkg/pkg` dependency and its stale type shim from
384
- `@pikku/deploy-standalone` (the pkg-based binary path was dropped in #489).
385
-
386
- - Updated dependencies [92cd5b1]
387
- - @pikku/core@0.12.38
package/run-tests.sh DELETED
@@ -1,68 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Enable nullglob to handle cases where no files match the pattern
4
- shopt -s nullglob
5
-
6
- # Initialize variables for options
7
- watch_mode=false
8
- coverage_mode=false
9
-
10
- # Parse command-line options
11
- while [[ $# -gt 0 ]]; do
12
- case $1 in
13
- --watch)
14
- watch_mode=true
15
- shift
16
- ;;
17
- --coverage)
18
- coverage_mode=true
19
- shift
20
- ;;
21
- *)
22
- echo "Unknown option: $1"
23
- exit 1
24
- ;;
25
- esac
26
- done
27
-
28
- # Define the pattern to match your test files
29
- pattern="src/*.test.ts"
30
-
31
- # Expand the pattern into an array of files
32
- files=($(find src -type f -name "*.test.ts"))
33
-
34
- # Check if any files matched the pattern
35
- if [ ${#files[@]} -eq 0 ]; then
36
- echo "No test files found matching pattern: $pattern"
37
- if [ "${STRICT_TEST_DISCOVERY}" = "1" ]; then
38
- exit 1
39
- fi
40
- exit 0
41
- fi
42
-
43
- # Construct the bun command
44
- #
45
- # --parallel gives every test file its own worker process, which is what node's
46
- # `--test` did. Several suites keep module-level caches (a TypeScript program, a
47
- # temp fixture directory) that a shared process would leak between files.
48
- #
49
- # --timeout because bun caps a test at 5s by default where node had no cap, and
50
- # the suites that build real TypeScript programs run well past that.
51
- bun_cmd=(bun test --parallel --timeout 120000)
52
-
53
- # Append options based on flags
54
- if [ "$watch_mode" = true ]; then
55
- # --watch reruns in one process; parallel workers have nothing to watch.
56
- bun_cmd=(bun test --watch --timeout 120000)
57
- fi
58
-
59
- if [ "$coverage_mode" = true ]; then
60
- # --coverage-dir=. keeps lcov.info at the package root: CI merges every
61
- # package's report by prefixing its SF paths with the file's own directory,
62
- # so a nested coverage/ directory would re-root them one level too deep.
63
- bun_cmd+=(--coverage --coverage-reporter=lcov --coverage-reporter=text --coverage-dir=.)
64
- export PIKKU_TEST_COVERAGE=1
65
- fi
66
-
67
- # Execute the bun command with the expanded list of files
68
- "${bun_cmd[@]}" "${files[@]}"