@scalar/snippetz 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,7 +84,7 @@ console.log(source)
84
84
 
85
85
  ## Community
86
86
 
87
- We are API nerds. You too? Lets chat on Discord: <https://discord.gg/scalar>
87
+ We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
88
88
 
89
89
  ## License
90
90
 
@@ -1 +1 @@
1
- {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,EAmH3B,CAAA"}
1
+ {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,EAyH3B,CAAA"}
package/dist/clients.js CHANGED
@@ -30,6 +30,7 @@ import { pythonRequests } from "./plugins/python/requests/index.js";
30
30
  import { pythonHttpxSync, pythonHttpxAsync } from "./plugins/python/httpx/index.js";
31
31
  import { rHttr } from "./plugins/r/httr/index.js";
32
32
  import { rubyNative } from "./plugins/ruby/native/index.js";
33
+ import { rustReqwest } from "./plugins/rust/reqwest/index.js";
33
34
  import { shellCurl } from "./plugins/shell/curl/index.js";
34
35
  import { shellHttpie } from "./plugins/shell/httpie/index.js";
35
36
  import { shellWget } from "./plugins/shell/wget/index.js";
@@ -137,6 +138,12 @@ const clients = [
137
138
  default: "native",
138
139
  clients: [rubyNative]
139
140
  },
141
+ {
142
+ key: "rust",
143
+ title: "Rust",
144
+ default: "reqwest",
145
+ clients: [rustReqwest]
146
+ },
140
147
  {
141
148
  key: "shell",
142
149
  title: "Shell",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { pythonHttpxSync, pythonHttpxAsync } from '@/plugins/python/httpx'\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, pythonHttpxSync, pythonHttpxAsync],\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": "AAAA,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB,wBAAwB;AAClD,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,yBAAyB;AAM3B,MAAM,UAAoB;AAAA,EAC/B;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,QAAQ;AAAA,EACpB;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,kBAAkB,eAAe;AAAA,EAC7C;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,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AAsB,oBAAoB;AAAA,EACtD;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,eAAe,gBAAgB,iBAAiB,gBAAgB;AAAA,EAC5E;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,KAAK;AAAA,EACjB;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,UAAU;AAAA,EACtB;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,WAAW,WAAW,WAAW;AAAA,EAC7C;AAAA,EACA;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,iBAAiB;AAAA,EAC7B;AACF;",
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 { pythonHttpxSync, pythonHttpxAsync } from '@/plugins/python/httpx'\nimport { rHttr } from '@/plugins/r/httr'\nimport { rubyNative } from '@/plugins/ruby/native'\nimport { rustReqwest } from '@/plugins/rust/reqwest'\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, pythonHttpxSync, pythonHttpxAsync],\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: 'rust',\n title: 'Rust',\n default: 'reqwest',\n clients: [rustReqwest],\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": "AAAA,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS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A;AAAA,IACE,KAAK;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,CAAC,iBAAiB;AAAA,EAC7B;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,2 @@
1
+ export * from './reqwest.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/rust/reqwest/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./reqwest.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/plugins/rust/reqwest/index.ts"],
4
+ "sourcesContent": ["export * from './reqwest'\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from '@scalar/types/snippetz';
2
+ /**
3
+ * rust/reqwest
4
+ */
5
+ export declare const rustReqwest: Plugin;
6
+ //# sourceMappingURL=reqwest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqwest.d.ts","sourceRoot":"","sources":["../../../../src/plugins/rust/reqwest/reqwest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAGpD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAwGzB,CAAA"}
@@ -0,0 +1,90 @@
1
+ import { toRustString } from "../../../plugins/rust/rustString.js";
2
+ const rustReqwest = {
3
+ target: "rust",
4
+ client: "reqwest",
5
+ title: "reqwest",
6
+ generate(request, options) {
7
+ const normalizedRequest = {
8
+ method: "GET",
9
+ ...request
10
+ };
11
+ normalizedRequest.method = normalizedRequest.method.toUpperCase();
12
+ let code = `let client = reqwest::Client::new();
13
+ `;
14
+ const queryString = normalizedRequest.queryString?.length ? "?" + normalizedRequest.queryString.map((param) => `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`).join("&") : "";
15
+ const url = `${normalizedRequest.url}${queryString}`;
16
+ const method = normalizedRequest.method.toLowerCase();
17
+ code += `let request = client.${method}(${toRustString(url)})`;
18
+ const headers = normalizedRequest.headers?.reduce(
19
+ (acc, header) => {
20
+ if (header.value && !/[; ]/.test(header.name)) {
21
+ acc[header.name] = header.value;
22
+ }
23
+ return acc;
24
+ },
25
+ {}
26
+ ) || {};
27
+ if (normalizedRequest.cookies && normalizedRequest.cookies.length > 0) {
28
+ const cookieString = normalizedRequest.cookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`).join("; ");
29
+ headers["Cookie"] = cookieString;
30
+ }
31
+ if (options?.auth) {
32
+ const { username, password } = options.auth;
33
+ if (username && password) {
34
+ code += `
35
+ .basic_auth(${toRustString(username)}, ${toRustString(password)})`;
36
+ }
37
+ }
38
+ for (const [key, value] of Object.entries(headers)) {
39
+ code += `
40
+ .header(${toRustString(key)}, ${toRustString(value)})`;
41
+ }
42
+ let isJsonRequest = false;
43
+ if (normalizedRequest.postData) {
44
+ if (normalizedRequest.postData.mimeType === "application/json") {
45
+ isJsonRequest = true;
46
+ code += `
47
+ .json(&serde_json::json!(${normalizedRequest.postData.text}))`;
48
+ } else if (normalizedRequest.postData.mimeType === "application/x-www-form-urlencoded") {
49
+ const formData = normalizedRequest.postData.params?.map((param) => `(${toRustString(param.name)}, ${toRustString(param.value || "")})`).join(", ") || "";
50
+ code += `
51
+ .form(&[${formData}])`;
52
+ } else if (normalizedRequest.postData.mimeType === "multipart/form-data") {
53
+ code += "\n .multipart({";
54
+ const formParts = normalizedRequest.postData.params?.map((param) => {
55
+ if (param.fileName) {
56
+ return `
57
+ let part = reqwest::multipart::Part::text(${toRustString(param.value || "")})
58
+ .file_name(${toRustString(param.fileName)});
59
+ form = form.part(${toRustString(param.name)}, part);`;
60
+ } else {
61
+ return `
62
+ form = form.text(${toRustString(param.name)}, ${toRustString(param.value || "")});`;
63
+ }
64
+ }).join("") || "";
65
+ code += `
66
+ let mut form = reqwest::multipart::Form::new();${formParts}
67
+ form
68
+ })`;
69
+ } else {
70
+ code += `
71
+ .body(${toRustString(normalizedRequest.postData.text || "")})`;
72
+ }
73
+ }
74
+ code += ";\n";
75
+ code += `let response = request.send().await?;
76
+ `;
77
+ if (isJsonRequest) {
78
+ code += `let body = response.json::<serde_json::Value>().await?;
79
+ `;
80
+ } else {
81
+ code += `let body = response.text().await?;
82
+ `;
83
+ }
84
+ return code;
85
+ }
86
+ };
87
+ export {
88
+ rustReqwest
89
+ };
90
+ //# sourceMappingURL=reqwest.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/plugins/rust/reqwest/reqwest.ts"],
4
+ "sourcesContent": ["import type { Plugin } from '@scalar/types/snippetz'\nimport { toRustString } from '@/plugins/rust/rustString'\n\n/**\n * rust/reqwest\n */\nexport const rustReqwest: Plugin = {\n target: 'rust',\n client: 'reqwest',\n title: 'reqwest',\n generate(request, options?: { auth?: { username: string; password: string } }) {\n // Defaults\n const normalizedRequest = {\n method: 'GET',\n ...request,\n }\n\n // Normalize method to uppercase\n normalizedRequest.method = normalizedRequest.method.toUpperCase()\n\n // Start building the Rust code\n let code = `let client = reqwest::Client::new();\\n`\n\n // Handle query string\n const queryString = normalizedRequest.queryString?.length\n ? '?' +\n normalizedRequest.queryString\n .map((param) => `${encodeURIComponent(param.name)}=${encodeURIComponent(param.value)}`)\n .join('&')\n : ''\n const url = `${normalizedRequest.url}${queryString}`\n\n // Start building request\n const method = normalizedRequest.method.toLowerCase()\n code += `let request = client.${method}(${toRustString(url)})`\n\n // Handle headers\n const headers =\n normalizedRequest.headers?.reduce(\n (acc, header) => {\n if (header.value && !/[; ]/.test(header.name)) {\n acc[header.name] = header.value\n }\n return acc\n },\n {} as Record<string, string>,\n ) || {}\n\n // Handle cookies\n if (normalizedRequest.cookies && normalizedRequest.cookies.length > 0) {\n const cookieString = normalizedRequest.cookies\n .map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`)\n .join('; ')\n headers['Cookie'] = cookieString\n }\n\n // Add Authorization header if credentials are provided\n if (options?.auth) {\n const { username, password } = options.auth\n if (username && password) {\n code += `\\n .basic_auth(${toRustString(username)}, ${toRustString(password)})`\n }\n }\n\n // Add headers to request\n for (const [key, value] of Object.entries(headers)) {\n code += `\\n .header(${toRustString(key)}, ${toRustString(value)})`\n }\n\n // Handle body\n let isJsonRequest = false\n if (normalizedRequest.postData) {\n if (normalizedRequest.postData.mimeType === 'application/json') {\n isJsonRequest = true\n code += `\\n .json(&serde_json::json!(${normalizedRequest.postData.text}))`\n } else if (normalizedRequest.postData.mimeType === 'application/x-www-form-urlencoded') {\n const formData =\n normalizedRequest.postData.params\n ?.map((param) => `(${toRustString(param.name)}, ${toRustString(param.value || '')})`)\n .join(', ') || ''\n code += `\\n .form(&[${formData}])`\n } else if (normalizedRequest.postData.mimeType === 'multipart/form-data') {\n code += '\\n .multipart({'\n const formParts =\n normalizedRequest.postData.params\n ?.map((param) => {\n if (param.fileName) {\n return `\\n let part = reqwest::multipart::Part::text(${toRustString(param.value || '')})\\n .file_name(${toRustString(param.fileName)});\\n form = form.part(${toRustString(param.name)}, part);`\n } else {\n return `\\n form = form.text(${toRustString(param.name)}, ${toRustString(param.value || '')});`\n }\n })\n .join('') || ''\n code += `\\n let mut form = reqwest::multipart::Form::new();${formParts}\\n form\\n })`\n } else {\n code += `\\n .body(${toRustString(normalizedRequest.postData.text || '')})`\n }\n }\n\n code += ';\\n'\n code += `let response = request.send().await?;\\n`\n\n if (isJsonRequest) {\n code += `let body = response.json::<serde_json::Value>().await?;\\n`\n } else {\n code += `let body = response.text().await?;\\n`\n }\n\n return code\n },\n}\n"],
5
+ "mappings": "AACA,SAAS,oBAAoB;AAKtB,MAAM,cAAsB;AAAA,EACjC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,S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5
+ * Safely formats a string for use in Rust string literals
6
+ * Returns the escaped string wrapped in double quotes
7
+ */
8
+ export declare function toRustString(str: string): string;
9
+ //# sourceMappingURL=rustString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rustString.d.ts","sourceRoot":"","sources":["../../../src/plugins/rust/rustString.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,10 @@
1
+ function escapeRustString(str) {
2
+ return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\0/g, "\\0");
3
+ }
4
+ function toRustString(str) {
5
+ return `"${escapeRustString(str)}"`;
6
+ }
7
+ export {
8
+ toRustString
9
+ };
10
+ //# sourceMappingURL=rustString.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/rust/rustString.ts"],
4
+ "sourcesContent": ["/**\n * Utilities for escaping strings in Rust code generation\n */\n\n/**\n * Escapes a string for use in Rust string literals\n * Handles quotes, backslashes, newlines, and other special characters\n */\nfunction escapeRustString(str: string): string {\n return str\n .replace(/\\\\/g, '\\\\\\\\') // Escape backslashes first\n .replace(/\"/g, '\\\\\"') // Escape double quotes\n .replace(/\\n/g, '\\\\n') // Escape newlines\n .replace(/\\r/g, '\\\\r') // Escape carriage returns\n .replace(/\\t/g, '\\\\t') // Escape tabs\n .replace(/\\0/g, '\\\\0') // Escape null bytes\n}\n\n/**\n * Safely formats a string for use in Rust string literals\n * Returns the escaped string wrapped in double quotes\n */\nexport function toRustString(str: string): string {\n return `\"${escapeRustString(str)}\"`\n}\n"],
5
+ "mappings": "AAQA,SAAS,iBAAiB,KAAqB;AAC7C,SAAO,IACJ,QAAQ,OAAO,MAAM,EACrB,QAAQ,MAAM,KAAK,EACnB,QAAQ,OAAO,KAAK,EACpB,QAAQ,OAAO,KAAK,EACpB,QAAQ,OAAO,KAAK,EACpB,QAAQ,OAAO,KAAK;AACzB;AAMO,SAAS,aAAa,KAAqB;AAChD,SAAO,IAAI,iBAAiB,GAAG,CAAC;AAClC;",
6
+ "names": []
7
+ }
@@ -15,7 +15,7 @@ const shellCurl = {
15
15
  return `${encodedName}=${encodedValue}`;
16
16
  }).join("&") : "";
