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

@dbux/common

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dbux/common - npm Package Compare versions

Comparing version 0.6.15 to 0.7.0

src/util/SyncPromise.js

4

package.json
{
"name": "@dbux/common",
"version": "0.6.15",
"version": "0.7.0",
"description": "",

@@ -19,3 +19,3 @@ "module": "src/index.js",

"_moduleAliases": {},
"gitHead": "54ff0e114cec4e99b5797ef55a4878ef5767a55a"
"gitHead": "5d5c57327a3bd7a5a899729a60f06a7f824a66a8"
}

@@ -23,3 +23,3 @@ /**

import { newLogger } from '@dbux/common/src/log/logger';
import { startPrettyTimer, PrettyTimer } from '@dbux/common-node/src/util/timeUtil';
import { startPrettyTimer, PrettyTimer } from '@dbux/common/src/util/timeUtil';

@@ -26,0 +26,0 @@ // eslint-disable-next-line no-unused-vars

@@ -25,2 +25,4 @@ export default class AsyncEvent {

// syncPromiseIds;
promiseId;
}

@@ -5,3 +5,5 @@ import Enum from '../../util/Enum';

/**
* future-work: add dynamic imports
* NOTE: This is just a summary type for {@link AsyncEventUpdateType}.
* For most intents and purposes, you want {@link AsyncEventUpdateType} instead.
* (Currently only used by analysis "plugins".)
*/

@@ -8,0 +10,0 @@ const asyncEventTypeObj = {

@@ -9,3 +9,5 @@ import Enum from '../../util/Enum';

Await: 3,
Resume: 4
ResumeAsync: 4,
ResumeGen: 5,
ResumeAsyncGen: 6,
};

@@ -17,9 +19,19 @@

const interruptableChildTypes = new Array(ExecutionContextType.getValueMaxIndex()).map((/* _ */) => false);
interruptableChildTypes[ExecutionContextType.Await] = true;
interruptableChildTypes[ExecutionContextType.Resume] = true;
const virtualTypes = new Array(ExecutionContextType.getValueMaxIndex()).map((/* _ */) => false);
virtualTypes[ExecutionContextType.Await] = true;
virtualTypes[ExecutionContextType.ResumeAsync] = true;
virtualTypes[ExecutionContextType.ResumeGen] = true;
virtualTypes[ExecutionContextType.ResumeAsyncGen] = true;
export function isVirtualContextType(executionContextType) {
return interruptableChildTypes[executionContextType];
return virtualTypes[executionContextType];
}
const resumeTypes = new Array(ExecutionContextType.getValueMaxIndex()).map((/* _ */) => false);
resumeTypes[ExecutionContextType.ResumeAsync] = true;
resumeTypes[ExecutionContextType.ResumeGen] = true;
resumeTypes[ExecutionContextType.ResumeAsyncGen] = true;
export function isResumeType(executionContextType) {
return resumeTypes[executionContextType];
}
export function isRealContextType(executionContextType) {

@@ -29,2 +41,9 @@ return !isVirtualContextType(executionContextType);

const asyncResumeTypes = new Array(ExecutionContextType.getValueMaxIndex()).map((/* _ */) => false);
asyncResumeTypes[ExecutionContextType.ResumeAsync] = true;
asyncResumeTypes[ExecutionContextType.ResumeAsyncGen] = true;
export function isAsyncResumeType(executionContextType) {
return asyncResumeTypes[executionContextType];
}
export default ExecutionContextType;
import Enum from '../../util/Enum';
// eslint-disable-next-line import/no-mutable-exports
let SpecialIdentifierType = {
let specialIdentifierTypeObj = {
Module: 1,

@@ -19,3 +19,12 @@ /**

Require: 10,
/**
* Dynamic import expression.
* @see https://v8.dev/features/dynamic-import
*/
Import: 11,
/**
* CommonJs.
* E.g.: `exports.f = 3;`.
*/
Exports: 12,

@@ -36,3 +45,3 @@ This: 20,

*/
SpecialIdentifierType = new Enum(SpecialIdentifierType);
const SpecialIdentifierType = new Enum(specialIdentifierTypeObj);

@@ -58,4 +67,7 @@

const notTraceable = new Array(SpecialIdentifierType.getValueMaxIndex()).map(() => false);
notTraceable[SpecialIdentifierType.Module] = true;
notTraceable[SpecialIdentifierType.Eval] = true;
notTraceable[SpecialIdentifierType.Require] = true;
notTraceable[SpecialIdentifierType.Import] = true;
notTraceable[SpecialIdentifierType.Exports] = true;
notTraceable[SpecialIdentifierType.Super] = true;

@@ -72,2 +84,3 @@ // NOTE: Proxy is traceable, but the proxy object's value should not be iterated over.

argsNotTraceableIfConstant[SpecialIdentifierType.Require] = true;
argsNotTraceableIfConstant[SpecialIdentifierType.Import] = true;
argsNotTraceableIfConstant[SpecialIdentifierType.Super] = true;

@@ -74,0 +87,0 @@

@@ -12,3 +12,5 @@ import Enum from "../../util/Enum";

Await: 3,
Resume: 4
ResumeAsync: 4,
ResumeGen: 5,
ResumeAsyncGen: 6,
};

@@ -24,11 +26,20 @@

interruptableChildTypes[StaticContextType.Await] = true;
interruptableChildTypes[StaticContextType.Resume] = true;
export function isVirtualContextType(staticContextType) {
interruptableChildTypes[StaticContextType.ResumeAsync] = true;
interruptableChildTypes[StaticContextType.ResumeGen] = true;
interruptableChildTypes[StaticContextType.ResumeAsyncGen] = true;
export function isVirtualStaticContextType(staticContextType) {
return interruptableChildTypes[staticContextType];
}
export function isRealContext(staticContextType) {
return !isVirtualContextType(staticContextType);
export function isRealStaticContext(staticContextType) {
return !isVirtualStaticContextType(staticContextType);
}
const asyncResumeTypes = new Array(StaticContextType.getValueMaxIndex()).map((/* _ */) => false);
asyncResumeTypes[StaticContextType.ResumeAsync] = true;
asyncResumeTypes[StaticContextType.ResumeAsyncGen] = true;
export function isAsyncResumeType(staticContextType) {
return asyncResumeTypes[staticContextType];
}
export default StaticContextType;

@@ -36,3 +36,3 @@ import Enum from '../../util/Enum';

Await: 20,
Resume: 21,
ResumeAsync: 21,

@@ -91,3 +91,6 @@

ClassInstance: 45,
ClassProperty: 45
ClassProperty: 45,
Yield: 50,
ResumeGen: 51,
};

@@ -94,0 +97,0 @@

@@ -14,2 +14,17 @@ import ExecutionContextType from './constants/ExecutionContextType';

class ExecutionContextExtraData {
/**
* @type {number?}
*/
callerPromiseId;
// /**
// * Id of promise whose ctor executor was on stack (if any).
// * Currently, not being used.
// *
// * @type {number?}
// */
// promisifyId;
}
export default class ExecutionContext {

@@ -56,2 +71,7 @@ /**

/**
* @type {number?}
*/
realContextId;
/**
* @type {number}

@@ -93,20 +113,13 @@ */

/**
* If the context is an async function, this is its returned `promiseId`.
*
* @type {number}
*/
asyncPromiseId;
// /**
// * If the context is an async function, this is its returned `promiseId`.
// *
// * @type {number}
// */
// asyncPromiseId;
/**
* @type {{callerPromiseId: number}?}
* @type {ExecutionContextExtraData?}
*/
data;
/**
* Set to id of promise whose ctor executor was on stack (if any).
*
* @type {number?}
*/
promisifyId;
}

@@ -20,2 +20,3 @@ /** @typedef {import('./Loc').default} Loc */

isInterruptable;
/**

@@ -22,0 +23,0 @@ * @type {number}

@@ -44,2 +44,5 @@ /** @typedef { import("./constants/SpecialIdentifierType").default } SpecialIdentifierType */

*
* Currently only set in `BaseId` and `MemberExpression`.
* We do not set it for constants, whose `TraceType` already encodes the same information (e.g. `super`, `this`, etc.).
*
* {@link SpecialIdentifierType}

@@ -46,0 +49,0 @@ */

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