@scalar/snippetz 0.2.19 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients.js +153 -155
- package/dist/clients.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js +44 -59
- package/dist/httpsnippet-lite/esm/helpers/code-builder.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/escape.js +41 -69
- package/dist/httpsnippet-lite/esm/helpers/escape.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js +59 -0
- package/dist/httpsnippet-lite/esm/helpers/form-data.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/headers.js +23 -18
- package/dist/httpsnippet-lite/esm/helpers/headers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/reducer.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/shell.js +13 -16
- package/dist/httpsnippet-lite/esm/helpers/shell.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js +20 -0
- package/dist/httpsnippet-lite/esm/helpers/url.js.map +7 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js +16 -0
- package/dist/httpsnippet-lite/esm/helpers/utils.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js +72 -40
- package/dist/httpsnippet-lite/esm/targets/c/libcurl/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/c/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js +149 -166
- package/dist/httpsnippet-lite/esm/targets/clojure/clj_http/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/clojure/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js +165 -161
- package/dist/httpsnippet-lite/esm/targets/csharp/httpclient/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js +47 -46
- package/dist/httpsnippet-lite/esm/targets/csharp/restsharp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/csharp/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/native/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js +167 -116
- package/dist/httpsnippet-lite/esm/targets/go/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/go/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/asynchttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js +41 -43
- package/dist/httpsnippet-lite/esm/targets/java/nethttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/java/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/java/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js +37 -44
- package/dist/httpsnippet-lite/esm/targets/java/unirest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js +79 -84
- package/dist/httpsnippet-lite/esm/targets/javascript/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js +76 -83
- package/dist/httpsnippet-lite/esm/targets/javascript/jquery/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js +78 -79
- package/dist/httpsnippet-lite/esm/targets/javascript/xhr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js +75 -67
- package/dist/httpsnippet-lite/esm/targets/kotlin/okhttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/kotlin/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js +70 -77
- package/dist/httpsnippet-lite/esm/targets/node/axios/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js +100 -0
- package/dist/httpsnippet-lite/esm/targets/node/request/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js +24 -0
- package/dist/httpsnippet-lite/esm/targets/node/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js +36 -52
- package/dist/httpsnippet-lite/esm/targets/objc/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js +157 -128
- package/dist/httpsnippet-lite/esm/targets/objc/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/objc/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js +50 -65
- package/dist/httpsnippet-lite/esm/targets/ocaml/cohttp/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ocaml/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js +72 -0
- package/dist/httpsnippet-lite/esm/targets/php/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js +85 -0
- package/dist/httpsnippet-lite/esm/targets/php/http1/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js +127 -0
- package/dist/httpsnippet-lite/esm/targets/php/http2/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js +22 -0
- package/dist/httpsnippet-lite/esm/targets/php/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js +61 -49
- package/dist/httpsnippet-lite/esm/targets/powershell/common.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/restmethod/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js +18 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js +12 -12
- package/dist/httpsnippet-lite/esm/targets/powershell/webrequest/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js +68 -0
- package/dist/httpsnippet-lite/esm/targets/python/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js +71 -90
- package/dist/httpsnippet-lite/esm/targets/python/python3/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/python/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js +99 -124
- package/dist/httpsnippet-lite/esm/targets/r/httr/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/r/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js +69 -69
- package/dist/httpsnippet-lite/esm/targets/ruby/native/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/ruby/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.d.ts.map +1 -1
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js +106 -113
- package/dist/httpsnippet-lite/esm/targets/shell/httpie/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js +20 -0
- package/dist/httpsnippet-lite/esm/targets/shell/target.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js +42 -51
- package/dist/httpsnippet-lite/esm/targets/shell/wget/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js +51 -67
- package/dist/httpsnippet-lite/esm/targets/swift/helpers.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js +132 -133
- package/dist/httpsnippet-lite/esm/targets/swift/nsurlsession/client.js.map +7 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js +16 -0
- package/dist/httpsnippet-lite/esm/targets/swift/target.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/code-builder.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/escape.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js +28 -0
- package/dist/httpsnippet-lite/types/helpers/form-data.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/headers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/reducer.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/shell.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/url.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js +1 -0
- package/dist/httpsnippet-lite/types/helpers/utils.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js +19 -0
- package/dist/httpsnippet-lite/types/httpsnippet.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/libcurl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/c/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/clj_http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/clojure/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/httpclient/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/restsharp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/csharp/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/http/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/dart/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/go/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/http1.1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/http/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/asynchttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/nethttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/java/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/jquery/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/javascript/xhr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/okhttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/kotlin/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/axios/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/fetch/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/request/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/node/unirest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/objc/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/cohttp/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ocaml/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/guzzle/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http1/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/http2/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/php/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/common.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/restmethod/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/powershell/webrequest/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/python3/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/requests/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/python/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/httr/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/r/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/native/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/ruby/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/curl/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/httpie/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/shell/wget/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/helpers.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/nsurlsession/client.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/swift/target.d.js.map +7 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js +1 -0
- package/dist/httpsnippet-lite/types/targets/targets.d.js.map +7 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +7 -0
- package/dist/plugins/c/libcurl/index.js +2 -1
- package/dist/plugins/c/libcurl/index.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.js +12 -15
- package/dist/plugins/c/libcurl/libcurl.js.map +7 -0
- package/dist/plugins/c/libcurl/libcurl.test.js +208 -0
- package/dist/plugins/c/libcurl/libcurl.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.js +12 -15
- package/dist/plugins/clojure/clj_http/clj_http.js.map +7 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js +151 -0
- package/dist/plugins/clojure/clj_http/clj_http.test.js.map +7 -0
- package/dist/plugins/clojure/clj_http/index.js +2 -1
- package/dist/plugins/clojure/clj_http/index.js.map +7 -0
- package/dist/plugins/csharp/httpclient/httpclient.js +12 -15
- package/dist/plugins/csharp/httpclient/httpclient.js.map +7 -0
- package/dist/plugins/csharp/httpclient/index.js +2 -1
- package/dist/plugins/csharp/httpclient/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/index.js +2 -1
- package/dist/plugins/csharp/restsharp/index.js.map +7 -0
- package/dist/plugins/csharp/restsharp/restsharp.js +12 -15
- package/dist/plugins/csharp/restsharp/restsharp.js.map +7 -0
- package/dist/plugins/dart/http/http.js +92 -96
- package/dist/plugins/dart/http/http.js.map +7 -0
- package/dist/plugins/dart/http/http.test.js +550 -0
- package/dist/plugins/dart/http/http.test.js.map +7 -0
- package/dist/plugins/dart/http/index.js +2 -1
- package/dist/plugins/dart/http/index.js.map +7 -0
- package/dist/plugins/go/native/index.js +2 -1
- package/dist/plugins/go/native/index.js.map +7 -0
- package/dist/plugins/go/native/native.js +12 -15
- package/dist/plugins/go/native/native.js.map +7 -0
- package/dist/plugins/go/native/native.test.js +366 -0
- package/dist/plugins/go/native/native.test.js.map +7 -0
- package/dist/plugins/http/http11/http11.js +84 -104
- package/dist/plugins/http/http11/http11.js.map +7 -0
- package/dist/plugins/http/http11/http11.test.js +175 -0
- package/dist/plugins/http/http11/http11.test.js.map +7 -0
- package/dist/plugins/http/http11/index.js +2 -1
- package/dist/plugins/http/http11/index.js.map +7 -0
- package/dist/plugins/java/asynchttp/asynchttp.js +12 -15
- package/dist/plugins/java/asynchttp/asynchttp.js.map +7 -0
- package/dist/plugins/java/asynchttp/index.js +2 -1
- package/dist/plugins/java/asynchttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/index.js +2 -1
- package/dist/plugins/java/nethttp/index.js.map +7 -0
- package/dist/plugins/java/nethttp/nethttp.js +12 -15
- package/dist/plugins/java/nethttp/nethttp.js.map +7 -0
- package/dist/plugins/java/okhttp/index.js +2 -1
- package/dist/plugins/java/okhttp/index.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.js +12 -15
- package/dist/plugins/java/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/java/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/java/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/java/unirest/index.js +2 -1
- package/dist/plugins/java/unirest/index.js.map +7 -0
- package/dist/plugins/java/unirest/unirest.js +12 -15
- package/dist/plugins/java/unirest/unirest.js.map +7 -0
- package/dist/plugins/js/axios/axios.js +12 -15
- package/dist/plugins/js/axios/axios.js.map +7 -0
- package/dist/plugins/js/axios/index.d.ts +1 -1
- package/dist/plugins/js/axios/index.d.ts.map +1 -1
- package/dist/plugins/js/axios/index.js +5 -1
- package/dist/plugins/js/axios/index.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/js/fetch/fetch.js +67 -60
- package/dist/plugins/js/fetch/fetch.js.map +7 -0
- package/dist/plugins/js/fetch/fetch.test.js +214 -0
- package/dist/plugins/js/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/js/fetch/index.d.ts +1 -1
- package/dist/plugins/js/fetch/index.d.ts.map +1 -1
- package/dist/plugins/js/fetch/index.js +5 -1
- package/dist/plugins/js/fetch/index.js.map +7 -0
- package/dist/plugins/js/jquery/index.js +2 -1
- package/dist/plugins/js/jquery/index.js.map +7 -0
- package/dist/plugins/js/jquery/jquery.js +12 -15
- package/dist/plugins/js/jquery/jquery.js.map +7 -0
- package/dist/plugins/js/ofetch/index.js +2 -1
- package/dist/plugins/js/ofetch/index.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/js/ofetch/ofetch.js +44 -67
- package/dist/plugins/js/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/js/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/js/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/js/xhr/index.js +2 -1
- package/dist/plugins/js/xhr/index.js.map +7 -0
- package/dist/plugins/js/xhr/xhr.js +12 -15
- package/dist/plugins/js/xhr/xhr.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/index.js +2 -1
- package/dist/plugins/kotlin/okhttp/index.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.js +12 -15
- package/dist/plugins/kotlin/okhttp/okhttp.js.map +7 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js +164 -0
- package/dist/plugins/kotlin/okhttp/okhttp.test.js.map +7 -0
- package/dist/plugins/node/axios/axios.js +12 -15
- package/dist/plugins/node/axios/axios.js.map +7 -0
- package/dist/plugins/node/axios/index.js +2 -1
- package/dist/plugins/node/axios/index.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.d.ts.map +1 -1
- package/dist/plugins/node/fetch/fetch.js +73 -59
- package/dist/plugins/node/fetch/fetch.js.map +7 -0
- package/dist/plugins/node/fetch/fetch.test.js +200 -0
- package/dist/plugins/node/fetch/fetch.test.js.map +7 -0
- package/dist/plugins/node/fetch/index.js +2 -1
- package/dist/plugins/node/fetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/index.js +2 -1
- package/dist/plugins/node/ofetch/index.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.d.ts.map +1 -1
- package/dist/plugins/node/ofetch/ofetch.js +44 -67
- package/dist/plugins/node/ofetch/ofetch.js.map +7 -0
- package/dist/plugins/node/ofetch/ofetch.test.js +126 -0
- package/dist/plugins/node/ofetch/ofetch.test.js.map +7 -0
- package/dist/plugins/node/undici/index.js +2 -1
- package/dist/plugins/node/undici/index.js.map +7 -0
- package/dist/plugins/node/undici/undici.d.ts.map +1 -1
- package/dist/plugins/node/undici/undici.js +46 -62
- package/dist/plugins/node/undici/undici.js.map +7 -0
- package/dist/plugins/node/undici/undici.test.js +133 -0
- package/dist/plugins/node/undici/undici.test.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/index.js +2 -1
- package/dist/plugins/objc/nsurlsession/index.js.map +7 -0
- package/dist/plugins/objc/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/objc/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/cohttp.js +12 -15
- package/dist/plugins/ocaml/cohttp/cohttp.js.map +7 -0
- package/dist/plugins/ocaml/cohttp/index.js +2 -1
- package/dist/plugins/ocaml/cohttp/index.js.map +7 -0
- package/dist/plugins/php/curl/curl.js +119 -157
- package/dist/plugins/php/curl/curl.js.map +7 -0
- package/dist/plugins/php/curl/curl.test.js +564 -0
- package/dist/plugins/php/curl/curl.test.js.map +7 -0
- package/dist/plugins/php/curl/index.js +2 -1
- package/dist/plugins/php/curl/index.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.js +115 -148
- package/dist/plugins/php/guzzle/guzzle.js.map +7 -0
- package/dist/plugins/php/guzzle/guzzle.test.js +546 -0
- package/dist/plugins/php/guzzle/guzzle.test.js.map +7 -0
- package/dist/plugins/php/guzzle/index.js +2 -1
- package/dist/plugins/php/guzzle/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/index.js +2 -1
- package/dist/plugins/powershell/restmethod/index.js.map +7 -0
- package/dist/plugins/powershell/restmethod/restmethod.js +12 -15
- package/dist/plugins/powershell/restmethod/restmethod.js.map +7 -0
- package/dist/plugins/powershell/webrequest/index.js +2 -1
- package/dist/plugins/powershell/webrequest/index.js.map +7 -0
- package/dist/plugins/powershell/webrequest/webrequest.js +12 -15
- package/dist/plugins/powershell/webrequest/webrequest.js.map +7 -0
- package/dist/plugins/python/python3/index.js +2 -1
- package/dist/plugins/python/python3/index.js.map +7 -0
- package/dist/plugins/python/python3/python3.js +12 -15
- package/dist/plugins/python/python3/python3.js.map +7 -0
- package/dist/plugins/python/requests/index.js +2 -1
- package/dist/plugins/python/requests/index.js.map +7 -0
- package/dist/plugins/python/requests/requests.d.ts.map +1 -1
- package/dist/plugins/python/requests/requests.js +98 -126
- package/dist/plugins/python/requests/requests.js.map +7 -0
- package/dist/plugins/python/requests/requests.test.js +419 -0
- package/dist/plugins/python/requests/requests.test.js.map +7 -0
- package/dist/plugins/r/httr/httr.js +12 -15
- package/dist/plugins/r/httr/httr.js.map +7 -0
- package/dist/plugins/r/httr/index.js +2 -1
- package/dist/plugins/r/httr/index.js.map +7 -0
- package/dist/plugins/ruby/native/index.js +2 -1
- package/dist/plugins/ruby/native/index.js.map +7 -0
- package/dist/plugins/ruby/native/native.js +12 -15
- package/dist/plugins/ruby/native/native.js.map +7 -0
- package/dist/plugins/ruby/native/native.test.js +240 -0
- package/dist/plugins/ruby/native/native.test.js.map +7 -0
- package/dist/plugins/shell/curl/curl.js +81 -114
- package/dist/plugins/shell/curl/curl.js.map +7 -0
- package/dist/plugins/shell/curl/curl.test.js +427 -0
- package/dist/plugins/shell/curl/curl.test.js.map +7 -0
- package/dist/plugins/shell/curl/index.js +2 -1
- package/dist/plugins/shell/curl/index.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.js +12 -15
- package/dist/plugins/shell/httpie/httpie.js.map +7 -0
- package/dist/plugins/shell/httpie/httpie.test.js +113 -0
- package/dist/plugins/shell/httpie/httpie.test.js.map +7 -0
- package/dist/plugins/shell/httpie/index.js +2 -1
- package/dist/plugins/shell/httpie/index.js.map +7 -0
- package/dist/plugins/shell/wget/index.js +2 -1
- package/dist/plugins/shell/wget/index.js.map +7 -0
- package/dist/plugins/shell/wget/wget.js +12 -15
- package/dist/plugins/shell/wget/wget.js.map +7 -0
- package/dist/plugins/shell/wget/wget.test.js +143 -0
- package/dist/plugins/shell/wget/wget.test.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/index.js +2 -1
- package/dist/plugins/swift/nsurlsession/index.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.js +12 -15
- package/dist/plugins/swift/nsurlsession/nsurlsession.js.map +7 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js +344 -0
- package/dist/plugins/swift/nsurlsession/nsurlsession.test.js.map +7 -0
- package/dist/snippetz.js +27 -27
- package/dist/snippetz.js.map +7 -0
- package/dist/snippetz.test.js +79 -0
- package/dist/snippetz.test.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.js +101 -104
- package/dist/utils/convertWithHttpSnippetLite.js.map +7 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js +106 -0
- package/dist/utils/convertWithHttpSnippetLite.test.js.map +7 -0
- package/dist/utils/create-search-params.d.ts +4 -0
- package/dist/utils/create-search-params.d.ts.map +1 -0
- package/dist/utils/create-search-params.js +11 -0
- package/dist/utils/create-search-params.js.map +7 -0
- package/dist/utils/create-search-params.test.js +49 -0
- package/dist/utils/create-search-params.test.js.map +7 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/needsQuotes.js +5 -8
- package/dist/utils/needsQuotes.js.map +7 -0
- package/dist/utils/objectToString.d.ts +8 -0
- package/dist/utils/objectToString.d.ts.map +1 -1
- package/dist/utils/objectToString.js +48 -54
- package/dist/utils/objectToString.js.map +7 -0
- package/package.json +147 -151
- package/dist/utils/arrayToObject.d.ts +0 -8
- package/dist/utils/arrayToObject.d.ts.map +0 -1
- package/dist/utils/arrayToObject.js +0 -14
package/dist/clients.js
CHANGED
|
@@ -1,157 +1,155 @@
|
|
|
1
|
-
import { cLibcurl } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { jsXhr } from
|
|
17
|
-
import { kotlinOkhttp } from
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { nodeOfetch } from
|
|
21
|
-
import { nodeUndici } from
|
|
22
|
-
import { objcNsurlsession } from
|
|
23
|
-
import { ocamlCohttp } from
|
|
24
|
-
import { phpCurl } from
|
|
25
|
-
import { phpGuzzle } from
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { pythonPython3 } from
|
|
29
|
-
import { pythonRequests } from
|
|
30
|
-
import { rHttr } from
|
|
31
|
-
import { rubyNative } from
|
|
32
|
-
import { shellCurl } from
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { swiftNsurlsession } from
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* All available clients
|
|
39
|
-
*/
|
|
1
|
+
import { cLibcurl } from "./plugins/c/libcurl/libcurl.js";
|
|
2
|
+
import { clojureCljhttp } from "./plugins/clojure/clj_http/index.js";
|
|
3
|
+
import { csharpHttpclient } from "./plugins/csharp/httpclient/index.js";
|
|
4
|
+
import { csharpRestsharp } from "./plugins/csharp/restsharp/index.js";
|
|
5
|
+
import { dartHttp } from "./plugins/dart/http/index.js";
|
|
6
|
+
import { goNative } from "./plugins/go/native/index.js";
|
|
7
|
+
import { httpHttp11 } from "./plugins/http/http11/index.js";
|
|
8
|
+
import { javaAsynchttp } from "./plugins/java/asynchttp/index.js";
|
|
9
|
+
import { javaNethttp } from "./plugins/java/nethttp/nethttp.js";
|
|
10
|
+
import { javaOkhttp } from "./plugins/java/okhttp/okhttp.js";
|
|
11
|
+
import { javaUnirest } from "./plugins/java/unirest/unirest.js";
|
|
12
|
+
import { jsAxios } from "./plugins/js/axios/index.js";
|
|
13
|
+
import { jsFetch } from "./plugins/js/fetch/index.js";
|
|
14
|
+
import { jsJquery } from "./plugins/js/jquery/index.js";
|
|
15
|
+
import { jsOfetch } from "./plugins/js/ofetch/index.js";
|
|
16
|
+
import { jsXhr } from "./plugins/js/xhr/index.js";
|
|
17
|
+
import { kotlinOkhttp } from "./plugins/kotlin/okhttp/index.js";
|
|
18
|
+
import { nodeAxios } from "./plugins/node/axios/index.js";
|
|
19
|
+
import { nodeFetch } from "./plugins/node/fetch/index.js";
|
|
20
|
+
import { nodeOfetch } from "./plugins/node/ofetch/index.js";
|
|
21
|
+
import { nodeUndici } from "./plugins/node/undici/index.js";
|
|
22
|
+
import { objcNsurlsession } from "./plugins/objc/nsurlsession/index.js";
|
|
23
|
+
import { ocamlCohttp } from "./plugins/ocaml/cohttp/index.js";
|
|
24
|
+
import { phpCurl } from "./plugins/php/curl/index.js";
|
|
25
|
+
import { phpGuzzle } from "./plugins/php/guzzle/index.js";
|
|
26
|
+
import { powershellRestmethod } from "./plugins/powershell/restmethod/index.js";
|
|
27
|
+
import { powershellWebrequest } from "./plugins/powershell/webrequest/index.js";
|
|
28
|
+
import { pythonPython3 } from "./plugins/python/python3/index.js";
|
|
29
|
+
import { pythonRequests } from "./plugins/python/requests/index.js";
|
|
30
|
+
import { rHttr } from "./plugins/r/httr/index.js";
|
|
31
|
+
import { rubyNative } from "./plugins/ruby/native/index.js";
|
|
32
|
+
import { shellCurl } from "./plugins/shell/curl/index.js";
|
|
33
|
+
import { shellHttpie } from "./plugins/shell/httpie/index.js";
|
|
34
|
+
import { shellWget } from "./plugins/shell/wget/index.js";
|
|
35
|
+
import { swiftNsurlsession } from "./plugins/swift/nsurlsession/index.js";
|
|
40
36
|
const clients = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
37
|
+
{
|
|
38
|
+
key: "c",
|
|
39
|
+
title: "C",
|
|
40
|
+
default: "libcurl",
|
|
41
|
+
clients: [cLibcurl]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "csharp",
|
|
45
|
+
title: "C#",
|
|
46
|
+
default: "restsharp",
|
|
47
|
+
clients: [csharpHttpclient, csharpRestsharp]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: "clojure",
|
|
51
|
+
title: "Clojure",
|
|
52
|
+
default: "clj_http",
|
|
53
|
+
clients: [clojureCljhttp]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "dart",
|
|
57
|
+
title: "Dart",
|
|
58
|
+
default: "http",
|
|
59
|
+
clients: [dartHttp]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "go",
|
|
63
|
+
title: "Go",
|
|
64
|
+
default: "native",
|
|
65
|
+
clients: [goNative]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
key: "http",
|
|
69
|
+
title: "HTTP",
|
|
70
|
+
default: "http1.1",
|
|
71
|
+
clients: [httpHttp11]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: "java",
|
|
75
|
+
title: "Java",
|
|
76
|
+
default: "unirest",
|
|
77
|
+
clients: [javaAsynchttp, javaNethttp, javaOkhttp, javaUnirest]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: "js",
|
|
81
|
+
title: "JavaScript",
|
|
82
|
+
default: "fetch",
|
|
83
|
+
clients: [jsFetch, jsAxios, jsOfetch, jsJquery, jsXhr]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "kotlin",
|
|
87
|
+
title: "Kotlin",
|
|
88
|
+
default: "okhttp",
|
|
89
|
+
clients: [kotlinOkhttp]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: "node",
|
|
93
|
+
title: "Node.js",
|
|
94
|
+
default: "fetch",
|
|
95
|
+
clients: [nodeFetch, nodeAxios, nodeOfetch, nodeUndici]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "objc",
|
|
99
|
+
title: "Objective-C",
|
|
100
|
+
default: "nsurlsession",
|
|
101
|
+
clients: [objcNsurlsession]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: "ocaml",
|
|
105
|
+
title: "OCaml",
|
|
106
|
+
default: "cohttp",
|
|
107
|
+
clients: [ocamlCohttp]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "php",
|
|
111
|
+
title: "PHP",
|
|
112
|
+
default: "curl",
|
|
113
|
+
clients: [phpCurl, phpGuzzle]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "powershell",
|
|
117
|
+
title: "Powershell",
|
|
118
|
+
default: "webrequest",
|
|
119
|
+
clients: [powershellWebrequest, powershellRestmethod]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "python",
|
|
123
|
+
title: "Python",
|
|
124
|
+
default: "python3",
|
|
125
|
+
clients: [pythonPython3, pythonRequests]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: "r",
|
|
129
|
+
title: "R",
|
|
130
|
+
default: "httr",
|
|
131
|
+
clients: [rHttr]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: "ruby",
|
|
135
|
+
title: "Ruby",
|
|
136
|
+
default: "native",
|
|
137
|
+
clients: [rubyNative]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: "shell",
|
|
141
|
+
title: "Shell",
|
|
142
|
+
default: "curl",
|
|
143
|
+
clients: [shellCurl, shellWget, shellHttpie]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "swift",
|
|
147
|
+
title: "Swift",
|
|
148
|
+
default: "nsurlsession",
|
|
149
|
+
clients: [swiftNsurlsession]
|
|
150
|
+
}
|
|
155
151
|
];
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
export {
|
|
153
|
+
clients
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=clients.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/clients.ts"],
|
|
4
|
+
"sourcesContent": ["import { cLibcurl } from '@/plugins/c/libcurl/libcurl'\nimport { clojureCljhttp } from '@/plugins/clojure/clj_http'\nimport { csharpHttpclient } from '@/plugins/csharp/httpclient'\nimport { csharpRestsharp } from '@/plugins/csharp/restsharp'\nimport { dartHttp } from '@/plugins/dart/http'\nimport { goNative } from '@/plugins/go/native'\nimport { httpHttp11 } from '@/plugins/http/http11'\nimport { javaAsynchttp } from '@/plugins/java/asynchttp'\nimport { javaNethttp } from '@/plugins/java/nethttp/nethttp'\nimport { javaOkhttp } from '@/plugins/java/okhttp/okhttp'\nimport { javaUnirest } from '@/plugins/java/unirest/unirest'\nimport { jsAxios } from '@/plugins/js/axios'\nimport { jsFetch } from '@/plugins/js/fetch'\nimport { jsJquery } from '@/plugins/js/jquery'\nimport { jsOfetch } from '@/plugins/js/ofetch'\nimport { jsXhr } from '@/plugins/js/xhr'\nimport { kotlinOkhttp } from '@/plugins/kotlin/okhttp'\nimport { nodeAxios } from '@/plugins/node/axios'\nimport { nodeFetch } from '@/plugins/node/fetch'\nimport { nodeOfetch } from '@/plugins/node/ofetch'\nimport { nodeUndici } from '@/plugins/node/undici'\nimport { objcNsurlsession } from '@/plugins/objc/nsurlsession'\nimport { ocamlCohttp } from '@/plugins/ocaml/cohttp'\nimport { phpCurl } from '@/plugins/php/curl'\nimport { phpGuzzle } from '@/plugins/php/guzzle'\nimport { powershellRestmethod } from '@/plugins/powershell/restmethod'\nimport { powershellWebrequest } from '@/plugins/powershell/webrequest'\nimport { pythonPython3 } from '@/plugins/python/python3'\nimport { pythonRequests } from '@/plugins/python/requests'\nimport { rHttr } from '@/plugins/r/httr'\nimport { rubyNative } from '@/plugins/ruby/native'\nimport { shellCurl } from '@/plugins/shell/curl'\nimport { shellHttpie } from '@/plugins/shell/httpie'\nimport { shellWget } from '@/plugins/shell/wget'\nimport { swiftNsurlsession } from '@/plugins/swift/nsurlsession'\nimport type { Target } from '@scalar/types/snippetz'\n\n/**\n * All available clients\n */\nexport const clients: Target[] = [\n {\n key: 'c',\n title: 'C',\n default: 'libcurl',\n clients: [cLibcurl],\n },\n {\n key: 'csharp',\n title: 'C#',\n default: 'restsharp',\n clients: [csharpHttpclient, csharpRestsharp],\n },\n {\n key: 'clojure',\n title: 'Clojure',\n default: 'clj_http',\n clients: [clojureCljhttp],\n },\n {\n key: 'dart',\n title: 'Dart',\n default: 'http',\n clients: [dartHttp],\n },\n {\n key: 'go',\n title: 'Go',\n default: 'native',\n clients: [goNative],\n },\n {\n key: 'http',\n title: 'HTTP',\n default: 'http1.1',\n clients: [httpHttp11],\n },\n {\n key: 'java',\n title: 'Java',\n default: 'unirest',\n clients: [javaAsynchttp, javaNethttp, javaOkhttp, javaUnirest],\n },\n {\n key: 'js',\n title: 'JavaScript',\n default: 'fetch',\n clients: [jsFetch, jsAxios, jsOfetch, jsJquery, jsXhr],\n },\n {\n key: 'kotlin',\n title: 'Kotlin',\n default: 'okhttp',\n clients: [kotlinOkhttp],\n },\n {\n key: 'node',\n title: 'Node.js',\n default: 'fetch',\n clients: [nodeFetch, nodeAxios, nodeOfetch, nodeUndici],\n },\n {\n key: 'objc',\n title: 'Objective-C',\n default: 'nsurlsession',\n clients: [objcNsurlsession],\n },\n {\n key: 'ocaml',\n title: 'OCaml',\n default: 'cohttp',\n clients: [ocamlCohttp],\n },\n {\n key: 'php',\n title: 'PHP',\n default: 'curl',\n clients: [phpCurl, phpGuzzle],\n },\n {\n key: 'powershell',\n title: 'Powershell',\n default: 'webrequest',\n clients: [powershellWebrequest, powershellRestmethod],\n },\n {\n key: 'python',\n title: 'Python',\n default: 'python3',\n clients: [pythonPython3, pythonRequests],\n },\n {\n key: 'r',\n title: 'R',\n default: 'httr',\n clients: [rHttr],\n },\n {\n key: 'ruby',\n title: 'Ruby',\n default: 'native',\n clients: [rubyNative],\n },\n {\n key: 'shell',\n title: 'Shell',\n default: 'curl',\n clients: [shellCurl, shellWget, shellHttpie],\n },\n {\n key: 'swift',\n title: 'Swift',\n default: 'nsurlsession',\n clients: [swiftNsurlsession],\n },\n]\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,61 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const DEFAULT_LINE_JOIN = '\n';
|
|
1
|
+
const DEFAULT_INDENTATION_CHARACTER = "";
|
|
2
|
+
const DEFAULT_LINE_JOIN = "\n";
|
|
4
3
|
class CodeBuilder {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
this.join = () => {
|
|
45
|
-
const unreplacedCode = this.code.join(this.lineJoin);
|
|
46
|
-
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
47
|
-
return replacedOutput;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
51
|
-
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
52
|
-
*/
|
|
53
|
-
this.addPostProcessor = (postProcessor) => {
|
|
54
|
-
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
55
|
-
};
|
|
56
|
-
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
57
|
-
this.lineJoin = join !== null && join !== void 0 ? join : DEFAULT_LINE_JOIN;
|
|
58
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* Helper object to format and aggragate lines of code.
|
|
6
|
+
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
7
|
+
*/
|
|
8
|
+
constructor({ indent, join } = {}) {
|
|
9
|
+
this.postProcessors = [];
|
|
10
|
+
this.code = [];
|
|
11
|
+
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
12
|
+
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
13
|
+
this.indentLine = (line, indentationLevel = 0) => {
|
|
14
|
+
const whitespace = this.indentationCharacter.repeat(indentationLevel);
|
|
15
|
+
return `${whitespace}${line}`;
|
|
16
|
+
};
|
|
17
|
+
this.unshift = (line, indentationLevel) => {
|
|
18
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
19
|
+
this.code.unshift(newLine);
|
|
20
|
+
};
|
|
21
|
+
this.push = (line, indentationLevel) => {
|
|
22
|
+
const newLine = this.indentLine(line, indentationLevel);
|
|
23
|
+
this.code.push(newLine);
|
|
24
|
+
};
|
|
25
|
+
this.blank = () => {
|
|
26
|
+
this.code.push("");
|
|
27
|
+
};
|
|
28
|
+
this.join = () => {
|
|
29
|
+
const unreplacedCode = this.code.join(this.lineJoin);
|
|
30
|
+
const replacedOutput = this.postProcessors.reduce(
|
|
31
|
+
(accumulator, replacer) => replacer(accumulator),
|
|
32
|
+
unreplacedCode
|
|
33
|
+
);
|
|
34
|
+
return replacedOutput;
|
|
35
|
+
};
|
|
36
|
+
this.addPostProcessor = (postProcessor) => {
|
|
37
|
+
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
38
|
+
};
|
|
39
|
+
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
40
|
+
this.lineJoin = join !== null && join !== void 0 ? join : DEFAULT_LINE_JOIN;
|
|
41
|
+
}
|
|
59
42
|
}
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
export {
|
|
44
|
+
CodeBuilder
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=code-builder.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/httpsnippet-lite/esm/helpers/code-builder.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\nconst DEFAULT_INDENTATION_CHARACTER = ''\nconst DEFAULT_LINE_JOIN = '\\n'\nexport class CodeBuilder {\n /**\n * Helper object to format and aggragate lines of code.\n * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.\n */\n constructor({ indent, join } = {}) {\n this.postProcessors = []\n this.code = []\n this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER\n this.lineJoin = DEFAULT_LINE_JOIN\n /**\n * Add given indentation level to given line of code\n */\n this.indentLine = (line, indentationLevel = 0) => {\n const whitespace = this.indentationCharacter.repeat(indentationLevel)\n return `${whitespace}${line}`\n }\n /**\n * Add the line at the beginning of the current lines\n */\n this.unshift = (line, indentationLevel) => {\n const newLine = this.indentLine(line, indentationLevel)\n this.code.unshift(newLine)\n }\n /**\n * Add the line at the end of the current lines\n */\n this.push = (line, indentationLevel) => {\n const newLine = this.indentLine(line, indentationLevel)\n this.code.push(newLine)\n }\n /**\n * Add an empty line at the end of current lines\n */\n this.blank = () => {\n this.code.push('')\n }\n /**\n * Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added\n */\n this.join = () => {\n const unreplacedCode = this.code.join(this.lineJoin)\n const replacedOutput = this.postProcessors.reduce(\n (accumulator, replacer) => replacer(accumulator),\n unreplacedCode,\n )\n return replacedOutput\n }\n /**\n * Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.\n * To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.\n */\n this.addPostProcessor = (postProcessor) => {\n this.postProcessors = [...this.postProcessors, postProcessor]\n }\n this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER\n this.lineJoin = join !== null && join !== void 0 ? join : DEFAULT_LINE_JOIN\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,MAAM,gCAAgC;AACtC,MAAM,oBAAoB;AACnB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvB,YAAY,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG;AACjC,SAAK,iBAAiB,CAAC;AACvB,SAAK,OAAO,CAAC;AACb,SAAK,uBAAuB;AAC5B,SAAK,WAAW;AAIhB,SAAK,aAAa,CAAC,MAAM,mBAAmB,MAAM;AAChD,YAAM,aAAa,KAAK,qBAAqB,OAAO,gBAAgB;AACpE,aAAO,GAAG,UAAU,GAAG,IAAI;AAAA,IAC7B;AAIA,SAAK,UAAU,CAAC,MAAM,qBAAqB;AACzC,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,QAAQ,OAAO;AAAA,IAC3B;AAIA,SAAK,OAAO,CAAC,MAAM,qBAAqB;AACtC,YAAM,UAAU,KAAK,WAAW,MAAM,gBAAgB;AACtD,WAAK,KAAK,KAAK,OAAO;AAAA,IACxB;AAIA,SAAK,QAAQ,MAAM;AACjB,WAAK,KAAK,KAAK,EAAE;AAAA,IACnB;AAIA,SAAK,OAAO,MAAM;AAChB,YAAM,iBAAiB,KAAK,KAAK,KAAK,KAAK,QAAQ;AACnD,YAAM,iBAAiB,KAAK,eAAe;AAAA,QACzC,CAAC,aAAa,aAAa,SAAS,WAAW;AAAA,QAC/C;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAKA,SAAK,mBAAmB,CAAC,kBAAkB;AACzC,WAAK,iBAAiB,CAAC,GAAG,KAAK,gBAAgB,aAAa;AAAA,IAC9D;AACA,SAAK,uBAAuB,UAAU;AACtC,SAAK,WAAW,SAAS,QAAQ,SAAS,SAAS,OAAO;AAAA,EAC5D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,73 +1,45 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* Escape characters within a value to make it safe to insert directly into a
|
|
4
|
-
* snippet. Takes options which define the escape requirements.
|
|
5
|
-
*
|
|
6
|
-
* This is closely based on the JSON-stringify string serialization algorithm,
|
|
7
|
-
* but generalized for other string delimiters (e.g. " or ') and different escape
|
|
8
|
-
* characters (e.g. Powershell uses `)
|
|
9
|
-
*
|
|
10
|
-
* See https://tc39.es/ecma262/multipage/structured-data.html#sec-quotejsonstring
|
|
11
|
-
* for the complete original algorithm.
|
|
12
|
-
*/
|
|
13
1
|
function escapeString(rawValue, options = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// strictly?) ASCII-only, this should almost never happen.
|
|
50
|
-
return JSON.stringify(c).slice(1, -1);
|
|
51
|
-
}
|
|
52
|
-
return c;
|
|
53
|
-
})
|
|
54
|
-
.join('');
|
|
2
|
+
const { delimiter = '"', escapeChar = "\\", escapeNewlines = true } = options;
|
|
3
|
+
const stringValue = rawValue.toString();
|
|
4
|
+
return [...stringValue].map((c) => {
|
|
5
|
+
if (c === "\b") {
|
|
6
|
+
return `${escapeChar}b`;
|
|
7
|
+
}
|
|
8
|
+
if (c === " ") {
|
|
9
|
+
return `${escapeChar}t`;
|
|
10
|
+
}
|
|
11
|
+
if (c === "\n") {
|
|
12
|
+
if (escapeNewlines) {
|
|
13
|
+
return `${escapeChar}n`;
|
|
14
|
+
}
|
|
15
|
+
return c;
|
|
16
|
+
}
|
|
17
|
+
if (c === "\f") {
|
|
18
|
+
return `${escapeChar}f`;
|
|
19
|
+
}
|
|
20
|
+
if (c === "\r") {
|
|
21
|
+
if (escapeNewlines) {
|
|
22
|
+
return `${escapeChar}r`;
|
|
23
|
+
}
|
|
24
|
+
return c;
|
|
25
|
+
}
|
|
26
|
+
if (c === escapeChar) {
|
|
27
|
+
return escapeChar + escapeChar;
|
|
28
|
+
}
|
|
29
|
+
if (c === delimiter) {
|
|
30
|
+
return escapeChar + delimiter;
|
|
31
|
+
}
|
|
32
|
+
if (c < " " || c > "~") {
|
|
33
|
+
return JSON.stringify(c).slice(1, -1);
|
|
34
|
+
}
|
|
35
|
+
return c;
|
|
36
|
+
}).join("");
|
|
55
37
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Make a string value safe to insert literally into a snippet within single quotes,
|
|
58
|
-
* by escaping problematic characters, including single quotes inside the string,
|
|
59
|
-
* backslashes, newlines, and other special characters.
|
|
60
|
-
*
|
|
61
|
-
* If value is not a string, it will be stringified with .toString() first.
|
|
62
|
-
*/
|
|
63
38
|
const escapeForSingleQuotes = (value) => escapeString(value, { delimiter: "'" });
|
|
64
|
-
/**
|
|
65
|
-
* Make a string value safe to insert literally into a snippet within double quotes,
|
|
66
|
-
* by escaping problematic characters, including double quotes inside the string,
|
|
67
|
-
* backslashes, newlines, and other special characters.
|
|
68
|
-
*
|
|
69
|
-
* If value is not a string, it will be stringified with .toString() first.
|
|
70
|
-
*/
|
|
71
39
|
const escapeForDoubleQuotes = (value) => escapeString(value, { delimiter: '"' });
|
|
72
|
-
|
|
73
|
-
|
|
40
|
+
export {
|
|
41
|
+
escapeForDoubleQuotes,
|
|
42
|
+
escapeForSingleQuotes,
|
|
43
|
+
escapeString
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=escape.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/httpsnippet-lite/esm/helpers/escape.ts"],
|
|
4
|
+
"sourcesContent": ["// @ts-nocheck\n/**\n * Escape characters within a value to make it safe to insert directly into a\n * snippet. Takes options which define the escape requirements.\n *\n * This is closely based on the JSON-stringify string serialization algorithm,\n * but generalized for other string delimiters (e.g. \" or ') and different escape\n * characters (e.g. Powershell uses `)\n *\n * See https://tc39.es/ecma262/multipage/structured-data.html#sec-quotejsonstring\n * for the complete original algorithm.\n */\nexport function escapeString(rawValue, options = {}) {\n const { delimiter = '\"', escapeChar = '\\\\', escapeNewlines = true } = options\n const stringValue = rawValue.toString()\n return [...stringValue]\n .map((c) => {\n if (c === '\\b') {\n return `${escapeChar}b`\n }if (c === '\\t') {\n return `${escapeChar}t`\n }if (c === '\\n') {\n if (escapeNewlines) {\n return `${escapeChar}n`\n }\n return c // Don't just continue, or this is caught by < \\u0020\n }if (c === '\\f') {\n return `${escapeChar}f`\n }if (c === '\\r') {\n if (escapeNewlines) {\n return `${escapeChar}r`\n }\n return c // Don't just continue, or this is caught by < \\u0020\n }if (c === escapeChar) {\n return escapeChar + escapeChar\n }if (c === delimiter) {\n return escapeChar + delimiter\n }if (c < '\\u0020' || c > '\\u007E') {\n // Delegate the trickier non-ASCII cases to the normal algorithm. Some of these\n // are escaped as \\uXXXX, whilst others are represented literally. Since we're\n // using this primarily for header values that are generally (though not 100%\n // strictly?) ASCII-only, this should almost never happen.\n return JSON.stringify(c).slice(1, -1)\n }\n return c\n })\n .join('')\n}\n/**\n * Make a string value safe to insert literally into a snippet within single quotes,\n * by escaping problematic characters, including single quotes inside the string,\n * backslashes, newlines, and other special characters.\n *\n * If value is not a string, it will be stringified with .toString() first.\n */\nexport const escapeForSingleQuotes = (value) =>\n escapeString(value, { delimiter: \"'\" })\n/**\n * Make a string value safe to insert literally into a snippet within double quotes,\n * by escaping problematic characters, including double quotes inside the string,\n * backslashes, newlines, and other special characters.\n *\n * If value is not a string, it will be stringified with .toString() first.\n */\nexport const escapeForDoubleQuotes = (value) =>\n escapeString(value, { delimiter: '\"' })\n"],
|
|
5
|
+
"mappings": "AAYO,SAAS,aAAa,UAAU,UAAU,CAAC,GAAG;AACnD,QAAM,EAAE,YAAY,KAAK,aAAa,MAAM,iBAAiB,KAAK,IAAI;AACtE,QAAM,cAAc,SAAS,SAAS;AACtC,SAAO,CAAC,GAAG,WAAW,EACnB,IAAI,CAAC,MAAM;AACV,QAAI,MAAM,MAAM;AACd,aAAO,GAAG,UAAU;AAAA,IACtB;AAAC,QAAI,MAAM,KAAM;AACf,aAAO,GAAG,UAAU;AAAA,IACtB;AAAC,QAAI,MAAM,MAAM;AACf,UAAI,gBAAgB;AAClB,eAAO,GAAG,UAAU;AAAA,MACtB;AACA,aAAO;AAAA,IACT;AAAC,QAAI,MAAM,MAAM;AACf,aAAO,GAAG,UAAU;AAAA,IACtB;AAAC,QAAI,MAAM,MAAM;AACf,UAAI,gBAAgB;AAClB,eAAO,GAAG,UAAU;AAAA,MACtB;AACA,aAAO;AAAA,IACT;AAAC,QAAI,MAAM,YAAY;AACrB,aAAO,aAAa;AAAA,IACtB;AAAC,QAAI,MAAM,WAAW;AACpB,aAAO,aAAa;AAAA,IACtB;AAAC,QAAI,IAAI,OAAY,IAAI,KAAU;AAKjC,aAAO,KAAK,UAAU,CAAC,EAAE,MAAM,GAAG,EAAE;AAAA,IACtC;AACA,WAAO;AAAA,EACT,CAAC,EACA,KAAK,EAAE;AACZ;AAQO,MAAM,wBAAwB,CAAC,UACpC,aAAa,OAAO,EAAE,WAAW,IAAI,CAAC;AAQjC,MAAM,wBAAwB,CAAC,UACpC,aAAa,OAAO,EAAE,WAAW,IAAI,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|