Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@best/runtime

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@best/runtime - npm Package Compare versions

Comparing version 4.0.0-alpha7 to 4.0.0-alpha8

8

dist/constants.js

@@ -16,6 +16,6 @@ const BEFORE_ALL = 'beforeAll';

export const PRIMITIVE_NODE_TYPES = {
GROUP: 'group',
BENCHMARK: 'benchmark',
RUN: 'run',
GROUP: "group",
BENCHMARK: "benchmark",
RUN: "run"
};
//# sourceMappingURL=constants.js.map
//# sourceMappingURL=constants.js.map
import { initializeBenchmarkConfig, getBenckmarkState } from './state';
import { runBenchmark as _runBenchmark } from './runner';
export * from './primitives';
const setupBenchmark = config => initializeBenchmarkConfig(config);
const runBenchmark = async config => {
const setupBenchmark = (config) => initializeBenchmarkConfig(config);
const runBenchmark = async (config) => {
if (config) {

@@ -24,2 +24,2 @@ setupBenchmark(config);

});
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

@@ -26,6 +26,4 @@ import { makeDescribe, makeBenchmark, makeBenchmarkRun } from './utils/primitives-nodes';

}
if (currentDescribeBlock.type === 'benchmark' && !currentDescribeBlock.run) {
throw new Error(
`Benchmark "${currentDescribeBlock.name}" must have a 'run()' function or contain benchmarks inside.`,
);
if (currentDescribeBlock.type === "benchmark" && !currentDescribeBlock.run) {
throw new Error(`Benchmark "${currentDescribeBlock.name}" must have a 'run()' function or contain benchmarks inside.`);
}

@@ -59,2 +57,2 @@ if (currentDescribeBlock.parent) {

export default handler;
//# sourceMappingURL=primitives-handler.js.map
//# sourceMappingURL=primitives-handler.js.map

@@ -20,8 +20,8 @@ import { dispatch } from './state';

const _addHook = (fn, hookType) => dispatch({ nodeName: 'hook', fn, hookType, nodeType: 'add_hook' });
const beforeAll = fn => _addHook(fn, HOOKS.BEFORE_ALL);
const before = fn => _addHook(fn, HOOKS.BEFORE);
const afterAll = fn => _addHook(fn, HOOKS.AFTER_ALL);
const after = fn => _addHook(fn, HOOKS.AFTER);
const run = fn => dispatch({ nodeName: 'run', fn, nodeType: RUN_BENCHMARK });
const beforeAll = (fn) => _addHook(fn, HOOKS.BEFORE_ALL);
const before = (fn) => _addHook(fn, HOOKS.BEFORE);
const afterAll = (fn) => _addHook(fn, HOOKS.AFTER_ALL);
const after = (fn) => _addHook(fn, HOOKS.AFTER);
const run = (fn) => dispatch({ nodeName: 'run', fn, nodeType: RUN_BENCHMARK });
export { describe, benchmark, beforeAll, before, afterAll, after, run };
//# sourceMappingURL=primitives.js.map
//# sourceMappingURL=primitives.js.map

@@ -10,2 +10,2 @@ export function normalizeResults(benchmarkState) {

}
//# sourceMappingURL=results.js.map
//# sourceMappingURL=results.js.map
import { raf, time, nextTick, withMacroTask, formatTime } from './utils/timers';
import { HOOKS } from './constants';
export var BenchmarkMeasureType;
(function(BenchmarkMeasureType) {
BenchmarkMeasureType['Execute'] = 'BEST/execute';
BenchmarkMeasureType['Before'] = 'BEST/before';
BenchmarkMeasureType['After'] = 'BEST/after';
(function (BenchmarkMeasureType) {
BenchmarkMeasureType["Execute"] = "BEST/execute";
BenchmarkMeasureType["Before"] = "BEST/before";
BenchmarkMeasureType["After"] = "BEST/after";
})(BenchmarkMeasureType || (BenchmarkMeasureType = {}));
const _initHandlers = () =>
Object.values(HOOKS).reduce((o, k) => {
o[k] = [];
return o;
}, {});
const _initHooks = hooks =>
hooks.reduce((m, { type, fn }) => {
m[type].push(fn);
return m;
}, _initHandlers());
const _initHandlers = () => Object.values(HOOKS).reduce((o, k) => {
o[k] = [];
return o;
}, {});
const _initHooks = (hooks) => hooks.reduce((m, { type, fn }) => {
m[type].push(fn);
return m;
}, _initHandlers());
const _forceGC = () => window.gc && window.gc();

@@ -46,3 +44,4 @@ function startMeasure(markName, type) {

})();
} else {
}
else {
benchmarkNode.aggregate = formatTime(time() - benchmarkNode.startedAt);

@@ -52,3 +51,4 @@ endMeasure(markName, BenchmarkMeasureType.Execute);

}
} catch (e) {
}
catch (e) {
benchmarkNode.aggregate = -1;

@@ -110,2 +110,2 @@ endMeasure(markName, BenchmarkMeasureType.Execute);

};
//# sourceMappingURL=run_iteration.js.map
//# sourceMappingURL=run_iteration.js.map
import { getBenchmarkRootNode } from './state';
import { runBenchmarkIteration } from './run_iteration';
import { normalizeResults } from './results';
import { validateState } from './utils/validate';
import { validateState } from "./utils/validate";
function collectNodeResults(node) {

@@ -12,5 +12,6 @@ const { name, aggregate, startedAt, run, children } = node;

resultNode.metrics = run.metrics;
} else if (children) {
resultNode.nodes = children.map(c => collectNodeResults(c));
}
else if (children) {
resultNode.nodes = children.map((c) => collectNodeResults(c));
}
return resultNode;

@@ -42,2 +43,2 @@ }

}
//# sourceMappingURL=runner.js.map
//# sourceMappingURL=runner.js.map
import primitivesHandler from './primitives-handler';
import { makeDescribe } from './utils/primitives-nodes';
import DEFAULT_STATE from './utils/default-state';
import cloneState from './utils/clone-state';
import cloneState from "./utils/clone-state";
const eventHandlers = [primitivesHandler];

