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

@glimmer/program

Package Overview
Dependencies
Maintainers
11
Versions
243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/program - npm Package Compare versions

Comparing version 0.30.5 to 0.31.0

81

dist/amd/es5/glimmer-program.js

@@ -1,2 +0,2 @@

define('@glimmer/program', ['exports', '@glimmer/encoder', '@glimmer/util'], function (exports, encoder, util) { 'use strict';
define('@glimmer/program', ['exports', '@glimmer/util'], function (exports, util) { 'use strict';

@@ -275,3 +275,3 @@ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

var rawType = this.heap.getbyaddr(this.offset);
return ((rawType & encoder.OPERAND_LEN_MASK) >> encoder.ARG_SHIFT) + 1;
return ((rawType & 768 /* OPERAND_LEN_MASK */) >> 8 /* ARG_SHIFT */) + 1;
}

@@ -282,3 +282,3 @@ }, {

var rawType = this.heap.getbyaddr(this.offset);
return rawType & encoder.MACHINE_MASK;
return rawType & 1024 /* MACHINE_MASK */;
}

@@ -288,3 +288,3 @@ }, {

get: function get() {
return this.heap.getbyaddr(this.offset) & encoder.TYPE_MASK;
return this.heap.getbyaddr(this.offset) & 255 /* TYPE_MASK */;
}

@@ -319,15 +319,2 @@ }, {

var TableSlotState;
(function (TableSlotState) {
TableSlotState[TableSlotState["Allocated"] = 0] = "Allocated";
TableSlotState[TableSlotState["Freed"] = 1] = "Freed";
TableSlotState[TableSlotState["Purged"] = 2] = "Purged";
TableSlotState[TableSlotState["Pointer"] = 3] = "Pointer";
})(TableSlotState || (TableSlotState = {}));
var ENTRY_SIZE = 2;
var INFO_OFFSET = 1;
var MAX_SIZE = 65535;
var SIZE_MASK = 65535;
var SCOPE_MASK = 1073676288;
var STATE_MASK = 3221225472;
function encodeTableInfo(size, scopeSize, state) {

@@ -396,3 +383,3 @@ return size | scopeSize << 16 | state << 30;

var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -405,4 +392,4 @@ };

var instructionSize = finish - start;
var info = encodeTableInfo(instructionSize, scopeSize, TableSlotState.Allocated);
this.table[handle + INFO_OFFSET] = info;
var info = encodeTableInfo(instructionSize, scopeSize, 0 /* Allocated */);
this.table[handle + 1 /* INFO_OFFSET */] = info;
};

@@ -423,5 +410,5 @@

Heap.prototype.gethandle = function gethandle(address) {
this.table.push(address, encodeTableInfo(0, 0, TableSlotState.Pointer));
this.table.push(address, encodeTableInfo(0, 0, 3 /* Pointer */));
var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -435,9 +422,9 @@ };

Heap.prototype.scopesizeof = function scopesizeof(handle) {
var info = this.table[handle + INFO_OFFSET];
return (info & SCOPE_MASK) >> 16;
var info = this.table[handle + 1 /* INFO_OFFSET */];
return (info & 1073676288 /* SCOPE_MASK */) >> 16;
};
Heap.prototype.free = function free(handle) {
var info = this.table[handle + INFO_OFFSET];
this.table[handle + INFO_OFFSET] = changeState(info, TableSlotState.Freed);
var info = this.table[handle + 1 /* INFO_OFFSET */];
this.table[handle + 1 /* INFO_OFFSET */] = changeState(info, 1 /* Freed */);
};

@@ -459,23 +446,23 @@ /**

for (var i = 0; i < length; i += ENTRY_SIZE) {
for (var i = 0; i < length; i += 2 /* ENTRY_SIZE */) {
var offset = table[i];
var info = table[i + INFO_OFFSET];
var size = info & SIZE_MASK;
var state = info & STATE_MASK >> 30;
if (state === TableSlotState.Purged) {
continue;
} else if (state === TableSlotState.Freed) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + INFO_OFFSET] = changeState(info, TableSlotState.Purged);
compactedSize += size;
} else if (state === TableSlotState.Allocated) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
var info = table[i + 1 /* INFO_OFFSET */];
var size = info & 65535;
var state = info & 3221225472 /* STATE_MASK */ >> 30;
if (state === 2 /* Purged */) {
continue;
} else if (state === 1 /* Freed */) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + 1 /* INFO_OFFSET */] = changeState(info, 2 /* Purged */);
compactedSize += size;
} else if (state === 0 /* Allocated */) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
}
table[i] = offset - compactedSize;
} else if (state === 3 /* Pointer */) {
table[i] = offset - compactedSize;
}
table[i] = offset - compactedSize;
} else if (state === TableSlotState.Pointer) {
table[i] = offset - compactedSize;
}
}

@@ -487,3 +474,3 @@ this.offset = this.offset - compactedSize;

var address = this.offset++;
this.heap[address] = MAX_SIZE;
this.heap[address] = 65535 /* MAX_SIZE */;
this.placeholders.push([address, valueFunc]);

