@scalar/snippetz 0.2.2 → 0.2.4

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
@@ -7,6 +7,8 @@
7
7
 
8
8
  A modern way to generate HTTP request examples for different languages and libraries.
9
9
 
10
+ Check out some examples [here](https://scalar-snippetz-801498848929.us-central1.run.app/)
11
+
10
12
  ## Installation
11
13
 
12
14
  ```bash
@@ -1,8 +1,13 @@
1
1
  import type { ClientId, Request, TargetId } from './core/index.js';
2
2
  import { undici } from './plugins/node/undici/index.js';
3
+ /**
4
+ * Generate code examples for HAR requests
5
+ */
3
6
  export declare function snippetz(): {
4
- get(target: TargetId, client: ClientId, request: Partial<Request>): import("./core/index.js").Source | undefined;
5
- print(target: TargetId, client: ClientId, request: Partial<Request>): string | undefined;
7
+ get(target: TargetId, client: ClientId, request: Partial<Request>): import("./core/index.js").Source | {
8
+ code: string;
9
+ };
10
+ print(target: TargetId, client: ClientId, request: Partial<Request>): string;
6
11
  targets(): TargetId[];
7
12
  clients(): ClientId[];
8
13
  plugins(): {
@@ -1 +1 @@
1
- {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKzD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,wBAAgB,QAAQ;gBAIR,QAAQ,UAAU,QAAQ,WAAW,OAAO,CAAC,OAAO,CAAC;kBAOnD,QAAQ,UAAU,QAAQ,WAAW,OAAO,CAAC,OAAO,CAAC;;;;;;;uBAyBhD,QAAQ,UAAU,QAAQ;sBAO3B,MAAM,UAAU,MAAM;EAI3C"}
1
+ {"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../src/snippetz.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAKzD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C;;GAEG;AACH,wBAAgB,QAAQ;gBAIR,QAAQ,UAAU,QAAQ,WAAW,OAAO,CAAC,OAAO,CAAC;;;kBAWnD,QAAQ,UAAU,QAAQ,WAAW,OAAO,CAAC,OAAO,CAAC;;;;;;;uBAyBhD,QAAQ,UAAU,QAAQ;sBAO3B,MAAM,UAAU,MAAM;EAI3C"}
package/dist/snippetz.js CHANGED
@@ -4,6 +4,9 @@ import { fetch as fetch$1 } from './plugins/js/fetch/fetch.js';
4
4
  import { ofetch } from './plugins/js/ofetch/ofetch.js';
5
5
  import { ofetch as ofetch$1 } from './plugins/node/ofetch/ofetch.js';
6
6
 
7
+ /**
8
+ * Generate code examples for HAR requests
9
+ */
7
10
  function snippetz() {
8
11
  const plugins = [undici, fetch, fetch$1, ofetch, ofetch$1];
9
12
  return {
@@ -12,6 +15,9 @@ function snippetz() {
12
15
  if (plugin) {
13
16
  return plugin(request);
14
17
  }
18
+ return {
19
+ code: '',
20
+ };
15
21
  },
16
22
  print(target, client, request) {
17
23
  return this.get(target, client, request)?.code;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/scalar/scalar.git",
10
10
  "directory": "packages/snippetz"
11
11
  },
12
- "version": "0.2.2",
12
+ "version": "0.2.4",
13
13
  "engines": {
14
14
  "node": ">=18"
15
15
  },
@@ -18,31 +18,38 @@
18
18
  "exports": {
19
19
  ".": {
20
20
  "import": "./dist/index.js",
21
- "types": "./dist/index.d.ts"
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
22
23
  },
23
24
  "./plugins/node/undici": {
24
25
  "import": "./dist/plugins/node/undici/index.js",
25
- "types": "./dist/plugins/node/undici/index.d.ts"
26
+ "types": "./dist/plugins/node/undici/index.d.ts",
27
+ "default": "./dist/plugins/node/undici/index.js"
26
28
  },
27
29
  "./plugins/node/ofetch": {
28
30
  "import": "./dist/plugins/node/ofetch/index.js",
29
- "types": "./dist/plugins/node/ofetch/index.d.ts"
31
+ "types": "./dist/plugins/node/ofetch/index.d.ts",
32
+ "default": "./dist/plugins/node/ofetch/index.js"
30
33
  },
31
34
  "./plugins/node/fetch": {
32
35
  "import": "./dist/plugins/node/fetch/index.js",
33
- "types": "./dist/plugins/node/fetch/index.d.ts"
36
+ "types": "./dist/plugins/node/fetch/index.d.ts",
37
+ "default": "./dist/plugins/node/fetch/index.js"
34
38
  },
35
39
  "./plugins/js/ofetch": {
36
40
  "import": "./dist/plugins/js/ofetch/index.js",
37
- "types": "./dist/plugins/js/ofetch/index.d.ts"
41
+ "types": "./dist/plugins/js/ofetch/index.d.ts",
42
+ "default": "./dist/plugins/js/ofetch/index.js"
38
43
  },
39
44
  "./plugins/js/fetch": {
40
45
  "import": "./dist/plugins/js/fetch/index.js",
41
- "types": "./dist/plugins/js/fetch/index.d.ts"
46
+ "types": "./dist/plugins/js/fetch/index.d.ts",
47
+ "default": "./dist/plugins/js/fetch/index.js"
42
48
  },
43
49
  "./core": {
44
50
  "import": "./dist/core/index.js",
45
- "types": "./dist/core/index.d.ts"
51
+ "types": "./dist/core/index.d.ts",
52
+ "default": "./dist/core/index.js"
46
53
  }
47
54
  },
48
55
  "files": [
@@ -52,10 +59,14 @@
52
59
  "module": "./dist/index.js",
53
60
  "devDependencies": {
54
61
  "@types/har-format": "^1.2.15",
55
- "@scalar/build-tooling": "0.1.10"
62
+ "@scalar/build-tooling": "0.1.11"
56
63
  },
57
64
  "scripts": {
58
65
  "build": "scalar-build-rollup",
66
+ "build:playground": "cd ./playground && pnpm build",
67
+ "dev": "cd ./playground && pnpm dev",
68
+ "lint:check": "eslint .",
69
+ "lint:fix": "eslint . --fix",
59
70
  "test": "vitest",
60
71
  "types:build": "scalar-types-build",
61
72
  "types:check": "scalar-types-check"