Socket
Socket
Sign inDemoInstall

@glimmer/debug

Package Overview
Dependencies
Maintainers
13
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/debug - npm Package Compare versions

Comparing version 0.85.12 to 0.85.13

143

dist/dev/index.js

@@ -1,13 +0,4 @@

import { DEBUG } from '@glimmer/env';
import { LOCAL_LOGGER, enumerate, decodeHandle, decodeImmediate } from '@glimmer/util';
import { Op, MachineOp, $v0, $t1, $t0, $s1, $s0, $sp, $fp, $ra, $pc } from '@glimmer/vm';
import '@glimmer/util';
import { Op, MachineOp } from '@glimmer/vm';
const LOCAL_SHOULD_LOG = DEBUG && (() => {
let location = typeof window !== 'undefined' && window.location;
if (location && /[&?]enable_local_should_log/u.test(window.location.search)) {
return true;
}
return false;
})();
/* This file is generated by build/debug.js */

@@ -1119,138 +1110,8 @@

function debugSlice(context, start, end) {
if (LOCAL_SHOULD_LOG) {
LOCAL_LOGGER.group(`%c${start}:${end}`, 'color: #999');
let heap = context.program.heap;
let opcode = context.program.createOp(heap);
let _size = 0;
for (let i = start; i < end; i = i + _size) {
opcode.offset = i;
let [name, params] = debug(context.program.constants, opcode, opcode.isMachine);
LOCAL_LOGGER.log(`${i}. ${logOpcode(name, params)}`);
_size = opcode.size;
}
opcode.offset = -_size;
LOCAL_LOGGER.groupEnd();
}
}
function logOpcode(type, params) {
if (LOCAL_SHOULD_LOG) {
let out = type;
if (params) {
let args = Object.keys(params).map(p => ` ${p}=${json(params[p])}`).join('');
out += args;
}
return `(${out})`;
}
}
function json(param) {
if (LOCAL_SHOULD_LOG) {
if (typeof param === 'function') {
return '<function>';
}
let string;
try {
string = JSON.stringify(param);
} catch (e) {
return '<object>';
}
if (string === undefined) {
return 'undefined';
}
let debug = JSON.parse(string);
if (typeof debug === 'object' && debug !== null && debug.GlimmerDebug !== undefined) {
return debug.GlimmerDebug;
}
return string;
}
}
function debug(c, op, isMachine) {
if (LOCAL_SHOULD_LOG) {
let metadata = opcodeMetadata(op.type, isMachine);
if (!metadata) {
throw new Error(`Missing Opcode Metadata for ${op}`);
}
let out = Object.create(null);
for (const [index, operand] of enumerate(metadata.ops)) {
let actualOperand = opcodeOperand(op, index);
switch (operand.type) {
case 'u32':
case 'i32':
case 'owner':
out[operand.name] = actualOperand;
break;
case 'handle':
out[operand.name] = c.getValue(actualOperand);
break;
case 'str':
case 'option-str':
case 'array':
out[operand.name] = c.getValue(actualOperand);
break;
case 'str-array':
out[operand.name] = c.getArray(actualOperand);
break;
case 'bool':
out[operand.name] = !!actualOperand;
break;
case 'primitive':
out[operand.name] = decodePrimitive(actualOperand, c);
break;
case 'register':
out[operand.name] = decodeRegister(actualOperand);
break;
case 'unknown':
out[operand.name] = c.getValue(actualOperand);
break;
case 'symbol-table':
case 'scope':
out[operand.name] = `<scope ${actualOperand}>`;
break;
default:
throw new Error(`Unexpected operand type ${operand.type} for debug output`);
}
}
return [metadata.name, out];
}
return undefined;
}
function opcodeOperand(opcode, index) {
switch (index) {
case 0:
return opcode.op1;
case 1:
return opcode.op2;
case 2:
return opcode.op3;
default:
throw new Error(`Unexpected operand index (must be 0-2)`);
}
}
function decodeRegister(register) {
switch (register) {
case $pc:
return 'pc';
case $ra:
return 'ra';
case $fp:
return 'fp';
case $sp:
return 'sp';
case $s0:
return 's0';
case $s1:
return 's1';
case $t0:
return 't0';
case $t1:
return 't1';
case $v0:
return 'v0';
}
}
function decodePrimitive(primitive, constants) {
if (primitive >= 0) {
return constants.getValue(decodeHandle(primitive));
}
return decodeImmediate(primitive);
}

@@ -1257,0 +1118,0 @@ // TODO: How do these map onto constant and machine types?

10

package.json
{
"name": "@glimmer/debug",
"type": "module",
"version": "0.85.12",
"version": "0.85.13",
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/debug",

@@ -21,5 +21,5 @@ "main": null,

"dependencies": {
"@glimmer/interfaces": "^0.85.12",
"@glimmer/util": "^0.85.12",
"@glimmer/vm": "^0.85.12"
"@glimmer/interfaces": "^0.85.13",
"@glimmer/util": "^0.85.13",
"@glimmer/vm": "^0.85.13"
},

@@ -33,3 +33,3 @@ "devDependencies": {

"@glimmer-workspace/build-support": "^1.0.0",
"@glimmer/local-debug-flags": "^0.85.12"
"@glimmer/local-debug-flags": "^0.85.13"
},

@@ -36,0 +36,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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