mq-web 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Takahiro Sato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ <div>
2
+ <a href="https://mqlang.org">Visit the site 🌐</a>
3
+ &mdash;
4
+ <a href="https://mqlang.org/book">Read the book 📖</a>
5
+ &mdash;
6
+ <a href="https://mqlang.org/playground">Playground 🎮</a>
7
+ </div>
8
+
9
+ # mq-web
10
+
11
+ A TypeScript/JavaScript package for running [mq](https://github.com/harehare/mq) (a jq-like command-line tool for Markdown processing) in web environments using WebAssembly.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install mq-web
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```typescript
22
+ import { run, format } from "mq-web";
23
+
24
+ // Transform markdown list style
25
+ const markdown = `- First item
26
+ - Second item
27
+ - Third item`;
28
+
29
+ const result = await run(".[]", markdown, { listStyle: "star" });
30
+ console.log(result);
31
+ // Output:
32
+ // * First item
33
+ // * Second item
34
+ // * Third item
35
+
36
+ // Format mq code
37
+ const formatted = await format("map(to_text)|select(gt(5))");
38
+ console.log(formatted);
39
+ // Output: map(to_text) | select(gt(5))
40
+ ```
41
+
42
+ ## API Reference
43
+
44
+ ### Functions
45
+
46
+ #### `run(code, content, options?)`
47
+
48
+ Run an mq script on markdown content.
49
+
50
+ - `code`: string - The mq script to execute
51
+ - `content`: string - The markdown content to process
52
+ - `options`: Partial<Options> - Processing options
53
+
54
+ Returns: `Promise<string>` - The processed output
55
+
56
+ #### `format(code)`
57
+
58
+ Format mq code.
59
+
60
+ - `code`: string - The mq code to format
61
+
62
+ Returns: `Promise<string>` - The formatted code
63
+
64
+ #### `diagnostics(code)`
65
+
66
+ Get diagnostics for mq code.
67
+
68
+ - `code`: string - The mq code to analyze
69
+
70
+ Returns: `Promise<ReadonlyArray<Diagnostic>>` - Array of diagnostic messages
71
+
72
+ #### `definedValues(code)`
73
+
74
+ Get defined values (functions, selectors, variables) from mq code.
75
+
76
+ - `code`: string - The mq code to analyze
77
+
78
+ Returns: `Promise<ReadonlyArray<DefinedValue>>` - Array of defined values
79
+
80
+ ## Examples
81
+
82
+ ### Extract and Transform Headings
83
+
84
+ ```typescript
85
+ import { run } from "mq-web";
86
+
87
+ const markdown = `# Main Title
88
+ Some content here.
89
+
90
+ ## Section 1
91
+ More content.
92
+
93
+ ### Subsection
94
+ Even more content.`;
95
+
96
+ // Extract all headings
97
+ const headings = await run(".[] | select(.h)", markdown);
98
+ ```
99
+
100
+ ### List Transformations
101
+
102
+ ```typescript
103
+ import { run } from "mq-web";
104
+
105
+ const markdown = `- Apple
106
+ - Banana
107
+ - Cherry`;
108
+
109
+ // Change list style
110
+ const starList = await run(".[]", markdown, { listStyle: "star" });
111
+ // Output: * Apple\n* Banana\n* Cherry
112
+
113
+ // Filter list items
114
+ const filtered = await run('.[] | select(test(to_text(), "^A"))', markdown);
115
+ // Output: - Apple
116
+
117
+ // Transform list items
118
+ const uppercase = await run(".[] | upcase()", markdown);
119
+ // Output: - APPLE\n- BANANA\n- CHERRY
120
+ ```
121
+
122
+ ### Error Handling
123
+
124
+ ```typescript
125
+ import { run, diagnostics } from "mq-web";
126
+
127
+ try {
128
+ const result = await run("invalid syntax", "content");
129
+ } catch (error) {
130
+ console.error("Runtime error:", error.message);
131
+ }
132
+
133
+ // Get detailed diagnostics
134
+ const diags = await diagnostics("invalid syntax");
135
+ diags.forEach((diag) => {
136
+ console.log(`Error at line ${diag.startLine}: ${diag.message}`);
137
+ });
138
+ ```
139
+
140
+ ## License
141
+
142
+ MIT License - see the main [mq](https://github.com/harehare/mq) repository for details.
package/dist/core.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var k=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var J=(e,t)=>()=>(e&&(t=e(e=0)),t);var R=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},G=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C(t))!H.call(e,i)&&i!==n&&k(e,i,{get:()=>t[i],enumerable:!(r=N(t,i))||r.enumerable});return e};var K=e=>G(k({},"__esModule",{value:!0}),e);var $={};R($,{RunOptions:()=>V,default:()=>E,definedValues:()=>te,diagnostics:()=>ee,format:()=>Z,initSync:()=>ie,run:()=>Y});function s(e){return w[e]}function j(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function y(e,t,n){if(n===void 0){let f=O.encode(e),b=t(f.length,1)>>>0;return j().subarray(b,b+f.length).set(f),g=f.length,b}let r=e.length,i=t(r,1)>>>0,a=j(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[i+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),i=n(i,r,r=c+e.length*3,1)>>>0;let f=j().subarray(i+c,i+r),b=Q(e,f);c+=b.written,i=n(i,r,c,1)>>>0}return g=c,i}function _(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==o.memory.buffer)&&(m=new DataView(o.memory.buffer)),m}function u(e){A===w.length&&w.push(w.length+1);let t=A;return A=w[t],w[t]=e,t}function X(e){e<132||(w[e]=A,A=e)}function l(e){let t=s(e);return X(e),t}function D(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=D(e[0]));for(let c=1;c<i;c++)a+=", "+D(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function I(e,t){return e=e>>>0,F.decode(j().subarray(e,e+t))}function M(e){return e==null}function Y(e,t,n){let r,i;try{let p=o.__wbindgen_add_to_stack_pointer(-16),z=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),L=g,q=y(t,o.__wbindgen_export_0,o.__wbindgen_export_1),B=g;o.run(p,z,L,q,B,u(n));var a=_().getInt32(p+4*0,!0),c=_().getInt32(p+4*1,!0),f=_().getInt32(p+4*2,!0),b=_().getInt32(p+4*3,!0),d=a,h=c;if(b)throw d=0,h=0,l(f);return r=d,i=h,I(d,h)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(r,i,1)}}function Z(e){let t,n;try{let d=o.__wbindgen_add_to_stack_pointer(-16),h=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),p=g;o.format(d,h,p);var r=_().getInt32(d+4*0,!0),i=_().getInt32(d+4*1,!0),a=_().getInt32(d+4*2,!0),c=_().getInt32(d+4*3,!0),f=r,b=i;if(c)throw f=0,b=0,l(a);return t=f,n=b,I(f,b)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(t,n,1)}}function ee(e){let t=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),n=g,r=o.diagnostics(t,n);return l(r)}function te(e){try{let i=o.__wbindgen_add_to_stack_pointer(-16),a=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),c=g;o.definedValues(i,a,c);var t=_().getInt32(i+4*0,!0),n=_().getInt32(i+4*1,!0),r=_().getInt32(i+4*2,!0);if(r)throw l(n);return l(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}async function re(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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 n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function U(){let e={};return e.wbg={},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=g;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(t){let n=s(t).buffer;return u(n)},e.wbg.__wbg_entries_3265d4158b33e5dc=function(t){let n=Object.entries(s(t));return u(n)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(t,n){let r=s(t)[n>>>0];return u(r)},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,n){let r=s(t)[s(n)];return u(r)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let n;try{n=s(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let n;try{n=s(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_length_a446193dc22c12f8=function(t){return s(t).length},e.wbg.__wbg_length_e2d2a49132c1b256=function(t){return s(t).length},e.wbg.__wbg_new_405e22f390576ce2=function(){let t=new Object;return u(t)},e.wbg.__wbg_new_78feb108b6472713=function(){let t=new Array;return u(t)},e.wbg.__wbg_new_a12002a7f91c75be=function(t){let n=new Uint8Array(s(t));return u(n)},e.wbg.__wbg_set_37837023f3d740e8=function(t,n,r){s(t)[n>>>0]=l(r)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){s(t)[l(n)]=l(r)},e.wbg.__wbg_set_65595bdd868b3009=function(t,n,r){s(t).set(s(n),r>>>0)},e.wbg.__wbindgen_boolean_get=function(t){let n=s(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_debug_string=function(t,n){let r=D(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=g;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(I(t,n));return u(r)},e.wbg.__wbindgen_in=function(t,n){return s(t)in s(n)},e.wbg.__wbindgen_is_object=function(t){let n=s(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_string=function(t){return typeof s(t)=="string"},e.wbg.__wbindgen_is_undefined=function(t){return s(t)===void 0},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return s(t)==s(n)},e.wbg.__wbindgen_memory=function(){let t=o.memory;return u(t)},e.wbg.__wbindgen_number_get=function(t,n){let r=s(n),i=typeof r=="number"?r:void 0;_().setFloat64(t+8*1,M(i)?0:i,!0),_().setInt32(t+4*0,!M(i),!0)},e.wbg.__wbindgen_number_new=function(t){return u(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=s(t);return u(n)},e.wbg.__wbindgen_object_drop_ref=function(t){l(t)},e.wbg.__wbindgen_string_get=function(t,n){let r=s(n),i=typeof r=="string"?r:void 0;var a=M(i)?0:y(i,o.__wbindgen_export_0,o.__wbindgen_export_1),c=g;_().setInt32(t+4*1,c,!0),_().setInt32(t+4*0,a,!0)},e.wbg.__wbindgen_string_new=function(t,n){let r=I(t,n);return u(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function v(e,t){return o=e.exports,P.__wbindgen_wasm_module=t,m=null,x=null,o}function ie(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=U();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return v(n,e)}async function P(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",oe.url));let t=U();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await re(await e,t);return v(n,r)}var oe,o,w,g,x,O,Q,m,A,F,ne,V,E,T=J(()=>{"use strict";oe={},w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);g=0,x=null;O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Q=typeof O.encodeInto=="function"?function(e,t){return O.encodeInto(e,t)}:function(e,t){let n=O.encode(e);return t.set(n),{read:e.length,written:n.length}};m=null;A=w.length;F=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&F.decode();ne=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>o.__wbg_runoptions_free(e>>>0,1)),V=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ne.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_runoptions_free(t,0)}};E=P});var fe={};R(fe,{definedValues:()=>ae,diagnostics:()=>_e,format:()=>ce,run:()=>se});module.exports=K(fe);T();var S=null;async function W(){return S||(await(async()=>{try{await E();let e=await Promise.resolve().then(()=>(T(),$));S={run:e.run,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),S)}async function se(e,t,n={}){return await(await W()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function ce(e){return await(await W()).format(e)}async function _e(e){return await(await W()).diagnostics(e)}async function ae(e){return await(await W()).definedValues(e)}0&&(module.exports={definedValues,diagnostics,format,run});
@@ -0,0 +1,43 @@
1
+ type DefinedValueType = 'Function' | 'Variable';
2
+
3
+ interface DefinedValue {
4
+ name: string;
5
+ args?: string[];
6
+ doc: string;
7
+ valueType: DefinedValueType;
8
+ }
9
+
10
+ interface Diagnostic {
11
+ startLine: number,
12
+ startColumn: number,
13
+ endLine: number,
14
+ endColumn: number,
15
+ message: string,
16
+ }
17
+
18
+ interface Options {
19
+ isUpdate: boolean,
20
+ inputFormat: 'markdown' | 'text' | 'mdx' | null,
21
+ listStyle: 'dash' | 'plus' | 'star' | null,
22
+ linkTitleStyle: 'double' | 'single' | 'paren' | null,
23
+ linkUrlStyle: 'angle' | 'none' | null,
24
+ }
25
+
26
+ /**
27
+ * Run an mq
28
+ */
29
+ declare function run(code: string, content: string, options?: Partial<Options>): Promise<string>;
30
+ /**
31
+ * Format mq code
32
+ */
33
+ declare function format(code: string): Promise<string>;
34
+ /**
35
+ * Get diagnostics for mq code
36
+ */
37
+ declare function diagnostics(code: string): Promise<ReadonlyArray<Diagnostic>>;
38
+ /**
39
+ * Get defined values from mq code
40
+ */
41
+ declare function definedValues(code: string): Promise<ReadonlyArray<DefinedValue>>;
42
+
43
+ export { definedValues, diagnostics, format, run };
package/dist/core.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ type DefinedValueType = 'Function' | 'Variable';
2
+
3
+ interface DefinedValue {
4
+ name: string;
5
+ args?: string[];
6
+ doc: string;
7
+ valueType: DefinedValueType;
8
+ }
9
+
10
+ interface Diagnostic {
11
+ startLine: number,
12
+ startColumn: number,
13
+ endLine: number,
14
+ endColumn: number,
15
+ message: string,
16
+ }
17
+
18
+ interface Options {
19
+ isUpdate: boolean,
20
+ inputFormat: 'markdown' | 'text' | 'mdx' | null,
21
+ listStyle: 'dash' | 'plus' | 'star' | null,
22
+ linkTitleStyle: 'double' | 'single' | 'paren' | null,
23
+ linkUrlStyle: 'angle' | 'none' | null,
24
+ }
25
+
26
+ /**
27
+ * Run an mq
28
+ */
29
+ declare function run(code: string, content: string, options?: Partial<Options>): Promise<string>;
30
+ /**
31
+ * Format mq code
32
+ */
33
+ declare function format(code: string): Promise<string>;
34
+ /**
35
+ * Get diagnostics for mq code
36
+ */
37
+ declare function diagnostics(code: string): Promise<ReadonlyArray<Diagnostic>>;
38
+ /**
39
+ * Get defined values from mq code
40
+ */
41
+ declare function definedValues(code: string): Promise<ReadonlyArray<DefinedValue>>;
42
+
43
+ export { definedValues, diagnostics, format, run };
package/dist/core.js ADDED
@@ -0,0 +1,2 @@
1
+ var q=Object.defineProperty;var B=(e,t)=>()=>(e&&(t=e(e=0)),t);var N=(e,t)=>{for(var n in t)q(e,n,{get:t[n],enumerable:!0})};var v={};N(v,{RunOptions:()=>D,default:()=>V,definedValues:()=>Q,diagnostics:()=>K,format:()=>G,initSync:()=>Z,run:()=>J});function s(e){return w[e]}function j(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function y(e,t,n){if(n===void 0){let f=O.encode(e),b=t(f.length,1)>>>0;return j().subarray(b,b+f.length).set(f),g=f.length,b}let r=e.length,i=t(r,1)>>>0,a=j(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[i+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),i=n(i,r,r=c+e.length*3,1)>>>0;let f=j().subarray(i+c,i+r),b=C(e,f);c+=b.written,i=n(i,r,c,1)>>>0}return g=c,i}function _(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==o.memory.buffer)&&(m=new DataView(o.memory.buffer)),m}function u(e){A===w.length&&w.push(w.length+1);let t=A;return A=w[t],w[t]=e,t}function H(e){e<132||(w[e]=A,A=e)}function l(e){let t=s(e);return H(e),t}function M(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=M(e[0]));for(let c=1;c<i;c++)a+=", "+M(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function I(e,t){return e=e>>>0,T.decode(j().subarray(e,e+t))}function k(e){return e==null}function J(e,t,n){let r,i;try{let p=o.__wbindgen_add_to_stack_pointer(-16),P=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),$=g,z=y(t,o.__wbindgen_export_0,o.__wbindgen_export_1),L=g;o.run(p,P,$,z,L,u(n));var a=_().getInt32(p+4*0,!0),c=_().getInt32(p+4*1,!0),f=_().getInt32(p+4*2,!0),b=_().getInt32(p+4*3,!0),d=a,h=c;if(b)throw d=0,h=0,l(f);return r=d,i=h,I(d,h)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(r,i,1)}}function G(e){let t,n;try{let d=o.__wbindgen_add_to_stack_pointer(-16),h=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),p=g;o.format(d,h,p);var r=_().getInt32(d+4*0,!0),i=_().getInt32(d+4*1,!0),a=_().getInt32(d+4*2,!0),c=_().getInt32(d+4*3,!0),f=r,b=i;if(c)throw f=0,b=0,l(a);return t=f,n=b,I(f,b)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(t,n,1)}}function K(e){let t=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),n=g,r=o.diagnostics(t,n);return l(r)}function Q(e){try{let i=o.__wbindgen_add_to_stack_pointer(-16),a=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),c=g;o.definedValues(i,a,c);var t=_().getInt32(i+4*0,!0),n=_().getInt32(i+4*1,!0),r=_().getInt32(i+4*2,!0);if(r)throw l(n);return l(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}async function Y(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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 n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function R(){let e={};return e.wbg={},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=g;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(t){let n=s(t).buffer;return u(n)},e.wbg.__wbg_entries_3265d4158b33e5dc=function(t){let n=Object.entries(s(t));return u(n)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(t,n){let r=s(t)[n>>>0];return u(r)},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,n){let r=s(t)[s(n)];return u(r)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let n;try{n=s(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let n;try{n=s(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_length_a446193dc22c12f8=function(t){return s(t).length},e.wbg.__wbg_length_e2d2a49132c1b256=function(t){return s(t).length},e.wbg.__wbg_new_405e22f390576ce2=function(){let t=new Object;return u(t)},e.wbg.__wbg_new_78feb108b6472713=function(){let t=new Array;return u(t)},e.wbg.__wbg_new_a12002a7f91c75be=function(t){let n=new Uint8Array(s(t));return u(n)},e.wbg.__wbg_set_37837023f3d740e8=function(t,n,r){s(t)[n>>>0]=l(r)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){s(t)[l(n)]=l(r)},e.wbg.__wbg_set_65595bdd868b3009=function(t,n,r){s(t).set(s(n),r>>>0)},e.wbg.__wbindgen_boolean_get=function(t){let n=s(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_debug_string=function(t,n){let r=M(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=g;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(I(t,n));return u(r)},e.wbg.__wbindgen_in=function(t,n){return s(t)in s(n)},e.wbg.__wbindgen_is_object=function(t){let n=s(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_string=function(t){return typeof s(t)=="string"},e.wbg.__wbindgen_is_undefined=function(t){return s(t)===void 0},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return s(t)==s(n)},e.wbg.__wbindgen_memory=function(){let t=o.memory;return u(t)},e.wbg.__wbindgen_number_get=function(t,n){let r=s(n),i=typeof r=="number"?r:void 0;_().setFloat64(t+8*1,k(i)?0:i,!0),_().setInt32(t+4*0,!k(i),!0)},e.wbg.__wbindgen_number_new=function(t){return u(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=s(t);return u(n)},e.wbg.__wbindgen_object_drop_ref=function(t){l(t)},e.wbg.__wbindgen_string_get=function(t,n){let r=s(n),i=typeof r=="string"?r:void 0;var a=k(i)?0:y(i,o.__wbindgen_export_0,o.__wbindgen_export_1),c=g;_().setInt32(t+4*1,c,!0),_().setInt32(t+4*0,a,!0)},e.wbg.__wbindgen_string_new=function(t,n){let r=I(t,n);return u(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function F(e,t){return o=e.exports,U.__wbindgen_wasm_module=t,m=null,x=null,o}function Z(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=R();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return F(n,e)}async function U(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let t=R();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Y(await e,t);return F(n,r)}var o,w,g,x,O,C,m,A,T,X,D,V,E=B(()=>{"use strict";w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);g=0,x=null;O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},C=typeof O.encodeInto=="function"?function(e,t){return O.encodeInto(e,t)}:function(e,t){let n=O.encode(e);return t.set(n),{read:e.length,written:n.length}};m=null;A=w.length;T=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&T.decode();X=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>o.__wbg_runoptions_free(e>>>0,1)),D=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,X.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_runoptions_free(t,0)}};V=U});E();var S=null;async function W(){return S||(await(async()=>{try{await V();let e=await Promise.resolve().then(()=>(E(),v));S={run:e.run,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),S)}async function oe(e,t,n={}){return await(await W()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function se(e){return await(await W()).format(e)}async function ce(e){return await(await W()).diagnostics(e)}async function _e(e){return await(await W()).definedValues(e)}export{_e as definedValues,ce as diagnostics,se as format,oe as run};
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var D=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var X=(e,t)=>()=>(e&&(t=e(e=0)),t);var R=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of K(t))!Q.call(e,i)&&i!==n&&D(e,i,{get:()=>t[i],enumerable:!(r=G(t,i))||r.enumerable});return e};var Z=e=>Y(D({},"__esModule",{value:!0}),e);var $={};R($,{RunOptions:()=>M,default:()=>T,definedValues:()=>oe,diagnostics:()=>ie,format:()=>re,initSync:()=>_e,run:()=>ne});function s(e){return w[e]}function j(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function y(e,t,n){if(n===void 0){let f=O.encode(e),g=t(f.length,1)>>>0;return j().subarray(g,g+f.length).set(f),b=f.length,g}let r=e.length,i=t(r,1)>>>0,a=j(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[i+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),i=n(i,r,r=c+e.length*3,1)>>>0;let f=j().subarray(i+c,i+r),g=ee(e,f);c+=g.written,i=n(i,r,c,1)>>>0}return b=c,i}function _(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==o.memory.buffer)&&(m=new DataView(o.memory.buffer)),m}function u(e){A===w.length&&w.push(w.length+1);let t=A;return A=w[t],w[t]=e,t}function te(e){e<132||(w[e]=A,A=e)}function l(e){let t=s(e);return te(e),t}function k(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=k(e[0]));for(let c=1;c<i;c++)a+=", "+k(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function I(e,t){return e=e>>>0,F.decode(j().subarray(e,e+t))}function V(e){return e==null}function ne(e,t,n){let r,i;try{let p=o.__wbindgen_add_to_stack_pointer(-16),N=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),C=b,H=y(t,o.__wbindgen_export_0,o.__wbindgen_export_1),J=b;o.run(p,N,C,H,J,u(n));var a=_().getInt32(p+4*0,!0),c=_().getInt32(p+4*1,!0),f=_().getInt32(p+4*2,!0),g=_().getInt32(p+4*3,!0),d=a,h=c;if(g)throw d=0,h=0,l(f);return r=d,i=h,I(d,h)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(r,i,1)}}function re(e){let t,n;try{let d=o.__wbindgen_add_to_stack_pointer(-16),h=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),p=b;o.format(d,h,p);var r=_().getInt32(d+4*0,!0),i=_().getInt32(d+4*1,!0),a=_().getInt32(d+4*2,!0),c=_().getInt32(d+4*3,!0),f=r,g=i;if(c)throw f=0,g=0,l(a);return t=f,n=g,I(f,g)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(t,n,1)}}function ie(e){let t=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),n=b,r=o.diagnostics(t,n);return l(r)}function oe(e){try{let i=o.__wbindgen_add_to_stack_pointer(-16),a=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),c=b;o.definedValues(i,a,c);var t=_().getInt32(i+4*0,!0),n=_().getInt32(i+4*1,!0),r=_().getInt32(i+4*2,!0);if(r)throw l(n);return l(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}async function ce(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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 n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function U(){let e={};return e.wbg={},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=b;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(t){let n=s(t).buffer;return u(n)},e.wbg.__wbg_entries_3265d4158b33e5dc=function(t){let n=Object.entries(s(t));return u(n)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(t,n){let r=s(t)[n>>>0];return u(r)},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,n){let r=s(t)[s(n)];return u(r)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let n;try{n=s(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let n;try{n=s(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_length_a446193dc22c12f8=function(t){return s(t).length},e.wbg.__wbg_length_e2d2a49132c1b256=function(t){return s(t).length},e.wbg.__wbg_new_405e22f390576ce2=function(){let t=new Object;return u(t)},e.wbg.__wbg_new_78feb108b6472713=function(){let t=new Array;return u(t)},e.wbg.__wbg_new_a12002a7f91c75be=function(t){let n=new Uint8Array(s(t));return u(n)},e.wbg.__wbg_set_37837023f3d740e8=function(t,n,r){s(t)[n>>>0]=l(r)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){s(t)[l(n)]=l(r)},e.wbg.__wbg_set_65595bdd868b3009=function(t,n,r){s(t).set(s(n),r>>>0)},e.wbg.__wbindgen_boolean_get=function(t){let n=s(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_debug_string=function(t,n){let r=k(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=b;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(I(t,n));return u(r)},e.wbg.__wbindgen_in=function(t,n){return s(t)in s(n)},e.wbg.__wbindgen_is_object=function(t){let n=s(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_string=function(t){return typeof s(t)=="string"},e.wbg.__wbindgen_is_undefined=function(t){return s(t)===void 0},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return s(t)==s(n)},e.wbg.__wbindgen_memory=function(){let t=o.memory;return u(t)},e.wbg.__wbindgen_number_get=function(t,n){let r=s(n),i=typeof r=="number"?r:void 0;_().setFloat64(t+8*1,V(i)?0:i,!0),_().setInt32(t+4*0,!V(i),!0)},e.wbg.__wbindgen_number_new=function(t){return u(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=s(t);return u(n)},e.wbg.__wbindgen_object_drop_ref=function(t){l(t)},e.wbg.__wbindgen_string_get=function(t,n){let r=s(n),i=typeof r=="string"?r:void 0;var a=V(i)?0:y(i,o.__wbindgen_export_0,o.__wbindgen_export_1),c=b;_().setInt32(t+4*1,c,!0),_().setInt32(t+4*0,a,!0)},e.wbg.__wbindgen_string_new=function(t,n){let r=I(t,n);return u(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function v(e,t){return o=e.exports,P.__wbindgen_wasm_module=t,m=null,x=null,o}function _e(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=U();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return v(n,e)}async function P(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",ae.url));let t=U();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ce(await e,t);return v(n,r)}var ae,o,w,b,x,O,ee,m,A,F,se,M,T,E=X(()=>{"use strict";ae={},w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);b=0,x=null;O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ee=typeof O.encodeInto=="function"?function(e,t){return O.encodeInto(e,t)}:function(e,t){let n=O.encode(e);return t.set(n),{read:e.length,written:n.length}};m=null;A=w.length;F=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&F.decode();se=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>o.__wbg_runoptions_free(e>>>0,1)),M=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,se.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_runoptions_free(t,0)}};T=P});var fe={};R(fe,{definedValues:()=>B,diagnostics:()=>L,format:()=>z,run:()=>q});module.exports=Z(fe);E();var S=null;async function W(){return S||(await(async()=>{try{await T();let e=await Promise.resolve().then(()=>(E(),$));S={run:e.run,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),S)}async function q(e,t,n={}){return await(await W()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function z(e){return await(await W()).format(e)}async function L(e){return await(await W()).diagnostics(e)}async function B(e){return await(await W()).definedValues(e)}0&&(module.exports={definedValues,diagnostics,format,run});
@@ -0,0 +1,28 @@
1
+ export { definedValues, diagnostics, format, run } from './core.cjs';
2
+
3
+ type DefinedValueType = 'Function' | 'Variable';
4
+
5
+ interface DefinedValue {
6
+ name: string;
7
+ args?: string[];
8
+ doc: string;
9
+ valueType: DefinedValueType;
10
+ }
11
+
12
+ interface Diagnostic {
13
+ startLine: number,
14
+ startColumn: number,
15
+ endLine: number,
16
+ endColumn: number,
17
+ message: string,
18
+ }
19
+
20
+ interface Options {
21
+ isUpdate: boolean,
22
+ inputFormat: 'markdown' | 'text' | 'mdx' | null,
23
+ listStyle: 'dash' | 'plus' | 'star' | null,
24
+ linkTitleStyle: 'double' | 'single' | 'paren' | null,
25
+ linkUrlStyle: 'angle' | 'none' | null,
26
+ }
27
+
28
+ export type { DefinedValue, DefinedValueType, Diagnostic, Options };
@@ -0,0 +1,28 @@
1
+ export { definedValues, diagnostics, format, run } from './core.js';
2
+
3
+ type DefinedValueType = 'Function' | 'Variable';
4
+
5
+ interface DefinedValue {
6
+ name: string;
7
+ args?: string[];
8
+ doc: string;
9
+ valueType: DefinedValueType;
10
+ }
11
+
12
+ interface Diagnostic {
13
+ startLine: number,
14
+ startColumn: number,
15
+ endLine: number,
16
+ endColumn: number,
17
+ message: string,
18
+ }
19
+
20
+ interface Options {
21
+ isUpdate: boolean,
22
+ inputFormat: 'markdown' | 'text' | 'mdx' | null,
23
+ listStyle: 'dash' | 'plus' | 'star' | null,
24
+ linkTitleStyle: 'double' | 'single' | 'paren' | null,
25
+ linkUrlStyle: 'angle' | 'none' | null,
26
+ }
27
+
28
+ export type { DefinedValue, DefinedValueType, Diagnostic, Options };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ var L=Object.defineProperty;var B=(e,t)=>()=>(e&&(t=e(e=0)),t);var N=(e,t)=>{for(var n in t)L(e,n,{get:t[n],enumerable:!0})};var v={};N(v,{RunOptions:()=>k,default:()=>M,definedValues:()=>Q,diagnostics:()=>K,format:()=>G,initSync:()=>Z,run:()=>J});function s(e){return w[e]}function j(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function y(e,t,n){if(n===void 0){let f=O.encode(e),g=t(f.length,1)>>>0;return j().subarray(g,g+f.length).set(f),b=f.length,g}let r=e.length,i=t(r,1)>>>0,a=j(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[i+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),i=n(i,r,r=c+e.length*3,1)>>>0;let f=j().subarray(i+c,i+r),g=C(e,f);c+=g.written,i=n(i,r,c,1)>>>0}return b=c,i}function _(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==o.memory.buffer)&&(m=new DataView(o.memory.buffer)),m}function u(e){A===w.length&&w.push(w.length+1);let t=A;return A=w[t],w[t]=e,t}function H(e){e<132||(w[e]=A,A=e)}function l(e){let t=s(e);return H(e),t}function V(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=V(e[0]));for(let c=1;c<i;c++)a+=", "+V(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function I(e,t){return e=e>>>0,E.decode(j().subarray(e,e+t))}function D(e){return e==null}function J(e,t,n){let r,i;try{let p=o.__wbindgen_add_to_stack_pointer(-16),P=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),$=b,q=y(t,o.__wbindgen_export_0,o.__wbindgen_export_1),z=b;o.run(p,P,$,q,z,u(n));var a=_().getInt32(p+4*0,!0),c=_().getInt32(p+4*1,!0),f=_().getInt32(p+4*2,!0),g=_().getInt32(p+4*3,!0),d=a,h=c;if(g)throw d=0,h=0,l(f);return r=d,i=h,I(d,h)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(r,i,1)}}function G(e){let t,n;try{let d=o.__wbindgen_add_to_stack_pointer(-16),h=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),p=b;o.format(d,h,p);var r=_().getInt32(d+4*0,!0),i=_().getInt32(d+4*1,!0),a=_().getInt32(d+4*2,!0),c=_().getInt32(d+4*3,!0),f=r,g=i;if(c)throw f=0,g=0,l(a);return t=f,n=g,I(f,g)}finally{o.__wbindgen_add_to_stack_pointer(16),o.__wbindgen_export_2(t,n,1)}}function K(e){let t=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),n=b,r=o.diagnostics(t,n);return l(r)}function Q(e){try{let i=o.__wbindgen_add_to_stack_pointer(-16),a=y(e,o.__wbindgen_export_0,o.__wbindgen_export_1),c=b;o.definedValues(i,a,c);var t=_().getInt32(i+4*0,!0),n=_().getInt32(i+4*1,!0),r=_().getInt32(i+4*2,!0);if(r)throw l(n);return l(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}async function Y(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.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 n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function R(){let e={};return e.wbg={},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=b;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbg_buffer_609cc3eee51ed158=function(t){let n=s(t).buffer;return u(n)},e.wbg.__wbg_entries_3265d4158b33e5dc=function(t){let n=Object.entries(s(t));return u(n)},e.wbg.__wbg_get_b9b93047fe3cf45b=function(t,n){let r=s(t)[n>>>0];return u(r)},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(t,n){let r=s(t)[s(n)];return u(r)},e.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(t){let n;try{n=s(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(t){let n;try{n=s(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_length_a446193dc22c12f8=function(t){return s(t).length},e.wbg.__wbg_length_e2d2a49132c1b256=function(t){return s(t).length},e.wbg.__wbg_new_405e22f390576ce2=function(){let t=new Object;return u(t)},e.wbg.__wbg_new_78feb108b6472713=function(){let t=new Array;return u(t)},e.wbg.__wbg_new_a12002a7f91c75be=function(t){let n=new Uint8Array(s(t));return u(n)},e.wbg.__wbg_set_37837023f3d740e8=function(t,n,r){s(t)[n>>>0]=l(r)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){s(t)[l(n)]=l(r)},e.wbg.__wbg_set_65595bdd868b3009=function(t,n,r){s(t).set(s(n),r>>>0)},e.wbg.__wbindgen_boolean_get=function(t){let n=s(t);return typeof n=="boolean"?n?1:0:2},e.wbg.__wbindgen_debug_string=function(t,n){let r=V(s(n)),i=y(r,o.__wbindgen_export_0,o.__wbindgen_export_1),a=b;_().setInt32(t+4*1,a,!0),_().setInt32(t+4*0,i,!0)},e.wbg.__wbindgen_error_new=function(t,n){let r=new Error(I(t,n));return u(r)},e.wbg.__wbindgen_in=function(t,n){return s(t)in s(n)},e.wbg.__wbindgen_is_object=function(t){let n=s(t);return typeof n=="object"&&n!==null},e.wbg.__wbindgen_is_string=function(t){return typeof s(t)=="string"},e.wbg.__wbindgen_is_undefined=function(t){return s(t)===void 0},e.wbg.__wbindgen_jsval_loose_eq=function(t,n){return s(t)==s(n)},e.wbg.__wbindgen_memory=function(){let t=o.memory;return u(t)},e.wbg.__wbindgen_number_get=function(t,n){let r=s(n),i=typeof r=="number"?r:void 0;_().setFloat64(t+8*1,D(i)?0:i,!0),_().setInt32(t+4*0,!D(i),!0)},e.wbg.__wbindgen_number_new=function(t){return u(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=s(t);return u(n)},e.wbg.__wbindgen_object_drop_ref=function(t){l(t)},e.wbg.__wbindgen_string_get=function(t,n){let r=s(n),i=typeof r=="string"?r:void 0;var a=D(i)?0:y(i,o.__wbindgen_export_0,o.__wbindgen_export_1),c=b;_().setInt32(t+4*1,c,!0),_().setInt32(t+4*0,a,!0)},e.wbg.__wbindgen_string_new=function(t,n){let r=I(t,n);return u(r)},e.wbg.__wbindgen_throw=function(t,n){throw new Error(I(t,n))},e}function F(e,t){return o=e.exports,U.__wbindgen_wasm_module=t,m=null,x=null,o}function Z(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=R();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return F(n,e)}async function U(e){if(o!==void 0)return o;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let t=R();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Y(await e,t);return F(n,r)}var o,w,b,x,O,C,m,A,E,X,k,M,T=B(()=>{"use strict";w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);b=0,x=null;O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},C=typeof O.encodeInto=="function"?function(e,t){return O.encodeInto(e,t)}:function(e,t){let n=O.encode(e);return t.set(n),{read:e.length,written:n.length}};m=null;A=w.length;E=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&E.decode();X=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>o.__wbg_runoptions_free(e>>>0,1)),k=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,X.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_runoptions_free(t,0)}};M=U});T();var S=null;async function W(){return S||(await(async()=>{try{await M();let e=await Promise.resolve().then(()=>(T(),v));S={run:e.run,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),S)}async function ee(e,t,n={}){return await(await W()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function te(e){return await(await W()).format(e)}async function ne(e){return await(await W()).diagnostics(e)}async function re(e){return await(await W()).definedValues(e)}export{re as definedValues,ne as diagnostics,te as format,ee as run};
@@ -0,0 +1,553 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let WASM_VECTOR_LEN = 0;
10
+
11
+ let cachedUint8ArrayMemory0 = null;
12
+
13
+ function getUint8ArrayMemory0() {
14
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
16
+ }
17
+ return cachedUint8ArrayMemory0;
18
+ }
19
+
20
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
21
+
22
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
+ ? function (arg, view) {
24
+ return cachedTextEncoder.encodeInto(arg, view);
25
+ }
26
+ : function (arg, view) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ view.set(buf);
29
+ return {
30
+ read: arg.length,
31
+ written: buf.length
32
+ };
33
+ });
34
+
35
+ function passStringToWasm0(arg, malloc, realloc) {
36
+
37
+ if (realloc === undefined) {
38
+ const buf = cachedTextEncoder.encode(arg);
39
+ const ptr = malloc(buf.length, 1) >>> 0;
40
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
41
+ WASM_VECTOR_LEN = buf.length;
42
+ return ptr;
43
+ }
44
+
45
+ let len = arg.length;
46
+ let ptr = malloc(len, 1) >>> 0;
47
+
48
+ const mem = getUint8ArrayMemory0();
49
+
50
+ let offset = 0;
51
+
52
+ for (; offset < len; offset++) {
53
+ const code = arg.charCodeAt(offset);
54
+ if (code > 0x7F) break;
55
+ mem[ptr + offset] = code;
56
+ }
57
+
58
+ if (offset !== len) {
59
+ if (offset !== 0) {
60
+ arg = arg.slice(offset);
61
+ }
62
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
64
+ const ret = encodeString(arg, view);
65
+
66
+ offset += ret.written;
67
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
68
+ }
69
+
70
+ WASM_VECTOR_LEN = offset;
71
+ return ptr;
72
+ }
73
+
74
+ let cachedDataViewMemory0 = null;
75
+
76
+ function getDataViewMemory0() {
77
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
+ }
80
+ return cachedDataViewMemory0;
81
+ }
82
+
83
+ let heap_next = heap.length;
84
+
85
+ function addHeapObject(obj) {
86
+ if (heap_next === heap.length) heap.push(heap.length + 1);
87
+ const idx = heap_next;
88
+ heap_next = heap[idx];
89
+
90
+ heap[idx] = obj;
91
+ return idx;
92
+ }
93
+
94
+ function dropObject(idx) {
95
+ if (idx < 132) return;
96
+ heap[idx] = heap_next;
97
+ heap_next = idx;
98
+ }
99
+
100
+ function takeObject(idx) {
101
+ const ret = getObject(idx);
102
+ dropObject(idx);
103
+ return ret;
104
+ }
105
+
106
+ function debugString(val) {
107
+ // primitive types
108
+ const type = typeof val;
109
+ if (type == 'number' || type == 'boolean' || val == null) {
110
+ return `${val}`;
111
+ }
112
+ if (type == 'string') {
113
+ return `"${val}"`;
114
+ }
115
+ if (type == 'symbol') {
116
+ const description = val.description;
117
+ if (description == null) {
118
+ return 'Symbol';
119
+ } else {
120
+ return `Symbol(${description})`;
121
+ }
122
+ }
123
+ if (type == 'function') {
124
+ const name = val.name;
125
+ if (typeof name == 'string' && name.length > 0) {
126
+ return `Function(${name})`;
127
+ } else {
128
+ return 'Function';
129
+ }
130
+ }
131
+ // objects
132
+ if (Array.isArray(val)) {
133
+ const length = val.length;
134
+ let debug = '[';
135
+ if (length > 0) {
136
+ debug += debugString(val[0]);
137
+ }
138
+ for(let i = 1; i < length; i++) {
139
+ debug += ', ' + debugString(val[i]);
140
+ }
141
+ debug += ']';
142
+ return debug;
143
+ }
144
+ // Test for built-in
145
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
146
+ let className;
147
+ if (builtInMatches && builtInMatches.length > 1) {
148
+ className = builtInMatches[1];
149
+ } else {
150
+ // Failed to match the standard '[object ClassName]'
151
+ return toString.call(val);
152
+ }
153
+ if (className == 'Object') {
154
+ // we're a user defined class or Object
155
+ // JSON.stringify avoids problems with cycles, and is generally much
156
+ // easier than looping through ownProperties of `val`.
157
+ try {
158
+ return 'Object(' + JSON.stringify(val) + ')';
159
+ } catch (_) {
160
+ return 'Object';
161
+ }
162
+ }
163
+ // errors
164
+ if (val instanceof Error) {
165
+ return `${val.name}: ${val.message}\n${val.stack}`;
166
+ }
167
+ // TODO we could test for more things here, like `Set`s and `Map`s.
168
+ return className;
169
+ }
170
+
171
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
172
+
173
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
174
+
175
+ function getStringFromWasm0(ptr, len) {
176
+ ptr = ptr >>> 0;
177
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
178
+ }
179
+
180
+ function isLikeNone(x) {
181
+ return x === undefined || x === null;
182
+ }
183
+ /**
184
+ * @param {string} code
185
+ * @param {string} content
186
+ * @param {any} options
187
+ * @returns {string}
188
+ */
189
+ export function run(code, content, options) {
190
+ let deferred4_0;
191
+ let deferred4_1;
192
+ try {
193
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
194
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
195
+ const len0 = WASM_VECTOR_LEN;
196
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
197
+ const len1 = WASM_VECTOR_LEN;
198
+ wasm.run(retptr, ptr0, len0, ptr1, len1, addHeapObject(options));
199
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
200
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
201
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
202
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
203
+ var ptr3 = r0;
204
+ var len3 = r1;
205
+ if (r3) {
206
+ ptr3 = 0; len3 = 0;
207
+ throw takeObject(r2);
208
+ }
209
+ deferred4_0 = ptr3;
210
+ deferred4_1 = len3;
211
+ return getStringFromWasm0(ptr3, len3);
212
+ } finally {
213
+ wasm.__wbindgen_add_to_stack_pointer(16);
214
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * @param {string} code
220
+ * @returns {string}
221
+ */
222
+ export function format(code) {
223
+ let deferred3_0;
224
+ let deferred3_1;
225
+ try {
226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
227
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
228
+ const len0 = WASM_VECTOR_LEN;
229
+ wasm.format(retptr, ptr0, len0);
230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
232
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
233
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
234
+ var ptr2 = r0;
235
+ var len2 = r1;
236
+ if (r3) {
237
+ ptr2 = 0; len2 = 0;
238
+ throw takeObject(r2);
239
+ }
240
+ deferred3_0 = ptr2;
241
+ deferred3_1 = len2;
242
+ return getStringFromWasm0(ptr2, len2);
243
+ } finally {
244
+ wasm.__wbindgen_add_to_stack_pointer(16);
245
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
246
+ }
247
+ }
248
+
249
+ /**
250
+ * @param {string} code
251
+ * @returns {any}
252
+ */
253
+ export function diagnostics(code) {
254
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
255
+ const len0 = WASM_VECTOR_LEN;
256
+ const ret = wasm.diagnostics(ptr0, len0);
257
+ return takeObject(ret);
258
+ }
259
+
260
+ /**
261
+ * @param {string} code
262
+ * @returns {any}
263
+ */
264
+ export function definedValues(code) {
265
+ try {
266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
+ const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
268
+ const len0 = WASM_VECTOR_LEN;
269
+ wasm.definedValues(retptr, ptr0, len0);
270
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
271
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
272
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
273
+ if (r2) {
274
+ throw takeObject(r1);
275
+ }
276
+ return takeObject(r0);
277
+ } finally {
278
+ wasm.__wbindgen_add_to_stack_pointer(16);
279
+ }
280
+ }
281
+
282
+ const RunOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
283
+ ? { register: () => {}, unregister: () => {} }
284
+ : new FinalizationRegistry(ptr => wasm.__wbg_runoptions_free(ptr >>> 0, 1));
285
+
286
+ export class RunOptions {
287
+
288
+ __destroy_into_raw() {
289
+ const ptr = this.__wbg_ptr;
290
+ this.__wbg_ptr = 0;
291
+ RunOptionsFinalization.unregister(this);
292
+ return ptr;
293
+ }
294
+
295
+ free() {
296
+ const ptr = this.__destroy_into_raw();
297
+ wasm.__wbg_runoptions_free(ptr, 0);
298
+ }
299
+ }
300
+
301
+ async function __wbg_load(module, imports) {
302
+ if (typeof Response === 'function' && module instanceof Response) {
303
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
304
+ try {
305
+ return await WebAssembly.instantiateStreaming(module, imports);
306
+
307
+ } catch (e) {
308
+ if (module.headers.get('Content-Type') != 'application/wasm') {
309
+ 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", e);
310
+
311
+ } else {
312
+ throw e;
313
+ }
314
+ }
315
+ }
316
+
317
+ const bytes = await module.arrayBuffer();
318
+ return await WebAssembly.instantiate(bytes, imports);
319
+
320
+ } else {
321
+ const instance = await WebAssembly.instantiate(module, imports);
322
+
323
+ if (instance instanceof WebAssembly.Instance) {
324
+ return { instance, module };
325
+
326
+ } else {
327
+ return instance;
328
+ }
329
+ }
330
+ }
331
+
332
+ function __wbg_get_imports() {
333
+ const imports = {};
334
+ imports.wbg = {};
335
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
336
+ const ret = String(getObject(arg1));
337
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
338
+ const len1 = WASM_VECTOR_LEN;
339
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
340
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
341
+ };
342
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
343
+ const ret = getObject(arg0).buffer;
344
+ return addHeapObject(ret);
345
+ };
346
+ imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
347
+ const ret = Object.entries(getObject(arg0));
348
+ return addHeapObject(ret);
349
+ };
350
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
351
+ const ret = getObject(arg0)[arg1 >>> 0];
352
+ return addHeapObject(ret);
353
+ };
354
+ imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
355
+ const ret = getObject(arg0)[getObject(arg1)];
356
+ return addHeapObject(ret);
357
+ };
358
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
359
+ let result;
360
+ try {
361
+ result = getObject(arg0) instanceof ArrayBuffer;
362
+ } catch (_) {
363
+ result = false;
364
+ }
365
+ const ret = result;
366
+ return ret;
367
+ };
368
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
369
+ let result;
370
+ try {
371
+ result = getObject(arg0) instanceof Uint8Array;
372
+ } catch (_) {
373
+ result = false;
374
+ }
375
+ const ret = result;
376
+ return ret;
377
+ };
378
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
379
+ const ret = getObject(arg0).length;
380
+ return ret;
381
+ };
382
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
383
+ const ret = getObject(arg0).length;
384
+ return ret;
385
+ };
386
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
387
+ const ret = new Object();
388
+ return addHeapObject(ret);
389
+ };
390
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
391
+ const ret = new Array();
392
+ return addHeapObject(ret);
393
+ };
394
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
395
+ const ret = new Uint8Array(getObject(arg0));
396
+ return addHeapObject(ret);
397
+ };
398
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
399
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
400
+ };
401
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
402
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
403
+ };
404
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
405
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
406
+ };
407
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
408
+ const v = getObject(arg0);
409
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
410
+ return ret;
411
+ };
412
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
413
+ const ret = debugString(getObject(arg1));
414
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
415
+ const len1 = WASM_VECTOR_LEN;
416
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
417
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
418
+ };
419
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
420
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
421
+ return addHeapObject(ret);
422
+ };
423
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
424
+ const ret = getObject(arg0) in getObject(arg1);
425
+ return ret;
426
+ };
427
+ imports.wbg.__wbindgen_is_object = function(arg0) {
428
+ const val = getObject(arg0);
429
+ const ret = typeof(val) === 'object' && val !== null;
430
+ return ret;
431
+ };
432
+ imports.wbg.__wbindgen_is_string = function(arg0) {
433
+ const ret = typeof(getObject(arg0)) === 'string';
434
+ return ret;
435
+ };
436
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
437
+ const ret = getObject(arg0) === undefined;
438
+ return ret;
439
+ };
440
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
441
+ const ret = getObject(arg0) == getObject(arg1);
442
+ return ret;
443
+ };
444
+ imports.wbg.__wbindgen_memory = function() {
445
+ const ret = wasm.memory;
446
+ return addHeapObject(ret);
447
+ };
448
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
449
+ const obj = getObject(arg1);
450
+ const ret = typeof(obj) === 'number' ? obj : undefined;
451
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
452
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
453
+ };
454
+ imports.wbg.__wbindgen_number_new = function(arg0) {
455
+ const ret = arg0;
456
+ return addHeapObject(ret);
457
+ };
458
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
459
+ const ret = getObject(arg0);
460
+ return addHeapObject(ret);
461
+ };
462
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
463
+ takeObject(arg0);
464
+ };
465
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
466
+ const obj = getObject(arg1);
467
+ const ret = typeof(obj) === 'string' ? obj : undefined;
468
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
469
+ var len1 = WASM_VECTOR_LEN;
470
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
471
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
472
+ };
473
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
474
+ const ret = getStringFromWasm0(arg0, arg1);
475
+ return addHeapObject(ret);
476
+ };
477
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
478
+ throw new Error(getStringFromWasm0(arg0, arg1));
479
+ };
480
+
481
+ return imports;
482
+ }
483
+
484
+ function __wbg_init_memory(imports, memory) {
485
+
486
+ }
487
+
488
+ function __wbg_finalize_init(instance, module) {
489
+ wasm = instance.exports;
490
+ __wbg_init.__wbindgen_wasm_module = module;
491
+ cachedDataViewMemory0 = null;
492
+ cachedUint8ArrayMemory0 = null;
493
+
494
+
495
+
496
+ return wasm;
497
+ }
498
+
499
+ function initSync(module) {
500
+ if (wasm !== undefined) return wasm;
501
+
502
+
503
+ if (typeof module !== 'undefined') {
504
+ if (Object.getPrototypeOf(module) === Object.prototype) {
505
+ ({module} = module)
506
+ } else {
507
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
508
+ }
509
+ }
510
+
511
+ const imports = __wbg_get_imports();
512
+
513
+ __wbg_init_memory(imports);
514
+
515
+ if (!(module instanceof WebAssembly.Module)) {
516
+ module = new WebAssembly.Module(module);
517
+ }
518
+
519
+ const instance = new WebAssembly.Instance(module, imports);
520
+
521
+ return __wbg_finalize_init(instance, module);
522
+ }
523
+
524
+ async function __wbg_init(module_or_path) {
525
+ if (wasm !== undefined) return wasm;
526
+
527
+
528
+ if (typeof module_or_path !== 'undefined') {
529
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
530
+ ({module_or_path} = module_or_path)
531
+ } else {
532
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
533
+ }
534
+ }
535
+
536
+ if (typeof module_or_path === 'undefined') {
537
+ module_or_path = new URL('mq_wasm_bg.wasm', import.meta.url);
538
+ }
539
+ const imports = __wbg_get_imports();
540
+
541
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
542
+ module_or_path = fetch(module_or_path);
543
+ }
544
+
545
+ __wbg_init_memory(imports);
546
+
547
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
548
+
549
+ return __wbg_finalize_init(instance, module);
550
+ }
551
+
552
+ export { initSync };
553
+ export default __wbg_init;
Binary file
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "mq-web",
3
+ "description": "A jq-like command-line tool for Markdown processing",
4
+ "version": "0.1.1",
5
+ "author": "harehare",
6
+ "license": "MIT",
7
+ "bugs": {
8
+ "url": "https://github.com/harehare/mq/issues"
9
+ },
10
+ "devDependencies": {
11
+ "tsup": "^8.0.0",
12
+ "typescript": "^5.0.0"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "homepage": "https://mqlang.org/book/",
18
+ "keywords": [
19
+ "filter",
20
+ "jq",
21
+ "markdown",
22
+ "transform",
23
+ "wasm",
24
+ "webassembly"
25
+ ],
26
+ "main": "dist/index.js",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/harehare/mq.git",
30
+ "directory": "packages/mq-web"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup && rm dist/.gitignore",
34
+ "dev": "tsup --watch",
35
+ "type-check": "tsc --noEmit"
36
+ },
37
+ "sideEffects": false,
38
+ "type": "module",
39
+ "types": "dist/index.d.ts"
40
+ }