@@ -596,2 +583,2 @@ };

});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xpbW1lci1wcm9ncmFtLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZ2xpbW1lci9wcm9ncmFtL2xpYi9jb25zdGFudHMudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZ2xpbW1lci9wcm9ncmFtL2xpYi9vcGNvZGUudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZ2xpbW1lci9wcm9ncmFtL2xpYi9wcm9ncmFtLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE9wYXF1ZSwgU3ltYm9sVGFibGUsIFJ1bnRpbWVSZXNvbHZlciwgQ29tcGlsZVRpbWVDb25zdGFudHMgfSBmcm9tIFwiQGdsaW1tZXIvaW50ZXJmYWNlc1wiO1xuXG5jb25zdCBVTlJFU09MVkVEID0ge307XG5cbmNvb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0FBSztvQkFGUDs7Ozs7O0FBUVgsSUFLRTs7WUFBbUIsZ0ZBQWdDLElBQUk7WUFBNkIsMkVBQU8sSUFBSTs7OzthQUFuRSxZQUFUO2FBQXFFLE9BQUo7YUFDN0UsVUFBVSxJQUFJLE9BQU8sS0FBSzs7O3dEQUcxQixRQUNMO2FBQUssUUFBUSxTQUFTO2VBQ2YsS0FBSzs7Ozs7QUFJaEIsSUFZRTs0QkFBbUIsV0FBa0Q7OzthQUF6QyxZQUFUO2FBQXNELE9BQUo7YUFDOUQsVUFBVSxJQUFJLE9BQU8sS0FBSzs7O21CQVYxQiwyQkFBc0IsU0FBeUIsTUFBb0IsVUFDeEU7WUFBSSxPQUFPLElBQUksS0FBSztZQUNoQixZQUFZLElBQUksaUJBQWlCLFVBQVU7ZUFFeEMsSUFBSSxlQUFlLFdBQVc7OztzREFTaEMsUUFDTDthQUFLLFFBQVEsU0FBUztlQUNmLEtBQUs7Ozs7O0FBSWhCLElBQW1DOzs7Ozs7Ozs7O0VBQVE7QUFJM0MsZUFBZSxLQUE2QixPQUFlLEtBQ3pEO1FBQUksZUFBZSxhQUFhO1lBQzFCLElBQUksVUFBVSxXQUFXO21CQUNwQixJQUFJLE1BQU0sT0FBTyxLQUFLOztZQUczQixNQUFNLElBQUksWUFBWTtlQUVuQixRQUFRLEtBQUssU0FBUztnQkFDdkIsU0FBVSxJQUFJOztlQUdiLElBQUk7O1dBR047Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==

