flingit 0.0.6 → 0.0.8
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/cli/commands/dev.d.ts +8 -6
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +210 -60
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/logs.d.ts.map +1 -1
- package/dist/cli/commands/logs.js +7 -2
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/onboard.d.ts.map +1 -1
- package/dist/cli/commands/onboard.js +6 -4
- package/dist/cli/commands/onboard.js.map +1 -1
- package/dist/cli/commands/push.d.ts.map +1 -1
- package/dist/cli/commands/push.js +82 -17
- package/dist/cli/commands/push.js.map +1 -1
- package/dist/cli/commands/tun.d.ts +13 -0
- package/dist/cli/commands/tun.d.ts.map +1 -0
- package/dist/cli/commands/tun.js +188 -0
- package/dist/cli/commands/tun.js.map +1 -0
- package/dist/cli/deploy/bundler.d.ts +44 -0
- package/dist/cli/deploy/bundler.d.ts.map +1 -1
- package/dist/cli/deploy/bundler.js +141 -3
- package/dist/cli/deploy/bundler.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/loaders/register-wasm.d.ts +12 -0
- package/dist/cli/loaders/register-wasm.d.ts.map +1 -0
- package/dist/cli/loaders/register-wasm.js +19 -0
- package/dist/cli/loaders/register-wasm.js.map +1 -0
- package/dist/cli/loaders/wasm-hooks.d.ts +61 -0
- package/dist/cli/loaders/wasm-hooks.d.ts.map +1 -0
- package/dist/cli/loaders/wasm-hooks.js +63 -0
- package/dist/cli/loaders/wasm-hooks.js.map +1 -0
- package/package.json +2 -1
- package/templates/default/skills/fling/API.md +78 -0
- package/templates/default/skills/fling/SKILL.md +17 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../../src/cli/deploy/bundler.ts"],"names":[],"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B,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,iDAAiD;IACjD,sBAAsB;IACtB,kCAAkC;IAClC,kCAAkC;IAClC,4EAA4E;IAC5E,6EAA6E;IAC7E,MAAM,aAAa,GAAG,8DAA8D,CAAC;IAErF,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { feedbackCommand } from "./commands/feedback.js";
|
|
|
22
22
|
import { projectCommand } from "./commands/project.js";
|
|
23
23
|
import { adminCommand } from "./commands/admin.js";
|
|
24
24
|
import { cronCommand } from "./commands/cron.js";
|
|
25
|
+
import { tunCommand } from "./commands/tun.js";
|
|
25
26
|
import { launch } from "./commands/launch.js";
|
|
26
27
|
const program = new Command();
|
|
27
28
|
program
|
|
@@ -61,6 +62,7 @@ program.addCommand(whoamiCommand);
|
|
|
61
62
|
program.addCommand(feedbackCommand);
|
|
62
63
|
program.addCommand(projectCommand);
|
|
63
64
|
program.addCommand(cronCommand);
|
|
65
|
+
program.addCommand(tunCommand);
|
|
64
66
|
program.addCommand(adminCommand);
|
|
65
67
|
// If no command specified, run the default launch action
|
|
66
68
|
if (process.argv.length === 2) {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,+DAA+D,CAAC;KAC5E,OAAO,CAAC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C,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration file for the WASM ESM loader hooks.
|
|
3
|
+
*
|
|
4
|
+
* This file is used with Node.js --import flag to register the WASM loader
|
|
5
|
+
* before any user code runs. It uses the node:module register() API to
|
|
6
|
+
* install the custom resolve and load hooks.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* node --import ./register-wasm.js script.js
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=register-wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-wasm.d.ts","sourceRoot":"","sources":["../../../src/cli/loaders/register-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration file for the WASM ESM loader hooks.
|
|
3
|
+
*
|
|
4
|
+
* This file is used with Node.js --import flag to register the WASM loader
|
|
5
|
+
* before any user code runs. It uses the node:module register() API to
|
|
6
|
+
* install the custom resolve and load hooks.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* node --import ./register-wasm.js script.js
|
|
10
|
+
*/
|
|
11
|
+
import { register } from "node:module";
|
|
12
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
|
+
import { dirname, join } from "node:path";
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
// The hooks file path - will be .js when compiled to dist/
|
|
16
|
+
const hooksPath = join(__dirname, "wasm-hooks.js");
|
|
17
|
+
// Register the WASM loader hooks
|
|
18
|
+
register(pathToFileURL(hooksPath).href, import.meta.url);
|
|
19
|
+
//# sourceMappingURL=register-wasm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-wasm.js","sourceRoot":"","sources":["../../../src/cli/loaders/register-wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,2DAA2D;AAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAEnD,iCAAiC;AACjC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js ESM loader hooks for WebAssembly support in development.
|
|
3
|
+
*
|
|
4
|
+
* This file provides the resolve and load hooks that allow importing .wasm
|
|
5
|
+
* files directly in TypeScript/JavaScript code during local development.
|
|
6
|
+
*
|
|
7
|
+
* Usage in user code (same API works in both local dev and production):
|
|
8
|
+
* import wasmBinary from './example.wasm';
|
|
9
|
+
* const { instance } = await WebAssembly.instantiate(wasmBinary);
|
|
10
|
+
* instance.exports.someFunction();
|
|
11
|
+
*
|
|
12
|
+
* The import returns:
|
|
13
|
+
* - In local dev (Node.js): Uint8Array
|
|
14
|
+
* - In production (Cloudflare): WebAssembly.Module
|
|
15
|
+
*
|
|
16
|
+
* Both types are accepted by WebAssembly.instantiate() and by WASM library
|
|
17
|
+
* init functions like @resvg/resvg-wasm's initWasm().
|
|
18
|
+
*/
|
|
19
|
+
interface ResolveContext {
|
|
20
|
+
conditions: string[];
|
|
21
|
+
importAttributes: Record<string, string>;
|
|
22
|
+
parentURL?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ResolveResult {
|
|
25
|
+
format?: string | null;
|
|
26
|
+
importAttributes?: Record<string, string>;
|
|
27
|
+
shortCircuit?: boolean;
|
|
28
|
+
url: string;
|
|
29
|
+
}
|
|
30
|
+
type NextResolve = (specifier: string, context: ResolveContext) => Promise<ResolveResult>;
|
|
31
|
+
interface LoadContext {
|
|
32
|
+
conditions: string[];
|
|
33
|
+
format?: string | null;
|
|
34
|
+
importAttributes: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
interface LoadResult {
|
|
37
|
+
format: string;
|
|
38
|
+
shortCircuit?: boolean;
|
|
39
|
+
source?: string | ArrayBuffer | Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
type NextLoad = (url: string, context: LoadContext) => Promise<LoadResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve hook: mark .wasm imports with custom format.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolve(specifier: string, context: ResolveContext, nextResolve: NextResolve): Promise<ResolveResult>;
|
|
46
|
+
/**
|
|
47
|
+
* Load hook: generate JS module that exports WASM binary as Uint8Array.
|
|
48
|
+
*
|
|
49
|
+
* We embed the WASM binary as base64 in the generated JS module,
|
|
50
|
+
* which then decodes to Uint8Array when imported.
|
|
51
|
+
*
|
|
52
|
+
* This matches what libraries like @resvg/resvg-wasm expect:
|
|
53
|
+
* - In Cloudflare Workers: import returns WebAssembly.Module
|
|
54
|
+
* - In Node.js (local dev): import returns Uint8Array
|
|
55
|
+
*
|
|
56
|
+
* Both types are accepted by WebAssembly.instantiate() and by
|
|
57
|
+
* library init functions like initWasm().
|
|
58
|
+
*/
|
|
59
|
+
export declare function load(url: string, context: LoadContext, nextLoad: NextLoad): Promise<LoadResult>;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=wasm-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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,MAAM,EACX,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,UAAU,CAAC,CAkBrB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js ESM loader hooks for WebAssembly support in development.
|
|
3
|
+
*
|
|
4
|
+
* This file provides the resolve and load hooks that allow importing .wasm
|
|
5
|
+
* files directly in TypeScript/JavaScript code during local development.
|
|
6
|
+
*
|
|
7
|
+
* Usage in user code (same API works in both local dev and production):
|
|
8
|
+
* import wasmBinary from './example.wasm';
|
|
9
|
+
* const { instance } = await WebAssembly.instantiate(wasmBinary);
|
|
10
|
+
* instance.exports.someFunction();
|
|
11
|
+
*
|
|
12
|
+
* The import returns:
|
|
13
|
+
* - In local dev (Node.js): Uint8Array
|
|
14
|
+
* - In production (Cloudflare): WebAssembly.Module
|
|
15
|
+
*
|
|
16
|
+
* Both types are accepted by WebAssembly.instantiate() and by WASM library
|
|
17
|
+
* init functions like @resvg/resvg-wasm's initWasm().
|
|
18
|
+
*/
|
|
19
|
+
import { readFile } from "node:fs/promises";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
21
|
+
// Custom format identifier for WASM files
|
|
22
|
+
const WASM_FORMAT = "wasm-loader";
|
|
23
|
+
/**
|
|
24
|
+
* Resolve hook: mark .wasm imports with custom format.
|
|
25
|
+
*/
|
|
26
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
27
|
+
const resolved = await nextResolve(specifier, context);
|
|
28
|
+
// Mark .wasm files with our custom format
|
|
29
|
+
if (specifier.endsWith(".wasm")) {
|
|
30
|
+
return { ...resolved, format: WASM_FORMAT };
|
|
31
|
+
}
|
|
32
|
+
return resolved;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Load hook: generate JS module that exports WASM binary as Uint8Array.
|
|
36
|
+
*
|
|
37
|
+
* We embed the WASM binary as base64 in the generated JS module,
|
|
38
|
+
* which then decodes to Uint8Array when imported.
|
|
39
|
+
*
|
|
40
|
+
* This matches what libraries like @resvg/resvg-wasm expect:
|
|
41
|
+
* - In Cloudflare Workers: import returns WebAssembly.Module
|
|
42
|
+
* - In Node.js (local dev): import returns Uint8Array
|
|
43
|
+
*
|
|
44
|
+
* Both types are accepted by WebAssembly.instantiate() and by
|
|
45
|
+
* library init functions like initWasm().
|
|
46
|
+
*/
|
|
47
|
+
export async function load(url, context, nextLoad) {
|
|
48
|
+
if (context.format === WASM_FORMAT) {
|
|
49
|
+
const filePath = fileURLToPath(url);
|
|
50
|
+
const wasmBuffer = await readFile(filePath);
|
|
51
|
+
const base64 = wasmBuffer.toString("base64");
|
|
52
|
+
// Generate JS module that decodes base64 to Uint8Array
|
|
53
|
+
// This is compatible with libraries that accept either Uint8Array or WebAssembly.Module
|
|
54
|
+
const source = `
|
|
55
|
+
const base64 = "${base64}";
|
|
56
|
+
const binary = Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
|
57
|
+
export default binary;
|
|
58
|
+
`;
|
|
59
|
+
return { format: "module", source, shortCircuit: true };
|
|
60
|
+
}
|
|
61
|
+
return nextLoad(url, context);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=wasm-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-hooks.js","sourceRoot":"","sources":["../../../src/cli/loaders/wasm-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,0CAA0C;AAC1C,MAAM,WAAW,GAAG,aAAa,CAAC;AAkClC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,SAAiB,EACjB,OAAuB,EACvB,WAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEvD,0CAA0C;IAC1C,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,GAAW,EACX,OAAoB,EACpB,QAAkB;IAElB,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE7C,uDAAuD;QACvD,wFAAwF;QACxF,MAAM,MAAM,GAAG;kBACD,MAAM;;;CAGvB,CAAC;QAEE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flingit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Personal Software Platform - Build and deploy personal tools through conversation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@clack/prompts": "^0.11.0",
|
|
54
54
|
"@hono/node-server": "^1.19.9",
|
|
55
55
|
"better-sqlite3": "^12.6.2",
|
|
56
|
+
"cloudflared": "^0.7.1",
|
|
56
57
|
"commander": "^14.0.2",
|
|
57
58
|
"croner": "^9.1.0",
|
|
58
59
|
"dotenv": "^17.2.3",
|
|
@@ -333,3 +333,81 @@ Secret names must be uppercase with underscores:
|
|
|
333
333
|
- `apiKey` ✗
|
|
334
334
|
- `github-token` ✗
|
|
335
335
|
|
|
336
|
+
## WebAssembly (WASM)
|
|
337
|
+
|
|
338
|
+
Fling supports importing WebAssembly modules in your backend code. This enables using libraries like `@resvg/resvg-wasm` for SVG rendering, image processing, and other compute-intensive tasks.
|
|
339
|
+
|
|
340
|
+
### Basic Usage
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
import { app } from "flingit";
|
|
344
|
+
import wasmBinary from "@resvg/resvg-wasm/index_bg.wasm";
|
|
345
|
+
import { initWasm, Resvg } from "@resvg/resvg-wasm";
|
|
346
|
+
|
|
347
|
+
// Initialize WASM once
|
|
348
|
+
let initialized = false;
|
|
349
|
+
|
|
350
|
+
app.get("/api/svg-to-png", async (c) => {
|
|
351
|
+
if (!initialized) {
|
|
352
|
+
await initWasm(wasmBinary);
|
|
353
|
+
initialized = true;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const svg = c.req.query("svg") ?? '<svg width="100" height="100"><circle cx="50" cy="50" r="40" fill="red"/></svg>';
|
|
357
|
+
const resvg = new Resvg(svg);
|
|
358
|
+
const png = resvg.render().asPng();
|
|
359
|
+
|
|
360
|
+
return c.body(png, 200, { "Content-Type": "image/png" });
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### How It Works
|
|
365
|
+
|
|
366
|
+
WASM files are handled differently in local development vs production, but the same code works for both:
|
|
367
|
+
|
|
368
|
+
| Environment | What `import wasm from "*.wasm"` returns |
|
|
369
|
+
|-------------|------------------------------------------|
|
|
370
|
+
| Local (Node.js) | `Uint8Array` (raw bytes) |
|
|
371
|
+
| Production (Cloudflare) | `WebAssembly.Module` (pre-compiled) |
|
|
372
|
+
|
|
373
|
+
Most WASM libraries (like `@resvg/resvg-wasm`) accept both types in their init functions, so your code works unchanged in both environments.
|
|
374
|
+
|
|
375
|
+
### TypeScript Support
|
|
376
|
+
|
|
377
|
+
Add a type declaration file (e.g., `src/worker/wasm.d.ts`):
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
declare module "*.wasm" {
|
|
381
|
+
const content: WebAssembly.Module | Uint8Array;
|
|
382
|
+
export default content;
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Direct WASM Instantiation
|
|
387
|
+
|
|
388
|
+
For custom WASM modules without a library wrapper:
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
import wasmModule from "./my-module.wasm";
|
|
392
|
+
|
|
393
|
+
let instance: WebAssembly.Instance | null = null;
|
|
394
|
+
|
|
395
|
+
app.get("/api/compute", async (c) => {
|
|
396
|
+
if (!instance) {
|
|
397
|
+
const result = await WebAssembly.instantiate(wasmModule);
|
|
398
|
+
instance = result instanceof WebAssembly.Instance ? result : result.instance;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const compute = instance.exports.compute as (x: number) => number;
|
|
402
|
+
const result = compute(42);
|
|
403
|
+
|
|
404
|
+
return c.json({ result });
|
|
405
|
+
});
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Important Notes
|
|
409
|
+
|
|
410
|
+
- **Cloudflare blocks dynamic WASM compilation** - You cannot use `WebAssembly.instantiate(bytes)` with raw bytes fetched at runtime. WASM must be imported statically so Cloudflare can pre-compile it at deploy time.
|
|
411
|
+
- **Initialize once** - WASM initialization is expensive. Cache the instance and reuse it across requests.
|
|
412
|
+
- **Bundle size** - WASM modules count toward the 10MB bundle limit. Large WASM files may require optimization.
|
|
413
|
+
|
|
@@ -4,13 +4,14 @@ You are working on a Fling project - a personal software platform for building a
|
|
|
4
4
|
|
|
5
5
|
## Core Concepts
|
|
6
6
|
|
|
7
|
-
Fling provides
|
|
7
|
+
Fling provides six primitives that work identically in local development and production:
|
|
8
8
|
|
|
9
9
|
1. **HTTP** - Expose endpoints via Hono
|
|
10
10
|
2. **Database** - SQLite locally, D1 in production
|
|
11
11
|
3. **Secrets** - Secure credential management
|
|
12
12
|
4. **Migrations** - Version your database schema
|
|
13
13
|
5. **Cron** - Scheduled tasks that run on a schedule
|
|
14
|
+
6. **WASM** - WebAssembly modules for compute-intensive tasks
|
|
14
15
|
|
|
15
16
|
## Project Structure
|
|
16
17
|
|
|
@@ -108,6 +109,21 @@ npm exec fling cron history <name> # View invocation history
|
|
|
108
109
|
npm exec fling cron trigger <name> # Manually trigger a cron job
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
### Debugging Cron Jobs in Production
|
|
113
|
+
|
|
114
|
+
Each cron invocation logs "Running cron job <name>" at the start. To see all logs from a specific cron invocation:
|
|
115
|
+
|
|
116
|
+
1. **Find the invocation** by searching for the cron job name:
|
|
117
|
+
```bash
|
|
118
|
+
npm exec fling -- --prod logs --search "Running cron job daily-cleanup"
|
|
119
|
+
```
|
|
120
|
+
This shows log entries with Ray IDs like `[ray:abc12345]`.
|
|
121
|
+
|
|
122
|
+
2. **Filter by that Ray ID** to see all logs from that invocation:
|
|
123
|
+
```bash
|
|
124
|
+
npm exec fling -- --prod logs --ray abc12345
|
|
125
|
+
```
|
|
126
|
+
|
|
111
127
|
### Local vs Production (`--prod`)
|
|
112
128
|
|
|
113
129
|
Commands default to local environment. Use `--prod` for production:
|