@@ -14,3 +14,3 @@ const ROOT_DESCRIBE_BLOCK_NAME = typeof BEST_CONFIG !== 'undefined' ? BEST_CONFIG.benchmarkName : 'ROOT_DESCRIBE_BLOCK';

export const getBenchmarkRootNode = () => getBenckmarkState().rootDescribeBlock;
export const initializeBenchmarkConfig = newOpts => {
export const initializeBenchmarkConfig = (newOpts) => {
if (newOpts.iterations !== undefined) {

@@ -31,6 +31,7 @@ if (newOpts.iterateOnClient === undefined) {

}
} catch (err) {
}
catch (err) {
STATE.benchmarkDefinitionError = err;
}
}
//# sourceMappingURL=state.js.map
//# sourceMappingURL=state.js.map
export default function cloneState(obj) {
const stateClone = Object.assign({}, obj);
if (stateClone.children) {
stateClone.children = stateClone.children.map(obj => cloneState(obj));
stateClone.children = stateClone.children.map((obj) => cloneState(obj));
}

@@ -11,2 +11,2 @@ if (stateClone.run) {

}
//# sourceMappingURL=clone-state.js.map
//# sourceMappingURL=clone-state.js.map
export default Object.freeze({
benchmarkName: '',
benchmarkName: "",
useMacroTaskAfterBenchmark: true,

@@ -11,2 +11,2 @@ maxDuration: 1000 * 20,

});
//# sourceMappingURL=default-state.js.map
//# sourceMappingURL=default-state.js.map
import { RUN_BENCHMARK } from '../constants';
export const makeDescribe = (name, parent, mode) => ({
type: 'group',
type: "group",
mode: parent && !mode ? parent.mode : mode,

@@ -13,3 +13,3 @@ children: [],

export const makeBenchmark = (name, parent, mode) => ({
type: 'benchmark',
type: "benchmark",
mode: parent && !mode ? parent.mode : mode,

@@ -23,3 +23,3 @@ hooks: [],

export const makeBenchmarkRun = (fn, parent) => ({
type: 'run',
type: "run",
fn,

@@ -31,4 +31,4 @@ name: RUN_BENCHMARK,

hooks: [],
aggregate: 0,
aggregate: 0
});
//# sourceMappingURL=primitives-nodes.js.map
//# sourceMappingURL=primitives-nodes.js.map

@@ -34,8 +34,7 @@ /*

};
} else if (
typeof MessageChannel !== 'undefined' &&
}
else if (typeof MessageChannel !== 'undefined' &&
(isNative(MessageChannel) ||
// PhantomJS
MessageChannel.toString() === '[object MessageChannelConstructor]')
) {
MessageChannel.toString() === '[object MessageChannelConstructor]')) {
const channel = new MessageChannel();

@@ -47,3 +46,4 @@ const port = channel.port2;

};
} else {
}
else {
/* istanbul ignore next */

@@ -61,3 +61,4 @@ macroTimerFunc = () => {

};
} else {
}
else {
// fallback to macro

@@ -71,5 +72,4 @@ microTimerFunc = macroTimerFunc;

export function withMacroTask(fn) {
return (
fn._withTask ||
(fn._withTask = function() {
return (fn._withTask ||
(fn._withTask = function () {
useMacroTask = true;

@@ -79,4 +79,3 @@ const res = fn.apply(null, arguments);

return res;
})
);
}));
}

@@ -89,6 +88,8 @@ export function nextTick(cb, ctx) {

cb.call(ctx);
} catch (e) {
}
catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
}
else if (_resolve) {
_resolve(ctx);

@@ -101,15 +102,14 @@ }

macroTimerFunc();
} else {
}
else {
microTimerFunc();
}
}
return cb
? null
: new Promise(resolve => {
_resolve = resolve;
});
return cb ? null : new Promise(resolve => {
_resolve = resolve;
});
}
export const time = window.performance.now.bind(window.performance);
export const formatTime = t => Math.round(t * 1000) / 1000;
export const formatTime = (t) => Math.round(t * 1000) / 1000;
export const raf = window && window.requestAnimationFrame ? window.requestAnimationFrame : nextTick;
//# sourceMappingURL=timers.js.map
//# sourceMappingURL=timers.js.map

@@ -13,2 +13,2 @@ export function validateState(benchmarkState) {

}
//# sourceMappingURL=validate.js.map
//# sourceMappingURL=validate.js.map

@@ -7,3 +7,3 @@ {

},
"version": "4.0.0-alpha7",
"version": "4.0.0-alpha8",
"description": "Best Runtime",

@@ -20,3 +20,3 @@ "keywords": [

],
"gitHead": "fe1d14c11ece42f88c40825d8b46386fb0452cd7"
"gitHead": "4d0c42f121a7ac6b8b26079579519d216f8b2751"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc