mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 13:42:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
21
web/node_modules/@webassemblyjs/wasm-parser/LICENSE
generated
vendored
Normal file
21
web/node_modules/@webassemblyjs/wasm-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 Sven Sauleau <sven@sauleau.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
26
web/node_modules/@webassemblyjs/wasm-parser/README.md
generated
vendored
Normal file
26
web/node_modules/@webassemblyjs/wasm-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
# @webassemblyjs/wasm-parser
|
||||
|
||||
> WebAssembly binary format parser
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
yarn add @webassemblyjs/wasm-parser
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { decode } from "@webassemblyjs/wasm-parser";
|
||||
|
||||
const decoderOpts = {};
|
||||
|
||||
const ast = decode(binary, decoderOpts);
|
||||
```
|
||||
|
||||
### Decoder options
|
||||
|
||||
- `dump`: print dump information while decoding (default `false`)
|
||||
- `ignoreCodeSection`: ignore the code section (default `false`)
|
||||
- `ignoreDataSection`: ignore the data section (default `false`)
|
||||
|
1760
web/node_modules/@webassemblyjs/wasm-parser/esm/decoder.js
generated
vendored
Normal file
1760
web/node_modules/@webassemblyjs/wasm-parser/esm/decoder.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
247
web/node_modules/@webassemblyjs/wasm-parser/esm/index.js
generated
vendored
Normal file
247
web/node_modules/@webassemblyjs/wasm-parser/esm/index.js
generated
vendored
Normal file
|
@ -0,0 +1,247 @@
|
|||
import * as decoder from "./decoder";
|
||||
import * as t from "@webassemblyjs/ast";
|
||||
/**
|
||||
* TODO(sven): I added initial props, but we should rather fix
|
||||
* https://github.com/xtuc/webassemblyjs/issues/405
|
||||
*/
|
||||
|
||||
var defaultDecoderOpts = {
|
||||
dump: false,
|
||||
ignoreCodeSection: false,
|
||||
ignoreDataSection: false,
|
||||
ignoreCustomNameSection: false
|
||||
}; // traverses the AST, locating function name metadata, which is then
|
||||
// used to update index-based identifiers with function names
|
||||
|
||||
function restoreFunctionNames(ast) {
|
||||
var functionNames = [];
|
||||
t.traverse(ast, {
|
||||
FunctionNameMetadata: function FunctionNameMetadata(_ref) {
|
||||
var node = _ref.node;
|
||||
functionNames.push({
|
||||
name: node.value,
|
||||
index: node.index
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (functionNames.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.traverse(ast, {
|
||||
Func: function (_Func) {
|
||||
function Func(_x) {
|
||||
return _Func.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
// $FlowIgnore
|
||||
var nodeName = node.name;
|
||||
var indexBasedFunctionName = nodeName.value;
|
||||
var index = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
var oldValue = nodeName.value;
|
||||
nodeName.value = functionName.name;
|
||||
nodeName.numeric = oldValue; // $FlowIgnore
|
||||
|
||||
delete nodeName.raw;
|
||||
}
|
||||
}),
|
||||
// Also update the reference in the export
|
||||
ModuleExport: function (_ModuleExport) {
|
||||
function ModuleExport(_x2) {
|
||||
return _ModuleExport.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleExport.toString = function () {
|
||||
return _ModuleExport.toString();
|
||||
};
|
||||
|
||||
return ModuleExport;
|
||||
}(function (_ref3) {
|
||||
var node = _ref3.node;
|
||||
|
||||
if (node.descr.exportType === "Func") {
|
||||
// $FlowIgnore
|
||||
var nodeName = node.descr.id;
|
||||
var index = nodeName.value;
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
node.descr.id = t.identifier(functionName.name);
|
||||
}
|
||||
}
|
||||
}),
|
||||
ModuleImport: function (_ModuleImport) {
|
||||
function ModuleImport(_x3) {
|
||||
return _ModuleImport.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleImport.toString = function () {
|
||||
return _ModuleImport.toString();
|
||||
};
|
||||
|
||||
return ModuleImport;
|
||||
}(function (_ref4) {
|
||||
var node = _ref4.node;
|
||||
|
||||
if (node.descr.type === "FuncImportDescr") {
|
||||
// $FlowIgnore
|
||||
var indexBasedFunctionName = node.descr.id;
|
||||
var index = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
// $FlowIgnore
|
||||
node.descr.id = t.identifier(functionName.name);
|
||||
}
|
||||
}
|
||||
}),
|
||||
CallInstruction: function (_CallInstruction) {
|
||||
function CallInstruction(_x4) {
|
||||
return _CallInstruction.apply(this, arguments);
|
||||
}
|
||||
|
||||
CallInstruction.toString = function () {
|
||||
return _CallInstruction.toString();
|
||||
};
|
||||
|
||||
return CallInstruction;
|
||||
}(function (nodePath) {
|
||||
var node = nodePath.node;
|
||||
var index = node.index.value;
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
var oldValue = node.index;
|
||||
node.index = t.identifier(functionName.name);
|
||||
node.numeric = oldValue; // $FlowIgnore
|
||||
|
||||
delete node.raw;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restoreLocalNames(ast) {
|
||||
var localNames = [];
|
||||
t.traverse(ast, {
|
||||
LocalNameMetadata: function LocalNameMetadata(_ref5) {
|
||||
var node = _ref5.node;
|
||||
localNames.push({
|
||||
name: node.value,
|
||||
localIndex: node.localIndex,
|
||||
functionIndex: node.functionIndex
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (localNames.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.traverse(ast, {
|
||||
Func: function (_Func2) {
|
||||
function Func(_x5) {
|
||||
return _Func2.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func2.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (_ref6) {
|
||||
var node = _ref6.node;
|
||||
var signature = node.signature;
|
||||
|
||||
if (signature.type !== "Signature") {
|
||||
return;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
var nodeName = node.name;
|
||||
var indexBasedFunctionName = nodeName.value;
|
||||
var functionIndex = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
signature.params.forEach(function (param, paramIndex) {
|
||||
var paramName = localNames.find(function (f) {
|
||||
return f.localIndex === paramIndex && f.functionIndex === functionIndex;
|
||||
});
|
||||
|
||||
if (paramName && paramName.name !== "") {
|
||||
param.id = paramName.name;
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restoreModuleName(ast) {
|
||||
t.traverse(ast, {
|
||||
ModuleNameMetadata: function (_ModuleNameMetadata) {
|
||||
function ModuleNameMetadata(_x6) {
|
||||
return _ModuleNameMetadata.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleNameMetadata.toString = function () {
|
||||
return _ModuleNameMetadata.toString();
|
||||
};
|
||||
|
||||
return ModuleNameMetadata;
|
||||
}(function (moduleNameMetadataPath) {
|
||||
// update module
|
||||
t.traverse(ast, {
|
||||
Module: function (_Module) {
|
||||
function Module(_x7) {
|
||||
return _Module.apply(this, arguments);
|
||||
}
|
||||
|
||||
Module.toString = function () {
|
||||
return _Module.toString();
|
||||
};
|
||||
|
||||
return Module;
|
||||
}(function (_ref7) {
|
||||
var node = _ref7.node;
|
||||
var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
|
||||
|
||||
if (name === "") {
|
||||
name = null;
|
||||
}
|
||||
|
||||
node.id = name;
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export function decode(buf, customOpts) {
|
||||
var opts = Object.assign({}, defaultDecoderOpts, customOpts);
|
||||
var ast = decoder.decode(buf, opts);
|
||||
|
||||
if (opts.ignoreCustomNameSection === false) {
|
||||
restoreFunctionNames(ast);
|
||||
restoreLocalNames(ast);
|
||||
restoreModuleName(ast);
|
||||
}
|
||||
|
||||
return ast;
|
||||
}
|
0
web/node_modules/@webassemblyjs/wasm-parser/esm/types/decoder.js
generated
vendored
Normal file
0
web/node_modules/@webassemblyjs/wasm-parser/esm/types/decoder.js
generated
vendored
Normal file
1776
web/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js
generated
vendored
Normal file
1776
web/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
257
web/node_modules/@webassemblyjs/wasm-parser/lib/index.js
generated
vendored
Normal file
257
web/node_modules/@webassemblyjs/wasm-parser/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,257 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.decode = decode;
|
||||
|
||||
var decoder = _interopRequireWildcard(require("./decoder"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@webassemblyjs/ast"));
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
/**
|
||||
* TODO(sven): I added initial props, but we should rather fix
|
||||
* https://github.com/xtuc/webassemblyjs/issues/405
|
||||
*/
|
||||
var defaultDecoderOpts = {
|
||||
dump: false,
|
||||
ignoreCodeSection: false,
|
||||
ignoreDataSection: false,
|
||||
ignoreCustomNameSection: false
|
||||
}; // traverses the AST, locating function name metadata, which is then
|
||||
// used to update index-based identifiers with function names
|
||||
|
||||
function restoreFunctionNames(ast) {
|
||||
var functionNames = [];
|
||||
t.traverse(ast, {
|
||||
FunctionNameMetadata: function FunctionNameMetadata(_ref) {
|
||||
var node = _ref.node;
|
||||
functionNames.push({
|
||||
name: node.value,
|
||||
index: node.index
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (functionNames.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.traverse(ast, {
|
||||
Func: function (_Func) {
|
||||
function Func(_x) {
|
||||
return _Func.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
// $FlowIgnore
|
||||
var nodeName = node.name;
|
||||
var indexBasedFunctionName = nodeName.value;
|
||||
var index = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
var oldValue = nodeName.value;
|
||||
nodeName.value = functionName.name;
|
||||
nodeName.numeric = oldValue; // $FlowIgnore
|
||||
|
||||
delete nodeName.raw;
|
||||
}
|
||||
}),
|
||||
// Also update the reference in the export
|
||||
ModuleExport: function (_ModuleExport) {
|
||||
function ModuleExport(_x2) {
|
||||
return _ModuleExport.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleExport.toString = function () {
|
||||
return _ModuleExport.toString();
|
||||
};
|
||||
|
||||
return ModuleExport;
|
||||
}(function (_ref3) {
|
||||
var node = _ref3.node;
|
||||
|
||||
if (node.descr.exportType === "Func") {
|
||||
// $FlowIgnore
|
||||
var nodeName = node.descr.id;
|
||||
var index = nodeName.value;
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
node.descr.id = t.identifier(functionName.name);
|
||||
}
|
||||
}
|
||||
}),
|
||||
ModuleImport: function (_ModuleImport) {
|
||||
function ModuleImport(_x3) {
|
||||
return _ModuleImport.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleImport.toString = function () {
|
||||
return _ModuleImport.toString();
|
||||
};
|
||||
|
||||
return ModuleImport;
|
||||
}(function (_ref4) {
|
||||
var node = _ref4.node;
|
||||
|
||||
if (node.descr.type === "FuncImportDescr") {
|
||||
// $FlowIgnore
|
||||
var indexBasedFunctionName = node.descr.id;
|
||||
var index = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
// $FlowIgnore
|
||||
node.descr.id = t.identifier(functionName.name);
|
||||
}
|
||||
}
|
||||
}),
|
||||
CallInstruction: function (_CallInstruction) {
|
||||
function CallInstruction(_x4) {
|
||||
return _CallInstruction.apply(this, arguments);
|
||||
}
|
||||
|
||||
CallInstruction.toString = function () {
|
||||
return _CallInstruction.toString();
|
||||
};
|
||||
|
||||
return CallInstruction;
|
||||
}(function (nodePath) {
|
||||
var node = nodePath.node;
|
||||
var index = node.index.value;
|
||||
var functionName = functionNames.find(function (f) {
|
||||
return f.index === index;
|
||||
});
|
||||
|
||||
if (functionName) {
|
||||
var oldValue = node.index;
|
||||
node.index = t.identifier(functionName.name);
|
||||
node.numeric = oldValue; // $FlowIgnore
|
||||
|
||||
delete node.raw;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restoreLocalNames(ast) {
|
||||
var localNames = [];
|
||||
t.traverse(ast, {
|
||||
LocalNameMetadata: function LocalNameMetadata(_ref5) {
|
||||
var node = _ref5.node;
|
||||
localNames.push({
|
||||
name: node.value,
|
||||
localIndex: node.localIndex,
|
||||
functionIndex: node.functionIndex
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (localNames.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.traverse(ast, {
|
||||
Func: function (_Func2) {
|
||||
function Func(_x5) {
|
||||
return _Func2.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func2.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (_ref6) {
|
||||
var node = _ref6.node;
|
||||
var signature = node.signature;
|
||||
|
||||
if (signature.type !== "Signature") {
|
||||
return;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
var nodeName = node.name;
|
||||
var indexBasedFunctionName = nodeName.value;
|
||||
var functionIndex = Number(indexBasedFunctionName.replace("func_", ""));
|
||||
signature.params.forEach(function (param, paramIndex) {
|
||||
var paramName = localNames.find(function (f) {
|
||||
return f.localIndex === paramIndex && f.functionIndex === functionIndex;
|
||||
});
|
||||
|
||||
if (paramName && paramName.name !== "") {
|
||||
param.id = paramName.name;
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restoreModuleName(ast) {
|
||||
t.traverse(ast, {
|
||||
ModuleNameMetadata: function (_ModuleNameMetadata) {
|
||||
function ModuleNameMetadata(_x6) {
|
||||
return _ModuleNameMetadata.apply(this, arguments);
|
||||
}
|
||||
|
||||
ModuleNameMetadata.toString = function () {
|
||||
return _ModuleNameMetadata.toString();
|
||||
};
|
||||
|
||||
return ModuleNameMetadata;
|
||||
}(function (moduleNameMetadataPath) {
|
||||
// update module
|
||||
t.traverse(ast, {
|
||||
Module: function (_Module) {
|
||||
function Module(_x7) {
|
||||
return _Module.apply(this, arguments);
|
||||
}
|
||||
|
||||
Module.toString = function () {
|
||||
return _Module.toString();
|
||||
};
|
||||
|
||||
return Module;
|
||||
}(function (_ref7) {
|
||||
var node = _ref7.node;
|
||||
var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
|
||||
|
||||
if (name === "") {
|
||||
name = null;
|
||||
}
|
||||
|
||||
node.id = name;
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function decode(buf, customOpts) {
|
||||
var opts = Object.assign({}, defaultDecoderOpts, customOpts);
|
||||
var ast = decoder.decode(buf, opts);
|
||||
|
||||
if (opts.ignoreCustomNameSection === false) {
|
||||
restoreFunctionNames(ast);
|
||||
restoreLocalNames(ast);
|
||||
restoreModuleName(ast);
|
||||
}
|
||||
|
||||
return ast;
|
||||
}
|
0
web/node_modules/@webassemblyjs/wasm-parser/lib/types/decoder.js
generated
vendored
Normal file
0
web/node_modules/@webassemblyjs/wasm-parser/lib/types/decoder.js
generated
vendored
Normal file
44
web/node_modules/@webassemblyjs/wasm-parser/package.json
generated
vendored
Normal file
44
web/node_modules/@webassemblyjs/wasm-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"name": "@webassemblyjs/wasm-parser",
|
||||
"version": "1.9.0",
|
||||
"keywords": [
|
||||
"webassembly",
|
||||
"javascript",
|
||||
"ast",
|
||||
"parser",
|
||||
"wasm"
|
||||
],
|
||||
"description": "WebAssembly binary format parser",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.9.0",
|
||||
"@webassemblyjs/helper-api-error": "1.9.0",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.9.0",
|
||||
"@webassemblyjs/ieee754": "1.9.0",
|
||||
"@webassemblyjs/leb128": "1.9.0",
|
||||
"@webassemblyjs/utf8": "1.9.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-buffer": "1.9.0",
|
||||
"@webassemblyjs/helper-test-framework": "1.9.0",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.7.7",
|
||||
"@webassemblyjs/wasm-gen": "1.9.0",
|
||||
"@webassemblyjs/wast-parser": "1.9.0",
|
||||
"mamacro": "^0.0.7",
|
||||
"wabt": "1.0.12"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue