@maravilla-labs/adapter-core 4.1.0 → 4.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAgD5F;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKvF"}
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAwD5F;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKvF"}
package/dist/bundle.js CHANGED
@@ -15,6 +15,13 @@ export async function bundleServerEntry(options) {
15
15
  platform: 'neutral',
16
16
  format: 'esm',
17
17
  target: 'es2022',
18
+ supported: {
19
+ // The Rust runtime loads bundles with `JsRuntime::execute_script()` and
20
+ // wraps them in a classic function. Lower any `import.meta` expression
21
+ // not covered by the explicit defines below so the emitted bundle stays
22
+ // valid script code after wrapping.
23
+ 'import-meta': false,
24
+ },
18
25
  mainFields: ['module', 'main'],
19
26
  conditions: ['worker', 'webworker'],
20
27
  external: [
@@ -26,6 +33,7 @@ export async function bundleServerEntry(options) {
26
33
  'process.env.NODE_ENV': '"production"',
27
34
  // Replace import.meta.* at bundle time since our runtime wraps
28
35
  // bundles in an IIFE (not an ES module), making import.meta illegal.
36
+ 'import.meta.url': '"file:///bundle.js"',
29
37
  'import.meta.env.DEV': 'false',
30
38
  'import.meta.env.PROD': 'true',
31
39
  'import.meta.env.SSR': 'true',
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAsB;IAC5D,MAAM,EACJ,UAAU,EACV,OAAO,EACP,QAAQ,GAAG,EAAE,EACb,MAAM,GAAG,EAAE,EACX,MAAM,GAAG,IAAI,EACb,WAAW,GAAG,KAAK,EACnB,KAAK,GACN,GAAG,OAAO,CAAC;IAEZ,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC;QACjC,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,OAAO;QACP,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC9B,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;QACnC,QAAQ,EAAE;YACR,GAAG,QAAQ;YACX,qBAAqB;SACtB;QACD,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE;YACN,sBAAsB,EAAE,cAAc;YACtC,+DAA+D;YAC/D,qEAAqE;YACrE,qBAAqB,EAAE,OAAO;YAC9B,sBAAsB,EAAE,MAAM;YAC9B,qBAAqB,EAAE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,CAAC;QAC9B,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;QACnC,QAAQ,EAAE;YACR,GAAG,QAAQ;YACX,qBAAqB;SACtB;QACD,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE;YACN,sBAAsB,EAAE,cAAc;YACtC,+DAA+D;YAC/D,qEAAqE;YACrE,iBAAiB,EAAE,qBAAqB;YACxC,qBAAqB,EAAE,OAAO;YAC9B,sBAAsB,EAAE,MAAM;YAC9B,qBAAqB,EAAE,MAAM;YAC7B,iBAAiB,EAAE,WAAW;YAC9B,oCAAoC;YACpC,qBAAqB,EAAE,MAAM;YAC7B,uBAAuB,EAAE,OAAO;YAChC,yCAAyC,EAAE,OAAO;YAClD,GAAG,MAAM;SACV;QACD,MAAM;QACN,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,IAAI;QACf,WAAW;KACZ,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAA2B;IAC7D,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,2uFAoF5B,CAAC"}
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') {
@@ -1 +1 @@
1
- {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoF/B,CAAC"}
1
+ {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkI/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maravilla-labs/adapter-core",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Shared utilities for Maravilla Runtime framework adapters",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",