@kevisual/cli 0.0.87 → 0.0.88
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/assistant-server.js +705 -633
- package/dist/assistant.js +130 -120
- package/dist/envision.js +5 -3
- package/package.json +1 -1
package/dist/assistant-server.js
CHANGED
|
@@ -1133,7 +1133,7 @@ var require_createBufferedReadableStream = __commonJS((exports) => {
|
|
|
1133
1133
|
exports.sizeOf = sizeOf;
|
|
1134
1134
|
exports.modeOf = modeOf;
|
|
1135
1135
|
var ByteArrayCollector_1 = require_ByteArrayCollector();
|
|
1136
|
-
function createBufferedReadableStream(upstream, size,
|
|
1136
|
+
function createBufferedReadableStream(upstream, size, logger2) {
|
|
1137
1137
|
const reader = upstream.getReader();
|
|
1138
1138
|
let streamBufferingLoggedWarning = false;
|
|
1139
1139
|
let bytesSeen = 0;
|
|
@@ -1171,7 +1171,7 @@ var require_createBufferedReadableStream = __commonJS((exports) => {
|
|
|
1171
1171
|
const newSize = merge(buffers, mode, chunk);
|
|
1172
1172
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
1173
1173
|
streamBufferingLoggedWarning = true;
|
|
1174
|
-
|
|
1174
|
+
logger2?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
1175
1175
|
}
|
|
1176
1176
|
if (newSize >= size) {
|
|
1177
1177
|
controller.enqueue(flush(buffers, mode));
|
|
@@ -1234,9 +1234,9 @@ var require_createBufferedReadable = __commonJS((exports) => {
|
|
|
1234
1234
|
var ByteArrayCollector_1 = require_ByteArrayCollector();
|
|
1235
1235
|
var createBufferedReadableStream_1 = require_createBufferedReadableStream();
|
|
1236
1236
|
var stream_type_check_1 = require_stream_type_check();
|
|
1237
|
-
function createBufferedReadable(upstream, size,
|
|
1237
|
+
function createBufferedReadable(upstream, size, logger2) {
|
|
1238
1238
|
if ((0, stream_type_check_1.isReadableStream)(upstream)) {
|
|
1239
|
-
return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size,
|
|
1239
|
+
return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger2);
|
|
1240
1240
|
}
|
|
1241
1241
|
const downstream = new node_stream_1.Readable({ read() {} });
|
|
1242
1242
|
let streamBufferingLoggedWarning = false;
|
|
@@ -1268,7 +1268,7 @@ var require_createBufferedReadable = __commonJS((exports) => {
|
|
|
1268
1268
|
const newSize = (0, createBufferedReadableStream_1.merge)(buffers, mode, chunk);
|
|
1269
1269
|
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
1270
1270
|
streamBufferingLoggedWarning = true;
|
|
1271
|
-
|
|
1271
|
+
logger2?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
1272
1272
|
}
|
|
1273
1273
|
if (newSize >= size) {
|
|
1274
1274
|
downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
|
|
@@ -1538,7 +1538,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
|
|
1540
1540
|
};
|
|
1541
|
-
var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout,
|
|
1541
|
+
var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger2) => {
|
|
1542
1542
|
if (timeoutInMs) {
|
|
1543
1543
|
return timing.setTimeout(() => {
|
|
1544
1544
|
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
@@ -1551,7 +1551,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
1551
1551
|
reject(error);
|
|
1552
1552
|
} else {
|
|
1553
1553
|
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
1554
|
-
|
|
1554
|
+
logger2?.warn?.(msg);
|
|
1555
1555
|
}
|
|
1556
1556
|
}, timeoutInMs);
|
|
1557
1557
|
}
|
|
@@ -1663,7 +1663,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
return new NodeHttpHandler(instanceOrOptions);
|
|
1665
1665
|
}
|
|
1666
|
-
static checkSocketUsage(agent, socketWarningTimestamp,
|
|
1666
|
+
static checkSocketUsage(agent, socketWarningTimestamp, logger2 = console) {
|
|
1667
1667
|
const { sockets, requests, maxSockets } = agent;
|
|
1668
1668
|
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
1669
1669
|
return socketWarningTimestamp;
|
|
@@ -1677,7 +1677,7 @@ var require_dist_cjs12 = __commonJS((exports) => {
|
|
|
1677
1677
|
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
1678
1678
|
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
1679
1679
|
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
1680
|
-
|
|
1680
|
+
logger2?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
1681
1681
|
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
1682
1682
|
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
1683
1683
|
return Date.now();
|
|
@@ -3944,7 +3944,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
3944
3944
|
}
|
|
3945
3945
|
if (typeof value === "number") {
|
|
3946
3946
|
if (value === 0 || value === 1) {
|
|
3947
|
-
|
|
3947
|
+
logger2.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
|
3948
3948
|
}
|
|
3949
3949
|
if (value === 0) {
|
|
3950
3950
|
return false;
|
|
@@ -3956,7 +3956,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
3956
3956
|
if (typeof value === "string") {
|
|
3957
3957
|
const lower = value.toLowerCase();
|
|
3958
3958
|
if (lower === "false" || lower === "true") {
|
|
3959
|
-
|
|
3959
|
+
logger2.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
|
|
3960
3960
|
}
|
|
3961
3961
|
if (lower === "false") {
|
|
3962
3962
|
return false;
|
|
@@ -3978,7 +3978,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
3978
3978
|
const parsed = parseFloat(value);
|
|
3979
3979
|
if (!Number.isNaN(parsed)) {
|
|
3980
3980
|
if (String(parsed) !== String(value)) {
|
|
3981
|
-
|
|
3981
|
+
logger2.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
|
|
3982
3982
|
}
|
|
3983
3983
|
return parsed;
|
|
3984
3984
|
}
|
|
@@ -4055,7 +4055,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
4055
4055
|
return value;
|
|
4056
4056
|
}
|
|
4057
4057
|
if (["boolean", "number", "bigint"].includes(typeof value)) {
|
|
4058
|
-
|
|
4058
|
+
logger2.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
|
|
4059
4059
|
return String(value);
|
|
4060
4060
|
}
|
|
4061
4061
|
throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
|
|
@@ -4151,7 +4151,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
4151
4151
|
`).slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join(`
|
|
4152
4152
|
`);
|
|
4153
4153
|
};
|
|
4154
|
-
var
|
|
4154
|
+
var logger2 = {
|
|
4155
4155
|
warn: console.warn
|
|
4156
4156
|
};
|
|
4157
4157
|
var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
@@ -4581,7 +4581,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
4581
4581
|
exports.limitedParseDouble = limitedParseDouble;
|
|
4582
4582
|
exports.limitedParseFloat = limitedParseFloat;
|
|
4583
4583
|
exports.limitedParseFloat32 = limitedParseFloat32;
|
|
4584
|
-
exports.logger =
|
|
4584
|
+
exports.logger = logger2;
|
|
4585
4585
|
exports.nv = nv;
|
|
4586
4586
|
exports.parseBoolean = parseBoolean;
|
|
4587
4587
|
exports.parseEpochTimestamp = parseEpochTimestamp;
|
|
@@ -5971,19 +5971,19 @@ var require_dist_cjs18 = __commonJS((exports) => {
|
|
|
5971
5971
|
name = "ProviderError";
|
|
5972
5972
|
tryNextLink;
|
|
5973
5973
|
constructor(message, options = true) {
|
|
5974
|
-
let
|
|
5974
|
+
let logger2;
|
|
5975
5975
|
let tryNextLink = true;
|
|
5976
5976
|
if (typeof options === "boolean") {
|
|
5977
|
-
|
|
5977
|
+
logger2 = undefined;
|
|
5978
5978
|
tryNextLink = options;
|
|
5979
5979
|
} else if (options != null && typeof options === "object") {
|
|
5980
|
-
|
|
5980
|
+
logger2 = options.logger;
|
|
5981
5981
|
tryNextLink = options.tryNextLink ?? true;
|
|
5982
5982
|
}
|
|
5983
5983
|
super(message);
|
|
5984
5984
|
this.tryNextLink = tryNextLink;
|
|
5985
5985
|
Object.setPrototypeOf(this, ProviderError.prototype);
|
|
5986
|
-
|
|
5986
|
+
logger2?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
|
|
5987
5987
|
}
|
|
5988
5988
|
static from(error, options = true) {
|
|
5989
5989
|
return Object.assign(new this(error.message, options), error);
|
|
@@ -8064,9 +8064,9 @@ var require_dist_cjs22 = __commonJS((exports) => {
|
|
|
8064
8064
|
this.middlewareStack.use(mw);
|
|
8065
8065
|
}
|
|
8066
8066
|
const stack = clientStack.concat(this.middlewareStack);
|
|
8067
|
-
const { logger } = configuration;
|
|
8067
|
+
const { logger: logger2 } = configuration;
|
|
8068
8068
|
const handlerExecutionContext = {
|
|
8069
|
-
logger,
|
|
8069
|
+
logger: logger2,
|
|
8070
8070
|
clientName,
|
|
8071
8071
|
commandName,
|
|
8072
8072
|
inputFilterSensitiveLog,
|
|
@@ -13075,7 +13075,7 @@ var require_dist_cjs29 = __commonJS((exports) => {
|
|
|
13075
13075
|
return false;
|
|
13076
13076
|
};
|
|
13077
13077
|
var getChecksum = async (body, { checksumAlgorithmFn, base64Encoder }) => base64Encoder(await stringHasher(checksumAlgorithmFn, body));
|
|
13078
|
-
var validateChecksumFromResponse = async (response, { config, responseAlgorithms, logger }) => {
|
|
13078
|
+
var validateChecksumFromResponse = async (response, { config, responseAlgorithms, logger: logger2 }) => {
|
|
13079
13079
|
const checksumAlgorithms = getChecksumAlgorithmListForResponse(responseAlgorithms);
|
|
13080
13080
|
const { body: responseBody, headers: responseHeaders } = response;
|
|
13081
13081
|
for (const algorithm of checksumAlgorithms) {
|
|
@@ -13087,7 +13087,7 @@ var require_dist_cjs29 = __commonJS((exports) => {
|
|
|
13087
13087
|
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config);
|
|
13088
13088
|
} catch (error) {
|
|
13089
13089
|
if (algorithm === exports.ChecksumAlgorithm.CRC64NVME) {
|
|
13090
|
-
|
|
13090
|
+
logger2?.warn(`Skipping ${exports.ChecksumAlgorithm.CRC64NVME} checksum validation: ${error.message}`);
|
|
13091
13091
|
continue;
|
|
13092
13092
|
}
|
|
13093
13093
|
throw error;
|
|
@@ -13221,12 +13221,12 @@ var require_dist_cjs31 = __commonJS((exports) => {
|
|
|
13221
13221
|
var loggerMiddleware = () => (next, context) => async (args) => {
|
|
13222
13222
|
try {
|
|
13223
13223
|
const response = await next(args);
|
|
13224
|
-
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
13224
|
+
const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context;
|
|
13225
13225
|
const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
13226
13226
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
13227
13227
|
const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
|
|
13228
13228
|
const { $metadata, ...outputWithoutMetadata } = response.output;
|
|
13229
|
-
|
|
13229
|
+
logger2?.info?.({
|
|
13230
13230
|
clientName,
|
|
13231
13231
|
commandName,
|
|
13232
13232
|
input: inputFilterSensitiveLog(args.input),
|
|
@@ -13235,10 +13235,10 @@ var require_dist_cjs31 = __commonJS((exports) => {
|
|
|
13235
13235
|
});
|
|
13236
13236
|
return response;
|
|
13237
13237
|
} catch (error) {
|
|
13238
|
-
const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
|
|
13238
|
+
const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context;
|
|
13239
13239
|
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
13240
13240
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
13241
|
-
|
|
13241
|
+
logger2?.error?.({
|
|
13242
13242
|
clientName,
|
|
13243
13243
|
commandName,
|
|
13244
13244
|
input: inputFilterSensitiveLog(args.input),
|
|
@@ -14450,7 +14450,7 @@ var require_dist_cjs36 = __commonJS((exports) => {
|
|
|
14450
14450
|
evaluateTreeRule
|
|
14451
14451
|
};
|
|
14452
14452
|
var resolveEndpoint = (ruleSetObject, options) => {
|
|
14453
|
-
const { endpointParams, logger } = options;
|
|
14453
|
+
const { endpointParams, logger: logger2 } = options;
|
|
14454
14454
|
const { parameters, rules } = ruleSetObject;
|
|
14455
14455
|
options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
|
|
14456
14456
|
const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]);
|
|
@@ -14465,7 +14465,7 @@ var require_dist_cjs36 = __commonJS((exports) => {
|
|
|
14465
14465
|
throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
|
|
14466
14466
|
}
|
|
14467
14467
|
}
|
|
14468
|
-
const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
|
|
14468
|
+
const endpoint = evaluateRules(rules, { endpointParams, logger: logger2, referenceRecord: {} });
|
|
14469
14469
|
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
|
14470
14470
|
return endpoint;
|
|
14471
14471
|
};
|
|
@@ -14960,11 +14960,11 @@ var require_dist_cjs40 = __commonJS((exports) => {
|
|
|
14960
14960
|
userAgentAppId: async () => {
|
|
14961
14961
|
const appId = await normalizedAppIdProvider();
|
|
14962
14962
|
if (!isValidUserAgentAppId(appId)) {
|
|
14963
|
-
const
|
|
14963
|
+
const logger2 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
|
|
14964
14964
|
if (typeof appId !== "string") {
|
|
14965
|
-
|
|
14965
|
+
logger2?.warn("userAgentAppId must be a string or undefined.");
|
|
14966
14966
|
} else if (appId.length > 50) {
|
|
14967
|
-
|
|
14967
|
+
logger2?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
|
|
14968
14968
|
}
|
|
14969
14969
|
}
|
|
14970
14970
|
return appId;
|
|
@@ -15627,8 +15627,8 @@ var require_dist_cjs45 = __commonJS((exports) => {
|
|
|
15627
15627
|
var isFunction = (func) => typeof func === "function";
|
|
15628
15628
|
var fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : propertyProvider.fromStatic(defaultValue);
|
|
15629
15629
|
var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
|
|
15630
|
-
const { signingName, logger } = configuration;
|
|
15631
|
-
const envOptions = { signingName, logger };
|
|
15630
|
+
const { signingName, logger: logger2 } = configuration;
|
|
15631
|
+
const envOptions = { signingName, logger: logger2 };
|
|
15632
15632
|
return propertyProvider.memoize(propertyProvider.chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
|
|
15633
15633
|
};
|
|
15634
15634
|
exports.loadConfig = loadConfig;
|
|
@@ -17331,7 +17331,7 @@ var require_dist_cjs52 = __commonJS((exports) => {
|
|
|
17331
17331
|
"http:": true,
|
|
17332
17332
|
"https:": true
|
|
17333
17333
|
};
|
|
17334
|
-
var getCmdsUri = async ({ logger }) => {
|
|
17334
|
+
var getCmdsUri = async ({ logger: logger2 }) => {
|
|
17335
17335
|
if (process.env[ENV_CMDS_RELATIVE_URI]) {
|
|
17336
17336
|
return {
|
|
17337
17337
|
hostname: CMDS_IP,
|
|
@@ -17343,13 +17343,13 @@ var require_dist_cjs52 = __commonJS((exports) => {
|
|
|
17343
17343
|
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
|
17344
17344
|
throw new propertyProvider.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
17345
17345
|
tryNextLink: false,
|
|
17346
|
-
logger
|
|
17346
|
+
logger: logger2
|
|
17347
17347
|
});
|
|
17348
17348
|
}
|
|
17349
17349
|
if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
|
|
17350
17350
|
throw new propertyProvider.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
17351
17351
|
tryNextLink: false,
|
|
17352
|
-
logger
|
|
17352
|
+
logger: logger2
|
|
17353
17353
|
});
|
|
17354
17354
|
}
|
|
17355
17355
|
return {
|
|
@@ -17359,7 +17359,7 @@ var require_dist_cjs52 = __commonJS((exports) => {
|
|
|
17359
17359
|
}
|
|
17360
17360
|
throw new propertyProvider.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
|
|
17361
17361
|
tryNextLink: false,
|
|
17362
|
-
logger
|
|
17362
|
+
logger: logger2
|
|
17363
17363
|
});
|
|
17364
17364
|
};
|
|
17365
17365
|
|
|
@@ -17412,10 +17412,10 @@ var require_dist_cjs52 = __commonJS((exports) => {
|
|
|
17412
17412
|
var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
|
|
17413
17413
|
var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
|
|
17414
17414
|
var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";
|
|
17415
|
-
var getExtendedInstanceMetadataCredentials = (credentials,
|
|
17415
|
+
var getExtendedInstanceMetadataCredentials = (credentials, logger2) => {
|
|
17416
17416
|
const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS);
|
|
17417
17417
|
const newExpiration = new Date(Date.now() + refreshInterval * 1000);
|
|
17418
|
-
|
|
17418
|
+
logger2.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " + `credentials will be attempted after ${new Date(newExpiration)}.
|
|
17419
17419
|
For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
17420
17420
|
const originalExpiration = credentials.originalExpiration ?? credentials.expiration;
|
|
17421
17421
|
return {
|
|
@@ -17425,19 +17425,19 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
17425
17425
|
};
|
|
17426
17426
|
};
|
|
17427
17427
|
var staticStabilityProvider = (provider, options = {}) => {
|
|
17428
|
-
const
|
|
17428
|
+
const logger2 = options?.logger || console;
|
|
17429
17429
|
let pastCredentials;
|
|
17430
17430
|
return async () => {
|
|
17431
17431
|
let credentials;
|
|
17432
17432
|
try {
|
|
17433
17433
|
credentials = await provider();
|
|
17434
17434
|
if (credentials.expiration && credentials.expiration.getTime() < Date.now()) {
|
|
17435
|
-
credentials = getExtendedInstanceMetadataCredentials(credentials,
|
|
17435
|
+
credentials = getExtendedInstanceMetadataCredentials(credentials, logger2);
|
|
17436
17436
|
}
|
|
17437
17437
|
} catch (e) {
|
|
17438
17438
|
if (pastCredentials) {
|
|
17439
|
-
|
|
17440
|
-
credentials = getExtendedInstanceMetadataCredentials(pastCredentials,
|
|
17439
|
+
logger2.warn("Credential renew failed: ", e);
|
|
17440
|
+
credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger2);
|
|
17441
17441
|
} else {
|
|
17442
17442
|
throw e;
|
|
17443
17443
|
}
|
|
@@ -17454,7 +17454,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
17454
17454
|
var fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger });
|
|
17455
17455
|
var getInstanceMetadataProvider = (init = {}) => {
|
|
17456
17456
|
let disableFetchToken = false;
|
|
17457
|
-
const { logger, profile } = init;
|
|
17457
|
+
const { logger: logger2, profile } = init;
|
|
17458
17458
|
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
17459
17459
|
const getCredentials = async (maxRetries2, options) => {
|
|
17460
17460
|
const isImdsV1Fallback = disableFetchToken || options.headers?.[X_AWS_EC2_METADATA_TOKEN] == null;
|
|
@@ -17518,7 +17518,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
17518
17518
|
return async () => {
|
|
17519
17519
|
const endpoint = await getInstanceMetadataEndpoint();
|
|
17520
17520
|
if (disableFetchToken) {
|
|
17521
|
-
|
|
17521
|
+
logger2?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
|
|
17522
17522
|
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
17523
17523
|
} else {
|
|
17524
17524
|
let token;
|
|
@@ -17532,7 +17532,7 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
17532
17532
|
} else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) {
|
|
17533
17533
|
disableFetchToken = true;
|
|
17534
17534
|
}
|
|
17535
|
-
|
|
17535
|
+
logger2?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
17536
17536
|
return getCredentials(maxRetries, { ...endpoint, timeout });
|
|
17537
17537
|
}
|
|
17538
17538
|
return getCredentials(maxRetries, {
|
|
@@ -17586,7 +17586,7 @@ var require_checkUrl = __commonJS((exports) => {
|
|
|
17586
17586
|
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
17587
17587
|
var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
|
17588
17588
|
var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
|
17589
|
-
var checkUrl = (url3,
|
|
17589
|
+
var checkUrl = (url3, logger2) => {
|
|
17590
17590
|
if (url3.protocol === "https:") {
|
|
17591
17591
|
return;
|
|
17592
17592
|
}
|
|
@@ -17613,7 +17613,7 @@ var require_checkUrl = __commonJS((exports) => {
|
|
|
17613
17613
|
throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
17614
17614
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
17615
17615
|
- ECS container host 169.254.170.2
|
|
17616
|
-
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
17616
|
+
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger: logger2 });
|
|
17617
17617
|
};
|
|
17618
17618
|
exports.checkUrl = checkUrl;
|
|
17619
17619
|
});
|
|
@@ -17640,13 +17640,13 @@ var require_requestHelpers = __commonJS((exports) => {
|
|
|
17640
17640
|
fragment: url3.hash
|
|
17641
17641
|
});
|
|
17642
17642
|
}
|
|
17643
|
-
async function getCredentials(response,
|
|
17643
|
+
async function getCredentials(response, logger2) {
|
|
17644
17644
|
const stream2 = (0, util_stream_1.sdkStreamMixin)(response.body);
|
|
17645
17645
|
const str = await stream2.transformToString();
|
|
17646
17646
|
if (response.statusCode === 200) {
|
|
17647
17647
|
const parsed = JSON.parse(str);
|
|
17648
17648
|
if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
|
|
17649
|
-
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
17649
|
+
throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger: logger2 });
|
|
17650
17650
|
}
|
|
17651
17651
|
return {
|
|
17652
17652
|
accessKeyId: parsed.AccessKeyId,
|
|
@@ -17660,12 +17660,12 @@ var require_requestHelpers = __commonJS((exports) => {
|
|
|
17660
17660
|
try {
|
|
17661
17661
|
parsedBody = JSON.parse(str);
|
|
17662
17662
|
} catch (e) {}
|
|
17663
|
-
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
17663
|
+
throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger: logger2 }), {
|
|
17664
17664
|
Code: parsedBody.Code,
|
|
17665
17665
|
Message: parsedBody.Message
|
|
17666
17666
|
});
|
|
17667
17667
|
}
|
|
17668
|
-
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
|
17668
|
+
throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger: logger2 });
|
|
17669
17669
|
}
|
|
17670
17670
|
});
|
|
17671
17671
|
|
|
@@ -20994,15 +20994,15 @@ var require_dist_cjs59 = __commonJS((exports) => {
|
|
|
20994
20994
|
var httpAuthSchemes = require_httpAuthSchemes();
|
|
20995
20995
|
var propertyProvider = require_dist_cjs18();
|
|
20996
20996
|
var sharedIniFileLoader = require_dist_cjs44();
|
|
20997
|
-
var
|
|
20998
|
-
var fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
|
|
20999
|
-
|
|
20997
|
+
var fs4 = __require("fs");
|
|
20998
|
+
var fromEnvSigningName = ({ logger: logger2, signingName } = {}) => async () => {
|
|
20999
|
+
logger2?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
21000
21000
|
if (!signingName) {
|
|
21001
|
-
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
|
|
21001
|
+
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger: logger2 });
|
|
21002
21002
|
}
|
|
21003
21003
|
const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
|
|
21004
21004
|
if (!(bearerTokenKey in process.env)) {
|
|
21005
|
-
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
21005
|
+
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger: logger2 });
|
|
21006
21006
|
}
|
|
21007
21007
|
const token = { token: process.env[bearerTokenKey] };
|
|
21008
21008
|
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
@@ -21040,7 +21040,7 @@ var require_dist_cjs59 = __commonJS((exports) => {
|
|
|
21040
21040
|
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
21041
21041
|
}
|
|
21042
21042
|
};
|
|
21043
|
-
var { writeFile } =
|
|
21043
|
+
var { writeFile } = fs4.promises;
|
|
21044
21044
|
var writeSSOTokenToFile = (id, ssoToken) => {
|
|
21045
21045
|
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
21046
21046
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -21115,8 +21115,8 @@ var require_dist_cjs59 = __commonJS((exports) => {
|
|
|
21115
21115
|
return existingToken;
|
|
21116
21116
|
}
|
|
21117
21117
|
};
|
|
21118
|
-
var fromStatic = ({ token, logger }) => async () => {
|
|
21119
|
-
|
|
21118
|
+
var fromStatic = ({ token, logger: logger2 }) => async () => {
|
|
21119
|
+
logger2?.debug("@aws-sdk/token-providers - fromStatic");
|
|
21120
21120
|
if (!token || !token.token) {
|
|
21121
21121
|
throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
21122
21122
|
}
|
|
@@ -21960,7 +21960,7 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
21960
21960
|
var tokenProviders = require_dist_cjs59();
|
|
21961
21961
|
var isSsoProfile = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
|
|
21962
21962
|
var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
|
|
21963
|
-
var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
|
|
21963
|
+
var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger: logger2 }) => {
|
|
21964
21964
|
let token;
|
|
21965
21965
|
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
21966
21966
|
if (ssoSession) {
|
|
@@ -21978,7 +21978,7 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
21978
21978
|
} catch (e) {
|
|
21979
21979
|
throw new propertyProvider.CredentialsProviderError(e.message, {
|
|
21980
21980
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
21981
|
-
logger
|
|
21981
|
+
logger: logger2
|
|
21982
21982
|
});
|
|
21983
21983
|
}
|
|
21984
21984
|
} else {
|
|
@@ -21987,14 +21987,14 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
21987
21987
|
} catch (e) {
|
|
21988
21988
|
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
21989
21989
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
21990
|
-
logger
|
|
21990
|
+
logger: logger2
|
|
21991
21991
|
});
|
|
21992
21992
|
}
|
|
21993
21993
|
}
|
|
21994
21994
|
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
21995
21995
|
throw new propertyProvider.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
21996
21996
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
21997
|
-
logger
|
|
21997
|
+
logger: logger2
|
|
21998
21998
|
});
|
|
21999
21999
|
}
|
|
22000
22000
|
const { accessToken } = token;
|
|
@@ -22016,14 +22016,14 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
22016
22016
|
} catch (e) {
|
|
22017
22017
|
throw new propertyProvider.CredentialsProviderError(e, {
|
|
22018
22018
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
22019
|
-
logger
|
|
22019
|
+
logger: logger2
|
|
22020
22020
|
});
|
|
22021
22021
|
}
|
|
22022
22022
|
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
|
|
22023
22023
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
22024
22024
|
throw new propertyProvider.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
22025
22025
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
22026
|
-
logger
|
|
22026
|
+
logger: logger2
|
|
22027
22027
|
});
|
|
22028
22028
|
}
|
|
22029
22029
|
const credentials = {
|
|
@@ -22041,11 +22041,11 @@ var require_dist_cjs61 = __commonJS((exports) => {
|
|
|
22041
22041
|
}
|
|
22042
22042
|
return credentials;
|
|
22043
22043
|
};
|
|
22044
|
-
var validateSsoProfile = (profile,
|
|
22044
|
+
var validateSsoProfile = (profile, logger2) => {
|
|
22045
22045
|
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
22046
22046
|
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
22047
22047
|
throw new propertyProvider.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` + `"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
|
|
22048
|
-
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
|
|
22048
|
+
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger: logger2 });
|
|
22049
22049
|
}
|
|
22050
22050
|
return profile;
|
|
22051
22051
|
};
|
|
@@ -22736,7 +22736,7 @@ var require_dist_cjs62 = __commonJS((exports) => {
|
|
|
22736
22736
|
}
|
|
22737
22737
|
async refresh(token) {
|
|
22738
22738
|
const { SigninClient, CreateOAuth2TokenCommand } = await Promise.resolve().then(() => __toESM(require_signin()));
|
|
22739
|
-
const { logger, userAgentAppId } = this.callerClientConfig ?? {};
|
|
22739
|
+
const { logger: logger2, userAgentAppId } = this.callerClientConfig ?? {};
|
|
22740
22740
|
const isH2 = (requestHandler2) => {
|
|
22741
22741
|
return requestHandler2?.metadata?.handlerProtocol === "h2";
|
|
22742
22742
|
};
|
|
@@ -22749,7 +22749,7 @@ var require_dist_cjs62 = __commonJS((exports) => {
|
|
|
22749
22749
|
},
|
|
22750
22750
|
region,
|
|
22751
22751
|
requestHandler,
|
|
22752
|
-
logger,
|
|
22752
|
+
logger: logger2,
|
|
22753
22753
|
userAgentAppId,
|
|
22754
22754
|
...this.init?.clientConfig
|
|
22755
22755
|
});
|
|
@@ -23685,9 +23685,9 @@ var require_sts = __commonJS((exports) => {
|
|
|
23685
23685
|
return async (sourceCreds, params) => {
|
|
23686
23686
|
closureSourceCreds = sourceCreds;
|
|
23687
23687
|
if (!stsClient) {
|
|
23688
|
-
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
23688
|
+
const { logger: logger2 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
23689
23689
|
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
23690
|
-
logger,
|
|
23690
|
+
logger: logger2,
|
|
23691
23691
|
profile
|
|
23692
23692
|
});
|
|
23693
23693
|
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
@@ -23698,7 +23698,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
23698
23698
|
credentialDefaultProvider: () => async () => closureSourceCreds,
|
|
23699
23699
|
region: resolvedRegion,
|
|
23700
23700
|
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
|
23701
|
-
logger
|
|
23701
|
+
logger: logger2
|
|
23702
23702
|
});
|
|
23703
23703
|
}
|
|
23704
23704
|
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleCommand(params));
|
|
@@ -23722,9 +23722,9 @@ var require_sts = __commonJS((exports) => {
|
|
|
23722
23722
|
let stsClient;
|
|
23723
23723
|
return async (params) => {
|
|
23724
23724
|
if (!stsClient) {
|
|
23725
|
-
const { logger = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
23725
|
+
const { logger: logger2 = stsOptions?.parentClientConfig?.logger, profile = stsOptions?.parentClientConfig?.profile, region, requestHandler = stsOptions?.parentClientConfig?.requestHandler, credentialProviderLogger, userAgentAppId = stsOptions?.parentClientConfig?.userAgentAppId } = stsOptions;
|
|
23726
23726
|
const resolvedRegion = await resolveRegion(region, stsOptions?.parentClientConfig?.region, credentialProviderLogger, {
|
|
23727
|
-
logger,
|
|
23727
|
+
logger: logger2,
|
|
23728
23728
|
profile
|
|
23729
23729
|
});
|
|
23730
23730
|
const isCompatibleRequestHandler = !isH2(requestHandler);
|
|
@@ -23734,7 +23734,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
23734
23734
|
profile,
|
|
23735
23735
|
region: resolvedRegion,
|
|
23736
23736
|
requestHandler: isCompatibleRequestHandler ? requestHandler : undefined,
|
|
23737
|
-
logger
|
|
23737
|
+
logger: logger2
|
|
23738
23738
|
});
|
|
23739
23739
|
}
|
|
23740
23740
|
const { Credentials, AssumedRoleUser } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params));
|
|
@@ -23866,7 +23866,7 @@ var require_dist_cjs63 = __commonJS((exports) => {
|
|
|
23866
23866
|
client.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
|
23867
23867
|
return credentials;
|
|
23868
23868
|
};
|
|
23869
|
-
var resolveProcessCredentials = async (profileName, profiles,
|
|
23869
|
+
var resolveProcessCredentials = async (profileName, profiles, logger2) => {
|
|
23870
23870
|
const profile = profiles[profileName];
|
|
23871
23871
|
if (profiles[profileName]) {
|
|
23872
23872
|
const credentialProcess = profile["credential_process"];
|
|
@@ -23882,14 +23882,14 @@ var require_dist_cjs63 = __commonJS((exports) => {
|
|
|
23882
23882
|
}
|
|
23883
23883
|
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
23884
23884
|
} catch (error) {
|
|
23885
|
-
throw new propertyProvider.CredentialsProviderError(error.message, { logger });
|
|
23885
|
+
throw new propertyProvider.CredentialsProviderError(error.message, { logger: logger2 });
|
|
23886
23886
|
}
|
|
23887
23887
|
} else {
|
|
23888
|
-
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
|
|
23888
|
+
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger: logger2 });
|
|
23889
23889
|
}
|
|
23890
23890
|
} else {
|
|
23891
23891
|
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
|
23892
|
-
logger
|
|
23892
|
+
logger: logger2
|
|
23893
23893
|
});
|
|
23894
23894
|
}
|
|
23895
23895
|
};
|
|
@@ -24045,21 +24045,21 @@ var require_dist_cjs65 = __commonJS((exports) => {
|
|
|
24045
24045
|
var propertyProvider = require_dist_cjs18();
|
|
24046
24046
|
var client = require_client();
|
|
24047
24047
|
var credentialProviderLogin = require_dist_cjs62();
|
|
24048
|
-
var resolveCredentialSource = (credentialSource, profileName,
|
|
24048
|
+
var resolveCredentialSource = (credentialSource, profileName, logger2) => {
|
|
24049
24049
|
const sourceProvidersMap = {
|
|
24050
24050
|
EcsContainer: async (options) => {
|
|
24051
24051
|
const { fromHttp } = await Promise.resolve().then(() => __toESM(require_dist_cjs53()));
|
|
24052
24052
|
const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs52()));
|
|
24053
|
-
|
|
24053
|
+
logger2?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
24054
24054
|
return async () => propertyProvider.chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
|
|
24055
24055
|
},
|
|
24056
24056
|
Ec2InstanceMetadata: async (options) => {
|
|
24057
|
-
|
|
24057
|
+
logger2?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
24058
24058
|
const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM(require_dist_cjs52()));
|
|
24059
24059
|
return async () => fromInstanceMetadata(options)().then(setNamedProvider);
|
|
24060
24060
|
},
|
|
24061
24061
|
Environment: async (options) => {
|
|
24062
|
-
|
|
24062
|
+
logger2?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
|
24063
24063
|
const { fromEnv } = await Promise.resolve().then(() => __toESM(require_dist_cjs51()));
|
|
24064
24064
|
return async () => fromEnv(options)().then(setNamedProvider);
|
|
24065
24065
|
}
|
|
@@ -24067,24 +24067,24 @@ var require_dist_cjs65 = __commonJS((exports) => {
|
|
|
24067
24067
|
if (credentialSource in sourceProvidersMap) {
|
|
24068
24068
|
return sourceProvidersMap[credentialSource];
|
|
24069
24069
|
} else {
|
|
24070
|
-
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
|
24070
|
+
throw new propertyProvider.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger: logger2 });
|
|
24071
24071
|
}
|
|
24072
24072
|
};
|
|
24073
24073
|
var setNamedProvider = (creds) => client.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
24074
|
-
var isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
|
24075
|
-
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
|
|
24074
|
+
var isAssumeRoleProfile = (arg, { profile = "default", logger: logger2 } = {}) => {
|
|
24075
|
+
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger: logger2 }) || isCredentialSourceProfile(arg, { profile, logger: logger2 }));
|
|
24076
24076
|
};
|
|
24077
|
-
var isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
|
24077
|
+
var isAssumeRoleWithSourceProfile = (arg, { profile, logger: logger2 }) => {
|
|
24078
24078
|
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
24079
24079
|
if (withSourceProfile) {
|
|
24080
|
-
|
|
24080
|
+
logger2?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
|
|
24081
24081
|
}
|
|
24082
24082
|
return withSourceProfile;
|
|
24083
24083
|
};
|
|
24084
|
-
var isCredentialSourceProfile = (arg, { profile, logger }) => {
|
|
24084
|
+
var isCredentialSourceProfile = (arg, { profile, logger: logger2 }) => {
|
|
24085
24085
|
const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
|
24086
24086
|
if (withProviderProfile) {
|
|
24087
|
-
|
|
24087
|
+
logger2?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
|
|
24088
24088
|
}
|
|
24089
24089
|
return withProviderProfile;
|
|
24090
24090
|
};
|
|
@@ -25264,7 +25264,7 @@ var require_dist_cjs70 = __commonJS((exports) => {
|
|
|
25264
25264
|
|
|
25265
25265
|
// ../node_modules/.pnpm/@smithy+hash-stream-node@4.2.8/node_modules/@smithy/hash-stream-node/dist-cjs/index.js
|
|
25266
25266
|
var require_dist_cjs71 = __commonJS((exports) => {
|
|
25267
|
-
var
|
|
25267
|
+
var fs4 = __require("fs");
|
|
25268
25268
|
var utilUtf8 = require_dist_cjs8();
|
|
25269
25269
|
var stream2 = __require("stream");
|
|
25270
25270
|
|
|
@@ -25288,7 +25288,7 @@ var require_dist_cjs71 = __commonJS((exports) => {
|
|
|
25288
25288
|
reject(new Error("Unable to calculate hash for non-file streams."));
|
|
25289
25289
|
return;
|
|
25290
25290
|
}
|
|
25291
|
-
const fileStreamTee =
|
|
25291
|
+
const fileStreamTee = fs4.createReadStream(fileStream.path, {
|
|
25292
25292
|
start: fileStream.start,
|
|
25293
25293
|
end: fileStream.end
|
|
25294
25294
|
});
|
|
@@ -33787,7 +33787,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
33787
33787
|
var site = callSiteLocation(stack[1]);
|
|
33788
33788
|
var file = site[0];
|
|
33789
33789
|
function deprecate(message) {
|
|
33790
|
-
|
|
33790
|
+
log2.call(deprecate, message);
|
|
33791
33791
|
}
|
|
33792
33792
|
deprecate._file = file;
|
|
33793
33793
|
deprecate._ignored = isignored(namespace);
|
|
@@ -33816,7 +33816,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
33816
33816
|
var str = process.env.TRACE_DEPRECATION || "";
|
|
33817
33817
|
return containsNamespace(str, namespace);
|
|
33818
33818
|
}
|
|
33819
|
-
function
|
|
33819
|
+
function log2(message, site) {
|
|
33820
33820
|
var haslisteners = eehaslisteners(process, "deprecation");
|
|
33821
33821
|
if (!haslisteners && this._ignored) {
|
|
33822
33822
|
return;
|
|
@@ -33955,7 +33955,7 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
33955
33955
|
var deprecatedfn = new Function("fn", "log", "deprecate", "message", "site", `"use strict"
|
|
33956
33956
|
` + "return function (" + args + ") {" + `log.call(deprecate, message, site)
|
|
33957
33957
|
` + `return fn.apply(this, arguments)
|
|
33958
|
-
` + "}")(fn,
|
|
33958
|
+
` + "}")(fn, log2, this, message, site);
|
|
33959
33959
|
return deprecatedfn;
|
|
33960
33960
|
}
|
|
33961
33961
|
function wrapproperty(obj, prop, message) {
|
|
@@ -33980,13 +33980,13 @@ var require_depd = __commonJS((exports, module) => {
|
|
|
33980
33980
|
var set = descriptor.set;
|
|
33981
33981
|
if (typeof get === "function") {
|
|
33982
33982
|
descriptor.get = function getter() {
|
|
33983
|
-
|
|
33983
|
+
log2.call(deprecate, message, site);
|
|
33984
33984
|
return get.apply(this, arguments);
|
|
33985
33985
|
};
|
|
33986
33986
|
}
|
|
33987
33987
|
if (typeof set === "function") {
|
|
33988
33988
|
descriptor.set = function setter() {
|
|
33989
|
-
|
|
33989
|
+
log2.call(deprecate, message, site);
|
|
33990
33990
|
return set.apply(this, arguments);
|
|
33991
33991
|
};
|
|
33992
33992
|
}
|
|
@@ -34890,21 +34890,21 @@ function envForceColor() {
|
|
|
34890
34890
|
if (env.FORCE_COLOR.length === 0) {
|
|
34891
34891
|
return 1;
|
|
34892
34892
|
}
|
|
34893
|
-
const
|
|
34894
|
-
if (![0, 1, 2, 3].includes(
|
|
34893
|
+
const level2 = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
34894
|
+
if (![0, 1, 2, 3].includes(level2)) {
|
|
34895
34895
|
return;
|
|
34896
34896
|
}
|
|
34897
|
-
return
|
|
34897
|
+
return level2;
|
|
34898
34898
|
}
|
|
34899
|
-
function translateLevel(
|
|
34900
|
-
if (
|
|
34899
|
+
function translateLevel(level2) {
|
|
34900
|
+
if (level2 === 0) {
|
|
34901
34901
|
return false;
|
|
34902
34902
|
}
|
|
34903
34903
|
return {
|
|
34904
|
-
level,
|
|
34904
|
+
level: level2,
|
|
34905
34905
|
hasBasic: true,
|
|
34906
|
-
has256:
|
|
34907
|
-
has16m:
|
|
34906
|
+
has256: level2 >= 2,
|
|
34907
|
+
has16m: level2 >= 3
|
|
34908
34908
|
};
|
|
34909
34909
|
}
|
|
34910
34910
|
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
@@ -34988,11 +34988,11 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
34988
34988
|
return min;
|
|
34989
34989
|
}
|
|
34990
34990
|
function createSupportsColor(stream2, options = {}) {
|
|
34991
|
-
const
|
|
34991
|
+
const level2 = _supportsColor(stream2, {
|
|
34992
34992
|
streamIsTTY: stream2 && stream2.isTTY,
|
|
34993
34993
|
...options
|
|
34994
34994
|
});
|
|
34995
|
-
return translateLevel(
|
|
34995
|
+
return translateLevel(level2);
|
|
34996
34996
|
}
|
|
34997
34997
|
var env, flagForceColor, supportsColor, supports_color_default;
|
|
34998
34998
|
var init_supports_color = __esm(() => {
|
|
@@ -35014,7 +35014,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
35014
35014
|
var tty2 = __require("tty");
|
|
35015
35015
|
var util = __require("util");
|
|
35016
35016
|
exports.init = init;
|
|
35017
|
-
exports.log =
|
|
35017
|
+
exports.log = log2;
|
|
35018
35018
|
exports.formatArgs = formatArgs;
|
|
35019
35019
|
exports.save = save;
|
|
35020
35020
|
exports.load = load;
|
|
@@ -35146,7 +35146,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
35146
35146
|
}
|
|
35147
35147
|
return new Date().toISOString() + " ";
|
|
35148
35148
|
}
|
|
35149
|
-
function
|
|
35149
|
+
function log2(...args) {
|
|
35150
35150
|
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + `
|
|
35151
35151
|
`);
|
|
35152
35152
|
}
|
|
@@ -45142,7 +45142,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
45142
45142
|
var escapeHtml = require_escape_html();
|
|
45143
45143
|
var etag = require_etag();
|
|
45144
45144
|
var fresh = require_fresh();
|
|
45145
|
-
var
|
|
45145
|
+
var fs5 = __require("fs");
|
|
45146
45146
|
var mime = require_mime_types();
|
|
45147
45147
|
var ms = require_ms();
|
|
45148
45148
|
var onFinished = require_on_finished();
|
|
@@ -45425,7 +45425,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
45425
45425
|
var i = 0;
|
|
45426
45426
|
var self2 = this;
|
|
45427
45427
|
debug('stat "%s"', path4);
|
|
45428
|
-
|
|
45428
|
+
fs5.stat(path4, function onstat(err, stat) {
|
|
45429
45429
|
var pathEndsWithSep = path4[path4.length - 1] === sep;
|
|
45430
45430
|
if (err && err.code === "ENOENT" && !extname(path4) && !pathEndsWithSep) {
|
|
45431
45431
|
return next(err);
|
|
@@ -45445,7 +45445,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
45445
45445
|
}
|
|
45446
45446
|
var p = path4 + "." + self2._extensions[i++];
|
|
45447
45447
|
debug('stat "%s"', p);
|
|
45448
|
-
|
|
45448
|
+
fs5.stat(p, function(err2, stat) {
|
|
45449
45449
|
if (err2)
|
|
45450
45450
|
return next(err2);
|
|
45451
45451
|
if (stat.isDirectory())
|
|
@@ -45466,7 +45466,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
45466
45466
|
}
|
|
45467
45467
|
var p = join(path4, self2._index[i]);
|
|
45468
45468
|
debug('stat "%s"', p);
|
|
45469
|
-
|
|
45469
|
+
fs5.stat(p, function(err2, stat) {
|
|
45470
45470
|
if (err2)
|
|
45471
45471
|
return next(err2);
|
|
45472
45472
|
if (stat.isDirectory())
|
|
@@ -45480,7 +45480,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
45480
45480
|
SendStream.prototype.stream = function stream(path4, options) {
|
|
45481
45481
|
var self2 = this;
|
|
45482
45482
|
var res = this.res;
|
|
45483
|
-
var stream2 =
|
|
45483
|
+
var stream2 = fs5.createReadStream(path4, options);
|
|
45484
45484
|
this.emit("stream", stream2);
|
|
45485
45485
|
stream2.pipe(res);
|
|
45486
45486
|
function cleanup() {
|
|
@@ -45696,7 +45696,7 @@ var require_path = __commonJS((exports) => {
|
|
|
45696
45696
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45697
45697
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = undefined;
|
|
45698
45698
|
var os2 = __require("os");
|
|
45699
|
-
var
|
|
45699
|
+
var path8 = __require("path");
|
|
45700
45700
|
var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
45701
45701
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
45702
45702
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
@@ -45708,7 +45708,7 @@ var require_path = __commonJS((exports) => {
|
|
|
45708
45708
|
}
|
|
45709
45709
|
exports.unixify = unixify;
|
|
45710
45710
|
function makeAbsolute(cwd, filepath) {
|
|
45711
|
-
return
|
|
45711
|
+
return path8.resolve(cwd, filepath);
|
|
45712
45712
|
}
|
|
45713
45713
|
exports.makeAbsolute = makeAbsolute;
|
|
45714
45714
|
function removeLeadingDotSegment(entry2) {
|
|
@@ -46966,7 +46966,7 @@ var require_braces = __commonJS((exports, module) => {
|
|
|
46966
46966
|
|
|
46967
46967
|
// ../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
|
|
46968
46968
|
var require_constants2 = __commonJS((exports, module) => {
|
|
46969
|
-
var
|
|
46969
|
+
var path8 = __require("path");
|
|
46970
46970
|
var WIN_SLASH = "\\\\/";
|
|
46971
46971
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
46972
46972
|
var DOT_LITERAL = "\\.";
|
|
@@ -47088,7 +47088,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
47088
47088
|
CHAR_UNDERSCORE: 95,
|
|
47089
47089
|
CHAR_VERTICAL_LINE: 124,
|
|
47090
47090
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
47091
|
-
SEP:
|
|
47091
|
+
SEP: path8.sep,
|
|
47092
47092
|
extglobChars(chars) {
|
|
47093
47093
|
return {
|
|
47094
47094
|
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
@@ -47106,7 +47106,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
47106
47106
|
|
|
47107
47107
|
// ../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
|
|
47108
47108
|
var require_utils2 = __commonJS((exports) => {
|
|
47109
|
-
var
|
|
47109
|
+
var path8 = __require("path");
|
|
47110
47110
|
var win32 = process.platform === "win32";
|
|
47111
47111
|
var {
|
|
47112
47112
|
REGEX_BACKSLASH,
|
|
@@ -47135,7 +47135,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
47135
47135
|
if (options && typeof options.windows === "boolean") {
|
|
47136
47136
|
return options.windows;
|
|
47137
47137
|
}
|
|
47138
|
-
return win32 === true ||
|
|
47138
|
+
return win32 === true || path8.sep === "\\";
|
|
47139
47139
|
};
|
|
47140
47140
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
47141
47141
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -48259,7 +48259,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
48259
48259
|
|
|
48260
48260
|
// ../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
|
|
48261
48261
|
var require_picomatch = __commonJS((exports, module) => {
|
|
48262
|
-
var
|
|
48262
|
+
var path8 = __require("path");
|
|
48263
48263
|
var scan = require_scan();
|
|
48264
48264
|
var parse = require_parse2();
|
|
48265
48265
|
var utils2 = require_utils2();
|
|
@@ -48345,7 +48345,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
48345
48345
|
};
|
|
48346
48346
|
picomatch2.matchBase = (input, glob2, options, posix = utils2.isWindows(options)) => {
|
|
48347
48347
|
const regex = glob2 instanceof RegExp ? glob2 : picomatch2.makeRe(glob2, options);
|
|
48348
|
-
return regex.test(
|
|
48348
|
+
return regex.test(path8.basename(input));
|
|
48349
48349
|
};
|
|
48350
48350
|
picomatch2.isMatch = (str, patterns, options) => picomatch2(patterns, options)(str);
|
|
48351
48351
|
picomatch2.parse = (pattern2, options) => {
|
|
@@ -48566,7 +48566,7 @@ var require_micromatch = __commonJS((exports, module) => {
|
|
|
48566
48566
|
var require_pattern = __commonJS((exports) => {
|
|
48567
48567
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48568
48568
|
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = undefined;
|
|
48569
|
-
var
|
|
48569
|
+
var path8 = __require("path");
|
|
48570
48570
|
var globParent2 = require_glob_parent();
|
|
48571
48571
|
var micromatch = require_micromatch();
|
|
48572
48572
|
var GLOBSTAR = "**";
|
|
@@ -48661,7 +48661,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
48661
48661
|
}
|
|
48662
48662
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
48663
48663
|
function isAffectDepthOfReadingPattern(pattern2) {
|
|
48664
|
-
const basename =
|
|
48664
|
+
const basename = path8.basename(pattern2);
|
|
48665
48665
|
return endsWithSlashGlobStar(pattern2) || isStaticPattern(basename);
|
|
48666
48666
|
}
|
|
48667
48667
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -48719,7 +48719,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
48719
48719
|
}
|
|
48720
48720
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
48721
48721
|
function isAbsolute(pattern2) {
|
|
48722
|
-
return
|
|
48722
|
+
return path8.isAbsolute(pattern2);
|
|
48723
48723
|
}
|
|
48724
48724
|
exports.isAbsolute = isAbsolute;
|
|
48725
48725
|
});
|
|
@@ -48882,10 +48882,10 @@ var require_utils3 = __commonJS((exports) => {
|
|
|
48882
48882
|
exports.array = array2;
|
|
48883
48883
|
var errno2 = require_errno();
|
|
48884
48884
|
exports.errno = errno2;
|
|
48885
|
-
var
|
|
48886
|
-
exports.fs =
|
|
48887
|
-
var
|
|
48888
|
-
exports.path =
|
|
48885
|
+
var fs8 = require_fs();
|
|
48886
|
+
exports.fs = fs8;
|
|
48887
|
+
var path8 = require_path();
|
|
48888
|
+
exports.path = path8;
|
|
48889
48889
|
var pattern2 = require_pattern();
|
|
48890
48890
|
exports.pattern = pattern2;
|
|
48891
48891
|
var stream3 = require_stream();
|
|
@@ -48981,8 +48981,8 @@ var require_tasks = __commonJS((exports) => {
|
|
|
48981
48981
|
var require_async = __commonJS((exports) => {
|
|
48982
48982
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48983
48983
|
exports.read = undefined;
|
|
48984
|
-
function read(
|
|
48985
|
-
settings2.fs.lstat(
|
|
48984
|
+
function read(path8, settings2, callback) {
|
|
48985
|
+
settings2.fs.lstat(path8, (lstatError, lstat) => {
|
|
48986
48986
|
if (lstatError !== null) {
|
|
48987
48987
|
callFailureCallback(callback, lstatError);
|
|
48988
48988
|
return;
|
|
@@ -48991,7 +48991,7 @@ var require_async = __commonJS((exports) => {
|
|
|
48991
48991
|
callSuccessCallback(callback, lstat);
|
|
48992
48992
|
return;
|
|
48993
48993
|
}
|
|
48994
|
-
settings2.fs.stat(
|
|
48994
|
+
settings2.fs.stat(path8, (statError, stat) => {
|
|
48995
48995
|
if (statError !== null) {
|
|
48996
48996
|
if (settings2.throwErrorOnBrokenSymbolicLink) {
|
|
48997
48997
|
callFailureCallback(callback, statError);
|
|
@@ -49020,13 +49020,13 @@ var require_async = __commonJS((exports) => {
|
|
|
49020
49020
|
var require_sync = __commonJS((exports) => {
|
|
49021
49021
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49022
49022
|
exports.read = undefined;
|
|
49023
|
-
function read(
|
|
49024
|
-
const lstat = settings2.fs.lstatSync(
|
|
49023
|
+
function read(path8, settings2) {
|
|
49024
|
+
const lstat = settings2.fs.lstatSync(path8);
|
|
49025
49025
|
if (!lstat.isSymbolicLink() || !settings2.followSymbolicLink) {
|
|
49026
49026
|
return lstat;
|
|
49027
49027
|
}
|
|
49028
49028
|
try {
|
|
49029
|
-
const stat = settings2.fs.statSync(
|
|
49029
|
+
const stat = settings2.fs.statSync(path8);
|
|
49030
49030
|
if (settings2.markSymbolicLink) {
|
|
49031
49031
|
stat.isSymbolicLink = () => true;
|
|
49032
49032
|
}
|
|
@@ -49045,12 +49045,12 @@ var require_sync = __commonJS((exports) => {
|
|
|
49045
49045
|
var require_fs2 = __commonJS((exports) => {
|
|
49046
49046
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49047
49047
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
49048
|
-
var
|
|
49048
|
+
var fs8 = __require("fs");
|
|
49049
49049
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
49050
|
-
lstat:
|
|
49051
|
-
stat:
|
|
49052
|
-
lstatSync:
|
|
49053
|
-
statSync:
|
|
49050
|
+
lstat: fs8.lstat,
|
|
49051
|
+
stat: fs8.stat,
|
|
49052
|
+
lstatSync: fs8.lstatSync,
|
|
49053
|
+
statSync: fs8.statSync
|
|
49054
49054
|
};
|
|
49055
49055
|
function createFileSystemAdapter(fsMethods) {
|
|
49056
49056
|
if (fsMethods === undefined) {
|
|
@@ -49064,13 +49064,13 @@ var require_fs2 = __commonJS((exports) => {
|
|
|
49064
49064
|
// ../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
|
|
49065
49065
|
var require_settings = __commonJS((exports) => {
|
|
49066
49066
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49067
|
-
var
|
|
49067
|
+
var fs8 = require_fs2();
|
|
49068
49068
|
|
|
49069
49069
|
class Settings {
|
|
49070
49070
|
constructor(_options = {}) {
|
|
49071
49071
|
this._options = _options;
|
|
49072
49072
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
49073
|
-
this.fs =
|
|
49073
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
|
49074
49074
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
49075
49075
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
49076
49076
|
}
|
|
@@ -49089,17 +49089,17 @@ var require_out = __commonJS((exports) => {
|
|
|
49089
49089
|
var sync2 = require_sync();
|
|
49090
49090
|
var settings_1 = require_settings();
|
|
49091
49091
|
exports.Settings = settings_1.default;
|
|
49092
|
-
function stat(
|
|
49092
|
+
function stat(path8, optionsOrSettingsOrCallback, callback) {
|
|
49093
49093
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
49094
|
-
async2.read(
|
|
49094
|
+
async2.read(path8, getSettings(), optionsOrSettingsOrCallback);
|
|
49095
49095
|
return;
|
|
49096
49096
|
}
|
|
49097
|
-
async2.read(
|
|
49097
|
+
async2.read(path8, getSettings(optionsOrSettingsOrCallback), callback);
|
|
49098
49098
|
}
|
|
49099
49099
|
exports.stat = stat;
|
|
49100
|
-
function statSync(
|
|
49100
|
+
function statSync(path8, optionsOrSettings) {
|
|
49101
49101
|
const settings2 = getSettings(optionsOrSettings);
|
|
49102
|
-
return sync2.read(
|
|
49102
|
+
return sync2.read(path8, settings2);
|
|
49103
49103
|
}
|
|
49104
49104
|
exports.statSync = statSync;
|
|
49105
49105
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -49215,8 +49215,8 @@ var require_fs3 = __commonJS((exports) => {
|
|
|
49215
49215
|
var require_utils4 = __commonJS((exports) => {
|
|
49216
49216
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49217
49217
|
exports.fs = undefined;
|
|
49218
|
-
var
|
|
49219
|
-
exports.fs =
|
|
49218
|
+
var fs8 = require_fs3();
|
|
49219
|
+
exports.fs = fs8;
|
|
49220
49220
|
});
|
|
49221
49221
|
|
|
49222
49222
|
// ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
|
|
@@ -49302,16 +49302,16 @@ var require_async2 = __commonJS((exports) => {
|
|
|
49302
49302
|
return;
|
|
49303
49303
|
}
|
|
49304
49304
|
const tasks2 = names.map((name) => {
|
|
49305
|
-
const
|
|
49305
|
+
const path8 = common2.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
|
|
49306
49306
|
return (done) => {
|
|
49307
|
-
fsStat.stat(
|
|
49307
|
+
fsStat.stat(path8, settings2.fsStatSettings, (error2, stats) => {
|
|
49308
49308
|
if (error2 !== null) {
|
|
49309
49309
|
done(error2);
|
|
49310
49310
|
return;
|
|
49311
49311
|
}
|
|
49312
49312
|
const entry2 = {
|
|
49313
49313
|
name,
|
|
49314
|
-
path:
|
|
49314
|
+
path: path8,
|
|
49315
49315
|
dirent: utils2.fs.createDirentFromStats(name, stats)
|
|
49316
49316
|
};
|
|
49317
49317
|
if (settings2.stats) {
|
|
@@ -49399,14 +49399,14 @@ var require_sync2 = __commonJS((exports) => {
|
|
|
49399
49399
|
var require_fs4 = __commonJS((exports) => {
|
|
49400
49400
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49401
49401
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
49402
|
-
var
|
|
49402
|
+
var fs8 = __require("fs");
|
|
49403
49403
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
49404
|
-
lstat:
|
|
49405
|
-
stat:
|
|
49406
|
-
lstatSync:
|
|
49407
|
-
statSync:
|
|
49408
|
-
readdir:
|
|
49409
|
-
readdirSync:
|
|
49404
|
+
lstat: fs8.lstat,
|
|
49405
|
+
stat: fs8.stat,
|
|
49406
|
+
lstatSync: fs8.lstatSync,
|
|
49407
|
+
statSync: fs8.statSync,
|
|
49408
|
+
readdir: fs8.readdir,
|
|
49409
|
+
readdirSync: fs8.readdirSync
|
|
49410
49410
|
};
|
|
49411
49411
|
function createFileSystemAdapter(fsMethods) {
|
|
49412
49412
|
if (fsMethods === undefined) {
|
|
@@ -49420,16 +49420,16 @@ var require_fs4 = __commonJS((exports) => {
|
|
|
49420
49420
|
// ../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
|
|
49421
49421
|
var require_settings2 = __commonJS((exports) => {
|
|
49422
49422
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49423
|
-
var
|
|
49423
|
+
var path8 = __require("path");
|
|
49424
49424
|
var fsStat = require_out();
|
|
49425
|
-
var
|
|
49425
|
+
var fs8 = require_fs4();
|
|
49426
49426
|
|
|
49427
49427
|
class Settings {
|
|
49428
49428
|
constructor(_options = {}) {
|
|
49429
49429
|
this._options = _options;
|
|
49430
49430
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
49431
|
-
this.fs =
|
|
49432
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
49431
|
+
this.fs = fs8.createFileSystemAdapter(this._options.fs);
|
|
49432
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path8.sep);
|
|
49433
49433
|
this.stats = this._getValue(this._options.stats, false);
|
|
49434
49434
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
49435
49435
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -49453,17 +49453,17 @@ var require_out2 = __commonJS((exports) => {
|
|
|
49453
49453
|
var sync2 = require_sync2();
|
|
49454
49454
|
var settings_1 = require_settings2();
|
|
49455
49455
|
exports.Settings = settings_1.default;
|
|
49456
|
-
function scandir(
|
|
49456
|
+
function scandir(path8, optionsOrSettingsOrCallback, callback) {
|
|
49457
49457
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
49458
|
-
async2.read(
|
|
49458
|
+
async2.read(path8, getSettings(), optionsOrSettingsOrCallback);
|
|
49459
49459
|
return;
|
|
49460
49460
|
}
|
|
49461
|
-
async2.read(
|
|
49461
|
+
async2.read(path8, getSettings(optionsOrSettingsOrCallback), callback);
|
|
49462
49462
|
}
|
|
49463
49463
|
exports.scandir = scandir;
|
|
49464
|
-
function scandirSync(
|
|
49464
|
+
function scandirSync(path8, optionsOrSettings) {
|
|
49465
49465
|
const settings2 = getSettings(optionsOrSettings);
|
|
49466
|
-
return sync2.read(
|
|
49466
|
+
return sync2.read(path8, settings2);
|
|
49467
49467
|
}
|
|
49468
49468
|
exports.scandirSync = scandirSync;
|
|
49469
49469
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -50061,7 +50061,7 @@ var require_sync4 = __commonJS((exports) => {
|
|
|
50061
50061
|
// ../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
|
|
50062
50062
|
var require_settings3 = __commonJS((exports) => {
|
|
50063
50063
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50064
|
-
var
|
|
50064
|
+
var path8 = __require("path");
|
|
50065
50065
|
var fsScandir = require_out2();
|
|
50066
50066
|
|
|
50067
50067
|
class Settings {
|
|
@@ -50072,7 +50072,7 @@ var require_settings3 = __commonJS((exports) => {
|
|
|
50072
50072
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
50073
50073
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
50074
50074
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
50075
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
50075
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path8.sep);
|
|
50076
50076
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
50077
50077
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
50078
50078
|
fs: this._options.fs,
|
|
@@ -50128,7 +50128,7 @@ var require_out3 = __commonJS((exports) => {
|
|
|
50128
50128
|
// ../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js
|
|
50129
50129
|
var require_reader2 = __commonJS((exports) => {
|
|
50130
50130
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50131
|
-
var
|
|
50131
|
+
var path8 = __require("path");
|
|
50132
50132
|
var fsStat = require_out();
|
|
50133
50133
|
var utils2 = require_utils3();
|
|
50134
50134
|
|
|
@@ -50142,7 +50142,7 @@ var require_reader2 = __commonJS((exports) => {
|
|
|
50142
50142
|
});
|
|
50143
50143
|
}
|
|
50144
50144
|
_getFullEntryPath(filepath) {
|
|
50145
|
-
return
|
|
50145
|
+
return path8.resolve(this._settings.cwd, filepath);
|
|
50146
50146
|
}
|
|
50147
50147
|
_makeEntry(stats, pattern2) {
|
|
50148
50148
|
const entry2 = {
|
|
@@ -50539,7 +50539,7 @@ var require_entry2 = __commonJS((exports) => {
|
|
|
50539
50539
|
// ../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js
|
|
50540
50540
|
var require_provider = __commonJS((exports) => {
|
|
50541
50541
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50542
|
-
var
|
|
50542
|
+
var path8 = __require("path");
|
|
50543
50543
|
var deep_1 = require_deep();
|
|
50544
50544
|
var entry_1 = require_entry();
|
|
50545
50545
|
var error_1 = require_error();
|
|
@@ -50554,7 +50554,7 @@ var require_provider = __commonJS((exports) => {
|
|
|
50554
50554
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
50555
50555
|
}
|
|
50556
50556
|
_getRootDirectory(task) {
|
|
50557
|
-
return
|
|
50557
|
+
return path8.resolve(this._settings.cwd, task.base);
|
|
50558
50558
|
}
|
|
50559
50559
|
_getReaderOptions(task) {
|
|
50560
50560
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -50723,16 +50723,16 @@ var require_sync6 = __commonJS((exports) => {
|
|
|
50723
50723
|
var require_settings4 = __commonJS((exports) => {
|
|
50724
50724
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50725
50725
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = undefined;
|
|
50726
|
-
var
|
|
50726
|
+
var fs8 = __require("fs");
|
|
50727
50727
|
var os2 = __require("os");
|
|
50728
50728
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
50729
50729
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
50730
|
-
lstat:
|
|
50731
|
-
lstatSync:
|
|
50732
|
-
stat:
|
|
50733
|
-
statSync:
|
|
50734
|
-
readdir:
|
|
50735
|
-
readdirSync:
|
|
50730
|
+
lstat: fs8.lstat,
|
|
50731
|
+
lstatSync: fs8.lstatSync,
|
|
50732
|
+
stat: fs8.stat,
|
|
50733
|
+
statSync: fs8.statSync,
|
|
50734
|
+
readdir: fs8.readdir,
|
|
50735
|
+
readdirSync: fs8.readdirSync
|
|
50736
50736
|
};
|
|
50737
50737
|
|
|
50738
50738
|
class Settings {
|
|
@@ -56809,10 +56809,10 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
56809
56809
|
exports.analyse = analyse;
|
|
56810
56810
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
56811
56811
|
let fd;
|
|
56812
|
-
const
|
|
56812
|
+
const fs13 = (0, node_1.default)();
|
|
56813
56813
|
const handler = (err, buffer) => {
|
|
56814
56814
|
if (fd) {
|
|
56815
|
-
|
|
56815
|
+
fs13.closeSync(fd);
|
|
56816
56816
|
}
|
|
56817
56817
|
if (err) {
|
|
56818
56818
|
reject(err);
|
|
@@ -56824,9 +56824,9 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
56824
56824
|
};
|
|
56825
56825
|
const sampleSize = (opts === null || opts === undefined ? undefined : opts.sampleSize) || 0;
|
|
56826
56826
|
if (sampleSize > 0) {
|
|
56827
|
-
fd =
|
|
56827
|
+
fd = fs13.openSync(filepath, "r");
|
|
56828
56828
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
56829
|
-
|
|
56829
|
+
fs13.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
56830
56830
|
if (err) {
|
|
56831
56831
|
handler(err, null);
|
|
56832
56832
|
} else {
|
|
@@ -56838,22 +56838,22 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
56838
56838
|
});
|
|
56839
56839
|
return;
|
|
56840
56840
|
}
|
|
56841
|
-
|
|
56841
|
+
fs13.readFile(filepath, handler);
|
|
56842
56842
|
});
|
|
56843
56843
|
exports.detectFile = detectFile;
|
|
56844
56844
|
var detectFileSync = (filepath, opts = {}) => {
|
|
56845
|
-
const
|
|
56845
|
+
const fs13 = (0, node_1.default)();
|
|
56846
56846
|
if (opts && opts.sampleSize) {
|
|
56847
|
-
const fd =
|
|
56847
|
+
const fd = fs13.openSync(filepath, "r");
|
|
56848
56848
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
56849
|
-
const bytesRead =
|
|
56849
|
+
const bytesRead = fs13.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
56850
56850
|
if (bytesRead < opts.sampleSize) {
|
|
56851
56851
|
sample = sample.subarray(0, bytesRead);
|
|
56852
56852
|
}
|
|
56853
|
-
|
|
56853
|
+
fs13.closeSync(fd);
|
|
56854
56854
|
return (0, exports.detect)(sample);
|
|
56855
56855
|
}
|
|
56856
|
-
return (0, exports.detect)(
|
|
56856
|
+
return (0, exports.detect)(fs13.readFileSync(filepath));
|
|
56857
56857
|
};
|
|
56858
56858
|
exports.detectFileSync = detectFileSync;
|
|
56859
56859
|
exports.default = {
|
|
@@ -72734,18 +72734,18 @@ var require_utils6 = __commonJS((exports, module) => {
|
|
|
72734
72734
|
if (decode2)
|
|
72735
72735
|
return decode2(data, hint);
|
|
72736
72736
|
}
|
|
72737
|
-
function basename(
|
|
72738
|
-
if (typeof
|
|
72737
|
+
function basename(path14) {
|
|
72738
|
+
if (typeof path14 !== "string")
|
|
72739
72739
|
return "";
|
|
72740
|
-
for (let i =
|
|
72741
|
-
switch (
|
|
72740
|
+
for (let i = path14.length - 1;i >= 0; --i) {
|
|
72741
|
+
switch (path14.charCodeAt(i)) {
|
|
72742
72742
|
case 47:
|
|
72743
72743
|
case 92:
|
|
72744
|
-
|
|
72745
|
-
return
|
|
72744
|
+
path14 = path14.slice(i + 1);
|
|
72745
|
+
return path14 === ".." || path14 === "." ? "" : path14;
|
|
72746
72746
|
}
|
|
72747
72747
|
}
|
|
72748
|
-
return
|
|
72748
|
+
return path14 === ".." || path14 === "." ? "" : path14;
|
|
72749
72749
|
}
|
|
72750
72750
|
var TOKEN = [
|
|
72751
72751
|
0,
|
|
@@ -76767,8 +76767,8 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
76767
76767
|
var require_command = __commonJS((exports) => {
|
|
76768
76768
|
var EventEmitter5 = __require("node:events").EventEmitter;
|
|
76769
76769
|
var childProcess = __require("node:child_process");
|
|
76770
|
-
var
|
|
76771
|
-
var
|
|
76770
|
+
var path16 = __require("node:path");
|
|
76771
|
+
var fs16 = __require("node:fs");
|
|
76772
76772
|
var process7 = __require("node:process");
|
|
76773
76773
|
var { Argument, humanReadableArgName } = require_argument();
|
|
76774
76774
|
var { CommanderError } = require_error2();
|
|
@@ -77303,7 +77303,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77303
77303
|
this.processedArgs = [];
|
|
77304
77304
|
}
|
|
77305
77305
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
77306
|
-
if (
|
|
77306
|
+
if (fs16.existsSync(executableFile))
|
|
77307
77307
|
return;
|
|
77308
77308
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
77309
77309
|
const executableMissing = `'${executableFile}' does not exist
|
|
@@ -77317,12 +77317,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77317
77317
|
let launchWithNode = false;
|
|
77318
77318
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
77319
77319
|
function findFile(baseDir, baseName) {
|
|
77320
|
-
const localBin =
|
|
77321
|
-
if (
|
|
77320
|
+
const localBin = path16.resolve(baseDir, baseName);
|
|
77321
|
+
if (fs16.existsSync(localBin))
|
|
77322
77322
|
return localBin;
|
|
77323
|
-
if (sourceExt.includes(
|
|
77323
|
+
if (sourceExt.includes(path16.extname(baseName)))
|
|
77324
77324
|
return;
|
|
77325
|
-
const foundExt = sourceExt.find((ext) =>
|
|
77325
|
+
const foundExt = sourceExt.find((ext) => fs16.existsSync(`${localBin}${ext}`));
|
|
77326
77326
|
if (foundExt)
|
|
77327
77327
|
return `${localBin}${foundExt}`;
|
|
77328
77328
|
return;
|
|
@@ -77334,23 +77334,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77334
77334
|
if (this._scriptPath) {
|
|
77335
77335
|
let resolvedScriptPath;
|
|
77336
77336
|
try {
|
|
77337
|
-
resolvedScriptPath =
|
|
77337
|
+
resolvedScriptPath = fs16.realpathSync(this._scriptPath);
|
|
77338
77338
|
} catch {
|
|
77339
77339
|
resolvedScriptPath = this._scriptPath;
|
|
77340
77340
|
}
|
|
77341
|
-
executableDir =
|
|
77341
|
+
executableDir = path16.resolve(path16.dirname(resolvedScriptPath), executableDir);
|
|
77342
77342
|
}
|
|
77343
77343
|
if (executableDir) {
|
|
77344
77344
|
let localFile = findFile(executableDir, executableFile);
|
|
77345
77345
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
77346
|
-
const legacyName =
|
|
77346
|
+
const legacyName = path16.basename(this._scriptPath, path16.extname(this._scriptPath));
|
|
77347
77347
|
if (legacyName !== this._name) {
|
|
77348
77348
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
77349
77349
|
}
|
|
77350
77350
|
}
|
|
77351
77351
|
executableFile = localFile || executableFile;
|
|
77352
77352
|
}
|
|
77353
|
-
launchWithNode = sourceExt.includes(
|
|
77353
|
+
launchWithNode = sourceExt.includes(path16.extname(executableFile));
|
|
77354
77354
|
let proc;
|
|
77355
77355
|
if (process7.platform !== "win32") {
|
|
77356
77356
|
if (launchWithNode) {
|
|
@@ -77939,13 +77939,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
77939
77939
|
cmd.helpGroup(this._defaultCommandGroup);
|
|
77940
77940
|
}
|
|
77941
77941
|
nameFromFilename(filename) {
|
|
77942
|
-
this._name =
|
|
77942
|
+
this._name = path16.basename(filename, path16.extname(filename));
|
|
77943
77943
|
return this;
|
|
77944
77944
|
}
|
|
77945
|
-
executableDir(
|
|
77946
|
-
if (
|
|
77945
|
+
executableDir(path17) {
|
|
77946
|
+
if (path17 === undefined)
|
|
77947
77947
|
return this._executableDir;
|
|
77948
|
-
this._executableDir =
|
|
77948
|
+
this._executableDir = path17;
|
|
77949
77949
|
return this;
|
|
77950
77950
|
}
|
|
77951
77951
|
helpInformation(contextOptions) {
|
|
@@ -83605,8 +83605,8 @@ class HttpChain {
|
|
|
83605
83605
|
}
|
|
83606
83606
|
|
|
83607
83607
|
// src/services/init/index.ts
|
|
83608
|
-
import
|
|
83609
|
-
import
|
|
83608
|
+
import fs10 from "node:fs";
|
|
83609
|
+
import path10 from "node:path";
|
|
83610
83610
|
|
|
83611
83611
|
// src/module/assistant/config/index.ts
|
|
83612
83612
|
import path from "path";
|
|
@@ -83626,7 +83626,9 @@ var checkFileExists = (filePath, checkIsFile = false) => {
|
|
|
83626
83626
|
return false;
|
|
83627
83627
|
}
|
|
83628
83628
|
};
|
|
83629
|
-
var createDir = (dirPath) => {
|
|
83629
|
+
var createDir = (dirPath, isCreate = true) => {
|
|
83630
|
+
if (!isCreate)
|
|
83631
|
+
return dirPath;
|
|
83630
83632
|
if (!checkFileExists(dirPath)) {
|
|
83631
83633
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
83632
83634
|
}
|
|
@@ -83635,11 +83637,119 @@ var createDir = (dirPath) => {
|
|
|
83635
83637
|
|
|
83636
83638
|
// src/module/assistant/config/index.ts
|
|
83637
83639
|
var import_dotenv = __toESM(require_main(), 1);
|
|
83640
|
+
|
|
83641
|
+
// ../node_modules/.pnpm/@kevisual+logger@0.0.4/node_modules/@kevisual/logger/dist/logger.mjs
|
|
83642
|
+
var showTime = (time, format = "hh:mm:ss") => {
|
|
83643
|
+
const date = new Date(time);
|
|
83644
|
+
const pad = (n) => n.toString().padStart(2, "0");
|
|
83645
|
+
const year = date.getFullYear();
|
|
83646
|
+
const month = pad(date.getMonth() + 1);
|
|
83647
|
+
const day = pad(date.getDate());
|
|
83648
|
+
const hours = pad(date.getHours());
|
|
83649
|
+
const minutes = pad(date.getMinutes());
|
|
83650
|
+
const seconds = pad(date.getSeconds());
|
|
83651
|
+
if (format === "YYYY-MM-DD hh:mm:ss") {
|
|
83652
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
83653
|
+
}
|
|
83654
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
83655
|
+
};
|
|
83656
|
+
var logLevel = ["debug", "info", "warn", "error"];
|
|
83657
|
+
var computeLevel = (level, currentLevel) => {
|
|
83658
|
+
const levelIndex = logLevel.indexOf(level);
|
|
83659
|
+
const currentLevelIndex = logLevel.indexOf(currentLevel);
|
|
83660
|
+
return levelIndex >= currentLevelIndex;
|
|
83661
|
+
};
|
|
83662
|
+
|
|
83663
|
+
class Printer {
|
|
83664
|
+
constructor() {}
|
|
83665
|
+
info(...args) {
|
|
83666
|
+
console.log(...args);
|
|
83667
|
+
}
|
|
83668
|
+
debug(...args) {
|
|
83669
|
+
console.debug(...args);
|
|
83670
|
+
}
|
|
83671
|
+
warn(...args) {
|
|
83672
|
+
console.warn(...args);
|
|
83673
|
+
}
|
|
83674
|
+
error(...args) {
|
|
83675
|
+
console.error(...args);
|
|
83676
|
+
}
|
|
83677
|
+
}
|
|
83678
|
+
|
|
83679
|
+
class Logger {
|
|
83680
|
+
level = "info";
|
|
83681
|
+
printer;
|
|
83682
|
+
showTime;
|
|
83683
|
+
format;
|
|
83684
|
+
constructor(opts) {
|
|
83685
|
+
if (opts?.level) {
|
|
83686
|
+
const normalizedLevel = opts.level.toLowerCase();
|
|
83687
|
+
if (logLevel.includes(normalizedLevel)) {
|
|
83688
|
+
this.level = normalizedLevel;
|
|
83689
|
+
} else {
|
|
83690
|
+
this.level = "info";
|
|
83691
|
+
}
|
|
83692
|
+
} else {
|
|
83693
|
+
this.level = "info";
|
|
83694
|
+
}
|
|
83695
|
+
this.printer = opts?.printer ?? new Printer;
|
|
83696
|
+
this.showTime = opts?.showTime ?? false;
|
|
83697
|
+
this.format = opts?.format ?? "HH:mm:ss";
|
|
83698
|
+
}
|
|
83699
|
+
print(level, ...args) {
|
|
83700
|
+
if (computeLevel(level, this.level)) {
|
|
83701
|
+
if (this.showTime) {
|
|
83702
|
+
const time = showTime(Date.now());
|
|
83703
|
+
args.unshift(time);
|
|
83704
|
+
}
|
|
83705
|
+
this.printer[level](...args);
|
|
83706
|
+
}
|
|
83707
|
+
}
|
|
83708
|
+
log(...args) {
|
|
83709
|
+
this.print("info", ...args);
|
|
83710
|
+
}
|
|
83711
|
+
info(...args) {
|
|
83712
|
+
this.print("info", ...args);
|
|
83713
|
+
}
|
|
83714
|
+
debug(...args) {
|
|
83715
|
+
this.print("debug", ...args);
|
|
83716
|
+
}
|
|
83717
|
+
warn(...args) {
|
|
83718
|
+
this.print("warn", ...args);
|
|
83719
|
+
}
|
|
83720
|
+
error(...args) {
|
|
83721
|
+
this.print("error", ...args);
|
|
83722
|
+
}
|
|
83723
|
+
}
|
|
83724
|
+
|
|
83725
|
+
// src/module/logger.ts
|
|
83726
|
+
var level = process.env.LOG_LEVEL || "info";
|
|
83727
|
+
var logger = new Logger({ level });
|
|
83728
|
+
var console2 = {
|
|
83729
|
+
log: logger.info,
|
|
83730
|
+
error: logger.error,
|
|
83731
|
+
warn: logger.warn,
|
|
83732
|
+
info: logger.info,
|
|
83733
|
+
debug: logger.debug
|
|
83734
|
+
};
|
|
83735
|
+
var logError = (message, data) => logger.error(data, message);
|
|
83736
|
+
var logWarning = (message, data) => logger.warn(data, message);
|
|
83737
|
+
var logInfo = (message, data) => logger.info(data, message);
|
|
83738
|
+
var logDebug = (message, data) => logger.debug(data, message);
|
|
83739
|
+
var log = {
|
|
83740
|
+
log: logInfo,
|
|
83741
|
+
error: logError,
|
|
83742
|
+
warn: logWarning,
|
|
83743
|
+
info: logInfo,
|
|
83744
|
+
debug: logDebug
|
|
83745
|
+
};
|
|
83746
|
+
|
|
83747
|
+
// src/module/assistant/config/index.ts
|
|
83638
83748
|
var kevisualDir = path.join(homedir(), "kevisual");
|
|
83639
83749
|
var envKevisualDir = process.env.ASSISTANT_CONFIG_DIR;
|
|
83640
83750
|
if (envKevisualDir) {
|
|
83641
83751
|
kevisualDir = envKevisualDir;
|
|
83642
|
-
|
|
83752
|
+
logger.debug("使用环境变量 ASSISTANT_CONFIG_DIR 作为 kevisual 目录:", kevisualDir);
|
|
83643
83753
|
}
|
|
83644
83754
|
var configDir = createDir(path.join(kevisualDir, "assistant-app"));
|
|
83645
83755
|
var initConfig = (configRootPath) => {
|
|
@@ -83684,8 +83794,8 @@ class AssistantConfig {
|
|
|
83684
83794
|
}
|
|
83685
83795
|
return this.#configPath;
|
|
83686
83796
|
}
|
|
83687
|
-
init() {
|
|
83688
|
-
this.configPath = initConfig(this.configDir);
|
|
83797
|
+
init(configDir2) {
|
|
83798
|
+
this.configPath = initConfig(configDir2 || this.configDir);
|
|
83689
83799
|
this.isMountedConfig = true;
|
|
83690
83800
|
}
|
|
83691
83801
|
checkMounted() {
|
|
@@ -83821,7 +83931,7 @@ class AssistantConfig {
|
|
|
83821
83931
|
}
|
|
83822
83932
|
}
|
|
83823
83933
|
function parseArgs(args) {
|
|
83824
|
-
const result = {};
|
|
83934
|
+
const result = { home: true };
|
|
83825
83935
|
for (let i = 0;i < args.length; i++) {
|
|
83826
83936
|
const arg = args[i];
|
|
83827
83937
|
if (arg === "--root") {
|
|
@@ -83830,11 +83940,13 @@ function parseArgs(args) {
|
|
|
83830
83940
|
i++;
|
|
83831
83941
|
}
|
|
83832
83942
|
}
|
|
83833
|
-
result.home = true;
|
|
83834
83943
|
if (arg === "--help" || arg === "-h") {
|
|
83835
83944
|
result.help = true;
|
|
83836
83945
|
}
|
|
83837
83946
|
}
|
|
83947
|
+
if (result.root) {
|
|
83948
|
+
result.home = false;
|
|
83949
|
+
}
|
|
83838
83950
|
return result;
|
|
83839
83951
|
}
|
|
83840
83952
|
var parseHomeArg = (homedir2) => {
|
|
@@ -83884,12 +83996,23 @@ function rewriteCookieDomain(cookie, domainRewrite) {
|
|
|
83884
83996
|
return [nameValue, ...newAttributes].join("; ");
|
|
83885
83997
|
}
|
|
83886
83998
|
|
|
83999
|
+
// src/module/assistant/proxy/pipe.ts
|
|
84000
|
+
import * as fs3 from "fs";
|
|
84001
|
+
|
|
83887
84002
|
// src/module/assistant/proxy/utils.ts
|
|
83888
84003
|
var isBun3 = typeof Bun !== "undefined" && Bun?.version != null;
|
|
83889
84004
|
var isNode = typeof process !== "undefined" && process?.versions != null && process.versions?.node != null;
|
|
83890
84005
|
var isDeno = typeof Deno !== "undefined" && Deno?.version != null && Deno?.version?.deno != null;
|
|
83891
84006
|
|
|
83892
84007
|
// src/module/assistant/proxy/pipe.ts
|
|
84008
|
+
var pipeFileStream = (filePath, res) => {
|
|
84009
|
+
const readStream = fs3.createReadStream(filePath);
|
|
84010
|
+
if (isBun3) {
|
|
84011
|
+
res.pipe(readStream);
|
|
84012
|
+
} else {
|
|
84013
|
+
readStream.pipe(res, { end: true });
|
|
84014
|
+
}
|
|
84015
|
+
};
|
|
83893
84016
|
var pipeStream = (readStream, res) => {
|
|
83894
84017
|
if (isBun3) {
|
|
83895
84018
|
res.pipe(readStream);
|
|
@@ -83934,7 +84057,7 @@ var pipeProxyReq = async (req, proxyReq, res) => {
|
|
|
83934
84057
|
proxyReq.end();
|
|
83935
84058
|
return;
|
|
83936
84059
|
}
|
|
83937
|
-
|
|
84060
|
+
logger.debug("Bun pipeProxyReq content-type", contentType);
|
|
83938
84061
|
const bodyString = req.body;
|
|
83939
84062
|
bodyString && proxyReq.write(bodyString);
|
|
83940
84063
|
proxyReq.end();
|
|
@@ -84039,9 +84162,9 @@ var import_client_s32 = __toESM(require_dist_cjs75(), 1);
|
|
|
84039
84162
|
|
|
84040
84163
|
// ../node_modules/.pnpm/@kevisual+oss@0.0.16/node_modules/@kevisual/oss/src/s3/core.ts
|
|
84041
84164
|
var import_client_s3 = __toESM(require_dist_cjs75(), 1);
|
|
84042
|
-
import
|
|
84165
|
+
import fs4 from "node:fs";
|
|
84043
84166
|
|
|
84044
|
-
// ../node_modules/.pnpm/es-toolkit@1.
|
|
84167
|
+
// ../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/object/omit.mjs
|
|
84045
84168
|
function omit(obj, keys) {
|
|
84046
84169
|
const result = { ...obj };
|
|
84047
84170
|
for (let i = 0;i < keys.length; i++) {
|
|
@@ -84232,8 +84355,8 @@ class OssBase {
|
|
|
84232
84355
|
};
|
|
84233
84356
|
}
|
|
84234
84357
|
async fPutObject(objectName, filePath, metaData) {
|
|
84235
|
-
const fileStream =
|
|
84236
|
-
const stat =
|
|
84358
|
+
const fileStream = fs4.createReadStream(filePath);
|
|
84359
|
+
const stat = fs4.statSync(filePath);
|
|
84237
84360
|
const { standardHeaders, customMetadata } = extractStandardHeaders(metaData || {});
|
|
84238
84361
|
const command = new import_client_s3.PutObjectCommand({
|
|
84239
84362
|
Bucket: this.bucketName,
|
|
@@ -84430,6 +84553,13 @@ var s3Proxy = async (req, res, proxyApi) => {
|
|
|
84430
84553
|
if (objectPath.startsWith(s3.bucket + "/")) {
|
|
84431
84554
|
objectPath = objectPath.replace(s3.bucket + "/", "");
|
|
84432
84555
|
}
|
|
84556
|
+
if (objectPath.endsWith("/")) {
|
|
84557
|
+
res.statusCode = 200;
|
|
84558
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
84559
|
+
const list = await oss.listObjects(objectPath);
|
|
84560
|
+
res.end(JSON.stringify(list, null, 2));
|
|
84561
|
+
return;
|
|
84562
|
+
}
|
|
84433
84563
|
oss.getObject(objectPath).then((response) => {
|
|
84434
84564
|
if (!response.Body) {
|
|
84435
84565
|
res.statusCode = 404;
|
|
@@ -84457,167 +84587,106 @@ var s3Proxy = async (req, res, proxyApi) => {
|
|
|
84457
84587
|
return;
|
|
84458
84588
|
};
|
|
84459
84589
|
|
|
84460
|
-
// src/module/assistant/proxy/proxy.ts
|
|
84461
|
-
var proxy = (req, res, proxyApi) => {
|
|
84462
|
-
if (proxyApi.type === "http" || !proxyApi.type) {
|
|
84463
|
-
return httpProxy(req, res, proxyApi);
|
|
84464
|
-
}
|
|
84465
|
-
console.log("proxyApi", proxyApi);
|
|
84466
|
-
if (proxyApi.type === "s3") {
|
|
84467
|
-
return s3Proxy(req, res, proxyApi);
|
|
84468
|
-
}
|
|
84469
|
-
};
|
|
84470
84590
|
// src/module/assistant/proxy/file-proxy.ts
|
|
84471
84591
|
var import_send = __toESM(require_send(), 1);
|
|
84472
|
-
import
|
|
84592
|
+
import path4 from "node:path";
|
|
84473
84593
|
|
|
84474
|
-
//
|
|
84475
|
-
|
|
84476
|
-
|
|
84477
|
-
const
|
|
84478
|
-
const
|
|
84479
|
-
|
|
84480
|
-
|
|
84481
|
-
|
|
84482
|
-
|
|
84483
|
-
|
|
84484
|
-
|
|
84485
|
-
|
|
84486
|
-
|
|
84487
|
-
|
|
84488
|
-
|
|
84489
|
-
|
|
84490
|
-
|
|
84491
|
-
|
|
84492
|
-
|
|
84493
|
-
|
|
84594
|
+
// src/module/assistant/proxy/module/mime.ts
|
|
84595
|
+
import path3 from "path";
|
|
84596
|
+
var getContentType2 = (filePath) => {
|
|
84597
|
+
const extname = path3.extname(filePath);
|
|
84598
|
+
const contentType = {
|
|
84599
|
+
".html": "text/html; charset=utf-8",
|
|
84600
|
+
".js": "text/javascript; charset=utf-8",
|
|
84601
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
84602
|
+
".css": "text/css; charset=utf-8",
|
|
84603
|
+
".txt": "text/plain; charset=utf-8",
|
|
84604
|
+
".json": "application/json; charset=utf-8",
|
|
84605
|
+
".png": "image/png",
|
|
84606
|
+
".jpg": "image/jpg",
|
|
84607
|
+
".gif": "image/gif",
|
|
84608
|
+
".svg": "image/svg+xml",
|
|
84609
|
+
".wav": "audio/wav",
|
|
84610
|
+
".mp4": "video/mp4",
|
|
84611
|
+
".md": "text/markdown; charset=utf-8",
|
|
84612
|
+
".ico": "image/x-icon",
|
|
84613
|
+
".webp": "image/webp",
|
|
84614
|
+
".webm": "video/webm",
|
|
84615
|
+
".ogg": "audio/ogg",
|
|
84616
|
+
".mp3": "audio/mpeg",
|
|
84617
|
+
".m4a": "audio/mp4",
|
|
84618
|
+
".m3u8": "application/vnd.apple.mpegurl",
|
|
84619
|
+
".ts": "video/mp2t",
|
|
84620
|
+
".pdf": "application/pdf",
|
|
84621
|
+
".doc": "application/msword",
|
|
84622
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
84623
|
+
".ppt": "application/vnd.ms-powerpoint",
|
|
84624
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
84625
|
+
".xls": "application/vnd.ms-excel",
|
|
84626
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
84627
|
+
".csv": "text/csv; charset=utf-8",
|
|
84628
|
+
".xml": "application/xml; charset=utf-8",
|
|
84629
|
+
".rtf": "application/rtf",
|
|
84630
|
+
".eot": "application/vnd.ms-fontobject",
|
|
84631
|
+
".ttf": "font/ttf",
|
|
84632
|
+
".woff": "font/woff",
|
|
84633
|
+
".woff2": "font/woff2",
|
|
84634
|
+
".otf": "font/otf",
|
|
84635
|
+
".wasm": "application/wasm",
|
|
84636
|
+
".pem": "application/x-pem-file",
|
|
84637
|
+
".crt": "application/x-x509-ca-cert",
|
|
84638
|
+
".yaml": "application/x-yaml; charset=utf-8",
|
|
84639
|
+
".yml": "application/x-yaml; charset=utf-8",
|
|
84640
|
+
".zip": "application/octet-stream"
|
|
84641
|
+
};
|
|
84642
|
+
return contentType[extname] || "application/octet-stream";
|
|
84494
84643
|
};
|
|
84495
84644
|
|
|
84496
|
-
|
|
84497
|
-
|
|
84498
|
-
|
|
84499
|
-
|
|
84500
|
-
}
|
|
84501
|
-
|
|
84502
|
-
|
|
84503
|
-
|
|
84504
|
-
warn(...args) {
|
|
84505
|
-
console.warn(...args);
|
|
84506
|
-
}
|
|
84507
|
-
error(...args) {
|
|
84508
|
-
console.error(...args);
|
|
84645
|
+
// src/module/assistant/proxy/file-proxy.ts
|
|
84646
|
+
var fileProxy2 = (req, res, proxyApi) => {
|
|
84647
|
+
res.statusCode = 501;
|
|
84648
|
+
const url3 = new URL(req.url, "http://localhost");
|
|
84649
|
+
const { rootPath, indexPath = "" } = proxyApi?.file || {};
|
|
84650
|
+
if (!rootPath) {
|
|
84651
|
+
res.end(`系统未配置根路径 rootPath id:[${proxyApi?.file?.id}]`);
|
|
84652
|
+
return;
|
|
84509
84653
|
}
|
|
84510
|
-
|
|
84511
|
-
|
|
84512
|
-
|
|
84513
|
-
|
|
84514
|
-
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
|
|
84518
|
-
|
|
84519
|
-
|
|
84520
|
-
|
|
84521
|
-
|
|
84522
|
-
} else {
|
|
84523
|
-
this.level = "info";
|
|
84524
|
-
}
|
|
84654
|
+
const pathname = url3.pathname;
|
|
84655
|
+
let targetFilepath = pathname.replace(proxyApi.path || "", "");
|
|
84656
|
+
if (targetFilepath.endsWith("/")) {
|
|
84657
|
+
targetFilepath += "index.html";
|
|
84658
|
+
}
|
|
84659
|
+
const filePath = path4.join(rootPath || process.cwd(), targetFilepath);
|
|
84660
|
+
const indexTargetPath = path4.join(rootPath || process.cwd(), indexPath);
|
|
84661
|
+
let sendPath = filePath;
|
|
84662
|
+
if (!checkFileExists(filePath)) {
|
|
84663
|
+
res.setHeader("X-Proxy-File", "false");
|
|
84664
|
+
if (indexPath && checkFileExists(indexTargetPath)) {
|
|
84665
|
+
sendPath = indexTargetPath;
|
|
84525
84666
|
} else {
|
|
84526
|
-
|
|
84527
|
-
|
|
84528
|
-
|
|
84529
|
-
this.showTime = opts?.showTime ?? false;
|
|
84530
|
-
this.format = opts?.format ?? "HH:mm:ss";
|
|
84531
|
-
}
|
|
84532
|
-
print(level, ...args) {
|
|
84533
|
-
if (computeLevel(level, this.level)) {
|
|
84534
|
-
if (this.showTime) {
|
|
84535
|
-
const time = showTime(Date.now());
|
|
84536
|
-
args.unshift(time);
|
|
84537
|
-
}
|
|
84538
|
-
this.printer[level](...args);
|
|
84667
|
+
res.statusCode = 404;
|
|
84668
|
+
res.end(`文件不存在, 路径: ${filePath}`);
|
|
84669
|
+
return;
|
|
84539
84670
|
}
|
|
84671
|
+
} else {
|
|
84672
|
+
res.setHeader("X-Proxy-File", "true");
|
|
84540
84673
|
}
|
|
84541
|
-
|
|
84542
|
-
|
|
84543
|
-
|
|
84544
|
-
info(...args) {
|
|
84545
|
-
this.print("info", ...args);
|
|
84546
|
-
}
|
|
84547
|
-
debug(...args) {
|
|
84548
|
-
this.print("debug", ...args);
|
|
84549
|
-
}
|
|
84550
|
-
warn(...args) {
|
|
84551
|
-
this.print("warn", ...args);
|
|
84552
|
-
}
|
|
84553
|
-
error(...args) {
|
|
84554
|
-
this.print("error", ...args);
|
|
84555
|
-
}
|
|
84556
|
-
}
|
|
84557
|
-
|
|
84558
|
-
// src/module/logger.ts
|
|
84559
|
-
var level = process.env.LOG_LEVEL || "info";
|
|
84560
|
-
var logger = new Logger({ level });
|
|
84561
|
-
var console2 = {
|
|
84562
|
-
log: logger.info,
|
|
84563
|
-
error: logger.error,
|
|
84564
|
-
warn: logger.warn,
|
|
84565
|
-
info: logger.info,
|
|
84566
|
-
debug: logger.debug
|
|
84567
|
-
};
|
|
84568
|
-
var logError = (message, data) => logger.error(data, message);
|
|
84569
|
-
var logWarning = (message, data) => logger.warn(data, message);
|
|
84570
|
-
var logInfo = (message, data) => logger.info(data, message);
|
|
84571
|
-
var logDebug = (message, data) => logger.debug(data, message);
|
|
84572
|
-
var log = {
|
|
84573
|
-
log: logInfo,
|
|
84574
|
-
error: logError,
|
|
84575
|
-
warn: logWarning,
|
|
84576
|
-
info: logInfo,
|
|
84577
|
-
debug: logDebug
|
|
84674
|
+
const contentType = getContentType2(sendPath);
|
|
84675
|
+
res.setHeader("Content-Type", contentType);
|
|
84676
|
+
pipeFileStream(sendPath, res);
|
|
84578
84677
|
};
|
|
84579
84678
|
|
|
84580
|
-
// src/module/assistant/proxy/
|
|
84581
|
-
var
|
|
84582
|
-
|
|
84583
|
-
|
|
84584
|
-
const pathname = url3.pathname.slice(1);
|
|
84585
|
-
const { indexPath = "", target = "", rootPath = process.cwd() } = proxyApi;
|
|
84586
|
-
if (!indexPath) {
|
|
84587
|
-
return res.end("Not Found indexPath");
|
|
84679
|
+
// src/module/assistant/proxy/proxy.ts
|
|
84680
|
+
var proxy = (req, res, proxyApi) => {
|
|
84681
|
+
if (proxyApi.type === "http" || !proxyApi.type) {
|
|
84682
|
+
return httpProxy(req, res, proxyApi);
|
|
84588
84683
|
}
|
|
84589
|
-
|
|
84590
|
-
|
|
84591
|
-
|
|
84592
|
-
|
|
84593
|
-
|
|
84594
|
-
|
|
84595
|
-
}
|
|
84596
|
-
if (!exist) {
|
|
84597
|
-
filePath = path3.join(rootPath, target, indexPath);
|
|
84598
|
-
exist = checkFileExists(filePath, true);
|
|
84599
|
-
}
|
|
84600
|
-
log.debug("filePath", { filePath, exist });
|
|
84601
|
-
if (!exist) {
|
|
84602
|
-
res.statusCode = 404;
|
|
84603
|
-
res.end("Not Found File");
|
|
84604
|
-
return;
|
|
84605
|
-
}
|
|
84606
|
-
const ext = path3.extname(filePath);
|
|
84607
|
-
let maxAge = 24 * 60 * 60 * 1000;
|
|
84608
|
-
if (ext === ".html") {
|
|
84609
|
-
maxAge = 0;
|
|
84610
|
-
}
|
|
84611
|
-
let sendFilePath = path3.relative(rootPath, filePath);
|
|
84612
|
-
const file = import_send.default(req, sendFilePath, {
|
|
84613
|
-
root: rootPath,
|
|
84614
|
-
maxAge
|
|
84615
|
-
});
|
|
84616
|
-
file.pipe(res);
|
|
84617
|
-
} catch (error) {
|
|
84618
|
-
res.statusCode = 404;
|
|
84619
|
-
res.end("Error:Not Found File");
|
|
84620
|
-
return;
|
|
84684
|
+
console.log("proxyApi", proxyApi);
|
|
84685
|
+
if (proxyApi.type === "s3") {
|
|
84686
|
+
return s3Proxy(req, res, proxyApi);
|
|
84687
|
+
}
|
|
84688
|
+
if (proxyApi.type === "file") {
|
|
84689
|
+
return fileProxy2(req, res, proxyApi);
|
|
84621
84690
|
}
|
|
84622
84691
|
};
|
|
84623
84692
|
|
|
@@ -84640,8 +84709,8 @@ __export(exports_manager, {
|
|
|
84640
84709
|
|
|
84641
84710
|
// ../node_modules/.pnpm/@kevisual+use-config@1.0.28_dotenv@17.2.3/node_modules/@kevisual/use-config/dist/app.js
|
|
84642
84711
|
import { createRequire as createRequire2 } from "node:module";
|
|
84643
|
-
import
|
|
84644
|
-
import
|
|
84712
|
+
import fs5 from "node:fs";
|
|
84713
|
+
import path5 from "node:path";
|
|
84645
84714
|
var __create2 = Object.create;
|
|
84646
84715
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
84647
84716
|
var __defProp2 = Object.defineProperty;
|
|
@@ -84725,8 +84794,8 @@ var require_package5 = __commonJS2((exports, module) => {
|
|
|
84725
84794
|
};
|
|
84726
84795
|
});
|
|
84727
84796
|
var require_main5 = __commonJS2((exports, module) => {
|
|
84728
|
-
var
|
|
84729
|
-
var
|
|
84797
|
+
var fs6 = __require2("fs");
|
|
84798
|
+
var path6 = __require2("path");
|
|
84730
84799
|
var os2 = __require2("os");
|
|
84731
84800
|
var crypto3 = __require2("crypto");
|
|
84732
84801
|
var packageJson = require_package5();
|
|
@@ -84869,7 +84938,7 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
84869
84938
|
if (options && options.path && options.path.length > 0) {
|
|
84870
84939
|
if (Array.isArray(options.path)) {
|
|
84871
84940
|
for (const filepath of options.path) {
|
|
84872
|
-
if (
|
|
84941
|
+
if (fs6.existsSync(filepath)) {
|
|
84873
84942
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
84874
84943
|
}
|
|
84875
84944
|
}
|
|
@@ -84877,15 +84946,15 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
84877
84946
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
84878
84947
|
}
|
|
84879
84948
|
} else {
|
|
84880
|
-
possibleVaultPath =
|
|
84949
|
+
possibleVaultPath = path6.resolve(process.cwd(), ".env.vault");
|
|
84881
84950
|
}
|
|
84882
|
-
if (
|
|
84951
|
+
if (fs6.existsSync(possibleVaultPath)) {
|
|
84883
84952
|
return possibleVaultPath;
|
|
84884
84953
|
}
|
|
84885
84954
|
return null;
|
|
84886
84955
|
}
|
|
84887
84956
|
function _resolveHome(envPath) {
|
|
84888
|
-
return envPath[0] === "~" ?
|
|
84957
|
+
return envPath[0] === "~" ? path6.join(os2.homedir(), envPath.slice(1)) : envPath;
|
|
84889
84958
|
}
|
|
84890
84959
|
function _configVault(options) {
|
|
84891
84960
|
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
@@ -84902,7 +84971,7 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
84902
84971
|
return { parsed };
|
|
84903
84972
|
}
|
|
84904
84973
|
function configDotenv(options) {
|
|
84905
|
-
const dotenvPath =
|
|
84974
|
+
const dotenvPath = path6.resolve(process.cwd(), ".env");
|
|
84906
84975
|
let encoding = "utf8";
|
|
84907
84976
|
let processEnv = process.env;
|
|
84908
84977
|
if (options && options.processEnv != null) {
|
|
@@ -84932,7 +85001,7 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
84932
85001
|
const parsedAll = {};
|
|
84933
85002
|
for (const path22 of optionPaths) {
|
|
84934
85003
|
try {
|
|
84935
|
-
const parsed = DotenvModule.parse(
|
|
85004
|
+
const parsed = DotenvModule.parse(fs6.readFileSync(path22, { encoding }));
|
|
84936
85005
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
84937
85006
|
} catch (e) {
|
|
84938
85007
|
if (debug) {
|
|
@@ -84949,7 +85018,7 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
84949
85018
|
const shortPaths = [];
|
|
84950
85019
|
for (const filePath of optionPaths) {
|
|
84951
85020
|
try {
|
|
84952
|
-
const relative =
|
|
85021
|
+
const relative = path6.relative(process.cwd(), filePath);
|
|
84953
85022
|
shortPaths.push(relative);
|
|
84954
85023
|
} catch (e) {
|
|
84955
85024
|
if (debug) {
|
|
@@ -85054,7 +85123,7 @@ var require_main5 = __commonJS2((exports, module) => {
|
|
|
85054
85123
|
var import_dotenv2 = __toESM2(require_main5(), 1);
|
|
85055
85124
|
var fileIsExist = (path22) => {
|
|
85056
85125
|
try {
|
|
85057
|
-
|
|
85126
|
+
fs5.accessSync(path22, fs5.constants.F_OK);
|
|
85058
85127
|
return true;
|
|
85059
85128
|
} catch (e) {
|
|
85060
85129
|
return false;
|
|
@@ -85065,7 +85134,7 @@ var getCwdDirname = () => {
|
|
|
85065
85134
|
};
|
|
85066
85135
|
var getConfigFile = (opts) => {
|
|
85067
85136
|
if (opts?.envConfigFile) {
|
|
85068
|
-
const filePath =
|
|
85137
|
+
const filePath = path5.join(opts.cwd || getCwdDirname(), opts.envConfigFile);
|
|
85069
85138
|
if (fileIsExist(filePath)) {
|
|
85070
85139
|
return filePath;
|
|
85071
85140
|
}
|
|
@@ -85076,11 +85145,11 @@ var getConfigFile = (opts) => {
|
|
|
85076
85145
|
const ben = fileIsExist(benPath);
|
|
85077
85146
|
if (ben)
|
|
85078
85147
|
return benPath;
|
|
85079
|
-
const lastPath =
|
|
85148
|
+
const lastPath = path5.join(dirname, "../" + fileName);
|
|
85080
85149
|
const last = fileIsExist(lastPath);
|
|
85081
85150
|
if (last)
|
|
85082
85151
|
return lastPath;
|
|
85083
|
-
const lastLastPath =
|
|
85152
|
+
const lastLastPath = path5.join(dirname, "../../" + fileName);
|
|
85084
85153
|
const lastLast = fileIsExist(lastLastPath);
|
|
85085
85154
|
if (lastLast)
|
|
85086
85155
|
return lastLastPath;
|
|
@@ -85088,10 +85157,10 @@ var getConfigFile = (opts) => {
|
|
|
85088
85157
|
};
|
|
85089
85158
|
var useFileStore = (str, opts) => {
|
|
85090
85159
|
const publicPath = process.cwd();
|
|
85091
|
-
const filePath =
|
|
85160
|
+
const filePath = path5.join(publicPath, str);
|
|
85092
85161
|
if (opts?.needExists) {
|
|
85093
85162
|
if (!fileIsExist(filePath)) {
|
|
85094
|
-
|
|
85163
|
+
fs5.mkdirSync(filePath, { recursive: true });
|
|
85095
85164
|
}
|
|
85096
85165
|
}
|
|
85097
85166
|
return filePath;
|
|
@@ -86523,14 +86592,14 @@ function requireFs$3() {
|
|
|
86523
86592
|
fs$3.createDirentFromStats = createDirentFromStats;
|
|
86524
86593
|
return fs$3;
|
|
86525
86594
|
}
|
|
86526
|
-
var
|
|
86595
|
+
var path6 = {};
|
|
86527
86596
|
var hasRequiredPath;
|
|
86528
86597
|
function requirePath() {
|
|
86529
86598
|
if (hasRequiredPath)
|
|
86530
|
-
return
|
|
86599
|
+
return path6;
|
|
86531
86600
|
hasRequiredPath = 1;
|
|
86532
|
-
Object.defineProperty(
|
|
86533
|
-
|
|
86601
|
+
Object.defineProperty(path6, "__esModule", { value: true });
|
|
86602
|
+
path6.convertPosixPathToPattern = path6.convertWindowsPathToPattern = path6.convertPathToPattern = path6.escapePosixPath = path6.escapeWindowsPath = path6.escape = path6.removeLeadingDotSegment = path6.makeAbsolute = path6.unixify = undefined;
|
|
86534
86603
|
const os2 = require$$02;
|
|
86535
86604
|
const path$12 = require$$0$12;
|
|
86536
86605
|
const IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
|
@@ -86542,11 +86611,11 @@ function requirePath() {
|
|
|
86542
86611
|
function unixify(filepath) {
|
|
86543
86612
|
return filepath.replace(/\\/g, "/");
|
|
86544
86613
|
}
|
|
86545
|
-
|
|
86614
|
+
path6.unixify = unixify;
|
|
86546
86615
|
function makeAbsolute(cwd, filepath) {
|
|
86547
86616
|
return path$12.resolve(cwd, filepath);
|
|
86548
86617
|
}
|
|
86549
|
-
|
|
86618
|
+
path6.makeAbsolute = makeAbsolute;
|
|
86550
86619
|
function removeLeadingDotSegment(entry) {
|
|
86551
86620
|
if (entry.charAt(0) === ".") {
|
|
86552
86621
|
const secondCharactery = entry.charAt(1);
|
|
@@ -86556,26 +86625,26 @@ function requirePath() {
|
|
|
86556
86625
|
}
|
|
86557
86626
|
return entry;
|
|
86558
86627
|
}
|
|
86559
|
-
|
|
86560
|
-
|
|
86628
|
+
path6.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
86629
|
+
path6.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
|
86561
86630
|
function escapeWindowsPath(pattern) {
|
|
86562
86631
|
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
|
86563
86632
|
}
|
|
86564
|
-
|
|
86633
|
+
path6.escapeWindowsPath = escapeWindowsPath;
|
|
86565
86634
|
function escapePosixPath(pattern) {
|
|
86566
86635
|
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
|
86567
86636
|
}
|
|
86568
|
-
|
|
86569
|
-
|
|
86637
|
+
path6.escapePosixPath = escapePosixPath;
|
|
86638
|
+
path6.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
|
86570
86639
|
function convertWindowsPathToPattern(filepath) {
|
|
86571
86640
|
return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/");
|
|
86572
86641
|
}
|
|
86573
|
-
|
|
86642
|
+
path6.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
|
86574
86643
|
function convertPosixPathToPattern(filepath) {
|
|
86575
86644
|
return escapePosixPath(filepath);
|
|
86576
86645
|
}
|
|
86577
|
-
|
|
86578
|
-
return
|
|
86646
|
+
path6.convertPosixPathToPattern = convertPosixPathToPattern;
|
|
86647
|
+
return path6;
|
|
86579
86648
|
}
|
|
86580
86649
|
var pattern = {};
|
|
86581
86650
|
/*!
|
|
@@ -87862,7 +87931,7 @@ function requireConstants$1() {
|
|
|
87862
87931
|
if (hasRequiredConstants$1)
|
|
87863
87932
|
return constants$1;
|
|
87864
87933
|
hasRequiredConstants$1 = 1;
|
|
87865
|
-
const
|
|
87934
|
+
const path7 = require$$0$12;
|
|
87866
87935
|
const WIN_SLASH = "\\\\/";
|
|
87867
87936
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
87868
87937
|
const DOT_LITERAL = "\\.";
|
|
@@ -87984,7 +88053,7 @@ function requireConstants$1() {
|
|
|
87984
88053
|
CHAR_UNDERSCORE: 95,
|
|
87985
88054
|
CHAR_VERTICAL_LINE: 124,
|
|
87986
88055
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
87987
|
-
SEP:
|
|
88056
|
+
SEP: path7.sep,
|
|
87988
88057
|
extglobChars(chars) {
|
|
87989
88058
|
return {
|
|
87990
88059
|
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
@@ -88006,7 +88075,7 @@ function requireUtils$2() {
|
|
|
88006
88075
|
return utils$1;
|
|
88007
88076
|
hasRequiredUtils$2 = 1;
|
|
88008
88077
|
(function(exports$1) {
|
|
88009
|
-
const
|
|
88078
|
+
const path7 = require$$0$12;
|
|
88010
88079
|
const win32 = process.platform === "win32";
|
|
88011
88080
|
const {
|
|
88012
88081
|
REGEX_BACKSLASH,
|
|
@@ -88035,7 +88104,7 @@ function requireUtils$2() {
|
|
|
88035
88104
|
if (options && typeof options.windows === "boolean") {
|
|
88036
88105
|
return options.windows;
|
|
88037
88106
|
}
|
|
88038
|
-
return win32 === true ||
|
|
88107
|
+
return win32 === true || path7.sep === "\\";
|
|
88039
88108
|
};
|
|
88040
88109
|
exports$1.escapeLast = (input, char, lastIdx) => {
|
|
88041
88110
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -89172,7 +89241,7 @@ function requirePicomatch$1() {
|
|
|
89172
89241
|
if (hasRequiredPicomatch$1)
|
|
89173
89242
|
return picomatch_1;
|
|
89174
89243
|
hasRequiredPicomatch$1 = 1;
|
|
89175
|
-
const
|
|
89244
|
+
const path7 = require$$0$12;
|
|
89176
89245
|
const scan = requireScan();
|
|
89177
89246
|
const parse = requireParse();
|
|
89178
89247
|
const utils = requireUtils$2();
|
|
@@ -89258,7 +89327,7 @@ function requirePicomatch$1() {
|
|
|
89258
89327
|
};
|
|
89259
89328
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
89260
89329
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
89261
|
-
return regex.test(
|
|
89330
|
+
return regex.test(path7.basename(input));
|
|
89262
89331
|
};
|
|
89263
89332
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
89264
89333
|
picomatch.parse = (pattern2, options) => {
|
|
@@ -89495,7 +89564,7 @@ function requirePattern() {
|
|
|
89495
89564
|
hasRequiredPattern = 1;
|
|
89496
89565
|
Object.defineProperty(pattern, "__esModule", { value: true });
|
|
89497
89566
|
pattern.isAbsolute = pattern.partitionAbsoluteAndRelative = pattern.removeDuplicateSlashes = pattern.matchAny = pattern.convertPatternsToRe = pattern.makeRe = pattern.getPatternParts = pattern.expandBraceExpansion = pattern.expandPatternsWithBraceExpansion = pattern.isAffectDepthOfReadingPattern = pattern.endsWithSlashGlobStar = pattern.hasGlobStar = pattern.getBaseDirectory = pattern.isPatternRelatedToParentDirectory = pattern.getPatternsOutsideCurrentDirectory = pattern.getPatternsInsideCurrentDirectory = pattern.getPositivePatterns = pattern.getNegativePatterns = pattern.isPositivePattern = pattern.isNegativePattern = pattern.convertToNegativePattern = pattern.convertToPositivePattern = pattern.isDynamicPattern = pattern.isStaticPattern = undefined;
|
|
89498
|
-
const
|
|
89567
|
+
const path7 = require$$0$12;
|
|
89499
89568
|
const globParent2 = requireGlobParent();
|
|
89500
89569
|
const micromatch = requireMicromatch();
|
|
89501
89570
|
const GLOBSTAR = "**";
|
|
@@ -89590,7 +89659,7 @@ function requirePattern() {
|
|
|
89590
89659
|
}
|
|
89591
89660
|
pattern.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
89592
89661
|
function isAffectDepthOfReadingPattern(pattern2) {
|
|
89593
|
-
const basename =
|
|
89662
|
+
const basename = path7.basename(pattern2);
|
|
89594
89663
|
return endsWithSlashGlobStar(pattern2) || isStaticPattern(basename);
|
|
89595
89664
|
}
|
|
89596
89665
|
pattern.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -89648,7 +89717,7 @@ function requirePattern() {
|
|
|
89648
89717
|
}
|
|
89649
89718
|
pattern.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
89650
89719
|
function isAbsolute(pattern2) {
|
|
89651
|
-
return
|
|
89720
|
+
return path7.isAbsolute(pattern2);
|
|
89652
89721
|
}
|
|
89653
89722
|
pattern.isAbsolute = isAbsolute;
|
|
89654
89723
|
return pattern;
|
|
@@ -89826,10 +89895,10 @@ function requireUtils$1() {
|
|
|
89826
89895
|
utils$3.array = array2;
|
|
89827
89896
|
const errno2 = requireErrno();
|
|
89828
89897
|
utils$3.errno = errno2;
|
|
89829
|
-
const
|
|
89830
|
-
utils$3.fs =
|
|
89831
|
-
const
|
|
89832
|
-
utils$3.path =
|
|
89898
|
+
const fs6 = requireFs$3();
|
|
89899
|
+
utils$3.fs = fs6;
|
|
89900
|
+
const path7 = requirePath();
|
|
89901
|
+
utils$3.path = path7;
|
|
89833
89902
|
const pattern2 = requirePattern();
|
|
89834
89903
|
utils$3.pattern = pattern2;
|
|
89835
89904
|
const stream2 = requireStream$3();
|
|
@@ -89940,8 +90009,8 @@ function requireAsync$5() {
|
|
|
89940
90009
|
hasRequiredAsync$5 = 1;
|
|
89941
90010
|
Object.defineProperty(async, "__esModule", { value: true });
|
|
89942
90011
|
async.read = undefined;
|
|
89943
|
-
function read(
|
|
89944
|
-
settings.fs.lstat(
|
|
90012
|
+
function read(path7, settings, callback) {
|
|
90013
|
+
settings.fs.lstat(path7, (lstatError, lstat) => {
|
|
89945
90014
|
if (lstatError !== null) {
|
|
89946
90015
|
callFailureCallback(callback, lstatError);
|
|
89947
90016
|
return;
|
|
@@ -89950,7 +90019,7 @@ function requireAsync$5() {
|
|
|
89950
90019
|
callSuccessCallback(callback, lstat);
|
|
89951
90020
|
return;
|
|
89952
90021
|
}
|
|
89953
|
-
settings.fs.stat(
|
|
90022
|
+
settings.fs.stat(path7, (statError, stat) => {
|
|
89954
90023
|
if (statError !== null) {
|
|
89955
90024
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
89956
90025
|
callFailureCallback(callback, statError);
|
|
@@ -89983,13 +90052,13 @@ function requireSync$5() {
|
|
|
89983
90052
|
hasRequiredSync$5 = 1;
|
|
89984
90053
|
Object.defineProperty(sync$5, "__esModule", { value: true });
|
|
89985
90054
|
sync$5.read = undefined;
|
|
89986
|
-
function read(
|
|
89987
|
-
const lstat = settings.fs.lstatSync(
|
|
90055
|
+
function read(path7, settings) {
|
|
90056
|
+
const lstat = settings.fs.lstatSync(path7);
|
|
89988
90057
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
89989
90058
|
return lstat;
|
|
89990
90059
|
}
|
|
89991
90060
|
try {
|
|
89992
|
-
const stat = settings.fs.statSync(
|
|
90061
|
+
const stat = settings.fs.statSync(path7);
|
|
89993
90062
|
if (settings.markSymbolicLink) {
|
|
89994
90063
|
stat.isSymbolicLink = () => true;
|
|
89995
90064
|
}
|
|
@@ -90014,12 +90083,12 @@ function requireFs$2() {
|
|
|
90014
90083
|
(function(exports$1) {
|
|
90015
90084
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
90016
90085
|
exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = undefined;
|
|
90017
|
-
const
|
|
90086
|
+
const fs6 = require$$0$4;
|
|
90018
90087
|
exports$1.FILE_SYSTEM_ADAPTER = {
|
|
90019
|
-
lstat:
|
|
90020
|
-
stat:
|
|
90021
|
-
lstatSync:
|
|
90022
|
-
statSync:
|
|
90088
|
+
lstat: fs6.lstat,
|
|
90089
|
+
stat: fs6.stat,
|
|
90090
|
+
lstatSync: fs6.lstatSync,
|
|
90091
|
+
statSync: fs6.statSync
|
|
90023
90092
|
};
|
|
90024
90093
|
function createFileSystemAdapter(fsMethods) {
|
|
90025
90094
|
if (fsMethods === undefined) {
|
|
@@ -90037,13 +90106,13 @@ function requireSettings$3() {
|
|
|
90037
90106
|
return settings$3;
|
|
90038
90107
|
hasRequiredSettings$3 = 1;
|
|
90039
90108
|
Object.defineProperty(settings$3, "__esModule", { value: true });
|
|
90040
|
-
const
|
|
90109
|
+
const fs6 = requireFs$2();
|
|
90041
90110
|
|
|
90042
90111
|
class Settings {
|
|
90043
90112
|
constructor(_options = {}) {
|
|
90044
90113
|
this._options = _options;
|
|
90045
90114
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
90046
|
-
this.fs =
|
|
90115
|
+
this.fs = fs6.createFileSystemAdapter(this._options.fs);
|
|
90047
90116
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
90048
90117
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
90049
90118
|
}
|
|
@@ -90065,17 +90134,17 @@ function requireOut$3() {
|
|
|
90065
90134
|
const sync = requireSync$5();
|
|
90066
90135
|
const settings_1 = requireSettings$3();
|
|
90067
90136
|
out$1.Settings = settings_1.default;
|
|
90068
|
-
function stat(
|
|
90137
|
+
function stat(path7, optionsOrSettingsOrCallback, callback) {
|
|
90069
90138
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
90070
|
-
async2.read(
|
|
90139
|
+
async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
|
|
90071
90140
|
return;
|
|
90072
90141
|
}
|
|
90073
|
-
async2.read(
|
|
90142
|
+
async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
|
|
90074
90143
|
}
|
|
90075
90144
|
out$1.stat = stat;
|
|
90076
|
-
function statSync(
|
|
90145
|
+
function statSync(path7, optionsOrSettings) {
|
|
90077
90146
|
const settings = getSettings(optionsOrSettings);
|
|
90078
|
-
return sync.read(
|
|
90147
|
+
return sync.read(path7, settings);
|
|
90079
90148
|
}
|
|
90080
90149
|
out$1.statSync = statSync;
|
|
90081
90150
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -90211,8 +90280,8 @@ function requireUtils() {
|
|
|
90211
90280
|
hasRequiredUtils = 1;
|
|
90212
90281
|
Object.defineProperty(utils, "__esModule", { value: true });
|
|
90213
90282
|
utils.fs = undefined;
|
|
90214
|
-
const
|
|
90215
|
-
utils.fs =
|
|
90283
|
+
const fs6 = requireFs$1();
|
|
90284
|
+
utils.fs = fs6;
|
|
90216
90285
|
return utils;
|
|
90217
90286
|
}
|
|
90218
90287
|
var common$1 = {};
|
|
@@ -90305,16 +90374,16 @@ function requireAsync$4() {
|
|
|
90305
90374
|
return;
|
|
90306
90375
|
}
|
|
90307
90376
|
const tasks2 = names.map((name) => {
|
|
90308
|
-
const
|
|
90377
|
+
const path7 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
90309
90378
|
return (done) => {
|
|
90310
|
-
fsStat.stat(
|
|
90379
|
+
fsStat.stat(path7, settings.fsStatSettings, (error, stats) => {
|
|
90311
90380
|
if (error !== null) {
|
|
90312
90381
|
done(error);
|
|
90313
90382
|
return;
|
|
90314
90383
|
}
|
|
90315
90384
|
const entry = {
|
|
90316
90385
|
name,
|
|
90317
|
-
path:
|
|
90386
|
+
path: path7,
|
|
90318
90387
|
dirent: utils2.fs.createDirentFromStats(name, stats)
|
|
90319
90388
|
};
|
|
90320
90389
|
if (settings.stats) {
|
|
@@ -90403,23 +90472,23 @@ function requireSync$4() {
|
|
|
90403
90472
|
return sync$4;
|
|
90404
90473
|
}
|
|
90405
90474
|
var settings$2 = {};
|
|
90406
|
-
var
|
|
90475
|
+
var fs6 = {};
|
|
90407
90476
|
var hasRequiredFs;
|
|
90408
90477
|
function requireFs() {
|
|
90409
90478
|
if (hasRequiredFs)
|
|
90410
|
-
return
|
|
90479
|
+
return fs6;
|
|
90411
90480
|
hasRequiredFs = 1;
|
|
90412
90481
|
(function(exports$1) {
|
|
90413
90482
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
90414
90483
|
exports$1.createFileSystemAdapter = exports$1.FILE_SYSTEM_ADAPTER = undefined;
|
|
90415
|
-
const
|
|
90484
|
+
const fs7 = require$$0$4;
|
|
90416
90485
|
exports$1.FILE_SYSTEM_ADAPTER = {
|
|
90417
|
-
lstat:
|
|
90418
|
-
stat:
|
|
90419
|
-
lstatSync:
|
|
90420
|
-
statSync:
|
|
90421
|
-
readdir:
|
|
90422
|
-
readdirSync:
|
|
90486
|
+
lstat: fs7.lstat,
|
|
90487
|
+
stat: fs7.stat,
|
|
90488
|
+
lstatSync: fs7.lstatSync,
|
|
90489
|
+
statSync: fs7.statSync,
|
|
90490
|
+
readdir: fs7.readdir,
|
|
90491
|
+
readdirSync: fs7.readdirSync
|
|
90423
90492
|
};
|
|
90424
90493
|
function createFileSystemAdapter(fsMethods) {
|
|
90425
90494
|
if (fsMethods === undefined) {
|
|
@@ -90428,8 +90497,8 @@ function requireFs() {
|
|
|
90428
90497
|
return Object.assign(Object.assign({}, exports$1.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
90429
90498
|
}
|
|
90430
90499
|
exports$1.createFileSystemAdapter = createFileSystemAdapter;
|
|
90431
|
-
})(
|
|
90432
|
-
return
|
|
90500
|
+
})(fs6);
|
|
90501
|
+
return fs6;
|
|
90433
90502
|
}
|
|
90434
90503
|
var hasRequiredSettings$2;
|
|
90435
90504
|
function requireSettings$2() {
|
|
@@ -90437,16 +90506,16 @@ function requireSettings$2() {
|
|
|
90437
90506
|
return settings$2;
|
|
90438
90507
|
hasRequiredSettings$2 = 1;
|
|
90439
90508
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
90440
|
-
const
|
|
90509
|
+
const path7 = require$$0$12;
|
|
90441
90510
|
const fsStat = requireOut$3();
|
|
90442
|
-
const
|
|
90511
|
+
const fs7 = requireFs();
|
|
90443
90512
|
|
|
90444
90513
|
class Settings {
|
|
90445
90514
|
constructor(_options = {}) {
|
|
90446
90515
|
this._options = _options;
|
|
90447
90516
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
90448
|
-
this.fs =
|
|
90449
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
90517
|
+
this.fs = fs7.createFileSystemAdapter(this._options.fs);
|
|
90518
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path7.sep);
|
|
90450
90519
|
this.stats = this._getValue(this._options.stats, false);
|
|
90451
90520
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
90452
90521
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -90473,17 +90542,17 @@ function requireOut$2() {
|
|
|
90473
90542
|
const sync = requireSync$4();
|
|
90474
90543
|
const settings_1 = requireSettings$2();
|
|
90475
90544
|
out$2.Settings = settings_1.default;
|
|
90476
|
-
function scandir(
|
|
90545
|
+
function scandir(path7, optionsOrSettingsOrCallback, callback) {
|
|
90477
90546
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
90478
|
-
async2.read(
|
|
90547
|
+
async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
|
|
90479
90548
|
return;
|
|
90480
90549
|
}
|
|
90481
|
-
async2.read(
|
|
90550
|
+
async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
|
|
90482
90551
|
}
|
|
90483
90552
|
out$2.scandir = scandir;
|
|
90484
|
-
function scandirSync(
|
|
90553
|
+
function scandirSync(path7, optionsOrSettings) {
|
|
90485
90554
|
const settings = getSettings(optionsOrSettings);
|
|
90486
|
-
return sync.read(
|
|
90555
|
+
return sync.read(path7, settings);
|
|
90487
90556
|
}
|
|
90488
90557
|
out$2.scandirSync = scandirSync;
|
|
90489
90558
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -91119,7 +91188,7 @@ function requireSettings$1() {
|
|
|
91119
91188
|
return settings$1;
|
|
91120
91189
|
hasRequiredSettings$1 = 1;
|
|
91121
91190
|
Object.defineProperty(settings$1, "__esModule", { value: true });
|
|
91122
|
-
const
|
|
91191
|
+
const path7 = require$$0$12;
|
|
91123
91192
|
const fsScandir = requireOut$2();
|
|
91124
91193
|
|
|
91125
91194
|
class Settings {
|
|
@@ -91130,7 +91199,7 @@ function requireSettings$1() {
|
|
|
91130
91199
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
91131
91200
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
91132
91201
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
91133
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
91202
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path7.sep);
|
|
91134
91203
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
91135
91204
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
91136
91205
|
fs: this._options.fs,
|
|
@@ -91193,7 +91262,7 @@ function requireReader() {
|
|
|
91193
91262
|
return reader;
|
|
91194
91263
|
hasRequiredReader = 1;
|
|
91195
91264
|
Object.defineProperty(reader, "__esModule", { value: true });
|
|
91196
|
-
const
|
|
91265
|
+
const path7 = require$$0$12;
|
|
91197
91266
|
const fsStat = requireOut$3();
|
|
91198
91267
|
const utils2 = requireUtils$1();
|
|
91199
91268
|
|
|
@@ -91207,7 +91276,7 @@ function requireReader() {
|
|
|
91207
91276
|
});
|
|
91208
91277
|
}
|
|
91209
91278
|
_getFullEntryPath(filepath) {
|
|
91210
|
-
return
|
|
91279
|
+
return path7.resolve(this._settings.cwd, filepath);
|
|
91211
91280
|
}
|
|
91212
91281
|
_makeEntry(stats, pattern2) {
|
|
91213
91282
|
const entry = {
|
|
@@ -91639,7 +91708,7 @@ function requireProvider() {
|
|
|
91639
91708
|
return provider;
|
|
91640
91709
|
hasRequiredProvider = 1;
|
|
91641
91710
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
91642
|
-
const
|
|
91711
|
+
const path7 = require$$0$12;
|
|
91643
91712
|
const deep_1 = requireDeep();
|
|
91644
91713
|
const entry_1 = requireEntry$1();
|
|
91645
91714
|
const error_1 = requireError();
|
|
@@ -91654,7 +91723,7 @@ function requireProvider() {
|
|
|
91654
91723
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
91655
91724
|
}
|
|
91656
91725
|
_getRootDirectory(task) {
|
|
91657
|
-
return
|
|
91726
|
+
return path7.resolve(this._settings.cwd, task.base);
|
|
91658
91727
|
}
|
|
91659
91728
|
_getReaderOptions(task) {
|
|
91660
91729
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -91843,16 +91912,16 @@ function requireSettings() {
|
|
|
91843
91912
|
(function(exports$1) {
|
|
91844
91913
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
91845
91914
|
exports$1.DEFAULT_FILE_SYSTEM_ADAPTER = undefined;
|
|
91846
|
-
const
|
|
91915
|
+
const fs7 = require$$0$4;
|
|
91847
91916
|
const os2 = require$$02;
|
|
91848
91917
|
const CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
91849
91918
|
exports$1.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
91850
|
-
lstat:
|
|
91851
|
-
lstatSync:
|
|
91852
|
-
stat:
|
|
91853
|
-
statSync:
|
|
91854
|
-
readdir:
|
|
91855
|
-
readdirSync:
|
|
91919
|
+
lstat: fs7.lstat,
|
|
91920
|
+
lstatSync: fs7.lstatSync,
|
|
91921
|
+
stat: fs7.stat,
|
|
91922
|
+
statSync: fs7.statSync,
|
|
91923
|
+
readdir: fs7.readdir,
|
|
91924
|
+
readdirSync: fs7.readdirSync
|
|
91856
91925
|
};
|
|
91857
91926
|
|
|
91858
91927
|
class Settings {
|
|
@@ -92626,16 +92695,16 @@ var reload = promisify2(pm22.reload).bind(pm22);
|
|
|
92626
92695
|
var deleteProcess2 = promisify2(pm22.delete).bind(pm22);
|
|
92627
92696
|
var list2 = promisify2(pm22.list).bind(pm22);
|
|
92628
92697
|
// src/module/local-apps/src/modules/app-file.ts
|
|
92629
|
-
import
|
|
92630
|
-
import
|
|
92698
|
+
import path7 from "node:path";
|
|
92699
|
+
import fs7 from "node:fs";
|
|
92631
92700
|
var getAppsPath2 = () => {
|
|
92632
92701
|
const appsPath = process.env.APPS_PATH;
|
|
92633
92702
|
if (appsPath) {
|
|
92634
|
-
const resolvePath =
|
|
92703
|
+
const resolvePath = path7.resolve(appsPath);
|
|
92635
92704
|
if (fileIsExist(resolvePath)) {
|
|
92636
92705
|
return resolvePath;
|
|
92637
92706
|
} else {
|
|
92638
|
-
|
|
92707
|
+
fs7.mkdirSync(resolvePath, { recursive: true });
|
|
92639
92708
|
return resolvePath;
|
|
92640
92709
|
}
|
|
92641
92710
|
}
|
|
@@ -92647,12 +92716,12 @@ var loadAppInfo2 = async (appsPath = "apps", filename = "apps.config.json") => {
|
|
|
92647
92716
|
fileName: filename
|
|
92648
92717
|
});
|
|
92649
92718
|
if (!configFile) {
|
|
92650
|
-
configFile =
|
|
92651
|
-
|
|
92719
|
+
configFile = path7.join(appsPath, "..", filename);
|
|
92720
|
+
fs7.writeFileSync(configFile, JSON.stringify({ list: [] }));
|
|
92652
92721
|
return { list: [] };
|
|
92653
92722
|
}
|
|
92654
92723
|
try {
|
|
92655
|
-
const config =
|
|
92724
|
+
const config = fs7.readFileSync(configFile, "utf-8");
|
|
92656
92725
|
const v = JSON.parse(config);
|
|
92657
92726
|
if (!v.list) {
|
|
92658
92727
|
v.list = [];
|
|
@@ -92672,15 +92741,15 @@ var saveAppInfo2 = async (data, appsPath, filename = "apps.config.json") => {
|
|
|
92672
92741
|
console.error("未找到配置文件");
|
|
92673
92742
|
return;
|
|
92674
92743
|
}
|
|
92675
|
-
|
|
92744
|
+
fs7.writeFileSync(configFile, JSON.stringify(data, null, 2));
|
|
92676
92745
|
};
|
|
92677
92746
|
var deleteFileAppInfo2 = async (key, appsPath) => {
|
|
92678
|
-
const normalizedKey = key.replace(/\//g,
|
|
92679
|
-
const directory =
|
|
92747
|
+
const normalizedKey = key.replace(/\//g, path7.sep);
|
|
92748
|
+
const directory = path7.join(appsPath, normalizedKey);
|
|
92680
92749
|
if (!fileIsExist(directory)) {
|
|
92681
92750
|
return;
|
|
92682
92751
|
}
|
|
92683
|
-
|
|
92752
|
+
fs7.rmSync(directory, { recursive: true });
|
|
92684
92753
|
};
|
|
92685
92754
|
|
|
92686
92755
|
// src/module/local-apps/src/modules/manager.ts
|
|
@@ -93727,9 +93796,9 @@ var merge2 = _createAssigner_default(function(object, source, srcIndex) {
|
|
|
93727
93796
|
});
|
|
93728
93797
|
var merge_default = merge2;
|
|
93729
93798
|
// src/module/local-apps/src/modules/manager.ts
|
|
93730
|
-
import
|
|
93799
|
+
import path8 from "node:path";
|
|
93731
93800
|
var import_fast_glob = __toESM(require_out4(), 1);
|
|
93732
|
-
import
|
|
93801
|
+
import fs8 from "node:fs";
|
|
93733
93802
|
|
|
93734
93803
|
// src/module/local-apps/src/modules/pm2.ts
|
|
93735
93804
|
import { spawn } from "node:child_process";
|
|
@@ -94215,7 +94284,7 @@ var LoadApp = async (app, opts) => {
|
|
|
94215
94284
|
console.error("app is not found");
|
|
94216
94285
|
return false;
|
|
94217
94286
|
}
|
|
94218
|
-
const pathEntry =
|
|
94287
|
+
const pathEntry = path8.join(app.path, app.entry);
|
|
94219
94288
|
if (!fileIsExist(pathEntry)) {
|
|
94220
94289
|
console.error("file entry not found");
|
|
94221
94290
|
return false;
|
|
@@ -94235,7 +94304,7 @@ var LoadApp = async (app, opts) => {
|
|
|
94235
94304
|
});
|
|
94236
94305
|
app.process = childProcess;
|
|
94237
94306
|
} else if (app.type === "system-app" /* SystemApp */) {
|
|
94238
|
-
const pathEntryAndTimestamp =
|
|
94307
|
+
const pathEntryAndTimestamp = path8.join(app.path, entry2);
|
|
94239
94308
|
const importPath = process.platform === "win32" ? "file:///" + pathEntryAndTimestamp.replace(/\\/g, "/") : pathEntryAndTimestamp;
|
|
94240
94309
|
const module = await import(importPath);
|
|
94241
94310
|
if (module.loadApp && mainApp) {
|
|
@@ -94244,7 +94313,7 @@ var LoadApp = async (app, opts) => {
|
|
|
94244
94313
|
} else if (app.type === "gateway-app" /* GatewayApp */) {
|
|
94245
94314
|
console.log("gateway app not support");
|
|
94246
94315
|
} else if (app.type === "pm2-system-app" /* Pm2SystemApp */) {
|
|
94247
|
-
const pathEntry2 =
|
|
94316
|
+
const pathEntry2 = path8.join(app.path, app.entry);
|
|
94248
94317
|
const pm2Manager = new Pm2Manager2({
|
|
94249
94318
|
appName: app.key,
|
|
94250
94319
|
script: pathEntry2,
|
|
@@ -94262,7 +94331,7 @@ var LoadApp = async (app, opts) => {
|
|
|
94262
94331
|
pm2Options.interpreter = pm2Options.interpreter || app?.engine;
|
|
94263
94332
|
}
|
|
94264
94333
|
if (!pm2Options.cwd) {
|
|
94265
|
-
pm2Options.cwd =
|
|
94334
|
+
pm2Options.cwd = path8.join(app.path, "../..");
|
|
94266
94335
|
}
|
|
94267
94336
|
await pm2Manager.start(pm2Options);
|
|
94268
94337
|
} else if (app.type === "script-app" /* ScriptApp */) {
|
|
@@ -94297,30 +94366,30 @@ var StopApp = async (app, opts) => {
|
|
|
94297
94366
|
}
|
|
94298
94367
|
};
|
|
94299
94368
|
var installAppFromKey2 = async (key, _appPath) => {
|
|
94300
|
-
const normalizedKey = key.replace(/\//g,
|
|
94301
|
-
const directory =
|
|
94369
|
+
const normalizedKey = key.replace(/\//g, path8.sep);
|
|
94370
|
+
const directory = path8.join(_appPath, normalizedKey);
|
|
94302
94371
|
if (!fileIsExist(directory)) {
|
|
94303
94372
|
console.error("App not found", directory);
|
|
94304
94373
|
throw new Error("App not found");
|
|
94305
94374
|
}
|
|
94306
|
-
const pkgs =
|
|
94375
|
+
const pkgs = path8.join(directory, "package.json");
|
|
94307
94376
|
if (!fileIsExist(pkgs)) {
|
|
94308
94377
|
throw new Error("Invalid package.json, need package.json in app directory");
|
|
94309
94378
|
}
|
|
94310
|
-
const json =
|
|
94379
|
+
const json = fs8.readFileSync(pkgs, "utf-8");
|
|
94311
94380
|
const pkg = JSON.parse(json);
|
|
94312
94381
|
const { name, version, app } = pkg;
|
|
94313
94382
|
if (!name || !version || !app) {
|
|
94314
94383
|
console.error("need name, version and app in package.json");
|
|
94315
94384
|
throw new Error("Invalid package.json format, need name, version and app");
|
|
94316
94385
|
}
|
|
94317
|
-
const readmeFile =
|
|
94318
|
-
const readmeFile2 =
|
|
94386
|
+
const readmeFile = path8.join(directory, "README.md");
|
|
94387
|
+
const readmeFile2 = path8.join(directory, "readme.md");
|
|
94319
94388
|
let readmeDesc = "";
|
|
94320
94389
|
if (fileIsExist(readmeFile)) {
|
|
94321
|
-
readmeDesc =
|
|
94390
|
+
readmeDesc = fs8.readFileSync(readmeFile, "utf-8");
|
|
94322
94391
|
} else if (fileIsExist(readmeFile2)) {
|
|
94323
|
-
readmeDesc =
|
|
94392
|
+
readmeDesc = fs8.readFileSync(readmeFile2, "utf-8");
|
|
94324
94393
|
}
|
|
94325
94394
|
let showAppInfo = {
|
|
94326
94395
|
key,
|
|
@@ -94335,13 +94404,13 @@ var installAppFromKey2 = async (key, _appPath) => {
|
|
|
94335
94404
|
};
|
|
94336
94405
|
app.key = key;
|
|
94337
94406
|
if (app.type === "pm2-system-app") {
|
|
94338
|
-
const pm2Cwd =
|
|
94407
|
+
const pm2Cwd = path8.join(_appPath, "..");
|
|
94339
94408
|
showAppInfo.pm2Options = { cwd: pm2Cwd, ...app.pm2Options };
|
|
94340
94409
|
}
|
|
94341
94410
|
return { pkg, showAppInfo };
|
|
94342
94411
|
};
|
|
94343
94412
|
var getAppPathKeys2 = async (_appPath) => {
|
|
94344
|
-
const directory =
|
|
94413
|
+
const directory = path8.resolve(_appPath);
|
|
94345
94414
|
const root3 = directory;
|
|
94346
94415
|
const path1 = "*/package.json";
|
|
94347
94416
|
const path22 = "*/*/package.json";
|
|
@@ -94352,7 +94421,7 @@ var getAppPathKeys2 = async (_appPath) => {
|
|
|
94352
94421
|
ignore: ["**/node_modules/**"]
|
|
94353
94422
|
});
|
|
94354
94423
|
const appPathKeys = appsPackages.map((pkg) => {
|
|
94355
|
-
const dir =
|
|
94424
|
+
const dir = path8.dirname(pkg);
|
|
94356
94425
|
return dir.replace(/\\/g, "/");
|
|
94357
94426
|
});
|
|
94358
94427
|
return appPathKeys;
|
|
@@ -94360,8 +94429,8 @@ var getAppPathKeys2 = async (_appPath) => {
|
|
|
94360
94429
|
|
|
94361
94430
|
// src/module/assistant/local-app-manager/assistant-app.ts
|
|
94362
94431
|
var import_fast_glob2 = __toESM(require_out4(), 1);
|
|
94363
|
-
import
|
|
94364
|
-
import
|
|
94432
|
+
import path9 from "node:path";
|
|
94433
|
+
import fs9 from "node:fs";
|
|
94365
94434
|
|
|
94366
94435
|
// ../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
|
94367
94436
|
var import__ = __toESM(require_eventemitter3(), 1);
|
|
@@ -94532,10 +94601,10 @@ class AssistantApp extends Manager2 {
|
|
|
94532
94601
|
remoteApp = null;
|
|
94533
94602
|
constructor(config, mainApp) {
|
|
94534
94603
|
config.checkMounted();
|
|
94535
|
-
const appsPath = config?.configPath?.appsDir ||
|
|
94536
|
-
const pagesPath = config?.configPath?.pagesDir ||
|
|
94604
|
+
const appsPath = config?.configPath?.appsDir || path9.join(process.cwd(), "apps");
|
|
94605
|
+
const pagesPath = config?.configPath?.pagesDir || path9.join(process.cwd(), "pages");
|
|
94537
94606
|
const appsConfigPath = config.configPath?.appsConfigPath;
|
|
94538
|
-
const configFimename =
|
|
94607
|
+
const configFimename = path9.basename(appsConfigPath || "");
|
|
94539
94608
|
super({
|
|
94540
94609
|
appsPath,
|
|
94541
94610
|
configFilename: configFimename,
|
|
@@ -94551,7 +94620,7 @@ class AssistantApp extends Manager2 {
|
|
|
94551
94620
|
});
|
|
94552
94621
|
const pagesParse = pages.map((page) => {
|
|
94553
94622
|
const [user, app] = page.split("/");
|
|
94554
|
-
const contentStr =
|
|
94623
|
+
const contentStr = fs9.readFileSync(path9.join(this.pagesPath, page), "utf-8");
|
|
94555
94624
|
const content = parseIfJson2(contentStr);
|
|
94556
94625
|
return {
|
|
94557
94626
|
user,
|
|
@@ -94574,7 +94643,7 @@ class AssistantApp extends Manager2 {
|
|
|
94574
94643
|
});
|
|
94575
94644
|
const pagesParse = pages.map((page) => {
|
|
94576
94645
|
const relativePath = page;
|
|
94577
|
-
const contentStr =
|
|
94646
|
+
const contentStr = fs9.readFileSync(path9.join(root3, page), "utf-8");
|
|
94578
94647
|
const content = parseIfJson2(contentStr);
|
|
94579
94648
|
if (!content.appType) {
|
|
94580
94649
|
const isWeb = relativePath.startsWith("pages/");
|
|
@@ -95438,12 +95507,15 @@ class AssistantInit extends AssistantConfig {
|
|
|
95438
95507
|
this.init();
|
|
95439
95508
|
}
|
|
95440
95509
|
}
|
|
95441
|
-
async init() {
|
|
95510
|
+
async init(configDir2) {
|
|
95511
|
+
if (configDir2) {
|
|
95512
|
+
this.configDir = configDir2;
|
|
95513
|
+
}
|
|
95442
95514
|
if (!this.checkConfigPath()) {
|
|
95443
95515
|
console.log(chalk2.blue("助手路径不存在,正在创建..."));
|
|
95444
|
-
super.init();
|
|
95516
|
+
super.init(configDir2);
|
|
95445
95517
|
} else {
|
|
95446
|
-
super.init();
|
|
95518
|
+
super.init(configDir2);
|
|
95447
95519
|
const assistantConfig2 = this;
|
|
95448
95520
|
console.log(chalk2.yellow("助手路径已存在"), chalk2.green(assistantConfig2.configDir));
|
|
95449
95521
|
}
|
|
@@ -95468,13 +95540,13 @@ class AssistantInit extends AssistantConfig {
|
|
|
95468
95540
|
});
|
|
95469
95541
|
}
|
|
95470
95542
|
checkConfigPath() {
|
|
95471
|
-
const assistantPath =
|
|
95543
|
+
const assistantPath = path10.join(this.configDir, "assistant-app", "assistant-config.json");
|
|
95472
95544
|
return checkFileExists(assistantPath);
|
|
95473
95545
|
}
|
|
95474
95546
|
createEnvConfig() {
|
|
95475
95547
|
const env3 = this.configPath?.envConfigPath;
|
|
95476
95548
|
if (!checkFileExists(env3, true)) {
|
|
95477
|
-
|
|
95549
|
+
fs10.writeFileSync(env3, `# 环境配置文件
|
|
95478
95550
|
`);
|
|
95479
95551
|
console.log(chalk2.green("助手环境配置.env文件创建成功"));
|
|
95480
95552
|
}
|
|
@@ -95482,7 +95554,7 @@ class AssistantInit extends AssistantConfig {
|
|
|
95482
95554
|
createOtherConfig() {
|
|
95483
95555
|
const appsConfig = this.configPath?.appsConfigPath;
|
|
95484
95556
|
if (!checkFileExists(appsConfig, true)) {
|
|
95485
|
-
|
|
95557
|
+
fs10.writeFileSync(appsConfig, JSON.stringify({ description: "apps manager.", list: [] }));
|
|
95486
95558
|
console.log(chalk2.green("助手应用配置文件 apps.json 创建成功"));
|
|
95487
95559
|
}
|
|
95488
95560
|
}
|
|
@@ -95504,20 +95576,20 @@ class AssistantInit extends AssistantConfig {
|
|
|
95504
95576
|
}
|
|
95505
95577
|
}
|
|
95506
95578
|
initPnpm() {
|
|
95507
|
-
const pnpmPath =
|
|
95579
|
+
const pnpmPath = path10.join(this.configDir, "assistant-app", "pnpm-workspace.yaml");
|
|
95508
95580
|
let create = false;
|
|
95509
95581
|
if (!checkFileExists(pnpmPath, true)) {
|
|
95510
95582
|
create = true;
|
|
95511
|
-
|
|
95583
|
+
fs10.writeFileSync(pnpmPath, `packages:
|
|
95512
95584
|
- 'apps/**/*'
|
|
95513
95585
|
- 'pages/**/*'
|
|
95514
95586
|
`);
|
|
95515
95587
|
console.log(chalk2.green("助手 pnpm-workspace.yaml 文件创建成功"));
|
|
95516
95588
|
}
|
|
95517
|
-
const packagePath =
|
|
95589
|
+
const packagePath = path10.join(this.configDir, "assistant-app", "package.json");
|
|
95518
95590
|
if (!checkFileExists(packagePath, true)) {
|
|
95519
95591
|
create = true;
|
|
95520
|
-
|
|
95592
|
+
fs10.writeFileSync(packagePath, `{
|
|
95521
95593
|
"name": "assistant-app",
|
|
95522
95594
|
"version": "1.0.0",
|
|
95523
95595
|
"description": "assistant-app package pnpm, node pkgs projects",
|
|
@@ -95559,7 +95631,7 @@ class AssistantInit extends AssistantConfig {
|
|
|
95559
95631
|
}
|
|
95560
95632
|
`);
|
|
95561
95633
|
console.log(chalk2.green("助手 package.json 文件创建成功, 正在安装依赖..."));
|
|
95562
|
-
installDeps({ appPath:
|
|
95634
|
+
installDeps({ appPath: path10.dirname(packagePath), isProduction: true }).then(() => {
|
|
95563
95635
|
console.log(chalk2.green("助手依赖安装完成"));
|
|
95564
95636
|
});
|
|
95565
95637
|
}
|
|
@@ -95568,10 +95640,10 @@ class AssistantInit extends AssistantConfig {
|
|
|
95568
95640
|
};
|
|
95569
95641
|
}
|
|
95570
95642
|
initIgnore() {
|
|
95571
|
-
const gitignorePath =
|
|
95643
|
+
const gitignorePath = path10.join(this.configDir, ".gitignore");
|
|
95572
95644
|
let content = "";
|
|
95573
95645
|
if (checkFileExists(gitignorePath, true)) {
|
|
95574
|
-
content =
|
|
95646
|
+
content = fs10.readFileSync(gitignorePath, "utf-8");
|
|
95575
95647
|
}
|
|
95576
95648
|
const ignoreLines = [
|
|
95577
95649
|
"node_modules",
|
|
@@ -95597,7 +95669,7 @@ ${line}`;
|
|
|
95597
95669
|
}
|
|
95598
95670
|
});
|
|
95599
95671
|
if (updated) {
|
|
95600
|
-
|
|
95672
|
+
fs10.writeFileSync(gitignorePath, content.trim() + `
|
|
95601
95673
|
`);
|
|
95602
95674
|
console.log(chalk2.green(".gitignore 文件更新成功"));
|
|
95603
95675
|
}
|
|
@@ -95672,15 +95744,15 @@ app.route({
|
|
|
95672
95744
|
}).addTo(app);
|
|
95673
95745
|
|
|
95674
95746
|
// src/module/local-proxy/index.ts
|
|
95675
|
-
import
|
|
95747
|
+
import fs12 from "node:fs";
|
|
95676
95748
|
|
|
95677
95749
|
// src/module/local-proxy/file.ts
|
|
95678
|
-
import
|
|
95750
|
+
import fs11 from "node:fs";
|
|
95679
95751
|
var checkFileExists2 = (filePath, checkIsFile = false) => {
|
|
95680
95752
|
try {
|
|
95681
|
-
|
|
95753
|
+
fs11.accessSync(filePath);
|
|
95682
95754
|
if (checkIsFile) {
|
|
95683
|
-
return
|
|
95755
|
+
return fs11.statSync(filePath).isFile();
|
|
95684
95756
|
}
|
|
95685
95757
|
return true;
|
|
95686
95758
|
} catch (error2) {
|
|
@@ -95689,7 +95761,7 @@ var checkFileExists2 = (filePath, checkIsFile = false) => {
|
|
|
95689
95761
|
};
|
|
95690
95762
|
|
|
95691
95763
|
// src/module/local-proxy/index.ts
|
|
95692
|
-
import
|
|
95764
|
+
import path11 from "node:path";
|
|
95693
95765
|
|
|
95694
95766
|
class LocalProxy {
|
|
95695
95767
|
localProxyProxyList = [];
|
|
@@ -95724,19 +95796,19 @@ class LocalProxy {
|
|
|
95724
95796
|
return;
|
|
95725
95797
|
}
|
|
95726
95798
|
if (!checkFileExists2(frontAppDir)) {
|
|
95727
|
-
|
|
95799
|
+
fs12.mkdirSync(frontAppDir, { recursive: true });
|
|
95728
95800
|
}
|
|
95729
95801
|
this.initing = true;
|
|
95730
|
-
const userList =
|
|
95802
|
+
const userList = fs12.readdirSync(frontAppDir);
|
|
95731
95803
|
const localProxyProxyList = [];
|
|
95732
95804
|
userList.forEach((user) => {
|
|
95733
|
-
const userPath =
|
|
95734
|
-
const stat =
|
|
95805
|
+
const userPath = path11.join(frontAppDir, user);
|
|
95806
|
+
const stat = fs12.statSync(userPath);
|
|
95735
95807
|
if (stat.isDirectory()) {
|
|
95736
|
-
const appList =
|
|
95808
|
+
const appList = fs12.readdirSync(userPath);
|
|
95737
95809
|
appList.forEach((app2) => {
|
|
95738
|
-
const appPath =
|
|
95739
|
-
const indexPath =
|
|
95810
|
+
const appPath = path11.join(userPath, app2);
|
|
95811
|
+
const indexPath = path11.join(appPath, "index.html");
|
|
95740
95812
|
if (!checkFileExists2(indexPath, true)) {
|
|
95741
95813
|
return;
|
|
95742
95814
|
}
|
|
@@ -95745,8 +95817,10 @@ class LocalProxy {
|
|
|
95745
95817
|
user,
|
|
95746
95818
|
key: app2,
|
|
95747
95819
|
path: `/${user}/${app2}/`,
|
|
95748
|
-
|
|
95749
|
-
|
|
95820
|
+
file: {
|
|
95821
|
+
indexPath: `${user}/${app2}/index.html`,
|
|
95822
|
+
absolutePath: appPath
|
|
95823
|
+
}
|
|
95750
95824
|
});
|
|
95751
95825
|
}
|
|
95752
95826
|
});
|
|
@@ -95775,7 +95849,7 @@ class LocalProxy {
|
|
|
95775
95849
|
fn();
|
|
95776
95850
|
}, delay);
|
|
95777
95851
|
};
|
|
95778
|
-
|
|
95852
|
+
fs12.watch(frontAppDir, { recursive: true }, (eventType, filename) => {
|
|
95779
95853
|
if (eventType === "rename" || eventType === "change") {
|
|
95780
95854
|
if (filename && filename.includes("node_modules")) {
|
|
95781
95855
|
return;
|
|
@@ -95785,9 +95859,9 @@ class LocalProxy {
|
|
|
95785
95859
|
if (!hasValidExtension) {
|
|
95786
95860
|
return;
|
|
95787
95861
|
}
|
|
95788
|
-
const filePath =
|
|
95862
|
+
const filePath = path11.join(frontAppDir, filename);
|
|
95789
95863
|
try {
|
|
95790
|
-
const stat =
|
|
95864
|
+
const stat = fs12.statSync(filePath);
|
|
95791
95865
|
if (stat.isFile() || stat.isDirectory()) {
|
|
95792
95866
|
debounce(that.init.bind(that), 5 * 1000);
|
|
95793
95867
|
}
|
|
@@ -95885,8 +95959,8 @@ app.route({
|
|
|
95885
95959
|
}).addTo(app);
|
|
95886
95960
|
|
|
95887
95961
|
// src/services/app/index.ts
|
|
95888
|
-
import
|
|
95889
|
-
import
|
|
95962
|
+
import path13 from "path";
|
|
95963
|
+
import fs13 from "fs";
|
|
95890
95964
|
|
|
95891
95965
|
// ../node_modules/.pnpm/@inquirer+core@11.1.1_@types+node@25.0.9/node_modules/@inquirer/core/dist/lib/key.js
|
|
95892
95966
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
@@ -97564,7 +97638,7 @@ var import_chardet = __toESM(require_lib2(), 1);
|
|
|
97564
97638
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
97565
97639
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "child_process";
|
|
97566
97640
|
import { readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
97567
|
-
import
|
|
97641
|
+
import path12 from "node:path";
|
|
97568
97642
|
import os3 from "node:os";
|
|
97569
97643
|
import { randomUUID } from "node:crypto";
|
|
97570
97644
|
|
|
@@ -97700,8 +97774,8 @@ class ExternalEditor {
|
|
|
97700
97774
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
97701
97775
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
97702
97776
|
const filename = `${prefix}${id}${postfix}`;
|
|
97703
|
-
const candidate =
|
|
97704
|
-
const baseResolved =
|
|
97777
|
+
const candidate = path12.resolve(baseDir, filename);
|
|
97778
|
+
const baseResolved = path12.resolve(baseDir) + path12.sep;
|
|
97705
97779
|
if (!candidate.startsWith(baseResolved)) {
|
|
97706
97780
|
throw new Error("Resolved temporary file escaped the base directory");
|
|
97707
97781
|
}
|
|
@@ -98639,9 +98713,9 @@ var import_run_async = __toESM(require_run_async(), 1);
|
|
|
98639
98713
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
98640
98714
|
import readline3 from "node:readline";
|
|
98641
98715
|
var _ = {
|
|
98642
|
-
set: (obj,
|
|
98716
|
+
set: (obj, path13 = "", value) => {
|
|
98643
98717
|
let pointer = obj;
|
|
98644
|
-
|
|
98718
|
+
path13.split(".").forEach((key, index, arr) => {
|
|
98645
98719
|
if (key === "__proto__" || key === "constructor")
|
|
98646
98720
|
return;
|
|
98647
98721
|
if (index === arr.length - 1) {
|
|
@@ -98652,8 +98726,8 @@ var _ = {
|
|
|
98652
98726
|
pointer = pointer[key];
|
|
98653
98727
|
});
|
|
98654
98728
|
},
|
|
98655
|
-
get: (obj,
|
|
98656
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
98729
|
+
get: (obj, path13 = "", defaultValue) => {
|
|
98730
|
+
const travel = (regexp) => String.prototype.split.call(path13, regexp).filter(Boolean).reduce((res, key) => res == null ? res : res[key], obj);
|
|
98657
98731
|
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
|
|
98658
98732
|
return result === undefined || result === obj ? defaultValue : result;
|
|
98659
98733
|
}
|
|
@@ -98933,7 +99007,7 @@ class AppDownload {
|
|
|
98933
99007
|
if (type === "web") {
|
|
98934
99008
|
args.push("-o", pagesDir);
|
|
98935
99009
|
} else if (type === "app") {
|
|
98936
|
-
args.push("-o",
|
|
99010
|
+
args.push("-o", path13.join(appsDir));
|
|
98937
99011
|
} else {
|
|
98938
99012
|
throw new Error("应用类型错误,只能是 web 或 app");
|
|
98939
99013
|
}
|
|
@@ -98971,10 +99045,10 @@ class AppDownload {
|
|
|
98971
99045
|
let deletePath = "";
|
|
98972
99046
|
let isDelete = false;
|
|
98973
99047
|
if (type === "web") {
|
|
98974
|
-
const pagePath =
|
|
99048
|
+
const pagePath = path13.join(pagesDir, id);
|
|
98975
99049
|
deletePath = pagePath;
|
|
98976
99050
|
} else if (type === "app") {
|
|
98977
|
-
const appPath =
|
|
99051
|
+
const appPath = path13.join(appsDir, id);
|
|
98978
99052
|
deletePath = appPath;
|
|
98979
99053
|
}
|
|
98980
99054
|
if (deletePath && checkFileExists(deletePath)) {
|
|
@@ -98985,7 +99059,7 @@ class AppDownload {
|
|
|
98985
99059
|
return;
|
|
98986
99060
|
}
|
|
98987
99061
|
}
|
|
98988
|
-
|
|
99062
|
+
fs13.rmSync(deletePath, { recursive: true });
|
|
98989
99063
|
isDelete = true;
|
|
98990
99064
|
console.log(`删除应用成功: ${deletePath}`);
|
|
98991
99065
|
}
|
|
@@ -102207,13 +102281,13 @@ var authFilter = async (req, res) => {
|
|
|
102207
102281
|
if (pathname === "/" || pathname === "/favicon.ico") {
|
|
102208
102282
|
return { code: 200, message: "允许访问根路径" };
|
|
102209
102283
|
}
|
|
102210
|
-
if (pathname.startsWith("/root/home") || pathname === "/root/cli") {
|
|
102284
|
+
if (pathname.startsWith("/root/home") || pathname === "/root/cli/docs/") {
|
|
102211
102285
|
return { code: 200, message: "允许访问首页" };
|
|
102212
102286
|
}
|
|
102213
|
-
const openApiPaths = ["/api", "/v1", "/client", "/serve", "/proxy"];
|
|
102287
|
+
const openApiPaths = ["/api", "/v1", "/client", "/serve", "/proxy", "/root"];
|
|
102214
102288
|
for (const openPath of openApiPaths) {
|
|
102215
102289
|
if (pathname.startsWith(openPath)) {
|
|
102216
|
-
return { code: 200, message: "
|
|
102290
|
+
return { code: 200, message: "允许公共访问模块" };
|
|
102217
102291
|
}
|
|
102218
102292
|
}
|
|
102219
102293
|
if (share === "public") {
|
|
@@ -102226,7 +102300,6 @@ var authFilter = async (req, res) => {
|
|
|
102226
102300
|
return { code: 500, message: "未登录" };
|
|
102227
102301
|
}
|
|
102228
102302
|
const tokenUser = await getTokenUserCache(token);
|
|
102229
|
-
console.log("authFilter tokenUser", tokenUser, token);
|
|
102230
102303
|
if (share === "protected" && tokenUser?.code === 200) {
|
|
102231
102304
|
return { code: 200, message: "受保护模式已登录允许访问" };
|
|
102232
102305
|
}
|
|
@@ -102276,21 +102349,32 @@ var proxyRoute = async (req, res) => {
|
|
|
102276
102349
|
const defaultApiProxy = createApiProxy(_assistantConfig?.app?.url || "https://kevisual.cn");
|
|
102277
102350
|
const allProxy = [...apiProxy, ...defaultApiProxy];
|
|
102278
102351
|
const apiBackendProxy = allProxy.find((item) => pathname.startsWith(item.path));
|
|
102279
|
-
|
|
102280
|
-
log.debug("
|
|
102281
|
-
if (
|
|
102352
|
+
const proxyFn = async (req2, res2, proxyApi2) => {
|
|
102353
|
+
log.debug("proxyApi", { proxyApi: proxyApi2, url: req2.url });
|
|
102354
|
+
if (proxyApi2.s3?.id) {
|
|
102355
|
+
const storage = _assistantConfig?.storage || [];
|
|
102356
|
+
const storageConfig = storage.find((item) => item.id === proxyApi2.s3?.id);
|
|
102357
|
+
proxyApi2.s3 = {
|
|
102358
|
+
...storageConfig,
|
|
102359
|
+
...proxyApi2.s3
|
|
102360
|
+
};
|
|
102361
|
+
}
|
|
102362
|
+
if (proxyApi2.file?.id) {
|
|
102282
102363
|
const storage = _assistantConfig?.storage || [];
|
|
102283
|
-
const storageConfig = storage.find((item) => item.id ===
|
|
102284
|
-
|
|
102364
|
+
const storageConfig = storage.find((item) => item.id === proxyApi2.file?.id);
|
|
102365
|
+
proxyApi2.file = {
|
|
102285
102366
|
...storageConfig,
|
|
102286
|
-
...
|
|
102367
|
+
...proxyApi2.file
|
|
102287
102368
|
};
|
|
102288
102369
|
}
|
|
102289
|
-
return proxy(
|
|
102290
|
-
path:
|
|
102291
|
-
target:
|
|
102292
|
-
...
|
|
102370
|
+
return proxy(req2, res2, {
|
|
102371
|
+
path: proxyApi2.path,
|
|
102372
|
+
target: proxyApi2.target,
|
|
102373
|
+
...proxyApi2
|
|
102293
102374
|
});
|
|
102375
|
+
};
|
|
102376
|
+
if (apiBackendProxy) {
|
|
102377
|
+
return proxyFn(req, res, apiBackendProxy);
|
|
102294
102378
|
}
|
|
102295
102379
|
logger.debug("proxyRoute handle by router", { url: req.url }, noAdmin);
|
|
102296
102380
|
const urls = pathname.split("/");
|
|
@@ -102311,27 +102395,9 @@ var proxyRoute = async (req, res) => {
|
|
|
102311
102395
|
}
|
|
102312
102396
|
const proxyApiList = _assistantConfig?.proxy || [];
|
|
102313
102397
|
const proxyApi = proxyApiList.find((item) => pathname.startsWith(item.path));
|
|
102314
|
-
if (proxyApi
|
|
102315
|
-
log.debug("
|
|
102316
|
-
|
|
102317
|
-
const _rootPath = proxyApi.rootPath;
|
|
102318
|
-
if (!_rootPath) {
|
|
102319
|
-
log.error("Not Found rootPath", { proxyApi, pathname });
|
|
102320
|
-
return res.end(`Not Found [${proxyApi.path}] rootPath`);
|
|
102321
|
-
}
|
|
102322
|
-
return fileProxy(req, res, {
|
|
102323
|
-
path: proxyApi.path,
|
|
102324
|
-
rootPath: proxyApi.rootPath,
|
|
102325
|
-
...proxyApi,
|
|
102326
|
-
indexPath: _indexPath
|
|
102327
|
-
});
|
|
102328
|
-
} else if (proxyApi && proxyApi.type === "http") {
|
|
102329
|
-
log.debug("proxyApi http", { proxyApi, pathname });
|
|
102330
|
-
return httpProxy(req, res, {
|
|
102331
|
-
path: proxyApi.path,
|
|
102332
|
-
target: proxyApi.target,
|
|
102333
|
-
type: "http"
|
|
102334
|
-
});
|
|
102398
|
+
if (proxyApi) {
|
|
102399
|
+
log.debug("proxyPage", { proxyApi, pathname });
|
|
102400
|
+
return proxyFn(req, res, proxyApi);
|
|
102335
102401
|
}
|
|
102336
102402
|
const filter2 = await authFilter(req, res);
|
|
102337
102403
|
if (filter2.code !== 200) {
|
|
@@ -102343,16 +102409,19 @@ var proxyRoute = async (req, res) => {
|
|
|
102343
102409
|
const localProxyProxy = localProxyProxyList.find((item) => pathname.startsWith(item.path));
|
|
102344
102410
|
if (localProxyProxy) {
|
|
102345
102411
|
log.log("localProxyProxy", { localProxyProxy, url: req.url });
|
|
102346
|
-
return
|
|
102412
|
+
return proxyFn(req, res, {
|
|
102347
102413
|
path: localProxyProxy.path,
|
|
102348
|
-
|
|
102349
|
-
|
|
102414
|
+
type: "file",
|
|
102415
|
+
file: {
|
|
102416
|
+
rootPath: localProxy.pagesDir,
|
|
102417
|
+
indexPath: localProxyProxy.file.indexPath
|
|
102418
|
+
}
|
|
102350
102419
|
});
|
|
102351
102420
|
}
|
|
102352
102421
|
const creatCenterProxy = createApiProxy(_assistantConfig?.app?.url || "https://kevisual.cn", ["/root", "/" + _user]);
|
|
102353
102422
|
const centerProxy = creatCenterProxy.find((item) => pathname.startsWith(item.path));
|
|
102354
102423
|
if (centerProxy) {
|
|
102355
|
-
return
|
|
102424
|
+
return proxyFn(req, res, {
|
|
102356
102425
|
path: centerProxy.path,
|
|
102357
102426
|
target: centerProxy.target,
|
|
102358
102427
|
type: "http"
|
|
@@ -102435,8 +102504,8 @@ var createProxyInfo = (proxyApiItem) => {
|
|
|
102435
102504
|
|
|
102436
102505
|
// src/routes-simple/upload.ts
|
|
102437
102506
|
var import_busboy = __toESM(require_lib4(), 1);
|
|
102438
|
-
import
|
|
102439
|
-
import
|
|
102507
|
+
import path15 from "path";
|
|
102508
|
+
import fs15 from "fs";
|
|
102440
102509
|
|
|
102441
102510
|
// ../node_modules/.pnpm/@kevisual+router@0.0.55/node_modules/@kevisual/router/src/server/cookie.ts
|
|
102442
102511
|
var NullObject2 = /* @__PURE__ */ (() => {
|
|
@@ -103136,8 +103205,8 @@ var validateDirectory = (directory) => {
|
|
|
103136
103205
|
};
|
|
103137
103206
|
|
|
103138
103207
|
// src/module/upload/mv.ts
|
|
103139
|
-
import
|
|
103140
|
-
import
|
|
103208
|
+
import fs14 from "node:fs";
|
|
103209
|
+
import path14 from "node:path";
|
|
103141
103210
|
|
|
103142
103211
|
class UploadManager {
|
|
103143
103212
|
config;
|
|
@@ -103148,12 +103217,12 @@ class UploadManager {
|
|
|
103148
103217
|
const { type, temppath, targetPath } = opts;
|
|
103149
103218
|
if (type === "file") {
|
|
103150
103219
|
const pageDir = this.config.configPath?.pagesDir;
|
|
103151
|
-
const fullTargetPath = targetPath.startsWith("/") ? targetPath :
|
|
103220
|
+
const fullTargetPath = targetPath.startsWith("/") ? targetPath : path14.join(pageDir, targetPath);
|
|
103152
103221
|
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf("/"));
|
|
103153
|
-
if (!
|
|
103154
|
-
|
|
103222
|
+
if (!fs14.existsSync(targetDir)) {
|
|
103223
|
+
fs14.mkdirSync(targetDir, { recursive: true });
|
|
103155
103224
|
}
|
|
103156
|
-
|
|
103225
|
+
fs14.renameSync(temppath, fullTargetPath);
|
|
103157
103226
|
return fullTargetPath;
|
|
103158
103227
|
}
|
|
103159
103228
|
}
|
|
@@ -103208,8 +103277,8 @@ var uploadResources = async (req, res) => {
|
|
|
103208
103277
|
});
|
|
103209
103278
|
busboy.on("file", (fieldname, fileStream, info) => {
|
|
103210
103279
|
const { filename, encoding, mimeType } = info;
|
|
103211
|
-
const tempPath =
|
|
103212
|
-
const writeStream =
|
|
103280
|
+
const tempPath = path15.join(cacheFilePath, `${Date.now()}-${Math.random().toString(36).substring(7)}`);
|
|
103281
|
+
const writeStream = fs15.createWriteStream(tempPath);
|
|
103213
103282
|
const filePromise = new Promise((resolve, reject) => {
|
|
103214
103283
|
fileStream.on("data", (chunk) => {
|
|
103215
103284
|
bytesReceived += chunk.length;
|
|
@@ -103248,8 +103317,8 @@ var uploadResources = async (req, res) => {
|
|
|
103248
103317
|
}
|
|
103249
103318
|
const clearFiles = () => {
|
|
103250
103319
|
files.forEach((file2) => {
|
|
103251
|
-
if (file2?.filepath &&
|
|
103252
|
-
|
|
103320
|
+
if (file2?.filepath && fs15.existsSync(file2.filepath)) {
|
|
103321
|
+
fs15.unlinkSync(file2.filepath);
|
|
103253
103322
|
}
|
|
103254
103323
|
});
|
|
103255
103324
|
};
|
|
@@ -103291,7 +103360,7 @@ var uploadResources = async (req, res) => {
|
|
|
103291
103360
|
targetPath: minioPath
|
|
103292
103361
|
});
|
|
103293
103362
|
if (type !== "file") {
|
|
103294
|
-
|
|
103363
|
+
fs15.unlinkSync(tempPath);
|
|
103295
103364
|
}
|
|
103296
103365
|
}
|
|
103297
103366
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
@@ -103460,10 +103529,10 @@ var {
|
|
|
103460
103529
|
|
|
103461
103530
|
// src/server.ts
|
|
103462
103531
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
103463
|
-
import
|
|
103532
|
+
import path17 from "node:path";
|
|
103464
103533
|
// src/module/get-bun-path.ts
|
|
103465
|
-
import
|
|
103466
|
-
import
|
|
103534
|
+
import fs16 from "node:fs";
|
|
103535
|
+
import path16 from "node:path";
|
|
103467
103536
|
import { execSync } from "node:child_process";
|
|
103468
103537
|
var getBunPath = () => {
|
|
103469
103538
|
const isWindows = process.platform === "win32";
|
|
@@ -103474,8 +103543,8 @@ var getBunPath = () => {
|
|
|
103474
103543
|
if (isWindows) {
|
|
103475
103544
|
try {
|
|
103476
103545
|
const globalNodeModules = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
103477
|
-
const bunExePath =
|
|
103478
|
-
if (
|
|
103546
|
+
const bunExePath = path16.join(globalNodeModules, "bun", "bin", "bun.exe");
|
|
103547
|
+
if (fs16.existsSync(bunExePath)) {
|
|
103479
103548
|
return bunExePath;
|
|
103480
103549
|
}
|
|
103481
103550
|
} catch (error3) {}
|
|
@@ -103486,9 +103555,9 @@ var getBunPath = () => {
|
|
|
103486
103555
|
return bunPath;
|
|
103487
103556
|
}
|
|
103488
103557
|
if (bunPath) {
|
|
103489
|
-
const bunDir =
|
|
103490
|
-
const bunExePath =
|
|
103491
|
-
if (
|
|
103558
|
+
const bunDir = path16.dirname(bunPath);
|
|
103559
|
+
const bunExePath = path16.join(bunDir, "node_modules", "bun", "bin", "bun.exe");
|
|
103560
|
+
if (fs16.existsSync(bunExePath)) {
|
|
103492
103561
|
return bunExePath;
|
|
103493
103562
|
}
|
|
103494
103563
|
}
|
|
@@ -103496,7 +103565,7 @@ var getBunPath = () => {
|
|
|
103496
103565
|
} else {
|
|
103497
103566
|
try {
|
|
103498
103567
|
const bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
|
|
103499
|
-
if (bunPath &&
|
|
103568
|
+
if (bunPath && fs16.existsSync(bunPath)) {
|
|
103500
103569
|
return bunPath;
|
|
103501
103570
|
}
|
|
103502
103571
|
} catch (error3) {}
|
|
@@ -103508,7 +103577,7 @@ var getBunPath = () => {
|
|
|
103508
103577
|
"C:\\Bun\\bun.exe"
|
|
103509
103578
|
];
|
|
103510
103579
|
for (const p of commonPaths) {
|
|
103511
|
-
if (
|
|
103580
|
+
if (fs16.existsSync(p)) {
|
|
103512
103581
|
return p;
|
|
103513
103582
|
}
|
|
103514
103583
|
}
|
|
@@ -103924,14 +103993,14 @@ class KeyStore {
|
|
|
103924
103993
|
}
|
|
103925
103994
|
}
|
|
103926
103995
|
function createKey(key) {
|
|
103927
|
-
let
|
|
103996
|
+
let path17 = null;
|
|
103928
103997
|
let id = null;
|
|
103929
103998
|
let src = null;
|
|
103930
103999
|
let weight = 1;
|
|
103931
104000
|
let getFn = null;
|
|
103932
104001
|
if (isString(key) || isArray3(key)) {
|
|
103933
104002
|
src = key;
|
|
103934
|
-
|
|
104003
|
+
path17 = createKeyPath(key);
|
|
103935
104004
|
id = createKeyId(key);
|
|
103936
104005
|
} else {
|
|
103937
104006
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -103945,11 +104014,11 @@ function createKey(key) {
|
|
|
103945
104014
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
103946
104015
|
}
|
|
103947
104016
|
}
|
|
103948
|
-
|
|
104017
|
+
path17 = createKeyPath(name);
|
|
103949
104018
|
id = createKeyId(name);
|
|
103950
104019
|
getFn = key.getFn;
|
|
103951
104020
|
}
|
|
103952
|
-
return { path:
|
|
104021
|
+
return { path: path17, id, weight, src, getFn };
|
|
103953
104022
|
}
|
|
103954
104023
|
function createKeyPath(key) {
|
|
103955
104024
|
return isArray3(key) ? key : key.split(".");
|
|
@@ -103957,34 +104026,34 @@ function createKeyPath(key) {
|
|
|
103957
104026
|
function createKeyId(key) {
|
|
103958
104027
|
return isArray3(key) ? key.join(".") : key;
|
|
103959
104028
|
}
|
|
103960
|
-
function get(obj,
|
|
104029
|
+
function get(obj, path17) {
|
|
103961
104030
|
let list4 = [];
|
|
103962
104031
|
let arr = false;
|
|
103963
|
-
const deepGet = (obj2,
|
|
104032
|
+
const deepGet = (obj2, path18, index) => {
|
|
103964
104033
|
if (!isDefined(obj2)) {
|
|
103965
104034
|
return;
|
|
103966
104035
|
}
|
|
103967
|
-
if (!
|
|
104036
|
+
if (!path18[index]) {
|
|
103968
104037
|
list4.push(obj2);
|
|
103969
104038
|
} else {
|
|
103970
|
-
let key =
|
|
104039
|
+
let key = path18[index];
|
|
103971
104040
|
const value = obj2[key];
|
|
103972
104041
|
if (!isDefined(value)) {
|
|
103973
104042
|
return;
|
|
103974
104043
|
}
|
|
103975
|
-
if (index ===
|
|
104044
|
+
if (index === path18.length - 1 && (isString(value) || isNumber2(value) || isBoolean(value))) {
|
|
103976
104045
|
list4.push(toString(value));
|
|
103977
104046
|
} else if (isArray3(value)) {
|
|
103978
104047
|
arr = true;
|
|
103979
104048
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
103980
|
-
deepGet(value[i],
|
|
104049
|
+
deepGet(value[i], path18, index + 1);
|
|
103981
104050
|
}
|
|
103982
|
-
} else if (
|
|
103983
|
-
deepGet(value,
|
|
104051
|
+
} else if (path18.length) {
|
|
104052
|
+
deepGet(value, path18, index + 1);
|
|
103984
104053
|
}
|
|
103985
104054
|
}
|
|
103986
104055
|
};
|
|
103987
|
-
deepGet(obj, isString(
|
|
104056
|
+
deepGet(obj, isString(path17) ? path17.split(".") : path17, 0);
|
|
103988
104057
|
return arr ? list4 : list4[0];
|
|
103989
104058
|
}
|
|
103990
104059
|
var MatchOptions = {
|
|
@@ -105516,12 +105585,12 @@ var runServer = async (port = 51515, listenPath = "127.0.0.1") => {
|
|
|
105516
105585
|
port: _port
|
|
105517
105586
|
};
|
|
105518
105587
|
};
|
|
105519
|
-
program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-e, --interpreter <interpreter>", "指定使用的解释器", "bun").action(async (options) => {
|
|
105588
|
+
program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-r, --root <root>", "工作空间路径").option("-e, --interpreter <interpreter>", "指定使用的解释器", "bun").action(async (options) => {
|
|
105520
105589
|
if (options.daemon) {
|
|
105521
105590
|
const [_interpreter, execPath] = process.argv;
|
|
105522
105591
|
const name = options.name;
|
|
105523
105592
|
const port = options.port;
|
|
105524
|
-
const runPath =
|
|
105593
|
+
const runPath = path17.resolve(execPath);
|
|
105525
105594
|
const escapePath = (p) => {
|
|
105526
105595
|
let normalized = p.replace(/\\/g, "/");
|
|
105527
105596
|
return normalized.includes(" ") ? `"${normalized}"` : normalized;
|
|
@@ -105535,6 +105604,9 @@ program.description("启动服务").option("-d, --daemon", "是否以守护进
|
|
|
105535
105604
|
if (port) {
|
|
105536
105605
|
pm2Command += ` -p ${port}`;
|
|
105537
105606
|
}
|
|
105607
|
+
if (options.root) {
|
|
105608
|
+
pm2Command += ` --root ${options.root}`;
|
|
105609
|
+
}
|
|
105538
105610
|
console.log(source_default.gray("执行命令:"), pm2Command);
|
|
105539
105611
|
console.log(source_default.gray("脚本路径:"), runPath);
|
|
105540
105612
|
try {
|