remove gitignore files
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mocha/bin/_mocha
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../acorn/bin/acorn
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../color-support/bin.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../detect-libc/bin/detect-libc.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../eslint/bin/eslint.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esparse.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../esprima/bin/esvalidate.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../flat/cli.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../he/bin/he
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../is-ci/bin.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../js-yaml/bin/js-yaml.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../loose-envify/cli.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mime/cli.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mkdirp/bin/cmd.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../mocha/bin/mocha
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../@mapbox/node-pre-gyp/bin/node-pre-gyp
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../nodemon/bin/nodemon.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../touch/bin/nodetouch.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../nopt/bin/nopt.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../rc/cli.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../rimraf/bin.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../semver/bin/semver.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../uuid/bin/uuid
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../which/bin/which
|
|
||||||
-5222
File diff suppressed because it is too large
Load Diff
-22
@@ -1,22 +0,0 @@
|
|||||||
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.
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
# @babel/code-frame
|
|
||||||
|
|
||||||
> Generate errors that contain a code frame that point to source locations.
|
|
||||||
|
|
||||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save-dev @babel/code-frame
|
|
||||||
```
|
|
||||||
|
|
||||||
or using yarn:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @babel/code-frame --dev
|
|
||||||
```
|
|
||||||
-173
@@ -1,173 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.codeFrameColumns = codeFrameColumns;
|
|
||||||
exports.default = _default;
|
|
||||||
|
|
||||||
function _highlight() {
|
|
||||||
const data = _interopRequireWildcard(require("@babel/highlight"));
|
|
||||||
|
|
||||||
_highlight = 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; } }
|
|
||||||
|
|
||||||
let deprecationWarningShown = false;
|
|
||||||
|
|
||||||
function getDefs(chalk) {
|
|
||||||
return {
|
|
||||||
gutter: chalk.grey,
|
|
||||||
marker: chalk.red.bold,
|
|
||||||
message: chalk.red.bold
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
||||||
|
|
||||||
function getMarkerLines(loc, source, opts) {
|
|
||||||
const startLoc = Object.assign({
|
|
||||||
column: 0,
|
|
||||||
line: -1
|
|
||||||
}, loc.start);
|
|
||||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
||||||
const {
|
|
||||||
linesAbove = 2,
|
|
||||||
linesBelow = 3
|
|
||||||
} = opts || {};
|
|
||||||
const startLine = startLoc.line;
|
|
||||||
const startColumn = startLoc.column;
|
|
||||||
const endLine = endLoc.line;
|
|
||||||
const endColumn = endLoc.column;
|
|
||||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
||||||
let end = Math.min(source.length, endLine + linesBelow);
|
|
||||||
|
|
||||||
if (startLine === -1) {
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endLine === -1) {
|
|
||||||
end = source.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lineDiff = endLine - startLine;
|
|
||||||
const markerLines = {};
|
|
||||||
|
|
||||||
if (lineDiff) {
|
|
||||||
for (let i = 0; i <= lineDiff; i++) {
|
|
||||||
const lineNumber = i + startLine;
|
|
||||||
|
|
||||||
if (!startColumn) {
|
|
||||||
markerLines[lineNumber] = true;
|
|
||||||
} else if (i === 0) {
|
|
||||||
const sourceLength = source[lineNumber - 1].length;
|
|
||||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
|
||||||
} else if (i === lineDiff) {
|
|
||||||
markerLines[lineNumber] = [0, endColumn];
|
|
||||||
} else {
|
|
||||||
const sourceLength = source[lineNumber - i].length;
|
|
||||||
markerLines[lineNumber] = [0, sourceLength];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (startColumn === endColumn) {
|
|
||||||
if (startColumn) {
|
|
||||||
markerLines[startLine] = [startColumn, 0];
|
|
||||||
} else {
|
|
||||||
markerLines[startLine] = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
markerLines
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
||||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
|
|
||||||
const chalk = (0, _highlight().getChalk)(opts);
|
|
||||||
const defs = getDefs(chalk);
|
|
||||||
|
|
||||||
const maybeHighlight = (chalkFn, string) => {
|
|
||||||
return highlighted ? chalkFn(string) : string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const lines = rawLines.split(NEWLINE);
|
|
||||||
const {
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
markerLines
|
|
||||||
} = getMarkerLines(loc, lines, opts);
|
|
||||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
||||||
const numberMaxWidth = String(end).length;
|
|
||||||
const highlightedLines = highlighted ? (0, _highlight().default)(rawLines, opts) : rawLines;
|
|
||||||
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
|
||||||
const number = start + 1 + index;
|
|
||||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
|
||||||
const gutter = ` ${paddedNumber} | `;
|
|
||||||
const hasMarker = markerLines[number];
|
|
||||||
const lastMarkerLine = !markerLines[number + 1];
|
|
||||||
|
|
||||||
if (hasMarker) {
|
|
||||||
let markerLine = "";
|
|
||||||
|
|
||||||
if (Array.isArray(hasMarker)) {
|
|
||||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
||||||
const numberOfMarkers = hasMarker[1] || 1;
|
|
||||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
|
||||||
|
|
||||||
if (lastMarkerLine && opts.message) {
|
|
||||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
|
||||||
} else {
|
|
||||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
|
||||||
}
|
|
||||||
}).join("\n");
|
|
||||||
|
|
||||||
if (opts.message && !hasColumns) {
|
|
||||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (highlighted) {
|
|
||||||
return chalk.reset(frame);
|
|
||||||
} else {
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
|
||||||
if (!deprecationWarningShown) {
|
|
||||||
deprecationWarningShown = true;
|
|
||||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
|
||||||
|
|
||||||
if (process.emitWarning) {
|
|
||||||
process.emitWarning(message, "DeprecationWarning");
|
|
||||||
} else {
|
|
||||||
const deprecationError = new Error(message);
|
|
||||||
deprecationError.name = "DeprecationWarning";
|
|
||||||
console.warn(new Error(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
colNumber = Math.max(colNumber, 0);
|
|
||||||
const location = {
|
|
||||||
start: {
|
|
||||||
column: colNumber,
|
|
||||||
line: lineNumber
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return codeFrameColumns(rawLines, location, opts);
|
|
||||||
}
|
|
||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@babel/code-frame@7.5.5",
|
|
||||||
"/home/app"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_development": true,
|
|
||||||
"_from": "@babel/code-frame@7.5.5",
|
|
||||||
"_id": "@babel/code-frame@7.5.5",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
|
|
||||||
"_location": "/@babel/code-frame",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@babel/code-frame@7.5.5",
|
|
||||||
"name": "@babel/code-frame",
|
|
||||||
"escapedName": "@babel%2fcode-frame",
|
|
||||||
"scope": "@babel",
|
|
||||||
"rawSpec": "7.5.5",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "7.5.5"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/eslint"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
|
|
||||||
"_spec": "7.5.5",
|
|
||||||
"_where": "/home/app",
|
|
||||||
"author": {
|
|
||||||
"name": "Sebastian McKenzie",
|
|
||||||
"email": "sebmck@gmail.com"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/highlight": "^7.0.0"
|
|
||||||
},
|
|
||||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
|
||||||
"devDependencies": {
|
|
||||||
"chalk": "^2.0.0",
|
|
||||||
"strip-ansi": "^4.0.0"
|
|
||||||
},
|
|
||||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
|
||||||
"homepage": "https://babeljs.io/",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"name": "@babel/code-frame",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
|
|
||||||
},
|
|
||||||
"version": "7.5.5"
|
|
||||||
}
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
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.
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
# @babel/highlight
|
|
||||||
|
|
||||||
> Syntax highlight JavaScript strings for output in terminals.
|
|
||||||
|
|
||||||
See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save-dev @babel/highlight
|
|
||||||
```
|
|
||||||
|
|
||||||
or using yarn:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @babel/highlight --dev
|
|
||||||
```
|
|
||||||
-129
@@ -1,129 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
|
||||||
value: true
|
|
||||||
});
|
|
||||||
exports.shouldHighlight = shouldHighlight;
|
|
||||||
exports.getChalk = getChalk;
|
|
||||||
exports.default = highlight;
|
|
||||||
|
|
||||||
function _jsTokens() {
|
|
||||||
const data = _interopRequireWildcard(require("js-tokens"));
|
|
||||||
|
|
||||||
_jsTokens = function () {
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _esutils() {
|
|
||||||
const data = _interopRequireDefault(require("esutils"));
|
|
||||||
|
|
||||||
_esutils = function () {
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _chalk() {
|
|
||||||
const data = _interopRequireDefault(require("chalk"));
|
|
||||||
|
|
||||||
_chalk = function () {
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
||||||
|
|
||||||
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 getDefs(chalk) {
|
|
||||||
return {
|
|
||||||
keyword: chalk.cyan,
|
|
||||||
capitalized: chalk.yellow,
|
|
||||||
jsx_tag: chalk.yellow,
|
|
||||||
punctuator: chalk.yellow,
|
|
||||||
number: chalk.magenta,
|
|
||||||
string: chalk.green,
|
|
||||||
regex: chalk.magenta,
|
|
||||||
comment: chalk.grey,
|
|
||||||
invalid: chalk.white.bgRed.bold
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
||||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
||||||
const BRACKET = /^[()[\]{}]$/;
|
|
||||||
|
|
||||||
function getTokenType(match) {
|
|
||||||
const [offset, text] = match.slice(-2);
|
|
||||||
const token = (0, _jsTokens().matchToToken)(match);
|
|
||||||
|
|
||||||
if (token.type === "name") {
|
|
||||||
if (_esutils().default.keyword.isReservedWordES6(token.value)) {
|
|
||||||
return "keyword";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
|
||||||
return "jsx_tag";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
||||||
return "capitalized";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
|
||||||
return "bracket";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
|
||||||
return "punctuator";
|
|
||||||
}
|
|
||||||
|
|
||||||
return token.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
function highlightTokens(defs, text) {
|
|
||||||
return text.replace(_jsTokens().default, function (...args) {
|
|
||||||
const type = getTokenType(args);
|
|
||||||
const colorize = defs[type];
|
|
||||||
|
|
||||||
if (colorize) {
|
|
||||||
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
|
|
||||||
} else {
|
|
||||||
return args[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function shouldHighlight(options) {
|
|
||||||
return _chalk().default.supportsColor || options.forceColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getChalk(options) {
|
|
||||||
let chalk = _chalk().default;
|
|
||||||
|
|
||||||
if (options.forceColor) {
|
|
||||||
chalk = new (_chalk().default.constructor)({
|
|
||||||
enabled: true,
|
|
||||||
level: 1
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return chalk;
|
|
||||||
}
|
|
||||||
|
|
||||||
function highlight(code, options = {}) {
|
|
||||||
if (shouldHighlight(options)) {
|
|
||||||
const chalk = getChalk(options);
|
|
||||||
const defs = getDefs(chalk);
|
|
||||||
return highlightTokens(defs, code);
|
|
||||||
} else {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-58
@@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"@babel/highlight@7.5.0",
|
|
||||||
"/home/app"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_development": true,
|
|
||||||
"_from": "@babel/highlight@7.5.0",
|
|
||||||
"_id": "@babel/highlight@7.5.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
|
|
||||||
"_location": "/@babel/highlight",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@babel/highlight@7.5.0",
|
|
||||||
"name": "@babel/highlight",
|
|
||||||
"escapedName": "@babel%2fhighlight",
|
|
||||||
"scope": "@babel",
|
|
||||||
"rawSpec": "7.5.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "7.5.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/@babel/code-frame"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
|
|
||||||
"_spec": "7.5.0",
|
|
||||||
"_where": "/home/app",
|
|
||||||
"author": {
|
|
||||||
"name": "suchipi",
|
|
||||||
"email": "me@suchipi.com"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"chalk": "^2.0.0",
|
|
||||||
"esutils": "^2.0.2",
|
|
||||||
"js-tokens": "^4.0.0"
|
|
||||||
},
|
|
||||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
|
||||||
"devDependencies": {
|
|
||||||
"strip-ansi": "^4.0.0"
|
|
||||||
},
|
|
||||||
"gitHead": "49da9a07c81156e997e60146eb001ea77b7044c4",
|
|
||||||
"homepage": "https://babeljs.io/",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/index.js",
|
|
||||||
"name": "@babel/highlight",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-highlight"
|
|
||||||
},
|
|
||||||
"version": "7.5.0"
|
|
||||||
}
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
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.
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
# @babel/runtime
|
|
||||||
|
|
||||||
> babel's modular runtime helpers
|
|
||||||
|
|
||||||
See our website [@babel/runtime](https://babeljs.io/docs/en/next/babel-runtime.html) for more information.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Using npm:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install --save @babel/runtime
|
|
||||||
```
|
|
||||||
|
|
||||||
or using yarn:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn add @babel/runtime
|
|
||||||
```
|
|
||||||
-100
@@ -1,100 +0,0 @@
|
|||||||
var AwaitValue = require("./AwaitValue");
|
|
||||||
|
|
||||||
function AsyncGenerator(gen) {
|
|
||||||
var front, back;
|
|
||||||
|
|
||||||
function send(key, arg) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var request = {
|
|
||||||
key: key,
|
|
||||||
arg: arg,
|
|
||||||
resolve: resolve,
|
|
||||||
reject: reject,
|
|
||||||
next: null
|
|
||||||
};
|
|
||||||
|
|
||||||
if (back) {
|
|
||||||
back = back.next = request;
|
|
||||||
} else {
|
|
||||||
front = back = request;
|
|
||||||
resume(key, arg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function resume(key, arg) {
|
|
||||||
try {
|
|
||||||
var result = gen[key](arg);
|
|
||||||
var value = result.value;
|
|
||||||
var wrappedAwait = value instanceof AwaitValue;
|
|
||||||
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
|
|
||||||
if (wrappedAwait) {
|
|
||||||
resume("next", arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
settle(result.done ? "return" : "normal", arg);
|
|
||||||
}, function (err) {
|
|
||||||
resume("throw", err);
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
settle("throw", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function settle(type, value) {
|
|
||||||
switch (type) {
|
|
||||||
case "return":
|
|
||||||
front.resolve({
|
|
||||||
value: value,
|
|
||||||
done: true
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "throw":
|
|
||||||
front.reject(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
front.resolve({
|
|
||||||
value: value,
|
|
||||||
done: false
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
front = front.next;
|
|
||||||
|
|
||||||
if (front) {
|
|
||||||
resume(front.key, front.arg);
|
|
||||||
} else {
|
|
||||||
back = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._invoke = send;
|
|
||||||
|
|
||||||
if (typeof gen["return"] !== "function") {
|
|
||||||
this["return"] = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
|
||||||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
AsyncGenerator.prototype.next = function (arg) {
|
|
||||||
return this._invoke("next", arg);
|
|
||||||
};
|
|
||||||
|
|
||||||
AsyncGenerator.prototype["throw"] = function (arg) {
|
|
||||||
return this._invoke("throw", arg);
|
|
||||||
};
|
|
||||||
|
|
||||||
AsyncGenerator.prototype["return"] = function (arg) {
|
|
||||||
return this._invoke("return", arg);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = AsyncGenerator;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
function _AwaitValue(value) {
|
|
||||||
this.wrapped = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _AwaitValue;
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
||||||
var desc = {};
|
|
||||||
Object.keys(descriptor).forEach(function (key) {
|
|
||||||
desc[key] = descriptor[key];
|
|
||||||
});
|
|
||||||
desc.enumerable = !!desc.enumerable;
|
|
||||||
desc.configurable = !!desc.configurable;
|
|
||||||
|
|
||||||
if ('value' in desc || desc.initializer) {
|
|
||||||
desc.writable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
||||||
return decorator(target, property, desc) || desc;
|
|
||||||
}, desc);
|
|
||||||
|
|
||||||
if (context && desc.initializer !== void 0) {
|
|
||||||
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
||||||
desc.initializer = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desc.initializer === void 0) {
|
|
||||||
Object.defineProperty(target, property, desc);
|
|
||||||
desc = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _applyDecoratedDescriptor;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
function _arrayWithHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _arrayWithHoles;
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
function _arrayWithoutHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) {
|
|
||||||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
|
||||||
arr2[i] = arr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _arrayWithoutHoles;
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
function _assertThisInitialized(self) {
|
|
||||||
if (self === void 0) {
|
|
||||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _assertThisInitialized;
|
|
||||||
-53
@@ -1,53 +0,0 @@
|
|||||||
function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
||||||
var iter = {},
|
|
||||||
waiting = false;
|
|
||||||
|
|
||||||
function pump(key, value) {
|
|
||||||
waiting = true;
|
|
||||||
value = new Promise(function (resolve) {
|
|
||||||
resolve(inner[key](value));
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
done: false,
|
|
||||||
value: awaitWrap(value)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
if (typeof Symbol === "function" && Symbol.iterator) {
|
|
||||||
iter[Symbol.iterator] = function () {
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
iter.next = function (value) {
|
|
||||||
if (waiting) {
|
|
||||||
waiting = false;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pump("next", value);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof inner["throw"] === "function") {
|
|
||||||
iter["throw"] = function (value) {
|
|
||||||
if (waiting) {
|
|
||||||
waiting = false;
|
|
||||||
throw value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pump("throw", value);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof inner["return"] === "function") {
|
|
||||||
iter["return"] = function (value) {
|
|
||||||
return pump("return", value);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return iter;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _asyncGeneratorDelegate;
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
function _asyncIterator(iterable) {
|
|
||||||
var method;
|
|
||||||
|
|
||||||
if (typeof Symbol !== "undefined") {
|
|
||||||
if (Symbol.asyncIterator) {
|
|
||||||
method = iterable[Symbol.asyncIterator];
|
|
||||||
if (method != null) return method.call(iterable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Symbol.iterator) {
|
|
||||||
method = iterable[Symbol.iterator];
|
|
||||||
if (method != null) return method.call(iterable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new TypeError("Object is not async iterable");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _asyncIterator;
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
||||||
try {
|
|
||||||
var info = gen[key](arg);
|
|
||||||
var value = info.value;
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.done) {
|
|
||||||
resolve(value);
|
|
||||||
} else {
|
|
||||||
Promise.resolve(value).then(_next, _throw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _asyncToGenerator(fn) {
|
|
||||||
return function () {
|
|
||||||
var self = this,
|
|
||||||
args = arguments;
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var gen = fn.apply(self, args);
|
|
||||||
|
|
||||||
function _next(value) {
|
|
||||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _throw(err) {
|
|
||||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
_next(undefined);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _asyncToGenerator;
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
var AwaitValue = require("./AwaitValue");
|
|
||||||
|
|
||||||
function _awaitAsyncGenerator(value) {
|
|
||||||
return new AwaitValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _awaitAsyncGenerator;
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
function _classCallCheck(instance, Constructor) {
|
|
||||||
if (!(instance instanceof Constructor)) {
|
|
||||||
throw new TypeError("Cannot call a class as a function");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classCallCheck;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
function _classNameTDZError(name) {
|
|
||||||
throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys.");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classNameTDZError;
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
function _classPrivateFieldDestructureSet(receiver, privateMap) {
|
|
||||||
if (!privateMap.has(receiver)) {
|
|
||||||
throw new TypeError("attempted to set private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
if (!("__destrObj" in descriptor)) {
|
|
||||||
descriptor.__destrObj = {
|
|
||||||
set value(v) {
|
|
||||||
descriptor.set.call(receiver, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.__destrObj;
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateFieldDestructureSet;
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
function _classPrivateFieldGet(receiver, privateMap) {
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError("attempted to get private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.get) {
|
|
||||||
return descriptor.get.call(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateFieldGet;
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
function _classPrivateFieldBase(receiver, privateKey) {
|
|
||||||
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
||||||
throw new TypeError("attempted to use private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return receiver;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateFieldBase;
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
var id = 0;
|
|
||||||
|
|
||||||
function _classPrivateFieldKey(name) {
|
|
||||||
return "__private_" + id++ + "_" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateFieldKey;
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError("attempted to set private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
descriptor.set.call(receiver, value);
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptor.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateFieldSet;
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
||||||
if (!privateSet.has(receiver)) {
|
|
||||||
throw new TypeError("attempted to get private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateMethodGet;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
function _classPrivateMethodSet() {
|
|
||||||
throw new TypeError("attempted to reassign private method");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classPrivateMethodSet;
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.get) {
|
|
||||||
return descriptor.get.call(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classStaticPrivateFieldSpecGet;
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
descriptor.set.call(receiver, value);
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptor.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classStaticPrivateFieldSpecSet;
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classStaticPrivateMethodGet;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
function _classStaticPrivateMethodSet() {
|
|
||||||
throw new TypeError("attempted to set read only static private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _classStaticPrivateMethodSet;
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
var setPrototypeOf = require("./setPrototypeOf");
|
|
||||||
|
|
||||||
function isNativeReflectConstruct() {
|
|
||||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
||||||
if (Reflect.construct.sham) return false;
|
|
||||||
if (typeof Proxy === "function") return true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _construct(Parent, args, Class) {
|
|
||||||
if (isNativeReflectConstruct()) {
|
|
||||||
module.exports = _construct = Reflect.construct;
|
|
||||||
} else {
|
|
||||||
module.exports = _construct = function _construct(Parent, args, Class) {
|
|
||||||
var a = [null];
|
|
||||||
a.push.apply(a, args);
|
|
||||||
var Constructor = Function.bind.apply(Parent, a);
|
|
||||||
var instance = new Constructor();
|
|
||||||
if (Class) setPrototypeOf(instance, Class.prototype);
|
|
||||||
return instance;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return _construct.apply(null, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _construct;
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
function _defineProperties(target, props) {
|
|
||||||
for (var i = 0; i < props.length; i++) {
|
|
||||||
var descriptor = props[i];
|
|
||||||
descriptor.enumerable = descriptor.enumerable || false;
|
|
||||||
descriptor.configurable = true;
|
|
||||||
if ("value" in descriptor) descriptor.writable = true;
|
|
||||||
Object.defineProperty(target, descriptor.key, descriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _createClass(Constructor, protoProps, staticProps) {
|
|
||||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
||||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
||||||
return Constructor;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _createClass;
|
|
||||||
-400
@@ -1,400 +0,0 @@
|
|||||||
var toArray = require("./toArray");
|
|
||||||
|
|
||||||
var toPropertyKey = require("./toPropertyKey");
|
|
||||||
|
|
||||||
function _decorate(decorators, factory, superClass, mixins) {
|
|
||||||
var api = _getDecoratorsApi();
|
|
||||||
|
|
||||||
if (mixins) {
|
|
||||||
for (var i = 0; i < mixins.length; i++) {
|
|
||||||
api = mixins[i](api);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var r = factory(function initialize(O) {
|
|
||||||
api.initializeInstanceElements(O, decorated.elements);
|
|
||||||
}, superClass);
|
|
||||||
var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
|
|
||||||
api.initializeClassElements(r.F, decorated.elements);
|
|
||||||
return api.runClassFinishers(r.F, decorated.finishers);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _getDecoratorsApi() {
|
|
||||||
_getDecoratorsApi = function _getDecoratorsApi() {
|
|
||||||
return api;
|
|
||||||
};
|
|
||||||
|
|
||||||
var api = {
|
|
||||||
elementsDefinitionOrder: [["method"], ["field"]],
|
|
||||||
initializeInstanceElements: function initializeInstanceElements(O, elements) {
|
|
||||||
["method", "field"].forEach(function (kind) {
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
if (element.kind === kind && element.placement === "own") {
|
|
||||||
this.defineClassElement(O, element);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
initializeClassElements: function initializeClassElements(F, elements) {
|
|
||||||
var proto = F.prototype;
|
|
||||||
["method", "field"].forEach(function (kind) {
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
var placement = element.placement;
|
|
||||||
|
|
||||||
if (element.kind === kind && (placement === "static" || placement === "prototype")) {
|
|
||||||
var receiver = placement === "static" ? F : proto;
|
|
||||||
this.defineClassElement(receiver, element);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
defineClassElement: function defineClassElement(receiver, element) {
|
|
||||||
var descriptor = element.descriptor;
|
|
||||||
|
|
||||||
if (element.kind === "field") {
|
|
||||||
var initializer = element.initializer;
|
|
||||||
descriptor = {
|
|
||||||
enumerable: descriptor.enumerable,
|
|
||||||
writable: descriptor.writable,
|
|
||||||
configurable: descriptor.configurable,
|
|
||||||
value: initializer === void 0 ? void 0 : initializer.call(receiver)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(receiver, element.key, descriptor);
|
|
||||||
},
|
|
||||||
decorateClass: function decorateClass(elements, decorators) {
|
|
||||||
var newElements = [];
|
|
||||||
var finishers = [];
|
|
||||||
var placements = {
|
|
||||||
"static": [],
|
|
||||||
prototype: [],
|
|
||||||
own: []
|
|
||||||
};
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
this.addElementPlacement(element, placements);
|
|
||||||
}, this);
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
if (!_hasDecorators(element)) return newElements.push(element);
|
|
||||||
var elementFinishersExtras = this.decorateElement(element, placements);
|
|
||||||
newElements.push(elementFinishersExtras.element);
|
|
||||||
newElements.push.apply(newElements, elementFinishersExtras.extras);
|
|
||||||
finishers.push.apply(finishers, elementFinishersExtras.finishers);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
if (!decorators) {
|
|
||||||
return {
|
|
||||||
elements: newElements,
|
|
||||||
finishers: finishers
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = this.decorateConstructor(newElements, decorators);
|
|
||||||
finishers.push.apply(finishers, result.finishers);
|
|
||||||
result.finishers = finishers;
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
addElementPlacement: function addElementPlacement(element, placements, silent) {
|
|
||||||
var keys = placements[element.placement];
|
|
||||||
|
|
||||||
if (!silent && keys.indexOf(element.key) !== -1) {
|
|
||||||
throw new TypeError("Duplicated element (" + element.key + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
keys.push(element.key);
|
|
||||||
},
|
|
||||||
decorateElement: function decorateElement(element, placements) {
|
|
||||||
var extras = [];
|
|
||||||
var finishers = [];
|
|
||||||
|
|
||||||
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
|
|
||||||
var keys = placements[element.placement];
|
|
||||||
keys.splice(keys.indexOf(element.key), 1);
|
|
||||||
var elementObject = this.fromElementDescriptor(element);
|
|
||||||
var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
|
|
||||||
element = elementFinisherExtras.element;
|
|
||||||
this.addElementPlacement(element, placements);
|
|
||||||
|
|
||||||
if (elementFinisherExtras.finisher) {
|
|
||||||
finishers.push(elementFinisherExtras.finisher);
|
|
||||||
}
|
|
||||||
|
|
||||||
var newExtras = elementFinisherExtras.extras;
|
|
||||||
|
|
||||||
if (newExtras) {
|
|
||||||
for (var j = 0; j < newExtras.length; j++) {
|
|
||||||
this.addElementPlacement(newExtras[j], placements);
|
|
||||||
}
|
|
||||||
|
|
||||||
extras.push.apply(extras, newExtras);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
element: element,
|
|
||||||
finishers: finishers,
|
|
||||||
extras: extras
|
|
||||||
};
|
|
||||||
},
|
|
||||||
decorateConstructor: function decorateConstructor(elements, decorators) {
|
|
||||||
var finishers = [];
|
|
||||||
|
|
||||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
||||||
var obj = this.fromClassDescriptor(elements);
|
|
||||||
var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
|
|
||||||
|
|
||||||
if (elementsAndFinisher.finisher !== undefined) {
|
|
||||||
finishers.push(elementsAndFinisher.finisher);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elementsAndFinisher.elements !== undefined) {
|
|
||||||
elements = elementsAndFinisher.elements;
|
|
||||||
|
|
||||||
for (var j = 0; j < elements.length - 1; j++) {
|
|
||||||
for (var k = j + 1; k < elements.length; k++) {
|
|
||||||
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
|
|
||||||
throw new TypeError("Duplicated element (" + elements[j].key + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
elements: elements,
|
|
||||||
finishers: finishers
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fromElementDescriptor: function fromElementDescriptor(element) {
|
|
||||||
var obj = {
|
|
||||||
kind: element.kind,
|
|
||||||
key: element.key,
|
|
||||||
placement: element.placement,
|
|
||||||
descriptor: element.descriptor
|
|
||||||
};
|
|
||||||
var desc = {
|
|
||||||
value: "Descriptor",
|
|
||||||
configurable: true
|
|
||||||
};
|
|
||||||
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
||||||
if (element.kind === "field") obj.initializer = element.initializer;
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
toElementDescriptors: function toElementDescriptors(elementObjects) {
|
|
||||||
if (elementObjects === undefined) return;
|
|
||||||
return toArray(elementObjects).map(function (elementObject) {
|
|
||||||
var element = this.toElementDescriptor(elementObject);
|
|
||||||
this.disallowProperty(elementObject, "finisher", "An element descriptor");
|
|
||||||
this.disallowProperty(elementObject, "extras", "An element descriptor");
|
|
||||||
return element;
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
toElementDescriptor: function toElementDescriptor(elementObject) {
|
|
||||||
var kind = String(elementObject.kind);
|
|
||||||
|
|
||||||
if (kind !== "method" && kind !== "field") {
|
|
||||||
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
var key = toPropertyKey(elementObject.key);
|
|
||||||
var placement = String(elementObject.placement);
|
|
||||||
|
|
||||||
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
|
|
||||||
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = elementObject.descriptor;
|
|
||||||
this.disallowProperty(elementObject, "elements", "An element descriptor");
|
|
||||||
var element = {
|
|
||||||
kind: kind,
|
|
||||||
key: key,
|
|
||||||
placement: placement,
|
|
||||||
descriptor: Object.assign({}, descriptor)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (kind !== "field") {
|
|
||||||
this.disallowProperty(elementObject, "initializer", "A method descriptor");
|
|
||||||
} else {
|
|
||||||
this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
|
|
||||||
this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
|
|
||||||
this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
|
|
||||||
element.initializer = elementObject.initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
|
||||||
},
|
|
||||||
toElementFinisherExtras: function toElementFinisherExtras(elementObject) {
|
|
||||||
var element = this.toElementDescriptor(elementObject);
|
|
||||||
|
|
||||||
var finisher = _optionalCallableProperty(elementObject, "finisher");
|
|
||||||
|
|
||||||
var extras = this.toElementDescriptors(elementObject.extras);
|
|
||||||
return {
|
|
||||||
element: element,
|
|
||||||
finisher: finisher,
|
|
||||||
extras: extras
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fromClassDescriptor: function fromClassDescriptor(elements) {
|
|
||||||
var obj = {
|
|
||||||
kind: "class",
|
|
||||||
elements: elements.map(this.fromElementDescriptor, this)
|
|
||||||
};
|
|
||||||
var desc = {
|
|
||||||
value: "Descriptor",
|
|
||||||
configurable: true
|
|
||||||
};
|
|
||||||
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
toClassDescriptor: function toClassDescriptor(obj) {
|
|
||||||
var kind = String(obj.kind);
|
|
||||||
|
|
||||||
if (kind !== "class") {
|
|
||||||
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.disallowProperty(obj, "key", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "placement", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "descriptor", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "initializer", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "extras", "A class descriptor");
|
|
||||||
|
|
||||||
var finisher = _optionalCallableProperty(obj, "finisher");
|
|
||||||
|
|
||||||
var elements = this.toElementDescriptors(obj.elements);
|
|
||||||
return {
|
|
||||||
elements: elements,
|
|
||||||
finisher: finisher
|
|
||||||
};
|
|
||||||
},
|
|
||||||
runClassFinishers: function runClassFinishers(constructor, finishers) {
|
|
||||||
for (var i = 0; i < finishers.length; i++) {
|
|
||||||
var newConstructor = (0, finishers[i])(constructor);
|
|
||||||
|
|
||||||
if (newConstructor !== undefined) {
|
|
||||||
if (typeof newConstructor !== "function") {
|
|
||||||
throw new TypeError("Finishers must return a constructor.");
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor = newConstructor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return constructor;
|
|
||||||
},
|
|
||||||
disallowProperty: function disallowProperty(obj, name, objectType) {
|
|
||||||
if (obj[name] !== undefined) {
|
|
||||||
throw new TypeError(objectType + " can't have a ." + name + " property.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return api;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _createElementDescriptor(def) {
|
|
||||||
var key = toPropertyKey(def.key);
|
|
||||||
var descriptor;
|
|
||||||
|
|
||||||
if (def.kind === "method") {
|
|
||||||
descriptor = {
|
|
||||||
value: def.value,
|
|
||||||
writable: true,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "get") {
|
|
||||||
descriptor = {
|
|
||||||
get: def.value,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "set") {
|
|
||||||
descriptor = {
|
|
||||||
set: def.value,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "field") {
|
|
||||||
descriptor = {
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
enumerable: true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var element = {
|
|
||||||
kind: def.kind === "field" ? "field" : "method",
|
|
||||||
key: key,
|
|
||||||
placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype",
|
|
||||||
descriptor: descriptor
|
|
||||||
};
|
|
||||||
if (def.decorators) element.decorators = def.decorators;
|
|
||||||
if (def.kind === "field") element.initializer = def.value;
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _coalesceGetterSetter(element, other) {
|
|
||||||
if (element.descriptor.get !== undefined) {
|
|
||||||
other.descriptor.get = element.descriptor.get;
|
|
||||||
} else {
|
|
||||||
other.descriptor.set = element.descriptor.set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _coalesceClassElements(elements) {
|
|
||||||
var newElements = [];
|
|
||||||
|
|
||||||
var isSameElement = function isSameElement(other) {
|
|
||||||
return other.kind === "method" && other.key === element.key && other.placement === element.placement;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i = 0; i < elements.length; i++) {
|
|
||||||
var element = elements[i];
|
|
||||||
var other;
|
|
||||||
|
|
||||||
if (element.kind === "method" && (other = newElements.find(isSameElement))) {
|
|
||||||
if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
|
|
||||||
if (_hasDecorators(element) || _hasDecorators(other)) {
|
|
||||||
throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
|
|
||||||
}
|
|
||||||
|
|
||||||
other.descriptor = element.descriptor;
|
|
||||||
} else {
|
|
||||||
if (_hasDecorators(element)) {
|
|
||||||
if (_hasDecorators(other)) {
|
|
||||||
throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
|
|
||||||
}
|
|
||||||
|
|
||||||
other.decorators = element.decorators;
|
|
||||||
}
|
|
||||||
|
|
||||||
_coalesceGetterSetter(element, other);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newElements.push(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newElements;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _hasDecorators(element) {
|
|
||||||
return element.decorators && element.decorators.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _isDataDescriptor(desc) {
|
|
||||||
return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _optionalCallableProperty(obj, name) {
|
|
||||||
var value = obj[name];
|
|
||||||
|
|
||||||
if (value !== undefined && typeof value !== "function") {
|
|
||||||
throw new TypeError("Expected '" + name + "' to be a function");
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _decorate;
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
function _defaults(obj, defaults) {
|
|
||||||
var keys = Object.getOwnPropertyNames(defaults);
|
|
||||||
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
var key = keys[i];
|
|
||||||
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
||||||
|
|
||||||
if (value && value.configurable && obj[key] === undefined) {
|
|
||||||
Object.defineProperty(obj, key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _defaults;
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
function _defineEnumerableProperties(obj, descs) {
|
|
||||||
for (var key in descs) {
|
|
||||||
var desc = descs[key];
|
|
||||||
desc.configurable = desc.enumerable = true;
|
|
||||||
if ("value" in desc) desc.writable = true;
|
|
||||||
Object.defineProperty(obj, key, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.getOwnPropertySymbols) {
|
|
||||||
var objectSymbols = Object.getOwnPropertySymbols(descs);
|
|
||||||
|
|
||||||
for (var i = 0; i < objectSymbols.length; i++) {
|
|
||||||
var sym = objectSymbols[i];
|
|
||||||
var desc = descs[sym];
|
|
||||||
desc.configurable = desc.enumerable = true;
|
|
||||||
if ("value" in desc) desc.writable = true;
|
|
||||||
Object.defineProperty(obj, sym, desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _defineEnumerableProperties;
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
function _defineProperty(obj, key, value) {
|
|
||||||
if (key in obj) {
|
|
||||||
Object.defineProperty(obj, key, {
|
|
||||||
value: value,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
obj[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = _defineProperty;
|
|
||||||
-97
@@ -1,97 +0,0 @@
|
|||||||
import AwaitValue from "./AwaitValue";
|
|
||||||
export default function AsyncGenerator(gen) {
|
|
||||||
var front, back;
|
|
||||||
|
|
||||||
function send(key, arg) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var request = {
|
|
||||||
key: key,
|
|
||||||
arg: arg,
|
|
||||||
resolve: resolve,
|
|
||||||
reject: reject,
|
|
||||||
next: null
|
|
||||||
};
|
|
||||||
|
|
||||||
if (back) {
|
|
||||||
back = back.next = request;
|
|
||||||
} else {
|
|
||||||
front = back = request;
|
|
||||||
resume(key, arg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function resume(key, arg) {
|
|
||||||
try {
|
|
||||||
var result = gen[key](arg);
|
|
||||||
var value = result.value;
|
|
||||||
var wrappedAwait = value instanceof AwaitValue;
|
|
||||||
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
|
|
||||||
if (wrappedAwait) {
|
|
||||||
resume("next", arg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
settle(result.done ? "return" : "normal", arg);
|
|
||||||
}, function (err) {
|
|
||||||
resume("throw", err);
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
settle("throw", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function settle(type, value) {
|
|
||||||
switch (type) {
|
|
||||||
case "return":
|
|
||||||
front.resolve({
|
|
||||||
value: value,
|
|
||||||
done: true
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "throw":
|
|
||||||
front.reject(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
front.resolve({
|
|
||||||
value: value,
|
|
||||||
done: false
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
front = front.next;
|
|
||||||
|
|
||||||
if (front) {
|
|
||||||
resume(front.key, front.arg);
|
|
||||||
} else {
|
|
||||||
back = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._invoke = send;
|
|
||||||
|
|
||||||
if (typeof gen["return"] !== "function") {
|
|
||||||
this["return"] = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
|
||||||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
AsyncGenerator.prototype.next = function (arg) {
|
|
||||||
return this._invoke("next", arg);
|
|
||||||
};
|
|
||||||
|
|
||||||
AsyncGenerator.prototype["throw"] = function (arg) {
|
|
||||||
return this._invoke("throw", arg);
|
|
||||||
};
|
|
||||||
|
|
||||||
AsyncGenerator.prototype["return"] = function (arg) {
|
|
||||||
return this._invoke("return", arg);
|
|
||||||
};
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export default function _AwaitValue(value) {
|
|
||||||
this.wrapped = value;
|
|
||||||
}
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
||||||
var desc = {};
|
|
||||||
Object.keys(descriptor).forEach(function (key) {
|
|
||||||
desc[key] = descriptor[key];
|
|
||||||
});
|
|
||||||
desc.enumerable = !!desc.enumerable;
|
|
||||||
desc.configurable = !!desc.configurable;
|
|
||||||
|
|
||||||
if ('value' in desc || desc.initializer) {
|
|
||||||
desc.writable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
||||||
return decorator(target, property, desc) || desc;
|
|
||||||
}, desc);
|
|
||||||
|
|
||||||
if (context && desc.initializer !== void 0) {
|
|
||||||
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
||||||
desc.initializer = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desc.initializer === void 0) {
|
|
||||||
Object.defineProperty(target, property, desc);
|
|
||||||
desc = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export default function _arrayWithHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) return arr;
|
|
||||||
}
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
export default function _arrayWithoutHoles(arr) {
|
|
||||||
if (Array.isArray(arr)) {
|
|
||||||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
|
||||||
arr2[i] = arr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
export default function _assertThisInitialized(self) {
|
|
||||||
if (self === void 0) {
|
|
||||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
-51
@@ -1,51 +0,0 @@
|
|||||||
export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
||||||
var iter = {},
|
|
||||||
waiting = false;
|
|
||||||
|
|
||||||
function pump(key, value) {
|
|
||||||
waiting = true;
|
|
||||||
value = new Promise(function (resolve) {
|
|
||||||
resolve(inner[key](value));
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
done: false,
|
|
||||||
value: awaitWrap(value)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
if (typeof Symbol === "function" && Symbol.iterator) {
|
|
||||||
iter[Symbol.iterator] = function () {
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
iter.next = function (value) {
|
|
||||||
if (waiting) {
|
|
||||||
waiting = false;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pump("next", value);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof inner["throw"] === "function") {
|
|
||||||
iter["throw"] = function (value) {
|
|
||||||
if (waiting) {
|
|
||||||
waiting = false;
|
|
||||||
throw value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pump("throw", value);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof inner["return"] === "function") {
|
|
||||||
iter["return"] = function (value) {
|
|
||||||
return pump("return", value);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return iter;
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
export default function _asyncIterator(iterable) {
|
|
||||||
var method;
|
|
||||||
|
|
||||||
if (typeof Symbol !== "undefined") {
|
|
||||||
if (Symbol.asyncIterator) {
|
|
||||||
method = iterable[Symbol.asyncIterator];
|
|
||||||
if (method != null) return method.call(iterable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Symbol.iterator) {
|
|
||||||
method = iterable[Symbol.iterator];
|
|
||||||
if (method != null) return method.call(iterable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new TypeError("Object is not async iterable");
|
|
||||||
}
|
|
||||||
-35
@@ -1,35 +0,0 @@
|
|||||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
||||||
try {
|
|
||||||
var info = gen[key](arg);
|
|
||||||
var value = info.value;
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.done) {
|
|
||||||
resolve(value);
|
|
||||||
} else {
|
|
||||||
Promise.resolve(value).then(_next, _throw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function _asyncToGenerator(fn) {
|
|
||||||
return function () {
|
|
||||||
var self = this,
|
|
||||||
args = arguments;
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var gen = fn.apply(self, args);
|
|
||||||
|
|
||||||
function _next(value) {
|
|
||||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _throw(err) {
|
|
||||||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
_next(undefined);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
import AwaitValue from "./AwaitValue";
|
|
||||||
export default function _awaitAsyncGenerator(value) {
|
|
||||||
return new AwaitValue(value);
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
export default function _classCallCheck(instance, Constructor) {
|
|
||||||
if (!(instance instanceof Constructor)) {
|
|
||||||
throw new TypeError("Cannot call a class as a function");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export default function _classNameTDZError(name) {
|
|
||||||
throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys.");
|
|
||||||
}
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
export default function _classPrivateFieldDestructureSet(receiver, privateMap) {
|
|
||||||
if (!privateMap.has(receiver)) {
|
|
||||||
throw new TypeError("attempted to set private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
if (!("__destrObj" in descriptor)) {
|
|
||||||
descriptor.__destrObj = {
|
|
||||||
set value(v) {
|
|
||||||
descriptor.set.call(receiver, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.__destrObj;
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
export default function _classPrivateFieldGet(receiver, privateMap) {
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError("attempted to get private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.get) {
|
|
||||||
return descriptor.get.call(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
export default function _classPrivateFieldBase(receiver, privateKey) {
|
|
||||||
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
||||||
throw new TypeError("attempted to use private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return receiver;
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
var id = 0;
|
|
||||||
export default function _classPrivateFieldKey(name) {
|
|
||||||
return "__private_" + id++ + "_" + name;
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
export default function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
||||||
var descriptor = privateMap.get(receiver);
|
|
||||||
|
|
||||||
if (!descriptor) {
|
|
||||||
throw new TypeError("attempted to set private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
descriptor.set.call(receiver, value);
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptor.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
export default function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
||||||
if (!privateSet.has(receiver)) {
|
|
||||||
throw new TypeError("attempted to get private field on non-instance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return fn;
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export default function _classPrivateMethodSet() {
|
|
||||||
throw new TypeError("attempted to reassign private method");
|
|
||||||
}
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.get) {
|
|
||||||
return descriptor.get.call(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return descriptor.value;
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor.set) {
|
|
||||||
descriptor.set.call(receiver, value);
|
|
||||||
} else {
|
|
||||||
if (!descriptor.writable) {
|
|
||||||
throw new TypeError("attempted to set read only private field");
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptor.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
|
|
||||||
if (receiver !== classConstructor) {
|
|
||||||
throw new TypeError("Private static access of wrong provenance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export default function _classStaticPrivateMethodSet() {
|
|
||||||
throw new TypeError("attempted to set read only static private field");
|
|
||||||
}
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
import setPrototypeOf from "./setPrototypeOf";
|
|
||||||
|
|
||||||
function isNativeReflectConstruct() {
|
|
||||||
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
||||||
if (Reflect.construct.sham) return false;
|
|
||||||
if (typeof Proxy === "function") return true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function _construct(Parent, args, Class) {
|
|
||||||
if (isNativeReflectConstruct()) {
|
|
||||||
_construct = Reflect.construct;
|
|
||||||
} else {
|
|
||||||
_construct = function _construct(Parent, args, Class) {
|
|
||||||
var a = [null];
|
|
||||||
a.push.apply(a, args);
|
|
||||||
var Constructor = Function.bind.apply(Parent, a);
|
|
||||||
var instance = new Constructor();
|
|
||||||
if (Class) setPrototypeOf(instance, Class.prototype);
|
|
||||||
return instance;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return _construct.apply(null, arguments);
|
|
||||||
}
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
function _defineProperties(target, props) {
|
|
||||||
for (var i = 0; i < props.length; i++) {
|
|
||||||
var descriptor = props[i];
|
|
||||||
descriptor.enumerable = descriptor.enumerable || false;
|
|
||||||
descriptor.configurable = true;
|
|
||||||
if ("value" in descriptor) descriptor.writable = true;
|
|
||||||
Object.defineProperty(target, descriptor.key, descriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function _createClass(Constructor, protoProps, staticProps) {
|
|
||||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
||||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
||||||
return Constructor;
|
|
||||||
}
|
|
||||||
-396
@@ -1,396 +0,0 @@
|
|||||||
import toArray from "./toArray";
|
|
||||||
import toPropertyKey from "./toPropertyKey";
|
|
||||||
export default function _decorate(decorators, factory, superClass, mixins) {
|
|
||||||
var api = _getDecoratorsApi();
|
|
||||||
|
|
||||||
if (mixins) {
|
|
||||||
for (var i = 0; i < mixins.length; i++) {
|
|
||||||
api = mixins[i](api);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var r = factory(function initialize(O) {
|
|
||||||
api.initializeInstanceElements(O, decorated.elements);
|
|
||||||
}, superClass);
|
|
||||||
var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
|
|
||||||
api.initializeClassElements(r.F, decorated.elements);
|
|
||||||
return api.runClassFinishers(r.F, decorated.finishers);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _getDecoratorsApi() {
|
|
||||||
_getDecoratorsApi = function _getDecoratorsApi() {
|
|
||||||
return api;
|
|
||||||
};
|
|
||||||
|
|
||||||
var api = {
|
|
||||||
elementsDefinitionOrder: [["method"], ["field"]],
|
|
||||||
initializeInstanceElements: function initializeInstanceElements(O, elements) {
|
|
||||||
["method", "field"].forEach(function (kind) {
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
if (element.kind === kind && element.placement === "own") {
|
|
||||||
this.defineClassElement(O, element);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
initializeClassElements: function initializeClassElements(F, elements) {
|
|
||||||
var proto = F.prototype;
|
|
||||||
["method", "field"].forEach(function (kind) {
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
var placement = element.placement;
|
|
||||||
|
|
||||||
if (element.kind === kind && (placement === "static" || placement === "prototype")) {
|
|
||||||
var receiver = placement === "static" ? F : proto;
|
|
||||||
this.defineClassElement(receiver, element);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
defineClassElement: function defineClassElement(receiver, element) {
|
|
||||||
var descriptor = element.descriptor;
|
|
||||||
|
|
||||||
if (element.kind === "field") {
|
|
||||||
var initializer = element.initializer;
|
|
||||||
descriptor = {
|
|
||||||
enumerable: descriptor.enumerable,
|
|
||||||
writable: descriptor.writable,
|
|
||||||
configurable: descriptor.configurable,
|
|
||||||
value: initializer === void 0 ? void 0 : initializer.call(receiver)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.defineProperty(receiver, element.key, descriptor);
|
|
||||||
},
|
|
||||||
decorateClass: function decorateClass(elements, decorators) {
|
|
||||||
var newElements = [];
|
|
||||||
var finishers = [];
|
|
||||||
var placements = {
|
|
||||||
"static": [],
|
|
||||||
prototype: [],
|
|
||||||
own: []
|
|
||||||
};
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
this.addElementPlacement(element, placements);
|
|
||||||
}, this);
|
|
||||||
elements.forEach(function (element) {
|
|
||||||
if (!_hasDecorators(element)) return newElements.push(element);
|
|
||||||
var elementFinishersExtras = this.decorateElement(element, placements);
|
|
||||||
newElements.push(elementFinishersExtras.element);
|
|
||||||
newElements.push.apply(newElements, elementFinishersExtras.extras);
|
|
||||||
finishers.push.apply(finishers, elementFinishersExtras.finishers);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
if (!decorators) {
|
|
||||||
return {
|
|
||||||
elements: newElements,
|
|
||||||
finishers: finishers
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = this.decorateConstructor(newElements, decorators);
|
|
||||||
finishers.push.apply(finishers, result.finishers);
|
|
||||||
result.finishers = finishers;
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
addElementPlacement: function addElementPlacement(element, placements, silent) {
|
|
||||||
var keys = placements[element.placement];
|
|
||||||
|
|
||||||
if (!silent && keys.indexOf(element.key) !== -1) {
|
|
||||||
throw new TypeError("Duplicated element (" + element.key + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
keys.push(element.key);
|
|
||||||
},
|
|
||||||
decorateElement: function decorateElement(element, placements) {
|
|
||||||
var extras = [];
|
|
||||||
var finishers = [];
|
|
||||||
|
|
||||||
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
|
|
||||||
var keys = placements[element.placement];
|
|
||||||
keys.splice(keys.indexOf(element.key), 1);
|
|
||||||
var elementObject = this.fromElementDescriptor(element);
|
|
||||||
var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
|
|
||||||
element = elementFinisherExtras.element;
|
|
||||||
this.addElementPlacement(element, placements);
|
|
||||||
|
|
||||||
if (elementFinisherExtras.finisher) {
|
|
||||||
finishers.push(elementFinisherExtras.finisher);
|
|
||||||
}
|
|
||||||
|
|
||||||
var newExtras = elementFinisherExtras.extras;
|
|
||||||
|
|
||||||
if (newExtras) {
|
|
||||||
for (var j = 0; j < newExtras.length; j++) {
|
|
||||||
this.addElementPlacement(newExtras[j], placements);
|
|
||||||
}
|
|
||||||
|
|
||||||
extras.push.apply(extras, newExtras);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
element: element,
|
|
||||||
finishers: finishers,
|
|
||||||
extras: extras
|
|
||||||
};
|
|
||||||
},
|
|
||||||
decorateConstructor: function decorateConstructor(elements, decorators) {
|
|
||||||
var finishers = [];
|
|
||||||
|
|
||||||
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
||||||
var obj = this.fromClassDescriptor(elements);
|
|
||||||
var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
|
|
||||||
|
|
||||||
if (elementsAndFinisher.finisher !== undefined) {
|
|
||||||
finishers.push(elementsAndFinisher.finisher);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elementsAndFinisher.elements !== undefined) {
|
|
||||||
elements = elementsAndFinisher.elements;
|
|
||||||
|
|
||||||
for (var j = 0; j < elements.length - 1; j++) {
|
|
||||||
for (var k = j + 1; k < elements.length; k++) {
|
|
||||||
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
|
|
||||||
throw new TypeError("Duplicated element (" + elements[j].key + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
elements: elements,
|
|
||||||
finishers: finishers
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fromElementDescriptor: function fromElementDescriptor(element) {
|
|
||||||
var obj = {
|
|
||||||
kind: element.kind,
|
|
||||||
key: element.key,
|
|
||||||
placement: element.placement,
|
|
||||||
descriptor: element.descriptor
|
|
||||||
};
|
|
||||||
var desc = {
|
|
||||||
value: "Descriptor",
|
|
||||||
configurable: true
|
|
||||||
};
|
|
||||||
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
||||||
if (element.kind === "field") obj.initializer = element.initializer;
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
toElementDescriptors: function toElementDescriptors(elementObjects) {
|
|
||||||
if (elementObjects === undefined) return;
|
|
||||||
return toArray(elementObjects).map(function (elementObject) {
|
|
||||||
var element = this.toElementDescriptor(elementObject);
|
|
||||||
this.disallowProperty(elementObject, "finisher", "An element descriptor");
|
|
||||||
this.disallowProperty(elementObject, "extras", "An element descriptor");
|
|
||||||
return element;
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
toElementDescriptor: function toElementDescriptor(elementObject) {
|
|
||||||
var kind = String(elementObject.kind);
|
|
||||||
|
|
||||||
if (kind !== "method" && kind !== "field") {
|
|
||||||
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
var key = toPropertyKey(elementObject.key);
|
|
||||||
var placement = String(elementObject.placement);
|
|
||||||
|
|
||||||
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
|
|
||||||
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
var descriptor = elementObject.descriptor;
|
|
||||||
this.disallowProperty(elementObject, "elements", "An element descriptor");
|
|
||||||
var element = {
|
|
||||||
kind: kind,
|
|
||||||
key: key,
|
|
||||||
placement: placement,
|
|
||||||
descriptor: Object.assign({}, descriptor)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (kind !== "field") {
|
|
||||||
this.disallowProperty(elementObject, "initializer", "A method descriptor");
|
|
||||||
} else {
|
|
||||||
this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
|
|
||||||
this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
|
|
||||||
this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
|
|
||||||
element.initializer = elementObject.initializer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
|
||||||
},
|
|
||||||
toElementFinisherExtras: function toElementFinisherExtras(elementObject) {
|
|
||||||
var element = this.toElementDescriptor(elementObject);
|
|
||||||
|
|
||||||
var finisher = _optionalCallableProperty(elementObject, "finisher");
|
|
||||||
|
|
||||||
var extras = this.toElementDescriptors(elementObject.extras);
|
|
||||||
return {
|
|
||||||
element: element,
|
|
||||||
finisher: finisher,
|
|
||||||
extras: extras
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fromClassDescriptor: function fromClassDescriptor(elements) {
|
|
||||||
var obj = {
|
|
||||||
kind: "class",
|
|
||||||
elements: elements.map(this.fromElementDescriptor, this)
|
|
||||||
};
|
|
||||||
var desc = {
|
|
||||||
value: "Descriptor",
|
|
||||||
configurable: true
|
|
||||||
};
|
|
||||||
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
toClassDescriptor: function toClassDescriptor(obj) {
|
|
||||||
var kind = String(obj.kind);
|
|
||||||
|
|
||||||
if (kind !== "class") {
|
|
||||||
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.disallowProperty(obj, "key", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "placement", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "descriptor", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "initializer", "A class descriptor");
|
|
||||||
this.disallowProperty(obj, "extras", "A class descriptor");
|
|
||||||
|
|
||||||
var finisher = _optionalCallableProperty(obj, "finisher");
|
|
||||||
|
|
||||||
var elements = this.toElementDescriptors(obj.elements);
|
|
||||||
return {
|
|
||||||
elements: elements,
|
|
||||||
finisher: finisher
|
|
||||||
};
|
|
||||||
},
|
|
||||||
runClassFinishers: function runClassFinishers(constructor, finishers) {
|
|
||||||
for (var i = 0; i < finishers.length; i++) {
|
|
||||||
var newConstructor = (0, finishers[i])(constructor);
|
|
||||||
|
|
||||||
if (newConstructor !== undefined) {
|
|
||||||
if (typeof newConstructor !== "function") {
|
|
||||||
throw new TypeError("Finishers must return a constructor.");
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor = newConstructor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return constructor;
|
|
||||||
},
|
|
||||||
disallowProperty: function disallowProperty(obj, name, objectType) {
|
|
||||||
if (obj[name] !== undefined) {
|
|
||||||
throw new TypeError(objectType + " can't have a ." + name + " property.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return api;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _createElementDescriptor(def) {
|
|
||||||
var key = toPropertyKey(def.key);
|
|
||||||
var descriptor;
|
|
||||||
|
|
||||||
if (def.kind === "method") {
|
|
||||||
descriptor = {
|
|
||||||
value: def.value,
|
|
||||||
writable: true,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "get") {
|
|
||||||
descriptor = {
|
|
||||||
get: def.value,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "set") {
|
|
||||||
descriptor = {
|
|
||||||
set: def.value,
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false
|
|
||||||
};
|
|
||||||
} else if (def.kind === "field") {
|
|
||||||
descriptor = {
|
|
||||||
configurable: true,
|
|
||||||
writable: true,
|
|
||||||
enumerable: true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var element = {
|
|
||||||
kind: def.kind === "field" ? "field" : "method",
|
|
||||||
key: key,
|
|
||||||
placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype",
|
|
||||||
descriptor: descriptor
|
|
||||||
};
|
|
||||||
if (def.decorators) element.decorators = def.decorators;
|
|
||||||
if (def.kind === "field") element.initializer = def.value;
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _coalesceGetterSetter(element, other) {
|
|
||||||
if (element.descriptor.get !== undefined) {
|
|
||||||
other.descriptor.get = element.descriptor.get;
|
|
||||||
} else {
|
|
||||||
other.descriptor.set = element.descriptor.set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _coalesceClassElements(elements) {
|
|
||||||
var newElements = [];
|
|
||||||
|
|
||||||
var isSameElement = function isSameElement(other) {
|
|
||||||
return other.kind === "method" && other.key === element.key && other.placement === element.placement;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i = 0; i < elements.length; i++) {
|
|
||||||
var element = elements[i];
|
|
||||||
var other;
|
|
||||||
|
|
||||||
if (element.kind === "method" && (other = newElements.find(isSameElement))) {
|
|
||||||
if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
|
|
||||||
if (_hasDecorators(element) || _hasDecorators(other)) {
|
|
||||||
throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
|
|
||||||
}
|
|
||||||
|
|
||||||
other.descriptor = element.descriptor;
|
|
||||||
} else {
|
|
||||||
if (_hasDecorators(element)) {
|
|
||||||
if (_hasDecorators(other)) {
|
|
||||||
throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
|
|
||||||
}
|
|
||||||
|
|
||||||
other.decorators = element.decorators;
|
|
||||||
}
|
|
||||||
|
|
||||||
_coalesceGetterSetter(element, other);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newElements.push(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newElements;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _hasDecorators(element) {
|
|
||||||
return element.decorators && element.decorators.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _isDataDescriptor(desc) {
|
|
||||||
return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _optionalCallableProperty(obj, name) {
|
|
||||||
var value = obj[name];
|
|
||||||
|
|
||||||
if (value !== undefined && typeof value !== "function") {
|
|
||||||
throw new TypeError("Expected '" + name + "' to be a function");
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
export default function _defaults(obj, defaults) {
|
|
||||||
var keys = Object.getOwnPropertyNames(defaults);
|
|
||||||
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
|
||||||
var key = keys[i];
|
|
||||||
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
||||||
|
|
||||||
if (value && value.configurable && obj[key] === undefined) {
|
|
||||||
Object.defineProperty(obj, key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
export default function _defineEnumerableProperties(obj, descs) {
|
|
||||||
for (var key in descs) {
|
|
||||||
var desc = descs[key];
|
|
||||||
desc.configurable = desc.enumerable = true;
|
|
||||||
if ("value" in desc) desc.writable = true;
|
|
||||||
Object.defineProperty(obj, key, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.getOwnPropertySymbols) {
|
|
||||||
var objectSymbols = Object.getOwnPropertySymbols(descs);
|
|
||||||
|
|
||||||
for (var i = 0; i < objectSymbols.length; i++) {
|
|
||||||
var sym = objectSymbols[i];
|
|
||||||
var desc = descs[sym];
|
|
||||||
desc.configurable = desc.enumerable = true;
|
|
||||||
if ("value" in desc) desc.writable = true;
|
|
||||||
Object.defineProperty(obj, sym, desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
export default function _defineProperty(obj, key, value) {
|
|
||||||
if (key in obj) {
|
|
||||||
Object.defineProperty(obj, key, {
|
|
||||||
value: value,
|
|
||||||
enumerable: true,
|
|
||||||
configurable: true,
|
|
||||||
writable: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
obj[key] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
export default function _extends() {
|
|
||||||
_extends = Object.assign || function (target) {
|
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
|
||||||
var source = arguments[i];
|
|
||||||
|
|
||||||
for (var key in source) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return target;
|
|
||||||
};
|
|
||||||
|
|
||||||
return _extends.apply(this, arguments);
|
|
||||||
}
|
|
||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
import superPropBase from "./superPropBase";
|
|
||||||
export default function _get(target, property, receiver) {
|
|
||||||
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
||||||
_get = Reflect.get;
|
|
||||||
} else {
|
|
||||||
_get = function _get(target, property, receiver) {
|
|
||||||
var base = superPropBase(target, property);
|
|
||||||
if (!base) return;
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
||||||
|
|
||||||
if (desc.get) {
|
|
||||||
return desc.get.call(receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc.value;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return _get(target, property, receiver || target);
|
|
||||||
}
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
export default function _getPrototypeOf(o) {
|
|
||||||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
||||||
return o.__proto__ || Object.getPrototypeOf(o);
|
|
||||||
};
|
|
||||||
return _getPrototypeOf(o);
|
|
||||||
}
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
import setPrototypeOf from "./setPrototypeOf";
|
|
||||||
export default function _inherits(subClass, superClass) {
|
|
||||||
if (typeof superClass !== "function" && superClass !== null) {
|
|
||||||
throw new TypeError("Super expression must either be null or a function");
|
|
||||||
}
|
|
||||||
|
|
||||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
||||||
constructor: {
|
|
||||||
value: subClass,
|
|
||||||
writable: true,
|
|
||||||
configurable: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (superClass) setPrototypeOf(subClass, superClass);
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
export default function _inheritsLoose(subClass, superClass) {
|
|
||||||
subClass.prototype = Object.create(superClass.prototype);
|
|
||||||
subClass.prototype.constructor = subClass;
|
|
||||||
subClass.__proto__ = superClass;
|
|
||||||
}
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
export default function _initializerDefineProperty(target, property, descriptor, context) {
|
|
||||||
if (!descriptor) return;
|
|
||||||
Object.defineProperty(target, property, {
|
|
||||||
enumerable: descriptor.enumerable,
|
|
||||||
configurable: descriptor.configurable,
|
|
||||||
writable: descriptor.writable,
|
|
||||||
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user