@@ -6,6 +6,2 @@ "use strict";

});
exports.Opcode = undefined;
var _encoder = require("@glimmer/encoder");
class Opcode {

@@ -18,10 +14,10 @@ constructor(heap) {

let rawType = this.heap.getbyaddr(this.offset);
return ((rawType & _encoder.OPERAND_LEN_MASK) >> _encoder.ARG_SHIFT) + 1;
return ((rawType & 768 /* OPERAND_LEN_MASK */) >> 8 /* ARG_SHIFT */) + 1;
}
get isMachine() {
let rawType = this.heap.getbyaddr(this.offset);
return rawType & _encoder.MACHINE_MASK;
return rawType & 1024 /* MACHINE_MASK */;
}
get type() {
return this.heap.getbyaddr(this.offset) & _encoder.TYPE_MASK;
return this.heap.getbyaddr(this.offset) & 255 /* TYPE_MASK */;
}

@@ -39,2 +35,2 @@ get op1() {

exports.Opcode = Opcode;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3Bjb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvb3Bjb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFDQSxBQUFPLEFBQUUsQUFBUyxBQUFFLEFBQWdCLEFBQUUsQUFBUyxBQUFFLEFBQVksQUFBRSxBQUFNLEFBQWtCLEFBQUMsQUFFeEYsQUFBTTs7O2dCQUVnQixBQUFVLE1BQVY7YUFBSSxPQURqQixBQUNhLEFBQUksQUFBTTthQURqQixTQUFHLEFBQUMsQUFBQyxBQUNlLEFBQUM7QUFFbEM7UUFBSSxBQUFJLE9BQ047WUFBSSxBQUFPLFVBQUcsQUFBSSxLQUFDLEFBQUksS0FBQyxBQUFTLFVBQUMsQUFBSSxLQUFDLEFBQU0sQUFBQyxBQUFDLEFBQy9DLEFBQU07ZUFBQyxDQUFDLENBQUMsQUFBTyxBQUFHLEFBQWdCLEFBQUMsQUFBSSxBQUFTLEFBQUMsOERBQUcsQUFBQyxBQUFDLEFBQ3pELEFBQUM7QUFFRDtRQUFJLEFBQVMsWUFDWDtZQUFJLEFBQU8sVUFBRyxBQUFJLEtBQUMsQUFBSSxLQUFDLEFBQVMsVUFBQyxBQUFJLEtBQUMsQUFBTSxBQUFDLEFBQUMsQUFDL0MsQUFBTTtlQUFDLEFBQU8sQUFBRyxBQUFZLEFBQUMsQUFDaEMsQUFBQztBQUVEO1FBQUksQUFBSSxPQUNOLEFBQU0sQUFBQ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YXA6IEhlYXApIHt9XG5cbiAgZ2V0IHNpemUoKSB7XG4gICAgbGV0IHJhd1R5cGUgPSB0aGlzLmhlYXAuZ2V0YnlhZGRyKHRoaXMub2Zmc2V0KTtcbiAgICByZXR1cm4gKChyYXdUeXBlICYgT3Bjb2RlU2l6ZS5PUEVSQU5EX0xFTl9NQVNLKSA+PiBPcGNvZGVTaXplLkFSR19TSElGVCkgKyAxO1xuICB9XG5cbiAgZ2V0IGlzTWFjaGluZSgpIHtcbiAgICBsZXQgcmF3VHlwZSA9IHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQpO1xuICAgIHJldHVybiByYXdUeXBlICYgT3Bjb2RlU2l6ZS5NQUNISU5FX01BU0s7XG4gIH1cblxuICBnZXQgdHlwZSgpIHtcbiAgICByZXR1cm4gKHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQpICYgT3Bjb2RlU2l6ZS5UWVBFX01BU0spO1xuICB9XG5cbiAgZ2V0IG9wMSgpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDEpO1xuICB9XG5cbiAgZ2V0IG9wMigpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDIpO1xuICB9XG5cbiAgZ2V0IG9wMygpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDMpO1xuICB9XG59XG4iXX0=

@@ -14,15 +14,2 @@ 'use strict';

var TableSlotState;
(function (TableSlotState) {
TableSlotState[TableSlotState["Allocated"] = 0] = "Allocated";
TableSlotState[TableSlotState["Freed"] = 1] = "Freed";
TableSlotState[TableSlotState["Purged"] = 2] = "Purged";
TableSlotState[TableSlotState["Pointer"] = 3] = "Pointer";
})(TableSlotState || (TableSlotState = {}));
const ENTRY_SIZE = 2;
const INFO_OFFSET = 1;
const MAX_SIZE = 0b1111111111111111;
const SIZE_MASK = 0b00000000000000001111111111111111;
const SCOPE_MASK = 0b00111111111111110000000000000000;
const STATE_MASK = 0b11000000000000000000000000000000;
function encodeTableInfo(size, scopeSize, state) {

@@ -82,3 +69,3 @@ return size | scopeSize << 16 | state << 30;

let handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -90,4 +77,4 @@ }

let instructionSize = finish - start;
let info = encodeTableInfo(instructionSize, scopeSize, TableSlotState.Allocated);
this.table[handle + INFO_OFFSET] = info;
let info = encodeTableInfo(instructionSize, scopeSize, 0 /* Allocated */);
this.table[handle + 1 /* INFO_OFFSET */] = info;
}

@@ -104,5 +91,5 @@ size() {

gethandle(address) {
this.table.push(address, encodeTableInfo(0, 0, TableSlotState.Pointer));
this.table.push(address, encodeTableInfo(0, 0, 3 /* Pointer */));
let handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -112,4 +99,4 @@ }

if (false) {
let info = this.table[handle + INFO_OFFSET];
return info & SIZE_MASK;
let info = this.table[handle + 1 /* INFO_OFFSET */];
return info & 65535 /* SIZE_MASK */;
}

@@ -119,8 +106,8 @@ return -1;

scopesizeof(handle) {
let info = this.table[handle + INFO_OFFSET];
return (info & SCOPE_MASK) >> 16;
let info = this.table[handle + 1 /* INFO_OFFSET */];
return (info & 1073676288 /* SCOPE_MASK */) >> 16;
}
free(handle) {
let info = this.table[handle + INFO_OFFSET];
this.table[handle + INFO_OFFSET] = changeState(info, TableSlotState.Freed);
let info = this.table[handle + 1 /* INFO_OFFSET */];
this.table[handle + 1 /* INFO_OFFSET */] = changeState(info, 1 /* Freed */);
}

@@ -137,23 +124,23 @@ /**

let { table, table: { length }, heap } = this;
for (let i = 0; i < length; i += ENTRY_SIZE) {
for (let i = 0; i < length; i += 2 /* ENTRY_SIZE */) {
let offset = table[i];
let info = table[i + INFO_OFFSET];
let size = info & SIZE_MASK;
let state = info & STATE_MASK >> 30;
if (state === TableSlotState.Purged) {
continue;
} else if (state === TableSlotState.Freed) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + INFO_OFFSET] = changeState(info, TableSlotState.Purged);
compactedSize += size;
} else if (state === TableSlotState.Allocated) {
for (let j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
let info = table[i + 1 /* INFO_OFFSET */];
let size = info & 65535 /* SIZE_MASK */;
let state = info & 3221225472 /* STATE_MASK */ >> 30;
if (state === 2 /* Purged */) {
continue;
} else if (state === 1 /* Freed */) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + 1 /* INFO_OFFSET */] = changeState(info, 2 /* Purged */);
compactedSize += size;
} else if (state === 0 /* Allocated */) {
for (let j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
}
table[i] = offset - compactedSize;
} else if (state === 3 /* Pointer */) {
table[i] = offset - compactedSize;
}
table[i] = offset - compactedSize;
} else if (state === TableSlotState.Pointer) {
table[i] = offset - compactedSize;
}
}

