@standardagents/sip 1.0.0 → 1.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Standard Agents <justin@standardagents.ai>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -174,20 +174,21 @@ This downloads libjpeg-turbo, compiles it to WASM, and generates:
174
174
 
175
175
  ### Using WASM
176
176
 
177
- For Workers and bundlers, statically import the emitted `.wasm` asset and pass it
178
- to `ready()` once at startup:
177
+ For Cloudflare Workers and other workerd-based runtimes, the package wires up
178
+ the emitted WASM for you. The normal path is just:
179
179
 
180
180
  ```typescript
181
181
  import { ready, transform, collect } from '@standardagents/sip';
182
- import sipWasm from '@standardagents/sip/dist/sip.wasm';
183
182
 
184
- await ready({ wasm: sipWasm });
183
+ await ready();
185
184
 
186
185
  const image = transform(request.body ?? request, { width: 2048, height: 2048 });
187
186
  const result = await collect(image);
188
187
  ```
189
188
 
190
- The `globalThis.__SIP_WASM_LOADER__` hook still exists as an internal escape hatch,
189
+ If you need to override the default loader, `ready({ wasm })` still accepts a
190
+ compiled `WebAssembly.Module` or raw WASM bytes. The
191
+ `globalThis.__SIP_WASM_LOADER__` hook still exists as an internal escape hatch,
191
192
  but it is not the intended public setup API.
192
193
 
193
194
  ## Architecture
@@ -0,0 +1 @@
1
+ export * from './index.js';
@@ -0,0 +1,20 @@
1
+ import createSipModule from './sip.js';
2
+ import sipWasm from './sip.wasm';
3
+
4
+ const globalScope = globalThis;
5
+
6
+ if (!globalScope.__SIP_WASM_LOADER__) {
7
+ globalScope.__SIP_WASM_LOADER__ = async () =>
8
+ createSipModule({
9
+ instantiateWasm(imports, receiveInstance) {
10
+ WebAssembly.instantiate(sipWasm, imports).then((result) => {
11
+ receiveInstance(
12
+ result instanceof WebAssembly.Instance ? result : result.instance
13
+ );
14
+ });
15
+ return {};
16
+ },
17
+ });
18
+ }
19
+
20
+ export * from './index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standardagents/sip",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Small Image Processor - Ultra memory-efficient image processing for Cloudflare Workers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "type": "module",
11
- "license": "UNLICENSED",
11
+ "license": "MIT",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/standardagents/sip.git"
@@ -19,7 +19,7 @@
19
19
  "exports": {
20
20
  ".": {
21
21
  "types": "./dist/index.d.ts",
22
- "workerd": "./dist/index.js",
22
+ "workerd": "./dist/workerd.js",
23
23
  "import": "./dist/index.js",
24
24
  "default": "./dist/index.js"
25
25
  },
@@ -29,22 +29,22 @@
29
29
  "dist"
30
30
  ],
31
31
  "scripts": {
32
- "clean": "rm -f dist/index.js dist/index.d.ts dist/index.js.map",
33
- "build": "([ -f dist/sip.wasm ] || pnpm build:wasm) && pnpm clean && tsup",
32
+ "clean": "rm -f dist/index.js dist/index.d.ts dist/index.js.map dist/workerd.js dist/workerd.d.ts",
33
+ "build": "([ -f dist/sip.wasm ] || pnpm build:wasm) && pnpm clean && tsup && node scripts/generate-workerd-entry.mjs",
34
34
  "build:wasm": "bash wasm/build.sh",
35
- "build:code": "pnpm clean && tsup",
35
+ "build:code": "pnpm clean && tsup && node scripts/generate-workerd-entry.mjs",
36
36
  "dev": "tsup --watch",
37
37
  "check:wasm-pair": "node scripts/check-wasm-pair.mjs",
38
- "docs:dev": "pnpm check:wasm-pair && vite --config docs/vite.config.mjs",
39
- "docs:build": "pnpm check:wasm-pair && vite build --config docs/vite.config.mjs",
40
- "docs:preview": "pnpm check:wasm-pair && vite preview --config docs/vite.config.mjs",
38
+ "docs:dev": "pnpm build:code && pnpm check:wasm-pair && vite --config docs/vite.config.mjs",
39
+ "docs:build": "pnpm build:code && pnpm check:wasm-pair && vite build --config docs/vite.config.mjs",
40
+ "docs:preview": "pnpm build:code && pnpm check:wasm-pair && vite preview --config docs/vite.config.mjs",
41
41
  "typecheck": "tsc --noEmit",
42
42
  "verify": "pnpm typecheck && pnpm build && pnpm docs:build && pnpm test:unit",
43
43
  "verify:release": "pnpm build:wasm && pnpm verify",
44
44
  "test": "vitest",
45
45
  "test:unit": "vitest run",
46
46
  "test:watch": "vitest --watch",
47
- "test:workers": "vitest run --config vitest.config.workers.ts",
47
+ "test:workers": "pnpm build:code && vitest run --config vitest.config.workers.ts",
48
48
  "test:e2e": "playwright test",
49
49
  "release": "node scripts/release.mjs",
50
50
  "release:next": "node scripts/release.mjs --tag=next",