17
17
  const url = `${normalizedRequest.url}${queryString}`;
18
- const hasSpecialChars = /[\s<>[\]{}|\\^%]/.test(url);
18
+ const hasSpecialChars = /[\s<>[\]{}|\\^%$]/.test(url);
19
19
  const urlPart = queryString || hasSpecialChars ? `'${url}'` : url;
20
20
  parts[0] = `curl ${urlPart}`;
21
21
  if (normalizedRequest.method !== "GET") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/plugins/shell/curl/curl.ts"],
4
- "sourcesContent": ["import type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * shell/curl\n */\nexport const shellCurl: Plugin = {\n target: 'shell',\n client: 'curl',\n title: 'Curl',\n generate(request, configuration) {\n // Defaults\n const normalizedRequest = {\n method: 'GET',\n ...request,\n }\n\n // Normalization\n normalizedRequest.method = normalizedRequest.method.toUpperCase()\n\n // Build curl command parts\n const parts: string[] = ['curl']\n\n // URL (quote if has query parameters or special characters)\n const queryString = normalizedRequest.queryString?.length\n ? '?' +\n normalizedRequest.queryString\n .map((param) => {\n // Ensure both name and value are fully URI encoded\n const encodedName = encodeURIComponent(param.name)\n const encodedValue = encodeURIComponent(param.value)\n return `${encodedName}=${encodedValue}`\n })\n .join('&')\n : ''\n const url = `${normalizedRequest.url}${queryString}`\n const hasSpecialChars = /[\\s<>[\\]{}|\\\\^%]/.test(url)\n const urlPart = queryString || hasSpecialChars ? `'${url}'` : url\n parts[0] = `curl ${urlPart}`\n\n // Method\n if (normalizedRequest.method !== 'GET') {\n parts.push(`--request ${normalizedRequest.method}`)\n }\n\n // Basic Auth\n if (configuration?.auth?.username && configuration?.auth?.password) {\n parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`)\n }\n\n // Headers\n if (normalizedRequest.headers?.length) {\n normalizedRequest.headers.forEach((header) => {\n parts.push(`--header '${header.name}: ${header.value}'`)\n })\n\n // Add compressed flag if Accept-Encoding header includes compression\n const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding')\n if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {\n parts.push('--compressed')\n }\n }\n\n // Cookies\n if (normalizedRequest.cookies?.length) {\n const cookieString = normalizedRequest.cookies\n .map((cookie) => {\n // Encode both cookie name and value to handle special characters\n const encodedName = encodeURIComponent(cookie.name)\n const encodedValue = encodeURIComponent(cookie.value)\n return `${encodedName}=${encodedValue}`\n })\n .join('; ')\n parts.push(`--cookie '${cookieString}'`)\n }\n\n // Body\n if (normalizedRequest.postData) {\n if (normalizedRequest.postData.mimeType === 'application/json') {\n // Pretty print JSON data\n if (normalizedRequest.postData.text) {\n try {\n const jsonData = JSON.parse(normalizedRequest.postData.text)\n const prettyJson = JSON.stringify(jsonData, null, 2)\n parts.push(`--data '${prettyJson}'`)\n } catch {\n // If JSON parsing fails, use the original text\n parts.push(`--data '${normalizedRequest.postData.text}'`)\n }\n }\n } else if (normalizedRequest.postData.mimeType === 'application/octet-stream') {\n parts.push(`--data-binary '${normalizedRequest.postData.text}'`)\n } else if (\n normalizedRequest.postData.mimeType === 'application/x-www-form-urlencoded' &&\n normalizedRequest.postData.params\n ) {\n // Handle URL-encoded form data\n normalizedRequest.postData.params.forEach((param) => {\n parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`)\n })\n } else if (normalizedRequest.postData.mimeType === 'multipart/form-data' && normalizedRequest.postData.params) {\n // Handle multipart form data\n normalizedRequest.postData.params.forEach((param) => {\n if (param.fileName !== undefined) {\n parts.push(`--form '${param.name}=@${param.fileName}'`)\n } else {\n parts.push(`--form '${param.name}=${param.value}'`)\n }\n })\n } else {\n // Try to parse and pretty print if it's JSON, otherwise use raw text\n try {\n const jsonData = JSON.parse(normalizedRequest.postData.text ?? '')\n const prettyJson = JSON.stringify(jsonData, null, 2)\n parts.push(`--data '${prettyJson}'`)\n } catch {\n parts.push(`--data '${normalizedRequest.postData.text}'`)\n }\n }\n }\n\n return parts.join(' \\\\\\n ')\n },\n}\n"],
5
- "mappings": "AAKO,MAAM,YAAoB;AAAA,EAC/B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS,eAAe;AAE/B,UAAM,oBAAoB;AAAA,MACxB,QAAQ;AAAA,MACR,GAAG;AAAA,IACL;AAGA,sBAAkB,SAAS,kBAAkB,OAAO,YAAY;AAGhE,UAAM,QAAkB,CAAC,MAAM;AAG/B,UAAM,cAAc,kBAAkB,aAAa,SAC/C,MACA,kBAAkB,YACf,IAAI,CAAC,UAAU;AAEd,YAAM,cAAc,mBAAmB,MAAM,IAAI;AACjD,YAAM,eAAe,mBAAmB,MAAM,KAAK;AACnD,aAAO,GAAG,WAAW,IAAI,YAAY;AAAA,IACvC,CAAC,EACA,KAAK,GAAG,IACX;AACJ,UAAM,MAAM,GAAG,kBAAkB,GAAG,GAAG,WAAW;AAClD,UAAM,kBAAkB,mBAAmB,KAAK,GAAG;AACnD,UAAM,UAAU,eAAe,kBAAkB,IAAI,GAAG,MAAM;AAC9D,UAAM,CAAC,IAAI,QAAQ,OAAO;AAG1B,QAAI,kBAAkB,WAAW,OAAO;AACtC,YAAM,KAAK,aAAa,kBAAkB,MAAM,EAAE;AAAA,IACpD;AAGA,QAAI,eAAe,MAAM,YAAY,eAAe,MAAM,UAAU;AAClE,YAAM,KAAK,WAAW,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,QAAQ,GAAG;AAAA,IACrF;AAGA,QAAI,kBAAkB,SAAS,QAAQ;AACrC,wBAAkB,QAAQ,QAAQ,CAAC,WAAW;AAC5C,cAAM,KAAK,aAAa,OAA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,QAAQ;AAE7G,0BAAkB,SAAS,OAAO,QAAQ,CAAC,UAAU;AACnD,cAAI,MAAM,aAAa,QAAW;AAChC,kBAAM,KAAK,WAAW,MAAM,IAAI,KAAK,MAAM,QAAQ,GAAG;AAAA,UACxD,OAAO;AACL,kBAAM,KAAK,WAAW,MAAM,IAAI,IAAI,MAAM,KAAK,GAAG;AAAA,UACpD;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AAEL,YAAI;AACF,gBAAM,WAAW,KAAK,MAAM,kBAAkB,SAAS,QAAQ,EAAE;AACjE,gBAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;AACnD,gBAAM,KAAK,WAAW,UAAU,GAAG;AAAA,QACrC,QAAQ;AACN,gBAAM,KAAK,WAAW,kBAAkB,SAAS,IAAI,GAAG;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAEA,WAAO,MAAM,KAAK,SAAS;AAAA,EAC7B;AACF;",
4
+ "sourcesContent": ["import type { Plugin } from '@scalar/types/snippetz'\n\n/**\n * shell/curl\n */\nexport const shellCurl: Plugin = {\n target: 'shell',\n client: 'curl',\n title: 'Curl',\n generate(request, configuration) {\n // Defaults\n const normalizedRequest = {\n method: 'GET',\n ...request,\n }\n\n // Normalization\n normalizedRequest.method = normalizedRequest.method.toUpperCase()\n\n // Build curl command parts\n const parts: string[] = ['curl']\n\n // URL (quote if has query parameters or special characters)\n const queryString = normalizedRequest.queryString?.length\n ? '?' +\n normalizedRequest.queryString\n .map((param) => {\n // Ensure both name and value are fully URI encoded\n const encodedName = encodeURIComponent(param.name)\n const encodedValue = encodeURIComponent(param.value)\n return `${encodedName}=${encodedValue}`\n })\n .join('&')\n : ''\n const url = `${normalizedRequest.url}${queryString}`\n const hasSpecialChars = /[\\s<>[\\]{}|\\\\^%$]/.test(url)\n const urlPart = queryString || hasSpecialChars ? `'${url}'` : url\n parts[0] = `curl ${urlPart}`\n\n // Method\n if (normalizedRequest.method !== 'GET') {\n parts.push(`--request ${normalizedRequest.method}`)\n }\n\n // Basic Auth\n if (configuration?.auth?.username && configuration?.auth?.password) {\n parts.push(`--user '${configuration.auth.username}:${configuration.auth.password}'`)\n }\n\n // Headers\n if (normalizedRequest.headers?.length) {\n normalizedRequest.headers.forEach((header) => {\n parts.push(`--header '${header.name}: ${header.value}'`)\n })\n\n // Add compressed flag if Accept-Encoding header includes compression\n const acceptEncoding = normalizedRequest.headers.find((header) => header.name.toLowerCase() === 'accept-encoding')\n if (acceptEncoding && /gzip|deflate/.test(acceptEncoding.value)) {\n parts.push('--compressed')\n }\n }\n\n // Cookies\n if (normalizedRequest.cookies?.length) {\n const cookieString = normalizedRequest.cookies\n .map((cookie) => {\n // Encode both cookie name and value to handle special characters\n const encodedName = encodeURIComponent(cookie.name)\n const encodedValue = encodeURIComponent(cookie.value)\n return `${encodedName}=${encodedValue}`\n })\n .join('; ')\n parts.push(`--cookie '${cookieString}'`)\n }\n\n // Body\n if (normalizedRequest.postData) {\n if (normalizedRequest.postData.mimeType === 'application/json') {\n // Pretty print JSON data\n if (normalizedRequest.postData.text) {\n try {\n const jsonData = JSON.parse(normalizedRequest.postData.text)\n const prettyJson = JSON.stringify(jsonData, null, 2)\n parts.push(`--data '${prettyJson}'`)\n } catch {\n // If JSON parsing fails, use the original text\n parts.push(`--data '${normalizedRequest.postData.text}'`)\n }\n }\n } else if (normalizedRequest.postData.mimeType === 'application/octet-stream') {\n parts.push(`--data-binary '${normalizedRequest.postData.text}'`)\n } else if (\n normalizedRequest.postData.mimeType === 'application/x-www-form-urlencoded' &&\n normalizedRequest.postData.params\n ) {\n // Handle URL-encoded form data\n normalizedRequest.postData.params.forEach((param) => {\n parts.push(`--data-urlencode '${encodeURIComponent(param.name)}=${param.value}'`)\n })\n } else if (normalizedRequest.postData.mimeType === 'multipart/form-data' && normalizedRequest.postData.params) {\n // Handle multipart form data\n normalizedRequest.postData.params.forEach((param) => {\n if (param.fileName !== undefined) {\n parts.push(`--form '${param.name}=@${param.fileName}'`)\n } else {\n parts.push(`--form '${param.name}=${param.value}'`)\n }\n })\n } else {\n // Try to parse and pretty print if it's JSON, otherwise use raw text\n try {\n const jsonData = JSON.parse(normalizedRequest.postData.text ?? '')\n const prettyJson = JSON.stringify(jsonData, null, 2)\n parts.push(`--data '${prettyJson}'`)\n } catch {\n parts.push(`--data '${normalizedRequest.postData.text}'`)\n }\n }\n }\n\n return parts.join(' \\\\\\n ')\n },\n}\n"],
5
+ "mappings": "AAKO,MAAM,YAAoB;AAAA,EAC/B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,SAAS,eAAe;AAE/B,UAAM,oBAAoB;AAAA,MACxB,QAAQ;AAAA,MACR,GAAG;AAAA,IACL;AAGA,sBAAkB,SAAS,kBAAkB,OAAO,YAAY;AAGhE,UAAM,QAAkB,CAAC,MAAM;AAG/B,UAAM,cAAc,kBAAkB,aAAa,SAC/C,MACA,kBAAkB,YACf,IAAI,CAAC,UAAU;AAEd,YAAM,cAAc,mBAAmB,MAAM,IAAI;AACjD,YAAM,eAAe,mBAAmB,MAAM,KAAK;AACnD,aAAO,GAAG,WAAW,IAAI,YAAY;AAAA,IACvC,CAAC,EACA,KAAK,GAAG,IACX;AACJ,UAAM,MAAM,GAAG,kBAAkB,GAAG,GAAG,WAAW;AAClD,UAAM,kBAAkB,oBAAoB,KAAK,GAAG;AACpD,UAAM,UAAU,eAAe,kBAAkB,IAAI,GAAG,MAAM;AAC9D,UAAM,CAAC,IAAI,QAAQ,OAAO;AAG1B,QAAI,kBAAkB,WAAW,OAAO;AACtC,YAAM,KAAK,aAAa,kBAAkB,MAAM,EAAE;AAAA,IACpD;AAGA,QAAI,eAAe,MAAM,YAAY,eAAe,MAAM,UAAU;AAClE,YAAM,KAAK,WAAW,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,QAAQ,GAAG;AAAA,IACrF;AAGA,QAAI,kBAAkB,SAAS,QAAQ;AACrC,wBAAkB,QAAQ,QAAQ,CAAC,WAAW;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,aAAa,yBAAyB,kBAAkB,SAAS,QAAQ;AAE7G,0BAAkB,SAAS,OAAO,QAAQ,CAAC,UAAU;AACnD,cAAI,MAAM,aAAa,QAAW;AAChC,kBAAM,KAAK,WAAW,MAAM,IAAI,KAAK,MAAM,QAAQ,GAAG;AAAA,UACxD,OAAO;AACL,kBAAM,KAAK,WAAW,MAAM,IAAI,IAAI,MAAM,KAAK,GAAG;AAAA,UACpD;AAAA,QACF,CAAC;AAAA,MACH,OAAO;AAEL,YAAI;AACF,gBAAM,WAAW,KAAK,MAAM,kBAAkB,SAAS,QAAQ,EAAE;AACjE,gBAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;AACnD,gBAAM,KAAK,WAAW,UAAU,GAAG;AAAA,QACrC,QAAQ;AACN,gBAAM,KAAK,WAAW,kBAAkB,SAAS,IAAI,GAAG;AAAA,QAC1D;AAAA,MACF;AAAA,IACF;AAEA,WAAO,MAAM,KAAK,SAAS;AAAA,EAC7B;AACF;",
6
6
  "names": []