@@ -164,3 +151,3 @@ this.offset = this.offset - compactedSize;

let address = this.offset++;
this.heap[address] = MAX_SIZE;
this.heap[address] = 65535 /* MAX_SIZE */;
this.placeholders.push([address, valueFunc]);

@@ -172,3 +159,3 @@ }

let [address, getValue] = placeholders[i];
false && (0, _util.assert)(this.getbyaddr(address) === MAX_SIZE, `expected to find a placeholder value at ${address}`);
false && (0, _util.assert)(this.getbyaddr(address) === 65535 /* MAX_SIZE */, `expected to find a placeholder value at ${address}`);

@@ -234,2 +221,2 @@ this.setbyaddr(address, getValue());

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncy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FydF0gID0gYXJyW3N0YXJ0XTtcbiAgICB9XG5cbiAgICByZXR1cm4gcmV0LmJ1ZmZlcjtcbiAgfVxuXG4gIHJldHVybiBudWxsO1xufVxuIl19

@@ -6,6 +6,2 @@ "use strict";

});
exports.Opcode = undefined;
var _encoder = require("@glimmer/encoder");
var _createClass = function () {

@@ -39,3 +35,3 @@ function defineProperties(target, props) {

var rawType = this.heap.getbyaddr(this.offset);
return ((rawType & _encoder.OPERAND_LEN_MASK) >> _encoder.ARG_SHIFT) + 1;
return ((rawType & 768 /* OPERAND_LEN_MASK */) >> 8 /* ARG_SHIFT */) + 1;
}

@@ -46,3 +42,3 @@ }, {

var rawType = this.heap.getbyaddr(this.offset);
return rawType & _encoder.MACHINE_MASK;
return rawType & 1024 /* MACHINE_MASK */;
}

@@ -52,3 +48,3 @@ }, {

get: function get() {
return this.heap.getbyaddr(this.offset) & _encoder.TYPE_MASK;
return this.heap.getbyaddr(this.offset) & 255 /* TYPE_MASK */;
}

@@ -74,2 +70,2 @@ }, {

}();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3Bjb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvb3Bjb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFDQSxBQUFPLEFBQUUsQUFBUyxBQUFFLEFBQWdCLEFBQUUsQUFBUyxBQUFFLEFBQVksQUFBRSxBQUFNLEFBQWtCLEFBQUMsQUFFeEYsQUFBTTs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBRUo7b0JBQW9CLEFBQVUsTUFBVjs7O2FBQUksT0FEakIsQUFDYSxBQUFJLEFBQU07YUFEakIsU0FBRyxBQUFDLEFBQUMsQUFDZSxBQUFDLEFBRWxDLEFBQUksQUFBSTs7Ozs7NEJBQ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cbiAgZ2V0IG9wMSgpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDEpO1xuICB9XG5cbiAgZ2V0IG9wMigpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDIpO1xuICB9XG5cbiAgZ2V0IG9wMygpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDMpO1xuICB9XG59XG4iXX0=

@@ -40,15 +40,2 @@ "use strict";

var TableSlotState;
(function (TableSlotState) {
TableSlotState[TableSlotState["Allocated"] = 0] = "Allocated";
TableSlotState[TableSlotState["Freed"] = 1] = "Freed";
TableSlotState[TableSlotState["Purged"] = 2] = "Purged";
TableSlotState[TableSlotState["Pointer"] = 3] = "Pointer";
})(TableSlotState || (TableSlotState = {}));
var ENTRY_SIZE = 2;
var INFO_OFFSET = 1;
var MAX_SIZE = 65535;
var SIZE_MASK = 65535;
var SCOPE_MASK = 1073676288;
var STATE_MASK = 3221225472;
function encodeTableInfo(size, scopeSize, state) {

@@ -117,3 +104,3 @@ return size | scopeSize << 16 | state << 30;

var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -126,4 +113,4 @@ };

var instructionSize = finish - start;
var info = encodeTableInfo(instructionSize, scopeSize, TableSlotState.Allocated);
this.table[handle + INFO_OFFSET] = info;
var info = encodeTableInfo(instructionSize, scopeSize, 0 /* Allocated */);
this.table[handle + 1 /* INFO_OFFSET */] = info;
};

@@ -144,5 +131,5 @@

Heap.prototype.gethandle = function gethandle(address) {
this.table.push(address, encodeTableInfo(0, 0, TableSlotState.Pointer));
this.table.push(address, encodeTableInfo(0, 0, 3 /* Pointer */));
var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -153,4 +140,4 @@ };

if (false) {
var info = this.table[handle + INFO_OFFSET];
return info & SIZE_MASK;
var info = this.table[handle + 1 /* INFO_OFFSET */];
return info & 65535 /* SIZE_MASK */;
}

@@ -161,9 +148,9 @@ return -1;

