Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
20
node_modules/gulp-replace/LICENSE
generated
vendored
Normal file
20
node_modules/gulp-replace/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Larry Davis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
148
node_modules/gulp-replace/README-gulp3.md
generated
vendored
Normal file
148
node_modules/gulp-replace/README-gulp3.md
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
|||
# gulp-replace [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url]
|
||||
|
||||
> A string replace plugin for gulp
|
||||
|
||||
## Usage
|
||||
|
||||
First, install `gulp-replace` as a development dependency:
|
||||
|
||||
```shell
|
||||
npm install --save-dev gulp-replace
|
||||
# or
|
||||
yarn add --dev gulp-replace
|
||||
```
|
||||
|
||||
Then, add it to your `gulpfile.js`:
|
||||
|
||||
### Simple string replace
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
.pipe(replace('bar', 'foo'))
|
||||
.pipe(gulp.dest('build/'));
|
||||
});
|
||||
```
|
||||
|
||||
### Simple regex replace
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
// See https://mdn.io/string.replace#Specifying_a_string_as_a_parameter
|
||||
.pipe(replace(/foo(.{3})/g, '$1foo'))
|
||||
.pipe(gulp.dest('build/'));
|
||||
});
|
||||
```
|
||||
|
||||
### String replace with function callback
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
.pipe(replace('foo', function(match) {
|
||||
// Replaces instances of "foo" with "oof"
|
||||
return match.reverse();
|
||||
}))
|
||||
.pipe(gulp.dest('build/'));
|
||||
});
|
||||
```
|
||||
|
||||
### Regex replace with function callback
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
.pipe(replace(/foo(.{3})/g, function(match, p1, offset, string) {
|
||||
// Replace foobaz with barbaz and log a ton of information
|
||||
// See https://mdn.io/string.replace#Specifying_a_function_as_a_parameter
|
||||
console.log('Found ' + match + ' with param ' + p1 + ' at ' + offset + ' inside of ' + string);
|
||||
return 'bar' + p1;
|
||||
}))
|
||||
.pipe(gulp.dest('build/'));
|
||||
});
|
||||
```
|
||||
|
||||
### Function callback with file object
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
.pipe(replace('filename', function() {
|
||||
// Replaces instances of "filename" with "file.txt"
|
||||
// this.file is also available for regex replace
|
||||
// See https://github.com/gulpjs/vinyl#instance-properties for details on available properties
|
||||
return this.file.relative;
|
||||
}))
|
||||
.pipe(gulp.dest('build/'));
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
`gulp-replace` can be called with a string or regex.
|
||||
|
||||
### replace(string, replacement[, options])
|
||||
|
||||
#### string
|
||||
|
||||
Type: `String`
|
||||
|
||||
The string to search for.
|
||||
|
||||
#### replacement
|
||||
|
||||
Type: `String` or `Function`
|
||||
|
||||
The replacement string or function. 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](https://github.com/gulpjs/vinyl#instance-properties) for the file being processed.
|
||||
|
||||
### replace(regex, replacement[, options])
|
||||
|
||||
#### regex
|
||||
|
||||
Type: `RegExp`
|
||||
|
||||
The regex pattern to search for. See the [MDN documentation for RegExp] for details.
|
||||
|
||||
#### replacement
|
||||
|
||||
Type: `String` or `Function`
|
||||
|
||||
The replacement string or function. See the [MDN documentation for String.replace] for details on special replacement string patterns and arguments to the replacement function.
|
||||
|
||||
The value of `this.file` will be equal to the [vinyl instance](https://github.com/gulpjs/vinyl#instance-properties) for the file being processed.
|
||||
|
||||
### gulp-replace options
|
||||
|
||||
An optional third argument, `options`, can be passed.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### options.skipBinary
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
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`.
|
||||
|
||||
[MDN documentation for RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
||||
[MDN documentation for String.replace]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
|
||||
|
||||
[travis-url]: https://travis-ci.org/lazd/gulp-replace
|
||||
[travis-image]: https://secure.travis-ci.org/lazd/gulp-replace.svg?branch=master
|
||||
[npm-url]: https://npmjs.org/package/gulp-replace
|
||||
[npm-image]: https://badge.fury.io/js/gulp-replace.svg
|
164
node_modules/gulp-replace/README.md
generated
vendored
Normal file
164
node_modules/gulp-replace/README.md
generated
vendored
Normal file
|
@ -0,0 +1,164 @@
|
|||
# gulp-replace [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url]
|
||||
|
||||
> A string replace plugin for gulp
|
||||
|
||||
[Read me for gulp 3](README-gulp3.md)
|
||||
|
||||
## Usage
|
||||
|
||||
First, install `gulp-replace` as a development dependency:
|
||||
|
||||
```shell
|
||||
npm install --save-dev gulp-replace
|
||||
# or
|
||||
yarn add --dev gulp-replace
|
||||
```
|
||||
|
||||
Then, add it to your `gulpfile.js`:
|
||||
|
||||
### Simple string replace
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
const { src, dest } = require('gulp');
|
||||
|
||||
function replaceTemplate() {
|
||||
return src(['file.txt'])
|
||||
.pipe(replace('bar', 'foo'))
|
||||
.pipe(dest('build/'));
|
||||
};
|
||||
|
||||
exports.replaceTemplate = replaceTemplate;
|
||||
```
|
||||
|
||||
### Simple regex replace
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
const { src, dest } = require('gulp');
|
||||
|
||||
function replaceTemplate() {
|
||||
return src(['file.txt'])
|
||||
// See https://mdn.io/string.replace#Specifying_a_string_as_a_parameter
|
||||
.pipe(replace(/foo(.{3})/g, '$1foo'))
|
||||
.pipe(dest('build/'));
|
||||
};
|
||||
|
||||
exports.replaceTemplate = replaceTemplate;
|
||||
```
|
||||
|
||||
### String replace with function callback
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
const { src, dest } = require('gulp');
|
||||
|
||||
function replaceTemplate() {
|
||||
return src(['file.txt'])
|
||||
.pipe(replace('foo', function handleReplace(match){ return match.reverse(); })
|
||||
.pipe(dest('build/'))
|
||||
};
|
||||
|
||||
exports.replaceTemplate = replaceTemplate;
|
||||
```
|
||||
|
||||
### Regex replace with function callback
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
const { src, dest } = require('gulp');
|
||||
|
||||
function replaceTemplate() {
|
||||
return src(['file.txt'])
|
||||
.pipe(replace(/foo(.{3})/g, function handleReplace(match, p1, offset, string) {
|
||||
// Replace foobaz with barbaz and log a ton of information
|
||||
// See https://mdn.io/string.replace#Specifying_a_function_as_a_parameter
|
||||
console.log('Found ' + match + ' with param ' + p1 + ' at ' + offset + ' inside of ' + string);
|
||||
return 'bar' + p1;
|
||||
}))
|
||||
.pipe(dest('build/'));
|
||||
};
|
||||
|
||||
exports.replaceTemplate = replaceTemplate;
|
||||
```
|
||||
|
||||
### Function callback with file object
|
||||
|
||||
```javascript
|
||||
const replace = require('gulp-replace');
|
||||
const { src, dest } = require('gulp');
|
||||
|
||||
function replaceTemplate() {
|
||||
return src(['file.txt'])
|
||||
.pipe(replace('filename', function handleReplace() {
|
||||
// Replaces instances of "filename" with "file.txt"
|
||||
// this.file is also available for regex replace
|
||||
// See https://github.com/gulpjs/vinyl#instance-properties for details on available properties
|
||||
return this.file.relative;
|
||||
}))
|
||||
.pipe(dest('build/'));
|
||||
};
|
||||
|
||||
exports.replaceTemplate = replaceTemplate;
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
`gulp-replace` can be called with a string or regex.
|
||||
|
||||
### replace(string, replacement[, options])
|
||||
|
||||
> CAUTION: `replacement` could **NOT be arrow function**, because arrow function could not bind `this`
|
||||
|
||||
#### string
|
||||
|
||||
Type: `String`
|
||||
|
||||
The string to search for.
|
||||
|
||||
#### replacement
|
||||
|
||||
Type: `String` or `Function`
|
||||
|
||||
The replacement string or function. 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](https://github.com/gulpjs/vinyl#instance-properties) for the file being processed.
|
||||
|
||||
### replace(regex, replacement[, options])
|
||||
|
||||
#### regex
|
||||
|
||||
Type: `RegExp`
|
||||
|
||||
The regex pattern to search for. See the [MDN documentation for RegExp] for details.
|
||||
|
||||
#### replacement
|
||||
|
||||
Type: `String` or `Function`
|
||||
|
||||
The replacement string or function. See the [MDN documentation for String.replace] for details on special replacement string patterns and arguments to the replacement function.
|
||||
|
||||
The value of `this.file` will be equal to the [vinyl instance](https://github.com/gulpjs/vinyl#instance-properties) for the file being processed.
|
||||
|
||||
### gulp-replace options
|
||||
|
||||
An optional third argument, `options`, can be passed.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### options.skipBinary
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
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`.
|
||||
|
||||
[MDN documentation for RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
||||
[MDN documentation for String.replace]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
|
||||
|
||||
[travis-url]: https://travis-ci.org/lazd/gulp-replace
|
||||
[travis-image]: https://secure.travis-ci.org/lazd/gulp-replace.svg?branch=master
|
||||
[npm-url]: https://npmjs.org/package/gulp-replace
|
||||
[npm-image]: https://badge.fury.io/js/gulp-replace.svg
|
53
node_modules/gulp-replace/index.d.ts
generated
vendored
Normal file
53
node_modules/gulp-replace/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
/// <reference types="node" />
|
||||
import File = require("vinyl");
|
||||
|
||||
/**
|
||||
* 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 `RegExp` to search for.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* 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`.
|
||||
*/
|
||||
declare function replace(
|
||||
search: string | RegExp,
|
||||
replacement: string | Replacer,
|
||||
options?: Options
|
||||
): NodeJS.ReadWriteStream;
|
||||
|
||||
export = replace;
|
91
node_modules/gulp-replace/index.js
generated
vendored
Normal file
91
node_modules/gulp-replace/index.js
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
'use strict';
|
||||
|
||||
const Transform = require('stream').Transform;
|
||||
const rs = require('replacestream');
|
||||
const istextorbinary = require('istextorbinary');
|
||||
|
||||
const defaultOptions = {
|
||||
skipBinary: true
|
||||
}
|
||||
|
||||
module.exports = function(search, _replacement, options = {}) {
|
||||
// merge options
|
||||
options = {
|
||||
...defaultOptions,
|
||||
...options
|
||||
}
|
||||
|
||||
return new Transform({
|
||||
objectMode: true,
|
||||
/**
|
||||
* transformation
|
||||
* @param {import("vinyl")} file
|
||||
* @param {BufferEncoding} enc
|
||||
* @param {(error?: Error | null, data?: any) => void} callback
|
||||
*/
|
||||
transform(file, enc, callback) {
|
||||
if (file.isNull()) {
|
||||
return callback(null, file);
|
||||
}
|
||||
|
||||
let replacement = _replacement;
|
||||
if (typeof _replacement === 'function') {
|
||||
// Pass the vinyl file object as this.file
|
||||
replacement = _replacement.bind({ file: file });
|
||||
}
|
||||
|
||||
function doReplace() {
|
||||
if (file.isStream()) {
|
||||
file.contents = file.contents.pipe(rs(search, replacement));
|
||||
return callback(null, file);
|
||||
}
|
||||
|
||||
if (file.isBuffer()) {
|
||||
if (search instanceof RegExp) {
|
||||
file.contents = Buffer.from(String(file.contents).replace(search, replacement));
|
||||
} else {
|
||||
const chunks = String(file.contents).split(search);
|
||||
|
||||
let result;
|
||||
if (typeof replacement === 'function') {
|
||||
// Start with the first chunk already in the result
|
||||
// Replacements will be added thereafter
|
||||
// This is done to avoid checking the value of i in the loop
|
||||
result = [ chunks[0] ];
|
||||
|
||||
// The replacement function should be called once for each match
|
||||
for (let i = 1; i < chunks.length; i++) {
|
||||
// Add the replacement value
|
||||
result.push(replacement(search));
|
||||
|
||||
// Add the next chunk
|
||||
result.push(chunks[i]);
|
||||
}
|
||||
|
||||
result = result.join('');
|
||||
}
|
||||
else {
|
||||
result = chunks.join(replacement);
|
||||
}
|
||||
|
||||
file.contents = Buffer.from(result);
|
||||
}
|
||||
return callback(null, file);
|
||||
}
|
||||
|
||||
callback(null, file);
|
||||
}
|
||||
|
||||
if (options.skipBinary) {
|
||||
if (!istextorbinary.isText(file.path, file.contents)) {
|
||||
callback(null, file);
|
||||
} else {
|
||||
doReplace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
doReplace();
|
||||
}
|
||||
});
|
||||
};
|
42
node_modules/gulp-replace/package.json
generated
vendored
Normal file
42
node_modules/gulp-replace/package.json
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "gulp-replace",
|
||||
"version": "1.1.3",
|
||||
"description": "A string replace plugin for gulp",
|
||||
"dependencies": {
|
||||
"@types/node": "^14.14.41",
|
||||
"@types/vinyl": "^2.0.4",
|
||||
"istextorbinary": "^3.0.0",
|
||||
"replacestream": "^4.0.3",
|
||||
"yargs-parser": ">=5.0.0-security.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concat-stream": "^2.0.0",
|
||||
"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"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/lazd/gulp-replace.git"
|
||||
},
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"replace"
|
||||
],
|
||||
"author": "Larry Davis <lazdnet@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/lazd/gulp-replace/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue