Skip to content

Commit

Permalink
feat(tar/unstable): @std/tar (#5905)
Browse files Browse the repository at this point in the history
* feat(tar/unstable): `@std/tar`

* fix

* edit
  • Loading branch information
iuioiua authored Sep 4, 2024
1 parent b41c503 commit b05acd6
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 12 deletions.
2 changes: 2 additions & 0 deletions _tools/check_circular_package_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Mod =
| "regexp"
| "semver"
| "streams"
| "tar"
| "testing"
| "text"
| "toml"
Expand Down Expand Up @@ -109,6 +110,7 @@ const ENTRYPOINTS: Record<Mod, string[]> = {
regexp: ["mod.ts"],
semver: ["mod.ts"],
streams: ["mod.ts"],
tar: ["mod.ts"],
testing: ["bdd.ts", "mock.ts", "snapshot.ts", "time.ts", "types.ts"],
text: ["mod.ts"],
toml: ["mod.ts"],
Expand Down
1 change: 1 addition & 0 deletions _tools/check_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const ENTRY_POINTS = [
"../regexp/mod.ts",
"../semver/mod.ts",
"../streams/mod.ts",
"../tar/mod.ts",
"../text/mod.ts",
"../testing/bdd.ts",
"../testing/mock.ts",
Expand Down
2 changes: 0 additions & 2 deletions archive/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "0.225.1",
"exports": {
".": "./mod.ts",
"./tar-stream": "./tar_stream.ts",
"./tar": "./tar.ts",
"./untar-stream": "./untar_stream.ts",
"./untar": "./untar.ts"
}
}
2 changes: 0 additions & 2 deletions archive/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@
*/
export * from "./tar.ts";
export * from "./untar.ts";
export * from "./tar_stream.ts";
export * from "./untar_stream.ts";
1 change: 1 addition & 0 deletions browser-compat.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"./regexp",
"./semver",
"./streams",
"./tar",
"./testing",
"./text",
"./toml",
Expand Down
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"./regexp",
"./semver",
"./streams",
"./tar",
"./testing",
"./text",
"./toml",
Expand Down
1 change: 1 addition & 0 deletions import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@std/regexp": "jsr:@std/regexp@^1.0.0",
"@std/semver": "jsr:@std/semver@^1.0.2",
"@std/streams": "jsr:@std/streams@^1.0.3",
"@std/tar": "jsr:@std/tar@^0.1.0",
"@std/testing": "jsr:@std/testing@^1.0.1",
"@std/text": "jsr:@std/text@^1.0.4",
"@std/toml": "jsr:@std/toml@^1.0.1",
Expand Down
9 changes: 9 additions & 0 deletions tar/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@std/tar",
"version": "0.1.0",
"exports": {
".": "./mod.ts",
"./tar-stream": "./tar_stream.ts",
"./untar-stream": "./untar_stream.ts"
}
}
29 changes: 29 additions & 0 deletions tar/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

/**
* Streaming utilities for working with tar archives.
*
* Files are not compressed, only collected into the archive.
*
* ```ts no-eval
* import { UntarStream } from "@std/tar/untar-stream";
* import { dirname, normalize } from "@std/path";
*
* for await (
* const entry of (await Deno.open("./out.tar.gz"))
* .readable
* .pipeThrough(new DecompressionStream("gzip"))
* .pipeThrough(new UntarStream())
* ) {
* const path = normalize(entry.path);
* await Deno.mkdir(dirname(path));
* await entry.readable?.pipeTo((await Deno.create(path)).writable);
* }
* ```
*
* @experimental **UNSTABLE**: New API, yet to be vetted.
*
* @module
*/
export * from "./tar_stream.ts";
export * from "./untar_stream.ts";
10 changes: 5 additions & 5 deletions archive/tar_stream.ts → tar/tar_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const SLASH_CODE_POINT = "/".charCodeAt(0);
*
* @example Usage
* ```ts no-eval
* import { TarStream, type TarStreamInput } from "@std/archive/tar-stream";
* import { TarStream, type TarStreamInput } from "@std/tar/tar-stream";
*
* await ReadableStream.from<TarStreamInput>([
* {
Expand Down Expand Up @@ -302,7 +302,7 @@ export class TarStream implements TransformStream<TarStreamInput, Uint8Array> {
*
* @example Usage
* ```ts no-eval
* import { TarStream } from "@std/archive/tar-stream";
* import { TarStream } from "@std/tar/tar-stream";
*
* await ReadableStream.from([
* {
Expand Down Expand Up @@ -338,7 +338,7 @@ export class TarStream implements TransformStream<TarStreamInput, Uint8Array> {
*
* @example Usage
* ```ts no-eval
* import { TarStream } from "@std/archive/tar-stream";
* import { TarStream } from "@std/tar/tar-stream";
*
* await ReadableStream.from([
* {
Expand Down Expand Up @@ -427,7 +427,7 @@ function parsePath(
*
* @example Usage
* ```ts no-assert no-eval
* import { assertValidPath, TarStream, type TarStreamInput } from "@std/archive";
* import { assertValidPath, TarStream, type TarStreamInput } from "@std/tar";
*
* const paths = (await Array.fromAsync(Deno.readDir("./")))
* .filter(entry => entry.isFile)
Expand Down Expand Up @@ -475,7 +475,7 @@ export function assertValidPath(path: string) {
*
* @example Usage
* ```ts no-assert no-eval
* import { assertValidTarStreamOptions, TarStream, type TarStreamInput } from "@std/archive";
* import { assertValidTarStreamOptions, TarStream, type TarStreamInput } from "@std/tar";
*
* const paths = (await Array.fromAsync(Deno.readDir('./')))
* .filter(entry => entry.isFile)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions archive/untar_stream.ts → tar/untar_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export interface TarStreamEntry {
*
* @example Usage
* ```ts no-eval
* import { UntarStream } from "@std/archive/untar-stream";
* import { UntarStream } from "@std/tar/untar-stream";
* import { dirname, normalize } from "@std/path";
*
* for await (
Expand Down Expand Up @@ -341,7 +341,7 @@ export class UntarStream
*
* @example Usage
* ```ts no-eval
* import { UntarStream } from "@std/archive/untar-stream";
* import { UntarStream } from "@std/tar/untar-stream";
* import { dirname, normalize } from "@std/path";
*
* for await (
Expand All @@ -367,7 +367,7 @@ export class UntarStream
*
* @example Usage
* ```ts no-eval
* import { UntarStream } from "@std/archive/untar-stream";
* import { UntarStream } from "@std/tar/untar-stream";
* import { dirname, normalize } from "@std/path";
*
* for await (
Expand Down
File renamed without changes.

0 comments on commit b05acd6

Please sign in to comment.