@apps-in-toss/cli 0.0.0-dev.1744801739343 → 0.0.0-dev.1752049503789

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.
Files changed (3) hide show
  1. package/dist/index.cjs +343 -1505
  2. package/dist/index.js +339 -1501
  3. package/package.json +10 -7
package/dist/index.js CHANGED
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
- // ../../.yarn/__virtual__/tsup-virtual-7254073ea3/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js
37
+ // ../../.yarn/__virtual__/tsup-virtual-7863592962/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js
38
38
  var init_esm_shims = __esm({
39
- "../../.yarn/__virtual__/tsup-virtual-7254073ea3/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js"() {
39
+ "../../.yarn/__virtual__/tsup-virtual-7863592962/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js"() {
40
40
  "use strict";
41
41
  }
42
42
  });
@@ -52,13 +52,13 @@ var require_ms = __commonJS({
52
52
  var d = h * 24;
53
53
  var w = d * 7;
54
54
  var y = d * 365.25;
55
- module.exports = function(val, options2) {
56
- options2 = options2 || {};
55
+ module.exports = function(val, options) {
56
+ options = options || {};
57
57
  var type = typeof val;
58
58
  if (type === "string" && val.length > 0) {
59
59
  return parse(val);
60
60
  } else if (type === "number" && isFinite(val)) {
61
- return options2.long ? fmtLong(val) : fmtShort(val);
61
+ return options.long ? fmtLong(val) : fmtShort(val);
62
62
  }
63
63
  throw new Error(
64
64
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
@@ -193,11 +193,11 @@ var require_common = __commonJS({
193
193
  let enableOverride = null;
194
194
  let namespacesCache;
195
195
  let enabledCache;
196
- function debug3(...args) {
197
- if (!debug3.enabled) {
196
+ function debug5(...args) {
197
+ if (!debug5.enabled) {
198
198
  return;
199
199
  }
200
- const self = debug3;
200
+ const self = debug5;
201
201
  const curr = Number(/* @__PURE__ */ new Date());
202
202
  const ms = curr - (prevTime || curr);
203
203
  self.diff = ms;
@@ -227,12 +227,12 @@ var require_common = __commonJS({
227
227
  const logFn = self.log || createDebug.log;
228
228
  logFn.apply(self, args);
229
229
  }
230
- debug3.namespace = namespace;
231
- debug3.useColors = createDebug.useColors();
232
- debug3.color = createDebug.selectColor(namespace);
233
- debug3.extend = extend;
234
- debug3.destroy = createDebug.destroy;
235
- Object.defineProperty(debug3, "enabled", {
230
+ debug5.namespace = namespace;
231
+ debug5.useColors = createDebug.useColors();
232
+ debug5.color = createDebug.selectColor(namespace);
233
+ debug5.extend = extend;
234
+ debug5.destroy = createDebug.destroy;
235
+ Object.defineProperty(debug5, "enabled", {
236
236
  enumerable: true,
237
237
  configurable: false,
238
238
  get: () => {
@@ -250,9 +250,9 @@ var require_common = __commonJS({
250
250
  }
251
251
  });
252
252
  if (typeof createDebug.init === "function") {
253
- createDebug.init(debug3);
253
+ createDebug.init(debug5);
254
254
  }
255
- return debug3;
255
+ return debug5;
256
256
  }
257
257
  function extend(namespace, delimiter) {
258
258
  const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
@@ -518,7 +518,7 @@ var require_node = __commonJS({
518
518
  var tty = __require("tty");
519
519
  var util = __require("util");
520
520
  exports.init = init;
521
- exports.log = log3;
521
+ exports.log = log4;
522
522
  exports.formatArgs = formatArgs;
523
523
  exports.save = save;
524
524
  exports.load = load;
@@ -653,7 +653,7 @@ var require_node = __commonJS({
653
653
  }
654
654
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
655
655
  }
656
- function log3(...args) {
656
+ function log4(...args) {
657
657
  return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
658
658
  }
659
659
  function save(namespaces) {
@@ -666,11 +666,11 @@ var require_node = __commonJS({
666
666
  function load() {
667
667
  return process.env.DEBUG;
668
668
  }
669
- function init(debug3) {
670
- debug3.inspectOpts = {};
669
+ function init(debug5) {
670
+ debug5.inspectOpts = {};
671
671
  const keys = Object.keys(exports.inspectOpts);
672
672
  for (let i = 0; i < keys.length; i++) {
673
- debug3.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
673
+ debug5.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
674
674
  }
675
675
  }
676
676
  module.exports = require_common()(exports);
@@ -704,10 +704,10 @@ var require_picocolors = __commonJS({
704
704
  "../../.yarn/cache/picocolors-npm-1.1.1-b0c45fa35e-e2e3e8170a.zip/node_modules/picocolors/picocolors.js"(exports, module) {
705
705
  "use strict";
706
706
  init_esm_shims();
707
- var p3 = process || {};
708
- var argv = p3.argv || [];
709
- var env = p3.env || {};
710
- var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p3.platform === "win32" || (p3.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
707
+ var p4 = process || {};
708
+ var argv = p4.argv || [];
709
+ var env = p4.env || {};
710
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p4.platform === "win32" || (p4.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
711
711
  var formatter = (open, close, replace = open) => (input) => {
712
712
  let string = "" + input, index = string.indexOf(close, open.length);
713
713
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
@@ -773,1399 +773,19 @@ var require_picocolors = __commonJS({
773
773
  }
774
774
  });
775
775
 
776
- // ../../.yarn/cache/pend-npm-1.2.0-dddaab3bf3-8a87e63f7a.zip/node_modules/pend/index.js
777
- var require_pend = __commonJS({
778
- "../../.yarn/cache/pend-npm-1.2.0-dddaab3bf3-8a87e63f7a.zip/node_modules/pend/index.js"(exports, module) {
779
- "use strict";
780
- init_esm_shims();
781
- module.exports = Pend;
782
- function Pend() {
783
- this.pending = 0;
784
- this.max = Infinity;
785
- this.listeners = [];
786
- this.waiting = [];
787
- this.error = null;
788
- }
789
- Pend.prototype.go = function(fn) {
790
- if (this.pending < this.max) {
791
- pendGo(this, fn);
792
- } else {
793
- this.waiting.push(fn);
794
- }
795
- };
796
- Pend.prototype.wait = function(cb) {
797
- if (this.pending === 0) {
798
- cb(this.error);
799
- } else {
800
- this.listeners.push(cb);
801
- }
802
- };
803
- Pend.prototype.hold = function() {
804
- return pendHold(this);
805
- };
806
- function pendHold(self) {
807
- self.pending += 1;
808
- var called = false;
809
- return onCb;
810
- function onCb(err) {
811
- if (called) throw new Error("callback called twice");
812
- called = true;
813
- self.error = self.error || err;
814
- self.pending -= 1;
815
- if (self.waiting.length > 0 && self.pending < self.max) {
816
- pendGo(self, self.waiting.shift());
817
- } else if (self.pending === 0) {
818
- var listeners = self.listeners;
819
- self.listeners = [];
820
- listeners.forEach(cbListener);
821
- }
822
- }
823
- function cbListener(listener) {
824
- listener(self.error);
825
- }
826
- }
827
- function pendGo(self, fn) {
828
- fn(pendHold(self));
829
- }
830
- }
831
- });
832
-
833
- // ../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/fd-slicer.js
834
- var require_fd_slicer = __commonJS({
835
- "../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/fd-slicer.js"(exports) {
836
- "use strict";
837
- init_esm_shims();
838
- var fs5 = __require("fs");
839
- var util = __require("util");
840
- var stream = __require("stream");
841
- var Readable = stream.Readable;
842
- var Writable = stream.Writable;
843
- var PassThrough = stream.PassThrough;
844
- var Pend = require_pend();
845
- var EventEmitter = __require("events").EventEmitter;
846
- exports.createFromBuffer = createFromBuffer;
847
- exports.createFromFd = createFromFd;
848
- exports.BufferSlicer = BufferSlicer;
849
- exports.FdSlicer = FdSlicer;
850
- util.inherits(FdSlicer, EventEmitter);
851
- function FdSlicer(fd, options2) {
852
- options2 = options2 || {};
853
- EventEmitter.call(this);
854
- this.fd = fd;
855
- this.pend = new Pend();
856
- this.pend.max = 1;
857
- this.refCount = 0;
858
- this.autoClose = !!options2.autoClose;
859
- }
860
- FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
861
- var self = this;
862
- self.pend.go(function(cb) {
863
- fs5.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
864
- cb();
865
- callback(err, bytesRead, buffer2);
866
- });
867
- });
868
- };
869
- FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
870
- var self = this;
871
- self.pend.go(function(cb) {
872
- fs5.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
873
- cb();
874
- callback(err, written, buffer2);
875
- });
876
- });
877
- };
878
- FdSlicer.prototype.createReadStream = function(options2) {
879
- return new ReadStream(this, options2);
880
- };
881
- FdSlicer.prototype.createWriteStream = function(options2) {
882
- return new WriteStream(this, options2);
883
- };
884
- FdSlicer.prototype.ref = function() {
885
- this.refCount += 1;
886
- };
887
- FdSlicer.prototype.unref = function() {
888
- var self = this;
889
- self.refCount -= 1;
890
- if (self.refCount > 0) return;
891
- if (self.refCount < 0) throw new Error("invalid unref");
892
- if (self.autoClose) {
893
- fs5.close(self.fd, onCloseDone);
894
- }
895
- function onCloseDone(err) {
896
- if (err) {
897
- self.emit("error", err);
898
- } else {
899
- self.emit("close");
900
- }
901
- }
902
- };
903
- util.inherits(ReadStream, Readable);
904
- function ReadStream(context, options2) {
905
- options2 = options2 || {};
906
- Readable.call(this, options2);
907
- this.context = context;
908
- this.context.ref();
909
- this.start = options2.start || 0;
910
- this.endOffset = options2.end;
911
- this.pos = this.start;
912
- this.destroyed = false;
913
- }
914
- ReadStream.prototype._read = function(n) {
915
- var self = this;
916
- if (self.destroyed) return;
917
- var toRead = Math.min(self._readableState.highWaterMark, n);
918
- if (self.endOffset != null) {
919
- toRead = Math.min(toRead, self.endOffset - self.pos);
920
- }
921
- if (toRead <= 0) {
922
- self.destroyed = true;
923
- self.push(null);
924
- self.context.unref();
925
- return;
926
- }
927
- self.context.pend.go(function(cb) {
928
- if (self.destroyed) return cb();
929
- var buffer = Buffer.allocUnsafe(toRead);
930
- fs5.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
931
- if (err) {
932
- self.destroy(err);
933
- } else if (bytesRead === 0) {
934
- self.destroyed = true;
935
- self.push(null);
936
- self.context.unref();
937
- } else {
938
- self.pos += bytesRead;
939
- self.push(buffer.slice(0, bytesRead));
940
- }
941
- cb();
942
- });
943
- });
944
- };
945
- ReadStream.prototype.destroy = function(err) {
946
- if (this.destroyed) return;
947
- err = err || new Error("stream destroyed");
948
- this.destroyed = true;
949
- this.emit("error", err);
950
- this.context.unref();
951
- };
952
- util.inherits(WriteStream, Writable);
953
- function WriteStream(context, options2) {
954
- options2 = options2 || {};
955
- Writable.call(this, options2);
956
- this.context = context;
957
- this.context.ref();
958
- this.start = options2.start || 0;
959
- this.endOffset = options2.end == null ? Infinity : +options2.end;
960
- this.bytesWritten = 0;
961
- this.pos = this.start;
962
- this.destroyed = false;
963
- this.on("finish", this.destroy.bind(this));
964
- }
965
- WriteStream.prototype._write = function(buffer, encoding, callback) {
966
- var self = this;
967
- if (self.destroyed) return;
968
- if (self.pos + buffer.length > self.endOffset) {
969
- var err = new Error("maximum file length exceeded");
970
- err.code = "ETOOBIG";
971
- self.destroy();
972
- callback(err);
973
- return;
974
- }
975
- self.context.pend.go(function(cb) {
976
- if (self.destroyed) return cb();
977
- fs5.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
978
- if (err2) {
979
- self.destroy();
980
- cb();
981
- callback(err2);
982
- } else {
983
- self.bytesWritten += bytes;
984
- self.pos += bytes;
985
- self.emit("progress");
986
- cb();
987
- callback();
988
- }
989
- });
990
- });
991
- };
992
- WriteStream.prototype.destroy = function() {
993
- if (this.destroyed) return;
994
- this.destroyed = true;
995
- this.context.unref();
996
- };
997
- util.inherits(BufferSlicer, EventEmitter);
998
- function BufferSlicer(buffer, options2) {
999
- EventEmitter.call(this);
1000
- options2 = options2 || {};
1001
- this.refCount = 0;
1002
- this.buffer = buffer;
1003
- this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
1004
- }
1005
- BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
1006
- if (!(0 <= offset && offset <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
1007
- if (position < 0) throw new RangeError("position is negative: " + position);
1008
- if (offset + length > buffer.length) {
1009
- length = buffer.length - offset;
1010
- }
1011
- if (position + length > this.buffer.length) {
1012
- length = this.buffer.length - position;
1013
- }
1014
- if (length <= 0) {
1015
- setImmediate(function() {
1016
- callback(null, 0);
1017
- });
1018
- return;
1019
- }
1020
- this.buffer.copy(buffer, offset, position, position + length);
1021
- setImmediate(function() {
1022
- callback(null, length);
1023
- });
1024
- };
1025
- BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
1026
- buffer.copy(this.buffer, position, offset, offset + length);
1027
- setImmediate(function() {
1028
- callback(null, length, buffer);
1029
- });
1030
- };
1031
- BufferSlicer.prototype.createReadStream = function(options2) {
1032
- options2 = options2 || {};
1033
- var readStream = new PassThrough(options2);
1034
- readStream.destroyed = false;
1035
- readStream.start = options2.start || 0;
1036
- readStream.endOffset = options2.end;
1037
- readStream.pos = readStream.endOffset || this.buffer.length;
1038
- var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
1039
- var offset = 0;
1040
- while (true) {
1041
- var nextOffset = offset + this.maxChunkSize;
1042
- if (nextOffset >= entireSlice.length) {
1043
- if (offset < entireSlice.length) {
1044
- readStream.write(entireSlice.slice(offset, entireSlice.length));
1045
- }
1046
- break;
1047
- }
1048
- readStream.write(entireSlice.slice(offset, nextOffset));
1049
- offset = nextOffset;
1050
- }
1051
- readStream.end();
1052
- readStream.destroy = function() {
1053
- readStream.destroyed = true;
1054
- };
1055
- return readStream;
1056
- };
1057
- BufferSlicer.prototype.createWriteStream = function(options2) {
1058
- var bufferSlicer = this;
1059
- options2 = options2 || {};
1060
- var writeStream = new Writable(options2);
1061
- writeStream.start = options2.start || 0;
1062
- writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
1063
- writeStream.bytesWritten = 0;
1064
- writeStream.pos = writeStream.start;
1065
- writeStream.destroyed = false;
1066
- writeStream._write = function(buffer, encoding, callback) {
1067
- if (writeStream.destroyed) return;
1068
- var end = writeStream.pos + buffer.length;
1069
- if (end > writeStream.endOffset) {
1070
- var err = new Error("maximum file length exceeded");
1071
- err.code = "ETOOBIG";
1072
- writeStream.destroyed = true;
1073
- callback(err);
1074
- return;
1075
- }
1076
- buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
1077
- writeStream.bytesWritten += buffer.length;
1078
- writeStream.pos = end;
1079
- writeStream.emit("progress");
1080
- callback();
1081
- };
1082
- writeStream.destroy = function() {
1083
- writeStream.destroyed = true;
1084
- };
1085
- return writeStream;
1086
- };
1087
- BufferSlicer.prototype.ref = function() {
1088
- this.refCount += 1;
1089
- };
1090
- BufferSlicer.prototype.unref = function() {
1091
- this.refCount -= 1;
1092
- if (this.refCount < 0) {
1093
- throw new Error("invalid unref");
1094
- }
1095
- };
1096
- function createFromBuffer(buffer, options2) {
1097
- return new BufferSlicer(buffer, options2);
1098
- }
1099
- function createFromFd(fd, options2) {
1100
- return new FdSlicer(fd, options2);
1101
- }
1102
- }
1103
- });
1104
-
1105
- // ../../.yarn/cache/buffer-crc32-npm-0.2.13-e25ddc91f5-cb0a8ddf5c.zip/node_modules/buffer-crc32/index.js
1106
- var require_buffer_crc32 = __commonJS({
1107
- "../../.yarn/cache/buffer-crc32-npm-0.2.13-e25ddc91f5-cb0a8ddf5c.zip/node_modules/buffer-crc32/index.js"(exports, module) {
1108
- "use strict";
1109
- init_esm_shims();
1110
- var Buffer2 = __require("buffer").Buffer;
1111
- var CRC_TABLE = [
1112
- 0,
1113
- 1996959894,
1114
- 3993919788,
1115
- 2567524794,
1116
- 124634137,
1117
- 1886057615,
1118
- 3915621685,
1119
- 2657392035,
1120
- 249268274,
1121
- 2044508324,
1122
- 3772115230,
1123
- 2547177864,
1124
- 162941995,
1125
- 2125561021,
1126
- 3887607047,
1127
- 2428444049,
1128
- 498536548,
1129
- 1789927666,
1130
- 4089016648,
1131
- 2227061214,
1132
- 450548861,
1133
- 1843258603,
1134
- 4107580753,
1135
- 2211677639,
1136
- 325883990,
1137
- 1684777152,
1138
- 4251122042,
1139
- 2321926636,
1140
- 335633487,
1141
- 1661365465,
1142
- 4195302755,
1143
- 2366115317,
1144
- 997073096,
1145
- 1281953886,
1146
- 3579855332,
1147
- 2724688242,
1148
- 1006888145,
1149
- 1258607687,
1150
- 3524101629,
1151
- 2768942443,
1152
- 901097722,
1153
- 1119000684,
1154
- 3686517206,
1155
- 2898065728,
1156
- 853044451,
1157
- 1172266101,
1158
- 3705015759,
1159
- 2882616665,
1160
- 651767980,
1161
- 1373503546,
1162
- 3369554304,
1163
- 3218104598,
1164
- 565507253,
1165
- 1454621731,
1166
- 3485111705,
1167
- 3099436303,
1168
- 671266974,
1169
- 1594198024,
1170
- 3322730930,
1171
- 2970347812,
1172
- 795835527,
1173
- 1483230225,
1174
- 3244367275,
1175
- 3060149565,
1176
- 1994146192,
1177
- 31158534,
1178
- 2563907772,
1179
- 4023717930,
1180
- 1907459465,
1181
- 112637215,
1182
- 2680153253,
1183
- 3904427059,
1184
- 2013776290,
1185
- 251722036,
1186
- 2517215374,
1187
- 3775830040,
1188
- 2137656763,
1189
- 141376813,
1190
- 2439277719,
1191
- 3865271297,
1192
- 1802195444,
1193
- 476864866,
1194
- 2238001368,
1195
- 4066508878,
1196
- 1812370925,
1197
- 453092731,
1198
- 2181625025,
1199
- 4111451223,
1200
- 1706088902,
1201
- 314042704,
1202
- 2344532202,
1203
- 4240017532,
1204
- 1658658271,
1205
- 366619977,
1206
- 2362670323,
1207
- 4224994405,
1208
- 1303535960,
1209
- 984961486,
1210
- 2747007092,
1211
- 3569037538,
1212
- 1256170817,
1213
- 1037604311,
1214
- 2765210733,
1215
- 3554079995,
1216
- 1131014506,
1217
- 879679996,
1218
- 2909243462,
1219
- 3663771856,
1220
- 1141124467,
1221
- 855842277,
1222
- 2852801631,
1223
- 3708648649,
1224
- 1342533948,
1225
- 654459306,
1226
- 3188396048,
1227
- 3373015174,
1228
- 1466479909,
1229
- 544179635,
1230
- 3110523913,
1231
- 3462522015,
1232
- 1591671054,
1233
- 702138776,
1234
- 2966460450,
1235
- 3352799412,
1236
- 1504918807,
1237
- 783551873,
1238
- 3082640443,
1239
- 3233442989,
1240
- 3988292384,
1241
- 2596254646,
1242
- 62317068,
1243
- 1957810842,
1244
- 3939845945,
1245
- 2647816111,
1246
- 81470997,
1247
- 1943803523,
1248
- 3814918930,
1249
- 2489596804,
1250
- 225274430,
1251
- 2053790376,
1252
- 3826175755,
1253
- 2466906013,
1254
- 167816743,
1255
- 2097651377,
1256
- 4027552580,
1257
- 2265490386,
1258
- 503444072,
1259
- 1762050814,
1260
- 4150417245,
1261
- 2154129355,
1262
- 426522225,
1263
- 1852507879,
1264
- 4275313526,
1265
- 2312317920,
1266
- 282753626,
1267
- 1742555852,
1268
- 4189708143,
1269
- 2394877945,
1270
- 397917763,
1271
- 1622183637,
1272
- 3604390888,
1273
- 2714866558,
1274
- 953729732,
1275
- 1340076626,
1276
- 3518719985,
1277
- 2797360999,
1278
- 1068828381,
1279
- 1219638859,
1280
- 3624741850,
1281
- 2936675148,
1282
- 906185462,
1283
- 1090812512,
1284
- 3747672003,
1285
- 2825379669,
1286
- 829329135,
1287
- 1181335161,
1288
- 3412177804,
1289
- 3160834842,
1290
- 628085408,
1291
- 1382605366,
1292
- 3423369109,
1293
- 3138078467,
1294
- 570562233,
1295
- 1426400815,
1296
- 3317316542,
1297
- 2998733608,
1298
- 733239954,
1299
- 1555261956,
1300
- 3268935591,
1301
- 3050360625,
1302
- 752459403,
1303
- 1541320221,
1304
- 2607071920,
1305
- 3965973030,
1306
- 1969922972,
1307
- 40735498,
1308
- 2617837225,
1309
- 3943577151,
1310
- 1913087877,
1311
- 83908371,
1312
- 2512341634,
1313
- 3803740692,
1314
- 2075208622,
1315
- 213261112,
1316
- 2463272603,
1317
- 3855990285,
1318
- 2094854071,
1319
- 198958881,
1320
- 2262029012,
1321
- 4057260610,
1322
- 1759359992,
1323
- 534414190,
1324
- 2176718541,
1325
- 4139329115,
1326
- 1873836001,
1327
- 414664567,
1328
- 2282248934,
1329
- 4279200368,
1330
- 1711684554,
1331
- 285281116,
1332
- 2405801727,
1333
- 4167216745,
1334
- 1634467795,
1335
- 376229701,
1336
- 2685067896,
1337
- 3608007406,
1338
- 1308918612,
1339
- 956543938,
1340
- 2808555105,
1341
- 3495958263,
1342
- 1231636301,
1343
- 1047427035,
1344
- 2932959818,
1345
- 3654703836,
1346
- 1088359270,
1347
- 936918e3,
1348
- 2847714899,
1349
- 3736837829,
1350
- 1202900863,
1351
- 817233897,
1352
- 3183342108,
1353
- 3401237130,
1354
- 1404277552,
1355
- 615818150,
1356
- 3134207493,
1357
- 3453421203,
1358
- 1423857449,
1359
- 601450431,
1360
- 3009837614,
1361
- 3294710456,
1362
- 1567103746,
1363
- 711928724,
1364
- 3020668471,
1365
- 3272380065,
1366
- 1510334235,
1367
- 755167117
1368
- ];
1369
- if (typeof Int32Array !== "undefined") {
1370
- CRC_TABLE = new Int32Array(CRC_TABLE);
1371
- }
1372
- function ensureBuffer(input) {
1373
- if (Buffer2.isBuffer(input)) {
1374
- return input;
1375
- }
1376
- var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
1377
- if (typeof input === "number") {
1378
- return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
1379
- } else if (typeof input === "string") {
1380
- return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
1381
- } else {
1382
- throw new Error("input must be buffer, number, or string, received " + typeof input);
1383
- }
1384
- }
1385
- function bufferizeInt(num) {
1386
- var tmp = ensureBuffer(4);
1387
- tmp.writeInt32BE(num, 0);
1388
- return tmp;
1389
- }
1390
- function _crc32(buf, previous) {
1391
- buf = ensureBuffer(buf);
1392
- if (Buffer2.isBuffer(previous)) {
1393
- previous = previous.readUInt32BE(0);
1394
- }
1395
- var crc = ~~previous ^ -1;
1396
- for (var n = 0; n < buf.length; n++) {
1397
- crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
1398
- }
1399
- return crc ^ -1;
1400
- }
1401
- function crc32() {
1402
- return bufferizeInt(_crc32.apply(null, arguments));
1403
- }
1404
- crc32.signed = function() {
1405
- return _crc32.apply(null, arguments);
1406
- };
1407
- crc32.unsigned = function() {
1408
- return _crc32.apply(null, arguments) >>> 0;
1409
- };
1410
- module.exports = crc32;
1411
- }
1412
- });
1413
-
1414
- // ../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/index.js
1415
- var require_yauzl = __commonJS({
1416
- "../../.yarn/cache/yauzl-npm-3.2.0-b1af038bc6-7b40b3dc46.zip/node_modules/yauzl/index.js"(exports) {
1417
- "use strict";
1418
- init_esm_shims();
1419
- var fs5 = __require("fs");
1420
- var zlib = __require("zlib");
1421
- var fd_slicer = require_fd_slicer();
1422
- var crc32 = require_buffer_crc32();
1423
- var util = __require("util");
1424
- var EventEmitter = __require("events").EventEmitter;
1425
- var Transform = __require("stream").Transform;
1426
- var PassThrough = __require("stream").PassThrough;
1427
- var Writable = __require("stream").Writable;
1428
- exports.open = open;
1429
- exports.fromFd = fromFd;
1430
- exports.fromBuffer = fromBuffer;
1431
- exports.fromRandomAccessReader = fromRandomAccessReader;
1432
- exports.dosDateTimeToDate = dosDateTimeToDate;
1433
- exports.getFileNameLowLevel = getFileNameLowLevel;
1434
- exports.validateFileName = validateFileName;
1435
- exports.parseExtraFields = parseExtraFields;
1436
- exports.ZipFile = ZipFile;
1437
- exports.Entry = Entry;
1438
- exports.LocalFileHeader = LocalFileHeader;
1439
- exports.RandomAccessReader = RandomAccessReader;
1440
- function open(path4, options2, callback) {
1441
- if (typeof options2 === "function") {
1442
- callback = options2;
1443
- options2 = null;
1444
- }
1445
- if (options2 == null) options2 = {};
1446
- if (options2.autoClose == null) options2.autoClose = true;
1447
- if (options2.lazyEntries == null) options2.lazyEntries = false;
1448
- if (options2.decodeStrings == null) options2.decodeStrings = true;
1449
- if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
1450
- if (options2.strictFileNames == null) options2.strictFileNames = false;
1451
- if (callback == null) callback = defaultCallback;
1452
- fs5.open(path4, "r", function(err, fd) {
1453
- if (err) return callback(err);
1454
- fromFd(fd, options2, function(err2, zipfile) {
1455
- if (err2) fs5.close(fd, defaultCallback);
1456
- callback(err2, zipfile);
1457
- });
1458
- });
1459
- }
1460
- function fromFd(fd, options2, callback) {
1461
- if (typeof options2 === "function") {
1462
- callback = options2;
1463
- options2 = null;
1464
- }
1465
- if (options2 == null) options2 = {};
1466
- if (options2.autoClose == null) options2.autoClose = false;
1467
- if (options2.lazyEntries == null) options2.lazyEntries = false;
1468
- if (options2.decodeStrings == null) options2.decodeStrings = true;
1469
- if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
1470
- if (options2.strictFileNames == null) options2.strictFileNames = false;
1471
- if (callback == null) callback = defaultCallback;
1472
- fs5.fstat(fd, function(err, stats) {
1473
- if (err) return callback(err);
1474
- var reader = fd_slicer.createFromFd(fd, { autoClose: true });
1475
- fromRandomAccessReader(reader, stats.size, options2, callback);
1476
- });
1477
- }
1478
- function fromBuffer(buffer, options2, callback) {
1479
- if (typeof options2 === "function") {
1480
- callback = options2;
1481
- options2 = null;
1482
- }
1483
- if (options2 == null) options2 = {};
1484
- options2.autoClose = false;
1485
- if (options2.lazyEntries == null) options2.lazyEntries = false;
1486
- if (options2.decodeStrings == null) options2.decodeStrings = true;
1487
- if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
1488
- if (options2.strictFileNames == null) options2.strictFileNames = false;
1489
- var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
1490
- fromRandomAccessReader(reader, buffer.length, options2, callback);
1491
- }
1492
- function fromRandomAccessReader(reader, totalSize, options2, callback) {
1493
- if (typeof options2 === "function") {
1494
- callback = options2;
1495
- options2 = null;
1496
- }
1497
- if (options2 == null) options2 = {};
1498
- if (options2.autoClose == null) options2.autoClose = true;
1499
- if (options2.lazyEntries == null) options2.lazyEntries = false;
1500
- if (options2.decodeStrings == null) options2.decodeStrings = true;
1501
- var decodeStrings = !!options2.decodeStrings;
1502
- if (options2.validateEntrySizes == null) options2.validateEntrySizes = true;
1503
- if (options2.strictFileNames == null) options2.strictFileNames = false;
1504
- if (callback == null) callback = defaultCallback;
1505
- if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
1506
- if (totalSize > Number.MAX_SAFE_INTEGER) {
1507
- throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
1508
- }
1509
- reader.ref();
1510
- var eocdrWithoutCommentSize = 22;
1511
- var zip64EocdlSize = 20;
1512
- var maxCommentSize = 65535;
1513
- var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + maxCommentSize, totalSize);
1514
- var buffer = newBuffer(bufferSize);
1515
- var bufferReadStart = totalSize - buffer.length;
1516
- readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
1517
- if (err) return callback(err);
1518
- for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
1519
- if (buffer.readUInt32LE(i) !== 101010256) continue;
1520
- var eocdrBuffer = buffer.subarray(i);
1521
- var diskNumber = eocdrBuffer.readUInt16LE(4);
1522
- var entryCount = eocdrBuffer.readUInt16LE(10);
1523
- var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
1524
- var commentLength = eocdrBuffer.readUInt16LE(20);
1525
- var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
1526
- if (commentLength !== expectedCommentLength) {
1527
- return callback(new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK\u263A\u263B` in the comment?"));
1528
- }
1529
- var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
1530
- if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
1531
- var zip64EocdlBuffer = buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize);
1532
- var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
1533
- var zip64EocdrBuffer = newBuffer(56);
1534
- return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
1535
- if (err2) return callback(err2);
1536
- if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
1537
- return callback(new Error("invalid zip64 end of central directory record signature"));
1538
- }
1539
- diskNumber = zip64EocdrBuffer.readUInt32LE(16);
1540
- if (diskNumber !== 0) {
1541
- return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
1542
- }
1543
- entryCount = readUInt64LE(zip64EocdrBuffer, 32);
1544
- centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
1545
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
1546
- });
1547
- }
1548
- if (diskNumber !== 0) {
1549
- return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
1550
- }
1551
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
1552
- }
1553
- callback(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
1554
- });
1555
- }
1556
- util.inherits(ZipFile, EventEmitter);
1557
- function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
1558
- var self = this;
1559
- EventEmitter.call(self);
1560
- self.reader = reader;
1561
- self.reader.on("error", function(err) {
1562
- emitError(self, err);
1563
- });
1564
- self.reader.once("close", function() {
1565
- self.emit("close");
1566
- });
1567
- self.readEntryCursor = centralDirectoryOffset;
1568
- self.fileSize = fileSize;
1569
- self.entryCount = entryCount;
1570
- self.comment = comment;
1571
- self.entriesRead = 0;
1572
- self.autoClose = !!autoClose;
1573
- self.lazyEntries = !!lazyEntries;
1574
- self.decodeStrings = !!decodeStrings;
1575
- self.validateEntrySizes = !!validateEntrySizes;
1576
- self.strictFileNames = !!strictFileNames;
1577
- self.isOpen = true;
1578
- self.emittedError = false;
1579
- if (!self.lazyEntries) self._readEntry();
1580
- }
1581
- ZipFile.prototype.close = function() {
1582
- if (!this.isOpen) return;
1583
- this.isOpen = false;
1584
- this.reader.unref();
1585
- };
1586
- function emitErrorAndAutoClose(self, err) {
1587
- if (self.autoClose) self.close();
1588
- emitError(self, err);
1589
- }
1590
- function emitError(self, err) {
1591
- if (self.emittedError) return;
1592
- self.emittedError = true;
1593
- self.emit("error", err);
1594
- }
1595
- ZipFile.prototype.readEntry = function() {
1596
- if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
1597
- this._readEntry();
1598
- };
1599
- ZipFile.prototype._readEntry = function() {
1600
- var self = this;
1601
- if (self.entryCount === self.entriesRead) {
1602
- setImmediate(function() {
1603
- if (self.autoClose) self.close();
1604
- if (self.emittedError) return;
1605
- self.emit("end");
1606
- });
1607
- return;
1608
- }
1609
- if (self.emittedError) return;
1610
- var buffer = newBuffer(46);
1611
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
1612
- if (err) return emitErrorAndAutoClose(self, err);
1613
- if (self.emittedError) return;
1614
- var entry = new Entry();
1615
- var signature = buffer.readUInt32LE(0);
1616
- if (signature !== 33639248) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
1617
- entry.versionMadeBy = buffer.readUInt16LE(4);
1618
- entry.versionNeededToExtract = buffer.readUInt16LE(6);
1619
- entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
1620
- entry.compressionMethod = buffer.readUInt16LE(10);
1621
- entry.lastModFileTime = buffer.readUInt16LE(12);
1622
- entry.lastModFileDate = buffer.readUInt16LE(14);
1623
- entry.crc32 = buffer.readUInt32LE(16);
1624
- entry.compressedSize = buffer.readUInt32LE(20);
1625
- entry.uncompressedSize = buffer.readUInt32LE(24);
1626
- entry.fileNameLength = buffer.readUInt16LE(28);
1627
- entry.extraFieldLength = buffer.readUInt16LE(30);
1628
- entry.fileCommentLength = buffer.readUInt16LE(32);
1629
- entry.internalFileAttributes = buffer.readUInt16LE(36);
1630
- entry.externalFileAttributes = buffer.readUInt32LE(38);
1631
- entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
1632
- if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
1633
- self.readEntryCursor += 46;
1634
- buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
1635
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
1636
- if (err2) return emitErrorAndAutoClose(self, err2);
1637
- if (self.emittedError) return;
1638
- entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
1639
- var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
1640
- entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
1641
- entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
1642
- try {
1643
- entry.extraFields = parseExtraFields(entry.extraFieldRaw);
1644
- } catch (err3) {
1645
- return emitErrorAndAutoClose(self, err3);
1646
- }
1647
- if (self.decodeStrings) {
1648
- var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
1649
- entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
1650
- entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
1651
- var errorMessage = validateFileName(entry.fileName);
1652
- if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
1653
- } else {
1654
- entry.fileComment = entry.fileCommentRaw;
1655
- entry.fileName = entry.fileNameRaw;
1656
- }
1657
- entry.comment = entry.fileComment;
1658
- self.readEntryCursor += buffer.length;
1659
- self.entriesRead += 1;
1660
- for (var i = 0; i < entry.extraFields.length; i++) {
1661
- var extraField = entry.extraFields[i];
1662
- if (extraField.id !== 1) continue;
1663
- var zip64EiefBuffer = extraField.data;
1664
- var index = 0;
1665
- if (entry.uncompressedSize === 4294967295) {
1666
- if (index + 8 > zip64EiefBuffer.length) {
1667
- return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
1668
- }
1669
- entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
1670
- index += 8;
1671
- }
1672
- if (entry.compressedSize === 4294967295) {
1673
- if (index + 8 > zip64EiefBuffer.length) {
1674
- return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
1675
- }
1676
- entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
1677
- index += 8;
1678
- }
1679
- if (entry.relativeOffsetOfLocalHeader === 4294967295) {
1680
- if (index + 8 > zip64EiefBuffer.length) {
1681
- return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
1682
- }
1683
- entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
1684
- index += 8;
1685
- }
1686
- break;
1687
- }
1688
- if (self.validateEntrySizes && entry.compressionMethod === 0) {
1689
- var expectedCompressedSize = entry.uncompressedSize;
1690
- if (entry.isEncrypted()) {
1691
- expectedCompressedSize += 12;
1692
- }
1693
- if (entry.compressedSize !== expectedCompressedSize) {
1694
- var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
1695
- return emitErrorAndAutoClose(self, new Error(msg));
1696
- }
1697
- }
1698
- self.emit("entry", entry);
1699
- if (!self.lazyEntries) self._readEntry();
1700
- });
1701
- });
1702
- };
1703
- ZipFile.prototype.openReadStream = function(entry, options2, callback) {
1704
- var self = this;
1705
- var relativeStart = 0;
1706
- var relativeEnd = entry.compressedSize;
1707
- if (callback == null) {
1708
- callback = options2;
1709
- options2 = null;
1710
- }
1711
- if (options2 == null) {
1712
- options2 = {};
1713
- } else {
1714
- if (options2.decrypt != null) {
1715
- if (!entry.isEncrypted()) {
1716
- throw new Error("options.decrypt can only be specified for encrypted entries");
1717
- }
1718
- if (options2.decrypt !== false) throw new Error("invalid options.decrypt value: " + options2.decrypt);
1719
- if (entry.isCompressed()) {
1720
- if (options2.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
1721
- }
1722
- }
1723
- if (options2.decompress != null) {
1724
- if (!entry.isCompressed()) {
1725
- throw new Error("options.decompress can only be specified for compressed entries");
1726
- }
1727
- if (!(options2.decompress === false || options2.decompress === true)) {
1728
- throw new Error("invalid options.decompress value: " + options2.decompress);
1729
- }
1730
- }
1731
- if (options2.start != null || options2.end != null) {
1732
- if (entry.isCompressed() && options2.decompress !== false) {
1733
- throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
1734
- }
1735
- if (entry.isEncrypted() && options2.decrypt !== false) {
1736
- throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
1737
- }
1738
- }
1739
- if (options2.start != null) {
1740
- relativeStart = options2.start;
1741
- if (relativeStart < 0) throw new Error("options.start < 0");
1742
- if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
1743
- }
1744
- if (options2.end != null) {
1745
- relativeEnd = options2.end;
1746
- if (relativeEnd < 0) throw new Error("options.end < 0");
1747
- if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
1748
- if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
1749
- }
1750
- }
1751
- if (!self.isOpen) return callback(new Error("closed"));
1752
- if (entry.isEncrypted()) {
1753
- if (options2.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
1754
- }
1755
- var decompress;
1756
- if (entry.compressionMethod === 0) {
1757
- decompress = false;
1758
- } else if (entry.compressionMethod === 8) {
1759
- decompress = options2.decompress != null ? options2.decompress : true;
1760
- } else {
1761
- return callback(new Error("unsupported compression method: " + entry.compressionMethod));
1762
- }
1763
- self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
1764
- if (err) return callback(err);
1765
- self.openReadStreamLowLevel(
1766
- localFileHeader.fileDataStart,
1767
- entry.compressedSize,
1768
- relativeStart,
1769
- relativeEnd,
1770
- decompress,
1771
- entry.uncompressedSize,
1772
- callback
1773
- );
1774
- });
1775
- };
1776
- ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
1777
- var self = this;
1778
- var fileDataEnd = fileDataStart + compressedSize;
1779
- var readStream = self.reader.createReadStream({
1780
- start: fileDataStart + relativeStart,
1781
- end: fileDataStart + relativeEnd
1782
- });
1783
- var endpointStream = readStream;
1784
- if (decompress) {
1785
- var destroyed = false;
1786
- var inflateFilter = zlib.createInflateRaw();
1787
- readStream.on("error", function(err) {
1788
- setImmediate(function() {
1789
- if (!destroyed) inflateFilter.emit("error", err);
1790
- });
1791
- });
1792
- readStream.pipe(inflateFilter);
1793
- if (self.validateEntrySizes) {
1794
- endpointStream = new AssertByteCountStream(uncompressedSize);
1795
- inflateFilter.on("error", function(err) {
1796
- setImmediate(function() {
1797
- if (!destroyed) endpointStream.emit("error", err);
1798
- });
1799
- });
1800
- inflateFilter.pipe(endpointStream);
1801
- } else {
1802
- endpointStream = inflateFilter;
1803
- }
1804
- installDestroyFn(endpointStream, function() {
1805
- destroyed = true;
1806
- if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
1807
- readStream.unpipe(inflateFilter);
1808
- readStream.destroy();
1809
- });
1810
- }
1811
- callback(null, endpointStream);
1812
- };
1813
- ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
1814
- var self = this;
1815
- if (callback == null) {
1816
- callback = options2;
1817
- options2 = null;
1818
- }
1819
- if (options2 == null) options2 = {};
1820
- self.reader.ref();
1821
- var buffer = newBuffer(30);
1822
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
1823
- try {
1824
- if (err) return callback(err);
1825
- var signature = buffer.readUInt32LE(0);
1826
- if (signature !== 67324752) {
1827
- return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
1828
- }
1829
- var fileNameLength = buffer.readUInt16LE(26);
1830
- var extraFieldLength = buffer.readUInt16LE(28);
1831
- var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
1832
- if (fileDataStart + entry.compressedSize > self.fileSize) {
1833
- return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
1834
- }
1835
- if (options2.minimal) {
1836
- return callback(null, { fileDataStart });
1837
- }
1838
- var localFileHeader = new LocalFileHeader();
1839
- localFileHeader.fileDataStart = fileDataStart;
1840
- localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
1841
- localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
1842
- localFileHeader.compressionMethod = buffer.readUInt16LE(8);
1843
- localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
1844
- localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
1845
- localFileHeader.crc32 = buffer.readUInt32LE(14);
1846
- localFileHeader.compressedSize = buffer.readUInt32LE(18);
1847
- localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
1848
- localFileHeader.fileNameLength = fileNameLength;
1849
- localFileHeader.extraFieldLength = extraFieldLength;
1850
- buffer = newBuffer(fileNameLength + extraFieldLength);
1851
- self.reader.ref();
1852
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
1853
- try {
1854
- if (err2) return callback(err2);
1855
- localFileHeader.fileName = buffer.subarray(0, fileNameLength);
1856
- localFileHeader.extraField = buffer.subarray(fileNameLength);
1857
- return callback(null, localFileHeader);
1858
- } finally {
1859
- self.reader.unref();
1860
- }
1861
- });
1862
- } finally {
1863
- self.reader.unref();
1864
- }
1865
- });
1866
- };
1867
- function Entry() {
1868
- }
1869
- Entry.prototype.getLastModDate = function(options2) {
1870
- if (options2 == null) options2 = {};
1871
- if (!options2.forceDosFormat) {
1872
- for (var i = 0; i < this.extraFields.length; i++) {
1873
- var extraField = this.extraFields[i];
1874
- if (extraField.id === 21589) {
1875
- var data = extraField.data;
1876
- if (data.length < 5) continue;
1877
- var flags = data[0];
1878
- var HAS_MTIME = 1;
1879
- if (!(flags & HAS_MTIME)) continue;
1880
- var posixTimestamp = data.readInt32LE(1);
1881
- return new Date(posixTimestamp * 1e3);
1882
- } else if (extraField.id === 10) {
1883
- var data = extraField.data;
1884
- var cursor = 4;
1885
- while (cursor < data.length + 4) {
1886
- var tag = data.readUInt16LE(cursor);
1887
- cursor += 2;
1888
- var size = data.readUInt16LE(cursor);
1889
- cursor += 2;
1890
- if (tag !== 1) {
1891
- cursor += size;
1892
- continue;
1893
- }
1894
- if (size < 8 || cursor + size > data.length) break;
1895
- var hundredNanoSecondsSince1601 = 4294967296 * data.readInt32LE(cursor + 4) + data.readUInt32LE(cursor);
1896
- var millisecondsSince1970 = hundredNanoSecondsSince1601 / 1e4 - 116444736e5;
1897
- return new Date(millisecondsSince1970);
1898
- }
1899
- }
1900
- }
1901
- }
1902
- return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options2.timezone);
1903
- };
1904
- Entry.prototype.isEncrypted = function() {
1905
- return (this.generalPurposeBitFlag & 1) !== 0;
1906
- };
1907
- Entry.prototype.isCompressed = function() {
1908
- return this.compressionMethod === 8;
1909
- };
1910
- function LocalFileHeader() {
1911
- }
1912
- function dosDateTimeToDate(date, time, timezone) {
1913
- var day = date & 31;
1914
- var month = (date >> 5 & 15) - 1;
1915
- var year = (date >> 9 & 127) + 1980;
1916
- var millisecond = 0;
1917
- var second = (time & 31) * 2;
1918
- var minute = time >> 5 & 63;
1919
- var hour = time >> 11 & 31;
1920
- if (timezone == null || timezone === "local") {
1921
- return new Date(year, month, day, hour, minute, second, millisecond);
1922
- } else if (timezone === "UTC") {
1923
- return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
1924
- } else {
1925
- throw new Error("unrecognized options.timezone: " + options.timezone);
1926
- }
1927
- }
1928
- function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
1929
- var fileName = null;
1930
- for (var i = 0; i < extraFields.length; i++) {
1931
- var extraField = extraFields[i];
1932
- if (extraField.id === 28789) {
1933
- if (extraField.data.length < 6) {
1934
- continue;
1935
- }
1936
- if (extraField.data.readUInt8(0) !== 1) {
1937
- continue;
1938
- }
1939
- var oldNameCrc32 = extraField.data.readUInt32LE(1);
1940
- if (crc32.unsigned(fileNameBuffer) !== oldNameCrc32) {
1941
- continue;
1942
- }
1943
- fileName = decodeBuffer(extraField.data.subarray(5), true);
1944
- break;
1945
- }
1946
- }
1947
- if (fileName == null) {
1948
- var isUtf8 = (generalPurposeBitFlag & 2048) !== 0;
1949
- fileName = decodeBuffer(fileNameBuffer, isUtf8);
1950
- }
1951
- if (!strictFileNames) {
1952
- fileName = fileName.replace(/\\/g, "/");
1953
- }
1954
- return fileName;
1955
- }
1956
- function validateFileName(fileName) {
1957
- if (fileName.indexOf("\\") !== -1) {
1958
- return "invalid characters in fileName: " + fileName;
1959
- }
1960
- if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
1961
- return "absolute path: " + fileName;
1962
- }
1963
- if (fileName.split("/").indexOf("..") !== -1) {
1964
- return "invalid relative path: " + fileName;
1965
- }
1966
- return null;
1967
- }
1968
- function parseExtraFields(extraFieldBuffer) {
1969
- var extraFields = [];
1970
- var i = 0;
1971
- while (i < extraFieldBuffer.length - 3) {
1972
- var headerId = extraFieldBuffer.readUInt16LE(i + 0);
1973
- var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
1974
- var dataStart = i + 4;
1975
- var dataEnd = dataStart + dataSize;
1976
- if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
1977
- var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
1978
- extraFields.push({
1979
- id: headerId,
1980
- data: dataBuffer
1981
- });
1982
- i = dataEnd;
1983
- }
1984
- return extraFields;
1985
- }
1986
- function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
1987
- if (length === 0) {
1988
- return setImmediate(function() {
1989
- callback(null, newBuffer(0));
1990
- });
1991
- }
1992
- reader.read(buffer, offset, length, position, function(err, bytesRead) {
1993
- if (err) return callback(err);
1994
- if (bytesRead < length) {
1995
- return callback(new Error("unexpected EOF"));
1996
- }
1997
- callback();
1998
- });
1999
- }
2000
- util.inherits(AssertByteCountStream, Transform);
2001
- function AssertByteCountStream(byteCount) {
2002
- Transform.call(this);
2003
- this.actualByteCount = 0;
2004
- this.expectedByteCount = byteCount;
2005
- }
2006
- AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
2007
- this.actualByteCount += chunk.length;
2008
- if (this.actualByteCount > this.expectedByteCount) {
2009
- var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
2010
- return cb(new Error(msg));
2011
- }
2012
- cb(null, chunk);
2013
- };
2014
- AssertByteCountStream.prototype._flush = function(cb) {
2015
- if (this.actualByteCount < this.expectedByteCount) {
2016
- var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
2017
- return cb(new Error(msg));
2018
- }
2019
- cb();
2020
- };
2021
- util.inherits(RandomAccessReader, EventEmitter);
2022
- function RandomAccessReader() {
2023
- EventEmitter.call(this);
2024
- this.refCount = 0;
2025
- }
2026
- RandomAccessReader.prototype.ref = function() {
2027
- this.refCount += 1;
2028
- };
2029
- RandomAccessReader.prototype.unref = function() {
2030
- var self = this;
2031
- self.refCount -= 1;
2032
- if (self.refCount > 0) return;
2033
- if (self.refCount < 0) throw new Error("invalid unref");
2034
- self.close(onCloseDone);
2035
- function onCloseDone(err) {
2036
- if (err) return self.emit("error", err);
2037
- self.emit("close");
2038
- }
2039
- };
2040
- RandomAccessReader.prototype.createReadStream = function(options2) {
2041
- if (options2 == null) options2 = {};
2042
- var start = options2.start;
2043
- var end = options2.end;
2044
- if (start === end) {
2045
- var emptyStream = new PassThrough();
2046
- setImmediate(function() {
2047
- emptyStream.end();
2048
- });
2049
- return emptyStream;
2050
- }
2051
- var stream = this._readStreamForRange(start, end);
2052
- var destroyed = false;
2053
- var refUnrefFilter = new RefUnrefFilter(this);
2054
- stream.on("error", function(err) {
2055
- setImmediate(function() {
2056
- if (!destroyed) refUnrefFilter.emit("error", err);
2057
- });
2058
- });
2059
- installDestroyFn(refUnrefFilter, function() {
2060
- stream.unpipe(refUnrefFilter);
2061
- refUnrefFilter.unref();
2062
- stream.destroy();
2063
- });
2064
- var byteCounter = new AssertByteCountStream(end - start);
2065
- refUnrefFilter.on("error", function(err) {
2066
- setImmediate(function() {
2067
- if (!destroyed) byteCounter.emit("error", err);
2068
- });
2069
- });
2070
- installDestroyFn(byteCounter, function() {
2071
- destroyed = true;
2072
- refUnrefFilter.unpipe(byteCounter);
2073
- refUnrefFilter.destroy();
2074
- });
2075
- return stream.pipe(refUnrefFilter).pipe(byteCounter);
2076
- };
2077
- RandomAccessReader.prototype._readStreamForRange = function(start, end) {
2078
- throw new Error("not implemented");
2079
- };
2080
- RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
2081
- var readStream = this.createReadStream({ start: position, end: position + length });
2082
- var writeStream = new Writable();
2083
- var written = 0;
2084
- writeStream._write = function(chunk, encoding, cb) {
2085
- chunk.copy(buffer, offset + written, 0, chunk.length);
2086
- written += chunk.length;
2087
- cb();
2088
- };
2089
- writeStream.on("finish", callback);
2090
- readStream.on("error", function(error) {
2091
- callback(error);
2092
- });
2093
- readStream.pipe(writeStream);
2094
- };
2095
- RandomAccessReader.prototype.close = function(callback) {
2096
- setImmediate(callback);
2097
- };
2098
- util.inherits(RefUnrefFilter, PassThrough);
2099
- function RefUnrefFilter(context) {
2100
- PassThrough.call(this);
2101
- this.context = context;
2102
- this.context.ref();
2103
- this.unreffedYet = false;
2104
- }
2105
- RefUnrefFilter.prototype._flush = function(cb) {
2106
- this.unref();
2107
- cb();
2108
- };
2109
- RefUnrefFilter.prototype.unref = function(cb) {
2110
- if (this.unreffedYet) return;
2111
- this.unreffedYet = true;
2112
- this.context.unref();
2113
- };
2114
- var cp437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
2115
- function decodeBuffer(buffer, isUtf8) {
2116
- if (isUtf8) {
2117
- return buffer.toString("utf8");
2118
- } else {
2119
- var result = "";
2120
- for (var i = 0; i < buffer.length; i++) {
2121
- result += cp437[buffer[i]];
2122
- }
2123
- return result;
2124
- }
2125
- }
2126
- function readUInt64LE(buffer, offset) {
2127
- var lower32 = buffer.readUInt32LE(offset);
2128
- var upper32 = buffer.readUInt32LE(offset + 4);
2129
- return upper32 * 4294967296 + lower32;
2130
- }
2131
- var newBuffer;
2132
- if (typeof Buffer.allocUnsafe === "function") {
2133
- newBuffer = function(len) {
2134
- return Buffer.allocUnsafe(len);
2135
- };
2136
- } else {
2137
- newBuffer = function(len) {
2138
- return new Buffer(len);
2139
- };
2140
- }
2141
- function installDestroyFn(stream, fn) {
2142
- if (typeof stream.destroy === "function") {
2143
- stream._destroy = function(err, cb) {
2144
- fn();
2145
- if (cb != null) cb(err);
2146
- };
2147
- } else {
2148
- stream.destroy = fn;
2149
- }
2150
- }
2151
- function defaultCallback(err) {
2152
- if (err) throw err;
2153
- }
2154
- }
2155
- });
2156
-
2157
776
  // src/index.ts
2158
777
  init_esm_shims();
2159
778
  import { Cli } from "clipanion";
2160
779
 
2161
780
  // src/DeployCommand.ts
2162
781
  init_esm_shims();
2163
- var import_debug2 = __toESM(require_src(), 1);
782
+ var import_debug3 = __toESM(require_src(), 1);
2164
783
  var import_picocolors = __toESM(require_picocolors(), 1);
2165
784
  import assert from "assert";
2166
- import fs3 from "fs";
2167
- import path2 from "path";
785
+ import fs2 from "fs";
786
+ import path from "path";
2168
787
  import * as p from "@clack/prompts";
788
+ import { getPackageRoot, readZipContent } from "@granite-js/utils";
2169
789
  import { Command, Option } from "clipanion";
2170
790
 
2171
791
  // src/utils/constants.ts
@@ -2173,66 +793,33 @@ init_esm_shims();
2173
793
  var APP_MANIFEST_NAME = "app.json";
2174
794
  var DEFAULT_API_BASE_URL = "https://apps-in-toss.toss.im/console";
2175
795
 
2176
- // src/utils/getPackageRoot.ts
796
+ // src/utils/upload.ts
2177
797
  init_esm_shims();
798
+ var import_debug2 = __toESM(require_src(), 1);
2178
799
  import fs from "fs";
2179
- import path from "path";
2180
- function getPackageRoot() {
2181
- let cwd = process.cwd();
2182
- const root = path.parse(cwd).root;
2183
- while (cwd !== root) {
2184
- if (fs.existsSync(path.join(cwd, "package.json"))) {
2185
- return cwd;
2186
- }
2187
- cwd = path.dirname(cwd);
2188
- }
2189
- return cwd;
2190
- }
2191
800
 
2192
- // src/utils/readZipContent.ts
801
+ // src/utils/handleFetchResponse.ts
2193
802
  init_esm_shims();
2194
- var import_yauzl = __toESM(require_yauzl(), 1);
2195
- function readZipContent(zipPath, fileName) {
2196
- return new Promise((resolve, reject) => {
2197
- import_yauzl.default.open(zipPath, { lazyEntries: true }, (error, zipFile) => {
2198
- if (error) {
2199
- reject(error);
2200
- return;
2201
- }
2202
- zipFile.on("entry", (entry) => {
2203
- if (entry.fileName === fileName) {
2204
- zipFile.openReadStream(entry, (error2, readStream) => {
2205
- if (error2) {
2206
- throw error2;
2207
- }
2208
- let fileData = "";
2209
- readStream.on("data", (chunk) => fileData += chunk.toString("utf8")).on("end", () => {
2210
- zipFile.close();
2211
- resolve(fileData);
2212
- });
2213
- });
2214
- } else {
2215
- zipFile.readEntry();
2216
- }
2217
- }).on("end", () => {
2218
- zipFile.close();
2219
- reject(new Error(`'${fileName}' not found in zip file`));
2220
- }).on("error", (error2) => {
2221
- zipFile.close();
2222
- reject(error2);
2223
- });
2224
- zipFile.readEntry();
2225
- });
2226
- });
803
+ var import_debug = __toESM(require_src(), 1);
804
+ var debug = (0, import_debug.default)("api");
805
+ async function handleFetchResponse(response) {
806
+ debug(`Response ${response.status} ${response.statusText}`);
807
+ if (!response.ok) {
808
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
809
+ }
810
+ const data = await response.clone().json();
811
+ debug("response", data);
812
+ if (data.resultType !== "SUCCESS") {
813
+ const errorCode = data?.error?.errorCode ?? "-1";
814
+ const errorReason = data?.error.reason ?? "unknown";
815
+ throw new Error(`${errorReason} (Code: ${errorCode})`);
816
+ }
2227
817
  }
2228
818
 
2229
819
  // src/utils/upload.ts
2230
- init_esm_shims();
2231
- var import_debug = __toESM(require_src(), 1);
2232
- import fs2 from "fs";
2233
- var debug = (0, import_debug.default)("cli:deploy");
820
+ var debug2 = (0, import_debug2.default)("cli:deploy");
2234
821
  async function uploadArtifact(config) {
2235
- debug("uploadArtifact", config);
822
+ debug2("uploadArtifact", config);
2236
823
  const baseUrl = config.baseUrl ?? DEFAULT_API_BASE_URL;
2237
824
  const response = await fetch(
2238
825
  `${baseUrl}/api-public/v3/appsintossconsole/bundles/${config.appName}/deployments/${config.deploymentId}/upload`,
@@ -2242,28 +829,15 @@ async function uploadArtifact(config) {
2242
829
  "Content-Type": "application/octet-stream",
2243
830
  "X-Ait-Console-Api-Key": config.apiKey
2244
831
  },
2245
- body: fs2.createReadStream(config.artifactPath),
832
+ body: fs.createReadStream(config.artifactPath),
2246
833
  duplex: "half"
2247
834
  }
2248
835
  );
2249
- return handleResponse(response);
2250
- }
2251
- async function handleResponse(response) {
2252
- debug(`Response ${response.status} ${response.statusText}`);
2253
- if (!response.ok) {
2254
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
2255
- }
2256
- const data = await response.clone().json();
2257
- debug("uploadArtifact response", data);
2258
- if (data.resultType !== "SUCCESS") {
2259
- const errorCode = data?.error?.errorCode ?? "-1";
2260
- const errorReason = data?.error.reason ?? "unknown";
2261
- throw new Error(`${errorReason} (Code: ${errorCode})`);
2262
- }
836
+ return handleFetchResponse(response);
2263
837
  }
2264
838
 
2265
839
  // src/DeployCommand.ts
2266
- var debug2 = (0, import_debug2.default)("cli:deploy");
840
+ var debug3 = (0, import_debug3.default)("cli:deploy");
2267
841
  var DeployCommand = class extends Command {
2268
842
  static paths = [["deploy"]];
2269
843
  apiKey = Option.String("--api-key", {
@@ -2289,11 +863,11 @@ var DeployCommand = class extends Command {
2289
863
  }
2290
864
  try {
2291
865
  const packageRoot = getPackageRoot();
2292
- const artifactFile = fs3.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
866
+ const artifactFile = fs2.readdirSync(packageRoot).find((file) => file.endsWith(".ait"));
2293
867
  if (!artifactFile) {
2294
868
  throw new Error("\uBC30\uD3EC\uD560 .ait \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
2295
869
  }
2296
- const resolvedArtifactPath = path2.resolve(packageRoot, artifactFile);
870
+ const resolvedArtifactPath = path.resolve(packageRoot, artifactFile);
2297
871
  const { appName, deploymentId } = await readZipContent(resolvedArtifactPath, APP_MANIFEST_NAME).then((rawAppManifest) => {
2298
872
  const appManifest = JSON.parse(rawAppManifest);
2299
873
  const appName2 = appManifest.appName;
@@ -2302,7 +876,7 @@ var DeployCommand = class extends Command {
2302
876
  assert(typeof deploymentId2 === "string", "invalid deploymentId");
2303
877
  return { appName: appName2, deploymentId: deploymentId2 };
2304
878
  }).catch((error) => {
2305
- debug2("invalid ait file", error);
879
+ debug3("invalid ait file", error);
2306
880
  throw new Error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 ait \uD30C\uC77C\uC785\uB2C8\uB2E4");
2307
881
  });
2308
882
  const colorAppName = import_picocolors.default.underline(import_picocolors.default.cyan(appName));
@@ -2335,9 +909,10 @@ var DeployCommand = class extends Command {
2335
909
 
2336
910
  // src/InitCommand.ts
2337
911
  init_esm_shims();
2338
- import fs4 from "fs";
2339
- import path3 from "path";
912
+ import fs3 from "fs";
913
+ import path2 from "path";
2340
914
  import * as p2 from "@clack/prompts";
915
+ import { getPackageRoot as getPackageRoot2 } from "@granite-js/utils";
2341
916
  import { Command as Command2, Option as Option2 } from "clipanion";
2342
917
 
2343
918
  // ../../.yarn/cache/es-toolkit-npm-1.32.0-019fc7c155-56ba965570.zip/node_modules/es-toolkit/dist/index.mjs
@@ -2382,9 +957,10 @@ export default defineConfig({
2382
957
  });
2383
958
  `;
2384
959
  var REACT_NATIVE_FRAMEWORK_CONFIG_TEMPLATE = `import { appsInToss } from '@apps-in-toss/framework/plugins';
2385
- import { defineConfig } from 'react-native-bedrock/config';
960
+ import { defineConfig } from '@granite-js/react-native/config';
2386
961
 
2387
962
  export default defineConfig({
963
+ scheme: 'intoss',
2388
964
  appName: '%%appName%%',
2389
965
  plugins: [
2390
966
  appsInToss({
@@ -2401,7 +977,7 @@ export default defineConfig({
2401
977
  `;
2402
978
  var APP_TEMPLATE = `import { AppsInToss } from '@apps-in-toss/framework';
2403
979
  import { PropsWithChildren } from 'react';
2404
- import { InitialProps } from 'react-native-bedrock';
980
+ import { InitialProps } from '@granite-js/react-native';
2405
981
  import { context } from '../require.context';
2406
982
 
2407
983
  function AppContainer({ children }: PropsWithChildren<InitialProps>) {
@@ -2436,7 +1012,7 @@ function transformTemplate(templateString, values) {
2436
1012
 
2437
1013
  // src/InitCommand.ts
2438
1014
  async function templateWebFramework({ appName, cwd, skipInput }) {
2439
- const packageJson = await fs4.promises.readFile(path3.join(cwd, "package.json"), {
1015
+ const packageJson = await fs3.promises.readFile(path2.join(cwd, "package.json"), {
2440
1016
  encoding: "utf-8"
2441
1017
  });
2442
1018
  const scripts = JSON.parse(packageJson);
@@ -2444,17 +1020,17 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
2444
1020
  dev: scripts?.scripts?.dev || scripts?.scripts?.start,
2445
1021
  build: scripts?.scripts?.build
2446
1022
  };
2447
- scripts.scripts.dev = "bedrock dev";
2448
- scripts.scripts.build = "bedrock build";
1023
+ scripts.scripts.dev = "granite dev";
1024
+ scripts.scripts.build = "granite build";
2449
1025
  scripts.scripts.deploy = "ait deploy";
2450
- await fs4.promises.writeFile(path3.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
1026
+ await fs3.promises.writeFile(path2.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
2451
1027
  encoding: "utf-8"
2452
1028
  });
2453
1029
  p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
2454
- await fs4.promises.appendFile(path3.join(cwd, ".gitignore"), "\n.bedrock\n");
1030
+ await fs3.promises.appendFile(path2.join(cwd, ".gitignore"), "\n.granite\n");
2455
1031
  const placeholder = {
2456
- dev: originalScripts.dev === "bedrock dev" ? "" : originalScripts.dev,
2457
- build: originalScripts.build === "bedrock build" ? "" : originalScripts.build
1032
+ dev: originalScripts.dev === "granite dev" ? "" : originalScripts.dev,
1033
+ build: originalScripts.build === "granite build" ? "" : originalScripts.build
2458
1034
  };
2459
1035
  const scriptInputs = skipInput ? placeholder : await p2.group(
2460
1036
  {
@@ -2475,7 +1051,7 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
2475
1051
  }
2476
1052
  }
2477
1053
  );
2478
- p2.log.step("bedrock.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
1054
+ p2.log.step("granite.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
2479
1055
  const webPort = skipInput ? "5173" : await p2.text({
2480
1056
  message: "Enter web port",
2481
1057
  placeholder: "5173",
@@ -2488,23 +1064,23 @@ async function templateWebFramework({ appName, cwd, skipInput }) {
2488
1064
  const config = transformTemplate(WEB_FRAMEWORK_CONFIG_TEMPLATE, {
2489
1065
  appName,
2490
1066
  webPort,
2491
- webDevCommand: scriptInputs.dev === "bedrock dev" ? "" : scriptInputs.dev,
2492
- webBuildCommand: scriptInputs.build === "bedrock build" ? "" : scriptInputs.build
1067
+ webDevCommand: scriptInputs.dev === "granite dev" ? "" : scriptInputs.dev,
1068
+ webBuildCommand: scriptInputs.build === "granite build" ? "" : scriptInputs.build
2493
1069
  });
2494
- await fs4.promises.writeFile(path3.join(cwd, "bedrock.config.ts"), config, {
1070
+ await fs3.promises.writeFile(path2.join(cwd, "granite.config.ts"), config, {
2495
1071
  encoding: "utf-8"
2496
1072
  });
2497
1073
  }
2498
1074
  async function templateReactNative({ appName, cwd }) {
2499
- p2.log.step("bedrock.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
1075
+ p2.log.step("granite.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
2500
1076
  const config = transformTemplate(REACT_NATIVE_FRAMEWORK_CONFIG_TEMPLATE, {
2501
1077
  appName
2502
1078
  });
2503
- await fs4.promises.writeFile(path3.join(cwd, "bedrock.config.ts"), config, {
1079
+ await fs3.promises.writeFile(path2.join(cwd, "granite.config.ts"), config, {
2504
1080
  encoding: "utf-8"
2505
1081
  });
2506
1082
  p2.log.step("src/_app.tsx \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
2507
- await fs4.promises.writeFile(path3.join(cwd, "src", "_app.tsx"), APP_TEMPLATE, {
1083
+ await fs3.promises.writeFile(path2.join(cwd, "src", "_app.tsx"), APP_TEMPLATE, {
2508
1084
  encoding: "utf-8"
2509
1085
  });
2510
1086
  }
@@ -2526,8 +1102,8 @@ var InitCommand = class extends Command2 {
2526
1102
  },
2527
1103
  {
2528
1104
  value: "react-native",
2529
- label: "React Native \uD504\uB808\uC784\uC6CC\uD06C (Bedrock)",
2530
- hint: "Bedrock \uD504\uB85C\uC81D\uD2B8\uC5D0 \uC571\uC778\uD1A0\uC2A4 React Native\uC6A9 \uAC1C\uBC1C\uD658\uACBD\uC744 \uC138\uD305\uD569\uB2C8\uB2E4."
1105
+ label: "React Native \uD504\uB808\uC784\uC6CC\uD06C (Granite)",
1106
+ hint: "Granite \uD504\uB85C\uC81D\uD2B8\uC5D0 \uC571\uC778\uD1A0\uC2A4 React Native\uC6A9 \uAC1C\uBC1C\uD658\uACBD\uC744 \uC138\uD305\uD569\uB2C8\uB2E4."
2531
1107
  }
2532
1108
  ]
2533
1109
  })
@@ -2535,7 +1111,7 @@ var InitCommand = class extends Command2 {
2535
1111
  if (p2.isCancel(template)) {
2536
1112
  process.exit(0);
2537
1113
  }
2538
- const cwd = getPackageRoot();
1114
+ const cwd = getPackageRoot2();
2539
1115
  p2.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
2540
1116
  const appName = await ensureSelect({
2541
1117
  value: this.appName,
@@ -2579,6 +1155,267 @@ var InitCommand = class extends Command2 {
2579
1155
  }
2580
1156
  };
2581
1157
 
1158
+ // src/integrations/UploadSentrySourcemap/index.ts
1159
+ init_esm_shims();
1160
+
1161
+ // src/integrations/UploadSentrySourcemap/UploadSentrySourcemap.ts
1162
+ init_esm_shims();
1163
+ import * as fs7 from "fs/promises";
1164
+ import * as p3 from "@clack/prompts";
1165
+ import { Command as Command3, Option as Option3 } from "clipanion";
1166
+
1167
+ // src/integrations/UploadSentrySourcemap/downloadArtifacts.ts
1168
+ init_esm_shims();
1169
+ var import_debug4 = __toESM(require_src(), 1);
1170
+ import * as fs4 from "fs";
1171
+ import * as os from "os";
1172
+ import * as path3 from "path";
1173
+ import { pipeline } from "stream";
1174
+ import { promisify } from "util";
1175
+ var debug4 = (0, import_debug4.default)("integrations:sentry");
1176
+ var streamPipeline = promisify(pipeline);
1177
+ async function downloadArtifacts(options) {
1178
+ const { appName, deploymentId, apiKey, baseUrl = DEFAULT_API_BASE_URL } = options;
1179
+ const params = new URLSearchParams({
1180
+ appName,
1181
+ deploymentId
1182
+ });
1183
+ const requestUrl = `${baseUrl}/api-public/v3/openapi/bundles/download?${params.toString()}`;
1184
+ debug4("Request URL", { requestUrl });
1185
+ const response = await fetch(`${baseUrl}/api-public/v3/openapi/bundles/download?${params.toString()}`, {
1186
+ method: "GET",
1187
+ headers: {
1188
+ "Content-Type": "application/json",
1189
+ Authorization: `Bearer ${apiKey}`
1190
+ }
1191
+ });
1192
+ if (!response.ok) {
1193
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
1194
+ }
1195
+ if (response.body == null) {
1196
+ throw new Error("No response body");
1197
+ }
1198
+ const tmpDir = await createTempDirectory();
1199
+ const tmpFile = `${deploymentId}.zip`;
1200
+ const tmpFilePath = path3.join(tmpDir.path, tmpFile);
1201
+ const fileStream = fs4.createWriteStream(tmpFilePath);
1202
+ await streamPipeline(response.body, fileStream);
1203
+ debug4("Artifacts downloaded", { tmpFilePath });
1204
+ return tmpFilePath;
1205
+ }
1206
+ function createTempDirectory() {
1207
+ const tempDir = path3.join(os.tmpdir(), "apps-in-toss", "sentry-integration");
1208
+ fs4.mkdirSync(tempDir, { recursive: true });
1209
+ debug4("Temp directory created", { tempDir });
1210
+ return {
1211
+ path: tempDir,
1212
+ cleanup: () => {
1213
+ fs4.rmSync(tempDir, { recursive: true, force: true });
1214
+ }
1215
+ };
1216
+ }
1217
+
1218
+ // src/integrations/UploadSentrySourcemap/extractSentryDebugId.ts
1219
+ init_esm_shims();
1220
+ import fs5 from "fs/promises";
1221
+ async function extractSentryDebugId(bundlePath) {
1222
+ const bundleContent = await fs5.readFile(bundlePath, "utf-8");
1223
+ return bundleContent.match(/SENTRY_DEBUG_ID=([\w-]+)/)?.[1];
1224
+ }
1225
+
1226
+ // src/integrations/UploadSentrySourcemap/extractSources.ts
1227
+ init_esm_shims();
1228
+ import * as fs6 from "fs";
1229
+ import * as path4 from "path";
1230
+ import { pipeline as pipeline2 } from "stream";
1231
+ import { promisify as promisify2 } from "util";
1232
+ import * as zlib from "zlib";
1233
+ import * as unzipper from "unzipper";
1234
+ var pipe = promisify2(pipeline2);
1235
+ async function extractSources(zipPath) {
1236
+ const sources = {
1237
+ android: {
1238
+ packagerBundle: "",
1239
+ packagerSourceMap: "",
1240
+ hermesBundle: "",
1241
+ hermesSourceMap: ""
1242
+ },
1243
+ ios: {
1244
+ packagerBundle: "",
1245
+ packagerSourceMap: "",
1246
+ hermesBundle: "",
1247
+ hermesSourceMap: ""
1248
+ }
1249
+ };
1250
+ await fs6.createReadStream(zipPath).pipe(unzipper.Parse()).on("entry", async (entry) => {
1251
+ const isRoot = !entry.path.includes("/");
1252
+ const fileName = path4.basename(entry.path);
1253
+ const outputPath = path4.join(path4.dirname(zipPath), fileName);
1254
+ if (isRoot) {
1255
+ entry.pipe(fs6.createWriteStream(outputPath));
1256
+ const platform = fileName.includes("android") ? "android" : "ios";
1257
+ if (fileName.endsWith(".js")) {
1258
+ sources[platform].packagerBundle = outputPath;
1259
+ } else if (fileName.endsWith(".hbc.gz")) {
1260
+ sources[platform].hermesBundle = outputPath;
1261
+ } else if (fileName.endsWith(".js.map")) {
1262
+ sources[platform].packagerSourceMap = outputPath;
1263
+ } else if (fileName.endsWith(".hbc.map")) {
1264
+ sources[platform].hermesSourceMap = outputPath;
1265
+ }
1266
+ } else {
1267
+ entry.autodrain();
1268
+ }
1269
+ }).promise();
1270
+ if (Object.values({ ...sources.android, ...sources.ios }).some((source) => source === "")) {
1271
+ throw new Error("invalid artifact");
1272
+ }
1273
+ const [androidHermesBundle, iosHermesBundle] = await Promise.all([
1274
+ decompressGzip(sources.android.hermesBundle),
1275
+ decompressGzip(sources.ios.hermesBundle)
1276
+ ]);
1277
+ sources.android.hermesBundle = androidHermesBundle;
1278
+ sources.ios.hermesBundle = iosHermesBundle;
1279
+ return sources;
1280
+ }
1281
+ async function decompressGzip(gzFile) {
1282
+ const outfile = gzFile.replace(/\.gz$/g, "");
1283
+ await pipe(fs6.createReadStream(gzFile), zlib.createGunzip(), fs6.createWriteStream(outfile));
1284
+ return outfile;
1285
+ }
1286
+
1287
+ // src/integrations/UploadSentrySourcemap/injectSentryDebugId.ts
1288
+ init_esm_shims();
1289
+ function injectSentryDebugId(rawSourceMap, debugId) {
1290
+ rawSourceMap.debugId = debugId;
1291
+ return rawSourceMap;
1292
+ }
1293
+
1294
+ // src/integrations/UploadSentrySourcemap/mergeSourcemap.ts
1295
+ init_esm_shims();
1296
+ import { SourceMapConsumer, SourceMapGenerator } from "source-map";
1297
+ async function mergeSourceMaps(packagerSourceMap, hermesSourceMap) {
1298
+ const packagerMapConsumer = await new SourceMapConsumer(packagerSourceMap);
1299
+ const hermesMapConsumer = await new SourceMapConsumer(hermesSourceMap);
1300
+ const generator = SourceMapGenerator.fromSourceMap(hermesMapConsumer);
1301
+ generator.applySourceMap(packagerMapConsumer, hermesMapConsumer.sources[0]);
1302
+ return generator.toJSON();
1303
+ }
1304
+
1305
+ // src/integrations/UploadSentrySourcemap/uploadSourcemap.ts
1306
+ init_esm_shims();
1307
+ import SentryCLI from "@sentry/cli";
1308
+ function uploadSourcemap(bundlePath, sourcemapPath, options) {
1309
+ const client = new SentryCLI(null, options);
1310
+ return client.execute(["sourcemaps", "upload", "--debug-id-reference", bundlePath, sourcemapPath], true);
1311
+ }
1312
+
1313
+ // src/integrations/UploadSentrySourcemap/UploadSentrySourcemap.ts
1314
+ var UploadSentrySourcemap = class extends Command3 {
1315
+ static paths = [["sentry", "upload-sourcemap"]];
1316
+ apiKey = Option3.String("--api-key", {
1317
+ required: false,
1318
+ description: "\uC778\uC99D API \uD0A4"
1319
+ });
1320
+ appName = Option3.String("--app-name", {
1321
+ required: false,
1322
+ description: "\uC571 \uC774\uB984"
1323
+ });
1324
+ deploymentId = Option3.String("--deployment-id", {
1325
+ required: false,
1326
+ description: "\uBC30\uD3EC ID"
1327
+ });
1328
+ sentryAuthToken = Option3.String("--sentry-auth-token", {
1329
+ required: false,
1330
+ description: "Sentry \uC778\uC99D\uD0A4"
1331
+ });
1332
+ sentryOrg = Option3.String("--sentry-org", {
1333
+ required: false,
1334
+ description: "Sentry \uC870\uC9C1"
1335
+ });
1336
+ sentryProject = Option3.String("--sentry-project", {
1337
+ required: false,
1338
+ description: "Sentry \uD504\uB85C\uC81D\uD2B8"
1339
+ });
1340
+ baseUrl = Option3.String("--base-url", {
1341
+ description: "API Base URL"
1342
+ });
1343
+ async execute() {
1344
+ const { baseUrl } = this;
1345
+ const apiKey = this.apiKey || await this.promptRequiredValue("password", "\uC571\uC778\uD1A0\uC2A4 API \uD0A4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694", "API \uD0A4\uB294 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1346
+ const appName = this.appName || await this.promptRequiredValue("text", "\uC571 \uC774\uB984\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694", "\uC571 \uC774\uB984\uC740 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1347
+ const deploymentId = this.deploymentId || await this.promptRequiredValue("text", "\uBC30\uD3EC ID\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694", "\uBC30\uD3EC ID\uB294 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1348
+ const sentryAuthToken = this.sentryAuthToken || process.env.SENTRY_AUTH_TOKEN || await this.promptRequiredValue("password", "Sentry \uC778\uC99D\uD0A4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694", "\uC778\uC99D\uD0A4\uB294 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1349
+ const sentryOrg = this.sentryOrg || process.env.SENTRY_ORG || await this.promptRequiredValue("text", "Sentry \uC870\uC9C1\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694", "\uC870\uC9C1\uC740 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1350
+ const sentryProject = this.sentryProject || process.env.SENTRY_PROJECT || await this.promptRequiredValue("text", "Sentry \uD504\uB85C\uC81D\uD2B8\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694", "\uD504\uB85C\uC81D\uD2B8\uB294 \uD544\uC218 \uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.");
1351
+ try {
1352
+ const zipPath = await downloadArtifacts({ apiKey, appName, deploymentId, baseUrl });
1353
+ const sources = await extractSources(zipPath);
1354
+ await p3.tasks([
1355
+ {
1356
+ title: "Android \uC18C\uC2A4\uB9F5 \uC5C5\uB85C\uB4DC \uC911...",
1357
+ task: async () => {
1358
+ await this.prepareSourceMapForUpload(sources.android);
1359
+ await uploadSourcemap(sources.android.hermesBundle, sources.android.hermesSourceMap, {
1360
+ authToken: sentryAuthToken,
1361
+ org: sentryOrg,
1362
+ project: sentryProject
1363
+ });
1364
+ return "Android \uC18C\uC2A4\uB9F5 \uC5C5\uB85C\uB4DC \uC644\uB8CC";
1365
+ }
1366
+ },
1367
+ {
1368
+ title: "iOS \uC18C\uC2A4\uB9F5 \uC5C5\uB85C\uB4DC \uC911...",
1369
+ task: async () => {
1370
+ await this.prepareSourceMapForUpload(sources.ios);
1371
+ await uploadSourcemap(sources.ios.hermesBundle, sources.ios.hermesSourceMap, {
1372
+ authToken: sentryAuthToken,
1373
+ org: sentryOrg,
1374
+ project: sentryProject
1375
+ });
1376
+ return "iOS \uC18C\uC2A4\uB9F5 \uC5C5\uB85C\uB4DC \uC644\uB8CC";
1377
+ }
1378
+ }
1379
+ ]);
1380
+ p3.outro("Sentry \uC18C\uC2A4\uB9F5 \uC5C5\uB85C\uB4DC \uC644\uB8CC");
1381
+ } catch (error) {
1382
+ if (error instanceof Error) {
1383
+ p3.log.error(error.message);
1384
+ } else {
1385
+ console.error(error);
1386
+ }
1387
+ process.exit(1);
1388
+ }
1389
+ }
1390
+ async prepareSourceMapForUpload(sources) {
1391
+ const debugId = await extractSentryDebugId(sources.packagerBundle);
1392
+ if (debugId == null) {
1393
+ throw new Error("Sentry Debug ID\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1394
+ }
1395
+ const mergedSourceMap = await mergeSourceMaps(
1396
+ await fs7.readFile(sources.packagerSourceMap, "utf-8"),
1397
+ await fs7.readFile(sources.hermesSourceMap, "utf-8")
1398
+ );
1399
+ const injectedSourceMap = injectSentryDebugId(mergedSourceMap, debugId);
1400
+ await fs7.writeFile(sources.hermesSourceMap, JSON.stringify(injectedSourceMap, null, 2), "utf-8");
1401
+ }
1402
+ async promptRequiredValue(type, message, validateMessage) {
1403
+ const result = await p3[type]({
1404
+ message,
1405
+ validate: (value) => {
1406
+ if (value.length === 0) {
1407
+ return validateMessage;
1408
+ }
1409
+ return;
1410
+ }
1411
+ });
1412
+ if (p3.isCancel(result)) {
1413
+ throw new Error("\uC791\uC5C5\uC774 \uCDE8\uC18C\uB418\uC5C8\uC5B4\uC694.");
1414
+ }
1415
+ return result;
1416
+ }
1417
+ };
1418
+
2582
1419
  // src/index.ts
2583
1420
  function initialize() {
2584
1421
  const cli = new Cli({
@@ -2587,6 +1424,7 @@ function initialize() {
2587
1424
  });
2588
1425
  cli.register(DeployCommand);
2589
1426
  cli.register(InitCommand);
1427
+ cli.register(UploadSentrySourcemap);
2590
1428
  cli.runExit(process.argv.slice(2));
2591
1429
  }
2592
1430
  export {