diff --git a/build.deno.js b/build.deno.js index 940aae6..6b46b93 100644 --- a/build.deno.js +++ b/build.deno.js @@ -9,6 +9,10 @@ import { writeFileSync, } from "fs"; +import pkgInfo from "./package.json" assert { type: "json" }; + +const denoXURL = `https://deno.land/x/streamparser_json@v${pkgInfo.version}`; + function copyReadme(src, dest) { writeFileSync( path.join(dest, "README.md"), @@ -16,11 +20,11 @@ function copyReadme(src, dest) { .toString() .replace( /import \{ (.*) \} from '@streamparser\/json';/gm, - 'import { $1 } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/' + `import { $1 } from "${denoXURL}/index.ts";/` ) .replace( /import { (.*) } from '@streamparser\/json\/(.*).js';/gm, - 'import { $1 } from "https://deno.land/x/streamparser_json@v0.0.13/$2.ts)";/' + `import { $1 } from "${denoXURL}/$2.ts)";/` ) ); } @@ -42,13 +46,10 @@ function processDir(src, dest) { readFileSync(currentPath) .toString() .replace(/from "(\.[.\\/-\w]+).js"/gm, 'from "$1.ts"') - .replace( - /from "@streamparser\/json"/gm, - 'from "https://deno.land/x/streamparser_json@v0.0.13/index.ts"' - ) + .replace(/from "@streamparser\/json"/gm, `from "${denoXURL}/index.ts"`) .replace( /from "@streamparser\/json\/(.*).js"/gm, - 'from "https://deno.land/x/streamparser_json@v0.0.13/$1.ts"' + `from "${denoXURL}/$1.ts"` ) ); }); diff --git a/package-lock.json b/package-lock.json index 2494dd3..51c72c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "streamparser-json", - "version": "0.0.13", + "version": "0.0.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "streamparser-json", - "version": "0.0.13", + "version": "0.0.14", "license": "MIT", "workspaces": [ "packages/plainjs", @@ -4955,14 +4955,16 @@ } }, "packages/plainjs": { - "version": "0.0.13", + "name": "@streamparser/json", + "version": "0.0.14", "license": "MIT" }, "packages/whatwg": { - "version": "0.0.13", + "name": "@streamparser/json-whatwg", + "version": "0.0.14", "license": "MIT", "dependencies": { - "@streamparser/json": "^0.0.13" + "@streamparser/json": "^0.0.14" } } } diff --git a/package.json b/package.json index bfb4957..837fd5d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "streamparser-json", "description": "Streaming JSON parser in Javascript for Node.js, Deno and the browser", - "version": "0.0.13", + "version": "0.0.14", "type": "module", "author": "Juanjo Diaz ", "repository": { diff --git a/packages/plainjs/dist/deno/README.md b/packages/plainjs/dist/deno/README.md index b27f122..a45c238 100644 --- a/packages/plainjs/dist/deno/README.md +++ b/packages/plainjs/dist/deno/README.md @@ -10,7 +10,7 @@ Fast dependency-free library to parse a JSON stream using utf-8 encoding in Node *tldr;* ```javascript -import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const parser = new JSONParser(); parser.onValue = ({ value }) => { /* process data */ }; @@ -51,7 +51,7 @@ If you are targeting browsers or systems in which these might be missing, you ne A JSON compliant tokenizer that parses a utf-8 stream into JSON tokens ```javascript -import { Tokenizer } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { Tokenizer } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const tokenizer = new Tokenizer(opts); ``` @@ -162,7 +162,7 @@ A drop-in replacement of `JSONparse` (with few ~~breaking changes~~ improvements ```javascript -import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const parser = new JSONParser(); ``` @@ -222,7 +222,7 @@ You push data using the `write` method which takes a string or an array-like obj You can subscribe to the resulting data using the ```javascript -import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const parser = new JSONParser({ stringBufferSize: undefined, paths: ['$'] }); parser.onValue = console.log; @@ -240,7 +240,7 @@ parser.write('"');// logs "Hello world!" Write is always a synchronous operation so any error during the parsing of the stream will be thrown during the write operation. After an error, the parser can't continue parsing. ```javascript -import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const parser = new JSONParser({ stringBufferSize: undefined }); parser.onValue = console.log; @@ -255,7 +255,7 @@ try { You can also handle errors using callbacks: ```javascript -import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ +import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const parser = new JSONParser({ stringBufferSize: undefined }); parser.onValue = console.log; @@ -293,7 +293,7 @@ Imagine an endpoint that send a large amount of JSON objects one after the other Imagine an endpoint that send a large amount of JSON objects one after the other (`[{"id":1},{"id":2},{"id":3},...]`). ```js - import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts";/ + import { JSONParser } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts";/ const jsonparser = new JSONParser({ stringBufferSize: undefined, paths: ['$.*'] }); jsonparser.onValue = ({ value, key, parent, stack }) => { diff --git a/packages/plainjs/package.json b/packages/plainjs/package.json index 267cee3..ae45b4a 100644 --- a/packages/plainjs/package.json +++ b/packages/plainjs/package.json @@ -1,7 +1,7 @@ { "name": "@streamparser/json", "description": "Streaming JSON parser in Javascript for Node.js, Deno and the browser", - "version": "0.0.13", + "version": "0.0.14", "main": "./dist/mjs/index.js", "module": "./dist/mjs/index.js", "browser": "./dist/mjs/index.js", diff --git a/packages/whatwg/dist/deno/index.ts b/packages/whatwg/dist/deno/index.ts index d40267c..3928139 100644 --- a/packages/whatwg/dist/deno/index.ts +++ b/packages/whatwg/dist/deno/index.ts @@ -10,4 +10,4 @@ export { TokenParserMode, type StackElement, TokenType, -} from "https://deno.land/x/streamparser_json@v0.0.13/index.ts"; +} from "https://deno.land/x/streamparser_json@v0.0.14/index.ts"; diff --git a/packages/whatwg/dist/deno/jsonparser.ts b/packages/whatwg/dist/deno/jsonparser.ts index add175e..364c175 100644 --- a/packages/whatwg/dist/deno/jsonparser.ts +++ b/packages/whatwg/dist/deno/jsonparser.ts @@ -1,5 +1,5 @@ -import { JSONParser, type JSONParserOptions } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts"; -import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.13/utils/types/parsedElementInfo.ts"; +import { JSONParser, type JSONParserOptions } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts"; +import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.14/utils/types/parsedElementInfo.ts"; import { cloneParsedElementInfo } from "./utils.ts"; class JSONParserTransformer diff --git a/packages/whatwg/dist/deno/tokenizer.ts b/packages/whatwg/dist/deno/tokenizer.ts index 63e5a4b..d9eca16 100644 --- a/packages/whatwg/dist/deno/tokenizer.ts +++ b/packages/whatwg/dist/deno/tokenizer.ts @@ -1,7 +1,7 @@ import Tokenizer, { type TokenizerOptions, -} from "https://deno.land/x/streamparser_json@v0.0.13/tokenizer.ts"; -import type { ParsedTokenInfo } from "https://deno.land/x/streamparser_json@v0.0.13/utils/types/parsedTokenInfo.ts"; +} from "https://deno.land/x/streamparser_json@v0.0.14/tokenizer.ts"; +import type { ParsedTokenInfo } from "https://deno.land/x/streamparser_json@v0.0.14/utils/types/parsedTokenInfo.ts"; class TokenizerTransformer extends Tokenizer diff --git a/packages/whatwg/dist/deno/tokenparser.ts b/packages/whatwg/dist/deno/tokenparser.ts index d6c2214..3201876 100644 --- a/packages/whatwg/dist/deno/tokenparser.ts +++ b/packages/whatwg/dist/deno/tokenparser.ts @@ -1,6 +1,6 @@ -import { TokenParser, type TokenParserOptions } from "https://deno.land/x/streamparser_json@v0.0.13/index.ts"; -import type { ParsedTokenInfo } from "https://deno.land/x/streamparser_json@v0.0.13/utils/types/parsedTokenInfo.ts"; -import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.13/utils/types/parsedElementInfo.ts"; +import { TokenParser, type TokenParserOptions } from "https://deno.land/x/streamparser_json@v0.0.14/index.ts"; +import type { ParsedTokenInfo } from "https://deno.land/x/streamparser_json@v0.0.14/utils/types/parsedTokenInfo.ts"; +import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.14/utils/types/parsedElementInfo.ts"; import { cloneParsedElementInfo } from "./utils.ts"; class TokenParserTransformer diff --git a/packages/whatwg/dist/deno/utils.ts b/packages/whatwg/dist/deno/utils.ts index e9274a3..ecfaf14 100644 --- a/packages/whatwg/dist/deno/utils.ts +++ b/packages/whatwg/dist/deno/utils.ts @@ -1,4 +1,4 @@ -import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.13/utils/types/parsedElementInfo.ts"; +import type { ParsedElementInfo } from "https://deno.land/x/streamparser_json@v0.0.14/utils/types/parsedElementInfo.ts"; export function cloneParsedElementInfo( parsedElementInfo: ParsedElementInfo diff --git a/packages/whatwg/package.json b/packages/whatwg/package.json index d1db80c..4cbd2d7 100644 --- a/packages/whatwg/package.json +++ b/packages/whatwg/package.json @@ -1,7 +1,7 @@ { "name": "@streamparser/json-whatwg", "description": "Streaming JSON parser in Javascript for Node.js, Deno and the browser", - "version": "0.0.13", + "version": "0.0.14", "main": "./dist/mjs/index.js", "module": "./dist/mjs/index.js", "browser": "./dist/mjs/index.js", @@ -42,6 +42,6 @@ "stream" ], "dependencies": { - "@streamparser/json": "^0.0.13" + "@streamparser/json": "^0.0.14" } }