mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
commit node_modules and generated files
This commit is contained in:
29
lib/api-client.js
generated
29
lib/api-client.js
generated
@@ -14,13 +14,38 @@ const core = __importStar(require("@actions/core"));
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||
const util_1 = require("./util");
|
||||
exports.getApiClient = function (allowLocalRun = false) {
|
||||
exports.getApiClient = function (githubAuth, githubApiUrl, allowLocalRun = false) {
|
||||
if (util_1.isLocalRun() && !allowLocalRun) {
|
||||
throw new Error('Invalid API call in local run');
|
||||
}
|
||||
return new github.GitHub(core.getInput('token'), {
|
||||
return new github.GitHub({
|
||||
auth: parseAuth(githubAuth),
|
||||
baseUrl: githubApiUrl,
|
||||
userAgent: "CodeQL Action",
|
||||
log: console_log_level_1.default({ level: "debug" })
|
||||
});
|
||||
};
|
||||
// Parses the user input as either a single token,
|
||||
// or a username and password / PAT.
|
||||
function parseAuth(auth) {
|
||||
// Check if it's a username:password pair
|
||||
const c = auth.indexOf(':');
|
||||
if (c !== -1) {
|
||||
return 'basic ' + Buffer.from(auth).toString('base64');
|
||||
// return {
|
||||
// username: auth.substring(0, c),
|
||||
// password: auth.substring(c + 1),
|
||||
// on2fa: async () => { throw new Error(''); }
|
||||
// };
|
||||
}
|
||||
// Otherwise use the token as it is
|
||||
return auth;
|
||||
}
|
||||
// Temporary function to aid in the transition to running on and off of github actions.
|
||||
// Once all code has been coverted this function should be removed or made canonical
|
||||
// and called only from the action entrypoints.
|
||||
function getActionsApiClient(allowLocalRun = false) {
|
||||
return exports.getApiClient(core.getInput('token'), util_1.getRequiredEnvParam('GITHUB_API_URL'), allowLocalRun);
|
||||
}
|
||||
exports.getActionsApiClient = getActionsApiClient;
|
||||
//# sourceMappingURL=api-client.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsC;AACtC,wDAA0C;AAC1C,0EAAgD;AAEhD,iCAAoC;AAEvB,QAAA,YAAY,GAAG,UAAS,aAAa,GAAG,KAAK;IACxD,IAAI,iBAAU,EAAE,IAAI,CAAC,aAAa,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,OAAO,IAAI,MAAM,CAAC,MAAM,CACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtB;QACE,SAAS,EAAE,eAAe;QAC1B,GAAG,EAAE,2BAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;KACzC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsC;AACtC,wDAA0C;AAC1C,0EAAgD;AAEhD,iCAAyD;AAE5C,QAAA,YAAY,GAAG,UAAS,UAAkB,EAAE,YAAoB,EAAE,aAAa,GAAG,KAAK;IAClG,IAAI,iBAAU,EAAE,IAAI,CAAC,aAAa,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,OAAO,IAAI,MAAM,CAAC,MAAM,CACtB;QACE,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC;QAC3B,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,eAAe;QAC1B,GAAG,EAAE,2BAAe,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;KACzC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,kDAAkD;AAClD,oCAAoC;AACpC,SAAS,SAAS,CAAC,IAAY;IAC7B,yCAAyC;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QACZ,OAAO,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACvD,WAAW;QACX,oCAAoC;QACpC,qCAAqC;QACrC,gDAAgD;QAChD,KAAK;KACN;IAED,mCAAmC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uFAAuF;AACvF,oFAAoF;AACpF,+CAA+C;AAC/C,SAAgB,mBAAmB,CAAC,aAAa,GAAG,KAAK;IACvD,OAAO,oBAAY,CACjB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtB,0BAAmB,CAAC,gBAAgB,CAAC,EACrC,aAAa,CAAC,CAAC;AACnB,CAAC;AALD,kDAKC"}
|
||||
59
lib/cli.js
generated
Normal file
59
lib/cli.js
generated
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const commander_1 = require("commander");
|
||||
const path = __importStar(require("path"));
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
const upload_lib = __importStar(require("./upload-lib"));
|
||||
const program = new commander_1.Command();
|
||||
program.version('0.0.1');
|
||||
function parseGithubApiUrl(inputUrl) {
|
||||
try {
|
||||
const url = new URL(inputUrl);
|
||||
// If we detect this is trying to be to github.com
|
||||
// then return with a fixed canonical URL.
|
||||
if (url.hostname === 'github.com' || url.hostname === 'api.github.com') {
|
||||
return 'https://api.github.com';
|
||||
}
|
||||
// Add the API path if it's not already present.
|
||||
if (url.pathname.indexOf('/api/v3') === -1) {
|
||||
url.pathname = path.join(url.pathname, 'api', 'v3');
|
||||
}
|
||||
return url.toString();
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`"${inputUrl}" is not a valid URL`);
|
||||
}
|
||||
}
|
||||
program
|
||||
.command('upload')
|
||||
.description('Uploads a SARIF file, or all SARIF files from a directory, to code scanning')
|
||||
.requiredOption('--sarif-file <file>', 'SARIF file to upload')
|
||||
.requiredOption('--repository <repository>', 'Repository name')
|
||||
.requiredOption('--commit <commit>', 'SHA of commit that was analyzed')
|
||||
.requiredOption('--ref <ref>', 'Name of ref that was analyzed')
|
||||
.requiredOption('--analysis-key <key>', 'Identifies the analysis, for use matching up equivalent analyses on different commits')
|
||||
.requiredOption('--github-url <url>', 'URL of GitHub instance')
|
||||
.requiredOption('--github-auth <auth>', 'GitHub Apps token, or of the form "username:token" if using a personal access token')
|
||||
.option('--checkout-path <path>', 'Checkout path (default: current working directory)')
|
||||
.option('--analysis-name <name>', 'Display name of the analysis (default: same as analysis-key')
|
||||
.option('--environment <env>', 'Environment (default: empty)')
|
||||
.action(async (cmd) => {
|
||||
const logger = logging_1.getCLILogger();
|
||||
try {
|
||||
await upload_lib.upload(cmd.sarifFile, repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, cmd.ref, cmd.analysisKey, cmd.analysisName || cmd.analysisKey, undefined, cmd.checkoutPath || process.cwd(), cmd.environment, cmd.githubAuth, parseGithubApiUrl(cmd.githubUrl), 'cli', logger);
|
||||
}
|
||||
catch (e) {
|
||||
logger.error("Upload failed");
|
||||
logger.error(e);
|
||||
}
|
||||
});
|
||||
program.parse(process.argv);
|
||||
//# sourceMappingURL=cli.js.map
|
||||
1
lib/cli.js.map
Normal file
1
lib/cli.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAoC;AACpC,2CAA6B;AAE7B,uCAAyC;AACzC,6CAAkD;AAClD,yDAA2C;AAE3C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAezB,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI;QACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE9B,kDAAkD;QAClD,0CAA0C;QAC1C,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,QAAQ,KAAK,gBAAgB,EAAE;YACtE,OAAO,wBAAwB,CAAC;SACjC;QAED,gDAAgD;QAChD,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1C,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;SACrD;QAED,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;KAEvB;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,IAAI,QAAQ,sBAAsB,CAAC,CAAC;KACrD;AACH,CAAC;AAED,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6EAA6E,CAAC;KAC1F,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,CAAC;KAC7D,cAAc,CAAC,2BAA2B,EAAE,iBAAiB,CAAC;KAC9D,cAAc,CAAC,mBAAmB,EAAE,iCAAiC,CAAC;KACtE,cAAc,CAAC,aAAa,EAAE,+BAA+B,CAAC;KAC9D,cAAc,CAAC,sBAAsB,EAAE,uFAAuF,CAAC;KAC/H,cAAc,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;KAC9D,cAAc,CAAC,sBAAsB,EAAE,qFAAqF,CAAC;KAC7H,MAAM,CAAC,wBAAwB,EAAE,oDAAoD,CAAC;KACtF,MAAM,CAAC,wBAAwB,EAAE,6DAA6D,CAAC;KAC/F,MAAM,CAAC,qBAAqB,EAAE,8BAA8B,CAAC;KAC7D,MAAM,CAAC,KAAK,EAAE,GAAe,EAAE,EAAE;IAChC,MAAM,MAAM,GAAG,sBAAY,EAAE,CAAC;IAC9B,IAAI;QACF,MAAM,UAAU,CAAC,MAAM,CACrB,GAAG,CAAC,SAAS,EACb,+BAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,EAClC,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,GAAG,EACP,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,WAAW,EACnC,SAAS,EACT,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,EAAE,EACjC,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,UAAU,EACd,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAChC,KAAK,EACL,MAAM,CAAC,CAAC;KACX;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
2
lib/codeql.js
generated
2
lib/codeql.js
generated
@@ -71,7 +71,7 @@ async function getCodeQLBundleDownloadURL() {
|
||||
}
|
||||
let [repositoryOwner, repositoryName] = repository.split("/");
|
||||
try {
|
||||
const release = await api.getApiClient().repos.getReleaseByTag({
|
||||
const release = await api.getActionsApiClient().repos.getReleaseByTag({
|
||||
owner: repositoryOwner,
|
||||
repo: repositoryName,
|
||||
tag: CODEQL_BUNDLE_VERSION
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/config-utils.js
generated
4
lib/config-utils.js
generated
@@ -316,7 +316,7 @@ async function getLanguagesInRepo() {
|
||||
let owner = repo_nwo[0];
|
||||
let repo = repo_nwo[1];
|
||||
core.debug(`GitHub repo ${owner} ${repo}`);
|
||||
const response = await api.getApiClient(true).repos.listLanguages({
|
||||
const response = await api.getActionsApiClient(true).repos.listLanguages({
|
||||
owner,
|
||||
repo
|
||||
});
|
||||
@@ -538,7 +538,7 @@ async function getRemoteConfig(configFile) {
|
||||
if (pieces === null || pieces.groups === undefined || pieces.length < 5) {
|
||||
throw new Error(getConfigFileRepoFormatInvalidMessage(configFile));
|
||||
}
|
||||
const response = await api.getApiClient(true).repos.getContents({
|
||||
const response = await api.getActionsApiClient(true).repos.getContents({
|
||||
owner: pieces.groups.owner,
|
||||
repo: pieces.groups.repo,
|
||||
path: pieces.groups.path,
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/finalize-db.js
generated
4
lib/finalize-db.js
generated
@@ -12,6 +12,8 @@ const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
const upload_lib = __importStar(require("./upload-lib"));
|
||||
const util = __importStar(require("./util"));
|
||||
@@ -95,7 +97,7 @@ async function run() {
|
||||
core.info('Analyzing database');
|
||||
queriesStats = await runQueries(databaseFolder, sarifFolder, config);
|
||||
if ('true' === core.getInput('upload')) {
|
||||
uploadStats = await upload_lib.upload(sarifFolder);
|
||||
uploadStats = await upload_lib.upload(sarifFolder, repository_1.parseRepositoryNwo(util.getRequiredEnvParam('GITHUB_REPOSITORY')), await util.getCommitOid(), util.getRef(), await util.getAnalysisKey(), util.getRequiredEnvParam('GITHUB_WORKFLOW'), util.getWorkflowRunID(), core.getInput('checkout_path'), core.getInput('matrix'), core.getInput('token'), util.getRequiredEnvParam('GITHUB_API_URL'), 'actions', logging_1.getActionsLogger());
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"finalize-db.js","sourceRoot":"","sources":["../src/finalize-db.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAE7B,qCAAwD;AACxD,4DAA8C;AAC9C,gEAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAiC/B,KAAK,UAAU,gBAAgB,CAC7B,SAAe,EACf,YAA6C,EAC7C,WAAsD,EACtD,KAAa;;IAEb,MAAM,MAAM,GAAG,OAAA,YAAY,0CAAE,wBAAwB,MAAK,SAAS,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACnH,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,QAAE,KAAK,0CAAE,OAAO,QAAE,KAAK,0CAAE,KAAK,CAAC,CAAC;IACtH,MAAM,YAAY,GAAuB;QACvC,GAAG,gBAAgB;QACnB,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;KACvB,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,4BAA4B,CAAC,cAAsB,EAAE,MAA0B;IAC5F,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,0BAAiB,CAAC,QAAQ,CAAC,EAAE;YAC/B,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;YAC1C,MAAM,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;YACnF,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;KACF;AACH,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,cAAsB,EAAE,MAA0B;IACxF,MAAM,4BAA4B,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;QAC1C,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;AACH,CAAC;AAED,2DAA2D;AAC3D,KAAK,UAAU,UAAU,CACvB,cAAsB,EACtB,WAAmB,EACnB,MAA0B;IAE1B,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,IAAI,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QACnD,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,QAAQ,CAAC,CAAC;QAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,QAAQ,GAAG,gDAAgD,CAAC,CAAC;SACrG;QAED,IAAI;YACF,uEAAuE;YACvE,2EAA2E;YAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC;YACxE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,uBAAuB,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CAAC,CAAC;YAE9E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;YAE9D,MAAM,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;YAEzF,IAAI,CAAC,KAAK,CAAC,6BAA6B,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC;YACzF,IAAI,CAAC,QAAQ,EAAE,CAAC;SAEjB;QAAC,OAAO,CAAC,EAAE;YACV,+DAA+D;YAC/D,OAAO;gBACL,wBAAwB,EAAE,QAAQ;aACnC,CAAC;SACH;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAoC,SAAS,CAAC;IAC9D,IAAI,WAAW,GAA8C,SAAS,CAAC;IACvE,IAAI;QACF,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE;YAC1G,OAAO;SACR;QACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,EAAE,CAAC;QAE7C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;QAEzD,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEpD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC1C,MAAM,wBAAwB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAEvD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAChC,YAAY,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAErE,IAAI,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtC,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;SACpD;KAEF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO;KACR;IAED,MAAM,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,IAAI,CAAC,SAAS,CAAC,yBAAyB,GAAG,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"finalize-db.js","sourceRoot":"","sources":["../src/finalize-db.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AACtC,uCAAyB;AACzB,2CAA6B;AAE7B,qCAAwD;AACxD,4DAA8C;AAC9C,uCAA6C;AAC7C,6CAAkD;AAClD,gEAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAiC/B,KAAK,UAAU,gBAAgB,CAC7B,SAAe,EACf,YAA6C,EAC7C,WAAsD,EACtD,KAAa;;IAEb,MAAM,MAAM,GAAG,OAAA,YAAY,0CAAE,wBAAwB,MAAK,SAAS,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACnH,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,QAAE,KAAK,0CAAE,OAAO,QAAE,KAAK,0CAAE,KAAK,CAAC,CAAC;IACtH,MAAM,YAAY,GAAuB;QACvC,GAAG,gBAAgB;QACnB,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;QACvB,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;KACvB,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,4BAA4B,CAAC,cAAsB,EAAE,MAA0B;IAC5F,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,0BAAiB,CAAC,QAAQ,CAAC,EAAE;YAC/B,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;YAC1C,MAAM,MAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;YACnF,IAAI,CAAC,QAAQ,EAAE,CAAC;SACjB;KACF;AACH,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,cAAsB,EAAE,MAA0B;IACxF,MAAM,4BAA4B,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC;QAC1C,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;AACH,CAAC;AAED,2DAA2D;AAC3D,KAAK,UAAU,UAAU,CACvB,cAAsB,EACtB,WAAmB,EACnB,MAA0B;IAE1B,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;IAC3B,KAAK,IAAI,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE;QACnD,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,QAAQ,CAAC,CAAC;QAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,QAAQ,GAAG,gDAAgD,CAAC,CAAC;SACrG;QAED,IAAI;YACF,uEAAuE;YACvE,2EAA2E;YAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC;YACxE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,uBAAuB,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CAAC,CAAC;YAE9E,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;YAE9D,MAAM,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;YAEzF,IAAI,CAAC,KAAK,CAAC,6BAA6B,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC;YACzF,IAAI,CAAC,QAAQ,EAAE,CAAC;SAEjB;QAAC,OAAO,CAAC,EAAE;YACV,+DAA+D;YAC/D,OAAO;gBACL,wBAAwB,EAAE,QAAQ;aACnC,CAAC;SACH;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAoC,SAAS,CAAC;IAC9D,IAAI,WAAW,GAA8C,SAAS,CAAC;IACvE,IAAI;QACF,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE;YAC1G,OAAO;SACR;QACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,EAAE,CAAC;QAE7C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAC9D,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;QAEzD,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAEpD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC1C,MAAM,wBAAwB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAEvD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAChC,YAAY,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QAErE,IAAI,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtC,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CACnC,WAAW,EACX,+BAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,EACjE,MAAM,IAAI,CAAC,YAAY,EAAE,EACzB,IAAI,CAAC,MAAM,EAAE,EACb,MAAM,IAAI,CAAC,cAAc,EAAE,EAC3B,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAC3C,IAAI,CAAC,gBAAgB,EAAE,EACvB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAC9B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC1C,SAAS,EACT,0BAAgB,EAAE,CAAC,CAAC;SACvB;KAEF;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACpE,OAAO;KACR;IAED,MAAM,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,IAAI,CAAC,SAAS,CAAC,yBAAyB,GAAG,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||
26
lib/logging.js
generated
Normal file
26
lib/logging.js
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
function getActionsLogger() {
|
||||
return core;
|
||||
}
|
||||
exports.getActionsLogger = getActionsLogger;
|
||||
function getCLILogger() {
|
||||
return {
|
||||
debug: console.debug,
|
||||
info: console.info,
|
||||
warning: console.warn,
|
||||
error: console.error,
|
||||
startGroup: () => undefined,
|
||||
endGroup: () => undefined,
|
||||
};
|
||||
}
|
||||
exports.getCLILogger = getCLILogger;
|
||||
//# sourceMappingURL=logging.js.map
|
||||
1
lib/logging.js.map
Normal file
1
lib/logging.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAYtC,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAFD,4CAEC;AAED,SAAgB,YAAY;IAC1B,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;QAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B,CAAC;AACJ,CAAC;AATD,oCASC"}
|
||||
14
lib/repository.js
generated
Normal file
14
lib/repository.js
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function parseRepositoryNwo(input) {
|
||||
const parts = input.split('/');
|
||||
if (parts.length !== 2) {
|
||||
throw new Error(`"${input}" is not a valid repository name`);
|
||||
}
|
||||
return {
|
||||
owner: parts[0],
|
||||
repo: parts[1],
|
||||
};
|
||||
}
|
||||
exports.parseRepositoryNwo = parseRepositoryNwo;
|
||||
//# sourceMappingURL=repository.js.map
|
||||
1
lib/repository.js.map
Normal file
1
lib/repository.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../src/repository.ts"],"names":[],"mappings":";;AAMA,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAkC,CAAC,CAAC;KAC9D;IACD,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACf,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;KACf,CAAC;AACJ,CAAC;AATD,gDASC"}
|
||||
3
lib/testing-utils.js
generated
3
lib/testing-utils.js
generated
@@ -56,6 +56,9 @@ function setupTests(test) {
|
||||
// process.env only has strings fields, so a shallow copy is fine.
|
||||
t.context.env = {};
|
||||
Object.assign(t.context.env, process.env);
|
||||
// Any test that runs code that expects to only be run on actions
|
||||
// will depend on various environment variables.
|
||||
process.env['GITHUB_API_URL'] = 'https://github.localhost/api/v3';
|
||||
});
|
||||
typedTest.afterEach.always(t => {
|
||||
// Restore stdout and stderr
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"testing-utils.js","sourceRoot":"","sources":["../src/testing-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA0B;AAE1B,iDAAmC;AAInC,SAAS,UAAU,CAAC,OAAoB;IACtC,8CAA8C;IAC9C,gCAAgC;IAChC,2EAA2E;IAC3E,2FAA2F;IAC3F,OAAO,CAAC,KAA0B,EAAE,QAAiB,EAAE,EAA0B,EAAW,EAAE;QAC5F,2CAA2C;QAC3C,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACtD,EAAE,GAAG,QAAQ,CAAC;YACd,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,oBAAoB;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,CAAC,UAAU,IAAI,IAAI,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,iDAAiD;QACjD,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;YAChD,EAAE,EAAE,CAAC;SACN;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,IAAwB;IACjD,MAAM,SAAS,GAAG,IAAkC,CAAC;IAErD,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACvB,gEAAgE;QAChE,0CAA0C;QAC1C,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAErB,iEAAiE;QACjE,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAC;QAC1B,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAQ,CAAC;QACpD,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAQ,CAAC;QAEpD,mEAAmE;QACnE,wEAAwE;QACxE,kEAAkE;QAClE,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;QACnB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC7B,4BAA4B;QAC5B,0DAA0D;QAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAC5C;QAED,uCAAuC;QACvC,eAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,oCAAoC;QACpC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAvCD,gCAuCC"}
|
||||
{"version":3,"file":"testing-utils.js","sourceRoot":"","sources":["../src/testing-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,kDAA0B;AAE1B,iDAAmC;AAInC,SAAS,UAAU,CAAC,OAAoB;IACtC,8CAA8C;IAC9C,gCAAgC;IAChC,2EAA2E;IAC3E,2FAA2F;IAC3F,OAAO,CAAC,KAA0B,EAAE,QAAiB,EAAE,EAA0B,EAAW,EAAE;QAC5F,2CAA2C;QAC3C,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YACtD,EAAE,GAAG,QAAQ,CAAC;YACd,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,oBAAoB;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,CAAC,UAAU,IAAI,IAAI,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,iDAAiD;QACjD,IAAI,EAAE,KAAK,SAAS,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;YAChD,EAAE,EAAE,CAAC;SACN;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,IAAwB;IACjD,MAAM,SAAS,GAAG,IAAkC,CAAC;IAErD,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;QACvB,gEAAgE;QAChE,0CAA0C;QAC1C,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAErB,iEAAiE;QACjE,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAC;QAC1B,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAQ,CAAC;QACpD,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAQ,CAAC;QAEpD,mEAAmE;QACnE,wEAAwE;QACxE,kEAAkE;QAClE,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;QACnB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAE1C,iEAAiE;QACjE,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,iCAAiC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC7B,4BAA4B;QAC5B,0DAA0D;QAC1D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAC5C;QAED,uCAAuC;QACvC,eAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,oCAAoC;QACpC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AA3CD,gCA2CC"}
|
||||
135
lib/upload-lib.js
generated
135
lib/upload-lib.js
generated
@@ -1,4 +1,7 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
@@ -6,11 +9,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const file_url_1 = __importDefault(require("file-url"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const jsonschema = __importStar(require("jsonschema"));
|
||||
@@ -18,7 +17,6 @@ const path = __importStar(require("path"));
|
||||
const zlib_1 = __importDefault(require("zlib"));
|
||||
const api = __importStar(require("./api-client"));
|
||||
const fingerprints = __importStar(require("./fingerprints"));
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
const util = __importStar(require("./util"));
|
||||
// Takes a list of paths to sarif files and combines them together,
|
||||
// returning the contents of the combined sarif file.
|
||||
@@ -43,29 +41,32 @@ function combineSarifFiles(sarifFiles) {
|
||||
exports.combineSarifFiles = combineSarifFiles;
|
||||
// Upload the given payload.
|
||||
// If the request fails then this will retry a small number of times.
|
||||
async function uploadPayload(payload) {
|
||||
core.info('Uploading results');
|
||||
async function uploadPayload(payload, repositoryNwo, githubAuth, githubApiUrl, mode, logger) {
|
||||
logger.info('Uploading results');
|
||||
// If in test mode we don't want to upload the results
|
||||
const testMode = process.env['TEST_MODE'] === 'true' || false;
|
||||
if (testMode) {
|
||||
return;
|
||||
}
|
||||
const [owner, repo] = util.getRequiredEnvParam("GITHUB_REPOSITORY").split("/");
|
||||
// Make up to 4 attempts to upload, and sleep for these
|
||||
// number of seconds between each attempt.
|
||||
// We don't want to backoff too much to avoid wasting action
|
||||
// minutes, but just waiting a little bit could maybe help.
|
||||
const backoffPeriods = [1, 5, 15];
|
||||
const client = api.getApiClient(githubAuth, githubApiUrl);
|
||||
for (let attempt = 0; attempt <= backoffPeriods.length; attempt++) {
|
||||
const response = await api.getApiClient().request("PUT /repos/:owner/:repo/code-scanning/analysis", ({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
const reqURL = mode === 'actions'
|
||||
? 'PUT /repos/:owner/:repo/code-scanning/analysis'
|
||||
: 'POST /repos/:owner/:repo/code-scanning/sarifs';
|
||||
const response = await client.request(reqURL, ({
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
data: payload,
|
||||
}));
|
||||
core.debug('response status: ' + response.status);
|
||||
logger.debug('response status: ' + response.status);
|
||||
const statusCode = response.status;
|
||||
if (statusCode === 202) {
|
||||
core.info("Successfully uploaded results");
|
||||
logger.info("Successfully uploaded results");
|
||||
return;
|
||||
}
|
||||
const requestID = response.headers["x-github-request-id"];
|
||||
@@ -76,7 +77,7 @@ async function uploadPayload(payload) {
|
||||
// On a 5xx status code we may retry the request
|
||||
if (attempt < backoffPeriods.length) {
|
||||
// Log the failure as a warning but don't mark the action as failed yet
|
||||
core.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
||||
logger.warning('Upload attempt (' + (attempt + 1) + ' of ' + (backoffPeriods.length + 1) +
|
||||
') failed (' + requestID + '). Retrying in ' + backoffPeriods[attempt] +
|
||||
' seconds: (' + statusCode + ') ' + JSON.stringify(response.data));
|
||||
// Sleep for the backoff period
|
||||
@@ -97,19 +98,21 @@ async function uploadPayload(payload) {
|
||||
// Uploads a single sarif file or a directory of sarif files
|
||||
// depending on what the path happens to refer to.
|
||||
// Returns true iff the upload occurred and succeeded
|
||||
async function upload(input) {
|
||||
if (fs.lstatSync(input).isDirectory()) {
|
||||
const sarifFiles = fs.readdirSync(input)
|
||||
async function upload(sarifFile, repositoryNwo, commitOid, ref, analysisKey, analysisName, workflowRunID, checkoutPath, environment, githubAuth, githubApiUrl, mode, logger) {
|
||||
const sarifFiles = [];
|
||||
if (fs.lstatSync(sarifFile).isDirectory()) {
|
||||
fs.readdirSync(sarifFile)
|
||||
.filter(f => f.endsWith(".sarif"))
|
||||
.map(f => path.resolve(input, f));
|
||||
.map(f => path.resolve(sarifFile, f))
|
||||
.forEach(f => sarifFiles.push(f));
|
||||
if (sarifFiles.length === 0) {
|
||||
throw new Error("No SARIF files found to upload in \"" + input + "\".");
|
||||
throw new Error("No SARIF files found to upload in \"" + sarifFile + "\".");
|
||||
}
|
||||
return await uploadFiles(sarifFiles);
|
||||
}
|
||||
else {
|
||||
return await uploadFiles([input]);
|
||||
sarifFiles.push(sarifFile);
|
||||
}
|
||||
return await uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, analysisName, workflowRunID, checkoutPath, environment, githubAuth, githubApiUrl, mode, logger);
|
||||
}
|
||||
exports.upload = upload;
|
||||
// Counts the number of results in the given SARIF file
|
||||
@@ -123,16 +126,16 @@ function countResultsInSarif(sarif) {
|
||||
exports.countResultsInSarif = countResultsInSarif;
|
||||
// Validates that the given file path refers to a valid SARIF file.
|
||||
// Throws an error if the file is invalid.
|
||||
function validateSarifFileSchema(sarifFilePath) {
|
||||
function validateSarifFileSchema(sarifFilePath, logger) {
|
||||
const sarif = JSON.parse(fs.readFileSync(sarifFilePath, 'utf8'));
|
||||
const schema = JSON.parse(fs.readFileSync(__dirname + '/../src/sarif_v2.1.0_schema.json', 'utf8'));
|
||||
const schema = require('../src/sarif_v2.1.0_schema.json');
|
||||
const result = new jsonschema.Validator().validate(sarif, schema);
|
||||
if (!result.valid) {
|
||||
// Output the more verbose error messages in groups as these may be very large.
|
||||
for (const error of result.errors) {
|
||||
core.startGroup("Error details: " + error.stack);
|
||||
core.info(JSON.stringify(error, null, 2));
|
||||
core.endGroup();
|
||||
logger.startGroup("Error details: " + error.stack);
|
||||
logger.info(JSON.stringify(error, null, 2));
|
||||
logger.endGroup();
|
||||
}
|
||||
// Set the main error message to the stacks of all the errors.
|
||||
// This should be of a manageable size and may even give enough to fix the error.
|
||||
@@ -143,65 +146,49 @@ function validateSarifFileSchema(sarifFilePath) {
|
||||
exports.validateSarifFileSchema = validateSarifFileSchema;
|
||||
// Uploads the given set of sarif files.
|
||||
// Returns true iff the upload occurred and succeeded
|
||||
async function uploadFiles(sarifFiles) {
|
||||
core.startGroup("Uploading results");
|
||||
core.info("Uploading sarif files: " + JSON.stringify(sarifFiles));
|
||||
const sentinelEnvVar = "CODEQL_UPLOAD_SARIF";
|
||||
if (process.env[sentinelEnvVar]) {
|
||||
throw new Error("Aborting upload: only one run of the codeql/analyze or codeql/upload-sarif actions is allowed per job");
|
||||
}
|
||||
core.exportVariable(sentinelEnvVar, sentinelEnvVar);
|
||||
async function uploadFiles(sarifFiles, repositoryNwo, commitOid, ref, analysisKey, analysisName, workflowRunID, checkoutPath, environment, githubAuth, githubApiUrl, mode, logger) {
|
||||
logger.info("Uploading sarif files: " + JSON.stringify(sarifFiles));
|
||||
// Validate that the files we were asked to upload are all valid SARIF files
|
||||
for (const file of sarifFiles) {
|
||||
validateSarifFileSchema(file);
|
||||
validateSarifFileSchema(file, logger);
|
||||
}
|
||||
const commitOid = await util.getCommitOid();
|
||||
const workflowRunIDStr = util.getRequiredEnvParam('GITHUB_RUN_ID');
|
||||
const ref = util.getRef();
|
||||
const analysisKey = await util.getAnalysisKey();
|
||||
const analysisName = util.getRequiredEnvParam('GITHUB_WORKFLOW');
|
||||
const startedAt = process.env[sharedEnv.CODEQL_WORKFLOW_STARTED_AT];
|
||||
let sarifPayload = combineSarifFiles(sarifFiles);
|
||||
sarifPayload = fingerprints.addFingerprints(sarifPayload);
|
||||
const zipped_sarif = zlib_1.default.gzipSync(sarifPayload).toString('base64');
|
||||
let checkoutPath = core.getInput('checkout_path');
|
||||
let checkoutURI = file_url_1.default(checkoutPath);
|
||||
const workflowRunID = parseInt(workflowRunIDStr, 10);
|
||||
if (Number.isNaN(workflowRunID)) {
|
||||
throw new Error('GITHUB_RUN_ID must define a non NaN workflow run ID');
|
||||
}
|
||||
let matrix = core.getInput('matrix');
|
||||
if (matrix === "null" || matrix === "") {
|
||||
matrix = undefined;
|
||||
}
|
||||
const toolNames = util.getToolNames(sarifPayload);
|
||||
const payload = JSON.stringify({
|
||||
"commit_oid": commitOid,
|
||||
"ref": ref,
|
||||
"analysis_key": analysisKey,
|
||||
"analysis_name": analysisName,
|
||||
"sarif": zipped_sarif,
|
||||
"workflow_run_id": workflowRunID,
|
||||
"checkout_uri": checkoutURI,
|
||||
"environment": matrix,
|
||||
"started_at": startedAt,
|
||||
"tool_names": toolNames,
|
||||
});
|
||||
// Log some useful debug info about the info
|
||||
const rawUploadSizeBytes = sarifPayload.length;
|
||||
core.debug("Raw upload size: " + rawUploadSizeBytes + " bytes");
|
||||
const zippedUploadSizeBytes = zipped_sarif.length;
|
||||
core.debug("Base64 zipped upload size: " + zippedUploadSizeBytes + " bytes");
|
||||
const numResultInSarif = countResultsInSarif(sarifPayload);
|
||||
core.debug("Number of results in upload: " + numResultInSarif);
|
||||
if (!util.isLocalRun()) {
|
||||
// Make the upload
|
||||
await uploadPayload(payload);
|
||||
let payload;
|
||||
if (mode === 'actions') {
|
||||
payload = JSON.stringify({
|
||||
"commit_oid": commitOid,
|
||||
"ref": ref,
|
||||
"analysis_key": analysisKey,
|
||||
"analysis_name": analysisName,
|
||||
"sarif": zipped_sarif,
|
||||
"workflow_run_id": workflowRunID,
|
||||
"checkout_uri": checkoutURI,
|
||||
"environment": environment,
|
||||
"tool_names": toolNames,
|
||||
});
|
||||
}
|
||||
else {
|
||||
core.debug("Not uploading because this is a local run.");
|
||||
payload = JSON.stringify({
|
||||
"commit_sha": commitOid,
|
||||
"ref": ref,
|
||||
"sarif": zipped_sarif,
|
||||
"checkout_uri": checkoutURI,
|
||||
"tool_name": toolNames[0],
|
||||
});
|
||||
}
|
||||
core.endGroup();
|
||||
// Log some useful debug info about the info
|
||||
const rawUploadSizeBytes = sarifPayload.length;
|
||||
console.debug("Raw upload size: " + rawUploadSizeBytes + " bytes");
|
||||
const zippedUploadSizeBytes = zipped_sarif.length;
|
||||
console.debug("Base64 zipped upload size: " + zippedUploadSizeBytes + " bytes");
|
||||
const numResultInSarif = countResultsInSarif(sarifPayload);
|
||||
console.debug("Number of results in upload: " + numResultInSarif);
|
||||
// Make the upload
|
||||
await uploadPayload(payload, repositoryNwo, githubAuth, githubApiUrl, mode, logger);
|
||||
return {
|
||||
raw_upload_size_bytes: rawUploadSizeBytes,
|
||||
zipped_upload_size_bytes: zippedUploadSizeBytes,
|
||||
|
||||
File diff suppressed because one or more lines are too long
5
lib/upload-lib.test.js
generated
5
lib/upload-lib.test.js
generated
@@ -11,15 +11,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const logging_1 = require("./logging");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const uploadLib = __importStar(require("./upload-lib"));
|
||||
testing_utils_1.setupTests(ava_1.default);
|
||||
ava_1.default('validateSarifFileSchema - valid', t => {
|
||||
const inputFile = __dirname + '/../src/testdata/valid-sarif.sarif';
|
||||
t.notThrows(() => uploadLib.validateSarifFileSchema(inputFile));
|
||||
t.notThrows(() => uploadLib.validateSarifFileSchema(inputFile, logging_1.getCLILogger()));
|
||||
});
|
||||
ava_1.default('validateSarifFileSchema - invalid', t => {
|
||||
const inputFile = __dirname + '/../src/testdata/invalid-sarif.sarif';
|
||||
t.throws(() => uploadLib.validateSarifFileSchema(inputFile));
|
||||
t.throws(() => uploadLib.validateSarifFileSchema(inputFile, logging_1.getCLILogger()));
|
||||
});
|
||||
//# sourceMappingURL=upload-lib.test.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"upload-lib.test.js","sourceRoot":"","sources":["../src/upload-lib.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,mDAA2C;AAC3C,wDAA0C;AAE1C,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE;IAC1C,MAAM,SAAS,GAAG,SAAS,GAAG,oCAAoC,CAAC;IACnE,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE;IAC5C,MAAM,SAAS,GAAG,SAAS,GAAG,sCAAsC,CAAC;IACrE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"upload-lib.test.js","sourceRoot":"","sources":["../src/upload-lib.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,uCAAyC;AACzC,mDAA2C;AAC3C,wDAA0C;AAE1C,0BAAU,CAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE;IAC1C,MAAM,SAAS,GAAG,SAAS,GAAG,oCAAoC,CAAC;IACnE,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,EAAE,sBAAY,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,mCAAmC,EAAE,CAAC,CAAC,EAAE;IAC5C,MAAM,SAAS,GAAG,SAAS,GAAG,sCAAsC,CAAC;IACrE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,SAAS,EAAE,sBAAY,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
|
||||
4
lib/upload-sarif.js
generated
4
lib/upload-sarif.js
generated
@@ -8,6 +8,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
const upload_lib = __importStar(require("./upload-lib"));
|
||||
const util = __importStar(require("./util"));
|
||||
async function sendSuccessStatusReport(startedAt, uploadStats) {
|
||||
@@ -24,7 +26,7 @@ async function run() {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const uploadStats = await upload_lib.upload(core.getInput('sarif_file'));
|
||||
const uploadStats = await upload_lib.upload(core.getInput('sarif_file'), repository_1.parseRepositoryNwo(util.getRequiredEnvParam('GITHUB_REPOSITORY')), await util.getCommitOid(), util.getRef(), await util.getAnalysisKey(), util.getRequiredEnvParam('GITHUB_WORKFLOW'), util.getWorkflowRunID(), core.getInput('checkout_path'), core.getInput('matrix'), core.getInput('token'), util.getRequiredEnvParam('GITHUB_API_URL'), 'actions', logging_1.getActionsLogger());
|
||||
await sendSuccessStatusReport(startedAt, uploadStats);
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"upload-sarif.js","sourceRoot":"","sources":["../src/upload-sarif.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,yDAA2C;AAC3C,6CAA+B;AAI/B,KAAK,UAAU,uBAAuB,CAAC,SAAe,EAAE,WAA0C;IAChG,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACjG,MAAM,YAAY,GAA4B;QAC5C,GAAG,gBAAgB;QACnB,GAAI,WAAW;KAChB,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE;QAChH,OAAO;KACR;IAED,IAAI;QACF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QACzE,MAAM,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;KAEvD;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAC3D,cAAc,EACd,SAAS,EACT,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChB,OAAO;KACR;AACH,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,IAAI,CAAC,SAAS,CAAC,qCAAqC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"upload-sarif.js","sourceRoot":"","sources":["../src/upload-sarif.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAEtC,uCAA6C;AAC7C,6CAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAI/B,KAAK,UAAU,uBAAuB,CAAC,SAAe,EAAE,WAA0C;IAChG,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACjG,MAAM,YAAY,GAA4B;QAC5C,GAAG,gBAAgB;QACnB,GAAI,WAAW;KAChB,CAAC;IACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE;QAChH,OAAO;KACR;IAED,IAAI;QACF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CACzC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAC3B,+BAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,EACjE,MAAM,IAAI,CAAC,YAAY,EAAE,EACzB,IAAI,CAAC,MAAM,EAAE,EACb,MAAM,IAAI,CAAC,cAAc,EAAE,EAC3B,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAC3C,IAAI,CAAC,gBAAgB,EAAE,EACvB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAC9B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC1C,SAAS,EACT,0BAAgB,EAAE,CAAC,CAAC;QACtB,MAAM,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;KAEvD;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAC3D,cAAc,EACd,SAAS,EACT,SAAS,EACT,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChB,OAAO;KACR;AACH,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACd,IAAI,CAAC,SAAS,CAAC,qCAAqC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
||||
19
lib/util.js
generated
19
lib/util.js
generated
@@ -96,14 +96,11 @@ exports.getCommitOid = getCommitOid;
|
||||
* Get the path of the currently executing workflow.
|
||||
*/
|
||||
async function getWorkflowPath() {
|
||||
if (isLocalRun()) {
|
||||
return 'LOCAL';
|
||||
}
|
||||
const repo_nwo = getRequiredEnvParam('GITHUB_REPOSITORY').split("/");
|
||||
const owner = repo_nwo[0];
|
||||
const repo = repo_nwo[1];
|
||||
const run_id = Number(getRequiredEnvParam('GITHUB_RUN_ID'));
|
||||
const apiClient = api.getApiClient();
|
||||
const apiClient = api.getActionsApiClient();
|
||||
const runsResponse = await apiClient.request('GET /repos/:owner/:repo/actions/runs/:run_id', {
|
||||
owner,
|
||||
repo,
|
||||
@@ -113,6 +110,17 @@ async function getWorkflowPath() {
|
||||
const workflowResponse = await apiClient.request('GET ' + workflowUrl);
|
||||
return workflowResponse.data.path;
|
||||
}
|
||||
/**
|
||||
* Get the workflow run ID.
|
||||
*/
|
||||
function getWorkflowRunID() {
|
||||
const workflowRunID = parseInt(getRequiredEnvParam('GITHUB_RUN_ID'), 10);
|
||||
if (Number.isNaN(workflowRunID)) {
|
||||
throw new Error('GITHUB_RUN_ID must define a non NaN workflow run ID');
|
||||
}
|
||||
return workflowRunID;
|
||||
}
|
||||
exports.getWorkflowRunID = getWorkflowRunID;
|
||||
/**
|
||||
* Get the analysis key paramter for the current job.
|
||||
*
|
||||
@@ -230,7 +238,8 @@ async function sendStatusReport(statusReport, ignoreFailures) {
|
||||
core.debug('Sending status report: ' + statusReportJSON);
|
||||
const nwo = getRequiredEnvParam("GITHUB_REPOSITORY");
|
||||
const [owner, repo] = nwo.split("/");
|
||||
const statusResponse = await api.getApiClient().request('PUT /repos/:owner/:repo/code-scanning/analysis/status', {
|
||||
const client = api.getActionsApiClient();
|
||||
const statusResponse = await client.request('PUT /repos/:owner/:repo/code-scanning/analysis/status', {
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
data: statusReportJSON,
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
node_modules/.bin/atob
generated
vendored
Symbolic link
1
node_modules/.bin/atob
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../atob/bin/atob.js
|
||||
1
node_modules/.bin/errno
generated
vendored
Symbolic link
1
node_modules/.bin/errno
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../errno/cli.js
|
||||
1
node_modules/.bin/json5
generated
vendored
Symbolic link
1
node_modules/.bin/json5
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../json5/lib/cli.js
|
||||
1
node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
1
node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../miller-rabin/bin/miller-rabin
|
||||
1
node_modules/.bin/sha.js
generated
vendored
Symbolic link
1
node_modules/.bin/sha.js
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../sha.js/bin.js
|
||||
1
node_modules/.bin/terser
generated
vendored
Symbolic link
1
node_modules/.bin/terser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../terser/bin/terser
|
||||
1
node_modules/.bin/webpack
generated
vendored
Symbolic link
1
node_modules/.bin/webpack
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../webpack/bin/webpack.js
|
||||
1
node_modules/.bin/webpack-cli
generated
vendored
Symbolic link
1
node_modules/.bin/webpack-cli
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../webpack-cli/bin/cli.js
|
||||
21
node_modules/@webassemblyjs/ast/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/ast/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.
|
||||
167
node_modules/@webassemblyjs/ast/README.md
generated
vendored
Normal file
167
node_modules/@webassemblyjs/ast/README.md
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# @webassemblyjs/ast
|
||||
|
||||
> AST utils for webassemblyjs
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
yarn add @webassemblyjs/ast
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Traverse
|
||||
|
||||
```js
|
||||
import { traverse } from "@webassemblyjs/ast";
|
||||
|
||||
traverse(ast, {
|
||||
Module(path) {
|
||||
console.log(path.node);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Instruction signatures
|
||||
|
||||
```js
|
||||
import { signatures } from "@webassemblyjs/ast";
|
||||
|
||||
console.log(signatures);
|
||||
```
|
||||
|
||||
### Path methods
|
||||
|
||||
- `findParent: NodeLocator`
|
||||
- `replaceWith: Node => void`
|
||||
- `remove: () => void`
|
||||
- `insertBefore: Node => void`
|
||||
- `insertAfter: Node => void`
|
||||
- `stop: () => void`
|
||||
|
||||
### AST utils
|
||||
|
||||
- function `module(id, fields, metadata)`
|
||||
- function `moduleMetadata(sections, functionNames, localNames)`
|
||||
- function `moduleNameMetadata(value)`
|
||||
- function `functionNameMetadata(value, index)`
|
||||
- function `localNameMetadata(value, localIndex, functionIndex)`
|
||||
- function `binaryModule(id, blob)`
|
||||
- function `quoteModule(id, string)`
|
||||
- function `sectionMetadata(section, startOffset, size, vectorOfSize)`
|
||||
- function `loopInstruction(label, resulttype, instr)`
|
||||
- function `instruction(id, args, namedArgs)`
|
||||
- function `objectInstruction(id, object, args, namedArgs)`
|
||||
- function `ifInstruction(testLabel, test, result, consequent, alternate)`
|
||||
- function `stringLiteral(value)`
|
||||
- function `numberLiteralFromRaw(value, raw)`
|
||||
- function `longNumberLiteral(value, raw)`
|
||||
- function `floatLiteral(value, nan, inf, raw)`
|
||||
- function `elem(table, offset, funcs)`
|
||||
- function `indexInFuncSection(index)`
|
||||
- function `valtypeLiteral(name)`
|
||||
- function `typeInstruction(id, functype)`
|
||||
- function `start(index)`
|
||||
- function `globalType(valtype, mutability)`
|
||||
- function `leadingComment(value)`
|
||||
- function `blockComment(value)`
|
||||
- function `data(memoryIndex, offset, init)`
|
||||
- function `global(globalType, init, name)`
|
||||
- function `table(elementType, limits, name, elements)`
|
||||
- function `memory(limits, id)`
|
||||
- function `funcImportDescr(id, signature)`
|
||||
- function `moduleImport(module, name, descr)`
|
||||
- function `moduleExportDescr(exportType, id)`
|
||||
- function `moduleExport(name, descr)`
|
||||
- function `limit(min, max)`
|
||||
- function `signature(params, results)`
|
||||
- function `program(body)`
|
||||
- function `identifier(value, raw)`
|
||||
- function `blockInstruction(label, instr, result)`
|
||||
- function `callInstruction(index, instrArgs)`
|
||||
- function `callIndirectInstruction(signature, intrs)`
|
||||
- function `byteArray(values)`
|
||||
- function `func(name, signature, body, isExternal, metadata)`
|
||||
- Constant`isModule`
|
||||
- Constant`isModuleMetadata`
|
||||
- Constant`isModuleNameMetadata`
|
||||
- Constant`isFunctionNameMetadata`
|
||||
- Constant`isLocalNameMetadata`
|
||||
- Constant`isBinaryModule`
|
||||
- Constant`isQuoteModule`
|
||||
- Constant`isSectionMetadata`
|
||||
- Constant`isLoopInstruction`
|
||||
- Constant`isInstruction`
|
||||
- Constant`isObjectInstruction`
|
||||
- Constant`isIfInstruction`
|
||||
- Constant`isStringLiteral`
|
||||
- Constant`isNumberLiteral`
|
||||
- Constant`isLongNumberLiteral`
|
||||
- Constant`isFloatLiteral`
|
||||
- Constant`isElem`
|
||||
- Constant`isIndexInFuncSection`
|
||||
- Constant`isValtypeLiteral`
|
||||
- Constant`isTypeInstruction`
|
||||
- Constant`isStart`
|
||||
- Constant`isGlobalType`
|
||||
- Constant`isLeadingComment`
|
||||
- Constant`isBlockComment`
|
||||
- Constant`isData`
|
||||
- Constant`isGlobal`
|
||||
- Constant`isTable`
|
||||
- Constant`isMemory`
|
||||
- Constant`isFuncImportDescr`
|
||||
- Constant`isModuleImport`
|
||||
- Constant`isModuleExportDescr`
|
||||
- Constant`isModuleExport`
|
||||
- Constant`isLimit`
|
||||
- Constant`isSignature`
|
||||
- Constant`isProgram`
|
||||
- Constant`isIdentifier`
|
||||
- Constant`isBlockInstruction`
|
||||
- Constant`isCallInstruction`
|
||||
- Constant`isCallIndirectInstruction`
|
||||
- Constant`isByteArray`
|
||||
- Constant`isFunc`
|
||||
- Constant`assertModule`
|
||||
- Constant`assertModuleMetadata`
|
||||
- Constant`assertModuleNameMetadata`
|
||||
- Constant`assertFunctionNameMetadata`
|
||||
- Constant`assertLocalNameMetadata`
|
||||
- Constant`assertBinaryModule`
|
||||
- Constant`assertQuoteModule`
|
||||
- Constant`assertSectionMetadata`
|
||||
- Constant`assertLoopInstruction`
|
||||
- Constant`assertInstruction`
|
||||
- Constant`assertObjectInstruction`
|
||||
- Constant`assertIfInstruction`
|
||||
- Constant`assertStringLiteral`
|
||||
- Constant`assertNumberLiteral`
|
||||
- Constant`assertLongNumberLiteral`
|
||||
- Constant`assertFloatLiteral`
|
||||
- Constant`assertElem`
|
||||
- Constant`assertIndexInFuncSection`
|
||||
- Constant`assertValtypeLiteral`
|
||||
- Constant`assertTypeInstruction`
|
||||
- Constant`assertStart`
|
||||
- Constant`assertGlobalType`
|
||||
- Constant`assertLeadingComment`
|
||||
- Constant`assertBlockComment`
|
||||
- Constant`assertData`
|
||||
- Constant`assertGlobal`
|
||||
- Constant`assertTable`
|
||||
- Constant`assertMemory`
|
||||
- Constant`assertFuncImportDescr`
|
||||
- Constant`assertModuleImport`
|
||||
- Constant`assertModuleExportDescr`
|
||||
- Constant`assertModuleExport`
|
||||
- Constant`assertLimit`
|
||||
- Constant`assertSignature`
|
||||
- Constant`assertProgram`
|
||||
- Constant`assertIdentifier`
|
||||
- Constant`assertBlockInstruction`
|
||||
- Constant`assertCallInstruction`
|
||||
- Constant`assertCallIndirectInstruction`
|
||||
- Constant`assertByteArray`
|
||||
- Constant`assertFunc`
|
||||
|
||||
10
node_modules/@webassemblyjs/ast/esm/clone.js
generated
vendored
Normal file
10
node_modules/@webassemblyjs/ast/esm/clone.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export function cloneNode(n) {
|
||||
// $FlowIgnore
|
||||
var newObj = {};
|
||||
|
||||
for (var k in n) {
|
||||
newObj[k] = n[k];
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
663
node_modules/@webassemblyjs/ast/esm/definitions.js
generated
vendored
Normal file
663
node_modules/@webassemblyjs/ast/esm/definitions.js
generated
vendored
Normal file
@@ -0,0 +1,663 @@
|
||||
var definitions = {};
|
||||
|
||||
function defineType(typeName, metadata) {
|
||||
definitions[typeName] = metadata;
|
||||
}
|
||||
|
||||
defineType("Module", {
|
||||
spec: {
|
||||
wasm: "https://webassembly.github.io/spec/core/binary/modules.html#binary-module",
|
||||
wat: "https://webassembly.github.io/spec/core/text/modules.html#text-module"
|
||||
},
|
||||
doc: "A module consists of a sequence of sections (termed fields in the text format).",
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
fields: {
|
||||
array: true,
|
||||
type: "Node"
|
||||
},
|
||||
metadata: {
|
||||
optional: true,
|
||||
type: "ModuleMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
sections: {
|
||||
array: true,
|
||||
type: "SectionMetadata"
|
||||
},
|
||||
functionNames: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "FunctionNameMetadata"
|
||||
},
|
||||
localNames: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "ModuleMetadata"
|
||||
},
|
||||
producers: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "ProducersSectionMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FunctionNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
index: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LocalNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
localIndex: {
|
||||
type: "number"
|
||||
},
|
||||
functionIndex: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BinaryModule", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
blob: {
|
||||
array: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("QuoteModule", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
string: {
|
||||
array: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("SectionMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
section: {
|
||||
type: "SectionName"
|
||||
},
|
||||
startOffset: {
|
||||
type: "number"
|
||||
},
|
||||
size: {
|
||||
type: "NumberLiteral"
|
||||
},
|
||||
vectorOfSize: {
|
||||
comment: "Size of the vector in the section (if any)",
|
||||
type: "NumberLiteral"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducersSectionMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
producers: {
|
||||
array: true,
|
||||
type: "ProducerMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducerMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
language: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
},
|
||||
processedBy: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
},
|
||||
sdk: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducerMetadataVersionedName", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
version: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Instructions
|
||||
*/
|
||||
|
||||
defineType("LoopInstruction", {
|
||||
unionType: ["Node", "Block", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "loop"
|
||||
},
|
||||
label: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
resulttype: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
instr: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Instr", {
|
||||
unionType: ["Node", "Expression", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
type: "string"
|
||||
},
|
||||
object: {
|
||||
optional: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
args: {
|
||||
array: true,
|
||||
type: "Expression"
|
||||
},
|
||||
namedArgs: {
|
||||
optional: true,
|
||||
type: "Object"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("IfInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "if"
|
||||
},
|
||||
testLabel: {
|
||||
comment: "only for WAST",
|
||||
type: "Identifier"
|
||||
},
|
||||
test: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
result: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
consequent: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
alternate: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Concrete value types
|
||||
*/
|
||||
|
||||
defineType("StringLiteral", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("NumberLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "number"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LongNumberLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "LongNumber"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FloatLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "number"
|
||||
},
|
||||
nan: {
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
inf: {
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Elem", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
table: {
|
||||
type: "Index"
|
||||
},
|
||||
offset: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
funcs: {
|
||||
array: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("IndexInFuncSection", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
index: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ValtypeLiteral", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("TypeInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
},
|
||||
functype: {
|
||||
type: "Signature"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Start", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
index: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("GlobalType", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
valtype: {
|
||||
type: "Valtype"
|
||||
},
|
||||
mutability: {
|
||||
type: "Mutability"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LeadingComment", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BlockComment", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Data", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
memoryIndex: {
|
||||
type: "Memidx"
|
||||
},
|
||||
offset: {
|
||||
type: "Instruction"
|
||||
},
|
||||
init: {
|
||||
type: "ByteArray"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Global", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
globalType: {
|
||||
type: "GlobalType"
|
||||
},
|
||||
init: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Table", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
elementType: {
|
||||
type: "TableElementType"
|
||||
},
|
||||
limits: {
|
||||
assertNodeType: true,
|
||||
type: "Limit"
|
||||
},
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
elements: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Memory", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
limits: {
|
||||
type: "Limit"
|
||||
},
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FuncImportDescr", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
id: {
|
||||
type: "Identifier"
|
||||
},
|
||||
signature: {
|
||||
type: "Signature"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleImport", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
module: {
|
||||
type: "string"
|
||||
},
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
descr: {
|
||||
type: "ImportDescr"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleExportDescr", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
exportType: {
|
||||
type: "ExportDescrType"
|
||||
},
|
||||
id: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleExport", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
descr: {
|
||||
type: "ModuleExportDescr"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Limit", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
min: {
|
||||
type: "number"
|
||||
},
|
||||
max: {
|
||||
optional: true,
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Signature", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
params: {
|
||||
array: true,
|
||||
type: "FuncParam"
|
||||
},
|
||||
results: {
|
||||
array: true,
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Program", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
body: {
|
||||
array: true,
|
||||
type: "Node"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Identifier", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
raw: {
|
||||
optional: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BlockInstruction", {
|
||||
unionType: ["Node", "Block", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "block"
|
||||
},
|
||||
label: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
instr: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
result: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("CallInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "call"
|
||||
},
|
||||
index: {
|
||||
type: "Index"
|
||||
},
|
||||
instrArgs: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Expression"
|
||||
},
|
||||
numeric: {
|
||||
type: "Index",
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("CallIndirectInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "call_indirect"
|
||||
},
|
||||
signature: {
|
||||
type: "SignatureOrTypeRef"
|
||||
},
|
||||
intrs: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Expression"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ByteArray", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
values: {
|
||||
array: true,
|
||||
type: "Byte"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Func", {
|
||||
unionType: ["Node", "Block"],
|
||||
fields: {
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
},
|
||||
signature: {
|
||||
type: "SignatureOrTypeRef"
|
||||
},
|
||||
body: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
isExternal: {
|
||||
comment: "means that it has been imported from the outside js",
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
metadata: {
|
||||
optional: true,
|
||||
type: "FuncMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Intrinsics
|
||||
*/
|
||||
|
||||
defineType("InternalBrUnless", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("InternalGoto", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("InternalCallExtern", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
}); // function bodies are terminated by an `end` instruction but are missing a
|
||||
// return instruction
|
||||
//
|
||||
// Since we can't inject a new instruction we are injecting a new instruction.
|
||||
|
||||
defineType("InternalEndAndReturn", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {}
|
||||
});
|
||||
module.exports = definitions;
|
||||
6
node_modules/@webassemblyjs/ast/esm/index.js
generated
vendored
Normal file
6
node_modules/@webassemblyjs/ast/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from "./nodes";
|
||||
export { numberLiteralFromRaw, withLoc, withRaw, funcParam, indexLiteral, memIndexLiteral, instruction, objectInstruction } from "./node-helpers.js";
|
||||
export { traverse } from "./traverse";
|
||||
export { signatures } from "./signatures";
|
||||
export * from "./utils";
|
||||
export { cloneNode } from "./clone";
|
||||
84
node_modules/@webassemblyjs/ast/esm/node-helpers.js
generated
vendored
Normal file
84
node_modules/@webassemblyjs/ast/esm/node-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
import { parse32F, parse64F, parse32I, parse64I, parseU32, isNanLiteral, isInfLiteral } from "@webassemblyjs/wast-parser";
|
||||
import { longNumberLiteral, floatLiteral, numberLiteral, instr } from "./nodes";
|
||||
export function numberLiteralFromRaw(rawValue) {
|
||||
var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
|
||||
var original = rawValue; // Remove numeric separators _
|
||||
|
||||
if (typeof rawValue === "string") {
|
||||
rawValue = rawValue.replace(/_/g, "");
|
||||
}
|
||||
|
||||
if (typeof rawValue === "number") {
|
||||
return numberLiteral(rawValue, String(original));
|
||||
} else {
|
||||
switch (instructionType) {
|
||||
case "i32":
|
||||
{
|
||||
return numberLiteral(parse32I(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "u32":
|
||||
{
|
||||
return numberLiteral(parseU32(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "i64":
|
||||
{
|
||||
return longNumberLiteral(parse64I(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "f32":
|
||||
{
|
||||
return floatLiteral(parse32F(rawValue), isNanLiteral(rawValue), isInfLiteral(rawValue), String(original));
|
||||
}
|
||||
// f64
|
||||
|
||||
default:
|
||||
{
|
||||
return floatLiteral(parse64F(rawValue), isNanLiteral(rawValue), isInfLiteral(rawValue), String(original));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export function instruction(id) {
|
||||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
||||
var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
return instr(id, undefined, args, namedArgs);
|
||||
}
|
||||
export function objectInstruction(id, object) {
|
||||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
return instr(id, object, args, namedArgs);
|
||||
}
|
||||
/**
|
||||
* Decorators
|
||||
*/
|
||||
|
||||
export function withLoc(n, end, start) {
|
||||
var loc = {
|
||||
start: start,
|
||||
end: end
|
||||
};
|
||||
n.loc = loc;
|
||||
return n;
|
||||
}
|
||||
export function withRaw(n, raw) {
|
||||
n.raw = raw;
|
||||
return n;
|
||||
}
|
||||
export function funcParam(valtype, id) {
|
||||
return {
|
||||
id: id,
|
||||
valtype: valtype
|
||||
};
|
||||
}
|
||||
export function indexLiteral(value) {
|
||||
// $FlowIgnore
|
||||
var x = numberLiteralFromRaw(value, "u32");
|
||||
return x;
|
||||
}
|
||||
export function memIndexLiteral(value) {
|
||||
// $FlowIgnore
|
||||
var x = numberLiteralFromRaw(value, "u32");
|
||||
return x;
|
||||
}
|
||||
137
node_modules/@webassemblyjs/ast/esm/node-path.js
generated
vendored
Normal file
137
node_modules/@webassemblyjs/ast/esm/node-path.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function findParent(_ref, cb) {
|
||||
var parentPath = _ref.parentPath;
|
||||
|
||||
if (parentPath == null) {
|
||||
throw new Error("node is root");
|
||||
}
|
||||
|
||||
var currentPath = parentPath;
|
||||
|
||||
while (cb(currentPath) !== false) {
|
||||
// Hit the root node, stop
|
||||
// $FlowIgnore
|
||||
if (currentPath.parentPath == null) {
|
||||
return null;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
currentPath = currentPath.parentPath;
|
||||
}
|
||||
|
||||
return currentPath.node;
|
||||
}
|
||||
|
||||
function insertBefore(context, newNode) {
|
||||
return insert(context, newNode);
|
||||
}
|
||||
|
||||
function insertAfter(context, newNode) {
|
||||
return insert(context, newNode, 1);
|
||||
}
|
||||
|
||||
function insert(_ref2, newNode) {
|
||||
var node = _ref2.node,
|
||||
inList = _ref2.inList,
|
||||
parentPath = _ref2.parentPath,
|
||||
parentKey = _ref2.parentKey;
|
||||
var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (!inList) {
|
||||
throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || "unknown"));
|
||||
}
|
||||
|
||||
if (!(parentPath != null)) {
|
||||
throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
var parentList = parentPath.node[parentKey];
|
||||
var indexInList = parentList.findIndex(function (n) {
|
||||
return n === node;
|
||||
});
|
||||
parentList.splice(indexInList + indexOffset, 0, newNode);
|
||||
}
|
||||
|
||||
function remove(_ref3) {
|
||||
var node = _ref3.node,
|
||||
parentKey = _ref3.parentKey,
|
||||
parentPath = _ref3.parentPath;
|
||||
|
||||
if (!(parentPath != null)) {
|
||||
throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
var parentNode = parentPath.node; // $FlowIgnore
|
||||
|
||||
var parentProperty = parentNode[parentKey];
|
||||
|
||||
if (Array.isArray(parentProperty)) {
|
||||
// $FlowIgnore
|
||||
parentNode[parentKey] = parentProperty.filter(function (n) {
|
||||
return n !== node;
|
||||
});
|
||||
} else {
|
||||
// $FlowIgnore
|
||||
delete parentNode[parentKey];
|
||||
}
|
||||
|
||||
node._deleted = true;
|
||||
}
|
||||
|
||||
function stop(context) {
|
||||
context.shouldStop = true;
|
||||
}
|
||||
|
||||
function replaceWith(context, newNode) {
|
||||
// $FlowIgnore
|
||||
var parentNode = context.parentPath.node; // $FlowIgnore
|
||||
|
||||
var parentProperty = parentNode[context.parentKey];
|
||||
|
||||
if (Array.isArray(parentProperty)) {
|
||||
var indexInList = parentProperty.findIndex(function (n) {
|
||||
return n === context.node;
|
||||
});
|
||||
parentProperty.splice(indexInList, 1, newNode);
|
||||
} else {
|
||||
// $FlowIgnore
|
||||
parentNode[context.parentKey] = newNode;
|
||||
}
|
||||
|
||||
context.node._deleted = true;
|
||||
context.node = newNode;
|
||||
} // bind the context to the first argument of node operations
|
||||
|
||||
|
||||
function bindNodeOperations(operations, context) {
|
||||
var keys = Object.keys(operations);
|
||||
var boundOperations = {};
|
||||
keys.forEach(function (key) {
|
||||
boundOperations[key] = operations[key].bind(null, context);
|
||||
});
|
||||
return boundOperations;
|
||||
}
|
||||
|
||||
function createPathOperations(context) {
|
||||
// $FlowIgnore
|
||||
return bindNodeOperations({
|
||||
findParent: findParent,
|
||||
replaceWith: replaceWith,
|
||||
remove: remove,
|
||||
insertBefore: insertBefore,
|
||||
insertAfter: insertAfter,
|
||||
stop: stop
|
||||
}, context);
|
||||
}
|
||||
|
||||
export function createPath(context) {
|
||||
var path = _extends({}, context); // $FlowIgnore
|
||||
|
||||
|
||||
Object.assign(path, createPathOperations(path)); // $FlowIgnore
|
||||
|
||||
return path;
|
||||
}
|
||||
915
node_modules/@webassemblyjs/ast/esm/nodes.js
generated
vendored
Normal file
915
node_modules/@webassemblyjs/ast/esm/nodes.js
generated
vendored
Normal file
@@ -0,0 +1,915 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
// THIS FILE IS AUTOGENERATED
|
||||
// see scripts/generateNodeUtils.js
|
||||
function isTypeOf(t) {
|
||||
return function (n) {
|
||||
return n.type === t;
|
||||
};
|
||||
}
|
||||
|
||||
function assertTypeOf(t) {
|
||||
return function (n) {
|
||||
return function () {
|
||||
if (!(n.type === t)) {
|
||||
throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}();
|
||||
};
|
||||
}
|
||||
|
||||
export function module(id, fields, metadata) {
|
||||
if (id !== null && id !== undefined) {
|
||||
if (!(typeof id === "string")) {
|
||||
throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
|
||||
throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Module",
|
||||
id: id,
|
||||
fields: fields
|
||||
};
|
||||
|
||||
if (typeof metadata !== "undefined") {
|
||||
node.metadata = metadata;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function moduleMetadata(sections, functionNames, localNames, producers) {
|
||||
if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
|
||||
throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (functionNames !== null && functionNames !== undefined) {
|
||||
if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
|
||||
throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (localNames !== null && localNames !== undefined) {
|
||||
if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
|
||||
throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (producers !== null && producers !== undefined) {
|
||||
if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
|
||||
throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ModuleMetadata",
|
||||
sections: sections
|
||||
};
|
||||
|
||||
if (typeof functionNames !== "undefined" && functionNames.length > 0) {
|
||||
node.functionNames = functionNames;
|
||||
}
|
||||
|
||||
if (typeof localNames !== "undefined" && localNames.length > 0) {
|
||||
node.localNames = localNames;
|
||||
}
|
||||
|
||||
if (typeof producers !== "undefined" && producers.length > 0) {
|
||||
node.producers = producers;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function moduleNameMetadata(value) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ModuleNameMetadata",
|
||||
value: value
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function functionNameMetadata(value, index) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof index === "number")) {
|
||||
throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "FunctionNameMetadata",
|
||||
value: value,
|
||||
index: index
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function localNameMetadata(value, localIndex, functionIndex) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof localIndex === "number")) {
|
||||
throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof functionIndex === "number")) {
|
||||
throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "LocalNameMetadata",
|
||||
value: value,
|
||||
localIndex: localIndex,
|
||||
functionIndex: functionIndex
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function binaryModule(id, blob) {
|
||||
if (id !== null && id !== undefined) {
|
||||
if (!(typeof id === "string")) {
|
||||
throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
|
||||
throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "BinaryModule",
|
||||
id: id,
|
||||
blob: blob
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function quoteModule(id, string) {
|
||||
if (id !== null && id !== undefined) {
|
||||
if (!(typeof id === "string")) {
|
||||
throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
|
||||
throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "QuoteModule",
|
||||
id: id,
|
||||
string: string
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function sectionMetadata(section, startOffset, size, vectorOfSize) {
|
||||
if (!(typeof startOffset === "number")) {
|
||||
throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "SectionMetadata",
|
||||
section: section,
|
||||
startOffset: startOffset,
|
||||
size: size,
|
||||
vectorOfSize: vectorOfSize
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function producersSectionMetadata(producers) {
|
||||
if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
|
||||
throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ProducersSectionMetadata",
|
||||
producers: producers
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function producerMetadata(language, processedBy, sdk) {
|
||||
if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
|
||||
throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
|
||||
throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
|
||||
throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ProducerMetadata",
|
||||
language: language,
|
||||
processedBy: processedBy,
|
||||
sdk: sdk
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function producerMetadataVersionedName(name, version) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof version === "string")) {
|
||||
throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
name: name,
|
||||
version: version
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function loopInstruction(label, resulttype, instr) {
|
||||
if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
|
||||
throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "LoopInstruction",
|
||||
id: "loop",
|
||||
label: label,
|
||||
resulttype: resulttype,
|
||||
instr: instr
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function instr(id, object, args, namedArgs) {
|
||||
if (!(typeof id === "string")) {
|
||||
throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
|
||||
throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Instr",
|
||||
id: id,
|
||||
args: args
|
||||
};
|
||||
|
||||
if (typeof object !== "undefined") {
|
||||
node.object = object;
|
||||
}
|
||||
|
||||
if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
|
||||
node.namedArgs = namedArgs;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function ifInstruction(testLabel, test, result, consequent, alternate) {
|
||||
if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
|
||||
throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
|
||||
throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
|
||||
throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "IfInstruction",
|
||||
id: "if",
|
||||
testLabel: testLabel,
|
||||
test: test,
|
||||
result: result,
|
||||
consequent: consequent,
|
||||
alternate: alternate
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function stringLiteral(value) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "StringLiteral",
|
||||
value: value
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function numberLiteral(value, raw) {
|
||||
if (!(typeof value === "number")) {
|
||||
throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof raw === "string")) {
|
||||
throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "NumberLiteral",
|
||||
value: value,
|
||||
raw: raw
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function longNumberLiteral(value, raw) {
|
||||
if (!(typeof raw === "string")) {
|
||||
throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "LongNumberLiteral",
|
||||
value: value,
|
||||
raw: raw
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function floatLiteral(value, nan, inf, raw) {
|
||||
if (!(typeof value === "number")) {
|
||||
throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
if (nan !== null && nan !== undefined) {
|
||||
if (!(typeof nan === "boolean")) {
|
||||
throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (inf !== null && inf !== undefined) {
|
||||
if (!(typeof inf === "boolean")) {
|
||||
throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(typeof raw === "string")) {
|
||||
throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "FloatLiteral",
|
||||
value: value,
|
||||
raw: raw
|
||||
};
|
||||
|
||||
if (nan === true) {
|
||||
node.nan = true;
|
||||
}
|
||||
|
||||
if (inf === true) {
|
||||
node.inf = true;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function elem(table, offset, funcs) {
|
||||
if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
|
||||
throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
|
||||
throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Elem",
|
||||
table: table,
|
||||
offset: offset,
|
||||
funcs: funcs
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function indexInFuncSection(index) {
|
||||
var node = {
|
||||
type: "IndexInFuncSection",
|
||||
index: index
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function valtypeLiteral(name) {
|
||||
var node = {
|
||||
type: "ValtypeLiteral",
|
||||
name: name
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function typeInstruction(id, functype) {
|
||||
var node = {
|
||||
type: "TypeInstruction",
|
||||
id: id,
|
||||
functype: functype
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function start(index) {
|
||||
var node = {
|
||||
type: "Start",
|
||||
index: index
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function globalType(valtype, mutability) {
|
||||
var node = {
|
||||
type: "GlobalType",
|
||||
valtype: valtype,
|
||||
mutability: mutability
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function leadingComment(value) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "LeadingComment",
|
||||
value: value
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function blockComment(value) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "BlockComment",
|
||||
value: value
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function data(memoryIndex, offset, init) {
|
||||
var node = {
|
||||
type: "Data",
|
||||
memoryIndex: memoryIndex,
|
||||
offset: offset,
|
||||
init: init
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function global(globalType, init, name) {
|
||||
if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
|
||||
throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Global",
|
||||
globalType: globalType,
|
||||
init: init,
|
||||
name: name
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function table(elementType, limits, name, elements) {
|
||||
if (!(limits.type === "Limit")) {
|
||||
throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || "unknown"));
|
||||
}
|
||||
|
||||
if (elements !== null && elements !== undefined) {
|
||||
if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
|
||||
throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Table",
|
||||
elementType: elementType,
|
||||
limits: limits,
|
||||
name: name
|
||||
};
|
||||
|
||||
if (typeof elements !== "undefined" && elements.length > 0) {
|
||||
node.elements = elements;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function memory(limits, id) {
|
||||
var node = {
|
||||
type: "Memory",
|
||||
limits: limits,
|
||||
id: id
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function funcImportDescr(id, signature) {
|
||||
var node = {
|
||||
type: "FuncImportDescr",
|
||||
id: id,
|
||||
signature: signature
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function moduleImport(module, name, descr) {
|
||||
if (!(typeof module === "string")) {
|
||||
throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || "unknown"));
|
||||
}
|
||||
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ModuleImport",
|
||||
module: module,
|
||||
name: name,
|
||||
descr: descr
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function moduleExportDescr(exportType, id) {
|
||||
var node = {
|
||||
type: "ModuleExportDescr",
|
||||
exportType: exportType,
|
||||
id: id
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function moduleExport(name, descr) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ModuleExport",
|
||||
name: name,
|
||||
descr: descr
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function limit(min, max) {
|
||||
if (!(typeof min === "number")) {
|
||||
throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || "unknown"));
|
||||
}
|
||||
|
||||
if (max !== null && max !== undefined) {
|
||||
if (!(typeof max === "number")) {
|
||||
throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Limit",
|
||||
min: min
|
||||
};
|
||||
|
||||
if (typeof max !== "undefined") {
|
||||
node.max = max;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function signature(params, results) {
|
||||
if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
|
||||
throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
|
||||
throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Signature",
|
||||
params: params,
|
||||
results: results
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function program(body) {
|
||||
if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
|
||||
throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Program",
|
||||
body: body
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function identifier(value, raw) {
|
||||
if (!(typeof value === "string")) {
|
||||
throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
|
||||
}
|
||||
|
||||
if (raw !== null && raw !== undefined) {
|
||||
if (!(typeof raw === "string")) {
|
||||
throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Identifier",
|
||||
value: value
|
||||
};
|
||||
|
||||
if (typeof raw !== "undefined") {
|
||||
node.raw = raw;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function blockInstruction(label, instr, result) {
|
||||
if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
|
||||
throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "BlockInstruction",
|
||||
id: "block",
|
||||
label: label,
|
||||
instr: instr,
|
||||
result: result
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function callInstruction(index, instrArgs, numeric) {
|
||||
if (instrArgs !== null && instrArgs !== undefined) {
|
||||
if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
|
||||
throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "CallInstruction",
|
||||
id: "call",
|
||||
index: index
|
||||
};
|
||||
|
||||
if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
|
||||
node.instrArgs = instrArgs;
|
||||
}
|
||||
|
||||
if (typeof numeric !== "undefined") {
|
||||
node.numeric = numeric;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function callIndirectInstruction(signature, intrs) {
|
||||
if (intrs !== null && intrs !== undefined) {
|
||||
if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
|
||||
throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "CallIndirectInstruction",
|
||||
id: "call_indirect",
|
||||
signature: signature
|
||||
};
|
||||
|
||||
if (typeof intrs !== "undefined" && intrs.length > 0) {
|
||||
node.intrs = intrs;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function byteArray(values) {
|
||||
if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
|
||||
throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "ByteArray",
|
||||
values: values
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function func(name, signature, body, isExternal, metadata) {
|
||||
if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
|
||||
throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
if (isExternal !== null && isExternal !== undefined) {
|
||||
if (!(typeof isExternal === "boolean")) {
|
||||
throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "Func",
|
||||
name: name,
|
||||
signature: signature,
|
||||
body: body
|
||||
};
|
||||
|
||||
if (isExternal === true) {
|
||||
node.isExternal = true;
|
||||
}
|
||||
|
||||
if (typeof metadata !== "undefined") {
|
||||
node.metadata = metadata;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
export function internalBrUnless(target) {
|
||||
if (!(typeof target === "number")) {
|
||||
throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "InternalBrUnless",
|
||||
target: target
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function internalGoto(target) {
|
||||
if (!(typeof target === "number")) {
|
||||
throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "InternalGoto",
|
||||
target: target
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function internalCallExtern(target) {
|
||||
if (!(typeof target === "number")) {
|
||||
throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
|
||||
}
|
||||
|
||||
var node = {
|
||||
type: "InternalCallExtern",
|
||||
target: target
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export function internalEndAndReturn() {
|
||||
var node = {
|
||||
type: "InternalEndAndReturn"
|
||||
};
|
||||
return node;
|
||||
}
|
||||
export var isModule = isTypeOf("Module");
|
||||
export var isModuleMetadata = isTypeOf("ModuleMetadata");
|
||||
export var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
|
||||
export var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
|
||||
export var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
|
||||
export var isBinaryModule = isTypeOf("BinaryModule");
|
||||
export var isQuoteModule = isTypeOf("QuoteModule");
|
||||
export var isSectionMetadata = isTypeOf("SectionMetadata");
|
||||
export var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
|
||||
export var isProducerMetadata = isTypeOf("ProducerMetadata");
|
||||
export var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
|
||||
export var isLoopInstruction = isTypeOf("LoopInstruction");
|
||||
export var isInstr = isTypeOf("Instr");
|
||||
export var isIfInstruction = isTypeOf("IfInstruction");
|
||||
export var isStringLiteral = isTypeOf("StringLiteral");
|
||||
export var isNumberLiteral = isTypeOf("NumberLiteral");
|
||||
export var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
|
||||
export var isFloatLiteral = isTypeOf("FloatLiteral");
|
||||
export var isElem = isTypeOf("Elem");
|
||||
export var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
|
||||
export var isValtypeLiteral = isTypeOf("ValtypeLiteral");
|
||||
export var isTypeInstruction = isTypeOf("TypeInstruction");
|
||||
export var isStart = isTypeOf("Start");
|
||||
export var isGlobalType = isTypeOf("GlobalType");
|
||||
export var isLeadingComment = isTypeOf("LeadingComment");
|
||||
export var isBlockComment = isTypeOf("BlockComment");
|
||||
export var isData = isTypeOf("Data");
|
||||
export var isGlobal = isTypeOf("Global");
|
||||
export var isTable = isTypeOf("Table");
|
||||
export var isMemory = isTypeOf("Memory");
|
||||
export var isFuncImportDescr = isTypeOf("FuncImportDescr");
|
||||
export var isModuleImport = isTypeOf("ModuleImport");
|
||||
export var isModuleExportDescr = isTypeOf("ModuleExportDescr");
|
||||
export var isModuleExport = isTypeOf("ModuleExport");
|
||||
export var isLimit = isTypeOf("Limit");
|
||||
export var isSignature = isTypeOf("Signature");
|
||||
export var isProgram = isTypeOf("Program");
|
||||
export var isIdentifier = isTypeOf("Identifier");
|
||||
export var isBlockInstruction = isTypeOf("BlockInstruction");
|
||||
export var isCallInstruction = isTypeOf("CallInstruction");
|
||||
export var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
|
||||
export var isByteArray = isTypeOf("ByteArray");
|
||||
export var isFunc = isTypeOf("Func");
|
||||
export var isInternalBrUnless = isTypeOf("InternalBrUnless");
|
||||
export var isInternalGoto = isTypeOf("InternalGoto");
|
||||
export var isInternalCallExtern = isTypeOf("InternalCallExtern");
|
||||
export var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
|
||||
export var isNode = function isNode(node) {
|
||||
return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
|
||||
};
|
||||
export var isBlock = function isBlock(node) {
|
||||
return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
|
||||
};
|
||||
export var isInstruction = function isInstruction(node) {
|
||||
return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
|
||||
};
|
||||
export var isExpression = function isExpression(node) {
|
||||
return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
|
||||
};
|
||||
export var isNumericLiteral = function isNumericLiteral(node) {
|
||||
return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
|
||||
};
|
||||
export var isImportDescr = function isImportDescr(node) {
|
||||
return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
|
||||
};
|
||||
export var isIntrinsic = function isIntrinsic(node) {
|
||||
return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
|
||||
};
|
||||
export var assertModule = assertTypeOf("Module");
|
||||
export var assertModuleMetadata = assertTypeOf("ModuleMetadata");
|
||||
export var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
|
||||
export var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
|
||||
export var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
|
||||
export var assertBinaryModule = assertTypeOf("BinaryModule");
|
||||
export var assertQuoteModule = assertTypeOf("QuoteModule");
|
||||
export var assertSectionMetadata = assertTypeOf("SectionMetadata");
|
||||
export var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
|
||||
export var assertProducerMetadata = assertTypeOf("ProducerMetadata");
|
||||
export var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
|
||||
export var assertLoopInstruction = assertTypeOf("LoopInstruction");
|
||||
export var assertInstr = assertTypeOf("Instr");
|
||||
export var assertIfInstruction = assertTypeOf("IfInstruction");
|
||||
export var assertStringLiteral = assertTypeOf("StringLiteral");
|
||||
export var assertNumberLiteral = assertTypeOf("NumberLiteral");
|
||||
export var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
|
||||
export var assertFloatLiteral = assertTypeOf("FloatLiteral");
|
||||
export var assertElem = assertTypeOf("Elem");
|
||||
export var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
|
||||
export var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
|
||||
export var assertTypeInstruction = assertTypeOf("TypeInstruction");
|
||||
export var assertStart = assertTypeOf("Start");
|
||||
export var assertGlobalType = assertTypeOf("GlobalType");
|
||||
export var assertLeadingComment = assertTypeOf("LeadingComment");
|
||||
export var assertBlockComment = assertTypeOf("BlockComment");
|
||||
export var assertData = assertTypeOf("Data");
|
||||
export var assertGlobal = assertTypeOf("Global");
|
||||
export var assertTable = assertTypeOf("Table");
|
||||
export var assertMemory = assertTypeOf("Memory");
|
||||
export var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
|
||||
export var assertModuleImport = assertTypeOf("ModuleImport");
|
||||
export var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
|
||||
export var assertModuleExport = assertTypeOf("ModuleExport");
|
||||
export var assertLimit = assertTypeOf("Limit");
|
||||
export var assertSignature = assertTypeOf("Signature");
|
||||
export var assertProgram = assertTypeOf("Program");
|
||||
export var assertIdentifier = assertTypeOf("Identifier");
|
||||
export var assertBlockInstruction = assertTypeOf("BlockInstruction");
|
||||
export var assertCallInstruction = assertTypeOf("CallInstruction");
|
||||
export var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
|
||||
export var assertByteArray = assertTypeOf("ByteArray");
|
||||
export var assertFunc = assertTypeOf("Func");
|
||||
export var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
|
||||
export var assertInternalGoto = assertTypeOf("InternalGoto");
|
||||
export var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
|
||||
export var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
|
||||
export var unionTypesMap = {
|
||||
Module: ["Node"],
|
||||
ModuleMetadata: ["Node"],
|
||||
ModuleNameMetadata: ["Node"],
|
||||
FunctionNameMetadata: ["Node"],
|
||||
LocalNameMetadata: ["Node"],
|
||||
BinaryModule: ["Node"],
|
||||
QuoteModule: ["Node"],
|
||||
SectionMetadata: ["Node"],
|
||||
ProducersSectionMetadata: ["Node"],
|
||||
ProducerMetadata: ["Node"],
|
||||
ProducerMetadataVersionedName: ["Node"],
|
||||
LoopInstruction: ["Node", "Block", "Instruction"],
|
||||
Instr: ["Node", "Expression", "Instruction"],
|
||||
IfInstruction: ["Node", "Instruction"],
|
||||
StringLiteral: ["Node", "Expression"],
|
||||
NumberLiteral: ["Node", "NumericLiteral", "Expression"],
|
||||
LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
|
||||
FloatLiteral: ["Node", "NumericLiteral", "Expression"],
|
||||
Elem: ["Node"],
|
||||
IndexInFuncSection: ["Node"],
|
||||
ValtypeLiteral: ["Node", "Expression"],
|
||||
TypeInstruction: ["Node", "Instruction"],
|
||||
Start: ["Node"],
|
||||
GlobalType: ["Node", "ImportDescr"],
|
||||
LeadingComment: ["Node"],
|
||||
BlockComment: ["Node"],
|
||||
Data: ["Node"],
|
||||
Global: ["Node"],
|
||||
Table: ["Node", "ImportDescr"],
|
||||
Memory: ["Node", "ImportDescr"],
|
||||
FuncImportDescr: ["Node", "ImportDescr"],
|
||||
ModuleImport: ["Node"],
|
||||
ModuleExportDescr: ["Node"],
|
||||
ModuleExport: ["Node"],
|
||||
Limit: ["Node"],
|
||||
Signature: ["Node"],
|
||||
Program: ["Node"],
|
||||
Identifier: ["Node", "Expression"],
|
||||
BlockInstruction: ["Node", "Block", "Instruction"],
|
||||
CallInstruction: ["Node", "Instruction"],
|
||||
CallIndirectInstruction: ["Node", "Instruction"],
|
||||
ByteArray: ["Node"],
|
||||
Func: ["Node", "Block"],
|
||||
InternalBrUnless: ["Node", "Intrinsic"],
|
||||
InternalGoto: ["Node", "Intrinsic"],
|
||||
InternalCallExtern: ["Node", "Intrinsic"],
|
||||
InternalEndAndReturn: ["Node", "Intrinsic"]
|
||||
};
|
||||
export var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
|
||||
199
node_modules/@webassemblyjs/ast/esm/signatures.js
generated
vendored
Normal file
199
node_modules/@webassemblyjs/ast/esm/signatures.js
generated
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
function sign(input, output) {
|
||||
return [input, output];
|
||||
}
|
||||
|
||||
var u32 = "u32";
|
||||
var i32 = "i32";
|
||||
var i64 = "i64";
|
||||
var f32 = "f32";
|
||||
var f64 = "f64";
|
||||
|
||||
var vector = function vector(t) {
|
||||
var vecType = [t]; // $FlowIgnore
|
||||
|
||||
vecType.vector = true;
|
||||
return vecType;
|
||||
};
|
||||
|
||||
var controlInstructions = {
|
||||
unreachable: sign([], []),
|
||||
nop: sign([], []),
|
||||
// block ?
|
||||
// loop ?
|
||||
// if ?
|
||||
// if else ?
|
||||
br: sign([u32], []),
|
||||
br_if: sign([u32], []),
|
||||
br_table: sign(vector(u32), []),
|
||||
return: sign([], []),
|
||||
call: sign([u32], []),
|
||||
call_indirect: sign([u32], [])
|
||||
};
|
||||
var parametricInstructions = {
|
||||
drop: sign([], []),
|
||||
select: sign([], [])
|
||||
};
|
||||
var variableInstructions = {
|
||||
get_local: sign([u32], []),
|
||||
set_local: sign([u32], []),
|
||||
tee_local: sign([u32], []),
|
||||
get_global: sign([u32], []),
|
||||
set_global: sign([u32], [])
|
||||
};
|
||||
var memoryInstructions = {
|
||||
"i32.load": sign([u32, u32], [i32]),
|
||||
"i64.load": sign([u32, u32], []),
|
||||
"f32.load": sign([u32, u32], []),
|
||||
"f64.load": sign([u32, u32], []),
|
||||
"i32.load8_s": sign([u32, u32], [i32]),
|
||||
"i32.load8_u": sign([u32, u32], [i32]),
|
||||
"i32.load16_s": sign([u32, u32], [i32]),
|
||||
"i32.load16_u": sign([u32, u32], [i32]),
|
||||
"i64.load8_s": sign([u32, u32], [i64]),
|
||||
"i64.load8_u": sign([u32, u32], [i64]),
|
||||
"i64.load16_s": sign([u32, u32], [i64]),
|
||||
"i64.load16_u": sign([u32, u32], [i64]),
|
||||
"i64.load32_s": sign([u32, u32], [i64]),
|
||||
"i64.load32_u": sign([u32, u32], [i64]),
|
||||
"i32.store": sign([u32, u32], []),
|
||||
"i64.store": sign([u32, u32], []),
|
||||
"f32.store": sign([u32, u32], []),
|
||||
"f64.store": sign([u32, u32], []),
|
||||
"i32.store8": sign([u32, u32], []),
|
||||
"i32.store16": sign([u32, u32], []),
|
||||
"i64.store8": sign([u32, u32], []),
|
||||
"i64.store16": sign([u32, u32], []),
|
||||
"i64.store32": sign([u32, u32], []),
|
||||
current_memory: sign([], []),
|
||||
grow_memory: sign([], [])
|
||||
};
|
||||
var numericInstructions = {
|
||||
"i32.const": sign([i32], [i32]),
|
||||
"i64.const": sign([i64], [i64]),
|
||||
"f32.const": sign([f32], [f32]),
|
||||
"f64.const": sign([f64], [f64]),
|
||||
"i32.eqz": sign([i32], [i32]),
|
||||
"i32.eq": sign([i32, i32], [i32]),
|
||||
"i32.ne": sign([i32, i32], [i32]),
|
||||
"i32.lt_s": sign([i32, i32], [i32]),
|
||||
"i32.lt_u": sign([i32, i32], [i32]),
|
||||
"i32.gt_s": sign([i32, i32], [i32]),
|
||||
"i32.gt_u": sign([i32, i32], [i32]),
|
||||
"i32.le_s": sign([i32, i32], [i32]),
|
||||
"i32.le_u": sign([i32, i32], [i32]),
|
||||
"i32.ge_s": sign([i32, i32], [i32]),
|
||||
"i32.ge_u": sign([i32, i32], [i32]),
|
||||
"i64.eqz": sign([i64], [i64]),
|
||||
"i64.eq": sign([i64, i64], [i32]),
|
||||
"i64.ne": sign([i64, i64], [i32]),
|
||||
"i64.lt_s": sign([i64, i64], [i32]),
|
||||
"i64.lt_u": sign([i64, i64], [i32]),
|
||||
"i64.gt_s": sign([i64, i64], [i32]),
|
||||
"i64.gt_u": sign([i64, i64], [i32]),
|
||||
"i64.le_s": sign([i64, i64], [i32]),
|
||||
"i64.le_u": sign([i64, i64], [i32]),
|
||||
"i64.ge_s": sign([i64, i64], [i32]),
|
||||
"i64.ge_u": sign([i64, i64], [i32]),
|
||||
"f32.eq": sign([f32, f32], [i32]),
|
||||
"f32.ne": sign([f32, f32], [i32]),
|
||||
"f32.lt": sign([f32, f32], [i32]),
|
||||
"f32.gt": sign([f32, f32], [i32]),
|
||||
"f32.le": sign([f32, f32], [i32]),
|
||||
"f32.ge": sign([f32, f32], [i32]),
|
||||
"f64.eq": sign([f64, f64], [i32]),
|
||||
"f64.ne": sign([f64, f64], [i32]),
|
||||
"f64.lt": sign([f64, f64], [i32]),
|
||||
"f64.gt": sign([f64, f64], [i32]),
|
||||
"f64.le": sign([f64, f64], [i32]),
|
||||
"f64.ge": sign([f64, f64], [i32]),
|
||||
"i32.clz": sign([i32], [i32]),
|
||||
"i32.ctz": sign([i32], [i32]),
|
||||
"i32.popcnt": sign([i32], [i32]),
|
||||
"i32.add": sign([i32, i32], [i32]),
|
||||
"i32.sub": sign([i32, i32], [i32]),
|
||||
"i32.mul": sign([i32, i32], [i32]),
|
||||
"i32.div_s": sign([i32, i32], [i32]),
|
||||
"i32.div_u": sign([i32, i32], [i32]),
|
||||
"i32.rem_s": sign([i32, i32], [i32]),
|
||||
"i32.rem_u": sign([i32, i32], [i32]),
|
||||
"i32.and": sign([i32, i32], [i32]),
|
||||
"i32.or": sign([i32, i32], [i32]),
|
||||
"i32.xor": sign([i32, i32], [i32]),
|
||||
"i32.shl": sign([i32, i32], [i32]),
|
||||
"i32.shr_s": sign([i32, i32], [i32]),
|
||||
"i32.shr_u": sign([i32, i32], [i32]),
|
||||
"i32.rotl": sign([i32, i32], [i32]),
|
||||
"i32.rotr": sign([i32, i32], [i32]),
|
||||
"i64.clz": sign([i64], [i64]),
|
||||
"i64.ctz": sign([i64], [i64]),
|
||||
"i64.popcnt": sign([i64], [i64]),
|
||||
"i64.add": sign([i64, i64], [i64]),
|
||||
"i64.sub": sign([i64, i64], [i64]),
|
||||
"i64.mul": sign([i64, i64], [i64]),
|
||||
"i64.div_s": sign([i64, i64], [i64]),
|
||||
"i64.div_u": sign([i64, i64], [i64]),
|
||||
"i64.rem_s": sign([i64, i64], [i64]),
|
||||
"i64.rem_u": sign([i64, i64], [i64]),
|
||||
"i64.and": sign([i64, i64], [i64]),
|
||||
"i64.or": sign([i64, i64], [i64]),
|
||||
"i64.xor": sign([i64, i64], [i64]),
|
||||
"i64.shl": sign([i64, i64], [i64]),
|
||||
"i64.shr_s": sign([i64, i64], [i64]),
|
||||
"i64.shr_u": sign([i64, i64], [i64]),
|
||||
"i64.rotl": sign([i64, i64], [i64]),
|
||||
"i64.rotr": sign([i64, i64], [i64]),
|
||||
"f32.abs": sign([f32], [f32]),
|
||||
"f32.neg": sign([f32], [f32]),
|
||||
"f32.ceil": sign([f32], [f32]),
|
||||
"f32.floor": sign([f32], [f32]),
|
||||
"f32.trunc": sign([f32], [f32]),
|
||||
"f32.nearest": sign([f32], [f32]),
|
||||
"f32.sqrt": sign([f32], [f32]),
|
||||
"f32.add": sign([f32, f32], [f32]),
|
||||
"f32.sub": sign([f32, f32], [f32]),
|
||||
"f32.mul": sign([f32, f32], [f32]),
|
||||
"f32.div": sign([f32, f32], [f32]),
|
||||
"f32.min": sign([f32, f32], [f32]),
|
||||
"f32.max": sign([f32, f32], [f32]),
|
||||
"f32.copysign": sign([f32, f32], [f32]),
|
||||
"f64.abs": sign([f64], [f64]),
|
||||
"f64.neg": sign([f64], [f64]),
|
||||
"f64.ceil": sign([f64], [f64]),
|
||||
"f64.floor": sign([f64], [f64]),
|
||||
"f64.trunc": sign([f64], [f64]),
|
||||
"f64.nearest": sign([f64], [f64]),
|
||||
"f64.sqrt": sign([f64], [f64]),
|
||||
"f64.add": sign([f64, f64], [f64]),
|
||||
"f64.sub": sign([f64, f64], [f64]),
|
||||
"f64.mul": sign([f64, f64], [f64]),
|
||||
"f64.div": sign([f64, f64], [f64]),
|
||||
"f64.min": sign([f64, f64], [f64]),
|
||||
"f64.max": sign([f64, f64], [f64]),
|
||||
"f64.copysign": sign([f64, f64], [f64]),
|
||||
"i32.wrap/i64": sign([i64], [i32]),
|
||||
"i32.trunc_s/f32": sign([f32], [i32]),
|
||||
"i32.trunc_u/f32": sign([f32], [i32]),
|
||||
"i32.trunc_s/f64": sign([f32], [i32]),
|
||||
"i32.trunc_u/f64": sign([f64], [i32]),
|
||||
"i64.extend_s/i32": sign([i32], [i64]),
|
||||
"i64.extend_u/i32": sign([i32], [i64]),
|
||||
"i64.trunc_s/f32": sign([f32], [i64]),
|
||||
"i64.trunc_u/f32": sign([f32], [i64]),
|
||||
"i64.trunc_s/f64": sign([f64], [i64]),
|
||||
"i64.trunc_u/f64": sign([f64], [i64]),
|
||||
"f32.convert_s/i32": sign([i32], [f32]),
|
||||
"f32.convert_u/i32": sign([i32], [f32]),
|
||||
"f32.convert_s/i64": sign([i64], [f32]),
|
||||
"f32.convert_u/i64": sign([i64], [f32]),
|
||||
"f32.demote/f64": sign([f64], [f32]),
|
||||
"f64.convert_s/i32": sign([i32], [f64]),
|
||||
"f64.convert_u/i32": sign([i32], [f64]),
|
||||
"f64.convert_s/i64": sign([i64], [f64]),
|
||||
"f64.convert_u/i64": sign([i64], [f64]),
|
||||
"f64.promote/f32": sign([f32], [f64]),
|
||||
"i32.reinterpret/f32": sign([f32], [i32]),
|
||||
"i64.reinterpret/f64": sign([f64], [i64]),
|
||||
"f32.reinterpret/i32": sign([i32], [f32]),
|
||||
"f64.reinterpret/i64": sign([i64], [f64])
|
||||
};
|
||||
export var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
|
||||
76
node_modules/@webassemblyjs/ast/esm/transform/denormalize-type-references/index.js
generated
vendored
Normal file
76
node_modules/@webassemblyjs/ast/esm/transform/denormalize-type-references/index.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var t = require("../../index"); // func and call_indirect instructions can either define a signature inline, or
|
||||
// reference a signature, e.g.
|
||||
//
|
||||
// ;; inline signature
|
||||
// (func (result i64)
|
||||
// (i64.const 2)
|
||||
// )
|
||||
// ;; signature reference
|
||||
// (type (func (result i64)))
|
||||
// (func (type 0)
|
||||
// (i64.const 2))
|
||||
// )
|
||||
//
|
||||
// this AST transform denormalises the type references, making all signatures within the module
|
||||
// inline.
|
||||
|
||||
|
||||
export function transform(ast) {
|
||||
var typeInstructions = [];
|
||||
t.traverse(ast, {
|
||||
TypeInstruction: function TypeInstruction(_ref) {
|
||||
var node = _ref.node;
|
||||
typeInstructions.push(node);
|
||||
}
|
||||
});
|
||||
|
||||
if (!typeInstructions.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
function denormalizeSignature(signature) {
|
||||
// signature referenced by identifier
|
||||
if (signature.type === "Identifier") {
|
||||
var identifier = signature;
|
||||
var typeInstruction = typeInstructions.find(function (t) {
|
||||
return t.id.type === identifier.type && t.id.value === identifier.value;
|
||||
});
|
||||
|
||||
if (!typeInstruction) {
|
||||
throw new Error("A type instruction reference was not found ".concat(JSON.stringify(signature)));
|
||||
}
|
||||
|
||||
return typeInstruction.functype;
|
||||
} // signature referenced by index
|
||||
|
||||
|
||||
if (signature.type === "NumberLiteral") {
|
||||
var signatureRef = signature;
|
||||
var _typeInstruction = typeInstructions[signatureRef.value];
|
||||
return _typeInstruction.functype;
|
||||
}
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
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;
|
||||
node.signature = denormalizeSignature(node.signature);
|
||||
}),
|
||||
CallIndirectInstruction: function CallIndirectInstruction(_ref3) {
|
||||
var node = _ref3.node;
|
||||
node.signature = denormalizeSignature(node.signature);
|
||||
}
|
||||
});
|
||||
}
|
||||
216
node_modules/@webassemblyjs/ast/esm/transform/wast-identifier-to-index/index.js
generated
vendored
Normal file
216
node_modules/@webassemblyjs/ast/esm/transform/wast-identifier-to-index/index.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
import { isBlock, isFunc, isIdentifier, numberLiteralFromRaw, traverse } from "../../index";
|
||||
import { moduleContextFromModuleAST } from "@webassemblyjs/helper-module-context"; // FIXME(sven): do the same with all block instructions, must be more generic here
|
||||
|
||||
function newUnexpectedFunction(i) {
|
||||
return new Error("unknown function at offset: " + i);
|
||||
}
|
||||
|
||||
export function transform(ast) {
|
||||
var module;
|
||||
traverse(ast, {
|
||||
Module: function (_Module) {
|
||||
function Module(_x) {
|
||||
return _Module.apply(this, arguments);
|
||||
}
|
||||
|
||||
Module.toString = function () {
|
||||
return _Module.toString();
|
||||
};
|
||||
|
||||
return Module;
|
||||
}(function (path) {
|
||||
module = path.node;
|
||||
})
|
||||
});
|
||||
var moduleContext = moduleContextFromModuleAST(module); // Transform the actual instruction in function bodies
|
||||
|
||||
traverse(ast, {
|
||||
Func: function (_Func) {
|
||||
function Func(_x2) {
|
||||
return _Func.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (path) {
|
||||
transformFuncPath(path, moduleContext);
|
||||
}),
|
||||
Start: function (_Start) {
|
||||
function Start(_x3) {
|
||||
return _Start.apply(this, arguments);
|
||||
}
|
||||
|
||||
Start.toString = function () {
|
||||
return _Start.toString();
|
||||
};
|
||||
|
||||
return Start;
|
||||
}(function (path) {
|
||||
var index = path.node.index;
|
||||
|
||||
if (isIdentifier(index) === true) {
|
||||
var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value);
|
||||
|
||||
if (typeof offsetInModule === "undefined") {
|
||||
throw newUnexpectedFunction(index.value);
|
||||
} // Replace the index Identifier
|
||||
// $FlowIgnore: reference?
|
||||
|
||||
|
||||
path.node.index = numberLiteralFromRaw(offsetInModule);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function transformFuncPath(funcPath, moduleContext) {
|
||||
var funcNode = funcPath.node;
|
||||
var signature = funcNode.signature;
|
||||
|
||||
if (signature.type !== "Signature") {
|
||||
throw new Error("Function signatures must be denormalised before execution");
|
||||
}
|
||||
|
||||
var params = signature.params; // Add func locals in the context
|
||||
|
||||
params.forEach(function (p) {
|
||||
return moduleContext.addLocal(p.valtype);
|
||||
});
|
||||
traverse(funcNode, {
|
||||
Instr: function (_Instr) {
|
||||
function Instr(_x4) {
|
||||
return _Instr.apply(this, arguments);
|
||||
}
|
||||
|
||||
Instr.toString = function () {
|
||||
return _Instr.toString();
|
||||
};
|
||||
|
||||
return Instr;
|
||||
}(function (instrPath) {
|
||||
var instrNode = instrPath.node;
|
||||
/**
|
||||
* Local access
|
||||
*/
|
||||
|
||||
if (instrNode.id === "get_local" || instrNode.id === "set_local" || instrNode.id === "tee_local") {
|
||||
var _instrNode$args = _slicedToArray(instrNode.args, 1),
|
||||
firstArg = _instrNode$args[0];
|
||||
|
||||
if (firstArg.type === "Identifier") {
|
||||
var offsetInParams = params.findIndex(function (_ref) {
|
||||
var id = _ref.id;
|
||||
return id === firstArg.value;
|
||||
});
|
||||
|
||||
if (offsetInParams === -1) {
|
||||
throw new Error("".concat(firstArg.value, " not found in ").concat(instrNode.id, ": not declared in func params"));
|
||||
} // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
|
||||
instrNode.args[0] = numberLiteralFromRaw(offsetInParams);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Global access
|
||||
*/
|
||||
|
||||
|
||||
if (instrNode.id === "get_global" || instrNode.id === "set_global") {
|
||||
var _instrNode$args2 = _slicedToArray(instrNode.args, 1),
|
||||
_firstArg = _instrNode$args2[0];
|
||||
|
||||
if (isIdentifier(_firstArg) === true) {
|
||||
var globalOffset = moduleContext.getGlobalOffsetByIdentifier( // $FlowIgnore: reference?
|
||||
_firstArg.value);
|
||||
|
||||
if (typeof globalOffset === "undefined") {
|
||||
// $FlowIgnore: reference?
|
||||
throw new Error("global ".concat(_firstArg.value, " not found in module"));
|
||||
} // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
|
||||
instrNode.args[0] = numberLiteralFromRaw(globalOffset);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Labels lookup
|
||||
*/
|
||||
|
||||
|
||||
if (instrNode.id === "br") {
|
||||
var _instrNode$args3 = _slicedToArray(instrNode.args, 1),
|
||||
_firstArg2 = _instrNode$args3[0];
|
||||
|
||||
if (isIdentifier(_firstArg2) === true) {
|
||||
// if the labels is not found it is going to be replaced with -1
|
||||
// which is invalid.
|
||||
var relativeBlockCount = -1; // $FlowIgnore: reference?
|
||||
|
||||
instrPath.findParent(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
|
||||
if (isBlock(node)) {
|
||||
relativeBlockCount++; // $FlowIgnore: reference?
|
||||
|
||||
var name = node.label || node.name;
|
||||
|
||||
if (_typeof(name) === "object") {
|
||||
// $FlowIgnore: isIdentifier ensures that
|
||||
if (name.value === _firstArg2.value) {
|
||||
// Found it
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isFunc(node)) {
|
||||
return false;
|
||||
}
|
||||
}); // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
instrNode.args[0] = numberLiteralFromRaw(relativeBlockCount);
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Func lookup
|
||||
*/
|
||||
CallInstruction: function (_CallInstruction) {
|
||||
function CallInstruction(_x5) {
|
||||
return _CallInstruction.apply(this, arguments);
|
||||
}
|
||||
|
||||
CallInstruction.toString = function () {
|
||||
return _CallInstruction.toString();
|
||||
};
|
||||
|
||||
return CallInstruction;
|
||||
}(function (_ref3) {
|
||||
var node = _ref3.node;
|
||||
var index = node.index;
|
||||
|
||||
if (isIdentifier(index) === true) {
|
||||
var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value);
|
||||
|
||||
if (typeof offsetInModule === "undefined") {
|
||||
throw newUnexpectedFunction(index.value);
|
||||
} // Replace the index Identifier
|
||||
// $FlowIgnore: reference?
|
||||
|
||||
|
||||
node.index = numberLiteralFromRaw(offsetInModule);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
96
node_modules/@webassemblyjs/ast/esm/traverse.js
generated
vendored
Normal file
96
node_modules/@webassemblyjs/ast/esm/traverse.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { createPath } from "./node-path";
|
||||
import { unionTypesMap, nodeAndUnionTypes } from "./nodes"; // recursively walks the AST starting at the given node. The callback is invoked for
|
||||
// and object that has a 'type' property.
|
||||
|
||||
function walk(context, callback) {
|
||||
var stop = false;
|
||||
|
||||
function innerWalk(context, callback) {
|
||||
if (stop) {
|
||||
return;
|
||||
}
|
||||
|
||||
var node = context.node;
|
||||
|
||||
if (node === undefined) {
|
||||
console.warn("traversing with an empty context");
|
||||
return;
|
||||
}
|
||||
|
||||
if (node._deleted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var path = createPath(context);
|
||||
callback(node.type, path);
|
||||
|
||||
if (path.shouldStop) {
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(node).forEach(function (prop) {
|
||||
var value = node[prop];
|
||||
|
||||
if (value === null || value === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var valueAsArray = Array.isArray(value) ? value : [value];
|
||||
valueAsArray.forEach(function (childNode) {
|
||||
if (typeof childNode.type === "string") {
|
||||
var childContext = {
|
||||
node: childNode,
|
||||
parentKey: prop,
|
||||
parentPath: path,
|
||||
shouldStop: false,
|
||||
inList: Array.isArray(value)
|
||||
};
|
||||
innerWalk(childContext, callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
innerWalk(context, callback);
|
||||
}
|
||||
|
||||
var noop = function noop() {};
|
||||
|
||||
export function traverse(node, visitors) {
|
||||
var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
|
||||
var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
|
||||
Object.keys(visitors).forEach(function (visitor) {
|
||||
if (!nodeAndUnionTypes.includes(visitor)) {
|
||||
throw new Error("Unexpected visitor ".concat(visitor));
|
||||
}
|
||||
});
|
||||
var context = {
|
||||
node: node,
|
||||
inList: false,
|
||||
shouldStop: false,
|
||||
parentPath: null,
|
||||
parentKey: null
|
||||
};
|
||||
walk(context, function (type, path) {
|
||||
if (typeof visitors[type] === "function") {
|
||||
before(type, path);
|
||||
visitors[type](path);
|
||||
after(type, path);
|
||||
}
|
||||
|
||||
var unionTypes = unionTypesMap[type];
|
||||
|
||||
if (!unionTypes) {
|
||||
throw new Error("Unexpected node type ".concat(type));
|
||||
}
|
||||
|
||||
unionTypes.forEach(function (unionType) {
|
||||
if (typeof visitors[unionType] === "function") {
|
||||
before(unionType, path);
|
||||
visitors[unionType](path);
|
||||
after(unionType, path);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
0
node_modules/@webassemblyjs/ast/esm/types/basic.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/esm/types/basic.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/esm/types/nodes.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/esm/types/nodes.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/esm/types/traverse.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/esm/types/traverse.js
generated
vendored
Normal file
265
node_modules/@webassemblyjs/ast/esm/utils.js
generated
vendored
Normal file
265
node_modules/@webassemblyjs/ast/esm/utils.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
import { signatures } from "./signatures";
|
||||
import { traverse } from "./traverse";
|
||||
import constants from "@webassemblyjs/helper-wasm-bytecode";
|
||||
import { getSectionForNode } from "@webassemblyjs/helper-wasm-bytecode";
|
||||
export function isAnonymous(ident) {
|
||||
return ident.raw === "";
|
||||
}
|
||||
export function getSectionMetadata(ast, name) {
|
||||
var section;
|
||||
traverse(ast, {
|
||||
SectionMetadata: function (_SectionMetadata) {
|
||||
function SectionMetadata(_x) {
|
||||
return _SectionMetadata.apply(this, arguments);
|
||||
}
|
||||
|
||||
SectionMetadata.toString = function () {
|
||||
return _SectionMetadata.toString();
|
||||
};
|
||||
|
||||
return SectionMetadata;
|
||||
}(function (_ref) {
|
||||
var node = _ref.node;
|
||||
|
||||
if (node.section === name) {
|
||||
section = node;
|
||||
}
|
||||
})
|
||||
});
|
||||
return section;
|
||||
}
|
||||
export function getSectionMetadatas(ast, name) {
|
||||
var sections = [];
|
||||
traverse(ast, {
|
||||
SectionMetadata: function (_SectionMetadata2) {
|
||||
function SectionMetadata(_x2) {
|
||||
return _SectionMetadata2.apply(this, arguments);
|
||||
}
|
||||
|
||||
SectionMetadata.toString = function () {
|
||||
return _SectionMetadata2.toString();
|
||||
};
|
||||
|
||||
return SectionMetadata;
|
||||
}(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
|
||||
if (node.section === name) {
|
||||
sections.push(node);
|
||||
}
|
||||
})
|
||||
});
|
||||
return sections;
|
||||
}
|
||||
export function sortSectionMetadata(m) {
|
||||
if (m.metadata == null) {
|
||||
console.warn("sortSectionMetadata: no metadata to sort");
|
||||
return;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
m.metadata.sections.sort(function (a, b) {
|
||||
var aId = constants.sections[a.section];
|
||||
var bId = constants.sections[b.section];
|
||||
|
||||
if (typeof aId !== "number" || typeof bId !== "number") {
|
||||
throw new Error("Section id not found");
|
||||
}
|
||||
|
||||
return aId - bId;
|
||||
});
|
||||
}
|
||||
export function orderedInsertNode(m, n) {
|
||||
assertHasLoc(n);
|
||||
var didInsert = false;
|
||||
|
||||
if (n.type === "ModuleExport") {
|
||||
m.fields.push(n);
|
||||
return;
|
||||
}
|
||||
|
||||
m.fields = m.fields.reduce(function (acc, field) {
|
||||
var fieldEndCol = Infinity;
|
||||
|
||||
if (field.loc != null) {
|
||||
// $FlowIgnore
|
||||
fieldEndCol = field.loc.end.column;
|
||||
} // $FlowIgnore: assertHasLoc ensures that
|
||||
|
||||
|
||||
if (didInsert === false && n.loc.start.column < fieldEndCol) {
|
||||
didInsert = true;
|
||||
acc.push(n);
|
||||
}
|
||||
|
||||
acc.push(field);
|
||||
return acc;
|
||||
}, []); // Handles empty modules or n is the last element
|
||||
|
||||
if (didInsert === false) {
|
||||
m.fields.push(n);
|
||||
}
|
||||
}
|
||||
export function assertHasLoc(n) {
|
||||
if (n.loc == null || n.loc.start == null || n.loc.end == null) {
|
||||
throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
|
||||
}
|
||||
}
|
||||
export function getEndOfSection(s) {
|
||||
assertHasLoc(s.size);
|
||||
return s.startOffset + s.size.value + ( // $FlowIgnore
|
||||
s.size.loc.end.column - s.size.loc.start.column);
|
||||
}
|
||||
export function shiftLoc(node, delta) {
|
||||
// $FlowIgnore
|
||||
node.loc.start.column += delta; // $FlowIgnore
|
||||
|
||||
node.loc.end.column += delta;
|
||||
}
|
||||
export function shiftSection(ast, node, delta) {
|
||||
if (node.type !== "SectionMetadata") {
|
||||
throw new Error("Can not shift node " + JSON.stringify(node.type));
|
||||
}
|
||||
|
||||
node.startOffset += delta;
|
||||
|
||||
if (_typeof(node.size.loc) === "object") {
|
||||
shiftLoc(node.size, delta);
|
||||
} // Custom sections doesn't have vectorOfSize
|
||||
|
||||
|
||||
if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
|
||||
shiftLoc(node.vectorOfSize, delta);
|
||||
}
|
||||
|
||||
var sectionName = node.section; // shift node locations within that section
|
||||
|
||||
traverse(ast, {
|
||||
Node: function Node(_ref3) {
|
||||
var node = _ref3.node;
|
||||
var section = getSectionForNode(node);
|
||||
|
||||
if (section === sectionName && _typeof(node.loc) === "object") {
|
||||
shiftLoc(node, delta);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
export function signatureForOpcode(object, name) {
|
||||
var opcodeName = name;
|
||||
|
||||
if (object !== undefined && object !== "") {
|
||||
opcodeName = object + "." + name;
|
||||
}
|
||||
|
||||
var sign = signatures[opcodeName];
|
||||
|
||||
if (sign == undefined) {
|
||||
// TODO: Uncomment this when br_table and others has been done
|
||||
//throw new Error("Invalid opcode: "+opcodeName);
|
||||
return [object, object];
|
||||
}
|
||||
|
||||
return sign[0];
|
||||
}
|
||||
export function getUniqueNameGenerator() {
|
||||
var inc = {};
|
||||
return function () {
|
||||
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
|
||||
|
||||
if (!(prefix in inc)) {
|
||||
inc[prefix] = 0;
|
||||
} else {
|
||||
inc[prefix] = inc[prefix] + 1;
|
||||
}
|
||||
|
||||
return prefix + "_" + inc[prefix];
|
||||
};
|
||||
}
|
||||
export function getStartByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
|
||||
throw new Error( // $FlowIgnore
|
||||
"Can not get byte offset without loc informations, node: " + String(n.id));
|
||||
}
|
||||
|
||||
return n.loc.start.column;
|
||||
}
|
||||
export function getEndByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
|
||||
throw new Error("Can not get byte offset without loc informations, node: " + n.type);
|
||||
}
|
||||
|
||||
return n.loc.end.column;
|
||||
}
|
||||
export function getFunctionBeginingByteOffset(n) {
|
||||
if (!(n.body.length > 0)) {
|
||||
throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var _n$body = _slicedToArray(n.body, 1),
|
||||
firstInstruction = _n$body[0];
|
||||
|
||||
return getStartByteOffset(firstInstruction);
|
||||
}
|
||||
export function getEndBlockByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (!(n.instr.length > 0 || n.body.length > 0)) {
|
||||
throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var lastInstruction;
|
||||
|
||||
if (n.instr) {
|
||||
// $FlowIgnore
|
||||
lastInstruction = n.instr[n.instr.length - 1];
|
||||
}
|
||||
|
||||
if (n.body) {
|
||||
// $FlowIgnore
|
||||
lastInstruction = n.body[n.body.length - 1];
|
||||
}
|
||||
|
||||
if (!(_typeof(lastInstruction) === "object")) {
|
||||
throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
return getStartByteOffset(lastInstruction);
|
||||
}
|
||||
export function getStartBlockByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (!(n.instr.length > 0 || n.body.length > 0)) {
|
||||
throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var fistInstruction;
|
||||
|
||||
if (n.instr) {
|
||||
// $FlowIgnore
|
||||
var _n$instr = _slicedToArray(n.instr, 1);
|
||||
|
||||
fistInstruction = _n$instr[0];
|
||||
}
|
||||
|
||||
if (n.body) {
|
||||
// $FlowIgnore
|
||||
var _n$body2 = _slicedToArray(n.body, 1);
|
||||
|
||||
fistInstruction = _n$body2[0];
|
||||
}
|
||||
|
||||
if (!(_typeof(fistInstruction) === "object")) {
|
||||
throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
return getStartByteOffset(fistInstruction);
|
||||
}
|
||||
17
node_modules/@webassemblyjs/ast/lib/clone.js
generated
vendored
Normal file
17
node_modules/@webassemblyjs/ast/lib/clone.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.cloneNode = cloneNode;
|
||||
|
||||
function cloneNode(n) {
|
||||
// $FlowIgnore
|
||||
var newObj = {};
|
||||
|
||||
for (var k in n) {
|
||||
newObj[k] = n[k];
|
||||
}
|
||||
|
||||
return newObj;
|
||||
}
|
||||
663
node_modules/@webassemblyjs/ast/lib/definitions.js
generated
vendored
Normal file
663
node_modules/@webassemblyjs/ast/lib/definitions.js
generated
vendored
Normal file
@@ -0,0 +1,663 @@
|
||||
var definitions = {};
|
||||
|
||||
function defineType(typeName, metadata) {
|
||||
definitions[typeName] = metadata;
|
||||
}
|
||||
|
||||
defineType("Module", {
|
||||
spec: {
|
||||
wasm: "https://webassembly.github.io/spec/core/binary/modules.html#binary-module",
|
||||
wat: "https://webassembly.github.io/spec/core/text/modules.html#text-module"
|
||||
},
|
||||
doc: "A module consists of a sequence of sections (termed fields in the text format).",
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
fields: {
|
||||
array: true,
|
||||
type: "Node"
|
||||
},
|
||||
metadata: {
|
||||
optional: true,
|
||||
type: "ModuleMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
sections: {
|
||||
array: true,
|
||||
type: "SectionMetadata"
|
||||
},
|
||||
functionNames: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "FunctionNameMetadata"
|
||||
},
|
||||
localNames: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "ModuleMetadata"
|
||||
},
|
||||
producers: {
|
||||
optional: true,
|
||||
array: true,
|
||||
type: "ProducersSectionMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FunctionNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
index: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LocalNameMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
localIndex: {
|
||||
type: "number"
|
||||
},
|
||||
functionIndex: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BinaryModule", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
blob: {
|
||||
array: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("QuoteModule", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "string"
|
||||
},
|
||||
string: {
|
||||
array: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("SectionMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
section: {
|
||||
type: "SectionName"
|
||||
},
|
||||
startOffset: {
|
||||
type: "number"
|
||||
},
|
||||
size: {
|
||||
type: "NumberLiteral"
|
||||
},
|
||||
vectorOfSize: {
|
||||
comment: "Size of the vector in the section (if any)",
|
||||
type: "NumberLiteral"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducersSectionMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
producers: {
|
||||
array: true,
|
||||
type: "ProducerMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducerMetadata", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
language: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
},
|
||||
processedBy: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
},
|
||||
sdk: {
|
||||
type: "ProducerMetadataVersionedName",
|
||||
array: true
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ProducerMetadataVersionedName", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
version: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Instructions
|
||||
*/
|
||||
|
||||
defineType("LoopInstruction", {
|
||||
unionType: ["Node", "Block", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "loop"
|
||||
},
|
||||
label: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
resulttype: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
instr: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Instr", {
|
||||
unionType: ["Node", "Expression", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
type: "string"
|
||||
},
|
||||
object: {
|
||||
optional: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
args: {
|
||||
array: true,
|
||||
type: "Expression"
|
||||
},
|
||||
namedArgs: {
|
||||
optional: true,
|
||||
type: "Object"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("IfInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "if"
|
||||
},
|
||||
testLabel: {
|
||||
comment: "only for WAST",
|
||||
type: "Identifier"
|
||||
},
|
||||
test: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
result: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
},
|
||||
consequent: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
alternate: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
Concrete value types
|
||||
*/
|
||||
|
||||
defineType("StringLiteral", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("NumberLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "number"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LongNumberLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "LongNumber"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FloatLiteral", {
|
||||
unionType: ["Node", "NumericLiteral", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "number"
|
||||
},
|
||||
nan: {
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
inf: {
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
raw: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Elem", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
table: {
|
||||
type: "Index"
|
||||
},
|
||||
offset: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
funcs: {
|
||||
array: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("IndexInFuncSection", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
index: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ValtypeLiteral", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("TypeInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
},
|
||||
functype: {
|
||||
type: "Signature"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Start", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
index: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("GlobalType", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
valtype: {
|
||||
type: "Valtype"
|
||||
},
|
||||
mutability: {
|
||||
type: "Mutability"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("LeadingComment", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BlockComment", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Data", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
memoryIndex: {
|
||||
type: "Memidx"
|
||||
},
|
||||
offset: {
|
||||
type: "Instruction"
|
||||
},
|
||||
init: {
|
||||
type: "ByteArray"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Global", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
globalType: {
|
||||
type: "GlobalType"
|
||||
},
|
||||
init: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Table", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
elementType: {
|
||||
type: "TableElementType"
|
||||
},
|
||||
limits: {
|
||||
assertNodeType: true,
|
||||
type: "Limit"
|
||||
},
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
elements: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Memory", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
limits: {
|
||||
type: "Limit"
|
||||
},
|
||||
id: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("FuncImportDescr", {
|
||||
unionType: ["Node", "ImportDescr"],
|
||||
fields: {
|
||||
id: {
|
||||
type: "Identifier"
|
||||
},
|
||||
signature: {
|
||||
type: "Signature"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleImport", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
module: {
|
||||
type: "string"
|
||||
},
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
descr: {
|
||||
type: "ImportDescr"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleExportDescr", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
exportType: {
|
||||
type: "ExportDescrType"
|
||||
},
|
||||
id: {
|
||||
type: "Index"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ModuleExport", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
name: {
|
||||
type: "string"
|
||||
},
|
||||
descr: {
|
||||
type: "ModuleExportDescr"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Limit", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
min: {
|
||||
type: "number"
|
||||
},
|
||||
max: {
|
||||
optional: true,
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Signature", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
params: {
|
||||
array: true,
|
||||
type: "FuncParam"
|
||||
},
|
||||
results: {
|
||||
array: true,
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Program", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
body: {
|
||||
array: true,
|
||||
type: "Node"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Identifier", {
|
||||
unionType: ["Node", "Expression"],
|
||||
fields: {
|
||||
value: {
|
||||
type: "string"
|
||||
},
|
||||
raw: {
|
||||
optional: true,
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("BlockInstruction", {
|
||||
unionType: ["Node", "Block", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "block"
|
||||
},
|
||||
label: {
|
||||
maybe: true,
|
||||
type: "Identifier"
|
||||
},
|
||||
instr: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
result: {
|
||||
maybe: true,
|
||||
type: "Valtype"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("CallInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "call"
|
||||
},
|
||||
index: {
|
||||
type: "Index"
|
||||
},
|
||||
instrArgs: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Expression"
|
||||
},
|
||||
numeric: {
|
||||
type: "Index",
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("CallIndirectInstruction", {
|
||||
unionType: ["Node", "Instruction"],
|
||||
fields: {
|
||||
id: {
|
||||
constant: true,
|
||||
type: "string",
|
||||
value: "call_indirect"
|
||||
},
|
||||
signature: {
|
||||
type: "SignatureOrTypeRef"
|
||||
},
|
||||
intrs: {
|
||||
array: true,
|
||||
optional: true,
|
||||
type: "Expression"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("ByteArray", {
|
||||
unionType: ["Node"],
|
||||
fields: {
|
||||
values: {
|
||||
array: true,
|
||||
type: "Byte"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("Func", {
|
||||
unionType: ["Node", "Block"],
|
||||
fields: {
|
||||
name: {
|
||||
maybe: true,
|
||||
type: "Index"
|
||||
},
|
||||
signature: {
|
||||
type: "SignatureOrTypeRef"
|
||||
},
|
||||
body: {
|
||||
array: true,
|
||||
type: "Instruction"
|
||||
},
|
||||
isExternal: {
|
||||
comment: "means that it has been imported from the outside js",
|
||||
optional: true,
|
||||
type: "boolean"
|
||||
},
|
||||
metadata: {
|
||||
optional: true,
|
||||
type: "FuncMetadata"
|
||||
}
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Intrinsics
|
||||
*/
|
||||
|
||||
defineType("InternalBrUnless", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("InternalGoto", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
});
|
||||
defineType("InternalCallExtern", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {
|
||||
target: {
|
||||
type: "number"
|
||||
}
|
||||
}
|
||||
}); // function bodies are terminated by an `end` instruction but are missing a
|
||||
// return instruction
|
||||
//
|
||||
// Since we can't inject a new instruction we are injecting a new instruction.
|
||||
|
||||
defineType("InternalEndAndReturn", {
|
||||
unionType: ["Node", "Intrinsic"],
|
||||
fields: {}
|
||||
});
|
||||
module.exports = definitions;
|
||||
118
node_modules/@webassemblyjs/ast/lib/index.js
generated
vendored
Normal file
118
node_modules/@webassemblyjs/ast/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
numberLiteralFromRaw: true,
|
||||
withLoc: true,
|
||||
withRaw: true,
|
||||
funcParam: true,
|
||||
indexLiteral: true,
|
||||
memIndexLiteral: true,
|
||||
instruction: true,
|
||||
objectInstruction: true,
|
||||
traverse: true,
|
||||
signatures: true,
|
||||
cloneNode: true
|
||||
};
|
||||
Object.defineProperty(exports, "numberLiteralFromRaw", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.numberLiteralFromRaw;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "withLoc", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.withLoc;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "withRaw", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.withRaw;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "funcParam", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.funcParam;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "indexLiteral", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.indexLiteral;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "memIndexLiteral", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.memIndexLiteral;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "instruction", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.instruction;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "objectInstruction", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodeHelpers.objectInstruction;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverse", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _traverse.traverse;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "signatures", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _signatures.signatures;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "cloneNode", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _clone.cloneNode;
|
||||
}
|
||||
});
|
||||
|
||||
var _nodes = require("./nodes");
|
||||
|
||||
Object.keys(_nodes).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _nodes[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _nodeHelpers = require("./node-helpers.js");
|
||||
|
||||
var _traverse = require("./traverse");
|
||||
|
||||
var _signatures = require("./signatures");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
Object.keys(_utils).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _utils[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var _clone = require("./clone");
|
||||
107
node_modules/@webassemblyjs/ast/lib/node-helpers.js
generated
vendored
Normal file
107
node_modules/@webassemblyjs/ast/lib/node-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.numberLiteralFromRaw = numberLiteralFromRaw;
|
||||
exports.instruction = instruction;
|
||||
exports.objectInstruction = objectInstruction;
|
||||
exports.withLoc = withLoc;
|
||||
exports.withRaw = withRaw;
|
||||
exports.funcParam = funcParam;
|
||||
exports.indexLiteral = indexLiteral;
|
||||
exports.memIndexLiteral = memIndexLiteral;
|
||||
|
||||
var _wastParser = require("@webassemblyjs/wast-parser");
|
||||
|
||||
var _nodes = require("./nodes");
|
||||
|
||||
function numberLiteralFromRaw(rawValue) {
|
||||
var instructionType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "i32";
|
||||
var original = rawValue; // Remove numeric separators _
|
||||
|
||||
if (typeof rawValue === "string") {
|
||||
rawValue = rawValue.replace(/_/g, "");
|
||||
}
|
||||
|
||||
if (typeof rawValue === "number") {
|
||||
return (0, _nodes.numberLiteral)(rawValue, String(original));
|
||||
} else {
|
||||
switch (instructionType) {
|
||||
case "i32":
|
||||
{
|
||||
return (0, _nodes.numberLiteral)((0, _wastParser.parse32I)(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "u32":
|
||||
{
|
||||
return (0, _nodes.numberLiteral)((0, _wastParser.parseU32)(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "i64":
|
||||
{
|
||||
return (0, _nodes.longNumberLiteral)((0, _wastParser.parse64I)(rawValue), String(original));
|
||||
}
|
||||
|
||||
case "f32":
|
||||
{
|
||||
return (0, _nodes.floatLiteral)((0, _wastParser.parse32F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
|
||||
}
|
||||
// f64
|
||||
|
||||
default:
|
||||
{
|
||||
return (0, _nodes.floatLiteral)((0, _wastParser.parse64F)(rawValue), (0, _wastParser.isNanLiteral)(rawValue), (0, _wastParser.isInfLiteral)(rawValue), String(original));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function instruction(id) {
|
||||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
||||
var namedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
return (0, _nodes.instr)(id, undefined, args, namedArgs);
|
||||
}
|
||||
|
||||
function objectInstruction(id, object) {
|
||||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
||||
var namedArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
return (0, _nodes.instr)(id, object, args, namedArgs);
|
||||
}
|
||||
/**
|
||||
* Decorators
|
||||
*/
|
||||
|
||||
|
||||
function withLoc(n, end, start) {
|
||||
var loc = {
|
||||
start: start,
|
||||
end: end
|
||||
};
|
||||
n.loc = loc;
|
||||
return n;
|
||||
}
|
||||
|
||||
function withRaw(n, raw) {
|
||||
n.raw = raw;
|
||||
return n;
|
||||
}
|
||||
|
||||
function funcParam(valtype, id) {
|
||||
return {
|
||||
id: id,
|
||||
valtype: valtype
|
||||
};
|
||||
}
|
||||
|
||||
function indexLiteral(value) {
|
||||
// $FlowIgnore
|
||||
var x = numberLiteralFromRaw(value, "u32");
|
||||
return x;
|
||||
}
|
||||
|
||||
function memIndexLiteral(value) {
|
||||
// $FlowIgnore
|
||||
var x = numberLiteralFromRaw(value, "u32");
|
||||
return x;
|
||||
}
|
||||
144
node_modules/@webassemblyjs/ast/lib/node-path.js
generated
vendored
Normal file
144
node_modules/@webassemblyjs/ast/lib/node-path.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createPath = createPath;
|
||||
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function findParent(_ref, cb) {
|
||||
var parentPath = _ref.parentPath;
|
||||
|
||||
if (parentPath == null) {
|
||||
throw new Error("node is root");
|
||||
}
|
||||
|
||||
var currentPath = parentPath;
|
||||
|
||||
while (cb(currentPath) !== false) {
|
||||
// Hit the root node, stop
|
||||
// $FlowIgnore
|
||||
if (currentPath.parentPath == null) {
|
||||
return null;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
currentPath = currentPath.parentPath;
|
||||
}
|
||||
|
||||
return currentPath.node;
|
||||
}
|
||||
|
||||
function insertBefore(context, newNode) {
|
||||
return insert(context, newNode);
|
||||
}
|
||||
|
||||
function insertAfter(context, newNode) {
|
||||
return insert(context, newNode, 1);
|
||||
}
|
||||
|
||||
function insert(_ref2, newNode) {
|
||||
var node = _ref2.node,
|
||||
inList = _ref2.inList,
|
||||
parentPath = _ref2.parentPath,
|
||||
parentKey = _ref2.parentKey;
|
||||
var indexOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (!inList) {
|
||||
throw new Error('inList' + " error: " + ("insert can only be used for nodes that are within lists" || "unknown"));
|
||||
}
|
||||
|
||||
if (!(parentPath != null)) {
|
||||
throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
var parentList = parentPath.node[parentKey];
|
||||
var indexInList = parentList.findIndex(function (n) {
|
||||
return n === node;
|
||||
});
|
||||
parentList.splice(indexInList + indexOffset, 0, newNode);
|
||||
}
|
||||
|
||||
function remove(_ref3) {
|
||||
var node = _ref3.node,
|
||||
parentKey = _ref3.parentKey,
|
||||
parentPath = _ref3.parentPath;
|
||||
|
||||
if (!(parentPath != null)) {
|
||||
throw new Error('parentPath != null' + " error: " + ("Can not remove root node" || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
var parentNode = parentPath.node; // $FlowIgnore
|
||||
|
||||
var parentProperty = parentNode[parentKey];
|
||||
|
||||
if (Array.isArray(parentProperty)) {
|
||||
// $FlowIgnore
|
||||
parentNode[parentKey] = parentProperty.filter(function (n) {
|
||||
return n !== node;
|
||||
});
|
||||
} else {
|
||||
// $FlowIgnore
|
||||
delete parentNode[parentKey];
|
||||
}
|
||||
|
||||
node._deleted = true;
|
||||
}
|
||||
|
||||
function stop(context) {
|
||||
context.shouldStop = true;
|
||||
}
|
||||
|
||||
function replaceWith(context, newNode) {
|
||||
// $FlowIgnore
|
||||
var parentNode = context.parentPath.node; // $FlowIgnore
|
||||
|
||||
var parentProperty = parentNode[context.parentKey];
|
||||
|
||||
if (Array.isArray(parentProperty)) {
|
||||
var indexInList = parentProperty.findIndex(function (n) {
|
||||
return n === context.node;
|
||||
});
|
||||
parentProperty.splice(indexInList, 1, newNode);
|
||||
} else {
|
||||
// $FlowIgnore
|
||||
parentNode[context.parentKey] = newNode;
|
||||
}
|
||||
|
||||
context.node._deleted = true;
|
||||
context.node = newNode;
|
||||
} // bind the context to the first argument of node operations
|
||||
|
||||
|
||||
function bindNodeOperations(operations, context) {
|
||||
var keys = Object.keys(operations);
|
||||
var boundOperations = {};
|
||||
keys.forEach(function (key) {
|
||||
boundOperations[key] = operations[key].bind(null, context);
|
||||
});
|
||||
return boundOperations;
|
||||
}
|
||||
|
||||
function createPathOperations(context) {
|
||||
// $FlowIgnore
|
||||
return bindNodeOperations({
|
||||
findParent: findParent,
|
||||
replaceWith: replaceWith,
|
||||
remove: remove,
|
||||
insertBefore: insertBefore,
|
||||
insertAfter: insertAfter,
|
||||
stop: stop
|
||||
}, context);
|
||||
}
|
||||
|
||||
function createPath(context) {
|
||||
var path = _extends({}, context); // $FlowIgnore
|
||||
|
||||
|
||||
Object.assign(path, createPathOperations(path)); // $FlowIgnore
|
||||
|
||||
return path;
|
||||
}
|
||||
1134
node_modules/@webassemblyjs/ast/lib/nodes.js
generated
vendored
Normal file
1134
node_modules/@webassemblyjs/ast/lib/nodes.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
207
node_modules/@webassemblyjs/ast/lib/signatures.js
generated
vendored
Normal file
207
node_modules/@webassemblyjs/ast/lib/signatures.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.signatures = void 0;
|
||||
|
||||
function sign(input, output) {
|
||||
return [input, output];
|
||||
}
|
||||
|
||||
var u32 = "u32";
|
||||
var i32 = "i32";
|
||||
var i64 = "i64";
|
||||
var f32 = "f32";
|
||||
var f64 = "f64";
|
||||
|
||||
var vector = function vector(t) {
|
||||
var vecType = [t]; // $FlowIgnore
|
||||
|
||||
vecType.vector = true;
|
||||
return vecType;
|
||||
};
|
||||
|
||||
var controlInstructions = {
|
||||
unreachable: sign([], []),
|
||||
nop: sign([], []),
|
||||
// block ?
|
||||
// loop ?
|
||||
// if ?
|
||||
// if else ?
|
||||
br: sign([u32], []),
|
||||
br_if: sign([u32], []),
|
||||
br_table: sign(vector(u32), []),
|
||||
return: sign([], []),
|
||||
call: sign([u32], []),
|
||||
call_indirect: sign([u32], [])
|
||||
};
|
||||
var parametricInstructions = {
|
||||
drop: sign([], []),
|
||||
select: sign([], [])
|
||||
};
|
||||
var variableInstructions = {
|
||||
get_local: sign([u32], []),
|
||||
set_local: sign([u32], []),
|
||||
tee_local: sign([u32], []),
|
||||
get_global: sign([u32], []),
|
||||
set_global: sign([u32], [])
|
||||
};
|
||||
var memoryInstructions = {
|
||||
"i32.load": sign([u32, u32], [i32]),
|
||||
"i64.load": sign([u32, u32], []),
|
||||
"f32.load": sign([u32, u32], []),
|
||||
"f64.load": sign([u32, u32], []),
|
||||
"i32.load8_s": sign([u32, u32], [i32]),
|
||||
"i32.load8_u": sign([u32, u32], [i32]),
|
||||
"i32.load16_s": sign([u32, u32], [i32]),
|
||||
"i32.load16_u": sign([u32, u32], [i32]),
|
||||
"i64.load8_s": sign([u32, u32], [i64]),
|
||||
"i64.load8_u": sign([u32, u32], [i64]),
|
||||
"i64.load16_s": sign([u32, u32], [i64]),
|
||||
"i64.load16_u": sign([u32, u32], [i64]),
|
||||
"i64.load32_s": sign([u32, u32], [i64]),
|
||||
"i64.load32_u": sign([u32, u32], [i64]),
|
||||
"i32.store": sign([u32, u32], []),
|
||||
"i64.store": sign([u32, u32], []),
|
||||
"f32.store": sign([u32, u32], []),
|
||||
"f64.store": sign([u32, u32], []),
|
||||
"i32.store8": sign([u32, u32], []),
|
||||
"i32.store16": sign([u32, u32], []),
|
||||
"i64.store8": sign([u32, u32], []),
|
||||
"i64.store16": sign([u32, u32], []),
|
||||
"i64.store32": sign([u32, u32], []),
|
||||
current_memory: sign([], []),
|
||||
grow_memory: sign([], [])
|
||||
};
|
||||
var numericInstructions = {
|
||||
"i32.const": sign([i32], [i32]),
|
||||
"i64.const": sign([i64], [i64]),
|
||||
"f32.const": sign([f32], [f32]),
|
||||
"f64.const": sign([f64], [f64]),
|
||||
"i32.eqz": sign([i32], [i32]),
|
||||
"i32.eq": sign([i32, i32], [i32]),
|
||||
"i32.ne": sign([i32, i32], [i32]),
|
||||
"i32.lt_s": sign([i32, i32], [i32]),
|
||||
"i32.lt_u": sign([i32, i32], [i32]),
|
||||
"i32.gt_s": sign([i32, i32], [i32]),
|
||||
"i32.gt_u": sign([i32, i32], [i32]),
|
||||
"i32.le_s": sign([i32, i32], [i32]),
|
||||
"i32.le_u": sign([i32, i32], [i32]),
|
||||
"i32.ge_s": sign([i32, i32], [i32]),
|
||||
"i32.ge_u": sign([i32, i32], [i32]),
|
||||
"i64.eqz": sign([i64], [i64]),
|
||||
"i64.eq": sign([i64, i64], [i32]),
|
||||
"i64.ne": sign([i64, i64], [i32]),
|
||||
"i64.lt_s": sign([i64, i64], [i32]),
|
||||
"i64.lt_u": sign([i64, i64], [i32]),
|
||||
"i64.gt_s": sign([i64, i64], [i32]),
|
||||
"i64.gt_u": sign([i64, i64], [i32]),
|
||||
"i64.le_s": sign([i64, i64], [i32]),
|
||||
"i64.le_u": sign([i64, i64], [i32]),
|
||||
"i64.ge_s": sign([i64, i64], [i32]),
|
||||
"i64.ge_u": sign([i64, i64], [i32]),
|
||||
"f32.eq": sign([f32, f32], [i32]),
|
||||
"f32.ne": sign([f32, f32], [i32]),
|
||||
"f32.lt": sign([f32, f32], [i32]),
|
||||
"f32.gt": sign([f32, f32], [i32]),
|
||||
"f32.le": sign([f32, f32], [i32]),
|
||||
"f32.ge": sign([f32, f32], [i32]),
|
||||
"f64.eq": sign([f64, f64], [i32]),
|
||||
"f64.ne": sign([f64, f64], [i32]),
|
||||
"f64.lt": sign([f64, f64], [i32]),
|
||||
"f64.gt": sign([f64, f64], [i32]),
|
||||
"f64.le": sign([f64, f64], [i32]),
|
||||
"f64.ge": sign([f64, f64], [i32]),
|
||||
"i32.clz": sign([i32], [i32]),
|
||||
"i32.ctz": sign([i32], [i32]),
|
||||
"i32.popcnt": sign([i32], [i32]),
|
||||
"i32.add": sign([i32, i32], [i32]),
|
||||
"i32.sub": sign([i32, i32], [i32]),
|
||||
"i32.mul": sign([i32, i32], [i32]),
|
||||
"i32.div_s": sign([i32, i32], [i32]),
|
||||
"i32.div_u": sign([i32, i32], [i32]),
|
||||
"i32.rem_s": sign([i32, i32], [i32]),
|
||||
"i32.rem_u": sign([i32, i32], [i32]),
|
||||
"i32.and": sign([i32, i32], [i32]),
|
||||
"i32.or": sign([i32, i32], [i32]),
|
||||
"i32.xor": sign([i32, i32], [i32]),
|
||||
"i32.shl": sign([i32, i32], [i32]),
|
||||
"i32.shr_s": sign([i32, i32], [i32]),
|
||||
"i32.shr_u": sign([i32, i32], [i32]),
|
||||
"i32.rotl": sign([i32, i32], [i32]),
|
||||
"i32.rotr": sign([i32, i32], [i32]),
|
||||
"i64.clz": sign([i64], [i64]),
|
||||
"i64.ctz": sign([i64], [i64]),
|
||||
"i64.popcnt": sign([i64], [i64]),
|
||||
"i64.add": sign([i64, i64], [i64]),
|
||||
"i64.sub": sign([i64, i64], [i64]),
|
||||
"i64.mul": sign([i64, i64], [i64]),
|
||||
"i64.div_s": sign([i64, i64], [i64]),
|
||||
"i64.div_u": sign([i64, i64], [i64]),
|
||||
"i64.rem_s": sign([i64, i64], [i64]),
|
||||
"i64.rem_u": sign([i64, i64], [i64]),
|
||||
"i64.and": sign([i64, i64], [i64]),
|
||||
"i64.or": sign([i64, i64], [i64]),
|
||||
"i64.xor": sign([i64, i64], [i64]),
|
||||
"i64.shl": sign([i64, i64], [i64]),
|
||||
"i64.shr_s": sign([i64, i64], [i64]),
|
||||
"i64.shr_u": sign([i64, i64], [i64]),
|
||||
"i64.rotl": sign([i64, i64], [i64]),
|
||||
"i64.rotr": sign([i64, i64], [i64]),
|
||||
"f32.abs": sign([f32], [f32]),
|
||||
"f32.neg": sign([f32], [f32]),
|
||||
"f32.ceil": sign([f32], [f32]),
|
||||
"f32.floor": sign([f32], [f32]),
|
||||
"f32.trunc": sign([f32], [f32]),
|
||||
"f32.nearest": sign([f32], [f32]),
|
||||
"f32.sqrt": sign([f32], [f32]),
|
||||
"f32.add": sign([f32, f32], [f32]),
|
||||
"f32.sub": sign([f32, f32], [f32]),
|
||||
"f32.mul": sign([f32, f32], [f32]),
|
||||
"f32.div": sign([f32, f32], [f32]),
|
||||
"f32.min": sign([f32, f32], [f32]),
|
||||
"f32.max": sign([f32, f32], [f32]),
|
||||
"f32.copysign": sign([f32, f32], [f32]),
|
||||
"f64.abs": sign([f64], [f64]),
|
||||
"f64.neg": sign([f64], [f64]),
|
||||
"f64.ceil": sign([f64], [f64]),
|
||||
"f64.floor": sign([f64], [f64]),
|
||||
"f64.trunc": sign([f64], [f64]),
|
||||
"f64.nearest": sign([f64], [f64]),
|
||||
"f64.sqrt": sign([f64], [f64]),
|
||||
"f64.add": sign([f64, f64], [f64]),
|
||||
"f64.sub": sign([f64, f64], [f64]),
|
||||
"f64.mul": sign([f64, f64], [f64]),
|
||||
"f64.div": sign([f64, f64], [f64]),
|
||||
"f64.min": sign([f64, f64], [f64]),
|
||||
"f64.max": sign([f64, f64], [f64]),
|
||||
"f64.copysign": sign([f64, f64], [f64]),
|
||||
"i32.wrap/i64": sign([i64], [i32]),
|
||||
"i32.trunc_s/f32": sign([f32], [i32]),
|
||||
"i32.trunc_u/f32": sign([f32], [i32]),
|
||||
"i32.trunc_s/f64": sign([f32], [i32]),
|
||||
"i32.trunc_u/f64": sign([f64], [i32]),
|
||||
"i64.extend_s/i32": sign([i32], [i64]),
|
||||
"i64.extend_u/i32": sign([i32], [i64]),
|
||||
"i64.trunc_s/f32": sign([f32], [i64]),
|
||||
"i64.trunc_u/f32": sign([f32], [i64]),
|
||||
"i64.trunc_s/f64": sign([f64], [i64]),
|
||||
"i64.trunc_u/f64": sign([f64], [i64]),
|
||||
"f32.convert_s/i32": sign([i32], [f32]),
|
||||
"f32.convert_u/i32": sign([i32], [f32]),
|
||||
"f32.convert_s/i64": sign([i64], [f32]),
|
||||
"f32.convert_u/i64": sign([i64], [f32]),
|
||||
"f32.demote/f64": sign([f64], [f32]),
|
||||
"f64.convert_s/i32": sign([i32], [f64]),
|
||||
"f64.convert_u/i32": sign([i32], [f64]),
|
||||
"f64.convert_s/i64": sign([i64], [f64]),
|
||||
"f64.convert_u/i64": sign([i64], [f64]),
|
||||
"f64.promote/f32": sign([f32], [f64]),
|
||||
"i32.reinterpret/f32": sign([f32], [i32]),
|
||||
"i64.reinterpret/f64": sign([f64], [i64]),
|
||||
"f32.reinterpret/i32": sign([i32], [f32]),
|
||||
"f64.reinterpret/i64": sign([i64], [f64])
|
||||
};
|
||||
var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions);
|
||||
exports.signatures = signatures;
|
||||
83
node_modules/@webassemblyjs/ast/lib/transform/denormalize-type-references/index.js
generated
vendored
Normal file
83
node_modules/@webassemblyjs/ast/lib/transform/denormalize-type-references/index.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transform = transform;
|
||||
|
||||
var t = require("../../index"); // func and call_indirect instructions can either define a signature inline, or
|
||||
// reference a signature, e.g.
|
||||
//
|
||||
// ;; inline signature
|
||||
// (func (result i64)
|
||||
// (i64.const 2)
|
||||
// )
|
||||
// ;; signature reference
|
||||
// (type (func (result i64)))
|
||||
// (func (type 0)
|
||||
// (i64.const 2))
|
||||
// )
|
||||
//
|
||||
// this AST transform denormalises the type references, making all signatures within the module
|
||||
// inline.
|
||||
|
||||
|
||||
function transform(ast) {
|
||||
var typeInstructions = [];
|
||||
t.traverse(ast, {
|
||||
TypeInstruction: function TypeInstruction(_ref) {
|
||||
var node = _ref.node;
|
||||
typeInstructions.push(node);
|
||||
}
|
||||
});
|
||||
|
||||
if (!typeInstructions.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
function denormalizeSignature(signature) {
|
||||
// signature referenced by identifier
|
||||
if (signature.type === "Identifier") {
|
||||
var identifier = signature;
|
||||
var typeInstruction = typeInstructions.find(function (t) {
|
||||
return t.id.type === identifier.type && t.id.value === identifier.value;
|
||||
});
|
||||
|
||||
if (!typeInstruction) {
|
||||
throw new Error("A type instruction reference was not found ".concat(JSON.stringify(signature)));
|
||||
}
|
||||
|
||||
return typeInstruction.functype;
|
||||
} // signature referenced by index
|
||||
|
||||
|
||||
if (signature.type === "NumberLiteral") {
|
||||
var signatureRef = signature;
|
||||
var _typeInstruction = typeInstructions[signatureRef.value];
|
||||
return _typeInstruction.functype;
|
||||
}
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
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;
|
||||
node.signature = denormalizeSignature(node.signature);
|
||||
}),
|
||||
CallIndirectInstruction: function CallIndirectInstruction(_ref3) {
|
||||
var node = _ref3.node;
|
||||
node.signature = denormalizeSignature(node.signature);
|
||||
}
|
||||
});
|
||||
}
|
||||
225
node_modules/@webassemblyjs/ast/lib/transform/wast-identifier-to-index/index.js
generated
vendored
Normal file
225
node_modules/@webassemblyjs/ast/lib/transform/wast-identifier-to-index/index.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transform = transform;
|
||||
|
||||
var _index = require("../../index");
|
||||
|
||||
var _helperModuleContext = require("@webassemblyjs/helper-module-context");
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
// FIXME(sven): do the same with all block instructions, must be more generic here
|
||||
function newUnexpectedFunction(i) {
|
||||
return new Error("unknown function at offset: " + i);
|
||||
}
|
||||
|
||||
function transform(ast) {
|
||||
var module;
|
||||
(0, _index.traverse)(ast, {
|
||||
Module: function (_Module) {
|
||||
function Module(_x) {
|
||||
return _Module.apply(this, arguments);
|
||||
}
|
||||
|
||||
Module.toString = function () {
|
||||
return _Module.toString();
|
||||
};
|
||||
|
||||
return Module;
|
||||
}(function (path) {
|
||||
module = path.node;
|
||||
})
|
||||
});
|
||||
var moduleContext = (0, _helperModuleContext.moduleContextFromModuleAST)(module); // Transform the actual instruction in function bodies
|
||||
|
||||
(0, _index.traverse)(ast, {
|
||||
Func: function (_Func) {
|
||||
function Func(_x2) {
|
||||
return _Func.apply(this, arguments);
|
||||
}
|
||||
|
||||
Func.toString = function () {
|
||||
return _Func.toString();
|
||||
};
|
||||
|
||||
return Func;
|
||||
}(function (path) {
|
||||
transformFuncPath(path, moduleContext);
|
||||
}),
|
||||
Start: function (_Start) {
|
||||
function Start(_x3) {
|
||||
return _Start.apply(this, arguments);
|
||||
}
|
||||
|
||||
Start.toString = function () {
|
||||
return _Start.toString();
|
||||
};
|
||||
|
||||
return Start;
|
||||
}(function (path) {
|
||||
var index = path.node.index;
|
||||
|
||||
if ((0, _index.isIdentifier)(index) === true) {
|
||||
var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value);
|
||||
|
||||
if (typeof offsetInModule === "undefined") {
|
||||
throw newUnexpectedFunction(index.value);
|
||||
} // Replace the index Identifier
|
||||
// $FlowIgnore: reference?
|
||||
|
||||
|
||||
path.node.index = (0, _index.numberLiteralFromRaw)(offsetInModule);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function transformFuncPath(funcPath, moduleContext) {
|
||||
var funcNode = funcPath.node;
|
||||
var signature = funcNode.signature;
|
||||
|
||||
if (signature.type !== "Signature") {
|
||||
throw new Error("Function signatures must be denormalised before execution");
|
||||
}
|
||||
|
||||
var params = signature.params; // Add func locals in the context
|
||||
|
||||
params.forEach(function (p) {
|
||||
return moduleContext.addLocal(p.valtype);
|
||||
});
|
||||
(0, _index.traverse)(funcNode, {
|
||||
Instr: function (_Instr) {
|
||||
function Instr(_x4) {
|
||||
return _Instr.apply(this, arguments);
|
||||
}
|
||||
|
||||
Instr.toString = function () {
|
||||
return _Instr.toString();
|
||||
};
|
||||
|
||||
return Instr;
|
||||
}(function (instrPath) {
|
||||
var instrNode = instrPath.node;
|
||||
/**
|
||||
* Local access
|
||||
*/
|
||||
|
||||
if (instrNode.id === "get_local" || instrNode.id === "set_local" || instrNode.id === "tee_local") {
|
||||
var _instrNode$args = _slicedToArray(instrNode.args, 1),
|
||||
firstArg = _instrNode$args[0];
|
||||
|
||||
if (firstArg.type === "Identifier") {
|
||||
var offsetInParams = params.findIndex(function (_ref) {
|
||||
var id = _ref.id;
|
||||
return id === firstArg.value;
|
||||
});
|
||||
|
||||
if (offsetInParams === -1) {
|
||||
throw new Error("".concat(firstArg.value, " not found in ").concat(instrNode.id, ": not declared in func params"));
|
||||
} // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
|
||||
instrNode.args[0] = (0, _index.numberLiteralFromRaw)(offsetInParams);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Global access
|
||||
*/
|
||||
|
||||
|
||||
if (instrNode.id === "get_global" || instrNode.id === "set_global") {
|
||||
var _instrNode$args2 = _slicedToArray(instrNode.args, 1),
|
||||
_firstArg = _instrNode$args2[0];
|
||||
|
||||
if ((0, _index.isIdentifier)(_firstArg) === true) {
|
||||
var globalOffset = moduleContext.getGlobalOffsetByIdentifier( // $FlowIgnore: reference?
|
||||
_firstArg.value);
|
||||
|
||||
if (typeof globalOffset === "undefined") {
|
||||
// $FlowIgnore: reference?
|
||||
throw new Error("global ".concat(_firstArg.value, " not found in module"));
|
||||
} // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
|
||||
instrNode.args[0] = (0, _index.numberLiteralFromRaw)(globalOffset);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Labels lookup
|
||||
*/
|
||||
|
||||
|
||||
if (instrNode.id === "br") {
|
||||
var _instrNode$args3 = _slicedToArray(instrNode.args, 1),
|
||||
_firstArg2 = _instrNode$args3[0];
|
||||
|
||||
if ((0, _index.isIdentifier)(_firstArg2) === true) {
|
||||
// if the labels is not found it is going to be replaced with -1
|
||||
// which is invalid.
|
||||
var relativeBlockCount = -1; // $FlowIgnore: reference?
|
||||
|
||||
instrPath.findParent(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
|
||||
if ((0, _index.isBlock)(node)) {
|
||||
relativeBlockCount++; // $FlowIgnore: reference?
|
||||
|
||||
var name = node.label || node.name;
|
||||
|
||||
if (_typeof(name) === "object") {
|
||||
// $FlowIgnore: isIdentifier ensures that
|
||||
if (name.value === _firstArg2.value) {
|
||||
// Found it
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((0, _index.isFunc)(node)) {
|
||||
return false;
|
||||
}
|
||||
}); // Replace the Identifer node by our new NumberLiteral node
|
||||
|
||||
instrNode.args[0] = (0, _index.numberLiteralFromRaw)(relativeBlockCount);
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Func lookup
|
||||
*/
|
||||
CallInstruction: function (_CallInstruction) {
|
||||
function CallInstruction(_x5) {
|
||||
return _CallInstruction.apply(this, arguments);
|
||||
}
|
||||
|
||||
CallInstruction.toString = function () {
|
||||
return _CallInstruction.toString();
|
||||
};
|
||||
|
||||
return CallInstruction;
|
||||
}(function (_ref3) {
|
||||
var node = _ref3.node;
|
||||
var index = node.index;
|
||||
|
||||
if ((0, _index.isIdentifier)(index) === true) {
|
||||
var offsetInModule = moduleContext.getFunctionOffsetByIdentifier(index.value);
|
||||
|
||||
if (typeof offsetInModule === "undefined") {
|
||||
throw newUnexpectedFunction(index.value);
|
||||
} // Replace the index Identifier
|
||||
// $FlowIgnore: reference?
|
||||
|
||||
|
||||
node.index = (0, _index.numberLiteralFromRaw)(offsetInModule);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
105
node_modules/@webassemblyjs/ast/lib/traverse.js
generated
vendored
Normal file
105
node_modules/@webassemblyjs/ast/lib/traverse.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.traverse = traverse;
|
||||
|
||||
var _nodePath = require("./node-path");
|
||||
|
||||
var _nodes = require("./nodes");
|
||||
|
||||
// recursively walks the AST starting at the given node. The callback is invoked for
|
||||
// and object that has a 'type' property.
|
||||
function walk(context, callback) {
|
||||
var stop = false;
|
||||
|
||||
function innerWalk(context, callback) {
|
||||
if (stop) {
|
||||
return;
|
||||
}
|
||||
|
||||
var node = context.node;
|
||||
|
||||
if (node === undefined) {
|
||||
console.warn("traversing with an empty context");
|
||||
return;
|
||||
}
|
||||
|
||||
if (node._deleted === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var path = (0, _nodePath.createPath)(context);
|
||||
callback(node.type, path);
|
||||
|
||||
if (path.shouldStop) {
|
||||
stop = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(node).forEach(function (prop) {
|
||||
var value = node[prop];
|
||||
|
||||
if (value === null || value === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var valueAsArray = Array.isArray(value) ? value : [value];
|
||||
valueAsArray.forEach(function (childNode) {
|
||||
if (typeof childNode.type === "string") {
|
||||
var childContext = {
|
||||
node: childNode,
|
||||
parentKey: prop,
|
||||
parentPath: path,
|
||||
shouldStop: false,
|
||||
inList: Array.isArray(value)
|
||||
};
|
||||
innerWalk(childContext, callback);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
innerWalk(context, callback);
|
||||
}
|
||||
|
||||
var noop = function noop() {};
|
||||
|
||||
function traverse(node, visitors) {
|
||||
var before = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
|
||||
var after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
|
||||
Object.keys(visitors).forEach(function (visitor) {
|
||||
if (!_nodes.nodeAndUnionTypes.includes(visitor)) {
|
||||
throw new Error("Unexpected visitor ".concat(visitor));
|
||||
}
|
||||
});
|
||||
var context = {
|
||||
node: node,
|
||||
inList: false,
|
||||
shouldStop: false,
|
||||
parentPath: null,
|
||||
parentKey: null
|
||||
};
|
||||
walk(context, function (type, path) {
|
||||
if (typeof visitors[type] === "function") {
|
||||
before(type, path);
|
||||
visitors[type](path);
|
||||
after(type, path);
|
||||
}
|
||||
|
||||
var unionTypes = _nodes.unionTypesMap[type];
|
||||
|
||||
if (!unionTypes) {
|
||||
throw new Error("Unexpected node type ".concat(type));
|
||||
}
|
||||
|
||||
unionTypes.forEach(function (unionType) {
|
||||
if (typeof visitors[unionType] === "function") {
|
||||
before(unionType, path);
|
||||
visitors[unionType](path);
|
||||
after(unionType, path);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
0
node_modules/@webassemblyjs/ast/lib/types/basic.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/lib/types/basic.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/lib/types/nodes.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/lib/types/nodes.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/lib/types/traverse.js
generated
vendored
Normal file
0
node_modules/@webassemblyjs/ast/lib/types/traverse.js
generated
vendored
Normal file
306
node_modules/@webassemblyjs/ast/lib/utils.js
generated
vendored
Normal file
306
node_modules/@webassemblyjs/ast/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isAnonymous = isAnonymous;
|
||||
exports.getSectionMetadata = getSectionMetadata;
|
||||
exports.getSectionMetadatas = getSectionMetadatas;
|
||||
exports.sortSectionMetadata = sortSectionMetadata;
|
||||
exports.orderedInsertNode = orderedInsertNode;
|
||||
exports.assertHasLoc = assertHasLoc;
|
||||
exports.getEndOfSection = getEndOfSection;
|
||||
exports.shiftLoc = shiftLoc;
|
||||
exports.shiftSection = shiftSection;
|
||||
exports.signatureForOpcode = signatureForOpcode;
|
||||
exports.getUniqueNameGenerator = getUniqueNameGenerator;
|
||||
exports.getStartByteOffset = getStartByteOffset;
|
||||
exports.getEndByteOffset = getEndByteOffset;
|
||||
exports.getFunctionBeginingByteOffset = getFunctionBeginingByteOffset;
|
||||
exports.getEndBlockByteOffset = getEndBlockByteOffset;
|
||||
exports.getStartBlockByteOffset = getStartBlockByteOffset;
|
||||
|
||||
var _signatures = require("./signatures");
|
||||
|
||||
var _traverse = require("./traverse");
|
||||
|
||||
var _helperWasmBytecode = _interopRequireWildcard(require("@webassemblyjs/helper-wasm-bytecode"));
|
||||
|
||||
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; } }
|
||||
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function isAnonymous(ident) {
|
||||
return ident.raw === "";
|
||||
}
|
||||
|
||||
function getSectionMetadata(ast, name) {
|
||||
var section;
|
||||
(0, _traverse.traverse)(ast, {
|
||||
SectionMetadata: function (_SectionMetadata) {
|
||||
function SectionMetadata(_x) {
|
||||
return _SectionMetadata.apply(this, arguments);
|
||||
}
|
||||
|
||||
SectionMetadata.toString = function () {
|
||||
return _SectionMetadata.toString();
|
||||
};
|
||||
|
||||
return SectionMetadata;
|
||||
}(function (_ref) {
|
||||
var node = _ref.node;
|
||||
|
||||
if (node.section === name) {
|
||||
section = node;
|
||||
}
|
||||
})
|
||||
});
|
||||
return section;
|
||||
}
|
||||
|
||||
function getSectionMetadatas(ast, name) {
|
||||
var sections = [];
|
||||
(0, _traverse.traverse)(ast, {
|
||||
SectionMetadata: function (_SectionMetadata2) {
|
||||
function SectionMetadata(_x2) {
|
||||
return _SectionMetadata2.apply(this, arguments);
|
||||
}
|
||||
|
||||
SectionMetadata.toString = function () {
|
||||
return _SectionMetadata2.toString();
|
||||
};
|
||||
|
||||
return SectionMetadata;
|
||||
}(function (_ref2) {
|
||||
var node = _ref2.node;
|
||||
|
||||
if (node.section === name) {
|
||||
sections.push(node);
|
||||
}
|
||||
})
|
||||
});
|
||||
return sections;
|
||||
}
|
||||
|
||||
function sortSectionMetadata(m) {
|
||||
if (m.metadata == null) {
|
||||
console.warn("sortSectionMetadata: no metadata to sort");
|
||||
return;
|
||||
} // $FlowIgnore
|
||||
|
||||
|
||||
m.metadata.sections.sort(function (a, b) {
|
||||
var aId = _helperWasmBytecode.default.sections[a.section];
|
||||
var bId = _helperWasmBytecode.default.sections[b.section];
|
||||
|
||||
if (typeof aId !== "number" || typeof bId !== "number") {
|
||||
throw new Error("Section id not found");
|
||||
}
|
||||
|
||||
return aId - bId;
|
||||
});
|
||||
}
|
||||
|
||||
function orderedInsertNode(m, n) {
|
||||
assertHasLoc(n);
|
||||
var didInsert = false;
|
||||
|
||||
if (n.type === "ModuleExport") {
|
||||
m.fields.push(n);
|
||||
return;
|
||||
}
|
||||
|
||||
m.fields = m.fields.reduce(function (acc, field) {
|
||||
var fieldEndCol = Infinity;
|
||||
|
||||
if (field.loc != null) {
|
||||
// $FlowIgnore
|
||||
fieldEndCol = field.loc.end.column;
|
||||
} // $FlowIgnore: assertHasLoc ensures that
|
||||
|
||||
|
||||
if (didInsert === false && n.loc.start.column < fieldEndCol) {
|
||||
didInsert = true;
|
||||
acc.push(n);
|
||||
}
|
||||
|
||||
acc.push(field);
|
||||
return acc;
|
||||
}, []); // Handles empty modules or n is the last element
|
||||
|
||||
if (didInsert === false) {
|
||||
m.fields.push(n);
|
||||
}
|
||||
}
|
||||
|
||||
function assertHasLoc(n) {
|
||||
if (n.loc == null || n.loc.start == null || n.loc.end == null) {
|
||||
throw new Error("Internal failure: node (".concat(JSON.stringify(n.type), ") has no location information"));
|
||||
}
|
||||
}
|
||||
|
||||
function getEndOfSection(s) {
|
||||
assertHasLoc(s.size);
|
||||
return s.startOffset + s.size.value + ( // $FlowIgnore
|
||||
s.size.loc.end.column - s.size.loc.start.column);
|
||||
}
|
||||
|
||||
function shiftLoc(node, delta) {
|
||||
// $FlowIgnore
|
||||
node.loc.start.column += delta; // $FlowIgnore
|
||||
|
||||
node.loc.end.column += delta;
|
||||
}
|
||||
|
||||
function shiftSection(ast, node, delta) {
|
||||
if (node.type !== "SectionMetadata") {
|
||||
throw new Error("Can not shift node " + JSON.stringify(node.type));
|
||||
}
|
||||
|
||||
node.startOffset += delta;
|
||||
|
||||
if (_typeof(node.size.loc) === "object") {
|
||||
shiftLoc(node.size, delta);
|
||||
} // Custom sections doesn't have vectorOfSize
|
||||
|
||||
|
||||
if (_typeof(node.vectorOfSize) === "object" && _typeof(node.vectorOfSize.loc) === "object") {
|
||||
shiftLoc(node.vectorOfSize, delta);
|
||||
}
|
||||
|
||||
var sectionName = node.section; // shift node locations within that section
|
||||
|
||||
(0, _traverse.traverse)(ast, {
|
||||
Node: function Node(_ref3) {
|
||||
var node = _ref3.node;
|
||||
var section = (0, _helperWasmBytecode.getSectionForNode)(node);
|
||||
|
||||
if (section === sectionName && _typeof(node.loc) === "object") {
|
||||
shiftLoc(node, delta);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function signatureForOpcode(object, name) {
|
||||
var opcodeName = name;
|
||||
|
||||
if (object !== undefined && object !== "") {
|
||||
opcodeName = object + "." + name;
|
||||
}
|
||||
|
||||
var sign = _signatures.signatures[opcodeName];
|
||||
|
||||
if (sign == undefined) {
|
||||
// TODO: Uncomment this when br_table and others has been done
|
||||
//throw new Error("Invalid opcode: "+opcodeName);
|
||||
return [object, object];
|
||||
}
|
||||
|
||||
return sign[0];
|
||||
}
|
||||
|
||||
function getUniqueNameGenerator() {
|
||||
var inc = {};
|
||||
return function () {
|
||||
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
|
||||
|
||||
if (!(prefix in inc)) {
|
||||
inc[prefix] = 0;
|
||||
} else {
|
||||
inc[prefix] = inc[prefix] + 1;
|
||||
}
|
||||
|
||||
return prefix + "_" + inc[prefix];
|
||||
};
|
||||
}
|
||||
|
||||
function getStartByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (typeof n.loc === "undefined" || typeof n.loc.start === "undefined") {
|
||||
throw new Error( // $FlowIgnore
|
||||
"Can not get byte offset without loc informations, node: " + String(n.id));
|
||||
}
|
||||
|
||||
return n.loc.start.column;
|
||||
}
|
||||
|
||||
function getEndByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (typeof n.loc === "undefined" || typeof n.loc.end === "undefined") {
|
||||
throw new Error("Can not get byte offset without loc informations, node: " + n.type);
|
||||
}
|
||||
|
||||
return n.loc.end.column;
|
||||
}
|
||||
|
||||
function getFunctionBeginingByteOffset(n) {
|
||||
if (!(n.body.length > 0)) {
|
||||
throw new Error('n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var _n$body = _slicedToArray(n.body, 1),
|
||||
firstInstruction = _n$body[0];
|
||||
|
||||
return getStartByteOffset(firstInstruction);
|
||||
}
|
||||
|
||||
function getEndBlockByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (!(n.instr.length > 0 || n.body.length > 0)) {
|
||||
throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var lastInstruction;
|
||||
|
||||
if (n.instr) {
|
||||
// $FlowIgnore
|
||||
lastInstruction = n.instr[n.instr.length - 1];
|
||||
}
|
||||
|
||||
if (n.body) {
|
||||
// $FlowIgnore
|
||||
lastInstruction = n.body[n.body.length - 1];
|
||||
}
|
||||
|
||||
if (!(_typeof(lastInstruction) === "object")) {
|
||||
throw new Error('typeof lastInstruction === "object"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
return getStartByteOffset(lastInstruction);
|
||||
}
|
||||
|
||||
function getStartBlockByteOffset(n) {
|
||||
// $FlowIgnore
|
||||
if (!(n.instr.length > 0 || n.body.length > 0)) {
|
||||
throw new Error('n.instr.length > 0 || n.body.length > 0' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var fistInstruction;
|
||||
|
||||
if (n.instr) {
|
||||
// $FlowIgnore
|
||||
var _n$instr = _slicedToArray(n.instr, 1);
|
||||
|
||||
fistInstruction = _n$instr[0];
|
||||
}
|
||||
|
||||
if (n.body) {
|
||||
// $FlowIgnore
|
||||
var _n$body2 = _slicedToArray(n.body, 1);
|
||||
|
||||
fistInstruction = _n$body2[0];
|
||||
}
|
||||
|
||||
if (!(_typeof(fistInstruction) === "object")) {
|
||||
throw new Error('typeof fistInstruction === "object"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
// $FlowIgnore
|
||||
return getStartByteOffset(fistInstruction);
|
||||
}
|
||||
33
node_modules/@webassemblyjs/ast/package.json
generated
vendored
Normal file
33
node_modules/@webassemblyjs/ast/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@webassemblyjs/ast",
|
||||
"version": "1.9.0",
|
||||
"description": "AST utils for webassemblyjs",
|
||||
"keywords": [
|
||||
"webassembly",
|
||||
"javascript",
|
||||
"ast"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/helper-module-context": "1.9.0",
|
||||
"@webassemblyjs/helper-wasm-bytecode": "1.9.0",
|
||||
"@webassemblyjs/wast-parser": "1.9.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/helper-test-framework": "1.9.0",
|
||||
"array.prototype.flatmap": "^1.2.1",
|
||||
"dump-exports": "^0.1.0",
|
||||
"mamacro": "^0.0.7"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
219
node_modules/@webassemblyjs/ast/scripts/generateNodeUtils.js
generated
vendored
Normal file
219
node_modules/@webassemblyjs/ast/scripts/generateNodeUtils.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
const definitions = require("../src/definitions");
|
||||
const flatMap = require("array.prototype.flatmap");
|
||||
const {
|
||||
typeSignature,
|
||||
iterateProps,
|
||||
mapProps,
|
||||
filterProps,
|
||||
unique
|
||||
} = require("./util");
|
||||
|
||||
const stdout = process.stdout;
|
||||
|
||||
const jsTypes = ["string", "number", "boolean"];
|
||||
|
||||
const quote = value => `"${value}"`;
|
||||
|
||||
function params(fields) {
|
||||
const optionalDefault = field => (field.default ? ` = ${field.default}` : "");
|
||||
return mapProps(fields)
|
||||
.map(field => `${typeSignature(field)}${optionalDefault(field)}`)
|
||||
.join(",");
|
||||
}
|
||||
|
||||
function assertParamType({ assertNodeType, array, name, type }) {
|
||||
if (array) {
|
||||
// TODO - assert contents of array?
|
||||
return `assert(typeof ${name} === "object" && typeof ${name}.length !== "undefined")\n`;
|
||||
} else {
|
||||
if (jsTypes.includes(type)) {
|
||||
return `assert(
|
||||
typeof ${name} === "${type}",
|
||||
"Argument ${name} must be of type ${type}, given: " + typeof ${name}
|
||||
)`;
|
||||
}
|
||||
|
||||
if (assertNodeType === true) {
|
||||
return `assert(
|
||||
${name}.type === "${type}",
|
||||
"Argument ${name} must be of type ${type}, given: " + ${name}.type
|
||||
)`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function assertParam(meta) {
|
||||
const paramAssertion = assertParamType(meta);
|
||||
|
||||
if (paramAssertion === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (meta.maybe || meta.optional) {
|
||||
return `
|
||||
if (${meta.name} !== null && ${meta.name} !== undefined) {
|
||||
${paramAssertion};
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
return paramAssertion;
|
||||
}
|
||||
}
|
||||
|
||||
function assertParams(fields) {
|
||||
return mapProps(fields)
|
||||
.map(assertParam)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function buildObject(typeDef) {
|
||||
const optionalField = meta => {
|
||||
if (meta.array) {
|
||||
// omit optional array properties if the constructor function was supplied
|
||||
// with an empty array
|
||||
return `
|
||||
if (typeof ${meta.name} !== "undefined" && ${meta.name}.length > 0) {
|
||||
node.${meta.name} = ${meta.name};
|
||||
}
|
||||
`;
|
||||
} else if (meta.type === "Object") {
|
||||
// omit optional object properties if they have no keys
|
||||
return `
|
||||
if (typeof ${meta.name} !== "undefined" && Object.keys(${
|
||||
meta.name
|
||||
}).length !== 0) {
|
||||
node.${meta.name} = ${meta.name};
|
||||
}
|
||||
`;
|
||||
} else if (meta.type === "boolean") {
|
||||
// omit optional boolean properties if they are not true
|
||||
return `
|
||||
if (${meta.name} === true) {
|
||||
node.${meta.name} = true;
|
||||
}
|
||||
`;
|
||||
} else {
|
||||
return `
|
||||
if (typeof ${meta.name} !== "undefined") {
|
||||
node.${meta.name} = ${meta.name};
|
||||
}
|
||||
`;
|
||||
}
|
||||
};
|
||||
|
||||
const fields = mapProps(typeDef.fields)
|
||||
.filter(f => !f.optional && !f.constant)
|
||||
.map(f => f.name);
|
||||
|
||||
const constants = mapProps(typeDef.fields)
|
||||
.filter(f => f.constant)
|
||||
.map(f => `${f.name}: "${f.value}"`);
|
||||
|
||||
return `
|
||||
const node: ${typeDef.flowTypeName || typeDef.name} = {
|
||||
type: "${typeDef.name}",
|
||||
${constants.concat(fields).join(",")}
|
||||
}
|
||||
|
||||
${mapProps(typeDef.fields)
|
||||
.filter(f => f.optional)
|
||||
.map(optionalField)
|
||||
.join("")}
|
||||
`;
|
||||
}
|
||||
|
||||
function lowerCamelCase(name) {
|
||||
return name.substring(0, 1).toLowerCase() + name.substring(1);
|
||||
}
|
||||
|
||||
function generate() {
|
||||
stdout.write(`
|
||||
// @flow
|
||||
|
||||
// THIS FILE IS AUTOGENERATED
|
||||
// see scripts/generateNodeUtils.js
|
||||
|
||||
import { assert } from "mamacro";
|
||||
|
||||
function isTypeOf(t: string) {
|
||||
return (n: Node) => n.type === t;
|
||||
}
|
||||
|
||||
function assertTypeOf(t: string) {
|
||||
return (n: Node) => assert(n.type === t);
|
||||
}
|
||||
`);
|
||||
|
||||
// Node builders
|
||||
iterateProps(definitions, typeDefinition => {
|
||||
stdout.write(`
|
||||
export function ${lowerCamelCase(typeDefinition.name)} (
|
||||
${params(filterProps(typeDefinition.fields, f => !f.constant))}
|
||||
): ${typeDefinition.name} {
|
||||
|
||||
${assertParams(filterProps(typeDefinition.fields, f => !f.constant))}
|
||||
${buildObject(typeDefinition)}
|
||||
|
||||
return node;
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
// Node testers
|
||||
iterateProps(definitions, typeDefinition => {
|
||||
stdout.write(`
|
||||
export const is${typeDefinition.name} =
|
||||
isTypeOf("${typeDefinition.name}");
|
||||
`);
|
||||
});
|
||||
|
||||
// Node union type testers
|
||||
const unionTypes = unique(
|
||||
flatMap(mapProps(definitions).filter(d => d.unionType), d => d.unionType)
|
||||
);
|
||||
unionTypes.forEach(unionType => {
|
||||
stdout.write(
|
||||
`
|
||||
export const is${unionType} = (node: Node) => ` +
|
||||
mapProps(definitions)
|
||||
.filter(d => d.unionType && d.unionType.includes(unionType))
|
||||
.map(d => `is${d.name}(node) `)
|
||||
.join("||") +
|
||||
";\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
// Node assertion
|
||||
iterateProps(definitions, typeDefinition => {
|
||||
stdout.write(`
|
||||
export const assert${typeDefinition.name} =
|
||||
assertTypeOf("${typeDefinition.name}");
|
||||
`);
|
||||
});
|
||||
|
||||
// a map from node type to its set of union types
|
||||
stdout.write(
|
||||
`
|
||||
export const unionTypesMap = {` +
|
||||
mapProps(definitions)
|
||||
.filter(d => d.unionType)
|
||||
.map(t => `"${t.name}": [${t.unionType.map(quote).join(",")}]\n`) +
|
||||
`};
|
||||
`
|
||||
);
|
||||
|
||||
// an array of all node and union types
|
||||
stdout.write(
|
||||
`
|
||||
export const nodeAndUnionTypes = [` +
|
||||
mapProps(definitions)
|
||||
.map(t => `"${t.name}"`)
|
||||
.concat(unionTypes.map(quote))
|
||||
.join(",") +
|
||||
`];`
|
||||
);
|
||||
}
|
||||
|
||||
generate();
|
||||
47
node_modules/@webassemblyjs/ast/scripts/generateTypeDefinitions.js
generated
vendored
Normal file
47
node_modules/@webassemblyjs/ast/scripts/generateTypeDefinitions.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
const definitions = require("../src/definitions");
|
||||
const flatMap = require("array.prototype.flatmap");
|
||||
const { typeSignature, mapProps, iterateProps, unique } = require("./util");
|
||||
|
||||
const stdout = process.stdout;
|
||||
|
||||
function params(fields) {
|
||||
return mapProps(fields)
|
||||
.map(typeSignature)
|
||||
.join(",");
|
||||
}
|
||||
|
||||
function generate() {
|
||||
stdout.write(`
|
||||
// @flow
|
||||
/* eslint no-unused-vars: off */
|
||||
|
||||
// THIS FILE IS AUTOGENERATED
|
||||
// see scripts/generateTypeDefinitions.js
|
||||
`);
|
||||
|
||||
// generate union types
|
||||
const unionTypes = unique(
|
||||
flatMap(mapProps(definitions).filter(d => d.unionType), d => d.unionType)
|
||||
);
|
||||
unionTypes.forEach(unionType => {
|
||||
stdout.write(
|
||||
`type ${unionType} = ` +
|
||||
mapProps(definitions)
|
||||
.filter(d => d.unionType && d.unionType.includes(unionType))
|
||||
.map(d => d.name)
|
||||
.join("|") +
|
||||
";\n\n"
|
||||
);
|
||||
});
|
||||
|
||||
// generate the type definitions
|
||||
iterateProps(definitions, typeDef => {
|
||||
stdout.write(`type ${typeDef.name} = {
|
||||
...BaseNode,
|
||||
type: "${typeDef.name}",
|
||||
${params(typeDef.fields)}
|
||||
};\n\n`);
|
||||
});
|
||||
}
|
||||
|
||||
generate();
|
||||
38
node_modules/@webassemblyjs/ast/scripts/util.js
generated
vendored
Normal file
38
node_modules/@webassemblyjs/ast/scripts/util.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
function iterateProps(obj, iterator) {
|
||||
Object.keys(obj).forEach(key => iterator({ ...obj[key], name: key }));
|
||||
}
|
||||
|
||||
function mapProps(obj) {
|
||||
return Object.keys(obj).map(key => ({ ...obj[key], name: key }));
|
||||
}
|
||||
|
||||
function filterProps(obj, filter) {
|
||||
const ret = {};
|
||||
Object.keys(obj).forEach(key => {
|
||||
if (filter(obj[key])) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
function typeSignature(meta) {
|
||||
const type = meta.array ? `Array<${meta.type}>` : meta.type;
|
||||
if (meta.optional) {
|
||||
return `${meta.name}?: ${type}`;
|
||||
} else if (meta.maybe) {
|
||||
return `${meta.name}: ?${type}`;
|
||||
} else {
|
||||
return `${meta.name}: ${type}`;
|
||||
}
|
||||
}
|
||||
|
||||
const unique = items => Array.from(new Set(items));
|
||||
|
||||
module.exports = {
|
||||
iterateProps,
|
||||
mapProps,
|
||||
filterProps,
|
||||
typeSignature,
|
||||
unique
|
||||
};
|
||||
21
node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Mauro Bringolf
|
||||
|
||||
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.
|
||||
34
node_modules/@webassemblyjs/floating-point-hex-parser/README.md
generated
vendored
Normal file
34
node_modules/@webassemblyjs/floating-point-hex-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# Parser function for floating point hexadecimals
|
||||
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
|
||||
> A JavaScript function to parse floating point hexadecimals as defined by the [WebAssembly specification](https://webassembly.github.io/spec/core/text/values.html#text-hexfloat).
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import parseHexFloat from '@webassemblyjs/floating-point-hex-parser'
|
||||
|
||||
parseHexFloat('0x1p-1') // 0.5
|
||||
parseHexFloat('0x1.921fb54442d18p+2') // 6.283185307179586
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
This module is tested in two ways. The first one is through a small set of test cases that can be found in [test/regular.test.js](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/blob/master/test/regular.test.js). The second one is non-deterministic (sometimes called *fuzzing*):
|
||||
|
||||
1. Generate a random IEEE754 double precision value `x`.
|
||||
1. Compute its representation `y` in floating point hexadecimal format using the C standard library function `printf` since C supports this format.
|
||||
1. Give both values to JS testcase and see if `parseHexFloat(y) === x`.
|
||||
|
||||
By default one `npm test` run tests 100 random samples. If you want to do more, you can set the environment variable `FUZZ_AMOUNT` to whatever number of runs you'd like. Because it uses one child process for each sample, it is really slow though. For more details about the randomized tests see [the source](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/tree/master/test/fuzzing).
|
||||
|
||||
## Links
|
||||
|
||||
* [maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/](https://maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/)
|
||||
|
||||
* [github.com/xtuc/js-webassembly-interpreter/issues/32](https://github.com/xtuc/js-webassembly-interpreter/issues/32)
|
||||
|
||||
* [github.com/WebAssembly/design/issues/292](https://github.com/WebAssembly/design/issues/292)
|
||||
42
node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js
generated
vendored
Normal file
42
node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
export default function parse(input) {
|
||||
input = input.toUpperCase();
|
||||
var splitIndex = input.indexOf("P");
|
||||
var mantissa, exponent;
|
||||
|
||||
if (splitIndex !== -1) {
|
||||
mantissa = input.substring(0, splitIndex);
|
||||
exponent = parseInt(input.substring(splitIndex + 1));
|
||||
} else {
|
||||
mantissa = input;
|
||||
exponent = 0;
|
||||
}
|
||||
|
||||
var dotIndex = mantissa.indexOf(".");
|
||||
|
||||
if (dotIndex !== -1) {
|
||||
var integerPart = parseInt(mantissa.substring(0, dotIndex), 16);
|
||||
var sign = Math.sign(integerPart);
|
||||
integerPart = sign * integerPart;
|
||||
var fractionLength = mantissa.length - dotIndex - 1;
|
||||
var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16);
|
||||
var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0;
|
||||
|
||||
if (sign === 0) {
|
||||
if (fraction === 0) {
|
||||
mantissa = sign;
|
||||
} else {
|
||||
if (Object.is(sign, -0)) {
|
||||
mantissa = -fraction;
|
||||
} else {
|
||||
mantissa = fraction;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mantissa = sign * (integerPart + fraction);
|
||||
}
|
||||
} else {
|
||||
mantissa = parseInt(mantissa, 16);
|
||||
}
|
||||
|
||||
return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1);
|
||||
}
|
||||
49
node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js
generated
vendored
Normal file
49
node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parse;
|
||||
|
||||
function parse(input) {
|
||||
input = input.toUpperCase();
|
||||
var splitIndex = input.indexOf("P");
|
||||
var mantissa, exponent;
|
||||
|
||||
if (splitIndex !== -1) {
|
||||
mantissa = input.substring(0, splitIndex);
|
||||
exponent = parseInt(input.substring(splitIndex + 1));
|
||||
} else {
|
||||
mantissa = input;
|
||||
exponent = 0;
|
||||
}
|
||||
|
||||
var dotIndex = mantissa.indexOf(".");
|
||||
|
||||
if (dotIndex !== -1) {
|
||||
var integerPart = parseInt(mantissa.substring(0, dotIndex), 16);
|
||||
var sign = Math.sign(integerPart);
|
||||
integerPart = sign * integerPart;
|
||||
var fractionLength = mantissa.length - dotIndex - 1;
|
||||
var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16);
|
||||
var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0;
|
||||
|
||||
if (sign === 0) {
|
||||
if (fraction === 0) {
|
||||
mantissa = sign;
|
||||
} else {
|
||||
if (Object.is(sign, -0)) {
|
||||
mantissa = -fraction;
|
||||
} else {
|
||||
mantissa = fraction;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mantissa = sign * (integerPart + fraction);
|
||||
}
|
||||
} else {
|
||||
mantissa = parseInt(mantissa, 16);
|
||||
}
|
||||
|
||||
return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1);
|
||||
}
|
||||
24
node_modules/@webassemblyjs/floating-point-hex-parser/package.json
generated
vendored
Normal file
24
node_modules/@webassemblyjs/floating-point-hex-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@webassemblyjs/floating-point-hex-parser",
|
||||
"scripts": {
|
||||
"build-fuzzer": "[ -f ./test/fuzzing/parse.out ] || gcc ./test/fuzzing/parse.c -o ./test/fuzzing/parse.out -lm -Wall"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"version": "1.9.0",
|
||||
"description": "A function to parse floating point hexadecimal strings as defined by the WebAssembly specification",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"keywords": [
|
||||
"webassembly",
|
||||
"floating-point"
|
||||
],
|
||||
"author": "Mauro Bringolf",
|
||||
"license": "MIT",
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
21
node_modules/@webassemblyjs/helper-api-error/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-api-error/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.
|
||||
47
node_modules/@webassemblyjs/helper-api-error/esm/index.js
generated
vendored
Normal file
47
node_modules/@webassemblyjs/helper-api-error/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
export var RuntimeError =
|
||||
/*#__PURE__*/
|
||||
function (_Error) {
|
||||
_inherits(RuntimeError, _Error);
|
||||
|
||||
function RuntimeError() {
|
||||
_classCallCheck(this, RuntimeError);
|
||||
|
||||
return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return RuntimeError;
|
||||
}(Error);
|
||||
export var CompileError =
|
||||
/*#__PURE__*/
|
||||
function (_Error2) {
|
||||
_inherits(CompileError, _Error2);
|
||||
|
||||
function CompileError() {
|
||||
_classCallCheck(this, CompileError);
|
||||
|
||||
return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return CompileError;
|
||||
}(Error);
|
||||
export var LinkError =
|
||||
/*#__PURE__*/
|
||||
function (_Error3) {
|
||||
_inherits(LinkError, _Error3);
|
||||
|
||||
function LinkError() {
|
||||
_classCallCheck(this, LinkError);
|
||||
|
||||
return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return LinkError;
|
||||
}(Error);
|
||||
62
node_modules/@webassemblyjs/helper-api-error/lib/index.js
generated
vendored
Normal file
62
node_modules/@webassemblyjs/helper-api-error/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.LinkError = exports.CompileError = exports.RuntimeError = void 0;
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var RuntimeError =
|
||||
/*#__PURE__*/
|
||||
function (_Error) {
|
||||
_inherits(RuntimeError, _Error);
|
||||
|
||||
function RuntimeError() {
|
||||
_classCallCheck(this, RuntimeError);
|
||||
|
||||
return _possibleConstructorReturn(this, (RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return RuntimeError;
|
||||
}(Error);
|
||||
|
||||
exports.RuntimeError = RuntimeError;
|
||||
|
||||
var CompileError =
|
||||
/*#__PURE__*/
|
||||
function (_Error2) {
|
||||
_inherits(CompileError, _Error2);
|
||||
|
||||
function CompileError() {
|
||||
_classCallCheck(this, CompileError);
|
||||
|
||||
return _possibleConstructorReturn(this, (CompileError.__proto__ || Object.getPrototypeOf(CompileError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return CompileError;
|
||||
}(Error);
|
||||
|
||||
exports.CompileError = CompileError;
|
||||
|
||||
var LinkError =
|
||||
/*#__PURE__*/
|
||||
function (_Error3) {
|
||||
_inherits(LinkError, _Error3);
|
||||
|
||||
function LinkError() {
|
||||
_classCallCheck(this, LinkError);
|
||||
|
||||
return _possibleConstructorReturn(this, (LinkError.__proto__ || Object.getPrototypeOf(LinkError)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return LinkError;
|
||||
}(Error);
|
||||
|
||||
exports.LinkError = LinkError;
|
||||
13
node_modules/@webassemblyjs/helper-api-error/package.json
generated
vendored
Normal file
13
node_modules/@webassemblyjs/helper-api-error/package.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-api-error",
|
||||
"version": "1.9.0",
|
||||
"description": "Common API errors",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
21
node_modules/@webassemblyjs/helper-buffer/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-buffer/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.
|
||||
65
node_modules/@webassemblyjs/helper-buffer/esm/compare.js
generated
vendored
Normal file
65
node_modules/@webassemblyjs/helper-buffer/esm/compare.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// this are dev dependencies
|
||||
var diff = require("jest-diff");
|
||||
|
||||
var _require = require("jest-diff/build/constants"),
|
||||
NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE;
|
||||
|
||||
var _require2 = require("@webassemblyjs/wasm-parser"),
|
||||
decode = _require2.decode;
|
||||
|
||||
var oldConsoleLog = console.log;
|
||||
export function compareArrayBuffers(l, r) {
|
||||
/**
|
||||
* Decode left
|
||||
*/
|
||||
var bufferL = "";
|
||||
|
||||
console.log = function () {
|
||||
for (var _len = arguments.length, texts = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
texts[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return bufferL += texts.join("") + "\n";
|
||||
};
|
||||
|
||||
try {
|
||||
decode(l, {
|
||||
dump: true
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(bufferL);
|
||||
console.error(e);
|
||||
throw e;
|
||||
}
|
||||
/**
|
||||
* Decode right
|
||||
*/
|
||||
|
||||
|
||||
var bufferR = "";
|
||||
|
||||
console.log = function () {
|
||||
for (var _len2 = arguments.length, texts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
texts[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return bufferR += texts.join("") + "\n";
|
||||
};
|
||||
|
||||
try {
|
||||
decode(r, {
|
||||
dump: true
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(bufferR);
|
||||
console.error(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
console.log = oldConsoleLog;
|
||||
var out = diff(bufferL, bufferR);
|
||||
|
||||
if (out !== null && out !== NO_DIFF_MESSAGE) {
|
||||
throw new Error("\n" + out);
|
||||
}
|
||||
}
|
||||
67
node_modules/@webassemblyjs/helper-buffer/esm/index.js
generated
vendored
Normal file
67
node_modules/@webassemblyjs/helper-buffer/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||||
|
||||
function concatUint8Arrays() {
|
||||
for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
arrays[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var totalLength = arrays.reduce(function (a, b) {
|
||||
return a + b.length;
|
||||
}, 0);
|
||||
var result = new Uint8Array(totalLength);
|
||||
var offset = 0;
|
||||
|
||||
for (var _i = 0; _i < arrays.length; _i++) {
|
||||
var arr = arrays[_i];
|
||||
|
||||
if (arr instanceof Uint8Array === false) {
|
||||
throw new Error("arr must be of type Uint8Array");
|
||||
}
|
||||
|
||||
result.set(arr, offset);
|
||||
offset += arr.length;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) {
|
||||
var beforeBytes = buffer.slice(0, startLoc);
|
||||
var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it
|
||||
|
||||
if (newBytes.length === 0) {
|
||||
return concatUint8Arrays(beforeBytes, afterBytes);
|
||||
}
|
||||
|
||||
var replacement = Uint8Array.from(newBytes);
|
||||
return concatUint8Arrays(beforeBytes, replacement, afterBytes);
|
||||
}
|
||||
export function makeBuffer() {
|
||||
for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
splitedBytes[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
var bytes = [].concat.apply([], splitedBytes);
|
||||
return new Uint8Array(bytes).buffer;
|
||||
}
|
||||
export function fromHexdump(str) {
|
||||
var lines = str.split("\n"); // remove any leading left whitespace
|
||||
|
||||
lines = lines.map(function (line) {
|
||||
return line.trim();
|
||||
});
|
||||
var bytes = lines.reduce(function (acc, line) {
|
||||
var cols = line.split(" "); // remove the offset, left column
|
||||
|
||||
cols.shift();
|
||||
cols = cols.filter(function (x) {
|
||||
return x !== "";
|
||||
});
|
||||
var bytes = cols.map(function (x) {
|
||||
return parseInt(x, 16);
|
||||
});
|
||||
acc.push.apply(acc, _toConsumableArray(bytes));
|
||||
return acc;
|
||||
}, []);
|
||||
return Buffer.from(bytes);
|
||||
}
|
||||
73
node_modules/@webassemblyjs/helper-buffer/lib/compare.js
generated
vendored
Normal file
73
node_modules/@webassemblyjs/helper-buffer/lib/compare.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.compareArrayBuffers = compareArrayBuffers;
|
||||
|
||||
// this are dev dependencies
|
||||
var diff = require("jest-diff");
|
||||
|
||||
var _require = require("jest-diff/build/constants"),
|
||||
NO_DIFF_MESSAGE = _require.NO_DIFF_MESSAGE;
|
||||
|
||||
var _require2 = require("@webassemblyjs/wasm-parser"),
|
||||
decode = _require2.decode;
|
||||
|
||||
var oldConsoleLog = console.log;
|
||||
|
||||
function compareArrayBuffers(l, r) {
|
||||
/**
|
||||
* Decode left
|
||||
*/
|
||||
var bufferL = "";
|
||||
|
||||
console.log = function () {
|
||||
for (var _len = arguments.length, texts = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
texts[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return bufferL += texts.join("") + "\n";
|
||||
};
|
||||
|
||||
try {
|
||||
decode(l, {
|
||||
dump: true
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(bufferL);
|
||||
console.error(e);
|
||||
throw e;
|
||||
}
|
||||
/**
|
||||
* Decode right
|
||||
*/
|
||||
|
||||
|
||||
var bufferR = "";
|
||||
|
||||
console.log = function () {
|
||||
for (var _len2 = arguments.length, texts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
texts[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
return bufferR += texts.join("") + "\n";
|
||||
};
|
||||
|
||||
try {
|
||||
decode(r, {
|
||||
dump: true
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(bufferR);
|
||||
console.error(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
console.log = oldConsoleLog;
|
||||
var out = diff(bufferL, bufferR);
|
||||
|
||||
if (out !== null && out !== NO_DIFF_MESSAGE) {
|
||||
throw new Error("\n" + out);
|
||||
}
|
||||
}
|
||||
78
node_modules/@webassemblyjs/helper-buffer/lib/index.js
generated
vendored
Normal file
78
node_modules/@webassemblyjs/helper-buffer/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.overrideBytesInBuffer = overrideBytesInBuffer;
|
||||
exports.makeBuffer = makeBuffer;
|
||||
exports.fromHexdump = fromHexdump;
|
||||
|
||||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||||
|
||||
function concatUint8Arrays() {
|
||||
for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
arrays[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var totalLength = arrays.reduce(function (a, b) {
|
||||
return a + b.length;
|
||||
}, 0);
|
||||
var result = new Uint8Array(totalLength);
|
||||
var offset = 0;
|
||||
|
||||
for (var _i = 0; _i < arrays.length; _i++) {
|
||||
var arr = arrays[_i];
|
||||
|
||||
if (arr instanceof Uint8Array === false) {
|
||||
throw new Error("arr must be of type Uint8Array");
|
||||
}
|
||||
|
||||
result.set(arr, offset);
|
||||
offset += arr.length;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function overrideBytesInBuffer(buffer, startLoc, endLoc, newBytes) {
|
||||
var beforeBytes = buffer.slice(0, startLoc);
|
||||
var afterBytes = buffer.slice(endLoc, buffer.length); // replacement is empty, we can omit it
|
||||
|
||||
if (newBytes.length === 0) {
|
||||
return concatUint8Arrays(beforeBytes, afterBytes);
|
||||
}
|
||||
|
||||
var replacement = Uint8Array.from(newBytes);
|
||||
return concatUint8Arrays(beforeBytes, replacement, afterBytes);
|
||||
}
|
||||
|
||||
function makeBuffer() {
|
||||
for (var _len2 = arguments.length, splitedBytes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
splitedBytes[_key2] = arguments[_key2];
|
||||
}
|
||||
|
||||
var bytes = [].concat.apply([], splitedBytes);
|
||||
return new Uint8Array(bytes).buffer;
|
||||
}
|
||||
|
||||
function fromHexdump(str) {
|
||||
var lines = str.split("\n"); // remove any leading left whitespace
|
||||
|
||||
lines = lines.map(function (line) {
|
||||
return line.trim();
|
||||
});
|
||||
var bytes = lines.reduce(function (acc, line) {
|
||||
var cols = line.split(" "); // remove the offset, left column
|
||||
|
||||
cols.shift();
|
||||
cols = cols.filter(function (x) {
|
||||
return x !== "";
|
||||
});
|
||||
var bytes = cols.map(function (x) {
|
||||
return parseInt(x, 16);
|
||||
});
|
||||
acc.push.apply(acc, _toConsumableArray(bytes));
|
||||
return acc;
|
||||
}, []);
|
||||
return Buffer.from(bytes);
|
||||
}
|
||||
24
node_modules/@webassemblyjs/helper-buffer/package.json
generated
vendored
Normal file
24
node_modules/@webassemblyjs/helper-buffer/package.json
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-buffer",
|
||||
"version": "1.9.0",
|
||||
"description": "Buffer manipulation utility",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/wasm-parser": "1.9.0",
|
||||
"jest-diff": "^24.0.0"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
21
node_modules/@webassemblyjs/helper-code-frame/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-code-frame/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.
|
||||
37
node_modules/@webassemblyjs/helper-code-frame/esm/index.js
generated
vendored
Normal file
37
node_modules/@webassemblyjs/helper-code-frame/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
import { print } from "@webassemblyjs/wast-printer";
|
||||
var SHOW_LINES_AROUND_POINTER = 5;
|
||||
|
||||
function repeat(char, nb) {
|
||||
return Array(nb).fill(char).join("");
|
||||
} // TODO(sven): allow arbitrary ast nodes
|
||||
|
||||
|
||||
export function codeFrameFromAst(ast, loc) {
|
||||
return codeFrameFromSource(print(ast), loc);
|
||||
}
|
||||
export function codeFrameFromSource(source, loc) {
|
||||
var start = loc.start,
|
||||
end = loc.end;
|
||||
var length = 1;
|
||||
|
||||
if (_typeof(end) === "object") {
|
||||
length = end.column - start.column + 1;
|
||||
}
|
||||
|
||||
return source.split("\n").reduce(function (acc, line, lineNbr) {
|
||||
if (Math.abs(start.line - lineNbr) < SHOW_LINES_AROUND_POINTER) {
|
||||
acc += line + "\n";
|
||||
} // Add a new line with the pointer padded left
|
||||
|
||||
|
||||
if (lineNbr === start.line - 1) {
|
||||
acc += repeat(" ", start.column - 1);
|
||||
acc += repeat("^", length);
|
||||
acc += "\n";
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, "");
|
||||
}
|
||||
47
node_modules/@webassemblyjs/helper-code-frame/lib/index.js
generated
vendored
Normal file
47
node_modules/@webassemblyjs/helper-code-frame/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameFromAst = codeFrameFromAst;
|
||||
exports.codeFrameFromSource = codeFrameFromSource;
|
||||
|
||||
var _wastPrinter = require("@webassemblyjs/wast-printer");
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
var SHOW_LINES_AROUND_POINTER = 5;
|
||||
|
||||
function repeat(char, nb) {
|
||||
return Array(nb).fill(char).join("");
|
||||
} // TODO(sven): allow arbitrary ast nodes
|
||||
|
||||
|
||||
function codeFrameFromAst(ast, loc) {
|
||||
return codeFrameFromSource((0, _wastPrinter.print)(ast), loc);
|
||||
}
|
||||
|
||||
function codeFrameFromSource(source, loc) {
|
||||
var start = loc.start,
|
||||
end = loc.end;
|
||||
var length = 1;
|
||||
|
||||
if (_typeof(end) === "object") {
|
||||
length = end.column - start.column + 1;
|
||||
}
|
||||
|
||||
return source.split("\n").reduce(function (acc, line, lineNbr) {
|
||||
if (Math.abs(start.line - lineNbr) < SHOW_LINES_AROUND_POINTER) {
|
||||
acc += line + "\n";
|
||||
} // Add a new line with the pointer padded left
|
||||
|
||||
|
||||
if (lineNbr === start.line - 1) {
|
||||
acc += repeat(" ", start.column - 1);
|
||||
acc += repeat("^", length);
|
||||
acc += "\n";
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, "");
|
||||
}
|
||||
23
node_modules/@webassemblyjs/helper-code-frame/package.json
generated
vendored
Normal file
23
node_modules/@webassemblyjs/helper-code-frame/package.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-code-frame",
|
||||
"version": "1.9.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@webassemblyjs/wast-printer": "1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/ast": "1.9.0"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
21
node_modules/@webassemblyjs/helper-fsm/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-fsm/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.
|
||||
101
node_modules/@webassemblyjs/helper-fsm/esm/index.js
generated
vendored
Normal file
101
node_modules/@webassemblyjs/helper-fsm/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var STOP = Symbol("STOP");
|
||||
|
||||
function makeTransition(regex, nextState) {
|
||||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
||||
_ref$n = _ref.n,
|
||||
n = _ref$n === void 0 ? 1 : _ref$n,
|
||||
allowedSeparator = _ref.allowedSeparator;
|
||||
|
||||
return function (instance) {
|
||||
if (allowedSeparator) {
|
||||
if (instance.input[instance.ptr] === allowedSeparator) {
|
||||
if (regex.test(instance.input.substring(instance.ptr - 1, instance.ptr))) {
|
||||
// Consume the separator and stay in current state
|
||||
return [instance.currentState, 1];
|
||||
} else {
|
||||
return [instance.terminatingState, 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (regex.test(instance.input.substring(instance.ptr, instance.ptr + n))) {
|
||||
return [nextState, n];
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
function combineTransitions(transitions) {
|
||||
return function () {
|
||||
var match = false;
|
||||
var currentTransitions = transitions[this.currentState] || [];
|
||||
|
||||
for (var i = 0; i < currentTransitions.length; ++i) {
|
||||
match = currentTransitions[i](this);
|
||||
|
||||
if (match !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return match || [this.terminatingState, 0];
|
||||
};
|
||||
}
|
||||
|
||||
var FSM =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function FSM(transitions, initialState) {
|
||||
var terminatingState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STOP;
|
||||
|
||||
_classCallCheck(this, FSM);
|
||||
|
||||
this.initialState = initialState;
|
||||
this.terminatingState = terminatingState;
|
||||
|
||||
if (terminatingState === STOP || !transitions[terminatingState]) {
|
||||
transitions[terminatingState] = [];
|
||||
}
|
||||
|
||||
this.transitionFunction = combineTransitions.call(this, transitions);
|
||||
}
|
||||
|
||||
_createClass(FSM, [{
|
||||
key: "run",
|
||||
value: function run(input) {
|
||||
this.input = input;
|
||||
this.ptr = 0;
|
||||
this.currentState = this.initialState;
|
||||
var value = "";
|
||||
var eatLength, nextState;
|
||||
|
||||
while (this.currentState !== this.terminatingState && this.ptr < this.input.length) {
|
||||
var _transitionFunction = this.transitionFunction();
|
||||
|
||||
var _transitionFunction2 = _slicedToArray(_transitionFunction, 2);
|
||||
|
||||
nextState = _transitionFunction2[0];
|
||||
eatLength = _transitionFunction2[1];
|
||||
value += this.input.substring(this.ptr, this.ptr += eatLength);
|
||||
this.currentState = nextState;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}]);
|
||||
|
||||
return FSM;
|
||||
}();
|
||||
|
||||
export { makeTransition, FSM };
|
||||
109
node_modules/@webassemblyjs/helper-fsm/lib/index.js
generated
vendored
Normal file
109
node_modules/@webassemblyjs/helper-fsm/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeTransition = makeTransition;
|
||||
exports.FSM = void 0;
|
||||
|
||||
function _sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _slicedToArray(arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return _sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var STOP = Symbol("STOP");
|
||||
|
||||
function makeTransition(regex, nextState) {
|
||||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
||||
_ref$n = _ref.n,
|
||||
n = _ref$n === void 0 ? 1 : _ref$n,
|
||||
allowedSeparator = _ref.allowedSeparator;
|
||||
|
||||
return function (instance) {
|
||||
if (allowedSeparator) {
|
||||
if (instance.input[instance.ptr] === allowedSeparator) {
|
||||
if (regex.test(instance.input.substring(instance.ptr - 1, instance.ptr))) {
|
||||
// Consume the separator and stay in current state
|
||||
return [instance.currentState, 1];
|
||||
} else {
|
||||
return [instance.terminatingState, 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (regex.test(instance.input.substring(instance.ptr, instance.ptr + n))) {
|
||||
return [nextState, n];
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
function combineTransitions(transitions) {
|
||||
return function () {
|
||||
var match = false;
|
||||
var currentTransitions = transitions[this.currentState] || [];
|
||||
|
||||
for (var i = 0; i < currentTransitions.length; ++i) {
|
||||
match = currentTransitions[i](this);
|
||||
|
||||
if (match !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return match || [this.terminatingState, 0];
|
||||
};
|
||||
}
|
||||
|
||||
var FSM =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function FSM(transitions, initialState) {
|
||||
var terminatingState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STOP;
|
||||
|
||||
_classCallCheck(this, FSM);
|
||||
|
||||
this.initialState = initialState;
|
||||
this.terminatingState = terminatingState;
|
||||
|
||||
if (terminatingState === STOP || !transitions[terminatingState]) {
|
||||
transitions[terminatingState] = [];
|
||||
}
|
||||
|
||||
this.transitionFunction = combineTransitions.call(this, transitions);
|
||||
}
|
||||
|
||||
_createClass(FSM, [{
|
||||
key: "run",
|
||||
value: function run(input) {
|
||||
this.input = input;
|
||||
this.ptr = 0;
|
||||
this.currentState = this.initialState;
|
||||
var value = "";
|
||||
var eatLength, nextState;
|
||||
|
||||
while (this.currentState !== this.terminatingState && this.ptr < this.input.length) {
|
||||
var _transitionFunction = this.transitionFunction();
|
||||
|
||||
var _transitionFunction2 = _slicedToArray(_transitionFunction, 2);
|
||||
|
||||
nextState = _transitionFunction2[0];
|
||||
eatLength = _transitionFunction2[1];
|
||||
value += this.input.substring(this.ptr, this.ptr += eatLength);
|
||||
this.currentState = nextState;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}]);
|
||||
|
||||
return FSM;
|
||||
}();
|
||||
|
||||
exports.FSM = FSM;
|
||||
13
node_modules/@webassemblyjs/helper-fsm/package.json
generated
vendored
Normal file
13
node_modules/@webassemblyjs/helper-fsm/package.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-fsm",
|
||||
"version": "1.9.0",
|
||||
"description": "FSM implementation",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"author": "Mauro Bringolf",
|
||||
"license": "ISC",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
21
node_modules/@webassemblyjs/helper-module-context/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-module-context/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.
|
||||
378
node_modules/@webassemblyjs/helper-module-context/esm/index.js
generated
vendored
Normal file
378
node_modules/@webassemblyjs/helper-module-context/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
// TODO(sven): add flow in here
|
||||
import { isSignature, isNumberLiteral } from "@webassemblyjs/ast";
|
||||
export function moduleContextFromModuleAST(m) {
|
||||
var moduleContext = new ModuleContext();
|
||||
|
||||
if (!(m.type === "Module")) {
|
||||
throw new Error('m.type === "Module"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
m.fields.forEach(function (field) {
|
||||
switch (field.type) {
|
||||
case "Start":
|
||||
{
|
||||
moduleContext.setStart(field.index);
|
||||
break;
|
||||
}
|
||||
|
||||
case "TypeInstruction":
|
||||
{
|
||||
moduleContext.addType(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Func":
|
||||
{
|
||||
moduleContext.addFunction(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Global":
|
||||
{
|
||||
moduleContext.defineGlobal(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "ModuleImport":
|
||||
{
|
||||
switch (field.descr.type) {
|
||||
case "GlobalType":
|
||||
{
|
||||
moduleContext.importGlobal(field.descr.valtype, field.descr.mutability);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Memory":
|
||||
{
|
||||
moduleContext.addMemory(field.descr.limits.min, field.descr.limits.max);
|
||||
break;
|
||||
}
|
||||
|
||||
case "FuncImportDescr":
|
||||
{
|
||||
moduleContext.importFunction(field.descr);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Table":
|
||||
{
|
||||
// FIXME(sven): not implemented yet
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error("Unsupported ModuleImport of type " + JSON.stringify(field.descr.type));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "Memory":
|
||||
{
|
||||
moduleContext.addMemory(field.limits.min, field.limits.max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return moduleContext;
|
||||
}
|
||||
/**
|
||||
* Module context for type checking
|
||||
*/
|
||||
|
||||
export var ModuleContext =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function ModuleContext() {
|
||||
_classCallCheck(this, ModuleContext);
|
||||
|
||||
this.funcs = [];
|
||||
this.funcsOffsetByIdentifier = [];
|
||||
this.types = [];
|
||||
this.globals = [];
|
||||
this.globalsOffsetByIdentifier = [];
|
||||
this.mems = []; // Current stack frame
|
||||
|
||||
this.locals = [];
|
||||
this.labels = [];
|
||||
this.return = [];
|
||||
this.debugName = "unknown";
|
||||
this.start = null;
|
||||
}
|
||||
/**
|
||||
* Set start segment
|
||||
*/
|
||||
|
||||
|
||||
_createClass(ModuleContext, [{
|
||||
key: "setStart",
|
||||
value: function setStart(index) {
|
||||
this.start = index.value;
|
||||
}
|
||||
/**
|
||||
* Get start function
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "getStart",
|
||||
value: function getStart() {
|
||||
return this.start;
|
||||
}
|
||||
/**
|
||||
* Reset the active stack frame
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "newContext",
|
||||
value: function newContext(debugName, expectedResult) {
|
||||
this.locals = [];
|
||||
this.labels = [expectedResult];
|
||||
this.return = expectedResult;
|
||||
this.debugName = debugName;
|
||||
}
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addFunction",
|
||||
value: function addFunction(func
|
||||
/*: Func*/
|
||||
) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
var _ref = func.signature || {},
|
||||
_ref$params = _ref.params,
|
||||
args = _ref$params === void 0 ? [] : _ref$params,
|
||||
_ref$results = _ref.results,
|
||||
result = _ref$results === void 0 ? [] : _ref$results;
|
||||
|
||||
args = args.map(function (arg) {
|
||||
return arg.valtype;
|
||||
});
|
||||
this.funcs.push({
|
||||
args: args,
|
||||
result: result
|
||||
});
|
||||
|
||||
if (typeof func.name !== "undefined") {
|
||||
this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "importFunction",
|
||||
value: function importFunction(funcimport) {
|
||||
if (isSignature(funcimport.signature)) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
var _funcimport$signature = funcimport.signature,
|
||||
args = _funcimport$signature.params,
|
||||
result = _funcimport$signature.results;
|
||||
args = args.map(function (arg) {
|
||||
return arg.valtype;
|
||||
});
|
||||
this.funcs.push({
|
||||
args: args,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
if (!isNumberLiteral(funcimport.signature)) {
|
||||
throw new Error('isNumberLiteral(funcimport.signature)' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var typeId = funcimport.signature.value;
|
||||
|
||||
if (!this.hasType(typeId)) {
|
||||
throw new Error('this.hasType(typeId)' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var signature = this.getType(typeId);
|
||||
this.funcs.push({
|
||||
args: signature.params.map(function (arg) {
|
||||
return arg.valtype;
|
||||
}),
|
||||
result: signature.results
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof funcimport.id !== "undefined") {
|
||||
// imports are first, we can assume their index in the array
|
||||
this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "hasFunction",
|
||||
value: function hasFunction(index) {
|
||||
return typeof this.getFunction(index) !== "undefined";
|
||||
}
|
||||
}, {
|
||||
key: "getFunction",
|
||||
value: function getFunction(index) {
|
||||
if (typeof index !== "number") {
|
||||
throw new Error("getFunction only supported for number index");
|
||||
}
|
||||
|
||||
return this.funcs[index];
|
||||
}
|
||||
}, {
|
||||
key: "getFunctionOffsetByIdentifier",
|
||||
value: function getFunctionOffsetByIdentifier(name) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
return this.funcsOffsetByIdentifier[name];
|
||||
}
|
||||
/**
|
||||
* Labels
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addLabel",
|
||||
value: function addLabel(result) {
|
||||
this.labels.unshift(result);
|
||||
}
|
||||
}, {
|
||||
key: "hasLabel",
|
||||
value: function hasLabel(index) {
|
||||
return this.labels.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "getLabel",
|
||||
value: function getLabel(index) {
|
||||
return this.labels[index];
|
||||
}
|
||||
}, {
|
||||
key: "popLabel",
|
||||
value: function popLabel() {
|
||||
this.labels.shift();
|
||||
}
|
||||
/**
|
||||
* Locals
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasLocal",
|
||||
value: function hasLocal(index) {
|
||||
return typeof this.getLocal(index) !== "undefined";
|
||||
}
|
||||
}, {
|
||||
key: "getLocal",
|
||||
value: function getLocal(index) {
|
||||
return this.locals[index];
|
||||
}
|
||||
}, {
|
||||
key: "addLocal",
|
||||
value: function addLocal(type) {
|
||||
this.locals.push(type);
|
||||
}
|
||||
/**
|
||||
* Types
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addType",
|
||||
value: function addType(type) {
|
||||
if (!(type.functype.type === "Signature")) {
|
||||
throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
this.types.push(type.functype);
|
||||
}
|
||||
}, {
|
||||
key: "hasType",
|
||||
value: function hasType(index) {
|
||||
return this.types[index] !== undefined;
|
||||
}
|
||||
}, {
|
||||
key: "getType",
|
||||
value: function getType(index) {
|
||||
return this.types[index];
|
||||
}
|
||||
/**
|
||||
* Globals
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasGlobal",
|
||||
value: function hasGlobal(index) {
|
||||
return this.globals.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "getGlobal",
|
||||
value: function getGlobal(index) {
|
||||
return this.globals[index].type;
|
||||
}
|
||||
}, {
|
||||
key: "getGlobalOffsetByIdentifier",
|
||||
value: function getGlobalOffsetByIdentifier(name) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
return this.globalsOffsetByIdentifier[name];
|
||||
}
|
||||
}, {
|
||||
key: "defineGlobal",
|
||||
value: function defineGlobal(global
|
||||
/*: Global*/
|
||||
) {
|
||||
var type = global.globalType.valtype;
|
||||
var mutability = global.globalType.mutability;
|
||||
this.globals.push({
|
||||
type: type,
|
||||
mutability: mutability
|
||||
});
|
||||
|
||||
if (typeof global.name !== "undefined") {
|
||||
this.globalsOffsetByIdentifier[global.name.value] = this.globals.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "importGlobal",
|
||||
value: function importGlobal(type, mutability) {
|
||||
this.globals.push({
|
||||
type: type,
|
||||
mutability: mutability
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "isMutableGlobal",
|
||||
value: function isMutableGlobal(index) {
|
||||
return this.globals[index].mutability === "var";
|
||||
}
|
||||
}, {
|
||||
key: "isImmutableGlobal",
|
||||
value: function isImmutableGlobal(index) {
|
||||
return this.globals[index].mutability === "const";
|
||||
}
|
||||
/**
|
||||
* Memories
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasMemory",
|
||||
value: function hasMemory(index) {
|
||||
return this.mems.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "addMemory",
|
||||
value: function addMemory(min, max) {
|
||||
this.mems.push({
|
||||
min: min,
|
||||
max: max
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getMemory",
|
||||
value: function getMemory(index) {
|
||||
return this.mems[index];
|
||||
}
|
||||
}]);
|
||||
|
||||
return ModuleContext;
|
||||
}();
|
||||
389
node_modules/@webassemblyjs/helper-module-context/lib/index.js
generated
vendored
Normal file
389
node_modules/@webassemblyjs/helper-module-context/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,389 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.moduleContextFromModuleAST = moduleContextFromModuleAST;
|
||||
exports.ModuleContext = void 0;
|
||||
|
||||
var _ast = require("@webassemblyjs/ast");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function moduleContextFromModuleAST(m) {
|
||||
var moduleContext = new ModuleContext();
|
||||
|
||||
if (!(m.type === "Module")) {
|
||||
throw new Error('m.type === "Module"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
m.fields.forEach(function (field) {
|
||||
switch (field.type) {
|
||||
case "Start":
|
||||
{
|
||||
moduleContext.setStart(field.index);
|
||||
break;
|
||||
}
|
||||
|
||||
case "TypeInstruction":
|
||||
{
|
||||
moduleContext.addType(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Func":
|
||||
{
|
||||
moduleContext.addFunction(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Global":
|
||||
{
|
||||
moduleContext.defineGlobal(field);
|
||||
break;
|
||||
}
|
||||
|
||||
case "ModuleImport":
|
||||
{
|
||||
switch (field.descr.type) {
|
||||
case "GlobalType":
|
||||
{
|
||||
moduleContext.importGlobal(field.descr.valtype, field.descr.mutability);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Memory":
|
||||
{
|
||||
moduleContext.addMemory(field.descr.limits.min, field.descr.limits.max);
|
||||
break;
|
||||
}
|
||||
|
||||
case "FuncImportDescr":
|
||||
{
|
||||
moduleContext.importFunction(field.descr);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Table":
|
||||
{
|
||||
// FIXME(sven): not implemented yet
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error("Unsupported ModuleImport of type " + JSON.stringify(field.descr.type));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "Memory":
|
||||
{
|
||||
moduleContext.addMemory(field.limits.min, field.limits.max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return moduleContext;
|
||||
}
|
||||
/**
|
||||
* Module context for type checking
|
||||
*/
|
||||
|
||||
|
||||
var ModuleContext =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function ModuleContext() {
|
||||
_classCallCheck(this, ModuleContext);
|
||||
|
||||
this.funcs = [];
|
||||
this.funcsOffsetByIdentifier = [];
|
||||
this.types = [];
|
||||
this.globals = [];
|
||||
this.globalsOffsetByIdentifier = [];
|
||||
this.mems = []; // Current stack frame
|
||||
|
||||
this.locals = [];
|
||||
this.labels = [];
|
||||
this.return = [];
|
||||
this.debugName = "unknown";
|
||||
this.start = null;
|
||||
}
|
||||
/**
|
||||
* Set start segment
|
||||
*/
|
||||
|
||||
|
||||
_createClass(ModuleContext, [{
|
||||
key: "setStart",
|
||||
value: function setStart(index) {
|
||||
this.start = index.value;
|
||||
}
|
||||
/**
|
||||
* Get start function
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "getStart",
|
||||
value: function getStart() {
|
||||
return this.start;
|
||||
}
|
||||
/**
|
||||
* Reset the active stack frame
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "newContext",
|
||||
value: function newContext(debugName, expectedResult) {
|
||||
this.locals = [];
|
||||
this.labels = [expectedResult];
|
||||
this.return = expectedResult;
|
||||
this.debugName = debugName;
|
||||
}
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addFunction",
|
||||
value: function addFunction(func
|
||||
/*: Func*/
|
||||
) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
var _ref = func.signature || {},
|
||||
_ref$params = _ref.params,
|
||||
args = _ref$params === void 0 ? [] : _ref$params,
|
||||
_ref$results = _ref.results,
|
||||
result = _ref$results === void 0 ? [] : _ref$results;
|
||||
|
||||
args = args.map(function (arg) {
|
||||
return arg.valtype;
|
||||
});
|
||||
this.funcs.push({
|
||||
args: args,
|
||||
result: result
|
||||
});
|
||||
|
||||
if (typeof func.name !== "undefined") {
|
||||
this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "importFunction",
|
||||
value: function importFunction(funcimport) {
|
||||
if ((0, _ast.isSignature)(funcimport.signature)) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
var _funcimport$signature = funcimport.signature,
|
||||
args = _funcimport$signature.params,
|
||||
result = _funcimport$signature.results;
|
||||
args = args.map(function (arg) {
|
||||
return arg.valtype;
|
||||
});
|
||||
this.funcs.push({
|
||||
args: args,
|
||||
result: result
|
||||
});
|
||||
} else {
|
||||
if (!(0, _ast.isNumberLiteral)(funcimport.signature)) {
|
||||
throw new Error('isNumberLiteral(funcimport.signature)' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var typeId = funcimport.signature.value;
|
||||
|
||||
if (!this.hasType(typeId)) {
|
||||
throw new Error('this.hasType(typeId)' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
var signature = this.getType(typeId);
|
||||
this.funcs.push({
|
||||
args: signature.params.map(function (arg) {
|
||||
return arg.valtype;
|
||||
}),
|
||||
result: signature.results
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof funcimport.id !== "undefined") {
|
||||
// imports are first, we can assume their index in the array
|
||||
this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "hasFunction",
|
||||
value: function hasFunction(index) {
|
||||
return typeof this.getFunction(index) !== "undefined";
|
||||
}
|
||||
}, {
|
||||
key: "getFunction",
|
||||
value: function getFunction(index) {
|
||||
if (typeof index !== "number") {
|
||||
throw new Error("getFunction only supported for number index");
|
||||
}
|
||||
|
||||
return this.funcs[index];
|
||||
}
|
||||
}, {
|
||||
key: "getFunctionOffsetByIdentifier",
|
||||
value: function getFunctionOffsetByIdentifier(name) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
return this.funcsOffsetByIdentifier[name];
|
||||
}
|
||||
/**
|
||||
* Labels
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addLabel",
|
||||
value: function addLabel(result) {
|
||||
this.labels.unshift(result);
|
||||
}
|
||||
}, {
|
||||
key: "hasLabel",
|
||||
value: function hasLabel(index) {
|
||||
return this.labels.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "getLabel",
|
||||
value: function getLabel(index) {
|
||||
return this.labels[index];
|
||||
}
|
||||
}, {
|
||||
key: "popLabel",
|
||||
value: function popLabel() {
|
||||
this.labels.shift();
|
||||
}
|
||||
/**
|
||||
* Locals
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasLocal",
|
||||
value: function hasLocal(index) {
|
||||
return typeof this.getLocal(index) !== "undefined";
|
||||
}
|
||||
}, {
|
||||
key: "getLocal",
|
||||
value: function getLocal(index) {
|
||||
return this.locals[index];
|
||||
}
|
||||
}, {
|
||||
key: "addLocal",
|
||||
value: function addLocal(type) {
|
||||
this.locals.push(type);
|
||||
}
|
||||
/**
|
||||
* Types
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "addType",
|
||||
value: function addType(type) {
|
||||
if (!(type.functype.type === "Signature")) {
|
||||
throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
this.types.push(type.functype);
|
||||
}
|
||||
}, {
|
||||
key: "hasType",
|
||||
value: function hasType(index) {
|
||||
return this.types[index] !== undefined;
|
||||
}
|
||||
}, {
|
||||
key: "getType",
|
||||
value: function getType(index) {
|
||||
return this.types[index];
|
||||
}
|
||||
/**
|
||||
* Globals
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasGlobal",
|
||||
value: function hasGlobal(index) {
|
||||
return this.globals.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "getGlobal",
|
||||
value: function getGlobal(index) {
|
||||
return this.globals[index].type;
|
||||
}
|
||||
}, {
|
||||
key: "getGlobalOffsetByIdentifier",
|
||||
value: function getGlobalOffsetByIdentifier(name) {
|
||||
if (!(typeof name === "string")) {
|
||||
throw new Error('typeof name === "string"' + " error: " + (undefined || "unknown"));
|
||||
}
|
||||
|
||||
return this.globalsOffsetByIdentifier[name];
|
||||
}
|
||||
}, {
|
||||
key: "defineGlobal",
|
||||
value: function defineGlobal(global
|
||||
/*: Global*/
|
||||
) {
|
||||
var type = global.globalType.valtype;
|
||||
var mutability = global.globalType.mutability;
|
||||
this.globals.push({
|
||||
type: type,
|
||||
mutability: mutability
|
||||
});
|
||||
|
||||
if (typeof global.name !== "undefined") {
|
||||
this.globalsOffsetByIdentifier[global.name.value] = this.globals.length - 1;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "importGlobal",
|
||||
value: function importGlobal(type, mutability) {
|
||||
this.globals.push({
|
||||
type: type,
|
||||
mutability: mutability
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "isMutableGlobal",
|
||||
value: function isMutableGlobal(index) {
|
||||
return this.globals[index].mutability === "var";
|
||||
}
|
||||
}, {
|
||||
key: "isImmutableGlobal",
|
||||
value: function isImmutableGlobal(index) {
|
||||
return this.globals[index].mutability === "const";
|
||||
}
|
||||
/**
|
||||
* Memories
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "hasMemory",
|
||||
value: function hasMemory(index) {
|
||||
return this.mems.length > index && index >= 0;
|
||||
}
|
||||
}, {
|
||||
key: "addMemory",
|
||||
value: function addMemory(min, max) {
|
||||
this.mems.push({
|
||||
min: min,
|
||||
max: max
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getMemory",
|
||||
value: function getMemory(index) {
|
||||
return this.mems[index];
|
||||
}
|
||||
}]);
|
||||
|
||||
return ModuleContext;
|
||||
}();
|
||||
|
||||
exports.ModuleContext = ModuleContext;
|
||||
27
node_modules/@webassemblyjs/helper-module-context/package.json
generated
vendored
Normal file
27
node_modules/@webassemblyjs/helper-module-context/package.json
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@webassemblyjs/helper-module-context",
|
||||
"version": "1.9.0",
|
||||
"description": "",
|
||||
"main": "lib/index.js",
|
||||
"module": "esm/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xtuc/webassemblyjs.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@webassemblyjs/ast": "1.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@webassemblyjs/wast-parser": "1.9.0",
|
||||
"mamacro": "^0.0.7"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"author": "Sven Sauleau",
|
||||
"license": "MIT",
|
||||
"gitHead": "0440b420888c1f7701eb9762ec657775506b87d8"
|
||||
}
|
||||
287
node_modules/@webassemblyjs/helper-module-context/src/index.js
generated
vendored
Normal file
287
node_modules/@webassemblyjs/helper-module-context/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
// TODO(sven): add flow in here
|
||||
|
||||
import { isSignature, isNumberLiteral } from "@webassemblyjs/ast";
|
||||
import { assert } from "mamacro";
|
||||
|
||||
export function moduleContextFromModuleAST(m) {
|
||||
const moduleContext = new ModuleContext();
|
||||
|
||||
assert(m.type === "Module");
|
||||
|
||||
m.fields.forEach(field => {
|
||||
switch (field.type) {
|
||||
case "Start": {
|
||||
moduleContext.setStart(field.index);
|
||||
break;
|
||||
}
|
||||
case "TypeInstruction": {
|
||||
moduleContext.addType(field);
|
||||
break;
|
||||
}
|
||||
case "Func": {
|
||||
moduleContext.addFunction(field);
|
||||
break;
|
||||
}
|
||||
case "Global": {
|
||||
moduleContext.defineGlobal(field);
|
||||
break;
|
||||
}
|
||||
case "ModuleImport": {
|
||||
switch (field.descr.type) {
|
||||
case "GlobalType": {
|
||||
moduleContext.importGlobal(
|
||||
field.descr.valtype,
|
||||
field.descr.mutability
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "Memory": {
|
||||
moduleContext.addMemory(
|
||||
field.descr.limits.min,
|
||||
field.descr.limits.max
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "FuncImportDescr": {
|
||||
moduleContext.importFunction(field.descr);
|
||||
break;
|
||||
}
|
||||
|
||||
case "Table": {
|
||||
// FIXME(sven): not implemented yet
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
"Unsupported ModuleImport of type " +
|
||||
JSON.stringify(field.descr.type)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Memory": {
|
||||
moduleContext.addMemory(field.limits.min, field.limits.max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return moduleContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module context for type checking
|
||||
*/
|
||||
export class ModuleContext {
|
||||
constructor() {
|
||||
this.funcs = [];
|
||||
this.funcsOffsetByIdentifier = [];
|
||||
|
||||
this.types = [];
|
||||
|
||||
this.globals = [];
|
||||
this.globalsOffsetByIdentifier = [];
|
||||
|
||||
this.mems = [];
|
||||
|
||||
// Current stack frame
|
||||
this.locals = [];
|
||||
this.labels = [];
|
||||
this.return = [];
|
||||
|
||||
this.debugName = "unknown";
|
||||
|
||||
this.start = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start segment
|
||||
*/
|
||||
setStart(index) {
|
||||
this.start = index.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start function
|
||||
*/
|
||||
getStart() {
|
||||
return this.start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the active stack frame
|
||||
*/
|
||||
newContext(debugName, expectedResult) {
|
||||
this.locals = [];
|
||||
this.labels = [expectedResult];
|
||||
this.return = expectedResult;
|
||||
this.debugName = debugName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
addFunction(func /*: Func*/) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { params: args = [], results: result = [] } = func.signature || {};
|
||||
|
||||
args = args.map(arg => arg.valtype);
|
||||
|
||||
this.funcs.push({ args, result });
|
||||
|
||||
if (typeof func.name !== "undefined") {
|
||||
this.funcsOffsetByIdentifier[func.name.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
importFunction(funcimport) {
|
||||
if (isSignature(funcimport.signature)) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { params: args, results: result } = funcimport.signature;
|
||||
args = args.map(arg => arg.valtype);
|
||||
|
||||
this.funcs.push({ args, result });
|
||||
} else {
|
||||
assert(isNumberLiteral(funcimport.signature));
|
||||
|
||||
const typeId = funcimport.signature.value;
|
||||
assert(this.hasType(typeId));
|
||||
|
||||
const signature = this.getType(typeId);
|
||||
this.funcs.push({
|
||||
args: signature.params.map(arg => arg.valtype),
|
||||
result: signature.results
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof funcimport.id !== "undefined") {
|
||||
// imports are first, we can assume their index in the array
|
||||
this.funcsOffsetByIdentifier[funcimport.id.value] = this.funcs.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
hasFunction(index) {
|
||||
return typeof this.getFunction(index) !== "undefined";
|
||||
}
|
||||
|
||||
getFunction(index) {
|
||||
if (typeof index !== "number") {
|
||||
throw new Error("getFunction only supported for number index");
|
||||
}
|
||||
|
||||
return this.funcs[index];
|
||||
}
|
||||
|
||||
getFunctionOffsetByIdentifier(name) {
|
||||
assert(typeof name === "string");
|
||||
|
||||
return this.funcsOffsetByIdentifier[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Labels
|
||||
*/
|
||||
addLabel(result) {
|
||||
this.labels.unshift(result);
|
||||
}
|
||||
|
||||
hasLabel(index) {
|
||||
return this.labels.length > index && index >= 0;
|
||||
}
|
||||
|
||||
getLabel(index) {
|
||||
return this.labels[index];
|
||||
}
|
||||
|
||||
popLabel() {
|
||||
this.labels.shift();
|
||||
}
|
||||
|
||||
/**
|
||||
* Locals
|
||||
*/
|
||||
hasLocal(index) {
|
||||
return typeof this.getLocal(index) !== "undefined";
|
||||
}
|
||||
|
||||
getLocal(index) {
|
||||
return this.locals[index];
|
||||
}
|
||||
|
||||
addLocal(type) {
|
||||
this.locals.push(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Types
|
||||
*/
|
||||
addType(type) {
|
||||
assert(type.functype.type === "Signature");
|
||||
this.types.push(type.functype);
|
||||
}
|
||||
|
||||
hasType(index) {
|
||||
return this.types[index] !== undefined;
|
||||
}
|
||||
|
||||
getType(index) {
|
||||
return this.types[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Globals
|
||||
*/
|
||||
hasGlobal(index) {
|
||||
return this.globals.length > index && index >= 0;
|
||||
}
|
||||
|
||||
getGlobal(index) {
|
||||
return this.globals[index].type;
|
||||
}
|
||||
|
||||
getGlobalOffsetByIdentifier(name) {
|
||||
assert(typeof name === "string");
|
||||
|
||||
return this.globalsOffsetByIdentifier[name];
|
||||
}
|
||||
|
||||
defineGlobal(global /*: Global*/) {
|
||||
const type = global.globalType.valtype;
|
||||
const mutability = global.globalType.mutability;
|
||||
|
||||
this.globals.push({ type, mutability });
|
||||
|
||||
if (typeof global.name !== "undefined") {
|
||||
this.globalsOffsetByIdentifier[global.name.value] =
|
||||
this.globals.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
importGlobal(type, mutability) {
|
||||
this.globals.push({ type, mutability });
|
||||
}
|
||||
|
||||
isMutableGlobal(index) {
|
||||
return this.globals[index].mutability === "var";
|
||||
}
|
||||
|
||||
isImmutableGlobal(index) {
|
||||
return this.globals[index].mutability === "const";
|
||||
}
|
||||
|
||||
/**
|
||||
* Memories
|
||||
*/
|
||||
hasMemory(index) {
|
||||
return this.mems.length > index && index >= 0;
|
||||
}
|
||||
|
||||
addMemory(min, max) {
|
||||
this.mems.push({ min, max });
|
||||
}
|
||||
|
||||
getMemory(index) {
|
||||
return this.mems[index];
|
||||
}
|
||||
}
|
||||
100
node_modules/@webassemblyjs/helper-module-context/test/index.js
generated
vendored
Normal file
100
node_modules/@webassemblyjs/helper-module-context/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
const { assert } = require("chai");
|
||||
const { parse } = require("@webassemblyjs/wast-parser");
|
||||
|
||||
const { moduleContextFromModuleAST } = require("../lib");
|
||||
|
||||
const contextFromWast = wast => moduleContextFromModuleAST(parse(wast).body[0]);
|
||||
|
||||
describe("module context", () => {
|
||||
describe("start segment", () => {
|
||||
it("should return the start function offset", () => {
|
||||
const context = contextFromWast(`
|
||||
(module
|
||||
(func)
|
||||
(func)
|
||||
(start 1)
|
||||
)
|
||||
`);
|
||||
|
||||
assert.isOk(context.getStart());
|
||||
assert.typeOf(context.getStart(), "number");
|
||||
assert.equal(context.getStart(), 1);
|
||||
});
|
||||
|
||||
it("should return null if no start function", () => {
|
||||
const context = contextFromWast(`
|
||||
(module (func))
|
||||
`);
|
||||
|
||||
assert.isNull(context.getStart());
|
||||
});
|
||||
|
||||
it("should retrive the type of implemented functions", () => {
|
||||
const context = contextFromWast(`
|
||||
(module
|
||||
(func (param i32) (result i64))
|
||||
(func (param i64) (result i32))
|
||||
(func (result i64))
|
||||
(func)
|
||||
)
|
||||
`);
|
||||
|
||||
assert.deepEqual(context.getFunction(0), {
|
||||
args: ["i32"],
|
||||
result: ["i64"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(1), {
|
||||
args: ["i64"],
|
||||
result: ["i32"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(2), { args: [], result: ["i64"] });
|
||||
assert.deepEqual(context.getFunction(3), { args: [], result: [] });
|
||||
});
|
||||
|
||||
it("should retrive the type of imported functions", () => {
|
||||
const context = contextFromWast(`
|
||||
(module
|
||||
(import "a" "a" (func (param i32) (result i32)))
|
||||
(import "a" "b" (func (result i64)))
|
||||
(import "a" "c" (func))
|
||||
(func (result f32))
|
||||
)
|
||||
`);
|
||||
|
||||
assert.deepEqual(context.getFunction(0), {
|
||||
args: ["i32"],
|
||||
result: ["i32"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(1), {
|
||||
args: [],
|
||||
result: ["i64"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(2), { args: [], result: [] });
|
||||
assert.deepEqual(context.getFunction(3), { args: [], result: ["f32"] });
|
||||
});
|
||||
|
||||
it("should retrive the type of functions with type ref", () => {
|
||||
const context = contextFromWast(`
|
||||
(module
|
||||
(type (func (param i32) (result i32)))
|
||||
(type (func (result i64)))
|
||||
(type (func))
|
||||
|
||||
(import "a" "a" (func (type 0)))
|
||||
(import "a" "b" (func (type 1)))
|
||||
(func (type 2))
|
||||
)
|
||||
`);
|
||||
|
||||
assert.deepEqual(context.getFunction(0), {
|
||||
args: ["i32"],
|
||||
result: ["i32"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(1), {
|
||||
args: [],
|
||||
result: ["i64"]
|
||||
});
|
||||
assert.deepEqual(context.getFunction(2), { args: [], result: [] });
|
||||
});
|
||||
});
|
||||
});
|
||||
21
node_modules/@webassemblyjs/helper-wasm-bytecode/LICENSE
generated
vendored
Normal file
21
node_modules/@webassemblyjs/helper-wasm-bytecode/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.
|
||||
324
node_modules/@webassemblyjs/helper-wasm-bytecode/esm/index.js
generated
vendored
Normal file
324
node_modules/@webassemblyjs/helper-wasm-bytecode/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
var illegalop = "illegal";
|
||||
var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
|
||||
var moduleVersion = [0x01, 0x00, 0x00, 0x00];
|
||||
|
||||
function invertMap(obj) {
|
||||
var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
|
||||
return k;
|
||||
};
|
||||
var result = {};
|
||||
var keys = Object.keys(obj);
|
||||
|
||||
for (var i = 0, length = keys.length; i < length; i++) {
|
||||
result[keyModifierFn(obj[keys[i]])] = keys[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function createSymbolObject(name
|
||||
/*: string */
|
||||
, object
|
||||
/*: string */
|
||||
)
|
||||
/*: Symbol*/
|
||||
{
|
||||
var numberOfArgs
|
||||
/*: number*/
|
||||
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
return {
|
||||
name: name,
|
||||
object: object,
|
||||
numberOfArgs: numberOfArgs
|
||||
};
|
||||
}
|
||||
|
||||
function createSymbol(name
|
||||
/*: string */
|
||||
)
|
||||
/*: Symbol*/
|
||||
{
|
||||
var numberOfArgs
|
||||
/*: number*/
|
||||
= arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
return {
|
||||
name: name,
|
||||
numberOfArgs: numberOfArgs
|
||||
};
|
||||
}
|
||||
|
||||
var types = {
|
||||
func: 0x60,
|
||||
result: 0x40
|
||||
};
|
||||
var exportTypes = {
|
||||
0x00: "Func",
|
||||
0x01: "Table",
|
||||
0x02: "Mem",
|
||||
0x03: "Global"
|
||||
};
|
||||
var exportTypesByName = invertMap(exportTypes);
|
||||
var valtypes = {
|
||||
0x7f: "i32",
|
||||
0x7e: "i64",
|
||||
0x7d: "f32",
|
||||
0x7c: "f64",
|
||||
0x7b: "v128"
|
||||
};
|
||||
var valtypesByString = invertMap(valtypes);
|
||||
var tableTypes = {
|
||||
0x70: "anyfunc"
|
||||
};
|
||||
var blockTypes = Object.assign({}, valtypes, {
|
||||
// https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
|
||||
0x40: null,
|
||||
// https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
|
||||
0x7f: "i32",
|
||||
0x7e: "i64",
|
||||
0x7d: "f32",
|
||||
0x7c: "f64"
|
||||
});
|
||||
var globalTypes = {
|
||||
0x00: "const",
|
||||
0x01: "var"
|
||||
};
|
||||
var globalTypesByString = invertMap(globalTypes);
|
||||
var importTypes = {
|
||||
0x00: "func",
|
||||
0x01: "table",
|
||||
0x02: "mem",
|
||||
0x03: "global"
|
||||
};
|
||||
var sections = {
|
||||
custom: 0,
|
||||
type: 1,
|
||||
import: 2,
|
||||
func: 3,
|
||||
table: 4,
|
||||
memory: 5,
|
||||
global: 6,
|
||||
export: 7,
|
||||
start: 8,
|
||||
element: 9,
|
||||
code: 10,
|
||||
data: 11
|
||||
};
|
||||
var symbolsByByte = {
|
||||
0x00: createSymbol("unreachable"),
|
||||
0x01: createSymbol("nop"),
|
||||
0x02: createSymbol("block"),
|
||||
0x03: createSymbol("loop"),
|
||||
0x04: createSymbol("if"),
|
||||
0x05: createSymbol("else"),
|
||||
0x06: illegalop,
|
||||
0x07: illegalop,
|
||||
0x08: illegalop,
|
||||
0x09: illegalop,
|
||||
0x0a: illegalop,
|
||||
0x0b: createSymbol("end"),
|
||||
0x0c: createSymbol("br", 1),
|
||||
0x0d: createSymbol("br_if", 1),
|
||||
0x0e: createSymbol("br_table"),
|
||||
0x0f: createSymbol("return"),
|
||||
0x10: createSymbol("call", 1),
|
||||
0x11: createSymbol("call_indirect", 2),
|
||||
0x12: illegalop,
|
||||
0x13: illegalop,
|
||||
0x14: illegalop,
|
||||
0x15: illegalop,
|
||||
0x16: illegalop,
|
||||
0x17: illegalop,
|
||||
0x18: illegalop,
|
||||
0x19: illegalop,
|
||||
0x1a: createSymbol("drop"),
|
||||
0x1b: createSymbol("select"),
|
||||
0x1c: illegalop,
|
||||
0x1d: illegalop,
|
||||
0x1e: illegalop,
|
||||
0x1f: illegalop,
|
||||
0x20: createSymbol("get_local", 1),
|
||||
0x21: createSymbol("set_local", 1),
|
||||
0x22: createSymbol("tee_local", 1),
|
||||
0x23: createSymbol("get_global", 1),
|
||||
0x24: createSymbol("set_global", 1),
|
||||
0x25: illegalop,
|
||||
0x26: illegalop,
|
||||
0x27: illegalop,
|
||||
0x28: createSymbolObject("load", "u32", 1),
|
||||
0x29: createSymbolObject("load", "u64", 1),
|
||||
0x2a: createSymbolObject("load", "f32", 1),
|
||||
0x2b: createSymbolObject("load", "f64", 1),
|
||||
0x2c: createSymbolObject("load8_s", "u32", 1),
|
||||
0x2d: createSymbolObject("load8_u", "u32", 1),
|
||||
0x2e: createSymbolObject("load16_s", "u32", 1),
|
||||
0x2f: createSymbolObject("load16_u", "u32", 1),
|
||||
0x30: createSymbolObject("load8_s", "u64", 1),
|
||||
0x31: createSymbolObject("load8_u", "u64", 1),
|
||||
0x32: createSymbolObject("load16_s", "u64", 1),
|
||||
0x33: createSymbolObject("load16_u", "u64", 1),
|
||||
0x34: createSymbolObject("load32_s", "u64", 1),
|
||||
0x35: createSymbolObject("load32_u", "u64", 1),
|
||||
0x36: createSymbolObject("store", "u32", 1),
|
||||
0x37: createSymbolObject("store", "u64", 1),
|
||||
0x38: createSymbolObject("store", "f32", 1),
|
||||
0x39: createSymbolObject("store", "f64", 1),
|
||||
0x3a: createSymbolObject("store8", "u32", 1),
|
||||
0x3b: createSymbolObject("store16", "u32", 1),
|
||||
0x3c: createSymbolObject("store8", "u64", 1),
|
||||
0x3d: createSymbolObject("store16", "u64", 1),
|
||||
0x3e: createSymbolObject("store32", "u64", 1),
|
||||
0x3f: createSymbolObject("current_memory"),
|
||||
0x40: createSymbolObject("grow_memory"),
|
||||
0x41: createSymbolObject("const", "i32", 1),
|
||||
0x42: createSymbolObject("const", "i64", 1),
|
||||
0x43: createSymbolObject("const", "f32", 1),
|
||||
0x44: createSymbolObject("const", "f64", 1),
|
||||
0x45: createSymbolObject("eqz", "i32"),
|
||||
0x46: createSymbolObject("eq", "i32"),
|
||||
0x47: createSymbolObject("ne", "i32"),
|
||||
0x48: createSymbolObject("lt_s", "i32"),
|
||||
0x49: createSymbolObject("lt_u", "i32"),
|
||||
0x4a: createSymbolObject("gt_s", "i32"),
|
||||
0x4b: createSymbolObject("gt_u", "i32"),
|
||||
0x4c: createSymbolObject("le_s", "i32"),
|
||||
0x4d: createSymbolObject("le_u", "i32"),
|
||||
0x4e: createSymbolObject("ge_s", "i32"),
|
||||
0x4f: createSymbolObject("ge_u", "i32"),
|
||||
0x50: createSymbolObject("eqz", "i64"),
|
||||
0x51: createSymbolObject("eq", "i64"),
|
||||
0x52: createSymbolObject("ne", "i64"),
|
||||
0x53: createSymbolObject("lt_s", "i64"),
|
||||
0x54: createSymbolObject("lt_u", "i64"),
|
||||
0x55: createSymbolObject("gt_s", "i64"),
|
||||
0x56: createSymbolObject("gt_u", "i64"),
|
||||
0x57: createSymbolObject("le_s", "i64"),
|
||||
0x58: createSymbolObject("le_u", "i64"),
|
||||
0x59: createSymbolObject("ge_s", "i64"),
|
||||
0x5a: createSymbolObject("ge_u", "i64"),
|
||||
0x5b: createSymbolObject("eq", "f32"),
|
||||
0x5c: createSymbolObject("ne", "f32"),
|
||||
0x5d: createSymbolObject("lt", "f32"),
|
||||
0x5e: createSymbolObject("gt", "f32"),
|
||||
0x5f: createSymbolObject("le", "f32"),
|
||||
0x60: createSymbolObject("ge", "f32"),
|
||||
0x61: createSymbolObject("eq", "f64"),
|
||||
0x62: createSymbolObject("ne", "f64"),
|
||||
0x63: createSymbolObject("lt", "f64"),
|
||||
0x64: createSymbolObject("gt", "f64"),
|
||||
0x65: createSymbolObject("le", "f64"),
|
||||
0x66: createSymbolObject("ge", "f64"),
|
||||
0x67: createSymbolObject("clz", "i32"),
|
||||
0x68: createSymbolObject("ctz", "i32"),
|
||||
0x69: createSymbolObject("popcnt", "i32"),
|
||||
0x6a: createSymbolObject("add", "i32"),
|
||||
0x6b: createSymbolObject("sub", "i32"),
|
||||
0x6c: createSymbolObject("mul", "i32"),
|
||||
0x6d: createSymbolObject("div_s", "i32"),
|
||||
0x6e: createSymbolObject("div_u", "i32"),
|
||||
0x6f: createSymbolObject("rem_s", "i32"),
|
||||
0x70: createSymbolObject("rem_u", "i32"),
|
||||
0x71: createSymbolObject("and", "i32"),
|
||||
0x72: createSymbolObject("or", "i32"),
|
||||
0x73: createSymbolObject("xor", "i32"),
|
||||
0x74: createSymbolObject("shl", "i32"),
|
||||
0x75: createSymbolObject("shr_s", "i32"),
|
||||
0x76: createSymbolObject("shr_u", "i32"),
|
||||
0x77: createSymbolObject("rotl", "i32"),
|
||||
0x78: createSymbolObject("rotr", "i32"),
|
||||
0x79: createSymbolObject("clz", "i64"),
|
||||
0x7a: createSymbolObject("ctz", "i64"),
|
||||
0x7b: createSymbolObject("popcnt", "i64"),
|
||||
0x7c: createSymbolObject("add", "i64"),
|
||||
0x7d: createSymbolObject("sub", "i64"),
|
||||
0x7e: createSymbolObject("mul", "i64"),
|
||||
0x7f: createSymbolObject("div_s", "i64"),
|
||||
0x80: createSymbolObject("div_u", "i64"),
|
||||
0x81: createSymbolObject("rem_s", "i64"),
|
||||
0x82: createSymbolObject("rem_u", "i64"),
|
||||
0x83: createSymbolObject("and", "i64"),
|
||||
0x84: createSymbolObject("or", "i64"),
|
||||
0x85: createSymbolObject("xor", "i64"),
|
||||
0x86: createSymbolObject("shl", "i64"),
|
||||
0x87: createSymbolObject("shr_s", "i64"),
|
||||
0x88: createSymbolObject("shr_u", "i64"),
|
||||
0x89: createSymbolObject("rotl", "i64"),
|
||||
0x8a: createSymbolObject("rotr", "i64"),
|
||||
0x8b: createSymbolObject("abs", "f32"),
|
||||
0x8c: createSymbolObject("neg", "f32"),
|
||||
0x8d: createSymbolObject("ceil", "f32"),
|
||||
0x8e: createSymbolObject("floor", "f32"),
|
||||
0x8f: createSymbolObject("trunc", "f32"),
|
||||
0x90: createSymbolObject("nearest", "f32"),
|
||||
0x91: createSymbolObject("sqrt", "f32"),
|
||||
0x92: createSymbolObject("add", "f32"),
|
||||
0x93: createSymbolObject("sub", "f32"),
|
||||
0x94: createSymbolObject("mul", "f32"),
|
||||
0x95: createSymbolObject("div", "f32"),
|
||||
0x96: createSymbolObject("min", "f32"),
|
||||
0x97: createSymbolObject("max", "f32"),
|
||||
0x98: createSymbolObject("copysign", "f32"),
|
||||
0x99: createSymbolObject("abs", "f64"),
|
||||
0x9a: createSymbolObject("neg", "f64"),
|
||||
0x9b: createSymbolObject("ceil", "f64"),
|
||||
0x9c: createSymbolObject("floor", "f64"),
|
||||
0x9d: createSymbolObject("trunc", "f64"),
|
||||
0x9e: createSymbolObject("nearest", "f64"),
|
||||
0x9f: createSymbolObject("sqrt", "f64"),
|
||||
0xa0: createSymbolObject("add", "f64"),
|
||||
0xa1: createSymbolObject("sub", "f64"),
|
||||
0xa2: createSymbolObject("mul", "f64"),
|
||||
0xa3: createSymbolObject("div", "f64"),
|
||||
0xa4: createSymbolObject("min", "f64"),
|
||||
0xa5: createSymbolObject("max", "f64"),
|
||||
0xa6: createSymbolObject("copysign", "f64"),
|
||||
0xa7: createSymbolObject("wrap/i64", "i32"),
|
||||
0xa8: createSymbolObject("trunc_s/f32", "i32"),
|
||||
0xa9: createSymbolObject("trunc_u/f32", "i32"),
|
||||
0xaa: createSymbolObject("trunc_s/f64", "i32"),
|
||||
0xab: createSymbolObject("trunc_u/f64", "i32"),
|
||||
0xac: createSymbolObject("extend_s/i32", "i64"),
|
||||
0xad: createSymbolObject("extend_u/i32", "i64"),
|
||||
0xae: createSymbolObject("trunc_s/f32", "i64"),
|
||||
0xaf: createSymbolObject("trunc_u/f32", "i64"),
|
||||
0xb0: createSymbolObject("trunc_s/f64", "i64"),
|
||||
0xb1: createSymbolObject("trunc_u/f64", "i64"),
|
||||
0xb2: createSymbolObject("convert_s/i32", "f32"),
|
||||
0xb3: createSymbolObject("convert_u/i32", "f32"),
|
||||
0xb4: createSymbolObject("convert_s/i64", "f32"),
|
||||
0xb5: createSymbolObject("convert_u/i64", "f32"),
|
||||
0xb6: createSymbolObject("demote/f64", "f32"),
|
||||
0xb7: createSymbolObject("convert_s/i32", "f64"),
|
||||
0xb8: createSymbolObject("convert_u/i32", "f64"),
|
||||
0xb9: createSymbolObject("convert_s/i64", "f64"),
|
||||
0xba: createSymbolObject("convert_u/i64", "f64"),
|
||||
0xbb: createSymbolObject("promote/f32", "f64"),
|
||||
0xbc: createSymbolObject("reinterpret/f32", "i32"),
|
||||
0xbd: createSymbolObject("reinterpret/f64", "i64"),
|
||||
0xbe: createSymbolObject("reinterpret/i32", "f32"),
|
||||
0xbf: createSymbolObject("reinterpret/i64", "f64")
|
||||
};
|
||||
var symbolsByName = invertMap(symbolsByByte, function (obj) {
|
||||
if (typeof obj.object === "string") {
|
||||
return "".concat(obj.object, ".").concat(obj.name);
|
||||
}
|
||||
|
||||
return obj.name;
|
||||
});
|
||||
export default {
|
||||
symbolsByByte: symbolsByByte,
|
||||
sections: sections,
|
||||
magicModuleHeader: magicModuleHeader,
|
||||
moduleVersion: moduleVersion,
|
||||
types: types,
|
||||
valtypes: valtypes,
|
||||
exportTypes: exportTypes,
|
||||
blockTypes: blockTypes,
|
||||
tableTypes: tableTypes,
|
||||
globalTypes: globalTypes,
|
||||
importTypes: importTypes,
|
||||
valtypesByString: valtypesByString,
|
||||
globalTypesByString: globalTypesByString,
|
||||
exportTypesByName: exportTypesByName,
|
||||
symbolsByName: symbolsByName
|
||||
};
|
||||
export { getSectionForNode } from "./section";
|
||||
31
node_modules/@webassemblyjs/helper-wasm-bytecode/esm/section.js
generated
vendored
Normal file
31
node_modules/@webassemblyjs/helper-wasm-bytecode/esm/section.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
export function getSectionForNode(n) {
|
||||
switch (n.type) {
|
||||
case "ModuleImport":
|
||||
return "import";
|
||||
|
||||
case "CallInstruction":
|
||||
case "CallIndirectInstruction":
|
||||
case "Func":
|
||||
case "Instr":
|
||||
return "code";
|
||||
|
||||
case "ModuleExport":
|
||||
return "export";
|
||||
|
||||
case "Start":
|
||||
return "start";
|
||||
|
||||
case "TypeInstruction":
|
||||
return "type";
|
||||
|
||||
case "IndexInFuncSection":
|
||||
return "func";
|
||||
|
||||
case "Global":
|
||||
return "global";
|
||||
// No section
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
339
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
generated
vendored
Normal file
339
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "getSectionForNode", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _section.getSectionForNode;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _section = require("./section");
|
||||
|
||||
var illegalop = "illegal";
|
||||
var magicModuleHeader = [0x00, 0x61, 0x73, 0x6d];
|
||||
var moduleVersion = [0x01, 0x00, 0x00, 0x00];
|
||||
|
||||
function invertMap(obj) {
|
||||
var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) {
|
||||
return k;
|
||||
};
|
||||
var result = {};
|
||||
var keys = Object.keys(obj);
|
||||
|
||||
for (var i = 0, length = keys.length; i < length; i++) {
|
||||
result[keyModifierFn(obj[keys[i]])] = keys[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function createSymbolObject(name
|
||||
/*: string */
|
||||
, object
|
||||
/*: string */
|
||||
)
|
||||
/*: Symbol*/
|
||||
{
|
||||
var numberOfArgs
|
||||
/*: number*/
|
||||
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
return {
|
||||
name: name,
|
||||
object: object,
|
||||
numberOfArgs: numberOfArgs
|
||||
};
|
||||
}
|
||||
|
||||
function createSymbol(name
|
||||
/*: string */
|
||||
)
|
||||
/*: Symbol*/
|
||||
{
|
||||
var numberOfArgs
|
||||
/*: number*/
|
||||
= arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
return {
|
||||
name: name,
|
||||
numberOfArgs: numberOfArgs
|
||||
};
|
||||
}
|
||||
|
||||
var types = {
|
||||
func: 0x60,
|
||||
result: 0x40
|
||||
};
|
||||
var exportTypes = {
|
||||
0x00: "Func",
|
||||
0x01: "Table",
|
||||
0x02: "Mem",
|
||||
0x03: "Global"
|
||||
};
|
||||
var exportTypesByName = invertMap(exportTypes);
|
||||
var valtypes = {
|
||||
0x7f: "i32",
|
||||
0x7e: "i64",
|
||||
0x7d: "f32",
|
||||
0x7c: "f64",
|
||||
0x7b: "v128"
|
||||
};
|
||||
var valtypesByString = invertMap(valtypes);
|
||||
var tableTypes = {
|
||||
0x70: "anyfunc"
|
||||
};
|
||||
var blockTypes = Object.assign({}, valtypes, {
|
||||
// https://webassembly.github.io/spec/core/binary/types.html#binary-blocktype
|
||||
0x40: null,
|
||||
// https://webassembly.github.io/spec/core/binary/types.html#binary-valtype
|
||||
0x7f: "i32",
|
||||
0x7e: "i64",
|
||||
0x7d: "f32",
|
||||
0x7c: "f64"
|
||||
});
|
||||
var globalTypes = {
|
||||
0x00: "const",
|
||||
0x01: "var"
|
||||
};
|
||||
var globalTypesByString = invertMap(globalTypes);
|
||||
var importTypes = {
|
||||
0x00: "func",
|
||||
0x01: "table",
|
||||
0x02: "mem",
|
||||
0x03: "global"
|
||||
};
|
||||
var sections = {
|
||||
custom: 0,
|
||||
type: 1,
|
||||
import: 2,
|
||||
func: 3,
|
||||
table: 4,
|
||||
memory: 5,
|
||||
global: 6,
|
||||
export: 7,
|
||||
start: 8,
|
||||
element: 9,
|
||||
code: 10,
|
||||
data: 11
|
||||
};
|
||||
var symbolsByByte = {
|
||||
0x00: createSymbol("unreachable"),
|
||||
0x01: createSymbol("nop"),
|
||||
0x02: createSymbol("block"),
|
||||
0x03: createSymbol("loop"),
|
||||
0x04: createSymbol("if"),
|
||||
0x05: createSymbol("else"),
|
||||
0x06: illegalop,
|
||||
0x07: illegalop,
|
||||
0x08: illegalop,
|
||||
0x09: illegalop,
|
||||
0x0a: illegalop,
|
||||
0x0b: createSymbol("end"),
|
||||
0x0c: createSymbol("br", 1),
|
||||
0x0d: createSymbol("br_if", 1),
|
||||
0x0e: createSymbol("br_table"),
|
||||
0x0f: createSymbol("return"),
|
||||
0x10: createSymbol("call", 1),
|
||||
0x11: createSymbol("call_indirect", 2),
|
||||
0x12: illegalop,
|
||||
0x13: illegalop,
|
||||
0x14: illegalop,
|
||||
0x15: illegalop,
|
||||
0x16: illegalop,
|
||||
0x17: illegalop,
|
||||
0x18: illegalop,
|
||||
0x19: illegalop,
|
||||
0x1a: createSymbol("drop"),
|
||||
0x1b: createSymbol("select"),
|
||||
0x1c: illegalop,
|
||||
0x1d: illegalop,
|
||||
0x1e: illegalop,
|
||||
0x1f: illegalop,
|
||||
0x20: createSymbol("get_local", 1),
|
||||
0x21: createSymbol("set_local", 1),
|
||||
0x22: createSymbol("tee_local", 1),
|
||||
0x23: createSymbol("get_global", 1),
|
||||
0x24: createSymbol("set_global", 1),
|
||||
0x25: illegalop,
|
||||
0x26: illegalop,
|
||||
0x27: illegalop,
|
||||
0x28: createSymbolObject("load", "u32", 1),
|
||||
0x29: createSymbolObject("load", "u64", 1),
|
||||
0x2a: createSymbolObject("load", "f32", 1),
|
||||
0x2b: createSymbolObject("load", "f64", 1),
|
||||
0x2c: createSymbolObject("load8_s", "u32", 1),
|
||||
0x2d: createSymbolObject("load8_u", "u32", 1),
|
||||
0x2e: createSymbolObject("load16_s", "u32", 1),
|
||||
0x2f: createSymbolObject("load16_u", "u32", 1),
|
||||
0x30: createSymbolObject("load8_s", "u64", 1),
|
||||
0x31: createSymbolObject("load8_u", "u64", 1),
|
||||
0x32: createSymbolObject("load16_s", "u64", 1),
|
||||
0x33: createSymbolObject("load16_u", "u64", 1),
|
||||
0x34: createSymbolObject("load32_s", "u64", 1),
|
||||
0x35: createSymbolObject("load32_u", "u64", 1),
|
||||
0x36: createSymbolObject("store", "u32", 1),
|
||||
0x37: createSymbolObject("store", "u64", 1),
|
||||
0x38: createSymbolObject("store", "f32", 1),
|
||||
0x39: createSymbolObject("store", "f64", 1),
|
||||
0x3a: createSymbolObject("store8", "u32", 1),
|
||||
0x3b: createSymbolObject("store16", "u32", 1),
|
||||
0x3c: createSymbolObject("store8", "u64", 1),
|
||||
0x3d: createSymbolObject("store16", "u64", 1),
|
||||
0x3e: createSymbolObject("store32", "u64", 1),
|
||||
0x3f: createSymbolObject("current_memory"),
|
||||
0x40: createSymbolObject("grow_memory"),
|
||||
0x41: createSymbolObject("const", "i32", 1),
|
||||
0x42: createSymbolObject("const", "i64", 1),
|
||||
0x43: createSymbolObject("const", "f32", 1),
|
||||
0x44: createSymbolObject("const", "f64", 1),
|
||||
0x45: createSymbolObject("eqz", "i32"),
|
||||
0x46: createSymbolObject("eq", "i32"),
|
||||
0x47: createSymbolObject("ne", "i32"),
|
||||
0x48: createSymbolObject("lt_s", "i32"),
|
||||
0x49: createSymbolObject("lt_u", "i32"),
|
||||
0x4a: createSymbolObject("gt_s", "i32"),
|
||||
0x4b: createSymbolObject("gt_u", "i32"),
|
||||
0x4c: createSymbolObject("le_s", "i32"),
|
||||
0x4d: createSymbolObject("le_u", "i32"),
|
||||
0x4e: createSymbolObject("ge_s", "i32"),
|
||||
0x4f: createSymbolObject("ge_u", "i32"),
|
||||
0x50: createSymbolObject("eqz", "i64"),
|
||||
0x51: createSymbolObject("eq", "i64"),
|
||||
0x52: createSymbolObject("ne", "i64"),
|
||||
0x53: createSymbolObject("lt_s", "i64"),
|
||||
0x54: createSymbolObject("lt_u", "i64"),
|
||||
0x55: createSymbolObject("gt_s", "i64"),
|
||||
0x56: createSymbolObject("gt_u", "i64"),
|
||||
0x57: createSymbolObject("le_s", "i64"),
|
||||
0x58: createSymbolObject("le_u", "i64"),
|
||||
0x59: createSymbolObject("ge_s", "i64"),
|
||||
0x5a: createSymbolObject("ge_u", "i64"),
|
||||
0x5b: createSymbolObject("eq", "f32"),
|
||||
0x5c: createSymbolObject("ne", "f32"),
|
||||
0x5d: createSymbolObject("lt", "f32"),
|
||||
0x5e: createSymbolObject("gt", "f32"),
|
||||
0x5f: createSymbolObject("le", "f32"),
|
||||
0x60: createSymbolObject("ge", "f32"),
|
||||
0x61: createSymbolObject("eq", "f64"),
|
||||
0x62: createSymbolObject("ne", "f64"),
|
||||
0x63: createSymbolObject("lt", "f64"),
|
||||
0x64: createSymbolObject("gt", "f64"),
|
||||
0x65: createSymbolObject("le", "f64"),
|
||||
0x66: createSymbolObject("ge", "f64"),
|
||||
0x67: createSymbolObject("clz", "i32"),
|
||||
0x68: createSymbolObject("ctz", "i32"),
|
||||
0x69: createSymbolObject("popcnt", "i32"),
|
||||
0x6a: createSymbolObject("add", "i32"),
|
||||
0x6b: createSymbolObject("sub", "i32"),
|
||||
0x6c: createSymbolObject("mul", "i32"),
|
||||
0x6d: createSymbolObject("div_s", "i32"),
|
||||
0x6e: createSymbolObject("div_u", "i32"),
|
||||
0x6f: createSymbolObject("rem_s", "i32"),
|
||||
0x70: createSymbolObject("rem_u", "i32"),
|
||||
0x71: createSymbolObject("and", "i32"),
|
||||
0x72: createSymbolObject("or", "i32"),
|
||||
0x73: createSymbolObject("xor", "i32"),
|
||||
0x74: createSymbolObject("shl", "i32"),
|
||||
0x75: createSymbolObject("shr_s", "i32"),
|
||||
0x76: createSymbolObject("shr_u", "i32"),
|
||||
0x77: createSymbolObject("rotl", "i32"),
|
||||
0x78: createSymbolObject("rotr", "i32"),
|
||||
0x79: createSymbolObject("clz", "i64"),
|
||||
0x7a: createSymbolObject("ctz", "i64"),
|
||||
0x7b: createSymbolObject("popcnt", "i64"),
|
||||
0x7c: createSymbolObject("add", "i64"),
|
||||
0x7d: createSymbolObject("sub", "i64"),
|
||||
0x7e: createSymbolObject("mul", "i64"),
|
||||
0x7f: createSymbolObject("div_s", "i64"),
|
||||
0x80: createSymbolObject("div_u", "i64"),
|
||||
0x81: createSymbolObject("rem_s", "i64"),
|
||||
0x82: createSymbolObject("rem_u", "i64"),
|
||||
0x83: createSymbolObject("and", "i64"),
|
||||
0x84: createSymbolObject("or", "i64"),
|
||||
0x85: createSymbolObject("xor", "i64"),
|
||||
0x86: createSymbolObject("shl", "i64"),
|
||||
0x87: createSymbolObject("shr_s", "i64"),
|
||||
0x88: createSymbolObject("shr_u", "i64"),
|
||||
0x89: createSymbolObject("rotl", "i64"),
|
||||
0x8a: createSymbolObject("rotr", "i64"),
|
||||
0x8b: createSymbolObject("abs", "f32"),
|
||||
0x8c: createSymbolObject("neg", "f32"),
|
||||
0x8d: createSymbolObject("ceil", "f32"),
|
||||
0x8e: createSymbolObject("floor", "f32"),
|
||||
0x8f: createSymbolObject("trunc", "f32"),
|
||||
0x90: createSymbolObject("nearest", "f32"),
|
||||
0x91: createSymbolObject("sqrt", "f32"),
|
||||
0x92: createSymbolObject("add", "f32"),
|
||||
0x93: createSymbolObject("sub", "f32"),
|
||||
0x94: createSymbolObject("mul", "f32"),
|
||||
0x95: createSymbolObject("div", "f32"),
|
||||
0x96: createSymbolObject("min", "f32"),
|
||||
0x97: createSymbolObject("max", "f32"),
|
||||
0x98: createSymbolObject("copysign", "f32"),
|
||||
0x99: createSymbolObject("abs", "f64"),
|
||||
0x9a: createSymbolObject("neg", "f64"),
|
||||
0x9b: createSymbolObject("ceil", "f64"),
|
||||
0x9c: createSymbolObject("floor", "f64"),
|
||||
0x9d: createSymbolObject("trunc", "f64"),
|
||||
0x9e: createSymbolObject("nearest", "f64"),
|
||||
0x9f: createSymbolObject("sqrt", "f64"),
|
||||
0xa0: createSymbolObject("add", "f64"),
|
||||
0xa1: createSymbolObject("sub", "f64"),
|
||||
0xa2: createSymbolObject("mul", "f64"),
|
||||
0xa3: createSymbolObject("div", "f64"),
|
||||
0xa4: createSymbolObject("min", "f64"),
|
||||
0xa5: createSymbolObject("max", "f64"),
|
||||
0xa6: createSymbolObject("copysign", "f64"),
|
||||
0xa7: createSymbolObject("wrap/i64", "i32"),
|
||||
0xa8: createSymbolObject("trunc_s/f32", "i32"),
|
||||
0xa9: createSymbolObject("trunc_u/f32", "i32"),
|
||||
0xaa: createSymbolObject("trunc_s/f64", "i32"),
|
||||
0xab: createSymbolObject("trunc_u/f64", "i32"),
|
||||
0xac: createSymbolObject("extend_s/i32", "i64"),
|
||||
0xad: createSymbolObject("extend_u/i32", "i64"),
|
||||
0xae: createSymbolObject("trunc_s/f32", "i64"),
|
||||
0xaf: createSymbolObject("trunc_u/f32", "i64"),
|
||||
0xb0: createSymbolObject("trunc_s/f64", "i64"),
|
||||
0xb1: createSymbolObject("trunc_u/f64", "i64"),
|
||||
0xb2: createSymbolObject("convert_s/i32", "f32"),
|
||||
0xb3: createSymbolObject("convert_u/i32", "f32"),
|
||||
0xb4: createSymbolObject("convert_s/i64", "f32"),
|
||||
0xb5: createSymbolObject("convert_u/i64", "f32"),
|
||||
0xb6: createSymbolObject("demote/f64", "f32"),
|
||||
0xb7: createSymbolObject("convert_s/i32", "f64"),
|
||||
0xb8: createSymbolObject("convert_u/i32", "f64"),
|
||||
0xb9: createSymbolObject("convert_s/i64", "f64"),
|
||||
0xba: createSymbolObject("convert_u/i64", "f64"),
|
||||
0xbb: createSymbolObject("promote/f32", "f64"),
|
||||
0xbc: createSymbolObject("reinterpret/f32", "i32"),
|
||||
0xbd: createSymbolObject("reinterpret/f64", "i64"),
|
||||
0xbe: createSymbolObject("reinterpret/i32", "f32"),
|
||||
0xbf: createSymbolObject("reinterpret/i64", "f64")
|
||||
};
|
||||
var symbolsByName = invertMap(symbolsByByte, function (obj) {
|
||||
if (typeof obj.object === "string") {
|
||||
return "".concat(obj.object, ".").concat(obj.name);
|
||||
}
|
||||
|
||||
return obj.name;
|
||||
});
|
||||
var _default = {
|
||||
symbolsByByte: symbolsByByte,
|
||||
sections: sections,
|
||||
magicModuleHeader: magicModuleHeader,
|
||||
moduleVersion: moduleVersion,
|
||||
types: types,
|
||||
valtypes: valtypes,
|
||||
exportTypes: exportTypes,
|
||||
blockTypes: blockTypes,
|
||||
tableTypes: tableTypes,
|
||||
globalTypes: globalTypes,
|
||||
importTypes: importTypes,
|
||||
valtypesByString: valtypesByString,
|
||||
globalTypesByString: globalTypesByString,
|
||||
exportTypesByName: exportTypesByName,
|
||||
symbolsByName: symbolsByName
|
||||
};
|
||||
exports.default = _default;
|
||||
38
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js
generated
vendored
Normal file
38
node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getSectionForNode = getSectionForNode;
|
||||
|
||||
function getSectionForNode(n) {
|
||||
switch (n.type) {
|
||||
case "ModuleImport":
|
||||
return "import";
|
||||
|
||||
case "CallInstruction":
|
||||
case "CallIndirectInstruction":
|
||||
case "Func":
|
||||
case "Instr":
|
||||
return "code";
|
||||
|
||||
case "ModuleExport":
|
||||
return "export";
|
||||
|
||||
case "Start":
|
||||
return "start";
|
||||
|
||||
case "TypeInstruction":
|
||||
return "type";
|
||||
|
||||
case "IndexInFuncSection":
|
||||
return "func";
|
||||
|
||||
case "Global":
|
||||
return "global";
|
||||
// No section
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user