@kevisual/cli 0.0.86 → 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.
@@ -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, logger) {
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
- logger?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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, logger) {
1237
+ function createBufferedReadable(upstream, size, logger2) {
1238
1238
  if ((0, stream_type_check_1.isReadableStream)(upstream)) {
1239
- return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger);
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
- logger?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
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, logger) => {
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
- logger?.warn?.(msg);
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, logger = console) {
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
- logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
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
- logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
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
- logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
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
- logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
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
- logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
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 logger = {
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 = 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 logger;
5974
+ let logger2;
5975
5975
  let tryNextLink = true;
5976
5976
  if (typeof options === "boolean") {
5977
- logger = undefined;
5977
+ logger2 = undefined;
5978
5978
  tryNextLink = options;
5979
5979
  } else if (options != null && typeof options === "object") {
5980
- logger = options.logger;
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
- logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
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
- logger?.warn(`Skipping ${exports.ChecksumAlgorithm.CRC64NVME} checksum validation: ${error.message}`);
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
- logger?.info?.({
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
- logger?.error?.({
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 logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
14963
+ const logger2 = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
14964
14964
  if (typeof appId !== "string") {
14965
- logger?.warn("userAgentAppId must be a string or undefined.");
14965
+ logger2?.warn("userAgentAppId must be a string or undefined.");
14966
14966
  } else if (appId.length > 50) {
14967
- logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
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, logger) => {
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
- logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these " + `credentials will be attempted after ${new Date(newExpiration)}.
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 logger = options?.logger || console;
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, logger);
17435
+ credentials = getExtendedInstanceMetadataCredentials(credentials, logger2);
17436
17436
  }
17437
17437
  } catch (e) {
17438
17438
  if (pastCredentials) {
17439
- logger.warn("Credential renew failed: ", e);
17440
- credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger);
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
- logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)");
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
- logger?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
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, logger) => {
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, logger) {
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 fs3 = __require("fs");
20998
- var fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
20999
- logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
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 } = fs3.promises;
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
- logger?.debug("@aws-sdk/token-providers - fromStatic");
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, logger) => {
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, logger) => {
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, logger) => {
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
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
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
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
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
- logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
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
- logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
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
- logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
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 fs3 = __require("fs");
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 = fs3.createReadStream(fileStream.path, {
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
- log.call(deprecate, message);
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 log(message, site) {
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, log, this, message, site);
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
- log.call(deprecate, message, site);
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
- log.call(deprecate, message, site);
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 level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
34894
- if (![0, 1, 2, 3].includes(level)) {
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 level;
34897
+ return level2;
34898
34898
  }
34899
- function translateLevel(level) {
34900
- if (level === 0) {
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: level >= 2,
34907
- has16m: level >= 3
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 level = _supportsColor(stream2, {
34991
+ const level2 = _supportsColor(stream2, {
34992
34992
  streamIsTTY: stream2 && stream2.isTTY,
34993
34993
  ...options
34994
34994
  });
34995
- return translateLevel(level);
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 = 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 log(...args) {
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 fs4 = __require("fs");
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
- fs4.stat(path4, function onstat(err, stat) {
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
- fs4.stat(p, function(err2, stat) {
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
- fs4.stat(p, function(err2, stat) {
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 = fs4.createReadStream(path4, options);
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 path7 = __require("path");
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 path7.resolve(cwd, filepath);
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 path7 = __require("path");
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: path7.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 path7 = __require("path");
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 || path7.sep === "\\";
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 path7 = __require("path");
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(path7.basename(input));
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 path7 = __require("path");
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 = path7.basename(pattern2);
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 path7.isAbsolute(pattern2);
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 fs7 = require_fs();
48886
- exports.fs = fs7;
48887
- var path7 = require_path();
48888
- exports.path = path7;
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(path7, settings2, callback) {
48985
- settings2.fs.lstat(path7, (lstatError, 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(path7, (statError, 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(path7, settings2) {
49024
- const lstat = settings2.fs.lstatSync(path7);
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(path7);
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 fs7 = __require("fs");
49048
+ var fs8 = __require("fs");
49049
49049
  exports.FILE_SYSTEM_ADAPTER = {
49050
- lstat: fs7.lstat,
49051
- stat: fs7.stat,
49052
- lstatSync: fs7.lstatSync,
49053
- statSync: fs7.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 fs7 = require_fs2();
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 = fs7.createFileSystemAdapter(this._options.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(path7, optionsOrSettingsOrCallback, callback) {
49092
+ function stat(path8, optionsOrSettingsOrCallback, callback) {
49093
49093
  if (typeof optionsOrSettingsOrCallback === "function") {
49094
- async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
49094
+ async2.read(path8, getSettings(), optionsOrSettingsOrCallback);
49095
49095
  return;
49096
49096
  }
49097
- async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
49097
+ async2.read(path8, getSettings(optionsOrSettingsOrCallback), callback);
49098
49098
  }
49099
49099
  exports.stat = stat;
49100
- function statSync(path7, optionsOrSettings) {
49100
+ function statSync(path8, optionsOrSettings) {
49101
49101
  const settings2 = getSettings(optionsOrSettings);
49102
- return sync2.read(path7, settings2);
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 fs7 = require_fs3();
49219
- exports.fs = fs7;
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 path7 = common2.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
49305
+ const path8 = common2.joinPathSegments(directory, name, settings2.pathSegmentSeparator);
49306
49306
  return (done) => {
49307
- fsStat.stat(path7, settings2.fsStatSettings, (error2, stats) => {
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: path7,
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 fs7 = __require("fs");
49402
+ var fs8 = __require("fs");
49403
49403
  exports.FILE_SYSTEM_ADAPTER = {
49404
- lstat: fs7.lstat,
49405
- stat: fs7.stat,
49406
- lstatSync: fs7.lstatSync,
49407
- statSync: fs7.statSync,
49408
- readdir: fs7.readdir,
49409
- readdirSync: fs7.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 path7 = __require("path");
49423
+ var path8 = __require("path");
49424
49424
  var fsStat = require_out();
49425
- var fs7 = require_fs4();
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 = fs7.createFileSystemAdapter(this._options.fs);
49432
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path7.sep);
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(path7, optionsOrSettingsOrCallback, callback) {
49456
+ function scandir(path8, optionsOrSettingsOrCallback, callback) {
49457
49457
  if (typeof optionsOrSettingsOrCallback === "function") {
49458
- async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
49458
+ async2.read(path8, getSettings(), optionsOrSettingsOrCallback);
49459
49459
  return;
49460
49460
  }
49461
- async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
49461
+ async2.read(path8, getSettings(optionsOrSettingsOrCallback), callback);
49462
49462
  }
49463
49463
  exports.scandir = scandir;
49464
- function scandirSync(path7, optionsOrSettings) {
49464
+ function scandirSync(path8, optionsOrSettings) {
49465
49465
  const settings2 = getSettings(optionsOrSettings);
49466
- return sync2.read(path7, settings2);
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 path7 = __require("path");
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, path7.sep);
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 path7 = __require("path");
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 path7.resolve(this._settings.cwd, filepath);
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 path7 = __require("path");
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 path7.resolve(this._settings.cwd, task.base);
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 fs7 = __require("fs");
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: fs7.lstat,
50731
- lstatSync: fs7.lstatSync,
50732
- stat: fs7.stat,
50733
- statSync: fs7.statSync,
50734
- readdir: fs7.readdir,
50735
- readdirSync: fs7.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 fs12 = (0, node_1.default)();
56812
+ const fs13 = (0, node_1.default)();
56813
56813
  const handler = (err, buffer) => {
56814
56814
  if (fd) {
56815
- fs12.closeSync(fd);
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 = fs12.openSync(filepath, "r");
56827
+ fd = fs13.openSync(filepath, "r");
56828
56828
  let sample = Buffer.allocUnsafe(sampleSize);
56829
- fs12.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
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
- fs12.readFile(filepath, handler);
56841
+ fs13.readFile(filepath, handler);
56842
56842
  });
56843
56843
  exports.detectFile = detectFile;
56844
56844
  var detectFileSync = (filepath, opts = {}) => {
56845
- const fs12 = (0, node_1.default)();
56845
+ const fs13 = (0, node_1.default)();
56846
56846
  if (opts && opts.sampleSize) {
56847
- const fd = fs12.openSync(filepath, "r");
56847
+ const fd = fs13.openSync(filepath, "r");
56848
56848
  let sample = Buffer.allocUnsafe(opts.sampleSize);
56849
- const bytesRead = fs12.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
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
- fs12.closeSync(fd);
56853
+ fs13.closeSync(fd);
56854
56854
  return (0, exports.detect)(sample);
56855
56855
  }
56856
- return (0, exports.detect)(fs12.readFileSync(filepath));
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(path13) {
72738
- if (typeof path13 !== "string")
72737
+ function basename(path14) {
72738
+ if (typeof path14 !== "string")
72739
72739
  return "";
72740
- for (let i = path13.length - 1;i >= 0; --i) {
72741
- switch (path13.charCodeAt(i)) {
72740
+ for (let i = path14.length - 1;i >= 0; --i) {
72741
+ switch (path14.charCodeAt(i)) {
72742
72742
  case 47:
72743
72743
  case 92:
72744
- path13 = path13.slice(i + 1);
72745
- return path13 === ".." || path13 === "." ? "" : path13;
72744
+ path14 = path14.slice(i + 1);
72745
+ return path14 === ".." || path14 === "." ? "" : path14;
72746
72746
  }
72747
72747
  }
72748
- return path13 === ".." || path13 === "." ? "" : path13;
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 path15 = __require("node:path");
76771
- var fs15 = __require("node:fs");
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 (fs15.existsSync(executableFile))
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 = path15.resolve(baseDir, baseName);
77321
- if (fs15.existsSync(localBin))
77320
+ const localBin = path16.resolve(baseDir, baseName);
77321
+ if (fs16.existsSync(localBin))
77322
77322
  return localBin;
77323
- if (sourceExt.includes(path15.extname(baseName)))
77323
+ if (sourceExt.includes(path16.extname(baseName)))
77324
77324
  return;
77325
- const foundExt = sourceExt.find((ext) => fs15.existsSync(`${localBin}${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 = fs15.realpathSync(this._scriptPath);
77337
+ resolvedScriptPath = fs16.realpathSync(this._scriptPath);
77338
77338
  } catch {
77339
77339
  resolvedScriptPath = this._scriptPath;
77340
77340
  }
77341
- executableDir = path15.resolve(path15.dirname(resolvedScriptPath), 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 = path15.basename(this._scriptPath, path15.extname(this._scriptPath));
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(path15.extname(executableFile));
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 = path15.basename(filename, path15.extname(filename));
77942
+ this._name = path16.basename(filename, path16.extname(filename));
77943
77943
  return this;
77944
77944
  }
77945
- executableDir(path16) {
77946
- if (path16 === undefined)
77945
+ executableDir(path17) {
77946
+ if (path17 === undefined)
77947
77947
  return this._executableDir;
77948
- this._executableDir = path16;
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 fs9 from "node:fs";
83609
- import path9 from "node:path";
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
- console.log("使用环境变量 ASSISTANT_CONFIG_DIR 作为 kevisual 目录:", kevisualDir);
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
- console.log("Bun pipeProxyReq content-type", contentType);
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 fs3 from "node:fs";
84165
+ import fs4 from "node:fs";
84043
84166
 
84044
- // ../node_modules/.pnpm/es-toolkit@1.43.0/node_modules/es-toolkit/dist/object/omit.mjs
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 = fs3.createReadStream(filePath);
84236
- const stat = fs3.statSync(filePath);
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 path3 from "node:path";
84592
+ import path4 from "node:path";
84473
84593
 
84474
- // ../node_modules/.pnpm/@kevisual+logger@0.0.4/node_modules/@kevisual/logger/dist/logger.mjs
84475
- var showTime = (time, format = "hh:mm:ss") => {
84476
- const date = new Date(time);
84477
- const pad = (n) => n.toString().padStart(2, "0");
84478
- const year = date.getFullYear();
84479
- const month = pad(date.getMonth() + 1);
84480
- const day = pad(date.getDate());
84481
- const hours = pad(date.getHours());
84482
- const minutes = pad(date.getMinutes());
84483
- const seconds = pad(date.getSeconds());
84484
- if (format === "YYYY-MM-DD hh:mm:ss") {
84485
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
84486
- }
84487
- return `${hours}:${minutes}:${seconds}`;
84488
- };
84489
- var logLevel = ["debug", "info", "warn", "error"];
84490
- var computeLevel = (level, currentLevel) => {
84491
- const levelIndex = logLevel.indexOf(level);
84492
- const currentLevelIndex = logLevel.indexOf(currentLevel);
84493
- return levelIndex >= currentLevelIndex;
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
- class Printer {
84497
- constructor() {}
84498
- info(...args) {
84499
- console.log(...args);
84500
- }
84501
- debug(...args) {
84502
- console.debug(...args);
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
- class Logger {
84513
- level = "info";
84514
- printer;
84515
- showTime;
84516
- format;
84517
- constructor(opts) {
84518
- if (opts?.level) {
84519
- const normalizedLevel = opts.level.toLowerCase();
84520
- if (logLevel.includes(normalizedLevel)) {
84521
- this.level = normalizedLevel;
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
- this.level = "info";
84527
- }
84528
- this.printer = opts?.printer ?? new Printer;
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
- log(...args) {
84542
- this.print("info", ...args);
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/file-proxy.ts
84581
- var fileProxy = (req, res, proxyApi) => {
84582
- const url3 = new URL(req.url, "http://localhost");
84583
- const [user, key, _info] = url3.pathname.split("/");
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
- try {
84590
- let filePath = "";
84591
- let exist = false;
84592
- if (_info) {
84593
- filePath = path3.join(rootPath, target, pathname);
84594
- exist = checkFileExists(filePath, true);
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 fs4 from "node:fs";
84644
- import path4 from "node:path";
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 fs5 = __require2("fs");
84729
- var path5 = __require2("path");
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 (fs5.existsSync(filepath)) {
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 = path5.resolve(process.cwd(), ".env.vault");
84949
+ possibleVaultPath = path6.resolve(process.cwd(), ".env.vault");
84881
84950
  }
84882
- if (fs5.existsSync(possibleVaultPath)) {
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] === "~" ? path5.join(os2.homedir(), envPath.slice(1)) : envPath;
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 = path5.resolve(process.cwd(), ".env");
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(fs5.readFileSync(path22, { encoding }));
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 = path5.relative(process.cwd(), filePath);
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
- fs4.accessSync(path22, fs4.constants.F_OK);
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 = path4.join(opts.cwd || getCwdDirname(), opts.envConfigFile);
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 = path4.join(dirname, "../" + fileName);
85148
+ const lastPath = path5.join(dirname, "../" + fileName);
85080
85149
  const last = fileIsExist(lastPath);
85081
85150
  if (last)
85082
85151
  return lastPath;
85083
- const lastLastPath = path4.join(dirname, "../../" + fileName);
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 = path4.join(publicPath, str);
85160
+ const filePath = path5.join(publicPath, str);
85092
85161
  if (opts?.needExists) {
85093
85162
  if (!fileIsExist(filePath)) {
85094
- fs4.mkdirSync(filePath, { recursive: true });
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 path5 = {};
86595
+ var path6 = {};
86527
86596
  var hasRequiredPath;
86528
86597
  function requirePath() {
86529
86598
  if (hasRequiredPath)
86530
- return path5;
86599
+ return path6;
86531
86600
  hasRequiredPath = 1;
86532
- Object.defineProperty(path5, "__esModule", { value: true });
86533
- path5.convertPosixPathToPattern = path5.convertWindowsPathToPattern = path5.convertPathToPattern = path5.escapePosixPath = path5.escapeWindowsPath = path5.escape = path5.removeLeadingDotSegment = path5.makeAbsolute = path5.unixify = undefined;
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
- path5.unixify = unixify;
86614
+ path6.unixify = unixify;
86546
86615
  function makeAbsolute(cwd, filepath) {
86547
86616
  return path$12.resolve(cwd, filepath);
86548
86617
  }
86549
- path5.makeAbsolute = makeAbsolute;
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
- path5.removeLeadingDotSegment = removeLeadingDotSegment;
86560
- path5.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
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
- path5.escapeWindowsPath = escapeWindowsPath;
86633
+ path6.escapeWindowsPath = escapeWindowsPath;
86565
86634
  function escapePosixPath(pattern) {
86566
86635
  return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
86567
86636
  }
86568
- path5.escapePosixPath = escapePosixPath;
86569
- path5.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
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
- path5.convertWindowsPathToPattern = convertWindowsPathToPattern;
86642
+ path6.convertWindowsPathToPattern = convertWindowsPathToPattern;
86574
86643
  function convertPosixPathToPattern(filepath) {
86575
86644
  return escapePosixPath(filepath);
86576
86645
  }
86577
- path5.convertPosixPathToPattern = convertPosixPathToPattern;
86578
- return path5;
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 path6 = require$$0$12;
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: path6.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 path6 = require$$0$12;
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 || path6.sep === "\\";
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 path6 = require$$0$12;
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(path6.basename(input));
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 path6 = require$$0$12;
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 = path6.basename(pattern2);
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 path6.isAbsolute(pattern2);
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 fs5 = requireFs$3();
89830
- utils$3.fs = fs5;
89831
- const path6 = requirePath();
89832
- utils$3.path = path6;
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(path6, settings, callback) {
89944
- settings.fs.lstat(path6, (lstatError, 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(path6, (statError, 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(path6, settings) {
89987
- const lstat = settings.fs.lstatSync(path6);
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(path6);
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 fs5 = require$$0$4;
90086
+ const fs6 = require$$0$4;
90018
90087
  exports$1.FILE_SYSTEM_ADAPTER = {
90019
- lstat: fs5.lstat,
90020
- stat: fs5.stat,
90021
- lstatSync: fs5.lstatSync,
90022
- statSync: fs5.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 fs5 = requireFs$2();
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 = fs5.createFileSystemAdapter(this._options.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(path6, optionsOrSettingsOrCallback, callback) {
90137
+ function stat(path7, optionsOrSettingsOrCallback, callback) {
90069
90138
  if (typeof optionsOrSettingsOrCallback === "function") {
90070
- async2.read(path6, getSettings(), optionsOrSettingsOrCallback);
90139
+ async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
90071
90140
  return;
90072
90141
  }
90073
- async2.read(path6, getSettings(optionsOrSettingsOrCallback), callback);
90142
+ async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
90074
90143
  }
90075
90144
  out$1.stat = stat;
90076
- function statSync(path6, optionsOrSettings) {
90145
+ function statSync(path7, optionsOrSettings) {
90077
90146
  const settings = getSettings(optionsOrSettings);
90078
- return sync.read(path6, settings);
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 fs5 = requireFs$1();
90215
- utils.fs = fs5;
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 path6 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
90377
+ const path7 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
90309
90378
  return (done) => {
90310
- fsStat.stat(path6, settings.fsStatSettings, (error, stats) => {
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: path6,
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 fs5 = {};
90475
+ var fs6 = {};
90407
90476
  var hasRequiredFs;
90408
90477
  function requireFs() {
90409
90478
  if (hasRequiredFs)
90410
- return fs5;
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 fs6 = require$$0$4;
90484
+ const fs7 = require$$0$4;
90416
90485
  exports$1.FILE_SYSTEM_ADAPTER = {
90417
- lstat: fs6.lstat,
90418
- stat: fs6.stat,
90419
- lstatSync: fs6.lstatSync,
90420
- statSync: fs6.statSync,
90421
- readdir: fs6.readdir,
90422
- readdirSync: fs6.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
- })(fs5);
90432
- return fs5;
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 path6 = require$$0$12;
90509
+ const path7 = require$$0$12;
90441
90510
  const fsStat = requireOut$3();
90442
- const fs6 = requireFs();
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 = fs6.createFileSystemAdapter(this._options.fs);
90449
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path6.sep);
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(path6, optionsOrSettingsOrCallback, callback) {
90545
+ function scandir(path7, optionsOrSettingsOrCallback, callback) {
90477
90546
  if (typeof optionsOrSettingsOrCallback === "function") {
90478
- async2.read(path6, getSettings(), optionsOrSettingsOrCallback);
90547
+ async2.read(path7, getSettings(), optionsOrSettingsOrCallback);
90479
90548
  return;
90480
90549
  }
90481
- async2.read(path6, getSettings(optionsOrSettingsOrCallback), callback);
90550
+ async2.read(path7, getSettings(optionsOrSettingsOrCallback), callback);
90482
90551
  }
90483
90552
  out$2.scandir = scandir;
90484
- function scandirSync(path6, optionsOrSettings) {
90553
+ function scandirSync(path7, optionsOrSettings) {
90485
90554
  const settings = getSettings(optionsOrSettings);
90486
- return sync.read(path6, settings);
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 path6 = require$$0$12;
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, path6.sep);
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 path6 = require$$0$12;
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 path6.resolve(this._settings.cwd, filepath);
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 path6 = require$$0$12;
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 path6.resolve(this._settings.cwd, task.base);
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 fs6 = require$$0$4;
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: fs6.lstat,
91851
- lstatSync: fs6.lstatSync,
91852
- stat: fs6.stat,
91853
- statSync: fs6.statSync,
91854
- readdir: fs6.readdir,
91855
- readdirSync: fs6.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 path6 from "node:path";
92630
- import fs6 from "node:fs";
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 = path6.resolve(appsPath);
92703
+ const resolvePath = path7.resolve(appsPath);
92635
92704
  if (fileIsExist(resolvePath)) {
92636
92705
  return resolvePath;
92637
92706
  } else {
92638
- fs6.mkdirSync(resolvePath, { recursive: true });
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 = path6.join(appsPath, "..", filename);
92651
- fs6.writeFileSync(configFile, JSON.stringify({ list: [] }));
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 = fs6.readFileSync(configFile, "utf-8");
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
- fs6.writeFileSync(configFile, JSON.stringify(data, null, 2));
92744
+ fs7.writeFileSync(configFile, JSON.stringify(data, null, 2));
92676
92745
  };
92677
92746
  var deleteFileAppInfo2 = async (key, appsPath) => {
92678
- const normalizedKey = key.replace(/\//g, path6.sep);
92679
- const directory = path6.join(appsPath, normalizedKey);
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
- fs6.rmSync(directory, { recursive: true });
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 path7 from "node:path";
93799
+ import path8 from "node:path";
93731
93800
  var import_fast_glob = __toESM(require_out4(), 1);
93732
- import fs7 from "node:fs";
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 = path7.join(app.path, app.entry);
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 = path7.join(app.path, entry2);
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 = path7.join(app.path, app.entry);
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 = path7.join(app.path, "../..");
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, path7.sep);
94301
- const directory = path7.join(_appPath, normalizedKey);
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 = path7.join(directory, "package.json");
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 = fs7.readFileSync(pkgs, "utf-8");
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 = path7.join(directory, "README.md");
94318
- const readmeFile2 = path7.join(directory, "readme.md");
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 = fs7.readFileSync(readmeFile, "utf-8");
94390
+ readmeDesc = fs8.readFileSync(readmeFile, "utf-8");
94322
94391
  } else if (fileIsExist(readmeFile2)) {
94323
- readmeDesc = fs7.readFileSync(readmeFile2, "utf-8");
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 = path7.join(_appPath, "..");
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 = path7.resolve(_appPath);
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 = path7.dirname(pkg);
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 path8 from "node:path";
94364
- import fs8 from "node:fs";
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 || path8.join(process.cwd(), "apps");
94536
- const pagesPath = config?.configPath?.pagesDir || path8.join(process.cwd(), "pages");
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 = path8.basename(appsConfigPath || "");
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 = fs8.readFileSync(path8.join(this.pagesPath, page), "utf-8");
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 = fs8.readFileSync(path8.join(root3, page), "utf-8");
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 = path9.join(this.configDir, "assistant-app", "assistant-config.json");
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
- fs9.writeFileSync(env3, `# 环境配置文件
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
- fs9.writeFileSync(appsConfig, JSON.stringify({ description: "apps manager.", list: [] }));
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 = path9.join(this.configDir, "assistant-app", "pnpm-workspace.yaml");
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
- fs9.writeFileSync(pnpmPath, `packages:
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 = path9.join(this.configDir, "assistant-app", "package.json");
95589
+ const packagePath = path10.join(this.configDir, "assistant-app", "package.json");
95518
95590
  if (!checkFileExists(packagePath, true)) {
95519
95591
  create = true;
95520
- fs9.writeFileSync(packagePath, `{
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: path9.dirname(packagePath), isProduction: true }).then(() => {
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 = path9.join(this.configDir, ".gitignore");
95643
+ const gitignorePath = path10.join(this.configDir, ".gitignore");
95572
95644
  let content = "";
95573
95645
  if (checkFileExists(gitignorePath, true)) {
95574
- content = fs9.readFileSync(gitignorePath, "utf-8");
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
- fs9.writeFileSync(gitignorePath, content.trim() + `
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 fs11 from "node:fs";
95747
+ import fs12 from "node:fs";
95676
95748
 
95677
95749
  // src/module/local-proxy/file.ts
95678
- import fs10 from "node:fs";
95750
+ import fs11 from "node:fs";
95679
95751
  var checkFileExists2 = (filePath, checkIsFile = false) => {
95680
95752
  try {
95681
- fs10.accessSync(filePath);
95753
+ fs11.accessSync(filePath);
95682
95754
  if (checkIsFile) {
95683
- return fs10.statSync(filePath).isFile();
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 path10 from "node:path";
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
- fs11.mkdirSync(frontAppDir, { recursive: true });
95799
+ fs12.mkdirSync(frontAppDir, { recursive: true });
95728
95800
  }
95729
95801
  this.initing = true;
95730
- const userList = fs11.readdirSync(frontAppDir);
95802
+ const userList = fs12.readdirSync(frontAppDir);
95731
95803
  const localProxyProxyList = [];
95732
95804
  userList.forEach((user) => {
95733
- const userPath = path10.join(frontAppDir, user);
95734
- const stat = fs11.statSync(userPath);
95805
+ const userPath = path11.join(frontAppDir, user);
95806
+ const stat = fs12.statSync(userPath);
95735
95807
  if (stat.isDirectory()) {
95736
- const appList = fs11.readdirSync(userPath);
95808
+ const appList = fs12.readdirSync(userPath);
95737
95809
  appList.forEach((app2) => {
95738
- const appPath = path10.join(userPath, app2);
95739
- const indexPath = path10.join(appPath, "index.html");
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
- indexPath: `${user}/${app2}/index.html`,
95749
- absolutePath: appPath
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
- fs11.watch(frontAppDir, { recursive: true }, (eventType, filename) => {
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 = path10.join(frontAppDir, filename);
95862
+ const filePath = path11.join(frontAppDir, filename);
95789
95863
  try {
95790
- const stat = fs11.statSync(filePath);
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 path12 from "path";
95889
- import fs12 from "fs";
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 path11 from "node:path";
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 = path11.resolve(baseDir, filename);
97704
- const baseResolved = path11.resolve(baseDir) + path11.sep;
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, path12 = "", value) => {
98716
+ set: (obj, path13 = "", value) => {
98643
98717
  let pointer = obj;
98644
- path12.split(".").forEach((key, index, arr) => {
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, path12 = "", defaultValue) => {
98656
- const travel = (regexp) => String.prototype.split.call(path12, regexp).filter(Boolean).reduce((res, key) => res == null ? res : res[key], obj);
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", path12.join(appsDir));
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 = path12.join(pagesDir, id);
99048
+ const pagePath = path13.join(pagesDir, id);
98975
99049
  deletePath = pagePath;
98976
99050
  } else if (type === "app") {
98977
- const appPath = path12.join(appsDir, id);
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
- fs12.rmSync(deletePath, { recursive: true });
99062
+ fs13.rmSync(deletePath, { recursive: true });
98989
99063
  isDelete = true;
98990
99064
  console.log(`删除应用成功: ${deletePath}`);
98991
99065
  }
@@ -102196,7 +102270,7 @@ var authFilter = async (req, res) => {
102196
102270
  const share = auth.share || "protected";
102197
102271
  const noAdmin = !auth.username;
102198
102272
  if (noAdmin)
102199
- return false;
102273
+ return { code: 500, message: "没有管理员" };
102200
102274
  const admin = auth.username;
102201
102275
  const admins = auth.admin || [];
102202
102276
  if (admin) {
@@ -102205,39 +102279,39 @@ var authFilter = async (req, res) => {
102205
102279
  const url3 = new URL(req.url, "http://localhost");
102206
102280
  const pathname = decodeURIComponent(url3.pathname);
102207
102281
  if (pathname === "/" || pathname === "/favicon.ico") {
102208
- return false;
102282
+ return { code: 200, message: "允许访问根路径" };
102209
102283
  }
102210
- if (pathname.startsWith("/root/home") || pathname === "/root/cli") {
102211
- return false;
102284
+ if (pathname.startsWith("/root/home") || pathname === "/root/cli/docs/") {
102285
+ return { code: 200, message: "允许访问首页" };
102212
102286
  }
102213
- const openApiPaths = ["/api", "/v1", "/client", "/serve"];
102287
+ const openApiPaths = ["/api", "/v1", "/client", "/serve", "/proxy", "/root"];
102214
102288
  for (const openPath of openApiPaths) {
102215
102289
  if (pathname.startsWith(openPath)) {
102216
- return false;
102290
+ return { code: 200, message: "允许公共访问模块" };
102217
102291
  }
102218
102292
  }
102219
102293
  if (share === "public") {
102220
- return false;
102294
+ return { code: 200, message: "公开模式允许访问" };
102221
102295
  }
102222
102296
  const { token } = await getToken(req);
102223
102297
  if (!token) {
102224
102298
  res.writeHead(302, { Location: `/root/home/` });
102225
102299
  res.end();
102226
- return false;
102300
+ return { code: 500, message: "未登录" };
102227
102301
  }
102228
102302
  const tokenUser = await getTokenUserCache(token);
102229
102303
  if (share === "protected" && tokenUser?.code === 200) {
102230
- return false;
102304
+ return { code: 200, message: "受保护模式已登录允许访问" };
102231
102305
  }
102232
102306
  if (share === "private") {
102233
102307
  if (tokenUser?.code === 200) {
102234
102308
  const username = tokenUser?.data?.username;
102235
102309
  if (admins.includes(username)) {
102236
- return false;
102310
+ return { code: 200, message: "私有模式管理员允许访问" };
102237
102311
  }
102238
102312
  }
102239
102313
  }
102240
- return true;
102314
+ return { code: 500, message: "没有权限访问" };
102241
102315
  };
102242
102316
  var proxyRoute = async (req, res) => {
102243
102317
  const _assistantConfig = assistantConfig2.getCacheAssistantConfig();
@@ -102275,21 +102349,32 @@ var proxyRoute = async (req, res) => {
102275
102349
  const defaultApiProxy = createApiProxy(_assistantConfig?.app?.url || "https://kevisual.cn");
102276
102350
  const allProxy = [...apiProxy, ...defaultApiProxy];
102277
102351
  const apiBackendProxy = allProxy.find((item) => pathname.startsWith(item.path));
102278
- if (apiBackendProxy) {
102279
- log.debug("apiBackendProxy", { apiBackendProxy, url: req.url });
102280
- if (apiBackendProxy.s3?.id) {
102352
+ const proxyFn = async (req2, res2, proxyApi2) => {
102353
+ log.debug("proxyApi", { proxyApi: proxyApi2, url: req2.url });
102354
+ if (proxyApi2.s3?.id) {
102281
102355
  const storage = _assistantConfig?.storage || [];
102282
- const storageConfig = storage.find((item) => item.id === apiBackendProxy.s3?.id);
102283
- apiBackendProxy.s3 = {
102356
+ const storageConfig = storage.find((item) => item.id === proxyApi2.s3?.id);
102357
+ proxyApi2.s3 = {
102284
102358
  ...storageConfig,
102285
- ...apiBackendProxy.s3
102359
+ ...proxyApi2.s3
102286
102360
  };
102287
102361
  }
102288
- return proxy(req, res, {
102289
- path: apiBackendProxy.path,
102290
- target: apiBackendProxy.target,
102291
- ...apiBackendProxy
102362
+ if (proxyApi2.file?.id) {
102363
+ const storage = _assistantConfig?.storage || [];
102364
+ const storageConfig = storage.find((item) => item.id === proxyApi2.file?.id);
102365
+ proxyApi2.file = {
102366
+ ...storageConfig,
102367
+ ...proxyApi2.file
102368
+ };
102369
+ }
102370
+ return proxy(req2, res2, {
102371
+ path: proxyApi2.path,
102372
+ target: proxyApi2.target,
102373
+ ...proxyApi2
102292
102374
  });
102375
+ };
102376
+ if (apiBackendProxy) {
102377
+ return proxyFn(req, res, apiBackendProxy);
102293
102378
  }
102294
102379
  logger.debug("proxyRoute handle by router", { url: req.url }, noAdmin);
102295
102380
  const urls = pathname.split("/");
@@ -102310,30 +102395,13 @@ var proxyRoute = async (req, res) => {
102310
102395
  }
102311
102396
  const proxyApiList = _assistantConfig?.proxy || [];
102312
102397
  const proxyApi = proxyApiList.find((item) => pathname.startsWith(item.path));
102313
- if (proxyApi && proxyApi.type === "file") {
102314
- log.debug("proxyApi", { proxyApi, pathname });
102315
- const _indexPath = proxyApi.indexPath || `${_user}/${_app}/index.html`;
102316
- const _rootPath = proxyApi.rootPath;
102317
- if (!_rootPath) {
102318
- log.error("Not Found rootPath", { proxyApi, pathname });
102319
- return res.end(`Not Found [${proxyApi.path}] rootPath`);
102320
- }
102321
- return fileProxy(req, res, {
102322
- path: proxyApi.path,
102323
- rootPath: proxyApi.rootPath,
102324
- ...proxyApi,
102325
- indexPath: _indexPath
102326
- });
102327
- } else if (proxyApi && proxyApi.type === "http") {
102328
- log.debug("proxyApi http", { proxyApi, pathname });
102329
- return httpProxy(req, res, {
102330
- path: proxyApi.path,
102331
- target: proxyApi.target,
102332
- type: "http"
102333
- });
102398
+ if (proxyApi) {
102399
+ log.debug("proxyPage", { proxyApi, pathname });
102400
+ return proxyFn(req, res, proxyApi);
102334
102401
  }
102335
102402
  const filter2 = await authFilter(req, res);
102336
- if (filter2) {
102403
+ if (filter2.code !== 200) {
102404
+ console.log("auth filter deny", filter2);
102337
102405
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
102338
102406
  return res.end(renderNoAuthAndLogin("Not Authorized Proxy"));
102339
102407
  }
@@ -102341,16 +102409,19 @@ var proxyRoute = async (req, res) => {
102341
102409
  const localProxyProxy = localProxyProxyList.find((item) => pathname.startsWith(item.path));
102342
102410
  if (localProxyProxy) {
102343
102411
  log.log("localProxyProxy", { localProxyProxy, url: req.url });
102344
- return fileProxy(req, res, {
102412
+ return proxyFn(req, res, {
102345
102413
  path: localProxyProxy.path,
102346
- rootPath: localProxy.pagesDir,
102347
- indexPath: localProxyProxy.indexPath
102414
+ type: "file",
102415
+ file: {
102416
+ rootPath: localProxy.pagesDir,
102417
+ indexPath: localProxyProxy.file.indexPath
102418
+ }
102348
102419
  });
102349
102420
  }
102350
102421
  const creatCenterProxy = createApiProxy(_assistantConfig?.app?.url || "https://kevisual.cn", ["/root", "/" + _user]);
102351
102422
  const centerProxy = creatCenterProxy.find((item) => pathname.startsWith(item.path));
102352
102423
  if (centerProxy) {
102353
- return httpProxy(req, res, {
102424
+ return proxyFn(req, res, {
102354
102425
  path: centerProxy.path,
102355
102426
  target: centerProxy.target,
102356
102427
  type: "http"
@@ -102433,8 +102504,8 @@ var createProxyInfo = (proxyApiItem) => {
102433
102504
 
102434
102505
  // src/routes-simple/upload.ts
102435
102506
  var import_busboy = __toESM(require_lib4(), 1);
102436
- import path14 from "path";
102437
- import fs14 from "fs";
102507
+ import path15 from "path";
102508
+ import fs15 from "fs";
102438
102509
 
102439
102510
  // ../node_modules/.pnpm/@kevisual+router@0.0.55/node_modules/@kevisual/router/src/server/cookie.ts
102440
102511
  var NullObject2 = /* @__PURE__ */ (() => {
@@ -103134,8 +103205,8 @@ var validateDirectory = (directory) => {
103134
103205
  };
103135
103206
 
103136
103207
  // src/module/upload/mv.ts
103137
- import fs13 from "node:fs";
103138
- import path13 from "node:path";
103208
+ import fs14 from "node:fs";
103209
+ import path14 from "node:path";
103139
103210
 
103140
103211
  class UploadManager {
103141
103212
  config;
@@ -103146,12 +103217,12 @@ class UploadManager {
103146
103217
  const { type, temppath, targetPath } = opts;
103147
103218
  if (type === "file") {
103148
103219
  const pageDir = this.config.configPath?.pagesDir;
103149
- const fullTargetPath = targetPath.startsWith("/") ? targetPath : path13.join(pageDir, targetPath);
103220
+ const fullTargetPath = targetPath.startsWith("/") ? targetPath : path14.join(pageDir, targetPath);
103150
103221
  const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf("/"));
103151
- if (!fs13.existsSync(targetDir)) {
103152
- fs13.mkdirSync(targetDir, { recursive: true });
103222
+ if (!fs14.existsSync(targetDir)) {
103223
+ fs14.mkdirSync(targetDir, { recursive: true });
103153
103224
  }
103154
- fs13.renameSync(temppath, fullTargetPath);
103225
+ fs14.renameSync(temppath, fullTargetPath);
103155
103226
  return fullTargetPath;
103156
103227
  }
103157
103228
  }
@@ -103206,8 +103277,8 @@ var uploadResources = async (req, res) => {
103206
103277
  });
103207
103278
  busboy.on("file", (fieldname, fileStream, info) => {
103208
103279
  const { filename, encoding, mimeType } = info;
103209
- const tempPath = path14.join(cacheFilePath, `${Date.now()}-${Math.random().toString(36).substring(7)}`);
103210
- const writeStream = fs14.createWriteStream(tempPath);
103280
+ const tempPath = path15.join(cacheFilePath, `${Date.now()}-${Math.random().toString(36).substring(7)}`);
103281
+ const writeStream = fs15.createWriteStream(tempPath);
103211
103282
  const filePromise = new Promise((resolve, reject) => {
103212
103283
  fileStream.on("data", (chunk) => {
103213
103284
  bytesReceived += chunk.length;
@@ -103246,8 +103317,8 @@ var uploadResources = async (req, res) => {
103246
103317
  }
103247
103318
  const clearFiles = () => {
103248
103319
  files.forEach((file2) => {
103249
- if (file2?.filepath && fs14.existsSync(file2.filepath)) {
103250
- fs14.unlinkSync(file2.filepath);
103320
+ if (file2?.filepath && fs15.existsSync(file2.filepath)) {
103321
+ fs15.unlinkSync(file2.filepath);
103251
103322
  }
103252
103323
  });
103253
103324
  };
@@ -103289,7 +103360,7 @@ var uploadResources = async (req, res) => {
103289
103360
  targetPath: minioPath
103290
103361
  });
103291
103362
  if (type !== "file") {
103292
- fs14.unlinkSync(tempPath);
103363
+ fs15.unlinkSync(tempPath);
103293
103364
  }
103294
103365
  }
103295
103366
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -103458,10 +103529,10 @@ var {
103458
103529
 
103459
103530
  // src/server.ts
103460
103531
  import { spawnSync as spawnSync4 } from "node:child_process";
103461
- import path16 from "node:path";
103532
+ import path17 from "node:path";
103462
103533
  // src/module/get-bun-path.ts
103463
- import fs15 from "node:fs";
103464
- import path15 from "node:path";
103534
+ import fs16 from "node:fs";
103535
+ import path16 from "node:path";
103465
103536
  import { execSync } from "node:child_process";
103466
103537
  var getBunPath = () => {
103467
103538
  const isWindows = process.platform === "win32";
@@ -103472,8 +103543,8 @@ var getBunPath = () => {
103472
103543
  if (isWindows) {
103473
103544
  try {
103474
103545
  const globalNodeModules = execSync("npm root -g", { encoding: "utf-8" }).trim();
103475
- const bunExePath = path15.join(globalNodeModules, "bun", "bin", "bun.exe");
103476
- if (fs15.existsSync(bunExePath)) {
103546
+ const bunExePath = path16.join(globalNodeModules, "bun", "bin", "bun.exe");
103547
+ if (fs16.existsSync(bunExePath)) {
103477
103548
  return bunExePath;
103478
103549
  }
103479
103550
  } catch (error3) {}
@@ -103484,9 +103555,9 @@ var getBunPath = () => {
103484
103555
  return bunPath;
103485
103556
  }
103486
103557
  if (bunPath) {
103487
- const bunDir = path15.dirname(bunPath);
103488
- const bunExePath = path15.join(bunDir, "node_modules", "bun", "bin", "bun.exe");
103489
- if (fs15.existsSync(bunExePath)) {
103558
+ const bunDir = path16.dirname(bunPath);
103559
+ const bunExePath = path16.join(bunDir, "node_modules", "bun", "bin", "bun.exe");
103560
+ if (fs16.existsSync(bunExePath)) {
103490
103561
  return bunExePath;
103491
103562
  }
103492
103563
  }
@@ -103494,7 +103565,7 @@ var getBunPath = () => {
103494
103565
  } else {
103495
103566
  try {
103496
103567
  const bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
103497
- if (bunPath && fs15.existsSync(bunPath)) {
103568
+ if (bunPath && fs16.existsSync(bunPath)) {
103498
103569
  return bunPath;
103499
103570
  }
103500
103571
  } catch (error3) {}
@@ -103506,7 +103577,7 @@ var getBunPath = () => {
103506
103577
  "C:\\Bun\\bun.exe"
103507
103578
  ];
103508
103579
  for (const p of commonPaths) {
103509
- if (fs15.existsSync(p)) {
103580
+ if (fs16.existsSync(p)) {
103510
103581
  return p;
103511
103582
  }
103512
103583
  }
@@ -103922,14 +103993,14 @@ class KeyStore {
103922
103993
  }
103923
103994
  }
103924
103995
  function createKey(key) {
103925
- let path16 = null;
103996
+ let path17 = null;
103926
103997
  let id = null;
103927
103998
  let src = null;
103928
103999
  let weight = 1;
103929
104000
  let getFn = null;
103930
104001
  if (isString(key) || isArray3(key)) {
103931
104002
  src = key;
103932
- path16 = createKeyPath(key);
104003
+ path17 = createKeyPath(key);
103933
104004
  id = createKeyId(key);
103934
104005
  } else {
103935
104006
  if (!hasOwn.call(key, "name")) {
@@ -103943,11 +104014,11 @@ function createKey(key) {
103943
104014
  throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
103944
104015
  }
103945
104016
  }
103946
- path16 = createKeyPath(name);
104017
+ path17 = createKeyPath(name);
103947
104018
  id = createKeyId(name);
103948
104019
  getFn = key.getFn;
103949
104020
  }
103950
- return { path: path16, id, weight, src, getFn };
104021
+ return { path: path17, id, weight, src, getFn };
103951
104022
  }
103952
104023
  function createKeyPath(key) {
103953
104024
  return isArray3(key) ? key : key.split(".");
@@ -103955,34 +104026,34 @@ function createKeyPath(key) {
103955
104026
  function createKeyId(key) {
103956
104027
  return isArray3(key) ? key.join(".") : key;
103957
104028
  }
103958
- function get(obj, path16) {
104029
+ function get(obj, path17) {
103959
104030
  let list4 = [];
103960
104031
  let arr = false;
103961
- const deepGet = (obj2, path17, index) => {
104032
+ const deepGet = (obj2, path18, index) => {
103962
104033
  if (!isDefined(obj2)) {
103963
104034
  return;
103964
104035
  }
103965
- if (!path17[index]) {
104036
+ if (!path18[index]) {
103966
104037
  list4.push(obj2);
103967
104038
  } else {
103968
- let key = path17[index];
104039
+ let key = path18[index];
103969
104040
  const value = obj2[key];
103970
104041
  if (!isDefined(value)) {
103971
104042
  return;
103972
104043
  }
103973
- if (index === path17.length - 1 && (isString(value) || isNumber2(value) || isBoolean(value))) {
104044
+ if (index === path18.length - 1 && (isString(value) || isNumber2(value) || isBoolean(value))) {
103974
104045
  list4.push(toString(value));
103975
104046
  } else if (isArray3(value)) {
103976
104047
  arr = true;
103977
104048
  for (let i = 0, len = value.length;i < len; i += 1) {
103978
- deepGet(value[i], path17, index + 1);
104049
+ deepGet(value[i], path18, index + 1);
103979
104050
  }
103980
- } else if (path17.length) {
103981
- deepGet(value, path17, index + 1);
104051
+ } else if (path18.length) {
104052
+ deepGet(value, path18, index + 1);
103982
104053
  }
103983
104054
  }
103984
104055
  };
103985
- deepGet(obj, isString(path16) ? path16.split(".") : path16, 0);
104056
+ deepGet(obj, isString(path17) ? path17.split(".") : path17, 0);
103986
104057
  return arr ? list4 : list4[0];
103987
104058
  }
103988
104059
  var MatchOptions = {
@@ -105514,12 +105585,12 @@ var runServer = async (port = 51515, listenPath = "127.0.0.1") => {
105514
105585
  port: _port
105515
105586
  };
105516
105587
  };
105517
- 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) => {
105518
105589
  if (options.daemon) {
105519
105590
  const [_interpreter, execPath] = process.argv;
105520
105591
  const name = options.name;
105521
105592
  const port = options.port;
105522
- const runPath = path16.resolve(execPath);
105593
+ const runPath = path17.resolve(execPath);
105523
105594
  const escapePath = (p) => {
105524
105595
  let normalized = p.replace(/\\/g, "/");
105525
105596
  return normalized.includes(" ") ? `"${normalized}"` : normalized;
@@ -105533,6 +105604,9 @@ program.description("启动服务").option("-d, --daemon", "是否以守护进
105533
105604
  if (port) {
105534
105605
  pm2Command += ` -p ${port}`;
105535
105606
  }
105607
+ if (options.root) {
105608
+ pm2Command += ` --root ${options.root}`;
105609
+ }
105536
105610
  console.log(source_default.gray("执行命令:"), pm2Command);
105537
105611
  console.log(source_default.gray("脚本路径:"), runPath);
105538
105612
  try {