Heap.prototype.scopesizeof = function scopesizeof(handle) {
var info = this.table[handle + INFO_OFFSET];
return (info & SCOPE_MASK) >> 16;
var info = this.table[handle + 1 /* INFO_OFFSET */];
return (info & 1073676288 /* SCOPE_MASK */) >> 16;
};
Heap.prototype.free = function free(handle) {
var info = this.table[handle + INFO_OFFSET];
this.table[handle + INFO_OFFSET] = changeState(info, TableSlotState.Freed);
var info = this.table[handle + 1 /* INFO_OFFSET */];
this.table[handle + 1 /* INFO_OFFSET */] = changeState(info, 1 /* Freed */);
};

@@ -184,23 +171,23 @@ /**

for (var i = 0; i < length; i += ENTRY_SIZE) {
for (var i = 0; i < length; i += 2 /* ENTRY_SIZE */) {
var offset = table[i];
var info = table[i + INFO_OFFSET];
var size = info & SIZE_MASK;
var state = info & STATE_MASK >> 30;
if (state === TableSlotState.Purged) {
continue;
} else if (state === TableSlotState.Freed) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + INFO_OFFSET] = changeState(info, TableSlotState.Purged);
compactedSize += size;
} else if (state === TableSlotState.Allocated) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
var info = table[i + 1 /* INFO_OFFSET */];
var size = info & 65535 /* SIZE_MASK */;
var state = info & 3221225472 /* STATE_MASK */ >> 30;
if (state === 2 /* Purged */) {
continue;
} else if (state === 1 /* Freed */) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + 1 /* INFO_OFFSET */] = changeState(info, 2 /* Purged */);
compactedSize += size;
} else if (state === 0 /* Allocated */) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
}
table[i] = offset - compactedSize;
} else if (state === 3 /* Pointer */) {
table[i] = offset - compactedSize;
}
table[i] = offset - compactedSize;
} else if (state === TableSlotState.Pointer) {
table[i] = offset - compactedSize;
}
}

@@ -212,3 +199,3 @@ this.offset = this.offset - compactedSize;

var address = this.offset++;
this.heap[address] = MAX_SIZE;
this.heap[address] = 65535 /* MAX_SIZE */;
this.placeholders.push([address, valueFunc]);

@@ -225,3 +212,3 @@ };

false && (0, _util.assert)(this.getbyaddr(address) === MAX_SIZE, 'expected to find a placeholder value at ' + address);
false && (0, _util.assert)(this.getbyaddr(address) === 65535 /* MAX_SIZE */, 'expected to find a placeholder value at ' + address);

