gulp-replace
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -0,23 +1,53 @@ | ||
/// <reference types="node" /> | ||
import type File = require("vinyl"); | ||
/** | ||
* replace | ||
* gulp-replace can be called with a string or regex. | ||
* Represents options for `gulp-replace`. | ||
*/ | ||
interface Options { | ||
/** | ||
* A value indicating whether binary files should be skipped. | ||
*/ | ||
skipBinary?: boolean | ||
} | ||
/** | ||
* The context of the replacer-function. | ||
*/ | ||
interface ReplacerContext { | ||
/** | ||
* The file being processed. | ||
*/ | ||
file: File | ||
} | ||
/** | ||
* Represents a method for replacing contents of a vinyl-file. | ||
*/ | ||
type Replacer = (this: ReplacerContext, match: string, ...args: any[]) => string; | ||
/** | ||
* Searches and replaces a portion of text using a `string` or a `RegExp`. | ||
* | ||
* @param search The string or regex to search for | ||
* @param search The `string` or `RegExp` to search for. | ||
* | ||
* @param _replacement The replacement string or function. | ||
* <p>If replacement is a function, it will be called once for each match and will be passed the string | ||
* @param replacement The replacement string or a function for generating a replacement. | ||
* | ||
* If `replacement` is a function, it will be called once for each match and will be passed the string | ||
* that is to be replaced. The value of `this.file` will be equal to the vinyl instance for the file | ||
* being processed.</p> | ||
* Read more at | ||
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter">String.prototype.replace() at MDN web docs</a> | ||
* being processed. | ||
* | ||
* @param options `options.skipBinary` will be equal to `true` by default. | ||
* <p>Skip binary files. This option is true by default. If | ||
* you want to replace content in binary files, you must explicitly set it to false</p> | ||
* Read more at [`String.prototype.replace()` at MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter"). | ||
* | ||
* @param options `options.skipBinary` will be equal to `true` by default. | ||
* | ||
* Skip binary files. This option is `true` by default. If | ||
* you want to replace content in binary files, you must explicitly set it to `false`. | ||
*/ | ||
export declare function replace( | ||
declare function replace( | ||
search: string | RegExp, | ||
_replacement: string | (() => string) | ((search: string, ...args: any[]) => string), | ||
options?: { skipBinary: boolean } | ||
): any; /* The type of return value should not be `any`, but I could not find the types definition of */ | ||
replacement: string | Replacer, | ||
options?: Options | ||
): NodeJS.ReadWriteStream; | ||
export = replace; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
const istextorbinary = require('istextorbinary'); | ||
const Vinyl = require('vinyl') | ||
const defaultOptions = { | ||
@@ -23,3 +23,3 @@ skipBinary: true | ||
* transformation | ||
* @param {Vinyl} file | ||
* @param {import("vinyl")} file | ||
* @param {BufferEncoding} enc | ||
@@ -26,0 +26,0 @@ * @param {(error?: Error | null, data?: any) => void} callback |
{ | ||
"name": "gulp-replace", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "A string replace plugin for gulp", | ||
"dependencies": { | ||
"@types/node": "^14.14.41", | ||
"@types/vinyl": "^2.0.4", | ||
"istextorbinary": "^3.0.0", | ||
@@ -13,3 +15,6 @@ "replacestream": "^4.0.3", | ||
"mocha": "^7.0.0", | ||
"npm-which": "^3.0.1", | ||
"should": "^13.2.3", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.4", | ||
"vinyl": "^2.2.1" | ||
@@ -16,0 +21,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14924
124
5
7
+ Added@types/node@^14.14.41
+ Added@types/vinyl@^2.0.4
+ Added@types/expect@1.20.4(transitive)
+ Added@types/node@14.18.63(transitive)
+ Added@types/vinyl@2.0.12(transitive)