@pulse-compute/assets 0.0.0 → 1.0.0-beta.2
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/README.md +31 -1
- package/as/README.md +12 -0
- package/as/index.as.ts +54 -0
- package/conformance/native.json +7 -0
- package/dist/asset-bucket.d.ts +85 -0
- package/dist/asset-bucket.d.ts.map +1 -0
- package/dist/asset-bucket.js +226 -0
- package/dist/asset-bucket.js.map +1 -0
- package/dist/asset-context.d.ts +34 -0
- package/dist/asset-context.d.ts.map +1 -0
- package/dist/asset-context.js +29 -0
- package/dist/asset-context.js.map +1 -0
- package/dist/asset-manager.d.ts +54 -0
- package/dist/asset-manager.d.ts.map +1 -0
- package/dist/asset-manager.js +257 -0
- package/dist/asset-manager.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/package-runtime.d.ts +9 -0
- package/dist/internal/package-runtime.d.ts.map +1 -0
- package/dist/internal/package-runtime.js +14 -0
- package/dist/internal/package-runtime.js.map +1 -0
- package/dist/portable.d.ts +33 -0
- package/dist/portable.d.ts.map +1 -0
- package/dist/portable.js +98 -0
- package/dist/portable.js.map +1 -0
- package/dist/pulsewasm-compiler-types.d.ts +26 -0
- package/dist/pulsewasm-compiler-types.d.ts.map +1 -0
- package/dist/pulsewasm-compiler-types.js +9 -0
- package/dist/pulsewasm-compiler-types.js.map +1 -0
- package/dist/pulsewasm.d.ts +35 -0
- package/dist/pulsewasm.d.ts.map +1 -0
- package/dist/pulsewasm.js +34 -0
- package/dist/pulsewasm.js.map +1 -0
- package/dist/response-ownership.d.ts +3 -0
- package/dist/response-ownership.d.ts.map +1 -0
- package/dist/response-ownership.js +13 -0
- package/dist/response-ownership.js.map +1 -0
- package/dist/sigv4.d.ts +19 -0
- package/dist/sigv4.d.ts.map +1 -0
- package/dist/sigv4.js +123 -0
- package/dist/sigv4.js.map +1 -0
- package/package.json +59 -5
- package/pulse.package.json +69 -0
- package/pulsewasm.compiler.cjs +1660 -0
- package/pulsewasm.manifest.cjs +60 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { AssetBucket, } from './asset-bucket.js';
|
|
2
|
+
import { AssetBucketConfigError, AssetBucketFetchError } from './errors.js';
|
|
3
|
+
import { normalizeAssetContext } from './asset-context.js';
|
|
4
|
+
import { cancelResponseBody } from './response-ownership.js';
|
|
5
|
+
const DEFAULT_TTL = 3600;
|
|
6
|
+
const IMMUTABLE_TTL = 31536000;
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function trimSlashes(value) {
|
|
11
|
+
return value.replace(/^\/+|\/+$/g, '');
|
|
12
|
+
}
|
|
13
|
+
function normalizePrefix(prefix) {
|
|
14
|
+
if (!prefix)
|
|
15
|
+
return '';
|
|
16
|
+
const clean = trimSlashes(prefix);
|
|
17
|
+
return clean ? `${clean}/` : '';
|
|
18
|
+
}
|
|
19
|
+
function normalizeKey(key) {
|
|
20
|
+
const pathOnly = key.split('?')[0] ?? '';
|
|
21
|
+
return decodeURIComponent(pathOnly)
|
|
22
|
+
.replace(/^\/+/, '')
|
|
23
|
+
.replace(/\/+/g, '/');
|
|
24
|
+
}
|
|
25
|
+
function normalizeMethods(methods) {
|
|
26
|
+
return new Set(methods ?? ['GET', 'HEAD']);
|
|
27
|
+
}
|
|
28
|
+
function requestRelativePath(ctx) {
|
|
29
|
+
return normalizeAssetContext(ctx).path.relative;
|
|
30
|
+
}
|
|
31
|
+
function cacheControl(config) {
|
|
32
|
+
const ttl = config.ttl ?? DEFAULT_TTL;
|
|
33
|
+
const immutable = config.immutable ?? false;
|
|
34
|
+
if (immutable) {
|
|
35
|
+
const maxAge = ttl === false ? IMMUTABLE_TTL : ttl;
|
|
36
|
+
return `public, max-age=${maxAge}, immutable`;
|
|
37
|
+
}
|
|
38
|
+
if (ttl === false)
|
|
39
|
+
return undefined;
|
|
40
|
+
return `public, max-age=${ttl}`;
|
|
41
|
+
}
|
|
42
|
+
function applyCache(headers, config) {
|
|
43
|
+
const value = cacheControl(config);
|
|
44
|
+
if (value)
|
|
45
|
+
headers.set('cache-control', value);
|
|
46
|
+
}
|
|
47
|
+
function mimeType(path, overrides) {
|
|
48
|
+
const lower = path.toLowerCase();
|
|
49
|
+
const ext = lower.includes('.') ? lower.slice(lower.lastIndexOf('.') + 1) : '';
|
|
50
|
+
if (overrides?.[ext])
|
|
51
|
+
return overrides[ext];
|
|
52
|
+
switch (ext) {
|
|
53
|
+
case 'html': return 'text/html; charset=utf-8';
|
|
54
|
+
case 'css': return 'text/css; charset=utf-8';
|
|
55
|
+
case 'js':
|
|
56
|
+
case 'mjs': return 'text/javascript; charset=utf-8';
|
|
57
|
+
case 'json': return 'application/json; charset=utf-8';
|
|
58
|
+
case 'svg': return 'image/svg+xml';
|
|
59
|
+
case 'png': return 'image/png';
|
|
60
|
+
case 'jpg':
|
|
61
|
+
case 'jpeg': return 'image/jpeg';
|
|
62
|
+
case 'gif': return 'image/gif';
|
|
63
|
+
case 'webp': return 'image/webp';
|
|
64
|
+
case 'ico': return 'image/x-icon';
|
|
65
|
+
case 'txt': return 'text/plain; charset=utf-8';
|
|
66
|
+
case 'wasm': return 'application/wasm';
|
|
67
|
+
case 'woff': return 'font/woff';
|
|
68
|
+
case 'woff2': return 'font/woff2';
|
|
69
|
+
default: return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function importNodeModule(specifier) {
|
|
73
|
+
return await import(specifier);
|
|
74
|
+
}
|
|
75
|
+
function validateMode(config) {
|
|
76
|
+
if (!isRecord(config)) {
|
|
77
|
+
throw new AssetBucketConfigError('AssetManager requires an assets config object');
|
|
78
|
+
}
|
|
79
|
+
if (config.mode !== 'local' && config.mode !== 'hosted' && config.mode !== 'bucket') {
|
|
80
|
+
throw new AssetBucketConfigError('AssetManager requires explicit mode: local, hosted, or bucket');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export class AssetManagerCore {
|
|
84
|
+
config;
|
|
85
|
+
bucket;
|
|
86
|
+
constructor(config) {
|
|
87
|
+
validateMode(config);
|
|
88
|
+
this.config = config;
|
|
89
|
+
if (config.mode === 'bucket') {
|
|
90
|
+
this.bucket = new AssetBucket(config);
|
|
91
|
+
}
|
|
92
|
+
else if (config.mode === 'local') {
|
|
93
|
+
if (!config.dir)
|
|
94
|
+
throw new AssetBucketConfigError('AssetManager local mode requires dir');
|
|
95
|
+
}
|
|
96
|
+
else if (config.mode === 'hosted') {
|
|
97
|
+
if (!config.origin)
|
|
98
|
+
throw new AssetBucketConfigError('AssetManager hosted mode requires origin');
|
|
99
|
+
try {
|
|
100
|
+
new URL(config.origin);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
throw new AssetBucketConfigError(`AssetManager hosted mode requires a valid origin URL: ${config.origin}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async handle(ctx, next) {
|
|
108
|
+
switch (this.config.mode) {
|
|
109
|
+
case 'local': return await this.handleLocal(ctx, next);
|
|
110
|
+
case 'hosted': return await this.handleHosted(ctx, next);
|
|
111
|
+
case 'bucket': return await this.bucket.core.handle(ctx, next);
|
|
112
|
+
default: return await this.pass(next);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async resolveKey(ctx) {
|
|
116
|
+
if (this.config.mode === 'bucket') {
|
|
117
|
+
return await this.bucket.resolveKey(ctx);
|
|
118
|
+
}
|
|
119
|
+
const key = normalizeKey(requestRelativePath(ctx));
|
|
120
|
+
const prefix = normalizePrefix(this.config.prefix);
|
|
121
|
+
const joined = `${prefix}${key}`;
|
|
122
|
+
if (this.config.mode === 'local') {
|
|
123
|
+
if ((joined === '' || joined.endsWith('/')) && this.config.index !== false) {
|
|
124
|
+
return `${joined}${this.config.index ?? 'index.html'}`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return joined;
|
|
128
|
+
}
|
|
129
|
+
allowed(method) {
|
|
130
|
+
return normalizeMethods(this.config.methods).has(method);
|
|
131
|
+
}
|
|
132
|
+
async handleLocal(ctx, next) {
|
|
133
|
+
const normalized = normalizeAssetContext(ctx);
|
|
134
|
+
const method = normalized.request.method.toUpperCase();
|
|
135
|
+
if (!this.allowed(method))
|
|
136
|
+
return await this.pass(next);
|
|
137
|
+
try {
|
|
138
|
+
const key = await this.resolveKey(ctx);
|
|
139
|
+
if (!key)
|
|
140
|
+
return await this.pass(next);
|
|
141
|
+
const { default: fs } = await importNodeModule('node:fs/promises');
|
|
142
|
+
const path = await importNodeModule('node:path');
|
|
143
|
+
const root = path.resolve(this.config.mode === 'local' ? this.config.dir : '.');
|
|
144
|
+
const target = path.resolve(root, key);
|
|
145
|
+
const separator = path.sep ?? '/';
|
|
146
|
+
if (target !== root && !target.startsWith(`${root}${separator}`)) {
|
|
147
|
+
return new Response('Forbidden', { status: 403 });
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const stat = await fs.stat(target);
|
|
151
|
+
if (!stat.isFile())
|
|
152
|
+
return await this.handleMiss(next);
|
|
153
|
+
}
|
|
154
|
+
catch (cause) {
|
|
155
|
+
if (isNodeNotFound(cause))
|
|
156
|
+
return await this.handleMiss(next);
|
|
157
|
+
throw cause;
|
|
158
|
+
}
|
|
159
|
+
const body = method === 'HEAD' ? null : await fs.readFile(target);
|
|
160
|
+
const headers = new Headers();
|
|
161
|
+
const type = mimeType(target, this.config.mode === 'local' ? this.config.contentTypes : undefined);
|
|
162
|
+
if (type)
|
|
163
|
+
headers.set('content-type', type);
|
|
164
|
+
applyCache(headers, this.config);
|
|
165
|
+
return new Response(body, { status: 200, headers });
|
|
166
|
+
}
|
|
167
|
+
catch (cause) {
|
|
168
|
+
if (this.config.passThroughOnError)
|
|
169
|
+
return await this.pass(next);
|
|
170
|
+
if (cause instanceof AssetBucketConfigError)
|
|
171
|
+
throw cause;
|
|
172
|
+
throw new AssetBucketFetchError('AssetManager failed to serve local asset', { cause });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async handleHosted(ctx, next) {
|
|
176
|
+
const config = this.config;
|
|
177
|
+
if (config.mode !== 'hosted')
|
|
178
|
+
return await this.pass(next);
|
|
179
|
+
const normalized = normalizeAssetContext(ctx);
|
|
180
|
+
const method = normalized.request.method.toUpperCase();
|
|
181
|
+
if (!this.allowed(method))
|
|
182
|
+
return await this.pass(next);
|
|
183
|
+
try {
|
|
184
|
+
const fetchImpl = config.fetch ?? globalThis.fetch;
|
|
185
|
+
if (typeof fetchImpl !== 'function') {
|
|
186
|
+
throw new AssetBucketConfigError('AssetManager hosted mode requires a fetch implementation');
|
|
187
|
+
}
|
|
188
|
+
const key = await this.resolveKey(ctx);
|
|
189
|
+
if (!key)
|
|
190
|
+
return await this.pass(next);
|
|
191
|
+
const url = new URL(config.origin.endsWith('/') ? config.origin : `${config.origin}/`);
|
|
192
|
+
url.pathname = joinUrlPath(url.pathname, key);
|
|
193
|
+
url.search = new URL(normalized.request.url).search;
|
|
194
|
+
const headers = new Headers(config.headers);
|
|
195
|
+
copyConditionalHeaders(normalized.request.headers, headers);
|
|
196
|
+
const upstream = await fetchImpl(new Request(url, { method, headers }));
|
|
197
|
+
if (upstream.status === 404 && (config.passThroughOn404 ?? true)) {
|
|
198
|
+
await cancelResponseBody(upstream);
|
|
199
|
+
return await this.pass(next);
|
|
200
|
+
}
|
|
201
|
+
const responseHeaders = new Headers(upstream.headers);
|
|
202
|
+
applyCache(responseHeaders, this.config);
|
|
203
|
+
if (method === 'HEAD')
|
|
204
|
+
await cancelResponseBody(upstream);
|
|
205
|
+
return new Response(method === 'HEAD' ? null : upstream.body, {
|
|
206
|
+
status: upstream.status,
|
|
207
|
+
statusText: upstream.statusText,
|
|
208
|
+
headers: responseHeaders,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (cause) {
|
|
212
|
+
if (this.config.passThroughOnError)
|
|
213
|
+
return await this.pass(next);
|
|
214
|
+
if (cause instanceof AssetBucketConfigError)
|
|
215
|
+
throw cause;
|
|
216
|
+
throw new AssetBucketFetchError('AssetManager failed to fetch hosted asset', { cause });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async handleMiss(next) {
|
|
220
|
+
if (this.config.passThroughOn404 ?? true)
|
|
221
|
+
return await this.pass(next);
|
|
222
|
+
return new Response('Not Found', { status: 404 });
|
|
223
|
+
}
|
|
224
|
+
async pass(next) {
|
|
225
|
+
return next ? await next() : undefined;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function isNodeNotFound(error) {
|
|
229
|
+
return isRecord(error) && error.code === 'ENOENT';
|
|
230
|
+
}
|
|
231
|
+
function joinUrlPath(...parts) {
|
|
232
|
+
return `/${parts.map((part) => trimSlashes(part)).filter(Boolean).join('/')}`;
|
|
233
|
+
}
|
|
234
|
+
function copyConditionalHeaders(source, target) {
|
|
235
|
+
for (const name of ['range', 'if-match', 'if-none-match', 'if-modified-since', 'if-unmodified-since']) {
|
|
236
|
+
const value = source.get(name);
|
|
237
|
+
if (value !== null)
|
|
238
|
+
target.set(name, value);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function createAssetManager(config) {
|
|
242
|
+
const core = new AssetManagerCore(config);
|
|
243
|
+
const middleware = core.handle.bind(core);
|
|
244
|
+
Object.defineProperties(middleware, {
|
|
245
|
+
core: { value: core, enumerable: false },
|
|
246
|
+
handle: { value: middleware, enumerable: false },
|
|
247
|
+
resolveKey: { value: core.resolveKey.bind(core), enumerable: false },
|
|
248
|
+
});
|
|
249
|
+
return middleware;
|
|
250
|
+
}
|
|
251
|
+
export const AssetManager = function AssetManager(config) {
|
|
252
|
+
return createAssetManager(config);
|
|
253
|
+
};
|
|
254
|
+
export function createAssets(config) {
|
|
255
|
+
return createAssetManager(config);
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=asset-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-manager.js","sourceRoot":"","sources":["../src/asset-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAMZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAsC,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAgD7D,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,eAAe,CAAC,MAA0B;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,OAAO,kBAAkB,CAAC,QAAQ,CAAC;SAChC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,MAAM,EAAE,GAA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AK,EAAE;QAChD,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE;KACrE,CAAC,CAAC;IACH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAA4B,SAAS,YAAY,CAExE,MAAoB;IAEpB,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAuC,CAAC;AAExC,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class AssetBucketConfigError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class AssetBucketSignError extends Error {
|
|
5
|
+
constructor(message: string, options?: {
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export declare class AssetBucketFetchError extends Error {
|
|
10
|
+
constructor(message: string, options?: {
|
|
11
|
+
cause?: unknown;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAO3D;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAO3D"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class AssetBucketConfigError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = "AssetBucketConfigError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class AssetBucketSignError extends Error {
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "AssetBucketSignError";
|
|
11
|
+
if (options?.cause !== undefined) {
|
|
12
|
+
this.cause = options.cause;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class AssetBucketFetchError extends Error {
|
|
17
|
+
constructor(message, options) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "AssetBucketFetchError";
|
|
20
|
+
if (options?.cause !== undefined) {
|
|
21
|
+
this.cause = options.cause;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,IAAoC,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,IAAoC,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AssetBucket, AssetBucketCore, type AssetBucketConstructor, type AssetBucketContext, type AssetBucketInstance, type AssetBucketMethod, type AssetBucketMiddleware, type AssetBucketOptions, type AssetBucketResponseContext, type AssetBucketRouteContext, type AssetBucketSigner, type AssetBucketSignerInput, type LegacyAssetBucketRouteContext, type RouteNext, } from './asset-bucket.js';
|
|
2
|
+
export { AssetBucketConfigError, AssetBucketFetchError, AssetBucketSignError, } from './errors.js';
|
|
3
|
+
export { encodeS3Key, signSigV4, type SecretValue, type SigV4Credentials, type SigV4SignOptions, } from './sigv4.js';
|
|
4
|
+
export { AssetManager, AssetManagerCore, createAssets, type AssetCacheOptions, type AssetManagerConstructor, type AssetManagerInstance, type AssetManagerMiddleware, type AssetsConfig, type BucketAssetsConfig, type HostedAssetsConfig, type LocalAssetsConfig, } from './asset-manager.js';
|
|
5
|
+
export { assets, lookup, respond, type AssetLookup, type AssetLookupEffect, type AssetLookupMethod, type AssetLookupOptions, type AssetResponseOptions, } from './portable.js';
|
|
6
|
+
export { assets as default } from './portable.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AssetBucket, AssetBucketCore, } from './asset-bucket.js';
|
|
2
|
+
export { AssetBucketConfigError, AssetBucketFetchError, AssetBucketSignError, } from './errors.js';
|
|
3
|
+
export { encodeS3Key, signSigV4, } from './sigv4.js';
|
|
4
|
+
export { AssetManager, AssetManagerCore, createAssets, } from './asset-manager.js';
|
|
5
|
+
export { assets, lookup, respond, } from './portable.js';
|
|
6
|
+
export { assets as default } from './portable.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,GAahB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,WAAW,EACX,SAAS,GAIV,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,YAAY,GASb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,GAMR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import packageRuntime from '@pulse-compute/runtime/package';
|
|
2
|
+
export declare const pulseAssetsRuntime: packageRuntime.PulsePackageRuntime<{
|
|
3
|
+
readonly lookup: {
|
|
4
|
+
readonly kind: "assets.lookup";
|
|
5
|
+
readonly capability: "assets.lookup";
|
|
6
|
+
readonly result: "asset";
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=package-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/package-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAE5D,eAAO,MAAM,kBAAkB;;;;;;EAWpB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import packageRuntime from '@pulse-compute/runtime/package';
|
|
2
|
+
export const pulseAssetsRuntime = packageRuntime.createPackageRuntime({
|
|
3
|
+
package: '@pulse-compute/assets',
|
|
4
|
+
contractId: 'pulse.assets',
|
|
5
|
+
providerKind: 'assets',
|
|
6
|
+
operations: {
|
|
7
|
+
lookup: {
|
|
8
|
+
kind: 'assets.lookup',
|
|
9
|
+
capability: 'assets.lookup',
|
|
10
|
+
result: 'asset',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=package-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-runtime.js","sourceRoot":"","sources":["../../src/internal/package-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,oBAAoB,CAAC;IACpE,OAAO,EAAE,uBAAuB;IAChC,UAAU,EAAE,cAAc;IAC1B,YAAY,EAAE,QAAQ;IACtB,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,eAAe;YAC3B,MAAM,EAAE,OAAO;SAChB;KACF;CACO,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PulseContext, PulseParallelEffect } from '@pulse-compute/runtime';
|
|
2
|
+
export type AssetLookupMethod = 'GET' | 'HEAD';
|
|
3
|
+
export type AssetLookupOptions = {
|
|
4
|
+
readonly method?: AssetLookupMethod | undefined;
|
|
5
|
+
readonly headers?: HeadersInit | undefined;
|
|
6
|
+
readonly passThroughOn404?: boolean | undefined;
|
|
7
|
+
readonly cacheControl?: string | undefined;
|
|
8
|
+
/** Native lowering payload ownership selector. JavaScript providers may ignore it. */
|
|
9
|
+
readonly payloadMode?: 'text-response-body' | 'stream-pass-through-response' | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type AssetResponseOptions = {
|
|
12
|
+
readonly status?: number | undefined;
|
|
13
|
+
readonly headers?: HeadersInit | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type AssetLookup = Response;
|
|
16
|
+
export type AssetLookupEffect = PulseParallelEffect<AssetLookup>;
|
|
17
|
+
/**
|
|
18
|
+
* Request-bound, provider-owned asset lookup. The explicit context binds the
|
|
19
|
+
* effect to the active Pulse request and makes the value safe for direct await
|
|
20
|
+
* or keyed ctx.parallel({ ... }) execution.
|
|
21
|
+
*/
|
|
22
|
+
export declare function lookup(ctx: PulseContext, store: string, key: string, options?: AssetLookupOptions): AssetLookupEffect;
|
|
23
|
+
/**
|
|
24
|
+
* Pure response adoption/decorating helper. With no overrides, the provider
|
|
25
|
+
* Response is returned by identity so a host-owned stream can pass through.
|
|
26
|
+
*/
|
|
27
|
+
export declare function respond(asset: AssetLookup, options?: AssetResponseOptions): Response;
|
|
28
|
+
export declare const assets: Readonly<{
|
|
29
|
+
lookup: typeof lookup;
|
|
30
|
+
respond: typeof respond;
|
|
31
|
+
}>;
|
|
32
|
+
export default assets;
|
|
33
|
+
//# sourceMappingURL=portable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable.d.ts","sourceRoot":"","sources":["../src/portable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,sFAAsF;IACtF,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,GAAG,8BAA8B,GAAG,SAAS,CAAC;CAC1F,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AACnC,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAqDjE;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,kBAAkB,GAC3B,iBAAiB,CAWnB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,QAAQ,CAmBpF;AAED,eAAO,MAAM,MAAM;;;EAAqC,CAAC;AACzD,eAAe,MAAM,CAAC"}
|
package/dist/portable.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { pulseAssetsRuntime } from './internal/package-runtime.js';
|
|
2
|
+
function requireNonEmpty(label, value) {
|
|
3
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
4
|
+
throw new TypeError(`Pulse ${label} must be a non-empty string.`);
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function normalizedHeaderPairs(headers) {
|
|
9
|
+
if (headers === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
const pairs = [];
|
|
12
|
+
if (Array.isArray(headers)) {
|
|
13
|
+
for (const entry of headers) {
|
|
14
|
+
if (!Array.isArray(entry) || entry.length !== 2) {
|
|
15
|
+
throw new TypeError('Pulse asset headers must be [name, value] pairs.');
|
|
16
|
+
}
|
|
17
|
+
pairs.push(Object.freeze([String(entry[0]), String(entry[1])]));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (headers instanceof Headers) {
|
|
21
|
+
for (const [name, value] of headers.entries())
|
|
22
|
+
pairs.push(Object.freeze([name, value]));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
for (const [name, value] of Object.entries(headers))
|
|
26
|
+
pairs.push(Object.freeze([name, String(value)]));
|
|
27
|
+
}
|
|
28
|
+
return Object.freeze(pairs);
|
|
29
|
+
}
|
|
30
|
+
function normalizeLookupOptions(options) {
|
|
31
|
+
if (options === undefined)
|
|
32
|
+
return Object.freeze({});
|
|
33
|
+
const method = options.method === undefined ? 'GET' : String(options.method).toUpperCase();
|
|
34
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
35
|
+
throw new TypeError('Pulse asset lookup method must be GET or HEAD.');
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
method,
|
|
39
|
+
...(options.headers === undefined ? {} : { headers: normalizedHeaderPairs(options.headers) }),
|
|
40
|
+
...(options.passThroughOn404 === undefined ? {} : { passThroughOn404: Boolean(options.passThroughOn404) }),
|
|
41
|
+
...(options.cacheControl === undefined ? {} : { cacheControl: String(options.cacheControl) }),
|
|
42
|
+
...(options.payloadMode === undefined ? {} : { payloadMode: String(options.payloadMode) }),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function normalizeAssetResult(value) {
|
|
46
|
+
if (!(value instanceof Response)) {
|
|
47
|
+
throw new TypeError('Pulse assets.lookup providers must return a Web Response.');
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
function responseBodyAllowed(status) {
|
|
52
|
+
return status !== 204 && status !== 205 && status !== 304;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Request-bound, provider-owned asset lookup. The explicit context binds the
|
|
56
|
+
* effect to the active Pulse request and makes the value safe for direct await
|
|
57
|
+
* or keyed ctx.parallel({ ... }) execution.
|
|
58
|
+
*/
|
|
59
|
+
export function lookup(ctx, store, key, options) {
|
|
60
|
+
const normalized = normalizeLookupOptions(options);
|
|
61
|
+
return pulseAssetsRuntime.effect(ctx, 'lookup', {
|
|
62
|
+
store: requireNonEmpty('asset store', store),
|
|
63
|
+
key: requireNonEmpty('asset key', key),
|
|
64
|
+
method: normalized.method ?? 'GET',
|
|
65
|
+
...(normalized.headers === undefined ? {} : { headers: normalized.headers }),
|
|
66
|
+
...(normalized.passThroughOn404 === undefined ? {} : { passThroughOn404: normalized.passThroughOn404 }),
|
|
67
|
+
...(normalized.cacheControl === undefined ? {} : { cacheControl: normalized.cacheControl }),
|
|
68
|
+
...(normalized.payloadMode === undefined ? {} : { payloadMode: normalized.payloadMode }),
|
|
69
|
+
}, normalizeAssetResult);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Pure response adoption/decorating helper. With no overrides, the provider
|
|
73
|
+
* Response is returned by identity so a host-owned stream can pass through.
|
|
74
|
+
*/
|
|
75
|
+
export function respond(asset, options) {
|
|
76
|
+
if (!(asset instanceof Response)) {
|
|
77
|
+
throw new TypeError('Pulse assets.respond requires the Response produced by assets.lookup.');
|
|
78
|
+
}
|
|
79
|
+
if (options === undefined || (options.status === undefined && options.headers === undefined))
|
|
80
|
+
return asset;
|
|
81
|
+
const headers = new Headers(asset.headers);
|
|
82
|
+
if (options.headers !== undefined) {
|
|
83
|
+
for (const [name, value] of normalizedHeaderPairs(options.headers) ?? [])
|
|
84
|
+
headers.append(name, value);
|
|
85
|
+
}
|
|
86
|
+
const status = options.status === undefined ? asset.status : Number(options.status);
|
|
87
|
+
if (!Number.isInteger(status) || status < 200 || status > 599) {
|
|
88
|
+
throw new TypeError('Pulse assets.respond status must be an integer from 200 through 599.');
|
|
89
|
+
}
|
|
90
|
+
return new Response(responseBodyAllowed(status) ? asset.body : null, {
|
|
91
|
+
status,
|
|
92
|
+
statusText: asset.statusText,
|
|
93
|
+
headers,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export const assets = Object.freeze({ lookup, respond });
|
|
97
|
+
export default assets;
|
|
98
|
+
//# sourceMappingURL=portable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portable.js","sourceRoot":"","sources":["../src/portable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAqBnE,SAAS,eAAe,CAAC,KAAa,EAAE,K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AAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACzD,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-only documentation for the package-owned PulseWasm compiler builder.
|
|
3
|
+
*
|
|
4
|
+
* Normal @pulse-compute/assets users do not import this module. The CommonJS
|
|
5
|
+
* builder entry lives at ../pulsewasm.compiler.cjs so package-out tooling can
|
|
6
|
+
* load it without adding TypeScript to the runtime dependency graph.
|
|
7
|
+
*/
|
|
8
|
+
export type PulseWasmAssetsCompilerBuilderInput = {
|
|
9
|
+
readonly sourceFile: unknown;
|
|
10
|
+
readonly typescript: unknown;
|
|
11
|
+
readonly manifest: unknown;
|
|
12
|
+
readonly manifestRecords?: readonly unknown[] | undefined;
|
|
13
|
+
readonly libraryContracts?: readonly unknown[] | undefined;
|
|
14
|
+
readonly cwd?: string | undefined;
|
|
15
|
+
readonly workspaceRoot?: string | undefined;
|
|
16
|
+
readonly generatedBy?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type PulseWasmAssetsCompilerBuilderResult = {
|
|
19
|
+
readonly artifact: unknown;
|
|
20
|
+
readonly diagnostics: readonly unknown[];
|
|
21
|
+
readonly unsupported: readonly unknown[];
|
|
22
|
+
readonly entries: readonly unknown[];
|
|
23
|
+
readonly payloadModes: unknown;
|
|
24
|
+
readonly hasErrors: boolean;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=pulsewasm-compiler-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulsewasm-compiler-types.d.ts","sourceRoot":"","sources":["../src/pulsewasm-compiler-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,mCAAmC,GAAG;IAChD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,OAAO,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-only documentation for the package-owned PulseWasm compiler builder.
|
|
3
|
+
*
|
|
4
|
+
* Normal @pulse-compute/assets users do not import this module. The CommonJS
|
|
5
|
+
* builder entry lives at ../pulsewasm.compiler.cjs so package-out tooling can
|
|
6
|
+
* load it without adding TypeScript to the runtime dependency graph.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=pulsewasm-compiler-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulsewasm-compiler-types.js","sourceRoot":"","sources":["../src/pulsewasm-compiler-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PulseWasm lowerable facade for @pulse-compute/assets.
|
|
3
|
+
*
|
|
4
|
+
* This module is the public package-owned lowering facade. PulseWasm compilers may recognize these symbols
|
|
5
|
+
* statically and lower them to the internal `pulse.assets` library contract.
|
|
6
|
+
* They are not a JavaScript asset runtime.
|
|
7
|
+
*/
|
|
8
|
+
export type AssetLookupMethod = 'GET' | 'HEAD';
|
|
9
|
+
export type AssetLookupOptions = {
|
|
10
|
+
readonly method?: AssetLookupMethod | undefined;
|
|
11
|
+
readonly headers?: HeadersInit | undefined;
|
|
12
|
+
readonly passThroughOn404?: boolean | undefined;
|
|
13
|
+
readonly cacheControl?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type AssetLookup = {
|
|
16
|
+
readonly kind: 'pulse.assets.lookup';
|
|
17
|
+
readonly store: string;
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly options?: AssetLookupOptions | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type AssetResponseOptions = {
|
|
22
|
+
readonly status?: number | undefined;
|
|
23
|
+
readonly headers?: HeadersInit | undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare class PulseWasmAssetsLoweringError extends Error {
|
|
26
|
+
constructor(symbol: string);
|
|
27
|
+
}
|
|
28
|
+
export declare function lookup(store: string, key: string, options?: AssetLookupOptions): AssetLookup;
|
|
29
|
+
export declare function respond(asset: AssetLookup, options?: AssetResponseOptions): Response;
|
|
30
|
+
export declare const assets: Readonly<{
|
|
31
|
+
lookup: typeof lookup;
|
|
32
|
+
respond: typeof respond;
|
|
33
|
+
}>;
|
|
34
|
+
export default assets;
|
|
35
|
+
//# sourceMappingURL=pulsewasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulsewasm.d.ts","sourceRoot":"","sources":["../src/pulsewasm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,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