@@ -310,2 +297,2 @@ this.setbyaddr(address, getValue());

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUdBLEFBQU8sQUFBYSxBQUFrQixBQUFFLEFBQWdCLEFBQWdCLEFBQU0sQUFBYSxBQUFDOztBQUM1RixBQUFPLEFBQUUsQUFBTSxBQUFFLEFBQU0sQUFBVSxBQUFDOztBQUNsQyxBQUFPLEFBQUUsQUFBTSxBQUFFLEFBQU0sQUFBZSxBQUFDOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBRXZDLElBQUssQUFLSjtBQUxELFdBQUssQUFBYyxnQkFDakI7c0RBQVMsQUFDVDtrREFBSyxBQUNMO21EQUFNLEFBQ047b0RBQU8sQUFDVCxBQUFDO0dBTEksQUFBYyxtQkFBZCxBQUFjLGlCQUtsQjtBQUVELElBQU0sQUFBVSxhQUFHLEFBQUMsQUFBQztBQUNyQixJQUFNLEFBQVcsY0FBRyxBQUFDLEFBQUM7QUFDdEIsSUFBTSxBQUFRLFdBQUcsQUFBa0IsQUFBQztBQUNwQyxJQUFNLEFBQVMsWUFBSSxBQUFrQyxB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{

@@ -9,10 +8,10 @@ constructor(heap) {

let rawType = this.heap.getbyaddr(this.offset);
return ((rawType & OPERAND_LEN_MASK) >> ARG_SHIFT) + 1;
return ((rawType & 768 /* OPERAND_LEN_MASK */) >> 8 /* ARG_SHIFT */) + 1;
}
get isMachine() {
let rawType = this.heap.getbyaddr(this.offset);
return rawType & MACHINE_MASK;
return rawType & 1024 /* MACHINE_MASK */;
}
get type() {
return this.heap.getbyaddr(this.offset) & TYPE_MASK;
return this.heap.getbyaddr(this.offset) & 255 /* TYPE_MASK */;
}

@@ -29,2 +28,2 @@ get op1() {

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3Bjb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvb3Bjb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLEFBQU8sU0FBRSxBQUFTLFdBQUUsQUFBZ0Isa0JBQUUsQUFBUyxXQUFFLEFBQVksQUFBRSxvQkFBTSxBQUFrQixBQUFDO0FBRXhGLEFBQU07QUFFSixnQkFBb0IsQUFBVTtBQUFWLGFBQUksT0FBSixBQUFJLEFBQU07QUFEdkIsYUFBTSxTQUFHLEFBQUMsQUFBQyxBQUNlO0FBQUM7QUFFbEMsUUFBSSxBQUFJO0FBQ04sWUFBSSxBQUFPLFVBQUcsQUFBSSxLQUFDLEFBQUksS0FBQyxBQUFTLFVBQUMsQUFBSSxLQUFDLEFBQU0sQUFBQyxBQUFDO0FBQy9DLEFBQU0sZUFBQyxDQUFDLENBQUMsQUFBTyxVQUFHLEFBQWdCLEFBQUMscUJBQUksQUFBUyxBQUFDLGFBQUcsQUFBQyxBQUFDLEFBQ3pEO0FBQUM7QUFFRCxRQUFJLEFBQVM7QUFDWCxZQUFJLEFBQU8sVUFBRyxBQUFJLEtBQUMsQU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l6ZSB9IGZyb20gXCJAZ2xpbW1lci9lbmNvZGVyXCI7XG5cbmV4cG9ydCBjbGFzcyBPcGNvZGUge1xuICBwdWJsaWMgb2Zmc2V0ID0gMDtcbiAgY29uc3RydWN0b3IocHJpdmF0ZSBoZWFwOiBIZWFwKSB7fVxuXG4gIGdldCBzaXplKCkge1xuICAgIGxldCByYXdUeXBlID0gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCk7XG4gICAgcmV0dXJuICgocmF3VHlwZSAmIE9wY29kZVNpemUuT1BFUkFORF9MRU5fTUFTSykgPj4gT3Bjb2RlU2l6ZS5BUkdfU0hJRlQpICsgMTtcbiAgfVxuXG4gIGdldCBpc01hY2hpbmUoKSB7XG4gICAgbGV0IHJhd1R5cGUgPSB0aGlzLmhlYXAuZ2V0YnlhZGRyKHRoaXMub2Zmc2V0KTtcbiAgICByZXR1cm4gcmF3VHlwZSAmIE9wY29kZVNpemUuTUFDSElORV9NQVNLO1xuICB9XG5cbiAgZ2V0IHR5cGUoKSB7XG4gICAgcmV0dXJuICh0aGlzLmhlYXAuZ2V0YnlhZGRyKHRoaXMub2Zmc2V0KSAmIE9wY29kZVNpemUuVFlQRV9NQVNLKTtcbiAgfVxuXG4gIGdldCBvcDEoKSB7XG4gICAgcmV0dXJuIHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQgKyAxKTtcbiAgfVxuXG4gIGdldCBvcDIoKSB7XG4gICAgcmV0dXJuIHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQgKyAyKTtcbiAgfVxuXG4gIGdldCBvcDMoKSB7XG4gICAgcmV0dXJuIHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQgKyAzKTtcbiAgfVxufVxuIl19

@@ -5,15 +5,2 @@

import { assert } from "@glimmer/util";
var TableSlotState;
(function (TableSlotState) {
TableSlotState[TableSlotState["Allocated"] = 0] = "Allocated";
TableSlotState[TableSlotState["Freed"] = 1] = "Freed";
TableSlotState[TableSlotState["Purged"] = 2] = "Purged";
TableSlotState[TableSlotState["Pointer"] = 3] = "Pointer";
})(TableSlotState || (TableSlotState = {}));
const ENTRY_SIZE = 2;
const INFO_OFFSET = 1;
const MAX_SIZE = 0b1111111111111111;
const SIZE_MASK = 0b00000000000000001111111111111111;
const SCOPE_MASK = 0b00111111111111110000000000000000;
const STATE_MASK = 0b11000000000000000000000000000000;
function encodeTableInfo(size, scopeSize, state) {

@@ -73,3 +60,3 @@ return size | scopeSize << 16 | state << 30;

let handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -81,4 +68,4 @@ }

let instructionSize = finish - start;
let info = encodeTableInfo(instructionSize, scopeSize, TableSlotState.Allocated);
this.table[handle + INFO_OFFSET] = info;
let info = encodeTableInfo(instructionSize, scopeSize, 0 /* Allocated */);
this.table[handle + 1 /* INFO_OFFSET */] = info;
}

@@ -95,5 +82,5 @@ size() {

gethandle(address) {
this.table.push(address, encodeTableInfo(0, 0, TableSlotState.Pointer));
this.table.push(address, encodeTableInfo(0, 0, 3 /* Pointer */));
let handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -103,4 +90,4 @@ }

if (false) {
let info = this.table[handle + INFO_OFFSET];
return info & SIZE_MASK;
let info = this.table[handle + 1 /* INFO_OFFSET */];
return info & 65535 /* SIZE_MASK */;
}

@@ -110,8 +97,8 @@ return -1;

scopesizeof(handle) {
let info = this.table[handle + INFO_OFFSET];
return (info & SCOPE_MASK) >> 16;
let info = this.table[handle + 1 /* INFO_OFFSET */];
return (info & 1073676288 /* SCOPE_MASK */) >> 16;
}
free(handle) {
let info = this.table[handle + INFO_OFFSET];
this.table[handle + INFO_OFFSET] = changeState(info, TableSlotState.Freed);
let info = this.table[handle + 1 /* INFO_OFFSET */];
this.table[handle + 1 /* INFO_OFFSET */] = changeState(info, 1 /* Freed */);
}

@@ -128,23 +115,23 @@ /**

let { table, table: { length }, heap } = this;
for (let i = 0; i < length; i += ENTRY_SIZE) {
for (let i = 0; i < length; i += 2 /* ENTRY_SIZE */) {
let offset = table[i];
let info = table[i + INFO_OFFSET];
let size = info & SIZE_MASK;
let state = info & STATE_MASK >> 30;
if (state === TableSlotState.Purged) {
continue;
} else if (state === TableSlotState.Freed) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + INFO_OFFSET] = changeState(info, TableSlotState.Purged);
compactedSize += size;
} else if (state === TableSlotState.Allocated) {
for (let j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
let info = table[i + 1 /* INFO_OFFSET */];
let size = info & 65535 /* SIZE_MASK */;
let state = info & 3221225472 /* STATE_MASK */ >> 30;
if (state === 2 /* Purged */) {
continue;
} else if (state === 1 /* Freed */) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + 1 /* INFO_OFFSET */] = changeState(info, 2 /* Purged */);
compactedSize += size;
} else if (state === 0 /* Allocated */) {
for (let j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
}
table[i] = offset - compactedSize;
} else if (state === 3 /* Pointer */) {
table[i] = offset - compactedSize;
}
table[i] = offset - compactedSize;
} else if (state === TableSlotState.Pointer) {
table[i] = offset - compactedSize;
}
}

