@maravilla-labs/adapter-core 4.1.1 → 4.2.0
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/polyfills.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* All framework adapters should include this at the top of their worker template.
|
|
8
8
|
*/
|
|
9
|
-
export declare const WORKER_POLYFILLS = "// Maravilla Runtime Worker Polyfills\n// Shared across all framework adapters\n\nconst originalFetch = globalThis.fetch;\nconst OriginalRequest = globalThis.Request;\n\nclass EnhancedRequest extends OriginalRequest {\n constructor(input, init) {\n if (typeof input === 'string') {\n try {\n super(input, init);\n } catch (e) {\n if (globalThis.location && e.message && e.message.includes('relative')) {\n try {\n const absoluteUrl = new URL(input, globalThis.location.href);\n super(absoluteUrl.href, init);\n } catch (e2) {\n throw e;\n }\n } else {\n throw e;\n }\n }\n return;\n }\n\n if (input && typeof input === 'object' && !(input instanceof OriginalRequest)) {\n const url = input.url || input.href || input.toString();\n if (!url) {\n throw new TypeError('Request must have a URL');\n }\n const newInit = {\n method: input.method || init?.method || 'GET',\n headers: input.headers || init?.headers,\n body: input.body || init?.body,\n mode: input.mode || init?.mode,\n credentials: input.credentials || init?.credentials,\n cache: input.cache || init?.cache,\n redirect: input.redirect || init?.redirect,\n referrer: input.referrer || init?.referrer,\n referrerPolicy: input.referrerPolicy || init?.referrerPolicy,\n integrity: input.integrity || init?.integrity,\n keepalive: input.keepalive || init?.keepalive,\n signal: input.signal || init?.signal,\n ...init\n };\n super(url, newInit);\n return;\n }\n\n super(input, init);\n }\n}\n\nglobalThis.Request = EnhancedRequest;\n\nglobalThis.fetch = function enhancedFetch(input, init) {\n let request;\n\n if (input instanceof Request) {\n request = input;\n } else if (typeof input === 'string') {\n if (input.startsWith('http://') || input.startsWith('https://')) {\n request = new Request(input, init);\n } else if (globalThis.location) {\n try {\n const absoluteUrl = new URL(input, globalThis.location.href);\n request = new Request(absoluteUrl.href, init);\n } catch (e) {\n console.error('Failed to resolve relative URL:', input, 'against', globalThis.location.href);\n throw e;\n }\n } else {\n console.error('Cannot resolve relative URL without globalThis.location:', input);\n throw new Error('Cannot resolve relative URL without a base URL');\n }\n } else if (input && typeof input === 'object') {\n request = new Request(input, init);\n } else {\n throw new TypeError('First argument must be a string, Request, or URL');\n }\n\n return originalFetch(request);\n};\n";
|
|
9
|
+
export declare const WORKER_POLYFILLS = "// Maravilla Runtime Worker Polyfills\n// Shared across all framework adapters\n\nconst originalFetch = globalThis.fetch;\nconst OriginalRequest = globalThis.Request;\n\nif (typeof globalThis.structuredClone !== 'function') {\n globalThis.structuredClone = function structuredCloneFallback(value) {\n if (value === null || typeof value !== 'object') {\n return value;\n }\n\n if (value instanceof Date) {\n return new Date(value.getTime());\n }\n\n if (value instanceof RegExp) {\n return new RegExp(value.source, value.flags);\n }\n\n if (value instanceof ArrayBuffer) {\n return value.slice(0);\n }\n\n if (ArrayBuffer.isView(value)) {\n return new value.constructor(value);\n }\n\n if (value instanceof Map) {\n return new Map(Array.from(value, ([key, entryValue]) => [\n globalThis.structuredClone(key),\n globalThis.structuredClone(entryValue)\n ]));\n }\n\n if (value instanceof Set) {\n return new Set(Array.from(value, (entryValue) => globalThis.structuredClone(entryValue)));\n }\n\n if (Array.isArray(value)) {\n return value.map((entryValue) => globalThis.structuredClone(entryValue));\n }\n\n return Object.fromEntries(\n Object.entries(value).map(([key, entryValue]) => [\n key,\n globalThis.structuredClone(entryValue)\n ])\n );\n };\n}\n\nclass EnhancedRequest extends OriginalRequest {\n constructor(input, init) {\n if (typeof input === 'string') {\n try {\n super(input, init);\n } catch (e) {\n if (globalThis.location && e.message && e.message.includes('relative')) {\n try {\n const absoluteUrl = new URL(input, globalThis.location.href);\n super(absoluteUrl.href, init);\n } catch (e2) {\n throw e;\n }\n } else {\n throw e;\n }\n }\n return;\n }\n\n if (input && typeof input === 'object' && !(input instanceof OriginalRequest)) {\n const url = input.url || input.href || input.toString();\n if (!url) {\n throw new TypeError('Request must have a URL');\n }\n const newInit = {\n method: input.method || init?.method || 'GET',\n headers: input.headers || init?.headers,\n body: input.body || init?.body,\n mode: input.mode || init?.mode,\n credentials: input.credentials || init?.credentials,\n cache: input.cache || init?.cache,\n redirect: input.redirect || init?.redirect,\n referrer: input.referrer || init?.referrer,\n referrerPolicy: input.referrerPolicy || init?.referrerPolicy,\n integrity: input.integrity || init?.integrity,\n keepalive: input.keepalive || init?.keepalive,\n signal: input.signal || init?.signal,\n ...init\n };\n super(url, newInit);\n return;\n }\n\n super(input, init);\n }\n}\n\nglobalThis.Request = EnhancedRequest;\n\nglobalThis.fetch = function enhancedFetch(input, init) {\n let request;\n\n if (input instanceof Request) {\n request = input;\n } else if (typeof input === 'string') {\n if (input.startsWith('http://') || input.startsWith('https://')) {\n request = new Request(input, init);\n } else if (globalThis.location) {\n try {\n const absoluteUrl = new URL(input, globalThis.location.href);\n request = new Request(absoluteUrl.href, init);\n } catch (e) {\n console.error('Failed to resolve relative URL:', input, 'against', globalThis.location.href);\n throw e;\n }\n } else {\n console.error('Cannot resolve relative URL without globalThis.location:', input);\n throw new Error('Cannot resolve relative URL without a base URL');\n }\n } else if (input && typeof input === 'object') {\n request = new Request(input, init);\n } else {\n throw new TypeError('First argument must be a string, Request, or URL');\n }\n\n return originalFetch(request);\n};\n";
|
|
10
10
|
//# sourceMappingURL=polyfills.d.ts.map
|
package/dist/polyfills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,k7HAkI5B,CAAC"}
|
package/dist/polyfills.js
CHANGED
|
@@ -12,6 +12,52 @@ export const WORKER_POLYFILLS = `// Maravilla Runtime Worker Polyfills
|
|
|
12
12
|
const originalFetch = globalThis.fetch;
|
|
13
13
|
const OriginalRequest = globalThis.Request;
|
|
14
14
|
|
|
15
|
+
if (typeof globalThis.structuredClone !== 'function') {
|
|
16
|
+
globalThis.structuredClone = function structuredCloneFallback(value) {
|
|
17
|
+
if (value === null || typeof value !== 'object') {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (value instanceof Date) {
|
|
22
|
+
return new Date(value.getTime());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (value instanceof RegExp) {
|
|
26
|
+
return new RegExp(value.source, value.flags);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (value instanceof ArrayBuffer) {
|
|
30
|
+
return value.slice(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (ArrayBuffer.isView(value)) {
|
|
34
|
+
return new value.constructor(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (value instanceof Map) {
|
|
38
|
+
return new Map(Array.from(value, ([key, entryValue]) => [
|
|
39
|
+
globalThis.structuredClone(key),
|
|
40
|
+
globalThis.structuredClone(entryValue)
|
|
41
|
+
]));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (value instanceof Set) {
|
|
45
|
+
return new Set(Array.from(value, (entryValue) => globalThis.structuredClone(entryValue)));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
return value.map((entryValue) => globalThis.structuredClone(entryValue));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return Object.fromEntries(
|
|
53
|
+
Object.entries(value).map(([key, entryValue]) => [
|
|
54
|
+
key,
|
|
55
|
+
globalThis.structuredClone(entryValue)
|
|
56
|
+
])
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
15
61
|
class EnhancedRequest extends OriginalRequest {
|
|
16
62
|
constructor(input, init) {
|
|
17
63
|
if (typeof input === 'string') {
|
package/dist/polyfills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkI/B,CAAC"}
|
|
@@ -45,6 +45,10 @@ export interface TransformTranscodeOpts {
|
|
|
45
45
|
max_height?: number;
|
|
46
46
|
audio_codec?: string;
|
|
47
47
|
bitrate_kbps?: number;
|
|
48
|
+
/** Constant output frame rate (fps) — see `@maravilla-labs/platform` `TranscodeOpts.fps`. */
|
|
49
|
+
fps?: number;
|
|
50
|
+
/** A keyframe at least every N ms — `1000` for an edit copy that scrubs fast. */
|
|
51
|
+
keyframe_interval_ms?: number;
|
|
48
52
|
}
|
|
49
53
|
/** Options for `platform.media.transforms.thumbnail`. */
|
|
50
54
|
export interface TransformThumbnailOpts {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transforms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD,4CAA4C;AAC5C,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1D,yDAAyD;AACzD,MAA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