7
7
  }
@@ -6,8 +6,8 @@ export declare function snippetz(): {
6
6
  print<T extends TargetId>(target: T, client: ClientId<T>, request: Partial<HarRequest>): string | undefined;
7
7
  clients(): import("@scalar/types/snippetz").Target[];
8
8
  plugins(): {
9
- target: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
10
- client: "libcurl" | "clj_http" | "httpclient" | "restsharp" | "native" | "http" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httpx_sync" | "httpx_async" | "httr" | "httpie" | "wget";
9
+ target: "c" | "clojure" | "csharp" | "dart" | "http" | "go" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "rust" | "shell" | "swift";
10
+ client: "libcurl" | "clj_http" | "httpclient" | "restsharp" | "http" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "httpx_sync" | "httpx_async" | "httr" | "reqwest" | "httpie" | "wget";
11
11
  }[];
12
12
  findPlugin: <T extends TargetId>(target: T | string, client: ClientId<T> | string) => import("@scalar/types/snippetz").Plugin | undefined;
13
13
  hasPlugin<T extends TargetId>(target: T | string, client: ClientId<T> | string): boolean;
@@ -2,7 +2,7 @@ import type { HarRequest } from '@scalar/types/snippetz';
2
2
  /**
3
3
  * Takes a httpsnippet-lite client and converts the given request to a code example with it.
4
4
  *
5
- * @deprecated This a temporary wrapper around httpsnippet-lite. Lets write all the generators ourselves instead.
5
+ * @deprecated This a temporary wrapper around httpsnippet-lite. Let's write all the generators ourselves instead.
6
6
  */
7
7
  export declare function convertWithHttpSnippetLite(client: Record<string, unknown>, request?: Partial<HarRequest>): string;
8
8
  //# sourceMappingURL=convertWithHttpSnippetLite.d.ts.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/convertWithHttpSnippetLite.ts"],
4
- "sourcesContent": ["import type { Request } from '@/httpsnippet-lite/types/httpsnippet'\nimport type { HarRequest } from '@scalar/types/snippetz'\n\n/**\n * Takes a httpsnippet-lite client and converts the given request to a code example with it.\n *\n * @deprecated This a temporary wrapper around httpsnippet-lite. Let\u2019s write all the generators ourselves instead.\n */\nexport function convertWithHttpSnippetLite(\n // Couldn\u2019t find the proper type, there was always a mismatch.\n client: Record<string, unknown>,\n request?: Partial<HarRequest>,\n): string {\n const urlObject = new URL(request?.url ?? '')\n\n // If it's just the domain, omit the trailing slash\n const url = urlObject.pathname === '/' ? urlObject.origin : urlObject.toString()\n\n const harRequest: HarRequest = {\n method: request?.method ?? 'GET',\n url,\n httpVersion: 'HTTP/1.1',\n cookies: [], // Cookies are handled through headers\n headers: request?.headers ?? [],\n headersSize: -1,\n bodySize: -1,\n queryString: Array.from(urlObject.searchParams.entries()).map(([name, value]) => ({\n name,\n value,\n })),\n postData: request?.postData,\n }\n\n const allHeaders = (harRequest?.headers ?? []).reduce(\n (acc, header) => ({\n ...acc,\n [header.name]: header.value,\n }),\n {} as Record<string, string>,\n )\n\n const queryObj = (harRequest.queryString ?? []).reduce(\n (acc, param) => ({\n ...acc,\n [param.name]: param.value,\n }),\n {} as Record<string, string>,\n )\n\n const cookiesObj = (harRequest.cookies ?? []).reduce(\n (acc, cookie) => ({\n ...acc,\n [cookie.name]: cookie.value,\n }),\n {} as Record<string, string>,\n )\n\n const parsedUrl = new URL(harRequest.url)\n const uriObj = {\n protocol: parsedUrl.protocol,\n hostname: parsedUrl.hostname,\n host: parsedUrl.hostname,\n port: parsedUrl.port,\n pathname:\n parsedUrl.pathname\n .split('/')\n .map((segment) => encodeURIComponent(decodeURIComponent(segment)))\n .join('/') + parsedUrl.search,\n path:\n parsedUrl.pathname\n .split('/')\n .map((segment) => encodeURIComponent(decodeURIComponent(segment)))\n .join('/') + parsedUrl.search,\n search: parsedUrl.search,\n hash: parsedUrl.hash,\n href: parsedUrl.href,\n origin: parsedUrl.origin,\n password: parsedUrl.password,\n searchParams: parsedUrl.searchParams,\n username: parsedUrl.username,\n toString: parsedUrl.toString,\n toJSON: () => parsedUrl.toJSON(),\n }\n\n const convertRequest = {\n url: harRequest.url,\n uriObj,\n method: harRequest.method?.toLocaleUpperCase() ?? 'GET',\n httpVersion: harRequest.httpVersion,\n cookies: harRequest.cookies ?? [],\n headers: harRequest.headers ?? [],\n headersSize: harRequest.headersSize ?? 0,\n headersObj: allHeaders ?? {},\n bodySize: harRequest.bodySize ?? 0,\n queryString: harRequest.queryString ?? [],\n postData: harRequest.postData\n ? {\n mimeType: harRequest.postData.mimeType ?? 'application/json',\n text: harRequest.postData.text ?? '',\n params: harRequest.postData.params ?? [],\n paramsObj:\n harRequest.postData.params?.reduce(\n (acc, param) => {\n if (param.name && param.value !== undefined) {\n acc[param.name] = param.value\n }\n return acc\n },\n {} as Record<string, string>,\n ) ?? {},\n }\n : undefined,\n allHeaders: allHeaders ?? {},\n fullUrl: harRequest.url,\n queryObj: queryObj ?? {},\n cookiesObj: cookiesObj ?? {},\n } as Request\n\n // If the request is a JSON request, parse the text as JSON\n if (convertRequest.postData?.mimeType === 'application/json' && convertRequest.postData?.text) {\n try {\n convertRequest.postData.jsonObj = JSON.parse(convertRequest.postData.text)\n } catch (error) {\n console.error('Error parsing JSON:', error)\n }\n }\n\n if (typeof client.convert === 'function') {\n return client.convert(convertRequest)\n }\n\n return ''\n}\n"],
4
+ "sourcesContent": ["import type { Request } from '@/httpsnippet-lite/types/httpsnippet'\nimport type { HarRequest } from '@scalar/types/snippetz'\n\n/**\n * Takes a httpsnippet-lite client and converts the given request to a code example with it.\n *\n * @deprecated This a temporary wrapper around httpsnippet-lite. Let's write all the generators ourselves instead.\n */\nexport function convertWithHttpSnippetLite(\n // Couldn't find the proper type, there was always a mismatch.\n client: Record<string, unknown>,\n request?: Partial<HarRequest>,\n): string {\n const urlObject = new URL(request?.url ?? '')\n\n // If it's just the domain, omit the trailing slash\n const url = urlObject.pathname === '/' ? urlObject.origin : urlObject.toString()\n\n const harRequest: HarRequest = {\n method: request?.method ?? 'GET',\n url,\n httpVersion: 'HTTP/1.1',\n cookies: [], // Cookies are handled through headers\n headers: request?.headers ?? [],\n headersSize: -1,\n bodySize: -1,\n queryString: Array.from(urlObject.searchParams.entries()).map(([name, value]) => ({\n name,\n value,\n })),\n postData: request?.postData,\n }\n\n const allHeaders = (harRequest?.headers ?? []).reduce(\n (acc, header) => ({\n ...acc,\n [header.name]: header.value,\n }),\n {} as Record<string, string>,\n )\n\n const queryObj = (harRequest.queryString ?? []).reduce(\n (acc, param) => ({\n ...acc,\n [param.name]: param.value,\n }),\n {} as Record<string, string>,\n )\n\n const cookiesObj = (harRequest.cookies ?? []).reduce(\n (acc, cookie) => ({\n ...acc,\n [cookie.name]: cookie.value,\n }),\n {} as Record<string, string>,\n )\n\n const parsedUrl = new URL(harRequest.url)\n const uriObj = {\n protocol: parsedUrl.protocol,\n hostname: parsedUrl.hostname,\n host: parsedUrl.hostname,\n port: parsedUrl.port,\n pathname:\n parsedUrl.pathname\n .split('/')\n .map((segment) => encodeURIComponent(decodeURIComponent(segment)))\n .join('/') + parsedUrl.search,\n path:\n parsedUrl.pathname\n .split('/')\n .map((segment) => encodeURIComponent(decodeURIComponent(segment)))\n .join('/') + parsedUrl.search,\n search: parsedUrl.search,\n hash: parsedUrl.hash,\n href: parsedUrl.href,\n origin: parsedUrl.origin,\n password: parsedUrl.password,\n searchParams: parsedUrl.searchParams,\n username: parsedUrl.username,\n toString: parsedUrl.toString,\n toJSON: () => parsedUrl.toJSON(),\n }\n\n const convertRequest = {\n url: harRequest.url,\n uriObj,\n method: harRequest.method?.toLocaleUpperCase() ?? 'GET',\n httpVersion: harRequest.httpVersion,\n cookies: harRequest.cookies ?? [],\n headers: harRequest.headers ?? [],\n headersSize: harRequest.headersSize ?? 0,\n headersObj: allHeaders ?? {},\n bodySize: harRequest.bodySize ?? 0,\n queryString: harRequest.queryString ?? [],\n postData: harRequest.postData\n ? {\n mimeType: harRequest.postData.mimeType ?? 'application/json',\n text: harRequest.postData.text ?? '',\n params: harRequest.postData.params ?? [],\n paramsObj:\n harRequest.postData.params?.reduce(\n (acc, param) => {\n if (param.name && param.value !== undefined) {\n acc[param.name] = param.value\n }\n return acc\n },\n {} as Record<string, string>,\n ) ?? {},\n }\n : undefined,\n allHeaders: allHeaders ?? {},\n fullUrl: harRequest.url,\n queryObj: queryObj ?? {},\n cookiesObj: cookiesObj ?? {},\n } as Request\n\n // If the request is a JSON request, parse the text as JSON\n if (convertRequest.postData?.mimeType === 'application/json' && convertRequest.postData?.text) {\n try {\n convertRequest.postData.jsonObj = JSON.parse(convertRequest.postData.text)\n } catch (error) {\n console.error('Error parsing JSON:', error)\n }\n }\n\n if (typeof client.convert === 'function') {\n return client.convert(convertRequest)\n }\n\n return ''\n}\n"],
5
5
  "mappings": "AAQO,SAAS,2BAEd,QACA,SACQ;AACR,QAAM,YAAY,IAAI,IAAI,SAAS,OAAO,EAAE;AAG5C,QAAM,MAAM,UAAU,aAAa,MAAM,UAAU,SAAS,UAAU,SAAS;AAE/E,QAAM,aAAyB;AAAA,IAC7B,QAAQ,SAAS,UAAU;AAAA,IAC3B;AAAA,IACA,aAAa;AAAA,IACb,SAAS,CAAC;AAAA;AAAA,IACV,SAAS,SAAS,WAAW,CAAC;AAAA,IAC9B,aAAa;AAAA,IACb,UAAU;AAAA,IACV,aAAa,MAAM,KAAK,UAAU,aAAa,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO;AAAA,MAChF;AAAA,MACA;AAAA,IACF,EAAE;AAAA,IACF,UAAU,SAAS;AAAA,EACrB;AAEA,QAAM,cAAc,YAAY,WAAW,CAAC,GAAG;AAAA,IAC7C,CAAC,KAAK,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,CAAC,OAAO,IAAI,GAAG,OAAO;AAAA,IACxB;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,WAAW,eAAe,CAAC,GAAG;AAAA,IAC9C,CAAC,KAAK,WAAW;AAAA,MACf,GAAG;AAAA,MACH,CAAC,MAAM,IAAI,GAAG,MAAM;AAAA,IACtB;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,cAAc,WAAW,WAAW,CAAC,GAAG;AAAA,IAC5C,CAAC,KAAK,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,CAAC,OAAO,IAAI,GAAG,OAAO;AAAA,IACxB;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,YAAY,IAAI,IAAI,WAAW,GAAG;AACxC,QAAM,SAAS;AAAA,IACb,UAAU,UAAU;AAAA,IACpB,U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C;AAAA,MACH,KAAK,CAAC;AAAA,IACV,IACA;AAAA,IACJ,YAAY,cAAc,CAAC;AAAA,IAC3B,SAAS,WAAW;AAAA,IACpB,UAAU,YAAY,CAAC;AAAA,IACvB,YAAY,cAAc,CAAC;AAAA,EAC7B;AAGA,MAAI,eAAe,UAAU,aAAa,sBAAsB,eAAe,UAAU,MAAM;AAC7F,QAAI;AACF,qBAAe,SAAS,UAAU,KAAK,MAAM,eAAe,SAAS,IAAI;AAAA,IAC3E,SAAS,OAAO;AACd,cAAQ,MAAM,uBAAuB,KAAK;AAAA,IAC5C;AAAA,EACF;AAEA,MAAI,OAAO,OAAO,YAAY,YAAY;AACxC,WAAO,OAAO,QAAQ,cAAc;AAAA,EACtC;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/scalar/scalar.git",
10
10
  "directory": "packages/snippetz"
11
11
  },
