Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replace): add missing types for objectGuards option #1818

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading