toiljs 0.0.140 → 0.0.141

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.
@@ -0,0 +1,83 @@
1
+ function colorSequenceEnd(message, start) {
2
+ if (message.charCodeAt(start + 1) !== 0x5b)
3
+ return -1;
4
+ const limit = Math.min(message.length, start + 64);
5
+ const params = [];
6
+ let cursor = start + 2;
7
+ while (cursor < limit) {
8
+ let value = 0;
9
+ let digits = 0;
10
+ while (cursor < limit) {
11
+ const code = message.charCodeAt(cursor);
12
+ if (code < 0x30 || code > 0x39)
13
+ break;
14
+ if (++digits > 3)
15
+ return -1;
16
+ value = value * 10 + code - 0x30;
17
+ cursor++;
18
+ }
19
+ if (digits === 0 || params.length === 16)
20
+ return -1;
21
+ params.push(value);
22
+ const next = message.charCodeAt(cursor++);
23
+ if (next === 0x3b)
24
+ continue;
25
+ if (next !== 0x6d || cursor > limit)
26
+ return -1;
27
+ for (let i = 0; i < params.length; i++) {
28
+ const code = params[i];
29
+ if (code === 0 ||
30
+ (code >= 30 && code <= 37) ||
31
+ code === 39 ||
32
+ (code >= 40 && code <= 47) ||
33
+ code === 49 ||
34
+ (code >= 90 && code <= 97) ||
35
+ (code >= 100 && code <= 107))
36
+ continue;
37
+ if (code !== 38 && code !== 48)
38
+ return -1;
39
+ const mode = params[++i];
40
+ const components = mode === 5 ? 1 : mode === 2 ? 3 : 0;
41
+ if (components === 0)
42
+ return -1;
43
+ for (let j = 0; j < components; j++) {
44
+ const component = params[++i];
45
+ if (component === undefined || component > 255)
46
+ return -1;
47
+ }
48
+ }
49
+ return cursor;
50
+ }
51
+ return -1;
52
+ }
53
+ export function sanitizeServerLog(message) {
54
+ const parts = [];
55
+ let colored = false;
56
+ for (let i = 0; i < message.length; i++) {
57
+ const code = message.charCodeAt(i);
58
+ if (code === 0x1b) {
59
+ const end = colorSequenceEnd(message, i);
60
+ if (end !== -1) {
61
+ parts.push(message.slice(i, end));
62
+ colored = true;
63
+ i = end - 1;
64
+ continue;
65
+ }
66
+ }
67
+ if (code < 0x20 || (code >= 0x7f && code <= 0x9f)) {
68
+ parts.push('\\x' + code.toString(16).padStart(2, '0'));
69
+ }
70
+ else if (code === 0x061c ||
71
+ code === 0x200e ||
72
+ code === 0x200f ||
73
+ (code >= 0x2028 && code <= 0x202e) ||
74
+ (code >= 0x2066 && code <= 0x2069)) {
75
+ parts.push('\\u' + code.toString(16).padStart(4, '0'));
76
+ }
77
+ else {
78
+ parts.push(message[i]);
79
+ }
80
+ }
81
+ const safe = parts.join('');
82
+ return colored && !safe.endsWith('\u001b[0m') ? safe + '\u001b[0m' : safe;
83
+ }
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import { Server } from '@dacely/hyper-express';
4
4
  import pc from 'picocolors';
5
5
  import { installSecurityHeaders } from 'toiljs/backend';
6
- import { startDaemonRuntime } from './daemon/runtime.js';
6
+ import { startDaemonWorker } from './daemon/runtime.js';
7
7
  import { configureDbPersistence } from './db/index.js';
8
8
  import { initEmailService } from './email/index.js';
9
9
  import { proxyToVite, wireWebsocketProxy } from './http/proxy.js';
@@ -63,8 +63,9 @@ export async function startDevServer(options) {
63
63
  wireWebsocketProxy(app, options.vite);
64
64
  }
65
65
  const blobs = await startDevBlobStorage(root);
