@assemblyscript/loader
Advanced tools
Comparing version 0.10.0-nightly.20200526 to 0.10.0-nightly.20200528
@@ -11,3 +11,3 @@ /// <reference lib="esnext.bigint" /> | ||
export type Imports = { | ||
[key: string]: any; | ||
[key: string]: Record<string,unknown>; | ||
env?: { | ||
@@ -104,3 +104,3 @@ memory?: WebAssembly.Memory; | ||
/** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */ | ||
export declare function instantiate<T extends {}>( | ||
export declare function instantiate<T extends Record<string,unknown>>( | ||
source: WebAssembly.Module | BufferSource | Response | PromiseLike<WebAssembly.Module | BufferSource | Response>, | ||
@@ -111,3 +111,3 @@ imports?: Imports | ||
/** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */ | ||
export declare function instantiateSync<T extends {}>( | ||
export declare function instantiateSync<T extends Record<string,unknown>>( | ||
source: WebAssembly.Module | BufferSource, | ||
@@ -118,3 +118,3 @@ imports?: Imports | ||
/** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */ | ||
export declare function instantiateStreaming<T extends {}>( | ||
export declare function instantiateStreaming<T extends Record<string,unknown>>( | ||
source: Response | PromiseLike<Response>, | ||
@@ -125,2 +125,5 @@ imports?: Imports | ||
/** Demangles an AssemblyScript module's exports to a friendly object structure. */ | ||
export declare function demangle<T extends {}>(exports: {}, extendedExports?: {}): T; | ||
export declare function demangle<T extends Record<string,unknown>>( | ||
exports: Record<string,unknown>, | ||
extendedExports?: Record<string,unknown> | ||
): T; |
39
index.js
@@ -10,3 +10,3 @@ "use strict"; | ||
const STRING_ID = 1; | ||
const ARRAYBUFFERVIEW_ID = 2; | ||
// const ARRAYBUFFERVIEW_ID = 2; | ||
@@ -17,16 +17,16 @@ // Runtime type information | ||
const STATICARRAY = 1 << 2; | ||
const SET = 1 << 3; | ||
const MAP = 1 << 4; | ||
// const SET = 1 << 3; | ||
// const MAP = 1 << 4; | ||
const VAL_ALIGN_OFFSET = 6; | ||
const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET; | ||
// const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET; | ||
const VAL_SIGNED = 1 << 11; | ||
const VAL_FLOAT = 1 << 12; | ||
const VAL_NULLABLE = 1 << 13; | ||
// const VAL_NULLABLE = 1 << 13; | ||
const VAL_MANAGED = 1 << 14; | ||
const KEY_ALIGN_OFFSET = 15; | ||
const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET; | ||
const KEY_SIGNED = 1 << 20; | ||
const KEY_FLOAT = 1 << 21; | ||
const KEY_NULLABLE = 1 << 22; | ||
const KEY_MANAGED = 1 << 23; | ||
// const KEY_ALIGN_OFFSET = 15; | ||
// const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET; | ||
// const KEY_SIGNED = 1 << 20; | ||
// const KEY_FLOAT = 1 << 21; | ||
// const KEY_NULLABLE = 1 << 22; | ||
// const KEY_MANAGED = 1 << 23; | ||
@@ -121,5 +121,5 @@ // Array(BufferView) layout | ||
/** Gets the runtime alignment of a collection's keys. */ | ||
function getKeyAlign(info) { | ||
return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none | ||
} | ||
// function getKeyAlign(info) { | ||
// return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none | ||
// } | ||
@@ -209,4 +209,3 @@ /** Allocates a new string in the module's memory and returns its retained pointer. */ | ||
: U32[buf + SIZE_OFFSET >>> 2] >>> align; | ||
return getView(align, info & VAL_SIGNED, info & VAL_FLOAT) | ||
.subarray(buf >>>= align, buf + length); | ||
return getView(align, info & VAL_SIGNED, info & VAL_FLOAT).subarray(buf >>>= align, buf + length); | ||
} | ||
@@ -280,4 +279,6 @@ | ||
if (id <= U32[rttiBase >>> 2]) { | ||
do if (id == baseId) return true; | ||
while (id = getBase(id)); | ||
do { | ||
if (id == baseId) return true; | ||
id = getBase(id); | ||
} while (id); | ||
} | ||
@@ -351,3 +352,3 @@ return false; | ||
? length => { exports["__argumentsLength"].value = length; } | ||
: exports["__setArgumentsLength"] || exports["__setargc"] || (() => {}); | ||
: exports["__setArgumentsLength"] || exports["__setargc"] || (() => { /* nop */ }); | ||
for (let internalName in exports) { | ||
@@ -354,0 +355,0 @@ if (!Object.prototype.hasOwnProperty.call(exports, internalName)) continue; |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.10.0-nightly.20200526", | ||
"version": "0.10.0-nightly.20200528", | ||
"author": "Daniel Wirtz <dcode+assemblyscript@dcode.io>", | ||
@@ -15,0 +15,0 @@ "license": "Apache-2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33299
491