flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
21
BACK_BACK/node_modules/@parcel/logger/LICENSE
generated
vendored
Executable file
21
BACK_BACK/node_modules/@parcel/logger/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017-present Devon Govett
|
||||
|
||||
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.
|
||||
5
BACK_BACK/node_modules/@parcel/logger/index.js
generated
vendored
Executable file
5
BACK_BACK/node_modules/@parcel/logger/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
// Node 8 supports native async functions - no need to use compiled code!
|
||||
module.exports =
|
||||
parseInt(process.versions.node, 10) < 8
|
||||
? require('./lib/Logger')
|
||||
: require('./src/Logger');
|
||||
38
BACK_BACK/node_modules/@parcel/logger/package.json
generated
vendored
Executable file
38
BACK_BACK/node_modules/@parcel/logger/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "@parcel/logger",
|
||||
"version": "1.11.1",
|
||||
"description": "Blazing fast, zero configuration web application bundler",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/parcel-bundler/parcel.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cross-env NODE_ENV=test mocha",
|
||||
"test-ci": "yarn build && yarn test",
|
||||
"format": "prettier --write \"./{src,bin,test}/**/*.{js,json,md}\"",
|
||||
"lint": "eslint . && prettier \"./{src,bin,test}/**/*.{js,json,md}\" --list-different",
|
||||
"build": "babel src -d lib",
|
||||
"prepublish": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@parcel/workers": "^1.11.0",
|
||||
"chalk": "^2.1.0",
|
||||
"grapheme-breaker": "^0.3.2",
|
||||
"ora": "^2.1.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/babel-register": "^1.11.1",
|
||||
"mocha": "^5.2.0",
|
||||
"sinon": "^5.0.1"
|
||||
},
|
||||
"gitHead": "d9ec7af22f85134dc1a97fe00f35950f2fe1f57a"
|
||||
}
|
||||
8
BACK_BACK/node_modules/@parcel/logger/src/.babelrc
generated
vendored
Executable file
8
BACK_BACK/node_modules/@parcel/logger/src/.babelrc
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"presets": [["@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": "6"
|
||||
}
|
||||
}]],
|
||||
"plugins": ["@babel/plugin-transform-runtime"]
|
||||
}
|
||||
3
BACK_BACK/node_modules/@parcel/logger/src/.eslintrc.json
generated
vendored
Executable file
3
BACK_BACK/node_modules/@parcel/logger/src/.eslintrc.json
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../../../.eslintrc.json"
|
||||
}
|
||||
248
BACK_BACK/node_modules/@parcel/logger/src/Logger.js
generated
vendored
Executable file
248
BACK_BACK/node_modules/@parcel/logger/src/Logger.js
generated
vendored
Executable file
|
|
@ -0,0 +1,248 @@
|
|||
const chalk = require('chalk');
|
||||
const readline = require('readline');
|
||||
const prettyError = require('./prettyError');
|
||||
const emoji = require('./emoji');
|
||||
const {countBreaks} = require('grapheme-breaker');
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const ora = require('ora');
|
||||
const WorkerFarm = require('@parcel/workers');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
class Logger {
|
||||
constructor(options) {
|
||||
this.lines = 0;
|
||||
this.spinner = null;
|
||||
this.setOptions(options);
|
||||
}
|
||||
|
||||
setOptions(options) {
|
||||
this.logLevel =
|
||||
options && isNaN(options.logLevel) === false
|
||||
? Number(options.logLevel)
|
||||
: 3;
|
||||
this.color =
|
||||
options && typeof options.color === 'boolean'
|
||||
? options.color
|
||||
: chalk.supportsColor;
|
||||
this.emoji = (options && options.emoji) || emoji;
|
||||
this.chalk = new chalk.constructor({enabled: this.color});
|
||||
this.isTest =
|
||||
options && typeof options.isTest === 'boolean'
|
||||
? options.isTest
|
||||
: process.env.NODE_ENV === 'test';
|
||||
}
|
||||
|
||||
countLines(message) {
|
||||
return stripAnsi(message)
|
||||
.split('\n')
|
||||
.reduce((p, line) => {
|
||||
if (process.stdout.columns) {
|
||||
return p + Math.ceil((line.length || 1) / process.stdout.columns);
|
||||
}
|
||||
|
||||
return p + 1;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
writeRaw(message) {
|
||||
this.stopSpinner();
|
||||
|
||||
this.lines += this.countLines(message) - 1;
|
||||
process.stdout.write(message);
|
||||
}
|
||||
|
||||
write(message, persistent = false) {
|
||||
if (this.logLevel > 3) {
|
||||
return this.verbose(message);
|
||||
}
|
||||
|
||||
if (!persistent) {
|
||||
this.lines += this.countLines(message);
|
||||
}
|
||||
|
||||
this.stopSpinner();
|
||||
this._log(message);
|
||||
}
|
||||
|
||||
verbose(message) {
|
||||
if (this.logLevel < 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
let currDate = new Date();
|
||||
message = `[${currDate.toLocaleTimeString()}]: ${message}`;
|
||||
if (this.logLevel > 4) {
|
||||
if (!this.logFile) {
|
||||
this.logFile = fs.createWriteStream(
|
||||
path.join(process.cwd(), `parcel-debug-${currDate.toISOString()}.log`)
|
||||
);
|
||||
}
|
||||
this.logFile.write(stripAnsi(message) + '\n');
|
||||
}
|
||||
this._log(message);
|
||||
}
|
||||
|
||||
log(message) {
|
||||
if (this.logLevel < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.write(message);
|
||||
}
|
||||
|
||||
persistent(message) {
|
||||
if (this.logLevel < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.write(this.chalk.bold(message), true);
|
||||
}
|
||||
|
||||
warn(err) {
|
||||
if (this.logLevel < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._writeError(err, this.emoji.warning, this.chalk.yellow);
|
||||
}
|
||||
|
||||
error(err) {
|
||||
if (this.logLevel < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._writeError(err, this.emoji.error, this.chalk.red.bold);
|
||||
}
|
||||
|
||||
success(message) {
|
||||
this.log(`${this.emoji.success} ${this.chalk.green.bold(message)}`);
|
||||
}
|
||||
|
||||
formatError(err, opts) {
|
||||
return prettyError(err, opts);
|
||||
}
|
||||
|
||||
_writeError(err, emoji, color) {
|
||||
let {message, stack} = this.formatError(err, {color: this.color});
|
||||
this.write(color(`${emoji} ${message}`));
|
||||
if (stack) {
|
||||
this.write(stack);
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
if (!this.color || this.isTest || this.logLevel > 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (this.lines > 0) {
|
||||
readline.clearLine(process.stdout, 0);
|
||||
readline.moveCursor(process.stdout, 0, -1);
|
||||
this.lines--;
|
||||
}
|
||||
|
||||
readline.cursorTo(process.stdout, 0);
|
||||
this.stopSpinner();
|
||||
}
|
||||
|
||||
progress(message) {
|
||||
if (this.logLevel < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.logLevel > 3) {
|
||||
return this.verbose(message);
|
||||
}
|
||||
|
||||
let styledMessage = this.chalk.gray.bold(message);
|
||||
if (!this.spinner) {
|
||||
this.spinner = ora({
|
||||
text: styledMessage,
|
||||
stream: process.stdout,
|
||||
enabled: this.isTest ? false : undefined // fall back to ora default unless we need to explicitly disable it.
|
||||
}).start();
|
||||
} else {
|
||||
this.spinner.text = styledMessage;
|
||||
}
|
||||
}
|
||||
|
||||
stopSpinner() {
|
||||
if (this.spinner) {
|
||||
this.spinner.stop();
|
||||
this.spinner = null;
|
||||
}
|
||||
}
|
||||
|
||||
handleMessage(options) {
|
||||
this[options.method](...options.args);
|
||||
}
|
||||
|
||||
_log(message) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
table(columns, table) {
|
||||
// Measure column widths
|
||||
let colWidths = [];
|
||||
for (let row of table) {
|
||||
let i = 0;
|
||||
for (let item of row) {
|
||||
colWidths[i] = Math.max(colWidths[i] || 0, stringWidth(item));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Render rows
|
||||
for (let row of table) {
|
||||
let items = row.map((item, i) => {
|
||||
// Add padding between columns unless the alignment is the opposite to the
|
||||
// next column and pad to the column width.
|
||||
let padding =
|
||||
!columns[i + 1] || columns[i + 1].align === columns[i].align ? 4 : 0;
|
||||
return pad(item, colWidths[i] + padding, columns[i].align);
|
||||
});
|
||||
|
||||
this.log(items.join(''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pad a string with spaces on either side
|
||||
function pad(text, length, align = 'left') {
|
||||
let pad = ' '.repeat(length - stringWidth(text));
|
||||
if (align === 'right') {
|
||||
return pad + text;
|
||||
}
|
||||
|
||||
return text + pad;
|
||||
}
|
||||
|
||||
// Count visible characters in a string
|
||||
function stringWidth(string) {
|
||||
return countBreaks(stripAnsi('' + string));
|
||||
}
|
||||
|
||||
// If we are in a worker, make a proxy class which will
|
||||
// send the logger calls to the main process via IPC.
|
||||
// These are handled in WorkerFarm and directed to handleMessage above.
|
||||
if (WorkerFarm.isWorker()) {
|
||||
class LoggerProxy {}
|
||||
for (let method of Object.getOwnPropertyNames(Logger.prototype)) {
|
||||
LoggerProxy.prototype[method] = (...args) => {
|
||||
WorkerFarm.callMaster(
|
||||
{
|
||||
location: __filename,
|
||||
method,
|
||||
args
|
||||
},
|
||||
false
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = new LoggerProxy();
|
||||
} else {
|
||||
module.exports = new Logger();
|
||||
}
|
||||
8
BACK_BACK/node_modules/@parcel/logger/src/emoji.js
generated
vendored
Executable file
8
BACK_BACK/node_modules/@parcel/logger/src/emoji.js
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
const supportsEmoji =
|
||||
process.platform !== 'win32' || process.env.TERM === 'xterm-256color';
|
||||
|
||||
// Fallback symbols for Windows from https://en.wikipedia.org/wiki/Code_page_437
|
||||
exports.progress = supportsEmoji ? '⏳' : '∞';
|
||||
exports.success = supportsEmoji ? '✨' : '√';
|
||||
exports.error = supportsEmoji ? '🚨' : '×';
|
||||
exports.warning = supportsEmoji ? '⚠️' : '‼';
|
||||
24
BACK_BACK/node_modules/@parcel/logger/src/prettyError.js
generated
vendored
Executable file
24
BACK_BACK/node_modules/@parcel/logger/src/prettyError.js
generated
vendored
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
module.exports = function(err, opts = {}) {
|
||||
let message = typeof err === 'string' ? err : err.message;
|
||||
if (!message) {
|
||||
message = 'Unknown error';
|
||||
}
|
||||
|
||||
if (err.fileName) {
|
||||
let fileName = err.fileName;
|
||||
if (err.loc) {
|
||||
fileName += `:${err.loc.line}:${err.loc.column}`;
|
||||
}
|
||||
|
||||
message = `${fileName}: ${message}`;
|
||||
}
|
||||
|
||||
let stack;
|
||||
if (err.codeFrame) {
|
||||
stack = (opts.color && err.highlightedCodeFrame) || err.codeFrame;
|
||||
} else if (err.stack) {
|
||||
stack = err.stack.slice(err.stack.indexOf('\n') + 1);
|
||||
}
|
||||
|
||||
return {message, stack};
|
||||
};
|
||||
8
BACK_BACK/node_modules/@parcel/logger/test/.babelrc
generated
vendored
Executable file
8
BACK_BACK/node_modules/@parcel/logger/test/.babelrc
generated
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"presets": [["@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]],
|
||||
"plugins": ["@babel/plugin-transform-runtime"]
|
||||
}
|
||||
6
BACK_BACK/node_modules/@parcel/logger/test/.eslintrc.json
generated
vendored
Executable file
6
BACK_BACK/node_modules/@parcel/logger/test/.eslintrc.json
generated
vendored
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"extends": "../../../../.eslintrc.json",
|
||||
"env": {
|
||||
"mocha": true
|
||||
}
|
||||
}
|
||||
123
BACK_BACK/node_modules/@parcel/logger/test/logger.js
generated
vendored
Executable file
123
BACK_BACK/node_modules/@parcel/logger/test/logger.js
generated
vendored
Executable file
|
|
@ -0,0 +1,123 @@
|
|||
const assert = require('assert');
|
||||
const sinon = require('sinon');
|
||||
const Logger = require('../src/Logger');
|
||||
|
||||
describe('Logger', () => {
|
||||
let log;
|
||||
beforeEach(function() {
|
||||
log = [];
|
||||
});
|
||||
|
||||
const stub = instance => {
|
||||
sinon.stub(instance, '_log').callsFake(message => {
|
||||
log.push(message);
|
||||
});
|
||||
};
|
||||
|
||||
it('should log message on write', () => {
|
||||
const l = new Logger.constructor({});
|
||||
stub(l);
|
||||
|
||||
l.write('hello');
|
||||
assert.equal(log[0], 'hello');
|
||||
});
|
||||
|
||||
it('should track number of lines on persist false', () => {
|
||||
const l = new Logger.constructor({});
|
||||
stub(l);
|
||||
|
||||
const count = l.lines;
|
||||
l.write('hello\nworld', false);
|
||||
assert.equal(l.lines, count + 2);
|
||||
});
|
||||
|
||||
it('should not track number of lines on persist true', () => {
|
||||
const l = new Logger.constructor({});
|
||||
stub(l);
|
||||
|
||||
const count = l.lines;
|
||||
l.write('hello\nworld', true);
|
||||
assert.equal(l.lines, count);
|
||||
});
|
||||
|
||||
it('should respect log levels', () => {
|
||||
const l = new Logger.constructor({logLevel: 2, color: false});
|
||||
stub(l);
|
||||
|
||||
l.log('message');
|
||||
l.persistent('message');
|
||||
l.progress('message');
|
||||
l.logLevel = 1;
|
||||
l.warn('message');
|
||||
l.logLevel = 0;
|
||||
l.error({message: 'message', stack: 'stack'});
|
||||
|
||||
assert.equal(log.length, 0);
|
||||
|
||||
l.logLevel = 1;
|
||||
l.error({message: 'message', stack: 'stack'});
|
||||
assert.equal(log.length, 2);
|
||||
|
||||
l.logLevel = 2;
|
||||
l.warn('message');
|
||||
assert.equal(log.length, 3);
|
||||
|
||||
l.logLevel = 3;
|
||||
l.log('message');
|
||||
l.persistent('message');
|
||||
l.progress('message');
|
||||
assert.equal(log.length, 5);
|
||||
});
|
||||
|
||||
it('should handle lack of color support with alternatives', () => {
|
||||
const l = new Logger.constructor({color: false});
|
||||
stub(l);
|
||||
|
||||
// clear is a no-op
|
||||
l.lines = 4;
|
||||
l.clear();
|
||||
assert.equal(l.lines, 4);
|
||||
});
|
||||
|
||||
it('should reset on clear', () => {
|
||||
const l = new Logger.constructor({color: true, isTest: false});
|
||||
stub(l);
|
||||
|
||||
// stub readline so we don't actually clear the test output
|
||||
const sandbox = sinon.createSandbox();
|
||||
sandbox.stub(require('readline'));
|
||||
|
||||
l.lines = 10;
|
||||
l.clear();
|
||||
|
||||
assert.equal(l.lines, 0);
|
||||
sandbox.restore();
|
||||
});
|
||||
|
||||
it('should use ora for progress', () => {
|
||||
const l = new Logger.constructor({color: false});
|
||||
|
||||
l.progress('message');
|
||||
|
||||
assert(l.spinner);
|
||||
assert(l.spinner.text.includes('message'));
|
||||
});
|
||||
|
||||
it('should use internal _log function for writes', () => {
|
||||
const l = new Logger.constructor({color: false});
|
||||
const sandbox = sinon.createSandbox(); // use sandbox to silence console.log
|
||||
|
||||
let spy;
|
||||
try {
|
||||
spy = sandbox.spy(l, '_log');
|
||||
sandbox.stub(console, 'log');
|
||||
|
||||
l.write('hello world');
|
||||
} finally {
|
||||
l._log.restore();
|
||||
sandbox.restore();
|
||||
}
|
||||
|
||||
assert(spy.called);
|
||||
});
|
||||
});
|
||||
2
BACK_BACK/node_modules/@parcel/logger/test/mocha.opts
generated
vendored
Executable file
2
BACK_BACK/node_modules/@parcel/logger/test/mocha.opts
generated
vendored
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
--require @parcel/babel-register
|
||||
--exit
|
||||
104
BACK_BACK/node_modules/@parcel/logger/test/prettyError.js
generated
vendored
Executable file
104
BACK_BACK/node_modules/@parcel/logger/test/prettyError.js
generated
vendored
Executable file
|
|
@ -0,0 +1,104 @@
|
|||
const assert = require('assert');
|
||||
const prettyError = require('../src/prettyError');
|
||||
|
||||
const message = 'Error Message!';
|
||||
const fileName = 'Test.js';
|
||||
const codeFrame = '<code>frame</code>';
|
||||
const stack =
|
||||
'Error: Uh-oh. Something went wrong. Line 88. \n Oh no. Something else went wrong. Line 77 \n';
|
||||
|
||||
describe('prettyError', () => {
|
||||
it('should handle passing error as string', () => {
|
||||
const err = prettyError(message);
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert.equal(err.stack, undefined);
|
||||
});
|
||||
|
||||
it('should handle passing error as object', () => {
|
||||
const err = prettyError({message});
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert.equal(err.stack, undefined);
|
||||
});
|
||||
|
||||
it('should handle unknown input', () => {
|
||||
const err = prettyError(Number.NaN);
|
||||
|
||||
assert(err.message.length); // non-empty error message
|
||||
assert.equal(err.stack, undefined);
|
||||
});
|
||||
|
||||
it('should prepend fileName', () => {
|
||||
const err = prettyError({
|
||||
message,
|
||||
fileName
|
||||
});
|
||||
|
||||
assert(err.message.startsWith(fileName));
|
||||
assert.equal(err.stack, undefined);
|
||||
});
|
||||
|
||||
it('should prepend line and column location', () => {
|
||||
const err = prettyError({
|
||||
message,
|
||||
fileName,
|
||||
loc: {
|
||||
line: 1,
|
||||
column: 10
|
||||
}
|
||||
});
|
||||
|
||||
assert(err.message.startsWith(`${fileName}:1:10`));
|
||||
assert.equal(err.stack, undefined);
|
||||
});
|
||||
|
||||
it('should support providing a codeFrame as stack', () => {
|
||||
const err = prettyError({
|
||||
message,
|
||||
stack,
|
||||
codeFrame: codeFrame
|
||||
});
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert.equal(err.stack, codeFrame);
|
||||
});
|
||||
|
||||
it('should support highlightedCodeFrame when opts.color is true', () => {
|
||||
let err = prettyError(
|
||||
{
|
||||
message,
|
||||
stack,
|
||||
codeFrame: '<not>a code frame</not>',
|
||||
highlightedCodeFrame: codeFrame
|
||||
},
|
||||
{color: true}
|
||||
);
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert.equal(err.stack, codeFrame);
|
||||
|
||||
err = prettyError(
|
||||
{
|
||||
message,
|
||||
stack,
|
||||
codeFrame: codeFrame,
|
||||
highlightedCodeFrame: '<not>a code frame</not>'
|
||||
},
|
||||
{color: false}
|
||||
);
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert.equal(err.stack, codeFrame);
|
||||
});
|
||||
|
||||
it('should support stack', () => {
|
||||
const err = prettyError({
|
||||
message,
|
||||
stack
|
||||
});
|
||||
|
||||
assert.equal(err.message, message);
|
||||
assert(err.stack.includes('Line'));
|
||||
});
|
||||
});
|
||||
9578
BACK_BACK/node_modules/@parcel/logger/yarn-error.log
generated
vendored
Executable file
9578
BACK_BACK/node_modules/@parcel/logger/yarn-error.log
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue