Skip to content

Commit

Permalink
Update Deno Dependencies (#8)
Browse files Browse the repository at this point in the history
* chore(deps): update deno dependencies

* bundle file

---------

Co-authored-by: GitHub <[email protected]>
Co-authored-by: ayame113 <[email protected]>
  • Loading branch information
3 people authored Apr 30, 2023
1 parent 42c461f commit f8d6552
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 18 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"exclude": ["./js/"]
}
},
"importMap": "./import-map.json"
"importMap": "./import-map.json",
"lock": false
}
4 changes: 2 additions & 2 deletions dev/build_npm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fromFileUrl } from "https://deno.land/std@0.173.0/path/mod.ts";
import { build, emptyDir } from "https://deno.land/x/dnt@0.33.0/mod.ts";
import { fromFileUrl } from "https://deno.land/std@0.185.0/path/mod.ts";
import { build, emptyDir } from "https://deno.land/x/dnt@0.34.0/mod.ts";

const outDir = fromFileUrl(new URL("./npm/", import.meta.url));
const projectRootDir = fromFileUrl(new URL("../", import.meta.url));
Expand Down
2 changes: 1 addition & 1 deletion dev/transpile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fromFileUrl } from "https://deno.land/std@0.173.0/path/mod.ts";
import { fromFileUrl } from "https://deno.land/std@0.185.0/path/mod.ts";

const input = fromFileUrl(new URL("../mod.ts", import.meta.url));
const output = fromFileUrl(new URL("../js/mod.js", import.meta.url));
Expand Down
4 changes: 2 additions & 2 deletions dev/transpile_check.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from "https://deno.land/std@0.173.0/testing/asserts.ts";
import { fromFileUrl } from "https://deno.land/std@0.173.0/path/mod.ts";
import { assertEquals } from "https://deno.land/std@0.185.0/testing/asserts.ts";
import { fromFileUrl } from "https://deno.land/std@0.185.0/path/mod.ts";

const input = fromFileUrl(new URL("../mod.ts", import.meta.url));
const output = fromFileUrl(new URL("../js/mod.js", import.meta.url));
Expand Down
16 changes: 10 additions & 6 deletions js/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class TextDelimiterStream extends TransformStream {
#inspectIndex = 0;
#matchIndex = 0;
#delimLPS;
constructor(delimiter){
#disp;
constructor(delimiter, options){
super({
transform: (chunk, controller)=>{
this.#handle(chunk, controller);
Expand All @@ -78,6 +79,7 @@ class TextDelimiterStream extends TransformStream {
});
this.#delimiter = delimiter;
this.#delimLPS = createLPS(new TextEncoder().encode(delimiter));
this.#disp = options?.disposition ?? "discard";
}
#handle(chunk, controller) {
this.#buf += chunk;
Expand All @@ -88,11 +90,13 @@ class TextDelimiterStream extends TransformStream {
localIndex++;
this.#matchIndex++;
if (this.#matchIndex === this.#delimiter.length) {
const matchEnd = this.#inspectIndex - this.#delimiter.length;
const readyString = this.#buf.slice(0, matchEnd);
controller.enqueue(readyString);
this.#buf = this.#buf.slice(this.#inspectIndex);
this.#inspectIndex = 0;
const start = this.#inspectIndex - this.#delimiter.length;
const end = this.#disp === "suffix" ? this.#inspectIndex : start;
const copy = this.#buf.slice(0, end);
controller.enqueue(copy);
const shift = this.#disp == "prefix" ? start : this.#inspectIndex;
this.#buf = this.#buf.slice(shift);
this.#inspectIndex = this.#disp == "prefix" ? this.#delimiter.length : 0;
this.#matchIndex = 0;
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
assertEquals,
assertRejects,
} from "https://deno.land/std@0.173.0/testing/asserts.ts";
import { readableStreamFromIterable } from "https://deno.land/std@0.173.0/streams/readable_stream_from_iterable.ts";
} from "https://deno.land/std@0.185.0/testing/asserts.ts";
import { readableStreamFromIterable } from "https://deno.land/std@0.185.0/streams/readable_stream_from_iterable.ts";
import {
ConcatenatedJSONParseStream,
ConcatenatedJSONStringifyStream,
Expand Down
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TextDelimiterStream } from "https://deno.land/std@0.173.0/streams/text_delimiter_stream.ts";
import { TextDelimiterStream } from "https://deno.land/std@0.185.0/streams/text_delimiter_stream.ts";
import { JSONValue, transformStreamFromGeneratorFunction } from "./utils.ts";

// avoid dnt typecheck error
Expand Down
4 changes: 2 additions & 2 deletions src/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface StringifyStreamOptions {
* stream to stringify [JSON lines](https://jsonlines.org/), [NDJSON](http://ndjson.org/) and [JSON Text Sequences](https://datatracker.ietf.org/doc/html/rfc7464).
*
* ```ts
* import { readableStreamFromIterable } from "https://deno.land/std@0.173.0/streams/mod.ts";
* import { readableStreamFromIterable } from "https://deno.land/std@0.185.0/streams/mod.ts";
* import { JSONLinesStringifyStream } from "https://deno.land/x/[email protected]/mod.ts";
*
* const file = await Deno.open(new URL("./tmp.concat-json", import.meta.url), {
Expand Down Expand Up @@ -57,7 +57,7 @@ export class JSONLinesStringifyStream extends TransformStream<unknown, string> {
* stream to stringify [Concatenated JSON](https://en.wikipedia.org/wiki/JSON_streaming#Concatenated_JSON).
*
* ```ts
* import { readableStreamFromIterable } from "https://deno.land/std@0.173.0/streams/mod.ts";
* import { readableStreamFromIterable } from "https://deno.land/std@0.185.0/streams/mod.ts";
* import { ConcatenatedJSONStringifyStream } from "https://deno.land/x/[email protected]/mod.ts";
*
* const file = await Deno.open(new URL("./tmp.concat-json", import.meta.url), {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type _QueuingStrategy<T> = QueuingStrategy<T | undefined>;
* Convert the generator function into a TransformStream.
*
* ```ts
* import { readableStreamFromIterable } from "https://deno.land/std@0.173.0/streams/mod.ts";
* import { readableStreamFromIterable } from "https://deno.land/std@0.185.0/streams/mod.ts";
* import { transformStreamFromGeneratorFunction } from "https://deno.land/x/[email protected]/mod.ts";
*
* const reader = readableStreamFromIterable([0, 1, 2])
Expand Down

0 comments on commit f8d6552

Please sign in to comment.