@kubohiroya/turbowarp-http-server 0.1.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/LICENSE +373 -0
- package/README.ja.md +346 -0
- package/README.md +874 -0
- package/dist/auth/digest-file.d.ts +17 -0
- package/dist/auth/digest-file.js +90 -0
- package/dist/auth/digest-file.js.map +1 -0
- package/dist/auth/digest.d.ts +23 -0
- package/dist/auth/digest.js +139 -0
- package/dist/auth/digest.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +156 -0
- package/dist/cli.js.map +1 -0
- package/dist/community.d.ts +81 -0
- package/dist/community.js +689 -0
- package/dist/community.js.map +1 -0
- package/dist/digest-cli.d.ts +1 -0
- package/dist/digest-cli.js +159 -0
- package/dist/digest-cli.js.map +1 -0
- package/dist/extension-manifest.json +441 -0
- package/dist/protocol.d.ts +59 -0
- package/dist/protocol.js +71 -0
- package/dist/protocol.js.map +1 -0
- package/dist/server.d.ts +89 -0
- package/dist/server.js +650 -0
- package/dist/server.js.map +1 -0
- package/dist/turbowarp-http-server.js +1110 -0
- package/docs/deployment-targets.ja.md +274 -0
- package/docs/turbowarp-http-server.architecture.html +15149 -0
- package/docs/turbowarp-http-server.architecture.json +1014 -0
- package/docs/turbowarp-http-server.architecture.visual-check.1440x900.dark.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.1440x900.light.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.2048x1320.dark.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.2048x1320.light.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.html +32 -0
- package/docs/turbowarp-http-server.architecture.visual-check.json +547 -0
- package/examples/01-hello-form/README.ja.md +46 -0
- package/examples/01-hello-form/server.mjs +59 -0
- package/examples/02-visitor-counter/README.ja.md +39 -0
- package/examples/02-visitor-counter/server.mjs +44 -0
- package/examples/03-message-board/README.ja.md +47 -0
- package/examples/03-message-board/server.mjs +72 -0
- package/examples/04-image-upload/README.ja.md +46 -0
- package/examples/04-image-upload/server.mjs +149 -0
- package/examples/05-live-camera/README.ja.md +47 -0
- package/examples/05-live-camera/server.mjs +147 -0
- package/examples/06-scratch-like-community/README.ja.md +82 -0
- package/examples/06-scratch-like-community/server.mjs +17 -0
- package/examples/README.ja.md +20 -0
- package/package.json +75 -0
- package/schemas/extension-manifest.schema.json +49 -0
- package/src/auth/digest-file.ts +115 -0
- package/src/auth/digest.ts +170 -0
- package/src/block-definitions.json +417 -0
- package/src/cli.ts +172 -0
- package/src/community.ts +815 -0
- package/src/config.ts +12 -0
- package/src/digest-cli.ts +178 -0
- package/src/extension-manifest.ts +149 -0
- package/src/extension.ts +713 -0
- package/src/globals.d.ts +30 -0
- package/src/index.ts +8 -0
- package/src/protocol.ts +132 -0
- package/src/server.ts +880 -0
package/README.md
ADDED
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
# TurboWarp-HTTP-Server
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [日本語](README.ja.md)
|
|
4
|
+
|
|
5
|
+
A companion package with both a CLI HTTP bridge server and a TurboWarp extension that connects Scratch-style block programs to that server over WebSocket.
|
|
6
|
+
|
|
7
|
+
**User guide:** [English](https://kubohiroya.github.io/turbowarp-http-server/)
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
- Starts a local HTTP/WebSocket bridge server from the command line.
|
|
12
|
+
- Provides a TurboWarp custom extension bundle with blocks for configuring and using the bridge connection.
|
|
13
|
+
- Sends text messages between TurboWarp and the bridge while the full HTTP request/response protocol is being defined.
|
|
14
|
+
|
|
15
|
+
## Requirements and safety
|
|
16
|
+
|
|
17
|
+
- TurboWarp Desktop, TurboWarp Web, or TurboWarp Packager with custom extensions enabled.
|
|
18
|
+
- Node.js 22 or newer for the CLI bridge server.
|
|
19
|
+
- The extension requires unsandboxed mode so incoming HTTP requests can start TurboWarp hat threads.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### CLI bridge server
|
|
24
|
+
|
|
25
|
+
From this repository:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
corepack pnpm install
|
|
29
|
+
corepack pnpm run build
|
|
30
|
+
corepack pnpm start -- --host 127.0.0.1 --port 8787
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
From an installed package:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
turbowarp-http-server --host 127.0.0.1 --port 8787
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For an offline venue LAN, enable HTTP Digest authentication with an htdigest file:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
turbowarp-http-digest init ./users.htdigest --realm turbowarp-lan
|
|
43
|
+
turbowarp-http-digest add ./users.htdigest alice --realm turbowarp-lan
|
|
44
|
+
|
|
45
|
+
turbowarp-http-server \
|
|
46
|
+
--host 0.0.0.0 \
|
|
47
|
+
--port 8787 \
|
|
48
|
+
--auth-digest ./users.htdigest \
|
|
49
|
+
--auth-realm turbowarp-lan
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Digest authentication is intended for simple user identification on a trusted LAN where certificates and external identity providers are not available. It is disabled by default. The authenticated username is forwarded to TurboWarp handlers as the runtime-owned `x-turbowarp-http-auth-user` request header; an incoming client-supplied header with the same name is overwritten. The `/ws` endpoint is only accepted from localhost peers.
|
|
53
|
+
|
|
54
|
+
TurboWarp handlers can read authentication context with reporter blocks: `current auth type`, `current authenticated user`, `current auth provider`, `current auth profile JSON`, and `auth profile field [NAME]`. Digest authentication provides the username. OAuth-capable deployments can forward provider profile data as request auth context, and handlers can read fields such as `email`, `name`, or dotted paths like `organization.name`.
|
|
55
|
+
|
|
56
|
+
If a certificate and private key are already available, the server can run HTTPS directly:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
turbowarp-http-server \
|
|
60
|
+
--host 0.0.0.0 \
|
|
61
|
+
--port 8787 \
|
|
62
|
+
--tls-cert ./certs/server.crt \
|
|
63
|
+
--tls-key ./certs/server.key
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Certificate issuance, renewal, distribution, and OS/browser trust configuration are outside this package. For Internet-facing deployments, terminate TLS at a reverse proxy and use the Cloudflare/OAuth deployment path for authentication.
|
|
67
|
+
|
|
68
|
+
The server exposes:
|
|
69
|
+
|
|
70
|
+
| Route | Purpose |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `GET /health` | Health check |
|
|
73
|
+
| `GET /ws` | WebSocket endpoint used by the TurboWarp extension |
|
|
74
|
+
| `GET /@assets/<name>` | Serve a named Asset Manager resource when a resource capability is attached |
|
|
75
|
+
| `HEAD /@assets/<name>` | Return the same resource metadata without a body |
|
|
76
|
+
| `PUT /@assets/<name>` | Create or atomically replace a named resource when supported |
|
|
77
|
+
| `DELETE /@assets/<name>` | Remove a named resource when supported |
|
|
78
|
+
| `GET /@assets/` | Return resource metadata without embedding binary payloads when supported |
|
|
79
|
+
| Any other HTTP route | Temporary `503 not_connected` placeholder until HTTP forwarding is implemented |
|
|
80
|
+
|
|
81
|
+
Sprite routes are a separate TurboWarp-facing layer. A Sprite named `camera` can publish `/camera`, and hiding that Sprite can disable the route. Those Sprite handlers may serve HTML, JSON, redirects, or friendly aliases such as `/camera/image.jpg`; they should call into the Asset Manager capability instead of making `@assets` a child namespace of the Sprite.
|
|
82
|
+
|
|
83
|
+
### Learning-only community server
|
|
84
|
+
|
|
85
|
+
Issue #10 adds an optional Scratch-like project sharing app for local learning examples. It is disabled by default so the existing bridge and `@assets` routes keep their current behavior.
|
|
86
|
+
|
|
87
|
+
Enable it from the CLI:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
COMMUNITY=1 corepack pnpm start -- --host 127.0.0.1 --port 8787
|
|
91
|
+
# or
|
|
92
|
+
corepack pnpm start -- --host 127.0.0.1 --port 8787 --community
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
When enabled, the community app provides:
|
|
96
|
+
|
|
97
|
+
| Route | Purpose |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `GET /` | Project listing HTML and an upload form for logged-in users |
|
|
100
|
+
| `GET /signup` / `POST /signup` | Demo password registration |
|
|
101
|
+
| `GET /login` / `POST /login` | Demo password login |
|
|
102
|
+
| `POST /logout` | Session logout |
|
|
103
|
+
| `GET /auth/:provider/start` | Start a configured OAuth demo flow |
|
|
104
|
+
| `GET /auth/:provider/callback` | Complete the OAuth demo flow |
|
|
105
|
+
| `POST /projects` | Upload an SB3 project and optional thumbnail |
|
|
106
|
+
| `GET /projects/:id` | Project detail HTML |
|
|
107
|
+
| `GET /projects/:id.sb3` | SB3 download |
|
|
108
|
+
| `POST /projects/:id/remix` | Create a remix linked to the source project |
|
|
109
|
+
| `POST /projects/:id/update` | Owner-only metadata edit |
|
|
110
|
+
| `POST /projects/:id/replace` | Owner-only SB3 and thumbnail replacement |
|
|
111
|
+
| `POST /projects/:id/delete` | Owner-only project deletion |
|
|
112
|
+
|
|
113
|
+
The demo hashes passwords with Node's standard `crypto.scrypt`, stores sessions in an HTTP-only `SameSite=Lax` cookie, issues CSRF tokens for HTML form posts, enforces multipart body limits before form parsing, applies per-file SB3 and thumbnail size limits, checks MIME types and file signatures, and rejects owner-only changes from other users. OAuth providers are enabled only when environment variables are present:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
COMMUNITY_OAUTH_DEMO_CLIENT_ID=demo-client
|
|
117
|
+
COMMUNITY_OAUTH_DEMO_AUTHORIZATION_URL=https://example.test/oauth/authorize
|
|
118
|
+
COMMUNITY_OAUTH_DEMO_REDIRECT_URI=http://127.0.0.1:8787/auth/demo/callback
|
|
119
|
+
COMMUNITY_OAUTH_DEMO_SCOPE=profile
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This community server is a local educational implementation, not a public production service. Before exposing it on the internet, replace the in-memory storage with durable storage, add rate limiting and abuse moderation, use HTTPS with secure cookies, implement a complete OAuth token/userinfo exchange, add email or external identity verification as needed, scan uploads, add audit logging, and document backup, retention, takedown, and incident-response procedures.
|
|
123
|
+
|
|
124
|
+
### TurboWarp extension bundle
|
|
125
|
+
|
|
126
|
+
1. Download [`dist/turbowarp-http-server.js`](dist/turbowarp-http-server.js?raw=1).
|
|
127
|
+
2. Open **Extensions** in TurboWarp.
|
|
128
|
+
3. Choose **Custom Extension** and load the file.
|
|
129
|
+
|
|
130
|
+
The reviewed JavaScript build is committed to this repository, so users do not need Node.js to install the extension.
|
|
131
|
+
|
|
132
|
+
### npm package
|
|
133
|
+
|
|
134
|
+
Install an exact version that you have reviewed:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pnpm add --save-exact @kubohiroya/turbowarp-http-server@0.1.0
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Load the standalone bundle from:
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
node_modules/@kubohiroya/turbowarp-http-server/dist/turbowarp-http-server.js
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
A version-pinned CDN URL is:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-http-server@0.1.0/dist/turbowarp-http-server.js
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Quick start
|
|
153
|
+
|
|
154
|
+
1. Start the CLI bridge server.
|
|
155
|
+
2. Set the bridge URL in TurboWarp, for example `ws://127.0.0.1:8787/ws`.
|
|
156
|
+
3. Connect, send a text payload, and read the latest bridge message.
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
set HTTP bridge URL to [ws://127.0.0.1:8787/ws]
|
|
160
|
+
connect to HTTP bridge
|
|
161
|
+
send [{"type":"ping"}] to HTTP bridge
|
|
162
|
+
last HTTP bridge message
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Asset Manager Resource Serving
|
|
166
|
+
|
|
167
|
+
The HTTP server is camera-agnostic. It serves generic named resources supplied by an external capability, such as `turbowarp-asset-manager`, without reading private extension fields or duplicating Asset Manager storage.
|
|
168
|
+
|
|
169
|
+
The generic Asset Manager namespace is rooted at `/@assets/`. It is not owned by a Sprite route; it is managed by the background/server-side resource capability. Sprite routes can still expose friendly aliases, but the generic resource route stays global.
|
|
170
|
+
|
|
171
|
+
| Resource | HTTP route |
|
|
172
|
+
|---|---|
|
|
173
|
+
| Resource `live-camera` | `/@assets/live-camera` |
|
|
174
|
+
| Resource `logo` | `/@assets/logo` |
|
|
175
|
+
|
|
176
|
+
The resource capability boundary provides:
|
|
177
|
+
|
|
178
|
+
- logical resource name
|
|
179
|
+
- MIME type
|
|
180
|
+
- binary bytes for a consistent snapshot
|
|
181
|
+
- byte length when known
|
|
182
|
+
- replacement identity for ETag generation when available
|
|
183
|
+
- optional last-modified timestamp
|
|
184
|
+
- optional namespace publication policy
|
|
185
|
+
|
|
186
|
+
Resource responses include `Content-Type`, `Content-Length`, `ETag` when identity is available, `Last-Modified` when supplied, and `Cache-Control`. The default cache policy is `no-cache` when ETag or last-modified metadata is available, and `no-store` when no validation metadata exists. `HEAD` returns the same metadata as `GET` with no body.
|
|
187
|
+
|
|
188
|
+
`PUT` uses the request body bytes and `Content-Type` to create or replace a resource through the capability. The server enforces a configurable body-size limit before handing bytes to the capability, rejects unsupported MIME types when the capability reports them, and makes replacements visible atomically to subsequent requests. A `GET` already in progress receives the snapshot it started with.
|
|
189
|
+
|
|
190
|
+
The management namespace `/_tw-http/` is reserved and is not treated as an asset route. Paths such as `/camera/@assets/live-camera` are not generic Asset Manager routes; use a Scratch/TurboWarp handler to alias friendly Sprite URLs to `/@assets/<name>` when needed. Resource authorization hooks, when configured, are applied to `GET`, `HEAD`, `PUT`, `DELETE`, and listing requests. Structured resource logs include metadata such as route, resource name, MIME type, byte count, and status; they do not include binary request or response bodies.
|
|
191
|
+
|
|
192
|
+
## Sprite Route Model
|
|
193
|
+
|
|
194
|
+
TurboWarp-facing routes should map naturally to visible project objects:
|
|
195
|
+
|
|
196
|
+
| TurboWarp object | Public route |
|
|
197
|
+
|---|---|
|
|
198
|
+
| Stage/background script | `/` |
|
|
199
|
+
| Sprite `camera` while visible | `/camera` |
|
|
200
|
+
| Sprite `camera` while hidden | route disabled |
|
|
201
|
+
|
|
202
|
+
This keeps Scratch interaction tangible: showing a Sprite publishes its route, and hiding it withdraws that route. Asset Manager resources remain global at `/@assets/<name>` so the same resource can be reused by multiple Sprite routes without duplicating storage.
|
|
203
|
+
|
|
204
|
+
A live camera page can therefore be modeled as:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
Sprite: camera
|
|
208
|
+
visible -> /camera is enabled
|
|
209
|
+
hidden -> /camera is disabled
|
|
210
|
+
|
|
211
|
+
GET /camera
|
|
212
|
+
-> returns an HTML page built by the Sprite handler
|
|
213
|
+
|
|
214
|
+
GET /camera/image.jpg
|
|
215
|
+
-> friendly handler/alias that serves /@assets/live-camera
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
In other words, `/camera/image.jpg` is a Sprite route decision, while `/@assets/live-camera` is the generic Asset Manager resource endpoint.
|
|
219
|
+
|
|
220
|
+
## Response Content Builders
|
|
221
|
+
|
|
222
|
+
The extension includes small builder-style blocks for response body construction. They are intentionally local to this package and do not introduce runtime dependencies on `turbowarp-html` or `turbowarp-markdown`.
|
|
223
|
+
|
|
224
|
+
Markdown builders return opaque handles such as `md:1`, allowing block chains to append content and render the final Markdown text:
|
|
225
|
+
|
|
226
|
+
```text
|
|
227
|
+
new markdown document
|
|
228
|
+
markdown [md:1] with heading level [1] [Status]
|
|
229
|
+
markdown [md:1] with paragraph [OK]
|
|
230
|
+
render markdown [md:1]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
HTML builders use opaque handles such as `html:1`. Text and attributes are escaped, event-handler attributes such as `onclick` are ignored, URL attributes only accept conservative safe schemes, and unknown tags fall back to `div`.
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
new HTML element [section]
|
|
237
|
+
HTML text [Live camera]
|
|
238
|
+
HTML [section] with child [text]
|
|
239
|
+
render HTML document title [Camera] body [section]
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
For server diagnostics, `HTTP log viewer HTML` returns a self-contained HTML document with a virtual-scroll log viewport. Scripts can append structured log JSON with `record HTTP log [ENTRY]`, clear it with `clear HTTP logs`, or render a viewer from an explicit JSON array with `HTTP log viewer HTML from [LOGS]`.
|
|
243
|
+
|
|
244
|
+
## Request Protocol And Blocks
|
|
245
|
+
|
|
246
|
+
For ordinary HTTP routes that are not handled by `/@assets`, the CLI server forwards the request to the connected TurboWarp extension over WebSocket. Each forwarded request receives a unique request ID and an isolated context.
|
|
247
|
+
|
|
248
|
+
Protocol v1 request messages preserve multi-valued query parameters and headers:
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"type": "request",
|
|
253
|
+
"protocol": "turbowarp-http-server",
|
|
254
|
+
"version": 1,
|
|
255
|
+
"id": "req-1",
|
|
256
|
+
"method": "GET",
|
|
257
|
+
"url": "http://127.0.0.1:8787/users/42?tag=a&tag=b",
|
|
258
|
+
"path": "/users/42",
|
|
259
|
+
"route": "/users/:id",
|
|
260
|
+
"pathParams": {"id": "42"},
|
|
261
|
+
"query": {"tag": ["a", "b"]},
|
|
262
|
+
"headers": {"accept": ["text/html"]},
|
|
263
|
+
"body": {"kind": "empty"},
|
|
264
|
+
"clientAddress": ""
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
TurboWarp blocks can read the selected current request:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
current HTTP method
|
|
272
|
+
current request path
|
|
273
|
+
current request URL
|
|
274
|
+
request header [name]
|
|
275
|
+
query parameter [name]
|
|
276
|
+
path parameter [name]
|
|
277
|
+
current request body
|
|
278
|
+
current request content type
|
|
279
|
+
current request ID
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The simple query/header reporters return the first value. The protocol keeps all values so future list-oriented blocks can expose repeated headers or query parameters without changing the wire format.
|
|
283
|
+
|
|
284
|
+
Response blocks mutate the response builder for the current request and complete it with a response message:
|
|
285
|
+
|
|
286
|
+
```text
|
|
287
|
+
set HTTP status [200]
|
|
288
|
+
set response header [name] to [value]
|
|
289
|
+
remove response header [name]
|
|
290
|
+
set response body [body]
|
|
291
|
+
send response [body]
|
|
292
|
+
respond with text [body]
|
|
293
|
+
respond with HTML [body]
|
|
294
|
+
respond with JSON [body]
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Response status defaults to `200`. Status values outside `100` through `599`, unsafe response headers, CR/LF header injection values, and runtime-owned headers such as `Content-Length` are ignored or rejected before they can reach Node's HTTP response API. The server suppresses response bodies for `HEAD`, `204`, `205`, and `304` responses.
|
|
298
|
+
|
|
299
|
+
If no bridge is connected, ordinary HTTP routes return `503`. If a connected bridge does not respond before the configured timeout, the server returns `504`. If the WebSocket disconnects with requests pending, they return `502`.
|
|
300
|
+
|
|
301
|
+
## Live-Camera Pattern
|
|
302
|
+
|
|
303
|
+
For low-frequency camera publishing, compose three independent pieces:
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
TurboWarp Camera Source
|
|
307
|
+
-> capture current frame every 10 seconds
|
|
308
|
+
-> replace Asset Manager resource "live-camera"
|
|
309
|
+
-> HTTP Server serves /@assets/live-camera
|
|
310
|
+
-> browser loads the stable URL
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The HTTP server does not depend on `turbowarp-camera-source` or `turbowarp-html`. Camera Source only produces snapshots; Asset Manager owns the named resource; HTTP Server serves the generic resource URL.
|
|
314
|
+
|
|
315
|
+
Example block-level flow:
|
|
316
|
+
|
|
317
|
+
```text
|
|
318
|
+
forever
|
|
319
|
+
capture current camera frame
|
|
320
|
+
replace asset [live-camera] with captured JPEG bytes
|
|
321
|
+
wait 10 seconds
|
|
322
|
+
end
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
External consumers can use the stable URL:
|
|
326
|
+
|
|
327
|
+
```text
|
|
328
|
+
/@assets/live-camera
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
If a friendlier URL is desired, a Scratch/TurboWarp route handler can alias:
|
|
332
|
+
|
|
333
|
+
```text
|
|
334
|
+
/camera/image.jpg -> /@assets/live-camera
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
An HTML page generated by `turbowarp-html` can refresh an `<img>` every 10 seconds, but cache correctness should come from HTTP validation headers, not timestamp query strings. With replacement identities from Asset Manager, clients can revalidate the stable URL using ETag and receive the newest snapshot without stale browser cache behavior.
|
|
338
|
+
|
|
339
|
+
## Block reference
|
|
340
|
+
|
|
341
|
+
The block reference is generated from [`src/block-definitions.json`](src/block-definitions.json). Do not edit the generated section manually.
|
|
342
|
+
|
|
343
|
+
<!-- BEGIN GENERATED BLOCKS -->
|
|
344
|
+
|
|
345
|
+
### `set HTTP bridge URL to [URL]`
|
|
346
|
+
|
|
347
|
+
Sets the WebSocket URL used to reach the HTTP bridge server.
|
|
348
|
+
|
|
349
|
+
| Property | Value |
|
|
350
|
+
|---|---|
|
|
351
|
+
| Type | Command |
|
|
352
|
+
| Opcode | `setServerUrl` |
|
|
353
|
+
| `URL` | String, default: `ws://127.0.0.1:8787/ws` |
|
|
354
|
+
|
|
355
|
+
### `connect to HTTP bridge`
|
|
356
|
+
|
|
357
|
+
Opens a WebSocket connection to the configured HTTP bridge server.
|
|
358
|
+
|
|
359
|
+
| Property | Value |
|
|
360
|
+
|---|---|
|
|
361
|
+
| Type | Command |
|
|
362
|
+
| Opcode | `connect` |
|
|
363
|
+
|
|
364
|
+
### `disconnect from HTTP bridge`
|
|
365
|
+
|
|
366
|
+
Closes the current bridge connection.
|
|
367
|
+
|
|
368
|
+
| Property | Value |
|
|
369
|
+
|---|---|
|
|
370
|
+
| Type | Command |
|
|
371
|
+
| Opcode | `disconnect` |
|
|
372
|
+
|
|
373
|
+
### `HTTP bridge connected?`
|
|
374
|
+
|
|
375
|
+
Reports whether the bridge WebSocket is currently open.
|
|
376
|
+
|
|
377
|
+
| Property | Value |
|
|
378
|
+
|---|---|
|
|
379
|
+
| Type | Boolean |
|
|
380
|
+
| Opcode | `isConnected` |
|
|
381
|
+
|
|
382
|
+
### `send [MESSAGE] to HTTP bridge`
|
|
383
|
+
|
|
384
|
+
Sends a text message to the connected HTTP bridge server.
|
|
385
|
+
|
|
386
|
+
| Property | Value |
|
|
387
|
+
|---|---|
|
|
388
|
+
| Type | Command |
|
|
389
|
+
| Opcode | `sendText` |
|
|
390
|
+
| `MESSAGE` | String, default: `{"type":"ping"}` |
|
|
391
|
+
|
|
392
|
+
### `last HTTP bridge message`
|
|
393
|
+
|
|
394
|
+
Returns the most recent text message received from the bridge.
|
|
395
|
+
|
|
396
|
+
| Property | Value |
|
|
397
|
+
|---|---|
|
|
398
|
+
| Type | Reporter |
|
|
399
|
+
| Opcode | `lastMessage` |
|
|
400
|
+
|
|
401
|
+
### `when HTTP request received`
|
|
402
|
+
|
|
403
|
+
Starts a TurboWarp handler thread when the bridge receives an HTTP request.
|
|
404
|
+
|
|
405
|
+
| Property | Value |
|
|
406
|
+
|---|---|
|
|
407
|
+
| Type | Hat |
|
|
408
|
+
| Opcode | `whenHttpRequestReceived` |
|
|
409
|
+
|
|
410
|
+
### `use HTTP request [ID]`
|
|
411
|
+
|
|
412
|
+
Selects a pending request context by request ID.
|
|
413
|
+
|
|
414
|
+
| Property | Value |
|
|
415
|
+
|---|---|
|
|
416
|
+
| Type | Command |
|
|
417
|
+
| Opcode | `useHttpRequest` |
|
|
418
|
+
| `ID` | String, default: `req-1` |
|
|
419
|
+
|
|
420
|
+
### `current request ID`
|
|
421
|
+
|
|
422
|
+
Returns the current HTTP request ID.
|
|
423
|
+
|
|
424
|
+
| Property | Value |
|
|
425
|
+
|---|---|
|
|
426
|
+
| Type | Reporter |
|
|
427
|
+
| Opcode | `currentRequestId` |
|
|
428
|
+
|
|
429
|
+
### `current HTTP method`
|
|
430
|
+
|
|
431
|
+
Returns the current HTTP request method.
|
|
432
|
+
|
|
433
|
+
| Property | Value |
|
|
434
|
+
|---|---|
|
|
435
|
+
| Type | Reporter |
|
|
436
|
+
| Opcode | `currentHttpMethod` |
|
|
437
|
+
|
|
438
|
+
### `current request path`
|
|
439
|
+
|
|
440
|
+
Returns the current HTTP request path.
|
|
441
|
+
|
|
442
|
+
| Property | Value |
|
|
443
|
+
|---|---|
|
|
444
|
+
| Type | Reporter |
|
|
445
|
+
| Opcode | `currentRequestPath` |
|
|
446
|
+
|
|
447
|
+
### `current request URL`
|
|
448
|
+
|
|
449
|
+
Returns the current HTTP request URL.
|
|
450
|
+
|
|
451
|
+
| Property | Value |
|
|
452
|
+
|---|---|
|
|
453
|
+
| Type | Reporter |
|
|
454
|
+
| Opcode | `currentRequestUrl` |
|
|
455
|
+
|
|
456
|
+
### `request header [NAME]`
|
|
457
|
+
|
|
458
|
+
Returns the first value of a request header using case-insensitive lookup.
|
|
459
|
+
|
|
460
|
+
| Property | Value |
|
|
461
|
+
|---|---|
|
|
462
|
+
| Type | Reporter |
|
|
463
|
+
| Opcode | `requestHeader` |
|
|
464
|
+
| `NAME` | String, default: `accept` |
|
|
465
|
+
|
|
466
|
+
### `query parameter [NAME]`
|
|
467
|
+
|
|
468
|
+
Returns the first query parameter value.
|
|
469
|
+
|
|
470
|
+
| Property | Value |
|
|
471
|
+
|---|---|
|
|
472
|
+
| Type | Reporter |
|
|
473
|
+
| Opcode | `queryParameter` |
|
|
474
|
+
| `NAME` | String, default: `q` |
|
|
475
|
+
|
|
476
|
+
### `path parameter [NAME]`
|
|
477
|
+
|
|
478
|
+
Returns a route path parameter value.
|
|
479
|
+
|
|
480
|
+
| Property | Value |
|
|
481
|
+
|---|---|
|
|
482
|
+
| Type | Reporter |
|
|
483
|
+
| Opcode | `pathParameter` |
|
|
484
|
+
| `NAME` | String, default: `id` |
|
|
485
|
+
|
|
486
|
+
### `current request body`
|
|
487
|
+
|
|
488
|
+
Returns the current textual request body, or an empty string for non-text bodies.
|
|
489
|
+
|
|
490
|
+
| Property | Value |
|
|
491
|
+
|---|---|
|
|
492
|
+
| Type | Reporter |
|
|
493
|
+
| Opcode | `currentRequestBody` |
|
|
494
|
+
|
|
495
|
+
### `current request content type`
|
|
496
|
+
|
|
497
|
+
Returns the current request Content-Type header.
|
|
498
|
+
|
|
499
|
+
| Property | Value |
|
|
500
|
+
|---|---|
|
|
501
|
+
| Type | Reporter |
|
|
502
|
+
| Opcode | `currentRequestContentType` |
|
|
503
|
+
|
|
504
|
+
### `current request client address`
|
|
505
|
+
|
|
506
|
+
Returns the current request client address when available.
|
|
507
|
+
|
|
508
|
+
| Property | Value |
|
|
509
|
+
|---|---|
|
|
510
|
+
| Type | Reporter |
|
|
511
|
+
| Opcode | `currentRequestClientAddress` |
|
|
512
|
+
|
|
513
|
+
### `current auth type`
|
|
514
|
+
|
|
515
|
+
Returns the current authentication type, such as digest or oauth.
|
|
516
|
+
|
|
517
|
+
| Property | Value |
|
|
518
|
+
|---|---|
|
|
519
|
+
| Type | Reporter |
|
|
520
|
+
| Opcode | `currentAuthType` |
|
|
521
|
+
|
|
522
|
+
### `current authenticated user`
|
|
523
|
+
|
|
524
|
+
Returns the authenticated username or a stable user-like profile field when available.
|
|
525
|
+
|
|
526
|
+
| Property | Value |
|
|
527
|
+
|---|---|
|
|
528
|
+
| Type | Reporter |
|
|
529
|
+
| Opcode | `currentAuthenticatedUser` |
|
|
530
|
+
|
|
531
|
+
### `current auth provider`
|
|
532
|
+
|
|
533
|
+
Returns the authentication provider name when available.
|
|
534
|
+
|
|
535
|
+
| Property | Value |
|
|
536
|
+
|---|---|
|
|
537
|
+
| Type | Reporter |
|
|
538
|
+
| Opcode | `currentAuthProvider` |
|
|
539
|
+
|
|
540
|
+
### `current auth profile JSON`
|
|
541
|
+
|
|
542
|
+
Returns the provider profile object as JSON when available.
|
|
543
|
+
|
|
544
|
+
| Property | Value |
|
|
545
|
+
|---|---|
|
|
546
|
+
| Type | Reporter |
|
|
547
|
+
| Opcode | `currentAuthProfileJson` |
|
|
548
|
+
|
|
549
|
+
### `auth profile field [NAME]`
|
|
550
|
+
|
|
551
|
+
Returns a top-level or dotted field from the provider profile object.
|
|
552
|
+
|
|
553
|
+
| Property | Value |
|
|
554
|
+
|---|---|
|
|
555
|
+
| Type | Reporter |
|
|
556
|
+
| Opcode | `authProfileField` |
|
|
557
|
+
| `NAME` | String, default: `email` |
|
|
558
|
+
|
|
559
|
+
### `current response status`
|
|
560
|
+
|
|
561
|
+
Returns the response status currently being built.
|
|
562
|
+
|
|
563
|
+
| Property | Value |
|
|
564
|
+
|---|---|
|
|
565
|
+
| Type | Reporter |
|
|
566
|
+
| Opcode | `currentResponseStatus` |
|
|
567
|
+
|
|
568
|
+
### `set HTTP status [STATUS]`
|
|
569
|
+
|
|
570
|
+
Sets the current response status.
|
|
571
|
+
|
|
572
|
+
| Property | Value |
|
|
573
|
+
|---|---|
|
|
574
|
+
| Type | Command |
|
|
575
|
+
| Opcode | `setHttpStatus` |
|
|
576
|
+
| `STATUS` | Number, default: `200` |
|
|
577
|
+
|
|
578
|
+
### `set response header [NAME] to [VALUE]`
|
|
579
|
+
|
|
580
|
+
Sets a response header for the current request.
|
|
581
|
+
|
|
582
|
+
| Property | Value |
|
|
583
|
+
|---|---|
|
|
584
|
+
| Type | Command |
|
|
585
|
+
| Opcode | `setResponseHeader` |
|
|
586
|
+
| `NAME` | String, default: `content-type` |
|
|
587
|
+
| `VALUE` | String, default: `text/plain; charset=utf-8` |
|
|
588
|
+
|
|
589
|
+
### `remove response header [NAME]`
|
|
590
|
+
|
|
591
|
+
Removes a response header for the current request.
|
|
592
|
+
|
|
593
|
+
| Property | Value |
|
|
594
|
+
|---|---|
|
|
595
|
+
| Type | Command |
|
|
596
|
+
| Opcode | `removeResponseHeader` |
|
|
597
|
+
| `NAME` | String, default: `content-type` |
|
|
598
|
+
|
|
599
|
+
### `response header [NAME]`
|
|
600
|
+
|
|
601
|
+
Returns the first configured response header value.
|
|
602
|
+
|
|
603
|
+
| Property | Value |
|
|
604
|
+
|---|---|
|
|
605
|
+
| Type | Reporter |
|
|
606
|
+
| Opcode | `responseHeader` |
|
|
607
|
+
| `NAME` | String, default: `content-type` |
|
|
608
|
+
|
|
609
|
+
### `set response body [BODY]`
|
|
610
|
+
|
|
611
|
+
Sets the current response body without completing the response.
|
|
612
|
+
|
|
613
|
+
| Property | Value |
|
|
614
|
+
|---|---|
|
|
615
|
+
| Type | Command |
|
|
616
|
+
| Opcode | `setResponseBody` |
|
|
617
|
+
| `BODY` | String, default: `Hello` |
|
|
618
|
+
|
|
619
|
+
### `send response [BODY]`
|
|
620
|
+
|
|
621
|
+
Sets the response body and completes the current request.
|
|
622
|
+
|
|
623
|
+
| Property | Value |
|
|
624
|
+
|---|---|
|
|
625
|
+
| Type | Command |
|
|
626
|
+
| Opcode | `sendResponse` |
|
|
627
|
+
| `BODY` | String, default: `Hello` |
|
|
628
|
+
|
|
629
|
+
### `respond with text [BODY]`
|
|
630
|
+
|
|
631
|
+
Responds with plain text.
|
|
632
|
+
|
|
633
|
+
| Property | Value |
|
|
634
|
+
|---|---|
|
|
635
|
+
| Type | Command |
|
|
636
|
+
| Opcode | `respondWithText` |
|
|
637
|
+
| `BODY` | String, default: `Hello` |
|
|
638
|
+
|
|
639
|
+
### `respond with HTML [BODY]`
|
|
640
|
+
|
|
641
|
+
Responds with HTML.
|
|
642
|
+
|
|
643
|
+
| Property | Value |
|
|
644
|
+
|---|---|
|
|
645
|
+
| Type | Command |
|
|
646
|
+
| Opcode | `respondWithHtml` |
|
|
647
|
+
| `BODY` | String, default: `<p>Hello</p>` |
|
|
648
|
+
|
|
649
|
+
### `respond with JSON [BODY]`
|
|
650
|
+
|
|
651
|
+
Responds with JSON.
|
|
652
|
+
|
|
653
|
+
| Property | Value |
|
|
654
|
+
|---|---|
|
|
655
|
+
| Type | Command |
|
|
656
|
+
| Opcode | `respondWithJson` |
|
|
657
|
+
| `BODY` | String, default: `{"ok":true}` |
|
|
658
|
+
|
|
659
|
+
### `record HTTP log [ENTRY]`
|
|
660
|
+
|
|
661
|
+
Adds a structured HTTP log entry JSON string to the extension log buffer.
|
|
662
|
+
|
|
663
|
+
| Property | Value |
|
|
664
|
+
|---|---|
|
|
665
|
+
| Type | Command |
|
|
666
|
+
| Opcode | `recordHttpLog` |
|
|
667
|
+
| `ENTRY` | String, default: `{"method":"GET","path":"/","status":200}` |
|
|
668
|
+
|
|
669
|
+
### `clear HTTP logs`
|
|
670
|
+
|
|
671
|
+
Clears the extension log buffer.
|
|
672
|
+
|
|
673
|
+
| Property | Value |
|
|
674
|
+
|---|---|
|
|
675
|
+
| Type | Command |
|
|
676
|
+
| Opcode | `clearHttpLogs` |
|
|
677
|
+
|
|
678
|
+
### `HTTP log viewer HTML`
|
|
679
|
+
|
|
680
|
+
Returns a self-contained virtual-scroll HTML log viewer for buffered HTTP logs.
|
|
681
|
+
|
|
682
|
+
| Property | Value |
|
|
683
|
+
|---|---|
|
|
684
|
+
| Type | Reporter |
|
|
685
|
+
| Opcode | `httpLogViewerHtml` |
|
|
686
|
+
|
|
687
|
+
### `HTTP log viewer HTML from [LOGS]`
|
|
688
|
+
|
|
689
|
+
Returns a self-contained virtual-scroll HTML log viewer from a JSON array of log entries.
|
|
690
|
+
|
|
691
|
+
| Property | Value |
|
|
692
|
+
|---|---|
|
|
693
|
+
| Type | Reporter |
|
|
694
|
+
| Opcode | `httpLogViewerHtmlFromJson` |
|
|
695
|
+
| `LOGS` | String, default: `[{"method":"GET","path":"/","status":200}]` |
|
|
696
|
+
|
|
697
|
+
### `new markdown document`
|
|
698
|
+
|
|
699
|
+
Creates an empty Markdown builder handle.
|
|
700
|
+
|
|
701
|
+
| Property | Value |
|
|
702
|
+
|---|---|
|
|
703
|
+
| Type | Reporter |
|
|
704
|
+
| Opcode | `newMarkdownDocument` |
|
|
705
|
+
|
|
706
|
+
### `markdown [DOC] with heading level [LEVEL] [TEXT]`
|
|
707
|
+
|
|
708
|
+
Appends a Markdown heading and returns the same builder handle.
|
|
709
|
+
|
|
710
|
+
| Property | Value |
|
|
711
|
+
|---|---|
|
|
712
|
+
| Type | Reporter |
|
|
713
|
+
| Opcode | `markdownHeading` |
|
|
714
|
+
| `DOC` | String, default: `md:1` |
|
|
715
|
+
| `LEVEL` | Number, default: `1` |
|
|
716
|
+
| `TEXT` | String, default: `Title` |
|
|
717
|
+
|
|
718
|
+
### `markdown [DOC] with paragraph [TEXT]`
|
|
719
|
+
|
|
720
|
+
Appends a Markdown paragraph and returns the same builder handle.
|
|
721
|
+
|
|
722
|
+
| Property | Value |
|
|
723
|
+
|---|---|
|
|
724
|
+
| Type | Reporter |
|
|
725
|
+
| Opcode | `markdownParagraph` |
|
|
726
|
+
| `DOC` | String, default: `md:1` |
|
|
727
|
+
| `TEXT` | String, default: `Hello` |
|
|
728
|
+
|
|
729
|
+
### `markdown [DOC] with bullet [TEXT]`
|
|
730
|
+
|
|
731
|
+
Appends a Markdown bullet and returns the same builder handle.
|
|
732
|
+
|
|
733
|
+
| Property | Value |
|
|
734
|
+
|---|---|
|
|
735
|
+
| Type | Reporter |
|
|
736
|
+
| Opcode | `markdownBullet` |
|
|
737
|
+
| `DOC` | String, default: `md:1` |
|
|
738
|
+
| `TEXT` | String, default: `Item` |
|
|
739
|
+
|
|
740
|
+
### `markdown [DOC] with code [CODE] language [LANG]`
|
|
741
|
+
|
|
742
|
+
Appends a fenced Markdown code block and returns the same builder handle.
|
|
743
|
+
|
|
744
|
+
| Property | Value |
|
|
745
|
+
|---|---|
|
|
746
|
+
| Type | Reporter |
|
|
747
|
+
| Opcode | `markdownCodeBlock` |
|
|
748
|
+
| `DOC` | String, default: `md:1` |
|
|
749
|
+
| `CODE` | String, default: `console.log('hello')` |
|
|
750
|
+
| `LANG` | String, default: `js` |
|
|
751
|
+
|
|
752
|
+
### `render markdown [DOC]`
|
|
753
|
+
|
|
754
|
+
Renders a Markdown builder handle to Markdown text.
|
|
755
|
+
|
|
756
|
+
| Property | Value |
|
|
757
|
+
|---|---|
|
|
758
|
+
| Type | Reporter |
|
|
759
|
+
| Opcode | `renderMarkdown` |
|
|
760
|
+
| `DOC` | String, default: `md:1` |
|
|
761
|
+
|
|
762
|
+
### `new HTML element [TAG]`
|
|
763
|
+
|
|
764
|
+
Creates an HTML element builder handle.
|
|
765
|
+
|
|
766
|
+
| Property | Value |
|
|
767
|
+
|---|---|
|
|
768
|
+
| Type | Reporter |
|
|
769
|
+
| Opcode | `newHtmlElement` |
|
|
770
|
+
| `TAG` | String, default: `div` |
|
|
771
|
+
|
|
772
|
+
### `HTML text [TEXT]`
|
|
773
|
+
|
|
774
|
+
Creates an escaped HTML text node handle.
|
|
775
|
+
|
|
776
|
+
| Property | Value |
|
|
777
|
+
|---|---|
|
|
778
|
+
| Type | Reporter |
|
|
779
|
+
| Opcode | `htmlText` |
|
|
780
|
+
| `TEXT` | String, default: `Hello` |
|
|
781
|
+
|
|
782
|
+
### `HTML [NODE] with attribute [NAME] [VALUE]`
|
|
783
|
+
|
|
784
|
+
Sets an escaped attribute on an HTML element and returns the same handle.
|
|
785
|
+
|
|
786
|
+
| Property | Value |
|
|
787
|
+
|---|---|
|
|
788
|
+
| Type | Reporter |
|
|
789
|
+
| Opcode | `htmlSetAttribute` |
|
|
790
|
+
| `NODE` | String, default: `html:1` |
|
|
791
|
+
| `NAME` | String, default: `class` |
|
|
792
|
+
| `VALUE` | String, default: `content` |
|
|
793
|
+
|
|
794
|
+
### `HTML [PARENT] with child [CHILD]`
|
|
795
|
+
|
|
796
|
+
Appends a child node to an HTML element and returns the parent handle.
|
|
797
|
+
|
|
798
|
+
| Property | Value |
|
|
799
|
+
|---|---|
|
|
800
|
+
| Type | Reporter |
|
|
801
|
+
| Opcode | `htmlAppendChild` |
|
|
802
|
+
| `PARENT` | String, default: `html:1` |
|
|
803
|
+
| `CHILD` | String, default: `html:2` |
|
|
804
|
+
|
|
805
|
+
### `render HTML [NODE]`
|
|
806
|
+
|
|
807
|
+
Renders an HTML node handle to an HTML fragment.
|
|
808
|
+
|
|
809
|
+
| Property | Value |
|
|
810
|
+
|---|---|
|
|
811
|
+
| Type | Reporter |
|
|
812
|
+
| Opcode | `renderHtml` |
|
|
813
|
+
| `NODE` | String, default: `html:1` |
|
|
814
|
+
|
|
815
|
+
### `render HTML document title [TITLE] body [BODY]`
|
|
816
|
+
|
|
817
|
+
Renders a full HTML document from an HTML body node handle.
|
|
818
|
+
|
|
819
|
+
| Property | Value |
|
|
820
|
+
|---|---|
|
|
821
|
+
| Type | Reporter |
|
|
822
|
+
| Opcode | `renderHtmlDocument` |
|
|
823
|
+
| `TITLE` | String, default: `Page` |
|
|
824
|
+
| `BODY` | String, default: `html:1` |
|
|
825
|
+
|
|
826
|
+
<!-- END GENERATED BLOCKS -->
|
|
827
|
+
|
|
828
|
+
## Important behavior
|
|
829
|
+
|
|
830
|
+
| Situation | Behavior |
|
|
831
|
+
|---|---|
|
|
832
|
+
| Empty bridge URL | Falls back to `ws://127.0.0.1:8787/ws`. |
|
|
833
|
+
| CLI `--host` omitted | Uses `HOST`, or `127.0.0.1` when unset. |
|
|
834
|
+
| CLI `--port` omitted | Uses `PORT`, or `8787` when unset. |
|
|
835
|
+
| Already connected | The connect block leaves the current open connection in place. |
|
|
836
|
+
| Sending while disconnected | The message is ignored. |
|
|
837
|
+
| Bridge close or error | The extension clears its active connection state. |
|
|
838
|
+
| Project stop or reload | TurboWarp unloads the extension runtime and any browser-owned WebSocket is closed by the page lifecycle. |
|
|
839
|
+
|
|
840
|
+
## Compatibility
|
|
841
|
+
|
|
842
|
+
| Identifier | Value | Stability |
|
|
843
|
+
|---|---|---|
|
|
844
|
+
| Product name | `TurboWarp-HTTP-Server` | Human-facing |
|
|
845
|
+
| Repository | `kubohiroya/turbowarp-http-server` | Current source location |
|
|
846
|
+
| npm package | `@kubohiroya/turbowarp-http-server` | Public package contract |
|
|
847
|
+
| CLI bin | `turbowarp-http-server` | Starts the bridge server |
|
|
848
|
+
| Extension ID | `kubohiroyaturbowarphttpserver` | Stored in SB3; migration required to change |
|
|
849
|
+
|
|
850
|
+
## Development
|
|
851
|
+
|
|
852
|
+
Use Node.js 22 or newer and the pnpm version declared by `packageManager`.
|
|
853
|
+
|
|
854
|
+
```bash
|
|
855
|
+
corepack enable
|
|
856
|
+
pnpm install --frozen-lockfile
|
|
857
|
+
pnpm check
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
Useful commands:
|
|
861
|
+
|
|
862
|
+
| Command | Purpose |
|
|
863
|
+
|---|---|
|
|
864
|
+
| `pnpm dev` | Rebuild the TurboWarp extension bundle while source files change |
|
|
865
|
+
| `pnpm run dev:server` | Run the CLI bridge server in watch mode |
|
|
866
|
+
| `pnpm start` | Start the built CLI bridge server |
|
|
867
|
+
| `pnpm run test` | Run tests |
|
|
868
|
+
| `pnpm run docs` | Regenerate block documentation |
|
|
869
|
+
| `pnpm run check:dist` | Verify committed build artifacts |
|
|
870
|
+
| `pnpm run pack:check` | Inspect the npm package |
|
|
871
|
+
|
|
872
|
+
## License
|
|
873
|
+
|
|
874
|
+
[Mozilla Public License 2.0](LICENSE) (SPDX: `MPL-2.0`).
|