Skip to content

Commit

Permalink
fix(replace): add missing types for objectGuards option (#1818)
Browse files Browse the repository at this point in the history
  • Loading branch information
dasa authored Dec 15, 2024
1 parent 97e17ce commit 9c0efb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/replace/test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config: RollupOptions = {
include: 'config.js',
exclude: 'node_modules/**',
delimiters: ['<@', '@>'],
objectGuards: true,
preventAssignment: true,
VERSION: '1.0.0',
ENVIRONMENT: JSON.stringify('development'),
Expand Down
7 changes: 7 additions & 0 deletions packages/replace/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface RollupReplaceOptions {
| Replacement
| RollupReplaceOptions['include']
| RollupReplaceOptions['values']
| RollupReplaceOptions['objectGuards']
| RollupReplaceOptions['preventAssignment'];

/**
Expand All @@ -33,6 +34,12 @@ export interface RollupReplaceOptions {
* of `foo`, supply delimiters
*/
delimiters?: [string, string];
/**
* When replacing dot-separated object properties like `process.env.NODE_ENV`,
* will also replace `typeof process` object guard checks against the objects
* with the string `"object"`.
*/
objectGuards?: boolean;
/**
* Prevents replacing strings where they are followed by a single equals
* sign.
Expand Down

0 comments on commit 9c0efb0

Please sign in to comment.