@@ -155,3 +142,3 @@ this.offset = this.offset - compactedSize;

let address = this.offset++;
this.heap[address] = MAX_SIZE;
this.heap[address] = 65535 /* MAX_SIZE */;
this.placeholders.push([address, valueFunc]);

@@ -163,3 +150,3 @@ }

let [address, getValue] = placeholders[i];
(false && assert(this.getbyaddr(address) === MAX_SIZE, `expected to find a placeholder value at ${address}`));
(false && assert(this.getbyaddr(address) === 65535 /* MAX_SIZE */, `expected to find a placeholder value at ${address}`));

@@ -221,2 +208,2 @@ this.setbyaddr(address, getValue());

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyI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sgc3RhcnQrKykge1xuICAgICAgcmV0W3N0YXJ0XSAgPSBhcnJbc3RhcnRdO1xuICAgIH1cblxuICAgIHJldHVybiByZXQuYnVmZmVyO1xuICB9XG5cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0=

@@ -5,3 +5,2 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { TYPE_MASK, OPERAND_LEN_MASK, ARG_SHIFT, MACHINE_MASK } from "@glimmer/encoder";
export var Opcode = function () {

@@ -19,3 +18,3 @@ function Opcode(heap) {

var rawType = this.heap.getbyaddr(this.offset);
return ((rawType & OPERAND_LEN_MASK) >> ARG_SHIFT) + 1;
return ((rawType & 768 /* OPERAND_LEN_MASK */) >> 8 /* ARG_SHIFT */) + 1;
}

@@ -26,3 +25,3 @@ }, {

var rawType = this.heap.getbyaddr(this.offset);
return rawType & MACHINE_MASK;
return rawType & 1024 /* MACHINE_MASK */;
}

@@ -32,3 +31,3 @@ }, {

get: function get() {
return this.heap.getbyaddr(this.offset) & TYPE_MASK;
return this.heap.getbyaddr(this.offset) & 255 /* TYPE_MASK */;
}

@@ -54,2 +53,2 @@ }, {

}();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3Bjb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvb3Bjb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFDQSxBQUFPLFNBQUUsQUFBUyxXQUFFLEFBQWdCLG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HJldHVybiByYXdUeXBlICYgT3Bjb2RlU2l6ZS5NQUNISU5FX01BU0s7XG4gIH1cblxuICBnZXQgdHlwZSgpIHtcbiAgICByZXR1cm4gKHRoaXMuaGVhcC5nZXRieWFkZHIodGhpcy5vZmZzZXQpICYgT3Bjb2RlU2l6ZS5UWVBFX01BU0spO1xuICB9XG5cbiAgZ2V0IG9wMSgpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDEpO1xuICB9XG5cbiAgZ2V0IG9wMigpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDIpO1xuICB9XG5cbiAgZ2V0IG9wMygpIHtcbiAgICByZXR1cm4gdGhpcy5oZWFwLmdldGJ5YWRkcih0aGlzLm9mZnNldCArIDMpO1xuICB9XG59XG4iXX0=

@@ -12,15 +12,2 @@ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

import { assert } from "@glimmer/util";
var TableSlotState;
(function (TableSlotState) {
TableSlotState[TableSlotState["Allocated"] = 0] = "Allocated";
TableSlotState[TableSlotState["Freed"] = 1] = "Freed";
TableSlotState[TableSlotState["Purged"] = 2] = "Purged";
TableSlotState[TableSlotState["Pointer"] = 3] = "Pointer";
})(TableSlotState || (TableSlotState = {}));
var ENTRY_SIZE = 2;
var INFO_OFFSET = 1;
var MAX_SIZE = 65535;
var SIZE_MASK = 65535;
var SCOPE_MASK = 1073676288;
var STATE_MASK = 3221225472;
function encodeTableInfo(size, scopeSize, state) {

@@ -89,3 +76,3 @@ return size | scopeSize << 16 | state << 30;

var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -98,4 +85,4 @@ };

