aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-transform-dotall-regex
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/@babel/plugin-transform-dotall-regex
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/@babel/plugin-transform-dotall-regex')
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/README.md69
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/lib/index.js64
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/package.json35
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/src/index.js23
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/options.json3
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/input.js2
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js2
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/input.js2
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/output.js2
-rw-r--r--node_modules/@babel/plugin-transform-dotall-regex/test/index.js2
10 files changed, 204 insertions, 0 deletions
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/README.md b/node_modules/@babel/plugin-transform-dotall-regex/README.md
new file mode 100644
index 00000000..d180193c
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/README.md
@@ -0,0 +1,69 @@
+# @babel/plugin-transform-dotall-regex
+
+> Compile regular expressions using [the `s` (`dotAll`) flag](https://github.com/tc39/proposal-regexp-dotall-flag) to ES5 that works in today’s environments.
+
+## Example
+
+**In**
+
+```js
+/./s
+```
+
+**Out**
+
+```js
+/[\0-\uFFFF]/
+```
+
+**In**
+
+```js
+/./su
+```
+
+**Out**
+
+```js
+/[\0-\u{10FFFF}]/u
+```
+
+[Here’s an online demo.](https://mothereff.in/regexpu#input=const+regex+%3D+/foo.bar/s%3B%0Aconsole.log%28%0A++regex.test%28%27foo%5Cnbar%27%29%0A%29%3B%0A//+%E2%86%92+true&dotAllFlag=1)
+
+## Installation
+
+```sh
+npm install --save-dev @babel/plugin-transform-dotall-regex
+```
+
+## Usage
+
+### Via `.babelrc` (recommended)
+
+`.babelrc`
+
+```json
+{
+ "plugins": ["@babel/plugin-transform-dotall-regex"]
+}
+```
+
+### Via CLI
+
+```sh
+$ babel --plugins @babel/plugin-transform-dotall-regex script.js
+```
+
+### Via Node.js API
+
+```js
+require('@babel/core').transform(code, {
+ 'plugins': ['@babel/plugin-transform-dotall-regex']
+});
+```
+
+## Author
+
+| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
+|---|
+| [Mathias Bynens](https://mathiasbynens.be/) |
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/lib/index.js b/node_modules/@babel/plugin-transform-dotall-regex/lib/index.js
new file mode 100644
index 00000000..707d77ec
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/lib/index.js
@@ -0,0 +1,64 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+function _helperPluginUtils() {
+ const data = require("@babel/helper-plugin-utils");
+
+ _helperPluginUtils = function _helperPluginUtils() {
+ return data;
+ };
+
+ return data;
+}
+
+function _regexpuCore() {
+ const data = _interopRequireDefault(require("regexpu-core"));
+
+ _regexpuCore = function _regexpuCore() {
+ return data;
+ };
+
+ return data;
+}
+
+function regex() {
+ const data = _interopRequireWildcard(require("@babel/helper-regex"));
+
+ regex = function regex() {
+ return data;
+ };
+
+ return data;
+}
+
+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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var _default = (0, _helperPluginUtils().declare)(api => {
+ api.assertVersion(7);
+ return {
+ visitor: {
+ RegExpLiteral(path) {
+ const node = path.node;
+
+ if (!regex().is(node, "s")) {
+ return;
+ }
+
+ node.pattern = (0, _regexpuCore().default)(node.pattern, node.flags, {
+ dotAllFlag: true,
+ useUnicodeFlag: regex().is(node, "u")
+ });
+ regex().pullFlag(node, "s");
+ }
+
+ }
+ };
+});
+
+exports.default = _default; \ No newline at end of file
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/package.json b/node_modules/@babel/plugin-transform-dotall-regex/package.json
new file mode 100644
index 00000000..f8dced35
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@babel/plugin-transform-dotall-regex",
+ "version": "7.0.0-beta.47",
+ "description": "Compile regular expressions using the `s` (`dotAll`) flag to ES5.",
+ "homepage": "https://babeljs.io/",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "engines": {
+ "node": ">=4"
+ },
+ "keywords": [
+ "babel-plugin",
+ "regex",
+ "regexp",
+ "regular expressions",
+ "dotall"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-dotall-regex.git"
+ },
+ "bugs": "https://github.com/babel/babel/issues",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "7.0.0-beta.47",
+ "@babel/helper-regex": "7.0.0-beta.47",
+ "regexpu-core": "^4.1.3"
+ },
+ "peerDependencies": {
+ "@babel/core": "7.0.0-beta.47"
+ },
+ "devDependencies": {
+ "@babel/core": "7.0.0-beta.47",
+ "@babel/helper-plugin-test-runner": "7.0.0-beta.47"
+ }
+}
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/src/index.js b/node_modules/@babel/plugin-transform-dotall-regex/src/index.js
new file mode 100644
index 00000000..e1303cd9
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/src/index.js
@@ -0,0 +1,23 @@
+import { declare } from "@babel/helper-plugin-utils";
+import rewritePattern from "regexpu-core";
+import * as regex from "@babel/helper-regex";
+
+export default declare(api => {
+ api.assertVersion(7);
+
+ return {
+ visitor: {
+ RegExpLiteral(path) {
+ const node = path.node;
+ if (!regex.is(node, "s")) {
+ return;
+ }
+ node.pattern = rewritePattern(node.pattern, node.flags, {
+ dotAllFlag: true,
+ useUnicodeFlag: regex.is(node, "u"),
+ });
+ regex.pullFlag(node, "s");
+ },
+ },
+ };
+});
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/options.json b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/options.json
new file mode 100644
index 00000000..971351e1
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/options.json
@@ -0,0 +1,3 @@
+{
+ "plugins": ["transform-dotall-regex"]
+}
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/input.js b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/input.js
new file mode 100644
index 00000000..bf124396
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/input.js
@@ -0,0 +1,2 @@
+var a = /./;
+var b = /./s;
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js
new file mode 100644
index 00000000..dec34325
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js
@@ -0,0 +1,2 @@
+var a = /./;
+var b = /[\0-\uFFFF]/;
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/input.js b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/input.js
new file mode 100644
index 00000000..9ca7da3e
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/input.js
@@ -0,0 +1,2 @@
+var a = /./u;
+var b = /./su;
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/output.js b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/output.js
new file mode 100644
index 00000000..bb1b222a
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-flag/output.js
@@ -0,0 +1,2 @@
+var a = /./u;
+var b = /[\0-\u{10FFFF}]/u;
diff --git a/node_modules/@babel/plugin-transform-dotall-regex/test/index.js b/node_modules/@babel/plugin-transform-dotall-regex/test/index.js
new file mode 100644
index 00000000..8c71ab59
--- /dev/null
+++ b/node_modules/@babel/plugin-transform-dotall-regex/test/index.js
@@ -0,0 +1,2 @@
+import runner from "@babel/helper-plugin-test-runner";
+runner(__dirname);