Brought escape-string-regexp source to next (#6979)

* Brought escape-string-regexp source to next

* Added Copyright comment
This commit is contained in:
Luis Fernando Alvarez D 2019-04-09 14:06:55 -05:00 committed by Joe Haddad
parent 72a31cb438
commit ae5eeb39f4
3 changed files with 15 additions and 9 deletions

View file

@ -1,8 +1,21 @@
import { Compiler, Plugin } from 'webpack'
import { createHash } from 'crypto'
import escapeRegex from 'escape-string-regexp'
import path from 'path'
/**
* From escape-string-regexp: https://github.com/sindresorhus/escape-string-regexp
* brought here to reduce the bundle size
* MIT License
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
*/
const matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
const escapeRegex = (str: string) => {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str.replace(matchOperatorsRe, '\\$&');
};
function getRawModuleIdentifier(m: any, dir: string) {
// webpack impl:
// new RawModule(

View file

@ -60,7 +60,6 @@
"babel-plugin-transform-async-to-promises": "0.8.9",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"chalk": "2.4.2",
"escape-string-regexp": "1.0.5",
"find-cache-dir": "2.0.0",
"find-up": "2.1.0",
"fresh": "0.5.2",
@ -104,7 +103,6 @@
"@types/babel__template": "7.0.1",
"@types/babel__traverse": "7.0.3",
"@types/cross-spawn": "6.0.0",
"@types/escape-string-regexp": "1.0.0",
"@types/etag": "1.8.0",
"@types/fresh": "0.5.0",
"@types/loader-utils": "1.1.3",

View file

@ -1571,11 +1571,6 @@
dependencies:
"@types/node" "*"
"@types/escape-string-regexp@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/escape-string-regexp/-/escape-string-regexp-1.0.0.tgz#052d16d87db583b72daceae4eaabddb66954424c"
integrity sha512-KAruqgk9/340M4MYYasdBET+lyYN8KMXUuRKWO72f4SbmIMMFp9nnJiXUkJS0HC2SFe4x0R/fLozXIzqoUfSjA==
"@types/etag@1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@types/etag/-/etag-1.8.0.tgz#37f0b1f3ea46da7ae319bbedb607e375b4c99f7e"
@ -4785,7 +4780,7 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=