Skip to content

Commit

Permalink
feat: add internalDependencies option (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore authored Nov 9, 2022
1 parent c749725 commit 52f59a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { Options } from "./types";

const DEFAULT_OPTIONS = {
dts: true,
internalDependencies: [],
};

const sdkPlugin = (rawOptions?: Partial<Options>): (Plugin | null)[] => {
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/extendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export const extendConfigPlugin = (options: Options): Plugin => {
...Object.keys(options.packageJSON.optionalDependencies ?? {}),
...Object.keys(options.packageJSON.peerDependencies ?? {}),
].map((name) => new RegExp(`^${name}(?:\/.*)?$`)),
],
].filter(
(regexp) =>
!options.internalDependencies.some((internalDependency) =>
regexp.test(internalDependency),
),
),
output: {
preserveModules: true,
preserveModulesRoot: "src",
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export interface Options {
* @defaultValue `true`
*/
dts: boolean;

/**
* A list of dependencies to ignore from Rollup's `external` option.
*/
internalDependencies: string[];
}

/**
Expand Down

0 comments on commit 52f59a5

Please sign in to comment.