keq 2.8.13 → 2.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/esm/src/util/create-response-proxy.js +2 -2
  3. package/dist/esm/src/util/fork.js +3 -3
  4. package/dist/umd/src/util/create-response-proxy.js +2 -2
  5. package/dist/umd/src/util/fork.js +3 -3
  6. package/package.json +1 -1
  7. package/packages/cache/.turbo/turbo-build.log +1 -6
  8. package/packages/cache/dist/cache-entry/cache-entry.d.ts +1 -1
  9. package/packages/cache/dist/cache-entry/cache-entry.d.ts.map +1 -1
  10. package/packages/cache/dist/cache.d.ts +7 -1
  11. package/packages/cache/dist/cache.d.ts.map +1 -1
  12. package/packages/cache/dist/index.js +28 -8
  13. package/packages/cache/dist/index.js.map +1 -1
  14. package/packages/cache/dist/index.mjs +28 -8
  15. package/packages/cache/dist/index.mjs.map +1 -1
  16. package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts.map +1 -1
  17. package/packages/cache/dist/types/request-cache-options.d.ts +11 -0
  18. package/packages/cache/dist/types/request-cache-options.d.ts.map +1 -1
  19. package/packages/cli/.turbo/turbo-build.log +1 -17
  20. package/packages/cli/dist/cli.cjs +132 -86
  21. package/packages/cli/dist/cli.cjs.map +1 -1
  22. package/packages/cli/dist/cli.js +132 -86
  23. package/packages/cli/dist/cli.js.map +1 -1
  24. package/packages/cli/dist/compiler/compiler.d.ts.map +1 -1
  25. package/packages/cli/dist/compiler/tasks/setup/index.d.ts.map +1 -1
  26. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts +0 -1
  27. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts.map +1 -1
  28. package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts +3 -0
  29. package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts.map +1 -0
  30. package/packages/cli/dist/compiler/types/compiler-context.d.ts +1 -1
  31. package/packages/cli/dist/compiler/types/compiler-context.d.ts.map +1 -1
  32. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts +2 -1
  33. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts.map +1 -1
  34. package/packages/cli/dist/define-config.d.ts +3 -0
  35. package/packages/cli/dist/define-config.d.ts.map +1 -0
  36. package/packages/cli/dist/index.cjs +137 -93
  37. package/packages/cli/dist/index.cjs.map +1 -1
  38. package/packages/cli/dist/index.d.ts +2 -2
  39. package/packages/cli/dist/index.d.ts.map +1 -1
  40. package/packages/cli/dist/index.js +136 -91
  41. package/packages/cli/dist/index.js.map +1 -1
  42. package/packages/cli/dist/models/module-definition.d.ts +3 -2
  43. package/packages/cli/dist/models/module-definition.d.ts.map +1 -1
  44. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts +2 -2
  45. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts.map +1 -1
  46. package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts.map +1 -1
  47. package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts.map +1 -1
  48. package/packages/cli/dist/plugins.cjs +25 -12
  49. package/packages/cli/dist/plugins.cjs.map +1 -1
  50. package/packages/cli/dist/plugins.js +25 -12
  51. package/packages/cli/dist/plugins.js.map +1 -1
  52. package/packages/cli/dist/types/address.d.ts +8 -0
  53. package/packages/cli/dist/types/address.d.ts.map +1 -0
  54. package/packages/cli/dist/types/index.d.ts +2 -1
  55. package/packages/cli/dist/types/index.d.ts.map +1 -1
  56. package/packages/cli/dist/types/runtime-config.d.ts +16 -7
  57. package/packages/cli/dist/types/runtime-config.d.ts.map +1 -1
  58. package/packages/cli/dist/utils/is-valid-url.d.ts +16 -0
  59. package/packages/cli/dist/utils/is-valid-url.d.ts.map +1 -0
  60. package/packages/exception/dist/catch-exception.d.ts +4 -0
  61. package/packages/exception/dist/catch-exception.d.ts.map +1 -0
  62. package/packages/exception/dist/index.d.ts +4 -0
  63. package/packages/exception/dist/index.d.ts.map +1 -0
  64. package/packages/exception/dist/throw-exception.d.ts +5 -0
  65. package/packages/exception/dist/throw-exception.d.ts.map +1 -0
  66. package/packages/exception/dist/validate-status-code.d.ts +3 -0
  67. package/packages/exception/dist/validate-status-code.d.ts.map +1 -0
  68. package/packages/headers/.turbo/turbo-build.log +6 -4
  69. package/packages/headers/dist/index.d.ts +42 -0
  70. package/packages/headers/dist/index.d.ts.map +1 -0
  71. package/packages/keq/.turbo/turbo-build.log +6 -6
  72. package/packages/keq/dist/context/execution-context.d.ts +2 -2
  73. package/packages/keq/dist/context/execution-context.d.ts.map +1 -1
  74. package/packages/keq/dist/context/middleware-context.d.ts +1 -1
  75. package/packages/keq/dist/context/middleware-context.d.ts.map +1 -1
  76. package/packages/keq/dist/context/orchestrator-context.d.ts +2 -2
  77. package/packages/keq/dist/context/orchestrator-context.d.ts.map +1 -1
  78. package/packages/keq/dist/context/shared-context.d.ts +7 -7
  79. package/packages/keq/dist/context/shared-context.d.ts.map +1 -1
  80. package/packages/keq/dist/context/types/keq-global.d.ts +7 -2
  81. package/packages/keq/dist/context/types/keq-global.d.ts.map +1 -1
  82. package/packages/keq/dist/index.d.ts +1 -1
  83. package/packages/keq/dist/index.d.ts.map +1 -1
  84. package/packages/keq/dist/index.js +73 -61
  85. package/packages/keq/dist/index.js.map +1 -1
  86. package/packages/keq/dist/index.mjs +73 -61
  87. package/packages/keq/dist/index.mjs.map +1 -1
  88. package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts.map +1 -1
  89. package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts.map +1 -1
  90. package/packages/keq/dist/orchestrator/orchestrator.d.ts +11 -6
  91. package/packages/keq/dist/orchestrator/orchestrator.d.ts.map +1 -1
  92. package/packages/keq/dist/request/core.d.ts +1 -7
  93. package/packages/keq/dist/request/core.d.ts.map +1 -1
  94. package/packages/keq/dist/request/request.d.ts.map +1 -1
  95. package/packages/keq/dist/request-init/request-init.d.ts +1 -1
  96. package/packages/keq/dist/request-init/request-init.d.ts.map +1 -1
  97. package/packages/nestjs/.turbo/turbo-build.log +1 -6
  98. package/packages/url/.turbo/turbo-build.log +4 -2
  99. package/packages/url/dist/index.d.ts +5 -0
  100. package/packages/url/dist/index.d.ts.map +1 -0
  101. package/packages/cli/dist/compiler/tasks/setup/utils/validate-modules.d.ts +0 -2
  102. package/packages/cli/dist/compiler/tasks/setup/utils/validate-modules.d.ts.map +0 -1
  103. package/packages/cli/dist/define-keq-config.d.ts +0 -3
  104. package/packages/cli/dist/define-keq-config.d.ts.map +0 -1
  105. package/packages/keq/node_modules/.bin/tsc +0 -21
  106. package/packages/keq/node_modules/.bin/tsserver +0 -21
  107. package/packages/nestjs/node_modules/.bin/tsc +0 -21
  108. package/packages/nestjs/node_modules/.bin/tsserver +0 -21
