@css-inline/css-inline-wasm 0.13.2 → 0.14.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/index.d.ts CHANGED
@@ -19,6 +19,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
19
19
  */
20
20
  export declare const initWasm: (module_or_path: Promise<InitInput> | InitInput) => Promise<void>;
21
21
  export declare function inline(html: string, options?: InlineOptions): string;
22
+ export declare function inlineFragment(html: string, css: string, options?: InlineOptions): string;
22
23
  export declare function version(): string;
23
24
 
24
25
  export {};
package/index.js CHANGED
@@ -22,6 +22,7 @@ var wasm_binding_exports = {};
22
22
  __export(wasm_binding_exports, {
23
23
  initWasm: () => initWasm,
24
24
  inline: () => inline2,
25
+ inlineFragment: () => inlineFragment2,
25
26
  version: () => version2
26
27
  });
27
28
  module.exports = __toCommonJS(wasm_binding_exports);
@@ -33,19 +34,12 @@ heap.push(void 0, null, true, false);
33
34
  function getObject(idx) {
34
35
  return heap[idx];
35
36
  }
36
- var heap_next = heap.length;
37
- function dropObject(idx) {
38
- if (idx < 132)
39
- return;
40
- heap[idx] = heap_next;
41
- heap_next = idx;
42
- }
43
- function takeObject(idx) {
44
- const ret = getObject(idx);
45
- dropObject(idx);
46
- return ret;
37
+ var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
38
+ throw Error("TextDecoder not available");
39
+ } };
40
+ if (typeof TextDecoder !== "undefined") {
41
+ cachedTextDecoder.decode();
47
42
  }
48
- var WASM_VECTOR_LEN = 0;
49
43
  var cachedUint8Memory0 = null;
50
44
  function getUint8Memory0() {
51
45
  if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
@@ -53,6 +47,20 @@ function getUint8Memory0() {
53
47
  }
54
48
  return cachedUint8Memory0;
55
49
  }
50
+ function getStringFromWasm0(ptr, len) {
51
+ ptr = ptr >>> 0;
52
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
53
+ }
54
+ var heap_next = heap.length;
55
+ function addHeapObject(obj) {
56
+ if (heap_next === heap.length)
57
+ heap.push(heap.length + 1);
58
+ const idx = heap_next;
59
+ heap_next = heap[idx];
60
+ heap[idx] = obj;
61
+ return idx;
62
+ }
63
+ var WASM_VECTOR_LEN = 0;
56
64
  var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
57
65
  throw Error("TextEncoder not available");
58
66
  } };
@@ -107,23 +115,16 @@ function getInt32Memory0() {
107
115
  }
108
116
  return cachedInt32Memory0;
109
117
  }
110
- var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
111
- throw Error("TextDecoder not available");
112
- } };
113
- if (typeof TextDecoder !== "undefined") {
114
- cachedTextDecoder.decode();
115
- }
116
- function getStringFromWasm0(ptr, len) {
117
- ptr = ptr >>> 0;
118
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
118
+ function dropObject(idx) {
119
+ if (idx < 132)
120
+ return;
121
+ heap[idx] = heap_next;
122
+ heap_next = idx;
119
123
  }
120
- function addHeapObject(obj) {
121
- if (heap_next === heap.length)
122
- heap.push(heap.length + 1);
123
- const idx = heap_next;
124
- heap_next = heap[idx];
125
- heap[idx] = obj;
126
- return idx;
124
+ function takeObject(idx) {
125
+ const ret = getObject(idx);
126
+ dropObject(idx);
127
+ return ret;
127
128
  }
128
129
  var cachedFloat64Memory0 = null;
129
130
  function getFloat64Memory0() {
@@ -215,6 +216,35 @@ function inline(html, options) {
215
216
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
216
217
  }
217
218
  }
219
+ function inlineFragment(html, css, options) {
220
+ let deferred4_0;
221
+ let deferred4_1;
222
+ try {
223
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
224
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ptr1 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
227
+ const len1 = WASM_VECTOR_LEN;
228
+ wasm.inlineFragment(retptr, ptr0, len0, ptr1, len1, addHeapObject(options));
229
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
230
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
231
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
232
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
233
+ var ptr3 = r0;
234
+ var len3 = r1;
235
+ if (r3) {
236
+ ptr3 = 0;
237
+ len3 = 0;
238
+ throw takeObject(r2);
239
+ }
240
+ deferred4_0 = ptr3;
241
+ deferred4_1 = len3;
242
+ return getStringFromWasm0(ptr3, len3);
243
+ } finally {
244
+ wasm.__wbindgen_add_to_stack_pointer(16);
245
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
246
+ }
247
+ }
218
248
  function version() {
219
249
  let deferred1_0;
220
250
  let deferred1_1;
@@ -262,31 +292,15 @@ function __wbg_get_imports() {
262
292
  const ret = getObject(arg0) === void 0;
263
293
  return ret;
264
294
  };
265
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
266
- takeObject(arg0);
267
- };
268
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
269
- const obj = getObject(arg1);
270
- const ret = typeof obj === "string" ? obj : void 0;
271
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
- var len1 = WASM_VECTOR_LEN;
273
- getInt32Memory0()[arg0 / 4 + 1] = len1;
274
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
275
- };
276
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
277
- const v = getObject(arg0);
278
- const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
279
- return ret;
295
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
296
+ const ret = getStringFromWasm0(arg0, arg1);
297
+ return addHeapObject(ret);
280
298
  };
