Improve code quality and write tests

This commit is contained in:
Shivam Mathur
2019-09-20 08:11:20 +05:30
parent db44db4b97
commit 43178a7254
3597 changed files with 255478 additions and 785554 deletions

View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

View File

@ -0,0 +1,19 @@
# @babel/plugin-proposal-unicode-property-regex
> Compile Unicode property escapes in Unicode regular expressions to ES5.
See our website [@babel/plugin-proposal-unicode-property-regex](https://babeljs.io/docs/en/next/babel-plugin-proposal-unicode-property-regex.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-unicode-property-regex
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-unicode-property-regex --dev
```

View File

@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
return data;
};
return data;
}
function _regexpuCore() {
const data = _interopRequireDefault(require("regexpu-core"));
_regexpuCore = function () {
return data;
};
return data;
}
function regex() {
const data = _interopRequireWildcard(require("@babel/helper-regex"));
regex = function () {
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, options) => {
api.assertVersion(7);
const {
useUnicodeFlag = true
} = options;
if (typeof useUnicodeFlag !== "boolean") {
throw new Error(".useUnicodeFlag must be a boolean, or undefined");
}
return {
name: "proposal-unicode-property-regex",
visitor: {
RegExpLiteral(path) {
const node = path.node;
if (!regex().is(node, "u")) {
return;
}
node.pattern = (0, _regexpuCore().default)(node.pattern, node.flags, {
unicodePropertyEscape: true,
useUnicodeFlag
});
if (!useUnicodeFlag) {
regex().pullFlag(node, "u");
}
}
}
};
});
exports.default = _default;

View File

@ -0,0 +1,71 @@
{
"_args": [
[
"@babel/plugin-proposal-unicode-property-regex@7.4.4",
"E:\\python\\setup-php"
]
],
"_from": "@babel/plugin-proposal-unicode-property-regex@7.4.4",
"_id": "@babel/plugin-proposal-unicode-property-regex@7.4.4",
"_inBundle": false,
"_integrity": "sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==",
"_location": "/@babel/plugin-proposal-unicode-property-regex",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@babel/plugin-proposal-unicode-property-regex@7.4.4",
"name": "@babel/plugin-proposal-unicode-property-regex",
"escapedName": "@babel%2fplugin-proposal-unicode-property-regex",
"scope": "@babel",
"rawSpec": "7.4.4",
"saveSpec": null,
"fetchSpec": "7.4.4"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz",
"_spec": "7.4.4",
"_where": "E:\\python\\setup-php",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/helper-regex": "^7.4.4",
"regexpu-core": "^4.5.4"
},
"description": "Compile Unicode property escapes in Unicode regular expressions to ES5.",
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"engines": {
"node": ">=4"
},
"gitHead": "2c88694388831b1e5b88e4bbed6781eb2be1edba",
"homepage": "https://babeljs.io/",
"keywords": [
"babel-plugin",
"regex",
"regexp",
"regular expressions",
"unicode properties",
"unicode"
],
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/plugin-proposal-unicode-property-regex",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-unicode-property-regex"
},
"version": "7.4.4"
}

View File

@ -0,0 +1,32 @@
import { declare } from "@babel/helper-plugin-utils";
import rewritePattern from "regexpu-core";
import * as regex from "@babel/helper-regex";
export default declare((api, options) => {
api.assertVersion(7);
const { useUnicodeFlag = true } = options;
if (typeof useUnicodeFlag !== "boolean") {
throw new Error(".useUnicodeFlag must be a boolean, or undefined");
}
return {
name: "proposal-unicode-property-regex",
visitor: {
RegExpLiteral(path) {
const node = path.node;
if (!regex.is(node, "u")) {
return;
}
node.pattern = rewritePattern(node.pattern, node.flags, {
unicodePropertyEscape: true,
useUnicodeFlag,
});
if (!useUnicodeFlag) {
regex.pullFlag(node, "u");
}
},
},
};
});

View File

@ -0,0 +1,10 @@
{
"plugins": [
[
"proposal-unicode-property-regex",
{
"useUnicodeFlag": true
}
]
]
}

View File

@ -0,0 +1 @@
var regex = /\p{Script_Extensions=Anatolian_Hieroglyphs}/u;

View File

@ -0,0 +1 @@
var regex = /[\u{14400}-\u{14646}]/u;

View File

@ -0,0 +1 @@
var regex = /\p{ASCII_Hex_Digit}/u;

View File

@ -0,0 +1 @@
var regex = /[0-9A-Fa-f]/u;

View File

@ -0,0 +1 @@
var regex = /\p{Regional_Indicator}/u;

View File

@ -0,0 +1 @@
var regex = /[\u{1F1E6}-\u{1F1FF}]/u;

View File

@ -0,0 +1 @@
var regex = /\p{Script_Extensions=Makasar}/u;

View File

@ -0,0 +1 @@
var regex = /[\u{11EE0}-\u{11EF8}]/u;

View File

@ -0,0 +1 @@
var regex = /[\u{1E2C0}-\u{1E2F9}\u{1E2FF}]/u;

View File

@ -0,0 +1 @@
var regex = /[\u{1E2C0}-\u{1E2F9}\u{1E2FF}]/u;

View File

@ -0,0 +1,10 @@
{
"plugins": [
[
"proposal-unicode-property-regex",
{
"useUnicodeFlag": false
}
]
]
}

View File

@ -0,0 +1 @@
var regex = /\p{Script_Extensions=Anatolian_Hieroglyphs}/u;

View File

@ -0,0 +1 @@
var regex = /(?:\uD811[\uDC00-\uDE46])/;

View File

@ -0,0 +1 @@
var regex = /\p{ASCII_Hex_Digit}/u;

View File

@ -0,0 +1 @@
var regex = /[0-9A-Fa-f]/;

View File

@ -0,0 +1 @@
var regex = /\p{Regional_Indicator}/u;

View File

@ -0,0 +1 @@
var regex = /(?:\uD83C[\uDDE6-\uDDFF])/;

View File

@ -0,0 +1 @@
var regex = /\p{Script_Extensions=Makasar}/u;

View File

@ -0,0 +1 @@
var regex = /(?:\uD807[\uDEE0-\uDEF8])/;

View File

@ -0,0 +1 @@
var regex = /\p{Script_Extensions=Wancho}/u;

View File

@ -0,0 +1 @@
var regex = /(?:\uD838[\uDEC0-\uDEF9\uDEFF])/;

View File

@ -0,0 +1,2 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);