srcpack 0.1.9 → 0.1.10
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/cli.js +96 -94
- package/dist/config.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/cli.ts +8 -8
- package/src/config.ts +10 -1
package/dist/cli.js
CHANGED
|
@@ -180915,8 +180915,8 @@ var require_retry = __commonJS((exports) => {
|
|
|
180915
180915
|
}
|
|
180916
180916
|
const delay = getNextRetryDelay(config2);
|
|
180917
180917
|
err.config.retryConfig.currentRetryAttempt += 1;
|
|
180918
|
-
const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay) : new Promise((
|
|
180919
|
-
setTimeout(
|
|
180918
|
+
const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay) : new Promise((resolve2) => {
|
|
180919
|
+
setTimeout(resolve2, delay);
|
|
180920
180920
|
});
|
|
180921
180921
|
if (config2.onRetryAttempt) {
|
|
180922
180922
|
await config2.onRetryAttempt(err);
|
|
@@ -181669,8 +181669,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
181669
181669
|
function req(url2, opts = {}) {
|
|
181670
181670
|
const href = typeof url2 === "string" ? url2 : url2.href;
|
|
181671
181671
|
const req2 = (href.startsWith("https:") ? https : http).request(url2, opts);
|
|
181672
|
-
const promise2 = new Promise((
|
|
181673
|
-
req2.once("response",
|
|
181672
|
+
const promise2 = new Promise((resolve2, reject) => {
|
|
181673
|
+
req2.once("response", resolve2).once("error", reject).end();
|
|
181674
181674
|
});
|
|
181675
181675
|
req2.then = promise2.then.bind(promise2);
|
|
181676
181676
|
return req2;
|
|
@@ -181839,7 +181839,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
181839
181839
|
var debug_1 = __importDefault(require_src());
|
|
181840
181840
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
181841
181841
|
function parseProxyResponse(socket) {
|
|
181842
|
-
return new Promise((
|
|
181842
|
+
return new Promise((resolve2, reject) => {
|
|
181843
181843
|
let buffersLength = 0;
|
|
181844
181844
|
const buffers = [];
|
|
181845
181845
|
function read() {
|
|
@@ -181908,7 +181908,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
181908
181908
|
}
|
|
181909
181909
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
181910
181910
|
cleanup();
|
|
181911
|
-
|
|
181911
|
+
resolve2({
|
|
181912
181912
|
connect: {
|
|
181913
181913
|
statusCode,
|
|
181914
181914
|
statusText,
|
|
@@ -182142,7 +182142,7 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
182142
182142
|
return new originalPromise(executor);
|
|
182143
182143
|
}
|
|
182144
182144
|
function promiseResolvedWith(value) {
|
|
182145
|
-
return newPromise((
|
|
182145
|
+
return newPromise((resolve2) => resolve2(value));
|
|
182146
182146
|
}
|
|
182147
182147
|
function promiseRejectedWith(reason) {
|
|
182148
182148
|
return originalPromiseReject(reason);
|
|
@@ -182297,8 +182297,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
182297
182297
|
return new TypeError("Cannot " + name + " a stream using a released reader");
|
|
182298
182298
|
}
|
|
182299
182299
|
function defaultReaderClosedPromiseInitialize(reader) {
|
|
182300
|
-
reader._closedPromise = newPromise((
|
|
182301
|
-
reader._closedPromise_resolve =
|
|
182300
|
+
reader._closedPromise = newPromise((resolve2, reject) => {
|
|
182301
|
+
reader._closedPromise_resolve = resolve2;
|
|
182302
182302
|
reader._closedPromise_reject = reject;
|
|
182303
182303
|
});
|
|
182304
182304
|
}
|
|
@@ -182461,8 +182461,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
182461
182461
|
}
|
|
182462
182462
|
let resolvePromise;
|
|
182463
182463
|
let rejectPromise;
|
|
182464
|
-
const promise2 = newPromise((
|
|
182465
|
-
resolvePromise =
|
|
182464
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
182465
|
+
resolvePromise = resolve2;
|
|
182466
182466
|
rejectPromise = reject;
|
|
182467
182467
|
});
|
|
182468
182468
|
const readRequest = {
|
|
@@ -182558,8 +182558,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
182558
182558
|
const reader = this._reader;
|
|
182559
182559
|
let resolvePromise;
|
|
182560
182560
|
let rejectPromise;
|
|
182561
|
-
const promise2 = newPromise((
|
|
182562
|
-
resolvePromise =
|
|
182561
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
182562
|
+
resolvePromise = resolve2;
|
|
182563
182563
|
rejectPromise = reject;
|
|
182564
182564
|
});
|
|
182565
182565
|
const readRequest = {
|
|
@@ -183556,8 +183556,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
183556
183556
|
}
|
|
183557
183557
|
let resolvePromise;
|
|
183558
183558
|
let rejectPromise;
|
|
183559
|
-
const promise2 = newPromise((
|
|
183560
|
-
resolvePromise =
|
|
183559
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
183560
|
+
resolvePromise = resolve2;
|
|
183561
183561
|
rejectPromise = reject;
|
|
183562
183562
|
});
|
|
183563
183563
|
const readIntoRequest = {
|
|
@@ -183833,10 +183833,10 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
183833
183833
|
wasAlreadyErroring = true;
|
|
183834
183834
|
reason = undefined;
|
|
183835
183835
|
}
|
|
183836
|
-
const promise2 = newPromise((
|
|
183836
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
183837
183837
|
stream._pendingAbortRequest = {
|
|
183838
183838
|
_promise: undefined,
|
|
183839
|
-
_resolve:
|
|
183839
|
+
_resolve: resolve2,
|
|
183840
183840
|
_reject: reject,
|
|
183841
183841
|
_reason: reason,
|
|
183842
183842
|
_wasAlreadyErroring: wasAlreadyErroring
|
|
@@ -183853,9 +183853,9 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
183853
183853
|
if (state === "closed" || state === "errored") {
|
|
183854
183854
|
return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
|
|
183855
183855
|
}
|
|
183856
|
-
const promise2 = newPromise((
|
|
183856
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
183857
183857
|
const closeRequest = {
|
|
183858
|
-
_resolve:
|
|
183858
|
+
_resolve: resolve2,
|
|
183859
183859
|
_reject: reject
|
|
183860
183860
|
};
|
|
183861
183861
|
stream._closeRequest = closeRequest;
|
|
@@ -183868,9 +183868,9 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
183868
183868
|
return promise2;
|
|
183869
183869
|
}
|
|
183870
183870
|
function WritableStreamAddWriteRequest(stream) {
|
|
183871
|
-
const promise2 = newPromise((
|
|
183871
|
+
const promise2 = newPromise((resolve2, reject) => {
|
|
183872
183872
|
const writeRequest = {
|
|
183873
|
-
_resolve:
|
|
183873
|
+
_resolve: resolve2,
|
|
183874
183874
|
_reject: reject
|
|
183875
183875
|
};
|
|
183876
183876
|
stream._writeRequests.push(writeRequest);
|
|
@@ -184435,8 +184435,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
184435
184435
|
return new TypeError("Cannot " + name + " a stream using a released writer");
|
|
184436
184436
|
}
|
|
184437
184437
|
function defaultWriterClosedPromiseInitialize(writer) {
|
|
184438
|
-
writer._closedPromise = newPromise((
|
|
184439
|
-
writer._closedPromise_resolve =
|
|
184438
|
+
writer._closedPromise = newPromise((resolve2, reject) => {
|
|
184439
|
+
writer._closedPromise_resolve = resolve2;
|
|
184440
184440
|
writer._closedPromise_reject = reject;
|
|
184441
184441
|
writer._closedPromiseState = "pending";
|
|
184442
184442
|
});
|
|
@@ -184472,8 +184472,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
184472
184472
|
writer._closedPromiseState = "resolved";
|
|
184473
184473
|
}
|
|
184474
184474
|
function defaultWriterReadyPromiseInitialize(writer) {
|
|
184475
|
-
writer._readyPromise = newPromise((
|
|
184476
|
-
writer._readyPromise_resolve =
|
|
184475
|
+
writer._readyPromise = newPromise((resolve2, reject) => {
|
|
184476
|
+
writer._readyPromise_resolve = resolve2;
|
|
184477
184477
|
writer._readyPromise_reject = reject;
|
|
184478
184478
|
});
|
|
184479
184479
|
writer._readyPromiseState = "pending";
|
|
@@ -184560,7 +184560,7 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
184560
184560
|
source._disturbed = true;
|
|
184561
184561
|
let shuttingDown = false;
|
|
184562
184562
|
let currentWrite = promiseResolvedWith(undefined);
|
|
184563
|
-
return newPromise((
|
|
184563
|
+
return newPromise((resolve2, reject) => {
|
|
184564
184564
|
let abortAlgorithm;
|
|
184565
184565
|
if (signal !== undefined) {
|
|
184566
184566
|
abortAlgorithm = () => {
|
|
@@ -184705,7 +184705,7 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
184705
184705
|
if (isError) {
|
|
184706
184706
|
reject(error49);
|
|
184707
184707
|
} else {
|
|
184708
|
-
|
|
184708
|
+
resolve2(undefined);
|
|
184709
184709
|
}
|
|
184710
184710
|
return null;
|
|
184711
184711
|
}
|
|
@@ -184974,8 +184974,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
184974
184974
|
let branch1;
|
|
184975
184975
|
let branch2;
|
|
184976
184976
|
let resolveCancelPromise;
|
|
184977
|
-
const cancelPromise = newPromise((
|
|
184978
|
-
resolveCancelPromise =
|
|
184977
|
+
const cancelPromise = newPromise((resolve2) => {
|
|
184978
|
+
resolveCancelPromise = resolve2;
|
|
184979
184979
|
});
|
|
184980
184980
|
function pullAlgorithm() {
|
|
184981
184981
|
if (reading) {
|
|
@@ -185065,8 +185065,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
185065
185065
|
let branch1;
|
|
185066
185066
|
let branch2;
|
|
185067
185067
|
let resolveCancelPromise;
|
|
185068
|
-
const cancelPromise = newPromise((
|
|
185069
|
-
resolveCancelPromise =
|
|
185068
|
+
const cancelPromise = newPromise((resolve2) => {
|
|
185069
|
+
resolveCancelPromise = resolve2;
|
|
185070
185070
|
});
|
|
185071
185071
|
function forwardReaderError(thisReader) {
|
|
185072
185072
|
uponRejection(thisReader._closedPromise, (r) => {
|
|
@@ -185811,8 +185811,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
185811
185811
|
const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
|
|
185812
185812
|
const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
|
|
185813
185813
|
let startPromise_resolve;
|
|
185814
|
-
const startPromise = newPromise((
|
|
185815
|
-
startPromise_resolve =
|
|
185814
|
+
const startPromise = newPromise((resolve2) => {
|
|
185815
|
+
startPromise_resolve = resolve2;
|
|
185816
185816
|
});
|
|
185817
185817
|
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
185818
185818
|
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
@@ -185899,8 +185899,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
185899
185899
|
if (stream._backpressureChangePromise !== undefined) {
|
|
185900
185900
|
stream._backpressureChangePromise_resolve();
|
|
185901
185901
|
}
|
|
185902
|
-
stream._backpressureChangePromise = newPromise((
|
|
185903
|
-
stream._backpressureChangePromise_resolve =
|
|
185902
|
+
stream._backpressureChangePromise = newPromise((resolve2) => {
|
|
185903
|
+
stream._backpressureChangePromise_resolve = resolve2;
|
|
185904
185904
|
});
|
|
185905
185905
|
stream._backpressure = backpressure;
|
|
185906
185906
|
}
|
|
@@ -186058,8 +186058,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
186058
186058
|
return controller._finishPromise;
|
|
186059
186059
|
}
|
|
186060
186060
|
const readable = stream._readable;
|
|
186061
|
-
controller._finishPromise = newPromise((
|
|
186062
|
-
controller._finishPromise_resolve =
|
|
186061
|
+
controller._finishPromise = newPromise((resolve2, reject) => {
|
|
186062
|
+
controller._finishPromise_resolve = resolve2;
|
|
186063
186063
|
controller._finishPromise_reject = reject;
|
|
186064
186064
|
});
|
|
186065
186065
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -186085,8 +186085,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
186085
186085
|
return controller._finishPromise;
|
|
186086
186086
|
}
|
|
186087
186087
|
const readable = stream._readable;
|
|
186088
|
-
controller._finishPromise = newPromise((
|
|
186089
|
-
controller._finishPromise_resolve =
|
|
186088
|
+
controller._finishPromise = newPromise((resolve2, reject) => {
|
|
186089
|
+
controller._finishPromise_resolve = resolve2;
|
|
186090
186090
|
controller._finishPromise_reject = reject;
|
|
186091
186091
|
});
|
|
186092
186092
|
const flushPromise = controller._flushAlgorithm();
|
|
@@ -186116,8 +186116,8 @@ var require_ponyfill_es2018 = __commonJS((exports, module) => {
|
|
|
186116
186116
|
return controller._finishPromise;
|
|
186117
186117
|
}
|
|
186118
186118
|
const writable = stream._writable;
|
|
186119
|
-
controller._finishPromise = newPromise((
|
|
186120
|
-
controller._finishPromise_resolve =
|
|
186119
|
+
controller._finishPromise = newPromise((resolve2, reject) => {
|
|
186120
|
+
controller._finishPromise_resolve = resolve2;
|
|
186121
186121
|
controller._finishPromise_reject = reject;
|
|
186122
186122
|
});
|
|
186123
186123
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -187839,7 +187839,7 @@ import zlib from "node:zlib";
|
|
|
187839
187839
|
import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "node:stream";
|
|
187840
187840
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
187841
187841
|
async function fetch2(url2, options_) {
|
|
187842
|
-
return new Promise((
|
|
187842
|
+
return new Promise((resolve2, reject) => {
|
|
187843
187843
|
const request = new Request2(url2, options_);
|
|
187844
187844
|
const { parsedURL, options } = getNodeRequestOptions(request);
|
|
187845
187845
|
if (!supportedSchemas.has(parsedURL.protocol)) {
|
|
@@ -187848,7 +187848,7 @@ async function fetch2(url2, options_) {
|
|
|
187848
187848
|
if (parsedURL.protocol === "data:") {
|
|
187849
187849
|
const data = dist_default(request.url);
|
|
187850
187850
|
const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
|
|
187851
|
-
|
|
187851
|
+
resolve2(response2);
|
|
187852
187852
|
return;
|
|
187853
187853
|
}
|
|
187854
187854
|
const send = (parsedURL.protocol === "https:" ? https : http2).request;
|
|
@@ -187970,7 +187970,7 @@ async function fetch2(url2, options_) {
|
|
|
187970
187970
|
if (responseReferrerPolicy) {
|
|
187971
187971
|
requestOptions.referrerPolicy = responseReferrerPolicy;
|
|
187972
187972
|
}
|
|
187973
|
-
|
|
187973
|
+
resolve2(fetch2(new Request2(locationURL, requestOptions)));
|
|
187974
187974
|
finalize2();
|
|
187975
187975
|
return;
|
|
187976
187976
|
}
|
|
@@ -188003,7 +188003,7 @@ async function fetch2(url2, options_) {
|
|
|
188003
188003
|
const codings = headers.get("Content-Encoding");
|
|
188004
188004
|
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
|
188005
188005
|
response = new Response2(body, responseOptions);
|
|
188006
|
-
|
|
188006
|
+
resolve2(response);
|
|
188007
188007
|
return;
|
|
188008
188008
|
}
|
|
188009
188009
|
const zlibOptions = {
|
|
@@ -188017,7 +188017,7 @@ async function fetch2(url2, options_) {
|
|
|
188017
188017
|
}
|
|
188018
188018
|
});
|
|
188019
188019
|
response = new Response2(body, responseOptions);
|
|
188020
|
-
|
|
188020
|
+
resolve2(response);
|
|
188021
188021
|
return;
|
|
188022
188022
|
}
|
|
188023
188023
|
if (codings === "deflate" || codings === "x-deflate") {
|
|
@@ -188041,12 +188041,12 @@ async function fetch2(url2, options_) {
|
|
|
188041
188041
|
});
|
|
188042
188042
|
}
|
|
188043
188043
|
response = new Response2(body, responseOptions);
|
|
188044
|
-
|
|
188044
|
+
resolve2(response);
|
|
188045
188045
|
});
|
|
188046
188046
|
raw.once("end", () => {
|
|
188047
188047
|
if (!response) {
|
|
188048
188048
|
response = new Response2(body, responseOptions);
|
|
188049
|
-
|
|
188049
|
+
resolve2(response);
|
|
188050
188050
|
}
|
|
188051
188051
|
});
|
|
188052
188052
|
return;
|
|
@@ -188058,11 +188058,11 @@ async function fetch2(url2, options_) {
|
|
|
188058
188058
|
}
|
|
188059
188059
|
});
|
|
188060
188060
|
response = new Response2(body, responseOptions);
|
|
188061
|
-
|
|
188061
|
+
resolve2(response);
|
|
188062
188062
|
return;
|
|
188063
188063
|
}
|
|
188064
188064
|
response = new Response2(body, responseOptions);
|
|
188065
|
-
|
|
188065
|
+
resolve2(response);
|
|
188066
188066
|
});
|
|
188067
188067
|
writeToStream(request_, request).catch(reject);
|
|
188068
188068
|
});
|
|
@@ -193984,7 +193984,7 @@ var require_jwtaccess = __commonJS((exports) => {
|
|
|
193984
193984
|
}
|
|
193985
193985
|
}
|
|
193986
193986
|
fromStreamAsync(inputStream) {
|
|
193987
|
-
return new Promise((
|
|
193987
|
+
return new Promise((resolve2, reject) => {
|
|
193988
193988
|
if (!inputStream) {
|
|
193989
193989
|
reject(new Error("Must pass in a stream containing the service account auth settings."));
|
|
193990
193990
|
}
|
|
@@ -193993,7 +193993,7 @@ var require_jwtaccess = __commonJS((exports) => {
|
|
|
193993
193993
|
try {
|
|
193994
193994
|
const data = JSON.parse(s2);
|
|
193995
193995
|
this.fromJSON(data);
|
|
193996
|
-
|
|
193996
|
+
resolve2();
|
|
193997
193997
|
} catch (err) {
|
|
193998
193998
|
reject(err);
|
|
193999
193999
|
}
|
|
@@ -194179,7 +194179,7 @@ var require_jwtclient = __commonJS((exports) => {
|
|
|
194179
194179
|
}
|
|
194180
194180
|
}
|
|
194181
194181
|
fromStreamAsync(inputStream) {
|
|
194182
|
-
return new Promise((
|
|
194182
|
+
return new Promise((resolve2, reject) => {
|
|
194183
194183
|
if (!inputStream) {
|
|
194184
194184
|
throw new Error("Must pass in a stream containing the service account auth settings.");
|
|
194185
194185
|
}
|
|
@@ -194188,7 +194188,7 @@ var require_jwtclient = __commonJS((exports) => {
|
|
|
194188
194188
|
try {
|
|
194189
194189
|
const data = JSON.parse(s2);
|
|
194190
194190
|
this.fromJSON(data);
|
|
194191
|
-
|
|
194191
|
+
resolve2();
|
|
194192
194192
|
} catch (e2) {
|
|
194193
194193
|
reject(e2);
|
|
194194
194194
|
}
|
|
@@ -194288,7 +194288,7 @@ var require_refreshclient = __commonJS((exports) => {
|
|
|
194288
194288
|
}
|
|
194289
194289
|
}
|
|
194290
194290
|
async fromStreamAsync(inputStream) {
|
|
194291
|
-
return new Promise((
|
|
194291
|
+
return new Promise((resolve2, reject) => {
|
|
194292
194292
|
if (!inputStream) {
|
|
194293
194293
|
return reject(new Error("Must pass in a stream containing the user refresh token."));
|
|
194294
194294
|
}
|
|
@@ -194297,7 +194297,7 @@ var require_refreshclient = __commonJS((exports) => {
|
|
|
194297
194297
|
try {
|
|
194298
194298
|
const data = JSON.parse(s2);
|
|
194299
194299
|
this.fromJSON(data);
|
|
194300
|
-
return
|
|
194300
|
+
return resolve2();
|
|
194301
194301
|
} catch (err) {
|
|
194302
194302
|
return reject(err);
|
|
194303
194303
|
}
|
|
@@ -195653,7 +195653,7 @@ var require_pluggable_auth_handler = __commonJS((exports) => {
|
|
|
195653
195653
|
this.outputFile = options.outputFile;
|
|
195654
195654
|
}
|
|
195655
195655
|
retrieveResponseFromExecutable(envMap) {
|
|
195656
|
-
return new Promise((
|
|
195656
|
+
return new Promise((resolve2, reject) => {
|
|
195657
195657
|
const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
|
|
195658
195658
|
env: { ...process.env, ...Object.fromEntries(envMap) }
|
|
195659
195659
|
});
|
|
@@ -195675,7 +195675,7 @@ var require_pluggable_auth_handler = __commonJS((exports) => {
|
|
|
195675
195675
|
try {
|
|
195676
195676
|
const responseJson = JSON.parse(output);
|
|
195677
195677
|
const response = new executable_response_1.ExecutableResponse(responseJson);
|
|
195678
|
-
return
|
|
195678
|
+
return resolve2(response);
|
|
195679
195679
|
} catch (error49) {
|
|
195680
195680
|
if (error49 instanceof executable_response_1.ExecutableResponseError) {
|
|
195681
195681
|
return reject(error49);
|
|
@@ -196326,7 +196326,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
196326
196326
|
}
|
|
196327
196327
|
}
|
|
196328
196328
|
fromStreamAsync(inputStream, options) {
|
|
196329
|
-
return new Promise((
|
|
196329
|
+
return new Promise((resolve2, reject) => {
|
|
196330
196330
|
if (!inputStream) {
|
|
196331
196331
|
throw new Error("Must pass in a stream containing the Google auth settings.");
|
|
196332
196332
|
}
|
|
@@ -196336,7 +196336,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
196336
196336
|
try {
|
|
196337
196337
|
const data = JSON.parse(chunks.join(""));
|
|
196338
196338
|
const r2 = this._cacheClientFromJSON(data, options);
|
|
196339
|
-
return
|
|
196339
|
+
return resolve2(r2);
|
|
196340
196340
|
} catch (err) {
|
|
196341
196341
|
if (!this.keyFilename)
|
|
196342
196342
|
throw err;
|
|
@@ -196346,7 +196346,7 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
196346
196346
|
});
|
|
196347
196347
|
this.cachedCredential = client;
|
|
196348
196348
|
this.setGapicJWTValues(client);
|
|
196349
|
-
return
|
|
196349
|
+
return resolve2(client);
|
|
196350
196350
|
}
|
|
196351
196351
|
} catch (err) {
|
|
196352
196352
|
return reject(err);
|
|
@@ -196367,16 +196367,16 @@ var require_googleauth = __commonJS((exports) => {
|
|
|
196367
196367
|
return false;
|
|
196368
196368
|
}
|
|
196369
196369
|
async getDefaultServiceProjectId() {
|
|
196370
|
-
return new Promise((
|
|
196370
|
+
return new Promise((resolve2) => {
|
|
196371
196371
|
(0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout) => {
|
|
196372
196372
|
if (!err && stdout) {
|
|
196373
196373
|
try {
|
|
196374
196374
|
const projectId = JSON.parse(stdout).configuration.properties.core.project;
|
|
196375
|
-
|
|
196375
|
+
resolve2(projectId);
|
|
196376
196376
|
return;
|
|
196377
196377
|
} catch (e2) {}
|
|
196378
196378
|
}
|
|
196379
|
-
|
|
196379
|
+
resolve2(null);
|
|
196380
196380
|
});
|
|
196381
196381
|
});
|
|
196382
196382
|
}
|
|
@@ -199334,7 +199334,7 @@ var require_http2 = __commonJS((exports) => {
|
|
|
199334
199334
|
const chunks = [];
|
|
199335
199335
|
const session = sessionData.session;
|
|
199336
199336
|
let req;
|
|
199337
|
-
return new Promise((
|
|
199337
|
+
return new Promise((resolve2, reject) => {
|
|
199338
199338
|
try {
|
|
199339
199339
|
req = session.request(headers).on("response", (responseHeaders) => {
|
|
199340
199340
|
Object.assign(res, {
|
|
@@ -199347,7 +199347,7 @@ var require_http2 = __commonJS((exports) => {
|
|
|
199347
199347
|
}
|
|
199348
199348
|
if (opts.responseType === "stream") {
|
|
199349
199349
|
res.data = stream;
|
|
199350
|
-
|
|
199350
|
+
resolve2(res);
|
|
199351
199351
|
return;
|
|
199352
199352
|
}
|
|
199353
199353
|
stream.on("data", (d) => {
|
|
@@ -199381,7 +199381,7 @@ var require_http2 = __commonJS((exports) => {
|
|
|
199381
199381
|
}
|
|
199382
199382
|
reject(new Error(message, { cause: res }));
|
|
199383
199383
|
}
|
|
199384
|
-
|
|
199384
|
+
resolve2(res);
|
|
199385
199385
|
return;
|
|
199386
199386
|
});
|
|
199387
199387
|
}).on("error", (e2) => {
|
|
@@ -199923,7 +199923,7 @@ var require_discovery = __commonJS((exports) => {
|
|
|
199923
199923
|
exports.Discovery = undefined;
|
|
199924
199924
|
var fs2 = __require("fs");
|
|
199925
199925
|
var gaxios_1 = require_src2();
|
|
199926
|
-
var
|
|
199926
|
+
var resolve2 = __require("url");
|
|
199927
199927
|
var util = __require("util");
|
|
199928
199928
|
var apirequest_1 = require_apirequest();
|
|
199929
199929
|
var endpoint_1 = require_endpoint();
|
|
@@ -199989,7 +199989,7 @@ var require_discovery = __commonJS((exports) => {
|
|
|
199989
199989
|
}
|
|
199990
199990
|
async discoverAPI(apiDiscoveryUrl) {
|
|
199991
199991
|
if (typeof apiDiscoveryUrl === "string") {
|
|
199992
|
-
const parts =
|
|
199992
|
+
const parts = resolve2.parse(apiDiscoveryUrl);
|
|
199993
199993
|
if (apiDiscoveryUrl && !parts.protocol) {
|
|
199994
199994
|
this.log("Reading from file " + apiDiscoveryUrl);
|
|
199995
199995
|
const file2 = await readFile2(apiDiscoveryUrl, { encoding: "utf8" });
|
|
@@ -204451,7 +204451,7 @@ var require_src8 = __commonJS((exports, module) => {
|
|
|
204451
204451
|
|
|
204452
204452
|
// src/cli.ts
|
|
204453
204453
|
import { mkdir as mkdir3, readdir, rm, writeFile as writeFile4 } from "node:fs/promises";
|
|
204454
|
-
import { dirname as dirname3, isAbsolute, join as join6, relative, resolve } from "node:path";
|
|
204454
|
+
import { dirname as dirname3, isAbsolute, join as join6, relative, resolve as resolve2 } from "node:path";
|
|
204455
204455
|
|
|
204456
204456
|
// node_modules/ora/index.js
|
|
204457
204457
|
import process8 from "node:process";
|
|
@@ -207664,7 +207664,7 @@ import { join as join2 } from "node:path";
|
|
|
207664
207664
|
// src/config.ts
|
|
207665
207665
|
var import_cosmiconfig = __toESM(require_dist(), 1);
|
|
207666
207666
|
import { homedir } from "node:os";
|
|
207667
|
-
import { join } from "node:path";
|
|
207667
|
+
import { join, resolve } from "node:path";
|
|
207668
207668
|
|
|
207669
207669
|
// node_modules/zod/v4/classic/external.js
|
|
207670
207670
|
var exports_external = {};
|
|
@@ -221227,6 +221227,7 @@ var UploadConfigSchema = exports_external.object({
|
|
|
221227
221227
|
exclude: exports_external.array(exports_external.string()).optional()
|
|
221228
221228
|
});
|
|
221229
221229
|
var ConfigSchema = exports_external.object({
|
|
221230
|
+
root: exports_external.string().default(""),
|
|
221230
221231
|
outDir: exports_external.string().default(".srcpack"),
|
|
221231
221232
|
emptyOutDir: exports_external.boolean().optional(),
|
|
221232
221233
|
upload: exports_external.union([UploadConfigSchema, exports_external.array(UploadConfigSchema).min(1)]).optional(),
|
|
@@ -221251,6 +221252,7 @@ function parseConfig(value) {
|
|
|
221251
221252
|
throw new ConfigError(message);
|
|
221252
221253
|
}
|
|
221253
221254
|
const config2 = result.data;
|
|
221255
|
+
config2.root = config2.root ? resolve(expandPath(config2.root)) : process.cwd();
|
|
221254
221256
|
config2.outDir = expandPath(config2.outDir);
|
|
221255
221257
|
for (const bundle of Object.values(config2.bundles)) {
|
|
221256
221258
|
if (typeof bundle === "object" && !Array.isArray(bundle) && bundle.outfile) {
|
|
@@ -221983,19 +221985,19 @@ var baseOpen = async (options) => {
|
|
|
221983
221985
|
}
|
|
221984
221986
|
const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
|
|
221985
221987
|
if (options.wait) {
|
|
221986
|
-
return new Promise((
|
|
221988
|
+
return new Promise((resolve2, reject) => {
|
|
221987
221989
|
subprocess.once("error", reject);
|
|
221988
221990
|
subprocess.once("close", (exitCode) => {
|
|
221989
221991
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
221990
221992
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
221991
221993
|
return;
|
|
221992
221994
|
}
|
|
221993
|
-
|
|
221995
|
+
resolve2(subprocess);
|
|
221994
221996
|
});
|
|
221995
221997
|
});
|
|
221996
221998
|
}
|
|
221997
221999
|
if (isFallbackAttempt) {
|
|
221998
|
-
return new Promise((
|
|
222000
|
+
return new Promise((resolve2, reject) => {
|
|
221999
222001
|
subprocess.once("error", reject);
|
|
222000
222002
|
subprocess.once("spawn", () => {
|
|
222001
222003
|
subprocess.once("close", (exitCode) => {
|
|
@@ -222005,17 +222007,17 @@ var baseOpen = async (options) => {
|
|
|
222005
222007
|
return;
|
|
222006
222008
|
}
|
|
222007
222009
|
subprocess.unref();
|
|
222008
|
-
|
|
222010
|
+
resolve2(subprocess);
|
|
222009
222011
|
});
|
|
222010
222012
|
});
|
|
222011
222013
|
});
|
|
222012
222014
|
}
|
|
222013
222015
|
subprocess.unref();
|
|
222014
|
-
return new Promise((
|
|
222016
|
+
return new Promise((resolve2, reject) => {
|
|
222015
222017
|
subprocess.once("error", reject);
|
|
222016
222018
|
subprocess.once("spawn", () => {
|
|
222017
222019
|
subprocess.off("error", reject);
|
|
222018
|
-
|
|
222020
|
+
resolve2(subprocess);
|
|
222019
222021
|
});
|
|
222020
222022
|
});
|
|
222021
222023
|
};
|
|
@@ -222217,8 +222219,8 @@ class BaseCallbackServer {
|
|
|
222217
222219
|
let timeoutId;
|
|
222218
222220
|
try {
|
|
222219
222221
|
return await Promise.race([
|
|
222220
|
-
new Promise((
|
|
222221
|
-
this.callbackListeners.set(path22, { resolve, reject });
|
|
222222
|
+
new Promise((resolve2, reject) => {
|
|
222223
|
+
this.callbackListeners.set(path22, { resolve: resolve2, reject });
|
|
222222
222224
|
}),
|
|
222223
222225
|
new Promise((_, reject) => {
|
|
222224
222226
|
timeoutId = setTimeout(() => {
|
|
@@ -222259,7 +222261,7 @@ class BunCallbackServer extends BaseCallbackServer {
|
|
|
222259
222261
|
if (!this.server)
|
|
222260
222262
|
return;
|
|
222261
222263
|
if (this.callbackReceived) {
|
|
222262
|
-
await new Promise((
|
|
222264
|
+
await new Promise((resolve2) => setTimeout(resolve2, 50));
|
|
222263
222265
|
}
|
|
222264
222266
|
this.server.stop(true);
|
|
222265
222267
|
this.server = undefined;
|
|
@@ -222289,7 +222291,7 @@ class NodeCallbackServer extends BaseCallbackServer {
|
|
|
222289
222291
|
this.setup(options);
|
|
222290
222292
|
const { port, hostname: hostname3 = "localhost" } = options;
|
|
222291
222293
|
const { createServer } = await import("node:http");
|
|
222292
|
-
return new Promise((
|
|
222294
|
+
return new Promise((resolve2, reject) => {
|
|
222293
222295
|
this.server = createServer(async (req, res) => {
|
|
222294
222296
|
try {
|
|
222295
222297
|
const request = this.nodeToWebRequest(req, port, hostname3);
|
|
@@ -222304,7 +222306,7 @@ class NodeCallbackServer extends BaseCallbackServer {
|
|
|
222304
222306
|
});
|
|
222305
222307
|
if (options.signal)
|
|
222306
222308
|
options.signal.addEventListener("abort", () => this.server?.close());
|
|
222307
|
-
this.server.listen(port, hostname3, () =>
|
|
222309
|
+
this.server.listen(port, hostname3, () => resolve2());
|
|
222308
222310
|
this.server.on("error", reject);
|
|
222309
222311
|
});
|
|
222310
222312
|
}
|
|
@@ -222312,10 +222314,10 @@ class NodeCallbackServer extends BaseCallbackServer {
|
|
|
222312
222314
|
if (!this.server)
|
|
222313
222315
|
return;
|
|
222314
222316
|
this.server.closeAllConnections();
|
|
222315
|
-
return new Promise((
|
|
222317
|
+
return new Promise((resolve2) => {
|
|
222316
222318
|
this.server?.close(() => {
|
|
222317
222319
|
this.server = undefined;
|
|
222318
|
-
|
|
222320
|
+
resolve2();
|
|
222319
222321
|
});
|
|
222320
222322
|
});
|
|
222321
222323
|
}
|
|
@@ -222619,7 +222621,7 @@ class BrowserOAuthProvider {
|
|
|
222619
222621
|
}
|
|
222620
222622
|
if (attempt < maxRetries) {
|
|
222621
222623
|
console.warn(`Auth attempt ${attempt + 1} failed, retrying...`, error49);
|
|
222622
|
-
await new Promise((
|
|
222624
|
+
await new Promise((resolve2) => setTimeout(resolve2, 1000 * (attempt + 1)));
|
|
222623
222625
|
}
|
|
222624
222626
|
}
|
|
222625
222627
|
}
|
|
@@ -223563,7 +223565,7 @@ function plural(n, singular, pluralForm) {
|
|
|
223563
223565
|
return n === 1 ? singular : pluralForm ?? singular + "s";
|
|
223564
223566
|
}
|
|
223565
223567
|
function isOutDirInsideRoot(outDir, root) {
|
|
223566
|
-
const absoluteOutDir = isAbsolute(outDir) ? outDir :
|
|
223568
|
+
const absoluteOutDir = isAbsolute(outDir) ? outDir : resolve2(root, outDir);
|
|
223567
223569
|
const rel = relative(root, absoluteOutDir);
|
|
223568
223570
|
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
223569
223571
|
}
|
|
@@ -223629,14 +223631,14 @@ Options:
|
|
|
223629
223631
|
console.log("No bundles configured.");
|
|
223630
223632
|
return;
|
|
223631
223633
|
}
|
|
223632
|
-
const
|
|
223633
|
-
const outDirInsideRoot = isOutDirInsideRoot(config2.outDir,
|
|
223634
|
+
const root = config2.root;
|
|
223635
|
+
const outDirInsideRoot = isOutDirInsideRoot(config2.outDir, root);
|
|
223634
223636
|
const emptyOutDir = emptyOutDirFlag ?? config2.emptyOutDir ?? outDirInsideRoot;
|
|
223635
223637
|
if (!outDirInsideRoot && emptyOutDirFlag === undefined && config2.emptyOutDir === undefined) {
|
|
223636
223638
|
console.warn(`Warning: outDir "${config2.outDir}" is outside project root. ` + "Use --emptyOutDir to suppress this warning and empty the directory.");
|
|
223637
223639
|
}
|
|
223638
223640
|
if (emptyOutDir && !dryRun) {
|
|
223639
|
-
const outDirPath = isAbsolute(config2.outDir) ? config2.outDir :
|
|
223641
|
+
const outDirPath = isAbsolute(config2.outDir) ? config2.outDir : resolve2(root, config2.outDir);
|
|
223640
223642
|
await emptyDirectory(outDirPath, [".git"]);
|
|
223641
223643
|
}
|
|
223642
223644
|
const outputs = [];
|
|
@@ -223648,7 +223650,7 @@ Options:
|
|
|
223648
223650
|
const name = bundleNames[i2];
|
|
223649
223651
|
bundleSpinner.text = `Bundling ${name}... (${i2 + 1}/${bundleNames.length})`;
|
|
223650
223652
|
const bundleConfig = config2.bundles[name];
|
|
223651
|
-
const result = await bundleOne(name, bundleConfig,
|
|
223653
|
+
const result = await bundleOne(name, bundleConfig, root);
|
|
223652
223654
|
const outfile = getOutfile(bundleConfig, name, config2.outDir);
|
|
223653
223655
|
outputs.push({ name, outfile, result });
|
|
223654
223656
|
}
|
|
@@ -223660,7 +223662,7 @@ Options:
|
|
|
223660
223662
|
for (const { name, outfile, result } of outputs) {
|
|
223661
223663
|
const fileCount = result.index.length;
|
|
223662
223664
|
const lineCount = sumLines(result);
|
|
223663
|
-
const outPath = join6(
|
|
223665
|
+
const outPath = join6(root, outfile);
|
|
223664
223666
|
const nameCol = name.padEnd(maxNameLen);
|
|
223665
223667
|
const filesCol = formatNumber(fileCount).padStart(maxFilesLen);
|
|
223666
223668
|
const linesCol = formatNumber(lineCount).padStart(maxLinesLen);
|
|
@@ -223689,7 +223691,7 @@ Options:
|
|
|
223689
223691
|
const uploads = Array.isArray(config2.upload) ? config2.upload : [config2.upload];
|
|
223690
223692
|
for (const uploadConfig of uploads) {
|
|
223691
223693
|
if (isGdriveConfigured(uploadConfig)) {
|
|
223692
|
-
await handleGdriveUpload(uploadConfig, outputs,
|
|
223694
|
+
await handleGdriveUpload(uploadConfig, outputs, root);
|
|
223693
223695
|
}
|
|
223694
223696
|
}
|
|
223695
223697
|
}
|
|
@@ -223750,7 +223752,7 @@ function printUploadConfigHelp() {
|
|
|
223750
223752
|
}
|
|
223751
223753
|
`);
|
|
223752
223754
|
}
|
|
223753
|
-
async function handleGdriveUpload(uploadConfig, outputs,
|
|
223755
|
+
async function handleGdriveUpload(uploadConfig, outputs, root) {
|
|
223754
223756
|
const excludeSet = new Set(uploadConfig.exclude ?? []);
|
|
223755
223757
|
const toUpload = outputs.filter((o2) => !excludeSet.has(o2.name));
|
|
223756
223758
|
if (toUpload.length === 0) {
|
|
@@ -223767,7 +223769,7 @@ No bundles to upload (all excluded).`);
|
|
|
223767
223769
|
const results = [];
|
|
223768
223770
|
for (let i2 = 0;i2 < toUpload.length; i2++) {
|
|
223769
223771
|
const output = toUpload[i2];
|
|
223770
|
-
const filePath = join6(
|
|
223772
|
+
const filePath = join6(root, output.outfile);
|
|
223771
223773
|
uploadSpinner.text = `Uploading ${output.name}... (${i2 + 1}/${toUpload.length})`;
|
|
223772
223774
|
const result = await uploadFile(filePath, uploadConfig);
|
|
223773
223775
|
results.push(result);
|
package/dist/config.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ declare const UploadConfigSchema: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
/** Root configuration for srcpack. */
|
|
36
36
|
declare const ConfigSchema: z.ZodObject<{
|
|
37
|
+
root: z.ZodDefault<z.ZodString>;
|
|
37
38
|
outDir: z.ZodDefault<z.ZodString>;
|
|
38
39
|
emptyOutDir: z.ZodOptional<z.ZodBoolean>;
|
|
39
40
|
upload: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -173462,7 +173462,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
173462
173462
|
// src/config.ts
|
|
173463
173463
|
var import_cosmiconfig = __toESM(require_dist(), 1);
|
|
173464
173464
|
import { homedir } from "node:os";
|
|
173465
|
-
import { join } from "node:path";
|
|
173465
|
+
import { join, resolve } from "node:path";
|
|
173466
173466
|
|
|
173467
173467
|
// node_modules/zod/v4/classic/external.js
|
|
173468
173468
|
var exports_external = {};
|
|
@@ -187025,6 +187025,7 @@ var UploadConfigSchema = exports_external.object({
|
|
|
187025
187025
|
exclude: exports_external.array(exports_external.string()).optional()
|
|
187026
187026
|
});
|
|
187027
187027
|
var ConfigSchema = exports_external.object({
|
|
187028
|
+
root: exports_external.string().default(""),
|
|
187028
187029
|
outDir: exports_external.string().default(".srcpack"),
|
|
187029
187030
|
emptyOutDir: exports_external.boolean().optional(),
|
|
187030
187031
|
upload: exports_external.union([UploadConfigSchema, exports_external.array(UploadConfigSchema).min(1)]).optional(),
|
|
@@ -187049,6 +187050,7 @@ function parseConfig(value) {
|
|
|
187049
187050
|
throw new ConfigError(message);
|
|
187050
187051
|
}
|
|
187051
187052
|
const config2 = result.data;
|
|
187053
|
+
config2.root = config2.root ? resolve(expandPath(config2.root)) : process.cwd();
|
|
187052
187054
|
config2.outDir = expandPath(config2.outDir);
|
|
187053
187055
|
for (const bundle of Object.values(config2.bundles)) {
|
|
187054
187056
|
if (typeof bundle === "object" && !Array.isArray(bundle) && bundle.outfile) {
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -138,10 +138,10 @@ Options:
|
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
const
|
|
141
|
+
const root = config.root;
|
|
142
142
|
|
|
143
143
|
// Resolve emptyOutDir: CLI flag > config > auto (true if inside root)
|
|
144
|
-
const outDirInsideRoot = isOutDirInsideRoot(config.outDir,
|
|
144
|
+
const outDirInsideRoot = isOutDirInsideRoot(config.outDir, root);
|
|
145
145
|
const emptyOutDir = emptyOutDirFlag ?? config.emptyOutDir ?? outDirInsideRoot;
|
|
146
146
|
|
|
147
147
|
// Warn if outDir is outside root and emptyOutDir is not explicitly set
|
|
@@ -160,7 +160,7 @@ Options:
|
|
|
160
160
|
if (emptyOutDir && !dryRun) {
|
|
161
161
|
const outDirPath = isAbsolute(config.outDir)
|
|
162
162
|
? config.outDir
|
|
163
|
-
: resolve(
|
|
163
|
+
: resolve(root, config.outDir);
|
|
164
164
|
await emptyDirectory(outDirPath, [".git"]);
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -176,7 +176,7 @@ Options:
|
|
|
176
176
|
const name = bundleNames[i]!;
|
|
177
177
|
bundleSpinner.text = `Bundling ${name}... (${i + 1}/${bundleNames.length})`;
|
|
178
178
|
const bundleConfig = config.bundles[name]!;
|
|
179
|
-
const result = await bundleOne(name, bundleConfig,
|
|
179
|
+
const result = await bundleOne(name, bundleConfig, root);
|
|
180
180
|
const outfile = getOutfile(bundleConfig, name, config.outDir);
|
|
181
181
|
outputs.push({ name, outfile, result });
|
|
182
182
|
}
|
|
@@ -197,7 +197,7 @@ Options:
|
|
|
197
197
|
for (const { name, outfile, result } of outputs) {
|
|
198
198
|
const fileCount = result.index.length;
|
|
199
199
|
const lineCount = sumLines(result);
|
|
200
|
-
const outPath = join(
|
|
200
|
+
const outPath = join(root, outfile);
|
|
201
201
|
|
|
202
202
|
const nameCol = name.padEnd(maxNameLen);
|
|
203
203
|
const filesCol = formatNumber(fileCount).padStart(maxFilesLen);
|
|
@@ -244,7 +244,7 @@ Options:
|
|
|
244
244
|
|
|
245
245
|
for (const uploadConfig of uploads) {
|
|
246
246
|
if (isGdriveConfigured(uploadConfig)) {
|
|
247
|
-
await handleGdriveUpload(uploadConfig, outputs,
|
|
247
|
+
await handleGdriveUpload(uploadConfig, outputs, root);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -335,7 +335,7 @@ function printUploadConfigHelp(): void {
|
|
|
335
335
|
async function handleGdriveUpload(
|
|
336
336
|
uploadConfig: UploadConfig,
|
|
337
337
|
outputs: BundleOutput[],
|
|
338
|
-
|
|
338
|
+
root: string,
|
|
339
339
|
): Promise<void> {
|
|
340
340
|
// Filter out excluded bundles
|
|
341
341
|
const excludeSet = new Set(uploadConfig.exclude ?? []);
|
|
@@ -358,7 +358,7 @@ async function handleGdriveUpload(
|
|
|
358
358
|
|
|
359
359
|
for (let i = 0; i < toUpload.length; i++) {
|
|
360
360
|
const output = toUpload[i]!;
|
|
361
|
-
const filePath = join(
|
|
361
|
+
const filePath = join(root, output.outfile);
|
|
362
362
|
uploadSpinner.text = `Uploading ${output.name}... (${i + 1}/${toUpload.length})`;
|
|
363
363
|
const result = await uploadFile(filePath, uploadConfig);
|
|
364
364
|
results.push(result);
|
package/src/config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
5
|
import { cosmiconfig } from "cosmiconfig";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
@@ -67,6 +67,11 @@ const UploadConfigSchema = z.object({
|
|
|
67
67
|
|
|
68
68
|
/** Root configuration for srcpack. */
|
|
69
69
|
const ConfigSchema = z.object({
|
|
70
|
+
/**
|
|
71
|
+
* Project root directory. Can be absolute or relative to CWD.
|
|
72
|
+
* @default process.cwd()
|
|
73
|
+
*/
|
|
74
|
+
root: z.string().default(""),
|
|
70
75
|
/** Output directory for bundle files. Defaults to ".srcpack". */
|
|
71
76
|
outDir: z.string().default(".srcpack"),
|
|
72
77
|
/** Empty outDir before bundling. Auto-enabled when outDir is inside project root. */
|
|
@@ -106,6 +111,10 @@ export function parseConfig(value: unknown): Config {
|
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
const config = result.data;
|
|
114
|
+
// Resolve root: absolute path, relative to CWD, or CWD if empty/unset
|
|
115
|
+
config.root = config.root
|
|
116
|
+
? resolve(expandPath(config.root))
|
|
117
|
+
: process.cwd();
|
|
109
118
|
config.outDir = expandPath(config.outDir);
|
|
110
119
|
|
|
111
120
|
for (const bundle of Object.values(config.bundles)) {
|