281
299
  imports.wbg.__wbindgen_is_object = function(arg0) {
282
300
  const val = getObject(arg0);
283
301
  const ret = typeof val === "object" && val !== null;
284
302
  return ret;
285
303
  };
286
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
287
- const ret = getStringFromWasm0(arg0, arg1);
288
- return addHeapObject(ret);
289
- };
290
304
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
291
305
  const ret = getObject(arg0);
292
306
  return addHeapObject(ret);
@@ -307,6 +321,22 @@ function __wbg_get_imports() {
307
321
  const ret = +getObject(arg0);
308
322
  return ret;
309
323
  };
324
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
325
+ const obj = getObject(arg1);
326
+ const ret = typeof obj === "string" ? obj : void 0;
327
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
+ var len1 = WASM_VECTOR_LEN;
329
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
330
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
331
+ };
332
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
333
+ const v = getObject(arg0);
334
+ const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
335
+ return ret;
336
+ };
337
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
338
+ takeObject(arg0);
339
+ };
310
340
  imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
311
341
  const ret = getObject(arg0).length;
312
342
  return ret;
@@ -412,6 +442,9 @@ var initWasm = async (module_or_path) => {
412
442
  function inline2(html, options) {
413
443
  return inline(html, options);
414
444
  }
445
+ function inlineFragment2(html, css, options) {
446
+ return inlineFragment(html, css, options);
447
+ }
415
448
  function version2() {
416
449
  return version();
417
450
  }
package/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var cssInline=(()=>{var S=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var B=(n,e)=>{for(var t in e)S(n,t,{get:e[t],enumerable:!0})},q=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of D(e))!N.call(n,i)&&i!==t&&S(n,i,{get:()=>e[i],enumerable:!(r=$(e,i))||r.enumerable});return n};var z=n=>q(S({},"__esModule",{value:!0}),n);var Y={};B(Y,{initWasm:()=>K,inline:()=>Q,version:()=>X});var c,b=new Array(128).fill(void 0);b.push(void 0,null,!0,!1);function o(n){return b[n]}var m=b.length;function C(n){n<132||(b[n]=m,m=n)}function M(n){let e=o(n);return C(n),e}var h=0,g=null;function A(){return(g===null||g.byteLength===0)&&(g=new Uint8Array(c.memory.buffer)),g}var I=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},P=typeof I.encodeInto=="function"?function(n,e){return I.encodeInto(n,e)}:function(n,e){let t=I.encode(n);return e.set(t),{read:n.length,written:t.length}};function W(n,e,t){if(t===void 0){let _=I.encode(n),a=e(_.length,1)>>>0;return A().subarray(a,a+_.length).set(_),h=_.length,a}let r=n.length,i=e(r,1)>>>0,f=A(),s=0;for(;s<r;s++){let _=n.charCodeAt(s);if(_>127)break;f[i+s]=_}if(s!==r){s!==0&&(n=n.slice(s)),i=t(i,r,r=s+n.length*3,1)>>>0;let _=A().subarray(i+s,i+r),a=P(n,_);s+=a.written,i=t(i,r,s,1)>>>0}return h=s,i}function j(n){return n==null}var w=null;function u(){return(w===null||w.byteLength===0)&&(w=new Int32Array(c.memory.buffer)),w}var O=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&O.decode();function p(n,e){return n=n>>>0,O.decode(A().subarray(n,n+e))}function l(n){m===b.length&&b.push(b.length+1);let e=m;return m=b[e],b[e]=n,e}var y=null;function H(){return(y===null||y.byteLength===0)&&(y=new Float64Array(c.memory.buffer)),y}function E(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){let i=n.length,f="[";i>0&&(f+=E(n[0]));for(let s=1;s<i;s++)f+=", "+E(n[s]);return f+="]",f}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
2
- ${n.stack}`:r}function T(n,e){let t,r;try{let d=c.__wbindgen_add_to_stack_pointer(-16),L=W(n,c.__wbindgen_malloc,c.__wbindgen_realloc),R=h;c.inline(d,L,R,l(e));var i=u()[d/4+0],f=u()[d/4+1],s=u()[d/4+2],_=u()[d/4+3],a=i,x=f;if(_)throw a=0,x=0,M(s);return t=a,r=x,p(a,x)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_free(t,r,1)}}function k(){let n,e;try{let i=c.__wbindgen_add_to_stack_pointer(-16);c.version(i);var t=u()[i/4+0],r=u()[i/4+1];return n=t,e=r,p(t,r)}finally{c.__wbindgen_add_to_stack_pointer(16),c.__wbindgen_free(n,e,1)}}async function J(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function V(){let n={};return n.wbg={},n.wbg.__wbindgen_is_undefined=function(e){return o(e)===void 0},n.wbg.__wbindgen_object_drop_ref=function(e){M(e)},n.wbg.__wbindgen_string_get=function(e,t){let r=o(t),i=typeof r=="string"?r:void 0;var f=j(i)?0:W(i,c.__wbindgen_malloc,c.__wbindgen_realloc),s=h;u()[e/4+1]=s,u()[e/4+0]=f},n.wbg.__wbindgen_boolean_get=function(e){let t=o(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_is_object=function(e){let t=o(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_string_new=function(e,t){let r=p(e,t);return l(r)},n.wbg.__wbindgen_object_clone_ref=function(e){let t=o(e);return l(t)},n.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,t){let r=o(e)[o(t)];return l(r)},n.wbg.__wbindgen_in=function(e,t){return o(e)in o(t)},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(o(e))},n.wbg.__wbindgen_as_number=function(e){return+o(e)},n.wbg.__wbg_length_c20a40f15020d68a=function(e){return o(e).length},n.wbg.__wbindgen_memory=function(){let e=c.memory;return l(e)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){let t=o(e).buffer;return l(t)},n.wbg.__wbg_new_63b92bc8671ed464=function(e){let t=new Uint8Array(o(e));return l(t)},n.wbg.__wbg_set_a47bac70306a19a7=function(e,t,r){o(e).set(o(t),r>>>0)},n.wbg.__wbindgen_error_new=function(e,t){let r=new Error(p(e,t));return l(r)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return o(e)==o(t)},n.wbg.__wbindgen_number_get=function(e,t){let r=o(t),i=typeof r=="number"?r:void 0;H()[e/8+1]=j(i)?0:i,u()[e/4+0]=!j(i)},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let t;try{t=o(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let t;try{t=o(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbindgen_debug_string=function(e,t){let r=E(o(t)),i=W(r,c.__wbindgen_malloc,c.__wbindgen_realloc),f=h;u()[e/4+1]=f,u()[e/4+0]=i},n.wbg.__wbindgen_throw=function(e,t){throw new Error(p(e,t))},n}function G(n,e){return c=n.exports,U.__wbindgen_wasm_module=e,y=null,w=null,g=null,c}async function U(n){if(c!==void 0)return c;typeof n>"u"&&(n=new URL("index_bg.wasm",void 0));let e=V();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await J(await n,e);return G(t,r)}var v=U;var F=!1,K=async n=>{if(F)throw new Error("Already initialized. The `initWasm()` function can be used only once.");await v(await n),F=!0};function Q(n,e){return T(n,e)}function X(){return k()}return z(Y);})();
1
+ "use strict";var cssInline=(()=>{var v=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var P=(n,e)=>{for(var t in e)v(n,t,{get:e[t],enumerable:!0})},H=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of z(e))!C.call(n,i)&&i!==t&&v(n,i,{get:()=>e[i],enumerable:!(r=q(e,i))||r.enumerable});return n};var J=n=>H(v({},"__esModule",{value:!0}),n);var rn={};P(rn,{initWasm:()=>Z,inline:()=>nn,inlineFragment:()=>en,version:()=>tn});var o,d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);function c(n){return d[n]}var M=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&M.decode();var p=null;function S(){return(p===null||p.byteLength===0)&&(p=new Uint8Array(o.memory.buffer)),p}function m(n,e){return n=n>>>0,M.decode(S().subarray(n,n+e))}var x=d.length;function l(n){x===d.length&&d.push(d.length+1);let e=x;return x=d[e],d[e]=n,e}var y=0,j=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},V=typeof j.encodeInto=="function"?function(n,e){return j.encodeInto(n,e)}:function(n,e){let t=j.encode(n);return e.set(t),{read:n.length,written:t.length}};function I(n,e,t){if(t===void 0){let a=j.encode(n),u=e(a.length,1)>>>0;return S().subarray(u,u+a.length).set(a),y=a.length,u}let r=n.length,i=e(r,1)>>>0,f=S(),s=0;for(;s<r;s++){let a=n.charCodeAt(s);if(a>127)break;f[i+s]=a}if(s!==r){s!==0&&(n=n.slice(s)),i=t(i,r,r=s+n.length*3,1)>>>0;let a=S().subarray(i+s,i+r),u=V(n,a);s+=u.written,i=t(i,r,s,1)>>>0}return y=s,i}function O(n){return n==null}var h=null;function _(){return(h===null||h.byteLength===0)&&(h=new Int32Array(o.memory.buffer)),h}function G(n){n<132||(d[n]=x,x=n)}function F(n){let e=c(n);return G(n),e}var A=null;function K(){return(A===null||A.byteLength===0)&&(A=new Float64Array(o.memory.buffer)),A}function E(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let i=n.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=n.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(n)){let i=n.length,f="[";i>0&&(f+=E(n[0]));for(let s=1;s<i;s++)f+=", "+E(n[s]);return f+="]",f}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
2
+ ${n.stack}`:r}function T(n,e){let t,r;try{let b=o.__wbindgen_add_to_stack_pointer(-16),w=I(n,o.__wbindgen_malloc,o.__wbindgen_realloc),W=y;o.inline(b,w,W,l(e));var i=_()[b/4+0],f=_()[b/4+1],s=_()[b/4+2],a=_()[b/4+3],u=i,g=f;if(a)throw u=0,g=0,F(s);return t=u,r=g,m(u,g)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_free(t,r,1)}}function k(n,e,t){let r,i;try{let w=o.__wbindgen_add_to_stack_pointer(-16),W=I(n,o.__wbindgen_malloc,o.__wbindgen_realloc),D=y,N=I(e,o.__wbindgen_malloc,o.__wbindgen_realloc),B=y;o.inlineFragment(w,W,D,N,B,l(t));var f=_()[w/4+0],s=_()[w/4+1],a=_()[w/4+2],u=_()[w/4+3],g=f,b=s;if(u)throw g=0,b=0,F(a);return r=g,i=b,m(g,b)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_free(r,i,1)}}function U(){let n,e;try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.version(i);var t=_()[i/4+0],r=_()[i/4+1];return n=t,e=r,m(t,r)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_free(n,e,1)}}async function Q(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function X(){let n={};return n.wbg={},n.wbg.__wbindgen_is_undefined=function(e){return c(e)===void 0},n.wbg.__wbindgen_string_new=function(e,t){let r=m(e,t);return l(r)},n.wbg.__wbindgen_is_object=function(e){let t=c(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_object_clone_ref=function(e){let t=c(e);return l(t)},n.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,t){let r=c(e)[c(t)];return l(r)},n.wbg.__wbindgen_in=function(e,t){return c(e)in c(t)},n.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2=function(e){return Number.isSafeInteger(c(e))},n.wbg.__wbindgen_as_number=function(e){return+c(e)},n.wbg.__wbindgen_string_get=function(e,t){let r=c(t),i=typeof r=="string"?r:void 0;var f=O(i)?0:I(i,o.__wbindgen_malloc,o.__wbindgen_realloc),s=y;_()[e/4+1]=s,_()[e/4+0]=f},n.wbg.__wbindgen_boolean_get=function(e){let t=c(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_object_drop_ref=function(e){F(e)},n.wbg.__wbg_length_c20a40f15020d68a=function(e){return c(e).length},n.wbg.__wbindgen_memory=function(){let e=o.memory;return l(e)},n.wbg.__wbg_buffer_12d079cc21e14bdb=function(e){let t=c(e).buffer;return l(t)},n.wbg.__wbg_new_63b92bc8671ed464=function(e){let t=new Uint8Array(c(e));return l(t)},n.wbg.__wbg_set_a47bac70306a19a7=function(e,t,r){c(e).set(c(t),r>>>0)},n.wbg.__wbindgen_error_new=function(e,t){let r=new Error(m(e,t));return l(r)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return c(e)==c(t)},n.wbg.__wbindgen_number_get=function(e,t){let r=c(t),i=typeof r=="number"?r:void 0;K()[e/8+1]=O(i)?0:i,_()[e/4+0]=!O(i)},n.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6=function(e){let t;try{t=c(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2=function(e){let t;try{t=c(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbindgen_debug_string=function(e,t){let r=E(c(t)),i=I(r,o.__wbindgen_malloc,o.__wbindgen_realloc),f=y;_()[e/4+1]=f,_()[e/4+0]=i},n.wbg.__wbindgen_throw=function(e,t){throw new Error(m(e,t))},n}function Y(n,e){return o=n.exports,L.__wbindgen_wasm_module=e,A=null,h=null,p=null,o}async function L(n){if(o!==void 0)return o;typeof n>"u"&&(n=new URL("index_bg.wasm",void 0));let e=X();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await Q(await n,e);return Y(t,r)}var R=L;var $=!1,Z=async n=>{if($)throw new Error("Already initialized. The `initWasm()` function can be used only once.");await R(await n),$=!0};function nn(n,e){return T(n,e)}function en(n,e,t){return k(n,e,t)}function tn(){return U()}return J(rn);})();
package/index.mjs CHANGED
@@ -5,19 +5,12 @@ heap.push(void 0, null, true, false);
5
5
  function getObject(idx) {
6
6
  return heap[idx];
7
7
  }
8
- var heap_next = heap.length;
9
- function dropObject(idx) {
10
- if (idx < 132)
11
- return;
12
- heap[idx] = heap_next;
13
- heap_next = idx;
14
- }
15
- function takeObject(idx) {
16
- const ret = getObject(idx);
17
- dropObject(idx);
18
- return ret;
8
+ var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
9
+ throw Error("TextDecoder not available");
10
+ } };
11
+ if (typeof TextDecoder !== "undefined") {
12
+ cachedTextDecoder.decode();
19
13
  }
20
- var WASM_VECTOR_LEN = 0;
21
14
  var cachedUint8Memory0 = null;
22
15
  function getUint8Memory0() {
23
16
  if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
@@ -25,6 +18,20 @@ function getUint8Memory0() {
25
18
  }
26
19
  return cachedUint8Memory0;
27
20
  }
21
+ function getStringFromWasm0(ptr, len) {
22
+ ptr = ptr >>> 0;
23
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
24
+ }
25
+ var heap_next = heap.length;
26
+ function addHeapObject(obj) {
27
+ if (heap_next === heap.length)
28
+ heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+ heap[idx] = obj;
32
+ return idx;
33
+ }
34
+ var WASM_VECTOR_LEN = 0;
28
35
  var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
29
36
  throw Error("TextEncoder not available");
30
37
  } };
@@ -79,23 +86,16 @@ function getInt32Memory0() {
79
86
  }
80
87
  return cachedInt32Memory0;
81
88
  }
82
- var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
83
- throw Error("TextDecoder not available");
84
- } };
85
- if (typeof TextDecoder !== "undefined") {
86
- cachedTextDecoder.decode();
87
- }
88
- function getStringFromWasm0(ptr, len) {
89
- ptr = ptr >>> 0;
90
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
89
+ function dropObject(idx) {
90
+ if (idx < 132)
91
+ return;
92
+ heap[idx] = heap_next;
93
+ heap_next = idx;
91
94
  }
92
- function addHeapObject(obj) {
93
- if (heap_next === heap.length)
94
- heap.push(heap.length + 1);
95
- const idx = heap_next;
96
- heap_next = heap[idx];
97
- heap[idx] = obj;
98
- return idx;
95
+ function takeObject(idx) {
96
+ const ret = getObject(idx);
97
+ dropObject(idx);
98
+ return ret;
99
99
  }
100
100
  var cachedFloat64Memory0 = null;
101
101
  function getFloat64Memory0() {
@@ -187,6 +187,35 @@ function inline(html, options) {
187
187
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
188
188
  }
189
189
  }
190
+ function inlineFragment(html, css, options) {
191
+ let deferred4_0;
192
+ let deferred4_1;
193
+ try {
194
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
195
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
196
+ const len0 = WASM_VECTOR_LEN;
197
+ const ptr1 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
198
+ const len1 = WASM_VECTOR_LEN;
199
+ wasm.inlineFragment(retptr, ptr0, len0, ptr1, len1, addHeapObject(options));
200
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
201
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
202
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
203
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
204
+ var ptr3 = r0;
205
+ var len3 = r1;
206
+ if (r3) {
207
+ ptr3 = 0;
208
+ len3 = 0;
209
+ throw takeObject(r2);
210
+ }
211
+ deferred4_0 = ptr3;
212
+ deferred4_1 = len3;
213
+ return getStringFromWasm0(ptr3, len3);
214
+ } finally {
215
+ wasm.__wbindgen_add_to_stack_pointer(16);
216
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
217
+ }
218
+ }
190
219
  function version() {
191
220
  let deferred1_0;
192
221
  let deferred1_1;
@@ -234,31 +263,15 @@ function __wbg_get_imports() {
234
263
  const ret = getObject(arg0) === void 0;
235
264
  return ret;
236
265
  };
237
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
238
- takeObject(arg0);
239
- };
240
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
241
- const obj = getObject(arg1);
242
- const ret = typeof obj === "string" ? obj : void 0;
243
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
244
- var len1 = WASM_VECTOR_LEN;
245
- getInt32Memory0()[arg0 / 4 + 1] = len1;
246
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
247
- };
248
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
249
- const v = getObject(arg0);
250
- const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
251
- return ret;
266
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
267
+ const ret = getStringFromWasm0(arg0, arg1);
268
+ return addHeapObject(ret);
252
269
  };
253
270
  imports.wbg.__wbindgen_is_object = function(arg0) {
254
271
  const val = getObject(arg0);
255
272
  const ret = typeof val === "object" && val !== null;
256
273
  return ret;
257
274
  };
258
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
259
- const ret = getStringFromWasm0(arg0, arg1);
260
- return addHeapObject(ret);
261
- };
262
275
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
263
276
  const ret = getObject(arg0);
264
277
  return addHeapObject(ret);
@@ -279,6 +292,22 @@ function __wbg_get_imports() {
279
292
  const ret = +getObject(arg0);
280
293
  return ret;
281
294
  };
295
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
296
+ const obj = getObject(arg1);
297
+ const ret = typeof obj === "string" ? obj : void 0;
298
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
+ var len1 = WASM_VECTOR_LEN;
300
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
301
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
302
+ };
303
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
304
+ const v = getObject(arg0);
305
+ const ret = typeof v === "boolean" ? v ? 1 : 0 : 2;
306
+ return ret;
307
+ };
308
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
309
+ takeObject(arg0);
310
+ };
282
311
  imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
283
312
  const ret = getObject(arg0).length;
284
313
  return ret;
@@ -384,11 +413,15 @@ var initWasm = async (module_or_path) => {
384
413
  function inline2(html, options) {
385
414
  return inline(html, options);
386
415
  }
416
+ function inlineFragment2(html, css, options) {
417
+ return inlineFragment(html, css, options);
418
+ }
387
419
  function version2() {
388
420
  return version();
389
421
  }
390
422
  export {
391
423
  initWasm,
392
424
  inline2 as inline,
425
+ inlineFragment2 as inlineFragment,
393
426
  version2 as version
394
427
  };
package/index_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@css-inline/css-inline-wasm",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "description": "High-performance library for inlining CSS into HTML 'style' attributes",
5
5
  "keywords": [
6
6
  "css",