diff options
Diffstat (limited to 'node_modules/babel-plugin-transform-es2015-unicode-regex')
4 files changed, 105 insertions, 0 deletions
diff --git a/node_modules/babel-plugin-transform-es2015-unicode-regex/.npmignore b/node_modules/babel-plugin-transform-es2015-unicode-regex/.npmignore new file mode 100644 index 000000000..31852902b --- /dev/null +++ b/node_modules/babel-plugin-transform-es2015-unicode-regex/.npmignore @@ -0,0 +1,4 @@ +node_modules +*.log +src +test diff --git a/node_modules/babel-plugin-transform-es2015-unicode-regex/README.md b/node_modules/babel-plugin-transform-es2015-unicode-regex/README.md new file mode 100644 index 000000000..56b2035f6 --- /dev/null +++ b/node_modules/babel-plugin-transform-es2015-unicode-regex/README.md @@ -0,0 +1,51 @@ +# babel-plugin-transform-es2015-unicode-regex + +> Compile ES2015 unicode regex to ES5 + +## Example + +**In** + +```js +var string = "foo💩bar"; +var match = string.match(/foo(.)bar/u); +``` + +**Out** + +```js +var string = "foo💩bar"; +var match = string.match(/foo((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))bar/); +``` + +## Installation + +```sh +npm install --save-dev babel-plugin-transform-es2015-unicode-regex +``` + +## Usage + +### Via `.babelrc` (Recommended) + +**.babelrc** + +```json +{ + "plugins": ["transform-es2015-unicode-regex"] +} +``` + +### Via CLI + +```sh +babel --plugins transform-es2015-unicode-regex script.js +``` + +### Via Node API + +```javascript +require("babel-core").transform("code", { + plugins: ["transform-es2015-unicode-regex"] +}); +``` diff --git a/node_modules/babel-plugin-transform-es2015-unicode-regex/lib/index.js b/node_modules/babel-plugin-transform-es2015-unicode-regex/lib/index.js new file mode 100644 index 000000000..2c427e9ff --- /dev/null +++ b/node_modules/babel-plugin-transform-es2015-unicode-regex/lib/index.js @@ -0,0 +1,31 @@ +"use strict"; + +exports.__esModule = true; + +exports.default = function () { + return { + visitor: { + RegExpLiteral: function RegExpLiteral(_ref) { + var node = _ref.node; + + if (!regex.is(node, "u")) return; + node.pattern = (0, _regexpuCore2.default)(node.pattern, node.flags); + regex.pullFlag(node, "u"); + } + } + }; +}; + +var _regexpuCore = require("regexpu-core"); + +var _regexpuCore2 = _interopRequireDefault(_regexpuCore); + +var _babelHelperRegex = require("babel-helper-regex"); + +var regex = _interopRequireWildcard(_babelHelperRegex); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = exports["default"];
\ No newline at end of file diff --git a/node_modules/babel-plugin-transform-es2015-unicode-regex/package.json b/node_modules/babel-plugin-transform-es2015-unicode-regex/package.json new file mode 100644 index 000000000..0a02d878c --- /dev/null +++ b/node_modules/babel-plugin-transform-es2015-unicode-regex/package.json @@ -0,0 +1,19 @@ +{ + "name": "babel-plugin-transform-es2015-unicode-regex", + "version": "6.24.1", + "description": "Compile ES2015 Unicode regex to ES5", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-unicode-regex", + "license": "MIT", + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" + }, + "devDependencies": { + "babel-helper-plugin-test-runner": "^6.24.1" + } +} |