var instructionSize = finish - start;
var info = encodeTableInfo(instructionSize, scopeSize, TableSlotState.Allocated);
this.table[handle + INFO_OFFSET] = info;
var info = encodeTableInfo(instructionSize, scopeSize, 0 /* Allocated */);
this.table[handle + 1 /* INFO_OFFSET */] = info;
};

@@ -116,5 +103,5 @@

Heap.prototype.gethandle = function gethandle(address) {
this.table.push(address, encodeTableInfo(0, 0, TableSlotState.Pointer));
this.table.push(address, encodeTableInfo(0, 0, 3 /* Pointer */));
var handle = this.handle;
this.handle += ENTRY_SIZE;
this.handle += 2 /* ENTRY_SIZE */;
return handle;

@@ -125,4 +112,4 @@ };

if (false) {
var info = this.table[handle + INFO_OFFSET];
return info & SIZE_MASK;
var info = this.table[handle + 1 /* INFO_OFFSET */];
return info & 65535 /* SIZE_MASK */;
}

@@ -133,9 +120,9 @@ return -1;

Heap.prototype.scopesizeof = function scopesizeof(handle) {
var info = this.table[handle + INFO_OFFSET];
return (info & SCOPE_MASK) >> 16;
var info = this.table[handle + 1 /* INFO_OFFSET */];
return (info & 1073676288 /* SCOPE_MASK */) >> 16;
};
Heap.prototype.free = function free(handle) {
var info = this.table[handle + INFO_OFFSET];
this.table[handle + INFO_OFFSET] = changeState(info, TableSlotState.Freed);
var info = this.table[handle + 1 /* INFO_OFFSET */];
this.table[handle + 1 /* INFO_OFFSET */] = changeState(info, 1 /* Freed */);
};

@@ -157,23 +144,23 @@ /**

for (var i = 0; i < length; i += ENTRY_SIZE) {
for (var i = 0; i < length; i += 2 /* ENTRY_SIZE */) {
var offset = table[i];
var info = table[i + INFO_OFFSET];
var size = info & SIZE_MASK;
var state = info & STATE_MASK >> 30;
if (state === TableSlotState.Purged) {
continue;
} else if (state === TableSlotState.Freed) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + INFO_OFFSET] = changeState(info, TableSlotState.Purged);
compactedSize += size;
} else if (state === TableSlotState.Allocated) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
var info = table[i + 1 /* INFO_OFFSET */];
var size = info & 65535 /* SIZE_MASK */;
var state = info & 3221225472 /* STATE_MASK */ >> 30;
if (state === 2 /* Purged */) {
continue;
} else if (state === 1 /* Freed */) {
// transition to "already freed" aka "purged"
// a good improvement would be to reuse
// these slots
table[i + 1 /* INFO_OFFSET */] = changeState(info, 2 /* Purged */);
compactedSize += size;
} else if (state === 0 /* Allocated */) {
for (var j = offset; j <= i + size; j++) {
heap[j - compactedSize] = heap[j];
}
table[i] = offset - compactedSize;
} else if (state === 3 /* Pointer */) {
table[i] = offset - compactedSize;
}
table[i] = offset - compactedSize;
} else if (state === TableSlotState.Pointer) {
table[i] = offset - compactedSize;
}
}

@@ -185,3 +172,3 @@ this.offset = this.offset - compactedSize;

var address = this.offset++;
this.heap[address] = MAX_SIZE;
this.heap[address] = 65535 /* MAX_SIZE */;
this.placeholders.push([address, valueFunc]);

@@ -198,3 +185,3 @@ };

false && assert(this.getbyaddr(address) === MAX_SIZE, 'expected to find a placeholder value at ' + address);
false && assert(this.getbyaddr(address) === 65535 /* MAX_SIZE */, 'expected to find a placeholder value at ' + address);

@@ -283,2 +270,2 @@ this.setbyaddr(address, getValue());

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFHQSxBQUFPLFNBQWEsQUFBa0Isb0JBQUUsQUFBZ0IsQUFBZ0Isd0JBQU0sQUFBYSxBQUFDO0FBQzVGLEFBQU8sU0FBRSxBQUFNLEFBQUUsY0FBTSxBQUFVLEFBQUM7QUFDbEMsQUFBTyxTQUFFLEFBQU0sQUFBRSxjQUFNLEFBQWUsQUFBQztBQUV2QyxJQUFLLEFBS0o7QUFMRC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1cm4gcmV0LmJ1ZmZlcjtcbiAgfVxuXG4gIHJldHVybiBudWxsO1xufVxuIl19
{
"name": "@glimmer/program",
"version": "0.30.5",
"version": "0.31.0",
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/program",
"dependencies": {
"@glimmer/util": "^0.30.5",
"@glimmer/interfaces": "^0.30.5",
"@glimmer/encoder": "^0.30.5"
"@glimmer/util": "^0.31.0",
"@glimmer/interfaces": "^0.31.0",
"@glimmer/encoder": "^0.31.0"
},

@@ -10,0 +10,0 @@ "devDependencies": {

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