diff --git a/README.md b/README.md index e69de29..07b68e4 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,71 @@ +# Rescript Decode + +Rescript Decode is a sophisticated Visual Studio Code extension meticulously crafted to streamline the process of transforming complex JSON objects into type-safe Rescript data structures. With Rescript Decode, you can effortlessly decode intricate data structures into precise Rescript types, ensuring robust and error-free code. + +## Table of Contents + + +- [Usage](#usage) +- [Installation](#installation) +- [Features](#features) +- [Contributing](#contributing) + + +## Usage + +![Alt Text](./rescript-decode.png) + +For every Rescript type, a conveniently located interface button allows effortless generation of decode functions. A simple click on this button triggers the automatic creation of the function, which is then seamlessly copied to your clipboard for immediate and convenient integration into your codebase. + +- Utilize the `enableDecodeButton` command to activate the decode button, which will be displayed above Rescript types. + +## Installation + +To make the most of this extension, follow these installation steps: + +1. **Clone or Download**: + - Clone or download the extension's source code from the [GitHub repository](https://github.com/dilanbopanna/rescript-decode-vscode). + +2. **Main File and Commands**: + - In the extension's primary file (`execution.js`), two vital commands are available: `enableDecodeButton` and `generateDecode`. +### Generating Decode Functions + +- Upon clicking the decode button, it triggers the `generateDecode` command. +- This command invokes a Rescript function that dynamically generates decode functions for each Rescript type. +- The generated decode function is automatically copied to your clipboard for effortless integration into your codebase. + +## Features + +### 1. **Effortless Decoding** + +Easily decode complex JSON objects into precise Rescript types with just a few clicks. Say goodbye to manual decoding and reduce the risk of runtime errors. + +### 2. **Customizable Decoding Logic** + +Tailor decoding logic to your project's specific requirements. Handle optional and nested fields with ease and create reusable decoders for your data structures. + +### 3. **Seamless Integration** + +Effortlessly integrate the Rescript Decode extension into your existing Rescript projects. Ensure compatibility and consistency across your codebase. + +## Contributing + +I welcome any kind of contributions to make this extension even better. If you'd like to contribute, here's how you can get involved: + +1. **Fork the Repository**: Start by forking this repository to your GitHub account. + +2. **Clone the Repository**: Clone the forked repository to your local development environment. + +3. **Create a Branch**: Create a new branch for your contribution to keep your work isolated. + +4. **Make Changes**: Implement your improvements or fixes, and ensure your code adheres to our coding standards. + +5. **Test Thoroughly**: Test your changes to ensure they work as expected. + +6. **Submit a Pull Request**: When ready, submit a pull request to the main repository, detailing your changes and why they're valuable. + +7. **Collaborate**: Engage in discussions, address feedback, and work collaboratively to refine your contribution. + +By contributing, you help enhance the Rescript Decode extension for the entire community. We appreciate your valuable input and look forward to your contributions! + + diff --git a/lib/bs/.bsdeps b/lib/bs/.bsdeps index e728026..7af422a 100644 --- a/lib/bs/.bsdeps +++ b/lib/bs/.bsdeps @@ -4,4 +4,4 @@ bsconfig.json 0x1.93d1783cp+30 src 0x1.93d17908p+30 === -/Users/bopanna.mj/Code/rescript-decode/node_modules/rescript/darwinarm64/rescript.exe 0x1.93d17c1cp+30 +/Users/bopanna.mj/Code/rescript-decode/node_modules/rescript/darwinarm64/rescript.exe 0x1.93d196ap+30 diff --git a/lib/bs/.compiler.log b/lib/bs/.compiler.log index 9132096..eaa15aa 100644 --- a/lib/bs/.compiler.log +++ b/lib/bs/.compiler.log @@ -1,2 +1,2 @@ -#Start(1693736711537) -#Done(1693736711583) +#Start(1693738408333) +#Done(1693738408333) diff --git a/out/main.js b/out/main.js new file mode 100644 index 0000000..b3956d1 --- /dev/null +++ b/out/main.js @@ -0,0 +1,75 @@ +var y=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var j=y(d=>{"use strict";function tr(e,r){return er||e===e?1:r===r?-1:0}function or(e,r){return e===r?0:er?e:r}function dr(e,r){return e>r?e:r}function _r(e,r){return e>r?e:r}function Y(e,r){return e[1]===r[1]?e[0]===r[0]:!1}function x(e,r){var n=r[0],t=e[0];return t>n?!0:t=r[1]}function pr(e,r){return!Y(e,r)}function gr(e,r){return!x(e,r)}function C(e,r){return e[0]>r[0]?!0:e[0]r[1]}function hr(e,r){return!C(e,r)}function mr(e,r){return x(e,r)?r:e}function wr(e,r){return C(e,r)?e:r}d.int_compare=tr;d.bool_compare=ur;d.float_compare=ir;d.string_compare=or;d.bool_min=cr;d.int_min=fr;d.float_min=ar;d.string_min=lr;d.bool_max=sr;d.int_max=vr;d.float_max=dr;d.string_max=_r;d.i64_eq=Y;d.i64_neq=pr;d.i64_lt=gr;d.i64_gt=C;d.i64_le=hr;d.i64_ge=x;d.i64_min=mr;d.i64_max=wr});var q=y(A=>{"use strict";function Er(e,r,n){for(var t=new Array(n),u=0,i=r;u=e.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};e[r]=n}function Dr(e,r){if(r<0||r>=e.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};return e[r]}function Br(e,r){for(var n=new Array(e),t=0;t=0;--o)n[o+t|0]=e[o+r|0]}function Ir(e){return e.slice(0)}A.dup=Ir;A.sub=Er;A.concat=Ur;A.make=Br;A.make_float=Nr;A.blit=Mr;A.get=Dr;A.set=Or});var z=y(p=>{"use strict";var ee=q();function l(e,r){for(;;){var n=r,t=e,u=t.length,i=u===0?1:u,o=n.length,c=i-o|0;if(c===0)return t.apply(null,n);if(c>=0)return function(f,v){return function(h){return l(f,v.concat([h]))}}(t,n);r=ee.sub(n,i,-c|0),e=t.apply(null,ee.sub(n,0,i))}}function re(e,r){var n=e.length;if(n===1)return e(r);switch(n){case 1:return e(r);case 2:return function(t){return e(r,t)};case 3:return function(t,u){return e(r,t,u)};case 4:return function(t,u,i){return e(r,t,u,i)};case 5:return function(t,u,i,o){return e(r,t,u,i,o)};case 6:return function(t,u,i,o,c){return e(r,t,u,i,o,c)};case 7:return function(t,u,i,o,c,f){return e(r,t,u,i,o,c,f)};default:return l(e,[r])}}function br(e){var r=e.length;return r===1?e:function(n){return re(e,n)}}function ne(e,r,n){var t=e.length;if(t===2)return e(r,n);switch(t){case 1:return l(e(r),[n]);case 2:return e(r,n);case 3:return function(u){return e(r,n,u)};case 4:return function(u,i){return e(r,n,u,i)};case 5:return function(u,i,o){return e(r,n,u,i,o)};case 6:return function(u,i,o,c){return e(r,n,u,i,o,c)};case 7:return function(u,i,o,c,f){return e(r,n,u,i,o,c,f)};default:return l(e,[r,n])}}function kr(e){var r=e.length;return r===2?e:function(n,t){return ne(e,n,t)}}function te(e,r,n,t){var u=e.length;if(u===3)return e(r,n,t);switch(u){case 1:return l(e(r),[n,t]);case 2:return l(e(r,n),[t]);case 3:return e(r,n,t);case 4:return function(i){return e(r,n,t,i)};case 5:return function(i,o){return e(r,n,t,i,o)};case 6:return function(i,o,c){return e(r,n,t,i,o,c)};case 7:return function(i,o,c,f){return e(r,n,t,i,o,c,f)};default:return l(e,[r,n,t])}}function Sr(e){var r=e.length;return r===3?e:function(n,t,u){return te(e,n,t,u)}}function ue(e,r,n,t,u){var i=e.length;if(i===4)return e(r,n,t,u);switch(i){case 1:return l(e(r),[n,t,u]);case 2:return l(e(r,n),[t,u]);case 3:return l(e(r,n,t),[u]);case 4:return e(r,n,t,u);case 5:return function(o){return e(r,n,t,u,o)};case 6:return function(o,c){return e(r,n,t,u,o,c)};case 7:return function(o,c,f){return e(r,n,t,u,o,c,f)};default:return l(e,[r,n,t,u])}}function Fr(e){var r=e.length;return r===4?e:function(n,t,u,i){return ue(e,n,t,u,i)}}function ie(e,r,n,t,u,i){var o=e.length;if(o===5)return e(r,n,t,u,i);switch(o){case 1:return l(e(r),[n,t,u,i]);case 2:return l(e(r,n),[t,u,i]);case 3:return l(e(r,n,t),[u,i]);case 4:return l(e(r,n,t,u),[i]);case 5:return e(r,n,t,u,i);case 6:return function(c){return e(r,n,t,u,i,c)};case 7:return function(c,f){return e(r,n,t,u,i,c,f)};default:return l(e,[r,n,t,u,i])}}function Tr(e){var r=e.length;return r===5?e:function(n,t,u,i,o){return ie(e,n,t,u,i,o)}}function oe(e,r,n,t,u,i,o){var c=e.length;if(c===6)return e(r,n,t,u,i,o);switch(c){case 1:return l(e(r),[n,t,u,i,o]);case 2:return l(e(r,n),[t,u,i,o]);case 3:return l(e(r,n,t),[u,i,o]);case 4:return l(e(r,n,t,u),[i,o]);case 5:return l(e(r,n,t,u,i),[o]);case 6:return e(r,n,t,u,i,o);case 7:return function(f){return e(r,n,t,u,i,o,f)};default:return l(e,[r,n,t,u,i,o])}}function Wr(e){var r=e.length;return r===6?e:function(n,t,u,i,o,c){return oe(e,n,t,u,i,o,c)}}function ce(e,r,n,t,u,i,o,c){var f=e.length;if(f===7)return e(r,n,t,u,i,o,c);switch(f){case 1:return l(e(r),[n,t,u,i,o,c]);case 2:return l(e(r,n),[t,u,i,o,c]);case 3:return l(e(r,n,t),[u,i,o,c]);case 4:return l(e(r,n,t,u),[i,o,c]);case 5:return l(e(r,n,t,u,i),[o,c]);case 6:return l(e(r,n,t,u,i,o),[c]);case 7:return e(r,n,t,u,i,o,c);default:return l(e,[r,n,t,u,i,o,c])}}function Jr(e){var r=e.length;return r===7?e:function(n,t,u,i,o,c,f){return ce(e,n,t,u,i,o,c,f)}}function fe(e,r,n,t,u,i,o,c,f){var v=e.length;if(v===8)return e(r,n,t,u,i,o,c,f);switch(v){case 1:return l(e(r),[n,t,u,i,o,c,f]);case 2:return l(e(r,n),[t,u,i,o,c,f]);case 3:return l(e(r,n,t),[u,i,o,c,f]);case 4:return l(e(r,n,t,u),[i,o,c,f]);case 5:return l(e(r,n,t,u,i),[o,c,f]);case 6:return l(e(r,n,t,u,i,o),[c,f]);case 7:return l(e(r,n,t,u,i,o,c),[f]);default:return l(e,[r,n,t,u,i,o,c,f])}}function Rr(e){var r=e.length;return r===8?e:function(n,t,u,i,o,c,f,v){return fe(e,n,t,u,i,o,c,f,v)}}p.app=l;p._1=re;p.__1=br;p._2=ne;p.__2=kr;p._3=te;p.__3=Sr;p._4=ue;p.__4=Fr;p._5=ie;p.__5=Tr;p._6=oe;p.__6=Wr;p._7=ce;p.__7=Jr;p._8=fe;p.__8=Rr});var ae=y(T=>{"use strict";function xr(e,r){return e===r}var Cr=2147483647,qr=-2147483648;T.equal=xr;T.max=Cr;T.min=qr});var se=y(N=>{"use strict";var B=ae();function zr(e){return Math.ceil(e)}function le(e){return e>B.max?B.max:eB.max?B.max:e{"use strict";function Xr(e){return e.BS_PRIVATE_NESTED_SOME_NONE!==void 0}function W(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Gr(e){if(e!=null)return W(e)}function $r(e){if(e!==void 0)return W(e)}function Kr(e){if(e!==null)return W(e)}function ve(e){if(!(e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return e;var r=e.BS_PRIVATE_NESTED_SOME_NONE;if(r!==0)return{BS_PRIVATE_NESTED_SOME_NONE:r-1|0}}function Hr(e){if(e!==void 0)return ve(e)}function Qr(e){return e!==void 0?e.VAL:e}U.nullable_to_opt=Gr;U.undefined_to_opt=$r;U.null_to_opt=Kr;U.valFromOption=ve;U.some=W;U.isNested=Xr;U.option_get=Hr;U.option_unwrap=Qr});var xe=y(a=>{"use strict";var E=j(),s=z(),Yr=se(),P=Z();function jr(e,r){if(r>=0&&r=0&&r=0&&r=0&&rt?n-t|0:0,i=new Array(u),o=0;o=0;--o)n[o+t|0]=e[o+r|0]}function wn(e,r,n,t,u){var i=e.length,o=n.length,c=r<0?E.int_max(i+r|0,0):r,f=t<0?E.int_max(o+t|0,0):t,v=E.int_min(u,E.int_min(i-c|0,o-f|0));if(f<=c){for(var h=0;h=0;--D)n[D+f|0]=e[D+c|0]}function ge(e,r){for(var n=0,t=e.length;n=0;--u)t=n(t,e[u]);return t}function Sn(e,r,n){return De(e,r,s.__2(n))}function Be(e,r,n,t){for(var u=n,i=E.int_min(e.length,r.length),o=i-1|0;o>=0;--o)u=t(u,e[o],r[o]);return u}function Fn(e,r,n,t){return Be(e,r,n,s.__3(t))}function Ne(e,r,n){for(var t=r,u=0,i=e.length;uu)return 1;if(t{"use strict";var M=z(),w=Z();function Ce(e,r){if(e!==void 0&&r(w.valFromOption(e)))return e}function Vn(e,r){return Ce(e,M.__1(r))}function qe(e,r){if(e!==void 0)return r(w.valFromOption(e))}function Xn(e,r){qe(e,M.__1(r))}function Gn(e){if(e!==void 0)return w.valFromOption(e);throw{RE_EXN_ID:"Not_found",Error:new Error}}function ze(e,r,n){return e!==void 0?n(w.valFromOption(e)):r}function $n(e,r,n){return ze(e,r,M.__1(n))}function Le(e,r){if(e!==void 0)return w.some(r(w.valFromOption(e)))}function Kn(e,r){return Le(e,M.__1(r))}function Ze(e,r){if(e!==void 0)return r(w.valFromOption(e))}function Hn(e,r){return Ze(e,M.__1(r))}function Qn(e,r){return e!==void 0?w.valFromOption(e):r}function Yn(e,r){return e!==void 0?e:r}function jn(e){return e!==void 0}function et(e){return e===void 0}function Pe(e,r,n){return e!==void 0?r!==void 0?n(w.valFromOption(e),w.valFromOption(r)):!1:r===void 0}function rt(e,r,n){return Pe(e,r,M.__2(n))}function Ve(e,r,n){return e!==void 0?r!==void 0?n(w.valFromOption(e),w.valFromOption(r)):1:r!==void 0?-1:0}function nt(e,r,n){return Ve(e,r,M.__2(n))}_.keepU=Ce;_.keep=Vn;_.forEachU=qe;_.forEach=Xn;_.getExn=Gn;_.mapWithDefaultU=ze;_.mapWithDefault=$n;_.mapU=Le;_.map=Kn;_.flatMapU=Ze;_.flatMap=Hn;_.getWithDefault=Qn;_.orElse=Yn;_.isSome=jn;_.isNone=et;_.eqU=Pe;_.eq=rt;_.cmpU=Ve;_.cmp=nt});var er=y(g=>{"use strict";var S=xe(),I=q(),tt=Xe();function ut(e){return e.length>0?e.charAt(0).toLowerCase()+e.slice(1):e}function O(e){return e.length>0?e.charAt(0).toUpperCase()+e.slice(1):e}function R(e,r){var n=new RegExp("(type\\s"+r+`+)\\s[=] +*\\s+({([a-zA-Z0-9_ :., +*\\s<>]+)})+`),t=new RegExp("type\\s+"+r+"+\\s*=\\s*(|[^|]+)"),u=new RegExp("type\\s+"+r+`\\s*=\\s*([A-Z][a-zA-Z0-9()\\s|]+) +`),i=e.match(n);if(i!==null)return[1,I.get(S.keepMap(i,function(f){return f}),2)];var o=e.match(t);if(o===null)return[1,"// Unable to find type"];var c=e.match(u);return c!==null?[0,I.get(S.keepMap(c,function(f){return f}),1)]:[0,"// Unable to find type"]}function Ge(e){return e.startsWith("option")?"None":e.startsWith("array")?"[]":"default"+O(e)}function $e(e){switch(e){case"Js.Json.t":return"Js.Dict.empty()->Js.Json.object_";case"array":case"array":return"[]";case"bool":return"false";case"float":return"0.0";case"int":return"0";case"option":case"option>":case"option>":case"option":case"option":case"option":case"option":return"None";case"string":return'""';default:return Ge(e)}}function $(e){return e.replace(/array<([a-zA-Z\.<>.]+)>/g,"$1").replace(/option<([a-zA-Z\.<>.]+)>/g,"$1")}function Ke(e,r){var n=$(r),t=R(e,n),u=t[1],i=u.replace(/([A-Za-z0-9_^]+)+\s*[:]\s+([a-zA-Z0-9_.<>]+)/g,function(c,f,v,h,D){var k=$e(v);return""+f+" : "+k});if(t[0])return"let default"+O(n)+" = "+i+` + +`;var o=S.get(u.split("|"),1);return o!==void 0?"let default"+O(n)+" = "+o+` +`:""}function K(e){return e.replace(/\|\s\"[A-Z][A-Za-z0-9]+[\(]+[a-zA-Z0-9_]+[\)]+\"\s=>\s([A-Z][A-Za-z0-9]+)[\(]+([a-zA-Z0-9_]+)[\)]+/g,function(r,n,t,u,i){return'| "'+n+'" => get'+O(t)+"() // Call you custom function here"})}function He(e){return e.replace(/(\([a-zA-Z0-9_\",\s]+\))/g,"")}function H(e,r){switch(e){case"Js.Json.t":return'getJsonObjectFromDict(dict, "'+r+'")';case"array":return'getIntArrayFromDict(dict, "'+r+'", [])';case"array":return'getStrArrayFromDict(dict, "'+r+'", [])';case"bool":return'getBool(dict, "'+r+'", false)';case"float":return'getFloat(dict, "'+r+'", 0.0)';case"int":return'getInt(dict, "'+r+'", 0)';case"option":return'getOptionalJsonFromDict(dict, "'+r+'")';case"option>":return'getOptionIntArrayFromDict(dict, "'+r+'")';case"option>":return'getOptionStrArrayFromDict(dict, "'+r+'")';case"option":return'getOptionBool(dict, "'+r+'")';case"option":return'getOptionFloat(dict, "'+r+'")';case"option":return'getOptionInt(dict, "'+r+'")';case"option":return'getOptionString(dict, "'+r+'")';case"string":return'getString(dict, "'+r+'", "")';default:return"||get"+O(r)+'(dict, "'+r+'")**'+e+"**||"}}function Qe(e,r,n,t){var u="let "+e+` = (dict, key) => { + dict + ->Js.Dict.get(key)`,i="->Belt.Option.flatMap(Js.Json.decodeObject)";if(/^option<([a-zA-Z0-9]+)>/.test(r)&&t===1)return""+u+` + `+i+` + ->Belt.Option.map(dict => { +`+n+` + }) +} +`;if(/^option<([a-zA-Z0-9]+)>/.test(r)&&t===0)return""+u+` + ->Belt.Option.flatMap(Js.Json.decodeString) + ->Belt.Option.map(str => { + +`+n+` + }) +} +`;if(/^array<([a-zA-Z0-9.]+)>/.test(r)){var o=!1;return""+u+` + ->Belt.Option.flatMap(Js.Json.decodeArray) + ->Belt.Option.getWithDefault([]) + ->Belt.Array.keepMap(Js.Json.decodeObject) + ->Js.Array2.map(dict => { + `+n+` + })`+(o?"->Some":"")+` +} +`}else return/^option>/.test(r)?"let "+e+` = (dict, key) => { + switch dict->Js.Dict.get(key)->Belt.Option.flatMap(Js.Json.decodeArray) { + | Some(arr) => + arr + `+i+` + ->Js.Array2.map(dict => { + `+n+` + }) + ->Some + | None => None + } +} +`:t===1?""+u+` + `+i+` + ->Belt.Option.map(dict => { + `+n+` + })->Belt.Option.getWithDefault(default`+O(r)+`) +} +`:""+u+` + ->Belt.Option.flatMap(Js.Json.decodeString) + ->Belt.Option.map(str => { + +`+n+` + })->Belt.Option.getWithDefault(default`+O(r)+`) +} +`}function Ye(e,r,n){var t=$(n),u=R(e,t),i=u[1],o=u[0],c;if(o)c=i.replace(/([A-Za-z0-9_^]+)+\s*[:]\s+([a-zA-Z0-9_.<>]+)/g,function(k,b,F,st,vt){var nr=H(F,b);return" "+b+" : "+nr+" "});else{var f=i.split("|"),v=K(f.reduce(function(k,b){var F=b.replace(` +`,"");return k+('| "'+F.trim()+'" => '+F+` +`)},"")),h=tt.getWithDefault(S.get(f,0),"No Default Varient found (Please Provide one)");c=` switch str { + +`+v+` +| _ => `+h+` //Ensure that appropriate default values are provided. + + }`}var D=He(r);return Qe(D,n,c,o)}function je(e,r){for(var n={contents:e},t=e;;){var u=t,i=u.match(/\|\|(.*?)\*\*(.*?)\*\*\|\|/);if(i===null)return n.contents;var o=S.keepMap(i,function(v){return v}),c=Ke(r,I.get(o,2)),f=Ye(r,I.get(o,1),I.get(o,2));n.contents=(c+` +`+f+` +`+n.contents).replace(I.get(o,0),I.get(o,1)),t=n.contents}}function it(e,r){var n=R(r,e),t=n[1],u=n[0],i;if(u)i=t.replace(/([A-Za-z0-9_^]+)+\s*[:]\s+([a-zA-Z0-9_.<>]+)/g,function(f,v,h,D,k){var b=H(h,v);return" "+v+" : "+b});else{var o=K(t.split("|").reduce(function(f,v){var h=v.replace(` +`,"");return f+('| "'+h.trim()+'" => '+h+` +`)},""));i=` switch str { + +`+o+` + }`}var c=u?`let itemToObjectMapper = dict => { +`+i+` +} + `:"let get"+O(e)+` = str => { +`+i+` +} + `;return je(c,r)}g.replaceFirstLetterLower=ut;g.replaceFirstLetterUpper=O;g.getRecordType=R;g.defaultUserTypedValue=Ge;g.defaultValueMapper=$e;g.filterTypeName=$;g.getDefaultValue=Ke;g.funcWarning=K;g.getFunctionName=He;g.typeFunctionMapper=H;g.getFuntionStr=Qe;g.getObjectFunction=Ye;g.generateNestedObject=je;g.generateDecode=it});var m=require("vscode"),{languages:ot,commands:rr,workspace:ct}=m,ft=er(),Q=class{constructor(){this.codeLenses=[],this.regex=/type\s+(\w+)\s+=\s+\{/g,this._onDidChangeCodeLenses=new m.EventEmitter,this.onDidChangeCodeLenses=this._onDidChangeCodeLenses.event,m.workspace.onDidChangeConfiguration(r=>{this._onDidChangeCodeLenses.fire()})}provideCodeLenses(r,n){if(m.workspace.getConfiguration("rescript-decode").get("enableDecodeButton",!0)){this.codeLenses=[];let t=new RegExp(this.regex),u=r.getText(),i;for(;(i=t.exec(u))!==null;){let o=r.lineAt(r.positionAt(i.index).line),c=o.text.indexOf(i[0]),f=new m.Position(o.lineNumber,c),v=r.getWordRangeAtPosition(f,new RegExp(this.regex));v&&this.codeLenses.push(new m.CodeLens(v))}return this.codeLenses}return[]}resolveCodeLens(r,n){if(m.workspace.getConfiguration("rescript-decode").get("enableDecodeButton",!0)){let u=m.window.activeTextEditor.document.lineAt(r.range.start.line).text;return r.command={title:"Generate Decode",tooltip:"Click to generate decode function",command:"rescript-decode.generateDecode",arguments:[u,!1]},r}return null}};function at(e){let r=new Q;ot.registerCodeLensProvider("*",r),rr.registerCommand("rescript-decode.enableDecodeButton",()=>{ct.getConfiguration("rescript-decode").update("enableDecodeButton",!0,!0)}),rr.registerCommand("rescript-decode.generateDecode",n=>{let t=/type\s+(\w+)\s+=/,u=m.window.activeTextEditor;if(!u){m.window.showErrorMessage("No active editor found.");return}let i=n.match(t);if(i){let o=i[1],c=u.document.getText(),f=ft.generateDecode(o,c);m.env.clipboard.writeText(f).then(()=>{m.window.showInformationMessage(`${o} : Generated code copied to clipboard.`)})}else m.window.showErrorMessage("No Type Found")})}function lt(){}module.exports={activate:at,deactivate:lt}; diff --git a/package-lock.json b/package-lock.json index 0e6b78f..9cbc988 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,10 +11,8 @@ "rescript": "^10.1.4" }, "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "16.x", - "@types/vscode": "^1.81.0", "@vscode/test-electron": "^2.3.4", + "esbuild": "^0.19.2", "eslint": "^8.47.0", "glob": "^10.3.3", "mocha": "^10.2.0", @@ -33,6 +31,358 @@ "node": ">=0.10.0" } }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz", + "integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz", + "integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz", + "integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz", + "integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz", + "integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz", + "integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz", + "integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz", + "integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz", + "integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz", + "integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz", + "integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz", + "integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz", + "integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz", + "integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz", + "integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz", + "integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz", + "integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz", + "integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz", + "integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz", + "integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz", + "integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz", + "integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -220,24 +570,6 @@ "node": ">= 6" } }, - "node_modules/@types/mocha": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", - "dev": true - }, - "node_modules/@types/node": { - "version": "16.18.48", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.48.tgz", - "integrity": "sha512-mlaecDKQ7rIZrYD7iiKNdzFb6e/qD5I9U1rAhq+Fd+DWvYVs+G2kv74UFHmSOlg5+i/vF3XxuR522V4u8BqO+Q==", - "dev": true - }, - "node_modules/@types/vscode": { - "version": "1.81.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.81.0.tgz", - "integrity": "sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==", - "dev": true - }, "node_modules/@vscode/test-electron": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.4.tgz", @@ -633,6 +965,43 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "node_modules/esbuild": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz", + "integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.2", + "@esbuild/android-arm64": "0.19.2", + "@esbuild/android-x64": "0.19.2", + "@esbuild/darwin-arm64": "0.19.2", + "@esbuild/darwin-x64": "0.19.2", + "@esbuild/freebsd-arm64": "0.19.2", + "@esbuild/freebsd-x64": "0.19.2", + "@esbuild/linux-arm": "0.19.2", + "@esbuild/linux-arm64": "0.19.2", + "@esbuild/linux-ia32": "0.19.2", + "@esbuild/linux-loong64": "0.19.2", + "@esbuild/linux-mips64el": "0.19.2", + "@esbuild/linux-ppc64": "0.19.2", + "@esbuild/linux-riscv64": "0.19.2", + "@esbuild/linux-s390x": "0.19.2", + "@esbuild/linux-x64": "0.19.2", + "@esbuild/netbsd-x64": "0.19.2", + "@esbuild/openbsd-x64": "0.19.2", + "@esbuild/sunos-x64": "0.19.2", + "@esbuild/win32-arm64": "0.19.2", + "@esbuild/win32-ia32": "0.19.2", + "@esbuild/win32-x64": "0.19.2" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -2313,6 +2682,160 @@ "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", "dev": true }, + "@esbuild/android-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz", + "integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz", + "integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz", + "integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz", + "integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz", + "integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz", + "integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz", + "integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz", + "integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz", + "integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz", + "integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz", + "integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz", + "integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz", + "integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz", + "integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz", + "integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz", + "integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz", + "integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz", + "integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz", + "integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz", + "integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz", + "integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz", + "integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==", + "dev": true, + "optional": true + }, "@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -2444,24 +2967,6 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, - "@types/mocha": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", - "integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==", - "dev": true - }, - "@types/node": { - "version": "16.18.48", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.48.tgz", - "integrity": "sha512-mlaecDKQ7rIZrYD7iiKNdzFb6e/qD5I9U1rAhq+Fd+DWvYVs+G2kv74UFHmSOlg5+i/vF3XxuR522V4u8BqO+Q==", - "dev": true - }, - "@types/vscode": { - "version": "1.81.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.81.0.tgz", - "integrity": "sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==", - "dev": true - }, "@vscode/test-electron": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.4.tgz", @@ -2758,6 +3263,36 @@ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true }, + "esbuild": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz", + "integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==", + "dev": true, + "requires": { + "@esbuild/android-arm": "0.19.2", + "@esbuild/android-arm64": "0.19.2", + "@esbuild/android-x64": "0.19.2", + "@esbuild/darwin-arm64": "0.19.2", + "@esbuild/darwin-x64": "0.19.2", + "@esbuild/freebsd-arm64": "0.19.2", + "@esbuild/freebsd-x64": "0.19.2", + "@esbuild/linux-arm": "0.19.2", + "@esbuild/linux-arm64": "0.19.2", + "@esbuild/linux-ia32": "0.19.2", + "@esbuild/linux-loong64": "0.19.2", + "@esbuild/linux-mips64el": "0.19.2", + "@esbuild/linux-ppc64": "0.19.2", + "@esbuild/linux-riscv64": "0.19.2", + "@esbuild/linux-s390x": "0.19.2", + "@esbuild/linux-x64": "0.19.2", + "@esbuild/netbsd-x64": "0.19.2", + "@esbuild/openbsd-x64": "0.19.2", + "@esbuild/sunos-x64": "0.19.2", + "@esbuild/win32-arm64": "0.19.2", + "@esbuild/win32-ia32": "0.19.2", + "@esbuild/win32-x64": "0.19.2" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", diff --git a/package.json b/package.json index 5c9ebbd..1a9551a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,14 @@ { "name": "rescript-decode", "displayName": "Rescript Decode", - "description": "", + "description": "Precision JSON-to-Rescript type conversion for generating efficient decode functions in Visual Studio Code.", "version": "0.0.1", + "author": "Dilan Bopanna", + "publisher": "dilanBopanna", + "repository": { + "type": "git", + "url": "https://github.com/dilanbopanna/rescript-decode-vscode.git" + }, "engines": { "vscode": "^1.73.0" }, @@ -36,13 +42,16 @@ "test": "node ./test/runTest.js", "re:build": "rescript", "re:clean": "rescript clean", - "re:start": "rescript build -w" + "re:start": "rescript build -w", + "vscode:prepublish": "npm run esbuild-base -- --minify", + "esbuild-base": "esbuild ./extension.js --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node", + "esbuild": "npm run esbuild-base -- --sourcemap", + "esbuild-watch": "npm run esbuild-base -- --sourcemap --watch", + "test-compile": "tsc -p ./" }, "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "16.x", - "@types/vscode": "^1.81.0", "@vscode/test-electron": "^2.3.4", + "esbuild": "^0.19.2", "eslint": "^8.47.0", "glob": "^10.3.3", "mocha": "^10.2.0", diff --git a/rescript-decode.png b/rescript-decode.png new file mode 100644 index 0000000..daf84e9 Binary files /dev/null and b/rescript-decode.png differ