@phron/image 0.0.0 → 0.1.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 +21 -0
- package/README.md +225 -3
- package/dist/index.d.ts +79 -0
- package/dist/index.js +51 -0
- package/dist/native.d.ts +2 -0
- package/dist/native.js +8 -0
- package/dist/next.d.ts +35 -0
- package/dist/next.js +48 -0
- package/dist/options.d.ts +22 -0
- package/dist/options.js +25 -0
- package/native.cjs +852 -0
- package/native.d.cts +81 -0
- package/package.json +92 -5
- package/phron-image.wasm32-wasip1.wasm +0 -0
- package/phron-image.wasm32-wasip1.wasm.d.mts +6 -0
- package/phron-image.wasm32-wasip1.workerd.d.mts +2 -0
- package/phron-image.wasm32-wasip1.workerd.mjs +2 -0
package/native.d.cts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
6
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
7
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
8
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
|
+
|
|
12
|
+
export interface ApiInput {
|
|
13
|
+
label: string
|
|
14
|
+
apiBaseUrl?: string
|
|
15
|
+
options?: Array<string>
|
|
16
|
+
path: string
|
|
17
|
+
format?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Build an API URL (`/v1/image/<label>/_/...`), sent with a bearer API key. */
|
|
21
|
+
export declare function apiUrl(input: ApiInput): string
|
|
22
|
+
|
|
23
|
+
/** Percent-encode a source path the way the URL builders do. */
|
|
24
|
+
export declare function encodePath(path: string): string
|
|
25
|
+
|
|
26
|
+
export interface InfoInput {
|
|
27
|
+
label: string
|
|
28
|
+
apiBaseUrl?: string
|
|
29
|
+
options?: Array<string>
|
|
30
|
+
path: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Build an info URL (`/v1/image/<label>/info/...`). */
|
|
34
|
+
export declare function infoUrl(input: InfoInput): string
|
|
35
|
+
|
|
36
|
+
export declare function optionExpires(unixSeconds: number): string
|
|
37
|
+
|
|
38
|
+
export declare function optionFormat(format: string): string
|
|
39
|
+
|
|
40
|
+
export declare function optionGravity(gravity: string, xOffset?: number | undefined | null, yOffset?: number | undefined | null): string
|
|
41
|
+
|
|
42
|
+
export declare function optionHeight(height: number): string
|
|
43
|
+
|
|
44
|
+
export declare function optionPreset(name: string): string
|
|
45
|
+
|
|
46
|
+
export declare function optionQuality(quality: number): string
|
|
47
|
+
|
|
48
|
+
export declare function optionRaw(option: string): string
|
|
49
|
+
|
|
50
|
+
export declare function optionResize(kind: string, width: number, height: number): string
|
|
51
|
+
|
|
52
|
+
export declare function optionWidth(width: number): string
|
|
53
|
+
|
|
54
|
+
export interface PublicInput {
|
|
55
|
+
baseUrl?: string
|
|
56
|
+
label?: string
|
|
57
|
+
preset: string
|
|
58
|
+
width?: number
|
|
59
|
+
path: string
|
|
60
|
+
format?: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Build an unsigned browser URL for a source whose access is public. */
|
|
64
|
+
export declare function publicUrl(input: PublicInput): string
|
|
65
|
+
|
|
66
|
+
/** `now + ttl`, rounded up to a multiple of `bucketSeconds`, in unix seconds. */
|
|
67
|
+
export declare function roundedExpiry(nowSeconds: number, ttlSeconds: number, bucketSeconds: number): number
|
|
68
|
+
|
|
69
|
+
export interface SignInput {
|
|
70
|
+
baseUrl?: string
|
|
71
|
+
label?: string
|
|
72
|
+
key: string
|
|
73
|
+
salt: string
|
|
74
|
+
options?: Array<string>
|
|
75
|
+
path: string
|
|
76
|
+
format?: string
|
|
77
|
+
expiresAt?: number
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Build a signed browser URL. Server-side only: `key` and `salt` must never reach a browser. */
|
|
81
|
+
export declare function signUrl(input: SignInput): string
|
package/package.json
CHANGED
|
@@ -1,12 +1,99 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phron/image",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Build and sign Phron Image URLs.
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Build and sign Phron Image URLs. A Rust core, bound through napi-rs: native on Linux x64, WebAssembly everywhere else.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"phron",
|
|
7
|
+
"image",
|
|
8
|
+
"signed-url",
|
|
9
|
+
"hmac",
|
|
10
|
+
"nextjs",
|
|
11
|
+
"napi"
|
|
12
|
+
],
|
|
5
13
|
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
6
16
|
"repository": {
|
|
7
17
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/phron-net/image.git"
|
|
18
|
+
"url": "git+https://github.com/phron-net/image.git",
|
|
19
|
+
"directory": "bindings/node"
|
|
9
20
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
21
|
+
"homepage": "https://github.com/phron-net/image#readme",
|
|
22
|
+
"bugs": "https://github.com/phron-net/image/issues",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./next": {
|
|
31
|
+
"types": "./dist/next.d.ts",
|
|
32
|
+
"default": "./dist/next.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json",
|
|
35
|
+
"./workerd": {
|
|
36
|
+
"types": "./phron-image.wasm32-wasip1.workerd.d.mts",
|
|
37
|
+
"default": "./phron-image.wasm32-wasip1.workerd.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./wasm": {
|
|
40
|
+
"types": "./phron-image.wasm32-wasip1.wasm.d.mts",
|
|
41
|
+
"default": "./phron-image.wasm32-wasip1.wasm"
|
|
42
|
+
},
|
|
43
|
+
"./wasm.wasm": {
|
|
44
|
+
"types": "./phron-image.wasm32-wasip1.wasm.d.mts",
|
|
45
|
+
"default": "./phron-image.wasm32-wasip1.wasm"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"native.cjs",
|
|
51
|
+
"native.d.cts",
|
|
52
|
+
"phron-image.wasm32-wasip1.workerd.mjs",
|
|
53
|
+
"phron-image.wasm32-wasip1.workerd.d.mts",
|
|
54
|
+
"phron-image.wasm32-wasip1.wasm",
|
|
55
|
+
"phron-image.wasm32-wasip1.wasm.d.mts"
|
|
56
|
+
],
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=20"
|
|
59
|
+
},
|
|
60
|
+
"napi": {
|
|
61
|
+
"binaryName": "phron-image",
|
|
62
|
+
"targets": [
|
|
63
|
+
"x86_64-unknown-linux-gnu",
|
|
64
|
+
"wasm32-wasip1"
|
|
65
|
+
],
|
|
66
|
+
"wasm": {
|
|
67
|
+
"cpu": false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public",
|
|
72
|
+
"provenance": true
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"build:native": "napi build --platform --release --js native.cjs --dts native.d.cts",
|
|
76
|
+
"build:native:debug": "napi build --platform --js native.cjs --dts native.d.cts",
|
|
77
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
78
|
+
"typecheck": "tsc --noEmit",
|
|
79
|
+
"test": "vitest run",
|
|
80
|
+
"prepack": "cp ../../README.md ../../LICENSE .",
|
|
81
|
+
"prepublishOnly": "napi prepublish -t npm --no-gh-release"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@emnapi/core": "^2.0.0-beta.3",
|
|
85
|
+
"@emnapi/runtime": "^2.0.0-beta.3",
|
|
86
|
+
"@napi-rs/cli": "^3.10.12",
|
|
87
|
+
"@napi-rs/wasm-runtime": "^1.2.7",
|
|
88
|
+
"@types/node": "^22.0.0",
|
|
89
|
+
"emnapi": "^2.0.0-beta.3",
|
|
90
|
+
"esbuild": "^0.28.2",
|
|
91
|
+
"miniflare": "^4.20260730.0",
|
|
92
|
+
"typescript": "^7.0.2",
|
|
93
|
+
"vitest": "^5.1.0"
|
|
94
|
+
},
|
|
95
|
+
"optionalDependencies": {
|
|
96
|
+
"@phron/image-linux-x64-gnu": "0.1.1",
|
|
97
|
+
"@phron/image-wasm32-wasip1": "0.1.1"
|
|
98
|
+
}
|
|
12
99
|
}
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// napi-rs-wasi-root-facade:{"version":1,"flavorPackage":"@phron/image-wasm32-wasip1","wasmSha256":"4fa16c1d538f9aa277c99401ddd7ab20d5c9e46b3bd3d0993ba8f50c84b94a72"}
|
|
2
|
+
/* auto-generated by NAPI-RS */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
declare const wasmModule: WebAssembly.Module
|
|
6
|
+
export default wasmModule
|