@dbux/common
Advanced tools
Comparing version 0.0.2-alpha.1005 to 0.1.5
@@ -14,4 +14,3 @@ module.exports = { | ||
} | ||
], | ||
"@babel/preset-flow" | ||
] | ||
], | ||
@@ -35,5 +34,4 @@ "plugins": [ | ||
"@babel/plugin-syntax-dynamic-import", | ||
"@babel/plugin-syntax-flow", | ||
//"@babel/plugin-transform-runtime" | ||
] | ||
}; |
@@ -5,2 +5,3 @@ var path = require('path'); | ||
"extends": [path.join(__dirname, '../.eslintrc.js')] | ||
}; |
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "@dbux/common", | ||
"version": "0.0.2-alpha.1005+aaf3394", | ||
"version": "0.1.5", | ||
"description": "", | ||
@@ -13,6 +13,7 @@ "module": "src/index.js", | ||
"colors": "^1.4.0", | ||
"lodash": "*" | ||
"lodash": "^4.17.19", | ||
"nanoevents": "^2.0.0" | ||
}, | ||
"_moduleAliases": {}, | ||
"gitHead": "aaf3394d7e832b87804c65b4f8a618283e5fa25e" | ||
"gitHead": "8b86112956ad0ffdda025886b1503ea3a1ba4959" | ||
} |
@@ -15,3 +15,3 @@ import Enum from '../../util/Enum'; | ||
const interruptableChildTypes = new Array(ExecutionContextType.getValueMaxIndex()).map(_ => false); | ||
const interruptableChildTypes = new Array(ExecutionContextType.getValueMaxIndex()).map((/* _ */) => false); | ||
interruptableChildTypes[ExecutionContextType.Await] = true; | ||
@@ -18,0 +18,0 @@ interruptableChildTypes[ExecutionContextType.Resume] = true; |
@@ -0,0 +0,0 @@ import Enum from "../../util/Enum"; |
@@ -16,3 +16,3 @@ import Enum from "../../util/Enum"; | ||
const interruptableChildTypes = new Array(StaticContextType.getValueMaxIndex()).map(_ => false); | ||
const interruptableChildTypes = new Array(StaticContextType.getValueMaxIndex()).map((/* _ */) => false); | ||
interruptableChildTypes[StaticContextType.Await] = true; | ||
@@ -19,0 +19,0 @@ interruptableChildTypes[StaticContextType.Resume] = true; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import Enum from '../../util/Enum'; |
@@ -0,0 +0,0 @@ import isString from 'lodash/isString'; |
@@ -0,0 +0,0 @@ import Enum from "../../util/Enum"; |
@@ -0,0 +0,0 @@ |
@@ -15,15 +15,58 @@ import ExecutionContextType from '../constants/ExecutionContextType'; | ||
export default class ExecutionContext { | ||
contextType : ExecutionContextType; | ||
stackDepth: number; | ||
runId: number; | ||
parentContextId : number; | ||
parentTraceId: number; | ||
contextId : number; | ||
staticContextId : number; | ||
orderId : number; | ||
schedulerTraceId : number; | ||
createdAt: number; | ||
lastTraceId: number; | ||
/** | ||
* @type {ExecutionContextType} | ||
*/ | ||
contextType; | ||
/** | ||
* @type {number} | ||
*/ | ||
stackDepth; | ||
/** | ||
* @type {number} | ||
*/ | ||
runId; | ||
/** | ||
* @type {number} | ||
*/ | ||
parentContextId ; | ||
/** | ||
* @type {number} | ||
*/ | ||
parentTraceId; | ||
/** | ||
* @type {number} | ||
*/ | ||
contextId ; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticContextId ; | ||
/** | ||
* @type {number} | ||
*/ | ||
orderId ; | ||
/** | ||
* @type {number} | ||
*/ | ||
schedulerTraceId ; | ||
/** | ||
* @type {number} | ||
*/ | ||
createdAt; | ||
/** | ||
* @type {number} | ||
*/ | ||
lastTraceId; | ||
/** | ||
* This is probably not necessary. | ||
@@ -30,0 +73,0 @@ * We can also find all children by searching for all contexts whose `schedulerId` equals this' `contextId`. |
@@ -0,0 +0,0 @@ export default class HasValue { |
@@ -0,0 +0,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import Var from '../Var'; | ||
/** @typedef {import('../Var').default} Var */ | ||
@@ -3,0 +3,0 @@ export default class Loop { |
export default class LoopIteration { | ||
loopId: number; | ||
runId: number; | ||
/** | ||
* @type {number} | ||
*/ | ||
loopId; | ||
i: number; | ||
vars: Array<Var>; | ||
/** | ||
* @type {number} | ||
*/ | ||
runId; | ||
/** | ||
* @type {number} | ||
*/ | ||
i; | ||
/** | ||
* @type {Array<Var>} | ||
*/ | ||
vars; | ||
} |
@@ -1,10 +0,22 @@ | ||
import Loc from "../Loc"; | ||
/** @typedef {import('../Loc').default} Loc */ | ||
export default class StaticLoop { | ||
staticLoopId: number; | ||
staticContextId: number; | ||
// type: number; | ||
loc: Loc; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticLoopId; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticContextId; | ||
/** | ||
* @type {Loc} | ||
*/ | ||
loc; | ||
displayName: string; | ||
/** | ||
* @type {string} | ||
*/ | ||
displayName; | ||
} |
@@ -1,12 +0,36 @@ | ||
import Loc from "./Loc"; | ||
/** @typedef {import('../Loc').default} Loc */ | ||
export default class StaticContext { | ||
staticContextType: number; // {StaticContextType} | ||
name: string; | ||
displayName: string; | ||
isInterruptable: boolean; | ||
staticId: number; | ||
parentId: number; | ||
programId: number; | ||
loc: Loc; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticContextType; // {StaticContextType} | ||
/** | ||
* @type {string} | ||
*/ | ||
name; | ||
/** | ||
* @type {string} | ||
*/ | ||
displayName; | ||
/** | ||
* @type {bool} | ||
*/ | ||
isInterruptable; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticId; | ||
/** | ||
* @type {number} | ||
*/ | ||
parentId; | ||
/** | ||
* @type {number} | ||
*/ | ||
programId; | ||
/** | ||
* @type {Loc} | ||
*/ | ||
loc; | ||
} |
@@ -1,8 +0,23 @@ | ||
import Loc from "./Loc"; | ||
/** @typedef {import('../Loc').default} Loc */ | ||
export default class StaticProgramContext { | ||
applicationId: number; | ||
programId: number; | ||
filePath: string; | ||
fileName: string; | ||
/** | ||
* @type {number} | ||
*/ | ||
applicationId; | ||
/** | ||
* @type {number} | ||
*/ | ||
programId; | ||
/** | ||
* @type {string} | ||
*/ | ||
filePath; | ||
/** | ||
* @type {string} | ||
*/ | ||
fileName; | ||
} |
@@ -1,10 +0,25 @@ | ||
import Loc from "./Loc"; | ||
/** @typedef {import('../Loc').default} Loc */ | ||
export default class StaticTrace { | ||
staticTraceId: number; | ||
staticContextId: number; | ||
type: number; | ||
loc: Loc; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticTraceId; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticContextId; | ||
/** | ||
* @type {number} | ||
*/ | ||
type; | ||
/** | ||
* @type {Loc} | ||
*/ | ||
loc; | ||
displayName: string; | ||
/** | ||
* @type {string} | ||
*/ | ||
displayName; | ||
} |
@@ -1,4 +0,5 @@ | ||
import Loc from "./Loc"; | ||
import VarOwnerType from '../constants/VarOwnerType'; | ||
/** @typedef {import('../Loc').default} Loc */ | ||
export default class StaticVarAccess { | ||
@@ -29,4 +30,11 @@ /** | ||
loc: Loc; | ||
name: string; | ||
/** | ||
* @type {Loc} | ||
*/ | ||
loc; | ||
/** | ||
* @type {string} | ||
*/ | ||
name; | ||
} |
@@ -5,15 +5,36 @@ import TraceType from '../constants/TraceType'; | ||
export default class Trace extends HasValue { | ||
traceId: number; | ||
staticTraceId: number; | ||
applicationId: number; | ||
runId: number; | ||
contextId: number; | ||
valueId: number; | ||
/** | ||
* @type {number} | ||
*/ | ||
traceId; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticTraceId; | ||
/** | ||
* @type {number} | ||
*/ | ||
applicationId; | ||
/** | ||
* @type {number} | ||
*/ | ||
runId; | ||
/** | ||
* @type {number} | ||
*/ | ||
contextId; | ||
/** | ||
* @type {number} | ||
*/ | ||
valueId; | ||
/** | ||
* @type {number} | ||
*/ | ||
loopId; | ||
loopId: number; | ||
/** | ||
* This is currently only set for `Pop` traces (to enable error tracking). | ||
* @type {number} | ||
*/ | ||
previousTrace: number; | ||
previousTrace; | ||
@@ -23,4 +44,5 @@ /** | ||
* Use DataProvider.util.getTraceType to get actual TraceType. | ||
* @type {number} | ||
*/ | ||
type: TraceType; | ||
type; | ||
} |
export default class ValueRef { | ||
valueId: number; | ||
trackId: number; | ||
/** | ||
* @type {number} | ||
*/ | ||
valueId; | ||
/** | ||
* @type {number} | ||
*/ | ||
trackId; | ||
category: number; | ||
pruneState: number; | ||
typeName: string; | ||
/** | ||
* @type {number} | ||
*/ | ||
category; | ||
/** | ||
* @type {number} | ||
*/ | ||
pruneState; | ||
/** | ||
* @type {string} | ||
*/ | ||
typeName; | ||
// when stored in DataProvider, serialized is taken out | ||
// serialized: any, | ||
// serialized, | ||
value: any; | ||
value; | ||
} |
import HasValue from './HasValue'; | ||
export default class Var extends HasValue { | ||
varId: number; | ||
staticVarId: number; | ||
/** | ||
* @type {number} | ||
*/ | ||
varId; | ||
/** | ||
* @type {number} | ||
*/ | ||
staticVarId; | ||
} |
@@ -0,0 +0,0 @@ import HasValue from './HasValue'; |
@@ -0,0 +0,0 @@ import process from 'process'; |
@@ -0,3 +1,3 @@ | ||
/* eslint no-console: 0 */ | ||
import NanoEvents from 'nanoevents'; | ||
import { makePrettyLog } from '../util/prettyLogs'; | ||
@@ -84,3 +84,3 @@ const errors = []; | ||
// this._emitter.emit(name, ...args); | ||
} | ||
}; | ||
} | ||
@@ -91,3 +91,3 @@ } | ||
export function newLogger(ns) { | ||
return new Logger(ns); | ||
return new Logger(`DBUX ${ns}`); | ||
} | ||
@@ -94,0 +94,0 @@ |
@@ -0,0 +0,0 @@ import SerializationMethod from './SerializationMethod'; |
@@ -0,0 +0,0 @@ import Enum from '../util/Enum'; |
@@ -1,7 +0,6 @@ | ||
import isObject from 'lodash/isObject'; | ||
import isArray from 'lodash/isArray'; | ||
import { newLogger } from '@dbux/common/src/log/logger'; | ||
import { newLogger } from '../log/logger'; | ||
import SerializationMethod from './SerializationMethod'; | ||
import ValueTypeCategory from '../core/constants/ValueTypeCategory'; | ||
// eslint-disable-next-line no-unused-vars | ||
const { log, debug, warn, error: logError } = newLogger('serialize'); | ||
@@ -19,20 +18,6 @@ | ||
function getBestMethod(category, value) { | ||
function getBestMethod(category, /* value */) { | ||
return category2Method[category]; | ||
} | ||
// function stringify(val, depth, replacer, space) { | ||
// depth = isNaN(+depth) ? 1 : depth; | ||
// function _build(key, val, depth, o, a) { // (JSON.stringify() has it's own rules, which we respect here by using it for property iteration) | ||
// return !val || typeof val != 'object' ? val : (a = Array.isArray(val), JSON.stringify(val, function (k, v) { if (a || depth > 0) { if (replacer) v = replacer(k, v); if (!k) return (a = Array.isArray(v), val = v); !o && (o = a ? [] : {}); o[k] = _build(k, v, a ? depth : depth - 1); } }), o || (a ? [] : {})); | ||
// } | ||
// return JSON.stringify(_build('', val, depth), null, space); | ||
// } | ||
function doSerialize(method, x) { | ||
// const method = getBestMethod(category, x); | ||
serializedValue = serializers[method](x); | ||
} | ||
// ########################################################################### | ||
@@ -43,3 +28,3 @@ // complexSerializer | ||
const serializers = { | ||
[SerializationMethod.Function](x) { | ||
[SerializationMethod.Function](/* x */) { | ||
return 'ƒ'; | ||
@@ -70,2 +55,17 @@ }, | ||
// function stringify(val, depth, replacer, space) { | ||
// depth = isNaN(+depth) ? 1 : depth; | ||
// function _build(key, val, depth, o, a) { // (JSON.stringify() has it's own rules, which we respect here by using it for property iteration) | ||
// return !val || typeof val != 'object' ? val : (a = Array.isArray(val), JSON.stringify(val, function (k, v) { if (a || depth > 0) { if (replacer) v = replacer(k, v); if (!k) return (a = Array.isArray(v), val = v); !o && (o = a ? [] : {}); o[k] = _build(k, v, a ? depth : depth - 1); } }), o || (a ? [] : {})); | ||
// } | ||
// return JSON.stringify(_build('', val, depth), null, space); | ||
// } | ||
function doSerialize(method, x) { | ||
// const method = getBestMethod(category, x); | ||
return serializers[method](x); | ||
} | ||
export default function serialize(category, inputValue) { | ||
@@ -72,0 +72,0 @@ // TODO: largely improve this process! |
@@ -0,0 +0,0 @@ import countBy from 'lodash/countBy'; |
@@ -0,0 +0,0 @@ // import FastBitSet from 'fastbitset'; |
@@ -11,10 +11,10 @@ | ||
export function getDomPath(el) { | ||
var stack = []; | ||
const stack = []; | ||
while (el.parentNode != null) { | ||
// console.log(el.nodeName); | ||
var sibCount = 0; | ||
var sibIndex = 0; | ||
for (var i = 0; i < el.parentNode.childNodes.length; i++) { | ||
var sib = el.parentNode.childNodes[i]; | ||
if (sib.nodeName == el.nodeName) { | ||
let sibCount = 0; | ||
let sibIndex = 0; | ||
for (let i = 0; i < el.parentNode.childNodes.length; i++) { | ||
const sib = el.parentNode.childNodes[i]; | ||
if (sib.nodeName === el.nodeName) { | ||
if (sib === el) { | ||
@@ -26,3 +26,3 @@ sibIndex = sibCount; | ||
} | ||
if (el.hasAttribute('id') && el.id != '') { | ||
if (el.hasAttribute('id') && el.id !== '') { | ||
stack.unshift(el.nodeName.toLowerCase() + '#' + el.id); | ||
@@ -29,0 +29,0 @@ } else if (sibCount > 1) { |
export default Object.freeze({}); |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ // import merge from 'lodash/merge'; |
@@ -1,2 +0,2 @@ | ||
import path from 'path' | ||
import path from 'path'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -0,0 +0,0 @@ import isFunction from 'lodash/isFunction'; |
@@ -0,0 +0,0 @@ // /** |
@@ -0,0 +0,0 @@ import process from 'process'; |
@@ -13,5 +13,5 @@ | ||
release(obj) { | ||
release(/* obj */) { | ||
// TODO | ||
} | ||
} |
@@ -0,0 +0,0 @@ /** |
@@ -0,1 +1,3 @@ | ||
/* eslint no-console: 0 */ | ||
/** | ||
@@ -8,7 +10,7 @@ * TODO: use something that works in browser as well as in Node (currently only works properly in Node) | ||
const inspectOptions = { depth: 0, colors: true }; | ||
function _inspect(arg) { | ||
const f = typeof window !== 'undefined' && window.inspect ? window.inspect : require('util').inspect; | ||
return f(arg, inspectOptions); | ||
} | ||
// const inspectOptions = { depth: 0, colors: true }; | ||
// function _inspect(arg) { | ||
// const f = typeof window !== 'undefined' && window.inspect ? window.inspect : require('util').inspect; | ||
// return f(arg, inspectOptions); | ||
// } | ||
@@ -15,0 +17,0 @@ |
import isFunction from 'lodash/isFunction'; | ||
import isString from 'lodash/isString'; | ||
import { newLogger } from '@dbux/common/src/log/logger'; | ||
import { newLogger } from '../../log/logger'; | ||
import { isPromise } from '../isPromise'; | ||
const { log, debug, warn, error: logError } = newLogger('dbux-code'); | ||
// eslint-disable-next-line no-unused-vars | ||
const { log, debug, warn, error: logError } = newLogger('SerialTaskQueue'); | ||
@@ -211,3 +212,3 @@ const WarnTimeout = 10000; | ||
try { | ||
while (!this.isEmpty()) { | ||
while (!this.isEmpty() && this._version === version) { | ||
// make sure, higher priority items come before lower piority items | ||
@@ -261,3 +262,3 @@ this._queue.sort((a, b) => { | ||
_log(...args) { | ||
_log(/* ...args */) { | ||
// debug(...args); | ||
@@ -264,0 +265,0 @@ } |
@@ -1,9 +0,9 @@ | ||
let TaskQueueState = { | ||
Idle: 0, | ||
Busy: 1, | ||
Waiting: 2 | ||
}; | ||
// let TaskQueueState = { | ||
// Idle: 0, | ||
// Busy: 1, | ||
// Waiting: 2 | ||
// }; | ||
TaskQueueState = new Enum(TaskQueueState); | ||
// TaskQueueState = new Enum(TaskQueueState); | ||
export default TaskQueueState; | ||
// export default TaskQueueState; |
@@ -0,0 +0,0 @@ /** |
@@ -40,2 +40,3 @@ import { logInternalError } from '../log/logger'; | ||
// hope for node or node-like environment | ||
// eslint-disable-next-line no-eval | ||
const { performance: performanceNodeJs } = eval("import('perf_hooks')"); | ||
@@ -42,0 +43,0 @@ return performanceNodeJs; |
Sorry, the diff of this file is not supported yet
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1879
2
2
1
64475
3
55
+ Addednanoevents@^2.0.0
+ Addednanoevents@2.0.0(transitive)
Updatedlodash@^4.17.19