@bendyline/molen-pack 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ provides, and a `contentHash` over paths and contents that does not depend on th
|
|
|
82
82
|
|
|
83
83
|
## Status
|
|
84
84
|
|
|
85
|
-
0.x,
|
|
85
|
+
0.x, versioned independently of the other `@bendyline/molen-*` packages. The format is
|
|
86
86
|
beta. Packs are written without zip64, so a pack must stay under 4 GiB and 65,535 members.
|
|
87
87
|
Building the same files always produces the same bytes; that depends on the exact `fflate`
|
|
88
88
|
version this package pins.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as describePack, a as PackIntegrityError, b as sha256, c as openPack, d as PackRetryOptions, f as RangeReader, g as createPack, h as PackOptions, i as PackInput, l as packFromFiles, m as PackFile, n as Pack, o as PackProgress, p as BuiltPack, r as PackEntryNotFoundError, s as ReadOptions, t as OpenPackOptions, u as PackChangedError, v as isTextPath, y as mediaTypeOf } from "./pack-
|
|
1
|
+
import { _ as describePack, a as PackIntegrityError, b as sha256, c as openPack, d as PackRetryOptions, f as RangeReader, g as createPack, h as PackOptions, i as PackInput, l as packFromFiles, m as PackFile, n as Pack, o as PackProgress, p as BuiltPack, r as PackEntryNotFoundError, s as ReadOptions, t as OpenPackOptions, u as PackChangedError, v as isTextPath, y as mediaTypeOf } from "./pack-DjufOvAS.mjs";
|
|
2
2
|
import { PackIndex, PackIndexEntry, PackManifest } from "@bendyline/molen-schema";
|
|
3
3
|
|
|
4
4
|
//#region src/set.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PackChangedError, c as isTextPath, i as packFromFiles, l as mediaTypeOf, n as PackIntegrityError, o as createPack, r as openPack, s as describePack, t as PackEntryNotFoundError, u as sha256 } from "./pack-
|
|
1
|
+
import { a as PackChangedError, c as isTextPath, i as packFromFiles, l as mediaTypeOf, n as PackIntegrityError, o as createPack, r as openPack, s as describePack, t as PackEntryNotFoundError, u as sha256 } from "./pack-DCQvXj1p.mjs";
|
|
2
2
|
//#region src/set.ts
|
|
3
3
|
var Packs = class {
|
|
4
4
|
list = [];
|
package/dist/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as PackFile, n as Pack, t as OpenPackOptions } from "./pack-
|
|
1
|
+
import { h as PackOptions, m as PackFile, n as Pack, t as OpenPackOptions } from "./pack-DjufOvAS.mjs";
|
|
2
2
|
import { PackIndexEntry, PackManifest, PackSourceConfig } from "@bendyline/molen-schema";
|
|
3
3
|
|
|
4
4
|
//#region src/node.d.ts
|
|
@@ -54,6 +54,7 @@ declare function recordInPackIndex(outDir: string, id: string, entry: PackIndexE
|
|
|
54
54
|
declare function buildPack(dir: string, options: {
|
|
55
55
|
outDir: string;
|
|
56
56
|
solid?: boolean;
|
|
57
|
+
compression?: PackOptions["compression"];
|
|
57
58
|
}): Promise<BuiltPackFile>;
|
|
58
59
|
/**
|
|
59
60
|
* Write every file of a pack into `outDir`, with a `molen-pack.source.json` that builds it back
|
package/dist/node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as packFromFiles, o as createPack, r as openPack, u as sha256 } from "./pack-
|
|
1
|
+
import { i as packFromFiles, o as createPack, r as openPack, u as sha256 } from "./pack-DCQvXj1p.mjs";
|
|
2
2
|
import { validate } from "@bendyline/molen-schema";
|
|
3
3
|
import { mkdir, open, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
@@ -162,7 +162,8 @@ async function buildPack(dir, options) {
|
|
|
162
162
|
const source = await readPackSource(dir);
|
|
163
163
|
const built = await createPack(source.files, {
|
|
164
164
|
...optionsOf(source.config),
|
|
165
|
-
...options.solid !== void 0 ? { solid: options.solid } : {}
|
|
165
|
+
...options.solid !== void 0 ? { solid: options.solid } : {},
|
|
166
|
+
...options.compression !== void 0 ? { compression: options.compression } : {}
|
|
166
167
|
});
|
|
167
168
|
const fileSha256 = await sha256(built.bytes);
|
|
168
169
|
const id = built.manifest.id;
|
|
@@ -345,6 +345,7 @@ async function createPack(files, options) {
|
|
|
345
345
|
const sorted = sortedFiles(files);
|
|
346
346
|
for (const file of sorted) if (file.path === PACK_MANIFEST_ENTRY || file.path.startsWith(PACK_RESERVED_PREFIX)) throw new Error(`"${file.path}" is reserved for the pack's own structure`);
|
|
347
347
|
const described = await describePack(sorted, options);
|
|
348
|
+
const compression = options.compression ?? "auto";
|
|
348
349
|
const entries = structuredClone(described.entries);
|
|
349
350
|
const members = [];
|
|
350
351
|
const blocks = {};
|
|
@@ -356,7 +357,7 @@ async function createPack(files, options) {
|
|
|
356
357
|
} else members.push({
|
|
357
358
|
name: file.path,
|
|
358
359
|
data: file.bytes,
|
|
359
|
-
compression
|
|
360
|
+
compression
|
|
360
361
|
});
|
|
361
362
|
for (const [group, groupFiles] of [...pending].sort(([a], [b]) => a < b ? -1 : 1)) {
|
|
362
363
|
let part = 1;
|
|
@@ -384,7 +385,7 @@ async function createPack(files, options) {
|
|
|
384
385
|
blockMembers.push({
|
|
385
386
|
name: entry,
|
|
386
387
|
data,
|
|
387
|
-
compression
|
|
388
|
+
compression
|
|
388
389
|
});
|
|
389
390
|
part++;
|
|
390
391
|
chunk = [];
|
|
@@ -410,7 +411,7 @@ async function createPack(files, options) {
|
|
|
410
411
|
{
|
|
411
412
|
name: PACK_MANIFEST_ENTRY,
|
|
412
413
|
data: new TextEncoder().encode(JSON.stringify(manifest)),
|
|
413
|
-
compression
|
|
414
|
+
compression
|
|
414
415
|
}
|
|
415
416
|
]),
|
|
416
417
|
manifest
|
|
@@ -19,6 +19,12 @@ interface PackOptions {
|
|
|
19
19
|
provides?: Record<string, string | readonly string[]>;
|
|
20
20
|
/** Group small text files into compressed solid blocks (default true). */
|
|
21
21
|
solid?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* `auto` (default) deflates a member when that saves at least 10%. `store` writes every member
|
|
24
|
+
* uncompressed: the manifest and contents are identical, only the archive is larger, so a pack
|
|
25
|
+
* built for local reading (a test run) skips the deflate that dominates build time.
|
|
26
|
+
*/
|
|
27
|
+
compression?: "auto" | "store";
|
|
22
28
|
}
|
|
23
29
|
interface BuiltPack {
|
|
24
30
|
bytes: Uint8Array;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/molen-pack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"fflate": "0.8.3",
|
|
45
|
-
"@bendyline/molen-schema": "0.0.
|
|
45
|
+
"@bendyline/molen-schema": "0.0.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@biomejs/biome": "^2.5.0",
|