@@ -1,5 +1,5 @@
1
- export { defineKeqConfig } from './define-keq-config.js';
2
- export { RuntimeConfig, Plugin, } from './types/index.js';
1
+ export { defineConfig } from './define-config.js';
2
+ export type { RawConfig as Config, Plugin, } from './types/index.js';
3
3
  export { FileNamingStyle, QsArrayFormat, } from './constants/index.js';
4
4
  export { Compiler, CompilerContext, TaskWrapper, } from './compiler/index.js';
5
5
  export { Artifact, ModuleDefinition, SchemaDefinition, OperationDefinition, ApiDocumentV3_1, Asset, } from './models/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EACL,aAAa,EACb,MAAM,GACP,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,KAAK,GACN,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,YAAY,EACV,SAAS,IAAI,MAAM,EACnB,MAAM,GACP,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,KAAK,GACN,MAAM,mBAAmB,CAAA"}
@@ -1,11 +1,8 @@
1
- // src/define-keq-config.ts
2
- function defineKeqConfig(config) {
1
+ // src/define-config.ts
2
+ function defineConfig(config) {
3
3
  return config;
4
4
  }
5
5
 
6
- // src/types/runtime-config.ts
7
- import { Type } from "@sinclair/typebox";
8
-
9
6
  // src/constants/file-naming-style.ts
10
7
  var FileNamingStyle = /* @__PURE__ */ ((FileNamingStyle2) => {
11
8
  FileNamingStyle2["camelCase"] = "camelCase";
@@ -22,39 +19,6 @@ var FileNamingStyle = /* @__PURE__ */ ((FileNamingStyle2) => {
22
19
  return FileNamingStyle2;
23
20
  })(FileNamingStyle || {});
24
21
 
25
- // src/types/runtime-config.ts
26
- var RuntimeConfig = Type.Object({
27
- mode: Type.Optional(
28
- Type.Union([
29
- Type.Literal("micro-function"),
30
- Type.Literal("nestjs-module"),
31
- Type.Literal("none")
32
- ], { default: "micro-function" })
33
- ),
34
- /**
35
- * Whether to generate ES Module code
36
- *
37
- * If not specified, the module system will be inferred from the nearest package.json "type" field
38
- * or defaults to "cjs" if no package.json is found.
39
- */
40
- esm: Type.Optional(Type.Boolean({ default: false })),
41
- /**
42
- * Output directory for generated files
43
- */
44
- outdir: Type.String({ default: `${process.cwd()}/api` }),
45
- /**
46
- * File naming style for generated files
47
- */
48
- fileNamingStyle: Type.Enum(FileNamingStyle, { default: "snakeCase" /* snakeCase */ }),
49
- modules: Type.Record(Type.String(), Type.String()),
50
- debug: Type.Optional(Type.Boolean({ default: false })),
51
- /**
52
- * Whether to tolerate wrong openapi/swagger structure
53
- */
54
- tolerant: Type.Optional(Type.Boolean({ default: false })),
55
- plugins: Type.Optional(Type.Array(Type.Any(), { default: [] }))
56
- });
57
-
58
22
  // src/constants/qs-array-format.ts
59
23
  var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
60
24
  QsArrayFormat2["brackets"] = "brackets";
@@ -84,7 +48,6 @@ import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } fro
84
48
  // src/compiler/tasks/setup/index.ts
85
49
  import fs3 from "fs-extra";
86
50
  import path2 from "path";
87
- import { Value } from "@sinclair/typebox/value";
88
51
  import { cosmiconfig } from "cosmiconfig";
89
52
 
90
53
  // src/utils/ignore-matcher.ts
@@ -178,35 +141,6 @@ var IgnoreMatcher = class _IgnoreMatcher {
178
141
  }
179
142
  };
180
143
 
181
- // src/compiler/tasks/setup/utils/validate-modules.ts
182
- import * as R2 from "ramda";
183
- import validator from "validator";
184
- function validateModules(modules) {
185
- const keys2 = Object.keys(modules);
186
- for (const key of keys2) {
187
- if (!/^[A-Za-z_][A-Za-z0-9_$]*$/.test(key)) {
188
- throw new Error(`Module name "${key}" is not valid. It must start with a letter or underscore, and can only contain letters, numbers, and underscores.`);
189
- }
190
- }
191
- const keysGroupByLowerCase = R2.groupBy(R2.toLower, keys2);
192
- for (const groupKey in keysGroupByLowerCase) {
193
- const keys3 = keysGroupByLowerCase[groupKey] || [];
194
- if (keys3.length > 1) {
195
- throw new Error(`Module names ${keys3.map((name) => `"${name}"`).join(", ")} are case-insensitively duplicated.`);
196
- }
197
- }
198
- for (const key in modules) {
199
- const address = modules[key];
200
- if (validator.isURL(address, { require_host: true, require_protocol: true, protocols: ["http", "https"] })) {
201
- continue;
202
- }
203
- if (/^(\/|\.\/|\.\.\/)/.test(address)) {
204
- continue;
205
- }
206
- throw new Error(`Module address "${address}" of module "${key}" is not valid. It must be a URL or a local path.`);
207
- }
208
- }
209
-
210
144
  // src/compiler/tasks/setup/utils/find-nearest-package-json.ts
211
145
  import fs2 from "fs";
212
146
  import path from "path";
@@ -233,6 +167,111 @@ function getProjectModuleSystem(pkgInfo) {
233
167
  return "cjs";
234
168
  }
235
169
 
170
+ // src/compiler/tasks/setup/utils/parse-runtime-config.ts
171
+ import { Value } from "@sinclair/typebox/value";
172
+
173
+ // src/types/address.ts
174
+ import { Type } from "@sinclair/typebox";
175
+ var Address = Type.Object({
176
+ url: Type.String(),
177
+ headers: Type.Optional(Type.Record(Type.String(), Type.String(), { default: {} })),
178
+ encoding: Type.Optional(
179
+ Type.Union([
180
+ Type.Literal("utf8"),
181
+ Type.Literal("ascii")
182
+ ], { default: "utf8" })
183
+ )
184
+ });
185
+
186
+ // src/types/runtime-config.ts
187
+ import * as R2 from "ramda";
188
+ import { Type as Type2 } from "@sinclair/typebox";
189
+
190
+ // src/utils/is-valid-url.ts
191
+ var URL_REGEX = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/(?:[^\s@]+@)?[^\s/:?#]*(?::\d+)?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/;
192
+ function isValidURL(url) {
193
+ return URL_REGEX.test(url);
194
+ }
195
+
196
+ // src/types/runtime-config.ts
197
+ var Modules = Type2.Transform(
198
+ Type2.Record(
199
+ Type2.String(),
200
+ Type2.Union([Type2.String(), Address])
201
+ )
202
+ ).Decode((value) => {
203
+ const keys2 = Object.keys(value);
204
+ for (const key of keys2) {
205
+ if (!/^[A-Za-z_][A-Za-z0-9_$]*$/.test(key)) {
206
+ throw new Error(`Module name "${key}" is not valid. It must start with a letter or underscore, and can only contain letters, numbers, and underscores.`);
207
+ }
208
+ }
209
+ const keysGroupByLowerCase = R2.groupBy(R2.toLower, keys2);
210
+ for (const groupKey in keysGroupByLowerCase) {
211
+ const keys3 = keysGroupByLowerCase[groupKey] || [];
212
+ if (keys3.length > 1) {
213
+ throw new Error(`Module names ${keys3.map((name) => `"${name}"`).join(", ")} are case-insensitively duplicated.`);
214
+ }
215
+ }
216
+ for (const key in value) {
217
+ const url = typeof value[key] === "string" ? value[key] : value[key].url;
218
+ if (isValidURL(url)) continue;
219
+ throw new Error(`The ${JSON.stringify(url)} of module "${key}" is not a valid URL.`);
220
+ }
221
+ return R2.map(
222
+ (item) => typeof item !== "string" ? item : { url: item, headers: {}, encoding: "utf8" },
223
+ value
224
+ );
225
+ }).Encode((value) => value);
226
+ var RawConfig = Type2.Object({
227
+ mode: Type2.Optional(
228
+ Type2.Union([
229
+ Type2.Literal("micro-function"),
230
+ Type2.Literal("nestjs-module"),
231
+ Type2.Literal("none")
232
+ ], { default: "micro-function" })
233
+ ),
234
+ /**
235
+ * Whether to generate ES Module code
236
+ *
237
+ * If not specified, the module system will be inferred from the nearest package.json "type" field
238
+ * or defaults to "cjs" if no package.json is found.
239
+ */
240
+ esm: Type2.Optional(Type2.Boolean({ default: false })),
241
+ /**
242
+ * Output directory for generated files
243
+ */
244
+ outdir: Type2.String({ default: `${process.cwd()}/api` }),
245
+ /**
246
+ * File naming style for generated files
247
+ */
248
+ fileNamingStyle: Type2.Enum(FileNamingStyle, { default: "snakeCase" /* snakeCase */ }),
249
+ modules: Modules,
250
+ debug: Type2.Optional(Type2.Boolean({ default: false })),
251
+ /**
252
+ * Whether to tolerate wrong openapi/swagger structure
253
+ */
254
+ tolerant: Type2.Optional(Type2.Boolean({ default: false })),
255
+ plugins: Type2.Optional(Type2.Array(Type2.Unsafe(Type2.Any()), { default: [] }))
256
+ });
257
+
258
+ // src/compiler/tasks/setup/utils/parse-runtime-config.ts
259
+ function parseRuntimeConfig(data) {
260
+ try {
261
+ const originalPlugins = typeof data === "object" && data !== null && "plugins" in data ? data.plugins : void 0;
262
+ const parsed = Value.Parse(RawConfig, data);
263
+ if (originalPlugins !== void 0) {
264
+ parsed.plugins = originalPlugins;
265
+ }
266
+ return parsed;
267
+ } catch (error) {
268
+ if (error instanceof Error) {
269
+ error.message = `Invalid Config: ${error.message}`;
270
+ }
271
+ throw error;
272
+ }
273
+ }
274
+
236
275
  // src/compiler/tasks/setup/index.ts
237
276
  var explore = cosmiconfig("keq");
238
277
  function main(compiler, options) {
@@ -242,13 +281,7 @@ function main(compiler, options) {
242
281
  if (!result || "isEmpty" in result && result.isEmpty) {
243
282
  throw new Error("Cannot find config file.");
244
283
  }
245
- if (!Value.Check(RuntimeConfig, result.config)) {
246
- const errors = [...Value.Errors(RuntimeConfig, result.config)];
247
- const message = errors.map(({ path: path13, message: message2 }) => `${path13}: ${message2}`).join("\n");
248
- throw new Error(`Invalid Config: ${message}`);
249
- }
250
- const rc = Value.Default(RuntimeConfig, result.config);
251
- validateModules(rc.modules);
284
+ const rc = parseRuntimeConfig(result.config);
252
285
  if (options?.debug) {
253
286
  await fs3.ensureDir(".keq");
254
287
  rc.debug = true;
@@ -412,10 +445,14 @@ var ModuleDefinition = class _ModuleDefinition {
412
445
  address;
413
446
  constructor(name, address) {
414
447
  this.name = name;
415
- this.address = address;
448
+ if (typeof address === "string") {
449
+ this.address = { url: address, headers: {}, encoding: "utf8" };
450
+ } else {
451
+ this.address = address;
452
+ }
416
453
  }
417
454
  static unknown() {
418
- return new _ModuleDefinition("", "");
455
+ return new _ModuleDefinition("", { url: "", headers: {}, encoding: "utf8" });
419
456
  }
420
457
  };
421
458
 
@@ -888,10 +925,10 @@ function main2(compiler, options) {
888
925
  task2.skip(`(${moduleDefinition.name}) is ignored`);
889
926
  return;
890
927
  }
891
- task2.output = `Downloaded from ${moduleDefinition.address}`;
928
+ task2.output = `Downloaded from ${moduleDefinition.address.url}`;
892
929
  const content = await compiler.hooks.download.promise(moduleDefinition.address, moduleDefinition, task2);
893
930
  if (!content) {
894
- throw new Exception(moduleDefinition, `Cannot download document from ${moduleDefinition.address}`);
931
+ throw new Exception(moduleDefinition, `Cannot download document from ${moduleDefinition.address.url}`);
895
932
  }
896
933
  const spec = JSON.parse(content);
897
934
  const { valid, errors } = await validate(spec);
@@ -2537,24 +2574,25 @@ var GenerateNestjsModulePlugin = class _GenerateNestjsModulePlugin {
2537
2574
  import { fixSwagger } from "swagger-fix";
2538
2575
 
2539
2576
  // src/plugins/download-http-file/download-http-file.plugin.ts
2540
- import * as validUrl from "valid-url";
2541
2577
  var DownloadHttpFilePlugin = class _DownloadHttpFilePlugin {
2542
2578
  apply(compiler) {
2543
2579
  compiler.hooks.download.tapPromise(_DownloadHttpFilePlugin.name, async (address, task) => {
2544
- if (!validUrl.isUri(address)) return void 0;
2580
+ const { url } = address;
2581
+ if (!url.startsWith("http://") && !url.startsWith("https://")) return void 0;
2545
2582
  const content = await this.download(address);
2546
2583
  const spec = this.deserialize(content);
2547
2584
  return JSON.stringify(spec);
2548
2585
  });
2549
2586
  }
2550
2587
  async download(address) {
2588
+ const { url, headers } = address;
2551
2589
  try {
2552
- const res = await fetch(address);
2590
+ const res = await fetch(url, { headers });
2553
2591
  if (res.status >= 400) throw new Error(`failed with status code ${res.status}`);
2554
2592
  return await res.text();
2555
2593
  } catch (e) {
2556
2594
  if (e instanceof Error) {
2557
- e.message = `Unable get the openapi/swagger file from ${address}: ${e.message}`;
2595
+ e.message = `Unable get the openapi/swagger file from ${url}: ${e.message}`;
2558
2596
  }
2559
2597
  throw e;
2560
2598
  }
@@ -2570,17 +2608,21 @@ var DownloadHttpFilePlugin = class _DownloadHttpFilePlugin {
2570
2608
  import * as path12 from "path";
2571
2609
  import * as fs5 from "fs/promises";
2572
2610
  import * as yaml from "js-yaml";
2611
+ import { fileURLToPath } from "url";
2573
2612
  var DownloadLocalFilePlugin = class _DownloadLocalFilePlugin {
2574
2613
  apply(compiler) {
2575
2614
  compiler.hooks.download.tapPromise(_DownloadLocalFilePlugin.name, async (address, task) => {
2576
- if (!address.startsWith("./") && !address.startsWith("/") && !address.startsWith("../")) return void 0;
2577
- const fileExt = path12.extname(address);
2578
- const content = await fs5.readFile(address, "utf8");
2615
+ const { url, encoding } = address;
2616
+ if (!url.startsWith("file://")) return void 0;
2617
+ const filepath = fileURLToPath(url);
2618
+ const fileExt = path12.extname(filepath);
2619
+ const content = await fs5.readFile(filepath, encoding);
2620
+ const str = typeof content === "string" ? content : content.toString(encoding);
2579
2621
  if ([".yml", ".yaml"].includes(fileExt)) {
2580
- const value = yaml.load(content);
2622
+ const value = yaml.load(str);
2581
2623
  return JSON.stringify(OpenapiUtils.to3_1(value));
2582
2624
  } else if (fileExt === ".json") {
2583
- return JSON.stringify(OpenapiUtils.to3_1(JSON.parse(content)));
2625
+ return JSON.stringify(OpenapiUtils.to3_1(JSON.parse(str)));
2584
2626
  }
2585
2627
  });
2586
2628
  }
@@ -2618,7 +2660,11 @@ var ShakingPlugin = class _ShakingPlugin {
2618
2660
  sharkedSwagger,
2619
2661
  new ModuleDefinition(
2620
2662
  document.module.name,
2621
- `file://${document.module.name}.v3_1.sharked.json`
2663
+ {
2664
+ url: `memory://${document.module.name}.v3_1.sharked.json`,
2665
+ headers: {},
2666
+ encoding: "utf8"
2667
+ }
2622
2668
  )
2623
2669
  );
2624
2670
  }
@@ -2801,8 +2847,7 @@ export {
2801
2847
  ModuleDefinition,
2802
2848
  OperationDefinition,
2803
2849
  QsArrayFormat,
2804
- RuntimeConfig,
2805
2850
  SchemaDefinition,
2806
- defineKeqConfig
2851
+ defineConfig
2807
2852
  };
2808
2853
  //# sourceMappingURL=index.js.map