@clef-sh/core 0.1.16 → 0.1.17
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/compliance/generator.d.ts +19 -0
- package/dist/compliance/generator.d.ts.map +1 -0
- package/dist/compliance/run.d.ts +66 -0
- package/dist/compliance/run.d.ts.map +1 -0
- package/dist/compliance/types.d.ts +72 -0
- package/dist/compliance/types.d.ts.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +594 -237
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +533 -213
- package/dist/index.mjs.map +4 -4
- package/dist/policy/evaluator.d.ts +39 -0
- package/dist/policy/evaluator.d.ts.map +1 -0
- package/dist/policy/parser.d.ts +36 -0
- package/dist/policy/parser.d.ts.map +1 -0
- package/dist/policy/types.d.ts +70 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/sops/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -304,10 +304,10 @@ var require_lib = __commonJS({
|
|
|
304
304
|
module.exports.sync = writeFileSync6;
|
|
305
305
|
module.exports._getTmpname = getTmpname;
|
|
306
306
|
module.exports._cleanupOnExit = cleanupOnExit;
|
|
307
|
-
var
|
|
307
|
+
var fs18 = __require("fs");
|
|
308
308
|
var crypto4 = __require("node:crypto");
|
|
309
309
|
var { onExit } = require_cjs();
|
|
310
|
-
var
|
|
310
|
+
var path26 = __require("path");
|
|
311
311
|
var { promisify } = __require("util");
|
|
312
312
|
var activeFiles = {};
|
|
313
313
|
var threadId = (function getId() {
|
|
@@ -325,7 +325,7 @@ var require_lib = __commonJS({
|
|
|
325
325
|
function cleanupOnExit(tmpfile) {
|
|
326
326
|
return () => {
|
|
327
327
|
try {
|
|
328
|
-
|
|
328
|
+
fs18.unlinkSync(typeof tmpfile === "function" ? tmpfile() : tmpfile);
|
|
329
329
|
} catch {
|
|
330
330
|
}
|
|
331
331
|
};
|
|
@@ -360,13 +360,13 @@ var require_lib = __commonJS({
|
|
|
360
360
|
let fd;
|
|
361
361
|
let tmpfile;
|
|
362
362
|
const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile));
|
|
363
|
-
const absoluteName =
|
|
363
|
+
const absoluteName = path26.resolve(filename);
|
|
364
364
|
try {
|
|
365
365
|
await serializeActiveFile(absoluteName);
|
|
366
|
-
const truename = await promisify(
|
|
366
|
+
const truename = await promisify(fs18.realpath)(filename).catch(() => filename);
|
|
367
367
|
tmpfile = getTmpname(truename);
|
|
368
368
|
if (!options.mode || !options.chown) {
|
|
369
|
-
const stats = await promisify(
|
|
369
|
+
const stats = await promisify(fs18.stat)(truename).catch(() => {
|
|
370
370
|
});
|
|
371
371
|
if (stats) {
|
|
372
372
|
if (options.mode == null) {
|
|
@@ -377,45 +377,45 @@ var require_lib = __commonJS({
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
fd = await promisify(
|
|
380
|
+
fd = await promisify(fs18.open)(tmpfile, "w", options.mode);
|
|
381
381
|
if (options.tmpfileCreated) {
|
|
382
382
|
await options.tmpfileCreated(tmpfile);
|
|
383
383
|
}
|
|
384
384
|
if (ArrayBuffer.isView(data)) {
|
|
385
|
-
await promisify(
|
|
385
|
+
await promisify(fs18.write)(fd, data, 0, data.length, 0);
|
|
386
386
|
} else if (data != null) {
|
|
387
|
-
await promisify(
|
|
387
|
+
await promisify(fs18.write)(fd, String(data), 0, String(options.encoding || "utf8"));
|
|
388
388
|
}
|
|
389
389
|
if (options.fsync !== false) {
|
|
390
|
-
await promisify(
|
|
390
|
+
await promisify(fs18.fsync)(fd);
|
|
391
391
|
}
|
|
392
|
-
await promisify(
|
|
392
|
+
await promisify(fs18.close)(fd);
|
|
393
393
|
fd = null;
|
|
394
394
|
if (options.chown) {
|
|
395
|
-
await promisify(
|
|
395
|
+
await promisify(fs18.chown)(tmpfile, options.chown.uid, options.chown.gid).catch((err) => {
|
|
396
396
|
if (!isChownErrOk(err)) {
|
|
397
397
|
throw err;
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
401
|
if (options.mode) {
|
|
402
|
-
await promisify(
|
|
402
|
+
await promisify(fs18.chmod)(tmpfile, options.mode).catch((err) => {
|
|
403
403
|
if (!isChownErrOk(err)) {
|
|
404
404
|
throw err;
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
|
-
await promisify(
|
|
408
|
+
await promisify(fs18.rename)(tmpfile, truename);
|
|
409
409
|
} finally {
|
|
410
410
|
if (fd) {
|
|
411
|
-
await promisify(
|
|
411
|
+
await promisify(fs18.close)(fd).catch(
|
|
412
412
|
/* istanbul ignore next */
|
|
413
413
|
() => {
|
|
414
414
|
}
|
|
415
415
|
);
|
|
416
416
|
}
|
|
417
417
|
removeOnExitHandler();
|
|
418
|
-
await promisify(
|
|
418
|
+
await promisify(fs18.unlink)(tmpfile).catch(() => {
|
|
419
419
|
});
|
|
420
420
|
activeFiles[absoluteName].shift();
|
|
421
421
|
if (activeFiles[absoluteName].length > 0) {
|
|
@@ -448,13 +448,13 @@ var require_lib = __commonJS({
|
|
|
448
448
|
options = {};
|
|
449
449
|
}
|
|
450
450
|
try {
|
|
451
|
-
filename =
|
|
451
|
+
filename = fs18.realpathSync(filename);
|
|
452
452
|
} catch (ex) {
|
|
453
453
|
}
|
|
454
454
|
const tmpfile = getTmpname(filename);
|
|
455
455
|
if (!options.mode || !options.chown) {
|
|
456
456
|
try {
|
|
457
|
-
const stats =
|
|
457
|
+
const stats = fs18.statSync(filename);
|
|
458
458
|
options = Object.assign({}, options);
|
|
459
459
|
if (!options.mode) {
|
|
460
460
|
options.mode = stats.mode;
|
|
@@ -470,23 +470,23 @@ var require_lib = __commonJS({
|
|
|
470
470
|
const removeOnExitHandler = onExit(cleanup);
|
|
471
471
|
let threw = true;
|
|
472
472
|
try {
|
|
473
|
-
fd =
|
|
473
|
+
fd = fs18.openSync(tmpfile, "w", options.mode || 438);
|
|
474
474
|
if (options.tmpfileCreated) {
|
|
475
475
|
options.tmpfileCreated(tmpfile);
|
|
476
476
|
}
|
|
477
477
|
if (ArrayBuffer.isView(data)) {
|
|
478
|
-
|
|
478
|
+
fs18.writeSync(fd, data, 0, data.length, 0);
|
|
479
479
|
} else if (data != null) {
|
|
480
|
-
|
|
480
|
+
fs18.writeSync(fd, String(data), 0, String(options.encoding || "utf8"));
|
|
481
481
|
}
|
|
482
482
|
if (options.fsync !== false) {
|
|
483
|
-
|
|
483
|
+
fs18.fsyncSync(fd);
|
|
484
484
|
}
|
|
485
|
-
|
|
485
|
+
fs18.closeSync(fd);
|
|
486
486
|
fd = null;
|
|
487
487
|
if (options.chown) {
|
|
488
488
|
try {
|
|
489
|
-
|
|
489
|
+
fs18.chownSync(tmpfile, options.chown.uid, options.chown.gid);
|
|
490
490
|
} catch (err) {
|
|
491
491
|
if (!isChownErrOk(err)) {
|
|
492
492
|
throw err;
|
|
@@ -495,19 +495,19 @@ var require_lib = __commonJS({
|
|
|
495
495
|
}
|
|
496
496
|
if (options.mode) {
|
|
497
497
|
try {
|
|
498
|
-
|
|
498
|
+
fs18.chmodSync(tmpfile, options.mode);
|
|
499
499
|
} catch (err) {
|
|
500
500
|
if (!isChownErrOk(err)) {
|
|
501
501
|
throw err;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
|
|
505
|
+
fs18.renameSync(tmpfile, filename);
|
|
506
506
|
threw = false;
|
|
507
507
|
} finally {
|
|
508
508
|
if (fd) {
|
|
509
509
|
try {
|
|
510
|
-
|
|
510
|
+
fs18.closeSync(fd);
|
|
511
511
|
} catch (ex) {
|
|
512
512
|
}
|
|
513
513
|
}
|
|
@@ -546,54 +546,54 @@ var require_polyfills = __commonJS({
|
|
|
546
546
|
}
|
|
547
547
|
var chdir;
|
|
548
548
|
module.exports = patch;
|
|
549
|
-
function patch(
|
|
549
|
+
function patch(fs18) {
|
|
550
550
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
551
|
-
patchLchmod(
|
|
552
|
-
}
|
|
553
|
-
if (!
|
|
554
|
-
patchLutimes(
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
if (
|
|
575
|
-
|
|
551
|
+
patchLchmod(fs18);
|
|
552
|
+
}
|
|
553
|
+
if (!fs18.lutimes) {
|
|
554
|
+
patchLutimes(fs18);
|
|
555
|
+
}
|
|
556
|
+
fs18.chown = chownFix(fs18.chown);
|
|
557
|
+
fs18.fchown = chownFix(fs18.fchown);
|
|
558
|
+
fs18.lchown = chownFix(fs18.lchown);
|
|
559
|
+
fs18.chmod = chmodFix(fs18.chmod);
|
|
560
|
+
fs18.fchmod = chmodFix(fs18.fchmod);
|
|
561
|
+
fs18.lchmod = chmodFix(fs18.lchmod);
|
|
562
|
+
fs18.chownSync = chownFixSync(fs18.chownSync);
|
|
563
|
+
fs18.fchownSync = chownFixSync(fs18.fchownSync);
|
|
564
|
+
fs18.lchownSync = chownFixSync(fs18.lchownSync);
|
|
565
|
+
fs18.chmodSync = chmodFixSync(fs18.chmodSync);
|
|
566
|
+
fs18.fchmodSync = chmodFixSync(fs18.fchmodSync);
|
|
567
|
+
fs18.lchmodSync = chmodFixSync(fs18.lchmodSync);
|
|
568
|
+
fs18.stat = statFix(fs18.stat);
|
|
569
|
+
fs18.fstat = statFix(fs18.fstat);
|
|
570
|
+
fs18.lstat = statFix(fs18.lstat);
|
|
571
|
+
fs18.statSync = statFixSync(fs18.statSync);
|
|
572
|
+
fs18.fstatSync = statFixSync(fs18.fstatSync);
|
|
573
|
+
fs18.lstatSync = statFixSync(fs18.lstatSync);
|
|
574
|
+
if (fs18.chmod && !fs18.lchmod) {
|
|
575
|
+
fs18.lchmod = function(path26, mode, cb) {
|
|
576
576
|
if (cb) process.nextTick(cb);
|
|
577
577
|
};
|
|
578
|
-
|
|
578
|
+
fs18.lchmodSync = function() {
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
-
if (
|
|
582
|
-
|
|
581
|
+
if (fs18.chown && !fs18.lchown) {
|
|
582
|
+
fs18.lchown = function(path26, uid, gid, cb) {
|
|
583
583
|
if (cb) process.nextTick(cb);
|
|
584
584
|
};
|
|
585
|
-
|
|
585
|
+
fs18.lchownSync = function() {
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
588
|
if (platform === "win32") {
|
|
589
|
-
|
|
589
|
+
fs18.rename = typeof fs18.rename !== "function" ? fs18.rename : (function(fs$rename) {
|
|
590
590
|
function rename(from, to, cb) {
|
|
591
591
|
var start = Date.now();
|
|
592
592
|
var backoff = 0;
|
|
593
593
|
fs$rename(from, to, function CB(er) {
|
|
594
594
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
595
595
|
setTimeout(function() {
|
|
596
|
-
|
|
596
|
+
fs18.stat(to, function(stater, st) {
|
|
597
597
|
if (stater && stater.code === "ENOENT")
|
|
598
598
|
fs$rename(from, to, CB);
|
|
599
599
|
else
|
|
@@ -609,9 +609,9 @@ var require_polyfills = __commonJS({
|
|
|
609
609
|
}
|
|
610
610
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
611
611
|
return rename;
|
|
612
|
-
})(
|
|
612
|
+
})(fs18.rename);
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
fs18.read = typeof fs18.read !== "function" ? fs18.read : (function(fs$read) {
|
|
615
615
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
616
616
|
var callback;
|
|
617
617
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -619,22 +619,22 @@ var require_polyfills = __commonJS({
|
|
|
619
619
|
callback = function(er, _, __) {
|
|
620
620
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
621
621
|
eagCounter++;
|
|
622
|
-
return fs$read.call(
|
|
622
|
+
return fs$read.call(fs18, fd, buffer, offset, length, position, callback);
|
|
623
623
|
}
|
|
624
624
|
callback_.apply(this, arguments);
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
|
-
return fs$read.call(
|
|
627
|
+
return fs$read.call(fs18, fd, buffer, offset, length, position, callback);
|
|
628
628
|
}
|
|
629
629
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
630
630
|
return read;
|
|
631
|
-
})(
|
|
632
|
-
|
|
631
|
+
})(fs18.read);
|
|
632
|
+
fs18.readSync = typeof fs18.readSync !== "function" ? fs18.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
633
633
|
return function(fd, buffer, offset, length, position) {
|
|
634
634
|
var eagCounter = 0;
|
|
635
635
|
while (true) {
|
|
636
636
|
try {
|
|
637
|
-
return fs$readSync.call(
|
|
637
|
+
return fs$readSync.call(fs18, fd, buffer, offset, length, position);
|
|
638
638
|
} catch (er) {
|
|
639
639
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
640
640
|
eagCounter++;
|
|
@@ -644,11 +644,11 @@ var require_polyfills = __commonJS({
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
|
-
})(
|
|
648
|
-
function patchLchmod(
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
647
|
+
})(fs18.readSync);
|
|
648
|
+
function patchLchmod(fs19) {
|
|
649
|
+
fs19.lchmod = function(path26, mode, callback) {
|
|
650
|
+
fs19.open(
|
|
651
|
+
path26,
|
|
652
652
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
653
653
|
mode,
|
|
654
654
|
function(err, fd) {
|
|
@@ -656,80 +656,80 @@ var require_polyfills = __commonJS({
|
|
|
656
656
|
if (callback) callback(err);
|
|
657
657
|
return;
|
|
658
658
|
}
|
|
659
|
-
|
|
660
|
-
|
|
659
|
+
fs19.fchmod(fd, mode, function(err2) {
|
|
660
|
+
fs19.close(fd, function(err22) {
|
|
661
661
|
if (callback) callback(err2 || err22);
|
|
662
662
|
});
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
666
|
};
|
|
667
|
-
|
|
668
|
-
var fd =
|
|
667
|
+
fs19.lchmodSync = function(path26, mode) {
|
|
668
|
+
var fd = fs19.openSync(path26, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
669
669
|
var threw = true;
|
|
670
670
|
var ret;
|
|
671
671
|
try {
|
|
672
|
-
ret =
|
|
672
|
+
ret = fs19.fchmodSync(fd, mode);
|
|
673
673
|
threw = false;
|
|
674
674
|
} finally {
|
|
675
675
|
if (threw) {
|
|
676
676
|
try {
|
|
677
|
-
|
|
677
|
+
fs19.closeSync(fd);
|
|
678
678
|
} catch (er) {
|
|
679
679
|
}
|
|
680
680
|
} else {
|
|
681
|
-
|
|
681
|
+
fs19.closeSync(fd);
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
return ret;
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
|
-
function patchLutimes(
|
|
688
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
689
|
-
|
|
690
|
-
|
|
687
|
+
function patchLutimes(fs19) {
|
|
688
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs19.futimes) {
|
|
689
|
+
fs19.lutimes = function(path26, at, mt, cb) {
|
|
690
|
+
fs19.open(path26, constants.O_SYMLINK, function(er, fd) {
|
|
691
691
|
if (er) {
|
|
692
692
|
if (cb) cb(er);
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
|
-
|
|
696
|
-
|
|
695
|
+
fs19.futimes(fd, at, mt, function(er2) {
|
|
696
|
+
fs19.close(fd, function(er22) {
|
|
697
697
|
if (cb) cb(er2 || er22);
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
});
|
|
701
701
|
};
|
|
702
|
-
|
|
703
|
-
var fd =
|
|
702
|
+
fs19.lutimesSync = function(path26, at, mt) {
|
|
703
|
+
var fd = fs19.openSync(path26, constants.O_SYMLINK);
|
|
704
704
|
var ret;
|
|
705
705
|
var threw = true;
|
|
706
706
|
try {
|
|
707
|
-
ret =
|
|
707
|
+
ret = fs19.futimesSync(fd, at, mt);
|
|
708
708
|
threw = false;
|
|
709
709
|
} finally {
|
|
710
710
|
if (threw) {
|
|
711
711
|
try {
|
|
712
|
-
|
|
712
|
+
fs19.closeSync(fd);
|
|
713
713
|
} catch (er) {
|
|
714
714
|
}
|
|
715
715
|
} else {
|
|
716
|
-
|
|
716
|
+
fs19.closeSync(fd);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
return ret;
|
|
720
720
|
};
|
|
721
|
-
} else if (
|
|
722
|
-
|
|
721
|
+
} else if (fs19.futimes) {
|
|
722
|
+
fs19.lutimes = function(_a, _b, _c, cb) {
|
|
723
723
|
if (cb) process.nextTick(cb);
|
|
724
724
|
};
|
|
725
|
-
|
|
725
|
+
fs19.lutimesSync = function() {
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
function chmodFix(orig) {
|
|
730
730
|
if (!orig) return orig;
|
|
731
731
|
return function(target, mode, cb) {
|
|
732
|
-
return orig.call(
|
|
732
|
+
return orig.call(fs18, target, mode, function(er) {
|
|
733
733
|
if (chownErOk(er)) er = null;
|
|
734
734
|
if (cb) cb.apply(this, arguments);
|
|
735
735
|
});
|
|
@@ -739,7 +739,7 @@ var require_polyfills = __commonJS({
|
|
|
739
739
|
if (!orig) return orig;
|
|
740
740
|
return function(target, mode) {
|
|
741
741
|
try {
|
|
742
|
-
return orig.call(
|
|
742
|
+
return orig.call(fs18, target, mode);
|
|
743
743
|
} catch (er) {
|
|
744
744
|
if (!chownErOk(er)) throw er;
|
|
745
745
|
}
|
|
@@ -748,7 +748,7 @@ var require_polyfills = __commonJS({
|
|
|
748
748
|
function chownFix(orig) {
|
|
749
749
|
if (!orig) return orig;
|
|
750
750
|
return function(target, uid, gid, cb) {
|
|
751
|
-
return orig.call(
|
|
751
|
+
return orig.call(fs18, target, uid, gid, function(er) {
|
|
752
752
|
if (chownErOk(er)) er = null;
|
|
753
753
|
if (cb) cb.apply(this, arguments);
|
|
754
754
|
});
|
|
@@ -758,7 +758,7 @@ var require_polyfills = __commonJS({
|
|
|
758
758
|
if (!orig) return orig;
|
|
759
759
|
return function(target, uid, gid) {
|
|
760
760
|
try {
|
|
761
|
-
return orig.call(
|
|
761
|
+
return orig.call(fs18, target, uid, gid);
|
|
762
762
|
} catch (er) {
|
|
763
763
|
if (!chownErOk(er)) throw er;
|
|
764
764
|
}
|
|
@@ -778,13 +778,13 @@ var require_polyfills = __commonJS({
|
|
|
778
778
|
}
|
|
779
779
|
if (cb) cb.apply(this, arguments);
|
|
780
780
|
}
|
|
781
|
-
return options ? orig.call(
|
|
781
|
+
return options ? orig.call(fs18, target, options, callback) : orig.call(fs18, target, callback);
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
function statFixSync(orig) {
|
|
785
785
|
if (!orig) return orig;
|
|
786
786
|
return function(target, options) {
|
|
787
|
-
var stats = options ? orig.call(
|
|
787
|
+
var stats = options ? orig.call(fs18, target, options) : orig.call(fs18, target);
|
|
788
788
|
if (stats) {
|
|
789
789
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
790
790
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -813,16 +813,16 @@ var require_legacy_streams = __commonJS({
|
|
|
813
813
|
"../../node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
814
814
|
var Stream = __require("stream").Stream;
|
|
815
815
|
module.exports = legacy;
|
|
816
|
-
function legacy(
|
|
816
|
+
function legacy(fs18) {
|
|
817
817
|
return {
|
|
818
818
|
ReadStream,
|
|
819
819
|
WriteStream
|
|
820
820
|
};
|
|
821
|
-
function ReadStream(
|
|
822
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
821
|
+
function ReadStream(path26, options) {
|
|
822
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path26, options);
|
|
823
823
|
Stream.call(this);
|
|
824
824
|
var self = this;
|
|
825
|
-
this.path =
|
|
825
|
+
this.path = path26;
|
|
826
826
|
this.fd = null;
|
|
827
827
|
this.readable = true;
|
|
828
828
|
this.paused = false;
|
|
@@ -856,7 +856,7 @@ var require_legacy_streams = __commonJS({
|
|
|
856
856
|
});
|
|
857
857
|
return;
|
|
858
858
|
}
|
|
859
|
-
|
|
859
|
+
fs18.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
860
860
|
if (err) {
|
|
861
861
|
self.emit("error", err);
|
|
862
862
|
self.readable = false;
|
|
@@ -867,10 +867,10 @@ var require_legacy_streams = __commonJS({
|
|
|
867
867
|
self._read();
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
|
-
function WriteStream(
|
|
871
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
870
|
+
function WriteStream(path26, options) {
|
|
871
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path26, options);
|
|
872
872
|
Stream.call(this);
|
|
873
|
-
this.path =
|
|
873
|
+
this.path = path26;
|
|
874
874
|
this.fd = null;
|
|
875
875
|
this.writable = true;
|
|
876
876
|
this.flags = "w";
|
|
@@ -895,7 +895,7 @@ var require_legacy_streams = __commonJS({
|
|
|
895
895
|
this.busy = false;
|
|
896
896
|
this._queue = [];
|
|
897
897
|
if (this.fd === null) {
|
|
898
|
-
this._open =
|
|
898
|
+
this._open = fs18.open;
|
|
899
899
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
900
900
|
this.flush();
|
|
901
901
|
}
|
|
@@ -930,7 +930,7 @@ var require_clone = __commonJS({
|
|
|
930
930
|
// ../../node_modules/graceful-fs/graceful-fs.js
|
|
931
931
|
var require_graceful_fs = __commonJS({
|
|
932
932
|
"../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
933
|
-
var
|
|
933
|
+
var fs18 = __require("fs");
|
|
934
934
|
var polyfills = require_polyfills();
|
|
935
935
|
var legacy = require_legacy_streams();
|
|
936
936
|
var clone = require_clone();
|
|
@@ -962,12 +962,12 @@ var require_graceful_fs = __commonJS({
|
|
|
962
962
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
963
963
|
console.error(m);
|
|
964
964
|
};
|
|
965
|
-
if (!
|
|
965
|
+
if (!fs18[gracefulQueue]) {
|
|
966
966
|
queue = global[gracefulQueue] || [];
|
|
967
|
-
publishQueue(
|
|
968
|
-
|
|
967
|
+
publishQueue(fs18, queue);
|
|
968
|
+
fs18.close = (function(fs$close) {
|
|
969
969
|
function close(fd, cb) {
|
|
970
|
-
return fs$close.call(
|
|
970
|
+
return fs$close.call(fs18, fd, function(err) {
|
|
971
971
|
if (!err) {
|
|
972
972
|
resetQueue();
|
|
973
973
|
}
|
|
@@ -979,48 +979,48 @@ var require_graceful_fs = __commonJS({
|
|
|
979
979
|
value: fs$close
|
|
980
980
|
});
|
|
981
981
|
return close;
|
|
982
|
-
})(
|
|
983
|
-
|
|
982
|
+
})(fs18.close);
|
|
983
|
+
fs18.closeSync = (function(fs$closeSync) {
|
|
984
984
|
function closeSync2(fd) {
|
|
985
|
-
fs$closeSync.apply(
|
|
985
|
+
fs$closeSync.apply(fs18, arguments);
|
|
986
986
|
resetQueue();
|
|
987
987
|
}
|
|
988
988
|
Object.defineProperty(closeSync2, previousSymbol, {
|
|
989
989
|
value: fs$closeSync
|
|
990
990
|
});
|
|
991
991
|
return closeSync2;
|
|
992
|
-
})(
|
|
992
|
+
})(fs18.closeSync);
|
|
993
993
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
994
994
|
process.on("exit", function() {
|
|
995
|
-
debug(
|
|
996
|
-
__require("assert").equal(
|
|
995
|
+
debug(fs18[gracefulQueue]);
|
|
996
|
+
__require("assert").equal(fs18[gracefulQueue].length, 0);
|
|
997
997
|
});
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
var queue;
|
|
1001
1001
|
if (!global[gracefulQueue]) {
|
|
1002
|
-
publishQueue(global,
|
|
1003
|
-
}
|
|
1004
|
-
module.exports = patch(clone(
|
|
1005
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
1006
|
-
module.exports = patch(
|
|
1007
|
-
|
|
1008
|
-
}
|
|
1009
|
-
function patch(
|
|
1010
|
-
polyfills(
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
var fs$readFile =
|
|
1015
|
-
|
|
1016
|
-
function readFile(
|
|
1002
|
+
publishQueue(global, fs18[gracefulQueue]);
|
|
1003
|
+
}
|
|
1004
|
+
module.exports = patch(clone(fs18));
|
|
1005
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs18.__patched) {
|
|
1006
|
+
module.exports = patch(fs18);
|
|
1007
|
+
fs18.__patched = true;
|
|
1008
|
+
}
|
|
1009
|
+
function patch(fs19) {
|
|
1010
|
+
polyfills(fs19);
|
|
1011
|
+
fs19.gracefulify = patch;
|
|
1012
|
+
fs19.createReadStream = createReadStream;
|
|
1013
|
+
fs19.createWriteStream = createWriteStream;
|
|
1014
|
+
var fs$readFile = fs19.readFile;
|
|
1015
|
+
fs19.readFile = readFile;
|
|
1016
|
+
function readFile(path26, options, cb) {
|
|
1017
1017
|
if (typeof options === "function")
|
|
1018
1018
|
cb = options, options = null;
|
|
1019
|
-
return go$readFile(
|
|
1020
|
-
function go$readFile(
|
|
1021
|
-
return fs$readFile(
|
|
1019
|
+
return go$readFile(path26, options, cb);
|
|
1020
|
+
function go$readFile(path27, options2, cb2, startTime) {
|
|
1021
|
+
return fs$readFile(path27, options2, function(err) {
|
|
1022
1022
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1023
|
-
enqueue([go$readFile, [
|
|
1023
|
+
enqueue([go$readFile, [path27, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1024
1024
|
else {
|
|
1025
1025
|
if (typeof cb2 === "function")
|
|
1026
1026
|
cb2.apply(this, arguments);
|
|
@@ -1028,16 +1028,16 @@ var require_graceful_fs = __commonJS({
|
|
|
1028
1028
|
});
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
|
-
var fs$writeFile =
|
|
1032
|
-
|
|
1033
|
-
function writeFile(
|
|
1031
|
+
var fs$writeFile = fs19.writeFile;
|
|
1032
|
+
fs19.writeFile = writeFile;
|
|
1033
|
+
function writeFile(path26, data, options, cb) {
|
|
1034
1034
|
if (typeof options === "function")
|
|
1035
1035
|
cb = options, options = null;
|
|
1036
|
-
return go$writeFile(
|
|
1037
|
-
function go$writeFile(
|
|
1038
|
-
return fs$writeFile(
|
|
1036
|
+
return go$writeFile(path26, data, options, cb);
|
|
1037
|
+
function go$writeFile(path27, data2, options2, cb2, startTime) {
|
|
1038
|
+
return fs$writeFile(path27, data2, options2, function(err) {
|
|
1039
1039
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1040
|
-
enqueue([go$writeFile, [
|
|
1040
|
+
enqueue([go$writeFile, [path27, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1041
1041
|
else {
|
|
1042
1042
|
if (typeof cb2 === "function")
|
|
1043
1043
|
cb2.apply(this, arguments);
|
|
@@ -1045,17 +1045,17 @@ var require_graceful_fs = __commonJS({
|
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
var fs$appendFile =
|
|
1048
|
+
var fs$appendFile = fs19.appendFile;
|
|
1049
1049
|
if (fs$appendFile)
|
|
1050
|
-
|
|
1051
|
-
function appendFile(
|
|
1050
|
+
fs19.appendFile = appendFile;
|
|
1051
|
+
function appendFile(path26, data, options, cb) {
|
|
1052
1052
|
if (typeof options === "function")
|
|
1053
1053
|
cb = options, options = null;
|
|
1054
|
-
return go$appendFile(
|
|
1055
|
-
function go$appendFile(
|
|
1056
|
-
return fs$appendFile(
|
|
1054
|
+
return go$appendFile(path26, data, options, cb);
|
|
1055
|
+
function go$appendFile(path27, data2, options2, cb2, startTime) {
|
|
1056
|
+
return fs$appendFile(path27, data2, options2, function(err) {
|
|
1057
1057
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1058
|
-
enqueue([go$appendFile, [
|
|
1058
|
+
enqueue([go$appendFile, [path27, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1059
1059
|
else {
|
|
1060
1060
|
if (typeof cb2 === "function")
|
|
1061
1061
|
cb2.apply(this, arguments);
|
|
@@ -1063,9 +1063,9 @@ var require_graceful_fs = __commonJS({
|
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
var fs$copyFile =
|
|
1066
|
+
var fs$copyFile = fs19.copyFile;
|
|
1067
1067
|
if (fs$copyFile)
|
|
1068
|
-
|
|
1068
|
+
fs19.copyFile = copyFile;
|
|
1069
1069
|
function copyFile(src, dest, flags, cb) {
|
|
1070
1070
|
if (typeof flags === "function") {
|
|
1071
1071
|
cb = flags;
|
|
@@ -1083,34 +1083,34 @@ var require_graceful_fs = __commonJS({
|
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
-
var fs$readdir =
|
|
1087
|
-
|
|
1086
|
+
var fs$readdir = fs19.readdir;
|
|
1087
|
+
fs19.readdir = readdir;
|
|
1088
1088
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1089
|
-
function readdir(
|
|
1089
|
+
function readdir(path26, options, cb) {
|
|
1090
1090
|
if (typeof options === "function")
|
|
1091
1091
|
cb = options, options = null;
|
|
1092
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
1093
|
-
return fs$readdir(
|
|
1094
|
-
|
|
1092
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path27, options2, cb2, startTime) {
|
|
1093
|
+
return fs$readdir(path27, fs$readdirCallback(
|
|
1094
|
+
path27,
|
|
1095
1095
|
options2,
|
|
1096
1096
|
cb2,
|
|
1097
1097
|
startTime
|
|
1098
1098
|
));
|
|
1099
|
-
} : function go$readdir2(
|
|
1100
|
-
return fs$readdir(
|
|
1101
|
-
|
|
1099
|
+
} : function go$readdir2(path27, options2, cb2, startTime) {
|
|
1100
|
+
return fs$readdir(path27, options2, fs$readdirCallback(
|
|
1101
|
+
path27,
|
|
1102
1102
|
options2,
|
|
1103
1103
|
cb2,
|
|
1104
1104
|
startTime
|
|
1105
1105
|
));
|
|
1106
1106
|
};
|
|
1107
|
-
return go$readdir(
|
|
1108
|
-
function fs$readdirCallback(
|
|
1107
|
+
return go$readdir(path26, options, cb);
|
|
1108
|
+
function fs$readdirCallback(path27, options2, cb2, startTime) {
|
|
1109
1109
|
return function(err, files) {
|
|
1110
1110
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1111
1111
|
enqueue([
|
|
1112
1112
|
go$readdir,
|
|
1113
|
-
[
|
|
1113
|
+
[path27, options2, cb2],
|
|
1114
1114
|
err,
|
|
1115
1115
|
startTime || Date.now(),
|
|
1116
1116
|
Date.now()
|
|
@@ -1125,21 +1125,21 @@ var require_graceful_fs = __commonJS({
|
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
1127
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
1128
|
-
var legStreams = legacy(
|
|
1128
|
+
var legStreams = legacy(fs19);
|
|
1129
1129
|
ReadStream = legStreams.ReadStream;
|
|
1130
1130
|
WriteStream = legStreams.WriteStream;
|
|
1131
1131
|
}
|
|
1132
|
-
var fs$ReadStream =
|
|
1132
|
+
var fs$ReadStream = fs19.ReadStream;
|
|
1133
1133
|
if (fs$ReadStream) {
|
|
1134
1134
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1135
1135
|
ReadStream.prototype.open = ReadStream$open;
|
|
1136
1136
|
}
|
|
1137
|
-
var fs$WriteStream =
|
|
1137
|
+
var fs$WriteStream = fs19.WriteStream;
|
|
1138
1138
|
if (fs$WriteStream) {
|
|
1139
1139
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1140
1140
|
WriteStream.prototype.open = WriteStream$open;
|
|
1141
1141
|
}
|
|
1142
|
-
Object.defineProperty(
|
|
1142
|
+
Object.defineProperty(fs19, "ReadStream", {
|
|
1143
1143
|
get: function() {
|
|
1144
1144
|
return ReadStream;
|
|
1145
1145
|
},
|
|
@@ -1149,7 +1149,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1149
1149
|
enumerable: true,
|
|
1150
1150
|
configurable: true
|
|
1151
1151
|
});
|
|
1152
|
-
Object.defineProperty(
|
|
1152
|
+
Object.defineProperty(fs19, "WriteStream", {
|
|
1153
1153
|
get: function() {
|
|
1154
1154
|
return WriteStream;
|
|
1155
1155
|
},
|
|
@@ -1160,7 +1160,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1160
1160
|
configurable: true
|
|
1161
1161
|
});
|
|
1162
1162
|
var FileReadStream = ReadStream;
|
|
1163
|
-
Object.defineProperty(
|
|
1163
|
+
Object.defineProperty(fs19, "FileReadStream", {
|
|
1164
1164
|
get: function() {
|
|
1165
1165
|
return FileReadStream;
|
|
1166
1166
|
},
|
|
@@ -1171,7 +1171,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1171
1171
|
configurable: true
|
|
1172
1172
|
});
|
|
1173
1173
|
var FileWriteStream = WriteStream;
|
|
1174
|
-
Object.defineProperty(
|
|
1174
|
+
Object.defineProperty(fs19, "FileWriteStream", {
|
|
1175
1175
|
get: function() {
|
|
1176
1176
|
return FileWriteStream;
|
|
1177
1177
|
},
|
|
@@ -1181,7 +1181,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1181
1181
|
enumerable: true,
|
|
1182
1182
|
configurable: true
|
|
1183
1183
|
});
|
|
1184
|
-
function ReadStream(
|
|
1184
|
+
function ReadStream(path26, options) {
|
|
1185
1185
|
if (this instanceof ReadStream)
|
|
1186
1186
|
return fs$ReadStream.apply(this, arguments), this;
|
|
1187
1187
|
else
|
|
@@ -1201,7 +1201,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
|
-
function WriteStream(
|
|
1204
|
+
function WriteStream(path26, options) {
|
|
1205
1205
|
if (this instanceof WriteStream)
|
|
1206
1206
|
return fs$WriteStream.apply(this, arguments), this;
|
|
1207
1207
|
else
|
|
@@ -1219,22 +1219,22 @@ var require_graceful_fs = __commonJS({
|
|
|
1219
1219
|
}
|
|
1220
1220
|
});
|
|
1221
1221
|
}
|
|
1222
|
-
function createReadStream(
|
|
1223
|
-
return new
|
|
1222
|
+
function createReadStream(path26, options) {
|
|
1223
|
+
return new fs19.ReadStream(path26, options);
|
|
1224
1224
|
}
|
|
1225
|
-
function createWriteStream(
|
|
1226
|
-
return new
|
|
1225
|
+
function createWriteStream(path26, options) {
|
|
1226
|
+
return new fs19.WriteStream(path26, options);
|
|
1227
1227
|
}
|
|
1228
|
-
var fs$open =
|
|
1229
|
-
|
|
1230
|
-
function open(
|
|
1228
|
+
var fs$open = fs19.open;
|
|
1229
|
+
fs19.open = open;
|
|
1230
|
+
function open(path26, flags, mode, cb) {
|
|
1231
1231
|
if (typeof mode === "function")
|
|
1232
1232
|
cb = mode, mode = null;
|
|
1233
|
-
return go$open(
|
|
1234
|
-
function go$open(
|
|
1235
|
-
return fs$open(
|
|
1233
|
+
return go$open(path26, flags, mode, cb);
|
|
1234
|
+
function go$open(path27, flags2, mode2, cb2, startTime) {
|
|
1235
|
+
return fs$open(path27, flags2, mode2, function(err, fd) {
|
|
1236
1236
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1237
|
-
enqueue([go$open, [
|
|
1237
|
+
enqueue([go$open, [path27, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1238
1238
|
else {
|
|
1239
1239
|
if (typeof cb2 === "function")
|
|
1240
1240
|
cb2.apply(this, arguments);
|
|
@@ -1242,20 +1242,20 @@ var require_graceful_fs = __commonJS({
|
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
|
-
return
|
|
1245
|
+
return fs19;
|
|
1246
1246
|
}
|
|
1247
1247
|
function enqueue(elem) {
|
|
1248
1248
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
1249
|
-
|
|
1249
|
+
fs18[gracefulQueue].push(elem);
|
|
1250
1250
|
retry();
|
|
1251
1251
|
}
|
|
1252
1252
|
var retryTimer;
|
|
1253
1253
|
function resetQueue() {
|
|
1254
1254
|
var now = Date.now();
|
|
1255
|
-
for (var i = 0; i <
|
|
1256
|
-
if (
|
|
1257
|
-
|
|
1258
|
-
|
|
1255
|
+
for (var i = 0; i < fs18[gracefulQueue].length; ++i) {
|
|
1256
|
+
if (fs18[gracefulQueue][i].length > 2) {
|
|
1257
|
+
fs18[gracefulQueue][i][3] = now;
|
|
1258
|
+
fs18[gracefulQueue][i][4] = now;
|
|
1259
1259
|
}
|
|
1260
1260
|
}
|
|
1261
1261
|
retry();
|
|
@@ -1263,9 +1263,9 @@ var require_graceful_fs = __commonJS({
|
|
|
1263
1263
|
function retry() {
|
|
1264
1264
|
clearTimeout(retryTimer);
|
|
1265
1265
|
retryTimer = void 0;
|
|
1266
|
-
if (
|
|
1266
|
+
if (fs18[gracefulQueue].length === 0)
|
|
1267
1267
|
return;
|
|
1268
|
-
var elem =
|
|
1268
|
+
var elem = fs18[gracefulQueue].shift();
|
|
1269
1269
|
var fn = elem[0];
|
|
1270
1270
|
var args = elem[1];
|
|
1271
1271
|
var err = elem[2];
|
|
@@ -1287,7 +1287,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1287
1287
|
debug("RETRY", fn.name, args);
|
|
1288
1288
|
fn.apply(null, args.concat([startTime]));
|
|
1289
1289
|
} else {
|
|
1290
|
-
|
|
1290
|
+
fs18[gracefulQueue].push(elem);
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
1293
|
if (retryTimer === void 0) {
|
|
@@ -1722,10 +1722,10 @@ var require_mtime_precision = __commonJS({
|
|
|
1722
1722
|
"../../node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
1723
1723
|
"use strict";
|
|
1724
1724
|
var cacheSymbol = /* @__PURE__ */ Symbol();
|
|
1725
|
-
function probe(file,
|
|
1726
|
-
const cachedPrecision =
|
|
1725
|
+
function probe(file, fs18, callback) {
|
|
1726
|
+
const cachedPrecision = fs18[cacheSymbol];
|
|
1727
1727
|
if (cachedPrecision) {
|
|
1728
|
-
return
|
|
1728
|
+
return fs18.stat(file, (err, stat) => {
|
|
1729
1729
|
if (err) {
|
|
1730
1730
|
return callback(err);
|
|
1731
1731
|
}
|
|
@@ -1733,16 +1733,16 @@ var require_mtime_precision = __commonJS({
|
|
|
1733
1733
|
});
|
|
1734
1734
|
}
|
|
1735
1735
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
1736
|
-
|
|
1736
|
+
fs18.utimes(file, mtime, mtime, (err) => {
|
|
1737
1737
|
if (err) {
|
|
1738
1738
|
return callback(err);
|
|
1739
1739
|
}
|
|
1740
|
-
|
|
1740
|
+
fs18.stat(file, (err2, stat) => {
|
|
1741
1741
|
if (err2) {
|
|
1742
1742
|
return callback(err2);
|
|
1743
1743
|
}
|
|
1744
1744
|
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1745
|
-
Object.defineProperty(
|
|
1745
|
+
Object.defineProperty(fs18, cacheSymbol, { value: precision });
|
|
1746
1746
|
callback(null, stat.mtime, precision);
|
|
1747
1747
|
});
|
|
1748
1748
|
});
|
|
@@ -1763,8 +1763,8 @@ var require_mtime_precision = __commonJS({
|
|
|
1763
1763
|
var require_lockfile = __commonJS({
|
|
1764
1764
|
"../../node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1765
1765
|
"use strict";
|
|
1766
|
-
var
|
|
1767
|
-
var
|
|
1766
|
+
var path26 = __require("path");
|
|
1767
|
+
var fs18 = require_graceful_fs();
|
|
1768
1768
|
var retry = require_retry2();
|
|
1769
1769
|
var onExit = require_signal_exit();
|
|
1770
1770
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -1774,7 +1774,7 @@ var require_lockfile = __commonJS({
|
|
|
1774
1774
|
}
|
|
1775
1775
|
function resolveCanonicalPath(file, options, callback) {
|
|
1776
1776
|
if (!options.realpath) {
|
|
1777
|
-
return callback(null,
|
|
1777
|
+
return callback(null, path26.resolve(file));
|
|
1778
1778
|
}
|
|
1779
1779
|
options.fs.realpath(file, callback);
|
|
1780
1780
|
}
|
|
@@ -1895,7 +1895,7 @@ var require_lockfile = __commonJS({
|
|
|
1895
1895
|
update: null,
|
|
1896
1896
|
realpath: true,
|
|
1897
1897
|
retries: 0,
|
|
1898
|
-
fs:
|
|
1898
|
+
fs: fs18,
|
|
1899
1899
|
onCompromised: (err) => {
|
|
1900
1900
|
throw err;
|
|
1901
1901
|
},
|
|
@@ -1939,7 +1939,7 @@ var require_lockfile = __commonJS({
|
|
|
1939
1939
|
}
|
|
1940
1940
|
function unlock(file, options, callback) {
|
|
1941
1941
|
options = {
|
|
1942
|
-
fs:
|
|
1942
|
+
fs: fs18,
|
|
1943
1943
|
realpath: true,
|
|
1944
1944
|
...options
|
|
1945
1945
|
};
|
|
@@ -1961,7 +1961,7 @@ var require_lockfile = __commonJS({
|
|
|
1961
1961
|
options = {
|
|
1962
1962
|
stale: 1e4,
|
|
1963
1963
|
realpath: true,
|
|
1964
|
-
fs:
|
|
1964
|
+
fs: fs18,
|
|
1965
1965
|
...options
|
|
1966
1966
|
};
|
|
1967
1967
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -2000,16 +2000,16 @@ var require_lockfile = __commonJS({
|
|
|
2000
2000
|
var require_adapter = __commonJS({
|
|
2001
2001
|
"../../node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
2002
2002
|
"use strict";
|
|
2003
|
-
var
|
|
2004
|
-
function createSyncFs(
|
|
2003
|
+
var fs18 = require_graceful_fs();
|
|
2004
|
+
function createSyncFs(fs19) {
|
|
2005
2005
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
2006
|
-
const newFs = { ...
|
|
2006
|
+
const newFs = { ...fs19 };
|
|
2007
2007
|
methods.forEach((method) => {
|
|
2008
2008
|
newFs[method] = (...args) => {
|
|
2009
2009
|
const callback = args.pop();
|
|
2010
2010
|
let ret;
|
|
2011
2011
|
try {
|
|
2012
|
-
ret =
|
|
2012
|
+
ret = fs19[`${method}Sync`](...args);
|
|
2013
2013
|
} catch (err) {
|
|
2014
2014
|
return callback(err);
|
|
2015
2015
|
}
|
|
@@ -2047,7 +2047,7 @@ var require_adapter = __commonJS({
|
|
|
2047
2047
|
}
|
|
2048
2048
|
function toSyncOptions(options) {
|
|
2049
2049
|
options = { ...options };
|
|
2050
|
-
options.fs = createSyncFs(options.fs ||
|
|
2050
|
+
options.fs = createSyncFs(options.fs || fs18);
|
|
2051
2051
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
2052
2052
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
2053
2053
|
}
|
|
@@ -2161,6 +2161,13 @@ var GitOperationError = class extends ClefError {
|
|
|
2161
2161
|
this.name = "GitOperationError";
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
|
+
var PolicyValidationError = class extends ClefError {
|
|
2165
|
+
constructor(message, field) {
|
|
2166
|
+
super(message, field ? `Check the '${field}' field in .clef/policy.yaml` : void 0);
|
|
2167
|
+
this.field = field;
|
|
2168
|
+
this.name = "PolicyValidationError";
|
|
2169
|
+
}
|
|
2170
|
+
};
|
|
2164
2171
|
var SchemaLoadError = class extends ClefError {
|
|
2165
2172
|
constructor(message, filePath) {
|
|
2166
2173
|
super(
|
|
@@ -4779,8 +4786,11 @@ var SopsClient = class {
|
|
|
4779
4786
|
}
|
|
4780
4787
|
const backend = this.detectBackend(sops);
|
|
4781
4788
|
const recipients = this.extractRecipients(sops, backend);
|
|
4782
|
-
const
|
|
4783
|
-
|
|
4789
|
+
const lastModifiedRaw = typeof sops.lastmodified === "string" ? sops.lastmodified : void 0;
|
|
4790
|
+
const lastModified = lastModifiedRaw ? new Date(lastModifiedRaw) : /* @__PURE__ */ new Date();
|
|
4791
|
+
const lastModifiedPresent = lastModifiedRaw !== void 0;
|
|
4792
|
+
const version = typeof sops.version === "string" ? sops.version : void 0;
|
|
4793
|
+
return { backend, recipients, lastModified, lastModifiedPresent, version };
|
|
4784
4794
|
}
|
|
4785
4795
|
detectBackend(sops) {
|
|
4786
4796
|
if (sops.age && Array.isArray(sops.age) && sops.age.length > 0) return "age";
|
|
@@ -8306,17 +8316,323 @@ var SyncManager = class {
|
|
|
8306
8316
|
};
|
|
8307
8317
|
}
|
|
8308
8318
|
};
|
|
8319
|
+
|
|
8320
|
+
// src/policy/parser.ts
|
|
8321
|
+
import * as fs17 from "fs";
|
|
8322
|
+
import * as YAML11 from "yaml";
|
|
8323
|
+
|
|
8324
|
+
// src/policy/types.ts
|
|
8325
|
+
var DEFAULT_POLICY = Object.freeze({
|
|
8326
|
+
version: 1,
|
|
8327
|
+
rotation: Object.freeze({ max_age_days: 90 })
|
|
8328
|
+
});
|
|
8329
|
+
|
|
8330
|
+
// src/policy/parser.ts
|
|
8331
|
+
var CLEF_POLICY_FILENAME = ".clef/policy.yaml";
|
|
8332
|
+
var SUPPORTED_VERSIONS = [1];
|
|
8333
|
+
var PolicyParser = class {
|
|
8334
|
+
/**
|
|
8335
|
+
* Read and validate a policy file from disk.
|
|
8336
|
+
*
|
|
8337
|
+
* @throws {@link PolicyValidationError} If the file cannot be read, contains
|
|
8338
|
+
* invalid YAML, or fails schema validation.
|
|
8339
|
+
*/
|
|
8340
|
+
parse(filePath) {
|
|
8341
|
+
let raw;
|
|
8342
|
+
try {
|
|
8343
|
+
raw = fs17.readFileSync(filePath, "utf-8");
|
|
8344
|
+
} catch {
|
|
8345
|
+
throw new PolicyValidationError(`Could not read policy file at '${filePath}'.`);
|
|
8346
|
+
}
|
|
8347
|
+
return this.parseContent(raw);
|
|
8348
|
+
}
|
|
8349
|
+
/**
|
|
8350
|
+
* Parse and validate a policy document from a YAML string.
|
|
8351
|
+
*
|
|
8352
|
+
* @throws {@link PolicyValidationError} If the content is malformed or
|
|
8353
|
+
* fails validation.
|
|
8354
|
+
*/
|
|
8355
|
+
parseContent(content) {
|
|
8356
|
+
let parsed;
|
|
8357
|
+
try {
|
|
8358
|
+
parsed = YAML11.parse(content);
|
|
8359
|
+
} catch {
|
|
8360
|
+
throw new PolicyValidationError(
|
|
8361
|
+
"Policy file contains invalid YAML. Check for syntax errors."
|
|
8362
|
+
);
|
|
8363
|
+
}
|
|
8364
|
+
return this.validate(parsed);
|
|
8365
|
+
}
|
|
8366
|
+
/**
|
|
8367
|
+
* Load policy from disk, returning {@link DEFAULT_POLICY} if the file does
|
|
8368
|
+
* not exist. Any other read or validation error throws.
|
|
8369
|
+
*/
|
|
8370
|
+
load(filePath) {
|
|
8371
|
+
if (!fs17.existsSync(filePath)) return DEFAULT_POLICY;
|
|
8372
|
+
return this.parse(filePath);
|
|
8373
|
+
}
|
|
8374
|
+
validate(raw) {
|
|
8375
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
8376
|
+
throw new PolicyValidationError("Policy file must be a YAML object.");
|
|
8377
|
+
}
|
|
8378
|
+
const doc = raw;
|
|
8379
|
+
if (!SUPPORTED_VERSIONS.includes(doc.version)) {
|
|
8380
|
+
throw new PolicyValidationError(
|
|
8381
|
+
`Policy file must declare 'version: 1', got: ${JSON.stringify(doc.version)}.`,
|
|
8382
|
+
"version"
|
|
8383
|
+
);
|
|
8384
|
+
}
|
|
8385
|
+
const rotation = doc.rotation === void 0 ? void 0 : this.validateRotation(doc.rotation);
|
|
8386
|
+
return { version: 1, ...rotation ? { rotation } : {} };
|
|
8387
|
+
}
|
|
8388
|
+
validateRotation(raw) {
|
|
8389
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
8390
|
+
throw new PolicyValidationError("Policy 'rotation' must be an object.", "rotation");
|
|
8391
|
+
}
|
|
8392
|
+
const rot = raw;
|
|
8393
|
+
const maxAge = rot.max_age_days;
|
|
8394
|
+
if (typeof maxAge !== "number" || !Number.isFinite(maxAge) || maxAge <= 0) {
|
|
8395
|
+
throw new PolicyValidationError(
|
|
8396
|
+
"Policy 'rotation.max_age_days' must be a positive number.",
|
|
8397
|
+
"rotation.max_age_days"
|
|
8398
|
+
);
|
|
8399
|
+
}
|
|
8400
|
+
const result = { max_age_days: maxAge };
|
|
8401
|
+
if (rot.environments !== void 0) {
|
|
8402
|
+
if (typeof rot.environments !== "object" || rot.environments === null || Array.isArray(rot.environments)) {
|
|
8403
|
+
throw new PolicyValidationError(
|
|
8404
|
+
"Policy 'rotation.environments' must be an object keyed by environment name.",
|
|
8405
|
+
"rotation.environments"
|
|
8406
|
+
);
|
|
8407
|
+
}
|
|
8408
|
+
const envs = {};
|
|
8409
|
+
for (const [envName, envVal] of Object.entries(rot.environments)) {
|
|
8410
|
+
if (typeof envVal !== "object" || envVal === null || Array.isArray(envVal)) {
|
|
8411
|
+
throw new PolicyValidationError(
|
|
8412
|
+
`Policy 'rotation.environments.${envName}' must be an object.`,
|
|
8413
|
+
`rotation.environments.${envName}`
|
|
8414
|
+
);
|
|
8415
|
+
}
|
|
8416
|
+
const envMaxAge = envVal.max_age_days;
|
|
8417
|
+
if (typeof envMaxAge !== "number" || !Number.isFinite(envMaxAge) || envMaxAge <= 0) {
|
|
8418
|
+
throw new PolicyValidationError(
|
|
8419
|
+
`Policy 'rotation.environments.${envName}.max_age_days' must be a positive number.`,
|
|
8420
|
+
`rotation.environments.${envName}.max_age_days`
|
|
8421
|
+
);
|
|
8422
|
+
}
|
|
8423
|
+
envs[envName] = { max_age_days: envMaxAge };
|
|
8424
|
+
}
|
|
8425
|
+
result.environments = envs;
|
|
8426
|
+
}
|
|
8427
|
+
return result;
|
|
8428
|
+
}
|
|
8429
|
+
};
|
|
8430
|
+
|
|
8431
|
+
// src/policy/evaluator.ts
|
|
8432
|
+
var MS_PER_DAY = 864e5;
|
|
8433
|
+
var DEFAULT_MAX_AGE_DAYS = 90;
|
|
8434
|
+
var PolicyEvaluator = class {
|
|
8435
|
+
constructor(policy) {
|
|
8436
|
+
this.policy = policy;
|
|
8437
|
+
}
|
|
8438
|
+
/**
|
|
8439
|
+
* Evaluate a single encrypted file's rotation state.
|
|
8440
|
+
*
|
|
8441
|
+
* @param filePath Repo-relative or absolute path to the encrypted file.
|
|
8442
|
+
* @param environment Environment name from the matrix; selects per-env
|
|
8443
|
+
* overrides if present in the policy.
|
|
8444
|
+
* @param metadata Result of `SopsClient.getMetadata()` for the file.
|
|
8445
|
+
* @param now Reference time (defaults to `new Date()`). Inject for
|
|
8446
|
+
* deterministic tests and reproducible audits.
|
|
8447
|
+
*/
|
|
8448
|
+
evaluateFile(filePath, environment, metadata, now = /* @__PURE__ */ new Date()) {
|
|
8449
|
+
const maxAgeDays = this.resolveMaxAgeDays(environment);
|
|
8450
|
+
const rotationDue = new Date(metadata.lastModified.getTime() + maxAgeDays * MS_PER_DAY);
|
|
8451
|
+
const rotationOverdue = now.getTime() > rotationDue.getTime();
|
|
8452
|
+
const daysOverdue = rotationOverdue ? Math.floor((now.getTime() - rotationDue.getTime()) / MS_PER_DAY) : 0;
|
|
8453
|
+
return {
|
|
8454
|
+
path: filePath,
|
|
8455
|
+
environment,
|
|
8456
|
+
backend: metadata.backend,
|
|
8457
|
+
recipients: metadata.recipients,
|
|
8458
|
+
last_modified: metadata.lastModified.toISOString(),
|
|
8459
|
+
// Treat a missing `lastModifiedPresent` as `true` — the field is
|
|
8460
|
+
// optional on SopsMetadata and only `parseMetadataFromFile` knows
|
|
8461
|
+
// authoritatively whether the underlying file carried `sops.lastmodified`.
|
|
8462
|
+
// Hand-constructed metadata is assumed trustworthy.
|
|
8463
|
+
last_modified_known: metadata.lastModifiedPresent !== false,
|
|
8464
|
+
rotation_due: rotationDue.toISOString(),
|
|
8465
|
+
rotation_overdue: rotationOverdue,
|
|
8466
|
+
days_overdue: daysOverdue,
|
|
8467
|
+
compliant: !rotationOverdue
|
|
8468
|
+
};
|
|
8469
|
+
}
|
|
8470
|
+
resolveMaxAgeDays(environment) {
|
|
8471
|
+
const envOverride = this.policy.rotation?.environments?.[environment];
|
|
8472
|
+
if (envOverride !== void 0) return envOverride.max_age_days;
|
|
8473
|
+
return this.policy.rotation?.max_age_days ?? DEFAULT_MAX_AGE_DAYS;
|
|
8474
|
+
}
|
|
8475
|
+
};
|
|
8476
|
+
|
|
8477
|
+
// src/compliance/generator.ts
|
|
8478
|
+
import { createHash as createHash3 } from "crypto";
|
|
8479
|
+
var SCHEMA_VERSION = "1";
|
|
8480
|
+
function canonicalJson(value) {
|
|
8481
|
+
if (value === null || typeof value !== "object") {
|
|
8482
|
+
return JSON.stringify(value);
|
|
8483
|
+
}
|
|
8484
|
+
if (Array.isArray(value)) {
|
|
8485
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
8486
|
+
}
|
|
8487
|
+
const obj = value;
|
|
8488
|
+
const keys = Object.keys(obj).sort();
|
|
8489
|
+
const entries = keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(obj[k])}`);
|
|
8490
|
+
return `{${entries.join(",")}}`;
|
|
8491
|
+
}
|
|
8492
|
+
var ComplianceGenerator = class {
|
|
8493
|
+
generate(opts) {
|
|
8494
|
+
const { sha, repo, policy, scanResult, lintResult, files, now } = opts;
|
|
8495
|
+
const generated_at = (now ?? /* @__PURE__ */ new Date()).toISOString();
|
|
8496
|
+
const policy_hash = `sha256:${createHash3("sha256").update(canonicalJson(policy)).digest("hex")}`;
|
|
8497
|
+
return {
|
|
8498
|
+
schema_version: SCHEMA_VERSION,
|
|
8499
|
+
generated_at,
|
|
8500
|
+
sha,
|
|
8501
|
+
repo,
|
|
8502
|
+
policy_hash,
|
|
8503
|
+
policy_snapshot: policy,
|
|
8504
|
+
summary: this.buildSummary(scanResult, lintResult, files),
|
|
8505
|
+
files,
|
|
8506
|
+
scan: scanResult,
|
|
8507
|
+
lint: lintResult
|
|
8508
|
+
};
|
|
8509
|
+
}
|
|
8510
|
+
/**
|
|
8511
|
+
* Compute a {@link ComplianceDocument.policy_hash}-format hash of any
|
|
8512
|
+
* {@link PolicyDocument} without generating a full document. Useful for
|
|
8513
|
+
* external consumers that want to compare policies across repos.
|
|
8514
|
+
*/
|
|
8515
|
+
static hashPolicy(policy) {
|
|
8516
|
+
return `sha256:${createHash3("sha256").update(canonicalJson(policy)).digest("hex")}`;
|
|
8517
|
+
}
|
|
8518
|
+
buildSummary(scan, lint, files) {
|
|
8519
|
+
return {
|
|
8520
|
+
total_files: files.length,
|
|
8521
|
+
compliant: files.filter((f) => f.compliant).length,
|
|
8522
|
+
rotation_overdue: files.filter((f) => f.rotation_overdue).length,
|
|
8523
|
+
scan_violations: scan.matches.length,
|
|
8524
|
+
lint_errors: lint.issues.filter((i) => i.severity === "error").length
|
|
8525
|
+
};
|
|
8526
|
+
}
|
|
8527
|
+
};
|
|
8528
|
+
|
|
8529
|
+
// src/compliance/run.ts
|
|
8530
|
+
import * as path25 from "path";
|
|
8531
|
+
var UNKNOWN = "unknown";
|
|
8532
|
+
async function runCompliance(opts) {
|
|
8533
|
+
const start = Date.now();
|
|
8534
|
+
const repoRoot = opts.repoRoot ?? process.cwd();
|
|
8535
|
+
const manifestPath = opts.manifestPath ?? path25.join(repoRoot, "clef.yaml");
|
|
8536
|
+
const policyPath = opts.policyPath ?? path25.join(repoRoot, CLEF_POLICY_FILENAME);
|
|
8537
|
+
const include = {
|
|
8538
|
+
scan: opts.include?.scan ?? true,
|
|
8539
|
+
lint: opts.include?.lint ?? true,
|
|
8540
|
+
rotation: opts.include?.rotation ?? true
|
|
8541
|
+
};
|
|
8542
|
+
const now = opts.now ?? /* @__PURE__ */ new Date();
|
|
8543
|
+
const manifest = new ManifestParser().parse(manifestPath);
|
|
8544
|
+
const policy = opts.policy ?? new PolicyParser().load(policyPath);
|
|
8545
|
+
const sopsClient = new SopsClient(opts.runner);
|
|
8546
|
+
const matrixManager = new MatrixManager();
|
|
8547
|
+
const schemaValidator = new SchemaValidator();
|
|
8548
|
+
const [sha, repo, files, scanResult, lintResult] = await Promise.all([
|
|
8549
|
+
opts.sha !== void 0 ? Promise.resolve(opts.sha) : detectSha(opts.runner, repoRoot),
|
|
8550
|
+
opts.repo !== void 0 ? Promise.resolve(opts.repo) : detectRepo(opts.runner, repoRoot),
|
|
8551
|
+
include.rotation ? evaluateMatrix({
|
|
8552
|
+
manifest,
|
|
8553
|
+
repoRoot,
|
|
8554
|
+
policy,
|
|
8555
|
+
matrixManager,
|
|
8556
|
+
sopsClient,
|
|
8557
|
+
filter: opts.filter,
|
|
8558
|
+
now
|
|
8559
|
+
}) : Promise.resolve([]),
|
|
8560
|
+
include.scan ? new ScanRunner(opts.runner).scan(repoRoot, manifest) : Promise.resolve(emptyScan()),
|
|
8561
|
+
include.lint ? new LintRunner(matrixManager, schemaValidator, sopsClient).run(manifest, repoRoot) : Promise.resolve(emptyLint())
|
|
8562
|
+
]);
|
|
8563
|
+
const document = new ComplianceGenerator().generate({
|
|
8564
|
+
sha,
|
|
8565
|
+
repo,
|
|
8566
|
+
policy,
|
|
8567
|
+
scanResult,
|
|
8568
|
+
lintResult,
|
|
8569
|
+
files,
|
|
8570
|
+
now
|
|
8571
|
+
});
|
|
8572
|
+
const passed = document.summary.rotation_overdue === 0 && document.summary.scan_violations === 0 && document.summary.lint_errors === 0;
|
|
8573
|
+
return { document, passed, durationMs: Date.now() - start };
|
|
8574
|
+
}
|
|
8575
|
+
async function evaluateMatrix(args) {
|
|
8576
|
+
const evaluator = new PolicyEvaluator(args.policy);
|
|
8577
|
+
const cells = args.matrixManager.resolveMatrix(args.manifest, args.repoRoot).filter((c) => applyFilter(c.namespace, c.environment, args.filter)).filter((c) => c.exists);
|
|
8578
|
+
return Promise.all(
|
|
8579
|
+
cells.map(async (cell) => {
|
|
8580
|
+
const metadata = await args.sopsClient.getMetadata(cell.filePath);
|
|
8581
|
+
const relPath = path25.relative(args.repoRoot, cell.filePath).replace(/\\/g, "/");
|
|
8582
|
+
return evaluator.evaluateFile(relPath, cell.environment, metadata, args.now);
|
|
8583
|
+
})
|
|
8584
|
+
);
|
|
8585
|
+
}
|
|
8586
|
+
function applyFilter(namespace, environment, filter) {
|
|
8587
|
+
if (filter?.namespaces?.length && !filter.namespaces.includes(namespace)) return false;
|
|
8588
|
+
if (filter?.environments?.length && !filter.environments.includes(environment)) return false;
|
|
8589
|
+
return true;
|
|
8590
|
+
}
|
|
8591
|
+
function emptyScan() {
|
|
8592
|
+
return {
|
|
8593
|
+
matches: [],
|
|
8594
|
+
filesScanned: 0,
|
|
8595
|
+
filesSkipped: 0,
|
|
8596
|
+
unencryptedMatrixFiles: [],
|
|
8597
|
+
durationMs: 0
|
|
8598
|
+
};
|
|
8599
|
+
}
|
|
8600
|
+
function emptyLint() {
|
|
8601
|
+
return { issues: [], fileCount: 0, pendingCount: 0 };
|
|
8602
|
+
}
|
|
8603
|
+
async function detectSha(runner, repoRoot) {
|
|
8604
|
+
const env = process.env;
|
|
8605
|
+
const fromEnv = env.GITHUB_SHA ?? env.CI_COMMIT_SHA ?? env.BITBUCKET_COMMIT ?? env.CIRCLE_SHA1 ?? env.BUILD_VCS_NUMBER;
|
|
8606
|
+
if (fromEnv) return fromEnv;
|
|
8607
|
+
const result = await runner.run("git", ["rev-parse", "HEAD"], { cwd: repoRoot });
|
|
8608
|
+
if (result.exitCode !== 0) return UNKNOWN;
|
|
8609
|
+
const trimmed = result.stdout.trim();
|
|
8610
|
+
return trimmed || UNKNOWN;
|
|
8611
|
+
}
|
|
8612
|
+
async function detectRepo(runner, repoRoot) {
|
|
8613
|
+
const env = process.env;
|
|
8614
|
+
const fromEnv = env.GITHUB_REPOSITORY ?? env.CI_PROJECT_PATH ?? env.BITBUCKET_REPO_FULL_NAME ?? (env.CIRCLE_PROJECT_USERNAME && env.CIRCLE_PROJECT_REPONAME ? `${env.CIRCLE_PROJECT_USERNAME}/${env.CIRCLE_PROJECT_REPONAME}` : void 0);
|
|
8615
|
+
if (fromEnv) return fromEnv;
|
|
8616
|
+
const result = await runner.run("git", ["remote", "get-url", "origin"], { cwd: repoRoot });
|
|
8617
|
+
if (result.exitCode !== 0) return UNKNOWN;
|
|
8618
|
+
const url = result.stdout.trim();
|
|
8619
|
+
const match = url.match(/[:/]([^/:]+)\/([^/]+?)(?:\.git)?\/?$/);
|
|
8620
|
+
return match ? `${match[1]}/${match[2]}` : UNKNOWN;
|
|
8621
|
+
}
|
|
8309
8622
|
export {
|
|
8310
8623
|
ArtifactPacker,
|
|
8311
8624
|
BackendMigrator,
|
|
8312
8625
|
BulkOps,
|
|
8313
8626
|
CLEF_MANIFEST_FILENAME,
|
|
8627
|
+
CLEF_POLICY_FILENAME,
|
|
8314
8628
|
CLEF_REPORT_SCHEMA_VERSION,
|
|
8315
8629
|
CLEF_SUPPORTED_EXTENSIONS,
|
|
8316
8630
|
ClefError,
|
|
8317
8631
|
CloudApiError,
|
|
8318
8632
|
CloudClient,
|
|
8633
|
+
ComplianceGenerator,
|
|
8319
8634
|
ConsumptionClient,
|
|
8635
|
+
DEFAULT_POLICY,
|
|
8320
8636
|
DiffEngine,
|
|
8321
8637
|
DriftDetector,
|
|
8322
8638
|
FilePackOutput,
|
|
@@ -8328,6 +8644,9 @@ export {
|
|
|
8328
8644
|
ManifestValidationError,
|
|
8329
8645
|
MatrixManager,
|
|
8330
8646
|
MemoryPackOutput,
|
|
8647
|
+
PolicyEvaluator,
|
|
8648
|
+
PolicyParser,
|
|
8649
|
+
PolicyValidationError,
|
|
8331
8650
|
REQUESTS_FILENAME,
|
|
8332
8651
|
REQUIREMENTS,
|
|
8333
8652
|
RecipientManager,
|
|
@@ -8394,6 +8713,7 @@ export {
|
|
|
8394
8713
|
resolveIdentitySecrets,
|
|
8395
8714
|
resolveRecipientsForEnvironment,
|
|
8396
8715
|
resolveSopsPath,
|
|
8716
|
+
runCompliance,
|
|
8397
8717
|
saveMetadata,
|
|
8398
8718
|
saveRequests,
|
|
8399
8719
|
shannonEntropy,
|