dowwntime 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env bun
2
2
  import { createRequire } from "module";
3
3
  import { debug } from "util";
4
4
  import http from "http";
@@ -27808,10 +27808,10 @@ var require_axios = /* @__PURE__ */ __commonJS({ "node_modules/axios/dist/node/a
27808
27808
  Request: globalObject.Request,
27809
27809
  Response: globalObject.Response
27810
27810
  }, env);
27811
- const { fetch: envFetch, Request, Response } = env;
27811
+ const { fetch: envFetch, Request, Response: Response$1 } = env;
27812
27812
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
27813
27813
  const isRequestSupported = isFunction(Request);
27814
- const isResponseSupported = isFunction(Response);
27814
+ const isResponseSupported = isFunction(Response$1);
27815
27815
  if (!isFetchSupported) return false;
27816
27816
  const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
27817
27817
  const encodeText = isFetchSupported && (typeof TextEncoder$1 === "function" ? ((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
@@ -27829,7 +27829,7 @@ var require_axios = /* @__PURE__ */ __commonJS({ "node_modules/axios/dist/node/a
27829
27829
  if (request.body != null) request.body.cancel();
27830
27830
  return duplexAccessed && !hasContentType;
27831
27831
  });
27832
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
27832
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response$1("").body));
27833
27833
  const resolvers = { stream: supportsResponseStream && ((res) => res.body) };
27834
27834
  isFetchSupported && [
27835
27835
  "text",
@@ -27934,7 +27934,7 @@ var require_axios = /* @__PURE__ */ __commonJS({ "node_modules/axios/dist/node/a
27934
27934
  }
27935
27935
  onProgress && onProgress(loadedBytes);
27936
27936
  };
27937
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
27937
+ response = new Response$1(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
27938
27938
  flush && flush();
27939
27939
  unsubscribe && unsubscribe();
27940
27940
  }), options);
@@ -27978,10 +27978,10 @@ var require_axios = /* @__PURE__ */ __commonJS({ "node_modules/axios/dist/node/a
27978
27978
  const seedCache = /* @__PURE__ */ new Map();
27979
27979
  const getFetch = (config$1) => {
27980
27980
  let env = config$1 && config$1.env || {};
27981
- const { fetch: fetch$1, Request, Response } = env;
27981
+ const { fetch: fetch$1, Request, Response: Response$1 } = env;
27982
27982
  const seeds = [
27983
27983
  Request,
27984
- Response,
27984
+ Response$1,
27985
27985
  fetch$1
27986
27986
  ];
27987
27987
  let i = seeds.length, seed, target, map$6 = seedCache;
@@ -28863,7 +28863,7 @@ const run = async (options) => {
28863
28863
  if (!pathItem) continue;
28864
28864
  if (!pathItem.get) continue;
28865
28865
  const url$2 = new URL(path$5, baseUrl);
28866
- let _path = path$5;
28866
+ let _path$1 = path$5;
28867
28867
  if ("200" in (pathItem.get?.responses ?? {}) && "text/event-stream" in (pathItem.get.responses?.["200"]?.content ?? {})) continue;
28868
28868
  for (const param of pathItem.get.parameters || []) {
28869
28869
  let exampleValue = options.getExampleValue?.(param.name, path$5) ?? param.example ?? param.examples?.[0] ?? param.schema?.example ?? param.schema?.examples?.[0];
@@ -28881,8 +28881,8 @@ const run = async (options) => {
28881
28881
  continue;
28882
28882
  }
28883
28883
  const placeholder = `{${param.name}}`;
28884
- _path = _path.replace(placeholder, exampleValue);
28885
- url$2.pathname = _path;
28884
+ _path$1 = _path$1.replace(placeholder, exampleValue);
28885
+ url$2.pathname = _path$1;
28886
28886
  }
28887
28887
  if (!exampleValue) continue;
28888
28888
  if (param.in === "query") url$2.searchParams.set(param.name, exampleValue);
@@ -32031,7 +32031,24 @@ const { program, createCommand, createArgument, createOption, CommanderError, In
32031
32031
  program.option("-c, --config [string]", "Path to config file", "dowwntime.config.ts");
32032
32032
  program.parse();
32033
32033
  const configPath = program.opts().config;
32034
- const config = (await import(path.resolve(process.cwd(), configPath))).default;
32034
+ const _path = path.resolve(process.cwd(), configPath);
32035
+ let configModule;
32036
+ try {
32037
+ configModule = await import(_path);
32038
+ } catch (e$1) {
32039
+ if (e$1.code !== "ERR_UNKNOWN_FILE_EXTENSION" || !_path.endsWith(".ts")) throw e$1;
32040
+ const proc = Bun.spawn([
32041
+ "bun",
32042
+ "-e",
32043
+ `import c from ${JSON.stringify(_path)}; process.stdout.write(JSON.stringify(c.default ?? c))`
32044
+ ], {
32045
+ stdout: "pipe",
32046
+ stderr: "inherit"
32047
+ });
32048
+ await proc.exited;
32049
+ configModule = { default: JSON.parse(await new Response(proc.stdout).text()) };
32050
+ }
32051
+ const config = configModule.default;
32035
32052
  if (!config || typeof config !== "object") throw new Error(`Invalid config file: no or wrong default export found, was ${typeof config}`);
32036
32053
  await run(defineConfig(config));
32037
32054