resourcexjs 2.1.1 → 2.2.0
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/dist/arp.js +1517 -201
- package/dist/arp.js.map +4 -4
- package/dist/index.js +1683 -367
- package/dist/index.js.map +3 -3
- package/package.json +6 -6
package/dist/arp.js
CHANGED
|
@@ -514,20 +514,25 @@ class ARP {
|
|
|
514
514
|
function createARP(config) {
|
|
515
515
|
return new ARP(config);
|
|
516
516
|
}
|
|
517
|
-
var VERSION = "2.
|
|
517
|
+
var VERSION = "2.2.0";
|
|
518
518
|
|
|
519
519
|
// ../registry/dist/index.js
|
|
520
520
|
import { createRequire } from "node:module";
|
|
521
521
|
import { gzip, gunzip } from "node:zlib";
|
|
522
522
|
import { promisify } from "node:util";
|
|
523
523
|
import { homedir } from "node:os";
|
|
524
|
-
import { join as
|
|
524
|
+
import { join as join3, resolve as resolvePath } from "node:path";
|
|
525
|
+
import { symlink, lstat, readlink } from "node:fs/promises";
|
|
525
526
|
import { gzip as gzip2, gunzip as gunzip2 } from "node:zlib";
|
|
526
527
|
import { promisify as promisify2 } from "node:util";
|
|
527
528
|
import { readFile as readFile2, writeFile as writeFile2, readdir as readdir2, mkdir as mkdir2, rm as rm2, access as access2, stat as stat2 } from "node:fs/promises";
|
|
528
|
-
import { resolve as resolve2, dirname as dirname2, join as
|
|
529
|
+
import { resolve as resolve2, dirname as dirname2, join as join2 } from "node:path";
|
|
530
|
+
import { join as join22, relative } from "node:path";
|
|
531
|
+
import { stat as stat22, readFile as readFile22, readdir as readdir22 } from "node:fs/promises";
|
|
532
|
+
import { gzip as gzip3, gunzip as gunzip3 } from "node:zlib";
|
|
533
|
+
import { promisify as promisify3 } from "node:util";
|
|
529
534
|
import { homedir as homedir2 } from "node:os";
|
|
530
|
-
import { join as
|
|
535
|
+
import { join as join4 } from "node:path";
|
|
531
536
|
import fs from "node:fs";
|
|
532
537
|
var __create = Object.create;
|
|
533
538
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -4276,7 +4281,7 @@ var require_deflate2 = __commonJS((exports) => {
|
|
|
4276
4281
|
options.raw = true;
|
|
4277
4282
|
return deflate(input, options);
|
|
4278
4283
|
}
|
|
4279
|
-
function
|
|
4284
|
+
function gzip4(input, options) {
|
|
4280
4285
|
options = options || {};
|
|
4281
4286
|
options.gzip = true;
|
|
4282
4287
|
return deflate(input, options);
|
|
@@ -4284,7 +4289,7 @@ var require_deflate2 = __commonJS((exports) => {
|
|
|
4284
4289
|
exports.Deflate = Deflate;
|
|
4285
4290
|
exports.deflate = deflate;
|
|
4286
4291
|
exports.deflateRaw = deflateRaw;
|
|
4287
|
-
exports.gzip =
|
|
4292
|
+
exports.gzip = gzip4;
|
|
4288
4293
|
});
|
|
4289
4294
|
var require_inffast = __commonJS((exports, module) => {
|
|
4290
4295
|
var BAD = 30;
|
|
@@ -6299,7 +6304,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
6299
6304
|
function makeArray(subject) {
|
|
6300
6305
|
return Array.isArray(subject) ? subject : [subject];
|
|
6301
6306
|
}
|
|
6302
|
-
var
|
|
6307
|
+
var EMPTY4 = "";
|
|
6303
6308
|
var SPACE = " ";
|
|
6304
6309
|
var ESCAPE = "\\";
|
|
6305
6310
|
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
@@ -6317,7 +6322,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
6317
6322
|
var define2 = (object, key, value) => Object.defineProperty(object, key, { value });
|
|
6318
6323
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
6319
6324
|
var RETURN_FALSE = () => false;
|
|
6320
|
-
var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match :
|
|
6325
|
+
var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY4);
|
|
6321
6326
|
var cleanRangeBackSlash = (slashes) => {
|
|
6322
6327
|
const { length } = slashes;
|
|
6323
6328
|
return slashes.slice(0, length - length % 2);
|
|
@@ -6325,11 +6330,11 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
6325
6330
|
var REPLACERS = [
|
|
6326
6331
|
[
|
|
6327
6332
|
/^\uFEFF/,
|
|
6328
|
-
() =>
|
|
6333
|
+
() => EMPTY4
|
|
6329
6334
|
],
|
|
6330
6335
|
[
|
|
6331
6336
|
/((?:\\\\)*?)(\\?\s+)$/,
|
|
6332
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE :
|
|
6337
|
+
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY4)
|
|
6333
6338
|
],
|
|
6334
6339
|
[
|
|
6335
6340
|
/(\\+?)\s/g,
|
|
@@ -7320,17 +7325,17 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
7320
7325
|
const length = Math.ceil((62 + bpath.length + 1) / 8) * 8;
|
|
7321
7326
|
const written = Buffer.alloc(length);
|
|
7322
7327
|
const writer = new BufferCursor(written);
|
|
7323
|
-
const
|
|
7324
|
-
writer.writeUInt32BE(
|
|
7325
|
-
writer.writeUInt32BE(
|
|
7326
|
-
writer.writeUInt32BE(
|
|
7327
|
-
writer.writeUInt32BE(
|
|
7328
|
-
writer.writeUInt32BE(
|
|
7329
|
-
writer.writeUInt32BE(
|
|
7330
|
-
writer.writeUInt32BE(
|
|
7331
|
-
writer.writeUInt32BE(
|
|
7332
|
-
writer.writeUInt32BE(
|
|
7333
|
-
writer.writeUInt32BE(
|
|
7328
|
+
const stat3 = normalizeStats(entry);
|
|
7329
|
+
writer.writeUInt32BE(stat3.ctimeSeconds);
|
|
7330
|
+
writer.writeUInt32BE(stat3.ctimeNanoseconds);
|
|
7331
|
+
writer.writeUInt32BE(stat3.mtimeSeconds);
|
|
7332
|
+
writer.writeUInt32BE(stat3.mtimeNanoseconds);
|
|
7333
|
+
writer.writeUInt32BE(stat3.dev);
|
|
7334
|
+
writer.writeUInt32BE(stat3.ino);
|
|
7335
|
+
writer.writeUInt32BE(stat3.mode);
|
|
7336
|
+
writer.writeUInt32BE(stat3.uid);
|
|
7337
|
+
writer.writeUInt32BE(stat3.gid);
|
|
7338
|
+
writer.writeUInt32BE(stat3.size);
|
|
7334
7339
|
writer.write(entry.oid, 20, "hex");
|
|
7335
7340
|
writer.writeUInt16BE(renderCacheEntryFlags(entry));
|
|
7336
7341
|
writer.write(entry.path, bpath.length, "utf8");
|
|
@@ -7375,13 +7380,13 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
7375
7380
|
};
|
|
7376
7381
|
}
|
|
7377
7382
|
async function updateCachedIndexFile(fs2, filepath, cache) {
|
|
7378
|
-
const [
|
|
7383
|
+
const [stat3, rawIndexFile] = await Promise.all([
|
|
7379
7384
|
fs2.lstat(filepath),
|
|
7380
7385
|
fs2.read(filepath)
|
|
7381
7386
|
]);
|
|
7382
7387
|
const index2 = await GitIndex.from(rawIndexFile);
|
|
7383
7388
|
cache.map.set(filepath, index2);
|
|
7384
|
-
cache.stats.set(filepath,
|
|
7389
|
+
cache.stats.set(filepath, stat3);
|
|
7385
7390
|
}
|
|
7386
7391
|
async function isIndexStale(fs2, filepath, cache) {
|
|
7387
7392
|
const savedStats = cache.stats.get(filepath);
|
|
@@ -7848,7 +7853,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
7848
7853
|
path += "/";
|
|
7849
7854
|
return isAbsolute ? `/${path}` : path;
|
|
7850
7855
|
}
|
|
7851
|
-
function
|
|
7856
|
+
function join42(...args) {
|
|
7852
7857
|
if (args.length === 0)
|
|
7853
7858
|
return ".";
|
|
7854
7859
|
let joined;
|
|
@@ -8203,7 +8208,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
8203
8208
|
}
|
|
8204
8209
|
}
|
|
8205
8210
|
for (const [key, value] of actualRefsToWrite) {
|
|
8206
|
-
await acquireLock(key, async () => fs2.write(
|
|
8211
|
+
await acquireLock(key, async () => fs2.write(join42(gitdir, key), `${value.trim()}
|
|
8207
8212
|
`, "utf8"));
|
|
8208
8213
|
}
|
|
8209
8214
|
return { pruned };
|
|
@@ -8212,18 +8217,18 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
8212
8217
|
if (!value.match(/[0-9a-f]{40}/)) {
|
|
8213
8218
|
throw new InvalidOidError(value);
|
|
8214
8219
|
}
|
|
8215
|
-
await acquireLock(ref, async () => fs2.write(
|
|
8220
|
+
await acquireLock(ref, async () => fs2.write(join42(gitdir, ref), `${value.trim()}
|
|
8216
8221
|
`, "utf8"));
|
|
8217
8222
|
}
|
|
8218
8223
|
static async writeSymbolicRef({ fs: fs2, gitdir, ref, value }) {
|
|
8219
|
-
await acquireLock(ref, async () => fs2.write(
|
|
8224
|
+
await acquireLock(ref, async () => fs2.write(join42(gitdir, ref), "ref: " + `${value.trim()}
|
|
8220
8225
|
`, "utf8"));
|
|
8221
8226
|
}
|
|
8222
8227
|
static async deleteRef({ fs: fs2, gitdir, ref }) {
|
|
8223
8228
|
return GitRefManager.deleteRefs({ fs: fs2, gitdir, refs: [ref] });
|
|
8224
8229
|
}
|
|
8225
8230
|
static async deleteRefs({ fs: fs2, gitdir, refs }) {
|
|
8226
|
-
await Promise.all(refs.map((ref) => fs2.rm(
|
|
8231
|
+
await Promise.all(refs.map((ref) => fs2.rm(join42(gitdir, ref))));
|
|
8227
8232
|
let text = await acquireLock("packed-refs", async () => fs2.read(`${gitdir}/packed-refs`, { encoding: "utf8" }));
|
|
8228
8233
|
const packed = GitPackedRefs.from(text);
|
|
8229
8234
|
const beforeSize = packed.refs.size;
|
|
@@ -9143,7 +9148,7 @@ Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/iss
|
|
|
9143
9148
|
format = "content",
|
|
9144
9149
|
getExternalRefDelta
|
|
9145
9150
|
}) {
|
|
9146
|
-
let list = await fs2.readdir(
|
|
9151
|
+
let list = await fs2.readdir(join42(gitdir, "objects/pack"));
|
|
9147
9152
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
9148
9153
|
for (const filename of list) {
|
|
9149
9154
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -9884,9 +9889,9 @@ gpgsig`));
|
|
|
9884
9889
|
}
|
|
9885
9890
|
const tree = GitTree.from(object);
|
|
9886
9891
|
for (const entry2 of tree) {
|
|
9887
|
-
map.set(
|
|
9892
|
+
map.set(join42(filepath, entry2.path), entry2);
|
|
9888
9893
|
}
|
|
9889
|
-
return tree.entries().map((entry2) =>
|
|
9894
|
+
return tree.entries().map((entry2) => join42(filepath, entry2.path));
|
|
9890
9895
|
}
|
|
9891
9896
|
async type(entry) {
|
|
9892
9897
|
if (entry._type === false) {
|
|
@@ -9977,10 +9982,10 @@ gpgsig`));
|
|
|
9977
9982
|
async readdir(entry) {
|
|
9978
9983
|
const filepath = entry._fullpath;
|
|
9979
9984
|
const { fs: fs2, dir } = this;
|
|
9980
|
-
const names = await fs2.readdir(
|
|
9985
|
+
const names = await fs2.readdir(join42(dir, filepath));
|
|
9981
9986
|
if (names === null)
|
|
9982
9987
|
return null;
|
|
9983
|
-
return names.map((name) =>
|
|
9988
|
+
return names.map((name) => join42(filepath, name));
|
|
9984
9989
|
}
|
|
9985
9990
|
async type(entry) {
|
|
9986
9991
|
if (entry._type === false) {
|
|
@@ -9997,21 +10002,21 @@ gpgsig`));
|
|
|
9997
10002
|
async stat(entry) {
|
|
9998
10003
|
if (entry._stat === false) {
|
|
9999
10004
|
const { fs: fs2, dir } = this;
|
|
10000
|
-
let
|
|
10001
|
-
if (!
|
|
10005
|
+
let stat3 = await fs2.lstat(`${dir}/${entry._fullpath}`);
|
|
10006
|
+
if (!stat3) {
|
|
10002
10007
|
throw new Error(`ENOENT: no such file or directory, lstat '${entry._fullpath}'`);
|
|
10003
10008
|
}
|
|
10004
|
-
let type =
|
|
10005
|
-
if (type === "blob" && !
|
|
10009
|
+
let type = stat3.isDirectory() ? "tree" : "blob";
|
|
10010
|
+
if (type === "blob" && !stat3.isFile() && !stat3.isSymbolicLink()) {
|
|
10006
10011
|
type = "special";
|
|
10007
10012
|
}
|
|
10008
10013
|
entry._type = type;
|
|
10009
|
-
|
|
10010
|
-
entry._mode =
|
|
10011
|
-
if (
|
|
10012
|
-
|
|
10014
|
+
stat3 = normalizeStats(stat3);
|
|
10015
|
+
entry._mode = stat3.mode;
|
|
10016
|
+
if (stat3.size === -1 && entry._actualSize) {
|
|
10017
|
+
stat3.size = entry._actualSize;
|
|
10013
10018
|
}
|
|
10014
|
-
entry._stat =
|
|
10019
|
+
entry._stat = stat3;
|
|
10015
10020
|
}
|
|
10016
10021
|
return entry._stat;
|
|
10017
10022
|
}
|
|
@@ -10193,11 +10198,11 @@ gpgsig`));
|
|
|
10193
10198
|
await fs2.rm(filepath);
|
|
10194
10199
|
} else if (entries.length) {
|
|
10195
10200
|
await Promise.all(entries.map((entry) => {
|
|
10196
|
-
const subpath =
|
|
10197
|
-
return fs2.lstat(subpath).then((
|
|
10198
|
-
if (!
|
|
10201
|
+
const subpath = join42(filepath, entry);
|
|
10202
|
+
return fs2.lstat(subpath).then((stat3) => {
|
|
10203
|
+
if (!stat3)
|
|
10199
10204
|
return;
|
|
10200
|
-
return
|
|
10205
|
+
return stat3.isDirectory() ? rmRecursive(fs2, subpath) : fs2.rm(subpath);
|
|
10201
10206
|
});
|
|
10202
10207
|
})).then(() => fs2.rmdir(filepath));
|
|
10203
10208
|
} else {
|
|
@@ -10415,7 +10420,7 @@ gpgsig`));
|
|
|
10415
10420
|
return dotgit;
|
|
10416
10421
|
} else if (dotgitStat.isFile()) {
|
|
10417
10422
|
return fsp._readFile(dotgit, "utf8").then((contents) => contents.trimRight().substr(8)).then((submoduleGitdir) => {
|
|
10418
|
-
const gitdir =
|
|
10423
|
+
const gitdir = join42(dirname22(dotgit), submoduleGitdir);
|
|
10419
10424
|
return gitdir;
|
|
10420
10425
|
});
|
|
10421
10426
|
} else {
|
|
@@ -10440,7 +10445,7 @@ gpgsig`));
|
|
|
10440
10445
|
async function abortMerge({
|
|
10441
10446
|
fs: _fs,
|
|
10442
10447
|
dir,
|
|
10443
|
-
gitdir =
|
|
10448
|
+
gitdir = join42(dir, ".git"),
|
|
10444
10449
|
commit: commit2 = "HEAD",
|
|
10445
10450
|
cache = {}
|
|
10446
10451
|
}) {
|
|
@@ -10509,19 +10514,19 @@ gpgsig`));
|
|
|
10509
10514
|
}
|
|
10510
10515
|
|
|
10511
10516
|
class GitIgnoreManager {
|
|
10512
|
-
static async isIgnored({ fs: fs2, dir, gitdir =
|
|
10517
|
+
static async isIgnored({ fs: fs2, dir, gitdir = join42(dir, ".git"), filepath }) {
|
|
10513
10518
|
if (basename(filepath) === ".git")
|
|
10514
10519
|
return true;
|
|
10515
10520
|
if (filepath === ".")
|
|
10516
10521
|
return false;
|
|
10517
10522
|
let excludes = "";
|
|
10518
|
-
const excludesFile =
|
|
10523
|
+
const excludesFile = join42(gitdir, "info", "exclude");
|
|
10519
10524
|
if (await fs2.exists(excludesFile)) {
|
|
10520
10525
|
excludes = await fs2.read(excludesFile, "utf8");
|
|
10521
10526
|
}
|
|
10522
10527
|
const pairs = [
|
|
10523
10528
|
{
|
|
10524
|
-
gitignore:
|
|
10529
|
+
gitignore: join42(dir, ".gitignore"),
|
|
10525
10530
|
filepath
|
|
10526
10531
|
}
|
|
10527
10532
|
];
|
|
@@ -10530,7 +10535,7 @@ gpgsig`));
|
|
|
10530
10535
|
const folder = pieces.slice(0, i).join("/");
|
|
10531
10536
|
const file = pieces.slice(i).join("/");
|
|
10532
10537
|
pairs.push({
|
|
10533
|
-
gitignore:
|
|
10538
|
+
gitignore: join42(dir, folder, ".gitignore"),
|
|
10534
10539
|
filepath: file
|
|
10535
10540
|
});
|
|
10536
10541
|
}
|
|
@@ -10619,7 +10624,7 @@ gpgsig`));
|
|
|
10619
10624
|
async function add({
|
|
10620
10625
|
fs: _fs,
|
|
10621
10626
|
dir,
|
|
10622
|
-
gitdir =
|
|
10627
|
+
gitdir = join42(dir, ".git"),
|
|
10623
10628
|
filepath,
|
|
10624
10629
|
cache = {},
|
|
10625
10630
|
force = false,
|
|
@@ -10673,17 +10678,17 @@ gpgsig`));
|
|
|
10673
10678
|
if (ignored)
|
|
10674
10679
|
return;
|
|
10675
10680
|
}
|
|
10676
|
-
const stats = await fs2.lstat(
|
|
10681
|
+
const stats = await fs2.lstat(join42(dir, currentFilepath));
|
|
10677
10682
|
if (!stats)
|
|
10678
10683
|
throw new NotFoundError(currentFilepath);
|
|
10679
10684
|
if (stats.isDirectory()) {
|
|
10680
|
-
const children = await fs2.readdir(
|
|
10685
|
+
const children = await fs2.readdir(join42(dir, currentFilepath));
|
|
10681
10686
|
if (parallel) {
|
|
10682
10687
|
const promises2 = children.map((child) => addToIndex({
|
|
10683
10688
|
dir,
|
|
10684
10689
|
gitdir,
|
|
10685
10690
|
fs: fs2,
|
|
10686
|
-
filepath: [
|
|
10691
|
+
filepath: [join42(currentFilepath, child)],
|
|
10687
10692
|
index: index2,
|
|
10688
10693
|
force,
|
|
10689
10694
|
parallel,
|
|
@@ -10696,7 +10701,7 @@ gpgsig`));
|
|
|
10696
10701
|
dir,
|
|
10697
10702
|
gitdir,
|
|
10698
10703
|
fs: fs2,
|
|
10699
|
-
filepath: [
|
|
10704
|
+
filepath: [join42(currentFilepath, child)],
|
|
10700
10705
|
index: index2,
|
|
10701
10706
|
force,
|
|
10702
10707
|
parallel,
|
|
@@ -10705,7 +10710,7 @@ gpgsig`));
|
|
|
10705
10710
|
}
|
|
10706
10711
|
}
|
|
10707
10712
|
} else {
|
|
10708
|
-
const object = stats.isSymbolicLink() ? await fs2.readlink(
|
|
10713
|
+
const object = stats.isSymbolicLink() ? await fs2.readlink(join42(dir, currentFilepath)).then(posixifyPathBuffer) : await fs2.read(join42(dir, currentFilepath), { autocrlf });
|
|
10709
10714
|
if (object === null)
|
|
10710
10715
|
throw new NotFoundError(currentFilepath);
|
|
10711
10716
|
const oid = await _writeObject({ fs: fs2, gitdir, type: "blob", object });
|
|
@@ -11101,7 +11106,7 @@ gpgsig`));
|
|
|
11101
11106
|
fs: _fs,
|
|
11102
11107
|
onSign,
|
|
11103
11108
|
dir,
|
|
11104
|
-
gitdir =
|
|
11109
|
+
gitdir = join42(dir, ".git"),
|
|
11105
11110
|
ref = "refs/notes/commits",
|
|
11106
11111
|
oid,
|
|
11107
11112
|
note,
|
|
@@ -11176,7 +11181,7 @@ gpgsig`));
|
|
|
11176
11181
|
async function addRemote({
|
|
11177
11182
|
fs: fs2,
|
|
11178
11183
|
dir,
|
|
11179
|
-
gitdir =
|
|
11184
|
+
gitdir = join42(dir, ".git"),
|
|
11180
11185
|
remote,
|
|
11181
11186
|
url,
|
|
11182
11187
|
force = false
|
|
@@ -11246,7 +11251,7 @@ gpgsig`));
|
|
|
11246
11251
|
fs: _fs,
|
|
11247
11252
|
onSign,
|
|
11248
11253
|
dir,
|
|
11249
|
-
gitdir =
|
|
11254
|
+
gitdir = join42(dir, ".git"),
|
|
11250
11255
|
ref,
|
|
11251
11256
|
tagger: _tagger,
|
|
11252
11257
|
message = ref,
|
|
@@ -11327,7 +11332,7 @@ gpgsig`));
|
|
|
11327
11332
|
async function branch({
|
|
11328
11333
|
fs: fs2,
|
|
11329
11334
|
dir,
|
|
11330
|
-
gitdir =
|
|
11335
|
+
gitdir = join42(dir, ".git"),
|
|
11331
11336
|
ref,
|
|
11332
11337
|
object,
|
|
11333
11338
|
checkout: checkout2 = false,
|
|
@@ -11898,7 +11903,7 @@ gpgsig`));
|
|
|
11898
11903
|
onProgress,
|
|
11899
11904
|
onPostCheckout,
|
|
11900
11905
|
dir,
|
|
11901
|
-
gitdir =
|
|
11906
|
+
gitdir = join42(dir, ".git"),
|
|
11902
11907
|
remote = "origin",
|
|
11903
11908
|
ref: _ref,
|
|
11904
11909
|
filepaths,
|
|
@@ -12311,7 +12316,7 @@ gpgsig`));
|
|
|
12311
12316
|
static async read({ fs: fs2, gitdir }) {
|
|
12312
12317
|
if (lock$2 === null)
|
|
12313
12318
|
lock$2 = new AsyncLock;
|
|
12314
|
-
const filepath =
|
|
12319
|
+
const filepath = join42(gitdir, "shallow");
|
|
12315
12320
|
const oids = new Set;
|
|
12316
12321
|
await lock$2.acquire(filepath, async function() {
|
|
12317
12322
|
const text = await fs2.read(filepath, { encoding: "utf8" });
|
|
@@ -12327,7 +12332,7 @@ gpgsig`));
|
|
|
12327
12332
|
static async write({ fs: fs2, gitdir, oids }) {
|
|
12328
12333
|
if (lock$2 === null)
|
|
12329
12334
|
lock$2 = new AsyncLock;
|
|
12330
|
-
const filepath =
|
|
12335
|
+
const filepath = join42(gitdir, "shallow");
|
|
12331
12336
|
if (oids.size > 0) {
|
|
12332
12337
|
const text = [...oids].join(`
|
|
12333
12338
|
`) + `
|
|
@@ -12355,7 +12360,7 @@ gpgsig`));
|
|
|
12355
12360
|
oid,
|
|
12356
12361
|
getExternalRefDelta
|
|
12357
12362
|
}) {
|
|
12358
|
-
let list = await fs2.readdir(
|
|
12363
|
+
let list = await fs2.readdir(join42(gitdir, "objects/pack"));
|
|
12359
12364
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
12360
12365
|
for (const filename of list) {
|
|
12361
12366
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -12644,7 +12649,7 @@ gpgsig`));
|
|
|
12644
12649
|
depth = null,
|
|
12645
12650
|
since = null,
|
|
12646
12651
|
exclude = [],
|
|
12647
|
-
relative = false,
|
|
12652
|
+
relative: relative2 = false,
|
|
12648
12653
|
tags = false,
|
|
12649
12654
|
singleBranch = false,
|
|
12650
12655
|
headers = {},
|
|
@@ -12692,7 +12697,7 @@ gpgsig`));
|
|
|
12692
12697
|
if (exclude.length > 0 && !remoteHTTP.capabilities.has("deepen-not")) {
|
|
12693
12698
|
throw new RemoteCapabilityError("deepen-not", "exclude");
|
|
12694
12699
|
}
|
|
12695
|
-
if (
|
|
12700
|
+
if (relative2 === true && !remoteHTTP.capabilities.has("deepen-relative")) {
|
|
12696
12701
|
throw new RemoteCapabilityError("deepen-relative", "relative");
|
|
12697
12702
|
}
|
|
12698
12703
|
const { oid, fullref } = GitRefManager.resolveAgainstMap({
|
|
@@ -12712,7 +12717,7 @@ gpgsig`));
|
|
|
12712
12717
|
"ofs-delta",
|
|
12713
12718
|
`agent=${pkg.agent}`
|
|
12714
12719
|
]);
|
|
12715
|
-
if (
|
|
12720
|
+
if (relative2)
|
|
12716
12721
|
capabilities.push("deepen-relative");
|
|
12717
12722
|
const wants = singleBranch ? [oid] : remoteRefs.values();
|
|
12718
12723
|
const haveRefs = singleBranch ? [ref] : await GitRefManager.listRefs({
|
|
@@ -12871,7 +12876,7 @@ gpgsig`));
|
|
|
12871
12876
|
}
|
|
12872
12877
|
if (packfileSha !== "" && !emptyPackfile(packfile)) {
|
|
12873
12878
|
res.packfile = `objects/pack/pack-${packfileSha}.pack`;
|
|
12874
|
-
const fullpath =
|
|
12879
|
+
const fullpath = join42(gitdir, res.packfile);
|
|
12875
12880
|
await fs2.write(fullpath, packfile);
|
|
12876
12881
|
const getExternalRefDelta = (oid2) => _readObject({ fs: fs2, cache, gitdir, oid: oid2 });
|
|
12877
12882
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -12887,7 +12892,7 @@ gpgsig`));
|
|
|
12887
12892
|
fs: fs2,
|
|
12888
12893
|
bare = false,
|
|
12889
12894
|
dir,
|
|
12890
|
-
gitdir = bare ? dir :
|
|
12895
|
+
gitdir = bare ? dir : join42(dir, ".git"),
|
|
12891
12896
|
defaultBranch = "master"
|
|
12892
12897
|
}) {
|
|
12893
12898
|
if (await fs2.exists(gitdir + "/config"))
|
|
@@ -12934,7 +12939,7 @@ gpgsig`));
|
|
|
12934
12939
|
depth,
|
|
12935
12940
|
since,
|
|
12936
12941
|
exclude,
|
|
12937
|
-
relative,
|
|
12942
|
+
relative: relative2,
|
|
12938
12943
|
singleBranch,
|
|
12939
12944
|
noCheckout,
|
|
12940
12945
|
noTags,
|
|
@@ -12966,7 +12971,7 @@ gpgsig`));
|
|
|
12966
12971
|
depth,
|
|
12967
12972
|
since,
|
|
12968
12973
|
exclude,
|
|
12969
|
-
relative,
|
|
12974
|
+
relative: relative2,
|
|
12970
12975
|
singleBranch,
|
|
12971
12976
|
headers,
|
|
12972
12977
|
tags: !noTags
|
|
@@ -13005,7 +13010,7 @@ gpgsig`));
|
|
|
13005
13010
|
onAuthFailure,
|
|
13006
13011
|
onPostCheckout,
|
|
13007
13012
|
dir,
|
|
13008
|
-
gitdir =
|
|
13013
|
+
gitdir = join42(dir, ".git"),
|
|
13009
13014
|
url,
|
|
13010
13015
|
corsProxy = undefined,
|
|
13011
13016
|
ref = undefined,
|
|
@@ -13013,7 +13018,7 @@ gpgsig`));
|
|
|
13013
13018
|
depth = undefined,
|
|
13014
13019
|
since = undefined,
|
|
13015
13020
|
exclude = [],
|
|
13016
|
-
relative = false,
|
|
13021
|
+
relative: relative2 = false,
|
|
13017
13022
|
singleBranch = false,
|
|
13018
13023
|
noCheckout = false,
|
|
13019
13024
|
noTags = false,
|
|
@@ -13051,7 +13056,7 @@ gpgsig`));
|
|
|
13051
13056
|
depth,
|
|
13052
13057
|
since,
|
|
13053
13058
|
exclude,
|
|
13054
|
-
relative,
|
|
13059
|
+
relative: relative2,
|
|
13055
13060
|
singleBranch,
|
|
13056
13061
|
noCheckout,
|
|
13057
13062
|
noTags,
|
|
@@ -13068,7 +13073,7 @@ gpgsig`));
|
|
|
13068
13073
|
fs: _fs,
|
|
13069
13074
|
onSign,
|
|
13070
13075
|
dir,
|
|
13071
|
-
gitdir =
|
|
13076
|
+
gitdir = join42(dir, ".git"),
|
|
13072
13077
|
message,
|
|
13073
13078
|
author,
|
|
13074
13079
|
committer,
|
|
@@ -13115,7 +13120,7 @@ gpgsig`));
|
|
|
13115
13120
|
async function currentBranch({
|
|
13116
13121
|
fs: fs2,
|
|
13117
13122
|
dir,
|
|
13118
|
-
gitdir =
|
|
13123
|
+
gitdir = join42(dir, ".git"),
|
|
13119
13124
|
fullname = false,
|
|
13120
13125
|
test = false
|
|
13121
13126
|
}) {
|
|
@@ -13156,7 +13161,7 @@ gpgsig`));
|
|
|
13156
13161
|
async function deleteBranch({
|
|
13157
13162
|
fs: fs2,
|
|
13158
13163
|
dir,
|
|
13159
|
-
gitdir =
|
|
13164
|
+
gitdir = join42(dir, ".git"),
|
|
13160
13165
|
ref
|
|
13161
13166
|
}) {
|
|
13162
13167
|
try {
|
|
@@ -13174,7 +13179,7 @@ gpgsig`));
|
|
|
13174
13179
|
throw err;
|
|
13175
13180
|
}
|
|
13176
13181
|
}
|
|
13177
|
-
async function deleteRef({ fs: fs2, dir, gitdir =
|
|
13182
|
+
async function deleteRef({ fs: fs2, dir, gitdir = join42(dir, ".git"), ref }) {
|
|
13178
13183
|
try {
|
|
13179
13184
|
assertParameter("fs", fs2);
|
|
13180
13185
|
assertParameter("ref", ref);
|
|
@@ -13194,7 +13199,7 @@ gpgsig`));
|
|
|
13194
13199
|
async function deleteRemote({
|
|
13195
13200
|
fs: fs2,
|
|
13196
13201
|
dir,
|
|
13197
|
-
gitdir =
|
|
13202
|
+
gitdir = join42(dir, ".git"),
|
|
13198
13203
|
remote
|
|
13199
13204
|
}) {
|
|
13200
13205
|
try {
|
|
@@ -13216,7 +13221,7 @@ gpgsig`));
|
|
|
13216
13221
|
ref = ref.startsWith("refs/tags/") ? ref : `refs/tags/${ref}`;
|
|
13217
13222
|
await GitRefManager.deleteRef({ fs: fs2, gitdir, ref });
|
|
13218
13223
|
}
|
|
13219
|
-
async function deleteTag({ fs: fs2, dir, gitdir =
|
|
13224
|
+
async function deleteTag({ fs: fs2, dir, gitdir = join42(dir, ".git"), ref }) {
|
|
13220
13225
|
try {
|
|
13221
13226
|
assertParameter("fs", fs2);
|
|
13222
13227
|
assertParameter("ref", ref);
|
|
@@ -13245,7 +13250,7 @@ gpgsig`));
|
|
|
13245
13250
|
getExternalRefDelta
|
|
13246
13251
|
}) {
|
|
13247
13252
|
const results = [];
|
|
13248
|
-
let list = await fs2.readdir(
|
|
13253
|
+
let list = await fs2.readdir(join42(gitdir, "objects/pack"));
|
|
13249
13254
|
list = list.filter((x) => x.endsWith(".idx"));
|
|
13250
13255
|
for (const filename of list) {
|
|
13251
13256
|
const indexFile = `${gitdir}/objects/pack/${filename}`;
|
|
@@ -13290,7 +13295,7 @@ gpgsig`));
|
|
|
13290
13295
|
async function expandOid({
|
|
13291
13296
|
fs: fs2,
|
|
13292
13297
|
dir,
|
|
13293
|
-
gitdir =
|
|
13298
|
+
gitdir = join42(dir, ".git"),
|
|
13294
13299
|
oid,
|
|
13295
13300
|
cache = {}
|
|
13296
13301
|
}) {
|
|
@@ -13311,7 +13316,7 @@ gpgsig`));
|
|
|
13311
13316
|
throw err;
|
|
13312
13317
|
}
|
|
13313
13318
|
}
|
|
13314
|
-
async function expandRef({ fs: fs2, dir, gitdir =
|
|
13319
|
+
async function expandRef({ fs: fs2, dir, gitdir = join42(dir, ".git"), ref }) {
|
|
13315
13320
|
try {
|
|
13316
13321
|
assertParameter("fs", fs2);
|
|
13317
13322
|
assertParameter("gitdir", gitdir);
|
|
@@ -13398,7 +13403,7 @@ gpgsig`));
|
|
|
13398
13403
|
fs: fs2,
|
|
13399
13404
|
cache,
|
|
13400
13405
|
dir,
|
|
13401
|
-
gitdir =
|
|
13406
|
+
gitdir = join42(dir, ".git"),
|
|
13402
13407
|
index: index2,
|
|
13403
13408
|
ourOid,
|
|
13404
13409
|
baseOid,
|
|
@@ -13868,7 +13873,7 @@ gpgsig`));
|
|
|
13868
13873
|
onAuthSuccess,
|
|
13869
13874
|
onAuthFailure,
|
|
13870
13875
|
dir,
|
|
13871
|
-
gitdir =
|
|
13876
|
+
gitdir = join42(dir, ".git"),
|
|
13872
13877
|
ref,
|
|
13873
13878
|
url,
|
|
13874
13879
|
remote,
|
|
@@ -13926,7 +13931,7 @@ gpgsig`));
|
|
|
13926
13931
|
onAuthSuccess,
|
|
13927
13932
|
onAuthFailure,
|
|
13928
13933
|
dir,
|
|
13929
|
-
gitdir =
|
|
13934
|
+
gitdir = join42(dir, ".git"),
|
|
13930
13935
|
ref,
|
|
13931
13936
|
remote,
|
|
13932
13937
|
remoteRef,
|
|
@@ -13935,7 +13940,7 @@ gpgsig`));
|
|
|
13935
13940
|
depth = null,
|
|
13936
13941
|
since = null,
|
|
13937
13942
|
exclude = [],
|
|
13938
|
-
relative = false,
|
|
13943
|
+
relative: relative2 = false,
|
|
13939
13944
|
tags = false,
|
|
13940
13945
|
singleBranch = false,
|
|
13941
13946
|
headers = {},
|
|
@@ -13967,7 +13972,7 @@ gpgsig`));
|
|
|
13967
13972
|
depth,
|
|
13968
13973
|
since,
|
|
13969
13974
|
exclude,
|
|
13970
|
-
relative,
|
|
13975
|
+
relative: relative2,
|
|
13971
13976
|
tags,
|
|
13972
13977
|
singleBranch,
|
|
13973
13978
|
headers,
|
|
@@ -13982,7 +13987,7 @@ gpgsig`));
|
|
|
13982
13987
|
async function findMergeBase({
|
|
13983
13988
|
fs: fs2,
|
|
13984
13989
|
dir,
|
|
13985
|
-
gitdir =
|
|
13990
|
+
gitdir = join42(dir, ".git"),
|
|
13986
13991
|
oids,
|
|
13987
13992
|
cache = {}
|
|
13988
13993
|
}) {
|
|
@@ -14004,7 +14009,7 @@ gpgsig`));
|
|
|
14004
14009
|
}
|
|
14005
14010
|
}
|
|
14006
14011
|
async function _findRoot({ fs: fs2, filepath }) {
|
|
14007
|
-
if (await fs2.exists(
|
|
14012
|
+
if (await fs2.exists(join42(filepath, ".git"))) {
|
|
14008
14013
|
return filepath;
|
|
14009
14014
|
} else {
|
|
14010
14015
|
const parent = dirname22(filepath);
|
|
@@ -14024,7 +14029,7 @@ gpgsig`));
|
|
|
14024
14029
|
throw err;
|
|
14025
14030
|
}
|
|
14026
14031
|
}
|
|
14027
|
-
async function getConfig({ fs: fs2, dir, gitdir =
|
|
14032
|
+
async function getConfig({ fs: fs2, dir, gitdir = join42(dir, ".git"), path }) {
|
|
14028
14033
|
try {
|
|
14029
14034
|
assertParameter("fs", fs2);
|
|
14030
14035
|
assertParameter("gitdir", gitdir);
|
|
@@ -14048,7 +14053,7 @@ gpgsig`));
|
|
|
14048
14053
|
async function getConfigAll({
|
|
14049
14054
|
fs: fs2,
|
|
14050
14055
|
dir,
|
|
14051
|
-
gitdir =
|
|
14056
|
+
gitdir = join42(dir, ".git"),
|
|
14052
14057
|
path
|
|
14053
14058
|
}) {
|
|
14054
14059
|
try {
|
|
@@ -14242,7 +14247,7 @@ gpgsig`));
|
|
|
14242
14247
|
filepath
|
|
14243
14248
|
}) {
|
|
14244
14249
|
try {
|
|
14245
|
-
filepath =
|
|
14250
|
+
filepath = join42(dir, filepath);
|
|
14246
14251
|
const pack = await fs2.read(filepath);
|
|
14247
14252
|
const getExternalRefDelta = (oid) => _readObject({ fs: fs2, cache, gitdir, oid });
|
|
14248
14253
|
const idx = await GitPackIndex.fromPack({
|
|
@@ -14263,7 +14268,7 @@ gpgsig`));
|
|
|
14263
14268
|
fs: fs2,
|
|
14264
14269
|
onProgress,
|
|
14265
14270
|
dir,
|
|
14266
|
-
gitdir =
|
|
14271
|
+
gitdir = join42(dir, ".git"),
|
|
14267
14272
|
filepath,
|
|
14268
14273
|
cache = {}
|
|
14269
14274
|
}) {
|
|
@@ -14291,7 +14296,7 @@ gpgsig`));
|
|
|
14291
14296
|
fs: fs2,
|
|
14292
14297
|
bare = false,
|
|
14293
14298
|
dir,
|
|
14294
|
-
gitdir = bare ? dir :
|
|
14299
|
+
gitdir = bare ? dir : join42(dir, ".git"),
|
|
14295
14300
|
defaultBranch = "master"
|
|
14296
14301
|
}) {
|
|
14297
14302
|
try {
|
|
@@ -14367,7 +14372,7 @@ gpgsig`));
|
|
|
14367
14372
|
async function isDescendent({
|
|
14368
14373
|
fs: fs2,
|
|
14369
14374
|
dir,
|
|
14370
|
-
gitdir =
|
|
14375
|
+
gitdir = join42(dir, ".git"),
|
|
14371
14376
|
oid,
|
|
14372
14377
|
ancestor,
|
|
14373
14378
|
depth = -1,
|
|
@@ -14396,7 +14401,7 @@ gpgsig`));
|
|
|
14396
14401
|
async function isIgnored({
|
|
14397
14402
|
fs: fs2,
|
|
14398
14403
|
dir,
|
|
14399
|
-
gitdir =
|
|
14404
|
+
gitdir = join42(dir, ".git"),
|
|
14400
14405
|
filepath
|
|
14401
14406
|
}) {
|
|
14402
14407
|
try {
|
|
@@ -14420,7 +14425,7 @@ gpgsig`));
|
|
|
14420
14425
|
async function listBranches({
|
|
14421
14426
|
fs: fs2,
|
|
14422
14427
|
dir,
|
|
14423
|
-
gitdir =
|
|
14428
|
+
gitdir = join42(dir, ".git"),
|
|
14424
14429
|
remote
|
|
14425
14430
|
}) {
|
|
14426
14431
|
try {
|
|
@@ -14474,17 +14479,17 @@ gpgsig`));
|
|
|
14474
14479
|
gitdir,
|
|
14475
14480
|
oid: entry.oid,
|
|
14476
14481
|
filenames,
|
|
14477
|
-
prefix:
|
|
14482
|
+
prefix: join42(prefix, entry.path)
|
|
14478
14483
|
});
|
|
14479
14484
|
} else {
|
|
14480
|
-
filenames.push(
|
|
14485
|
+
filenames.push(join42(prefix, entry.path));
|
|
14481
14486
|
}
|
|
14482
14487
|
}
|
|
14483
14488
|
}
|
|
14484
14489
|
async function listFiles({
|
|
14485
14490
|
fs: fs2,
|
|
14486
14491
|
dir,
|
|
14487
|
-
gitdir =
|
|
14492
|
+
gitdir = join42(dir, ".git"),
|
|
14488
14493
|
ref,
|
|
14489
14494
|
cache = {}
|
|
14490
14495
|
}) {
|
|
@@ -14528,7 +14533,7 @@ gpgsig`));
|
|
|
14528
14533
|
async function listNotes({
|
|
14529
14534
|
fs: fs2,
|
|
14530
14535
|
dir,
|
|
14531
|
-
gitdir =
|
|
14536
|
+
gitdir = join42(dir, ".git"),
|
|
14532
14537
|
ref = "refs/notes/commits",
|
|
14533
14538
|
cache = {}
|
|
14534
14539
|
}) {
|
|
@@ -14552,7 +14557,7 @@ gpgsig`));
|
|
|
14552
14557
|
async function listRefs({
|
|
14553
14558
|
fs: fs2,
|
|
14554
14559
|
dir,
|
|
14555
|
-
gitdir =
|
|
14560
|
+
gitdir = join42(dir, ".git"),
|
|
14556
14561
|
filepath
|
|
14557
14562
|
}) {
|
|
14558
14563
|
try {
|
|
@@ -14575,7 +14580,7 @@ gpgsig`));
|
|
|
14575
14580
|
}));
|
|
14576
14581
|
return remotes;
|
|
14577
14582
|
}
|
|
14578
|
-
async function listRemotes({ fs: fs2, dir, gitdir =
|
|
14583
|
+
async function listRemotes({ fs: fs2, dir, gitdir = join42(dir, ".git") }) {
|
|
14579
14584
|
try {
|
|
14580
14585
|
assertParameter("fs", fs2);
|
|
14581
14586
|
assertParameter("gitdir", gitdir);
|
|
@@ -14680,7 +14685,7 @@ gpgsig`));
|
|
|
14680
14685
|
throw err;
|
|
14681
14686
|
}
|
|
14682
14687
|
}
|
|
14683
|
-
async function listTags({ fs: fs2, dir, gitdir =
|
|
14688
|
+
async function listTags({ fs: fs2, dir, gitdir = join42(dir, ".git") }) {
|
|
14684
14689
|
try {
|
|
14685
14690
|
assertParameter("fs", fs2);
|
|
14686
14691
|
assertParameter("gitdir", gitdir);
|
|
@@ -14736,7 +14741,7 @@ gpgsig`));
|
|
|
14736
14741
|
const walks = tree.entries().map(function(entry) {
|
|
14737
14742
|
let result;
|
|
14738
14743
|
if (entry.oid === fileId) {
|
|
14739
|
-
result =
|
|
14744
|
+
result = join42(parentPath, entry.path);
|
|
14740
14745
|
filepaths.push(result);
|
|
14741
14746
|
} else if (entry.type === "tree") {
|
|
14742
14747
|
result = _readObject({
|
|
@@ -14753,7 +14758,7 @@ gpgsig`));
|
|
|
14753
14758
|
fileId,
|
|
14754
14759
|
oid,
|
|
14755
14760
|
filepaths,
|
|
14756
|
-
parentPath:
|
|
14761
|
+
parentPath: join42(parentPath, entry.path)
|
|
14757
14762
|
});
|
|
14758
14763
|
});
|
|
14759
14764
|
}
|
|
@@ -14888,7 +14893,7 @@ gpgsig`));
|
|
|
14888
14893
|
async function log({
|
|
14889
14894
|
fs: fs2,
|
|
14890
14895
|
dir,
|
|
14891
|
-
gitdir =
|
|
14896
|
+
gitdir = join42(dir, ".git"),
|
|
14892
14897
|
filepath,
|
|
14893
14898
|
ref = "HEAD",
|
|
14894
14899
|
depth,
|
|
@@ -14923,7 +14928,7 @@ gpgsig`));
|
|
|
14923
14928
|
fs: _fs,
|
|
14924
14929
|
onSign,
|
|
14925
14930
|
dir,
|
|
14926
|
-
gitdir =
|
|
14931
|
+
gitdir = join42(dir, ".git"),
|
|
14927
14932
|
ours,
|
|
14928
14933
|
theirs,
|
|
14929
14934
|
fastForward: fastForward2 = true,
|
|
@@ -15000,7 +15005,7 @@ gpgsig`));
|
|
|
15000
15005
|
fs: fs2,
|
|
15001
15006
|
cache,
|
|
15002
15007
|
dir,
|
|
15003
|
-
gitdir =
|
|
15008
|
+
gitdir = join42(dir, ".git"),
|
|
15004
15009
|
oids
|
|
15005
15010
|
}) {
|
|
15006
15011
|
const hash = new Hash;
|
|
@@ -15043,7 +15048,7 @@ gpgsig`));
|
|
|
15043
15048
|
const packfileSha = packfile.slice(-20).toString("hex");
|
|
15044
15049
|
const filename = `pack-${packfileSha}.pack`;
|
|
15045
15050
|
if (write) {
|
|
15046
|
-
await fs2.write(
|
|
15051
|
+
await fs2.write(join42(gitdir, `objects/pack/${filename}`), packfile);
|
|
15047
15052
|
return { filename };
|
|
15048
15053
|
}
|
|
15049
15054
|
return {
|
|
@@ -15054,7 +15059,7 @@ gpgsig`));
|
|
|
15054
15059
|
async function packObjects({
|
|
15055
15060
|
fs: fs2,
|
|
15056
15061
|
dir,
|
|
15057
|
-
gitdir =
|
|
15062
|
+
gitdir = join42(dir, ".git"),
|
|
15058
15063
|
oids,
|
|
15059
15064
|
write = false,
|
|
15060
15065
|
cache = {}
|
|
@@ -15086,7 +15091,7 @@ gpgsig`));
|
|
|
15086
15091
|
onAuthSuccess,
|
|
15087
15092
|
onAuthFailure,
|
|
15088
15093
|
dir,
|
|
15089
|
-
gitdir =
|
|
15094
|
+
gitdir = join42(dir, ".git"),
|
|
15090
15095
|
ref,
|
|
15091
15096
|
url,
|
|
15092
15097
|
remote,
|
|
@@ -15158,7 +15163,7 @@ gpgsig`));
|
|
|
15158
15163
|
fs: fs2,
|
|
15159
15164
|
cache,
|
|
15160
15165
|
dir,
|
|
15161
|
-
gitdir =
|
|
15166
|
+
gitdir = join42(dir, ".git"),
|
|
15162
15167
|
start,
|
|
15163
15168
|
finish
|
|
15164
15169
|
}) {
|
|
@@ -15205,7 +15210,7 @@ gpgsig`));
|
|
|
15205
15210
|
fs: fs2,
|
|
15206
15211
|
cache,
|
|
15207
15212
|
dir,
|
|
15208
|
-
gitdir =
|
|
15213
|
+
gitdir = join42(dir, ".git"),
|
|
15209
15214
|
oids
|
|
15210
15215
|
}) {
|
|
15211
15216
|
const visited = new Set;
|
|
@@ -15498,7 +15503,7 @@ gpgsig`));
|
|
|
15498
15503
|
onAuthFailure,
|
|
15499
15504
|
onPrePush,
|
|
15500
15505
|
dir,
|
|
15501
|
-
gitdir =
|
|
15506
|
+
gitdir = join42(dir, ".git"),
|
|
15502
15507
|
ref,
|
|
15503
15508
|
remoteRef,
|
|
15504
15509
|
remote = "origin",
|
|
@@ -15572,7 +15577,7 @@ gpgsig`));
|
|
|
15572
15577
|
async function readBlob({
|
|
15573
15578
|
fs: fs2,
|
|
15574
15579
|
dir,
|
|
15575
|
-
gitdir =
|
|
15580
|
+
gitdir = join42(dir, ".git"),
|
|
15576
15581
|
oid,
|
|
15577
15582
|
filepath,
|
|
15578
15583
|
cache = {}
|
|
@@ -15598,7 +15603,7 @@ gpgsig`));
|
|
|
15598
15603
|
async function readCommit({
|
|
15599
15604
|
fs: fs2,
|
|
15600
15605
|
dir,
|
|
15601
|
-
gitdir =
|
|
15606
|
+
gitdir = join42(dir, ".git"),
|
|
15602
15607
|
oid,
|
|
15603
15608
|
cache = {}
|
|
15604
15609
|
}) {
|
|
@@ -15639,7 +15644,7 @@ gpgsig`));
|
|
|
15639
15644
|
async function readNote({
|
|
15640
15645
|
fs: fs2,
|
|
15641
15646
|
dir,
|
|
15642
|
-
gitdir =
|
|
15647
|
+
gitdir = join42(dir, ".git"),
|
|
15643
15648
|
ref = "refs/notes/commits",
|
|
15644
15649
|
oid,
|
|
15645
15650
|
cache = {}
|
|
@@ -15666,7 +15671,7 @@ gpgsig`));
|
|
|
15666
15671
|
async function readObject({
|
|
15667
15672
|
fs: _fs,
|
|
15668
15673
|
dir,
|
|
15669
|
-
gitdir =
|
|
15674
|
+
gitdir = join42(dir, ".git"),
|
|
15670
15675
|
oid,
|
|
15671
15676
|
format = "parsed",
|
|
15672
15677
|
filepath = undefined,
|
|
@@ -15751,7 +15756,7 @@ gpgsig`));
|
|
|
15751
15756
|
async function readTag({
|
|
15752
15757
|
fs: fs2,
|
|
15753
15758
|
dir,
|
|
15754
|
-
gitdir =
|
|
15759
|
+
gitdir = join42(dir, ".git"),
|
|
15755
15760
|
oid,
|
|
15756
15761
|
cache = {}
|
|
15757
15762
|
}) {
|
|
@@ -15775,7 +15780,7 @@ gpgsig`));
|
|
|
15775
15780
|
async function readTree({
|
|
15776
15781
|
fs: fs2,
|
|
15777
15782
|
dir,
|
|
15778
|
-
gitdir =
|
|
15783
|
+
gitdir = join42(dir, ".git"),
|
|
15779
15784
|
oid,
|
|
15780
15785
|
filepath = undefined,
|
|
15781
15786
|
cache = {}
|
|
@@ -15801,7 +15806,7 @@ gpgsig`));
|
|
|
15801
15806
|
async function remove({
|
|
15802
15807
|
fs: _fs,
|
|
15803
15808
|
dir,
|
|
15804
|
-
gitdir =
|
|
15809
|
+
gitdir = join42(dir, ".git"),
|
|
15805
15810
|
filepath,
|
|
15806
15811
|
cache = {}
|
|
15807
15812
|
}) {
|
|
@@ -15871,7 +15876,7 @@ gpgsig`));
|
|
|
15871
15876
|
fs: _fs,
|
|
15872
15877
|
onSign,
|
|
15873
15878
|
dir,
|
|
15874
|
-
gitdir =
|
|
15879
|
+
gitdir = join42(dir, ".git"),
|
|
15875
15880
|
ref = "refs/notes/commits",
|
|
15876
15881
|
oid,
|
|
15877
15882
|
author: _author,
|
|
@@ -15961,7 +15966,7 @@ gpgsig`));
|
|
|
15961
15966
|
async function renameBranch({
|
|
15962
15967
|
fs: fs2,
|
|
15963
15968
|
dir,
|
|
15964
|
-
gitdir =
|
|
15969
|
+
gitdir = join42(dir, ".git"),
|
|
15965
15970
|
ref,
|
|
15966
15971
|
oldref,
|
|
15967
15972
|
checkout: checkout2 = false
|
|
@@ -15991,7 +15996,7 @@ gpgsig`));
|
|
|
15991
15996
|
async function resetIndex({
|
|
15992
15997
|
fs: _fs,
|
|
15993
15998
|
dir,
|
|
15994
|
-
gitdir =
|
|
15999
|
+
gitdir = join42(dir, ".git"),
|
|
15995
16000
|
filepath,
|
|
15996
16001
|
ref,
|
|
15997
16002
|
cache = {}
|
|
@@ -16038,7 +16043,7 @@ gpgsig`));
|
|
|
16038
16043
|
gid: 0,
|
|
16039
16044
|
size: 0
|
|
16040
16045
|
};
|
|
16041
|
-
const object = dir && await fs2.read(
|
|
16046
|
+
const object = dir && await fs2.read(join42(dir, filepath));
|
|
16042
16047
|
if (object) {
|
|
16043
16048
|
workdirOid = await hashObject$1({
|
|
16044
16049
|
gitdir: updatedGitdir,
|
|
@@ -16046,7 +16051,7 @@ gpgsig`));
|
|
|
16046
16051
|
object
|
|
16047
16052
|
});
|
|
16048
16053
|
if (oid === workdirOid) {
|
|
16049
|
-
stats = await fs2.lstat(
|
|
16054
|
+
stats = await fs2.lstat(join42(dir, filepath));
|
|
16050
16055
|
}
|
|
16051
16056
|
}
|
|
16052
16057
|
await GitIndexManager.acquire({ fs: fs2, gitdir: updatedGitdir, cache }, async function(index2) {
|
|
@@ -16063,7 +16068,7 @@ gpgsig`));
|
|
|
16063
16068
|
async function resolveRef({
|
|
16064
16069
|
fs: fs2,
|
|
16065
16070
|
dir,
|
|
16066
|
-
gitdir =
|
|
16071
|
+
gitdir = join42(dir, ".git"),
|
|
16067
16072
|
ref,
|
|
16068
16073
|
depth
|
|
16069
16074
|
}) {
|
|
@@ -16088,7 +16093,7 @@ gpgsig`));
|
|
|
16088
16093
|
async function setConfig({
|
|
16089
16094
|
fs: _fs,
|
|
16090
16095
|
dir,
|
|
16091
|
-
gitdir =
|
|
16096
|
+
gitdir = join42(dir, ".git"),
|
|
16092
16097
|
path,
|
|
16093
16098
|
value,
|
|
16094
16099
|
append = false
|
|
@@ -16157,7 +16162,7 @@ gpgsig`));
|
|
|
16157
16162
|
return lock$3.acquire(ref, callback);
|
|
16158
16163
|
}
|
|
16159
16164
|
async function checkAndWriteBlob(fs2, gitdir, dir, filepath, oid = null) {
|
|
16160
|
-
const currentFilepath =
|
|
16165
|
+
const currentFilepath = join42(dir, filepath);
|
|
16161
16166
|
const stats = await fs2.lstat(currentFilepath);
|
|
16162
16167
|
if (!stats)
|
|
16163
16168
|
throw new NotFoundError(currentFilepath);
|
|
@@ -16320,7 +16325,7 @@ gpgsig`));
|
|
|
16320
16325
|
stageUpdated.push({
|
|
16321
16326
|
filepath,
|
|
16322
16327
|
oid,
|
|
16323
|
-
stats: await fs2.lstat(
|
|
16328
|
+
stats: await fs2.lstat(join42(dir, filepath))
|
|
16324
16329
|
});
|
|
16325
16330
|
return {
|
|
16326
16331
|
method: "write",
|
|
@@ -16333,7 +16338,7 @@ gpgsig`));
|
|
|
16333
16338
|
});
|
|
16334
16339
|
await acquireLock$1({ fs: fs2, gitdir, dirRemoved, ops }, async () => {
|
|
16335
16340
|
for (const op of ops) {
|
|
16336
|
-
const currentFilepath =
|
|
16341
|
+
const currentFilepath = join42(dir, op.filepath);
|
|
16337
16342
|
switch (op.method) {
|
|
16338
16343
|
case "rmdir":
|
|
16339
16344
|
await fs2.rmdir(currentFilepath);
|
|
@@ -16369,7 +16374,7 @@ gpgsig`));
|
|
|
16369
16374
|
}
|
|
16370
16375
|
|
|
16371
16376
|
class GitStashManager {
|
|
16372
|
-
constructor({ fs: fs2, dir, gitdir =
|
|
16377
|
+
constructor({ fs: fs2, dir, gitdir = join42(dir, ".git") }) {
|
|
16373
16378
|
Object.assign(this, {
|
|
16374
16379
|
fs: fs2,
|
|
16375
16380
|
dir,
|
|
@@ -16384,10 +16389,10 @@ gpgsig`));
|
|
|
16384
16389
|
return "logs/refs/stash";
|
|
16385
16390
|
}
|
|
16386
16391
|
get refStashPath() {
|
|
16387
|
-
return
|
|
16392
|
+
return join42(this.gitdir, GitStashManager.refStash);
|
|
16388
16393
|
}
|
|
16389
16394
|
get refLogsStashPath() {
|
|
16390
|
-
return
|
|
16395
|
+
return join42(this.gitdir, GitStashManager.refLogsStash);
|
|
16391
16396
|
}
|
|
16392
16397
|
async getAuthor() {
|
|
16393
16398
|
if (!this._author) {
|
|
@@ -16632,7 +16637,7 @@ gpgsig`));
|
|
|
16632
16637
|
async function stash({
|
|
16633
16638
|
fs: fs2,
|
|
16634
16639
|
dir,
|
|
16635
|
-
gitdir =
|
|
16640
|
+
gitdir = join42(dir, ".git"),
|
|
16636
16641
|
op = "push",
|
|
16637
16642
|
message = "",
|
|
16638
16643
|
refIdx = 0
|
|
@@ -16655,7 +16660,7 @@ gpgsig`));
|
|
|
16655
16660
|
const _fs = new FileSystem(fs2);
|
|
16656
16661
|
const updatedGitdir = await discoverGitdir({ fsp: _fs, dotgit: gitdir });
|
|
16657
16662
|
const folders = ["refs", "logs", "logs/refs"];
|
|
16658
|
-
folders.map((f) =>
|
|
16663
|
+
folders.map((f) => join42(updatedGitdir, f)).forEach(async (folder) => {
|
|
16659
16664
|
if (!await _fs.exists(folder)) {
|
|
16660
16665
|
await _fs.mkdir(folder);
|
|
16661
16666
|
}
|
|
@@ -16682,7 +16687,7 @@ gpgsig`));
|
|
|
16682
16687
|
async function status({
|
|
16683
16688
|
fs: _fs,
|
|
16684
16689
|
dir,
|
|
16685
|
-
gitdir =
|
|
16690
|
+
gitdir = join42(dir, ".git"),
|
|
16686
16691
|
filepath,
|
|
16687
16692
|
cache = {}
|
|
16688
16693
|
}) {
|
|
@@ -16716,7 +16721,7 @@ gpgsig`));
|
|
|
16716
16721
|
}
|
|
16717
16722
|
return null;
|
|
16718
16723
|
});
|
|
16719
|
-
const stats = await fs2.lstat(
|
|
16724
|
+
const stats = await fs2.lstat(join42(dir, filepath));
|
|
16720
16725
|
const H = treeOid !== null;
|
|
16721
16726
|
const I = indexEntry !== null;
|
|
16722
16727
|
const W = stats !== null;
|
|
@@ -16724,7 +16729,7 @@ gpgsig`));
|
|
|
16724
16729
|
if (I && !compareStats(indexEntry, stats)) {
|
|
16725
16730
|
return indexEntry.oid;
|
|
16726
16731
|
} else {
|
|
16727
|
-
const object = await fs2.read(
|
|
16732
|
+
const object = await fs2.read(join42(dir, filepath));
|
|
16728
16733
|
const workdirOid = await hashObject$1({
|
|
16729
16734
|
gitdir: updatedGitdir,
|
|
16730
16735
|
type: "blob",
|
|
@@ -16817,7 +16822,7 @@ gpgsig`));
|
|
|
16817
16822
|
async function statusMatrix({
|
|
16818
16823
|
fs: _fs,
|
|
16819
16824
|
dir,
|
|
16820
|
-
gitdir =
|
|
16825
|
+
gitdir = join42(dir, ".git"),
|
|
16821
16826
|
ref = "HEAD",
|
|
16822
16827
|
filepaths = ["."],
|
|
16823
16828
|
filter,
|
|
@@ -16894,7 +16899,7 @@ gpgsig`));
|
|
|
16894
16899
|
async function tag({
|
|
16895
16900
|
fs: _fs,
|
|
16896
16901
|
dir,
|
|
16897
|
-
gitdir =
|
|
16902
|
+
gitdir = join42(dir, ".git"),
|
|
16898
16903
|
ref,
|
|
16899
16904
|
object,
|
|
16900
16905
|
force = false
|
|
@@ -16926,7 +16931,7 @@ gpgsig`));
|
|
|
16926
16931
|
async function updateIndex$1({
|
|
16927
16932
|
fs: _fs,
|
|
16928
16933
|
dir,
|
|
16929
|
-
gitdir =
|
|
16934
|
+
gitdir = join42(dir, ".git"),
|
|
16930
16935
|
cache = {},
|
|
16931
16936
|
filepath,
|
|
16932
16937
|
oid,
|
|
@@ -16944,7 +16949,7 @@ gpgsig`));
|
|
|
16944
16949
|
if (remove2) {
|
|
16945
16950
|
return await GitIndexManager.acquire({ fs: fs2, gitdir: updatedGitdir, cache }, async function(index2) {
|
|
16946
16951
|
if (!force) {
|
|
16947
|
-
const fileStats2 = await fs2.lstat(
|
|
16952
|
+
const fileStats2 = await fs2.lstat(join42(dir, filepath));
|
|
16948
16953
|
if (fileStats2) {
|
|
16949
16954
|
if (fileStats2.isDirectory()) {
|
|
16950
16955
|
throw new InvalidFilepathError("directory");
|
|
@@ -16961,7 +16966,7 @@ gpgsig`));
|
|
|
16961
16966
|
}
|
|
16962
16967
|
let fileStats;
|
|
16963
16968
|
if (!oid) {
|
|
16964
|
-
fileStats = await fs2.lstat(
|
|
16969
|
+
fileStats = await fs2.lstat(join42(dir, filepath));
|
|
16965
16970
|
if (!fileStats) {
|
|
16966
16971
|
throw new NotFoundError(`file at "${filepath}" on disk and "remove" not set`);
|
|
16967
16972
|
}
|
|
@@ -16976,7 +16981,7 @@ gpgsig`));
|
|
|
16976
16981
|
let stats;
|
|
16977
16982
|
if (!oid) {
|
|
16978
16983
|
stats = fileStats;
|
|
16979
|
-
const object = stats.isSymbolicLink() ? await fs2.readlink(
|
|
16984
|
+
const object = stats.isSymbolicLink() ? await fs2.readlink(join42(dir, filepath)) : await fs2.read(join42(dir, filepath));
|
|
16980
16985
|
oid = await _writeObject({
|
|
16981
16986
|
fs: fs2,
|
|
16982
16987
|
gitdir: updatedGitdir,
|
|
@@ -17019,7 +17024,7 @@ gpgsig`));
|
|
|
17019
17024
|
async function walk({
|
|
17020
17025
|
fs: fs2,
|
|
17021
17026
|
dir,
|
|
17022
|
-
gitdir =
|
|
17027
|
+
gitdir = join42(dir, ".git"),
|
|
17023
17028
|
trees,
|
|
17024
17029
|
map,
|
|
17025
17030
|
reduce,
|
|
@@ -17047,7 +17052,7 @@ gpgsig`));
|
|
|
17047
17052
|
throw err;
|
|
17048
17053
|
}
|
|
17049
17054
|
}
|
|
17050
|
-
async function writeBlob({ fs: fs2, dir, gitdir =
|
|
17055
|
+
async function writeBlob({ fs: fs2, dir, gitdir = join42(dir, ".git"), blob }) {
|
|
17051
17056
|
try {
|
|
17052
17057
|
assertParameter("fs", fs2);
|
|
17053
17058
|
assertParameter("gitdir", gitdir);
|
|
@@ -17069,7 +17074,7 @@ gpgsig`));
|
|
|
17069
17074
|
async function writeCommit({
|
|
17070
17075
|
fs: fs2,
|
|
17071
17076
|
dir,
|
|
17072
|
-
gitdir =
|
|
17077
|
+
gitdir = join42(dir, ".git"),
|
|
17073
17078
|
commit: commit2
|
|
17074
17079
|
}) {
|
|
17075
17080
|
try {
|
|
@@ -17091,7 +17096,7 @@ gpgsig`));
|
|
|
17091
17096
|
async function writeObject({
|
|
17092
17097
|
fs: _fs,
|
|
17093
17098
|
dir,
|
|
17094
|
-
gitdir =
|
|
17099
|
+
gitdir = join42(dir, ".git"),
|
|
17095
17100
|
type,
|
|
17096
17101
|
object,
|
|
17097
17102
|
format = "parsed",
|
|
@@ -17137,7 +17142,7 @@ gpgsig`));
|
|
|
17137
17142
|
async function writeRef({
|
|
17138
17143
|
fs: _fs,
|
|
17139
17144
|
dir,
|
|
17140
|
-
gitdir =
|
|
17145
|
+
gitdir = join42(dir, ".git"),
|
|
17141
17146
|
ref,
|
|
17142
17147
|
value,
|
|
17143
17148
|
force = false,
|
|
@@ -17192,7 +17197,7 @@ gpgsig`));
|
|
|
17192
17197
|
});
|
|
17193
17198
|
return oid;
|
|
17194
17199
|
}
|
|
17195
|
-
async function writeTag({ fs: fs2, dir, gitdir =
|
|
17200
|
+
async function writeTag({ fs: fs2, dir, gitdir = join42(dir, ".git"), tag: tag2 }) {
|
|
17196
17201
|
try {
|
|
17197
17202
|
assertParameter("fs", fs2);
|
|
17198
17203
|
assertParameter("gitdir", gitdir);
|
|
@@ -17209,7 +17214,7 @@ gpgsig`));
|
|
|
17209
17214
|
throw err;
|
|
17210
17215
|
}
|
|
17211
17216
|
}
|
|
17212
|
-
async function writeTree({ fs: fs2, dir, gitdir =
|
|
17217
|
+
async function writeTree({ fs: fs2, dir, gitdir = join42(dir, ".git"), tree }) {
|
|
17213
17218
|
try {
|
|
17214
17219
|
assertParameter("fs", fs2);
|
|
17215
17220
|
assertParameter("gitdir", gitdir);
|
|
@@ -20667,13 +20672,13 @@ var require_readable = __commonJS((exports, module) => {
|
|
|
20667
20672
|
return state[kPaused] === true || state.flowing === false;
|
|
20668
20673
|
};
|
|
20669
20674
|
Readable.prototype.setEncoding = function(enc) {
|
|
20670
|
-
const
|
|
20671
|
-
this._readableState.decoder =
|
|
20675
|
+
const decoder4 = new StringDecoder(enc);
|
|
20676
|
+
this._readableState.decoder = decoder4;
|
|
20672
20677
|
this._readableState.encoding = this._readableState.decoder.encoding;
|
|
20673
20678
|
const buffer = this._readableState.buffer;
|
|
20674
20679
|
let content = "";
|
|
20675
20680
|
for (const data of buffer) {
|
|
20676
|
-
content +=
|
|
20681
|
+
content += decoder4.write(data);
|
|
20677
20682
|
}
|
|
20678
20683
|
buffer.clear();
|
|
20679
20684
|
if (content !== "")
|
|
@@ -25372,7 +25377,7 @@ class FileTransportHandler2 {
|
|
|
25372
25377
|
const entries = await readdir2(currentPath, { withFileTypes: true });
|
|
25373
25378
|
const results = [];
|
|
25374
25379
|
for (const entry of entries) {
|
|
25375
|
-
const fullPath =
|
|
25380
|
+
const fullPath = join2(currentPath, entry.name);
|
|
25376
25381
|
const relativePath = fullPath.substring(basePath.length + 1);
|
|
25377
25382
|
if (entry.isDirectory()) {
|
|
25378
25383
|
const subEntries = await this.listRecursive(basePath, fullPath);
|
|
@@ -25720,6 +25725,1275 @@ class ARP2 {
|
|
|
25720
25725
|
function createARP2(config) {
|
|
25721
25726
|
return new ARP2(config);
|
|
25722
25727
|
}
|
|
25728
|
+
|
|
25729
|
+
class ResourceXError3 extends Error {
|
|
25730
|
+
constructor(message, options) {
|
|
25731
|
+
super(message, options);
|
|
25732
|
+
this.name = "ResourceXError";
|
|
25733
|
+
}
|
|
25734
|
+
}
|
|
25735
|
+
|
|
25736
|
+
class ManifestError2 extends ResourceXError3 {
|
|
25737
|
+
constructor(message) {
|
|
25738
|
+
super(message);
|
|
25739
|
+
this.name = "ManifestError";
|
|
25740
|
+
}
|
|
25741
|
+
}
|
|
25742
|
+
|
|
25743
|
+
class ContentError2 extends ResourceXError3 {
|
|
25744
|
+
constructor(message) {
|
|
25745
|
+
super(message);
|
|
25746
|
+
this.name = "ContentError";
|
|
25747
|
+
}
|
|
25748
|
+
}
|
|
25749
|
+
|
|
25750
|
+
class RXLImpl3 {
|
|
25751
|
+
domain;
|
|
25752
|
+
path;
|
|
25753
|
+
name;
|
|
25754
|
+
type;
|
|
25755
|
+
version;
|
|
25756
|
+
constructor(parts) {
|
|
25757
|
+
this.domain = parts.domain;
|
|
25758
|
+
this.path = parts.path;
|
|
25759
|
+
this.name = parts.name;
|
|
25760
|
+
this.type = parts.type;
|
|
25761
|
+
this.version = parts.version;
|
|
25762
|
+
}
|
|
25763
|
+
toString() {
|
|
25764
|
+
let result = "";
|
|
25765
|
+
if (this.domain) {
|
|
25766
|
+
result += this.domain + "/";
|
|
25767
|
+
if (this.path) {
|
|
25768
|
+
result += this.path + "/";
|
|
25769
|
+
}
|
|
25770
|
+
}
|
|
25771
|
+
result += this.name;
|
|
25772
|
+
if (this.type) {
|
|
25773
|
+
result += "." + this.type;
|
|
25774
|
+
}
|
|
25775
|
+
if (this.version) {
|
|
25776
|
+
result += "@" + this.version;
|
|
25777
|
+
}
|
|
25778
|
+
return result;
|
|
25779
|
+
}
|
|
25780
|
+
}
|
|
25781
|
+
function isDomain3(str) {
|
|
25782
|
+
if (str === "localhost")
|
|
25783
|
+
return true;
|
|
25784
|
+
return str.includes(".");
|
|
25785
|
+
}
|
|
25786
|
+
function parseRXL3(locator) {
|
|
25787
|
+
let remaining = locator;
|
|
25788
|
+
let version;
|
|
25789
|
+
let type;
|
|
25790
|
+
let domain;
|
|
25791
|
+
let path;
|
|
25792
|
+
let name;
|
|
25793
|
+
const atIndex = remaining.indexOf("@");
|
|
25794
|
+
if (atIndex !== -1) {
|
|
25795
|
+
version = remaining.slice(atIndex + 1);
|
|
25796
|
+
remaining = remaining.slice(0, atIndex);
|
|
25797
|
+
}
|
|
25798
|
+
const segments = remaining.split("/");
|
|
25799
|
+
if (segments.length > 1 && isDomain3(segments[0])) {
|
|
25800
|
+
domain = segments[0];
|
|
25801
|
+
const lastSegment = segments[segments.length - 1];
|
|
25802
|
+
if (segments.length > 2) {
|
|
25803
|
+
path = segments.slice(1, -1).join("/");
|
|
25804
|
+
}
|
|
25805
|
+
remaining = lastSegment;
|
|
25806
|
+
} else {
|
|
25807
|
+
remaining = segments.join("/");
|
|
25808
|
+
}
|
|
25809
|
+
const dotIndex = remaining.lastIndexOf(".");
|
|
25810
|
+
if (dotIndex !== -1) {
|
|
25811
|
+
type = remaining.slice(dotIndex + 1);
|
|
25812
|
+
name = remaining.slice(0, dotIndex);
|
|
25813
|
+
} else {
|
|
25814
|
+
name = remaining;
|
|
25815
|
+
}
|
|
25816
|
+
return new RXLImpl3({ domain, path, name, type, version });
|
|
25817
|
+
}
|
|
25818
|
+
|
|
25819
|
+
class RXMImpl2 {
|
|
25820
|
+
domain;
|
|
25821
|
+
path;
|
|
25822
|
+
name;
|
|
25823
|
+
type;
|
|
25824
|
+
version;
|
|
25825
|
+
constructor(data) {
|
|
25826
|
+
this.domain = data.domain;
|
|
25827
|
+
this.path = data.path;
|
|
25828
|
+
this.name = data.name;
|
|
25829
|
+
this.type = data.type;
|
|
25830
|
+
this.version = data.version;
|
|
25831
|
+
}
|
|
25832
|
+
toLocator() {
|
|
25833
|
+
let result = this.domain + "/";
|
|
25834
|
+
if (this.path) {
|
|
25835
|
+
result += this.path + "/";
|
|
25836
|
+
}
|
|
25837
|
+
result += this.name;
|
|
25838
|
+
result += "." + this.type;
|
|
25839
|
+
result += "@" + this.version;
|
|
25840
|
+
return result;
|
|
25841
|
+
}
|
|
25842
|
+
toJSON() {
|
|
25843
|
+
const json = {
|
|
25844
|
+
domain: this.domain,
|
|
25845
|
+
name: this.name,
|
|
25846
|
+
type: this.type,
|
|
25847
|
+
version: this.version
|
|
25848
|
+
};
|
|
25849
|
+
if (this.path !== undefined) {
|
|
25850
|
+
json.path = this.path;
|
|
25851
|
+
}
|
|
25852
|
+
return json;
|
|
25853
|
+
}
|
|
25854
|
+
}
|
|
25855
|
+
function createRXM2(data) {
|
|
25856
|
+
if (!data.domain) {
|
|
25857
|
+
throw new ManifestError2("domain is required");
|
|
25858
|
+
}
|
|
25859
|
+
if (!data.name) {
|
|
25860
|
+
throw new ManifestError2("name is required");
|
|
25861
|
+
}
|
|
25862
|
+
if (!data.type) {
|
|
25863
|
+
throw new ManifestError2("type is required");
|
|
25864
|
+
}
|
|
25865
|
+
if (!data.version) {
|
|
25866
|
+
throw new ManifestError2("version is required");
|
|
25867
|
+
}
|
|
25868
|
+
return new RXMImpl2({
|
|
25869
|
+
domain: data.domain,
|
|
25870
|
+
path: data.path,
|
|
25871
|
+
name: data.name,
|
|
25872
|
+
type: data.type,
|
|
25873
|
+
version: data.version
|
|
25874
|
+
});
|
|
25875
|
+
}
|
|
25876
|
+
var BLOCK_SIZE3 = 512;
|
|
25877
|
+
var BLOCK_SIZE_MASK2 = 511;
|
|
25878
|
+
var DEFAULT_FILE_MODE2 = 420;
|
|
25879
|
+
var DEFAULT_DIR_MODE2 = 493;
|
|
25880
|
+
var USTAR_NAME_OFFSET2 = 0;
|
|
25881
|
+
var USTAR_NAME_SIZE2 = 100;
|
|
25882
|
+
var USTAR_MODE_OFFSET2 = 100;
|
|
25883
|
+
var USTAR_MODE_SIZE2 = 8;
|
|
25884
|
+
var USTAR_UID_OFFSET2 = 108;
|
|
25885
|
+
var USTAR_UID_SIZE2 = 8;
|
|
25886
|
+
var USTAR_GID_OFFSET2 = 116;
|
|
25887
|
+
var USTAR_GID_SIZE2 = 8;
|
|
25888
|
+
var USTAR_SIZE_OFFSET2 = 124;
|
|
25889
|
+
var USTAR_SIZE_SIZE2 = 12;
|
|
25890
|
+
var USTAR_MTIME_OFFSET2 = 136;
|
|
25891
|
+
var USTAR_MTIME_SIZE2 = 12;
|
|
25892
|
+
var USTAR_CHECKSUM_OFFSET2 = 148;
|
|
25893
|
+
var USTAR_CHECKSUM_SIZE2 = 8;
|
|
25894
|
+
var USTAR_TYPEFLAG_OFFSET2 = 156;
|
|
25895
|
+
var USTAR_TYPEFLAG_SIZE2 = 1;
|
|
25896
|
+
var USTAR_LINKNAME_OFFSET2 = 157;
|
|
25897
|
+
var USTAR_LINKNAME_SIZE2 = 100;
|
|
25898
|
+
var USTAR_MAGIC_OFFSET2 = 257;
|
|
25899
|
+
var USTAR_MAGIC_SIZE2 = 6;
|
|
25900
|
+
var USTAR_VERSION_OFFSET2 = 263;
|
|
25901
|
+
var USTAR_VERSION_SIZE2 = 2;
|
|
25902
|
+
var USTAR_UNAME_OFFSET2 = 265;
|
|
25903
|
+
var USTAR_UNAME_SIZE2 = 32;
|
|
25904
|
+
var USTAR_GNAME_OFFSET2 = 297;
|
|
25905
|
+
var USTAR_GNAME_SIZE2 = 32;
|
|
25906
|
+
var USTAR_PREFIX_OFFSET2 = 345;
|
|
25907
|
+
var USTAR_PREFIX_SIZE2 = 155;
|
|
25908
|
+
var USTAR_VERSION2 = "00";
|
|
25909
|
+
var USTAR_MAX_UID_GID2 = 2097151;
|
|
25910
|
+
var USTAR_MAX_SIZE2 = 8589934591;
|
|
25911
|
+
var FILE2 = "file";
|
|
25912
|
+
var LINK2 = "link";
|
|
25913
|
+
var SYMLINK2 = "symlink";
|
|
25914
|
+
var DIRECTORY2 = "directory";
|
|
25915
|
+
var TYPEFLAG2 = {
|
|
25916
|
+
file: "0",
|
|
25917
|
+
link: "1",
|
|
25918
|
+
symlink: "2",
|
|
25919
|
+
"character-device": "3",
|
|
25920
|
+
"block-device": "4",
|
|
25921
|
+
directory: "5",
|
|
25922
|
+
fifo: "6",
|
|
25923
|
+
"pax-header": "x",
|
|
25924
|
+
"pax-global-header": "g",
|
|
25925
|
+
"gnu-long-name": "L",
|
|
25926
|
+
"gnu-long-link-name": "K"
|
|
25927
|
+
};
|
|
25928
|
+
var FLAGTYPE2 = {
|
|
25929
|
+
"0": FILE2,
|
|
25930
|
+
"1": LINK2,
|
|
25931
|
+
"2": SYMLINK2,
|
|
25932
|
+
"3": "character-device",
|
|
25933
|
+
"4": "block-device",
|
|
25934
|
+
"5": DIRECTORY2,
|
|
25935
|
+
"6": "fifo",
|
|
25936
|
+
x: "pax-header",
|
|
25937
|
+
g: "pax-global-header",
|
|
25938
|
+
L: "gnu-long-name",
|
|
25939
|
+
K: "gnu-long-link-name"
|
|
25940
|
+
};
|
|
25941
|
+
var ZERO_BLOCK3 = new Uint8Array(BLOCK_SIZE3);
|
|
25942
|
+
var EMPTY3 = new Uint8Array(0);
|
|
25943
|
+
var encoder3 = new TextEncoder;
|
|
25944
|
+
var decoder3 = new TextDecoder;
|
|
25945
|
+
function writeString2(view, offset, size, value) {
|
|
25946
|
+
if (value)
|
|
25947
|
+
encoder3.encodeInto(value, view.subarray(offset, offset + size));
|
|
25948
|
+
}
|
|
25949
|
+
function writeOctal2(view, offset, size, value) {
|
|
25950
|
+
if (value === undefined)
|
|
25951
|
+
return;
|
|
25952
|
+
const octalString = value.toString(8).padStart(size - 1, "0");
|
|
25953
|
+
encoder3.encodeInto(octalString, view.subarray(offset, offset + size - 1));
|
|
25954
|
+
}
|
|
25955
|
+
function readString2(view, offset, size) {
|
|
25956
|
+
const end = view.indexOf(0, offset);
|
|
25957
|
+
const sliceEnd = end === -1 || end > offset + size ? offset + size : end;
|
|
25958
|
+
return decoder3.decode(view.subarray(offset, sliceEnd));
|
|
25959
|
+
}
|
|
25960
|
+
function readOctal2(view, offset, size) {
|
|
25961
|
+
let value = 0;
|
|
25962
|
+
const end = offset + size;
|
|
25963
|
+
for (let i = offset;i < end; i++) {
|
|
25964
|
+
const charCode = view[i];
|
|
25965
|
+
if (charCode === 0)
|
|
25966
|
+
break;
|
|
25967
|
+
if (charCode === 32)
|
|
25968
|
+
continue;
|
|
25969
|
+
value = value * 8 + (charCode - 48);
|
|
25970
|
+
}
|
|
25971
|
+
return value;
|
|
25972
|
+
}
|
|
25973
|
+
function readNumeric2(view, offset, size) {
|
|
25974
|
+
if (view[offset] & 128) {
|
|
25975
|
+
let result = 0;
|
|
25976
|
+
result = view[offset] & 127;
|
|
25977
|
+
for (let i = 1;i < size; i++)
|
|
25978
|
+
result = result * 256 + view[offset + i];
|
|
25979
|
+
if (!Number.isSafeInteger(result))
|
|
25980
|
+
throw new Error("TAR number too large");
|
|
25981
|
+
return result;
|
|
25982
|
+
}
|
|
25983
|
+
return readOctal2(view, offset, size);
|
|
25984
|
+
}
|
|
25985
|
+
var isBodyless2 = (header) => header.type === DIRECTORY2 || header.type === SYMLINK2 || header.type === LINK2;
|
|
25986
|
+
async function normalizeBody2(body) {
|
|
25987
|
+
if (body === null || body === undefined)
|
|
25988
|
+
return EMPTY3;
|
|
25989
|
+
if (body instanceof Uint8Array)
|
|
25990
|
+
return body;
|
|
25991
|
+
if (typeof body === "string")
|
|
25992
|
+
return encoder3.encode(body);
|
|
25993
|
+
if (body instanceof ArrayBuffer)
|
|
25994
|
+
return new Uint8Array(body);
|
|
25995
|
+
if (body instanceof Blob)
|
|
25996
|
+
return new Uint8Array(await body.arrayBuffer());
|
|
25997
|
+
throw new TypeError("Unsupported content type for entry body.");
|
|
25998
|
+
}
|
|
25999
|
+
function transformHeader2(header, options) {
|
|
26000
|
+
const { strip, filter, map } = options;
|
|
26001
|
+
if (!strip && !filter && !map)
|
|
26002
|
+
return header;
|
|
26003
|
+
const h = { ...header };
|
|
26004
|
+
if (strip && strip > 0) {
|
|
26005
|
+
const components = h.name.split("/").filter(Boolean);
|
|
26006
|
+
if (strip >= components.length)
|
|
26007
|
+
return null;
|
|
26008
|
+
const newName = components.slice(strip).join("/");
|
|
26009
|
+
h.name = h.type === DIRECTORY2 && !newName.endsWith("/") ? `${newName}/` : newName;
|
|
26010
|
+
if (h.linkname?.startsWith("/")) {
|
|
26011
|
+
const linkComponents = h.linkname.split("/").filter(Boolean);
|
|
26012
|
+
h.linkname = strip >= linkComponents.length ? "/" : `/${linkComponents.slice(strip).join("/")}`;
|
|
26013
|
+
}
|
|
26014
|
+
}
|
|
26015
|
+
if (filter?.(h) === false)
|
|
26016
|
+
return null;
|
|
26017
|
+
const result = map ? map(h) : h;
|
|
26018
|
+
if (result && (!result.name || !result.name.trim() || result.name === "." || result.name === "/"))
|
|
26019
|
+
return null;
|
|
26020
|
+
return result;
|
|
26021
|
+
}
|
|
26022
|
+
var CHECKSUM_SPACE2 = 32;
|
|
26023
|
+
var ASCII_ZERO2 = 48;
|
|
26024
|
+
function validateChecksum2(block) {
|
|
26025
|
+
const stored = readOctal2(block, USTAR_CHECKSUM_OFFSET2, USTAR_CHECKSUM_SIZE2);
|
|
26026
|
+
let sum = 0;
|
|
26027
|
+
for (let i = 0;i < block.length; i++)
|
|
26028
|
+
if (i >= USTAR_CHECKSUM_OFFSET2 && i < USTAR_CHECKSUM_OFFSET2 + USTAR_CHECKSUM_SIZE2)
|
|
26029
|
+
sum += CHECKSUM_SPACE2;
|
|
26030
|
+
else
|
|
26031
|
+
sum += block[i];
|
|
26032
|
+
return stored === sum;
|
|
26033
|
+
}
|
|
26034
|
+
function writeChecksum2(block) {
|
|
26035
|
+
block.fill(CHECKSUM_SPACE2, USTAR_CHECKSUM_OFFSET2, USTAR_CHECKSUM_OFFSET2 + USTAR_CHECKSUM_SIZE2);
|
|
26036
|
+
let checksum = 0;
|
|
26037
|
+
for (const byte of block)
|
|
26038
|
+
checksum += byte;
|
|
26039
|
+
for (let i = USTAR_CHECKSUM_OFFSET2 + 6 - 1;i >= USTAR_CHECKSUM_OFFSET2; i--) {
|
|
26040
|
+
block[i] = (checksum & 7) + ASCII_ZERO2;
|
|
26041
|
+
checksum >>= 3;
|
|
26042
|
+
}
|
|
26043
|
+
block[USTAR_CHECKSUM_OFFSET2 + 6] = 0;
|
|
26044
|
+
block[USTAR_CHECKSUM_OFFSET2 + 7] = CHECKSUM_SPACE2;
|
|
26045
|
+
}
|
|
26046
|
+
function generatePax2(header) {
|
|
26047
|
+
const paxRecords = {};
|
|
26048
|
+
if (header.name.length > USTAR_NAME_SIZE2) {
|
|
26049
|
+
if (findUstarSplit2(header.name) === null)
|
|
26050
|
+
paxRecords.path = header.name;
|
|
26051
|
+
}
|
|
26052
|
+
if (header.linkname && header.linkname.length > USTAR_NAME_SIZE2)
|
|
26053
|
+
paxRecords.linkpath = header.linkname;
|
|
26054
|
+
if (header.uname && header.uname.length > USTAR_UNAME_SIZE2)
|
|
26055
|
+
paxRecords.uname = header.uname;
|
|
26056
|
+
if (header.gname && header.gname.length > USTAR_GNAME_SIZE2)
|
|
26057
|
+
paxRecords.gname = header.gname;
|
|
26058
|
+
if (header.uid != null && header.uid > USTAR_MAX_UID_GID2)
|
|
26059
|
+
paxRecords.uid = String(header.uid);
|
|
26060
|
+
if (header.gid != null && header.gid > USTAR_MAX_UID_GID2)
|
|
26061
|
+
paxRecords.gid = String(header.gid);
|
|
26062
|
+
if (header.size != null && header.size > USTAR_MAX_SIZE2)
|
|
26063
|
+
paxRecords.size = String(header.size);
|
|
26064
|
+
if (header.pax)
|
|
26065
|
+
Object.assign(paxRecords, header.pax);
|
|
26066
|
+
const paxEntries = Object.entries(paxRecords);
|
|
26067
|
+
if (paxEntries.length === 0)
|
|
26068
|
+
return null;
|
|
26069
|
+
const paxBody = encoder3.encode(paxEntries.map(([key, value]) => {
|
|
26070
|
+
const record = `${key}=${value}
|
|
26071
|
+
`;
|
|
26072
|
+
const partLength = encoder3.encode(record).length + 1;
|
|
26073
|
+
let totalLength = partLength + String(partLength).length;
|
|
26074
|
+
totalLength = partLength + String(totalLength).length;
|
|
26075
|
+
return `${totalLength} ${record}`;
|
|
26076
|
+
}).join(""));
|
|
26077
|
+
return {
|
|
26078
|
+
paxHeader: createTarHeader2({
|
|
26079
|
+
name: decoder3.decode(encoder3.encode(`PaxHeader/${header.name}`).slice(0, 100)),
|
|
26080
|
+
size: paxBody.length,
|
|
26081
|
+
type: "pax-header",
|
|
26082
|
+
mode: 420,
|
|
26083
|
+
mtime: header.mtime,
|
|
26084
|
+
uname: header.uname,
|
|
26085
|
+
gname: header.gname,
|
|
26086
|
+
uid: header.uid,
|
|
26087
|
+
gid: header.gid
|
|
26088
|
+
}),
|
|
26089
|
+
paxBody
|
|
26090
|
+
};
|
|
26091
|
+
}
|
|
26092
|
+
function findUstarSplit2(path) {
|
|
26093
|
+
if (path.length <= USTAR_NAME_SIZE2)
|
|
26094
|
+
return null;
|
|
26095
|
+
const minSlashIndex = path.length - USTAR_NAME_SIZE2 - 1;
|
|
26096
|
+
const slashIndex = path.lastIndexOf("/", USTAR_PREFIX_SIZE2);
|
|
26097
|
+
if (slashIndex > 0 && slashIndex >= minSlashIndex)
|
|
26098
|
+
return {
|
|
26099
|
+
prefix: path.slice(0, slashIndex),
|
|
26100
|
+
name: path.slice(slashIndex + 1)
|
|
26101
|
+
};
|
|
26102
|
+
return null;
|
|
26103
|
+
}
|
|
26104
|
+
function createTarHeader2(header) {
|
|
26105
|
+
const view = new Uint8Array(BLOCK_SIZE3);
|
|
26106
|
+
const size = isBodyless2(header) ? 0 : header.size ?? 0;
|
|
26107
|
+
let name = header.name;
|
|
26108
|
+
let prefix = "";
|
|
26109
|
+
if (!header.pax?.path) {
|
|
26110
|
+
const split = findUstarSplit2(name);
|
|
26111
|
+
if (split) {
|
|
26112
|
+
name = split.name;
|
|
26113
|
+
prefix = split.prefix;
|
|
26114
|
+
}
|
|
26115
|
+
}
|
|
26116
|
+
writeString2(view, USTAR_NAME_OFFSET2, USTAR_NAME_SIZE2, name);
|
|
26117
|
+
writeOctal2(view, USTAR_MODE_OFFSET2, USTAR_MODE_SIZE2, header.mode ?? (header.type === DIRECTORY2 ? DEFAULT_DIR_MODE2 : DEFAULT_FILE_MODE2));
|
|
26118
|
+
writeOctal2(view, USTAR_UID_OFFSET2, USTAR_UID_SIZE2, header.uid ?? 0);
|
|
26119
|
+
writeOctal2(view, USTAR_GID_OFFSET2, USTAR_GID_SIZE2, header.gid ?? 0);
|
|
26120
|
+
writeOctal2(view, USTAR_SIZE_OFFSET2, USTAR_SIZE_SIZE2, size);
|
|
26121
|
+
writeOctal2(view, USTAR_MTIME_OFFSET2, USTAR_MTIME_SIZE2, Math.floor((header.mtime?.getTime() ?? Date.now()) / 1000));
|
|
26122
|
+
writeString2(view, USTAR_TYPEFLAG_OFFSET2, USTAR_TYPEFLAG_SIZE2, TYPEFLAG2[header.type ?? FILE2]);
|
|
26123
|
+
writeString2(view, USTAR_LINKNAME_OFFSET2, USTAR_LINKNAME_SIZE2, header.linkname);
|
|
26124
|
+
writeString2(view, USTAR_MAGIC_OFFSET2, USTAR_MAGIC_SIZE2, "ustar\x00");
|
|
26125
|
+
writeString2(view, USTAR_VERSION_OFFSET2, USTAR_VERSION_SIZE2, USTAR_VERSION2);
|
|
26126
|
+
writeString2(view, USTAR_UNAME_OFFSET2, USTAR_UNAME_SIZE2, header.uname);
|
|
26127
|
+
writeString2(view, USTAR_GNAME_OFFSET2, USTAR_GNAME_SIZE2, header.gname);
|
|
26128
|
+
writeString2(view, USTAR_PREFIX_OFFSET2, USTAR_PREFIX_SIZE2, prefix);
|
|
26129
|
+
writeChecksum2(view);
|
|
26130
|
+
return view;
|
|
26131
|
+
}
|
|
26132
|
+
function parseUstarHeader2(block, strict) {
|
|
26133
|
+
if (strict && !validateChecksum2(block))
|
|
26134
|
+
throw new Error("Invalid tar header checksum.");
|
|
26135
|
+
const typeflag = readString2(block, USTAR_TYPEFLAG_OFFSET2, USTAR_TYPEFLAG_SIZE2);
|
|
26136
|
+
const header = {
|
|
26137
|
+
name: readString2(block, USTAR_NAME_OFFSET2, USTAR_NAME_SIZE2),
|
|
26138
|
+
mode: readOctal2(block, USTAR_MODE_OFFSET2, USTAR_MODE_SIZE2),
|
|
26139
|
+
uid: readNumeric2(block, USTAR_UID_OFFSET2, USTAR_UID_SIZE2),
|
|
26140
|
+
gid: readNumeric2(block, USTAR_GID_OFFSET2, USTAR_GID_SIZE2),
|
|
26141
|
+
size: readNumeric2(block, USTAR_SIZE_OFFSET2, USTAR_SIZE_SIZE2),
|
|
26142
|
+
mtime: /* @__PURE__ */ new Date(readNumeric2(block, USTAR_MTIME_OFFSET2, USTAR_MTIME_SIZE2) * 1000),
|
|
26143
|
+
type: FLAGTYPE2[typeflag] || FILE2,
|
|
26144
|
+
linkname: readString2(block, USTAR_LINKNAME_OFFSET2, USTAR_LINKNAME_SIZE2)
|
|
26145
|
+
};
|
|
26146
|
+
const magic = readString2(block, USTAR_MAGIC_OFFSET2, USTAR_MAGIC_SIZE2);
|
|
26147
|
+
if (magic.trim() === "ustar") {
|
|
26148
|
+
header.uname = readString2(block, USTAR_UNAME_OFFSET2, USTAR_UNAME_SIZE2);
|
|
26149
|
+
header.gname = readString2(block, USTAR_GNAME_OFFSET2, USTAR_GNAME_SIZE2);
|
|
26150
|
+
}
|
|
26151
|
+
if (magic === "ustar")
|
|
26152
|
+
header.prefix = readString2(block, USTAR_PREFIX_OFFSET2, USTAR_PREFIX_SIZE2);
|
|
26153
|
+
return header;
|
|
26154
|
+
}
|
|
26155
|
+
var PAX_MAPPING2 = {
|
|
26156
|
+
path: ["name", (v) => v],
|
|
26157
|
+
linkpath: ["linkname", (v) => v],
|
|
26158
|
+
size: ["size", (v) => parseInt(v, 10)],
|
|
26159
|
+
mtime: ["mtime", parseFloat],
|
|
26160
|
+
uid: ["uid", (v) => parseInt(v, 10)],
|
|
26161
|
+
gid: ["gid", (v) => parseInt(v, 10)],
|
|
26162
|
+
uname: ["uname", (v) => v],
|
|
26163
|
+
gname: ["gname", (v) => v]
|
|
26164
|
+
};
|
|
26165
|
+
function parsePax2(buffer) {
|
|
26166
|
+
const decoder$1 = new TextDecoder("utf-8");
|
|
26167
|
+
const overrides = {};
|
|
26168
|
+
const pax = {};
|
|
26169
|
+
let offset = 0;
|
|
26170
|
+
while (offset < buffer.length) {
|
|
26171
|
+
const spaceIndex = buffer.indexOf(32, offset);
|
|
26172
|
+
if (spaceIndex === -1)
|
|
26173
|
+
break;
|
|
26174
|
+
const length = parseInt(decoder$1.decode(buffer.subarray(offset, spaceIndex)), 10);
|
|
26175
|
+
if (Number.isNaN(length) || length === 0)
|
|
26176
|
+
break;
|
|
26177
|
+
const recordEnd = offset + length;
|
|
26178
|
+
const [key, value] = decoder$1.decode(buffer.subarray(spaceIndex + 1, recordEnd - 1)).split("=", 2);
|
|
26179
|
+
if (key && value !== undefined) {
|
|
26180
|
+
pax[key] = value;
|
|
26181
|
+
const mapping = PAX_MAPPING2[key];
|
|
26182
|
+
if (mapping) {
|
|
26183
|
+
const [targetKey, parser] = mapping;
|
|
26184
|
+
const parsedValue = parser(value);
|
|
26185
|
+
if (typeof parsedValue === "string" || !Number.isNaN(parsedValue))
|
|
26186
|
+
overrides[targetKey] = parsedValue;
|
|
26187
|
+
}
|
|
26188
|
+
}
|
|
26189
|
+
offset = recordEnd;
|
|
26190
|
+
}
|
|
26191
|
+
if (Object.keys(pax).length > 0)
|
|
26192
|
+
overrides.pax = pax;
|
|
26193
|
+
return overrides;
|
|
26194
|
+
}
|
|
26195
|
+
function applyOverrides2(header, overrides) {
|
|
26196
|
+
if (overrides.name !== undefined)
|
|
26197
|
+
header.name = overrides.name;
|
|
26198
|
+
if (overrides.linkname !== undefined)
|
|
26199
|
+
header.linkname = overrides.linkname;
|
|
26200
|
+
if (overrides.size !== undefined)
|
|
26201
|
+
header.size = overrides.size;
|
|
26202
|
+
if (overrides.mtime !== undefined)
|
|
26203
|
+
header.mtime = /* @__PURE__ */ new Date(overrides.mtime * 1000);
|
|
26204
|
+
if (overrides.uid !== undefined)
|
|
26205
|
+
header.uid = overrides.uid;
|
|
26206
|
+
if (overrides.gid !== undefined)
|
|
26207
|
+
header.gid = overrides.gid;
|
|
26208
|
+
if (overrides.uname !== undefined)
|
|
26209
|
+
header.uname = overrides.uname;
|
|
26210
|
+
if (overrides.gname !== undefined)
|
|
26211
|
+
header.gname = overrides.gname;
|
|
26212
|
+
if (overrides.pax)
|
|
26213
|
+
header.pax = Object.assign({}, header.pax ?? {}, overrides.pax);
|
|
26214
|
+
}
|
|
26215
|
+
function getMetaParser2(type) {
|
|
26216
|
+
switch (type) {
|
|
26217
|
+
case "pax-global-header":
|
|
26218
|
+
case "pax-header":
|
|
26219
|
+
return parsePax2;
|
|
26220
|
+
case "gnu-long-name":
|
|
26221
|
+
return (data) => ({ name: readString2(data, 0, data.length) });
|
|
26222
|
+
case "gnu-long-link-name":
|
|
26223
|
+
return (data) => ({ linkname: readString2(data, 0, data.length) });
|
|
26224
|
+
default:
|
|
26225
|
+
return;
|
|
26226
|
+
}
|
|
26227
|
+
}
|
|
26228
|
+
function getHeaderBlocks2(header) {
|
|
26229
|
+
const base = createTarHeader2(header);
|
|
26230
|
+
const pax = generatePax2(header);
|
|
26231
|
+
if (!pax)
|
|
26232
|
+
return [base];
|
|
26233
|
+
const paxPadding = -pax.paxBody.length & BLOCK_SIZE_MASK2;
|
|
26234
|
+
const paddingBlocks = paxPadding > 0 ? [ZERO_BLOCK3.subarray(0, paxPadding)] : [];
|
|
26235
|
+
return [
|
|
26236
|
+
pax.paxHeader,
|
|
26237
|
+
pax.paxBody,
|
|
26238
|
+
...paddingBlocks,
|
|
26239
|
+
base
|
|
26240
|
+
];
|
|
26241
|
+
}
|
|
26242
|
+
var EOF_BUFFER3 = new Uint8Array(BLOCK_SIZE3 * 2);
|
|
26243
|
+
function createTarPacker3(onData, onError, onFinalize) {
|
|
26244
|
+
let currentHeader = null;
|
|
26245
|
+
let bytesWritten = 0;
|
|
26246
|
+
let finalized = false;
|
|
26247
|
+
return {
|
|
26248
|
+
add(header) {
|
|
26249
|
+
if (finalized) {
|
|
26250
|
+
const error = /* @__PURE__ */ new Error("No new tar entries after finalize.");
|
|
26251
|
+
onError(error);
|
|
26252
|
+
throw error;
|
|
26253
|
+
}
|
|
26254
|
+
if (currentHeader !== null) {
|
|
26255
|
+
const error = /* @__PURE__ */ new Error("Previous entry must be completed before adding a new one");
|
|
26256
|
+
onError(error);
|
|
26257
|
+
throw error;
|
|
26258
|
+
}
|
|
26259
|
+
try {
|
|
26260
|
+
const size = isBodyless2(header) ? 0 : header.size ?? 0;
|
|
26261
|
+
const headerBlocks = getHeaderBlocks2({
|
|
26262
|
+
...header,
|
|
26263
|
+
size
|
|
26264
|
+
});
|
|
26265
|
+
for (const block of headerBlocks)
|
|
26266
|
+
onData(block);
|
|
26267
|
+
currentHeader = {
|
|
26268
|
+
...header,
|
|
26269
|
+
size
|
|
26270
|
+
};
|
|
26271
|
+
bytesWritten = 0;
|
|
26272
|
+
} catch (error) {
|
|
26273
|
+
onError(error);
|
|
26274
|
+
}
|
|
26275
|
+
},
|
|
26276
|
+
write(chunk) {
|
|
26277
|
+
if (!currentHeader) {
|
|
26278
|
+
const error = /* @__PURE__ */ new Error("No active tar entry.");
|
|
26279
|
+
onError(error);
|
|
26280
|
+
throw error;
|
|
26281
|
+
}
|
|
26282
|
+
if (finalized) {
|
|
26283
|
+
const error = /* @__PURE__ */ new Error("Cannot write data after finalize.");
|
|
26284
|
+
onError(error);
|
|
26285
|
+
throw error;
|
|
26286
|
+
}
|
|
26287
|
+
const newTotal = bytesWritten + chunk.length;
|
|
26288
|
+
if (newTotal > currentHeader.size) {
|
|
26289
|
+
const error = /* @__PURE__ */ new Error(`"${currentHeader.name}" exceeds given size of ${currentHeader.size} bytes.`);
|
|
26290
|
+
onError(error);
|
|
26291
|
+
throw error;
|
|
26292
|
+
}
|
|
26293
|
+
try {
|
|
26294
|
+
bytesWritten = newTotal;
|
|
26295
|
+
onData(chunk);
|
|
26296
|
+
} catch (error) {
|
|
26297
|
+
onError(error);
|
|
26298
|
+
}
|
|
26299
|
+
},
|
|
26300
|
+
endEntry() {
|
|
26301
|
+
if (!currentHeader) {
|
|
26302
|
+
const error = /* @__PURE__ */ new Error("No active entry to end.");
|
|
26303
|
+
onError(error);
|
|
26304
|
+
throw error;
|
|
26305
|
+
}
|
|
26306
|
+
if (finalized) {
|
|
26307
|
+
const error = /* @__PURE__ */ new Error("Cannot end entry after finalize.");
|
|
26308
|
+
onError(error);
|
|
26309
|
+
throw error;
|
|
26310
|
+
}
|
|
26311
|
+
try {
|
|
26312
|
+
if (bytesWritten !== currentHeader.size) {
|
|
26313
|
+
const error = /* @__PURE__ */ new Error(`Size mismatch for "${currentHeader.name}".`);
|
|
26314
|
+
onError(error);
|
|
26315
|
+
throw error;
|
|
26316
|
+
}
|
|
26317
|
+
const paddingSize = -currentHeader.size & BLOCK_SIZE_MASK2;
|
|
26318
|
+
if (paddingSize > 0)
|
|
26319
|
+
onData(new Uint8Array(paddingSize));
|
|
26320
|
+
currentHeader = null;
|
|
26321
|
+
bytesWritten = 0;
|
|
26322
|
+
} catch (error) {
|
|
26323
|
+
onError(error);
|
|
26324
|
+
throw error;
|
|
26325
|
+
}
|
|
26326
|
+
},
|
|
26327
|
+
finalize() {
|
|
26328
|
+
if (finalized) {
|
|
26329
|
+
const error = /* @__PURE__ */ new Error("Archive has already been finalized");
|
|
26330
|
+
onError(error);
|
|
26331
|
+
throw error;
|
|
26332
|
+
}
|
|
26333
|
+
if (currentHeader !== null) {
|
|
26334
|
+
const error = /* @__PURE__ */ new Error("Cannot finalize while an entry is still active");
|
|
26335
|
+
onError(error);
|
|
26336
|
+
throw error;
|
|
26337
|
+
}
|
|
26338
|
+
try {
|
|
26339
|
+
onData(EOF_BUFFER3);
|
|
26340
|
+
finalized = true;
|
|
26341
|
+
if (onFinalize)
|
|
26342
|
+
onFinalize();
|
|
26343
|
+
} catch (error) {
|
|
26344
|
+
onError(error);
|
|
26345
|
+
}
|
|
26346
|
+
}
|
|
26347
|
+
};
|
|
26348
|
+
}
|
|
26349
|
+
var INITIAL_CAPACITY2 = 256;
|
|
26350
|
+
function createChunkQueue2() {
|
|
26351
|
+
let chunks = new Array(INITIAL_CAPACITY2);
|
|
26352
|
+
let capacityMask = chunks.length - 1;
|
|
26353
|
+
let head = 0;
|
|
26354
|
+
let tail = 0;
|
|
26355
|
+
let totalAvailable = 0;
|
|
26356
|
+
const consumeFromHead = (count) => {
|
|
26357
|
+
const chunk = chunks[head];
|
|
26358
|
+
if (count === chunk.length) {
|
|
26359
|
+
chunks[head] = EMPTY3;
|
|
26360
|
+
head = head + 1 & capacityMask;
|
|
26361
|
+
} else
|
|
26362
|
+
chunks[head] = chunk.subarray(count);
|
|
26363
|
+
totalAvailable -= count;
|
|
26364
|
+
if (totalAvailable === 0 && chunks.length > INITIAL_CAPACITY2) {
|
|
26365
|
+
chunks = new Array(INITIAL_CAPACITY2);
|
|
26366
|
+
capacityMask = INITIAL_CAPACITY2 - 1;
|
|
26367
|
+
head = 0;
|
|
26368
|
+
tail = 0;
|
|
26369
|
+
}
|
|
26370
|
+
};
|
|
26371
|
+
function pull(bytes, callback) {
|
|
26372
|
+
if (callback) {
|
|
26373
|
+
let fed = 0;
|
|
26374
|
+
let remaining$1 = Math.min(bytes, totalAvailable);
|
|
26375
|
+
while (remaining$1 > 0) {
|
|
26376
|
+
const chunk = chunks[head];
|
|
26377
|
+
const toFeed = Math.min(remaining$1, chunk.length);
|
|
26378
|
+
const segment = toFeed === chunk.length ? chunk : chunk.subarray(0, toFeed);
|
|
26379
|
+
consumeFromHead(toFeed);
|
|
26380
|
+
remaining$1 -= toFeed;
|
|
26381
|
+
fed += toFeed;
|
|
26382
|
+
if (!callback(segment))
|
|
26383
|
+
break;
|
|
26384
|
+
}
|
|
26385
|
+
return fed;
|
|
26386
|
+
}
|
|
26387
|
+
if (totalAvailable < bytes)
|
|
26388
|
+
return null;
|
|
26389
|
+
if (bytes === 0)
|
|
26390
|
+
return EMPTY3;
|
|
26391
|
+
const firstChunk = chunks[head];
|
|
26392
|
+
if (firstChunk.length >= bytes) {
|
|
26393
|
+
const view = firstChunk.length === bytes ? firstChunk : firstChunk.subarray(0, bytes);
|
|
26394
|
+
consumeFromHead(bytes);
|
|
26395
|
+
return view;
|
|
26396
|
+
}
|
|
26397
|
+
const result = new Uint8Array(bytes);
|
|
26398
|
+
let copied = 0;
|
|
26399
|
+
let remaining = bytes;
|
|
26400
|
+
while (remaining > 0) {
|
|
26401
|
+
const chunk = chunks[head];
|
|
26402
|
+
const toCopy = Math.min(remaining, chunk.length);
|
|
26403
|
+
result.set(toCopy === chunk.length ? chunk : chunk.subarray(0, toCopy), copied);
|
|
26404
|
+
copied += toCopy;
|
|
26405
|
+
remaining -= toCopy;
|
|
26406
|
+
consumeFromHead(toCopy);
|
|
26407
|
+
}
|
|
26408
|
+
return result;
|
|
26409
|
+
}
|
|
26410
|
+
return {
|
|
26411
|
+
push: (chunk) => {
|
|
26412
|
+
if (chunk.length === 0)
|
|
26413
|
+
return;
|
|
26414
|
+
let nextTail = tail + 1 & capacityMask;
|
|
26415
|
+
if (nextTail === head) {
|
|
26416
|
+
const oldLen = chunks.length;
|
|
26417
|
+
const newLen = oldLen * 2;
|
|
26418
|
+
const newChunks = new Array(newLen);
|
|
26419
|
+
const count = tail - head + oldLen & oldLen - 1;
|
|
26420
|
+
if (head < tail)
|
|
26421
|
+
for (let i = 0;i < count; i++)
|
|
26422
|
+
newChunks[i] = chunks[head + i];
|
|
26423
|
+
else if (count > 0) {
|
|
26424
|
+
const firstPart = oldLen - head;
|
|
26425
|
+
for (let i = 0;i < firstPart; i++)
|
|
26426
|
+
newChunks[i] = chunks[head + i];
|
|
26427
|
+
for (let i = 0;i < tail; i++)
|
|
26428
|
+
newChunks[firstPart + i] = chunks[i];
|
|
26429
|
+
}
|
|
26430
|
+
chunks = newChunks;
|
|
26431
|
+
capacityMask = newLen - 1;
|
|
26432
|
+
head = 0;
|
|
26433
|
+
tail = count;
|
|
26434
|
+
nextTail = tail + 1 & capacityMask;
|
|
26435
|
+
}
|
|
26436
|
+
chunks[tail] = chunk;
|
|
26437
|
+
tail = nextTail;
|
|
26438
|
+
totalAvailable += chunk.length;
|
|
26439
|
+
},
|
|
26440
|
+
available: () => totalAvailable,
|
|
26441
|
+
peek: (bytes) => {
|
|
26442
|
+
if (totalAvailable < bytes)
|
|
26443
|
+
return null;
|
|
26444
|
+
if (bytes === 0)
|
|
26445
|
+
return EMPTY3;
|
|
26446
|
+
const firstChunk = chunks[head];
|
|
26447
|
+
if (firstChunk.length >= bytes)
|
|
26448
|
+
return firstChunk.length === bytes ? firstChunk : firstChunk.subarray(0, bytes);
|
|
26449
|
+
const result = new Uint8Array(bytes);
|
|
26450
|
+
let copied = 0;
|
|
26451
|
+
let index = head;
|
|
26452
|
+
while (copied < bytes) {
|
|
26453
|
+
const chunk = chunks[index];
|
|
26454
|
+
const toCopy = Math.min(bytes - copied, chunk.length);
|
|
26455
|
+
if (toCopy === chunk.length)
|
|
26456
|
+
result.set(chunk, copied);
|
|
26457
|
+
else
|
|
26458
|
+
result.set(chunk.subarray(0, toCopy), copied);
|
|
26459
|
+
copied += toCopy;
|
|
26460
|
+
index = index + 1 & capacityMask;
|
|
26461
|
+
}
|
|
26462
|
+
return result;
|
|
26463
|
+
},
|
|
26464
|
+
discard: (bytes) => {
|
|
26465
|
+
if (bytes > totalAvailable)
|
|
26466
|
+
throw new Error("Too many bytes consumed");
|
|
26467
|
+
if (bytes === 0)
|
|
26468
|
+
return;
|
|
26469
|
+
let remaining = bytes;
|
|
26470
|
+
while (remaining > 0) {
|
|
26471
|
+
const chunk = chunks[head];
|
|
26472
|
+
const toConsume = Math.min(remaining, chunk.length);
|
|
26473
|
+
consumeFromHead(toConsume);
|
|
26474
|
+
remaining -= toConsume;
|
|
26475
|
+
}
|
|
26476
|
+
},
|
|
26477
|
+
pull
|
|
26478
|
+
};
|
|
26479
|
+
}
|
|
26480
|
+
var STATE_HEADER2 = 0;
|
|
26481
|
+
var STATE_BODY2 = 1;
|
|
26482
|
+
var truncateErr2 = /* @__PURE__ */ new Error("Tar archive is truncated.");
|
|
26483
|
+
function createUnpacker2(options = {}) {
|
|
26484
|
+
const strict = options.strict ?? false;
|
|
26485
|
+
const { available, peek, push, discard, pull } = createChunkQueue2();
|
|
26486
|
+
let state = STATE_HEADER2;
|
|
26487
|
+
let ended = false;
|
|
26488
|
+
let done = false;
|
|
26489
|
+
let eof = false;
|
|
26490
|
+
let currentEntry = null;
|
|
26491
|
+
const paxGlobals = {};
|
|
26492
|
+
let nextEntryOverrides = {};
|
|
26493
|
+
const unpacker = {
|
|
26494
|
+
isEntryActive: () => state === STATE_BODY2,
|
|
26495
|
+
isBodyComplete: () => !currentEntry || currentEntry.remaining === 0,
|
|
26496
|
+
write(chunk) {
|
|
26497
|
+
if (ended)
|
|
26498
|
+
throw new Error("Archive already ended.");
|
|
26499
|
+
push(chunk);
|
|
26500
|
+
},
|
|
26501
|
+
end() {
|
|
26502
|
+
ended = true;
|
|
26503
|
+
},
|
|
26504
|
+
readHeader() {
|
|
26505
|
+
if (state !== STATE_HEADER2)
|
|
26506
|
+
throw new Error("Cannot read header while an entry is active");
|
|
26507
|
+
if (done)
|
|
26508
|
+
return;
|
|
26509
|
+
while (!done) {
|
|
26510
|
+
if (available() < BLOCK_SIZE3) {
|
|
26511
|
+
if (ended) {
|
|
26512
|
+
if (available() > 0 && strict)
|
|
26513
|
+
throw truncateErr2;
|
|
26514
|
+
done = true;
|
|
26515
|
+
return;
|
|
26516
|
+
}
|
|
26517
|
+
return null;
|
|
26518
|
+
}
|
|
26519
|
+
const headerBlock = peek(BLOCK_SIZE3);
|
|
26520
|
+
if (isZeroBlock2(headerBlock)) {
|
|
26521
|
+
if (available() < BLOCK_SIZE3 * 2) {
|
|
26522
|
+
if (ended) {
|
|
26523
|
+
if (strict)
|
|
26524
|
+
throw truncateErr2;
|
|
26525
|
+
done = true;
|
|
26526
|
+
return;
|
|
26527
|
+
}
|
|
26528
|
+
return null;
|
|
26529
|
+
}
|
|
26530
|
+
if (isZeroBlock2(peek(BLOCK_SIZE3 * 2).subarray(BLOCK_SIZE3))) {
|
|
26531
|
+
discard(BLOCK_SIZE3 * 2);
|
|
26532
|
+
done = true;
|
|
26533
|
+
eof = true;
|
|
26534
|
+
return;
|
|
26535
|
+
}
|
|
26536
|
+
if (strict)
|
|
26537
|
+
throw new Error("Invalid tar header.");
|
|
26538
|
+
discard(BLOCK_SIZE3);
|
|
26539
|
+
continue;
|
|
26540
|
+
}
|
|
26541
|
+
let internalHeader;
|
|
26542
|
+
try {
|
|
26543
|
+
internalHeader = parseUstarHeader2(headerBlock, strict);
|
|
26544
|
+
} catch (err) {
|
|
26545
|
+
if (strict)
|
|
26546
|
+
throw err;
|
|
26547
|
+
discard(BLOCK_SIZE3);
|
|
26548
|
+
continue;
|
|
26549
|
+
}
|
|
26550
|
+
const metaParser = getMetaParser2(internalHeader.type);
|
|
26551
|
+
if (metaParser) {
|
|
26552
|
+
const paddedSize = internalHeader.size + BLOCK_SIZE_MASK2 & ~BLOCK_SIZE_MASK2;
|
|
26553
|
+
if (available() < BLOCK_SIZE3 + paddedSize) {
|
|
26554
|
+
if (ended && strict)
|
|
26555
|
+
throw truncateErr2;
|
|
26556
|
+
return null;
|
|
26557
|
+
}
|
|
26558
|
+
discard(BLOCK_SIZE3);
|
|
26559
|
+
const overrides = metaParser(pull(paddedSize).subarray(0, internalHeader.size));
|
|
26560
|
+
const target = internalHeader.type === "pax-global-header" ? paxGlobals : nextEntryOverrides;
|
|
26561
|
+
for (const key in overrides)
|
|
26562
|
+
target[key] = overrides[key];
|
|
26563
|
+
continue;
|
|
26564
|
+
}
|
|
26565
|
+
discard(BLOCK_SIZE3);
|
|
26566
|
+
const header = internalHeader;
|
|
26567
|
+
if (internalHeader.prefix)
|
|
26568
|
+
header.name = `${internalHeader.prefix}/${header.name}`;
|
|
26569
|
+
applyOverrides2(header, paxGlobals);
|
|
26570
|
+
applyOverrides2(header, nextEntryOverrides);
|
|
26571
|
+
nextEntryOverrides = {};
|
|
26572
|
+
currentEntry = {
|
|
26573
|
+
header,
|
|
26574
|
+
remaining: header.size,
|
|
26575
|
+
padding: -header.size & BLOCK_SIZE_MASK2
|
|
26576
|
+
};
|
|
26577
|
+
state = STATE_BODY2;
|
|
26578
|
+
return header;
|
|
26579
|
+
}
|
|
26580
|
+
},
|
|
26581
|
+
streamBody(callback) {
|
|
26582
|
+
if (state !== STATE_BODY2 || !currentEntry || currentEntry.remaining === 0)
|
|
26583
|
+
return 0;
|
|
26584
|
+
const bytesToFeed = Math.min(currentEntry.remaining, available());
|
|
26585
|
+
if (bytesToFeed === 0)
|
|
26586
|
+
return 0;
|
|
26587
|
+
const fed = pull(bytesToFeed, callback);
|
|
26588
|
+
currentEntry.remaining -= fed;
|
|
26589
|
+
return fed;
|
|
26590
|
+
},
|
|
26591
|
+
skipPadding() {
|
|
26592
|
+
if (state !== STATE_BODY2 || !currentEntry)
|
|
26593
|
+
return true;
|
|
26594
|
+
if (currentEntry.remaining > 0)
|
|
26595
|
+
throw new Error("Body not fully consumed");
|
|
26596
|
+
if (available() < currentEntry.padding)
|
|
26597
|
+
return false;
|
|
26598
|
+
discard(currentEntry.padding);
|
|
26599
|
+
currentEntry = null;
|
|
26600
|
+
state = STATE_HEADER2;
|
|
26601
|
+
return true;
|
|
26602
|
+
},
|
|
26603
|
+
skipEntry() {
|
|
26604
|
+
if (state !== STATE_BODY2 || !currentEntry)
|
|
26605
|
+
return true;
|
|
26606
|
+
const toDiscard = Math.min(currentEntry.remaining, available());
|
|
26607
|
+
if (toDiscard > 0) {
|
|
26608
|
+
discard(toDiscard);
|
|
26609
|
+
currentEntry.remaining -= toDiscard;
|
|
26610
|
+
}
|
|
26611
|
+
if (currentEntry.remaining > 0)
|
|
26612
|
+
return false;
|
|
26613
|
+
return unpacker.skipPadding();
|
|
26614
|
+
},
|
|
26615
|
+
validateEOF() {
|
|
26616
|
+
if (strict) {
|
|
26617
|
+
if (!eof)
|
|
26618
|
+
throw truncateErr2;
|
|
26619
|
+
if (available() > 0) {
|
|
26620
|
+
if (pull(available()).some((byte) => byte !== 0))
|
|
26621
|
+
throw new Error("Invalid EOF.");
|
|
26622
|
+
}
|
|
26623
|
+
}
|
|
26624
|
+
}
|
|
26625
|
+
};
|
|
26626
|
+
return unpacker;
|
|
26627
|
+
}
|
|
26628
|
+
function isZeroBlock2(block) {
|
|
26629
|
+
if (block.byteOffset % 8 === 0) {
|
|
26630
|
+
const view = new BigUint64Array(block.buffer, block.byteOffset, block.length / 8);
|
|
26631
|
+
for (let i = 0;i < view.length; i++)
|
|
26632
|
+
if (view[i] !== 0n)
|
|
26633
|
+
return false;
|
|
26634
|
+
return true;
|
|
26635
|
+
}
|
|
26636
|
+
for (let i = 0;i < block.length; i++)
|
|
26637
|
+
if (block[i] !== 0)
|
|
26638
|
+
return false;
|
|
26639
|
+
return true;
|
|
26640
|
+
}
|
|
26641
|
+
function createTarPacker22() {
|
|
26642
|
+
let streamController;
|
|
26643
|
+
let packer;
|
|
26644
|
+
return {
|
|
26645
|
+
readable: new ReadableStream({ start(controller) {
|
|
26646
|
+
streamController = controller;
|
|
26647
|
+
packer = createTarPacker3(controller.enqueue.bind(controller), controller.error.bind(controller), controller.close.bind(controller));
|
|
26648
|
+
} }),
|
|
26649
|
+
controller: {
|
|
26650
|
+
add(header) {
|
|
26651
|
+
const bodyless = isBodyless2(header);
|
|
26652
|
+
const h = { ...header };
|
|
26653
|
+
if (bodyless)
|
|
26654
|
+
h.size = 0;
|
|
26655
|
+
packer.add(h);
|
|
26656
|
+
if (bodyless)
|
|
26657
|
+
packer.endEntry();
|
|
26658
|
+
return new WritableStream({
|
|
26659
|
+
write(chunk) {
|
|
26660
|
+
packer.write(chunk);
|
|
26661
|
+
},
|
|
26662
|
+
close() {
|
|
26663
|
+
if (!bodyless)
|
|
26664
|
+
packer.endEntry();
|
|
26665
|
+
},
|
|
26666
|
+
abort(reason) {
|
|
26667
|
+
streamController.error(reason);
|
|
26668
|
+
}
|
|
26669
|
+
});
|
|
26670
|
+
},
|
|
26671
|
+
finalize() {
|
|
26672
|
+
packer.finalize();
|
|
26673
|
+
},
|
|
26674
|
+
error(err) {
|
|
26675
|
+
streamController.error(err);
|
|
26676
|
+
}
|
|
26677
|
+
}
|
|
26678
|
+
};
|
|
26679
|
+
}
|
|
26680
|
+
async function streamToBuffer2(stream) {
|
|
26681
|
+
const chunks = [];
|
|
26682
|
+
const reader = stream.getReader();
|
|
26683
|
+
let totalLength = 0;
|
|
26684
|
+
try {
|
|
26685
|
+
while (true) {
|
|
26686
|
+
const { done, value } = await reader.read();
|
|
26687
|
+
if (done)
|
|
26688
|
+
break;
|
|
26689
|
+
chunks.push(value);
|
|
26690
|
+
totalLength += value.length;
|
|
26691
|
+
}
|
|
26692
|
+
const result = new Uint8Array(totalLength);
|
|
26693
|
+
let offset = 0;
|
|
26694
|
+
for (const chunk of chunks) {
|
|
26695
|
+
result.set(chunk, offset);
|
|
26696
|
+
offset += chunk.length;
|
|
26697
|
+
}
|
|
26698
|
+
return result;
|
|
26699
|
+
} finally {
|
|
26700
|
+
reader.releaseLock();
|
|
26701
|
+
}
|
|
26702
|
+
}
|
|
26703
|
+
var drain2 = (stream) => stream.pipeTo(new WritableStream);
|
|
26704
|
+
function createTarDecoder2(options = {}) {
|
|
26705
|
+
const unpacker = createUnpacker2(options);
|
|
26706
|
+
let bodyController = null;
|
|
26707
|
+
let pumping = false;
|
|
26708
|
+
const pump = (controller) => {
|
|
26709
|
+
if (pumping)
|
|
26710
|
+
return;
|
|
26711
|
+
pumping = true;
|
|
26712
|
+
try {
|
|
26713
|
+
while (true)
|
|
26714
|
+
if (unpacker.isEntryActive()) {
|
|
26715
|
+
if (bodyController) {
|
|
26716
|
+
if (unpacker.streamBody((c) => (bodyController.enqueue(c), true)) === 0 && !unpacker.isBodyComplete())
|
|
26717
|
+
break;
|
|
26718
|
+
} else if (!unpacker.skipEntry())
|
|
26719
|
+
break;
|
|
26720
|
+
if (unpacker.isBodyComplete()) {
|
|
26721
|
+
try {
|
|
26722
|
+
bodyController?.close();
|
|
26723
|
+
} catch {}
|
|
26724
|
+
bodyController = null;
|
|
26725
|
+
if (!unpacker.skipPadding())
|
|
26726
|
+
break;
|
|
26727
|
+
}
|
|
26728
|
+
} else {
|
|
26729
|
+
const header = unpacker.readHeader();
|
|
26730
|
+
if (header === null || header === undefined)
|
|
26731
|
+
break;
|
|
26732
|
+
controller.enqueue({
|
|
26733
|
+
header,
|
|
26734
|
+
body: new ReadableStream({
|
|
26735
|
+
start(c) {
|
|
26736
|
+
if (header.size === 0)
|
|
26737
|
+
c.close();
|
|
26738
|
+
else
|
|
26739
|
+
bodyController = c;
|
|
26740
|
+
},
|
|
26741
|
+
pull: () => pump(controller),
|
|
26742
|
+
cancel() {
|
|
26743
|
+
bodyController = null;
|
|
26744
|
+
pump(controller);
|
|
26745
|
+
}
|
|
26746
|
+
})
|
|
26747
|
+
});
|
|
26748
|
+
}
|
|
26749
|
+
} catch (error) {
|
|
26750
|
+
try {
|
|
26751
|
+
bodyController?.error(error);
|
|
26752
|
+
} catch {}
|
|
26753
|
+
bodyController = null;
|
|
26754
|
+
throw error;
|
|
26755
|
+
} finally {
|
|
26756
|
+
pumping = false;
|
|
26757
|
+
}
|
|
26758
|
+
};
|
|
26759
|
+
return new TransformStream({
|
|
26760
|
+
transform(chunk, controller) {
|
|
26761
|
+
try {
|
|
26762
|
+
unpacker.write(chunk);
|
|
26763
|
+
pump(controller);
|
|
26764
|
+
} catch (error) {
|
|
26765
|
+
try {
|
|
26766
|
+
bodyController?.error(error);
|
|
26767
|
+
} catch {}
|
|
26768
|
+
throw error;
|
|
26769
|
+
}
|
|
26770
|
+
},
|
|
26771
|
+
flush(controller) {
|
|
26772
|
+
try {
|
|
26773
|
+
unpacker.end();
|
|
26774
|
+
pump(controller);
|
|
26775
|
+
unpacker.validateEOF();
|
|
26776
|
+
if (unpacker.isEntryActive() && !unpacker.isBodyComplete())
|
|
26777
|
+
try {
|
|
26778
|
+
bodyController?.close();
|
|
26779
|
+
} catch {}
|
|
26780
|
+
} catch (error) {
|
|
26781
|
+
try {
|
|
26782
|
+
bodyController?.error(error);
|
|
26783
|
+
} catch {}
|
|
26784
|
+
throw error;
|
|
26785
|
+
}
|
|
26786
|
+
}
|
|
26787
|
+
}, undefined, { highWaterMark: 1 });
|
|
26788
|
+
}
|
|
26789
|
+
async function packTar2(entries) {
|
|
26790
|
+
const { readable, controller } = createTarPacker22();
|
|
26791
|
+
await (async () => {
|
|
26792
|
+
for (const entry of entries) {
|
|
26793
|
+
const entryStream = controller.add(entry.header);
|
|
26794
|
+
const body = "body" in entry ? entry.body : entry.data;
|
|
26795
|
+
if (!body) {
|
|
26796
|
+
await entryStream.close();
|
|
26797
|
+
continue;
|
|
26798
|
+
}
|
|
26799
|
+
if (body instanceof ReadableStream)
|
|
26800
|
+
await body.pipeTo(entryStream);
|
|
26801
|
+
else if (body instanceof Blob)
|
|
26802
|
+
await body.stream().pipeTo(entryStream);
|
|
26803
|
+
else
|
|
26804
|
+
try {
|
|
26805
|
+
const chunk = await normalizeBody2(body);
|
|
26806
|
+
if (chunk.length > 0) {
|
|
26807
|
+
const writer = entryStream.getWriter();
|
|
26808
|
+
await writer.write(chunk);
|
|
26809
|
+
await writer.close();
|
|
26810
|
+
} else
|
|
26811
|
+
await entryStream.close();
|
|
26812
|
+
} catch {
|
|
26813
|
+
throw new TypeError(`Unsupported content type for entry "${entry.header.name}".`);
|
|
26814
|
+
}
|
|
26815
|
+
}
|
|
26816
|
+
})().then(() => controller.finalize()).catch((err) => controller.error(err));
|
|
26817
|
+
return new Uint8Array(await streamToBuffer2(readable));
|
|
26818
|
+
}
|
|
26819
|
+
async function unpackTar2(archive, options = {}) {
|
|
26820
|
+
const sourceStream = archive instanceof ReadableStream ? archive : new ReadableStream({ start(controller) {
|
|
26821
|
+
controller.enqueue(archive instanceof Uint8Array ? archive : new Uint8Array(archive));
|
|
26822
|
+
controller.close();
|
|
26823
|
+
} });
|
|
26824
|
+
const results = [];
|
|
26825
|
+
const entryStream = sourceStream.pipeThrough(createTarDecoder2(options));
|
|
26826
|
+
for await (const entry of entryStream) {
|
|
26827
|
+
let processedHeader;
|
|
26828
|
+
try {
|
|
26829
|
+
processedHeader = transformHeader2(entry.header, options);
|
|
26830
|
+
} catch (error) {
|
|
26831
|
+
await entry.body.cancel();
|
|
26832
|
+
throw error;
|
|
26833
|
+
}
|
|
26834
|
+
if (processedHeader === null) {
|
|
26835
|
+
await drain2(entry.body);
|
|
26836
|
+
continue;
|
|
26837
|
+
}
|
|
26838
|
+
if (isBodyless2(processedHeader)) {
|
|
26839
|
+
await drain2(entry.body);
|
|
26840
|
+
results.push({ header: processedHeader });
|
|
26841
|
+
} else
|
|
26842
|
+
results.push({
|
|
26843
|
+
header: processedHeader,
|
|
26844
|
+
data: await streamToBuffer2(entry.body)
|
|
26845
|
+
});
|
|
26846
|
+
}
|
|
26847
|
+
return results;
|
|
26848
|
+
}
|
|
26849
|
+
var gzipAsync3 = promisify3(gzip3);
|
|
26850
|
+
var gunzipAsync3 = promisify3(gunzip3);
|
|
26851
|
+
|
|
26852
|
+
class RXCImpl2 {
|
|
26853
|
+
_buffer;
|
|
26854
|
+
_filesCache = null;
|
|
26855
|
+
constructor(buffer) {
|
|
26856
|
+
this._buffer = buffer;
|
|
26857
|
+
}
|
|
26858
|
+
get stream() {
|
|
26859
|
+
const buffer = this._buffer;
|
|
26860
|
+
return new ReadableStream({
|
|
26861
|
+
start(controller) {
|
|
26862
|
+
controller.enqueue(new Uint8Array(buffer));
|
|
26863
|
+
controller.close();
|
|
26864
|
+
}
|
|
26865
|
+
});
|
|
26866
|
+
}
|
|
26867
|
+
async buffer() {
|
|
26868
|
+
return this._buffer;
|
|
26869
|
+
}
|
|
26870
|
+
async file(path) {
|
|
26871
|
+
const filesMap = await this.files();
|
|
26872
|
+
const content = filesMap.get(path);
|
|
26873
|
+
if (!content) {
|
|
26874
|
+
throw new ContentError2(`file not found: ${path}`);
|
|
26875
|
+
}
|
|
26876
|
+
return content;
|
|
26877
|
+
}
|
|
26878
|
+
async files() {
|
|
26879
|
+
if (this._filesCache) {
|
|
26880
|
+
return this._filesCache;
|
|
26881
|
+
}
|
|
26882
|
+
const tarBuffer = await gunzipAsync3(this._buffer);
|
|
26883
|
+
const entries = await unpackTar2(tarBuffer);
|
|
26884
|
+
const filesMap = new Map;
|
|
26885
|
+
for (const entry of entries) {
|
|
26886
|
+
if ((entry.header.type === "file" || entry.header.type === undefined) && entry.data) {
|
|
26887
|
+
filesMap.set(entry.header.name, Buffer.from(entry.data));
|
|
26888
|
+
}
|
|
26889
|
+
}
|
|
26890
|
+
this._filesCache = filesMap;
|
|
26891
|
+
return filesMap;
|
|
26892
|
+
}
|
|
26893
|
+
}
|
|
26894
|
+
function isArchiveInput2(input) {
|
|
26895
|
+
return "archive" in input && Buffer.isBuffer(input.archive);
|
|
26896
|
+
}
|
|
26897
|
+
async function createRXC2(input) {
|
|
26898
|
+
if (isArchiveInput2(input)) {
|
|
26899
|
+
return new RXCImpl2(input.archive);
|
|
26900
|
+
}
|
|
26901
|
+
const entries = Object.entries(input).map(([name, content]) => {
|
|
26902
|
+
const body = typeof content === "string" ? content : content instanceof Uint8Array ? content : new Uint8Array(content);
|
|
26903
|
+
const size = typeof content === "string" ? Buffer.byteLength(content) : content.length;
|
|
26904
|
+
return {
|
|
26905
|
+
header: { name, size, type: "file" },
|
|
26906
|
+
body
|
|
26907
|
+
};
|
|
26908
|
+
});
|
|
26909
|
+
const tarBuffer = await packTar2(entries);
|
|
26910
|
+
const gzipBuffer = await gzipAsync3(Buffer.from(tarBuffer));
|
|
26911
|
+
return new RXCImpl2(gzipBuffer);
|
|
26912
|
+
}
|
|
26913
|
+
|
|
26914
|
+
class FolderLoader {
|
|
26915
|
+
async canLoad(source) {
|
|
26916
|
+
try {
|
|
26917
|
+
const stats = await stat22(source);
|
|
26918
|
+
if (!stats.isDirectory()) {
|
|
26919
|
+
return false;
|
|
26920
|
+
}
|
|
26921
|
+
const manifestPath = join22(source, "resource.json");
|
|
26922
|
+
const manifestStats = await stat22(manifestPath);
|
|
26923
|
+
return manifestStats.isFile();
|
|
26924
|
+
} catch {
|
|
26925
|
+
return false;
|
|
26926
|
+
}
|
|
26927
|
+
}
|
|
26928
|
+
async load(folderPath) {
|
|
26929
|
+
const manifestPath = join22(folderPath, "resource.json");
|
|
26930
|
+
let manifestJson;
|
|
26931
|
+
try {
|
|
26932
|
+
manifestJson = await readFile22(manifestPath, "utf-8");
|
|
26933
|
+
} catch (error) {
|
|
26934
|
+
throw new ResourceXError3(`Failed to read resource.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
26935
|
+
}
|
|
26936
|
+
let manifestData;
|
|
26937
|
+
try {
|
|
26938
|
+
manifestData = JSON.parse(manifestJson);
|
|
26939
|
+
} catch (error) {
|
|
26940
|
+
throw new ResourceXError3(`Invalid JSON in resource.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
26941
|
+
}
|
|
26942
|
+
if (!manifestData.name) {
|
|
26943
|
+
throw new ResourceXError3("Invalid resource.json: missing required field 'name'");
|
|
26944
|
+
}
|
|
26945
|
+
if (!manifestData.type) {
|
|
26946
|
+
throw new ResourceXError3("Invalid resource.json: missing required field 'type'");
|
|
26947
|
+
}
|
|
26948
|
+
if (!manifestData.version) {
|
|
26949
|
+
throw new ResourceXError3("Invalid resource.json: missing required field 'version'");
|
|
26950
|
+
}
|
|
26951
|
+
const manifest = createRXM2({
|
|
26952
|
+
domain: manifestData.domain ?? "localhost",
|
|
26953
|
+
path: manifestData.path,
|
|
26954
|
+
name: manifestData.name,
|
|
26955
|
+
type: manifestData.type,
|
|
26956
|
+
version: manifestData.version
|
|
26957
|
+
});
|
|
26958
|
+
const files = await this.readFolderFiles(folderPath);
|
|
26959
|
+
if (Object.keys(files).length === 0) {
|
|
26960
|
+
throw new ResourceXError3("No content files found in resource folder");
|
|
26961
|
+
}
|
|
26962
|
+
const content = await createRXC2(files);
|
|
26963
|
+
const locator = parseRXL3(manifest.toLocator());
|
|
26964
|
+
return {
|
|
26965
|
+
locator,
|
|
26966
|
+
manifest,
|
|
26967
|
+
content
|
|
26968
|
+
};
|
|
26969
|
+
}
|
|
26970
|
+
async readFolderFiles(folderPath, basePath = folderPath) {
|
|
26971
|
+
const files = {};
|
|
26972
|
+
const entries = await readdir22(folderPath, { withFileTypes: true });
|
|
26973
|
+
for (const entry of entries) {
|
|
26974
|
+
const fullPath = join22(folderPath, entry.name);
|
|
26975
|
+
const relativePath = relative(basePath, fullPath);
|
|
26976
|
+
if (relativePath === "resource.json") {
|
|
26977
|
+
continue;
|
|
26978
|
+
}
|
|
26979
|
+
if (entry.isFile()) {
|
|
26980
|
+
files[relativePath] = await readFile22(fullPath);
|
|
26981
|
+
} else if (entry.isDirectory()) {
|
|
26982
|
+
const subFiles = await this.readFolderFiles(fullPath, basePath);
|
|
26983
|
+
Object.assign(files, subFiles);
|
|
26984
|
+
}
|
|
26985
|
+
}
|
|
26986
|
+
return files;
|
|
26987
|
+
}
|
|
26988
|
+
}
|
|
26989
|
+
async function loadResource(source, config) {
|
|
26990
|
+
const loader = config?.loader ?? new FolderLoader;
|
|
26991
|
+
const canLoad = await loader.canLoad(source);
|
|
26992
|
+
if (!canLoad) {
|
|
26993
|
+
throw new ResourceXError3(`Cannot load resource from: ${source}`);
|
|
26994
|
+
}
|
|
26995
|
+
return loader.load(source);
|
|
26996
|
+
}
|
|
25723
26997
|
var DEFAULT_PATH = `${homedir()}/.resourcex`;
|
|
25724
26998
|
|
|
25725
26999
|
class LocalRegistry {
|
|
@@ -25747,14 +27021,14 @@ class LocalRegistry {
|
|
|
25747
27021
|
const resourceName = rxl.type ? `${rxl.name}.${rxl.type}` : rxl.name;
|
|
25748
27022
|
const version = rxl.version ?? "latest";
|
|
25749
27023
|
if (area === "local") {
|
|
25750
|
-
return
|
|
27024
|
+
return join3(this.basePath, "local", resourceName, version);
|
|
25751
27025
|
} else {
|
|
25752
27026
|
const domain = rxl.domain ?? "localhost";
|
|
25753
|
-
let path =
|
|
27027
|
+
let path = join3(this.basePath, "cache", domain);
|
|
25754
27028
|
if (rxl.path) {
|
|
25755
|
-
path =
|
|
27029
|
+
path = join3(path, rxl.path);
|
|
25756
27030
|
}
|
|
25757
|
-
return
|
|
27031
|
+
return join3(path, resourceName, version);
|
|
25758
27032
|
}
|
|
25759
27033
|
}
|
|
25760
27034
|
isLocalOnlyLocator(locator) {
|
|
@@ -25762,7 +27036,7 @@ class LocalRegistry {
|
|
|
25762
27036
|
return !rxl.domain || rxl.domain === "localhost";
|
|
25763
27037
|
}
|
|
25764
27038
|
async existsAt(resourcePath) {
|
|
25765
|
-
const manifestPath =
|
|
27039
|
+
const manifestPath = join3(resourcePath, "manifest.json");
|
|
25766
27040
|
const arl = this.arp.parse(this.toArpUrl(manifestPath));
|
|
25767
27041
|
return arl.exists();
|
|
25768
27042
|
}
|
|
@@ -25777,39 +27051,72 @@ class LocalRegistry {
|
|
|
25777
27051
|
}
|
|
25778
27052
|
return null;
|
|
25779
27053
|
}
|
|
27054
|
+
async isSymlink(path) {
|
|
27055
|
+
try {
|
|
27056
|
+
const stats = await lstat(path);
|
|
27057
|
+
return stats.isSymbolicLink();
|
|
27058
|
+
} catch {
|
|
27059
|
+
return false;
|
|
27060
|
+
}
|
|
27061
|
+
}
|
|
25780
27062
|
async loadFrom(resourcePath) {
|
|
25781
|
-
|
|
27063
|
+
if (await this.isSymlink(resourcePath)) {
|
|
27064
|
+
const targetPath = await readlink(resourcePath);
|
|
27065
|
+
return loadResource(targetPath);
|
|
27066
|
+
}
|
|
27067
|
+
const manifestPath = join3(resourcePath, "manifest.json");
|
|
25782
27068
|
const manifestArl = this.arp.parse(this.toArpUrl(manifestPath));
|
|
25783
27069
|
const manifestResource = await manifestArl.resolve();
|
|
25784
27070
|
const manifestContent = manifestResource.content.toString("utf-8");
|
|
25785
27071
|
const manifestData = JSON.parse(manifestContent);
|
|
25786
27072
|
const manifest = createRXM(manifestData);
|
|
25787
|
-
const contentPath =
|
|
27073
|
+
const contentPath = join3(resourcePath, "content.tar.gz");
|
|
25788
27074
|
const contentArl = this.arp.parse(this.toArpUrl(contentPath));
|
|
25789
27075
|
const contentResource = await contentArl.resolve();
|
|
25790
27076
|
const data = contentResource.content;
|
|
25791
27077
|
return this.typeHandler.deserialize(data, manifest);
|
|
25792
27078
|
}
|
|
25793
|
-
async
|
|
25794
|
-
|
|
25795
|
-
|
|
25796
|
-
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
|
|
27079
|
+
async link(path) {
|
|
27080
|
+
const rxr = await loadResource(path);
|
|
27081
|
+
const locator = rxr.manifest.toLocator();
|
|
27082
|
+
const resourcePath = this.buildPath(locator, "local");
|
|
27083
|
+
try {
|
|
27084
|
+
const arl = this.arp.parse(this.toArpUrl(resourcePath));
|
|
27085
|
+
if (await arl.exists()) {
|
|
27086
|
+
await arl.delete();
|
|
27087
|
+
}
|
|
27088
|
+
} catch {}
|
|
27089
|
+
const parentPath = join3(resourcePath, "..");
|
|
27090
|
+
const parentArl = this.arp.parse(this.toArpUrl(parentPath));
|
|
27091
|
+
await parentArl.mkdir();
|
|
27092
|
+
const absolutePath = resolvePath(path);
|
|
27093
|
+
await symlink(absolutePath, resourcePath);
|
|
27094
|
+
}
|
|
27095
|
+
async add(source) {
|
|
27096
|
+
const resource = typeof source === "string" ? await loadResource(source) : source;
|
|
25800
27097
|
const locator = resource.manifest.toLocator();
|
|
25801
27098
|
const resourcePath = this.buildPath(locator, "local");
|
|
27099
|
+
if (await this.isSymlink(resourcePath)) {
|
|
27100
|
+
const arl = this.arp.parse(this.toArpUrl(resourcePath));
|
|
27101
|
+
await arl.delete();
|
|
27102
|
+
}
|
|
25802
27103
|
const dirArl = this.arp.parse(this.toArpUrl(resourcePath));
|
|
25803
27104
|
await dirArl.mkdir();
|
|
25804
|
-
const manifestPath =
|
|
27105
|
+
const manifestPath = join3(resourcePath, "manifest.json");
|
|
25805
27106
|
const manifestArl = this.arp.parse(this.toArpUrl(manifestPath));
|
|
25806
27107
|
const manifestContent = Buffer.from(JSON.stringify(resource.manifest.toJSON(), null, 2), "utf-8");
|
|
25807
27108
|
await manifestArl.deposit(manifestContent);
|
|
25808
|
-
const contentPath =
|
|
27109
|
+
const contentPath = join3(resourcePath, "content.tar.gz");
|
|
25809
27110
|
const contentArl = this.arp.parse(this.toArpUrl(contentPath));
|
|
25810
27111
|
const serialized = await this.typeHandler.serialize(resource);
|
|
25811
27112
|
await contentArl.deposit(serialized);
|
|
25812
27113
|
}
|
|
27114
|
+
async pull(_locator, _options) {
|
|
27115
|
+
throw new RegistryError("Pull not implemented yet - see issue #018");
|
|
27116
|
+
}
|
|
27117
|
+
async publish(_source, _options) {
|
|
27118
|
+
throw new RegistryError("Publish not implemented yet - see issue #018");
|
|
27119
|
+
}
|
|
25813
27120
|
async get(locator) {
|
|
25814
27121
|
const area = await this.findArea(locator);
|
|
25815
27122
|
if (!area) {
|
|
@@ -25845,7 +27152,7 @@ class LocalRegistry {
|
|
|
25845
27152
|
async search(options) {
|
|
25846
27153
|
const { query, limit, offset = 0 } = options ?? {};
|
|
25847
27154
|
const locators = [];
|
|
25848
|
-
const localDir =
|
|
27155
|
+
const localDir = join3(this.basePath, "local");
|
|
25849
27156
|
try {
|
|
25850
27157
|
const localArl = this.arp.parse(this.toArpUrl(localDir));
|
|
25851
27158
|
const localEntries = await localArl.list({ recursive: true, pattern: "*.json" });
|
|
@@ -25857,7 +27164,7 @@ class LocalRegistry {
|
|
|
25857
27164
|
locators.push(rxl);
|
|
25858
27165
|
}
|
|
25859
27166
|
} catch {}
|
|
25860
|
-
const cacheDir =
|
|
27167
|
+
const cacheDir = join3(this.basePath, "cache");
|
|
25861
27168
|
try {
|
|
25862
27169
|
const cacheArl = this.arp.parse(this.toArpUrl(cacheDir));
|
|
25863
27170
|
const cacheEntries = await cacheArl.list({ recursive: true, pattern: "*.json" });
|
|
@@ -25952,15 +27259,18 @@ class RemoteRegistry {
|
|
|
25952
27259
|
supportType(type) {
|
|
25953
27260
|
this.typeHandler.register(type);
|
|
25954
27261
|
}
|
|
27262
|
+
async link(_path) {
|
|
27263
|
+
throw new RegistryError("Cannot link to remote registry - use local registry for linking");
|
|
27264
|
+
}
|
|
27265
|
+
async add(_source) {
|
|
27266
|
+
throw new RegistryError("Cannot add to remote registry - use local registry for adding");
|
|
27267
|
+
}
|
|
25955
27268
|
async pull(_locator, _options) {
|
|
25956
27269
|
throw new RegistryError("Cannot pull to remote registry - use local registry for pulling");
|
|
25957
27270
|
}
|
|
25958
|
-
async publish(
|
|
27271
|
+
async publish(_source, _options) {
|
|
25959
27272
|
throw new RegistryError("Remote registry publish not implemented yet");
|
|
25960
27273
|
}
|
|
25961
|
-
async link(_resource) {
|
|
25962
|
-
throw new RegistryError("Cannot link to remote registry - use local registry for linking");
|
|
25963
|
-
}
|
|
25964
27274
|
async get(locator) {
|
|
25965
27275
|
const manifestUrl = `${this.endpoint}/resource?locator=${encodeURIComponent(locator)}`;
|
|
25966
27276
|
const manifestResponse = await fetch(manifestUrl);
|
|
@@ -26223,7 +27533,7 @@ class GitRegistry {
|
|
|
26223
27533
|
normalized = normalized.slice(0, -4);
|
|
26224
27534
|
}
|
|
26225
27535
|
const dirName = normalized.replace(/\//g, "-");
|
|
26226
|
-
return
|
|
27536
|
+
return join4(DEFAULT_GIT_CACHE, dirName);
|
|
26227
27537
|
}
|
|
26228
27538
|
supportType(type) {
|
|
26229
27539
|
this.typeHandler.register(type);
|
|
@@ -26232,7 +27542,7 @@ class GitRegistry {
|
|
|
26232
27542
|
return `arp:binary:file://${filePath}`;
|
|
26233
27543
|
}
|
|
26234
27544
|
async ensureCloned() {
|
|
26235
|
-
const gitDir =
|
|
27545
|
+
const gitDir = join4(this.cacheDir, ".git");
|
|
26236
27546
|
const gitArl = this.arp.parse(this.toArpUrl(gitDir));
|
|
26237
27547
|
if (this.isLocal) {
|
|
26238
27548
|
if (!await gitArl.exists()) {
|
|
@@ -26311,17 +27621,17 @@ class GitRegistry {
|
|
|
26311
27621
|
const rxl = parseRXL(locator);
|
|
26312
27622
|
const domain = rxl.domain ?? "localhost";
|
|
26313
27623
|
const version = rxl.version ?? "latest";
|
|
26314
|
-
let path =
|
|
27624
|
+
let path = join4(this.cacheDir, this.basePath, domain);
|
|
26315
27625
|
if (rxl.path) {
|
|
26316
|
-
path =
|
|
27626
|
+
path = join4(path, rxl.path);
|
|
26317
27627
|
}
|
|
26318
27628
|
const resourceName = rxl.type ? `${rxl.name}.${rxl.type}` : rxl.name;
|
|
26319
|
-
return
|
|
27629
|
+
return join4(path, resourceName, version);
|
|
26320
27630
|
}
|
|
26321
27631
|
async get(locator) {
|
|
26322
27632
|
await this.ensureCloned();
|
|
26323
27633
|
const resourcePath = this.buildResourcePath(locator);
|
|
26324
|
-
const manifestPath =
|
|
27634
|
+
const manifestPath = join4(resourcePath, "manifest.json");
|
|
26325
27635
|
const manifestArl = this.arp.parse(this.toArpUrl(manifestPath));
|
|
26326
27636
|
if (!await manifestArl.exists()) {
|
|
26327
27637
|
throw new RegistryError(`Resource not found: ${locator}`);
|
|
@@ -26330,7 +27640,7 @@ class GitRegistry {
|
|
|
26330
27640
|
const manifestContent = manifestResource.content.toString("utf-8");
|
|
26331
27641
|
const manifestData = JSON.parse(manifestContent);
|
|
26332
27642
|
const manifest = createRXM(manifestData);
|
|
26333
|
-
const contentPath =
|
|
27643
|
+
const contentPath = join4(resourcePath, "content.tar.gz");
|
|
26334
27644
|
const contentArl = this.arp.parse(this.toArpUrl(contentPath));
|
|
26335
27645
|
const contentResource = await contentArl.resolve();
|
|
26336
27646
|
const data = contentResource.content;
|
|
@@ -26344,7 +27654,7 @@ class GitRegistry {
|
|
|
26344
27654
|
try {
|
|
26345
27655
|
await this.ensureCloned();
|
|
26346
27656
|
const resourcePath = this.buildResourcePath(locator);
|
|
26347
|
-
const manifestPath =
|
|
27657
|
+
const manifestPath = join4(resourcePath, "manifest.json");
|
|
26348
27658
|
const manifestArl = this.arp.parse(this.toArpUrl(manifestPath));
|
|
26349
27659
|
return await manifestArl.exists();
|
|
26350
27660
|
} catch {
|
|
@@ -26355,7 +27665,7 @@ class GitRegistry {
|
|
|
26355
27665
|
await this.ensureCloned();
|
|
26356
27666
|
const { query, limit, offset = 0 } = options ?? {};
|
|
26357
27667
|
const locators = [];
|
|
26358
|
-
const baseDir =
|
|
27668
|
+
const baseDir = join4(this.cacheDir, this.basePath);
|
|
26359
27669
|
try {
|
|
26360
27670
|
const baseArl = this.arp.parse(this.toArpUrl(baseDir));
|
|
26361
27671
|
const entries = await baseArl.list({ recursive: true, pattern: "*.json" });
|
|
@@ -26415,15 +27725,18 @@ class GitRegistry {
|
|
|
26415
27725
|
return null;
|
|
26416
27726
|
}
|
|
26417
27727
|
}
|
|
27728
|
+
async link(_path) {
|
|
27729
|
+
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.link()");
|
|
27730
|
+
}
|
|
27731
|
+
async add(_source) {
|
|
27732
|
+
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.add()");
|
|
27733
|
+
}
|
|
26418
27734
|
async pull(_locator, _options) {
|
|
26419
27735
|
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.pull()");
|
|
26420
27736
|
}
|
|
26421
|
-
async publish(
|
|
27737
|
+
async publish(_source, _options) {
|
|
26422
27738
|
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.publish()");
|
|
26423
27739
|
}
|
|
26424
|
-
async link(_resource) {
|
|
26425
|
-
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.link()");
|
|
26426
|
-
}
|
|
26427
27740
|
async delete(_locator) {
|
|
26428
27741
|
throw new RegistryError("GitRegistry is read-only - use LocalRegistry.delete()");
|
|
26429
27742
|
}
|
|
@@ -26437,14 +27750,17 @@ class RegistryMiddleware {
|
|
|
26437
27750
|
supportType(type) {
|
|
26438
27751
|
this.inner.supportType(type);
|
|
26439
27752
|
}
|
|
27753
|
+
link(path) {
|
|
27754
|
+
return this.inner.link(path);
|
|
27755
|
+
}
|
|
27756
|
+
add(source) {
|
|
27757
|
+
return this.inner.add(source);
|
|
27758
|
+
}
|
|
26440
27759
|
pull(locator, options) {
|
|
26441
27760
|
return this.inner.pull(locator, options);
|
|
26442
27761
|
}
|
|
26443
|
-
publish(
|
|
26444
|
-
return this.inner.publish(
|
|
26445
|
-
}
|
|
26446
|
-
link(resource) {
|
|
26447
|
-
return this.inner.link(resource);
|
|
27762
|
+
publish(source, options) {
|
|
27763
|
+
return this.inner.publish(source, options);
|
|
26448
27764
|
}
|
|
26449
27765
|
get(locator) {
|
|
26450
27766
|
return this.inner.get(locator);
|
|
@@ -26639,4 +27955,4 @@ export {
|
|
|
26639
27955
|
ARP
|
|
26640
27956
|
};
|
|
26641
27957
|
|
|
26642
|
-
//# debugId=
|
|
27958
|
+
//# debugId=8A456A3331FC3D3E64756E2164756E21
|