Skip to content

Commit e01804c

Browse files
committed
test: update type declaration assertions for generated d.ts files
Fix test assertions to match updated TypeScript declaration format generated by tsup. Updates expectations for function declarations, constant exports, and UMD bundle structure in build artifact tests. Also enables DTS generation for CLI build and improves test code formatting. <!-- ps-id: 819eb0d5-f3aa-4133-a8b1-d5de3f6862e7 -->
1 parent d5fb652 commit e01804c

22 files changed

+1181
-1875
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [18.x, 20.x, 22.x, 23.x]
21+
node-version: [20.x, 22.x, 23.x, 24.x]
2222

2323
steps:
2424
- name: 📚 checkout

README.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,70 @@ JMESPath is a query language for JSON. It will take a JSON document
88
as input and transform it into another JSON document
99
given a JMESPath expression.
1010

11-
## INSTALLATION
12-
13-
```
11+
## Table of Contents
12+
13+
- [Installation](#installation)
14+
- [Usage](#usage)
15+
- [ESM (Node.js)](#esm-nodejs)
16+
- [CommonJS (Node.js)](#commonjs-nodejs)
17+
- [Browser (UMD)](#browser-umd)
18+
- [API](#api)
19+
- [`search(data, expression)`](#searchdata-jsonvalue-expression-string-jsonvalue)
20+
- [`compile(expression)`](#compileexpression-string-expressionnodetree)
21+
- [Extensions](#extensions-to-original-spec)
22+
- [More Resources](#more-resources)
23+
- [Experimental Features](#experimental-features)
24+
25+
## Installation
26+
27+
```bash
1428
npm install @jmespath-community/jmespath
1529
```
1630

17-
## USAGE
31+
## Usage
1832

19-
### `search(data: JSONValue, expression: string): JSONValue`
33+
### ESM (Node.js)
2034

2135
```javascript
2236
import { search } from "@jmespath-community/jmespath";
2337

24-
search({ foo: { bar: { baz: [0, 1, 2, 3, 4] } } }, "foo.bar.baz[2]");
38+
const data = { foo: { bar: { baz: [0, 1, 2, 3, 4] } } };
39+
const result = search(data, "foo.bar.baz[2]");
40+
41+
console.log(result);
42+
// Outputs: 2
43+
```
44+
45+
### CommonJS (Node.js)
46+
47+
```javascript
48+
const { search } = require("@jmespath-community/jmespath");
49+
50+
const data = { foo: { bar: { baz: [0, 1, 2, 3, 4] } } };
51+
const result = search(data, "foo.bar.baz[2]");
52+
53+
console.log(result);
54+
// Outputs: 2
55+
```
56+
57+
### Browser (UMD)
2558

26-
// OUTPUTS: 2
59+
You can include the UMD build directly in your HTML file. The library will be available under the `jmespath` global variable.
60+
61+
```html
62+
<script src="https://unpkg.com/@jmespath-community/jmespath/dist/index.umd.min.js"></script>
63+
<script>
64+
const data = { foo: { bar: { baz: [0, 1, 2, 3, 4] } } };
65+
const result = jmespath.search(data, "foo.bar.baz[2]");
66+
console.log(result);
67+
// Outputs: 2
68+
</script>
2769
```
2870

71+
## API
72+
73+
### `search(data: JSONValue, expression: string): JSONValue`
74+
2975
In the example we gave the `search` function input data of
3076
`{foo: {bar: {baz: [0, 1, 2, 3, 4]}}}` as well as the JMESPath
3177
expression `foo.bar.baz[2]`, and the `search` function evaluated
@@ -83,7 +129,7 @@ import { compile, TreeInterpreter } from "@jmespath-community/jmespath";
83129

84130
const ast = compile("foo.bar");
85131

86-
TreeInterpreter.search(ast, { foo: { bar: "BAZ" } });
132+
const result = TreeInterpreter.search(ast, { foo: { bar: "BAZ" } });
87133
// RETURNS: "BAZ"
88134
```
89135

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
33
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
44
"files": { "ignoreUnknown": false, "includes": ["**", "!**/dist", "!**/coverage", "!**/test/compliance"] },
55
"formatter": {

0 commit comments

Comments
 (0)