Public
Versions
- Open: VersionChanges from v11 to v12+12-12⦚ 21 unchanged lines ⦚let transforms = [1];
const pipeline = new TextDecoderStream();const pipelineEnd = new TextEncoderStream();let stream = pipeline.readable;let index = 0;while (index < transforms.length) {// const getTransform = transforms.at(index);stream = stream.pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),);}stream.pipeThrough(pipelineEnd);res.body.pipeTo(pipeline.writable);return new Response(⦚ 17 unchanged lines ⦚⦚ 21 unchanged lines ⦚let transforms = [1];// const pipeline = new TextDecoderStream();// const pipelineEnd = new TextEncoderStream();// let stream = pipeline.readable;// let index = 0;// while (index < transforms.length) {// // const getTransform = transforms.at(index);// stream = stream.pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// );// }// stream.pipeThrough(pipelineEnd);// res.body.pipeTo(pipeline.writable);return new Response(⦚ 17 unchanged lines ⦚ - Open: VersionChanges from v10 to v11+1-1⦚ 42 unchanged lines ⦚new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),new TextEncoderStream(),
)// res.body// .pipeThrough(new TextDecoderStream())⦚ 9 unchanged lines ⦚⦚ 42 unchanged lines ⦚new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),new TextEncoderStream(),),// res.body// .pipeThrough(new TextDecoderStream())⦚ 9 unchanged lines ⦚ - Open: VersionChanges from v9 to v10+9-1import { InjectCodeOnValTownStream } from "https://esm.town/v/andreterron/InjectCodeOnValTownStream?v=4";import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=26";import { parse } from "npm:content-type";const { author, name } = extractValInfo(import.meta.url);⦚ 29 unchanged lines ⦚return new Response(
// res.body// .pipeThrough(new TextDecoderStream())// .pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// )// .pipeThrough(new TextEncoderStream()),pipelineEnd.readable,// stream.pipeThrough(new TextEncoderStream()),res,);}import { InjectCodeOnValTownStream } from "https://esm.town/v/andreterron/InjectCodeOnValTownStream?v=4";import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=26";import { parse } from "npm:content-type";import { pipe } from "npm:web-streams-extensions";const { author, name } = extractValInfo(import.meta.url);⦚ 29 unchanged lines ⦚return new Response(pipe(res.body,new TextDecoderStream(),new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),new TextEncoderStream(),)// res.body// .pipeThrough(new TextDecoderStream())// .pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// )// .pipeThrough(new TextEncoderStream()),// pipelineEnd.readable,// stream.pipeThrough(new TextEncoderStream()),res,);} - Open: VersionChanges from v8 to v9+5-2⦚ 20 unchanged lines ⦚const pipeline = new TextDecoderStream();let stream = pipeline.readable;⦚ 5 unchanged lines ⦚);}
stream.pipeThrough(new TextEncoderStream());return new Response(⦚ 4 unchanged lines ⦚// )// .pipeThrough(new TextEncoderStream()),res.body.pipeThrough(pipeline),// stream.pipeThrough(new TextEncoderStream()),res,);}⦚ 20 unchanged lines ⦚const pipeline = new TextDecoderStream();const pipelineEnd = new TextEncoderStream();let stream = pipeline.readable;⦚ 5 unchanged lines ⦚);}stream.pipeThrough(pipelineEnd);res.body.pipeTo(pipeline.writable);return new Response(⦚ 4 unchanged lines ⦚// )// .pipeThrough(new TextEncoderStream()),pipelineEnd.readable,// stream.pipeThrough(new TextEncoderStream()),res,);} - Open: VersionChanges from v7 to v8+6-2⦚ 19 unchanged lines ⦚let transforms = [1];
let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {⦚ 3 unchanged lines ⦚);}return new Response(⦚ 4 unchanged lines ⦚// )// .pipeThrough(new TextEncoderStream()),stream.pipeThrough(new TextEncoderStream()),res,);}⦚ 19 unchanged lines ⦚let transforms = [1];const pipeline = new TextDecoderStream();let stream = pipeline.readable;let index = 0;while (index < transforms.length) {⦚ 3 unchanged lines ⦚);}stream.pipeThrough(new TextEncoderStream());return new Response(⦚ 4 unchanged lines ⦚// )// .pipeThrough(new TextEncoderStream()),res.body.pipeThrough(pipeline),// stream.pipeThrough(new TextEncoderStream()),res,);} - Open: VersionChanges from v6 to v7+15-15⦚ 19 unchanged lines ⦚let transforms = [1];
// let stream = res.body.pipeThrough(new TextDecoderStream());// let index = 0;// while (index < transforms.length) {// // const getTransform = transforms.at(index);// stream = stream.pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// );// }return new Response(res.body.pipeThrough(new TextDecoderStream()).pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),).pipeThrough(new TextEncoderStream()),// stream.pipeThrough(new TextEncoderStream()),res,);}⦚ 19 unchanged lines ⦚let transforms = [1];let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {// const getTransform = transforms.at(index);stream = stream.pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),);}return new Response(// res.body// .pipeThrough(new TextDecoderStream())// .pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// )// .pipeThrough(new TextEncoderStream()),stream.pipeThrough(new TextEncoderStream()),res,);} - Open: VersionChanges from v5 to v6+15-9⦚ 19 unchanged lines ⦚let transforms = [1];
let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {// const getTransform = transforms.at(index);stream = stream.pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),);}return new Response(stream.pipeThrough(new TextEncoderStream()),res,);}⦚ 19 unchanged lines ⦚let transforms = [1];// let stream = res.body.pipeThrough(new TextDecoderStream());// let index = 0;// while (index < transforms.length) {// // const getTransform = transforms.at(index);// stream = stream.pipeThrough(// new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),// );// }return new Response(res.body.pipeThrough(new TextDecoderStream()).pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),).pipeThrough(new TextEncoderStream()),// stream.pipeThrough(new TextEncoderStream()),res,);} - Open: VersionChanges from v4 to v5+14-6import { parse } from "npm:content-type";export function pipeResponse(res: Response,
...transforms: Array<() => ReadableWritablePair>) {const contentType = res.headers.get("content-type");if (!contentType || parse(contentType).type !== "text/html") {return res;}if (!transforms.length) {return res;}let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {const getTransform = transforms.at(index);stream = stream.pipeThrough(getTransform());}⦚ 5 unchanged lines ⦚import { InjectCodeOnValTownStream } from "https://esm.town/v/andreterron/InjectCodeOnValTownStream?v=4";import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=26";import { parse } from "npm:content-type";const { author, name } = extractValInfo(import.meta.url);export function pipeResponse(res: Response,// ...transforms: Array<() => ReadableWritablePair>) {const contentType = res.headers.get("content-type");if (!contentType || parse(contentType).type !== "text/html") {return res;}// if (!transforms.length) {// return res;// }let transforms = [1];let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {// const getTransform = transforms.at(index);stream = stream.pipeThrough(new InjectCodeOnValTownStream({ val: { handle: author, name: name } }),);}⦚ 5 unchanged lines ⦚ - Open: Version+27-0import { parse } from "npm:content-type";export function pipeResponse(res: Response,...transforms: Array<() => ReadableWritablePair>) {const contentType = res.headers.get("content-type");if (!contentType || parse(contentType).type !== "text/html") {return res;}if (!transforms.length) {return res;}let stream = res.body.pipeThrough(new TextDecoderStream());let index = 0;while (index < transforms.length) {const getTransform = transforms.at(index);stream = stream.pipeThrough(getTransform());}return new Response(stream.pipeThrough(new TextEncoderStream()),res,);}
Updated: March 7, 2024