@orval/core 8.0.0-rc.6 → 8.0.0

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/index.d.mts CHANGED
@@ -104,6 +104,7 @@ type NormalizedMutator = {
104
104
  name?: string;
105
105
  default: boolean;
106
106
  alias?: Record<string, string>;
107
+ external?: string[];
107
108
  extension?: string;
108
109
  };
109
110
  type NormalizedOperationOptions = {
@@ -301,6 +302,7 @@ type MutatorObject = {
301
302
  name?: string;
302
303
  default?: boolean;
303
304
  alias?: Record<string, string>;
305
+ external?: string[];
304
306
  extension?: string;
305
307
  };
306
308
  type Mutator = string | MutatorObject;
package/dist/index.mjs CHANGED
@@ -2687,10 +2687,10 @@ function generateModelsInline(obj) {
2687
2687
  //#endregion
2688
2688
  //#region src/generators/mutator-info.ts
2689
2689
  async function getMutatorInfo(filePath, options) {
2690
- const { root = process.cwd(), namedExport = "default", alias, tsconfig } = options ?? {};
2691
- return parseFile(await bundleFile(root, path.resolve(filePath), alias, tsconfig?.compilerOptions), namedExport, getEcmaVersion(tsconfig?.compilerOptions?.target));
2690
+ const { root = process.cwd(), namedExport = "default", alias, external, tsconfig } = options ?? {};
2691
+ return parseFile(await bundleFile(root, path.resolve(filePath), alias, external, tsconfig?.compilerOptions), namedExport, getEcmaVersion(tsconfig?.compilerOptions?.target));
2692
2692
  }
2693
- async function bundleFile(root, fileName, alias, compilerOptions) {
2693
+ async function bundleFile(root, fileName, alias, external, compilerOptions) {
2694
2694
  const { text } = (await build({
2695
2695
  absWorkingDir: root,
2696
2696
  entryPoints: [fileName],
@@ -2707,7 +2707,7 @@ async function bundleFile(root, fileName, alias, compilerOptions) {
2707
2707
  treeShaking: false,
2708
2708
  keepNames: false,
2709
2709
  alias,
2710
- external: ["*"]
2710
+ external: external || ["*"]
2711
2711
  })).outputFiles[0];
2712
2712
  return text;
2713
2713
  }
@@ -2807,6 +2807,7 @@ async function generateMutator({ output, mutator, name, workspace, tsconfig }) {
2807
2807
  root: path.resolve(workspace),
2808
2808
  namedExport: mutatorInfoName,
2809
2809
  alias: mutator.alias,
2810
+ external: mutator.external,
2810
2811
  tsconfig
2811
2812
  });
2812
2813
  if (!mutatorInfo) throw new Error(chalk.red(`Your mutator file doesn't have the ${mutatorInfoName} exported function`));