stuff
This commit is contained in:
192
buildfiles/node_modules/roarr/dist/factories/createLogger.js
generated
vendored
Normal file
192
buildfiles/node_modules/roarr/dist/factories/createLogger.js
generated
vendored
Normal file
@ -0,0 +1,192 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _detectNode = _interopRequireDefault(require("detect-node"));
|
||||
|
||||
var _globalthis = _interopRequireDefault(require("globalthis"));
|
||||
|
||||
var _jsonStringifySafe = _interopRequireDefault(require("json-stringify-safe"));
|
||||
|
||||
var _sprintfJs = require("sprintf-js");
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
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; }
|
||||
|
||||
const globalThis = (0, _globalthis.default)();
|
||||
let domain;
|
||||
|
||||
if (_detectNode.default) {
|
||||
// eslint-disable-next-line global-require
|
||||
domain = require('domain');
|
||||
}
|
||||
|
||||
const getParentDomainContext = () => {
|
||||
if (!domain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const parentRoarrContexts = [];
|
||||
let currentDomain = process.domain; // $FlowFixMe
|
||||
|
||||
if (!currentDomain || !currentDomain.parentDomain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
while (currentDomain && currentDomain.parentDomain) {
|
||||
currentDomain = currentDomain.parentDomain;
|
||||
|
||||
if (currentDomain.roarr && currentDomain.roarr.context) {
|
||||
parentRoarrContexts.push(currentDomain.roarr.context);
|
||||
}
|
||||
}
|
||||
|
||||
let domainContext = {};
|
||||
|
||||
for (const parentRoarrContext of parentRoarrContexts) {
|
||||
domainContext = _objectSpread(_objectSpread({}, domainContext), parentRoarrContext);
|
||||
}
|
||||
|
||||
return domainContext;
|
||||
};
|
||||
|
||||
const getFirstParentDomainContext = () => {
|
||||
if (!domain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
let currentDomain = process.domain; // $FlowFixMe
|
||||
|
||||
if (currentDomain && currentDomain.roarr && currentDomain.roarr.context) {
|
||||
return currentDomain.roarr.context;
|
||||
} // $FlowFixMe
|
||||
|
||||
|
||||
if (!currentDomain || !currentDomain.parentDomain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
while (currentDomain && currentDomain.parentDomain) {
|
||||
currentDomain = currentDomain.parentDomain;
|
||||
|
||||
if (currentDomain.roarr && currentDomain.roarr.context) {
|
||||
return currentDomain.roarr.context;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
const createLogger = (onMessage, parentContext) => {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
const log = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
const time = Date.now();
|
||||
const sequence = globalThis.ROARR.sequence++;
|
||||
let context;
|
||||
let message;
|
||||
|
||||
if (typeof a === 'string') {
|
||||
context = _objectSpread(_objectSpread({}, getFirstParentDomainContext()), parentContext || {}); // eslint-disable-next-line id-length, object-property-newline
|
||||
|
||||
const args = _extends({}, {
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g,
|
||||
h,
|
||||
i,
|
||||
k
|
||||
});
|
||||
|
||||
const values = Object.keys(args).map(key => {
|
||||
return args[key];
|
||||
}); // eslint-disable-next-line unicorn/no-reduce
|
||||
|
||||
const hasOnlyOneParameterValued = 1 === values.reduce((accumulator, value) => {
|
||||
// eslint-disable-next-line no-return-assign, no-param-reassign
|
||||
return accumulator += typeof value === 'undefined' ? 0 : 1;
|
||||
}, 0);
|
||||
message = hasOnlyOneParameterValued ? (0, _sprintfJs.sprintf)('%s', a) : (0, _sprintfJs.sprintf)(a, b, c, d, e, f, g, h, i, k);
|
||||
} else {
|
||||
if (typeof b !== 'string') {
|
||||
throw new TypeError('Message must be a string.');
|
||||
}
|
||||
|
||||
context = JSON.parse((0, _jsonStringifySafe.default)(_objectSpread(_objectSpread(_objectSpread({}, getFirstParentDomainContext()), parentContext || {}), a)));
|
||||
message = (0, _sprintfJs.sprintf)(b, c, d, e, f, g, h, i, k);
|
||||
}
|
||||
|
||||
onMessage({
|
||||
context,
|
||||
message,
|
||||
sequence,
|
||||
time,
|
||||
version: '1.0.0'
|
||||
});
|
||||
};
|
||||
|
||||
log.child = context => {
|
||||
if (typeof context === 'function') {
|
||||
return createLogger(message => {
|
||||
if (typeof context !== 'function') {
|
||||
throw new TypeError('Unexpected state.');
|
||||
}
|
||||
|
||||
onMessage(context(message));
|
||||
}, parentContext);
|
||||
}
|
||||
|
||||
return createLogger(onMessage, _objectSpread(_objectSpread(_objectSpread({}, getFirstParentDomainContext()), parentContext), context));
|
||||
};
|
||||
|
||||
log.getContext = () => {
|
||||
return _objectSpread(_objectSpread({}, getFirstParentDomainContext()), parentContext || {});
|
||||
};
|
||||
|
||||
log.adopt = async (routine, context) => {
|
||||
if (!domain) {
|
||||
return routine();
|
||||
}
|
||||
|
||||
const adoptedDomain = domain.create();
|
||||
return adoptedDomain.run(() => {
|
||||
// $FlowFixMe
|
||||
adoptedDomain.roarr = {
|
||||
context: _objectSpread(_objectSpread({}, getParentDomainContext()), context)
|
||||
};
|
||||
return routine();
|
||||
});
|
||||
};
|
||||
|
||||
for (const logLevel of Object.keys(_constants.logLevels)) {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
return log.child({
|
||||
logLevel: _constants.logLevels[logLevel]
|
||||
})(a, b, c, d, e, f, g, h, i, k);
|
||||
};
|
||||
} // @see https://github.com/facebook/flow/issues/6705
|
||||
// $FlowFixMe
|
||||
|
||||
|
||||
return log;
|
||||
};
|
||||
|
||||
var _default = createLogger;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createLogger.js.map
|
197
buildfiles/node_modules/roarr/dist/factories/createLogger.js.flow
generated
vendored
Normal file
197
buildfiles/node_modules/roarr/dist/factories/createLogger.js.flow
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
// @flow
|
||||
|
||||
import environmentIsNode from 'detect-node';
|
||||
import createGlobalThis from 'globalthis';
|
||||
import stringify from 'json-stringify-safe';
|
||||
import {
|
||||
sprintf,
|
||||
} from 'sprintf-js';
|
||||
import {
|
||||
logLevels,
|
||||
} from '../constants';
|
||||
import type {
|
||||
LoggerType,
|
||||
MessageContextType,
|
||||
MessageEventHandlerType,
|
||||
TranslateMessageFunctionType,
|
||||
} from '../types';
|
||||
|
||||
const globalThis = createGlobalThis();
|
||||
|
||||
let domain;
|
||||
|
||||
if (environmentIsNode) {
|
||||
// eslint-disable-next-line global-require
|
||||
domain = require('domain');
|
||||
}
|
||||
|
||||
const getParentDomainContext = () => {
|
||||
if (!domain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const parentRoarrContexts = [];
|
||||
|
||||
let currentDomain = process.domain;
|
||||
|
||||
// $FlowFixMe
|
||||
if (!currentDomain || !currentDomain.parentDomain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
while (currentDomain && currentDomain.parentDomain) {
|
||||
currentDomain = currentDomain.parentDomain;
|
||||
|
||||
if (currentDomain.roarr && currentDomain.roarr.context) {
|
||||
parentRoarrContexts.push(currentDomain.roarr.context);
|
||||
}
|
||||
}
|
||||
|
||||
let domainContext = {};
|
||||
|
||||
for (const parentRoarrContext of parentRoarrContexts) {
|
||||
domainContext = {
|
||||
...domainContext,
|
||||
...parentRoarrContext,
|
||||
};
|
||||
}
|
||||
|
||||
return domainContext;
|
||||
};
|
||||
|
||||
const getFirstParentDomainContext = () => {
|
||||
if (!domain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
let currentDomain = process.domain;
|
||||
|
||||
// $FlowFixMe
|
||||
if (currentDomain && currentDomain.roarr && currentDomain.roarr.context) {
|
||||
return currentDomain.roarr.context;
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
if (!currentDomain || !currentDomain.parentDomain) {
|
||||
return {};
|
||||
}
|
||||
|
||||
while (currentDomain && currentDomain.parentDomain) {
|
||||
currentDomain = currentDomain.parentDomain;
|
||||
|
||||
if (currentDomain.roarr && currentDomain.roarr.context) {
|
||||
return currentDomain.roarr.context;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
const createLogger = (onMessage: MessageEventHandlerType, parentContext?: MessageContextType): LoggerType => {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
const log = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
const time = Date.now();
|
||||
const sequence = globalThis.ROARR.sequence++;
|
||||
|
||||
let context;
|
||||
let message;
|
||||
|
||||
if (typeof a === 'string') {
|
||||
context = {
|
||||
...getFirstParentDomainContext(),
|
||||
...parentContext || {},
|
||||
};
|
||||
// eslint-disable-next-line id-length, object-property-newline
|
||||
const {...args} = {a, b, c, d, e, f, g, h, i, k};
|
||||
const values = Object.keys(args).map((key) => {
|
||||
return args[key];
|
||||
});
|
||||
// eslint-disable-next-line unicorn/no-reduce
|
||||
const hasOnlyOneParameterValued = 1 === values.reduce((accumulator, value) => {
|
||||
// eslint-disable-next-line no-return-assign, no-param-reassign
|
||||
return accumulator += typeof value === 'undefined' ? 0 : 1;
|
||||
}, 0);
|
||||
message = hasOnlyOneParameterValued ? sprintf('%s', a) : sprintf(a, b, c, d, e, f, g, h, i, k);
|
||||
} else {
|
||||
if (typeof b !== 'string') {
|
||||
throw new TypeError('Message must be a string.');
|
||||
}
|
||||
|
||||
context = JSON.parse(stringify({
|
||||
...getFirstParentDomainContext(),
|
||||
...parentContext || {},
|
||||
...a,
|
||||
}));
|
||||
|
||||
message = sprintf(b, c, d, e, f, g, h, i, k);
|
||||
}
|
||||
|
||||
onMessage({
|
||||
context,
|
||||
message,
|
||||
sequence,
|
||||
time,
|
||||
version: '1.0.0',
|
||||
});
|
||||
};
|
||||
|
||||
log.child = (context: TranslateMessageFunctionType | MessageContextType): LoggerType => {
|
||||
if (typeof context === 'function') {
|
||||
return createLogger((message) => {
|
||||
if (typeof context !== 'function') {
|
||||
throw new TypeError('Unexpected state.');
|
||||
}
|
||||
onMessage(context(message));
|
||||
}, parentContext);
|
||||
}
|
||||
|
||||
return createLogger(onMessage, {
|
||||
...getFirstParentDomainContext(),
|
||||
...parentContext,
|
||||
...context,
|
||||
});
|
||||
};
|
||||
|
||||
log.getContext = (): MessageContextType => {
|
||||
return {
|
||||
...getFirstParentDomainContext(),
|
||||
...parentContext || {},
|
||||
};
|
||||
};
|
||||
|
||||
log.adopt = async (routine, context) => {
|
||||
if (!domain) {
|
||||
return routine();
|
||||
}
|
||||
|
||||
const adoptedDomain = domain.create();
|
||||
|
||||
return adoptedDomain
|
||||
.run(() => {
|
||||
// $FlowFixMe
|
||||
adoptedDomain.roarr = {
|
||||
context: {
|
||||
...getParentDomainContext(),
|
||||
...context,
|
||||
},
|
||||
};
|
||||
|
||||
return routine();
|
||||
});
|
||||
};
|
||||
|
||||
for (const logLevel of Object.keys(logLevels)) {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
return log.child({
|
||||
logLevel: logLevels[logLevel],
|
||||
})(a, b, c, d, e, f, g, h, i, k);
|
||||
};
|
||||
}
|
||||
|
||||
// @see https://github.com/facebook/flow/issues/6705
|
||||
// $FlowFixMe
|
||||
return log;
|
||||
};
|
||||
|
||||
export default createLogger;
|
1
buildfiles/node_modules/roarr/dist/factories/createLogger.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/roarr/dist/factories/createLogger.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js
generated
vendored
Normal file
44
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
const createMockLogger = (onMessage, parentContext) => {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations, no-unused-vars
|
||||
const log = (a, b, c, d, e, f, g, h, i, k) => {//
|
||||
};
|
||||
|
||||
log.adopt = async routine => {
|
||||
return routine();
|
||||
}; // eslint-disable-next-line no-unused-vars
|
||||
|
||||
|
||||
log.child = context => {
|
||||
return createMockLogger(onMessage, parentContext);
|
||||
};
|
||||
|
||||
log.getContext = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
for (const logLevel of Object.keys(_constants.logLevels)) {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
return log.child({
|
||||
logLevel: _constants.logLevels[logLevel]
|
||||
})(a, b, c, d, e, f, g, h, i, k);
|
||||
};
|
||||
} // @see https://github.com/facebook/flow/issues/6705
|
||||
// $FlowFixMe
|
||||
|
||||
|
||||
return log;
|
||||
};
|
||||
|
||||
var _default = createMockLogger;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createMockLogger.js.map
|
46
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js.flow
generated
vendored
Normal file
46
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js.flow
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
// @flow
|
||||
|
||||
import {
|
||||
logLevels,
|
||||
} from '../constants';
|
||||
import type {
|
||||
LoggerType,
|
||||
MessageContextType,
|
||||
MessageEventHandlerType,
|
||||
TranslateMessageFunctionType,
|
||||
} from '../types';
|
||||
|
||||
const createMockLogger = (onMessage: MessageEventHandlerType, parentContext?: MessageContextType): LoggerType => {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations, no-unused-vars
|
||||
const log = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
//
|
||||
};
|
||||
|
||||
log.adopt = async (routine) => {
|
||||
return routine();
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
log.child = (context: TranslateMessageFunctionType | MessageContextType): LoggerType => {
|
||||
return createMockLogger(onMessage, parentContext);
|
||||
};
|
||||
|
||||
log.getContext = (): MessageContextType => {
|
||||
return {};
|
||||
};
|
||||
|
||||
for (const logLevel of Object.keys(logLevels)) {
|
||||
// eslint-disable-next-line id-length, unicorn/prevent-abbreviations
|
||||
log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {
|
||||
return log.child({
|
||||
logLevel: logLevels[logLevel],
|
||||
})(a, b, c, d, e, f, g, h, i, k);
|
||||
};
|
||||
}
|
||||
|
||||
// @see https://github.com/facebook/flow/issues/6705
|
||||
// $FlowFixMe
|
||||
return log;
|
||||
};
|
||||
|
||||
export default createMockLogger;
|
1
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/roarr/dist/factories/createMockLogger.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/factories/createMockLogger.js"],"names":["createMockLogger","onMessage","parentContext","log","a","b","c","d","e","f","g","h","i","k","adopt","routine","child","context","getContext","logLevel","Object","keys","logLevels"],"mappings":";;;;;;;AAEA;;AAUA,MAAMA,gBAAgB,GAAG,CAACC,SAAD,EAAqCC,aAArC,KAAwF;AAC/G;AACA,QAAMC,GAAG,GAAG,CAACC,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaC,CAAb,EAAgBC,CAAhB,EAAmBC,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BC,CAA5B,KAAkC,CAC5C;AACD,GAFD;;AAIAV,EAAAA,GAAG,CAACW,KAAJ,GAAY,MAAOC,OAAP,IAAmB;AAC7B,WAAOA,OAAO,EAAd;AACD,GAFD,CAN+G,CAU/G;;;AACAZ,EAAAA,GAAG,CAACa,KAAJ,GAAaC,OAAD,IAA4E;AACtF,WAAOjB,gBAAgB,CAACC,SAAD,EAAYC,aAAZ,CAAvB;AACD,GAFD;;AAIAC,EAAAA,GAAG,CAACe,UAAJ,GAAiB,MAA0B;AACzC,WAAO,EAAP;AACD,GAFD;;AAIA,OAAK,MAAMC,QAAX,IAAuBC,MAAM,CAACC,IAAP,CAAYC,oBAAZ,CAAvB,EAA+C;AAC7C;AACAnB,IAAAA,GAAG,CAACgB,QAAD,CAAH,GAAgB,CAACf,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,EAAaC,CAAb,EAAgBC,CAAhB,EAAmBC,CAAnB,EAAsBC,CAAtB,EAAyBC,CAAzB,EAA4BC,CAA5B,KAAkC;AAChD,aAAOV,GAAG,CAACa,KAAJ,CAAU;AACfG,QAAAA,QAAQ,EAAEG,qBAAUH,QAAV;AADK,OAAV,EAEJf,CAFI,EAEDC,CAFC,EAEEC,CAFF,EAEKC,CAFL,EAEQC,CAFR,EAEWC,CAFX,EAEcC,CAFd,EAEiBC,CAFjB,EAEoBC,CAFpB,EAEuBC,CAFvB,CAAP;AAGD,KAJD;AAKD,GA1B8G,CA4B/G;AACA;;;AACA,SAAOV,GAAP;AACD,CA/BD;;eAiCeH,gB","sourcesContent":["// @flow\n\nimport {\n logLevels,\n} from '../constants';\nimport type {\n LoggerType,\n MessageContextType,\n MessageEventHandlerType,\n TranslateMessageFunctionType,\n} from '../types';\n\nconst createMockLogger = (onMessage: MessageEventHandlerType, parentContext?: MessageContextType): LoggerType => {\n // eslint-disable-next-line id-length, unicorn/prevent-abbreviations, no-unused-vars\n const log = (a, b, c, d, e, f, g, h, i, k) => {\n //\n };\n\n log.adopt = async (routine) => {\n return routine();\n };\n\n // eslint-disable-next-line no-unused-vars\n log.child = (context: TranslateMessageFunctionType | MessageContextType): LoggerType => {\n return createMockLogger(onMessage, parentContext);\n };\n\n log.getContext = (): MessageContextType => {\n return {};\n };\n\n for (const logLevel of Object.keys(logLevels)) {\n // eslint-disable-next-line id-length, unicorn/prevent-abbreviations\n log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {\n return log.child({\n logLevel: logLevels[logLevel],\n })(a, b, c, d, e, f, g, h, i, k);\n };\n }\n\n // @see https://github.com/facebook/flow/issues/6705\n // $FlowFixMe\n return log;\n};\n\nexport default createMockLogger;\n"],"file":"createMockLogger.js"}
|
25
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js
generated
vendored
Normal file
25
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
const createBlockingWriter = stream => {
|
||||
return {
|
||||
write: message => {
|
||||
stream.write(message + '\n');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const createNodeWriter = () => {
|
||||
// eslint-disable-next-line no-process-env
|
||||
const targetStream = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase();
|
||||
const stream = targetStream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr;
|
||||
return createBlockingWriter(stream);
|
||||
};
|
||||
|
||||
var _default = createNodeWriter;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createNodeWriter.js.map
|
22
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js.flow
generated
vendored
Normal file
22
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js.flow
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// @flow
|
||||
|
||||
import type {
|
||||
WriterType,
|
||||
} from '../types';
|
||||
|
||||
const createBlockingWriter = (stream: stream$Writable): WriterType => {
|
||||
return {
|
||||
write: (message: string) => {
|
||||
stream.write(message + '\n');
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default (): WriterType => {
|
||||
// eslint-disable-next-line no-process-env
|
||||
const targetStream = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase();
|
||||
|
||||
const stream = targetStream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr;
|
||||
|
||||
return createBlockingWriter(stream);
|
||||
};
|
1
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/roarr/dist/factories/createNodeWriter.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/factories/createNodeWriter.js"],"names":["createBlockingWriter","stream","write","message","targetStream","process","env","ROARR_STREAM","toUpperCase","stdout","stderr"],"mappings":";;;;;;;AAMA,MAAMA,oBAAoB,GAAIC,MAAD,IAAyC;AACpE,SAAO;AACLC,IAAAA,KAAK,EAAGC,OAAD,IAAqB;AAC1BF,MAAAA,MAAM,CAACC,KAAP,CAAaC,OAAO,GAAG,IAAvB;AACD;AAHI,GAAP;AAKD,CAND;;+BAQiC;AAC/B;AACA,QAAMC,YAAY,GAAG,CAACC,OAAO,CAACC,GAAR,CAAYC,YAAZ,IAA4B,QAA7B,EAAuCC,WAAvC,EAArB;AAEA,QAAMP,MAAM,GAAGG,YAAY,CAACI,WAAb,OAA+B,QAA/B,GAA0CH,OAAO,CAACI,MAAlD,GAA2DJ,OAAO,CAACK,MAAlF;AAEA,SAAOV,oBAAoB,CAACC,MAAD,CAA3B;AACD,C","sourcesContent":["// @flow\n\nimport type {\n WriterType,\n} from '../types';\n\nconst createBlockingWriter = (stream: stream$Writable): WriterType => {\n return {\n write: (message: string) => {\n stream.write(message + '\\n');\n },\n };\n};\n\nexport default (): WriterType => {\n // eslint-disable-next-line no-process-env\n const targetStream = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase();\n\n const stream = targetStream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr;\n\n return createBlockingWriter(stream);\n};\n"],"file":"createNodeWriter.js"}
|
53
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js
generated
vendored
Normal file
53
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _detectNode = _interopRequireDefault(require("detect-node"));
|
||||
|
||||
var _semverCompare = _interopRequireDefault(require("semver-compare"));
|
||||
|
||||
var _package = require("../../package.json");
|
||||
|
||||
var _createNodeWriter = _interopRequireDefault(require("./createNodeWriter"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
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; }
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
const createRoarrInititialGlobalState = currentState => {
|
||||
const versions = (currentState.versions || []).concat();
|
||||
versions.sort(_semverCompare.default);
|
||||
const currentIsLatestVersion = !versions.length || (0, _semverCompare.default)(_package.version, versions[versions.length - 1]) === 1;
|
||||
|
||||
if (!versions.includes(_package.version)) {
|
||||
versions.push(_package.version);
|
||||
}
|
||||
|
||||
versions.sort(_semverCompare.default);
|
||||
|
||||
let newState = _objectSpread(_objectSpread({
|
||||
sequence: 0
|
||||
}, currentState), {}, {
|
||||
versions
|
||||
});
|
||||
|
||||
if (_detectNode.default) {
|
||||
if (currentIsLatestVersion || !newState.write) {
|
||||
newState = _objectSpread(_objectSpread({}, newState), (0, _createNodeWriter.default)());
|
||||
}
|
||||
}
|
||||
|
||||
return newState;
|
||||
};
|
||||
|
||||
var _default = createRoarrInititialGlobalState;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createRoarrInititialGlobalState.js.map
|
43
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js.flow
generated
vendored
Normal file
43
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js.flow
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// @flow
|
||||
|
||||
import environmentIsNode from 'detect-node';
|
||||
import cmp from 'semver-compare';
|
||||
import {
|
||||
version,
|
||||
} from '../../package.json';
|
||||
import type {
|
||||
RoarrGlobalStateType,
|
||||
} from '../types';
|
||||
import createNodeWriter from './createNodeWriter';
|
||||
|
||||
// eslint-disable-next-line flowtype/no-weak-types
|
||||
export default (currentState: Object): RoarrGlobalStateType => {
|
||||
const versions = (currentState.versions || []).concat();
|
||||
|
||||
versions.sort(cmp);
|
||||
|
||||
const currentIsLatestVersion = !versions.length || cmp(version, versions[versions.length - 1]) === 1;
|
||||
|
||||
if (!versions.includes(version)) {
|
||||
versions.push(version);
|
||||
}
|
||||
|
||||
versions.sort(cmp);
|
||||
|
||||
let newState = {
|
||||
sequence: 0,
|
||||
...currentState,
|
||||
versions,
|
||||
};
|
||||
|
||||
if (environmentIsNode) {
|
||||
if (currentIsLatestVersion || !newState.write) {
|
||||
newState = {
|
||||
...newState,
|
||||
...createNodeWriter(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return newState;
|
||||
};
|
1
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/roarr/dist/factories/createRoarrInititialGlobalState.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/factories/createRoarrInititialGlobalState.js"],"names":["currentState","versions","concat","sort","cmp","currentIsLatestVersion","length","version","includes","push","newState","sequence","environmentIsNode","write"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;AAMA;;;;;;;;;;AAEA;wCACgBA,Y,IAA+C;AAC7D,QAAMC,QAAQ,GAAG,CAACD,YAAY,CAACC,QAAb,IAAyB,EAA1B,EAA8BC,MAA9B,EAAjB;AAEAD,EAAAA,QAAQ,CAACE,IAAT,CAAcC,sBAAd;AAEA,QAAMC,sBAAsB,GAAG,CAACJ,QAAQ,CAACK,MAAV,IAAoB,4BAAIC,gBAAJ,EAAaN,QAAQ,CAACA,QAAQ,CAACK,MAAT,GAAkB,CAAnB,CAArB,MAAgD,CAAnG;;AAEA,MAAI,CAACL,QAAQ,CAACO,QAAT,CAAkBD,gBAAlB,CAAL,EAAiC;AAC/BN,IAAAA,QAAQ,CAACQ,IAAT,CAAcF,gBAAd;AACD;;AAEDN,EAAAA,QAAQ,CAACE,IAAT,CAAcC,sBAAd;;AAEA,MAAIM,QAAQ;AACVC,IAAAA,QAAQ,EAAE;AADA,KAEPX,YAFO;AAGVC,IAAAA;AAHU,IAAZ;;AAMA,MAAIW,mBAAJ,EAAuB;AACrB,QAAIP,sBAAsB,IAAI,CAACK,QAAQ,CAACG,KAAxC,EAA+C;AAC7CH,MAAAA,QAAQ,mCACHA,QADG,GAEH,gCAFG,CAAR;AAID;AACF;;AAED,SAAOA,QAAP;AACD,C","sourcesContent":["// @flow\n\nimport environmentIsNode from 'detect-node';\nimport cmp from 'semver-compare';\nimport {\n version,\n} from '../../package.json';\nimport type {\n RoarrGlobalStateType,\n} from '../types';\nimport createNodeWriter from './createNodeWriter';\n\n// eslint-disable-next-line flowtype/no-weak-types\nexport default (currentState: Object): RoarrGlobalStateType => {\n const versions = (currentState.versions || []).concat();\n\n versions.sort(cmp);\n\n const currentIsLatestVersion = !versions.length || cmp(version, versions[versions.length - 1]) === 1;\n\n if (!versions.includes(version)) {\n versions.push(version);\n }\n\n versions.sort(cmp);\n\n let newState = {\n sequence: 0,\n ...currentState,\n versions,\n };\n\n if (environmentIsNode) {\n if (currentIsLatestVersion || !newState.write) {\n newState = {\n ...newState,\n ...createNodeWriter(),\n };\n }\n }\n\n return newState;\n};\n"],"file":"createRoarrInititialGlobalState.js"}
|
32
buildfiles/node_modules/roarr/dist/factories/index.js
generated
vendored
Normal file
32
buildfiles/node_modules/roarr/dist/factories/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createLogger", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _createLogger.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createMockLogger", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _createMockLogger.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createRoarrInititialGlobalState", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _createRoarrInititialGlobalState.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _createLogger = _interopRequireDefault(require("./createLogger"));
|
||||
|
||||
var _createMockLogger = _interopRequireDefault(require("./createMockLogger"));
|
||||
|
||||
var _createRoarrInititialGlobalState = _interopRequireDefault(require("./createRoarrInititialGlobalState"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
11
buildfiles/node_modules/roarr/dist/factories/index.js.flow
generated
vendored
Normal file
11
buildfiles/node_modules/roarr/dist/factories/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// @flow
|
||||
|
||||
export {
|
||||
default as createLogger,
|
||||
} from './createLogger';
|
||||
export {
|
||||
default as createMockLogger,
|
||||
} from './createMockLogger';
|
||||
export {
|
||||
default as createRoarrInititialGlobalState,
|
||||
} from './createRoarrInititialGlobalState';
|
1
buildfiles/node_modules/roarr/dist/factories/index.js.map
generated
vendored
Normal file
1
buildfiles/node_modules/roarr/dist/factories/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/factories/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAGA;;AAGA","sourcesContent":["// @flow\n\nexport {\n default as createLogger,\n} from './createLogger';\nexport {\n default as createMockLogger,\n} from './createMockLogger';\nexport {\n default as createRoarrInititialGlobalState,\n} from './createRoarrInititialGlobalState';\n"],"file":"index.js"}
|
Reference in New Issue
Block a user