66
- const daemon = startDaemonRuntime({
66
+ const daemon = startDaemonWorker({
67
67
  coldWasmFile: options.coldWasmFile,
68
+ hotWasmFile: options.wasmFile,
68
69
  nodeMode,
69
70
  daemon: options.daemon,
70
71
  logging: options.logging ?? true,
@@ -109,7 +110,7 @@ export async function startDevServer(options) {
109
110
  await app.listen(options.port, host);
110
111
  }
111
112
  catch (error) {
112
- daemon?.close();
113
+ await daemon?.close();
113
114
  await blobs?.close();
114
115
  throw error;
115
116
  }
@@ -117,7 +118,7 @@ export async function startDevServer(options) {
117
118
  port: options.port,
118
119
  host,
119
120
  close: async () => {
120
- daemon?.close();
121
+ await daemon?.close();
121
122
  await blobs?.close();
122
123
  await app.shutdown();
123
124
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "toiljs",
3
3
  "type": "module",
4
- "version": "0.0.140",
4
+ "version": "0.0.141",
5
5
  "author": "Dacely",
6
6
  "description": "The modern React framework: a file-based React frontend and a ToilScript-compiled WebAssembly backend.",
7
7
  "repository": {
@@ -152,43 +152,46 @@
152
152
  "@dacely/noble-post-quantum": "^0.6.1",
153
153
  "@dacely/toilscript-loader": "^0.1.0",
154
154
  "@noble/curves": "^2.4.0",
155
- "@stylistic/eslint-plugin": "^5.10.0",
156
- "@vitejs/plugin-react": "^6.2.1",
155
+ "@stylistic/eslint-plugin": "^6.0.1",
156
+ "@vitejs/plugin-react": "^6.3.0",
157
157
  "busboy": "^1.6.0",
158
- "dompurify": "^3.4.17",
158
+ "dompurify": "^3.4.18",
159
159
  "eslint-plugin-react-hooks": "^7.1.1",
160
160
  "hash-wasm": "^4.13.0",
161
- "juice": "^12.2.1",
162
- "nodemailer": "^10.4.0",
163
- "oxc-parser": "^0.157.0",
164
- "oxlint": "^1.92.0",
165
- "oxlint-tsgolint": "^7.0.2006",
161
+ "juice": "^12.2.4",
162
+ "nodemailer": "^10.6.0",
163
+ "oxc-parser": "^0.159.0",
164
+ "oxlint": "^1.94.0",
165
+ "oxlint-tsgolint": "^7.0.2007",
166
166
  "picocolors": "^1.1.1",
167
167
  "semver": "^7.8.6",
168
168
  "sharp": "^0.35.5",
169
- "toilscript": ">=0.1.67",
170
- "vite": "^8.3.6",
171
- "vite-imagetools": "^12.0.1",
169
+ "toilscript": ">=0.1.68",
170
+ "vite": "^8.3.8",
171
+ "vite-imagetools": "^12.0.2",
172
172
  "vite-plugin-node-polyfills": "^0.28.0"
173
173
  },
174
174
  "peerDependencies": {
175
- "prettier": ">=3.9.10",
175
+ "prettier": ">=3.10.1",
176
176
  "react": "^19.3.1",
177
177
  "react-dom": "^19.3.1",
178
- "toilscript": ">=0.1.67",
178
+ "toilscript": ">=0.1.68",
179
179
  "vitest": "^5.1.0",
180
180
  "@vitest/browser-webdriverio": "^5.0.0",
181
181
  "@vitest/coverage-v8": "^5.1.0",
182
182
  "webdriverio": "^10.2.0"
183
183
  },
184
184
  "overrides": {
185
- "elliptic": "file:./stubs/elliptic"
185
+ "elliptic": "file:./stubs/elliptic",
186
+ "readdir-glob@3.0.0": {
187
+ "minimatch": "^11.0.9"
188
+ }
186
189
  },
187
190
  "devDependencies": {
188
- "@babel/core": "^8.1.0",
191
+ "@babel/core": "^8.1.2",
189
192
  "@babel/preset-env": "^8.0.7",
190
193
  "@babel/preset-typescript": "^8.0.7",
191
- "@clack/prompts": "^1.8.1",
194
+ "@clack/prompts": "^1.9.0",
192
195
  "@testing-library/dom": "^10.4.2",
193
196
  "@testing-library/react": "^16.3.3",
194
197
  "@types/busboy": "^1.5.5",
@@ -201,9 +204,9 @@
201
204
  "@vitest/coverage-v8": "^5.1.0",
202
205
  "@vitest/ui": "^5.1.0",
203
206
  "esbuild": "^0.28.2",
204
- "jsdom": "^31.0.0",
207
+ "jsdom": "^31.0.1",
205
208
  "micromatch": "^4.0.8",
206
- "prettier": "^3.9.10",
209
+ "prettier": "^3.10.1",
207
210
  "react": "^19.3.1",
208
211
  "react-dom": "^19.3.1",
209
212
  "typescript": "^7.0.2",
@@ -46,3 +46,24 @@ export class ToilLog {
46
46
  return ToilLog.write<T>(2, value);
47
47
  }
48
48
  }
49
+
50
+ // The standard console uses browser string-pointer imports, which cold artifacts
51
+ // deliberately reject. Keep server console output on the bounded UTF-8 log ABI.
52
+ @global
53
+ export class ToilConsole {
54
+ static log<T = string>(value: T = ''): void {
55
+ ToilLog.log<T>(value);
56
+ }
57
+ static debug<T = string>(value: T = ''): void {
58
+ ToilLog.debug<T>(value);
59
+ }
60
+ static info<T = string>(value: T = ''): void {
61
+ ToilLog.info<T>(value);
62
+ }
63
+ static warn<T = string>(value: T = ''): void {
64
+ ToilLog.warn<T>(value);
65
+ }
66
+ static error<T = string>(value: T = ''): void {
67
+ ToilLog.error<T>(value);
68
+ }
69
+ }
@@ -28,6 +28,14 @@ declare namespace Log {
28
28
  function warn<T>(value: T): bool;
29
29
  function error<T>(value: T): bool;
30
30
  }
31
+ // Server console accepts the same values as Log, with optional empty calls.
32
+ declare namespace console {
33
+ function log<T = string>(value?: T): void;
34
+ function debug<T = string>(value?: T): void;
35
+ function info<T = string>(value?: T): void;
36
+ function warn<T = string>(value?: T): void;
37
+ function error<T = string>(value?: T): void;
38
+ }
31
39
  // Email, rate-limit, 2FA, and auth globals (server/globals/*), hand-declared
32
40
  // because their AssemblyScript source can't be type-aliased from tsc.
33
41
  declare enum EmailStatus { Sent, Disabled, Budget, RecipientCapped, Deduped, TryLater, BadRecipient, ProviderError }