Skip to content

Commit cdee4fb

Browse files
committed
Merge branch 'main' of github.com:formkit/jsonreader
# Conflicts: # packages/docs/package.json # packages/docs/pages/docs/api-reference.vue # packages/docs/pages/docs/examples.vue # packages/docs/pages/docs/getting-started.vue # packages/docs/pages/index.vue
2 parents b0f8a4d + a1ed669 commit cdee4fb

File tree

12 files changed

+220
-521
lines changed

12 files changed

+220
-521
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,5 @@ jobs:
4141
- name: Install dependencies
4242
run: pnpm install
4343

44-
- name: Run linting
45-
run: pnpm lint
46-
47-
- name: Run type checking
48-
run: pnpm --filter jsonreader typecheck
49-
5044
- name: Run tests
5145
run: pnpm test

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# jsonreader monorepo
22

3-
This is a monorepo for the `jsonreader` package and its documentation site.
3+
[![Tests](https://github.com/formkit/jsonreader/actions/workflows/tests.yml/badge.svg)](https://github.com/formkit/jsonreader/actions/workflows/tests.yml)
4+
5+
This is a monorepo for the `@formkit/jsonreader` package and its documentation site.
46

57
## About jsonreader
68

7-
`jsonreader` is a specialized utility for processing JSON data from streams in real-time. Unlike traditional JSON parsers that require the entire payload before processing, `jsonreader` allows you to:
9+
`@formkit/jsonreader` is a specialized utility for processing JSON data from streams in real-time. Unlike traditional JSON parsers that require the entire payload before processing, `@formkit/jsonreader` allows you to:
810

911
- Process JSON progressively as it arrives from a stream
1012
- Extract specific properties as soon as they become available
@@ -35,7 +37,7 @@ Each commercial project requires a separate license. See the [documentation](htt
3537
## Quick Start
3638

3739
```typescript
38-
import { jsonReader, jsonPathReader } from 'jsonreader';
40+
import { jsonReader, jsonPathReader } from '@formkit/jsonreader';
3941

4042
// Get a stream reader (e.g. from fetch API)
4143
const response = await fetch('https://api.example.com/large-data.json');

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"name": "jsonreader-monorepo",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
5-
"description": "A monorepo for the jsonreader package and its documentation",
5+
"description": "A monorepo for the @formkit/jsonreader package and its documentation",
66
"scripts": {
77
"build": "pnpm -r build",
88
"dev:docs": "pnpm --filter docs dev",
9-
"dev:jsonreader": "pnpm --filter jsonreader dev",
9+
"dev:jsonreader": "pnpm --filter @formkit/jsonreader dev",
1010
"test": "pnpm -r test",
11-
"lint": "pnpm -r lint"
11+
"lint": "pnpm -r lint",
12+
"release": "pnpm build && bumpp -r && cd packages/jsonreader && pnpm publish"
1213
},
1314
"keywords": [
1415
"json",
@@ -26,6 +27,7 @@
2627
"devDependencies": {
2728
"@tailwindcss/typography": "^0.5.16",
2829
"autoprefixer": "^10.4.21",
30+
"bumpp": "^10.1.0",
2931
"postcss": "^8.5.3",
3032
"shikiji": "^0.10.2",
3133
"tailwindcss": "^3.4.11"

packages/docs/components/DocFooter.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</li>
5050
<li>
5151
<a
52-
href="https://www.npmjs.com/package/jsonreader"
52+
href="https://www.npmjs.com/package/@formkit/jsonreader"
5353
target="_blank"
5454
class="text-gray-600 hover:text-accent-1 transition-colors"
5555
>npm Package</a
@@ -60,7 +60,7 @@
6060
<div class="fade-in">
6161
<h3 class="text-xl font-bold text-black mb-6">About</h3>
6262
<p class="text-gray-600 mb-6">
63-
jsonreader is a utility for processing JSON data from streams in
63+
@formkit/jsonreader is a utility for processing JSON data from streams in
6464
real-time, optimized for AI tool calls and large API responses.
6565
</p>
6666
<div class="flex items-center space-x-4">

packages/docs/pages/docs/api-reference.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<CodeBlock
1616
language="javascript"
17-
code="import { jsonReader } from 'jsonreader';
17+
code="import { jsonReader } from '@formkit/jsonreader';
1818
1919
for await (const partialData of jsonReader(reader)) {
2020
// Process the partial data
@@ -157,7 +157,7 @@ for await (const partialData of jsonReader(reader)) {
157157

158158
<CodeBlock
159159
language="javascript"
160-
code="import { jsonReader } from 'jsonreader';
160+
code="import { jsonReader } from '@formkit/jsonreader';
161161
162162
for await (const partialData of jsonReader(reader, {
163163
// Only yield when these properties are present
@@ -190,7 +190,7 @@ for await (const partialData of jsonReader(reader, {
190190

191191
<CodeBlock
192192
language="javascript"
193-
code="import { jsonPathReader } from 'jsonreader';
193+
code="import { jsonPathReader } from '@formkit/jsonreader';
194194
195195
const reader = response.body.getReader();
196196
const paths = [
@@ -348,7 +348,7 @@ for await (const [value, path] of jsonPathReader(reader, paths)) {
348348

349349
<CodeBlock
350350
language="javascript"
351-
code="import { jsonPathReader } from 'jsonreader';
351+
code="import { jsonPathReader } from '@formkit/jsonreader';
352352
353353
async function searchWithRealtimeResults() {
354354
const response = await fetch('https://api.search-service.com/search?q=jsonreader');

packages/docs/pages/docs/examples.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<CodeBlock
5151
language="javascript"
52-
code="import { jsonReader } from 'jsonreader';
52+
code="import { jsonReader } from '@formkit/jsonreader';
5353
5454
async function processAIFunctionCall() {
5555
// Call an AI model with function calling enabled
@@ -128,7 +128,7 @@ async function processAIFunctionCall() {
128128

129129
<CodeBlock
130130
language="javascript"
131-
code="import { jsonPathReader } from 'jsonreader';
131+
code="import { jsonPathReader } from '@formkit/jsonreader';
132132
133133
async function progressiveProfileLoader() {
134134
const response = await fetch('/api/user/profile');
@@ -192,7 +192,7 @@ async function progressiveProfileLoader() {
192192
<CodeBlock
193193
language="javascript"
194194
code="import { createReadStream } from 'fs';
195-
import { jsonReader } from 'jsonreader';
195+
import { jsonReader } from '@formkit/jsonreader';
196196
197197
async function processLargeJsonFile(filePath) {
198198
// Create a file stream

packages/docs/pages/docs/getting-started.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pnpm add jsonreader"
100100

101101
<CodeBlock
102102
language="javascript"
103-
code="import { jsonReader } from 'jsonreader';
103+
code="import { jsonReader } from '@formkit/jsonreader';
104104
105105
async function processStreamingData() {
106106
// Get a stream from somewhere (e.g., fetch API)
@@ -135,7 +135,7 @@ async function processStreamingData() {
135135

136136
<CodeBlock
137137
language="javascript"
138-
code="import { jsonReader } from 'jsonreader';
138+
code="import { jsonReader } from '@formkit/jsonreader';
139139
140140
async function processToolResults() {
141141
const response = await fetch('https://api.ai-service.com/v1/generate');
@@ -170,7 +170,7 @@ async function processToolResults() {
170170

171171
<CodeBlock
172172
language="javascript"
173-
code="import { jsonPathReader } from 'jsonreader';
173+
code="import { jsonPathReader } from '@formkit/jsonreader';
174174
175175
// Define paths to extract
176176
const paths = [

packages/docs/pages/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<!-- Simple Code Example -->
6464
<CodeBlock
6565
language="javascript"
66-
code="import { jsonReader } from 'jsonreader';
66+
code="import { jsonReader } from '@formkit/jsonreader';
6767
6868
// Get a reader from a streaming response
6969
const reader = response.body.getReader();
@@ -516,7 +516,7 @@ pnpm add jsonreader"
516516

517517
<CodeBlock
518518
language="javascript"
519-
code="import { jsonReader } from 'jsonreader';
519+
code="import { jsonReader } from '@formkit/jsonreader';
520520
521521
async function processStreamingData() {
522522
// Get a stream from somewhere (e.g., fetch API)
@@ -596,7 +596,7 @@ async function processStreamingData() {
596596

597597
<CodeBlock
598598
language="javascript"
599-
code="import { jsonReader } from 'jsonreader';
599+
code="import { jsonReader } from '@formkit/jsonreader';
600600
601601
for await (const data of jsonReader(reader, {
602602
// Won't yield anything until 'metadata' is complete
@@ -635,7 +635,7 @@ for await (const data of jsonReader(reader, {
635635

636636
<CodeBlock
637637
language="javascript"
638-
code="import { jsonPathReader } from 'jsonreader';
638+
code="import { jsonPathReader } from '@formkit/jsonreader';
639639
640640
for await (const [value, path] of jsonPathReader(reader, [
641641
'results',

packages/jsonreader/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# jsonreader
1+
# @formkit/jsonreader
2+
3+
[![Tests](https://github.com/formkit/jsonreader/actions/workflows/tests.yml/badge.svg)](https://github.com/formkit/jsonreader/actions/workflows/tests.yml)
24

35
A lightweight utility for reading and parsing JSON from streams in real-time, yielding progressively updated results as data arrives.
46

@@ -23,19 +25,19 @@ Each commercial project requires a separate license. See the [documentation](htt
2325

2426
```bash
2527
# npm
26-
npm install jsonreader
28+
npm install @formkit/jsonreader
2729

2830
# yarn
29-
yarn add jsonreader
31+
yarn add @formkit/jsonreader
3032

3133
# pnpm
32-
pnpm add jsonreader
34+
pnpm add @formkit/jsonreader
3335
```
3436

3537
## Basic Usage
3638

3739
```typescript
38-
import { jsonReader } from 'jsonreader';
40+
import { jsonReader } from '@formkit/jsonreader';
3941

4042
// Example with a fetch request
4143
const response = await fetch('https://api.example.com/large-data.json');
@@ -56,7 +58,7 @@ for await (const partialData of jsonReader(reader)) {
5658
### Getting Specific Properties as Soon as They're Available
5759

5860
```typescript
59-
import { jsonPathReader } from 'jsonreader';
61+
import { jsonPathReader } from '@formkit/jsonreader';
6062

6163
const response = await fetch('https://api.example.com/large-data.json');
6264
if (!response.body) throw new Error('No response body');
@@ -80,7 +82,7 @@ for await (const [value, path] of jsonPathReader(reader, paths)) {
8082
### Controlling When Data is Yielded
8183

8284
```typescript
83-
import { jsonReader } from 'jsonreader';
85+
import { jsonReader } from '@formkit/jsonreader';
8486

8587
const response = await fetch('https://api.example.com/large-data.json');
8688
if (!response.body) throw new Error('No response body');
@@ -152,7 +154,7 @@ Paths use dot notation to refer to nested properties:
152154
## Example: Real-time UI Updates During File Upload
153155

154156
```typescript
155-
import { jsonPathReader } from 'jsonreader';
157+
import { jsonPathReader } from '@formkit/jsonreader';
156158

157159
async function processFileUpload(fileUploadResponse) {
158160
const reader = fileUploadResponse.body.getReader();
@@ -184,7 +186,7 @@ async function processFileUpload(fileUploadResponse) {
184186

185187
## How It Works
186188

187-
The `jsonreader` utility parses JSON data character by character as it arrives from a stream. It builds up a syntactically valid JSON structure as data comes in, closing any unclosed objects or arrays to create valid partial representations.
189+
The `@formkit/jsonreader` utility parses JSON data character by character as it arrives from a stream. It builds up a syntactically valid JSON structure as data comes in, closing any unclosed objects or arrays to create valid partial representations.
188190

189191
For each chunk of data received:
190192

packages/jsonreader/examples/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# jsonreader Examples
1+
# @formkit/jsonreader Examples
22

3-
This directory contains examples demonstrating how to use the `jsonreader` package for streaming JSON processing.
3+
[![Tests](https://github.com/formkit/jsonreader/actions/workflows/tests.yml/badge.svg)](https://github.com/formkit/jsonreader/actions/workflows/tests.yml)
4+
5+
This directory contains examples demonstrating how to use the `@formkit/jsonreader` package for streaming JSON processing.
46

57
## Running the Examples
68

@@ -30,7 +32,7 @@ node examples/basic-usage.js
3032
## Available Examples
3133

3234
1. **Basic Usage** (`basic-usage.ts`)
33-
- Demonstrates the fundamental usage patterns of jsonreader
35+
- Demonstrates the fundamental usage patterns of @formkit/jsonreader
3436
- Shows how to use `jsonReader` with fetch API
3537
- Shows how to use `jsonPathReader` to extract specific paths
3638
- Shows how to use options to control when data is yielded
@@ -43,7 +45,7 @@ node examples/basic-usage.js
4345

4446
## Example Code Structure
4547

46-
Each example file is structured to demonstrate specific features of the `jsonreader` package:
48+
Each example file is structured to demonstrate specific features of the `@formkit/jsonreader` package:
4749

4850
- **Import**: Import the necessary functions from the package
4951
- **Setup**: Create a ReadableStream or obtain one from an API

0 commit comments

Comments
 (0)