12
- "version": "0.3.1",
12
+ "version": "0.4.1",
13
13
  "engines": {
14
14
  "node": ">=20"
15
15
  },
@@ -181,6 +181,11 @@
181
181
  "types": "./dist/plugins/ruby/native/index.d.ts",
182
182
  "default": "./dist/plugins/ruby/native/index.js"
183
183
  },
184
+ "./plugins/rust/reqwest": {
185
+ "import": "./dist/plugins/rust/reqwest/index.js",
186
+ "types": "./dist/plugins/rust/reqwest/index.d.ts",
187
+ "default": "./dist/plugins/rust/reqwest/index.js"
188
+ },
184
189
  "./plugins/shell/curl": {
185
190
  "import": "./dist/plugins/shell/curl/index.js",
186
191
  "types": "./dist/plugins/shell/curl/index.d.ts",
@@ -213,12 +218,12 @@
213
218
  ],
214
219
  "module": "./dist/index.js",
215
220
  "dependencies": {
216
- "stringify-object": "^5.0.0"
221
+ "stringify-object": "^5.0.0",
222
+ "@scalar/types": "0.2.8"
217
223
  },
218
224
  "devDependencies": {
219
225
  "vite": "5.4.19",
220
- "@scalar/build-tooling": "0.2.3",
221
- "@scalar/types": "0.2.3"
226
+ "@scalar/build-tooling": "0.2.4"
222
227
  },
223
228
  "scripts": {
224
229
  "build": "scalar-build-esbuild",