diff --git a/.eslintignore b/.eslintignore
index 1f981fe5e5..bb97247b6a 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,8 +1,7 @@
dist/
-docs/
lib/binaryen.js
lib/parse/index.js
-out/
+build/
raw/
tests/parser/
diff --git a/.eslintrc.js b/.eslintrc.cjs
similarity index 97%
rename from .eslintrc.js
rename to .eslintrc.cjs
index 24129405b9..3ba62e3992 100644
--- a/.eslintrc.js
+++ b/.eslintrc.cjs
@@ -1,3 +1,5 @@
+/* global module */
+
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
@@ -15,9 +17,14 @@ module.exports = {
ecmaFeatures: {}
},
globals: {
+ "globalThis": "readonly",
"BigInt64Array": "readonly",
"BigUint64Array": "readonly",
- "__non_webpack_require__": "readonly"
+ "WebAssembly": "readonly",
+ "FinalizationRegistry": "readonly",
+ "fetch": "readonly",
+ "URL": "readonly",
+ "console": "readonly"
},
// === General rules =========================================================
@@ -218,8 +225,7 @@ module.exports = {
{
files: [
- "./index.d.ts",
- "./index.release.d.ts",
+ "./dist/*.d.ts"
],
rules: {
// Our definitions are complicated, and all attempts to describe them
diff --git a/.gitattributes b/.gitattributes
index b817804567..219d8546ed 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,5 +1,6 @@
bin/* text eol=lf
dist/* binary
scripts/*.sh eol=lf
-lib/binaryen.js binary
tests/compiler/std/string-encoding.ts eol=lf
+src/bindings/js.ts eol=lf
+src/bindings/tsd.ts eol=lf
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index e29f68ecae..8e3cbb4925 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -47,6 +47,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
+ node ./scripts/prepublish
if [ $(node -pe "require('./package.json').version") != "0.0.0" ]; then
npx aspublish
fi
@@ -59,3 +60,4 @@ jobs:
npm publish --access public
fi
cd ../..
+ node ./scripts/prepublish --reset
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 48f1de832a..1d96735a6f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -20,12 +20,14 @@ jobs:
else
printf "\nOK: Distributions files have not been modified.\n";
fi
- test:
- name: "Compiler (Linux, node ${{ matrix.node_version }})"
- runs-on: ubuntu-latest
+ compiler:
+ name: "Compiler (${{ matrix.os }}, node ${{ matrix.node_version }})"
+ runs-on: ${{ matrix.os }}-latest
needs: check
strategy:
matrix:
+ os: ["ubuntu", "macos"]
+ # TODO: re-enable "windows", see https://github.com/npm/cli/issues/4234
node_version: ["current", "lts_latest"]
steps:
- uses: actions/checkout@v1.0.0
@@ -34,71 +36,19 @@ jobs:
node-version: ${{ matrix.node_version }}
- name: Install dependencies
run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
- - name: Check sources
- run: npm run check
- - name: Test sources
- run: npm test
- - name: Build distribution files
+ - name: Build
run: npm run build
- - name: Update entry file
- run: npm run prepare-ci
- - name: Test distribution
- run: npm test
- - name: Test browser build
- run: node tests/browser-asc
- # see: https://github.com/npm/cli/issues/4234
- # test-windows:
- # name: "Compiler (Windows, node current)"
- # runs-on: windows-latest
- # needs: check
- # steps:
- # - uses: actions/checkout@v1.0.0
- # - uses: dcodeIO/setup-node-nvm@master
- # with:
- # node-version: current
- # - name: Install dependencies
- # run: npm ci --no-audit
- # - name: Clean distribution files
- # run: npm run clean
- # - name: Test sources
- # run: npm test
- # - name: Build distribution files
- # run: npm run build
- # - name: Update entry file
- # run: npm run prepare-ci
- # - name: Test distribution
- # run: npm test
- # - name: Test browser build
- # run: node tests/browser-asc
- test-macos:
- name: "Compiler (MacOS, node current)"
- runs-on: macos-latest
- needs: check
- steps:
- - uses: actions/checkout@v1.0.0
- - uses: dcodeIO/setup-node-nvm@master
- with:
- node-version: current
- - name: Install dependencies
- run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
- - name: Test sources
- run: npm test
- - name: Build distribution files
- run: npm run build
- - name: Update entry file
- run: npm run prepare-ci
- - name: Test distribution
+ - name: Check
+ run: npm run check
+ - name: Test
run: npm test
- - name: Test browser build
- run: node tests/browser-asc
- test-bootstrap:
- name: "Compiler (Bootstrap)"
+ bootstrap:
+ name: "Bootstrap (${{ matrix.target }})"
runs-on: ubuntu-latest
needs: check
+ strategy:
+ matrix:
+ target: ["debug", "release"]
steps:
- uses: actions/checkout@v1.0.0
- uses: dcodeIO/setup-node-nvm@master
@@ -106,15 +56,13 @@ jobs:
node-version: current
- name: Install dependencies
run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
- - name: Bootstrap the compiler
- run: npm run bootstrap
- - name: Run compiler tests (untouched-bootstrap)
- run: npm run test:compiler -- --wasm out/assemblyscript.untouched-bootstrap.wasm
- - name: Run compiler tests (optimized-bootstrap)
- run: npm run test:compiler -- --wasm out/assemblyscript.optimized-bootstrap.wasm
- test-features:
+ - name: Build
+ run: npm run build
+ - name: Bootstrap
+ run: npm run bootstrap:${{ matrix.target }}
+ - name: Test
+ run: npm run test:compiler -- --wasm build/assemblyscript.${{ matrix.target }}-bootstrap.js
+ features:
name: "Features"
runs-on: ubuntu-latest
needs: check
@@ -126,14 +74,14 @@ jobs:
node-version: 18.0.0-v8-canary20211115037fd7ae8d
- name: Install dependencies
run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
+ - name: Build
+ run: npm run build
- name: Test experimental features
env:
- ASC_FEATURES: threads,reference-types,bigint-integration,gc
+ ASC_FEATURES: threads,reference-types,gc,exception-handling
run: |
- npm run test:compiler rt/flags features/js-bigint-integration features/reference-types features/threads std-wasi/process std-wasi/crypto
- test-runtimes:
+ npm run test:compiler features/threads features/reference-types features/gc features/exception-handling
+ runtimes:
name: "Runtimes"
runs-on: ubuntu-latest
needs: check
@@ -144,8 +92,8 @@ jobs:
node-version: current
- name: Install dependencies
run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
+ - name: Build
+ run: npm run build
- name: Test default allocator
run: |
cd tests/allocators/default
@@ -158,7 +106,7 @@ jobs:
npm run build
cd ..
npm test stub
- test-loader:
+ loader:
name: "Loader"
runs-on: ubuntu-latest
needs: check
@@ -169,8 +117,8 @@ jobs:
node-version: current
- name: Install dependencies
run: npm ci --no-audit
- - name: Clean distribution files
- run: npm run clean
+ - name: Build
+ run: npm run build
- name: Test the loader
run: |
cd lib/loader
diff --git a/.gitignore b/.gitignore
index 2efb8995ec..98a3ba835b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,11 @@
-npm-debug.*
-dist/
-docs/
node_modules/
-out/
+*debug.log
+dist/
+build/
raw/
.history
*.backup
.vscode
.idea
+cli/index.generated.js
+src/diagnosticMessages.generated.ts
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 9cd16c0d9e..0000000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
-
-[homepage]: https://contributor-covenant.org
-[version]: https://contributor-covenant.org/version/1/4/
diff --git a/README.md b/README.md
index 4f9c5d7d60..8e73885756 100644
--- a/README.md
+++ b/README.md
@@ -29,8 +29,25 @@
Thanks to our sponsors!
-Most of the core team members and most contributors do this open source work in their free time. If you use AssemblyScript for a serious task or plan to do so, and you'd like us to invest more time on it, please donate to our OpenCollective. By sponsoring this project, your logo will show up below. Thank you so much for your support!
+Most of the maintainers and contributors do this open source work in their free time. If you use AssemblyScript for a serious task or plan to do so, and you'd like us to invest more time on it, please donate to our OpenCollective. By sponsoring this project, your logo will show up below. Thank you so much for your support!
+
+## Development instructions
+
+A development environment can be set up by cloning the repository:
+
+```sh
+git clone https://github.com/AssemblyScript/assemblyscript.git
+cd assemblyscript
+npm install
+npm link
+```
+
+The link step is optional and makes the development instance available globally. The full process is documented as part of the repository:
+
+* [Compiler instructions](./src)
+* [Runtime instructions](./std/assembly/rt)
+* [Test instructions](./tests)
diff --git a/bin/asc b/bin/asc
deleted file mode 100755
index 0b08d513b4..0000000000
--- a/bin/asc
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env node
-
-const tailArgs = process.argv.indexOf("--");
-if (~tailArgs) {
- require("child_process").spawnSync(
- process.argv[0],
- process.argv.slice(tailArgs + 1).concat(
- process.argv.slice(1, tailArgs)
- ),
- { stdio: "inherit" }
- );
- return;
-}
-
-try { require("source-map-support").install(); } catch (e) {}
-
-const asc = module.exports = require("../cli/asc.js");
-if (/\basc$/.test(process.argv[1])) {
- asc.ready.then(() => process.exitCode = asc.main(process.argv.slice(2)));
-}
diff --git a/bin/asc.js b/bin/asc.js
new file mode 100644
index 0000000000..a5b6e1227b
--- /dev/null
+++ b/bin/asc.js
@@ -0,0 +1,33 @@
+#!/usr/bin/env node
+
+const [ nodePath, thisPath, ...args ] = process.argv;
+const nodeArgs = process.execArgv;
+
+const hasSourceMaps = nodeArgs.includes("--enable-source-maps");
+const posCustomArgs = args.indexOf("--");
+const isDeno = typeof Deno !== "undefined";
+
+if (isDeno) {
+ process.on = function() { /* suppress 'not implemented' message */ };
+}
+
+if ((!hasSourceMaps || ~posCustomArgs) && !isDeno) {
+ if (!hasSourceMaps) {
+ nodeArgs.push("--enable-source-maps");
+ }
+ if (~posCustomArgs) {
+ nodeArgs.push(...args.slice(posCustomArgs + 1));
+ args.length = posCustomArgs;
+ }
+ (await import("child_process")).spawnSync(
+ nodePath,
+ [...nodeArgs, thisPath, ...args],
+ { stdio: "inherit" }
+ );
+} else {
+ const { error } = (await import("../dist/asc.js")).main(process.argv.slice(2), {
+ stdout: process.stdout,
+ stderr: process.stderr
+ });
+ if (error) process.exitCode = 1;
+}
diff --git a/bin/asinit b/bin/asinit.js
old mode 100755
new mode 100644
similarity index 52%
rename from bin/asinit
rename to bin/asinit.js
index 9b38303e2f..5023e5c09a
--- a/bin/asinit
+++ b/bin/asinit.js
@@ -1,10 +1,15 @@
#!/usr/bin/env node
-const fs = require("fs");
-const path = require("path");
-const colors = require("../cli/util/colors");
-const version = require("../package.json").version;
-const options = require("../cli/util/options");
+import fs from "fs";
+import path from "path";
+import { createRequire } from "module";
+import { fileURLToPath } from "url";
+import { stdoutColors } from "../util/terminal.js";
+import * as optionsUtil from "../util/options.js";
+
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+const require = createRequire(import.meta.url);
+const version = require("../package.json").version; // TODO
const npmDefaultTest = "echo \"Error: no test specified\" && exit 1";
@@ -38,50 +43,44 @@ if (typeof process.env.npm_config_user_agent === "string") {
const asinitOptions = {
"help": {
"category": "General",
- "description": "Prints a help message.",
+ "description": "Prints this help message.",
"type": "b",
"alias": "h"
},
"yes": {
"category": "General",
- "description": "Answers all questions with their default option for non-interactive usage.",
+ "description": [
+ "Answers all questions with their default option",
+ "for non-interactive usage."
+ ],
"type": "b",
"alias": "y"
- },
- "web": {
- "category": "General",
- "description": "Adds an index.html file that can load your module. (Disables node without --node/-n flag)",
- "type": "b",
- "alias": "w"
- },
- "node": {
- "category": "General",
- "description": "Re-enables node files when using the --web/-w flag",
- "type": "b",
- "alias": "n"
}
};
-const cliOptions = options.parse(process.argv.slice(2), asinitOptions);
+const cliOptions = optionsUtil.parse(process.argv.slice(2), asinitOptions);
if (cliOptions.options.help || cliOptions.arguments.length === 0) printHelp();
-const useWeb = cliOptions.options.web;
-const useNode = cliOptions.options.node || !useWeb;
-
function printHelp() {
console.log([
"Sets up a new AssemblyScript project or updates an existing one.",
- "For example, to create a new project in the current directory:",
"",
- " " + colors.cyan("asinit") + " .",
+ stdoutColors.white("SYNTAX"),
+ " " + stdoutColors.cyan("asinit") + " directory [options]",
+ "",
+ stdoutColors.white("EXAMPLES"),
+ " " + stdoutColors.cyan("asinit") + " .",
+ " " + stdoutColors.cyan("asinit") + " ./newProject -y",
+ "",
+ stdoutColors.white("OPTIONS"),
+ optionsUtil.help(asinitOptions, { noCategories: true })
].join("\n"));
process.exit(0);
}
+const compilerDir = path.join(dirname, "..");
const projectDir = path.resolve(cliOptions.arguments[0]);
-const compilerDir = path.join(__dirname, "..");
-const compilerVersion = require(path.join(compilerDir, "package.json")).version;
const assemblyDir = path.join(projectDir, "assembly");
const tsconfigFile = path.join(assemblyDir, "tsconfig.json");
const asconfigFile = path.join(projectDir, "asconfig.json");
@@ -96,43 +95,31 @@ const testsDir = path.join(projectDir, "tests");
const gitignoreFile = path.join(buildDir, ".gitignore");
const packageFile = path.join(projectDir, "package.json");
-const indexHtml = path.join(projectDir, "index.html");
-const indexFile = path.join(projectDir, "index.js");
+const indexHtmlFile = path.join(projectDir, "index.html");
const testsIndexFile = path.join(testsDir, "index.js");
-const basePaths = [
+const paths = [
[assemblyDir, "Directory holding the AssemblyScript sources being compiled to WebAssembly."],
[tsconfigFile, "TypeScript configuration inheriting recommended AssemblyScript settings."],
[entryFile, "Example entry file being compiled to WebAssembly to get you started."],
[buildDir, "Build artifact directory where compiled WebAssembly files are stored."],
[gitignoreFile, "Git configuration that excludes compiled binaries from source control."],
[asconfigFile, "Configuration file defining both a 'debug' and a 'release' target."],
- [packageFile, "Package info containing the necessary commands to compile to WebAssembly."]
+ [packageFile, "Package info containing the necessary commands to compile to WebAssembly."],
+ [testsIndexFile, "Stater test to check that the module is functioning."],
+ [indexHtmlFile, "Starter HTML file that loads the module in a browser."]
];
-const nodePaths = [
- [indexFile, "Main file loading the WebAssembly module and exporting its exports."],
- [testsIndexFile, "Example test to check that your module is indeed working."]
-];
-
-const webPaths = [
- [indexHtml, "Starter HTML file that loads your module."]
-];
-
-const paths = basePaths;
-if (useNode) Array.prototype.push.apply(paths, nodePaths);
-if (useWeb) Array.prototype.push.apply(paths, webPaths);
-
const formatPath = filePath => "./" + path.relative(projectDir, filePath).replace(/\\/g, "/");
console.log([
"Version: " + version,
"",
- colors.white([
+ stdoutColors.white([
"This command will make sure that the following files exist in the project",
"directory '" + projectDir + "':"
].join("\n")),
- ...paths.map(([filePath, description]) => "\n " + colors.cyan(formatPath(filePath)) + "\n " + description),
+ ...paths.map(([filePath, description]) => "\n " + stdoutColors.cyan(formatPath(filePath)) + "\n " + description),
"",
"The command will try to update existing files to match the correct settings",
"for this instance of the compiler in '" + compilerDir + "'.",
@@ -153,57 +140,48 @@ function createProject(answer) {
ensureGitignore();
ensurePackageJson();
ensureAsconfigJson();
-
- if (useNode) {
- ensureIndexJs();
- ensureTestsDirectory();
- ensureTestsIndexJs();
- }
-
- if (useWeb) {
- ensureIndexHtml();
- }
+ ensureTestsDirectory();
+ ensureTestsIndexJs();
+ ensureIndexHtml();
console.log([
- colors.green("Done!"),
+ stdoutColors.green("Done!"),
"",
"Don't forget to install dependencies before you start:",
"",
- colors.white(" " + commands[pm].install),
+ stdoutColors.white(" " + commands[pm].install),
"",
- "To edit the entry file, open '" + colors.cyan("assembly/index.ts") + "' in your editor of choice.",
+ "To edit the entry file, open '" + stdoutColors.cyan("assembly/index.ts") + "' in your editor of choice.",
"Create as many additional files as necessary and use them as imports.",
"",
"To build the entry file to WebAssembly when you are ready, run:",
"",
- colors.white(" " + commands[pm].run + " asbuild"),
+ stdoutColors.white(" " + commands[pm].run + " asbuild"),
"",
"Running the command above creates the following binaries incl. their respective",
"text format representations and source maps:",
"",
- colors.cyan(" ./build/untouched.wasm"),
- colors.cyan(" ./build/untouched.wasm.map"),
- colors.cyan(" ./build/untouched.wat"),
+ stdoutColors.cyan(" ./build/debug.wasm"),
+ stdoutColors.cyan(" ./build/debug.wasm.map"),
+ stdoutColors.cyan(" ./build/debug.wat"),
"",
- " ^ The untouched WebAssembly module as generated by the compiler.",
+ " ^ The debuggable WebAssembly module as generated by the compiler.",
" This one matches your sources exactly, without any optimizations.",
"",
- colors.cyan(" ./build/optimized.wasm"),
- colors.cyan(" ./build/optimized.wasm.map"),
- colors.cyan(" ./build/optimized.wat"),
+ stdoutColors.cyan(" ./build/release.wasm"),
+ stdoutColors.cyan(" ./build/release.wasm.map"),
+ stdoutColors.cyan(" ./build/release.wat"),
"",
" ^ The optimized WebAssembly module using default optimization settings.",
- " You can change the optimization settings in '" + colors.cyan("package.json")+ "'.",
+ " You can change the optimization settings in '" + stdoutColors.cyan("package.json")+ "'.",
+ "",
+ "To run the tests, do:",
+ "",
+ stdoutColors.white(" " + commands[pm].test),
"",
- ...(useNode ? [
- "To run the tests, do:",
- "",
- colors.white(" " + commands[pm].test),
- ""
- ] : []),
"The AssemblyScript documentation covers all the details:",
"",
- " https://docs.assemblyscript.org",
+ " https://www.assemblyscript.org",
"",
"Have a nice day!"
].join("\n"));
@@ -216,7 +194,7 @@ if (cliOptions.options.yes) {
input: process.stdin,
output: process.stdout
});
- rl.question(colors.white("Do you want to proceed?") + " [Y/n] ", result => {
+ rl.question(stdoutColors.white("Do you want to proceed?") + " [Y/n] ", result => {
rl.close();
createProject(result);
});
@@ -226,9 +204,9 @@ function ensureProjectDirectory() {
console.log("- Making sure that the project directory exists...");
if (!fs.existsSync(projectDir)) {
fs.mkdirSync(projectDir);
- console.log(colors.green(" Created: ") + projectDir);
+ console.log(stdoutColors.green(" Created: ") + projectDir);
} else {
- console.log(colors.yellow(" Exists: ") + projectDir);
+ console.log(stdoutColors.yellow(" Exists: ") + projectDir);
}
console.log();
}
@@ -237,9 +215,9 @@ function ensureAssemblyDirectory() {
console.log("- Making sure that the 'assembly' directory exists...");
if (!fs.existsSync(assemblyDir)) {
fs.mkdirSync(assemblyDir);
- console.log(colors.green(" Created: ") + assemblyDir);
+ console.log(stdoutColors.green(" Created: ") + assemblyDir);
} else {
- console.log(colors.yellow(" Exists: ") + assemblyDir);
+ console.log(stdoutColors.yellow(" Exists: ") + assemblyDir);
}
console.log();
}
@@ -254,13 +232,13 @@ function ensureTsconfigJson() {
"./**/*.ts"
]
}, null, 2));
- console.log(colors.green(" Created: ") + tsconfigFile);
+ console.log(stdoutColors.green(" Created: ") + tsconfigFile);
} else {
let tsconfig = JSON.parse(fs.readFileSync(tsconfigFile, "utf8"));
tsconfig["extends"] = base;
fs.writeFileSync(tsconfigFile, JSON.stringify(tsconfig, null, 2));
- console.log(colors.green(" Updated: ") + tsconfigFile);
+ console.log(stdoutColors.green(" Updated: ") + tsconfigFile);
}
console.log();
}
@@ -271,16 +249,16 @@ function ensureAsconfigJson() {
fs.writeFileSync(asconfigFile, JSON.stringify({
targets: {
debug: {
- // -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug
- binaryFile: "build/untouched.wasm",
- textFile: "build/untouched.wat",
+ // -o build/debug.wasm -t build/debug.wat --sourceMap --debug
+ outFile: "build/debug.wasm",
+ textFile: "build/debug.wat",
sourceMap: true,
debug: true
},
release: {
- // -b build/optimized.wasm -t build/optimized.wat --sourceMap --optimize
- binaryFile: "build/optimized.wasm",
- textFile: "build/optimized.wat",
+ // -o build/release.wasm -t build/release.wat --sourceMap --optimize
+ outFile: "build/release.wasm",
+ textFile: "build/release.wat",
sourceMap: true,
optimizeLevel: 3,
shrinkLevel: 0,
@@ -288,11 +266,13 @@ function ensureAsconfigJson() {
noAssert: false
}
},
- options: {}
+ options: {
+ bindings: "esm"
+ }
}, null, 2));
- console.log(colors.green(" Created: ") + asconfigFile);
+ console.log(stdoutColors.green(" Created: ") + asconfigFile);
} else {
- console.log(colors.yellow(" Exists: ") + asconfigFile);
+ console.log(stdoutColors.yellow(" Exists: ") + asconfigFile);
}
console.log();
}
@@ -307,9 +287,9 @@ function ensureEntryFile() {
" return a + b;",
"}"
].join("\n") + "\n");
- console.log(colors.green(" Created: ") + entryFile);
+ console.log(stdoutColors.green(" Created: ") + entryFile);
} else {
- console.log(colors.yellow(" Exists: ") + entryFile);
+ console.log(stdoutColors.yellow(" Exists: ") + entryFile);
}
console.log();
}
@@ -318,9 +298,9 @@ function ensureBuildDirectory() {
console.log("- Making sure that the 'build' directory exists...");
if (!fs.existsSync(buildDir)) {
fs.mkdirSync(buildDir);
- console.log(colors.green(" Created: ") + buildDir);
+ console.log(stdoutColors.green(" Created: ") + buildDir);
} else {
- console.log(colors.yellow(" Exists: ") + buildDir);
+ console.log(stdoutColors.yellow(" Exists: ") + buildDir);
}
console.log();
}
@@ -329,13 +309,12 @@ function ensureGitignore() {
console.log("- Making sure that 'build/.gitignore' is set up...");
if (!fs.existsSync(gitignoreFile)) {
fs.writeFileSync(gitignoreFile, [
- "*.wasm",
- "*.wasm.map",
- "*.asm.js"
+ "*",
+ "!.gitignore"
].join("\n") + "\n");
- console.log(colors.green(" Created: ") + gitignoreFile);
+ console.log(stdoutColors.green(" Created: ") + gitignoreFile);
} else {
- console.log(colors.yellow(" Exists: ") + gitignoreFile);
+ console.log(stdoutColors.yellow(" Exists: ") + gitignoreFile);
}
console.log();
}
@@ -343,94 +322,86 @@ function ensureGitignore() {
function ensurePackageJson() {
console.log("- Making sure that 'package.json' contains the build commands...");
const entryPath = path.relative(projectDir, entryFile).replace(/\\/g, "/");
- const buildUntouched = "asc " + entryPath + " --target debug";
- const buildOptimized = "asc " + entryPath + " --target release";
- const buildAll = commands[pm].run + " asbuild:untouched && " + commands[pm].run + " asbuild:optimized";
+ const buildDebug = "asc " + entryPath + " --target debug";
+ const buildRelease = "asc " + entryPath + " --target release";
+ const buildAll = commands[pm].run + " asbuild:debug && " + commands[pm].run + " asbuild:release";
if (!fs.existsSync(packageFile)) {
fs.writeFileSync(packageFile, JSON.stringify({
+ "type": "module",
+ "exports": {
+ ".": {
+ "import": "./build/release.js",
+ "types": "./build/release.d.ts"
+ }
+ },
"scripts": {
- "asbuild:untouched": buildUntouched,
- "asbuild:optimized": buildOptimized,
+ "asbuild:debug": buildDebug,
+ "asbuild:release": buildRelease,
"asbuild": buildAll,
- ...(useNode && {"test": "node tests"})
+ "test": "node tests",
+ "start": "npx serve ."
},
- ...(useNode && {
- "dependencies": {
- "@assemblyscript/loader": "^" + compilerVersion
- }
- }),
"devDependencies": {
- "assemblyscript": "^" + compilerVersion
+ "assemblyscript": "^" + version
}
}, null, 2));
- console.log(colors.green(" Created: ") + packageFile);
+ console.log(stdoutColors.green(" Created: ") + packageFile);
} else {
let pkg = JSON.parse(fs.readFileSync(packageFile));
let scripts = pkg.scripts || {};
let updated = false;
+ if (!pkg["type"]) {
+ pkg["type"] = "module";
+ updated = true;
+ }
+ if (!pkg["exports"]) {
+ pkg["exports"] = {
+ ".": {
+ "import": "./build/release.js",
+ "types": "./build/release.d.ts"
+ }
+ };
+ }
if (!scripts["asbuild"]) {
- scripts["asbuild:untouched"] = buildUntouched;
- scripts["asbuild:optimized"] = buildOptimized;
+ scripts["asbuild:debug"] = buildDebug;
+ scripts["asbuild:release"] = buildRelease;
scripts["asbuild"] = buildAll;
pkg["scripts"] = scripts;
updated = true;
}
- if (!scripts["test"] || scripts["test"] == npmDefaultTest && useNode) {
+ if (!scripts["test"] || scripts["test"] == npmDefaultTest) {
scripts["test"] = "node tests";
pkg["scripts"] = scripts;
updated = true;
}
- let dependencies = pkg["dependencies"] || {};
- if (!dependencies["@assemblyscript/loader"] && useNode) {
- dependencies["@assemblyscript/loader"] = "^" + compilerVersion;
- pkg["dependencies"] = dependencies;
+ if (!scripts["start"]) {
+ scripts["start"] = "npx serve .",
+ pkg["scripts"] = scripts;
updated = true;
}
let devDependencies = pkg["devDependencies"] || {};
if (!devDependencies["assemblyscript"]) {
- devDependencies["assemblyscript"] = "^" + compilerVersion;
+ devDependencies["assemblyscript"] = "^" + version;
pkg["devDependencies"] = devDependencies;
updated = true;
}
if (updated) {
fs.writeFileSync(packageFile, JSON.stringify(pkg, null, 2));
- console.log(colors.green(" Updated: ") + packageFile);
+ console.log(stdoutColors.green(" Updated: ") + packageFile);
} else {
- console.log(colors.yellow(" Exists: ") + packageFile);
+ console.log(stdoutColors.yellow(" Exists: ") + packageFile);
}
}
console.log();
}
-function ensureIndexJs() {
- console.log("- Making sure that 'index.js' exists...");
- if (!fs.existsSync(indexFile)) {
- // since node.js v13.2.0 or v12.17.0 we can use ESM without flags
- const ver = process.versions.node.split('.');
- const maj = parseInt(ver[0]);
- const min = parseInt(ver[1]);
- const supportESM = maj >= 14 || (maj == 13 && min >= 2) || (maj == 12 && min >= 17);
- fs.writeFileSync(indexFile, [
- "const fs = require(\"fs\");",
- "const loader = require(\"@assemblyscript/loader" + (supportESM ? "" : "/umd") + "\");",
- "const imports = { /* imports go here */ };",
- "const wasmModule = loader.instantiateSync(fs.readFileSync(__dirname + \"/build/optimized.wasm\"), imports);",
- "module.exports = wasmModule.exports;"
- ].join("\n") + "\n");
- console.log(colors.green(" Created: ") + indexFile);
- } else {
- console.log(colors.yellow(" Exists: ") + indexFile);
- }
- console.log();
-}
-
function ensureTestsDirectory() {
console.log("- Making sure that the 'tests' directory exists...");
if (!fs.existsSync(testsDir)) {
fs.mkdirSync(testsDir);
- console.log(colors.green(" Created: ") + testsDir);
+ console.log(stdoutColors.green(" Created: ") + testsDir);
} else {
- console.log(colors.yellow(" Exists: ") + testsDir);
+ console.log(stdoutColors.yellow(" Exists: ") + testsDir);
}
console.log();
}
@@ -439,45 +410,36 @@ function ensureTestsIndexJs() {
console.log("- Making sure that 'tests/index.js' exists...");
if (!fs.existsSync(testsIndexFile)) {
fs.writeFileSync(testsIndexFile, [
- "const assert = require(\"assert\");",
- "const myModule = require(\"..\");",
- "assert.strictEqual(myModule.add(1, 2), 3);",
+ "import assert from \"assert\";",
+ "import { add } from \"../build/debug.js\";",
+ "assert.strictEqual(add(1, 2), 3);",
"console.log(\"ok\");"
].join("\n") + "\n");
- console.log(colors.green(" Created: ") + testsIndexFile);
+ console.log(stdoutColors.green(" Created: ") + testsIndexFile);
} else {
- console.log(colors.yellow(" Exists: ") + testsIndexFile);
+ console.log(stdoutColors.yellow(" Exists: ") + testsIndexFile);
}
console.log();
}
function ensureIndexHtml() {
console.log("- Making sure that 'index.html' exists...");
- if (!fs.existsSync(indexHtml)) {
- fs.writeFileSync(indexHtml, [
+ if (!fs.existsSync(indexHtmlFile)) {
+ fs.writeFileSync(indexHtmlFile, [
"",
"",
- " ",
- " ",
- " ",
- " ",
- " ",
+ "",
+ "",
+ "",
+ "",
"",
].join("\n") + "\n");
- console.log(colors.green(" Created: ") + indexHtml);
+ console.log(stdoutColors.green(" Created: ") + indexHtmlFile);
} else {
- console.log(colors.yellow(" Exists: ") + indexHtml);
+ console.log(stdoutColors.yellow(" Exists: ") + indexHtmlFile);
}
console.log();
-}
\ No newline at end of file
+}
diff --git a/cli/README.md b/cli/README.md
index 6033f60451..9e048005e3 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -1,5 +1,5 @@
-Compiler frontend for node.js
-=============================
+Frontend for Node.js
+====================
Usage
-----
@@ -13,41 +13,46 @@ $> asc --help
API
---
-The API accepts the same options as the CLI but also lets you override stdout and stderr and/or provide a callback. Example:
+The API accepts the same options as the CLI but also lets you override stdout and stderr. Example:
```js
-const asc = require("assemblyscript/cli/asc");
-asc.ready.then(() => {
- asc.main([
- "myModule.ts",
- "--binaryFile", "myModule.wasm",
- "--optimize",
- "--sourceMap",
- "--measure"
- ], {
- stdout: process.stdout,
- stderr: process.stderr
- }, function(err) {
- if (err)
- throw err;
- ...
- });
-});
+import asc from "assemblyscript/asc";
+
+const { error, stdout } = await asc.main([
+ "myModule.ts",
+ "--outFile", "myModule.wasm",
+ "--optimize",
+ "--sourceMap",
+ "--stats"
+]);
+if (error) {
+ console.log("Compilation failed: " + error.message);
+} else {
+ console.log(stdout.toString());
+}
```
-Available command line options can also be obtained programmatically:
+The result has the following structure:
+
+| Property | Description
+|----------|-------------
+| error | Encountered error, if any
+| stdout | Standard output stream
+| stderr | Standard error stream
+| stats | Statistics
+
+You can also compile a single source string directly (note that this API has limited functionality):
```js
-const options = require("assemblyscript/cli/asc.json");
+import asc from "assemblyscript/asc";
+const { binary, text, stdout, stderr } = await asc.compileString(`...`, { optimize: 2 });
...
```
-You can also compile a source string directly, for example in a browser environment:
+
+Available command line options can also be obtained programmatically:
```js
-const asc = require("assemblyscript/cli/asc");
-asc.ready.then(() => {
- const { binary, text, stdout, stderr } = asc.compileString(`...`, { optimize: 2 });
-});
+import { options } from "assemblyscript/asc";
...
```
diff --git a/cli/asc.js b/cli/asc.js
deleted file mode 100644
index 3c47266c2a..0000000000
--- a/cli/asc.js
+++ /dev/null
@@ -1,1532 +0,0 @@
-/**
- * @license
- * Copyright 2020 Daniel Wirtz / The AssemblyScript Authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * @fileoverview Compiler frontend for node.js
- *
- * Uses the low-level API exported from src/index.ts so it works with the compiler compiled to
- * JavaScript as well as the compiler compiled to WebAssembly (eventually). Runs the sources
- * directly through ts-node if distribution files are not present.
- *
- * Can also be packaged as a bundle suitable for in-browser use with the standard library injected
- * in the build step. See dist/asc.js for the bundle and webpack.config.js for building details.
- */
-
-/* global BUNDLE_VERSION, BUNDLE_LIBRARY, BUNDLE_DEFINITIONS */
-
-const fs = require("fs");
-const path = require("path");
-const process = require("process"); // ensure shim
-const utf8 = require("./util/utf8");
-const colorsUtil = require("./util/colors");
-const optionsUtil = require("./util/options");
-const mkdirp = require("./util/mkdirp");
-const find = require("./util/find");
-const binaryen = global.binaryen || (global.binaryen = require("binaryen"));
-
-const dynrequire = typeof __webpack_require__ === "function"
- ? __non_webpack_require__
- : require;
-
-const WIN = process.platform === "win32";
-const EOL = WIN ? "\r\n" : "\n";
-const SEP = WIN ? "\\" : "/";
-
-function toUpperSnakeCase(str) {
- return str.replace(/-/g, "_").toUpperCase();
-}
-
-// Sets up an extension with its definition counterpart and relevant regexes.
-function setupExtension(ext) {
- if (!ext.startsWith(".")) ext = `.${ext}`;
- return {
- ext,
- ext_d: `.d${ext}`,
- re: new RegExp("\\" + ext + "$"),
- re_d: new RegExp("\\.d\\" + ext + "$"),
- re_except_d: new RegExp("^(?!.*\\.d\\" + ext + "$).*\\" + ext + "$"),
- re_index: new RegExp("(?:^|[\\\\\\/])index\\" + ext + "$")
- };
-}
-
-const defaultExtension = setupExtension(".ts");
-
-// Proxy Binaryen's ready event
-Object.defineProperty(exports, "ready", {
- get() { return binaryen.ready; }
-});
-
-// Emscripten adds an `uncaughtException` listener to Binaryen that results in an additional
-// useless code fragment on top of an actual error. suppress this:
-if (process.removeAllListeners) {
- process.removeAllListeners("uncaughtException");
-}
-
-// Use distribution files if present, otherwise run the sources directly.
-function loadAssemblyScriptJS() {
- var exports, tsNode;
- try {
- // note that this case will always trigger in recent node.js versions for typical installs
- // see: https://nodejs.org/api/packages.html#packages_self_referencing_a_package_using_its_name
- exports = require("assemblyscript");
- } catch (e) {
- try { // `asc` on the command line (unnecessary in recent node)
- exports = dynrequire("../dist/assemblyscript.js");
- } catch (e) {
- try { // `asc` on the command line without dist files (unnecessary in recent node)
- tsNode = dynrequire("ts-node");
- tsNode.register({
- project: path.join(__dirname, "..", "src", "tsconfig.json"),
- typeCheck: false,
- transpileOnly: true,
- compilerHost: true,
- files: true,
- skipIgnore: true,
- moduleTypes: {
- "../src/glue/js/*": "cjs"
- },
- compilerOptions: {
- module: "esnext",
- target: "es2017"
- }
- });
- dynrequire("../src/glue/js");
- exports = dynrequire("../src");
- } catch (e_ts) {
- if (!tsNode || !(e_ts instanceof tsNode.TSError)) {
- try { // `require("dist/asc.js")` in explicit browser tests
- exports = dynrequire("./assemblyscript");
- } catch (e) {
- throw Error(`${e_ts.stack}\n---\n${e.stack}`);
- }
- } else {
- throw e_ts;
- }
- }
- }
- }
- return exports;
-}
-
-// Loads the specified bootstrapped Wasm binary of the compiler.
-function loadAssemblyScriptWasm(binaryPath) {
- const loader = require("../lib/loader/umd/index");
- const rtrace = new (require("../lib/rtrace/umd/index").Rtrace)({
- onerror(err, info) {
- console.log(err, info);
- },
- getMemory() {
- return exports.memory;
- },
- oncollect() {
- var gcProfile = rtrace.gcProfile;
- if (gcProfile && gcProfile.length && fs.writeFileSync) {
- let timestamp = Date.now();
- fs.writeFileSync(
- `rtrace-gc-profile-${timestamp}.json`,
- JSON.stringify(gcProfile)
- );
- fs.writeFileSync(
- `rtrace-gc-profile-${timestamp}.csv`,
- `time,memory,pause\n${gcProfile.join("\n")}`
- );
- }
- }
- });
- var { exports } = loader.instantiateSync(fs.readFileSync(binaryPath), rtrace.install({ binaryen }));
- if (exports._start) exports._start();
- return exports;
-}
-
-/** Ensures that an object is a wrapper class instead of just a pointer. */
-function __wrap(ptrOrObj, wrapperClass) {
- if (typeof ptrOrObj === "number") {
- return ptrOrObj === 0 ? null : wrapperClass.wrap(ptrOrObj);
- }
- return ptrOrObj;
-}
-
-var assemblyscript, __newString, __getString, __pin, __unpin, __collect;
-
-function loadAssemblyScript() {
- const wasmArg = process.argv.findIndex(arg => arg == "--wasm");
- if (~wasmArg) {
- let binaryPath = process.argv[wasmArg + 1];
- process.argv.splice(wasmArg, 2);
- assemblyscript = loadAssemblyScriptWasm(binaryPath);
- __newString = assemblyscript.__newString;
- __getString = assemblyscript.__getString;
- __pin = assemblyscript.__pin;
- __unpin = assemblyscript.__unpin;
- __collect = assemblyscript.__collect;
- } else {
- assemblyscript = loadAssemblyScriptJS();
- __newString = str => str;
- __getString = ptr => ptr;
- __pin = ptr => ptr;
- __unpin = _ => undefined;
- __collect = _ => undefined;
- }
-}
-loadAssemblyScript();
-
-/** Whether this is a webpack bundle or not. */
-exports.isBundle = typeof BUNDLE_VERSION === "string";
-
-/** AssemblyScript version. */
-exports.version = exports.isBundle ? BUNDLE_VERSION : dynrequire("../package.json").version;
-
-/** Available CLI options. */
-exports.options = require("./asc.json");
-
-/** Prefix used for library files. */
-exports.libraryPrefix = __getString(assemblyscript.LIBRARY_PREFIX.valueOf());
-
-/** Default Binaryen optimization level. */
-exports.defaultOptimizeLevel = 3;
-
-/** Default Binaryen shrink level. */
-exports.defaultShrinkLevel = 0;
-
-/** Bundled library files. */
-exports.libraryFiles = exports.isBundle ? BUNDLE_LIBRARY : (() => { // set up if not a bundle
- const libDir = path.join(__dirname, "..", "std", "assembly");
- const bundled = {};
- find
- .files(libDir, defaultExtension.re_except_d)
- .forEach(file => {
- bundled[file.replace(defaultExtension.re, "")] = fs.readFileSync(path.join(libDir, file), "utf8");
- });
- return bundled;
-})();
-
-/** Bundled definition files. */
-exports.definitionFiles = exports.isBundle ? BUNDLE_DEFINITIONS : (() => { // set up if not a bundle
- const readDefinition = name => fs.readFileSync(
- path.join(__dirname, "..", "std", name, `index${defaultExtension.ext_d}`),
- "utf8"
- );
- return {
- assembly: readDefinition("assembly"),
- portable: readDefinition("portable")
- };
-})();
-
-/** Convenience function that parses and compiles source strings directly. */
-exports.compileString = (sources, options) => {
- if (typeof sources === "string") sources = { [`input${defaultExtension.ext}`]: sources };
- const output = Object.create({
- stdout: createMemoryStream(),
- stderr: createMemoryStream()
- });
- var argv = [
- "--binaryFile", "binary",
- "--textFile", "text",
- ];
- Object.keys(options || {}).forEach(key => {
- var val = options[key];
- var opt = exports.options[key];
- if (opt && opt.type === "b") {
- if (val) argv.push(`--${key}`);
- } else {
- if (Array.isArray(val)) {
- val.forEach(val => { argv.push(`--${key}`, String(val)); });
- }
- else argv.push(`--${key}`, String(val));
- }
- });
- exports.main(argv.concat(Object.keys(sources)), {
- stdout: output.stdout,
- stderr: output.stderr,
- readFile: name => Object.prototype.hasOwnProperty.call(sources, name) ? sources[name] : null,
- writeFile: (name, contents) => { output[name] = contents; },
- listFiles: () => []
- });
- return output;
-};
-
-/** Runs the command line utility using the specified arguments array. */
-exports.main = function main(argv, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- } else if (!options) {
- options = {};
- }
-
- // Bundle semantic version
- let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0;
- const versionParts = (exports.version || "").split(".");
- if (versionParts.length === 3) {
- bundleMajorVersion = parseInt(versionParts[0]) | 0;
- bundleMinorVersion = parseInt(versionParts[1]) | 0;
- bundlePatchVersion = parseInt(versionParts[2]) | 0;
- }
-
- const stdout = options.stdout || process.stdout;
- const stderr = options.stderr || process.stderr;
- const readFile = options.readFile || readFileNode;
- const writeFile = options.writeFile || writeFileNode;
- const listFiles = options.listFiles || listFilesNode;
- const stats = options.stats || createStats();
- let extension = defaultExtension;
-
- // Output must be specified if not present in the environment
- if (!stdout) throw Error("'options.stdout' must be specified");
- if (!stderr) throw Error("'options.stderr' must be specified");
-
- // Parse command line options but do not populate option defaults yet
- const optionsResult = optionsUtil.parse(argv, exports.options, false);
- let opts = optionsResult.options;
- argv = optionsResult.arguments;
-
- if (opts.noColors) {
- colorsUtil.stdout.supported =
- colorsUtil.stderr.supported = false;
- } else {
- colorsUtil.stdout = colorsUtil.from(stdout);
- colorsUtil.stderr = colorsUtil.from(stderr);
- }
-
- // Check for unknown options
- const unknownOpts = optionsResult.unknown;
- if (unknownOpts.length) {
- unknownOpts.forEach(arg => {
- stderr.write(
- `${colorsUtil.stderr.yellow("WARNING ")}Unknown option '${arg}'%{EOL}`
- );
- });
- }
-
- // Check for trailing arguments
- const trailingArgv = optionsResult.trailing;
- if (trailingArgv.length) {
- stderr.write(
- `${colorsUtil.stderr.yellow("WARNING ")}Unsupported trailing arguments: ${trailingArgv.join(" ")}${EOL}`
- );
- }
-
- // Use default callback if none is provided
- if (!callback) callback = function defaultCallback(err) {
- var code = 0;
- if (err) {
- stderr.write(`${colorsUtil.stderr.red("FAILURE ")}${err.stack.replace(/^ERROR: /i, "")}${EOL}`);
- code = 1;
- }
- return code;
- };
-
- // Just print the version if requested
- if (opts.version) {
- stdout.write(`Version ${exports.version}${EOL}`);
- return callback(null);
- }
-
- // Use another extension if requested
- if (typeof opts.extension === "string") {
- if (/^\.?[0-9a-zA-Z]{1,14}$/.test(opts.extension)) {
- extension = setupExtension(opts.extension);
- } else {
- return callback(Error(`Invalid extension: ${opts.extension}`));
- }
- }
-
- // Set up base directory
- const baseDir = path.normalize(opts.baseDir || ".");
-
- // Check if a config file is present
- let asconfigPath = optionsUtil.resolvePath(opts.config || "asconfig.json", baseDir);
- let asconfigFile = path.basename(asconfigPath);
- let asconfigDir = path.dirname(asconfigPath);
- let asconfig = getAsconfig(asconfigFile, asconfigDir, readFile);
- let asconfigHasEntries = asconfig != null && Array.isArray(asconfig.entries) && asconfig.entries.length;
-
- // Print the help message if requested or no source files are provided
- if (opts.help || (!argv.length && !asconfigHasEntries)) {
- var out = opts.help ? stdout : stderr;
- var color = opts.help ? colorsUtil.stdout : colorsUtil.stderr;
- out.write([
- color.white("SYNTAX"),
- " " + color.cyan("asc") + " [entryFile ...] [options]",
- "",
- color.white("EXAMPLES"),
- " " + color.cyan("asc") + " hello" + extension.ext,
- " " + color.cyan("asc") + " hello" + extension.ext + " -b hello.wasm -t hello.wat",
- " " + color.cyan("asc") + " hello1" + extension.ext + " hello2" + extension.ext + " -b -O > hello.wasm",
- " " + color.cyan("asc") + " --config asconfig.json --target release",
- "",
- color.white("OPTIONS"),
- ].concat(
- optionsUtil.help(exports.options, 24, EOL)
- ).join(EOL) + EOL);
- return callback(null);
- }
-
- // I/O must be specified if not present in the environment
- if (!fs.readFileSync) {
- if (readFile === readFileNode) throw Error("'options.readFile' must be specified");
- if (writeFile === writeFileNode) throw Error("'options.writeFile' must be specified");
- if (listFiles === listFilesNode) throw Error("'options.listFiles' must be specified");
- }
-
- // Load additional options from asconfig.json
- const seenAsconfig = new Set();
- seenAsconfig.add(asconfigPath);
- const target = opts.target || "release";
- while (asconfig) {
- // Merge target first
- if (asconfig.targets) {
- const targetOptions = asconfig.targets[target];
- if (targetOptions) {
- opts = optionsUtil.merge(exports.options, opts, targetOptions, asconfigDir);
- }
- }
- // Merge general options
- const generalOptions = asconfig.options;
- if (generalOptions) {
- opts = optionsUtil.merge(exports.options, opts, generalOptions, asconfigDir);
- }
-
- // Append entries
- if (asconfig.entries) {
- for (let entry of asconfig.entries) {
- argv.push(optionsUtil.resolvePath(entry, asconfigDir));
- }
- }
-
- // Look up extended asconfig and repeat
- if (asconfig.extends) {
- asconfigPath = optionsUtil.resolvePath(asconfig.extends, asconfigDir, true);
- asconfigFile = path.basename(asconfigPath);
- asconfigDir = path.dirname(asconfigPath);
- if (seenAsconfig.has(asconfigPath)) break;
- seenAsconfig.add(asconfigPath);
- asconfig = getAsconfig(asconfigFile, asconfigDir, readFile);
- } else {
- break;
- }
- }
-
- // Populate option defaults once user-defined options are set
- optionsUtil.addDefaults(exports.options, opts);
-
- // If showConfig print options and exit
- if (opts.showConfig) {
- stderr.write(JSON.stringify({
- options: opts,
- entries: argv
- }, null, 2));
- return callback(null);
- }
-
- // create a unique set of values
- function unique(values) {
- return [...new Set(values)];
- }
-
- // Set up options
- var program, runtime;
- const compilerOptions = __pin(assemblyscript.newOptions());
- switch (opts.runtime) {
- case "stub": runtime = 0; break;
- case "minimal": runtime = 1; break;
- default: runtime = 2; break;
- }
- assemblyscript.setTarget(compilerOptions, 0);
- assemblyscript.setRuntime(compilerOptions, runtime);
- assemblyscript.setNoAssert(compilerOptions, opts.noAssert);
- assemblyscript.setExportMemory(compilerOptions, !opts.noExportMemory);
- assemblyscript.setImportMemory(compilerOptions, opts.importMemory);
- assemblyscript.setInitialMemory(compilerOptions, opts.initialMemory >>> 0);
- assemblyscript.setMaximumMemory(compilerOptions, opts.maximumMemory >>> 0);
- assemblyscript.setSharedMemory(compilerOptions, opts.sharedMemory);
- assemblyscript.setImportTable(compilerOptions, opts.importTable);
- assemblyscript.setExportTable(compilerOptions, opts.exportTable);
- assemblyscript.setExplicitStart(compilerOptions, opts.explicitStart);
- assemblyscript.setMemoryBase(compilerOptions, opts.memoryBase >>> 0);
- assemblyscript.setTableBase(compilerOptions, opts.tableBase >>> 0);
- assemblyscript.setSourceMap(compilerOptions, opts.sourceMap != null);
- assemblyscript.setNoUnsafe(compilerOptions, opts.noUnsafe);
- assemblyscript.setPedantic(compilerOptions, opts.pedantic);
- assemblyscript.setLowMemoryLimit(compilerOptions, opts.lowMemoryLimit >>> 0);
- assemblyscript.setExportRuntime(compilerOptions, opts.exportRuntime);
- assemblyscript.setBundleVersion(compilerOptions, bundleMajorVersion, bundleMinorVersion, bundlePatchVersion);
- if (!opts.stackSize && opts.runtime == "incremental") {
- opts.stackSize = assemblyscript.DEFAULT_STACK_SIZE;
- }
- assemblyscript.setStackSize(compilerOptions, opts.stackSize);
-
- // Instrument callback to perform GC
- callback = (function(callback) {
- return function wrappedCallback(err) {
- __unpin(compilerOptions);
- if (program) __unpin(program);
- __collect();
- return callback(err);
- };
- })(callback);
-
- // Add or override aliases if specified
- if (opts.use) {
- let aliases = opts.use;
- for (let i = 0, k = aliases.length; i < k; ++i) {
- let part = aliases[i];
- let p = part.indexOf("=");
- if (p < 0) return callback(Error(`Global alias '${part}' is invalid.`));
- let alias = part.substring(0, p).trim();
- let name = part.substring(p + 1).trim();
- if (!alias.length) {
- return callback(Error(`Global alias '${part}' is invalid.`));
- }
- {
- let aliasPtr = __pin(__newString(alias));
- let namePtr = __newString(name);
- assemblyscript.setGlobalAlias(compilerOptions, aliasPtr, namePtr);
- __unpin(aliasPtr);
- }
- }
- }
-
- // Disable default features if specified
- var features;
- if ((features = opts.disable) != null) {
- if (typeof features === "string") features = features.split(",");
- for (let i = 0, k = features.length; i < k; ++i) {
- let name = features[i].trim();
- let flag = assemblyscript[`FEATURE_${toUpperSnakeCase(name)}`];
- if (!flag) return callback(Error(`Feature '${name}' is unknown.`));
- assemblyscript.disableFeature(compilerOptions, flag);
- }
- }
-
- // Enable experimental features if specified
- if ((features = opts.enable) != null) {
- if (typeof features === "string") features = features.split(",");
- for (let i = 0, k = features.length; i < k; ++i) {
- let name = features[i].trim();
- let flag = assemblyscript[`FEATURE_${toUpperSnakeCase(name)}`];
- if (!flag) return callback(Error(`Feature '${name}' is unknown.`));
- assemblyscript.enableFeature(compilerOptions, flag);
- }
- }
-
- // Set up optimization levels
- var optimizeLevel = 0;
- var shrinkLevel = 0;
- if (opts.optimize) {
- optimizeLevel = exports.defaultOptimizeLevel;
- shrinkLevel = exports.defaultShrinkLevel;
- }
- if (typeof opts.optimizeLevel === "number") optimizeLevel = opts.optimizeLevel;
- if (typeof opts.shrinkLevel === "number") shrinkLevel = opts.shrinkLevel;
- optimizeLevel = Math.min(Math.max(optimizeLevel, 0), 3);
- shrinkLevel = Math.min(Math.max(shrinkLevel, 0), 2);
- assemblyscript.setOptimizeLevelHints(compilerOptions, optimizeLevel, shrinkLevel);
-
- // Initialize the program
- program = __pin(assemblyscript.newProgram(compilerOptions));
-
- // Collect transforms *constructors* from the `--transform` CLI flag as well
- // as the `transform` option into the `transforms` array.
- let transforms = [];
- // `transform` option from `main()`
- if (Array.isArray(options.transforms)) {
- transforms.push(...options.transforms);
- }
- // `--transform` CLI flag
- if (opts.transform) {
- let tsNodeRegistered = false;
- let transformArgs = unique(opts.transform);
- for (let i = 0, k = transformArgs.length; i < k; ++i) {
- let filename = transformArgs[i].trim();
- if (!tsNodeRegistered && filename.endsWith(".ts")) { // ts-node requires .ts specifically
- dynrequire("ts-node").register({
- transpileOnly: true,
- skipProject: true,
- compilerOptions: { target: "ES2016" }
- });
- tsNodeRegistered = true;
- }
- try {
- transforms.push(dynrequire(dynrequire.resolve(filename, {
- paths: [baseDir, process.cwd()]
- })));
- } catch (e) {
- return callback(e);
- }
- }
- }
-
- // Fix up the prototype of the transforms’ constructors and instantiate them.
- try {
- transforms = transforms.map(classOrModule => {
- // Except if it’s a legacy module, just pass it through.
- if (typeof classOrModule !== "function") {
- return classOrModule;
- }
- Object.assign(classOrModule.prototype, {
- program,
- baseDir,
- stdout,
- stderr,
- log: console.error,
- readFile,
- writeFile,
- listFiles
- });
- return new classOrModule();
- });
- } catch (e) {
- return callback(e);
- }
-
- function applyTransform(name, ...args) {
- for (let i = 0, k = transforms.length; i < k; ++i) {
- let transform = transforms[i];
- if (typeof transform[name] === "function") {
- try {
- stats.transformCount++;
- stats.transfromTime += measure(() => {
- transform[name](...args);
- });
- } catch (e) {
- return e;
- }
- }
- }
- }
-
- // Parse library files
- Object.keys(exports.libraryFiles).forEach(libPath => {
- if (libPath.includes("/")) return; // in sub-directory: imported on demand
- stats.parseCount++;
- stats.parseTime += measure(() => {
- let textPtr = __pin(__newString(exports.libraryFiles[libPath]));
- let pathPtr = __newString(exports.libraryPrefix + libPath + extension.ext);
- assemblyscript.parse(program, textPtr, pathPtr, false);
- __unpin(textPtr);
- });
- });
- let customLibDirs = [];
- if (opts.lib) {
- let lib = opts.lib;
- if (typeof lib === "string") lib = lib.split(",");
- customLibDirs.push(...lib.map(p => p.trim()));
- customLibDirs = unique(customLibDirs); // `lib` and `customLibDirs` may include duplicates
- for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom
- let libDir = customLibDirs[i];
- let libFiles;
- if (libDir.endsWith(extension.ext)) {
- libFiles = [ path.basename(libDir) ];
- libDir = path.dirname(libDir);
- } else {
- libFiles = listFiles(libDir, baseDir) || [];
- }
- for (let j = 0, l = libFiles.length; j < l; ++j) {
- let libPath = libFiles[j];
- let libText = readFile(libPath, libDir);
- if (libText == null) {
- return callback(Error(`Library file '${libPath}' not found.`));
- }
- stats.parseCount++;
- exports.libraryFiles[libPath.replace(extension.re, "")] = libText;
- stats.parseTime += measure(() => {
- let textPtr = __pin(__newString(libText));
- let pathPtr = __newString(exports.libraryPrefix + libPath);
- assemblyscript.parse(program, textPtr, pathPtr, false);
- __unpin(textPtr);
- });
- }
- }
- }
- opts.path = opts.path || [];
-
- // Maps package names to parent directory
- const packageMains = new Map();
- const packageBases = new Map();
-
- // Gets the file matching the specified source path, imported at the given dependee path
- function getFile(internalPath, dependeePath) {
- var sourceText = null; // text reported back to the compiler
- var sourcePath = null; // path reported back to the compiler
-
- const libraryPrefix = exports.libraryPrefix;
- const libraryFiles = exports.libraryFiles;
-
- // Try file.ext, file/index.ext, file.d.ext
- if (!internalPath.startsWith(libraryPrefix)) {
- if ((sourceText = readFile(sourcePath = internalPath + extension.ext, baseDir)) == null) {
- if ((sourceText = readFile(sourcePath = internalPath + "/index" + extension.ext, baseDir)) == null) {
- // portable d.ext: uses the .js file next to it in JS or becomes an import in Wasm
- sourcePath = internalPath + extension.ext;
- sourceText = readFile(internalPath + extension.ext_d, baseDir);
- }
- }
-
- // Search library in this order: stdlib, custom lib dirs, paths
- } else {
- const plainName = internalPath.substring(libraryPrefix.length);
- const indexName = `${plainName}/index`;
- if (Object.prototype.hasOwnProperty.call(libraryFiles, plainName)) {
- sourceText = libraryFiles[plainName];
- sourcePath = libraryPrefix + plainName + extension.ext;
- } else if (Object.prototype.hasOwnProperty.call(libraryFiles, indexName)) {
- sourceText = libraryFiles[indexName];
- sourcePath = libraryPrefix + indexName + extension.ext;
- } else { // custom lib dirs
- for (const libDir of customLibDirs) {
- if ((sourceText = readFile(plainName + extension.ext, libDir)) != null) {
- sourcePath = libraryPrefix + plainName + extension.ext;
- break;
- } else {
- if ((sourceText = readFile(indexName + extension.ext, libDir)) != null) {
- sourcePath = libraryPrefix + indexName + extension.ext;
- break;
- }
- }
- }
- if (sourceText == null) { // paths
- const match = internalPath.match(/^~lib\/((?:@[^/]+\/)?[^/]+)(?:\/(.+))?/); // ~lib/(pkg)/(path), ~lib/(@org/pkg)/(path)
- if (match) {
- const packageName = match[1];
- const isPackageRoot = match[2] === undefined;
- const filePath = isPackageRoot ? "index" : match[2];
- const basePath = packageBases.has(dependeePath)
- ? packageBases.get(dependeePath)
- : ".";
-
- if (opts.traceResolution) {
- stderr.write(`Looking for package '${packageName}' file '${filePath}' relative to '${basePath}'${EOL}`);
- }
- const paths = [];
- const parts = path.resolve(baseDir, basePath).split(SEP);
- for (let i = parts.length, k = WIN ? 1 : 0; i >= k; --i) {
- if (parts[i - 1] !== "node_modules") {
- paths.push(`${parts.slice(0, i).join(SEP)}${SEP}node_modules`);
- }
- }
- for (const currentPath of paths.concat(...opts.path).map(p => path.relative(baseDir, p))) {
- if (opts.traceResolution) {
- stderr.write(` in ${path.join(currentPath, packageName)}${EOL}`);
- }
- let mainPath = "assembly";
- if (packageMains.has(packageName)) { // use cached
- mainPath = packageMains.get(packageName);
- } else { // evaluate package.json
- let jsonPath = path.join(currentPath, packageName, "package.json");
- let jsonText = readFile(jsonPath, baseDir);
- if (jsonText != null) {
- try {
- let json = JSON.parse(jsonText);
- if (typeof json.ascMain === "string") {
- mainPath = json.ascMain.replace(extension.re_index, "");
- packageMains.set(packageName, mainPath);
- }
- } catch (e) { /* nop */ }
- }
- }
- const mainDir = path.join(currentPath, packageName, mainPath);
- const plainName = filePath;
- if ((sourceText = readFile(path.join(mainDir, plainName + extension.ext), baseDir)) != null) {
- sourcePath = `${libraryPrefix}${packageName}/${plainName}${extension.ext}`;
- packageBases.set(sourcePath.replace(extension.re, ""), path.join(currentPath, packageName));
- if (opts.traceResolution) {
- stderr.write(` -> ${path.join(mainDir, plainName + extension.ext)}${EOL}`);
- }
- break;
- } else if (!isPackageRoot) {
- const indexName = `${filePath}/index`;
- if ((sourceText = readFile(path.join(mainDir, indexName + extension.ext), baseDir)) !== null) {
- sourcePath = `${libraryPrefix}${packageName}/${indexName}${extension.ext}`;
- packageBases.set(sourcePath.replace(extension.re, ""), path.join(currentPath, packageName));
- if (opts.traceResolution) {
- stderr.write(` -> ${path.join(mainDir, indexName + extension.ext)}${EOL}`);
- }
- break;
- }
- }
- }
- }
- }
- }
- }
- // No such file
- if (sourceText == null) return null;
- return { sourceText, sourcePath };
- }
-
- // Parses the backlog of imported files after including entry files
- function parseBacklog() {
- var internalPath;
- while ((internalPath = __getString(assemblyscript.nextFile(program)))) {
- let file = getFile(internalPath, assemblyscript.getDependee(program, internalPath));
- if (file) {
- stats.parseCount++;
- stats.parseTime += measure(() => {
- let textPtr = __pin(__newString(file.sourceText));
- let pathPtr = __newString(file.sourcePath);
- assemblyscript.parse(program, textPtr, pathPtr, false);
- __unpin(textPtr);
- });
- } else {
- stats.parseTime += measure(() => {
- let textPtr = __newString(null); // no need to pin
- let pathPtr = __newString(internalPath + extension.ext);
- assemblyscript.parse(program, textPtr, pathPtr, false);
- });
- }
- }
- var numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic);
- if (numErrors) {
- const err = Error(`${numErrors} parse error(s)`);
- err.stack = err.message; // omit stack
- return callback(err);
- }
- }
-
- // Include runtime before entry files so its setup runs first
- {
- let runtimeName = String(opts.runtime);
- let runtimePath = `rt/index-${runtimeName}`;
- let runtimeText = exports.libraryFiles[runtimePath];
- if (runtimeText == null) {
- runtimePath = runtimeName;
- runtimeText = readFile(runtimePath + extension.ext, baseDir);
- if (runtimeText == null) return callback(Error(`Runtime '${runtimeName}' not found.`));
- } else {
- runtimePath = `~lib/${runtimePath}`;
- }
- stats.parseCount++;
- stats.parseTime += measure(() => {
- let textPtr = __pin(__newString(runtimeText));
- let pathPtr = __newString(runtimePath + extension.ext);
- assemblyscript.parse(program, textPtr, pathPtr, true);
- __unpin(textPtr);
- });
- }
-
- // Include entry files
- for (let i = 0, k = argv.length; i < k; ++i) {
- const filename = argv[i];
- let sourcePath = String(filename)
- .replace(/\\/g, "/")
- .replace(extension.re, "")
- .replace(/[\\/]$/, "");
-
- // Setting the path to relative path
- sourcePath = path.isAbsolute(sourcePath)
- ? path.relative(baseDir, sourcePath).replace(/\\/g, "/")
- : sourcePath;
-
- // Try entryPath.ext, then entryPath/index.ext
- let sourceText = readFile(sourcePath + extension.ext, baseDir);
- if (sourceText == null) {
- const path = `${sourcePath}/index${extension.ext}`;
- sourceText = readFile(path, baseDir);
- if (sourceText != null) sourcePath = path;
- else sourcePath += extension.ext;
- } else {
- sourcePath += extension.ext;
- }
-
- stats.parseCount++;
- stats.parseTime += measure(() => {
- let textPtr = __pin(__newString(sourceText));
- let pathPtr = __newString(sourcePath);
- assemblyscript.parse(program, textPtr, pathPtr, true);
- __unpin(textPtr);
- });
- }
-
- // Parse entry files
- {
- let code = parseBacklog();
- if (code) return code;
- }
-
- // Call afterParse transform hook
- {
- let error = applyTransform("afterParse", program.parser);
- if (error) return callback(error);
- }
-
- // Parse additional files, if any
- {
- let code = parseBacklog();
- if (code) return code;
- }
-
- // Print files and exit if listFiles
- if (opts.listFiles) {
- // FIXME: not a proper C-like API
- stderr.write(program.sources.map(s => s.normalizedPath).sort().join(EOL) + EOL);
- return callback(null);
- }
-
- // Pre-emptively initialize the program
- stats.initializeCount++;
- stats.initializeTime += measure(() => {
- try {
- assemblyscript.initializeProgram(program);
- } catch (e) {
- crash("initialize", e);
- }
- });
-
- // Call afterInitialize transform hook
- {
- let error = applyTransform("afterInitialize", program);
- if (error) return callback(error);
- }
-
- var module;
- stats.compileCount++;
- stats.compileTime += measure(() => {
- try {
- module = assemblyscript.compile(program);
- } catch (e) {
- crash("compile", e);
- }
- // From here on we are going to use Binaryen.js, except that we keep pass
- // order as defined in the compiler.
- if (typeof module === "number") { // Wasm
- const original = assemblyscript.Module.wrap(module);
- module = binaryen.wrapModule(original.ref);
- module.optimize = function(...args) {
- original.optimize(...args);
- };
- } else { // JS
- const original = module;
- module = binaryen.wrapModule(module.ref);
- module.optimize = function(...args) {
- original.optimize(...args);
- };
- }
- });
- var numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic);
- if (numErrors) {
- if (module) module.dispose();
- const err = Error(`${numErrors} compile error(s)`);
- err.stack = err.message; // omit stack
- return callback(err);
- }
-
- // Call afterCompile transform hook
- {
- let error = applyTransform("afterCompile", module);
- if (error) return callback(error);
- }
-
- numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic);
- if (numErrors) {
- if (module) module.dispose();
- const err = Error(`${numErrors} afterCompile error(s)`);
- err.stack = err.message; // omit stack
- return callback(err);
- }
-
- // Validate the module if requested
- if (!opts.noValidate) {
- stats.validateCount++;
- let isValid;
- stats.validateTime += measure(() => {
- isValid = module.validate();
- });
- if (!isValid) {
- module.dispose();
- return callback(Error("validate error"));
- }
- }
-
- // Set Binaryen-specific options
- if (opts.trapMode === "clamp" || opts.trapMode === "js") {
- stats.optimizeCount++;
- stats.optimizeTime += measure(() => {
- try {
- module.runPasses([`trap-mode-${opts.trapMode}`]);
- } catch (e) {
- crash("runPasses", e);
- }
- });
- } else if (opts.trapMode !== "allow") {
- module.dispose();
- return callback(Error("Unsupported trap mode"));
- }
-
- // Optimize the module
- const debugInfo = opts.debug;
- const converge = opts.converge;
- const zeroFilledMemory = opts.importMemory
- ? opts.zeroFilledMemory
- : false;
-
- const runPasses = [];
- if (opts.runPasses) {
- if (typeof opts.runPasses === "string") {
- opts.runPasses = opts.runPasses.split(",");
- }
- if (opts.runPasses.length) {
- opts.runPasses.forEach(pass => {
- if (!runPasses.includes(pass = pass.trim())) {
- runPasses.push(pass);
- }
- });
- }
- }
-
- stats.optimizeTime += measure(() => {
- stats.optimizeCount++;
- try {
- module.optimize(optimizeLevel, shrinkLevel, debugInfo, zeroFilledMemory);
- } catch (e) {
- crash("optimize", e);
- }
- try {
- module.runPasses(runPasses);
- } catch (e) {
- crash("runPasses", e);
- }
- if (converge) {
- let last;
- try {
- last = module.emitBinary();
- } catch (e) {
- crash("emitBinary (converge)", e);
- }
- do {
- stats.optimizeCount++;
- try {
- module.optimize(optimizeLevel, shrinkLevel, debugInfo, zeroFilledMemory);
- } catch (e) {
- crash("optimize (converge)", e);
- }
- try {
- module.runPasses(runPasses);
- } catch (e) {
- crash("runPasses (converge)", e);
- }
- let next;
- try {
- next = module.emitBinary();
- } catch (e) {
- crash("emitBinary (converge)", e);
- }
- if (next.length >= last.length) {
- if (next.length > last.length) {
- stderr.write(`Last converge was suboptimial.${EOL}`);
- }
- break;
- }
- last = next;
- } while (true);
- }
- });
-
- // Prepare output
- if (!opts.noEmit) {
- if (opts.outFile != null) {
- if (opts.textFile == null && /\.was?t$/.test(opts.outFile)) {
- opts.textFile = opts.outFile;
- } else if (opts.jsFile == null && /\.js$/.test(opts.outFile)) {
- opts.jsFile = opts.outFile;
- } else if (opts.binaryFile == null) {
- opts.binaryFile = opts.outFile;
- }
- }
-
- let hasStdout = false;
- let hasOutput = opts.textFile != null
- || opts.binaryFile != null
- || opts.jsFile != null
- || opts.tsdFile != null
- || opts.idlFile != null;
-
- // Write binary
- if (opts.binaryFile != null) {
- let basename = path.basename(opts.binaryFile);
- let sourceMapURL = opts.sourceMap != null
- ? opts.sourceMap.length
- ? opts.sourceMap
- : `./${basename}.map`
- : null;
-
- let wasm;
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- wasm = module.emitBinary(sourceMapURL);
- } catch (e) {
- crash("emitBinary", e);
- }
- });
-
- if (opts.binaryFile.length) {
- writeFile(opts.binaryFile, wasm.binary, baseDir);
- } else {
- writeStdout(wasm.binary);
- hasStdout = true;
- }
-
- // Post-process source map
- if (wasm.sourceMap != "") {
- if (opts.binaryFile.length) {
- let map = JSON.parse(wasm.sourceMap);
- map.sourceRoot = `./${basename}`;
- let contents = [];
- map.sources.forEach((name, index) => {
- let text = assemblyscript.getSource(program, __newString(name.replace(extension.re, "")));
- if (text == null) return callback(Error(`Source of file '${name}' not found.`));
- contents[index] = text;
- });
- map.sourcesContent = contents;
- writeFile(path.join(
- path.dirname(opts.binaryFile),
- path.basename(sourceMapURL)
- ).replace(/^\.\//, ""), JSON.stringify(map), baseDir);
- } else {
- stderr.write(`Skipped source map (stdout already occupied)${EOL}`);
- }
- }
- }
-
- // Write text (also fallback)
- if (opts.textFile != null || !hasOutput) {
- let out;
- if (opts.textFile != null && opts.textFile.length) {
- // use superset text format when extension is `.wast`.
- // Otherwise use official stack IR format (wat).
- let wastFormat = opts.textFile.endsWith(".wast");
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- out = wastFormat
- ? module.emitText()
- : module.emitStackIR(true);
- } catch (e) {
- crash("emitText", e);
- }
- });
- writeFile(opts.textFile, out, baseDir);
- } else if (!hasStdout) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- out = module.emitStackIR(true);
- } catch (e) {
- crash("emitText", e);
- }
- });
- writeStdout(out);
- }
- }
-
- // Write WebIDL
- if (opts.idlFile != null) {
- let idl;
- if (opts.idlFile.length) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- idl = assemblyscript.buildIDL(program);
- } catch (e) {
- crash("buildIDL", e);
- }
- });
- writeFile(opts.idlFile, __getString(idl), baseDir);
- } else if (!hasStdout) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- idl = assemblyscript.buildIDL(program);
- } catch (e) {
- crash("buildIDL", e);
- }
- });
- writeStdout(__getString(idl));
- hasStdout = true;
- }
- }
-
- // Write TypeScript definition
- if (opts.tsdFile != null) {
- let tsd;
- if (opts.tsdFile.length) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- tsd = assemblyscript.buildTSD(program);
- } catch (e) {
- crash("buildTSD", e);
- }
- });
- writeFile(opts.tsdFile, __getString(tsd), baseDir);
- } else if (!hasStdout) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- tsd = assemblyscript.buildTSD(program);
- } catch (e) {
- crash("buildTSD", e);
- }
- });
- writeStdout(__getString(tsd));
- hasStdout = true;
- }
- }
-
- // Write JS (modifies the binary, so must be last)
- if (opts.jsFile != null) {
- let js;
- if (opts.jsFile.length) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- js = module.emitAsmjs();
- } catch (e) {
- crash("emitJS", e);
- }
- });
- writeFile(opts.jsFile, js, baseDir);
- } else if (!hasStdout) {
- stats.emitCount++;
- stats.emitTime += measure(() => {
- try {
- js = module.emitAsmjs();
- } catch (e) {
- crash("emitJS", e);
- }
- });
- writeStdout(js);
- }
- }
- }
-
- module.dispose();
- if (opts.measure) {
- printStats(stats, stderr);
- }
-
- return callback(null);
-
- function readFileNode(filename, baseDir) {
- let name = path.resolve(baseDir, filename);
- try {
- let text;
- stats.readCount++;
- stats.readTime += measure(() => {
- text = fs.readFileSync(name, "utf8");
- });
- return text;
- } catch (e) {
- return null;
- }
- }
-
- function writeFileNode(filename, contents, baseDir) {
- try {
- stats.writeCount++;
- stats.writeTime += measure(() => {
- const dirPath = path.resolve(baseDir, path.dirname(filename));
- filename = path.basename(filename);
- const outputFilePath = path.join(dirPath, filename);
- if (!fs.existsSync(dirPath)) mkdirp(dirPath);
- fs.writeFileSync(outputFilePath, contents);
- });
- return true;
- } catch (e) {
- return false;
- }
- }
-
- function listFilesNode(dirname, baseDir) {
- var files;
- try {
- stats.readCount++;
- stats.readTime += measure(() => {
- files = fs.readdirSync(path.join(baseDir, dirname))
- .filter(file => extension.re_except_d.test(file));
- });
- return files;
- } catch (e) {
- return null;
- }
- }
-
- function writeStdout(contents) {
- if (!writeStdout.used) {
- stats.writeCount++;
- writeStdout.used = true;
- }
- stats.writeTime += measure(() => {
- stdout.write(contents);
- });
- }
-};
-
-const toString = Object.prototype.toString;
-
-function isObject(arg) {
- return toString.call(arg) === "[object Object]";
-}
-
-function getAsconfig(file, baseDir, readFile) {
- const contents = readFile(file, baseDir);
- const location = path.join(baseDir, file);
- if (!contents) return null;
-
- // obtain the configuration
- let config;
- try {
- config = JSON.parse(contents);
- } catch(ex) {
- throw new Error(`Asconfig is not valid json: ${location}`);
- }
-
- // validate asconfig shape
- if (config.options && !isObject(config.options)) {
- throw new Error(`Asconfig.options is not an object: ${location}`);
- }
-
- if (config.include && !Array.isArray(config.include)) {
- throw new Error(`Asconfig.include is not an array: ${location}`);
- }
-
- if (config.targets) {
- if (!isObject(config.targets)) {
- throw new Error(`Asconfig.targets is not an object: ${location}`);
- }
- const targets = Object.keys(config.targets);
- for (let i = 0; i < targets.length; i++) {
- const target = targets[i];
- if (!isObject(config.targets[target])) {
- throw new Error(`Asconfig.targets.${target} is not an object: ${location}`);
- }
- }
- }
-
- if (config.extends && typeof config.extends !== "string") {
- throw new Error(`Asconfig.extends is not a string: ${location}`);
- }
-
- return config;
-}
-
-exports.getAsconfig = getAsconfig;
-
-/** Checks diagnostics emitted so far for errors. */
-function checkDiagnostics(program, stderr, reportDiagnostic) {
- var numErrors = 0;
- do {
- let diagnosticPtr = assemblyscript.nextDiagnostic(program);
- if (!diagnosticPtr) break;
- __pin(diagnosticPtr);
- if (stderr) {
- stderr.write(
- __getString(assemblyscript.formatDiagnostic(diagnosticPtr, stderr.isTTY, true)) +
- EOL + EOL
- );
- }
- if (reportDiagnostic) {
- const diagnostic = __wrap(diagnosticPtr, assemblyscript.DiagnosticMessage);
- const range = __wrap(diagnostic.range, assemblyscript.Range);
- const relatedRange = __wrap(diagnostic.relatedRange, assemblyscript.Range);
- const rangeSource = range ? __wrap(range.source, assemblyscript.Source) : null;
- const relatedRangeSource = relatedRange ? __wrap(relatedRange.source, assemblyscript.Source) : null;
-
- reportDiagnostic({
- message: __getString(diagnostic.message),
- code: diagnostic.code,
- category: diagnostic.category,
- range: range ? {
- start: range.start,
- end: range.end,
- source: rangeSource ? {
- normalizedPath: __getString(rangeSource.normalizedPath)
- } : null,
- } : null,
- relatedRange: relatedRange ? {
- start: relatedRange.start,
- end: relatedRange.end,
- source: relatedRangeSource ? {
- normalizedPath: __getString(relatedRangeSource.normalizedPath)
- } : null
- } : null
- });
- }
- if (assemblyscript.isError(diagnosticPtr)) ++numErrors;
- __unpin(diagnosticPtr);
- } while (true);
- return numErrors;
-}
-
-exports.checkDiagnostics = checkDiagnostics;
-
-/** Creates an empty set of stats. */
-function createStats() {
- return {
- readTime: 0,
- readCount: 0,
- writeTime: 0,
- writeCount: 0,
- parseTime: 0,
- parseCount: 0,
- initializeTime: 0,
- initializeCount: 0,
- compileTime: 0,
- compileCount: 0,
- emitTime: 0,
- emitCount: 0,
- validateTime: 0,
- validateCount: 0,
- optimizeTime: 0,
- optimizeCount: 0,
- transformTime: 0,
- transformCount: 0
- };
-}
-
-exports.createStats = createStats;
-
-/** Measures the execution time of the specified function. */
-function measure(fn) {
- const start = process.hrtime();
- fn();
- const times = process.hrtime(start);
- return times[0] * 1e9 + times[1];
-}
-
-exports.measure = measure;
-
-function pad(str, len) {
- while (str.length < len) str = ` ${str}`;
- return str;
-}
-
-/** Formats a high resolution time to a human readable string. */
-function formatTime(time) {
- return time ? `${(time / 1e6).toFixed(3)} ms` : "n/a";
-}
-
-exports.formatTime = formatTime;
-
-/** Formats and prints out the contents of a set of stats. */
-function printStats(stats, output) {
- const format = (time, count) => `${pad(formatTime(time), 12)} n=${count}`;
- (output || process.stdout).write([
- "I/O Read : " + format(stats.readTime, stats.readCount),
- "I/O Write : " + format(stats.writeTime, stats.writeCount),
- "Parse : " + format(stats.parseTime, stats.parseCount),
- "Initialize : " + format(stats.initializeTime, stats.initializeCount),
- "Compile : " + format(stats.compileTime, stats.compileCount),
- "Emit : " + format(stats.emitTime, stats.emitCount),
- "Validate : " + format(stats.validateTime, stats.validateCount),
- "Optimize : " + format(stats.optimizeTime, stats.optimizeCount),
- "Transform : " + format(stats.transformTime, stats.transformCount),
- ""
- ].join(EOL) + EOL);
-}
-
-exports.printStats = printStats;
-
-var allocBuffer = typeof global !== "undefined" && global.Buffer
- ? global.Buffer.allocUnsafe || (len => new global.Buffer(len))
- : len => new Uint8Array(len);
-
-/** Creates a memory stream that can be used in place of stdout/stderr. */
-function createMemoryStream(fn) {
- var stream = [];
- stream.write = function(chunk) {
- if (fn) fn(chunk);
- if (typeof chunk === "string") {
- let buffer = allocBuffer(utf8.length(chunk));
- utf8.write(chunk, buffer, 0);
- chunk = buffer;
- }
- this.push(chunk);
- };
- stream.reset = function() {
- stream.length = 0;
- };
- stream.toBuffer = function() {
- var offset = 0, i = 0, k = this.length;
- while (i < k) offset += this[i++].length;
- var buffer = allocBuffer(offset);
- offset = i = 0;
- while (i < k) {
- buffer.set(this[i], offset);
- offset += this[i].length;
- ++i;
- }
- return buffer;
- };
- stream.toString = function() {
- var buffer = this.toBuffer();
- return utf8.read(buffer, 0, buffer.length);
- };
- return stream;
-}
-
-exports.createMemoryStream = createMemoryStream;
-
-/** Compatible TypeScript compiler options for syntax highlighting etc. */
-exports.tscOptions = {
- alwaysStrict: true,
- noImplicitAny: true,
- noImplicitReturns: true,
- noImplicitThis: true,
- noEmitOnError: true,
- strictNullChecks: true,
- experimentalDecorators: true,
- target: "esnext",
- module: "commonjs",
- noLib: true,
- types: [],
- allowJs: false
-};
-
-// Gracefully handle crashes
-function crash(stage, e) {
- const BAR = colorsUtil.red("▌ ");
- console.error([
- EOL,
- BAR, "Whoops, the AssemblyScript compiler has crashed during ", stage, " :-(", EOL,
- BAR, EOL,
- (typeof e.stack === "string"
- ? [
- BAR, "Here is the stack trace hinting at the problem, perhaps it's useful?", EOL,
- BAR, EOL,
- e.stack.replace(/^/mg, BAR), EOL,
- BAR, EOL,
- BAR, "If it refers to the dist files, try to 'npm install source-map-support' and", EOL,
- BAR, "run again, which should then show the actual code location in the sources.", EOL,
- ]
- : [
- BAR, "There is no stack trace. Perhaps a Binaryen exception above / in console?", EOL,
- BAR, EOL,
- BAR, "> " + e.stack, EOL
- ]
- ).join(""),
- BAR, EOL,
- BAR, "If you see where the error is, feel free to send us a pull request. If not,", EOL,
- BAR, "please let us know: https://github.com/AssemblyScript/assemblyscript/issues", EOL,
- BAR, EOL,
- BAR, "Thank you!", EOL
- ].join(""));
- process.exit(1);
-}
diff --git a/cli/asc.d.ts b/cli/index.d.ts
similarity index 63%
rename from cli/asc.d.ts
rename to cli/index.d.ts
index 3887d60105..c2666db31f 100644
--- a/cli/asc.d.ts
+++ b/cli/index.d.ts
@@ -3,18 +3,8 @@
* @license Apache-2.0
*/
-import { OptionDescription } from "./util/options";
+import { OptionDescription } from "../util/options";
export { OptionDescription };
-import { Transform } from "./transform";
-
-/** Ready promise resolved once/if the compiler is ready. */
-export const ready: Promise;
-
-/** Whether this is a webpack bundle or not. */
-export const isBundle: boolean;
-
-/** Whether asc runs the sources directly or not. */
-export const isDev: boolean;
/** AssemblyScript version. */
export const version: string;
@@ -22,17 +12,8 @@ export const version: string;
/** Available CLI options. */
export const options: { [key: string]: OptionDescription };
-/** Common root used in source maps. */
-export var sourceMapRoot: string;
-
/** Prefix used for library files. */
-export var libraryPrefix: string;
-
-/** Default Binaryen optimization level. */
-export var defaultOptimizeLevel: number;
-
-/** Default Binaryen shrink level. */
-export var defaultShrinkLevel: number;
+export const libraryPrefix: string;
/** Bundled library files. */
export const libraryFiles: { [key: string]: string };
@@ -40,9 +21,15 @@ export const libraryFiles: { [key: string]: string };
/** Bundled definition files. */
export const definitionFiles: { assembly: string, portable: string };
+/** Default Binaryen optimization level. */
+export const defaultOptimizeLevel: number;
+
+/** Default Binaryen shrink level. */
+export const defaultShrinkLevel: number;
+
/** A compatible output stream. */
export interface OutputStream {
- /** Writes another chunk of data to the stream. */
+ /** Writes a chunk of data to the stream. */
write(chunk: Uint8Array | string): void;
}
@@ -105,18 +92,12 @@ export interface CompilerOptions {
converge?: boolean;
/** Specifies the base directory of input and output files. */
baseDir?: string;
- /** Specifies the output file. File extension indicates format. */
+ /** Specifies the WebAssembly output file (.wasm). */
outFile?: string;
- /** Specifies the binary output file (.wasm). */
- binaryFile?: string;
- /** Specifies the text output file (.wat). */
+ /** Specifies the WebAssembly text output file (.wat). */
textFile?: string;
- /** Specifies the JavaScript (via wasm2js) output file (.js). */
- jsFile?: string;
- /** Specifies the WebIDL output file (.webidl). */
- idlFile?: string;
- /** Specifies the TypeScript definition output file (.d.ts). */
- tsdFile?: string;
+ /** Specified the bindings to generate. */
+ bindings?: string[];
/** Enables source map generation. Optionally takes the URL. */
sourceMap?: boolean | string;
/** Specifies the runtime variant to include in the program. */
@@ -147,8 +128,8 @@ export interface CompilerOptions {
importTable?: boolean;
/** Exports the function table as 'table'. */
exportTable?: boolean;
- /** Exports an explicit start function to be called manually. */
- explicitStart?: boolean;
+ /** Exports the start function instead of calling it implicitly. */
+ exportStart?: string;
/** "Adds one or multiple paths to custom library components. */
lib?: string | string[];
/** Adds one or multiple paths to package resolution. */
@@ -169,16 +150,10 @@ export interface CompilerOptions {
transform?: string | string[];
/** Make yourself sad for no good reason. */
pedantic?: boolean;
- /** Enables tracing of package resolution. */
- traceResolution?: boolean;
- /** Lists files to be compiled and exits. */
- listFiles?: boolean;
/** Prints measuring information on I/O and compile times. */
- measure?: boolean;
+ stats?: boolean;
/** Disables terminal colors. */
noColors?: boolean;
- /** Specifies an alternative file extension. */
- extension?: string;
}
/** Compiler API options. */
@@ -188,68 +163,118 @@ export interface APIOptions {
/** Standard error stream to use. */
stderr?: OutputStream;
/** Reads a file from disk (or memory). */
- readFile?: (filename: string, baseDir: string) => string | null;
+ readFile?: (filename: string, baseDir: string) => (string | null) | Promise;
/** Writes a file to disk (or memory). */
- writeFile?: (filename: string, contents: Uint8Array, baseDir: string) => void;
+ writeFile?: (filename: string, contents: Uint8Array, baseDir: string) => void | Promise;
/** Lists all files within a directory. */
- listFiles?: (dirname: string, baseDir: string) => string[] | null;
+ listFiles?: (dirname: string, baseDir: string) => (string[] | null) | Promise;
/** Handler for diagnostic messages. */
reportDiagnostic?: DiagnosticReporter;
/** Additional transforms to apply. */
transforms?: Transform[];
}
+/** Compiler API result. */
+export interface APIResult {
+ /** Encountered error, if any. */
+ error: Error | null;
+ /** Standard output stream. */
+ stdout: OutputStream;
+ /** Standard error stream. */
+ stderr: OutputStream;
+ /** Statistics. */
+ stats: Stats;
+}
+
+/** Runs the command line utility using the specified arguments array. */
+export function main(argv: string[] | CompilerOptions, options?: APIOptions): Promise;
+
/** Convenience function that parses and compiles source strings directly. */
-export function compileString(sources: { [key: string]: string } | string, options?: CompilerOptions): {
- /** Standard output. */
- stdout: OutputStream,
- /** Standard error. */
- stderr: OutputStream,
+export function compileString(sources: { [key: string]: string } | string, options?: CompilerOptions): Promise number): number;
-export function main(argv: string[], callback?: (err: Error | null) => number): number;
+}>;
/** Checks diagnostics emitted so far for errors. */
-export function checkDiagnostics(emitter: Record, stderr?: OutputStream, reportDiagnostic?: DiagnosticReporter): boolean;
-
-/** An object of stats for the current task. */
-export interface Stats {
- readTime: number,
- readCount: number,
- writeTime: number,
- writeCount: number,
- parseTime: number,
- parseCount: number,
- compileTime: number,
- compileCount: number,
- emitTime: number,
- emitCount: number,
- validateTime: number,
- validateCount: number,
- optimizeTime: number,
- optimizeCount: number
-}
+export function checkDiagnostics(emitter: Record, stderr?: OutputStream, reportDiagnostic?: DiagnosticReporter, useColors?: boolean): boolean;
-/** Creates an empty set of stats. */
-export function createStats(): Stats;
-
-/** Measures the execution time of the specified function. */
-export function measure(fn: () => void): number;
-
-/** Formats a high resolution time to a human readable string. */
-export function formatTime(time: number): string;
-
-/** Formats and prints out the contents of a set of stats. */
-export function printStats(stats: Stats, output: OutputStream): void;
+/** Statistics for the current task. */
+export class Stats {
+ /** Number of files read. */
+ readCount: number;
+ /** Number of files written. */
+ writeCount: number;
+ /** Time taken to parse files. */
+ parseTime: number;
+ /** Number of files parsed. */
+ parseCount: number;
+ /** Time taken to compile programs. */
+ compileTime: number;
+ /** Number of programs compiled. */
+ compileCount: number;
+ /** Time taken to emit files. */
+ emitTime: number;
+ /** Number of emitted files. */
+ emitCount: number;
+ /** Time taken to validate modules. */
+ validateTime: number;
+ /** Number of modules validated. */
+ validateCount: number;
+ /** Time taken to optimize modules. */
+ optimizeTime: number;
+ /** Number of modules optimized. */
+ optimizeCount: number;
+ /** Begins measuring execution time. */
+ begin(): number;
+ /** Ends measuring execution time since `begin`. */
+ end(begin: number): number;
+ /** Returns a string representation. */
+ toString(): string;
+}
/** Creates a memory stream that can be used in place of stdout/stderr. */
export function createMemoryStream(fn?: (chunk: Uint8Array | string) => void): MemoryStream;
/** Compatible TypeScript compiler options for syntax highlighting etc. */
export const tscOptions: Record;
+
+import { Program, Parser, Module } from "../src";
+
+/** Compiler transform base class. */
+export abstract class Transform {
+
+ /** Program reference. */
+ readonly program: Program;
+
+ /** Base directory. */
+ readonly baseDir: string;
+
+ /** Output stream used by the compiler. */
+ readonly stdout: OutputStream;
+
+ /** Error stream used by the compiler. */
+ readonly stderr: OutputStream;
+
+ /** Logs a message to console. */
+ readonly log: typeof console.log;
+
+ /** Reads a file from disk. */
+ readFile(filename: string, baseDir: string): (string | null) | Promise;
+
+ /** Writes a file to disk. */
+ writeFile(filename: string, contents: string | Uint8Array, baseDir: string): void | Promise;
+
+ /** Lists all files in a directory. */
+ listFiles(dirname: string, baseDir: string): (string[] | null) | Promise;
+
+ /** Called when parsing is complete, before a program is instantiated from the AST. */
+ afterParse?(parser: Parser): void | Promise;
+
+ /** Called after the program is instantiated. */
+ afterInitialize?(program: Program): void | Promise;
+
+ /** Called when compilation is complete, before the module is being validated. */
+ afterCompile?(module: Module): void | Promise;
+}
diff --git a/cli/index.js b/cli/index.js
new file mode 100644
index 0000000000..53d85a9a7a
--- /dev/null
+++ b/cli/index.js
@@ -0,0 +1,1263 @@
+/**
+ * @license
+ * Copyright 2020 Daniel Wirtz / The AssemblyScript Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * @fileoverview Compiler frontend for node.js
+ *
+ * Uses the low-level API exported from src/index.ts so it works with the compiler compiled to
+ * JavaScript as well as the compiler compiled to WebAssembly (eventually).
+ *
+ * Can also be packaged as a bundle suitable for in-browser use with the standard library injected
+ * in the build step. See dist/asc.js for the bundle.
+ */
+
+import { fs, module, path, process, url } from "../util/node.js";
+import { Colors } from "../util/terminal.js";
+import { utf8 } from "../util/text.js";
+import * as optionsUtil from "../util/options.js";
+import * as generated from "./index.generated.js";
+
+import binaryen from "../lib/binaryen.js";
+import * as assemblyscriptJS from "assemblyscript";
+
+// Use the TS->JS variant by default
+var assemblyscript = assemblyscriptJS;
+
+// Use the AS->Wasm variant as an option (experimental)
+const wasmPos = process.argv.indexOf("--wasm");
+if (~wasmPos) {
+ const wasmPath = String(process.argv[wasmPos + 1]);
+ process.argv.splice(wasmPos, 2);
+ assemblyscript = await import(new URL(wasmPath, url.pathToFileURL(process.cwd() + "/")));
+}
+
+const require = module.createRequire(import.meta.url);
+
+const WIN = process.platform === "win32";
+const EOL = WIN ? "\r\n" : "\n";
+const SEP = WIN ? "\\" : "/";
+
+const extension = ".ts";
+const extension_d = `.d${extension}`;
+const extension_re = new RegExp("\\" + extension + "$");
+const extension_re_except_d = new RegExp("^(?!.*\\.d\\" + extension + "$).*\\" + extension + "$");
+
+function toUpperSnakeCase(str) {
+ return str.replace(/-/g, "_").toUpperCase();
+}
+
+/** Ensures that an object is a wrapper class instead of just a pointer. */
+// function __wrap(ptrOrObj, wrapperClass) {
+// if (typeof ptrOrObj === "number") {
+// return ptrOrObj === 0 ? null : wrapperClass.wrap(ptrOrObj);
+// }
+// return ptrOrObj;
+// }
+
+/** AssemblyScript version. */
+export const version = generated.version;
+
+/** Available CLI options. */
+export const options = generated.options;
+
+/** Prefix used for library files. */
+export const libraryPrefix = generated.libraryPrefix;
+
+/** Bundled library files. */
+export const libraryFiles = generated.libraryFiles;
+
+/** Bundled definition files. */
+export const definitionFiles = generated.definitionFiles;
+
+/** Default Binaryen optimization level. */
+export const defaultOptimizeLevel = 3;
+
+/** Default Binaryen shrink level. */
+export const defaultShrinkLevel = 0;
+
+/** Converts a configuration object to an arguments array. */
+export function configToArguments(options, argv = []) {
+ Object.keys(options || {}).forEach(key => {
+ const val = options[key];
+ const opt = generated.options[key];
+ if (opt && opt.type === "b") {
+ if (val) argv.push(`--${key}`);
+ } else {
+ if (Array.isArray(val)) {
+ val.forEach(val => { argv.push(`--${key}`, String(val)); });
+ }
+ else argv.push(`--${key}`, String(val));
+ }
+ });
+ return argv;
+}
+
+/** Convenience function that parses and compiles source strings directly. */
+export async function compileString(sources, config = {}) {
+ if (typeof sources === "string") sources = { [`input${extension}`]: sources };
+ var argv = [
+ "--outFile", "binary",
+ "--textFile", "text",
+ ];
+ configToArguments(config, argv);
+ const output = {};
+ const result = await main(argv.concat(Object.keys(sources)), {
+ readFile: name => Object.prototype.hasOwnProperty.call(sources, name) ? sources[name] : null,
+ writeFile: (name, contents) => { output[name] = contents; },
+ listFiles: () => []
+ });
+ return Object.assign(result, output);
+}
+
+/** Runs the command line utility using the specified arguments array. */
+export async function main(argv, options) {
+ if (!Array.isArray(argv)) argv = configToArguments(argv);
+ if (!options) options = {};
+
+ const stats = options.stats || new Stats();
+ const statsBegin = stats.begin();
+
+ // Bundle semantic version
+ let bundleMinorVersion = 0, bundleMajorVersion = 0, bundlePatchVersion = 0;
+ const versionParts = (version || "").split(".");
+ if (versionParts.length === 3) {
+ bundleMajorVersion = parseInt(versionParts[0]) | 0;
+ bundleMinorVersion = parseInt(versionParts[1]) | 0;
+ bundlePatchVersion = parseInt(versionParts[2]) | 0;
+ }
+
+ const stdout = options.stdout || createMemoryStream();
+ const stderr = options.stderr || createMemoryStream();
+ const readFile = options.readFile || readFileNode;
+ const writeFile = options.writeFile || writeFileNode;
+ const listFiles = options.listFiles || listFilesNode;
+
+ // Parse command line options but do not populate option defaults yet
+ const optionsResult = optionsUtil.parse(argv, generated.options, false);
+ let opts = optionsResult.options;
+ argv = optionsResult.arguments;
+
+ const stdoutColors = new Colors(stdout);
+ const stderrColors = new Colors(stderr);
+ if (opts.noColors) {
+ stdoutColors.enabled = false;
+ stderrColors.enabled = false;
+ }
+
+ // Check for unknown options
+ const unknownOpts = optionsResult.unknown;
+ if (unknownOpts.length) {
+ unknownOpts.forEach(arg => {
+ stderr.write(
+ `${stderrColors.yellow("WARNING ")}Unknown option '${arg}'${EOL}`
+ );
+ });
+ }
+
+ // Check for trailing arguments
+ const trailingArgv = optionsResult.trailing;
+ if (trailingArgv.length) {
+ stderr.write(
+ `${stderrColors.yellow("WARNING ")}Unsupported trailing arguments: ${trailingArgv.join(" ")}${EOL}`
+ );
+ }
+
+ var module = null;
+ var binaryenModule = null;
+
+ // Prepares the result object
+ var prepareResult = (error, result = {}) => {
+ if (error) {
+ stderr.write(`${stderrColors.red("FAILURE ")}${error.stack.replace(/^ERROR: /i, "")}${EOL}`);
+ }
+ if (binaryenModule) binaryenModule.dispose();
+ if (!stats.total) stats.total = stats.end(statsBegin);
+ return Object.assign({ error, stdout, stderr, stats }, result);
+ };
+
+ // Just print the version if requested
+ if (opts.version) {
+ stdout.write(`Version ${version}${EOL}`);
+ return prepareResult(null);
+ }
+
+ // Set up base directory
+ const baseDir = path.normalize(opts.baseDir || ".");
+
+ // Check if a config file is present
+ let configPath = optionsUtil.resolvePath(opts.config || "asconfig.json", baseDir);
+ let configFile = path.basename(configPath);
+ let configDir = path.dirname(configPath);
+ let config = await getConfig(configFile, configDir, readFile);
+ let configHasEntries = config != null && Array.isArray(config.entries) && config.entries.length;
+
+ // Print the help message if requested or no source files are provided
+ if (opts.help || (!argv.length && !configHasEntries)) {
+ var out = opts.help ? stdout : stderr;
+ var colors = opts.help ? stdoutColors : stderrColors;
+ out.write([
+ colors.white("SYNTAX"),
+ " " + colors.cyan("asc") + " [entryFile ...] [options]",
+ "",
+ colors.white("EXAMPLES"),
+ " " + colors.cyan("asc") + " hello" + extension,
+ " " + colors.cyan("asc") + " hello" + extension + " -o hello.wasm -t hello.wat",
+ " " + colors.cyan("asc") + " hello1" + extension + " hello2" + extension + " -o -O > hello.wasm",
+ " " + colors.cyan("asc") + " --config asconfig.json --target release",
+ "",
+ colors.white("OPTIONS"),
+ ].concat(
+ optionsUtil.help(generated.options, 24, EOL)
+ ).join(EOL) + EOL);
+ return prepareResult(null);
+ }
+
+ // I/O must be specified if not present in the environment
+ if (!(fs.promises && fs.promises.readFile)) {
+ if (readFile === readFileNode) throw Error("'options.readFile' must be specified");
+ if (writeFile === writeFileNode) throw Error("'options.writeFile' must be specified");
+ if (listFiles === listFilesNode) throw Error("'options.listFiles' must be specified");
+ }
+
+ // Load additional options from asconfig.json
+ const seenAsconfig = new Set();
+ seenAsconfig.add(configPath);
+ const target = opts.target || "release";
+ while (config) {
+ // Merge target first
+ if (config.targets) {
+ const targetOptions = config.targets[target];
+ if (targetOptions) {
+ opts = optionsUtil.merge(generated.options, opts, targetOptions, configDir);
+ }
+ }
+ // Merge general options
+ const generalOptions = config.options;
+ if (generalOptions) {
+ opts = optionsUtil.merge(generated.options, opts, generalOptions, configDir);
+ }
+
+ // Append entries
+ if (config.entries) {
+ for (let entry of config.entries) {
+ argv.push(optionsUtil.resolvePath(entry, configDir));
+ }
+ }
+
+ // Look up extended asconfig and repeat
+ if (config.extends) {
+ configPath = optionsUtil.resolvePath(config.extends, configDir, true);
+ configFile = path.basename(configPath);
+ configDir = path.dirname(configPath);
+ if (seenAsconfig.has(configPath)) break;
+ seenAsconfig.add(configPath);
+ config = await getConfig(configFile, configDir, readFile);
+ } else {
+ break;
+ }
+ }
+
+ // Populate option defaults once user-defined options are set
+ optionsUtil.addDefaults(generated.options, opts);
+
+ // If showConfig print options and exit
+ if (opts.showConfig) {
+ stderr.write(JSON.stringify({
+ options: opts,
+ entries: argv
+ }, null, 2));
+ return prepareResult(null);
+ }
+
+ // create a unique set of values
+ function unique(values) {
+ return [...new Set(values)];
+ }
+
+ // Set up options
+ var program, runtime;
+ const compilerOptions = assemblyscript.newOptions();
+ switch (opts.runtime) {
+ case "stub": runtime = 0; break;
+ case "minimal": runtime = 1; break;
+ /* incremental */
+ default: runtime = 2; break;
+ }
+ assemblyscript.setTarget(compilerOptions, 0);
+ assemblyscript.setRuntime(compilerOptions, runtime);
+ assemblyscript.setNoAssert(compilerOptions, opts.noAssert);
+ assemblyscript.setExportMemory(compilerOptions, !opts.noExportMemory);
+ assemblyscript.setImportMemory(compilerOptions, opts.importMemory);
+ assemblyscript.setInitialMemory(compilerOptions, opts.initialMemory >>> 0);
+ assemblyscript.setMaximumMemory(compilerOptions, opts.maximumMemory >>> 0);
+ assemblyscript.setSharedMemory(compilerOptions, opts.sharedMemory);
+ assemblyscript.setImportTable(compilerOptions, opts.importTable);
+ assemblyscript.setExportTable(compilerOptions, opts.exportTable);
+ assemblyscript.setExportStart(compilerOptions, typeof opts.exportStart === "string" ? opts.exportStart : null);
+ assemblyscript.setMemoryBase(compilerOptions, opts.memoryBase >>> 0);
+ assemblyscript.setTableBase(compilerOptions, opts.tableBase >>> 0);
+ assemblyscript.setSourceMap(compilerOptions, opts.sourceMap != null);
+ assemblyscript.setNoUnsafe(compilerOptions, opts.noUnsafe);
+ assemblyscript.setPedantic(compilerOptions, opts.pedantic);
+ assemblyscript.setLowMemoryLimit(compilerOptions, opts.lowMemoryLimit >>> 0);
+ assemblyscript.setExportRuntime(compilerOptions, opts.exportRuntime);
+ assemblyscript.setBundleVersion(compilerOptions, bundleMajorVersion, bundleMinorVersion, bundlePatchVersion);
+ if (!opts.stackSize && opts.runtime == "incremental") {
+ opts.stackSize = assemblyscript.DEFAULT_STACK_SIZE;
+ }
+ assemblyscript.setStackSize(compilerOptions, opts.stackSize);
+
+ // Instrument callback to perform GC
+ // prepareResult = (original => {
+ // return function gcBeforePrepareResult(err) {
+ // __unpin(compilerOptions);
+ // if (program) __unpin(program);
+ // __collect();
+ // return original(err);
+ // };
+ // })(prepareResult);
+
+ // Add or override aliases if specified
+ if (opts.use) {
+ let aliases = opts.use;
+ for (let i = 0, k = aliases.length; i < k; ++i) {
+ let part = aliases[i];
+ let p = part.indexOf("=");
+ if (p < 0) return prepareResult(Error(`Global alias '${part}' is invalid.`));
+ let alias = part.substring(0, p).trim();
+ let name = part.substring(p + 1).trim();
+ if (!alias.length) {
+ return prepareResult(Error(`Global alias '${part}' is invalid.`));
+ }
+ assemblyscript.addGlobalAlias(compilerOptions, alias, name);
+ }
+ }
+
+ // Disable default features if specified
+ var features;
+ if ((features = opts.disable) != null) {
+ if (typeof features === "string") features = features.split(",");
+ for (let i = 0, k = features.length; i < k; ++i) {
+ let name = features[i].trim();
+ let flag = assemblyscript[`FEATURE_${toUpperSnakeCase(name)}`];
+ if (!flag) return prepareResult(Error(`Feature '${name}' is unknown.`));
+ assemblyscript.disableFeature(compilerOptions, flag);
+ }
+ }
+
+ // Enable experimental features if specified
+ if ((features = opts.enable) != null) {
+ if (typeof features === "string") features = features.split(",");
+ for (let i = 0, k = features.length; i < k; ++i) {
+ let name = features[i].trim();
+ let flag = assemblyscript[`FEATURE_${toUpperSnakeCase(name)}`];
+ if (!flag) return prepareResult(Error(`Feature '${name}' is unknown.`));
+ assemblyscript.enableFeature(compilerOptions, flag);
+ }
+ }
+
+ // Set up optimization levels
+ var optimizeLevel = 0;
+ var shrinkLevel = 0;
+ if (opts.optimize) {
+ optimizeLevel = defaultOptimizeLevel;
+ shrinkLevel = defaultShrinkLevel;
+ }
+ if (typeof opts.optimizeLevel === "number") optimizeLevel = opts.optimizeLevel;
+ if (typeof opts.shrinkLevel === "number") shrinkLevel = opts.shrinkLevel;
+ optimizeLevel = Math.min(Math.max(optimizeLevel, 0), 3);
+ shrinkLevel = Math.min(Math.max(shrinkLevel, 0), 2);
+ assemblyscript.setOptimizeLevelHints(compilerOptions, optimizeLevel, shrinkLevel);
+
+ // Initialize the program
+ program = assemblyscript.newProgram(compilerOptions);
+
+ // Collect transforms *constructors* from the `--transform` CLI flag as well
+ // as the `transform` option into the `transforms` array.
+ let transforms = [];
+ // `transform` option from `main()`
+ if (Array.isArray(options.transforms)) {
+ transforms.push(...options.transforms);
+ }
+ // `--transform` CLI flag
+ if (opts.transform) {
+ let transformArgs = unique(opts.transform);
+ for (let i = 0, k = transformArgs.length; i < k; ++i) {
+ let filename = transformArgs[i].trim();
+ let resolved;
+ let transform;
+ if (require.resolve) {
+ try {
+ resolved = require.resolve(filename, { paths: [process.cwd(), baseDir] });
+ transform = await import(url.pathToFileURL(resolved));
+ if (transform.default) transform = transform.default;
+ } catch (e1) {
+ try {
+ transform = require(resolved);
+ } catch (e2) {
+ return prepareResult(e1);
+ }
+ }
+ } else {
+ try {
+ transform = await import(new URL(filename, import.meta.url));
+ if (transform.default) transform = transform.default;
+ } catch (e) {
+ return prepareResult(e);
+ }
+ }
+ if (!transform || (typeof transform !== "function" && typeof transform !== "object")) {
+ return prepareResult(Error("not a transform: " + transformArgs[i]));
+ }
+ transforms.push(transform);
+ }
+ }
+
+ // Fix up the prototype of the transforms’ constructors and instantiate them.
+ try {
+ transforms = transforms.map(transform => {
+ if (typeof transform === "function") {
+ Object.assign(transform.prototype, {
+ program,
+ baseDir,
+ stdout,
+ stderr,
+ log: console.error,
+ readFile,
+ writeFile,
+ listFiles
+ });
+ transform = new transform();
+ }
+ return transform;
+ });
+ } catch (e) {
+ return prepareResult(e);
+ }
+
+ async function applyTransform(name, ...args) {
+ for (let i = 0, k = transforms.length; i < k; ++i) {
+ let transform = transforms[i];
+ if (typeof transform[name] === "function") {
+ try {
+ let start = stats.begin();
+ stats.transformCount++;
+ await transform[name](...args);
+ stats.transformTime += stats.end(start);
+ } catch (e) {
+ return e;
+ }
+ }
+ }
+ }
+
+ // Parse library files
+ Object.keys(libraryFiles).forEach(libPath => {
+ if (libPath.includes("/")) return; // in sub-directory: imported on demand
+ let begin = stats.begin();
+ stats.parseCount++;
+ assemblyscript.parse(program, libraryFiles[libPath], libraryPrefix + libPath + extension, false);
+ stats.parseTime += stats.end(begin);
+ });
+ let customLibDirs = [];
+ if (opts.lib) {
+ let lib = opts.lib;
+ if (typeof lib === "string") lib = lib.split(",");
+ customLibDirs.push(...lib.map(p => p.trim()));
+ customLibDirs = unique(customLibDirs); // `lib` and `customLibDirs` may include duplicates
+ for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom
+ let libDir = customLibDirs[i];
+ let libFiles;
+ if (libDir.endsWith(extension)) {
+ libFiles = [ path.basename(libDir) ];
+ libDir = path.dirname(libDir);
+ } else {
+ libFiles = await listFiles(libDir, baseDir) || [];
+ }
+ for (let libPath of libFiles) {
+ let libText = await readFile(libPath, libDir);
+ if (libText == null) {
+ return prepareResult(Error(`Library file '${libPath}' not found.`));
+ }
+ libraryFiles[libPath.replace(extension_re, "")] = libText;
+ let begin = stats.begin();
+ stats.parseCount++;
+ assemblyscript.parse(program, libText, libraryPrefix + libPath, false);
+ stats.parseTime += stats.end(begin);
+ }
+ }
+ }
+ opts.path = opts.path || [];
+
+ // Maps package names to parent directory
+ const packageBases = new Map();
+
+ // Gets the file matching the specified source path, imported at the given dependee path
+ async function getFile(internalPath, dependeePath) {
+ var sourceText = null; // text reported back to the compiler
+ var sourcePath = null; // path reported back to the compiler
+
+ // Try file.ext, file/index.ext, file.d.ext
+ if (!internalPath.startsWith(libraryPrefix)) {
+ if ((sourceText = await readFile(sourcePath = internalPath + extension, baseDir)) == null) {
+ if ((sourceText = await readFile(sourcePath = internalPath + "/index" + extension, baseDir)) == null) {
+ // portable d.ext: uses the .js file next to it in JS or becomes an import in Wasm
+ sourcePath = internalPath + extension;
+ sourceText = await readFile(internalPath + extension_d, baseDir);
+ }
+ }
+
+ // Search library in this order: stdlib, custom lib dirs, paths
+ } else {
+ const plainName = internalPath.substring(libraryPrefix.length);
+ const indexName = `${plainName}/index`;
+ if (Object.prototype.hasOwnProperty.call(libraryFiles, plainName)) {
+ sourceText = libraryFiles[plainName];
+ sourcePath = libraryPrefix + plainName + extension;
+ } else if (Object.prototype.hasOwnProperty.call(libraryFiles, indexName)) {
+ sourceText = libraryFiles[indexName];
+ sourcePath = libraryPrefix + indexName + extension;
+ } else { // custom lib dirs
+ for (const libDir of customLibDirs) {
+ if ((sourceText = await readFile(plainName + extension, libDir)) != null) {
+ sourcePath = libraryPrefix + plainName + extension;
+ break;
+ } else {
+ if ((sourceText = await readFile(indexName + extension, libDir)) != null) {
+ sourcePath = libraryPrefix + indexName + extension;
+ break;
+ }
+ }
+ }
+ if (sourceText == null) { // paths
+ const match = internalPath.match(/^~lib\/((?:@[^/]+\/)?[^/]+)(?:\/(.+))?/); // ~lib/(pkg)/(path), ~lib/(@org/pkg)/(path)
+ if (match) {
+ const packageName = match[1];
+ const filePath = match[2] || "index";
+ const basePath = packageBases.has(dependeePath) ? packageBases.get(dependeePath) : ".";
+ const paths = [];
+ const parts = path.resolve(baseDir, basePath).split(SEP);
+ for (let i = parts.length, k = WIN ? 1 : 0; i >= k; --i) {
+ if (parts[i - 1] !== "node_modules") {
+ paths.push(`${parts.slice(0, i).join(SEP)}${SEP}node_modules`);
+ }
+ }
+ paths.push(...opts.path);
+ for (const currentDir of paths.map(p => path.relative(baseDir, p))) {
+ const plainName = filePath;
+ if ((sourceText = await readFile(path.join(currentDir, packageName, plainName + extension), baseDir)) != null) {
+ sourcePath = `${libraryPrefix}${packageName}/${plainName}${extension}`;
+ packageBases.set(sourcePath.replace(extension_re, ""), path.join(currentDir, packageName));
+ break;
+ }
+ const indexName = `${filePath}/index`;
+ if ((sourceText = await readFile(path.join(currentDir, packageName, indexName + extension), baseDir)) != null) {
+ sourcePath = `${libraryPrefix}${packageName}/${indexName}${extension}`;
+ packageBases.set(sourcePath.replace(extension_re, ""), path.join(currentDir, packageName));
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ // No such file
+ if (sourceText == null) return null;
+ return { sourceText, sourcePath };
+ }
+
+ // Gets all pending imported files from the the backlog
+ function getBacklog(paths = []) {
+ do {
+ let internalPath = assemblyscript.nextFile(program);
+ if (internalPath == null) break;
+ paths.push(internalPath);
+ } while (true);
+ return paths;
+ }
+
+ // Parses the backlog of imported files after including entry files
+ async function parseBacklog() {
+ var backlog;
+ while ((backlog = getBacklog()).length) {
+ let files = [];
+ for (let internalPath of backlog) {
+ const dependee = assemblyscript.getDependee(program, internalPath);
+ files.push(getFile(internalPath, dependee)); // queue
+ }
+ files = await Promise.all(files); // parallel
+ for (let i = 0, k = backlog.length; i < k; ++i) {
+ const internalPath = backlog[i];
+ const file = files[i];
+ const begin = stats.begin();
+ stats.parseCount++;
+ if (file) {
+ assemblyscript.parse(program, file.sourceText, file.sourcePath, false);
+ } else {
+ assemblyscript.parse(program, null, internalPath + extension, false);
+ }
+ stats.parseTime += stats.end(begin);
+ }
+ }
+ const numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic, stderrColors.enabled);
+ if (numErrors) {
+ const err = Error(`${numErrors} parse error(s)`);
+ err.stack = err.message; // omit stack
+ return prepareResult(err);
+ }
+ }
+
+ // Include runtime before entry files so its setup runs first
+ {
+ let runtimeName = String(opts.runtime);
+ let runtimePath = `rt/index-${runtimeName}`;
+ let runtimeText = libraryFiles[runtimePath];
+ if (runtimeText == null) {
+ runtimePath = runtimeName;
+ runtimeText = await readFile(runtimePath + extension, baseDir);
+ if (runtimeText == null) return prepareResult(Error(`Runtime '${runtimeName}' not found.`));
+ } else {
+ runtimePath = `~lib/${runtimePath}`;
+ }
+ let begin = stats.begin();
+ stats.parseCount++;
+ assemblyscript.parse(program, runtimeText, runtimePath + extension, true);
+ stats.parseTime += stats.end(begin);
+ }
+
+ // Include entry files
+ for (let i = 0, k = argv.length; i < k; ++i) {
+ const filename = argv[i];
+ let sourcePath = String(filename)
+ .replace(/\\/g, "/")
+ .replace(extension_re, "")
+ .replace(/[\\/]$/, "");
+
+ // Setting the path to relative path
+ sourcePath = path.isAbsolute(sourcePath)
+ ? path.relative(baseDir, sourcePath).replace(/\\/g, "/")
+ : sourcePath;
+
+ // Try entryPath.ext, then entryPath/index.ext
+ let sourceText = await readFile(sourcePath + extension, baseDir);
+ if (sourceText == null) {
+ const path = `${sourcePath}/index${extension}`;
+ sourceText = await readFile(path, baseDir);
+ if (sourceText != null) sourcePath = path;
+ else sourcePath += extension;
+ } else {
+ sourcePath += extension;
+ }
+
+ let begin = stats.begin();
+ stats.parseCount++;
+ assemblyscript.parse(program, sourceText, sourcePath, true);
+ stats.parseTime += stats.end(begin);
+ }
+
+ // Parse entry files
+ {
+ let code = await parseBacklog();
+ if (code) return code;
+ }
+
+ // Call afterParse transform hook
+ {
+ let error = await applyTransform("afterParse", program.parser);
+ if (error) return prepareResult(error);
+ }
+
+ // Parse additional files, if any
+ {
+ let code = await parseBacklog();
+ if (code) return code;
+ }
+
+ // Pre-emptively initialize the program
+ {
+ let begin = stats.begin();
+ stats.initializeCount++;
+ try {
+ assemblyscript.initializeProgram(program);
+ } catch (e) {
+ crash("initialize", e);
+ }
+ stats.initializeTime += stats.end(begin);
+ }
+
+ // Call afterInitialize transform hook
+ {
+ let error = await applyTransform("afterInitialize", program);
+ if (error) return prepareResult(error);
+ }
+
+ // Compile the program
+ {
+ let begin = stats.begin();
+ stats.compileCount++;
+ try {
+ module = assemblyscript.compile(program);
+ } catch (e) {
+ crash("compile", e);
+ }
+ stats.compileTime += stats.end(begin);
+ }
+ // From here on we are going to use Binaryen.js
+ binaryenModule = binaryen.wrapModule(
+ typeof module === "number" || module instanceof Number
+ ? assemblyscript.getBinaryenModuleRef(module)
+ : module.ref
+ );
+ var numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic, stderrColors.enabled);
+ if (numErrors) {
+ const err = Error(`${numErrors} compile error(s)`);
+ err.stack = err.message; // omit stack
+ return prepareResult(err);
+ }
+
+ // Call afterCompile transform hook
+ {
+ let error = await applyTransform("afterCompile", binaryenModule);
+ if (error) return prepareResult(error);
+ }
+
+ numErrors = checkDiagnostics(program, stderr, options.reportDiagnostic, stderrColors.enabled);
+ if (numErrors) {
+ const err = Error(`${numErrors} afterCompile error(s)`);
+ err.stack = err.message; // omit stack
+ return prepareResult(err);
+ }
+
+ // Validate the module if requested
+ if (!opts.noValidate) {
+ let begin = stats.begin();
+ stats.validateCount++;
+ let isValid = assemblyscript.validate(module);
+ stats.validateTime += stats.end(begin);
+ if (!isValid) {
+ return prepareResult(Error("validate error"));
+ }
+ }
+
+ // Set Binaryen-specific options
+ if (opts.trapMode === "clamp" || opts.trapMode === "js") {
+ let begin = stats.begin();
+ try {
+ binaryenModule.runPasses([`trap-mode-${opts.trapMode}`]);
+ } catch (e) {
+ crash("runPasses", e);
+ }
+ stats.compileTime += stats.end(begin);
+ } else if (opts.trapMode !== "allow") {
+ return prepareResult(Error("Unsupported trap mode"));
+ }
+
+ // Optimize the module
+ const debugInfo = opts.debug;
+ const converge = opts.converge;
+ const zeroFilledMemory = opts.importMemory
+ ? opts.zeroFilledMemory
+ : false;
+
+ const runPasses = [];
+ if (opts.runPasses) {
+ if (typeof opts.runPasses === "string") {
+ opts.runPasses = opts.runPasses.split(",");
+ }
+ if (opts.runPasses.length) {
+ opts.runPasses.forEach(pass => {
+ if (!runPasses.includes(pass = pass.trim())) {
+ runPasses.push(pass);
+ }
+ });
+ }
+ }
+
+ {
+ let begin = stats.begin();
+ try {
+ stats.optimizeCount++;
+ assemblyscript.optimize(module, optimizeLevel, shrinkLevel, debugInfo, zeroFilledMemory);
+ } catch (e) {
+ crash("optimize", e);
+ }
+ try {
+ binaryenModule.runPasses(runPasses);
+ } catch (e) {
+ crash("runPasses", e);
+ }
+ if (converge) {
+ let last;
+ try {
+ let begin = stats.begin();
+ stats.emitCount++;
+ last = binaryenModule.emitBinary();
+ stats.emitTime += stats.end(begin);
+ } catch (e) {
+ crash("emitBinary (converge)", e);
+ }
+ do {
+ try {
+ stats.optimizeCount++;
+ assemblyscript.optimize(module, optimizeLevel, shrinkLevel, debugInfo, zeroFilledMemory);
+ } catch (e) {
+ crash("optimize (converge)", e);
+ }
+ try {
+ binaryenModule.runPasses(runPasses);
+ } catch (e) {
+ crash("runPasses (converge)", e);
+ }
+ let next;
+ try {
+ let begin = stats.begin();
+ stats.emitCount++;
+ next = binaryenModule.emitBinary();
+ stats.emitTime += stats.end(begin);
+ } catch (e) {
+ crash("emitBinary (converge)", e);
+ }
+ if (next.length >= last.length) {
+ if (next.length > last.length) {
+ stderr.write(`Last converge was suboptimial.${EOL}`);
+ }
+ break;
+ }
+ last = next;
+ } while (true);
+ }
+ stats.optimizeTime += stats.end(begin);
+ }
+
+ const pending = [];
+
+ // Prepare output
+ if (!opts.noEmit) {
+ let bindings = opts.bindings || [];
+ let hasStdout = false;
+ let hasOutFile = opts.outFile != null;
+ let hasTextFile = opts.textFile != null;
+ let hasOutput = hasOutFile || hasTextFile;
+ let hasFileOutput = (hasOutFile && opts.outFile.length > 0) || (hasTextFile && opts.textFile.length > 0);
+ let basepath = hasFileOutput
+ ? (opts.outFile || opts.textFile).replace(/\.\w+$/, "")
+ : null;
+ let basename = hasFileOutput
+ ? path.basename(basepath)
+ : "output";
+
+ assemblyscript.setBasenameHint(compilerOptions, basename);
+
+ // Write binary
+ if (opts.outFile != null) {
+ let sourceMapURL = opts.sourceMap != null
+ ? opts.sourceMap.length
+ ? opts.sourceMap
+ : `./${basename}.wasm.map`
+ : null;
+
+ let begin = stats.begin();
+ stats.emitCount++;
+ let wasm;
+ try {
+ wasm = binaryenModule.emitBinary(sourceMapURL);
+ } catch (e) {
+ crash("emitBinary", e);
+ }
+ stats.emitTime += stats.end(begin);
+
+ if (opts.outFile.length) {
+ pending.push(
+ writeFile(opts.outFile, wasm.binary, baseDir)
+ );
+ } else {
+ hasStdout = true;
+ writeStdout(wasm.binary);
+ }
+
+ // Post-process source map
+ if (wasm.sourceMap != "") {
+ if (opts.outFile.length) {
+ let map = JSON.parse(wasm.sourceMap);
+ map.sourceRoot = `./${basename}`;
+ let contents = [];
+ for (let i = 0, k = map.sources.length; i < k; ++i) {
+ let name = map.sources[i];
+ let text = assemblyscript.getSource(program, name.replace(extension_re, ""));
+ if (text == null) return prepareResult(Error(`Source of file '${name}' not found.`));
+ contents[i] = text;
+ }
+ map.sourcesContent = contents;
+ pending.push(
+ writeFile(path.join(
+ path.dirname(opts.outFile),
+ path.basename(sourceMapURL)
+ ).replace(/^\.\//, ""), JSON.stringify(map), baseDir)
+ );
+ } else {
+ stderr.write(`Skipped source map (no output path)${EOL}`);
+ }
+ }
+ }
+
+ // Write text (also fallback)
+ if (opts.textFile != null || !hasOutput) {
+ let begin = stats.begin();
+ stats.emitCount++;
+ let out;
+ try {
+ // use superset text format when extension is `.wast`.
+ // Otherwise use official stack IR format (wat).
+ out = opts.textFile?.endsWith(".wast")
+ ? binaryenModule.emitText()
+ : binaryenModule.emitStackIR(true);
+ } catch (e) {
+ crash("emitText", e);
+ }
+ stats.emitTime += stats.end(begin);
+
+ if (opts.textFile != null && opts.textFile.length) {
+ pending.push(
+ writeFile(opts.textFile, out, baseDir)
+ );
+ } else if (!hasStdout) {
+ hasStdout = true;
+ writeStdout(out);
+ }
+ }
+
+ // Write TypeScript definition
+ const bindingsEsm = bindings.includes("esm");
+ const bindingsRaw = !bindingsEsm && bindings.includes("raw");
+ if (bindingsEsm || bindingsRaw) {
+ if (basepath) {
+ let begin = stats.begin();
+ stats.emitCount++;
+ let source;
+ try {
+ source = assemblyscript.buildTSD(program, bindingsEsm);
+ } catch (e) {
+ crash("buildTSD", e);
+ }
+ stats.emitTime += stats.end(begin);
+ pending.push(
+ writeFile(basepath + ".d.ts", source, baseDir)
+ );
+ } else {
+ stderr.write(`Skipped TypeScript binding (no output path)${EOL}`);
+ }
+ }
+
+ // Write JavaScript bindings
+ if (bindingsEsm || bindingsRaw) {
+ if (basepath) {
+ let begin = stats.begin();
+ stats.emitCount++;
+ let source;
+ try {
+ source = assemblyscript.buildJS(program, bindingsEsm);
+ } catch (e) {
+ crash("buildJS", e);
+ }
+ stats.emitTime += stats.end(begin);
+ pending.push(
+ writeFile(basepath + ".js", source, baseDir)
+ );
+ } else {
+ stderr.write(`Skipped JavaScript binding (no output path)${EOL}`);
+ }
+ }
+ }
+
+ try {
+ await Promise.all(pending);
+ } catch (err) {
+ return prepareResult(err);
+ }
+
+ stats.total = stats.end(statsBegin);
+ if (opts.stats) stderr.write(stats.toString());
+
+ return prepareResult(null);
+
+ // Default implementation to read files on node
+ async function readFileNode(filename, baseDir) {
+ let name = path.resolve(baseDir, filename);
+ try {
+ stats.readCount++;
+ return await fs.promises.readFile(name, "utf8");
+ } catch (e) {
+ return null;
+ }
+ }
+
+ // Default implementation to write files on node
+ async function writeFileNode(filename, contents, baseDir) {
+ try {
+ stats.writeCount++;
+ const dirPath = path.resolve(baseDir, path.dirname(filename));
+ const filePath = path.join(dirPath, path.basename(filename));
+ await fs.promises.mkdir(dirPath, { recursive: true });
+ await fs.promises.writeFile(filePath, contents);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ // Default implementation to list files on node
+ async function listFilesNode(dirname, baseDir) {
+ try {
+ stats.readCount++;
+ return (await fs.promises.readdir(path.join(baseDir, dirname)))
+ .filter(file => extension_re_except_d.test(file));
+ } catch (e) {
+ return null;
+ }
+ }
+
+ // Writes to stdout
+ function writeStdout(contents) {
+ if (!writeStdout.used) {
+ writeStdout.used = true;
+ stats.writeCount++;
+ }
+ stdout.write(contents);
+ }
+
+ // Crash handler
+ function crash(stage, e) {
+ const BAR = stdoutColors.red("▌ ");
+ console.error([
+ EOL,
+ BAR, "Whoops, the AssemblyScript compiler has crashed during ", stage, " :-(", EOL,
+ BAR, EOL,
+ (typeof e.stack === "string"
+ ? [
+ BAR, "Here is the stack trace hinting at the problem, perhaps it's useful?", EOL,
+ BAR, EOL,
+ e.stack.replace(/^/mg, BAR), EOL
+ ]
+ : [
+ BAR, "There is no stack trace. Perhaps a Binaryen exception above / in console?", EOL,
+ BAR, EOL,
+ BAR, "> " + e.stack, EOL
+ ]
+ ).join(""),
+ BAR, EOL,
+ BAR, "If you see where the error is, feel free to send us a pull request. If not,", EOL,
+ BAR, "please let us know: https://github.com/AssemblyScript/assemblyscript/issues", EOL,
+ BAR, EOL,
+ BAR, "Thank you!", EOL
+ ].join(""));
+ process.exit(1);
+ }
+}
+
+function isObject(arg) {
+ return Object.prototype.toString.call(arg) === "[object Object]";
+}
+
+async function getConfig(file, baseDir, readFile) {
+ const contents = await readFile(file, baseDir);
+ const location = path.join(baseDir, file);
+ if (!contents) return null;
+
+ // obtain the configuration
+ let config;
+ try {
+ config = JSON.parse(contents);
+ } catch(ex) {
+ throw new Error(`Asconfig is not valid json: ${location}`);
+ }
+
+ // validate asconfig shape
+ if (config.options && !isObject(config.options)) {
+ throw new Error(`Asconfig.options is not an object: ${location}`);
+ }
+
+ if (config.include && !Array.isArray(config.include)) {
+ throw new Error(`Asconfig.include is not an array: ${location}`);
+ }
+
+ if (config.targets) {
+ if (!isObject(config.targets)) {
+ throw new Error(`Asconfig.targets is not an object: ${location}`);
+ }
+ const targets = Object.keys(config.targets);
+ for (let i = 0; i < targets.length; i++) {
+ const target = targets[i];
+ if (!isObject(config.targets[target])) {
+ throw new Error(`Asconfig.targets.${target} is not an object: ${location}`);
+ }
+ }
+ }
+
+ if (config.extends && typeof config.extends !== "string") {
+ throw new Error(`Asconfig.extends is not a string: ${location}`);
+ }
+
+ return config;
+}
+
+/** Checks diagnostics emitted so far for errors. */
+export function checkDiagnostics(program, stderr, reportDiagnostic, useColors) {
+ if (typeof useColors === "undefined" && stderr) useColors = stderr.isTTY;
+ var numErrors = 0;
+ do {
+ let diagnostic = assemblyscript.nextDiagnostic(program);
+ if (!diagnostic) break;
+ if (stderr) {
+ stderr.write(
+ assemblyscript.formatDiagnostic(diagnostic, useColors, true) +
+ EOL + EOL
+ );
+ }
+ if (reportDiagnostic) {
+ function wrapRange(range) {
+ return range && {
+ start: assemblyscript.getRangeStart(range),
+ end: assemblyscript.getRangeEnd(range),
+ source: wrapSource(assemblyscript.getRangeSource(range))
+ } || null;
+ }
+ function wrapSource(source) {
+ return source && {
+ normalizedPath: assemblyscript.getSourceNormalizedPath(source)
+ } || null;
+ }
+ reportDiagnostic({
+ message: assemblyscript.getDiagnosticMessage(diagnostic),
+ code: assemblyscript.getDiagnosticCode(diagnostic),
+ category: assemblyscript.getDiagnosticCategory(diagnostic),
+ range: wrapRange(assemblyscript.getDiagnosticRange(diagnostic)),
+ relatedRange: wrapRange(assemblyscript.getDiagnosticRelatedRange(diagnostic))
+ });
+ }
+ if (assemblyscript.isError(diagnostic)) ++numErrors;
+ } while (true);
+ return numErrors;
+}
+
+export class Stats {
+ readCount = 0;
+ writeCount = 0;
+ parseTime = 0;
+ parseCount = 0;
+ initializeTime = 0;
+ initializeCount = 0;
+ compileTime = 0;
+ compileCount = 0;
+ emitTime = 0;
+ emitCount = 0;
+ validateTime = 0;
+ validateCount = 0;
+ optimizeTime = 0;
+ optimizeCount = 0;
+ transformTime = 0;
+ transformCount = 0;
+ begin() {
+ return process.hrtime();
+ }
+ end(begin) {
+ const hrtime = process.hrtime(begin);
+ return hrtime[0] * 1e9 + hrtime[1];
+ }
+ toString() {
+ const formatTime = time => time ? `${(time / 1e6).toFixed(3)} ms` : "n/a";
+ const keys = Object.keys(this).filter(key => key.endsWith("Time")).map(key => key.substring(0, key.length - 4));
+ const times = keys.map(key => formatTime(this[`${key}Time`]));
+ const counts = keys.map(key => this[`${key}Count`].toString());
+ const keysLen = keys.reduce((current, key) => Math.max(key.length, current), 0);
+ const timesLen = times.reduce((current, time) => Math.max(time.length, current), 0);
+ const countsLen = counts.reduce((current, count) => Math.max(count.length, current), 0);
+ const totalLen = keysLen + timesLen + countsLen + 6;
+ const out = [];
+ out.push(`╭─${"─".repeat(totalLen)}─╮${EOL}`);
+ const header = `Stats`;
+ out.push(`│ ${header}${" ".repeat(totalLen - header.length)} │${EOL}`);
+ out.push(`╞═${"═".repeat(keysLen)}═╤═${"═".repeat(timesLen)}═╤═${"═".repeat(countsLen)}═╡${EOL}`);
+ for (let i = 0, k = keys.length; i < k; ++i) {
+ out.push(`│ ${keys[i].padEnd(keysLen)} │ ${times[i].padStart(timesLen)} │ ${counts[i].padStart(countsLen)} │${EOL}`);
+ }
+ out.push(`├─${"─".repeat(keysLen)}─┴─${"─".repeat(timesLen)}─┴─${"─".repeat(countsLen)}─┤${EOL}`);
+ const totalTime = `Took ${formatTime(this.total)}`;
+ out.push(`│ ${totalTime}${" ".repeat(totalLen - totalTime.length)} │${EOL}`);
+ const readsWrites = `${this.readCount} reads, ${this.writeCount} writes`;
+ out.push(`│ ${readsWrites}${" ".repeat(totalLen - readsWrites.length)} │${EOL}`);
+ out.push(`╰─${"─".repeat(totalLen)}─╯${EOL}`);
+ return out.join("");
+ }
+}
+
+var allocBuffer = typeof global !== "undefined" && global.Buffer
+ ? global.Buffer.allocUnsafe || (len => new global.Buffer(len))
+ : len => new Uint8Array(len);
+
+/** Creates a memory stream that can be used in place of stdout/stderr. */
+export function createMemoryStream(fn) {
+ var stream = [];
+ stream.write = function(chunk) {
+ if (fn) fn(chunk);
+ if (typeof chunk === "string") {
+ let buffer = allocBuffer(utf8.length(chunk));
+ utf8.write(chunk, buffer, 0);
+ chunk = buffer;
+ }
+ this.push(chunk);
+ };
+ stream.reset = function() {
+ stream.length = 0;
+ };
+ stream.toBuffer = function() {
+ var offset = 0, i = 0, k = this.length;
+ while (i < k) offset += this[i++].length;
+ var buffer = allocBuffer(offset);
+ offset = i = 0;
+ while (i < k) {
+ buffer.set(this[i], offset);
+ offset += this[i].length;
+ ++i;
+ }
+ return buffer;
+ };
+ stream.toString = function() {
+ var buffer = this.toBuffer();
+ return utf8.read(buffer, 0, buffer.length);
+ };
+ return stream;
+}
+
+/** Compatible TypeScript compiler options for syntax highlighting etc. */
+export const tscOptions = {
+ alwaysStrict: true,
+ strictNullChecks: true,
+ noImplicitAny: true,
+ noImplicitReturns: true,
+ noImplicitThis: true,
+ noEmitOnError: true,
+ noPropertyAccessFromIndexSignature: true,
+ experimentalDecorators: true,
+ target: "esnext",
+ noLib: true,
+ types: [],
+ allowJs: false
+};
+
+export * as default from "./index.js";
diff --git a/cli/asc.json b/cli/options.json
similarity index 85%
rename from cli/asc.json
rename to cli/options.json
index e8b049cf63..c68bc7e72a 100644
--- a/cli/asc.json
+++ b/cli/options.json
@@ -11,12 +11,6 @@
"type": "b",
"alias": "h"
},
- "noColors": {
- "category": "General",
- "description": "Disables terminal colors.",
- "type": "b",
- "default": false
- },
"config": {
"category": "General",
"description": "Configuration file to apply. CLI arguments take precedence.",
@@ -25,7 +19,7 @@
},
"target": {
"category": "General",
- "description": "Target configuration to use. Defaults to 'release'.",
+ "description": "Configuration file target to use. Defaults to 'release'.",
"type": "s",
"cliOnly": true
},
@@ -70,45 +64,30 @@
"outFile": {
"category": "Output",
- "description": "Specifies the output file. File extension indicates format.",
+ "description": "Specifies the WebAssembly output file (.wasm).",
"type": "s",
"alias": "o",
"isPath": true
},
- "binaryFile": {
- "category": "Output",
- "description": "Specifies the binary output file (.wasm).",
- "type": "s",
- "alias": "b",
- "isPath": true
- },
"textFile": {
"category": "Output",
- "description": "Specifies the text output file (.wat).",
+ "description": "Specifies the WebAssembly text output file (.wat).",
"type": "s",
"alias": "t",
"isPath": true
},
- "jsFile": {
- "category": "Output",
- "description": "Specifies the JavaScript (via wasm2js) output file (.js).",
- "type": "s",
- "alias": "j",
- "isPath": true
- },
- "idlFile": {
+ "bindings": {
"category": "Output",
- "description": "Specifies the WebIDL output file (.webidl).",
- "type": "s",
- "alias": "i",
- "isPath": true
- },
- "tsdFile": {
- "category": "Output",
- "description": "Specifies the TypeScript definition output file (.d.ts).",
- "type": "s",
- "alias": "d",
- "isPath": true
+ "description": [
+ "Specifies the bindings to generate (.js + .d.ts).",
+ "",
+ " esm JavaScript bindings & typings for ESM integration.",
+ " raw Like esm, but exports just the instantiate function.",
+ " Useful where modules are meant to be instantiated",
+ " multiple times or non-ESM imports must be provided."
+ ],
+ "type": "S",
+ "alias": "b"
},
"sourceMap": {
@@ -158,7 +137,7 @@
},
"zeroFilledMemory": {
"category": "Features",
- "description": "Assume that imported memory is zero filled. Requires importMemory.",
+ "description": "Assume imported memory is zeroed. Requires importMemory.",
"type": "b",
"default": false
},
@@ -174,6 +153,15 @@
"type": "b",
"default": false
},
+ "exportStart": {
+ "category": "Features",
+ "description": [
+ "Exports the start function using the specified name instead",
+ "of calling it implicitly. Useful for WASI or to obtain the",
+ "exported memory before executing any code accessing it."
+ ],
+ "type": "s"
+ },
"runtime": {
"category": "Features",
"description": [
@@ -204,21 +192,13 @@
"default": 0,
"type": "i"
},
- "explicitStart": {
- "category": "Features",
- "description": "Exports an explicit '_start' function to call.",
- "type": "b",
- "default": false
- },
"enable": {
"category": "Features",
"description": [
"Enables WebAssembly features being disabled by default.",
"",
- " nontrapping-f2i Non-trapping float to integer ops.",
- " bulk-memory Bulk memory operations.",
- " simd SIMD types and operations.",
" threads Threading and atomic operations.",
+ " simd SIMD types and operations.",
" reference-types Reference types and operations.",
" gc Garbage collection (WIP).",
""
@@ -227,7 +207,10 @@
" exception-handling Exception handling.",
" tail-calls Tail call operations.",
" multi-value Multi value types.",
- " memory64 Memory64 operations."
+ " memory64 Memory64 operations.",
+ " function-references Function reference types.",
+ " relaxed-simd Relaxed SIMD operations.",
+ " extended-const Extended const expressions."
],
"type": "S",
"mutuallyExclusive": "disable"
@@ -239,6 +222,8 @@
"",
" mutable-globals Mutable global imports and exports.",
" sign-extension Sign-extension operations",
+ " nontrapping-f2i Non-trapping float to integer ops.",
+ " bulk-memory Bulk memory operations.",
""
],
"type": "S",
@@ -276,7 +261,7 @@
"transform": {
"category": "API",
- "description": "Specifies the path to a custom transform to 'require'.",
+ "description": "Specifies the path to a custom transform to load.",
"type": "S",
"isPath": true,
"useNodeResolution": true
@@ -315,10 +300,10 @@
"type": "s",
"default": "."
},
- "extension": {
- "description": "Specifies an alternative file extension to use.",
- "type": "s",
- "cliOnly": true
+ "noColors": {
+ "description": "Disables terminal colors.",
+ "type": "b",
+ "default": false
},
"noUnsafe": {
"description": [
@@ -338,8 +323,8 @@
"type": "b",
"default": false
},
- "measure": {
- "description": "Prints measuring information on I/O and compile times.",
+ "stats": {
+ "description": "Prints statistics on I/O and compile times.",
"type": "b",
"default": false
},
@@ -365,16 +350,6 @@
"type": "S",
"isPath": true
},
- "traceResolution": {
- "description": "Enables tracing of package resolution.",
- "type": "b",
- "default": false
- },
- "listFiles": {
- "description": "Lists files to be compiled and exits.",
- "type": "b",
- "default": false
- },
"wasm": {
"description": "Uses the specified Wasm binary of the compiler.",
"type": "s"
@@ -397,5 +372,6 @@
"-O2z": { "value": { "optimizeLevel": 2, "shrinkLevel": 2 } },
"-O3z": { "value": { "optimizeLevel": 3, "shrinkLevel": 2 } },
"-Ospeed": { "value": { "optimizeLevel": 3, "shrinkLevel": 0 } },
- "-Osize": { "value": { "optimizeLevel": 0, "shrinkLevel": 2, "converge": true } }
+ "-Osize": { "value": { "optimizeLevel": 0, "shrinkLevel": 2, "converge": true } },
+ "--measure": { "value": { "stats": true } }
}
diff --git a/cli/shim/README.md b/cli/shim/README.md
deleted file mode 100644
index 73b7e60d3c..0000000000
--- a/cli/shim/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Shims used when bundling asc for browser usage.
diff --git a/cli/shim/fs.js b/cli/shim/fs.js
deleted file mode 100644
index f053ebf797..0000000000
--- a/cli/shim/fs.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = {};
diff --git a/cli/shim/path.js b/cli/shim/path.js
deleted file mode 100644
index 28978caf27..0000000000
--- a/cli/shim/path.js
+++ /dev/null
@@ -1,531 +0,0 @@
-const process = require("process"); // ensure shim
-
-// https://github.com/browserify/path-browserify v1.0.1
-//
-// Copyright (c) 2013 James Halliday
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// 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.
-
-function assertPath(path) {
- if (typeof path !== 'string') {
- throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
- }
-}
-
-// Resolves . and .. elements in a path with directory names
-function normalizeStringPosix(path, allowAboveRoot) {
- var res = '';
- var lastSegmentLength = 0;
- var lastSlash = -1;
- var dots = 0;
- var code;
- for (var i = 0; i <= path.length; ++i) {
- if (i < path.length)
- code = path.charCodeAt(i);
- else if (code === 47 /*/*/)
- break;
- else
- code = 47 /*/*/;
- if (code === 47 /*/*/) {
- if (lastSlash === i - 1 || dots === 1) {
- // NOOP
- } else if (lastSlash !== i - 1 && dots === 2) {
- if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
- if (res.length > 2) {
- var lastSlashIndex = res.lastIndexOf('/');
- if (lastSlashIndex !== res.length - 1) {
- if (lastSlashIndex === -1) {
- res = '';
- lastSegmentLength = 0;
- } else {
- res = res.slice(0, lastSlashIndex);
- lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
- }
- lastSlash = i;
- dots = 0;
- continue;
- }
- } else if (res.length === 2 || res.length === 1) {
- res = '';
- lastSegmentLength = 0;
- lastSlash = i;
- dots = 0;
- continue;
- }
- }
- if (allowAboveRoot) {
- if (res.length > 0)
- res += '/..';
- else
- res = '..';
- lastSegmentLength = 2;
- }
- } else {
- if (res.length > 0)
- res += '/' + path.slice(lastSlash + 1, i);
- else
- res = path.slice(lastSlash + 1, i);
- lastSegmentLength = i - lastSlash - 1;
- }
- lastSlash = i;
- dots = 0;
- } else if (code === 46 && dots !== -1) {
- ++dots;
- } else {
- dots = -1;
- }
- }
- return res;
-}
-
-function _format(sep, pathObject) {
- var dir = pathObject.dir || pathObject.root;
- var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
- if (!dir) {
- return base;
- }
- if (dir === pathObject.root) {
- return dir + base;
- }
- return dir + sep + base;
-}
-
-var posix = {
- // path.resolve([from ...], to)
- resolve: function resolve() {
- var resolvedPath = '';
- var resolvedAbsolute = false;
- var cwd;
-
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path;
- if (i >= 0)
- path = arguments[i];
- else {
- if (cwd === undefined)
- cwd = process.cwd();
- path = cwd;
- }
-
- assertPath(path);
-
- // Skip empty entries
- if (path.length === 0) {
- continue;
- }
-
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
- }
-
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
-
- // Normalize the path
- resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
-
- if (resolvedAbsolute) {
- if (resolvedPath.length > 0)
- return '/' + resolvedPath;
- else
- return '/';
- } else if (resolvedPath.length > 0) {
- return resolvedPath;
- } else {
- return '.';
- }
- },
-
- normalize: function normalize(path) {
- assertPath(path);
-
- if (path.length === 0) return '.';
-
- var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
- var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
-
- // Normalize the path
- path = normalizeStringPosix(path, !isAbsolute);
-
- if (path.length === 0 && !isAbsolute) path = '.';
- if (path.length > 0 && trailingSeparator) path += '/';
-
- if (isAbsolute) return '/' + path;
- return path;
- },
-
- isAbsolute: function isAbsolute(path) {
- assertPath(path);
- return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
- },
-
- join: function join() {
- if (arguments.length === 0)
- return '.';
- var joined;
- for (var i = 0; i < arguments.length; ++i) {
- var arg = arguments[i];
- assertPath(arg);
- if (arg.length > 0) {
- if (joined === undefined)
- joined = arg;
- else
- joined += '/' + arg;
- }
- }
- if (joined === undefined)
- return '.';
- return posix.normalize(joined);
- },
-
- relative: function relative(from, to) {
- assertPath(from);
- assertPath(to);
-
- if (from === to) return '';
-
- from = posix.resolve(from);
- to = posix.resolve(to);
-
- if (from === to) return '';
-
- if (from === ".") return to; // FIX for 'odule.ts' (see issue #1398)
-
- // Trim any leading backslashes
- var fromStart = 1;
- for (; fromStart < from.length; ++fromStart) {
- if (from.charCodeAt(fromStart) !== 47 /*/*/)
- break;
- }
- var fromEnd = from.length;
- var fromLen = fromEnd - fromStart;
-
- // Trim any leading backslashes
- var toStart = 1;
- for (; toStart < to.length; ++toStart) {
- if (to.charCodeAt(toStart) !== 47 /*/*/)
- break;
- }
- var toEnd = to.length;
- var toLen = toEnd - toStart;
-
- // Compare paths to find the longest common path from root
- var length = fromLen < toLen ? fromLen : toLen;
- var lastCommonSep = -1;
- var i = 0;
- for (; i <= length; ++i) {
- if (i === length) {
- if (toLen > length) {
- if (to.charCodeAt(toStart + i) === 47 /*/*/) {
- // We get here if `from` is the exact base path for `to`.
- // For example: from='/foo/bar'; to='/foo/bar/baz'
- return to.slice(toStart + i + 1);
- } else if (i === 0) {
- // We get here if `from` is the root
- // For example: from='/'; to='/foo'
- return to.slice(toStart + i);
- }
- } else if (fromLen > length) {
- if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
- // We get here if `to` is the exact base path for `from`.
- // For example: from='/foo/bar/baz'; to='/foo/bar'
- lastCommonSep = i;
- } else if (i === 0) {
- // We get here if `to` is the root.
- // For example: from='/foo'; to='/'
- lastCommonSep = 0;
- }
- }
- break;
- }
- var fromCode = from.charCodeAt(fromStart + i);
- var toCode = to.charCodeAt(toStart + i);
- if (fromCode !== toCode)
- break;
- else if (fromCode === 47 /*/*/)
- lastCommonSep = i;
- }
-
- var out = '';
- // Generate the relative path based on the path difference between `to`
- // and `from`
- for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
- if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
- if (out.length === 0)
- out += '..';
- else
- out += '/..';
- }
- }
-
- // Lastly, append the rest of the destination (`to`) path that comes after
- // the common path parts
- if (out.length > 0)
- return out + to.slice(toStart + lastCommonSep);
- else {
- toStart += lastCommonSep;
- if (to.charCodeAt(toStart) === 47 /*/*/)
- ++toStart;
- return to.slice(toStart);
- }
- },
-
- _makeLong: function _makeLong(path) {
- return path;
- },
-
- dirname: function dirname(path) {
- assertPath(path);
- if (path.length === 0) return '.';
- var code = path.charCodeAt(0);
- var hasRoot = code === 47 /*/*/;
- var end = -1;
- var matchedSlash = true;
- for (var i = path.length - 1; i >= 1; --i) {
- code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- if (!matchedSlash) {
- end = i;
- break;
- }
- } else {
- // We saw the first non-path separator
- matchedSlash = false;
- }
- }
-
- if (end === -1) return hasRoot ? '/' : '.';
- if (hasRoot && end === 1) return '//';
- return path.slice(0, end);
- },
-
- basename: function basename(path, ext) {
- if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
- assertPath(path);
-
- var start = 0;
- var end = -1;
- var matchedSlash = true;
- var i;
-
- if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
- if (ext.length === path.length && ext === path) return '';
- var extIdx = ext.length - 1;
- var firstNonSlashEnd = -1;
- for (i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else {
- if (firstNonSlashEnd === -1) {
- // We saw the first non-path separator, remember this index in case
- // we need it if the extension ends up not matching
- matchedSlash = false;
- firstNonSlashEnd = i + 1;
- }
- if (extIdx >= 0) {
- // Try to match the explicit extension
- if (code === ext.charCodeAt(extIdx)) {
- if (--extIdx === -1) {
- // We matched the extension, so mark this as the end of our path
- // component
- end = i;
- }
- } else {
- // Extension does not match, so our result is the entire path
- // component
- extIdx = -1;
- end = firstNonSlashEnd;
- }
- }
- }
- }
-
- if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
- return path.slice(start, end);
- } else {
- for (i = path.length - 1; i >= 0; --i) {
- if (path.charCodeAt(i) === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // path component
- matchedSlash = false;
- end = i + 1;
- }
- }
-
- if (end === -1) return '';
- return path.slice(start, end);
- }
- },
-
- extname: function extname(path) {
- assertPath(path);
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- // Track the state of characters (if any) we see before our first dot and
- // after any path separator we find
- var preDotState = 0;
- for (var i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // extension
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46) {
- // If this is our first dot, mark it as the start of our extension
- if (startDot === -1)
- startDot = i;
- else if (preDotState !== 1)
- preDotState = 1;
- } else if (startDot !== -1) {
- // We saw a non-dot and non-path separator before our dot, so we should
- // have a good chance at having a non-empty extension
- preDotState = -1;
- }
- }
-
- if (startDot === -1 || end === -1 ||
- // We saw a non-dot character immediately before the dot
- preDotState === 0 ||
- // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return '';
- }
- return path.slice(startDot, end);
- },
-
- format: function format(pathObject) {
- if (pathObject === null || typeof pathObject !== 'object') {
- throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
- }
- return _format('/', pathObject);
- },
-
- parse: function parse(path) {
- assertPath(path);
-
- var ret = { root: '', dir: '', base: '', ext: '', name: '' };
- if (path.length === 0) return ret;
- var code = path.charCodeAt(0);
- var isAbsolute = code === 47 /*/*/;
- var start;
- if (isAbsolute) {
- ret.root = '/';
- start = 1;
- } else {
- start = 0;
- }
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- var i = path.length - 1;
-
- // Track the state of characters (if any) we see before our first dot and
- // after any path separator we find
- var preDotState = 0;
-
- // Get non-dir info
- for (; i >= start; --i) {
- code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // extension
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46) {
- // If this is our first dot, mark it as the start of our extension
- if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
- } else if (startDot !== -1) {
- // We saw a non-dot and non-path separator before our dot, so we should
- // have a good chance at having a non-empty extension
- preDotState = -1;
- }
- }
-
- if (startDot === -1 || end === -1 ||
- // We saw a non-dot character immediately before the dot
- preDotState === 0 ||
- // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- if (end !== -1) {
- if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
- }
- } else {
- if (startPart === 0 && isAbsolute) {
- ret.name = path.slice(1, startDot);
- ret.base = path.slice(1, end);
- } else {
- ret.name = path.slice(startPart, startDot);
- ret.base = path.slice(startPart, end);
- }
- ret.ext = path.slice(startDot, end);
- }
-
- if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
-
- return ret;
- },
-
- sep: '/',
- delimiter: ':',
- win32: null,
- posix: null
-};
-
-posix.posix = posix;
-
-module.exports = posix;
diff --git a/cli/transform.d.ts b/cli/transform.d.ts
deleted file mode 100644
index c63b3cb4ee..0000000000
--- a/cli/transform.d.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @fileoverview Compiler transform interface definitions.
- * @license Apache-2.0
- */
-
-import { Program, Parser, Module } from "..";
-import { OutputStream } from "./asc";
-
-export abstract class Transform {
-
- /** Program reference. */
- readonly program: Program;
-
- /** Base directory. */
- readonly baseDir: string;
-
- /** Output stream used by the compiler. */
- readonly stdout: OutputStream;
-
- /** Error stream used by the compiler. */
- readonly stderr: OutputStream;
-
- /** Logs a message to console. */
- readonly log: typeof console.log;
-
- /** Writes a file to disk. */
- writeFile(filename: string, contents: string | Uint8Array, baseDir: string): boolean;
-
- /** Reads a file from disk. */
- readFile(filename: string, baseDir: string): string | null;
-
- /** Lists all files in a directory. */
- listFiles(dirname: string, baseDir: string): string[] | null;
-
- /** Called when parsing is complete, before a program is instantiated from the AST. */
- afterParse?(parser: Parser): void;
-
- /** Called after the program is instantiated. */
- afterInitialize?(program: Program): void;
-
- /** Called when compilation is complete, before the module is being validated. */
- afterCompile?(module: Module): void;
-}
diff --git a/cli/transform.js b/cli/transform.js
deleted file mode 100644
index 8f68d7a2e5..0000000000
--- a/cli/transform.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * @fileoverview Compiler transform interface.
- * @license Apache-2.0
- */
-
-// becomes replaced with the actual base by asc
-exports.Transform = function Transform() { /* nop */ };
diff --git a/cli/tsconfig.json b/cli/tsconfig.json
new file mode 100644
index 0000000000..bcb1b8a11d
--- /dev/null
+++ b/cli/tsconfig.json
@@ -0,0 +1,6 @@
+{
+ "extends": "../tsconfig-base.json",
+ "include": [
+ "./**/*.ts"
+ ]
+}
diff --git a/cli/util/colors.d.ts b/cli/util/colors.d.ts
deleted file mode 100644
index 75d689a50f..0000000000
--- a/cli/util/colors.d.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @fileoverview Terminal colors utility definitions.
- * @license Apache-2.0
- */
-
-interface Colors {
- /** Whether terminal colors are supported. */
- supported: boolean;
- /** Colors a string in gray if {@link supported}. */
- gray(text: string): string;
- /** Colors a string in red if {@link supported}. */
- red(text: string): string;
- /** Colors a string in green if {@link supported}. */
- green(text: string): string;
- /** Colors a string in yellow if {@link supported}. */
- yellow(text: string): string;
- /** Colors a string in blue if {@link supported}. */
- blue(text: string): string;
- /** Colors a string in magenta if {@link supported}. */
- magenta(text: string): string;
- /** Colors a string in cyan if {@link supported}. */
- cyan(text: string): string;
- /** Colors a string in white if {@link supported}. */
- white(text: string): string;
-}
-
-interface Exports extends Colors {
- /** Standard output wrapper. */
- stdout: Colors;
- /** Standard error wrapper. */
- stderr: Colors;
- /** Creates an instance for the specified stream. */
- from(stream: Record, base?: Record): Colors;
- /** Gray color escape sequence. */
- GRAY: string;
- /** Red color escape sequence. */
- RED: string;
- /** Green color escape sequence. */
- GREEN: string;
- /** Yellow color escape sequence. */
- YELLOW: string;
- /** Blue color escape sequence. */
- BLUE: string;
- /** Magenta color escape sequence. */
- MAGENTA: string;
- /** Cyan color escape sequence. */
- CYAN: string;
- /** White color escape sequence. */
- WHITE: string;
- /** Reset color escape sequence. */
- RESET: string;
-}
-
-declare const colors: Exports;
-export = colors;
diff --git a/cli/util/colors.js b/cli/util/colors.js
deleted file mode 100644
index 798960c7a0..0000000000
--- a/cli/util/colors.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @fileoverview Terminal colors utility.
- * @license Apache-2.0
- */
-
-var proc = typeof process !== "undefined" && process || {};
-var isCI = proc.env && "CI" in proc.env; // doesn't work when bundled because 'process' is a mock
-
-function from(stream, base) {
- var colors = base || {};
- colors.supported = (stream && !!stream.isTTY) || isCI;
- colors.gray = text => colors.supported ? exports.GRAY + text + exports.RESET : text;
- colors.red = text => colors.supported ? exports.RED + text + exports.RESET : text;
- colors.green = text => colors.supported ? exports.GREEN + text + exports.RESET : text;
- colors.yellow = text => colors.supported ? exports.YELLOW + text + exports.RESET : text;
- colors.blue = text => colors.supported ? exports.BLUE + text + exports.RESET : text;
- colors.magenta = text => colors.supported ? exports.MAGENTA + text + exports.RESET : text;
- colors.cyan = text => colors.supported ? exports.CYAN + text + exports.RESET : text;
- colors.white = text => colors.supported ? exports.WHITE + text + exports.RESET : text;
- return colors;
-}
-
-exports.stdout = from(proc.stdout, exports);
-exports.stderr = from(proc.stderr);
-exports.from = from;
-
-exports.GRAY = "\u001b[90m";
-exports.RED = "\u001b[91m";
-exports.GREEN = "\u001b[92m";
-exports.YELLOW = "\u001b[93m";
-exports.BLUE = "\u001b[94m";
-exports.MAGENTA = "\u001b[95m";
-exports.CYAN = "\u001b[96m";
-exports.WHITE = "\u001b[97m";
-exports.RESET = "\u001b[0m";
diff --git a/cli/util/find.d.ts b/cli/util/find.d.ts
deleted file mode 100644
index cc2aeaed37..0000000000
--- a/cli/util/find.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * @fileoverview File finding utility definitions.
- * @license Apache-2.0
- */
-
-export function files(dirname: string, filter?: ((name: string) => bool) | RegExp): string[];
diff --git a/cli/util/mkdirp.d.ts b/cli/util/mkdirp.d.ts
deleted file mode 100644
index 7a0658d500..0000000000
--- a/cli/util/mkdirp.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * @fileoverview Recursive mkdir definitions.
- * @license Apache-2.0
- */
-
-interface Options {
- mode?: number;
-}
-declare function mkdirp(path: string, options?: Options): string | null;
-export = mkdirp;
diff --git a/cli/util/mkdirp.js b/cli/util/mkdirp.js
deleted file mode 100644
index 24d94043b0..0000000000
--- a/cli/util/mkdirp.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @fileoverview Recursive mkdir.
- * @license
- * Copyright 2010 James Halliday (mail@substack.net)
- *
- * This project is free software released under the MIT/X11 license:
- *
- * 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.
- */
-
-const path = require("path");
-const fs = require("fs");
-const process = require("process"); // ensure shim
-
-module.exports = function mkdirp(p, opts, made) {
- if (!opts || typeof opts !== "object") {
- opts = { mode: opts };
- }
- var mode = opts.mode;
- if (mode === undefined) {
- mode = 0o777 & (~process.umask());
- }
- if (!made) made = null;
- p = path.resolve(p);
- try {
- fs.mkdirSync(p, mode);
- made = made || p;
- } catch (err0) {
- switch (err0.code) {
- case "ENOENT":
- made = mkdirp(path.dirname(p), opts, made);
- mkdirp(p, opts, made);
- break;
- default:
- var stat;
- try {
- stat = fs.statSync(p);
- } catch (err1) {
- throw err0;
- }
- if (!stat.isDirectory()) throw err0;
- break;
- }
- }
- return made;
-};
diff --git a/cli/util/utf8.d.ts b/cli/util/utf8.d.ts
deleted file mode 100644
index d419c041e3..0000000000
--- a/cli/util/utf8.d.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @fileoverview UTF8 utility definitions.
- * @license Apache-2.0
- */
-
-/**
- * Calculates the UTF8 byte length of a string.
- * @param {string} string String
- * @returns {number} Byte length
- */
-export function length(string: string): number;
-
-/**
- * Reads UTF8 bytes as a string.
- * @param {Uint8Array} buffer Source buffer
- * @param {number} start Source start
- * @param {number} end Source end
- * @returns {string} String read
- */
-export function read(buffer: Uint8Array, start: number, end: number): string;
-
-/**
- * Writes a string as UTF8 bytes.
- * @param {string} string Source string
- * @param {Uint8Array} buffer Destination buffer
- * @param {number} offset Destination offset
- * @returns {number} Bytes written
- */
-export function write(string: string, buffer: Uint8Array, offset: number): number;
diff --git a/cli/util/utf8.js b/cli/util/utf8.js
deleted file mode 100644
index 22f16671e9..0000000000
--- a/cli/util/utf8.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * @fileoverview UTF8 utility.
- * @license Apache-2.0
- */
-
-// @protobufjs/utf8
-
-/**
- * A minimal UTF8 implementation for number arrays.
- * @memberof util
- * @namespace
- */
-var utf8 = exports;
-
-/**
- * Calculates the UTF8 byte length of a string.
- * @param {string} string String
- * @returns {number} Byte length
- */
-utf8.length = function utf8_length(string) {
- var len = 0,
- c = 0;
- for (var i = 0, l = string.length; i < l; ++i) {
- c = string.charCodeAt(i);
- if (c < 128)
- len += 1;
- else if (c < 2048)
- len += 2;
- else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
- ++i;
- len += 4;
- } else
- len += 3;
- }
- return len;
-};
-
-/**
- * Reads UTF8 bytes as a string.
- * @param {Uint8Array} buffer Source buffer
- * @param {number} start Source start
- * @param {number} end Source end
- * @returns {string} String read
- */
-utf8.read = function utf8_read(buffer, start, end) {
- var len = end - start;
- if (len < 1)
- return "";
- var parts = null,
- chunk = [],
- i = 0, // char offset
- t; // temporary
- while (start < end) {
- t = buffer[start++];
- if (t < 128)
- chunk[i++] = t;
- else if (t > 191 && t < 224)
- chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
- else if (t > 239 && t < 365) {
- t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
- chunk[i++] = 0xD800 + (t >> 10);
- chunk[i++] = 0xDC00 + (t & 1023);
- } else
- chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
- if (i > 8191) {
- (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
- i = 0;
- }
- }
- if (parts) {
- if (i)
- parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
- return parts.join("");
- }
- return String.fromCharCode.apply(String, chunk.slice(0, i));
-};
-
-/**
- * Writes a string as UTF8 bytes.
- * @param {string} string Source string
- * @param {Uint8Array} buffer Destination buffer
- * @param {number} offset Destination offset
- * @returns {number} Bytes written
- */
-utf8.write = function utf8_write(string, buffer, offset) {
- var start = offset,
- c1, // character 1
- c2; // character 2
- for (var i = 0; i < string.length; ++i) {
- c1 = string.charCodeAt(i);
- if (c1 < 128) {
- buffer[offset++] = c1;
- } else if (c1 < 2048) {
- buffer[offset++] = c1 >> 6 | 192;
- buffer[offset++] = c1 & 63 | 128;
- } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
- c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
- ++i;
- buffer[offset++] = c1 >> 18 | 240;
- buffer[offset++] = c1 >> 12 & 63 | 128;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- } else {
- buffer[offset++] = c1 >> 12 | 224;
- buffer[offset++] = c1 >> 6 & 63 | 128;
- buffer[offset++] = c1 & 63 | 128;
- }
- }
- return offset - start;
-};
diff --git a/index.d.ts b/index.d.ts
deleted file mode 100644
index c039a8000c..0000000000
--- a/index.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import "./src/glue/js";
-export * from "./src";
diff --git a/index.js b/index.js
deleted file mode 100644
index a2ab787e8e..0000000000
--- a/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-require("ts-node").register({
- project: require("path").join(__dirname, "src", "tsconfig.json"),
- compilerHost: true,
- skipIgnore: true,
- files: true,
- compilerOptions: {
- removeComments: false
- }
-});
-require("./src/glue/js");
-module.exports = require("./src");
diff --git a/index.release.d.ts b/index.release.d.ts
deleted file mode 100644
index 388aca2060..0000000000
--- a/index.release.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-export * from "assemblyscript";
diff --git a/index.release.js b/index.release.js
deleted file mode 100644
index b459cec30a..0000000000
--- a/index.release.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./dist/assemblyscript");
diff --git a/lib/README.md b/lib/README.md
new file mode 100644
index 0000000000..9ac01cc665
--- /dev/null
+++ b/lib/README.md
@@ -0,0 +1,14 @@
+Library
+=======
+
+Additional packages provided by the main package.
+
+| Package | Description
+|------------------------------------|-------------------------
+| [@assemblyscript/loader](./loader) | Module loader utility
+| [@assemblyscript/rtrace](./rtrace) | Runtime tracing utility
+| binaryen | Binaryen proxy
+
+The Binaryen proxy herein is imported accross the code base and forwards the
+`binaryen` npm package by default. It can be modified to use a custom build,
+for example for testing purposes.
diff --git a/lib/binaryen.d.ts b/lib/binaryen.d.ts
new file mode 100644
index 0000000000..facd164949
--- /dev/null
+++ b/lib/binaryen.d.ts
@@ -0,0 +1,2 @@
+export * from "binaryen";
+export { default } from "binaryen";
diff --git a/lib/binaryen.js b/lib/binaryen.js
new file mode 100644
index 0000000000..facd164949
--- /dev/null
+++ b/lib/binaryen.js
@@ -0,0 +1,2 @@
+export * from "binaryen";
+export { default } from "binaryen";
diff --git a/lib/loader/README.md b/lib/loader/README.md
index 58ce74c630..ff1e805977 100644
--- a/lib/loader/README.md
+++ b/lib/loader/README.md
@@ -1,5 +1,318 @@
# AssemblyScript Loader
-A convenient loader for [AssemblyScript](https://assemblyscript.org) modules. Demangles module exports to a friendly object structure compatible with TypeScript definitions and provides useful utility to read/write data from/to memory.
+A tiny module loader that makes working with AssemblyScript modules as convenient as it gets without sacrificing efficiency. It about mirrors the relevant parts of the WebAssembly API while also providing utility to allocate and read strings, arrays and classes.
-[Documentation](https://assemblyscript.org/loader.html)
+**DEPRECATION NOTICE:** The loader has been deprecated in AssemblyScript 0.20. It will likely continue to work for a while, but it is recommended to switch to the new [static bindings](https://www.assemblyscript.org/compiler.html#host-bindings) generation.
+
+## Example
+
+```ts
+import loader from "@assemblyscript/loader"; // or require
+loader.instantiate(
+ // Binary to instantiate
+ fetch("optimized.wasm"), // or fs.readFileSync
+ // or fs.promises.readFile
+ // or just a buffer
+ // Additional imports
+ { ... }
+).then(({ exports }) => {
+ ...
+})
+```
+
+The loader basically instantiates the module using `WebAssembly` APIs, but also adds additional utility.
+
+## Installation
+
+The loader can be installed from [npm](https://www.npmjs.com/package/@assemblyscript/loader):
+
+```sh
+npm install --save @assemblyscript/loader
+```
+
+On the web:
+
+```html
+
+
+
+
+```
+
+## Usage
+
+One task the loader does not perform is to implicitly translate between WebAssembly pointers and JavaScript objects, and that's where the mixed in utility comes into play. For example, if one has
+
+```ts
+// AssemblyScript
+export function concat(a: string, b: string): string {
+ return a + b
+}
+```
+
+and then wants to call `concat` externally, the string arguments cannot just be JavaScript strings but must first be allocated in the module's memory with their lifetime tracked, like so:
+
+```js
+// JavaScript
+const { concat } = myModule.exports
+const { __newString, __getString } = myModule.exports
+
+function doConcat(aStr, bStr) {
+ let aPtr = __newString(aStr)
+ let bPtr = __newString(bStr)
+ let cPtr = concat(aPtr, bPtr)
+ let cStr = __getString(cPtr)
+ return cStr
+}
+
+console.log(doConcat("Hello ", "world!"))
+```
+
+### Creating arrays
+
+Arrays (or more advanced classes for that matter) require a bit more cooperation because we need to know their value type in order to work with them properly. To achieve this, every class has a unique id internally, and a chunk of runtime type information (RTTI) is shipped with the module to evaluate class types. Here's an example of working with an `Int32Array`:
+
+```ts
+// AssemblyScript
+export function sum(arr: Int32Array): i32 {
+ let sum = 0
+ for (let i = 0, k = arr.length; i < k; ++i) {
+ sum += unchecked(arr[i])
+ }
+ return sum
+}
+export const Int32Array_ID = idof()
+```
+
+```js
+// JavaScript
+const { sum, Int32Array_ID } = myModule.exports
+const { __newArray } = myModule.exports
+
+function doSum(values) {
+ const arrPtr = __newArray(Int32Array_ID, values)
+ return sum(arrPtr)
+}
+
+console.log(doSum([1, 2, 3]))
+```
+
+This works with all kinds of arrays, except that ids are different and values are interpreted differently, of course.
+
+### Reading arrays
+
+If one is instead interested in the values of an array being returned by the module, there are two approaches to this. Let's say we have the following module:
+
+```ts
+// AssemblyScript
+export function getRandomArray(len: i32): Int32Array {
+ const arr = new Int32Array(len)
+ // fill with random values
+ return arr
+}
+```
+
+The first is, obviously, to read the array's values from the module's memory by essentially copying them to a JS array
+
+```js
+// JavaScript
+const { getRandomArray } = myModule.exports
+const { __getArray } = myModule.exports
+
+function doGetRandomArray(len) {
+ const arrPtr = getRandomArray(len)
+ const values = __getArray(arrPtr)
+ return values
+}
+
+console.log(doGetRandomArray(10))
+```
+
+which is always safe, while the second is to create a live view on the array, enabling two-way modification of its values:
+
+```js
+// JavaScript
+const { getRandomArray } = myModule.exports
+const { __getArrayView, __pin, __unpin } = myModule.exports
+
+function doGetRandomArrayView(len) {
+ const arrPtr = __pin(getRandomArray(len)) // pin if necessary
+ const view = __getArrayView(arrPtr)
+ return { ptr, view }
+}
+
+const randomArray = doGetRandomArrayView(10)
+console.log(randomArray.view)
+__unpin(randomArray.ptr) // unpin if necessary
+```
+
+The latter variant can be more efficient (and useful) but is a little dangerous because the view may become detached from the module's memory when memory automatically grows. Also, the viewed array can grow automatically when pushed to, with the view then referencing random memory. Pushing to an array can be avoided quite easily, yet it is notoriously hard to predict when module memory grows - but one can try to set a sufficiently large size of `--initialMemory` or defensively trigger a sufficiently large dynamic allocation being freed immediately before dealing with potentially problematic views.
+
+### Custom classes
+
+As mentioned earlier, the loader understands how to make a nice object structure of a module's exports, and it is possible to utilize it to work with classes in a more natural way. For example, when calling the following function externally
+
+```ts
+// AssemblyScript
+export class Foo {
+ constructor(public str: string) {}
+ getString(): string {
+ return this.str
+ }
+}
+
+export function getFoo(): Foo { // this one
+ return new Foo("Hello world!")
+}
+```
+
+one can wrap the received pointer in a `myModule.exports.Foo` instance:
+
+```js
+// JavaScript
+const { Foo, getFoo } = myModule.exports
+const { __getString, __pin, __unpin } = myModule.exports
+
+const fooPtr = __pin(getFoo()) // pin if necessary
+const foo = Foo.wrap(fooPtr)
+const strPtr = foo.getString()
+console.log(__getString(strPtr))
+__unpin(fooPtr) // unpin if necessary
+```
+
+## API
+
+For reference, here comes the full API provided by the loader.
+
+::: tip
+Copying from and extending the examples above is typically sufficient.
+:::
+
+### Static members
+
+* ```ts
+ function instantiate(
+ moduleOrBuffer: WasmInstantiable,
+ imports?: WasmImports
+ ): Promise
+ ```
+ Asynchronously instantiates an AssemblyScript module from anything that can be instantiated.
+
+* ```ts
+ function instantiateSync(
+ moduleOrBuffer: WasmInstantiable,
+ imports?: WasmImports
+ ): ASUtil & T
+ ```
+ Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. Not recommended.
+
+* ```ts
+ function instantiateStreaming(
+ response: Response | PromiseLike,
+ imports?: WasmImports
+ ): Promise
+ ```
+ Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by fetch.
+
+* ```ts
+ function demangle(
+ exports: WasmExports,
+ baseModule?: Object
+ ): T
+ ```
+ Demangles an AssemblyScript module's exports to a friendly object structure. You usually don't have to call this manually as instantiation does this implicitly.
+
+Note that `T` above can either be omitted if the shape of the module is unknown, or can reference a `.d.ts` (i.e. `typeof MyModule`) as produced by the compiler with the `-d` option.
+
+### Module instance utility
+
+The following utility functions are mixed into the module's exports.
+
+* ```ts
+ function __newString(str: string): number
+ ```
+ Allocates a new string in the module's memory and returns a pointer to it. Requires `--exportRuntime` for access to `__new`.
+
+* ```ts
+ function __newArray(
+ id: number,
+ values: valuesOrCapacity?: number[] | ArrayBufferView | number
+ ): number
+ ```
+ Allocates a new array in the module's memory and returns a pointer to it. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const Int32Array_ID = idof()`. Requires `--exportRuntime` for access to `__new`. The `values` parameter сan also be used to pre-allocate an otherwise empty array of a certain capacity.
+
+* ```ts
+ function __getString(ptr: number): string
+ ```
+ Copies a string's value from the module's memory to a JavaScript string. `ptr` must not be zero.
+
+* ```ts
+ function __getFunction(ptr: number): ((...args: unknown[]) => unknown) | null
+ ```
+ Gets a callable function object from the module's memory containing its table index. `ptr` must not be zero.
+
+* ```ts
+ function __getArrayBuffer(ptr: number): ArrayBuffer
+ ```
+ Copies an ArrayBuffer's value from the module's memory to a JavaScript buffer. `ptr` must not be zero.
+
+* ```ts
+ function __getArray(ptr: number): number[]
+ ```
+ Copies an array's values from the module's memory to a JavaScript array. Infers the array type from RTTI. `ptr` must not be zero.
+
+* ```ts
+ function __getArrayView(ptr: number): TypedArray
+ ```
+ Gets a live view on the values of an array in the module's memory. Infers the array type from RTTI. `ptr` must not be zero.
+
+ This differs from `__getArray` in that the data isn't copied but remains live in both directions. That's faster but also unsafe because if the array grows or becomes garbage collected, the view will no longer represent the correct memory region and modifying its values in this state will most likely corrupt memory or otherwise explode. Use, but use with care.
+
+* ```ts
+ function __getInt8ArrayView(ptr: number): Int8Array
+ function __getUint8ArrayView(ptr: number): Uint8Array
+ function __getUint8ClampedArrayView(ptr: number): Uint8ClampedArray
+ function __getInt16ArrayView(ptr: number): Int16Array
+ function __getUint16ArrayView(ptr: number): Uint16Array
+ function __getInt32ArrayView(ptr: number): Int32Array
+ function __getUint32ArrayView(ptr: number): Uint32Array
+ function __getInt64ArrayView(ptr: number): BigInt64Array
+ function __getUint64ArrayView(ptr: number): BigUint64Array
+ function __getFloat32ArrayView(ptr: number): Float32Array
+ function __getFloat64ArrayView(ptr: number): Float64Array
+ ```
+ Slightly more efficient variants of `__getArrayView` where the type of the array is know beforehand. Doesn't try to infer the type.
+
+### Module instance runtime interface
+
+When compiling with `--exportRuntime`, the loader will expose the runtime interface (`__new`, `__pin`, `__unpin`, `__collect`) as well.
+
+## Convenience vs. efficiency
+
+Making the loader's API any more convenient has its tradeoffs. One would either have to include extended type information with the module itself or generate an additional JavaScript file of glue code that does (and hides) all the lifting. As such, one can consider the loader as a small and efficient building block that can do it all, yet does not sacrifice efficiency. If that's not exactly what you are looking for, take a look at more convenient tools below. Just remember that these have tradeoffs.
+
+### More convenient tools
+
+* [as-bind](https://github.com/torch2424/as-bind) is a library, built on top of the loader, to make passing high-level data structures between AssemblyScript and JavaScript more convenient.
+
+## Advanced usage
+
+### Direct memory access
+
+All of the above can be mixed with direct memory accesses on `myModule.exports.memory.buffer`, for instance by adhering to class layout.
+
+### TypeScript definitions
+
+The compiler is able to emit definitions using the `-d` command line option that are compatible with modules demangled by the loader, and these can be used for proper typings in development:
+
+```ts
+// TypeScript
+import type * as MyModule from "myModule"; // pointing at the generated d.ts
+
+loader.instantiate(
+ fetch("myModule.wasm"),
+ { ... }
+).then(({ exports }) => {
+ ...
+})
+```
diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts
index 8db7280e14..f0e484ab6b 100644
--- a/lib/loader/index.d.ts
+++ b/lib/loader/index.d.ts
@@ -24,9 +24,6 @@ export interface ASUtil {
memory?: WebAssembly.Memory;
table?: WebAssembly.Table;
- /** Explicit start function, if requested. */
- _start(): void;
-
/** Copies a string's value from the module's memory. */
__getString(ptr: number): string;
/** Copies an ArrayBuffer's value from the module's memory. */
diff --git a/lib/loader/package.json b/lib/loader/package.json
index 8b9a69518f..2cd178daad 100644
--- a/lib/loader/package.json
+++ b/lib/loader/package.json
@@ -33,8 +33,8 @@
},
"scripts": {
"asbuild": "npm run asbuild:default && npm run asbuild:legacy",
- "asbuild:default": "node ../../bin/asc tests/assembly/index.ts --binaryFile tests/build/default.wasm --exportRuntime --exportTable",
- "asbuild:legacy": "node ../../bin/asc tests/assembly/index.ts --disable mutable-globals --binaryFile tests/build/legacy.wasm --exportRuntime --exportTable",
+ "asbuild:default": "node ../../bin/asc tests/assembly/index.ts --outFile tests/build/default.wasm --exportRuntime --exportTable",
+ "asbuild:legacy": "node ../../bin/asc tests/assembly/index.ts --disable mutable-globals --outFile tests/build/legacy.wasm --exportRuntime --exportTable",
"build": "npx esm2umd loader index.js > umd/index.js",
"test": "node tests && node tests/umd"
},
diff --git a/lib/loader/tests/build/default.wasm b/lib/loader/tests/build/default.wasm
index b105c1038d..13ca03ba98 100644
Binary files a/lib/loader/tests/build/default.wasm and b/lib/loader/tests/build/default.wasm differ
diff --git a/lib/loader/tests/build/legacy.wasm b/lib/loader/tests/build/legacy.wasm
index b105c1038d..13ca03ba98 100644
Binary files a/lib/loader/tests/build/legacy.wasm and b/lib/loader/tests/build/legacy.wasm differ
diff --git a/lib/loader/tests/index.html b/lib/loader/tests/index.html
index 68a98e4c22..8f3d7cc3fc 100644
--- a/lib/loader/tests/index.html
+++ b/lib/loader/tests/index.html
@@ -7,37 +7,37 @@
(async () => {
var module;
- module = await exports.instantiate(fetch("./build/untouched.wasm"));
+ module = await exports.instantiate(fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiate(await fetch("./build/untouched.wasm"));
+ module = await exports.instantiate(await fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiate((await fetch("./build/untouched.wasm")).arrayBuffer());
+ module = await exports.instantiate((await fetch("./build/debug.wasm")).arrayBuffer());
assert(module.memory);
- module = await exports.instantiate(await (await fetch("./build/untouched.wasm")).arrayBuffer());
+ module = await exports.instantiate(await (await fetch("./build/debug.wasm")).arrayBuffer());
assert(module.memory);
- module = await exports.instantiateStreaming(fetch("./build/untouched.wasm"));
+ module = await exports.instantiateStreaming(fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiateStreaming(await fetch("./build/untouched.wasm"));
+ module = await exports.instantiateStreaming(await fetch("./build/debug.wasm"));
assert(module.memory);
var instantiateStreaming = WebAssembly.instantiateStreaming;
delete WebAssembly.instantiateStreaming;
- module = await exports.instantiate(fetch("./build/untouched.wasm"));
+ module = await exports.instantiate(fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiate(await fetch("./build/untouched.wasm"));
+ module = await exports.instantiate(await fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiateStreaming(fetch("./build/untouched.wasm"));
+ module = await exports.instantiateStreaming(fetch("./build/debug.wasm"));
assert(module.memory);
- module = await exports.instantiateStreaming(await fetch("./build/untouched.wasm"));
+ module = await exports.instantiateStreaming(await fetch("./build/debug.wasm"));
assert(module.memory);
WebAssembly.instantiateStreaming = instantiateStreaming;
diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js
index db158ef2b3..26c53791c7 100644
--- a/lib/loader/tests/index.js
+++ b/lib/loader/tests/index.js
@@ -23,7 +23,9 @@ function test(file) {
// should export memory
assert(exports.memory instanceof WebAssembly.Memory);
- assert(typeof exports.memory.compare === "function");
+
+ // NOTE: Namespace exports have been removed in 0.20
+ // assert(typeof exports.memory.compare === "function");
// should be able to get an exported string
assert.strictEqual(exports.__getString(exports.COLOR), "red");
@@ -251,15 +253,16 @@ function test(file) {
// ref = module.newFunction(module.varadd);
// assert.strictEqual(module.calladd(ref, 2, 3), 5);
+ // NOTE: Class exports have been removed in 0.20
// should be able to use a class
- var car = new exports.Car(5);
- assert.strictEqual(car.numDoors, 5);
- assert.strictEqual(car.isDoorsOpen, 0);
- car.openDoors();
- assert.strictEqual(car.isDoorsOpen, 1);
- car.closeDoors();
- assert.strictEqual(car.isDoorsOpen, 0);
- assert(typeof +car === "number"); // uses Car.prototype.valueOf to obtain `thisPtr`
+ // var car = new exports.Car(5);
+ // assert.strictEqual(car.numDoors, 5);
+ // assert.strictEqual(car.isDoorsOpen, 0);
+ // car.openDoors();
+ // assert.strictEqual(car.isDoorsOpen, 1);
+ // car.closeDoors();
+ // assert.strictEqual(car.isDoorsOpen, 0);
+ // assert(typeof +car === "number"); // uses Car.prototype.valueOf to obtain `thisPtr`
// should be able to return a function
{
diff --git a/lib/parse/README.md b/lib/parse/README.md
deleted file mode 100644
index 2864308a11..0000000000
--- a/lib/parse/README.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# WebAssembly Parser
-
-A WebAssembly binary parser in WebAssembly. Super small, super fast, with TypeScript support.
-
-API
----
-
-* **parse**(binary: `Uint8Array`, options?: `ParseOptions`): `void`
- Parses the contents of a WebAssembly binary according to the specified options.
-
-* **ParseOptions**
- Options specified to the parser. The `onSection` callback determines the sections being evaluated in detail.
-
- * **onSection**?(id: `SectionId`, payloadOff: `number`, payloadLen: `number`, nameOff: `number`, nameLen: `number`): `boolean`
- Called with each section in the binary. Returning `true` evaluates the section.
-
- * **onType**?(index: `number`, form: `number`): `void`
- Called with each function type if the type section is evaluated.
-
- * **onTypeParam**?(index: `number`, paramIndex: `number`, paramType: `Type`): `void`
- Called with each function parameter if the type section is evaluated.
-
- * **onTypeReturn**?(index: `number`, returnIndex: `number`, returnType: `Type`): `void`
- Called with each function return type if the type section is evaluated.
-
- * **onImport**?(index: `number`, kind: `ExternalKind`, moduleOff: `number`, moduleLen: `number`, fieldOff: `number`, fieldLen: `number`): `void`
- Called with each import if the import section is evaluated.
-
- * **onFunctionImport**?(index: `number`, type: `number`): `void`
- Called with each function import if the import section is evaluated.
-
- * **onTableImport**?(index: `number`, type: `Type`, initial: `number`, maximum: `number`, flags: `number`): `void`
- Called with each table import if the import section is evaluated.
-
- * **onMemoryImport**?(index: `number`, initial: `number`, maximum: `number`, flags: `number`): `void`
- Called with each memory import if the import section is evaluated.
-
- * **onGlobalImport**?(index: `number`, type: `Type`, mutability: `number`): `void`
- Called with each global import if the import section is evaluated.
-
- * **onMemory**?(index: `number`, initial: `number`, maximum: `number`, flags: `number`): `void`
- Called with each memory if the memory section is evaluated.
-
- * **onFunction**?(index: `number`, typeIndex: `number`): `void`
- Called with each function if the function section is evaluated.
-
- * **onGlobal**?(index: `number`, type: `Type`, mutability: `number`): `void`
- Called with each global if the global section is evaluated.
-
- * **onStart**?(index: `number`): `void`
- Called with the start function index if the start section is evaluated.
-
- * **onExport**?(index: `number`, kind: `ExternalKind`, kindIndex: `number`, nameOff: `number`, nameLen: `number`): `void`
- Called with each export if the export section is evaluated.
-
- * **onSourceMappingURL**?(offset: `number`, length: `number`): `void`
- Called with the source map URL if the 'sourceMappingURL' section is evaluated.
-
- * **onModuleName**?(offset: `number`, length: `number`): `void`
- Called with the module name if present and the 'name' section is evaluated.
-
- * **onFunctionName**?(index: `number`, offset: `number`, length: `number`): `void`
- Called with each function name if present and the 'name' section is evaluated.
-
- * **onLocalName**?(funcIndex: `number`, index: `number`, offset: `number`, length: `number`): `void`
- Called with each local name if present and the 'name' section is evaluated.
-
-* **Type**
- A value or element type, depending on context.
-
- | Name | Value
- |---------|-------
- | i32 | 0x7f
- | i64 | 0x7e
- | f32 | 0x7d
- | f64 | 0x7c
- | anyfunc | 0x70
- | func | 0x60
- | none | 0x40
-
-* **SectionId**
- Numerical id of the current section.
-
- | Name | Value
- |----------|-------
- | Custom | 0
- | Type | 1
- | Import | 2
- | Function | 3
- | Table | 4
- | Memory | 5
- | Global | 6
- | Export | 7
- | Start | 8
- | Element | 9
- | Code | 10
- | Data | 11
-
-* **ExternalKind**
- Kind of an export or import.
-
- | Name | Value
- |----------|-------
- | Function | 0
- | Table | 1
- | Memory | 2
- | Global | 3
diff --git a/lib/parse/assembly/index.ts b/lib/parse/assembly/index.ts
deleted file mode 100644
index 3defa2ec19..0000000000
--- a/lib/parse/assembly/index.ts
+++ /dev/null
@@ -1,406 +0,0 @@
-/** A WebAssembly module that parses WebAssembly modules. */
-
-// Common constants shared between AssemblyScript and TypeScript
-import {
- SectionId,
- ExternalKind,
- NameType,
- MAX_PAGES,
- MAX_ELEMS,
- Opcode
-} from "../src/common";
-
-import * as opt from "./options";
-
-/** Current offset in memory. */
-var off: usize = 0;
-
-/** Reads an unsigned integer from memory. */
-function readUint(): u32 {
- var pos = off;
- var val = load(pos);
- off = pos + sizeof();
- return val;
-}
-
-/** Reads an unsigned 64-bit integer from memory. */
-function readUint64(): u64 {
- var pos = off;
- var val = load(pos);
- off = pos + 8;
- return val;
-}
-
-/** Reads a LEB128-encoded unsigned integer from memory. */
-function readVaruint(size: u32): u32 {
- var val: u32 = 0;
- var shl: u32 = 0;
- var byt: u32;
- var pos = off;
- do {
- byt = load(pos++);
- val |= (byt & 0x7F) << shl;
- if (!(byt & 0x80)) break;
- shl += 7;
- } while (true);
- off = pos;
- return val;
-}
-
-/** Reads a LEB128-encoded signed integer from memory. */
-function readVarint(size: u32): i32 {
- var val: u32 = 0;
- var shl: u32 = 0;
- var byt: u32;
- var pos = off;
- do {
- byt = load(pos++);
- val |= (byt & 0x7F) << shl;
- shl += 7;
- } while (byt & 0x80);
- off = pos;
- return select(val | (~0 << shl), val, shl < size && (byt & 0x40) != 0);
-}
-
-/** Reads a LEB128-encoded signed 64-bit integer from memory. */
-function readVarint64(): i64 {
- var val: u64 = 0;
- var shl: u64 = 0;
- var byt: u64;
- var pos = off;
- do {
- byt = load(pos++);
- val |= (byt & 0x7F) << shl;
- shl += 7;
- } while (byt & 0x80);
- off = pos;
- return select(val | (~0 << shl), val, shl < 64 && (byt & 0x40) != 0);
-}
-
-function skipInitExpr(): void {
- var op = readUint();
- switch (op) {
- case Opcode.i32_const: {
- readVarint(32);
- break;
- }
- case Opcode.i64_const: {
- readVarint64();
- break;
- }
- case Opcode.f32_const: {
- readUint();
- break;
- }
- case Opcode.f64_const: {
- readUint64();
- break;
- }
- case Opcode.get_global: {
- readVaruint(32);
- break;
- }
- default: unreachable(); // MVP
- }
- if (readUint() != Opcode.end) unreachable();
-}
-
-/** Starts parsing the module that has been placed in memory. */
-export function parse(begin: usize, end: usize): void {
- off = begin;
- var magic = readUint();
- if (magic != 0x6D736100) unreachable();
- var version = readUint();
- if (version != 1) unreachable();
- var fun_space_index: u32 = 0;
- var glo_space_index: u32 = 0;
- var mem_space_index: u32 = 0;
- var tbl_space_index: u32 = 0;
- while (off < end) {
- // let section_off = off;
- let id = readVaruint(7);
- let payload_len = readVaruint(32);
- let name_off = 0;
- let name_len = 0;
- if (!id) {
- let before = off;
- name_len = readVaruint(32);
- name_off = off;
- off += name_len;
- payload_len -= off - before;
- } else if (id > SectionId.Data) unreachable();
- let payload_off = off;
- if (opt.onSection(
- id,
- payload_off,
- payload_len,
- name_off,
- name_len
- )) {
- switch (id) {
- case SectionId.Type: {
- let count = readVaruint(32);
- for (let index: u32 = 0; index < count; ++index) {
- let form = readVarint(7) & 0x7f;
- opt.onType(
- index,
- form
- );
- let paramCount = readVaruint(32);
- for (let paramIndex: u32 = 0; paramIndex < paramCount; ++paramIndex) {
- let paramType = readVarint(7) & 0x7f;
- opt.onTypeParam(
- index,
- paramIndex,
- paramType
- );
- }
- let returnCount = readVaruint(1); // MVP
- for (let returnIndex: u32 = 0; returnIndex < returnCount; ++returnIndex) {
- let returnType = readVarint(7) & 0x7f;
- opt.onTypeReturn(
- index,
- returnIndex,
- returnType
- );
- }
- }
- break;
- }
- case SectionId.Import: {
- let count = readVaruint(32);
- for (let index: u32 = 0; index < count; ++index) {
- let module_len = readVaruint(32);
- let module_off = off;
- off += module_len;
- let field_len = readVaruint(32);
- let field_off = off;
- off += field_len;
- let kind = readUint();
- opt.onImport(
- index,
- kind,
- module_off,
- module_len,
- field_off,
- field_len
- );
- switch (kind) {
- case ExternalKind.Function: {
- let type = readVaruint(32);
- opt.onFunctionImport(
- fun_space_index++,
- type
- );
- break;
- }
- case ExternalKind.Table: {
- let type = readVarint(7) & 0x7f;
- let flags = readVaruint(1);
- let initial = readVaruint(32);
- let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS;
- opt.onTableImport(
- tbl_space_index++,
- type,
- initial,
- maximum,
- flags
- );
- break;
- }
- case ExternalKind.Memory: {
- let flags = readVaruint(1);
- let initial = readVaruint(32);
- let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES;
- opt.onMemoryImport(
- mem_space_index++,
- initial,
- maximum,
- flags
- );
- break;
- }
- case ExternalKind.Global: {
- let type = readVarint(7) & 0x7f;
- let mutability = readVaruint(1);
- opt.onGlobalImport(
- glo_space_index++,
- type,
- mutability
- );
- break;
- }
- default: unreachable();
- }
- }
- break;
- }
- case SectionId.Function: {
- let count = readVaruint(32);
- for (let i: u32 = 0; i < count; ++i) {
- let typeIndex = readVaruint(32);
- opt.onFunction(
- fun_space_index++,
- typeIndex
- );
- }
- break;
- }
- case SectionId.Table: {
- let count = readVaruint(32);
- for (let index: u32 = 0; index < count; ++index) {
- let type = readVaruint(7) & 0x7f;
- let flags = readVaruint(1);
- let initial = readVaruint(32);
- let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS;
- opt.onTable(
- tbl_space_index++,
- type,
- initial,
- maximum,
- flags
- );
- }
- break;
- }
- case SectionId.Memory: {
- let count = readVaruint(32);
- for (let index: u32 = 0; index < count; ++index) {
- let flags = readVaruint(1);
- let initial = readVaruint(32);
- let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES;
- opt.onMemory(
- mem_space_index++,
- initial,
- maximum,
- flags
- );
- }
- break;
- }
- case SectionId.Global: {
- let count = readVaruint(32);
- for (let i: u32 = 0; i < count; ++i) {
- let type = readVarint(7) & 0x7f;
- let mutability = readVaruint(1);
- skipInitExpr();
- opt.onGlobal(
- glo_space_index++,
- type,
- mutability
- );
- }
- break;
- }
- case SectionId.Export: {
- let count = readVaruint(32);
- for (let index: u32 = 0; index < count; ++index) {
- let field_len = readVaruint(32);
- let field_off = off;
- off += field_len;
- let kind = readUint();
- let kind_index = readVaruint(32);
- opt.onExport(
- index,
- kind,
- kind_index,
- field_off,
- field_len
- );
- }
- break;
- }
- case SectionId.Start: {
- let index = readVaruint(32);
- opt.onStart(
- index
- );
- break;
- }
- case SectionId.Custom: {
- if (
- name_len == 4 &&
- load(name_off) == 0x656D616E // "name"
- ) {
- let name_type = readVaruint(7);
- let name_payload_len = readVaruint(32);
- let name_payload_off = off;
- switch (name_type) {
- case NameType.Module: {
- let module_name_len = readVaruint(32);
- let module_name_off = off;
- opt.onModuleName(
- module_name_off,
- module_name_len
- );
- break;
- }
- case NameType.Function: {
- let count = readVaruint(32);
- for (let i: u32 = 0; i < count; ++i) {
- let fn_index = readVaruint(32);
- let fn_name_len = readVaruint(32);
- let fn_name_off = off;
- off += fn_name_len;
- opt.onFunctionName(
- fn_index,
- fn_name_off,
- fn_name_len
- );
- }
- break;
- }
- case NameType.Local: {
- let count = readVaruint(32);
- for (let i: u32 = 0; i < count; ++i) {
- let fn_index = readVaruint(32);
- let lc_count = readVaruint(32);
- for (let j: u32 = 0; j < lc_count; ++j) {
- let lc_index = readVaruint(32);
- let lc_name_len = readVaruint(32);
- let lc_name_off = off;
- off += lc_name_len;
- opt.onLocalName(
- fn_index,
- lc_index,
- lc_name_off,
- lc_name_len
- );
- }
- }
- break;
- }
- default: unreachable();
- }
- off = name_payload_off + name_payload_len; // ignore errors
- break;
- } else if (
- name_len == 16 &&
- load(name_off ) == 0x614D656372756F73 && // "sourceMa"
- load(name_off + 8) == 0x4C5255676E697070 // "ppingURL"
- ) {
- let url_len = readVaruint(32);
- let url_off = off;
- off += url_len;
- opt.onSourceMappingURL(
- url_off,
- url_len
- );
- }
- off = payload_off + payload_len; // ignore errors
- break;
- }
- case SectionId.Element:
- case SectionId.Code:
- case SectionId.Data: { // skip
- off += payload_len;
- break;
- }
- default: unreachable();
- }
- } else { // skip
- off += payload_len;
- }
- }
- if (off != end) unreachable();
-}
diff --git a/lib/parse/assembly/options.ts b/lib/parse/assembly/options.ts
deleted file mode 100644
index e4ca8ad219..0000000000
--- a/lib/parse/assembly/options.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-// Imported callbacks
-export declare function onSection(id: u32, offset: u32, length: u32, nameOffset: u32, nameLength: u32): bool;
-export declare function onType(index: u32, form: u32): void;
-export declare function onTypeParam(index: u32, paramIndex: u32, paramType: u32): void;
-export declare function onTypeReturn(index: u32, returnIndex: u32, returnType: u32): void;
-export declare function onImport(index: u32, kind: u32, moduleOff: u32, moduleLen: u32, fieldOff: u32, fieldLen: u32): void;
-export declare function onFunctionImport(index: u32, type: u32): void;
-export declare function onTableImport(index: u32, type: u32, initial: u32, maximum: u32, flags: u32): void;
-export declare function onMemoryImport(index: u32, initial: u32, maximum: u32, flags: u32): void;
-export declare function onGlobalImport(index: u32, type: u32, mutability: u32): void;
-export declare function onMemory(index: u32, initial: u32, maximum: u32, flags: u32): void;
-export declare function onFunction(index: u32, typeIndex: u32): void;
-export declare function onTable(index: u32, type: u32, initial: u32, maximum: u32, flags: u32): void;
-export declare function onGlobal(index: u32, type: u32, mutability: u32): void;
-export declare function onExport(index: u32, kind: u32, kindIndex: u32, nameOffset: u32, nameLength: u32): void;
-export declare function onStart(index: u32): void;
-export declare function onSourceMappingURL(offset: u32, length: u32): void;
-export declare function onModuleName(offset: u32, length: u32): void;
-export declare function onFunctionName(index: u32, offset: u32, length: u32): void;
-export declare function onLocalName(funcIndex: u32, index: u32, offset: u32, length: u32): void;
diff --git a/lib/parse/assembly/tsconfig.json b/lib/parse/assembly/tsconfig.json
deleted file mode 100644
index 6e52b21c48..0000000000
--- a/lib/parse/assembly/tsconfig.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "extends": "../../../std/assembly.json",
- "include": [
- "./**/*.ts"
- ]
-}
diff --git a/lib/parse/build/.gitignore b/lib/parse/build/.gitignore
deleted file mode 100644
index d873de2f78..0000000000
--- a/lib/parse/build/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.wasm
-*.wasm.map
diff --git a/lib/parse/build/index.wat b/lib/parse/build/index.wat
deleted file mode 100644
index 73b58157fd..0000000000
--- a/lib/parse/build/index.wat
+++ /dev/null
@@ -1,932 +0,0 @@
-(module
- (type $FUNCSIG$vii (func (param i32 i32)))
- (type $FUNCSIG$ii (func (param i32) (result i32)))
- (type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32)))
- (type $FUNCSIG$viii (func (param i32 i32 i32)))
- (type $FUNCSIG$viiiiii (func (param i32 i32 i32 i32 i32 i32)))
- (type $FUNCSIG$viiiii (func (param i32 i32 i32 i32 i32)))
- (type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
- (type $FUNCSIG$v (func))
- (type $FUNCSIG$vi (func (param i32)))
- (type $FUNCSIG$i (func (result i32)))
- (import "env" "memory" (memory $0 0))
- (import "options" "onSection" (func $assembly/options/onSection (param i32 i32 i32 i32 i32) (result i32)))
- (import "options" "onType" (func $assembly/options/onType (param i32 i32)))
- (import "options" "onTypeParam" (func $assembly/options/onTypeParam (param i32 i32 i32)))
- (import "options" "onTypeReturn" (func $assembly/options/onTypeReturn (param i32 i32 i32)))
- (import "options" "onImport" (func $assembly/options/onImport (param i32 i32 i32 i32 i32 i32)))
- (import "options" "onFunctionImport" (func $assembly/options/onFunctionImport (param i32 i32)))
- (import "options" "onTableImport" (func $assembly/options/onTableImport (param i32 i32 i32 i32 i32)))
- (import "options" "onMemoryImport" (func $assembly/options/onMemoryImport (param i32 i32 i32 i32)))
- (import "options" "onGlobalImport" (func $assembly/options/onGlobalImport (param i32 i32 i32)))
- (import "options" "onFunction" (func $assembly/options/onFunction (param i32 i32)))
- (import "options" "onTable" (func $assembly/options/onTable (param i32 i32 i32 i32 i32)))
- (import "options" "onMemory" (func $assembly/options/onMemory (param i32 i32 i32 i32)))
- (import "options" "onGlobal" (func $assembly/options/onGlobal (param i32 i32 i32)))
- (import "options" "onExport" (func $assembly/options/onExport (param i32 i32 i32 i32 i32)))
- (import "options" "onStart" (func $assembly/options/onStart (param i32)))
- (import "options" "onModuleName" (func $assembly/options/onModuleName (param i32 i32)))
- (import "options" "onFunctionName" (func $assembly/options/onFunctionName (param i32 i32 i32)))
- (import "options" "onLocalName" (func $assembly/options/onLocalName (param i32 i32 i32 i32)))
- (import "options" "onSourceMappingURL" (func $assembly/options/onSourceMappingURL (param i32 i32)))
- (global $assembly/index/off (mut i32) (i32.const 0))
- (export "memory" (memory $0))
- (export "parse" (func $assembly/index/parse))
- (func $assembly/index/readVaruint (; 19 ;) (type $FUNCSIG$i) (result i32)
- (local $0 i32)
- (local $1 i32)
- (local $2 i32)
- (local $3 i32)
- global.get $assembly/index/off
- local.set $0
- loop $continue|0
- local.get $0
- local.tee $1
- i32.const 1
- i32.add
- local.set $0
- local.get $1
- i32.load8_u
- local.tee $1
- i32.const 127
- i32.and
- local.get $3
- i32.shl
- local.get $2
- i32.or
- local.set $2
- local.get $1
- i32.const 128
- i32.and
- if
- local.get $3
- i32.const 7
- i32.add
- local.set $3
- br $continue|0
- end
- end
- local.get $0
- global.set $assembly/index/off
- local.get $2
- )
- (func $assembly/index/readVarint (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
- (local $1 i32)
- (local $2 i32)
- (local $3 i32)
- (local $4 i32)
- global.get $assembly/index/off
- local.set $4
- loop $continue|0
- local.get $4
- local.tee $3
- i32.const 1
- i32.add
- local.set $4
- local.get $3
- i32.load8_u
- local.tee $3
- i32.const 127
- i32.and
- local.get $1
- i32.shl
- local.get $2
- i32.or
- local.set $2
- local.get $1
- i32.const 7
- i32.add
- local.set $1
- local.get $3
- i32.const 128
- i32.and
- br_if $continue|0
- end
- local.get $4
- global.set $assembly/index/off
- i32.const -1
- local.get $1
- i32.shl
- local.get $2
- i32.or
- local.get $2
- local.get $3
- i32.const 64
- i32.and
- i32.const 0
- i32.ne
- i32.const 0
- local.get $1
- local.get $0
- i32.lt_u
- select
- select
- )
- (func $assembly/index/readVarint64 (; 21 ;) (type $FUNCSIG$v)
- (local $0 i32)
- (local $1 i64)
- (local $2 i32)
- (local $3 i64)
- (local $4 i64)
- global.get $assembly/index/off
- local.set $0
- loop $continue|0
- local.get $0
- local.tee $2
- i32.const 1
- i32.add
- local.set $0
- local.get $2
- i64.load8_u
- local.tee $4
- i64.const 127
- i64.and
- local.get $1
- i64.shl
- local.get $3
- i64.or
- local.set $3
- local.get $1
- i64.const 7
- i64.add
- local.set $1
- local.get $4
- i64.const 128
- i64.and
- i64.const 0
- i64.ne
- br_if $continue|0
- end
- local.get $0
- global.set $assembly/index/off
- )
- (func $assembly/index/skipInitExpr (; 22 ;) (type $FUNCSIG$v)
- (local $0 i32)
- (local $1 i32)
- global.get $assembly/index/off
- local.tee $1
- i32.load8_u
- local.set $0
- local.get $1
- i32.const 1
- i32.add
- global.set $assembly/index/off
- block $break|0
- block $case5|0
- block $case4|0
- block $case3|0
- block $case2|0
- block $case1|0
- local.get $0
- i32.const 65
- i32.ne
- if
- local.get $0
- i32.const 66
- i32.eq
- br_if $case1|0
- local.get $0
- i32.const 67
- i32.eq
- br_if $case2|0
- local.get $0
- i32.const 68
- i32.eq
- br_if $case3|0
- local.get $0
- i32.const 35
- i32.eq
- br_if $case4|0
- br $case5|0
- end
- i32.const 32
- call $assembly/index/readVarint
- drop
- br $break|0
- end
- call $assembly/index/readVarint64
- br $break|0
- end
- global.get $assembly/index/off
- local.tee $0
- i32.load
- drop
- local.get $0
- i32.const 4
- i32.add
- global.set $assembly/index/off
- br $break|0
- end
- global.get $assembly/index/off
- local.tee $0
- i64.load
- drop
- local.get $0
- i32.const 8
- i32.add
- global.set $assembly/index/off
- br $break|0
- end
- call $assembly/index/readVaruint
- drop
- br $break|0
- end
- unreachable
- end
- global.get $assembly/index/off
- local.tee $1
- i32.load8_u
- local.get $1
- i32.const 1
- i32.add
- global.set $assembly/index/off
- i32.const 11
- i32.ne
- if
- unreachable
- end
- )
- (func $assembly/index/parse (; 23 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
- (local $2 i32)
- (local $3 i32)
- (local $4 i32)
- (local $5 i32)
- (local $6 i32)
- (local $7 i32)
- (local $8 i32)
- (local $9 i32)
- (local $10 i32)
- (local $11 i32)
- (local $12 i32)
- (local $13 i32)
- (local $14 i32)
- local.get $0
- global.set $assembly/index/off
- global.get $assembly/index/off
- local.tee $0
- i32.load
- local.get $0
- i32.const 4
- i32.add
- global.set $assembly/index/off
- i32.const 1836278016
- i32.ne
- if
- unreachable
- end
- global.get $assembly/index/off
- local.tee $0
- i32.load
- local.get $0
- i32.const 4
- i32.add
- global.set $assembly/index/off
- i32.const 1
- i32.ne
- if
- unreachable
- end
- i32.const 0
- local.set $0
- loop $continue|0
- global.get $assembly/index/off
- local.get $1
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.set $4
- call $assembly/index/readVaruint
- local.set $3
- i32.const 0
- local.set $5
- i32.const 0
- local.set $2
- local.get $4
- if
- local.get $4
- i32.const 11
- i32.gt_u
- if
- unreachable
- end
- else
- global.get $assembly/index/off
- local.set $6
- call $assembly/index/readVaruint
- local.tee $2
- global.get $assembly/index/off
- local.tee $5
- i32.add
- global.set $assembly/index/off
- local.get $3
- global.get $assembly/index/off
- local.get $6
- i32.sub
- i32.sub
- local.set $3
- end
- local.get $4
- global.get $assembly/index/off
- local.tee $6
- local.get $3
- local.get $5
- local.get $2
- call $assembly/options/onSection
- if
- block $break|1
- block $case12|1
- block $case11|1
- block $case8|1
- block $case7|1
- block $case6|1
- block $case5|1
- block $case4|1
- block $case3|1
- block $case2|1
- block $case1|1
- local.get $4
- i32.const 1
- i32.ne
- if
- local.get $4
- i32.const 2
- i32.eq
- br_if $case1|1
- block $tablify|0
- local.get $4
- br_table $case8|1 $tablify|0 $tablify|0 $case2|1 $case3|1 $case4|1 $case5|1 $case6|1 $case7|1 $case11|1 $case11|1 $case11|1 $tablify|0
- end
- br $case12|1
- end
- call $assembly/index/readVaruint
- local.set $4
- i32.const 0
- local.set $2
- loop $loop|2
- local.get $2
- local.get $4
- i32.lt_u
- if
- local.get $2
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- call $assembly/options/onType
- call $assembly/index/readVaruint
- local.set $5
- i32.const 0
- local.set $3
- loop $loop|3
- local.get $3
- local.get $5
- i32.lt_u
- if
- local.get $2
- local.get $3
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- call $assembly/options/onTypeParam
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|3
- end
- end
- call $assembly/index/readVaruint
- local.set $5
- i32.const 0
- local.set $3
- loop $loop|4
- local.get $3
- local.get $5
- i32.lt_u
- if
- local.get $2
- local.get $3
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- call $assembly/options/onTypeReturn
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|4
- end
- end
- local.get $2
- i32.const 1
- i32.add
- local.set $2
- br $loop|2
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $7
- i32.const 0
- local.set $4
- loop $loop|5
- local.get $4
- local.get $7
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.tee $3
- global.get $assembly/index/off
- local.tee $5
- i32.add
- global.set $assembly/index/off
- call $assembly/index/readVaruint
- local.tee $6
- global.get $assembly/index/off
- local.tee $8
- i32.add
- global.set $assembly/index/off
- global.get $assembly/index/off
- local.tee $9
- i32.load8_u
- local.set $2
- local.get $9
- i32.const 1
- i32.add
- global.set $assembly/index/off
- local.get $4
- local.get $2
- local.get $5
- local.get $3
- local.get $8
- local.get $6
- call $assembly/options/onImport
- block $break|6
- block $case4|6
- block $case3|6
- block $case2|6
- block $case1|6
- local.get $2
- if
- local.get $2
- i32.const 1
- i32.sub
- br_table $case1|6 $case2|6 $case3|6 $case4|6
- end
- local.get $10
- local.tee $2
- i32.const 1
- i32.add
- local.set $10
- local.get $2
- call $assembly/index/readVaruint
- call $assembly/options/onFunctionImport
- br $break|6
- end
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- local.set $3
- call $assembly/index/readVaruint
- local.set $5
- local.get $0
- local.tee $2
- i32.const 1
- i32.add
- local.set $0
- local.get $2
- local.get $3
- call $assembly/index/readVaruint
- local.get $5
- i32.const 1
- i32.and
- if (result i32)
- call $assembly/index/readVaruint
- else
- i32.const -1
- end
- local.get $5
- call $assembly/options/onTableImport
- br $break|6
- end
- call $assembly/index/readVaruint
- local.set $3
- local.get $11
- local.tee $2
- i32.const 1
- i32.add
- local.set $11
- local.get $2
- call $assembly/index/readVaruint
- local.get $3
- i32.const 1
- i32.and
- if (result i32)
- call $assembly/index/readVaruint
- else
- i32.const 65535
- end
- local.get $3
- call $assembly/options/onMemoryImport
- br $break|6
- end
- local.get $12
- local.tee $2
- i32.const 1
- i32.add
- local.set $12
- local.get $2
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- call $assembly/index/readVaruint
- call $assembly/options/onGlobalImport
- br $break|6
- end
- unreachable
- end
- local.get $4
- i32.const 1
- i32.add
- local.set $4
- br $loop|5
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $4
- i32.const 0
- local.set $3
- loop $loop|7
- local.get $3
- local.get $4
- i32.lt_u
- if
- local.get $10
- local.tee $2
- i32.const 1
- i32.add
- local.set $10
- local.get $2
- call $assembly/index/readVaruint
- call $assembly/options/onFunction
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|7
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $7
- i32.const 0
- local.set $4
- loop $loop|8
- local.get $4
- local.get $7
- i32.lt_u
- if
- call $assembly/index/readVaruint
- i32.const 127
- i32.and
- local.set $3
- call $assembly/index/readVaruint
- local.set $5
- local.get $0
- local.tee $2
- i32.const 1
- i32.add
- local.set $0
- local.get $2
- local.get $3
- call $assembly/index/readVaruint
- local.get $5
- i32.const 1
- i32.and
- if (result i32)
- call $assembly/index/readVaruint
- else
- i32.const -1
- end
- local.get $5
- call $assembly/options/onTable
- local.get $4
- i32.const 1
- i32.add
- local.set $4
- br $loop|8
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $6
- i32.const 0
- local.set $3
- loop $loop|9
- local.get $3
- local.get $6
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.set $4
- local.get $11
- local.tee $2
- i32.const 1
- i32.add
- local.set $11
- local.get $2
- call $assembly/index/readVaruint
- local.get $4
- i32.const 1
- i32.and
- if (result i32)
- call $assembly/index/readVaruint
- else
- i32.const 65535
- end
- local.get $4
- call $assembly/options/onMemory
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|9
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $4
- i32.const 0
- local.set $3
- loop $loop|10
- local.get $3
- local.get $4
- i32.lt_u
- if
- i32.const 7
- call $assembly/index/readVarint
- i32.const 127
- i32.and
- local.set $5
- call $assembly/index/readVaruint
- local.set $6
- call $assembly/index/skipInitExpr
- local.get $12
- local.tee $2
- i32.const 1
- i32.add
- local.set $12
- local.get $2
- local.get $5
- local.get $6
- call $assembly/options/onGlobal
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|10
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- local.set $3
- i32.const 0
- local.set $2
- loop $loop|11
- local.get $2
- local.get $3
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.tee $4
- global.get $assembly/index/off
- local.tee $5
- i32.add
- global.set $assembly/index/off
- global.get $assembly/index/off
- local.tee $6
- i32.load8_u
- local.set $7
- local.get $6
- i32.const 1
- i32.add
- global.set $assembly/index/off
- local.get $2
- local.get $7
- call $assembly/index/readVaruint
- local.get $5
- local.get $4
- call $assembly/options/onExport
- local.get $2
- i32.const 1
- i32.add
- local.set $2
- br $loop|11
- end
- end
- br $break|1
- end
- call $assembly/index/readVaruint
- call $assembly/options/onStart
- br $break|1
- end
- local.get $2
- i32.const 4
- i32.eq
- if (result i32)
- local.get $5
- i32.load
- i32.const 1701667182
- i32.eq
- else
- i32.const 0
- end
- if
- call $assembly/index/readVaruint
- local.set $2
- call $assembly/index/readVaruint
- global.get $assembly/index/off
- block $break|12
- block $case3|12
- block $case2|12
- block $case1|12
- local.get $2
- if
- local.get $2
- i32.const 1
- i32.eq
- br_if $case1|12
- local.get $2
- i32.const 2
- i32.eq
- br_if $case2|12
- br $case3|12
- end
- call $assembly/index/readVaruint
- local.set $2
- global.get $assembly/index/off
- local.get $2
- call $assembly/options/onModuleName
- br $break|12
- end
- call $assembly/index/readVaruint
- local.set $2
- i32.const 0
- local.set $3
- loop $loop|13
- local.get $3
- local.get $2
- i32.lt_u
- if
- call $assembly/index/readVaruint
- call $assembly/index/readVaruint
- local.tee $7
- global.get $assembly/index/off
- local.tee $8
- i32.add
- global.set $assembly/index/off
- local.get $8
- local.get $7
- call $assembly/options/onFunctionName
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|13
- end
- end
- br $break|12
- end
- call $assembly/index/readVaruint
- local.set $6
- i32.const 0
- local.set $2
- loop $loop|14
- local.get $2
- local.get $6
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.set $7
- call $assembly/index/readVaruint
- local.set $8
- i32.const 0
- local.set $3
- loop $loop|15
- local.get $3
- local.get $8
- i32.lt_u
- if
- call $assembly/index/readVaruint
- local.set $9
- call $assembly/index/readVaruint
- local.tee $13
- global.get $assembly/index/off
- local.tee $14
- i32.add
- global.set $assembly/index/off
- local.get $7
- local.get $9
- local.get $14
- local.get $13
- call $assembly/options/onLocalName
- local.get $3
- i32.const 1
- i32.add
- local.set $3
- br $loop|15
- end
- end
- local.get $2
- i32.const 1
- i32.add
- local.set $2
- br $loop|14
- end
- end
- br $break|12
- end
- unreachable
- end
- i32.add
- global.set $assembly/index/off
- br $break|1
- else
- local.get $2
- i32.const 16
- i32.eq
- if (result i32)
- local.get $5
- i64.load
- i64.const 7011371672682196851
- i64.eq
- else
- i32.const 0
- end
- if (result i32)
- local.get $5
- i32.const 8
- i32.add
- i64.load
- i64.const 5499551997695193200
- i64.eq
- else
- i32.const 0
- end
- if
- call $assembly/index/readVaruint
- local.tee $2
- global.get $assembly/index/off
- local.tee $4
- i32.add
- global.set $assembly/index/off
- local.get $4
- local.get $2
- call $assembly/options/onSourceMappingURL
- end
- end
- local.get $3
- local.get $6
- i32.add
- global.set $assembly/index/off
- br $break|1
- end
- global.get $assembly/index/off
- local.get $3
- i32.add
- global.set $assembly/index/off
- br $break|1
- end
- unreachable
- end
- else
- global.get $assembly/index/off
- local.get $3
- i32.add
- global.set $assembly/index/off
- end
- br $continue|0
- end
- end
- global.get $assembly/index/off
- local.get $1
- i32.ne
- if
- unreachable
- end
- )
- (func $null (; 24 ;) (type $FUNCSIG$v)
- nop
- )
-)
diff --git a/lib/parse/index.d.ts b/lib/parse/index.d.ts
deleted file mode 100644
index 3bd16e178a..0000000000
--- a/lib/parse/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./src";
diff --git a/lib/parse/index.js b/lib/parse/index.js
deleted file mode 100644
index 79b2952d67..0000000000
--- a/lib/parse/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.asparse=e():A.asparse=e()}("undefined"!=typeof self?self:this,function(){return function(A){var e={};function n(o){if(e[o])return e[o].exports;var Q=e[o]={i:o,l:!1,exports:{}};return A[o].call(Q.exports,Q,Q.exports,n),Q.l=!0,Q.exports}return n.m=A,n.c=e,n.d=function(A,e,o){n.o(A,e)||Object.defineProperty(A,e,{enumerable:!0,get:o})},n.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},n.t=function(A,e){if(1&e&&(A=n(A)),8&e)return A;if(4&e&&"object"==typeof A&&A&&A.__esModule)return A;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:A}),2&e&&"string"!=typeof A)for(var Q in A)n.d(o,Q,function(e){return A[e]}.bind(null,Q));return o},n.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return n.d(e,"a",e),e},n.o=function(A,e){return Object.prototype.hasOwnProperty.call(A,e)},n.p="",n(n.s=0)}([function(A,e,n){A.exports=n(1)},function(A,e,n){"use strict";e.__esModule=!0;var o=n(2);e.Type=o.Type,e.SectionId=o.SectionId,e.ExternalKind=o.ExternalKind;var Q=null;e.parse=function A(e,n){n||(n={}),Q||(Q=new WebAssembly.Module(function(A){var e=A.length;if(e){for(var n=0,o=e;--o%4>1&&61===A.charCodeAt(o);)++n;e=Math.ceil(3*e)/4-n}for(var Q=new Uint8Array(e),B=0,I=0,E=0,r=0,i=A.length;r1)break;if(void 0===(C=t[C]))throw Error();switch(B){case 0:E=C,B=1;break;case 1:Q[I++]=E<<2|(48&C)>>4,E=C,B=2;break;case 2:Q[I++]=(15&E)<<4|(60&C)>>2,E=C,B=3;break;case 3:Q[I++]=(3&E)<<6|C,B=0}}if(1===B)throw Error();return Q}("AGFzbQEAAAABPQpgAn9/AGABfwF/YAV/f39/fwF/YAN/f38AYAZ/f39/f38AYAV/f39/fwBgBH9/f38AYAAAYAF/AGAAAX8CrgMUB29wdGlvbnMJb25TZWN0aW9uAAIHb3B0aW9ucwZvblR5cGUAAAdvcHRpb25zC29uVHlwZVBhcmFtAAMHb3B0aW9ucwxvblR5cGVSZXR1cm4AAwdvcHRpb25zCG9uSW1wb3J0AAQHb3B0aW9ucxBvbkZ1bmN0aW9uSW1wb3J0AAAHb3B0aW9ucw1vblRhYmxlSW1wb3J0AAUHb3B0aW9ucw5vbk1lbW9yeUltcG9ydAAGB29wdGlvbnMOb25HbG9iYWxJbXBvcnQAAwdvcHRpb25zCm9uRnVuY3Rpb24AAAdvcHRpb25zB29uVGFibGUABQdvcHRpb25zCG9uTWVtb3J5AAYHb3B0aW9ucwhvbkdsb2JhbAADB29wdGlvbnMIb25FeHBvcnQABQdvcHRpb25zB29uU3RhcnQACAdvcHRpb25zDG9uTW9kdWxlTmFtZQAAB29wdGlvbnMOb25GdW5jdGlvbk5hbWUAAwdvcHRpb25zC29uTG9jYWxOYW1lAAYHb3B0aW9ucxJvblNvdXJjZU1hcHBpbmdVUkwAAANlbnYGbWVtb3J5AgAAAwcGCQEHBwAHBgYBfwFBAAsHEgIGbWVtb3J5AgAFcGFyc2UAFwrlDAY/AQR/IwAhAANAIAAiAUEBaiEAIAEtAAAiAUH/AHEgA3QgAnIhAiABQYABcQRAIANBB2ohAwwBCwsgACQAIAILVgEEfyMAIQQDQCAEIgNBAWohBCADLQAAIgNB/wBxIAF0IAJyIQIgAUEHaiEBIANBgAFxDQALIAQkAEF/IAF0IAJyIAIgA0HAAHFBAEdBACABIABJGxsLPwICfwN+IwAhAANAIAAiAUEBaiEAIAExAAAiBEL/AIMgAoYgA4QhAyACQgd8IQIgBEKAAYNCAFINAAsgACQAC5wBAQJ/IwAiAS0AACEAIAFBAWokAAJAAkACQAJAAkACQCAAQcEARwRAIABBwgBGDQEgAEHDAEYNAiAAQcQARg0DIABBI0YNBAwFC0EgEBQaDAULEBUMBAsjACIAKAIAGiAAQQRqJAAMAwsjACIAKQMAGiAAQQhqJAAMAgsQExoMAQsACyMAIgEtAAAhACABQQFqJAAgAEELRwRAAAsL6QkBDX8gACQAIwAiACgCACECIABBBGokACACQYDCzesGRwRAAAsjACIAKAIAIQIgAEEEaiQAIAJBAUcEQAALQQAhAANAIwAgAUkEQBATIQQQEyEDQQAhBUEAIQIgBARAIARBC0sEQAALBSMAIQYQEyICIwAiBWokACADIwAgBmtrIQMLIAQjACIGIAMgBSACEAAEQAJAAkACQAJAAkACQAJAAkACQAJAAkAgBEEBRwRAIARBAkYNAQJAIAQODAkAAAMEBQYHCAoKCgALDAoLEBMhBEEAIQIDQCACIARJBEAgAkEHEBRB/wBxEAEQEyEFQQAhAwNAIAMgBUkEQCACIANBBxAUQf8AcRACIANBAWohAwwBCwsQEyEFQQAhAwNAIAMgBUkEQCACIANBBxAUQf8AcRADIANBAWohAwwBCwsgAkEBaiECDAELCwwKCxATIQdBACEEA0AgBCAHSQRAEBMiAyMAIgVqJAAQEyIGIwAiCGokACMAIgktAAAhAiAJQQFqJAAgBCACIAUgAyAIIAYQBAJAAkACQAJAAkAgAgRAIAJBAWsOAwECAwQLIAoiAkEBaiEKIAIQExAFDAQLQQcQFEH/AHEhAxATIQUgACICQQFqIQAgAiADEBMgBUEBcQR/EBMFQX8LIAUQBgwDCxATIQMgCyICQQFqIQsgAhATIANBAXEEfxATBUH//wMLIAMQBwwCCyAMIgJBAWohDCACQQcQFEH/AHEQExAIDAELAAsgBEEBaiEEDAELCwwJCxATIQRBACEDA0AgAyAESQRAIAoiAkEBaiEKIAIQExAJIANBAWohAwwBCwsMCAsQEyEHQQAhBANAIAQgB0kEQBATQf8AcSEDEBMhBSAAIgJBAWohACACIAMQEyAFQQFxBH8QEwVBfwsgBRAKIARBAWohBAwBCwsMBwsQEyEGQQAhAwNAIAMgBkkEQBATIQQgCyICQQFqIQsgAhATIARBAXEEfxATBUH//wMLIAQQCyADQQFqIQMMAQsLDAYLEBMhBEEAIQMDQCADIARJBEBBBxAUQf8AcSEFEBMhBhAWIAwiAkEBaiEMIAIgBSAGEAwgA0EBaiEDDAELCwwFCxATIQNBACECA0AgAiADSQRAEBMiBCMAIgVqJAAjACIGLQAAIQcgBkEBaiQAIAIgBxATIAUgBBANIAJBAWohAgwBCwsMBAsQExAODAMLIAJBBEYEfyAFKAIAQe7CtasGRgVBAAsEQBATIQIQEyEEIwAhBQJAAkACQAJAIAIEQCACQQFGDQEgAkECRg0CDAMLEBMhAiMAIAIQDwwDCxATIQJBACEDA0AgAyACSQRAEBMhBhATIgcjACIIaiQAIAYgCCAHEBAgA0EBaiEDDAELCwwCCxATIQZBACECA0AgAiAGSQRAEBMhBxATIQhBACEDA0AgAyAISQRAEBMhCRATIg0jACIOaiQAIAcgCSAOIA0QESADQQFqIQMMAQsLIAJBAWohAgwBCwsMAQsACyAEIAVqJAAMAwUgAkEQRgR/IAUpAwBC897Vk7es2abhAFEFQQALBH8gBUEIaikDAELw4KXz9qyVqcwAUQVBAAsEQBATIgIjACIEaiQAIAQgAhASCwsgAyAGaiQADAILIwAgA2okAAwBCwALBSMAIANqJAALDAELCyMAIAFHBEAACwsDAAELACAQc291cmNlTWFwcGluZ1VSTA5pbmRleC53YXNtLm1hcA==")));var o=e.length,B=(o+65535&-65536)>>16,I=new WebAssembly.Memory({initial:B}),E=new Uint8Array(I.buffer);E.set(e),A.readString=function(A,e){return function(A,e,n){if(n-e<1)return"";for(var o=null,Q=[],t=0,B=0;e191&&B<224?Q[t++]=(31&B)<<6|63&A[e++]:B>239&&B<365?(B=((7&B)<<18|(63&A[e++])<<12|(63&A[e++])<<6|63&A[e++])-65536,Q[t++]=55296+(B>>10),Q[t++]=56320+(1023&B)):Q[t++]=(15&B)<<12|(63&A[e++])<<6|63&A[e++],t>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,Q)),t=0);return o?(t&&o.push(String.fromCharCode.apply(String,Q.slice(0,t))),o.join("")):String.fromCharCode.apply(String,Q.slice(0,t))}(E,A,A+e)};var r={env:{memory:I},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onTable","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return r.options[A]=n[A]||function(){}}),new WebAssembly.Instance(Q,r).exports.parse(0,o)};for(var t=new Array(123),B=0;B<64;)t[B<26?B+65:B<52?B+71:B<62?B-4:B-59|43]=B++},function(A,e,n){"use strict";e.__esModule=!0,function(A){A[A.i32=127]="i32",A[A.i64=126]="i64",A[A.f32=125]="f32",A[A.f64=124]="f64",A[A.anyfunc=112]="anyfunc",A[A.func=96]="func",A[A.none=64]="none"}(e.Type||(e.Type={})),function(A){A[A.Custom=0]="Custom",A[A.Type=1]="Type",A[A.Import=2]="Import",A[A.Function=3]="Function",A[A.Table=4]="Table",A[A.Memory=5]="Memory",A[A.Global=6]="Global",A[A.Export=7]="Export",A[A.Start=8]="Start",A[A.Element=9]="Element",A[A.Code=10]="Code",A[A.Data=11]="Data"}(e.SectionId||(e.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(e.ExternalKind||(e.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(e.NameType||(e.NameType={})),e.MAX_PAGES=65535,e.MAX_ELEMS=4294967295,function(A){A[A.end=11]="end",A[A.get_global=35]="get_global",A[A.i32_const=65]="i32_const",A[A.i64_const=66]="i64_const",A[A.f32_const=67]="f32_const",A[A.f64_const=68]="f64_const"}(e.Opcode||(e.Opcode={}))}])});
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/lib/parse/index.js.map b/lib/parse/index.js.map
deleted file mode 100644
index 0253c777cb..0000000000
--- a/lib/parse/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack://asparse/webpack/universalModuleDefinition","webpack://asparse/webpack/bootstrap","webpack://asparse/./src/index.ts","webpack://asparse/./src/common.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","common_1","Type","SectionId","ExternalKind","compiled","parse","binary","options","WebAssembly","Module","string","length","charCodeAt","Math","ceil","buffer","Uint8Array","j","k","undefined","s64","Error","base64_decode","nBytes","nPages","memory","Memory","initial","set","readString","offset","start","end","parts","chunk","push","String","fromCharCode","apply","slice","join","utf8_read","imports","env","forEach","Instance","Array","NameType","MAX_PAGES","MAX_ELEMS","Opcode"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAR,QAGA,IAAAC,EAAAK,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAV,YAUA,OANAW,EAAAH,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAS,GAAA,EAGAT,EAAAD,QA0DA,OArDAO,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAvB,GACA,oBAAAwB,eAAAC,aACAN,OAAAC,eAAApB,EAAAwB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAApB,EAAA,cAAiD0B,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAQ,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAvB,EAAA2B,EAAA,SAAAjC,GACA,IAAAgB,EAAAhB,KAAA4B,WACA,WAA2B,OAAA5B,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAM,EAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD7B,EAAAgC,EAAA,GAIAhC,IAAAiC,EAAA,kECjFAxC,EAAA6B,YAAA,EACA,IAAAY,EAAelC,EAAQ,GACvBP,EAAA0C,KAAAD,EAAAC,KACA1C,EAAA2C,UAAAF,EAAAE,UACA3C,EAAA4C,aAAAH,EAAAG,aAEA,IAAAC,EAAA,KAgDA7C,EAAA8C,MA5CA,SAAAA,EAAAC,EAAAC,GACAA,IACAA,MAEAH,IACAA,EAAA,IAAAI,YAAAC,OA4EA,SAAAC,GACA,IAAAC,EAAAD,EAAAC,OACA,GAAAA,EAAA,CAEA,IADA,IAAAlB,EAAA,EAAAK,EAAAa,IACAb,EAAA,UAAAY,EAAAE,WAAAd,MACAL,EACAkB,EAAAE,KAAAC,KAAA,EAAAH,GAAA,EAAAlB,EAIA,IAFA,IAAAsB,EAAA,IAAAC,WAAAL,GACAM,EAAA,EAAAxC,EAAA,EAAAS,EAAA,EACAlB,EAAA,EAAAkD,EAAAR,EAAAC,OAAsC3C,EAAAkD,GAAO,CAC7C,IAAA7C,EAAAqC,EAAAE,WAAA5C,KACA,QAAAK,GAAA4C,EAAA,EACA,MACA,QAAAE,KAAA9C,EAAA+C,EAAA/C,IACA,MAAAgD,QACA,OAAAJ,GACA,OACA/B,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,KAAAS,GAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,GAAAS,IAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,EAAAS,IAAA,EAAAb,EACA4C,EAAA,GAKA,OAAAA,EACA,MAAAI,QACA,OAAAN,EAvHAO,CAAwD,k5FAExD,IAAAC,EAAAjB,EAAAK,OACAa,GAAAD,EAAA,kBACAE,EAAA,IAAAjB,YAAAkB,QAAyCC,QAAAH,IACzCT,EAAA,IAAAC,WAAAS,EAAAV,QACAA,EAAAa,IAAAtB,GAEAD,EAAAwB,WAAA,SAAAC,EAAAnB,GAAkD,OAiClD,SAAAI,EAAAgB,EAAAC,GAEA,GADAA,EAAAD,EACA,EACA,SAGA,IAFA,IAAAE,EAAA,KAAAC,KAAAlE,EAAA,EACAkB,EAAA,EACA6C,EAAAC,IACA9C,EAAA6B,EAAAgB,MACA,IACAG,EAAAlE,KAAAkB,EAEAA,EAAA,KAAAA,EAAA,IACAgD,EAAAlE,MAAA,GAAAkB,IAAA,KAAA6B,EAAAgB,KAEA7C,EAAA,KAAAA,EAAA,KACAA,IAAA,EAAAA,IAAA,OAAA6B,EAAAgB,OAAA,OAAAhB,EAAAgB,OAAA,KAAAhB,EAAAgB,MAAA,MACAG,EAAAlE,KAAA,OAAAkB,GAAA,IACAgD,EAAAlE,KAAA,YAAAkB,IAGAgD,EAAAlE,MAAA,GAAAkB,IAAA,OAAA6B,EAAAgB,OAAA,KAAAhB,EAAAgB,KAEA/D,EAAA,QACAiE,WAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,IACAlE,EAAA,GAGA,OAAAiE,GACAjE,GACAiE,EAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,KACAiE,EAAAO,KAAA,KAEAJ,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,IAjEkDyE,CAAA1B,EAAAe,IAAAnB,IAElD,IAAA+B,GACAC,KACAlB,UAEAlB,aAEA,YACA,SACA,cACA,eACA,WACA,mBACA,gBACA,iBACA,iBACA,WACA,aACA,UACA,WACA,WACA,UACA,qBACA,eACA,iBACA,eACAqC,QAAA,SAAArE,GAA+B,OAAAmE,EAAAnC,QAAAhC,GAAAgC,EAAAhC,IAAA,eAC/B,IAAAiC,YAAAqC,SAAAzC,EAAAsC,GACAnF,QAAA8C,MAAA,EAAAkB,IAqFA,IADA,IAAAH,EAAA,IAAA0B,MAAA,KACA9E,EAAA,EAAeA,EAAA,IACfoD,EAAApD,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,EAAA,OAAAA,kCCzIAT,EAAA6B,YAAA,EAGA,SAAAa,GACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,uBACAA,IAAA,gBACAA,IAAA,gBAPA,CAQC1C,EAAA0C,OAAA1C,EAAA0C,UAGD,SAAAC,GACAA,IAAA,mBACAA,IAAA,eACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,iBACAA,IAAA,qBACAA,IAAA,gBACAA,IAAA,gBAZA,CAaC3C,EAAA2C,YAAA3C,EAAA2C,eAGD,SAAAC,GACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBAJA,CAKC5C,EAAA4C,eAAA5C,EAAA4C,kBAGD,SAAA4C,GACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBAHA,CAICxF,EAAAwF,WAAAxF,EAAAwF,cAEDxF,EAAAyF,UAAA,MAEAzF,EAAA0F,UAAA,WAGA,SAAAC,GAOAA,IAAA,cAYAA,IAAA,4BA2BAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BAjDA,CA6KC3F,EAAA2F,SAAA3F,EAAA2F","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"asparse\"] = factory();\n\telse\n\t\troot[\"asparse\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar common_1 = require(\"./common\");\r\nexports.Type = common_1.Type;\r\nexports.SectionId = common_1.SectionId;\r\nexports.ExternalKind = common_1.ExternalKind;\r\n/** Cached compiled parser. */\r\nvar compiled = null;\r\nif (typeof WASM_DATA !== \"string\")\r\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\r\n/** Parses the contents of a WebAssembly binary according to the specified options. */\r\nfunction parse(binary, options) {\r\n if (!options)\r\n options = {};\r\n // compile the parser if not yet compiled\r\n if (!compiled)\r\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\r\n // use the binary as the parser's memory\r\n var nBytes = binary.length;\r\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\r\n var memory = new WebAssembly.Memory({ initial: nPages });\r\n var buffer = new Uint8Array(memory.buffer);\r\n buffer.set(binary);\r\n // provide a way to read strings from memory\r\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\r\n // instantiate the parser and return its exports\r\n var imports = {\r\n env: {\r\n memory: memory\r\n },\r\n options: {}\r\n };\r\n [\"onSection\",\r\n \"onType\",\r\n \"onTypeParam\",\r\n \"onTypeReturn\",\r\n \"onImport\",\r\n \"onFunctionImport\",\r\n \"onTableImport\",\r\n \"onMemoryImport\",\r\n \"onGlobalImport\",\r\n \"onMemory\",\r\n \"onFunction\",\r\n \"onTable\",\r\n \"onGlobal\",\r\n \"onExport\",\r\n \"onStart\",\r\n \"onSourceMappingURL\",\r\n \"onModuleName\",\r\n \"onFunctionName\",\r\n \"onLocalName\"\r\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\r\n var instance = new WebAssembly.Instance(compiled, imports);\r\n instance.exports.parse(0, nBytes);\r\n}\r\nexports.parse = parse;\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\r\nfunction utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null, chunk = [], i = 0, // char offset\r\n t = 0; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128) {\r\n chunk[i++] = t;\r\n }\r\n else if (t > 191 && t < 224) {\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n }\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n }\r\n else {\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n}\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\r\nfunction base64_decode(string) {\r\n var length = string.length;\r\n if (length) {\r\n var n = 0, p = length;\r\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\r\n ++n;\r\n length = Math.ceil(length * 3) / 4 - n;\r\n }\r\n var buffer = new Uint8Array(length);\r\n var j = 0, o = 0, t = 0;\r\n for (var i = 0, k = string.length; i < k;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error();\r\n switch (j) {\r\n case 0: {\r\n t = c;\r\n j = 1;\r\n break;\r\n }\r\n case 1: {\r\n buffer[o++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n }\r\n case 2: {\r\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n }\r\n case 3: {\r\n buffer[o++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n }\r\n if (j === 1)\r\n throw Error();\r\n return buffer;\r\n}\r\nvar s64 = new Array(123);\r\nfor (var i = 0; i < 64;)\r\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n","\"use strict\";\r\n/** Common constants shared between AssemblyScript and TypeScript. */\r\nexports.__esModule = true;\r\n/** WebAssembly types. */\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"i32\"] = 127] = \"i32\";\r\n Type[Type[\"i64\"] = 126] = \"i64\";\r\n Type[Type[\"f32\"] = 125] = \"f32\";\r\n Type[Type[\"f64\"] = 124] = \"f64\";\r\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\r\n Type[Type[\"func\"] = 96] = \"func\";\r\n Type[Type[\"none\"] = 64] = \"none\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\n/** WebAssembly section ids. */\r\nvar SectionId;\r\n(function (SectionId) {\r\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\r\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\r\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\r\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\r\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\r\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\r\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\r\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\r\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\r\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\r\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\r\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\r\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\r\n/** WebAssembly external kinds. */\r\nvar ExternalKind;\r\n(function (ExternalKind) {\r\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\r\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\r\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\r\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\r\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\r\n/** Name section types. */\r\nvar NameType;\r\n(function (NameType) {\r\n NameType[NameType[\"Module\"] = 0] = \"Module\";\r\n NameType[NameType[\"Function\"] = 1] = \"Function\";\r\n NameType[NameType[\"Local\"] = 2] = \"Local\";\r\n})(NameType = exports.NameType || (exports.NameType = {}));\r\n/** Maximum number of memory pages. */\r\nexports.MAX_PAGES = 0xffff;\r\n/** Maximum number of table elements. */\r\nexports.MAX_ELEMS = 0xffffffff;\r\n/** WebAssembly opcodes. */\r\nvar Opcode;\r\n(function (Opcode) {\r\n // unreachable = 0x00,\r\n // nop = 0x01,\r\n // block = 0x02,\r\n // loop = 0x03,\r\n // if_ = 0x04,\r\n // else_ = 0x05,\r\n Opcode[Opcode[\"end\"] = 11] = \"end\";\r\n // br = 0x0c,\r\n // br_if = 0x0d,\r\n // br_table = 0x0e,\r\n // return_ = 0x0f,\r\n // call = 0x10,\r\n // call_indirect = 0x11,\r\n // drop = 0x1a,\r\n // select = 0x1b,\r\n // get_local = 0x20,\r\n // set_local = 0x21,\r\n // tee_local = 0x22,\r\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\r\n // set_global = 0x24,\r\n // i32_load = 0x28,\r\n // i64_load = 0x29,\r\n // f32_load = 0x2a,\r\n // f64_load = 0x2b,\r\n // i32_load8_s = 0x2c,\r\n // i32_load8_u = 0x2d,\r\n // i32_load16_s = 0x2e,\r\n // i32_load16_u = 0x2f,\r\n // i64_load8_s = 0x30,\r\n // i64_load8_u = 0x31,\r\n // i64_load16_s = 0x32,\r\n // i64_load16_u = 0x33,\r\n // i64_load32_s = 0x34,\r\n // i64_load32_u = 0x35,\r\n // i32_store = 0x36,\r\n // i64_store = 0x37,\r\n // f32_store = 0x38,\r\n // f64_store = 0x39,\r\n // i32_store8 = 0x3a,\r\n // i32_store16 = 0x3b,\r\n // i64_store8 = 0x3c,\r\n // i64_store16 = 0x3d,\r\n // i64_store32 = 0x3e,\r\n // current_memory = 0x3f,\r\n // grow_memory = 0x40,\r\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\r\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\r\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\r\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\r\n // i32_eqz = 0x45,\r\n // i32_eq = 0x46,\r\n // i32_ne = 0x47,\r\n // i32_lt_s = 0x48,\r\n // i32_lt_u = 0x49,\r\n // i32_gt_s = 0x4a,\r\n // i32_gt_u = 0x4b,\r\n // i32_le_s = 0x4c,\r\n // i32_le_u = 0x4d,\r\n // i32_ge_s = 0x4e,\r\n // i32_ge_u = 0x4f,\r\n // i64_eqz = 0x50,\r\n // i64_eq = 0x51,\r\n // i64_ne = 0x52,\r\n // i64_lt_s = 0x53,\r\n // i64_lt_u = 0x54,\r\n // i64_gt_s = 0x55,\r\n // i64_gt_u = 0x56,\r\n // i64_le_s = 0x57,\r\n // i64_le_u = 0x58,\r\n // i64_ge_s = 0x59,\r\n // i64_ge_u = 0x5a,\r\n // f32_eq = 0x5b,\r\n // f32_ne = 0x5c,\r\n // f32_lt = 0x5d,\r\n // f32_gt = 0x5e,\r\n // f32_le = 0x5f,\r\n // f32_ge = 0x60,\r\n // f64_eq = 0x61,\r\n // f64_ne = 0x62,\r\n // f64_lt = 0x63,\r\n // f64_gt = 0x64,\r\n // f64_le = 0x65,\r\n // f64_ge = 0x66,\r\n // i32_clz = 0x67,\r\n // i32_ctz = 0x68,\r\n // i32_popcnt = 0x69,\r\n // i32_add = 0x6a,\r\n // i32_sub = 0x6b,\r\n // i32_mul = 0x6c,\r\n // i32_div_s = 0x6d,\r\n // i32_div_u = 0x6e,\r\n // i32_rem_s = 0x6f,\r\n // i32_rem_u = 0x70,\r\n // i32_and = 0x71,\r\n // i32_or = 0x72,\r\n // i32_xor = 0x73,\r\n // i32_shl = 0x74,\r\n // i32_shr_s = 0x75,\r\n // i32_shr_u = 0x76,\r\n // i32_rotl = 0x77,\r\n // i32_rotr = 0x78,\r\n // i64_clz = 0x79,\r\n // i64_ctz = 0x7a,\r\n // i64_popcnt = 0x7b,\r\n // i64_add = 0x7c,\r\n // i64_sub = 0x7d,\r\n // i64_mul = 0x7e,\r\n // i64_div_s = 0x7f,\r\n // i64_div_u = 0x80,\r\n // i64_rem_s = 0x81,\r\n // i64_rem_u = 0x82,\r\n // i64_and = 0x83,\r\n // i64_or = 0x84,\r\n // i64_xor = 0x85,\r\n // i64_shl = 0x86,\r\n // i64_shr_s = 0x87,\r\n // i64_shr_u = 0x88,\r\n // i64_rotl = 0x89,\r\n // i64_rotr = 0x8a,\r\n // f32_abs = 0x8b,\r\n // f32_neg = 0x8c,\r\n // f32_ceil = 0x8d,\r\n // f32_floor = 0x8e,\r\n // f32_trunc = 0x8f,\r\n // f32_nearest = 0x90,\r\n // f32_sqrt = 0x91,\r\n // f32_add = 0x92,\r\n // f32_sub = 0x93,\r\n // f32_mul = 0x94,\r\n // f32_div = 0x95,\r\n // f32_min = 0x96,\r\n // f32_max = 0x97,\r\n // f32_copysign = 0x98,\r\n // f64_abs = 0x99,\r\n // f64_neg = 0x9a,\r\n // f64_ceil = 0x9b,\r\n // f64_floor = 0x9c,\r\n // f64_trunc = 0x9d,\r\n // f64_nearest = 0x9e,\r\n // f64_sqrt = 0x9f,\r\n // f64_add = 0xa0,\r\n // f64_sub = 0xa1,\r\n // f64_mul = 0xa2,\r\n // f64_div = 0xa3,\r\n // f64_min = 0xa4,\r\n // f64_max = 0xa5,\r\n // f64_copysign = 0xa6,\r\n // i32_wrap_i64 = 0xa7,\r\n // i32_trunc_s_f32 = 0xa8,\r\n // i32_trunc_u_f32 = 0xa9,\r\n // i32_trunc_s_f64 = 0xaa,\r\n // i32_trunc_u_f64 = 0xab,\r\n // i64_extend_s_i32 = 0xac,\r\n // i64_extend_u_i32 = 0xad,\r\n // i64_trunc_s_f32 = 0xae,\r\n // i64_trunc_u_f32 = 0xaf,\r\n // i64_trunc_s_f64 = 0xb0,\r\n // i64_trunc_u_f64 = 0xb1,\r\n // f32_convert_s_i32 = 0xb2,\r\n // f32_convert_u_i32 = 0xb3,\r\n // f32_convert_s_i64 = 0xb4,\r\n // f32_convert_u_i64 = 0xb5,\r\n // f32_demote_f64 = 0xb6,\r\n // f64_convert_s_i32 = 0xb7,\r\n // f64_convert_u_i32 = 0xb8,\r\n // f64_convert_s_i64 = 0xb9,\r\n // f64_convert_u_i64 = 0xba,\r\n // f64_promote_f32 = 0xbb,\r\n // i32_reinterpret_f32 = 0xbc,\r\n // i64_reinterpret_f64 = 0xbd,\r\n // f32_reinterpret_i32 = 0xbe,\r\n // f64_reinterpret_i64 = 0xbf\r\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\r\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/lib/parse/package.json b/lib/parse/package.json
deleted file mode 100644
index f91a68c569..0000000000
--- a/lib/parse/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "@assemblyscript/parse",
- "version": "1.0.0",
- "license": "Apache-2.0",
- "main": "index.js",
- "types": "index.d.ts",
- "scripts": {
- "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --runtime none --sourceMap",
- "build": "npm run asbuild && webpack --mode production --display-modules",
- "test": "ts-node tests/"
- },
- "files": [
- "package.json",
- "index.d.ts",
- "index.js",
- "index.js.map",
- "src/",
- "README.md"
- ],
- "dependencies": {},
- "devDependencies": {
- "@types/webassembly-js-api": "0.0.1",
- "assemblyscript": "AssemblyScript/assemblyscript",
- "ts-loader": "^5.2.1",
- "ts-node": "^6.2.0",
- "typescript": "^3.1.2",
- "webpack": "^4.20.2",
- "webpack-cli": "^3.1.2"
- }
-}
diff --git a/lib/parse/src/common.ts b/lib/parse/src/common.ts
deleted file mode 100644
index e45100db5f..0000000000
--- a/lib/parse/src/common.ts
+++ /dev/null
@@ -1,225 +0,0 @@
-/** Common constants shared between AssemblyScript and TypeScript. */
-
-/** WebAssembly types. */
-export enum Type {
- i32 = 0x7f,
- i64 = 0x7e,
- f32 = 0x7d,
- f64 = 0x7c,
- anyfunc = 0x70,
- func = 0x60,
- none = 0x40
-}
-
-/** WebAssembly section ids. */
-export enum SectionId {
- Custom = 0,
- Type = 1,
- Import = 2,
- Function = 3,
- Table = 4,
- Memory = 5,
- Global = 6,
- Export = 7,
- Start = 8,
- Element = 9,
- Code = 10,
- Data = 11
-}
-
-/** WebAssembly external kinds. */
-export enum ExternalKind {
- Function = 0,
- Table = 1,
- Memory = 2,
- Global = 3
-}
-
-/** Name section types. */
-export enum NameType {
- Module = 0,
- Function = 1,
- Local = 2
-}
-
-/** Maximum number of memory pages. */
-export const MAX_PAGES = 0xffff;
-
-/** Maximum number of table elements. */
-export const MAX_ELEMS = 0xffffffff;
-
-/** WebAssembly opcodes. */
-export enum Opcode { // just a few of these are actually used
- // unreachable = 0x00,
- // nop = 0x01,
- // block = 0x02,
- // loop = 0x03,
- // if_ = 0x04,
- // else_ = 0x05,
- end = 0x0b,
- // br = 0x0c,
- // br_if = 0x0d,
- // br_table = 0x0e,
- // return_ = 0x0f,
- // call = 0x10,
- // call_indirect = 0x11,
- // drop = 0x1a,
- // select = 0x1b,
- // get_local = 0x20,
- // set_local = 0x21,
- // tee_local = 0x22,
- get_global = 0x23,
- // set_global = 0x24,
- // i32_load = 0x28,
- // i64_load = 0x29,
- // f32_load = 0x2a,
- // f64_load = 0x2b,
- // i32_load8_s = 0x2c,
- // i32_load8_u = 0x2d,
- // i32_load16_s = 0x2e,
- // i32_load16_u = 0x2f,
- // i64_load8_s = 0x30,
- // i64_load8_u = 0x31,
- // i64_load16_s = 0x32,
- // i64_load16_u = 0x33,
- // i64_load32_s = 0x34,
- // i64_load32_u = 0x35,
- // i32_store = 0x36,
- // i64_store = 0x37,
- // f32_store = 0x38,
- // f64_store = 0x39,
- // i32_store8 = 0x3a,
- // i32_store16 = 0x3b,
- // i64_store8 = 0x3c,
- // i64_store16 = 0x3d,
- // i64_store32 = 0x3e,
- // current_memory = 0x3f,
- // grow_memory = 0x40,
- i32_const = 0x41,
- i64_const = 0x42,
- f32_const = 0x43,
- f64_const = 0x44
- // i32_eqz = 0x45,
- // i32_eq = 0x46,
- // i32_ne = 0x47,
- // i32_lt_s = 0x48,
- // i32_lt_u = 0x49,
- // i32_gt_s = 0x4a,
- // i32_gt_u = 0x4b,
- // i32_le_s = 0x4c,
- // i32_le_u = 0x4d,
- // i32_ge_s = 0x4e,
- // i32_ge_u = 0x4f,
- // i64_eqz = 0x50,
- // i64_eq = 0x51,
- // i64_ne = 0x52,
- // i64_lt_s = 0x53,
- // i64_lt_u = 0x54,
- // i64_gt_s = 0x55,
- // i64_gt_u = 0x56,
- // i64_le_s = 0x57,
- // i64_le_u = 0x58,
- // i64_ge_s = 0x59,
- // i64_ge_u = 0x5a,
- // f32_eq = 0x5b,
- // f32_ne = 0x5c,
- // f32_lt = 0x5d,
- // f32_gt = 0x5e,
- // f32_le = 0x5f,
- // f32_ge = 0x60,
- // f64_eq = 0x61,
- // f64_ne = 0x62,
- // f64_lt = 0x63,
- // f64_gt = 0x64,
- // f64_le = 0x65,
- // f64_ge = 0x66,
- // i32_clz = 0x67,
- // i32_ctz = 0x68,
- // i32_popcnt = 0x69,
- // i32_add = 0x6a,
- // i32_sub = 0x6b,
- // i32_mul = 0x6c,
- // i32_div_s = 0x6d,
- // i32_div_u = 0x6e,
- // i32_rem_s = 0x6f,
- // i32_rem_u = 0x70,
- // i32_and = 0x71,
- // i32_or = 0x72,
- // i32_xor = 0x73,
- // i32_shl = 0x74,
- // i32_shr_s = 0x75,
- // i32_shr_u = 0x76,
- // i32_rotl = 0x77,
- // i32_rotr = 0x78,
- // i64_clz = 0x79,
- // i64_ctz = 0x7a,
- // i64_popcnt = 0x7b,
- // i64_add = 0x7c,
- // i64_sub = 0x7d,
- // i64_mul = 0x7e,
- // i64_div_s = 0x7f,
- // i64_div_u = 0x80,
- // i64_rem_s = 0x81,
- // i64_rem_u = 0x82,
- // i64_and = 0x83,
- // i64_or = 0x84,
- // i64_xor = 0x85,
- // i64_shl = 0x86,
- // i64_shr_s = 0x87,
- // i64_shr_u = 0x88,
- // i64_rotl = 0x89,
- // i64_rotr = 0x8a,
- // f32_abs = 0x8b,
- // f32_neg = 0x8c,
- // f32_ceil = 0x8d,
- // f32_floor = 0x8e,
- // f32_trunc = 0x8f,
- // f32_nearest = 0x90,
- // f32_sqrt = 0x91,
- // f32_add = 0x92,
- // f32_sub = 0x93,
- // f32_mul = 0x94,
- // f32_div = 0x95,
- // f32_min = 0x96,
- // f32_max = 0x97,
- // f32_copysign = 0x98,
- // f64_abs = 0x99,
- // f64_neg = 0x9a,
- // f64_ceil = 0x9b,
- // f64_floor = 0x9c,
- // f64_trunc = 0x9d,
- // f64_nearest = 0x9e,
- // f64_sqrt = 0x9f,
- // f64_add = 0xa0,
- // f64_sub = 0xa1,
- // f64_mul = 0xa2,
- // f64_div = 0xa3,
- // f64_min = 0xa4,
- // f64_max = 0xa5,
- // f64_copysign = 0xa6,
- // i32_wrap_i64 = 0xa7,
- // i32_trunc_s_f32 = 0xa8,
- // i32_trunc_u_f32 = 0xa9,
- // i32_trunc_s_f64 = 0xaa,
- // i32_trunc_u_f64 = 0xab,
- // i64_extend_s_i32 = 0xac,
- // i64_extend_u_i32 = 0xad,
- // i64_trunc_s_f32 = 0xae,
- // i64_trunc_u_f32 = 0xaf,
- // i64_trunc_s_f64 = 0xb0,
- // i64_trunc_u_f64 = 0xb1,
- // f32_convert_s_i32 = 0xb2,
- // f32_convert_u_i32 = 0xb3,
- // f32_convert_s_i64 = 0xb4,
- // f32_convert_u_i64 = 0xb5,
- // f32_demote_f64 = 0xb6,
- // f64_convert_s_i32 = 0xb7,
- // f64_convert_u_i32 = 0xb8,
- // f64_convert_s_i64 = 0xb9,
- // f64_convert_u_i64 = 0xba,
- // f64_promote_f32 = 0xbb,
- // i32_reinterpret_f32 = 0xbc,
- // i64_reinterpret_f64 = 0xbd,
- // f32_reinterpret_i32 = 0xbe,
- // f64_reinterpret_i64 = 0xbf
-}
diff --git a/lib/parse/src/index.ts b/lib/parse/src/index.ts
deleted file mode 100644
index ebd48a3541..0000000000
--- a/lib/parse/src/index.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-import { Type, SectionId, ExternalKind } from "./common";
-export { Type, SectionId, ExternalKind };
-
-/** Cached compiled parser. */
-var compiled: WebAssembly.Module | null = null;
-
-declare var WASM_DATA: string; // injected by webpack
-if (typeof WASM_DATA !== "string") {
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- WASM_DATA = require("fs").readFileSync(__dirname + "/../build/index.wasm", "base64");
-}
-
-/** Options specified to the parser. The `onSection` callback determines the sections being evaluated in detail. */
-export interface ParseOptions {
- /** Called with each section in the binary. Returning `true` evaluates the section. */
- onSection?(id: SectionId, payloadOff: number, payloadLen: number, nameOff: number, nameLen: number): boolean;
- /** Called with each function type if the type section is evaluated. */
- onType?(index: number, form: number): void;
- /** Called with each function parameter if the type section is evaluated. */
- onTypeParam?(index: number, paramIndex: number, paramType: Type): void;
- /** Called with each function return type if the type section is evaluated. */
- onTypeReturn?(index: number, returnIndex: number, returnType: Type): void;
- /** Called with each import if the import section is evaluated. */
- onImport?(index: number, kind: ExternalKind, moduleOff: number, moduleLen: number, fieldOff: number, fieldLen: number): void;
- /** Called with each function import if the import section is evaluated. */
- onFunctionImport?(index: number, type: number): void;
- /** Called with each table import if the import section is evaluated. */
- onTableImport?(index: number, type: Type, initial: number, maximum: number, flags: number): void;
- /** Called with each memory import if the import section is evaluated. */
- onMemoryImport?(index: number, initial: number, maximum: number, flags: number): void;
- /** Called with each global import if the import section is evaluated. */
- onGlobalImport?(index: number, type: Type, mutability: number): void;
- /** Called with each memory if the memory section is evaluated.*/
- onMemory?(index: number, initial: number, maximum: number, flags: number): void;
- /** Called with each function if the function section is evaluated. */
- onFunction?(index: number, typeIndex: number): void;
- /** Called with each table if the table section is evaluated.*/
- onTable?(index: number, type: Type, initial: number, maximum: number, flags: number): void;
- /** Called with each global if the global section is evaluated. */
- onGlobal?(index: number, type: Type, mutability: number): void;
- /** Called with the start function index if the start section is evaluated. */
- onStart?(index: number): void;
- /** Called with each export if the export section is evaluated. */
- onExport?(index: number, kind: ExternalKind, kindIndex: number, nameOff: number, nameLen: number): void;
- /** Called with the source map URL if the 'sourceMappingURL' section is evaluated. */
- onSourceMappingURL?(offset: number, length: number): void;
- /** Called with the module name if present and the 'name' section is evaluated. */
- onModuleName?(offset: number, length: number): void;
- /** Called with each function name if present and the 'name' section is evaluated. */
- onFunctionName?(index: number, offset: number, length: number): void;
- /** Called with each local name if present and the 'name' section is evaluated. */
- onLocalName?(funcIndex: number, index: number, offset: number, length: number): void;
-}
-
-/** Parses the contents of a WebAssembly binary according to the specified options. */
-export function parse(binary: Uint8Array, options?: ParseOptions): void {
- if (!options) options = {};
-
- // compile the parser if not yet compiled
- if (!compiled) compiled = new WebAssembly.Module(base64_decode(WASM_DATA));
-
- // use the binary as the parser's memory
- var nBytes = binary.length;
- var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;
- var memory = new WebAssembly.Memory({ initial: nPages });
- var buffer = new Uint8Array(memory.buffer);
- buffer.set(binary);
-
- // provide a way to read strings from memory
- parse.readString = (offset: number, length: number): string => utf8_read(buffer, offset, offset + length);
-
- // instantiate the parser and return its exports
- var imports = {
- env: {
- memory
- },
- options: {}
- };
- [ "onSection",
- "onType",
- "onTypeParam",
- "onTypeReturn",
- "onImport",
- "onFunctionImport",
- "onTableImport",
- "onMemoryImport",
- "onGlobalImport",
- "onMemory",
- "onFunction",
- "onTable",
- "onGlobal",
- "onExport",
- "onStart",
- "onSourceMappingURL",
- "onModuleName",
- "onFunctionName",
- "onLocalName"
- ].forEach((name: string) => imports.options[name] = options[name] || function() { /* nop */ });
- var instance = new WebAssembly.Instance(compiled, imports);
- instance.exports.parse(0, nBytes);
-}
-
-export declare namespace parse {
- /** Utility function for reading an UTF8 encoded string from memory while parsing. */
- function readString(offset: number, length: number): string;
-}
-
-// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8
-function utf8_read(buffer: Uint8Array, start: number, end: number): string {
- var len = end - start;
- if (len < 1) return "";
- var parts: string[] | null = null, chunk: number[] = [];
- var i = 0, t = 0; // char offset and temporary
- while (start < end) {
- t = buffer[start++];
- if (t < 128) {
- chunk[i++] = t;
- } else if (t > 191 && t < 224) {
- chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
- } else if (t > 239 && t < 365) {
- t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
- chunk[i++] = 0xD800 + (t >> 10);
- chunk[i++] = 0xDC00 + (t & 1023);
- } else {
- chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
- }
- if (i > 8191) {
- (parts || (parts = [])).push(String.fromCharCode(...chunk));
- i = 0;
- }
- }
- if (parts) {
- if (i) parts.push(String.fromCharCode(...chunk.slice(0, i)));
- return parts.join("");
- }
- return String.fromCharCode(...chunk.slice(0, i));
-}
-
-// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64
-function base64_decode(string: string): Uint8Array {
- var length = string.length;
- if (length) {
- let n = 0, p = length;
- while (--p % 4 > 1 && string.charCodeAt(p) === 61) ++n;
- length = Math.ceil(length * 3) / 4 - n;
- }
- var buffer = new Uint8Array(length);
- var j = 0, o = 0, t = 0;
- for (let i = 0, k = string.length; i < k;) {
- let c = string.charCodeAt(i++);
- if (c === 61 && j > 1) break;
- if ((c = s64[c]) === undefined) throw Error();
- switch (j) {
- case 0: { t = c; j = 1; break; }
- case 1: { buffer[o++] = t << 2 | (c & 48) >> 4; t = c; j = 2; break; }
- case 2: { buffer[o++] = (t & 15) << 4 | (c & 60) >> 2; t = c; j = 3; break; }
- case 3: { buffer[o++] = (t & 3) << 6 | c; j = 0; break; }
- }
- }
- if (j === 1) throw Error();
- return buffer;
-}
-
-var s64 = new Array(123);
-for (let i = 0; i < 64;) s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
diff --git a/lib/parse/tests/index.ts b/lib/parse/tests/index.ts
deleted file mode 100644
index 3ca12d4c62..0000000000
--- a/lib/parse/tests/index.ts
+++ /dev/null
@@ -1,121 +0,0 @@
-import * as fs from "fs";
-import {
- Type,
- SectionId,
- ExternalKind,
- parse
-} from "..";
-
-function onSection(id: SectionId, offset: number, length: number, nameOffset: number, nameLength: number): boolean {
- var name = id == 0 ? "'" + parse.readString(nameOffset, nameLength) + "'" : SectionId[id];
- console.log(name + " section at " + offset + ".." + (offset + length));
- return true;
-}
-
-function onType(index: number, form: Type): void {
- console.log("- FunctionType[" + index + "]: " + Type[form]);
-}
-
-function onTypeParam(index: number, paramIndex: number, paramType: Type): void {
- console.log(" > param[" + paramIndex + "] -> " + Type[paramType]);
-}
-
-function onTypeReturn(index: number, returnIndex: number, returnType: Type): void {
- console.log(" > return[" + returnIndex + "] -> " + Type[returnType]);
-}
-
-function onImport(index: number, kind: ExternalKind, moduleOff: number, moduleLen: number, fieldOff: number, fieldLen: number): void {
- var moduleName = parse.readString(moduleOff, moduleLen);
- var fieldName = parse.readString(fieldOff, fieldLen);
- console.log("- Import[" + index + "]: '" + moduleName + "." + fieldName + "'");
-}
-
-function onFunctionImport(funIndex: number, type: number): void {
- console.log(" - Function[" + funIndex + "] -> FunctionType[" + type + "]");
-}
-
-function onTableImport(tblIndex: number, type: Type, initial: number, maximum: number, flags: number): void {
- console.log(" - Table[" + tblIndex + "] -> " + Type[type] + ": initial=" + initial + ", maximum=" + maximum);
-}
-
-function onMemoryImport(memIndex: number, initial: number, maximum: number, flags: number): void {
- console.log(" - Memory[" + memIndex + "]: initial=" + initial + ", maximum=" + maximum);
-}
-
-function onGlobalImport(gloIndex: number, type: Type, mutability: number): void {
- console.log(" - Global[" + gloIndex + "]: " + (mutability & 1 ? "mutable " : "const ") + Type[type]);
-}
-
-function onMemory(memIndex: number, initial: number, maximum: number, flags: number): void {
- console.log("- Memory[" + memIndex + "]: initial=" + initial + ", maximum=" + maximum);
-}
-
-function onFunction(funIndex: number, typeIndex: number): void {
- console.log("- Function[" + funIndex + "] -> FunctionType[" + typeIndex + "]");
-}
-
-function onTable(tblIndex: number, type: number, initial: number, maximum: number, flags: number): void {
- console.log("- Table[" + tblIndex + "] -> " + Type[type] + ": initial=" + initial + ", maximum=" + (maximum >>> 0));
-}
-
-function onGlobal(gloIndex: number, type: Type, mutability: number): void {
- console.log("- Global[" + gloIndex + "]: " + (mutability & 1 ? "mutable " : "const ") + Type[type]);
-}
-
-function onStart(index: number): void {
- console.log("- Start: Function[" + index + "]");
-}
-
-function onExport(index: number, kind: ExternalKind, kindIndex: number, fieldOffset: number, fieldLength: number): void {
- var field = parse.readString(fieldOffset, fieldLength);
- console.log("- Export[" + index + "], '" + field + "' -> " + ExternalKind[kind] + "[" + kindIndex + "]");
-}
-
-function onSourceMappingURL(offset: number, length: number): void {
- var url = parse.readString(offset, length);
- console.log("- sourceMap: " + url);
-}
-
-function onModuleName(offset: number, length: number): void {
- var name = parse.readString(offset, length);
- console.log("- moduleName: " + name);
-}
-
-function onFunctionName(index: number, offset: number, length: number): void {
- var name = parse.readString(offset, length);
- console.log(" - Function[" + index + "] name: " + name);
-}
-
-function onLocalName(funcIndex: number, index: number, offset: number, length: number): void {
- var name = parse.readString(offset, length);
- console.log(" - Function[" + funcIndex + "].local[" + index + "] name: " + name);
-}
-
-[ "../build/index.wasm",
- "libm.wasm"
-].forEach((filename: string): void => {
- const binary: Uint8Array = fs.readFileSync(__dirname + "/" + filename);
- console.log("Testing '" + filename + "' ...");
- parse(binary, {
- onSection,
- onType,
- onTypeParam,
- onTypeReturn,
- onImport,
- onFunctionImport,
- onTableImport,
- onMemoryImport,
- onGlobalImport,
- onMemory,
- onFunction,
- onTable,
- onGlobal,
- onStart,
- onExport,
- onSourceMappingURL,
- onModuleName,
- onFunctionName,
- onLocalName
- });
- console.log();
-});
diff --git a/lib/parse/tests/libm.wasm b/lib/parse/tests/libm.wasm
deleted file mode 100644
index 44467da623..0000000000
Binary files a/lib/parse/tests/libm.wasm and /dev/null differ
diff --git a/lib/parse/webpack.config.js b/lib/parse/webpack.config.js
deleted file mode 100644
index 61fee7db6f..0000000000
--- a/lib/parse/webpack.config.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const fs = require("fs");
-const webpack = require("webpack");
-
-const wasmData = fs.readFileSync(__dirname + "/build/index.wasm");
-
-module.exports = {
- entry: [ "./src/index.ts" ],
- module: {
- rules: [
- {
- test: /\.ts$/,
- use: "ts-loader",
- exclude: /node_modules/
- }
- ]
- },
- resolve: {
- extensions: [ ".ts", ".js" ]
- },
- node: {
- fs: false
- },
- output: {
- filename: "index.js",
- path: __dirname,
- library: "asparse",
- libraryTarget: "umd",
- globalObject: "typeof self !== 'undefined' ? self : this"
- },
- plugins: [
- new webpack.DefinePlugin({
- WASM_DATA: JSON.stringify(wasmData.toString("base64"))
- })
- ],
- devtool: "source-map"
-};
diff --git a/lib/rtrace/README.md b/lib/rtrace/README.md
index 27635a6824..622f41a1fd 100644
--- a/lib/rtrace/README.md
+++ b/lib/rtrace/README.md
@@ -5,7 +5,7 @@ A tiny utility to sanitize the AssemblyScript runtime. Records allocations and f
Instructions
------------
-Compile your module that uses the full or half runtime with `-use ASC_RTRACE=1 --explicitStart` and include an instance of this module as the import named `rtrace`.
+Compile your module that uses the full or half runtime with `-use ASC_RTRACE=1 --exportStart _initialize` and include an instance of this module as the import named `rtrace`.
```js
const rtrace = new Rtrace({
@@ -17,7 +17,7 @@ const rtrace = new Rtrace({
},
getMemory() {
// obtain the module's memory,
- // e.g. with --explicitStart:
+ // e.g. using --exportStart:
return instance.exports.memory;
}
});
@@ -27,7 +27,7 @@ const { module, instance } = await WebAssembly.instantiate(...,
...imports...
})
);
-instance.exports._start();
+instance.exports._initialize();
...
if (rtrace.active) {
diff --git a/lib/rtrace/tlsfvis.html b/lib/rtrace/tlsfvis.html
index aa359833a3..ab3f6548a6 100644
--- a/lib/rtrace/tlsfvis.html
+++ b/lib/rtrace/tlsfvis.html
@@ -12,7 +12,7 @@
var exports;
var ROOT;
var U32;
-fetch("untouched.wasm").then(result =>
+fetch("debug.wasm").then(result =>
result.arrayBuffer()
).then(buffer =>
WebAssembly.instantiate(buffer, {
@@ -27,7 +27,7 @@
})
).then(result => {
exports = result.instance.exports;
- if (exports._start) exports._start();
+ if (exports._initialize) exports._initialize();
U32 = new Uint32Array(exports.memory.buffer);
var first = exports.__alloc(255);
exports.__free(first);
diff --git a/lib/sdk/README.md b/lib/sdk/README.md
deleted file mode 100644
index 1927878f8f..0000000000
--- a/lib/sdk/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Browser SDK
-
-An SDK to use the AssemblyScript compiler on the web. This is built to distribution files using the exact versions of the compiler and its dependencies.
-
-Expects [require.js](https://requirejs.org) (or compatible) on the web, primarily targeting [WebAssembly Studio](https://webassembly.studio). Note that consuming the source file in this directory directly does not solve any versioning issues - use `dist/sdk.js` instead. Do not try to bundle this.
-
-Exports
--------
-
-* **binaryen**
- The version of binaryen required by the compiler.
-
-* **long**
- The version of long.js required by the compiler.
-
-* **assemblyscript**
- The AssemblyScript compiler as a library.
-
-* **asc**
- AssemblyScript compiler frontend that one will interact with
- ([see](https://github.com/AssemblyScript/assemblyscript/tree/main/cli)).
-
-Example usage
--------------
-
-```js
-require(
- ["https://cdn.jsdelivr.net/npm/assemblyscript@latest/dist/sdk"],
- function(sdk) {
- const { asc } = sdk;
- asc.ready.then(() => {
- asc.main(...);
- });
- }
-);
-```
-
-There is also the [SDK example](https://github.com/AssemblyScript/examples/tree/main/sdk) showing how to compile some actual code.
diff --git a/lib/sdk/index.js b/lib/sdk/index.js
deleted file mode 100644
index ad20f72bdd..0000000000
--- a/lib/sdk/index.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const BINARYEN_VERSION = "nightly";
-const LONG_VERSION = "latest";
-const ASSEMBLYSCRIPT_VERSION = "latest";
-
-// AMD/require.js (browser)
-if (typeof define === "function" && define.amd) {
- const paths = {
- "binaryen": "https://cdn.jsdelivr.net/npm/binaryen@" + BINARYEN_VERSION + "/index",
- "long": "https://cdn.jsdelivr.net/npm/long@" + LONG_VERSION + "/umd/index",
- "assemblyscript": "https://cdn.jsdelivr.net/npm/assemblyscript@" + ASSEMBLYSCRIPT_VERSION + "/dist/assemblyscript",
- "assemblyscript/cli/asc": "https://cdn.jsdelivr.net/npm/assemblyscript@" + ASSEMBLYSCRIPT_VERSION + "/dist/asc",
- };
- require.config({ paths });
- define(Object.keys(paths), (binaryen, long, assemblyscript, asc) => ({
- BINARYEN_VERSION,
- LONG_VERSION,
- ASSEMBLYSCRIPT_VERSION,
- binaryen,
- long,
- assemblyscript,
- asc
- }));
-
-// CommonJS fallback (node)
-} else if (typeof module === "object" && module.exports) {
- module.exports = {
- BINARYEN_VERSION,
- LONG_VERSION,
- ASSEMBLYSCRIPT_VERSION,
- binaryen: require("binaryen"),
- long: require("long"),
- assemblyscript: require("assemblyscript"),
- asc: require("assemblyscript/cli/asc")
- };
-}
diff --git a/lib/sdk/tests/index.html b/lib/sdk/tests/index.html
deleted file mode 100644
index 5d5eb34fc8..0000000000
--- a/lib/sdk/tests/index.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
diff --git a/lib/webpack/README.md b/lib/webpack/README.md
deleted file mode 100644
index 733f718636..0000000000
--- a/lib/webpack/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Webpack loader
-
-An experimental [webpack](https://webpack.js.org/) loader for [AssemblyScript](http://assemblyscript.org) modules.
-
-Usage
------
-
-```js
-import MyModule from "@assemblyscript/webpack!mymodule.wasm";
-
-var myModule = new MyModule({ imports: { /* if any */ } });
-```
-
-TODO: Pipe .ts files through `asc`, accepting the usual options, but also keep raw .wasm support.
diff --git a/lib/webpack/decode.js b/lib/webpack/decode.js
deleted file mode 100644
index 364df2089f..0000000000
--- a/lib/webpack/decode.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var s64 = new Array(123);
-for (var i = 0; i < 64;) s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
-
-module.exports = function decode(string) {
- var length = string.length;
- if (length) {
- var n = 0, p = length;
- while (--p % 4 > 1 && string.charCodeAt(p) === 61) ++n;
- length = Math.ceil(length * 3) / 4 - n;
- }
- var buffer = new Uint8Array(length);
- var j = 0, o = 0, t;
- for (var i = 0, k = string.length; i < k;) {
- var c = string.charCodeAt(i++);
- if (c === 61 && j > 1) break;
- if ((c = s64[c]) === undefined) throw Error();
- switch (j) {
- case 0: t = c; j = 1; break;
- case 1: buffer[o++] = t << 2 | (c & 48) >> 4; t = c; j = 2; break;
- case 2: buffer[o++] = (t & 15) << 4 | (c & 60) >> 2; t = c; j = 3; break;
- case 3: buffer[o++] = (t & 3) << 6 | c; j = 0; break;
- }
- }
- if (j === 1) throw Error();
- return buffer;
-};
diff --git a/lib/webpack/index.js b/lib/webpack/index.js
deleted file mode 100644
index d622ce5164..0000000000
--- a/lib/webpack/index.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const fs = require("fs");
-const path = require("path");
-const asc = require("assemblyscript/cli/asc.js");
-const base64 = require("@protobufjs/base64");
-
-const MAGIC = Buffer.from([ 0x00, 0x61, 0x73, 0x6D ]);
-
-module.exports = loader;
-
-function loader(buffer) {
- if (MAGIC.compare(buffer, 0, 4) !== 0)
- return compile.call(this);
- else
- return bundle.call(this, buffer);
-}
-
-loader.raw = true;
-
-function compile() {
- const basePath = this.resourcePath.replace(/\.\w+$/, "");
- const args = [
- path.basename(this.resourcePath),
- "--baseDir", path.dirname(this.resourcePath),
- "--binaryFile", basePath + ".wasm",
- "--textFile", basePath + ".wat",
- "--optimize"
- ];
- if (this.sourceMap)
- args.push("--sourceMap");
- asc.main(args, err => {
- if (err)
- return this.callback(err);
- fs.readFile(basePath + ".wasm", (err, binary) => {
- if (err)
- return this.callback(err);
- if (!this.sourceMap)
- return this.callback(null, bundle(binary));
- fs.readFile(basePath + ".wasm.map", (err, sourceMap) => {
- if (err)
- return this.callback(err);
- return this.callback(null, bundle(binary), sourceMap.toString("utf8"));
- });
- });
- });
-}
-
-function bundle(binary) {
- const data = base64.encode(binary, 0, binary.wasm);
- return [
- 'var data = "' + data + '", wasm;',
- 'module.exports = function AssemblyScriptModule(options) {',
- ' if (!wasm)',
- ' wasm = new WebAssembly.Module(require("@assemblyscript/webpack/decode")(data));',
- ' return new WebAssembly.Instance(wasm, options && options.imports || {}).exports;',
- '};'
- ].join("\n") + "\n";
-}
diff --git a/lib/webpack/package.json b/lib/webpack/package.json
deleted file mode 100644
index 169206ff98..0000000000
--- a/lib/webpack/package.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "@assemblyscript/webpack",
- "version": "0.5.0",
- "description": "webpack loader for AssemblyScript modules.",
- "license": "Apache-2.0",
- "dependencies": {
- "@protobufjs/base64": "^1.1.2"
- }
-}
diff --git a/package-lock.json b/package-lock.json
index 31d47ea1d5..4dd6cb69ba 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,78 +5,40 @@
"requires": true,
"packages": {
"": {
- "name": "assemblyscript",
"version": "0.0.0",
"license": "Apache-2.0",
"dependencies": {
- "binaryen": "102.0.0-nightly.20211028",
- "long": "^5.2.0",
- "source-map-support": "^0.5.20",
- "ts-node": "^10.4.0"
+ "binaryen": "106.0.0-nightly.20220320",
+ "long": "^5.2.0"
},
"bin": {
- "asc": "bin/asc",
- "asinit": "bin/asinit"
+ "asc": "bin/asc.js",
+ "asinit": "bin/asinit.js"
},
"devDependencies": {
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"diff": "^5.0.0",
+ "esbuild": "^0.14.1",
"eslint": "^8.2.0",
"glob": "^7.2.0",
- "mkdirp": "^1.0.4",
- "physical-cpu-count": "^2.0.0",
- "ts-loader": "^9.2.6",
- "ts-node": "^10.4.0",
- "typescript": "~4.5.2",
- "webpack": "^5.64.1",
- "webpack-cli": "^4.9.1"
+ "typescript": "~4.5.2"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/assemblyscript"
}
},
- "node_modules/@cspotcode/source-map-consumer": {
- "version": "0.8.0",
- "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
- "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==",
- "dev": true,
- "engines": {
- "node": ">= 12"
- }
- },
- "node_modules/@cspotcode/source-map-support": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
- "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
- "dev": true,
- "dependencies": {
- "@cspotcode/source-map-consumer": "0.8.0"
- },
- "engines": {
- "node": ">=12"
- }
- },
- "node_modules/@discoveryjs/json-ext": {
- "version": "0.5.5",
- "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz",
- "integrity": "sha512-6nFkfkmSeV/rqSaS4oWHgmpnYw194f6hmWF5is6b0J1naJZoiD0NTc9AiUwPHvWsowkjuHErCZT1wa0jg+BLIA==",
- "dev": true,
- "engines": {
- "node": ">=10.0.0"
- }
- },
"node_modules/@eslint/eslintrc": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.4.tgz",
- "integrity": "sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz",
+ "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
- "espree": "^9.0.0",
+ "espree": "^9.3.1",
"globals": "^13.9.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
@@ -98,12 +60,12 @@
}
},
"node_modules/@humanwhocodes/config-array": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz",
- "integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==",
+ "version": "0.9.5",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz",
+ "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==",
"dev": true,
"dependencies": {
- "@humanwhocodes/object-schema": "^1.2.0",
+ "@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
"minimatch": "^3.0.4"
},
@@ -152,56 +114,6 @@
"node": ">= 8"
}
},
- "node_modules/@tsconfig/node10": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
- "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==",
- "dev": true
- },
- "node_modules/@tsconfig/node12": {
- "version": "1.0.9",
- "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
- "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==",
- "dev": true
- },
- "node_modules/@tsconfig/node14": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
- "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==",
- "dev": true
- },
- "node_modules/@tsconfig/node16": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
- "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
- "dev": true
- },
- "node_modules/@types/eslint": {
- "version": "7.28.2",
- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.2.tgz",
- "integrity": "sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA==",
- "dev": true,
- "dependencies": {
- "@types/estree": "*",
- "@types/json-schema": "*"
- }
- },
- "node_modules/@types/eslint-scope": {
- "version": "3.7.1",
- "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.1.tgz",
- "integrity": "sha512-SCFeogqiptms4Fg29WpOTk5nHIzfpKCemSN63ksBQYKTcXoJEmJagV+DhVmbapZzY4/5YaOV1nZwrsU79fFm1g==",
- "dev": true,
- "dependencies": {
- "@types/eslint": "*",
- "@types/estree": "*"
- }
- },
- "node_modules/@types/estree": {
- "version": "0.0.50",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz",
- "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==",
- "dev": true
- },
"node_modules/@types/json-schema": {
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
@@ -209,19 +121,20 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "16.11.7",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
- "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==",
+ "version": "16.11.26",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.26.tgz",
+ "integrity": "sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.4.0.tgz",
- "integrity": "sha512-9/yPSBlwzsetCsGEn9j24D8vGQgJkOTr4oMLas/w886ZtzKIs1iyoqFrwsX2fqYEeUwsdBpC21gcjRGo57u0eg==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz",
+ "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/experimental-utils": "5.4.0",
- "@typescript-eslint/scope-manager": "5.4.0",
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/type-utils": "5.13.0",
+ "@typescript-eslint/utils": "5.13.0",
"debug": "^4.3.2",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.1.8",
@@ -246,18 +159,16 @@
}
}
},
- "node_modules/@typescript-eslint/experimental-utils": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.4.0.tgz",
- "integrity": "sha512-Nz2JDIQUdmIGd6p33A+naQmwfkU5KVTLb/5lTk+tLVTDacZKoGQisj8UCxk7onJcrgjIvr8xWqkYI+DbI3TfXg==",
+ "node_modules/@typescript-eslint/parser": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz",
+ "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==",
"dev": true,
"dependencies": {
- "@types/json-schema": "^7.0.9",
- "@typescript-eslint/scope-manager": "5.4.0",
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/typescript-estree": "5.4.0",
- "eslint-scope": "^5.1.1",
- "eslint-utils": "^3.0.0"
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/typescript-estree": "5.13.0",
+ "debug": "^4.3.2"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -267,19 +178,22 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
- "eslint": "*"
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
}
},
- "node_modules/@typescript-eslint/parser": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.4.0.tgz",
- "integrity": "sha512-JoB41EmxiYpaEsRwpZEYAJ9XQURPFer8hpkIW9GiaspVLX8oqbqNM8P4EP8HOZg96yaALiLEVWllA2E8vwsIKw==",
+ "node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz",
+ "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.4.0",
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/typescript-estree": "5.4.0",
- "debug": "^4.3.2"
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/visitor-keys": "5.13.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -287,24 +201,17 @@
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
}
},
- "node_modules/@typescript-eslint/scope-manager": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.4.0.tgz",
- "integrity": "sha512-pRxFjYwoi8R+n+sibjgF9iUiAELU9ihPBtHzocyW8v8D8G8KeQvXTsW7+CBYIyTYsmhtNk50QPGLE3vrvhM5KA==",
+ "node_modules/@typescript-eslint/type-utils": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz",
+ "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/visitor-keys": "5.4.0"
+ "@typescript-eslint/utils": "5.13.0",
+ "debug": "^4.3.2",
+ "tsutils": "^3.21.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -312,12 +219,20 @@
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "*"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
}
},
"node_modules/@typescript-eslint/types": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.4.0.tgz",
- "integrity": "sha512-GjXNpmn+n1LvnttarX+sPD6+S7giO+9LxDIGlRl4wK3a7qMWALOHYuVSZpPTfEIklYjaWuMtfKdeByx0AcaThA==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz",
+ "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -328,13 +243,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.4.0.tgz",
- "integrity": "sha512-nhlNoBdhKuwiLMx6GrybPT3SFILm5Gij2YBdPEPFlYNFAXUJWX6QRgvi/lwVoadaQEFsizohs6aFRMqsXI2ewA==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz",
+ "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/visitor-keys": "5.4.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/visitor-keys": "5.13.0",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
@@ -354,14 +269,18 @@
}
}
},
- "node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.4.0.tgz",
- "integrity": "sha512-PVbax7MeE7tdLfW5SA0fs8NGVVr+buMPrcj+CWYWPXsZCH8qZ1THufDzbXm1xrZ2b2PA1iENJ0sRq5fuUtvsJg==",
+ "node_modules/@typescript-eslint/utils": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz",
+ "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.4.0",
- "eslint-visitor-keys": "^3.0.0"
+ "@types/json-schema": "^7.0.9",
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/typescript-estree": "5.13.0",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -369,206 +288,32 @@
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@webassemblyjs/ast": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
- "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/helper-numbers": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/floating-point-hex-parser": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz",
- "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==",
- "dev": true
- },
- "node_modules/@webassemblyjs/helper-api-error": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz",
- "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==",
- "dev": true
- },
- "node_modules/@webassemblyjs/helper-buffer": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz",
- "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==",
- "dev": true
- },
- "node_modules/@webassemblyjs/helper-numbers": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz",
- "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/floating-point-hex-parser": "1.11.1",
- "@webassemblyjs/helper-api-error": "1.11.1",
- "@xtuc/long": "4.2.2"
- }
- },
- "node_modules/@webassemblyjs/helper-wasm-bytecode": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz",
- "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==",
- "dev": true
- },
- "node_modules/@webassemblyjs/helper-wasm-section": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz",
- "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/ieee754": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz",
- "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==",
- "dev": true,
- "dependencies": {
- "@xtuc/ieee754": "^1.2.0"
- }
- },
- "node_modules/@webassemblyjs/leb128": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz",
- "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==",
- "dev": true,
- "dependencies": {
- "@xtuc/long": "4.2.2"
- }
- },
- "node_modules/@webassemblyjs/utf8": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz",
- "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==",
- "dev": true
- },
- "node_modules/@webassemblyjs/wasm-edit": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz",
- "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/helper-wasm-section": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1",
- "@webassemblyjs/wasm-opt": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1",
- "@webassemblyjs/wast-printer": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/wasm-gen": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz",
- "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/ieee754": "1.11.1",
- "@webassemblyjs/leb128": "1.11.1",
- "@webassemblyjs/utf8": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/wasm-opt": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz",
- "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/wasm-parser": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz",
- "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-api-error": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/ieee754": "1.11.1",
- "@webassemblyjs/leb128": "1.11.1",
- "@webassemblyjs/utf8": "1.11.1"
- }
- },
- "node_modules/@webassemblyjs/wast-printer": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz",
- "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==",
- "dev": true,
- "dependencies": {
- "@webassemblyjs/ast": "1.11.1",
- "@xtuc/long": "4.2.2"
- }
- },
- "node_modules/@webpack-cli/configtest": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz",
- "integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==",
- "dev": true,
+ },
"peerDependencies": {
- "webpack": "4.x.x || 5.x.x",
- "webpack-cli": "4.x.x"
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
- "node_modules/@webpack-cli/info": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz",
- "integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==",
+ "node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz",
+ "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==",
"dev": true,
"dependencies": {
- "envinfo": "^7.7.3"
+ "@typescript-eslint/types": "5.13.0",
+ "eslint-visitor-keys": "^3.0.0"
},
- "peerDependencies": {
- "webpack-cli": "4.x.x"
- }
- },
- "node_modules/@webpack-cli/serve": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz",
- "integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==",
- "dev": true,
- "peerDependencies": {
- "webpack-cli": "4.x.x"
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
- "peerDependenciesMeta": {
- "webpack-dev-server": {
- "optional": true
- }
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/@xtuc/ieee754": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
- "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
- "dev": true
- },
- "node_modules/@xtuc/long": {
- "version": "4.2.2",
- "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
- "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
- "dev": true
- },
"node_modules/acorn": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz",
- "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
+ "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
@@ -577,15 +322,6 @@
"node": ">=0.4.0"
}
},
- "node_modules/acorn-import-assertions": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
- "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
- "dev": true,
- "peerDependencies": {
- "acorn": "^8"
- }
- },
"node_modules/acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
@@ -595,15 +331,6 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
- "node_modules/acorn-walk": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
- "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
- "dev": true,
- "engines": {
- "node": ">=0.4.0"
- }
- },
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -620,24 +347,6 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
- "node_modules/ajv-keywords": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
- "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
- "dev": true,
- "peerDependencies": {
- "ajv": "^6.9.1"
- }
- },
- "node_modules/ansi-colors": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
- "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -662,12 +371,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
- "node_modules/arg": {
- "version": "4.1.3",
- "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
- "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
- "dev": true
- },
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -690,11 +393,12 @@
"dev": true
},
"node_modules/binaryen": {
- "version": "102.0.0-nightly.20211028",
- "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-102.0.0-nightly.20211028.tgz",
- "integrity": "sha512-GCJBVB5exbxzzvyt8MGDv/MeUjs6gkXDvf4xOIItRBptYl0Tz5sm1o/uG95YK0L0VeG5ajDu3hRtkBP2kzqC5w==",
+ "version": "106.0.0-nightly.20220320",
+ "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-106.0.0-nightly.20220320.tgz",
+ "integrity": "sha512-9Jzp9aOJ2uk2+viAiPr6+wi1BZKlxO4paTVm481RUEq3PIY63kdw78JoThrROt1s1qpCMuz0Oml6YqPJ7tep4w==",
"bin": {
- "wasm-opt": "bin/wasm-opt"
+ "wasm-opt": "bin/wasm-opt",
+ "wasm2js": "bin/wasm2js"
}
},
"node_modules/brace-expansion": {
@@ -719,34 +423,6 @@
"node": ">=8"
}
},
- "node_modules/browserslist": {
- "version": "4.17.6",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.6.tgz",
- "integrity": "sha512-uPgz3vyRTlEiCv4ee9KlsKgo2V6qPk7Jsn0KAn2OBqbqKo3iNcPEC1Ti6J4dwnz+aIRfEEEuOzC9IBk8tXUomw==",
- "dev": true,
- "dependencies": {
- "caniuse-lite": "^1.0.30001274",
- "electron-to-chromium": "^1.3.886",
- "escalade": "^3.1.1",
- "node-releases": "^2.0.1",
- "picocolors": "^1.0.0"
- },
- "bin": {
- "browserslist": "cli.js"
- },
- "engines": {
- "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- }
- },
- "node_modules/buffer-from": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
- "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
- },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -756,16 +432,6 @@
"node": ">=6"
}
},
- "node_modules/caniuse-lite": {
- "version": "1.0.30001278",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001278.tgz",
- "integrity": "sha512-mpF9KeH8u5cMoEmIic/cr7PNS+F5LWBk0t2ekGT60lFf0Wq+n9LspAj0g3P+o7DQhD3sUdlMln4YFAWhFYn9jg==",
- "dev": true,
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- }
- },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -782,29 +448,6 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
- "node_modules/chrome-trace-event": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
- "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==",
- "dev": true,
- "engines": {
- "node": ">=6.0"
- }
- },
- "node_modules/clone-deep": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
- "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
- "dev": true,
- "dependencies": {
- "is-plain-object": "^2.0.4",
- "kind-of": "^6.0.2",
- "shallow-clone": "^3.0.0"
- },
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -823,30 +466,12 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
- "node_modules/colorette": {
- "version": "2.0.16",
- "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz",
- "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==",
- "dev": true
- },
- "node_modules/commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "dev": true
- },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
- "node_modules/create-require": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
- "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
- "dev": true
- },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -862,9 +487,9 @@
}
},
"node_modules/debug": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
- "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
+ "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
"dev": true,
"dependencies": {
"ms": "2.1.2"
@@ -917,95 +542,391 @@
"node": ">=6.0.0"
}
},
- "node_modules/electron-to-chromium": {
- "version": "1.3.891",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.891.tgz",
- "integrity": "sha512-3cpwR82QkIS01CN/dup/4Yr3BiOiRLlZlcAFn/5FbNCunMO9ojqDgEP9JEo1QNLflu3pEnPWve50gHOEKc7r6w==",
- "dev": true
- },
- "node_modules/enhanced-resolve": {
- "version": "5.8.3",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz",
- "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==",
+ "node_modules/esbuild": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.25.tgz",
+ "integrity": "sha512-4JHEIOMNFvK09ziiL+iVmldIhLbn49V4NAVo888tcGFKedEZY/Y8YapfStJ6zSE23tzYPKxqKwQBnQoIO0BI/Q==",
"dev": true,
- "dependencies": {
- "graceful-fs": "^4.2.4",
- "tapable": "^2.2.0"
+ "hasInstallScript": true,
+ "bin": {
+ "esbuild": "bin/esbuild"
},
"engines": {
- "node": ">=10.13.0"
+ "node": ">=12"
+ },
+ "optionalDependencies": {
+ "esbuild-android-64": "0.14.25",
+ "esbuild-android-arm64": "0.14.25",
+ "esbuild-darwin-64": "0.14.25",
+ "esbuild-darwin-arm64": "0.14.25",
+ "esbuild-freebsd-64": "0.14.25",
+ "esbuild-freebsd-arm64": "0.14.25",
+ "esbuild-linux-32": "0.14.25",
+ "esbuild-linux-64": "0.14.25",
+ "esbuild-linux-arm": "0.14.25",
+ "esbuild-linux-arm64": "0.14.25",
+ "esbuild-linux-mips64le": "0.14.25",
+ "esbuild-linux-ppc64le": "0.14.25",
+ "esbuild-linux-riscv64": "0.14.25",
+ "esbuild-linux-s390x": "0.14.25",
+ "esbuild-netbsd-64": "0.14.25",
+ "esbuild-openbsd-64": "0.14.25",
+ "esbuild-sunos-64": "0.14.25",
+ "esbuild-windows-32": "0.14.25",
+ "esbuild-windows-64": "0.14.25",
+ "esbuild-windows-arm64": "0.14.25"
+ }
+ },
+ "node_modules/esbuild-android-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.25.tgz",
+ "integrity": "sha512-L5vCUk7TzFbBnoESNoXjU3x9+/+7TDIE/1mTfy/erAfvZAqC+S3sp/Qa9wkypFMcFvN9FzvESkTlpeQDolREtQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
}
},
- "node_modules/enquirer": {
- "version": "2.3.6",
- "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
- "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
+ "node_modules/esbuild-android-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.25.tgz",
+ "integrity": "sha512-4jv5xPjM/qNm27T5j3ZEck0PvjgQtoMHnz4FzwF5zNP56PvY2CT0WStcAIl6jNlsuDdN63rk2HRBIsO6xFbcFw==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
- "dependencies": {
- "ansi-colors": "^4.1.1"
- },
+ "optional": true,
+ "os": [
+ "android"
+ ],
"engines": {
- "node": ">=8.6"
+ "node": ">=12"
}
},
- "node_modules/envinfo": {
- "version": "7.8.1",
- "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz",
- "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==",
+ "node_modules/esbuild-darwin-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.25.tgz",
+ "integrity": "sha512-TGp8tuudIxOyWd1+8aYPxQmC1ZQyvij/AfNBa35RubixD0zJ1vkKHVAzo0Zao1zcG6pNqiSyzfPto8vmg0s7oA==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
- "bin": {
- "envinfo": "dist/cli.js"
- },
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
"engines": {
- "node": ">=4"
+ "node": ">=12"
}
},
- "node_modules/es-module-lexer": {
- "version": "0.9.3",
- "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
- "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
- "dev": true
+ "node_modules/esbuild-darwin-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.25.tgz",
+ "integrity": "sha512-oTcDgdm0MDVEmw2DWu8BV68pYuImpFgvWREPErBZmNA4MYKGuBRaCiJqq6jZmBR1x+3y1DWCjez+5uLtuAm6mw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
},
- "node_modules/escalade": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
- "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "node_modules/esbuild-freebsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.25.tgz",
+ "integrity": "sha512-ueAqbnMZ8arnuLH8tHwTCQYeptnHOUV7vA6px6j4zjjQwDx7TdP7kACPf3TLZLdJQ3CAD1XCvQ2sPhX+8tacvQ==",
+ "cpu": [
+ "x64"
+ ],
"dev": true,
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
"engines": {
- "node": ">=6"
+ "node": ">=12"
}
},
- "node_modules/escape-string-regexp": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
- "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "node_modules/esbuild-freebsd-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.25.tgz",
+ "integrity": "sha512-+ZVWud2HKh+Ob6k/qiJWjBtUg4KmJGGmbvEXXW1SNKS7hW7HU+Zq2ZCcE1akFxOPkVB+EhOty/sSek30tkCYug==",
+ "cpu": [
+ "arm64"
+ ],
"dev": true,
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
"engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "node": ">=12"
}
},
- "node_modules/eslint": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.2.0.tgz",
- "integrity": "sha512-erw7XmM+CLxTOickrimJ1SiF55jiNlVSp2qqm0NuBWPtHYQCegD5ZMaW0c3i5ytPqL+SSLaCxdvQXFPLJn+ABw==",
+ "node_modules/esbuild-linux-32": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.25.tgz",
+ "integrity": "sha512-3OP/lwV3kCzEz45tobH9nj+uE4ubhGsfx+tn0L26WAGtUbmmcRpqy7XRG/qK7h1mClZ+eguIANcQntYMdYklfw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.25.tgz",
+ "integrity": "sha512-+aKHdHZmX9qwVlQmu5xYXh7GsBFf4TWrePgeJTalhXHOG7NNuUwoHmketGiZEoNsWyyqwH9rE5BC+iwcLY30Ug==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-arm": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.25.tgz",
+ "integrity": "sha512-aTLcE2VBoLydL943REcAcgnDi3bHtmULSXWLbjtBdtykRatJVSxKMjK9YlBXUZC4/YcNQfH7AxwVeQr9fNxPhw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.25.tgz",
+ "integrity": "sha512-UxfenPx/wSZx55gScCImPtXekvZQLI2GW3qe5dtlmU7luiqhp5GWPzGeQEbD3yN3xg/pHc671m5bma5Ns7lBHw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-mips64le": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.25.tgz",
+ "integrity": "sha512-wLWYyqVfYx9Ur6eU5RT92yJVsaBGi5RdkoWqRHOqcJ38Kn60QMlcghsKeWfe9jcYut8LangYZ98xO1LxIoSXrQ==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-ppc64le": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.25.tgz",
+ "integrity": "sha512-0dR6Csl6Zas3g4p9ULckEl8Mo8IInJh33VCJ3eaV1hj9+MHGdmDOakYMN8MZP9/5nl+NU/0ygpd14cWgy8uqRw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-riscv64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.25.tgz",
+ "integrity": "sha512-J4d20HDmTrgvhR0bdkDhvvJGaikH3LzXQnNaseo8rcw9Yqby9A90gKUmWpfwqLVNRILvNnAmKLfBjCKU9ajg8w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-linux-s390x": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.25.tgz",
+ "integrity": "sha512-YI2d5V6nTE73ZnhEKQD7MtsPs1EtUZJ3obS21oxQxGbbRw1G+PtJKjNyur+3t6nzHP9oTg6GHQ3S3hOLLmbDIQ==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-netbsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.25.tgz",
+ "integrity": "sha512-TKIVgNWLUOkr+Exrye70XTEE1lJjdQXdM4tAXRzfHE9iBA7LXWcNtVIuSnphTqpanPzTDFarF0yqq4kpbC6miA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-openbsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.25.tgz",
+ "integrity": "sha512-QgFJ37A15D7NIXBTYEqz29+uw3nNBOIyog+3kFidANn6kjw0GHZ0lEYQn+cwjyzu94WobR+fes7cTl/ZYlHb1A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-sunos-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.25.tgz",
+ "integrity": "sha512-rmWfjUItYIVlqr5EnTH1+GCxXiBOC42WBZ3w++qh7n2cS9Xo0lO5pGSG2N+huOU2fX5L+6YUuJ78/vOYvefeFw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-windows-32": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.25.tgz",
+ "integrity": "sha512-HGAxVUofl3iUIz9W10Y9XKtD0bNsK9fBXv1D55N/ljNvkrAYcGB8YCm0v7DjlwtyS6ws3dkdQyXadbxkbzaKOA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-windows-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.25.tgz",
+ "integrity": "sha512-TirEohRkfWU9hXLgoDxzhMQD1g8I2mOqvdQF2RS9E/wbkORTAqJHyh7wqGRCQAwNzdNXdg3JAyhQ9/177AadWA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/esbuild-windows-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.25.tgz",
+ "integrity": "sha512-4ype9ERiI45rSh+R8qUoBtaj6kJvUOI7oVLhKqPEpcF4Pa5PpT3hm/mXAyotJHREkHpM87PAJcA442mLnbtlNA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint": {
+ "version": "8.10.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz",
+ "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==",
"dev": true,
"dependencies": {
- "@eslint/eslintrc": "^1.0.4",
- "@humanwhocodes/config-array": "^0.6.0",
+ "@eslint/eslintrc": "^1.2.0",
+ "@humanwhocodes/config-array": "^0.9.2",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"doctrine": "^3.0.0",
- "enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0",
- "eslint-scope": "^6.0.0",
+ "eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
- "eslint-visitor-keys": "^3.0.0",
- "espree": "^9.0.0",
+ "eslint-visitor-keys": "^3.3.0",
+ "espree": "^9.3.1",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
@@ -1013,7 +934,7 @@
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^6.0.1",
"globals": "^13.6.0",
- "ignore": "^4.0.6",
+ "ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
@@ -1024,9 +945,7 @@
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
- "progress": "^2.0.0",
"regexpp": "^3.2.0",
- "semver": "^7.2.1",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
"text-table": "^0.2.0",
@@ -1083,18 +1002,18 @@
}
},
"node_modules/eslint-visitor-keys": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz",
- "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz",
+ "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/eslint/node_modules/eslint-scope": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz",
- "integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz",
+ "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==",
"dev": true,
"dependencies": {
"esrecurse": "^4.3.0",
@@ -1113,24 +1032,15 @@
"node": ">=4.0"
}
},
- "node_modules/eslint/node_modules/ignore": {
- "version": "4.0.6",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
- "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
- "dev": true,
- "engines": {
- "node": ">= 4"
- }
- },
"node_modules/espree": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz",
- "integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==",
+ "version": "9.3.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz",
+ "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==",
"dev": true,
"dependencies": {
- "acorn": "^8.5.0",
+ "acorn": "^8.7.0",
"acorn-jsx": "^5.3.1",
- "eslint-visitor-keys": "^3.0.0"
+ "eslint-visitor-keys": "^3.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1196,38 +1106,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/events": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
- "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
- "dev": true,
- "engines": {
- "node": ">=0.8.x"
- }
- },
- "node_modules/execa": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
- "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
- "dev": true,
- "dependencies": {
- "cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
- "merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sindresorhus/execa?sponsor=1"
- }
- },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -1235,9 +1113,9 @@
"dev": true
},
"node_modules/fast-glob": {
- "version": "3.2.7",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
- "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
+ "version": "3.2.11",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
+ "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
"dev": true,
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
@@ -1247,7 +1125,7 @@
"micromatch": "^4.0.4"
},
"engines": {
- "node": ">=8"
+ "node": ">=8.6.0"
}
},
"node_modules/fast-glob/node_modules/glob-parent": {
@@ -1274,12 +1152,6 @@
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"dev": true
},
- "node_modules/fastest-levenshtein": {
- "version": "1.0.12",
- "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
- "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==",
- "dev": true
- },
"node_modules/fastq": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
@@ -1313,19 +1185,6 @@
"node": ">=8"
}
},
- "node_modules/find-up": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
- "dev": true,
- "dependencies": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/flat-cache": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
@@ -1340,9 +1199,9 @@
}
},
"node_modules/flatted": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz",
- "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
+ "version": "3.2.5",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
+ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
"dev": true
},
"node_modules/fs.realpath": {
@@ -1351,30 +1210,12 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
- "node_modules/function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
- "dev": true
- },
"node_modules/functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
- "node_modules/get-stream": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
- "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
- "dev": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
@@ -1407,16 +1248,10 @@
"node": ">=10.13.0"
}
},
- "node_modules/glob-to-regexp": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
- "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
- "dev": true
- },
"node_modules/globals": {
- "version": "13.12.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
- "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
+ "version": "13.12.1",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz",
+ "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -1429,16 +1264,16 @@
}
},
"node_modules/globby": {
- "version": "11.0.4",
- "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz",
- "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
- "fast-glob": "^3.1.1",
- "ignore": "^5.1.4",
- "merge2": "^1.3.0",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
@@ -1448,24 +1283,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/graceful-fs": {
- "version": "4.2.8",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
- "dev": true
- },
- "node_modules/has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
- "dev": true,
- "dependencies": {
- "function-bind": "^1.1.1"
- },
- "engines": {
- "node": ">= 0.4.0"
- }
- },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -1475,19 +1292,10 @@
"node": ">=8"
}
},
- "node_modules/human-signals": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
- "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
- "dev": true,
- "engines": {
- "node": ">=10.17.0"
- }
- },
"node_modules/ignore": {
- "version": "5.1.9",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz",
- "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
+ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
"dev": true,
"engines": {
"node": ">= 4"
@@ -1509,22 +1317,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/import-local": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz",
- "integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==",
- "dev": true,
- "dependencies": {
- "pkg-dir": "^4.2.0",
- "resolve-cwd": "^3.0.0"
- },
- "bin": {
- "import-local-fixture": "fixtures/cli.js"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@@ -1550,27 +1342,6 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
- "node_modules/interpret": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
- "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
- "dev": true,
- "engines": {
- "node": ">= 0.10"
- }
- },
- "node_modules/is-core-module": {
- "version": "2.8.0",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
- "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
- "dev": true,
- "dependencies": {
- "has": "^1.0.3"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -1601,74 +1372,12 @@
"node": ">=0.12.0"
}
},
- "node_modules/is-plain-object": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
- "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
- "dev": true,
- "dependencies": {
- "isobject": "^3.0.1"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
- "dev": true,
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
- "node_modules/isobject": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
- "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/jest-worker": {
- "version": "27.3.1",
- "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.3.1.tgz",
- "integrity": "sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==",
- "dev": true,
- "dependencies": {
- "@types/node": "*",
- "merge-stream": "^2.0.0",
- "supports-color": "^8.0.0"
- },
- "engines": {
- "node": ">= 10.13.0"
- }
- },
- "node_modules/jest-worker/node_modules/supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
- "dev": true,
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/supports-color?sponsor=1"
- }
- },
"node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@@ -1681,12 +1390,6 @@
"js-yaml": "bin/js-yaml.js"
}
},
- "node_modules/json-parse-better-errors": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
- "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
- "dev": true
- },
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -1699,15 +1402,6 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
- "node_modules/kind-of": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
- "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -1721,27 +1415,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/loader-runner": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz",
- "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==",
- "dev": true,
- "engines": {
- "node": ">=6.11.5"
- }
- },
- "node_modules/locate-path": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
- "dev": true,
- "dependencies": {
- "p-locate": "^4.1.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -1765,18 +1438,6 @@
"node": ">=10"
}
},
- "node_modules/make-error": {
- "version": "1.3.6",
- "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
- "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
- "dev": true
- },
- "node_modules/merge-stream": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
- "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
- "dev": true
- },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -1799,40 +1460,10 @@
"node": ">=8.6"
}
},
- "node_modules/mime-db": {
- "version": "1.50.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz",
- "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==",
- "dev": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/mime-types": {
- "version": "2.1.33",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz",
- "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==",
- "dev": true,
- "dependencies": {
- "mime-db": "1.50.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
@@ -1841,18 +1472,6 @@
"node": "*"
}
},
- "node_modules/mkdirp": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
- "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
- "dev": true,
- "bin": {
- "mkdirp": "bin/cmd.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -1865,30 +1484,6 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
- "node_modules/neo-async": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
- "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
- "dev": true
- },
- "node_modules/node-releases": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz",
- "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==",
- "dev": true
- },
- "node_modules/npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
- "dev": true,
- "dependencies": {
- "path-key": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -1898,21 +1493,6 @@
"wrappy": "1"
}
},
- "node_modules/onetime": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
- "dev": true,
- "dependencies": {
- "mimic-fn": "^2.1.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/optionator": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
@@ -1930,42 +1510,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/p-limit": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
- "dev": true,
- "dependencies": {
- "p-try": "^2.0.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/p-locate": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
- "dev": true,
- "dependencies": {
- "p-limit": "^2.2.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -1978,15 +1522,6 @@
"node": ">=6"
}
},
- "node_modules/path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
- "dev": true,
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -2005,12 +1540,6 @@
"node": ">=8"
}
},
- "node_modules/path-parse": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
- "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
- "dev": true
- },
"node_modules/path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
@@ -2020,22 +1549,10 @@
"node": ">=8"
}
},
- "node_modules/physical-cpu-count": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz",
- "integrity": "sha1-GN4vl+S/epVRrXURlCtUlverpmA=",
- "dev": true
- },
- "node_modules/picocolors": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
- "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
- "dev": true
- },
"node_modules/picomatch": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
- "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
@@ -2044,18 +1561,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/pkg-dir": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
- "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
- "dev": true,
- "dependencies": {
- "find-up": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -2065,15 +1570,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/progress": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
- "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
- "dev": true,
- "engines": {
- "node": ">=0.4.0"
- }
- },
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
@@ -2103,27 +1599,6 @@
}
]
},
- "node_modules/randombytes": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
- "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
- "dev": true,
- "dependencies": {
- "safe-buffer": "^5.1.0"
- }
- },
- "node_modules/rechoir": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
- "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
- "dev": true,
- "dependencies": {
- "resolve": "^1.9.0"
- },
- "engines": {
- "node": ">= 0.10"
- }
- },
"node_modules/regexpp": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
@@ -2136,40 +1611,6 @@
"url": "https://github.com/sponsors/mysticatea"
}
},
- "node_modules/resolve": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
- "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
- "dev": true,
- "dependencies": {
- "is-core-module": "^2.2.0",
- "path-parse": "^1.0.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/resolve-cwd": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz",
- "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==",
- "dev": true,
- "dependencies": {
- "resolve-from": "^5.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/resolve-cwd/node_modules/resolve-from": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
- "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
- "dev": true,
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/resolve-from": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
@@ -2227,44 +1668,6 @@
"queue-microtask": "^1.2.2"
}
},
- "node_modules/safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ]
- },
- "node_modules/schema-utils": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
- "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
- "dev": true,
- "dependencies": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
- },
- "engines": {
- "node": ">= 10.13.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
- }
- },
"node_modules/semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
@@ -2280,27 +1683,6 @@
"node": ">=10"
}
},
- "node_modules/serialize-javascript": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
- "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
- "dev": true,
- "dependencies": {
- "randombytes": "^2.1.0"
- }
- },
- "node_modules/shallow-clone": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
- "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
- "dev": true,
- "dependencies": {
- "kind-of": "^6.0.2"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -2322,12 +1704,6 @@
"node": ">=8"
}
},
- "node_modules/signal-exit": {
- "version": "3.0.5",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
- "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
- "dev": true
- },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -2337,23 +1713,6 @@
"node": ">=8"
}
},
- "node_modules/source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/source-map-support": {
- "version": "0.5.20",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz",
- "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==",
- "dependencies": {
- "buffer-from": "^1.0.0",
- "source-map": "^0.6.0"
- }
- },
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -2366,15 +1725,6 @@
"node": ">=8"
}
},
- "node_modules/strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -2399,75 +1749,6 @@
"node": ">=8"
}
},
- "node_modules/tapable": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
- "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/terser": {
- "version": "5.9.0",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz",
- "integrity": "sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ==",
- "dev": true,
- "dependencies": {
- "commander": "^2.20.0",
- "source-map": "~0.7.2",
- "source-map-support": "~0.5.20"
- },
- "bin": {
- "terser": "bin/terser"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/terser-webpack-plugin": {
- "version": "5.2.5",
- "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz",
- "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==",
- "dev": true,
- "dependencies": {
- "jest-worker": "^27.0.6",
- "schema-utils": "^3.1.1",
- "serialize-javascript": "^6.0.0",
- "source-map": "^0.6.1",
- "terser": "^5.7.2"
- },
- "engines": {
- "node": ">= 10.13.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
- },
- "peerDependencies": {
- "webpack": "^5.1.0"
- },
- "peerDependenciesMeta": {
- "@swc/core": {
- "optional": true
- },
- "esbuild": {
- "optional": true
- },
- "uglify-js": {
- "optional": true
- }
- }
- },
- "node_modules/terser/node_modules/source-map": {
- "version": "0.7.3",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
- "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
- "dev": true,
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@@ -2486,75 +1767,6 @@
"node": ">=8.0"
}
},
- "node_modules/ts-loader": {
- "version": "9.2.6",
- "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.6.tgz",
- "integrity": "sha512-QMTC4UFzHmu9wU2VHZEmWWE9cUajjfcdcws+Gh7FhiO+Dy0RnR1bNz0YCHqhI0yRowCE9arVnNxYHqELOy9Hjw==",
- "dev": true,
- "dependencies": {
- "chalk": "^4.1.0",
- "enhanced-resolve": "^5.0.0",
- "micromatch": "^4.0.0",
- "semver": "^7.3.4"
- },
- "engines": {
- "node": ">=12.0.0"
- },
- "peerDependencies": {
- "typescript": "*",
- "webpack": "^5.0.0"
- }
- },
- "node_modules/ts-node": {
- "version": "10.4.0",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
- "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
- "dev": true,
- "dependencies": {
- "@cspotcode/source-map-support": "0.7.0",
- "@tsconfig/node10": "^1.0.7",
- "@tsconfig/node12": "^1.0.7",
- "@tsconfig/node14": "^1.0.0",
- "@tsconfig/node16": "^1.0.2",
- "acorn": "^8.4.1",
- "acorn-walk": "^8.1.1",
- "arg": "^4.1.0",
- "create-require": "^1.1.0",
- "diff": "^4.0.1",
- "make-error": "^1.1.1",
- "yn": "3.1.1"
- },
- "bin": {
- "ts-node": "dist/bin.js",
- "ts-node-cwd": "dist/bin-cwd.js",
- "ts-node-script": "dist/bin-script.js",
- "ts-node-transpile-only": "dist/bin-transpile.js",
- "ts-script": "dist/bin-script-deprecated.js"
- },
- "peerDependencies": {
- "@swc/core": ">=1.2.50",
- "@swc/wasm": ">=1.2.50",
- "@types/node": "*",
- "typescript": ">=2.7"
- },
- "peerDependenciesMeta": {
- "@swc/core": {
- "optional": true
- },
- "@swc/wasm": {
- "optional": true
- }
- }
- },
- "node_modules/ts-node/node_modules/diff": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
- "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
- "dev": true,
- "engines": {
- "node": ">=0.3.1"
- }
- },
"node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
@@ -2601,9 +1813,9 @@
}
},
"node_modules/typescript": {
- "version": "4.5.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
- "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
+ "version": "4.5.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
+ "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -2628,140 +1840,6 @@
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
- "node_modules/watchpack": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz",
- "integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==",
- "dev": true,
- "dependencies": {
- "glob-to-regexp": "^0.4.1",
- "graceful-fs": "^4.1.2"
- },
- "engines": {
- "node": ">=10.13.0"
- }
- },
- "node_modules/webpack": {
- "version": "5.64.1",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.64.1.tgz",
- "integrity": "sha512-b4FHmRgaaAjP+aVOVz41a9Qa5SmkUPQ+u8FntTQ1roPHahSComB6rXnLwc976VhUY4CqTaLu5mCswuHiNhOfVw==",
- "dev": true,
- "dependencies": {
- "@types/eslint-scope": "^3.7.0",
- "@types/estree": "^0.0.50",
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/wasm-edit": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1",
- "acorn": "^8.4.1",
- "acorn-import-assertions": "^1.7.6",
- "browserslist": "^4.14.5",
- "chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^5.8.3",
- "es-module-lexer": "^0.9.0",
- "eslint-scope": "5.1.1",
- "events": "^3.2.0",
- "glob-to-regexp": "^0.4.1",
- "graceful-fs": "^4.2.4",
- "json-parse-better-errors": "^1.0.2",
- "loader-runner": "^4.2.0",
- "mime-types": "^2.1.27",
- "neo-async": "^2.6.2",
- "schema-utils": "^3.1.0",
- "tapable": "^2.1.1",
- "terser-webpack-plugin": "^5.1.3",
- "watchpack": "^2.2.0",
- "webpack-sources": "^3.2.2"
- },
- "bin": {
- "webpack": "bin/webpack.js"
- },
- "engines": {
- "node": ">=10.13.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
- },
- "peerDependenciesMeta": {
- "webpack-cli": {
- "optional": true
- }
- }
- },
- "node_modules/webpack-cli": {
- "version": "4.9.1",
- "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz",
- "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==",
- "dev": true,
- "dependencies": {
- "@discoveryjs/json-ext": "^0.5.0",
- "@webpack-cli/configtest": "^1.1.0",
- "@webpack-cli/info": "^1.4.0",
- "@webpack-cli/serve": "^1.6.0",
- "colorette": "^2.0.14",
- "commander": "^7.0.0",
- "execa": "^5.0.0",
- "fastest-levenshtein": "^1.0.12",
- "import-local": "^3.0.2",
- "interpret": "^2.2.0",
- "rechoir": "^0.7.0",
- "webpack-merge": "^5.7.3"
- },
- "bin": {
- "webpack-cli": "bin/cli.js"
- },
- "engines": {
- "node": ">=10.13.0"
- },
- "peerDependencies": {
- "webpack": "4.x.x || 5.x.x"
- },
- "peerDependenciesMeta": {
- "@webpack-cli/generators": {
- "optional": true
- },
- "@webpack-cli/migrate": {
- "optional": true
- },
- "webpack-bundle-analyzer": {
- "optional": true
- },
- "webpack-dev-server": {
- "optional": true
- }
- }
- },
- "node_modules/webpack-cli/node_modules/commander": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
- "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
- "dev": true,
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/webpack-merge": {
- "version": "5.8.0",
- "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz",
- "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==",
- "dev": true,
- "dependencies": {
- "clone-deep": "^4.0.1",
- "wildcard": "^2.0.0"
- },
- "engines": {
- "node": ">=10.0.0"
- }
- },
- "node_modules/webpack-sources": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz",
- "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==",
- "dev": true,
- "engines": {
- "node": ">=10.13.0"
- }
- },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -2777,12 +1855,6 @@
"node": ">= 8"
}
},
- "node_modules/wildcard": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz",
- "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==",
- "dev": true
- },
"node_modules/word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -2803,48 +1875,18 @@
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
- },
- "node_modules/yn": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
- "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
}
},
"dependencies": {
- "@cspotcode/source-map-consumer": {
- "version": "0.8.0",
- "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
- "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==",
- "dev": true
- },
- "@cspotcode/source-map-support": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
- "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
- "dev": true,
- "requires": {
- "@cspotcode/source-map-consumer": "0.8.0"
- }
- },
- "@discoveryjs/json-ext": {
- "version": "0.5.5",
- "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz",
- "integrity": "sha512-6nFkfkmSeV/rqSaS4oWHgmpnYw194f6hmWF5is6b0J1naJZoiD0NTc9AiUwPHvWsowkjuHErCZT1wa0jg+BLIA==",
- "dev": true
- },
"@eslint/eslintrc": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.4.tgz",
- "integrity": "sha512-h8Vx6MdxwWI2WM8/zREHMoqdgLNXEL4QX3MWSVMdyNJGvXVOs+6lp+m2hc3FnuMHDc4poxFNI20vCk0OmI4G0Q==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz",
+ "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
- "espree": "^9.0.0",
+ "espree": "^9.3.1",
"globals": "^13.9.0",
"ignore": "^4.0.6",
"import-fresh": "^3.2.1",
@@ -2862,12 +1904,12 @@
}
},
"@humanwhocodes/config-array": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz",
- "integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==",
+ "version": "0.9.5",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz",
+ "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==",
"dev": true,
"requires": {
- "@humanwhocodes/object-schema": "^1.2.0",
+ "@humanwhocodes/object-schema": "^1.2.1",
"debug": "^4.1.1",
"minimatch": "^3.0.4"
}
@@ -2904,56 +1946,6 @@
"fastq": "^1.6.0"
}
},
- "@tsconfig/node10": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
- "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==",
- "dev": true
- },
- "@tsconfig/node12": {
- "version": "1.0.9",
- "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
- "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==",
- "dev": true
- },
- "@tsconfig/node14": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
- "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==",
- "dev": true
- },
- "@tsconfig/node16": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
- "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
- "dev": true
- },
- "@types/eslint": {
- "version": "7.28.2",
- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.2.tgz",
- "integrity": "sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA==",
- "dev": true,
- "requires": {
- "@types/estree": "*",
- "@types/json-schema": "*"
- }
- },
- "@types/eslint-scope": {
- "version": "3.7.1",
- "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.1.tgz",
- "integrity": "sha512-SCFeogqiptms4Fg29WpOTk5nHIzfpKCemSN63ksBQYKTcXoJEmJagV+DhVmbapZzY4/5YaOV1nZwrsU79fFm1g==",
- "dev": true,
- "requires": {
- "@types/eslint": "*",
- "@types/estree": "*"
- }
- },
- "@types/estree": {
- "version": "0.0.50",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz",
- "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==",
- "dev": true
- },
"@types/json-schema": {
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz",
@@ -2961,19 +1953,20 @@
"dev": true
},
"@types/node": {
- "version": "16.11.7",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
- "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==",
+ "version": "16.11.26",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.26.tgz",
+ "integrity": "sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==",
"dev": true
},
"@typescript-eslint/eslint-plugin": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.4.0.tgz",
- "integrity": "sha512-9/yPSBlwzsetCsGEn9j24D8vGQgJkOTr4oMLas/w886ZtzKIs1iyoqFrwsX2fqYEeUwsdBpC21gcjRGo57u0eg==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz",
+ "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==",
"dev": true,
"requires": {
- "@typescript-eslint/experimental-utils": "5.4.0",
- "@typescript-eslint/scope-manager": "5.4.0",
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/type-utils": "5.13.0",
+ "@typescript-eslint/utils": "5.13.0",
"debug": "^4.3.2",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.1.8",
@@ -2982,56 +1975,53 @@
"tsutils": "^3.21.0"
}
},
- "@typescript-eslint/experimental-utils": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.4.0.tgz",
- "integrity": "sha512-Nz2JDIQUdmIGd6p33A+naQmwfkU5KVTLb/5lTk+tLVTDacZKoGQisj8UCxk7onJcrgjIvr8xWqkYI+DbI3TfXg==",
+ "@typescript-eslint/parser": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz",
+ "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==",
"dev": true,
"requires": {
- "@types/json-schema": "^7.0.9",
- "@typescript-eslint/scope-manager": "5.4.0",
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/typescript-estree": "5.4.0",
- "eslint-scope": "^5.1.1",
- "eslint-utils": "^3.0.0"
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/typescript-estree": "5.13.0",
+ "debug": "^4.3.2"
}
},
- "@typescript-eslint/parser": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.4.0.tgz",
- "integrity": "sha512-JoB41EmxiYpaEsRwpZEYAJ9XQURPFer8hpkIW9GiaspVLX8oqbqNM8P4EP8HOZg96yaALiLEVWllA2E8vwsIKw==",
+ "@typescript-eslint/scope-manager": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz",
+ "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.4.0",
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/typescript-estree": "5.4.0",
- "debug": "^4.3.2"
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/visitor-keys": "5.13.0"
}
},
- "@typescript-eslint/scope-manager": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.4.0.tgz",
- "integrity": "sha512-pRxFjYwoi8R+n+sibjgF9iUiAELU9ihPBtHzocyW8v8D8G8KeQvXTsW7+CBYIyTYsmhtNk50QPGLE3vrvhM5KA==",
+ "@typescript-eslint/type-utils": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz",
+ "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/visitor-keys": "5.4.0"
+ "@typescript-eslint/utils": "5.13.0",
+ "debug": "^4.3.2",
+ "tsutils": "^3.21.0"
}
},
"@typescript-eslint/types": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.4.0.tgz",
- "integrity": "sha512-GjXNpmn+n1LvnttarX+sPD6+S7giO+9LxDIGlRl4wK3a7qMWALOHYuVSZpPTfEIklYjaWuMtfKdeByx0AcaThA==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz",
+ "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.4.0.tgz",
- "integrity": "sha512-nhlNoBdhKuwiLMx6GrybPT3SFILm5Gij2YBdPEPFlYNFAXUJWX6QRgvi/lwVoadaQEFsizohs6aFRMqsXI2ewA==",
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz",
+ "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.4.0",
- "@typescript-eslint/visitor-keys": "5.4.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/visitor-keys": "5.13.0",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
@@ -3039,210 +2029,36 @@
"tsutils": "^3.21.0"
}
},
- "@typescript-eslint/visitor-keys": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.4.0.tgz",
- "integrity": "sha512-PVbax7MeE7tdLfW5SA0fs8NGVVr+buMPrcj+CWYWPXsZCH8qZ1THufDzbXm1xrZ2b2PA1iENJ0sRq5fuUtvsJg==",
- "dev": true,
- "requires": {
- "@typescript-eslint/types": "5.4.0",
- "eslint-visitor-keys": "^3.0.0"
- }
- },
- "@webassemblyjs/ast": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
- "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==",
+ "@typescript-eslint/utils": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz",
+ "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==",
"dev": true,
"requires": {
- "@webassemblyjs/helper-numbers": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1"
- }
- },
- "@webassemblyjs/floating-point-hex-parser": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz",
- "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==",
- "dev": true
- },
- "@webassemblyjs/helper-api-error": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz",
- "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==",
- "dev": true
- },
- "@webassemblyjs/helper-buffer": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz",
- "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==",
- "dev": true
- },
- "@webassemblyjs/helper-numbers": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz",
- "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==",
- "dev": true,
- "requires": {
- "@webassemblyjs/floating-point-hex-parser": "1.11.1",
- "@webassemblyjs/helper-api-error": "1.11.1",
- "@xtuc/long": "4.2.2"
- }
- },
- "@webassemblyjs/helper-wasm-bytecode": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz",
- "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==",
- "dev": true
- },
- "@webassemblyjs/helper-wasm-section": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz",
- "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1"
- }
- },
- "@webassemblyjs/ieee754": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz",
- "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==",
- "dev": true,
- "requires": {
- "@xtuc/ieee754": "^1.2.0"
- }
- },
- "@webassemblyjs/leb128": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz",
- "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==",
- "dev": true,
- "requires": {
- "@xtuc/long": "4.2.2"
- }
- },
- "@webassemblyjs/utf8": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz",
- "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==",
- "dev": true
- },
- "@webassemblyjs/wasm-edit": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz",
- "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/helper-wasm-section": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1",
- "@webassemblyjs/wasm-opt": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1",
- "@webassemblyjs/wast-printer": "1.11.1"
- }
- },
- "@webassemblyjs/wasm-gen": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz",
- "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/ieee754": "1.11.1",
- "@webassemblyjs/leb128": "1.11.1",
- "@webassemblyjs/utf8": "1.11.1"
- }
- },
- "@webassemblyjs/wasm-opt": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz",
- "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-buffer": "1.11.1",
- "@webassemblyjs/wasm-gen": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1"
- }
- },
- "@webassemblyjs/wasm-parser": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz",
- "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/helper-api-error": "1.11.1",
- "@webassemblyjs/helper-wasm-bytecode": "1.11.1",
- "@webassemblyjs/ieee754": "1.11.1",
- "@webassemblyjs/leb128": "1.11.1",
- "@webassemblyjs/utf8": "1.11.1"
- }
- },
- "@webassemblyjs/wast-printer": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz",
- "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==",
- "dev": true,
- "requires": {
- "@webassemblyjs/ast": "1.11.1",
- "@xtuc/long": "4.2.2"
+ "@types/json-schema": "^7.0.9",
+ "@typescript-eslint/scope-manager": "5.13.0",
+ "@typescript-eslint/types": "5.13.0",
+ "@typescript-eslint/typescript-estree": "5.13.0",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0"
}
},
- "@webpack-cli/configtest": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz",
- "integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==",
- "dev": true,
- "requires": {}
- },
- "@webpack-cli/info": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz",
- "integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==",
+ "@typescript-eslint/visitor-keys": {
+ "version": "5.13.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz",
+ "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==",
"dev": true,
"requires": {
- "envinfo": "^7.7.3"
+ "@typescript-eslint/types": "5.13.0",
+ "eslint-visitor-keys": "^3.0.0"
}
},
- "@webpack-cli/serve": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz",
- "integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==",
- "dev": true,
- "requires": {}
- },
- "@xtuc/ieee754": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
- "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
- "dev": true
- },
- "@xtuc/long": {
- "version": "4.2.2",
- "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
- "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
- "dev": true
- },
"acorn": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz",
- "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
+ "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"dev": true
},
- "acorn-import-assertions": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
- "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
- "dev": true,
- "requires": {}
- },
"acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
@@ -3250,12 +2066,6 @@
"dev": true,
"requires": {}
},
- "acorn-walk": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
- "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
- "dev": true
- },
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -3268,19 +2078,6 @@
"uri-js": "^4.2.2"
}
},
- "ajv-keywords": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
- "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
- "dev": true,
- "requires": {}
- },
- "ansi-colors": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
- "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
- "dev": true
- },
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -3296,12 +2093,6 @@
"color-convert": "^2.0.1"
}
},
- "arg": {
- "version": "4.1.3",
- "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
- "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
- "dev": true
- },
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -3321,9 +2112,9 @@
"dev": true
},
"binaryen": {
- "version": "102.0.0-nightly.20211028",
- "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-102.0.0-nightly.20211028.tgz",
- "integrity": "sha512-GCJBVB5exbxzzvyt8MGDv/MeUjs6gkXDvf4xOIItRBptYl0Tz5sm1o/uG95YK0L0VeG5ajDu3hRtkBP2kzqC5w=="
+ "version": "106.0.0-nightly.20220320",
+ "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-106.0.0-nightly.20220320.tgz",
+ "integrity": "sha512-9Jzp9aOJ2uk2+viAiPr6+wi1BZKlxO4paTVm481RUEq3PIY63kdw78JoThrROt1s1qpCMuz0Oml6YqPJ7tep4w=="
},
"brace-expansion": {
"version": "1.1.11",
@@ -3344,36 +2135,12 @@
"fill-range": "^7.0.1"
}
},
- "browserslist": {
- "version": "4.17.6",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.6.tgz",
- "integrity": "sha512-uPgz3vyRTlEiCv4ee9KlsKgo2V6qPk7Jsn0KAn2OBqbqKo3iNcPEC1Ti6J4dwnz+aIRfEEEuOzC9IBk8tXUomw==",
- "dev": true,
- "requires": {
- "caniuse-lite": "^1.0.30001274",
- "electron-to-chromium": "^1.3.886",
- "escalade": "^3.1.1",
- "node-releases": "^2.0.1",
- "picocolors": "^1.0.0"
- }
- },
- "buffer-from": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
- "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
- },
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true
},
- "caniuse-lite": {
- "version": "1.0.30001278",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001278.tgz",
- "integrity": "sha512-mpF9KeH8u5cMoEmIic/cr7PNS+F5LWBk0t2ekGT60lFf0Wq+n9LspAj0g3P+o7DQhD3sUdlMln4YFAWhFYn9jg==",
- "dev": true
- },
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -3384,23 +2151,6 @@
"supports-color": "^7.1.0"
}
},
- "chrome-trace-event": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
- "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==",
- "dev": true
- },
- "clone-deep": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
- "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
- "dev": true,
- "requires": {
- "is-plain-object": "^2.0.4",
- "kind-of": "^6.0.2",
- "shallow-clone": "^3.0.0"
- }
- },
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@@ -3416,30 +2166,12 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
- "colorette": {
- "version": "2.0.16",
- "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz",
- "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==",
- "dev": true
- },
- "commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "dev": true
- },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
- "create-require": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
- "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
- "dev": true
- },
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -3452,9 +2184,9 @@
}
},
"debug": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
- "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
+ "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
"dev": true,
"requires": {
"ms": "2.1.2"
@@ -3490,48 +2222,173 @@
"esutils": "^2.0.2"
}
},
- "electron-to-chromium": {
- "version": "1.3.891",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.891.tgz",
- "integrity": "sha512-3cpwR82QkIS01CN/dup/4Yr3BiOiRLlZlcAFn/5FbNCunMO9ojqDgEP9JEo1QNLflu3pEnPWve50gHOEKc7r6w==",
- "dev": true
- },
- "enhanced-resolve": {
- "version": "5.8.3",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz",
- "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==",
+ "esbuild": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.25.tgz",
+ "integrity": "sha512-4JHEIOMNFvK09ziiL+iVmldIhLbn49V4NAVo888tcGFKedEZY/Y8YapfStJ6zSE23tzYPKxqKwQBnQoIO0BI/Q==",
"dev": true,
"requires": {
- "graceful-fs": "^4.2.4",
- "tapable": "^2.2.0"
+ "esbuild-android-64": "0.14.25",
+ "esbuild-android-arm64": "0.14.25",
+ "esbuild-darwin-64": "0.14.25",
+ "esbuild-darwin-arm64": "0.14.25",
+ "esbuild-freebsd-64": "0.14.25",
+ "esbuild-freebsd-arm64": "0.14.25",
+ "esbuild-linux-32": "0.14.25",
+ "esbuild-linux-64": "0.14.25",
+ "esbuild-linux-arm": "0.14.25",
+ "esbuild-linux-arm64": "0.14.25",
+ "esbuild-linux-mips64le": "0.14.25",
+ "esbuild-linux-ppc64le": "0.14.25",
+ "esbuild-linux-riscv64": "0.14.25",
+ "esbuild-linux-s390x": "0.14.25",
+ "esbuild-netbsd-64": "0.14.25",
+ "esbuild-openbsd-64": "0.14.25",
+ "esbuild-sunos-64": "0.14.25",
+ "esbuild-windows-32": "0.14.25",
+ "esbuild-windows-64": "0.14.25",
+ "esbuild-windows-arm64": "0.14.25"
}
},
- "enquirer": {
- "version": "2.3.6",
- "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
- "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
+ "esbuild-android-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.25.tgz",
+ "integrity": "sha512-L5vCUk7TzFbBnoESNoXjU3x9+/+7TDIE/1mTfy/erAfvZAqC+S3sp/Qa9wkypFMcFvN9FzvESkTlpeQDolREtQ==",
"dev": true,
- "requires": {
- "ansi-colors": "^4.1.1"
- }
+ "optional": true
},
- "envinfo": {
- "version": "7.8.1",
- "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz",
- "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==",
- "dev": true
+ "esbuild-android-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.25.tgz",
+ "integrity": "sha512-4jv5xPjM/qNm27T5j3ZEck0PvjgQtoMHnz4FzwF5zNP56PvY2CT0WStcAIl6jNlsuDdN63rk2HRBIsO6xFbcFw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-darwin-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.25.tgz",
+ "integrity": "sha512-TGp8tuudIxOyWd1+8aYPxQmC1ZQyvij/AfNBa35RubixD0zJ1vkKHVAzo0Zao1zcG6pNqiSyzfPto8vmg0s7oA==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-darwin-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.25.tgz",
+ "integrity": "sha512-oTcDgdm0MDVEmw2DWu8BV68pYuImpFgvWREPErBZmNA4MYKGuBRaCiJqq6jZmBR1x+3y1DWCjez+5uLtuAm6mw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-freebsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.25.tgz",
+ "integrity": "sha512-ueAqbnMZ8arnuLH8tHwTCQYeptnHOUV7vA6px6j4zjjQwDx7TdP7kACPf3TLZLdJQ3CAD1XCvQ2sPhX+8tacvQ==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-freebsd-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.25.tgz",
+ "integrity": "sha512-+ZVWud2HKh+Ob6k/qiJWjBtUg4KmJGGmbvEXXW1SNKS7hW7HU+Zq2ZCcE1akFxOPkVB+EhOty/sSek30tkCYug==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-32": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.25.tgz",
+ "integrity": "sha512-3OP/lwV3kCzEz45tobH9nj+uE4ubhGsfx+tn0L26WAGtUbmmcRpqy7XRG/qK7h1mClZ+eguIANcQntYMdYklfw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.25.tgz",
+ "integrity": "sha512-+aKHdHZmX9qwVlQmu5xYXh7GsBFf4TWrePgeJTalhXHOG7NNuUwoHmketGiZEoNsWyyqwH9rE5BC+iwcLY30Ug==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-arm": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.25.tgz",
+ "integrity": "sha512-aTLcE2VBoLydL943REcAcgnDi3bHtmULSXWLbjtBdtykRatJVSxKMjK9YlBXUZC4/YcNQfH7AxwVeQr9fNxPhw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.25.tgz",
+ "integrity": "sha512-UxfenPx/wSZx55gScCImPtXekvZQLI2GW3qe5dtlmU7luiqhp5GWPzGeQEbD3yN3xg/pHc671m5bma5Ns7lBHw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-mips64le": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.25.tgz",
+ "integrity": "sha512-wLWYyqVfYx9Ur6eU5RT92yJVsaBGi5RdkoWqRHOqcJ38Kn60QMlcghsKeWfe9jcYut8LangYZ98xO1LxIoSXrQ==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-ppc64le": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.25.tgz",
+ "integrity": "sha512-0dR6Csl6Zas3g4p9ULckEl8Mo8IInJh33VCJ3eaV1hj9+MHGdmDOakYMN8MZP9/5nl+NU/0ygpd14cWgy8uqRw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-riscv64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.25.tgz",
+ "integrity": "sha512-J4d20HDmTrgvhR0bdkDhvvJGaikH3LzXQnNaseo8rcw9Yqby9A90gKUmWpfwqLVNRILvNnAmKLfBjCKU9ajg8w==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-linux-s390x": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.25.tgz",
+ "integrity": "sha512-YI2d5V6nTE73ZnhEKQD7MtsPs1EtUZJ3obS21oxQxGbbRw1G+PtJKjNyur+3t6nzHP9oTg6GHQ3S3hOLLmbDIQ==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-netbsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.25.tgz",
+ "integrity": "sha512-TKIVgNWLUOkr+Exrye70XTEE1lJjdQXdM4tAXRzfHE9iBA7LXWcNtVIuSnphTqpanPzTDFarF0yqq4kpbC6miA==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-openbsd-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.25.tgz",
+ "integrity": "sha512-QgFJ37A15D7NIXBTYEqz29+uw3nNBOIyog+3kFidANn6kjw0GHZ0lEYQn+cwjyzu94WobR+fes7cTl/ZYlHb1A==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-sunos-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.25.tgz",
+ "integrity": "sha512-rmWfjUItYIVlqr5EnTH1+GCxXiBOC42WBZ3w++qh7n2cS9Xo0lO5pGSG2N+huOU2fX5L+6YUuJ78/vOYvefeFw==",
+ "dev": true,
+ "optional": true
+ },
+ "esbuild-windows-32": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.25.tgz",
+ "integrity": "sha512-HGAxVUofl3iUIz9W10Y9XKtD0bNsK9fBXv1D55N/ljNvkrAYcGB8YCm0v7DjlwtyS6ws3dkdQyXadbxkbzaKOA==",
+ "dev": true,
+ "optional": true
},
- "es-module-lexer": {
- "version": "0.9.3",
- "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz",
- "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
- "dev": true
+ "esbuild-windows-64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.25.tgz",
+ "integrity": "sha512-TirEohRkfWU9hXLgoDxzhMQD1g8I2mOqvdQF2RS9E/wbkORTAqJHyh7wqGRCQAwNzdNXdg3JAyhQ9/177AadWA==",
+ "dev": true,
+ "optional": true
},
- "escalade": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
- "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
- "dev": true
+ "esbuild-windows-arm64": {
+ "version": "0.14.25",
+ "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.25.tgz",
+ "integrity": "sha512-4ype9ERiI45rSh+R8qUoBtaj6kJvUOI7oVLhKqPEpcF4Pa5PpT3hm/mXAyotJHREkHpM87PAJcA442mLnbtlNA==",
+ "dev": true,
+ "optional": true
},
"escape-string-regexp": {
"version": "4.0.0",
@@ -3540,24 +2397,23 @@
"dev": true
},
"eslint": {
- "version": "8.2.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.2.0.tgz",
- "integrity": "sha512-erw7XmM+CLxTOickrimJ1SiF55jiNlVSp2qqm0NuBWPtHYQCegD5ZMaW0c3i5ytPqL+SSLaCxdvQXFPLJn+ABw==",
+ "version": "8.10.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz",
+ "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==",
"dev": true,
"requires": {
- "@eslint/eslintrc": "^1.0.4",
- "@humanwhocodes/config-array": "^0.6.0",
+ "@eslint/eslintrc": "^1.2.0",
+ "@humanwhocodes/config-array": "^0.9.2",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"doctrine": "^3.0.0",
- "enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0",
- "eslint-scope": "^6.0.0",
+ "eslint-scope": "^7.1.1",
"eslint-utils": "^3.0.0",
- "eslint-visitor-keys": "^3.0.0",
- "espree": "^9.0.0",
+ "eslint-visitor-keys": "^3.3.0",
+ "espree": "^9.3.1",
"esquery": "^1.4.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
@@ -3565,7 +2421,7 @@
"functional-red-black-tree": "^1.0.1",
"glob-parent": "^6.0.1",
"globals": "^13.6.0",
- "ignore": "^4.0.6",
+ "ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
@@ -3576,9 +2432,7 @@
"minimatch": "^3.0.4",
"natural-compare": "^1.4.0",
"optionator": "^0.9.1",
- "progress": "^2.0.0",
"regexpp": "^3.2.0",
- "semver": "^7.2.1",
"strip-ansi": "^6.0.1",
"strip-json-comments": "^3.1.0",
"text-table": "^0.2.0",
@@ -3586,9 +2440,9 @@
},
"dependencies": {
"eslint-scope": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz",
- "integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==",
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz",
+ "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==",
"dev": true,
"requires": {
"esrecurse": "^4.3.0",
@@ -3600,12 +2454,6 @@
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true
- },
- "ignore": {
- "version": "4.0.6",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
- "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
- "dev": true
}
}
},
@@ -3637,20 +2485,20 @@
}
},
"eslint-visitor-keys": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz",
- "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==",
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz",
+ "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==",
"dev": true
},
"espree": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz",
- "integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==",
+ "version": "9.3.1",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz",
+ "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==",
"dev": true,
"requires": {
- "acorn": "^8.5.0",
+ "acorn": "^8.7.0",
"acorn-jsx": "^5.3.1",
- "eslint-visitor-keys": "^3.0.0"
+ "eslint-visitor-keys": "^3.3.0"
}
},
"esquery": {
@@ -3699,29 +2547,6 @@
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
- "events": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
- "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
- "dev": true
- },
- "execa": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
- "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
- "dev": true,
- "requires": {
- "cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
- "merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
- }
- },
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -3729,9 +2554,9 @@
"dev": true
},
"fast-glob": {
- "version": "3.2.7",
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
- "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
+ "version": "3.2.11",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
+ "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
"dev": true,
"requires": {
"@nodelib/fs.stat": "^2.0.2",
@@ -3764,12 +2589,6 @@
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
"dev": true
},
- "fastest-levenshtein": {
- "version": "1.0.12",
- "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
- "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==",
- "dev": true
- },
"fastq": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
@@ -3797,16 +2616,6 @@
"to-regex-range": "^5.0.1"
}
},
- "find-up": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
- "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
- "dev": true,
- "requires": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- }
- },
"flat-cache": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
@@ -3818,9 +2627,9 @@
}
},
"flatted": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz",
- "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==",
+ "version": "3.2.5",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
+ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
"dev": true
},
"fs.realpath": {
@@ -3829,24 +2638,12 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
- "function-bind": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
- "dev": true
- },
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
- "get-stream": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
- "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
- "dev": true
- },
"glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
@@ -3870,66 +2667,39 @@
"is-glob": "^4.0.3"
}
},
- "glob-to-regexp": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
- "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
- "dev": true
- },
"globals": {
- "version": "13.12.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
- "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
+ "version": "13.12.1",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz",
+ "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
}
},
"globby": {
- "version": "11.0.4",
- "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz",
- "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
"requires": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
- "fast-glob": "^3.1.1",
- "ignore": "^5.1.4",
- "merge2": "^1.3.0",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
"slash": "^3.0.0"
}
},
- "graceful-fs": {
- "version": "4.2.8",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz",
- "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==",
- "dev": true
- },
- "has": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
- "dev": true,
- "requires": {
- "function-bind": "^1.1.1"
- }
- },
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
- "human-signals": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
- "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
- "dev": true
- },
"ignore": {
- "version": "5.1.9",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.9.tgz",
- "integrity": "sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
+ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==",
"dev": true
},
"import-fresh": {
@@ -3942,16 +2712,6 @@
"resolve-from": "^4.0.0"
}
},
- "import-local": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz",
- "integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==",
- "dev": true,
- "requires": {
- "pkg-dir": "^4.2.0",
- "resolve-cwd": "^3.0.0"
- }
- },
"imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@@ -3974,21 +2734,6 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true
},
- "interpret": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz",
- "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==",
- "dev": true
- },
- "is-core-module": {
- "version": "2.8.0",
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz",
- "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==",
- "dev": true,
- "requires": {
- "has": "^1.0.3"
- }
- },
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -4010,55 +2755,12 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
- "is-plain-object": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
- "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
- "dev": true,
- "requires": {
- "isobject": "^3.0.1"
- }
- },
- "is-stream": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
- "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
- "dev": true
- },
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
},
- "isobject": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
- "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
- "dev": true
- },
- "jest-worker": {
- "version": "27.3.1",
- "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.3.1.tgz",
- "integrity": "sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g==",
- "dev": true,
- "requires": {
- "@types/node": "*",
- "merge-stream": "^2.0.0",
- "supports-color": "^8.0.0"
- },
- "dependencies": {
- "supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
- "dev": true,
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
- }
- },
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@@ -4068,12 +2770,6 @@
"argparse": "^2.0.1"
}
},
- "json-parse-better-errors": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
- "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
- "dev": true
- },
"json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -4086,12 +2782,6 @@
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
- "kind-of": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
- "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
- "dev": true
- },
"levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -4102,21 +2792,6 @@
"type-check": "~0.4.0"
}
},
- "loader-runner": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz",
- "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==",
- "dev": true
- },
- "locate-path": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
- "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
- "dev": true,
- "requires": {
- "p-locate": "^4.1.0"
- }
- },
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@@ -4137,18 +2812,6 @@
"yallist": "^4.0.0"
}
},
- "make-error": {
- "version": "1.3.6",
- "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
- "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
- "dev": true
- },
- "merge-stream": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
- "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
- "dev": true
- },
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -4165,42 +2828,15 @@
"picomatch": "^2.2.3"
}
},
- "mime-db": {
- "version": "1.50.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz",
- "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==",
- "dev": true
- },
- "mime-types": {
- "version": "2.1.33",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz",
- "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==",
- "dev": true,
- "requires": {
- "mime-db": "1.50.0"
- }
- },
- "mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true
- },
"minimatch": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
- "mkdirp": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
- "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
- "dev": true
- },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -4213,27 +2849,6 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
- "neo-async": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
- "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
- "dev": true
- },
- "node-releases": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz",
- "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==",
- "dev": true
- },
- "npm-run-path": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
- "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
- "dev": true,
- "requires": {
- "path-key": "^3.0.0"
- }
- },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -4243,15 +2858,6 @@
"wrappy": "1"
}
},
- "onetime": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
- "dev": true,
- "requires": {
- "mimic-fn": "^2.1.0"
- }
- },
"optionator": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
@@ -4266,30 +2872,6 @@
"word-wrap": "^1.2.3"
}
},
- "p-limit": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
- "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
- "dev": true,
- "requires": {
- "p-try": "^2.0.0"
- }
- },
- "p-locate": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
- "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
- "dev": true,
- "requires": {
- "p-limit": "^2.2.0"
- }
- },
- "p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
- "dev": true
- },
"parent-module": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -4299,12 +2881,6 @@
"callsites": "^3.0.0"
}
},
- "path-exists": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
- "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
- "dev": true
- },
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -4317,57 +2893,24 @@
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true
},
- "path-parse": {
- "version": "1.0.7",
- "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
- "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
- "dev": true
- },
"path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
- "physical-cpu-count": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz",
- "integrity": "sha1-GN4vl+S/epVRrXURlCtUlverpmA=",
- "dev": true
- },
- "picocolors": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
- "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
- "dev": true
- },
"picomatch": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
- "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true
},
- "pkg-dir": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
- "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
- "dev": true,
- "requires": {
- "find-up": "^4.0.0"
- }
- },
"prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
- "progress": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
- "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
- "dev": true
- },
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
@@ -4380,57 +2923,12 @@
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
"dev": true
},
- "randombytes": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
- "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
- "dev": true,
- "requires": {
- "safe-buffer": "^5.1.0"
- }
- },
- "rechoir": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz",
- "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==",
- "dev": true,
- "requires": {
- "resolve": "^1.9.0"
- }
- },
"regexpp": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
"dev": true
},
- "resolve": {
- "version": "1.20.0",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
- "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
- "dev": true,
- "requires": {
- "is-core-module": "^2.2.0",
- "path-parse": "^1.0.6"
- }
- },
- "resolve-cwd": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz",
- "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==",
- "dev": true,
- "requires": {
- "resolve-from": "^5.0.0"
- },
- "dependencies": {
- "resolve-from": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
- "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==",
- "dev": true
- }
- }
- },
"resolve-from": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
@@ -4461,23 +2959,6 @@
"queue-microtask": "^1.2.2"
}
},
- "safe-buffer": {
- "version": "5.2.1",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
- "dev": true
- },
- "schema-utils": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
- "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
- "dev": true,
- "requires": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
- }
- },
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
@@ -4487,24 +2968,6 @@
"lru-cache": "^6.0.0"
}
},
- "serialize-javascript": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
- "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
- "dev": true,
- "requires": {
- "randombytes": "^2.1.0"
- }
- },
- "shallow-clone": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
- "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.2"
- }
- },
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -4520,32 +2983,12 @@
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true
},
- "signal-exit": {
- "version": "3.0.5",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
- "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
- "dev": true
- },
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true
},
- "source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
- },
- "source-map-support": {
- "version": "0.5.20",
- "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz",
- "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==",
- "requires": {
- "buffer-from": "^1.0.0",
- "source-map": "^0.6.0"
- }
- },
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -4555,12 +2998,6 @@
"ansi-regex": "^5.0.1"
}
},
- "strip-final-newline": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
- "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
- "dev": true
- },
"strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -4576,44 +3013,6 @@
"has-flag": "^4.0.0"
}
},
- "tapable": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
- "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
- "dev": true
- },
- "terser": {
- "version": "5.9.0",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz",
- "integrity": "sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ==",
- "dev": true,
- "requires": {
- "commander": "^2.20.0",
- "source-map": "~0.7.2",
- "source-map-support": "~0.5.20"
- },
- "dependencies": {
- "source-map": {
- "version": "0.7.3",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",
- "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",
- "dev": true
- }
- }
- },
- "terser-webpack-plugin": {
- "version": "5.2.5",
- "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz",
- "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==",
- "dev": true,
- "requires": {
- "jest-worker": "^27.0.6",
- "schema-utils": "^3.1.1",
- "serialize-javascript": "^6.0.0",
- "source-map": "^0.6.1",
- "terser": "^5.7.2"
- }
- },
"text-table": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@@ -4629,46 +3028,6 @@
"is-number": "^7.0.0"
}
},
- "ts-loader": {
- "version": "9.2.6",
- "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.6.tgz",
- "integrity": "sha512-QMTC4UFzHmu9wU2VHZEmWWE9cUajjfcdcws+Gh7FhiO+Dy0RnR1bNz0YCHqhI0yRowCE9arVnNxYHqELOy9Hjw==",
- "dev": true,
- "requires": {
- "chalk": "^4.1.0",
- "enhanced-resolve": "^5.0.0",
- "micromatch": "^4.0.0",
- "semver": "^7.3.4"
- }
- },
- "ts-node": {
- "version": "10.4.0",
- "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
- "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
- "dev": true,
- "requires": {
- "@cspotcode/source-map-support": "0.7.0",
- "@tsconfig/node10": "^1.0.7",
- "@tsconfig/node12": "^1.0.7",
- "@tsconfig/node14": "^1.0.0",
- "@tsconfig/node16": "^1.0.2",
- "acorn": "^8.4.1",
- "acorn-walk": "^8.1.1",
- "arg": "^4.1.0",
- "create-require": "^1.1.0",
- "diff": "^4.0.1",
- "make-error": "^1.1.1",
- "yn": "3.1.1"
- },
- "dependencies": {
- "diff": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
- "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
- "dev": true
- }
- }
- },
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
@@ -4700,9 +3059,9 @@
"dev": true
},
"typescript": {
- "version": "4.5.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
- "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
+ "version": "4.5.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
+ "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
"dev": true
},
"uri-js": {
@@ -4720,92 +3079,6 @@
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==",
"dev": true
},
- "watchpack": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz",
- "integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==",
- "dev": true,
- "requires": {
- "glob-to-regexp": "^0.4.1",
- "graceful-fs": "^4.1.2"
- }
- },
- "webpack": {
- "version": "5.64.1",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.64.1.tgz",
- "integrity": "sha512-b4FHmRgaaAjP+aVOVz41a9Qa5SmkUPQ+u8FntTQ1roPHahSComB6rXnLwc976VhUY4CqTaLu5mCswuHiNhOfVw==",
- "dev": true,
- "requires": {
- "@types/eslint-scope": "^3.7.0",
- "@types/estree": "^0.0.50",
- "@webassemblyjs/ast": "1.11.1",
- "@webassemblyjs/wasm-edit": "1.11.1",
- "@webassemblyjs/wasm-parser": "1.11.1",
- "acorn": "^8.4.1",
- "acorn-import-assertions": "^1.7.6",
- "browserslist": "^4.14.5",
- "chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^5.8.3",
- "es-module-lexer": "^0.9.0",
- "eslint-scope": "5.1.1",
- "events": "^3.2.0",
- "glob-to-regexp": "^0.4.1",
- "graceful-fs": "^4.2.4",
- "json-parse-better-errors": "^1.0.2",
- "loader-runner": "^4.2.0",
- "mime-types": "^2.1.27",
- "neo-async": "^2.6.2",
- "schema-utils": "^3.1.0",
- "tapable": "^2.1.1",
- "terser-webpack-plugin": "^5.1.3",
- "watchpack": "^2.2.0",
- "webpack-sources": "^3.2.2"
- }
- },
- "webpack-cli": {
- "version": "4.9.1",
- "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz",
- "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==",
- "dev": true,
- "requires": {
- "@discoveryjs/json-ext": "^0.5.0",
- "@webpack-cli/configtest": "^1.1.0",
- "@webpack-cli/info": "^1.4.0",
- "@webpack-cli/serve": "^1.6.0",
- "colorette": "^2.0.14",
- "commander": "^7.0.0",
- "execa": "^5.0.0",
- "fastest-levenshtein": "^1.0.12",
- "import-local": "^3.0.2",
- "interpret": "^2.2.0",
- "rechoir": "^0.7.0",
- "webpack-merge": "^5.7.3"
- },
- "dependencies": {
- "commander": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
- "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
- "dev": true
- }
- }
- },
- "webpack-merge": {
- "version": "5.8.0",
- "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz",
- "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==",
- "dev": true,
- "requires": {
- "clone-deep": "^4.0.1",
- "wildcard": "^2.0.0"
- }
- },
- "webpack-sources": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz",
- "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==",
- "dev": true
- },
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -4815,12 +3088,6 @@
"isexe": "^2.0.0"
}
},
- "wildcard": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz",
- "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==",
- "dev": true
- },
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -4838,12 +3105,6 @@
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
- },
- "yn": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
- "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
- "dev": true
}
}
}
diff --git a/package.json b/package.json
index 1be706a1eb..5ad413229d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "assemblyscript",
- "description": "Definitely not a TypeScript to WebAssembly compiler.",
+ "description": "A TypeScript-like language for WebAssembly.",
"keywords": [
"typescript",
"webassembly",
@@ -10,7 +10,6 @@
],
"version": "0.0.0",
"author": "Daniel Wirtz ",
- "contributors": [],
"license": "Apache-2.0",
"homepage": "https://assemblyscript.org",
"repository": {
@@ -21,110 +20,77 @@
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
},
"dependencies": {
- "binaryen": "102.0.0-nightly.20211028",
- "long": "^5.2.0",
- "source-map-support": "^0.5.20",
- "ts-node": "^10.4.0"
+ "binaryen": "106.0.0-nightly.20220320",
+ "long": "^5.2.0"
},
"devDependencies": {
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"diff": "^5.0.0",
+ "esbuild": "^0.14.1",
"eslint": "^8.2.0",
"glob": "^7.2.0",
- "mkdirp": "^1.0.4",
- "physical-cpu-count": "^2.0.0",
- "ts-loader": "^9.2.6",
- "ts-node": "^10.4.0",
- "typescript": "~4.5.2",
- "webpack": "^5.64.1",
- "webpack-cli": "^4.9.1"
+ "typescript": "~4.5.2"
},
- "type": "commonjs",
- "main": "index.js",
- "types": "index.d.ts",
+ "type": "module",
"exports": {
- ".": "./index.js",
- "./std/portable": "./std/portable/index.js",
- "./lib/loader": {
- "import": "./lib/loader/index.js",
- "require": "./lib/loader/umd/index.js"
+ ".": {
+ "import": "./dist/assemblyscript.js",
+ "types": "./dist/assemblyscript.d.ts"
},
- "./lib/rtrace": {
- "import": "./lib/rtrace/index.js",
- "require": "./lib/rtrace/umd/index.js"
+ "./asc": {
+ "import": "./dist/asc.js",
+ "types": "./dist/asc.d.ts"
},
- "./*": "./*.js",
- "./cli/asc": "./cli/asc.js",
- "./cli/transform": "./cli/transform.js",
- "./cli/util/options": "./cli/util/options.js",
- "./dist/assemblyscript": "./dist/assemblyscript.js",
- "./dist/asc": "./dist/asc.js"
+ "./transform": {
+ "import": "./dist/transform.js",
+ "require": "./dist/transform.cjs",
+ "types": "./dist/transform.d.ts"
+ },
+ "./binaryen": {
+ "import": "./lib/binaryen.js",
+ "types": "./lib/binaryen.d.ts"
+ },
+ "./*": "./*"
},
"bin": {
- "asc": "bin/asc",
- "asinit": "bin/asinit"
+ "asc": "./bin/asc.js",
+ "asinit": "./bin/asinit.js"
},
"scripts": {
- "build": "npm run build:bundle && npm run build:dts && npm run build:sdk",
- "build:bundle": "webpack --config webpack.config.js",
- "build:dts": "node scripts/build-dts && tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index-release",
- "build:sdk": "node scripts/build-sdk",
- "clean": "node scripts/clean",
- "check": "npm run check:config && npm run check:require && npm run check:lint",
+ "check": "npm run check:config && npm run check:import && npm run lint",
"check:config": "tsc --noEmit -p src --diagnostics --listFiles",
- "check:require": "tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index",
- "check:lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
- "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:extension && npm run test:asconfig",
- "test:parser": "node tests/parser",
- "test:compiler": "node --experimental-wasi-unstable-preview1 tests/compiler",
- "test:packages": "cd tests/packages && npm run test",
- "test:extension": "cd tests/extension && npm run test",
+ "check:import": "tsc --noEmit --target ESNEXT --module es6 --experimentalDecorators tests/import/index",
+ "lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
+ "build": "node scripts/build",
+ "watch": "node scripts/build --watch",
+ "test": "npm run test:parser && npm run test:compiler -- --parallel && npm run test:browser && npm run test:asconfig && npm run test:transform",
+ "test:parser": "node --enable-source-maps tests/parser",
+ "test:compiler": "node --enable-source-maps --experimental-wasi-unstable-preview1 --no-warnings tests/compiler",
+ "test:browser": "node --enable-source-maps tests/browser",
"test:asconfig": "cd tests/asconfig && npm run test",
- "make": "npm run clean && npm test && npm run build && npm test",
- "all": "npm run check && npm run make",
- "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md",
- "prepare-ci": "node scripts/prepublish --prepare-for-ci",
- "prepublishOnly": "node scripts/prepublish",
- "postpublish": "node scripts/postpublish",
- "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
- "asbuild:untouched": "node bin/asc --config src/asconfig.json --target untouched",
- "asbuild:optimized": "node bin/asc --config src/asconfig.json --target optimized",
+ "test:transform": "npm run test:transform:esm && npm run test:transform:cjs",
+ "test:transform:esm": "node bin/asc tests/compiler/empty --transform ./tests/transform/index.js --noEmit && node bin/asc tests/compiler/empty --transform ./tests/transform/simple.js --noEmit",
+ "test:transform:cjs": "node bin/asc tests/compiler/empty --transform ./tests/transform/cjs/index.js --noEmit && node bin/asc tests/compiler/empty --transform ./tests/transform/cjs/simple.js --noEmit",
+ "asbuild": "npm run asbuild:debug && npm run asbuild:release",
+ "asbuild:debug": "node bin/asc --config src/asconfig.json --target debug",
+ "asbuild:release": "node bin/asc --config src/asconfig.json --target release",
"asbuild:rtraced": "node bin/asc --config src/asconfig.json --target rtraced",
- "bootstrap": "npm run bootstrap:untouched && npm run bootstrap:optimized",
- "bootstrap:untouched": "node bin/asc --config src/asconfig.json --target untouched && node bin/asc --config src/asconfig.json --target untouched-bootstrap --wasm out/assemblyscript.untouched.wasm && node bin/asc --config src/asconfig.json --target untouched-bootstrap --wasm out/assemblyscript.untouched-bootstrap.wasm && git --no-pager diff --no-index out/assemblyscript.untouched.wast out/assemblyscript.untouched-bootstrap.wast",
- "bootstrap:optimized": "node bin/asc --config src/asconfig.json --target optimized && node bin/asc --config src/asconfig.json --target optimized-bootstrap --wasm out/assemblyscript.optimized.wasm && node bin/asc --config src/asconfig.json --target optimized-bootstrap --wasm out/assemblyscript.optimized-bootstrap.wasm && git --no-pager diff --no-index out/assemblyscript.optimized.wast out/assemblyscript.optimized-bootstrap.wast",
- "bootstrap:rtraced": "node bin/asc --config src/asconfig.json --target rtraced && node bin/asc --config src/asconfig.json --target rtraced --wasm out/assemblyscript.rtraced.wasm",
- "astest": "ts-node tests/bootstrap"
+ "bootstrap": "npm run bootstrap:debug && npm run bootstrap:release",
+ "bootstrap:debug": "node bin/asc --config src/asconfig.json --target debug && node bin/asc --config src/asconfig.json --target debug-bootstrap --wasm ./build/assemblyscript.debug.js && node bin/asc --config src/asconfig.json --target debug-bootstrap --wasm ./build/assemblyscript.debug-bootstrap.js && git --no-pager diff --no-index build/assemblyscript.debug.wast build/assemblyscript.debug-bootstrap.wast",
+ "bootstrap:release": "node bin/asc --config src/asconfig.json --target release && node bin/asc --config src/asconfig.json --target release-bootstrap --wasm ./build/assemblyscript.release.js && node bin/asc --config src/asconfig.json --target release-bootstrap --wasm ./build/assemblyscript.release-bootstrap.js && git --no-pager diff --no-index build/assemblyscript.release.wast build/assemblyscript.release-bootstrap.wast",
+ "bootstrap:rtraced": "node bin/asc --config src/asconfig.json --target rtraced && node bin/asc --config src/asconfig.json --target rtraced --wasm ./build/assemblyscript.rtraced.js"
},
- "releaseFiles": [
- "lib/loader/index.d.ts",
- "lib/loader/index.js",
- "lib/loader/package.json",
- "lib/loader/umd/index.d.ts",
- "lib/loader/umd/index.js",
- "lib/loader/umd/package.json",
- "lib/loader/README.md",
- "lib/rtrace/index.d.ts",
- "lib/rtrace/index.js",
- "lib/rtrace/package.json",
- "lib/rtrace/umd/index.d.ts",
- "lib/rtrace/umd/index.js",
- "lib/rtrace/umd/package.json",
- "lib/rtrace/README.md",
+ "files": [
"bin/",
- "cli/",
"dist/",
- "index.d.ts",
- "index.js",
- "LICENSE",
- "NOTICE",
- "package.json",
- "package-lock.json",
- "README.md",
"std/",
- "tsconfig-base.json"
+ "util/",
+ "lib/binaryen.js",
+ "lib/binaryen.d.ts",
+ "tsconfig-base.json",
+ "NOTICE"
],
"funding": {
"type": "opencollective",
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 0000000000..63738b199f
--- /dev/null
+++ b/scripts/README.md
@@ -0,0 +1,21 @@
+Scripts
+=======
+
+Various scripts for development purposes.
+
+### Default target
+
+| Command | Description
+|-------------------|-------------------------------------------
+| npm install | Install required dependencies
+| npm run build | Builds the compiler
+| npm run watch | Builds the compiler and watches for changes
+| npm run check | Performs sanity checks on code style etc.
+| npm test | Runs the test suite
+
+### WebAssembly target
+
+| Command | Description
+|-------------------|-------------------------------------------
+| npm run asbuild | Compiles the compiler to WebAssembly
+| npm run bootstrap | Bootstraps the compiler to WebAssembly
diff --git a/scripts/build-diagnostics.js b/scripts/build-diagnostics.js
deleted file mode 100644
index 3253bb13d2..0000000000
--- a/scripts/build-diagnostics.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var fs = require("fs");
-
-var messages = require(__dirname + "/../src/diagnosticMessages.json");
-
-var header = `/**
- * @fileoverview Generated from diagnosticsMessages.json. Do not edit.
- * @license Apache-2.0
- */
-
-`.replace(/\r\n/g, "\n");
-
-var sb = [ header ];
-
-function makeKey(text) {
- return text.replace(/[^\w]+/g, "_").replace(/_+$/, "");
-}
-
-sb.push("/** Enum of available diagnostic codes. */\n");
-sb.push("export enum DiagnosticCode {\n");
-
-var first = true;
-Object.keys(messages).forEach(text => {
- var key = makeKey(text);
- if (first)
- first = false;
- else {
- sb.push(",\n");
- }
- sb.push(" " + key + " = " + messages[text]);
-});
-
-sb.push("\n}\n\n");
-sb.push("/** Translates a diagnostic code to its respective string. */\n");
-sb.push("export function diagnosticCodeToString(code: DiagnosticCode): string {\n switch (code) {\n");
-
-Object.keys(messages).forEach(text => {
- sb.push(" case " + messages[text] + ": return " + JSON.stringify(text) + ";\n");
-});
-
-sb.push(" default: return \"\";\n }\n}\n");
-
-fs.writeFileSync(__dirname + "/../src/diagnosticMessages.generated.ts", sb.join(""), { encoding: "utf8" });
diff --git a/scripts/build-dts.js b/scripts/build-dts.js
index f0d893a1c1..477724d578 100644
--- a/scripts/build-dts.js
+++ b/scripts/build-dts.js
@@ -1,13 +1,17 @@
+import fs from "fs";
+import glob from "glob";
+import os from "os";
+import pathUtil from "path";
+import ts from "typescript";
+import stream from "stream";
+import util from "util";
+import { fileURLToPath } from 'url';
+
+const __dirname = pathUtil.dirname(fileURLToPath(import.meta.url));
+
// © 2015-2019 SitePen, Inc. New BSD License.
// see: https://github.com/SitePen/dts-generator
-(function() {
- const fs = require("fs");
- const glob = require("glob");
- const mkdirp = require("mkdirp");
- const os = require("os");
- const pathUtil = require("path");
- const ts = require("typescript");
-
+const generate = (function() {
// declare some constants so we don't have magic integers without explanation
const DTSLEN = '.d.ts'.length;
const filenameToMid = (function () {
@@ -209,7 +213,7 @@
verboseMessage('exclude:');
options.exclude.forEach(name => { verboseMessage(' ' + name); });
}
- if (!options.stdout) mkdirp.sync(pathUtil.dirname(options.out));
+ if (!options.stdout) fs.mkdirSync(pathUtil.dirname(options.out), { recursive: true });
/* node.js typings are missing the optional mode in createWriteStream options and therefore
* in TS 1.6 the strict object literal checking is throwing, therefore a hammer to the nut */
const output = options.stdout || fs.createWriteStream(options.out, { mode: parseInt('644', 8) });
@@ -402,14 +406,9 @@
}
}
}
- exports.default = generate;
+ return generate;
})();
-const path = require("path");
-const fs = require("fs");
-const stream = require("stream");
-const util = require("util");
-
function OutputStream(options) {
stream.Writable.call(this, options);
this.chunks = [];
@@ -426,82 +425,158 @@ OutputStream.prototype.toString = function () {
return this.toBuffer().toString("utf8");
};
-const stdout = new OutputStream();
-stdout.write(`declare module 'assemblyscript' {
- export * from 'assemblyscript/src/index';
+function transformTypes(sourceFile) {
+ var numReplaced = 0;
+ console.log("transforming:");
+ var result = ts.transform(sourceFile, [
+ function (context) {
+ const visit = node => {
+ node = ts.visitEachChild(node, visit, context);
+ if (ts.isTypeNode(node)) {
+ const name = node.getText(sourceFile);
+ switch (name) {
+ // this is wrong, but works
+ case "bool": ++numReplaced; return ts.createIdentifier("boolean");
+ default: if (!/^(?:Binaryen|Relooper)/.test(name)) break;
+ case "i8": case "i16": case "i32": case "isize":
+ case "u8": case "u16": case "u32": case "usize":
+ case "f32": case "f64": ++numReplaced; return ts.createIdentifier("number");
+ }
+ }
+ return node;
+ };
+ return node => ts.visitNode(node, visit);
+ }
+ ]);
+ console.log(" replaced " + numReplaced + " AS types with TS types");
+ return result;
}
-`);
-module.exports.default({
- project: path.resolve(__dirname, "..", "src"),
- prefix: "assemblyscript",
- exclude: [
- "glue/**",
- ],
- verbose: true,
- sendMessage: console.log,
- stdout: stdout
-});
+const prefix = "types:assemblyscript";
-stdout.write("\n");
+function generateSrc() {
+ const stdout = new OutputStream();
-module.exports.default({
- project: path.resolve(__dirname, "..", "std/assembly/shared"),
- prefix: "assemblyscript/std/assembly/shared",
- exclude: [],
- verbose: true,
- sendMessage: console.log,
- stdout: stdout
-});
+ generate({
+ project: pathUtil.resolve(__dirname, "..", "src"),
+ prefix,
+ exclude: [
+ "glue/**",
+ ],
+ verbose: true,
+ sendMessage: console.log,
+ stdout: stdout
+ });
-stdout.write("\n");
+ stdout.write("\n");
-module.exports.default({
- project: path.resolve(__dirname, "..", "src/glue"),
- prefix: "assemblyscript/src/glue",
- exclude: [
- "js/index.ts",
- "js/node.d.ts"
- ],
- verbose: true,
- sendMessage: console.log,
- stdout: stdout
-});
+ generate({
+ project: pathUtil.resolve(__dirname, "..", "std", "assembly", "shared"),
+ prefix: prefix + "/std/assembly/shared",
+ exclude: [],
+ verbose: true,
+ sendMessage: console.log,
+ stdout: stdout
+ });
-var source = stdout.toString().replace(/\/\/\/ ]*>\r?\n/g, "");
+ stdout.write("\n");
-const ts = require("typescript");
-const sourceFile = ts.createSourceFile("assemblyscript.d.ts", source, ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
+ generate({
+ project: pathUtil.resolve(__dirname, "..", "src", "glue"),
+ prefix: prefix + "/src/glue",
+ exclude: [
+ "js/index.ts",
+ "js/node.d.ts"
+ ],
+ verbose: true,
+ sendMessage: console.log,
+ stdout: stdout
+ });
-console.log("transforming:");
-var numReplaced = 0;
-const result = ts.transform(sourceFile, [
- function (context) {
- const visit = node => {
- node = ts.visitEachChild(node, visit, context);
- if (ts.isTypeNode(node)) {
- const name = node.getText(sourceFile);
- switch (name) {
- // this is wrong, but works
- case "bool": ++numReplaced; return ts.createIdentifier("boolean");
- default: if (!/^(?:Binaryen|Relooper)/.test(name)) break;
- case "i8": case "i16": case "i32": case "isize":
- case "u8": case "u16": case "u32": case "usize":
- case "f32": case "f64": ++numReplaced; return ts.createIdentifier("number");
- }
+ const source = stdout.toString().replace(/\/\/\/ ]*>\r?\n/g, "");
+ const sourceFile = ts.createSourceFile("assemblyscript.d.ts", source, ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
+ const result = transformTypes(sourceFile);
+ if (!fs.existsSync(pathUtil.join(__dirname, "..", "dist"))) {
+ fs.mkdirSync(pathUtil.join(__dirname, "..", "dist"));
+ }
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "assemblyscript.generated.d.ts"),
+ ts.createPrinter().printFile(result.transformed[0])
+ );
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "assemblyscript.d.ts"),
+ [ `/// \n`,
+ `export * from "${prefix}/src/index";\n`,
+ `import * as assemblyscript from "${prefix}/src/index";\n`,
+ `export default assemblyscript;\n`
+ ].join("")
+ );
+}
+
+function generateCli() {
+ const stdout = new OutputStream();
+
+ generate({
+ baseDir: pathUtil.resolve(__dirname, ".."),
+ files: [
+ pathUtil.resolve(__dirname, "..", "cli", "index.d.ts")
+ ],
+ externs: [
+ "./assemblyscript.generated.d.ts"
+ ],
+ prefix,
+ verbose: true,
+ sendMessage: console.log,
+ stdout: stdout,
+ resolveModuleImport: ({ importedModuleId, currentModuleId }) => {
+ if (currentModuleId == "cli/index") {
+ if (importedModuleId == "../src") return prefix + "/src/index";
}
- return node;
- };
- return node => ts.visitNode(node, visit);
+ return null;
+ },
+ });
+
+ const source = stdout.toString();
+ const sourceFile = ts.createSourceFile("asc.d.ts", source, ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
+ const result = transformTypes(sourceFile);
+ if (!fs.existsSync(pathUtil.join(__dirname, "..", "dist"))) {
+ fs.mkdirSync(pathUtil.join(__dirname, "..", "dist"));
}
-]);
-console.log(" replaced " + numReplaced + " AS types with JS types");
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "asc.generated.d.ts"),
+ ts.createPrinter().printFile(result.transformed[0])
+ );
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "asc.d.ts"),
+ [ `/// \n`,
+ `export * from "${prefix}/cli/index";\n`,
+ `import * as asc from "${prefix}/cli/index";\n`,
+ `export default asc;\n`
+ ].join("")
+ );
+}
-if (!fs.existsSync(path.join(__dirname, "..", "dist"))) {
- fs.mkdirSync(path.join(__dirname, "..", "dist"));
+function generateTransform() {
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "transform.js"),
+ [
+ `export function Transform() { /* stub */ }\n`
+ ].join("")
+ );
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "transform.cjs"),
+ [
+ `module.exports = function Transform() { /* stub */ }\n`
+ ].join("")
+ );
+ fs.writeFileSync(
+ pathUtil.resolve(__dirname, "..", "dist", "transform.d.ts"),
+ [
+ `export { Transform } from "./asc";\n`
+ ].join("")
+ );
}
-fs.writeFileSync(
- path.resolve(__dirname, "..", "dist", "assemblyscript.d.ts"),
- ts.createPrinter().printFile(result.transformed[0]),
- "utf8"
-);
+
+generateSrc();
+generateCli();
+generateTransform();
diff --git a/scripts/build-sdk.js b/scripts/build-sdk.js
deleted file mode 100644
index 6ab50e1099..0000000000
--- a/scripts/build-sdk.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const path = require("path");
-const fs = require("fs");
-const pkg = require("../package-lock.json");
-
-fs.readFile(path.join(__dirname, "..", "lib", "sdk", "index.js"), "utf8", function(err, data) {
- if (err) throw err;
- data = data
- .replace(/BINARYEN_VERSION = "nightly"/, "BINARYEN_VERSION = " + JSON.stringify(pkg.dependencies.binaryen.version))
- .replace(/LONG_VERSION = "latest"/, "LONG_VERSION = " + JSON.stringify(pkg.dependencies.long.version))
- .replace(/ASSEMBLYSCRIPT_VERSION = "latest"/, "ASSEMBLYSCRIPT_VERSION = " + JSON.stringify(pkg.version));
- fs.writeFile(path.join(__dirname, "..", "dist", "sdk.js"), data, function(err) {
- if (err) throw err;
- });
-});
diff --git a/scripts/build-web.js b/scripts/build-web.js
new file mode 100644
index 0000000000..fded04b86b
--- /dev/null
+++ b/scripts/build-web.js
@@ -0,0 +1,53 @@
+import path from "path";
+import fs from "fs";
+import { createRequire } from "module";
+import { fileURLToPath } from "url";
+
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+const require = createRequire(import.meta.url);
+const pkg = require("../package-lock.json");
+
+const mainVersion = pkg.version;
+const binaryenVersion = pkg.dependencies.binaryen.version;
+const longVersion = pkg.dependencies.long.version;
+
+const distUrl = mainVersion === "0.0.0" ? `../dist/` : `https://cdn.jsdelivr.net/npm/assemblyscript@${mainVersion}/dist/`;
+const binaryenUrl = `https://cdn.jsdelivr.net/npm/binaryen@${binaryenVersion}/index.js`;
+const longUrl = `https://cdn.jsdelivr.net/npm/long@${longVersion}/index.js`;
+
+fs.writeFileSync(path.join(dirname, "..", "dist", "web.html"), `
+
+
+`);
diff --git a/scripts/build.js b/scripts/build.js
index 9e6d573d49..986a41a664 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -1,6 +1,277 @@
-const webpack = require("webpack");
-const config = require("../webpack.config.js");
+import fs from "fs";
+import path from "path";
+import { fileURLToPath } from "url";
+import childProcess from "child_process";
+import esbuild from "esbuild";
+import glob from "glob";
+import { createRequire } from "module";
+import { stdoutColors } from "../util/terminal.js";
-webpack(config, err => {
- if (err) throw err;
+const require = createRequire(import.meta.url);
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+const watch = process.argv[2] === "--watch";
+
+function prelude(name) {
+ return [
+ "/**\n",
+ " * @license\n",
+ " * ", name, "\n",
+ " * Copyright ", new Date().getFullYear().toString(), " Daniel Wirtz / The AssemblyScript Authors\n",
+ " * SPDX-License-Identifier: Apache-2.0\n",
+ " */"
+ ].join("");
+}
+
+// Report what's going on
+
+function time() {
+ return new Date().toISOString();
+}
+
+function reportPlugin(name) {
+ return {
+ name: "reporter",
+ setup(build) {
+ let startTime = 0;
+ build.onStart(() => {
+ console.log(`${time()} - ${name} - Starting new build ...`);
+ startTime = Date.now();
+ });
+ build.onEnd(({ errors, warnings }) => {
+ const duration = Date.now() - startTime;
+ if (errors.length) {
+ console.log(`${time()} - ${name} - ${stdoutColors.red("ERROR")} (${errors.length} errors, ${warnings.length} warnings, ${duration} ms)`);
+ } else {
+ console.log(`${time()} - ${name} - ${stdoutColors.green("SUCCESS")} (${warnings.length} warnings, ${duration} ms)`);
+ }
+ });
+ }
+ };
+}
+
+// Standard library integration
+
+function bundleFile(filename) {
+ return fs.readFileSync(filename, { encoding: "utf8" }).replace(/\r\n/g, "\n");
+}
+
+const stdlibPlugin = {
+ name: "stdlib",
+ setup(build) {
+ build.onResolve({ filter: /\bindex\.generated\.js$/ }, args => {
+ return {
+ path: path.join(args.resolveDir, args.path),
+ watchFiles: glob.sync(path.join(dirname, "..", "std", "assembly") + "/**/*.ts")
+ .concat([
+ path.join(dirname, "..", "package.json"),
+ path.join(dirname, "..", "cli", "options.json"),
+ path.join(dirname, "..", "std", "portable", "index.d.ts")
+ ])
+ };
+ });
+ build.onLoad({ filter: /\bindex\.generated\.js$/ }, args => {
+ const out = [
+ `// GENERATED FILE. DO NOT EDIT.\n\n`
+ ];
+ const version = require("../package.json").version;
+ out.push(
+ `export const version = ${JSON.stringify(version)};\n`
+ );
+ const options = require("../cli/options.json");
+ out.push(
+ `export const options = ${JSON.stringify(options, null, 2)};\n`
+ );
+ out.push(
+ `export const libraryPrefix = "~lib/";\n`
+ );
+ const libraryDir = path.join(dirname, "..", "std", "assembly");
+ const libraryFiles = {};
+ for (const file of glob.sync("**/!(*.d).ts", { cwd: libraryDir })) {
+ libraryFiles[file.replace(/\.ts$/, "")] = bundleFile(path.join(libraryDir, file));
+ }
+ out.push(
+ `export const libraryFiles = ${JSON.stringify(libraryFiles, null, 2)};\n`
+ );
+ const definitionFiles = {
+ assembly: bundleFile(path.join(dirname, "..", "std", "assembly", "index.d.ts")),
+ portable: bundleFile(path.join(dirname, "..", "std", "portable", "index.d.ts"))
+ };
+ out.push(
+ `export const definitionFiles = ${JSON.stringify(definitionFiles, null, 2)};\n`
+ );
+ const generated = out.join("");
+ fs.writeFileSync(path.join(dirname, "..", "cli", "index.generated.js"), generated);
+ return {
+ contents: generated,
+ loader: "js"
+ };
+ });
+ }
+};
+
+// Diagnostic messages integration
+
+const diagnosticsPlugin = {
+ name: "diagnostics",
+ setup(build) {
+ build.onResolve({ filter: /\bdiagnosticMessages\.generated$/ }, args => {
+ return {
+ path: path.join(args.resolveDir, args.path),
+ watchFiles: [
+ path.join(dirname, "..", "src", "diagnosticMessages.json")
+ ]
+ };
+ });
+ build.onLoad({ filter: /\bdiagnosticMessages\.generated$/ }, args => {
+ const out = [
+ `// GENERATED FILE. DO NOT EDIT.\n\n`
+ ];
+
+ function makeKey(text) {
+ return text.replace(/[^\w]+/g, "_").replace(/_+$/, "");
+ }
+
+ out.push("/** Enum of available diagnostic codes. */\n");
+ out.push("export enum DiagnosticCode {\n");
+
+ var first = true;
+ const messages = JSON.parse(fs.readFileSync(path.join(dirname, "..", "src", "diagnosticMessages.json")));
+ Object.keys(messages).forEach(text => {
+ var key = makeKey(text);
+ if (first)
+ first = false;
+ else {
+ out.push(",\n");
+ }
+ out.push(" " + key + " = " + messages[text]);
+ });
+
+ out.push("\n}\n\n");
+ out.push("/** Translates a diagnostic code to its respective string. */\n");
+ out.push("export function diagnosticCodeToString(code: DiagnosticCode): string {\n switch (code) {\n");
+
+ Object.keys(messages).forEach(text => {
+ out.push(" case " + messages[text] + ": return " + JSON.stringify(text) + ";\n");
+ });
+
+ out.push(" default: return \"\";\n }\n}\n");
+
+ const generated = out.join("");
+ fs.writeFileSync(path.join(dirname, "..", "src", "diagnosticMessages.generated.ts"), generated);
+ return {
+ contents: generated,
+ loader: "ts"
+ };
+ });
+ }
+};
+
+// Web template integration
+
+const webPlugin = {
+ name: "web",
+ setup(build) {
+ build.onEnd(() => {
+ const startTime = Date.now();
+ const stdout = [];
+ console.log(`${time()} - ${"web"} - Starting new build ...`);
+ childProcess.spawn("node", [ "./build-web.js" ], {
+ cwd: dirname,
+ stdio: "pipe"
+ }).on("data", data => {
+ stdout.push(data.toString());
+ }).on("error", err => {
+ const duration = Date.now() - startTime;
+ console.log(stdout.join(""));
+ console.log(`${time()} - ${"web"} - ${stdoutColors.red("ERROR")} (had errors, ${duration} ms)`);
+ }).on("close", code => {
+ if (code) return;
+ const duration = Date.now() - startTime;
+ console.log(`${time()} - ${"web"} - ${stdoutColors.green("SUCCESS")} (no errors, ${duration} ms)`);
+ });
+ });
+ }
+};
+
+// Build compiler and CLI
+
+const common = {
+ target: "esnext",
+ platform: "node",
+ format: "esm",
+ external: [
+ "assemblyscript",
+ "binaryen",
+ "long"
+ ],
+ legalComments: "none",
+ bundle: true,
+ sourcemap: true,
+ treeShaking: true,
+ minify: true,
+ watch,
+ incremental: watch
+};
+
+const srcBuild = esbuild.build({
+ entryPoints: [ "./src/index.ts" ],
+ tsconfig: "./src/tsconfig.json",
+ outfile: "./dist/assemblyscript.js",
+ banner: { js: prelude("The AssemblyScript compiler") },
+ plugins: [ diagnosticsPlugin, reportPlugin("src") ],
+ ...common
+});
+
+const cliBuild = esbuild.build({
+ entryPoints: [ "./cli/index.js" ],
+ tsconfig: "./cli/tsconfig.json",
+ outfile: "./dist/asc.js",
+ banner: { js: prelude("The AssemblyScript frontend") },
+ plugins: [ stdlibPlugin, webPlugin, reportPlugin("cli") ],
+ ...common
});
+
+// Optionally build definitions (takes a while)
+
+var buildingDefinitions = false;
+
+function buildDefinitions() {
+ const startTime = Date.now();
+ const stdout = [];
+ console.log(`${time()} - ${"dts"} - Starting new build ...`);
+ buildingDefinitions = true;
+ childProcess.spawn("node", [ "./build-dts.js" ], {
+ cwd: dirname,
+ stdio: "pipe"
+ }).on("data", data => {
+ stdout.push(data.toString());
+ }).on("error", err => {
+ buildingDefinitions = false;
+ const duration = Date.now() - startTime;
+ console.log(stdout.join(""));
+ console.log(`${time()} - ${"dts"} - ${stdoutColors.red("ERROR")} (had errors, ${duration} ms)`);
+ }).on("close", code => {
+ buildingDefinitions = false;
+ if (code) return;
+ const duration = Date.now() - startTime;
+ console.log(`${time()} - ${"dts"} - ${stdoutColors.green("SUCCESS")} (no errors, ${duration} ms)`);
+ });
+}
+
+if (watch) {
+ console.log("Watching for changes. Press RETURN to rebuild definitions.\n");
+ process.stdin.on("data", data => {
+ if (data == "\r\n" || data == "\n") {
+ process.stdout.write("\u001b[1A");
+ if (!buildingDefinitions) buildDefinitions();
+ }
+ });
+}
+
+console.log(`src : Compiler as a library
+cli : Compiler frontend asc
+dts : TS definition bundles
+web : Example web template\n`);
+
+await Promise.all([ srcBuild, cliBuild ]);
+buildDefinitions();
diff --git a/scripts/clean.js b/scripts/clean.js
deleted file mode 100644
index 956dea952e..0000000000
--- a/scripts/clean.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var fs = require("fs");
-var glob = require("glob");
-
-glob("*", { cwd: __dirname + "/../dist" }, (err, matches) => {
- if (err)
- console.log("Failed to list files in 'dist/': " + err.message);
- else
- matches.forEach(match => {
- fs.unlink(__dirname + "/../dist/" + match, err => {
- if (err)
- console.log("Failed to delete 'dist/" + match + "': " + err.message);
- else
- console.log("Deleted 'dist/" + match + "'");
- });
- });
-});
diff --git a/scripts/postpublish-files.json b/scripts/postpublish-files.json
deleted file mode 100644
index c2a9b27bf0..0000000000
--- a/scripts/postpublish-files.json
+++ /dev/null
@@ -1,5 +0,0 @@
-[
- "package.json",
- "index.js",
- "index.d.ts"
-]
diff --git a/scripts/postpublish.js b/scripts/postpublish.js
deleted file mode 100644
index 4c0ddb5fe9..0000000000
--- a/scripts/postpublish.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// Reconfigures the repository after publishing
-
-const fs = require("fs");
-const path = require("path");
-const devFiles = require("./postpublish-files.json");
-
-console.log("Restoring development files ...");
-
-devFiles.forEach(originalName => {
- const backupName = originalName + ".backup";
- const backupPath = path.join(__dirname, "..", backupName);
- if (!fs.existsSync(backupPath)) {
- console.log("- " + backupName + " does not exist");
- } else {
- console.log("- " + backupName + " -> " + originalName);
- fs.copyFileSync(
- backupPath,
- path.join(__dirname, "..", originalName)
- );
- fs.unlinkSync(backupPath);
- }
-});
diff --git a/scripts/prepublish.js b/scripts/prepublish.js
index 62217dbf54..84f7a19678 100644
--- a/scripts/prepublish.js
+++ b/scripts/prepublish.js
@@ -1,69 +1,32 @@
-// Reconfigures the repository before publishing
-
-const fs = require("fs");
-const path = require("path");
-const pkg = require("../package.json");
-const devFiles = require("./postpublish-files.json");
-
-var isCI = process.argv[2] === '--prepare-for-ci';
-
-if (!isCI) {
- if (!pkg.releaseFiles) {
- console.log("Package has already been updated");
- return;
- }
-
- console.log("Backing up development files ...");
-
- devFiles.forEach(originalName => {
- const backupName = originalName + ".backup";
- console.log("- " + originalName + " -> " + backupName);
- fs.copyFileSync(
- path.join(__dirname, "..", originalName),
- path.join(__dirname, "..", backupName)
- );
- });
-
- console.log("Updating package.json ...");
-
- // Stuff we don't need in release
- Object.keys(pkg.devDependencies).forEach(dep => delete pkg.dependencies[dep]);
- delete pkg.devDependencies;
+import fs from "fs";
+import path from "path";
+import { createRequire } from "module";
+import { fileURLToPath } from "url";
+
+const require = createRequire(import.meta.url);
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+
+const reset = process.argv[2] === "--reset";
+
+if (reset) {
+ fs.copyFileSync(
+ path.join(dirname, "..", "package.json.backup"),
+ path.join(dirname, "..", "package.json")
+ );
+ fs.unlinkSync(
+ path.join(dirname, "..", "package.json.backup")
+ );
+} else {
+ const pkg = require("../package.json");
+ if (!pkg.scripts) throw Error("already modified");
delete pkg.scripts;
-
- // Stuff we want in release
- pkg.files = pkg.releaseFiles;
- delete pkg.releaseFiles;
-
- // Copy contributors from NOTICE to .contributors
- const notice = fs.readFileSync(path.join(__dirname, "..", "NOTICE"), "utf8");
- const noticeRange = ["dcode.io>", "Portions of this software"];
- const posStart = notice.indexOf(noticeRange[0]);
- const posEnd = notice.indexOf(noticeRange[1], posStart);
- if (posStart < 0 || posEnd < 0) throw Error("unexpected NOTICE format");
- pkg.contributors = [];
- for (let entry of notice.substring(posStart + noticeRange[0].length, posEnd).trim().matchAll(/^\* ([^<\n]+(?: <([^>\n]+)>))/mg)) {
- pkg.contributors.push(entry[1]);
- }
- if (!pkg.contributors.length) throw Error("missing contributors");
- fs.writeFileSync(path.join(__dirname, "..", "package.json"), [
- JSON.stringify(pkg, null, 2), '\n'
- ].join(""));
-}
-
-console.log("Copying index.release.js -> index.js ...");
-fs.copyFileSync(
- path.join(__dirname, "..", "index.release.js"),
- path.join(__dirname, "..", "index.js")
-);
-
-console.log("Copying index.release.d.ts -> index.d.ts ...");
-fs.copyFileSync(
- path.join(__dirname, "..", "index.release.d.ts"),
- path.join(__dirname, "..", "index.d.ts")
-);
-
-if (!isCI) {
- // We are going to use these immediately, so, to be sure:
- setTimeout(() => console.log("OK"), 2000);
+ delete pkg.devDependencies;
+ fs.copyFileSync(
+ path.join(dirname, "..", "package.json"),
+ path.join(dirname, "..", "package.json.backup")
+ );
+ fs.writeFileSync(
+ path.join(dirname, "..", "package.json"),
+ JSON.stringify(pkg, null, 2)
+ );
}
diff --git a/scripts/update-constants.js b/scripts/update-constants.js
index 5f94354372..8ef7161811 100644
--- a/scripts/update-constants.js
+++ b/scripts/update-constants.js
@@ -1,14 +1,15 @@
// Updates the Binaryen constants in src/module.ts
-const fs = require("fs");
-const path = require("path");
-const binaryen = require("binaryen");
+import fs from "fs";
+import path from "path";
+import { fileURLToPath } from "url";
+import binaryen from "../lib/binaryen.js";
-const srcfile = path.join(__dirname, "..", "src", "module.ts");
-var src = fs.readFileSync(srcfile, "utf8");
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
-binaryen.ready.then(() => {
- src = src.replace(/(?:enum|namespace) (\w+) \{([^}]*)\}/g, function($0) {
+const srcfile = path.join(__dirname, "..", "src", "module.ts");
+var src = fs.readFileSync(srcfile, "utf8")
+ .replace(/(?:enum|namespace) (\w+) \{([^}]*)\}/g, function($0) {
return $0.replace(/(\w+)[ ]+=[ ]+([^,;\n]+)/g, function($0, key, val) {
var match = val.match(/\b(_(?:Binaryen|Relooper|ExpressionRunner)\w+)\b/);
if (match) {
@@ -21,5 +22,4 @@ binaryen.ready.then(() => {
return $0;
});
});
- fs.writeFileSync(srcfile, src, "utf8");
-});
+fs.writeFileSync(srcfile, src, "utf8");
diff --git a/snap/README.md b/snap/README.md
deleted file mode 100644
index d7245ed05f..0000000000
--- a/snap/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Snaps are containerised software packages that are simple to create and install on all major Linux systems without modification. [Learn more](https://docs.snapcraft.io).
-
-[](https://snapcraft.io/assemblyscript)
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
deleted file mode 100644
index d4655e495d..0000000000
--- a/snap/snapcraft.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: assemblyscript
-summary: A TypeScript-like language for WebAssembly.
-description: |
- AssemblyScript compiles a variant of TypeScript to WebAssembly using Binaryen.
-
- See the AssemblyScript website for documentation:
- https://www.assemblyscript.org
-type: app
-icon: media/icon.svg
-version: git
-grade: stable
-confinement: strict
-apps:
- asc:
- command: asc
- asinit:
- command: asinit
-parts:
- assemblyscript:
- source: .
- plugin: npm
- npm-node-version: 16.9.1
-architectures:
- - build-on: amd64
- run-on: [amd64, armhf, arm64, i386]
diff --git a/src/README.md b/src/README.md
index 60a15098e9..65eb7e260e 100644
--- a/src/README.md
+++ b/src/README.md
@@ -11,30 +11,27 @@ Architecture
Usage
-----
-Note that using the compiler as a library requires awaiting Binaryen ready state, like so:
-
```js
-const binaryen = require("binaryen");
-const assemblyscript = require("assemblyscript");
-binaryen.ready.then(() => {
- // do something with assemblyscript
-});
+import assemblyscript from "assemblyscript";
+...
```
Building
--------
-Note that building the compiler is not necessary if you only want to run it (in development). If not built, `ts-node` is used to run the sources directly.
-
### Building to JavaScript
-To build the compiler to a JavaScript bundle, run:
+To build the compiler, run:
```sh
npm run build
```
-Uses webpack under the hood, building to `dist/`.
+The rebuild automatically when there are changes, do:
+
+```sh
+npm run watch
+```
### Building to WebAssembly
@@ -44,16 +41,16 @@ To build the compiler to a WebAssembly binary, run:
npm run bootstrap
```
-Uses the AssemblyScript compiler compiled to JavaScript to compile itself to WebAssembly, building to WebAssembly again using itself compiled to WebAssembly. Builds to `out/`. Performs a `git diff` to make sure that both the initial and the final artifacts are the same. Note that this builds the compiler as a library, while the `asc` frontend setting it up and feeding it source files is JavaScript for now.
+Uses the AssemblyScript compiler compiled to JavaScript to compile itself to WebAssembly, building to WebAssembly again using itself compiled to WebAssembly. Builds to `build/`. Performs a `git diff` to make sure that both the initial and the final artifacts are the same. Note that this builds the compiler as a library, while the `asc` frontend setting it up and feeding it source files is JavaScript for now.
Running `asc` with the WebAssembly variant:
```ts
-asc [options...] --wasm out/assemblyscript.optimized-bootstrap.wasm
+asc [options...] --wasm build/assemblyscript.release-bootstrap.wasm
```
Running the compiler tests with the WebAssembly variant:
```ts
-npm run test:compiler -- --wasm out/assemblyscript.optimized-bootstrap.wasm
+npm run test:compiler -- --wasm build/assemblyscript.release-bootstrap.wasm
```
diff --git a/src/asconfig.json b/src/asconfig.json
index 2335eca294..8618a21c41 100644
--- a/src/asconfig.json
+++ b/src/asconfig.json
@@ -1,47 +1,45 @@
{
"entries": [
"./glue/wasm/index.ts",
- "./index.ts"
+ "./index-wasm.ts"
],
"options": {
- "explicitStart": true,
+ "exportStart": "_initialize",
"exportRuntime": true,
"initialMemory": 768,
"runtime": "incremental",
- "measure": true
+ "bindings": [ "esm" ],
+ "stats": true
},
"targets": {
- "untouched": {
- "binaryFile": "../out/assemblyscript.untouched.wasm",
- "textFile": "../out/assemblyscript.untouched.wast",
- "tsdFile": "../out/assemblyscript.d.ts",
- "debug": true
+ "debug": {
+ "outFile": "../build/assemblyscript.debug.wasm",
+ "textFile": "../build/assemblyscript.debug.wast",
+ "debug": true,
+ "sourceMap": true
},
- "optimized": {
- "binaryFile": "../out/assemblyscript.optimized.wasm",
- "textFile": "../out/assemblyscript.optimized.wast",
- "tsdFile": "../out/assemblyscript.d.ts",
+ "release": {
+ "outFile": "../build/assemblyscript.release.wasm",
+ "textFile": "../build/assemblyscript.release.wast",
"optimizeLevel": 3,
"shrinkLevel": 0
},
"rtraced": {
- "binaryFile": "../out/assemblyscript.rtraced.wasm",
- "textFile": "../out/assemblyscript.rtraced.wast",
- "tsdFile": "../out/assemblyscript.d.ts",
+ "outFile": "../build/assemblyscript.rtraced.wasm",
+ "textFile": "../build/assemblyscript.rtraced.wast",
"debug": true,
"use": "ASC_RTRACE=1",
"runPasses": []
},
- "untouched-bootstrap": {
- "binaryFile": "../out/assemblyscript.untouched-bootstrap.wasm",
- "textFile": "../out/assemblyscript.untouched-bootstrap.wast",
- "tsdFile": "../out/assemblyscript.d.ts",
- "debug": true
+ "debug-bootstrap": {
+ "outFile": "../build/assemblyscript.debug-bootstrap.wasm",
+ "textFile": "../build/assemblyscript.debug-bootstrap.wast",
+ "debug": true,
+ "sourceMap": true
},
- "optimized-bootstrap": {
- "binaryFile": "../out/assemblyscript.optimized-bootstrap.wasm",
- "textFile": "../out/assemblyscript.optimized-bootstrap.wast",
- "tsdFile": "../out/assemblyscript.d.ts",
+ "release-bootstrap": {
+ "outFile": "../build/assemblyscript.release-bootstrap.wasm",
+ "textFile": "../build/assemblyscript.release-bootstrap.wast",
"optimizeLevel": 3,
"shrinkLevel": 0
}
diff --git a/src/ast.ts b/src/ast.ts
index 3f725bd24c..c5a2427d1e 100644
--- a/src/ast.ts
+++ b/src/ast.ts
@@ -29,8 +29,7 @@ import {
import {
normalizePath,
resolvePath,
- CharCode,
- isAlphaOrDecimal
+ CharCode
} from "./util";
import {
@@ -100,6 +99,7 @@ export enum NodeKind {
VARIABLE,
VOID,
WHILE,
+ MODULE,
// declaration statements
CLASSDECLARATION,
@@ -713,6 +713,14 @@ export abstract class Node {
return new TypeDeclaration(name, decorators, flags, typeParameters, type, range);
}
+ static createModuleDeclaration(
+ name: string,
+ flags: CommonFlags,
+ range: Range
+ ): ModuleDeclaration {
+ return new ModuleDeclaration(name, flags, range);
+ }
+
static createVariableStatement(
decorators: DecoratorNode[] | null,
declarations: VariableDeclaration[],
@@ -825,7 +833,7 @@ export abstract class TypeNode extends Node {
let namedTypeNode = changetype(this); // TS
if (!namedTypeNode.name.next) {
let typeArgumentNodes = namedTypeNode.typeArguments;
- if (typeArgumentNodes !== null && typeArgumentNodes.length > 0) {
+ if (typeArgumentNodes && typeArgumentNodes.length > 0) {
for (let i = 0, k = typeArgumentNodes.length; i < k; ++i) {
if (typeArgumentNodes[i].hasGenericComponent(typeParameterNodes)) return true;
}
@@ -844,7 +852,7 @@ export abstract class TypeNode extends Node {
}
if (functionTypeNode.returnType.hasGenericComponent(typeParameterNodes)) return true;
let explicitThisType = functionTypeNode.explicitThisType;
- if (explicitThisType !== null && explicitThisType.hasGenericComponent(typeParameterNodes)) return true;
+ if (explicitThisType && explicitThisType.hasGenericComponent(typeParameterNodes)) return true;
} else {
assert(false);
}
@@ -884,7 +892,7 @@ export class NamedTypeNode extends TypeNode {
/** Checks if this type node has type arguments. */
get hasTypeArguments(): bool {
var typeArguments = this.typeArguments;
- return typeArguments !== null && typeArguments.length > 0;
+ return typeArguments != null && typeArguments.length > 0;
}
}
@@ -976,6 +984,7 @@ export enum DecoratorKind {
FINAL,
INLINE,
EXTERNAL,
+ EXTERNAL_JS,
BUILTIN,
LAZY,
UNSAFE
@@ -1043,6 +1052,13 @@ export namespace DecoratorKind {
break;
}
}
+ } else if (nameStr == "external") {
+ switch (propStr.charCodeAt(0)) {
+ case CharCode.j: {
+ if (propStr == "js") return DecoratorKind.EXTERNAL_JS;
+ break;
+ }
+ }
}
}
}
@@ -1340,7 +1356,7 @@ export class NewExpression extends Expression {
get typeArgumentsRange(): Range {
var typeArguments = this.typeArguments;
var numTypeArguments: i32;
- if (typeArguments !== null && (numTypeArguments = typeArguments.length) > 0) {
+ if (typeArguments && (numTypeArguments = typeArguments.length) > 0) {
return Range.join(typeArguments[0].range, typeArguments[numTypeArguments - 1].range);
}
return this.typeName.range;
@@ -1694,6 +1710,8 @@ export abstract class DeclarationStatement extends Statement {
) {
super(kind, range);
}
+ /** Overridden module name from preceeding `module` statement. */
+ public overriddenModuleName: string | null = null;
/** Tests if this node has the specified flag or flags. */
is(flag: CommonFlags): bool { return (this.flags & flag) == flag; }
@@ -2106,7 +2124,7 @@ export class ImportStatement extends Statement {
} else { // absolute in library
if (!normalizedPath.startsWith(LIBRARY_PREFIX)) normalizedPath = LIBRARY_PREFIX + normalizedPath;
}
- this.internalPath = normalizedPath;
+ this.internalPath = mangleInternalPath(normalizedPath);
}
/** Internal path being referenced. */
@@ -2249,6 +2267,20 @@ export class TryStatement extends Statement {
}
}
+/** Represents a `module` statement. */
+export class ModuleDeclaration extends Statement {
+ constructor(
+ /** Module name. */
+ public moduleName: string,
+ /** Common flags indicating specific traits. */
+ public flags: CommonFlags,
+ /** Source range. */
+ range: Range
+ ) {
+ super(NodeKind.MODULE, range);
+ }
+}
+
/** Represents a `type` declaration. */
export class TypeDeclaration extends DeclarationStatement {
constructor(
@@ -2342,19 +2374,11 @@ export function findDecorator(kind: DecoratorKind, decorators: DecoratorNode[] |
/** Mangles an external to an internal path. */
export function mangleInternalPath(path: string): string {
- var pos = path.lastIndexOf(".");
- var len = path.length;
- if (pos >= 0 && len - pos >= 2) { // at least one char plus dot
- let cur = pos;
- while (++cur < len) {
- if (!isAlphaOrDecimal(path.charCodeAt(cur))) {
- assert(false); // not a valid external path
- return path;
- }
- }
- return path.substring(0, pos);
+ if (path.endsWith("/")) {
+ path += "index";
+ } else if (path.endsWith(".ts")) {
+ path = path.substring(0, path.length - 3);
}
- assert(false); // not an external path
return path;
}
@@ -2362,7 +2386,7 @@ export function mangleInternalPath(path: string): string {
export function isTypeOmitted(type: TypeNode): bool {
if (type.kind == NodeKind.NAMEDTYPE) {
let name = (type).name;
- return !(name.next !== null || name.identifier.text.length > 0);
+ return !(name.next || name.identifier.text.length > 0);
}
return false;
}
diff --git a/src/bindings.ts b/src/bindings.ts
new file mode 100644
index 0000000000..7da5ad772e
--- /dev/null
+++ b/src/bindings.ts
@@ -0,0 +1,11 @@
+/**
+ * @fileoverview Builders for various definitions describing a module.
+ *
+ * - JSBuilder: Creates a JavaScript glue code file (.js)
+ * - TSDBuilder: Creates a TypeScript definition file (.d.ts)
+ *
+ * @license Apache-2.0
+ */
+
+export { JSBuilder } from "./bindings/js";
+export { TSDBuilder } from "./bindings/tsd";
diff --git a/src/bindings/js.ts b/src/bindings/js.ts
new file mode 100644
index 0000000000..768a435ec8
--- /dev/null
+++ b/src/bindings/js.ts
@@ -0,0 +1,1321 @@
+import {
+ NodeKind,
+ DecoratorKind,
+ LiteralKind,
+ LiteralExpression,
+ StringLiteralExpression,
+ TemplateLiteralExpression,
+ findDecorator
+} from "../ast";
+
+import {
+ CommonFlags
+} from "../common";
+
+import {
+ ElementKind,
+ Element,
+ Program,
+ Function,
+ Global,
+ Class,
+ Interface,
+ Enum,
+ EnumValue,
+ Field
+} from "../program";
+
+import {
+ Type,
+ TypeFlags,
+ Signature
+} from "../types";
+
+import {
+ CharCode,
+ escapeString,
+ indent,
+ isIdentifier
+} from "../util";
+
+import {
+ ExportsWalker
+} from "./util";
+
+// Limitations
+//
+// - Instrumented globals are no longer WebAssembly.Global, hence cannot be
+// imported the same way as non-instrumented globals would allow. Affects both
+// globals imported here and globals imported elsewhere.
+//
+// - Since little is known about how class imports and exports will behave,
+// there is currently no glue generated for them. In IT there appears to be
+// a concept of protocols that may or may not map in the future. In GC there
+// doesn't appear to be a connection between classes and their methods so far.
+//
+// Instead, generated bindings are limited to lifting and lowering of plain
+// objects when the class has no constructor and no non-public elements. In
+// any other sitation an internal or external reference is passed.
+//
+// - Linking two instrumented modules with separate bindings produces
+// intermediate garbage (i.e. goes through a temporary JS object). Any native
+// mechanism enabling communication between modules directly would help here.
+//
+// - Cycles between the internal and the external GC cannot be resolved. Using
+// a common GC as envisioned by the GC proposal can help here, but so far it
+// seems that the same limitations as for IT will remain.
+//
+// - Duplicate Wasm imports don't yet work when instrumentation is required as
+// provided argument types cannot be told apart when these only come in as
+// numbers. It might be possible to modify the binary post compilation, but
+// this has not been attempted yet.
+//
+// Oddities
+//
+// - Interface Types `string` will be incompatible with JavaScript `String` and
+// it remains unclear how to proceed on this front. We could either use the IT
+// mechanism and accept potential hazards or keep using unfortunate glue code.
+//
+// - Functions with a variable number of arguments need some special glue to
+// inform the binary how many arguments have been provided so it can fill in
+// defaults for the omitted arguments. No native mechanism in sight, yet.
+//
+// - Optional BigInt arguments must be coerced to 0n since JS does not
+// implicitly coerce from `null` or `undefined`. Numbers do, however.
+//
+// - Generated bindings assume little endian architecture with typed arrays as
+// it appears to be more efficient than using a DataView and BE use cases
+// haven't been seen in the wild so far.
+//
+// - It is assumed that generated import bindings call JavaScript and that the
+// callee expects a properly coerced integer value, leading to more `>>> 0`
+// coercions than necessary when the import is actually another Wasm module.
+
+/** A JavaScript bindings builder. */
+export class JSBuilder extends ExportsWalker {
+
+ /** Builds JavaScript bindings for the specified program. */
+ static build(program: Program, esm: bool = true): string {
+ return new JSBuilder(program, esm).build();
+ }
+
+ private esm: bool;
+ private sb: string[] = [];
+ private indentLevel: i32 = 0;
+
+ private needsLiftBuffer: bool = false;
+ private needsLowerBuffer: bool = false;
+ private needsLiftString: bool = false;
+ private needsLowerString: bool = false;
+ private needsLiftArray: bool = false;
+ private needsLowerArray: bool = false;
+ private needsLiftTypedArray: bool = false;
+ private needsLowerTypedArray: bool = false;
+ private needsLiftStaticArray: bool = false;
+ private needsLowerStaticArray: bool = false;
+ private needsLiftInternref: bool = false;
+ private needsLowerInternref: bool = false;
+ private needsRetain: bool = false;
+ private needsRelease: bool = false;
+ private needsNotNull: bool = false;
+
+ private deferredLifts: Set = new Set();
+ private deferredLowers: Set = new Set();
+ private deferredCode: string[] = new Array();
+
+ private exports: string[] = new Array();
+ private importMappings: Map = new Map();
+
+ /** Constructs a new JavaScript bindings builder. */
+ constructor(program: Program, esm: bool, includePrivate: bool = false) {
+ super(program, includePrivate);
+ this.esm = esm;
+ }
+
+ visitGlobal(name: string, element: Global): void {
+ var sb = this.sb;
+ var type = element.type;
+ this.exports.push(name);
+ if (!isPlainValue(type, Mode.EXPORT)) {
+ indent(sb, this.indentLevel);
+ sb.push(name);
+ sb.push(": {\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(": ");
+ sb.push(type.toString());
+ sb.push("\n");
+ indent(sb, this.indentLevel);
+ sb.push("valueOf() { return this.value; },\n");
+ indent(sb, this.indentLevel);
+ sb.push("get value() {\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("return ");
+ this.makeLiftFromValue("exports." + name + ".value", type, sb);
+ sb.push(";\n");
+ indent(sb, --this.indentLevel);
+ sb.push("}");
+ if (!element.is(CommonFlags.CONST)) {
+ sb.push(",\n");
+ indent(sb, this.indentLevel);
+ sb.push("set value(value) {\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("exports.");
+ sb.push(name);
+ sb.push(".value = ");
+ this.makeLowerToValue("value", type, sb);
+ sb.push(";\n");
+ indent(sb, --this.indentLevel);
+ sb.push("}");
+ }
+ sb.push("\n");
+ indent(sb, --this.indentLevel);
+ sb.push("},\n");
+ }
+ this.visitNamespace(name, element);
+ }
+
+ visitEnum(name: string, element: Enum): void {
+ var sb = this.sb;
+ this.exports.push(name);
+ indent(sb, this.indentLevel);
+ sb.push(name);
+ sb.push(": (values => (\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push("\n");
+ var members = element.members;
+ if (members) {
+ for (let _values = Map_values(members), i = 0, k = _values.length; i < k; ++i) {
+ let value = _values[i];
+ if (value.kind != ElementKind.ENUMVALUE) continue;
+ indent(sb, this.indentLevel);
+ sb.push("values[values.");
+ sb.push(value.name);
+ if (value.is(CommonFlags.INLINED)) {
+ sb.push(" = ");
+ sb.push(i64_low((value).constantIntegerValue).toString());
+ } else {
+ sb.push(" = exports[\"");
+ sb.push(escapeString(name + "." + value.name, CharCode.DOUBLEQUOTE));
+ sb.push("\"].valueOf()");
+ }
+ sb.push("] = \"");
+ sb.push(escapeString(value.name, CharCode.DOUBLEQUOTE));
+ sb.push("\",\n");
+ }
+ }
+ indent(sb, this.indentLevel);
+ sb.push("values\n");
+ indent(sb, --this.indentLevel);
+ sb.push("))({}),\n");
+ this.visitNamespace(name, element);
+ }
+
+ makeGlobalImport(moduleName: string, name: string, element: Global): void {
+ var sb = this.sb;
+ var type = element.type;
+ indent(sb, this.indentLevel);
+ if (isIdentifier(name)) {
+ sb.push(name);
+ } else {
+ sb.push("\"");
+ sb.push(escapeString(name, CharCode.DOUBLEQUOTE));
+ sb.push("\": ");
+ }
+ let moduleId = this.ensureModuleId(moduleName);
+ if (isPlainValue(type, Mode.IMPORT)) {
+ sb.push("(\n");
+ indent(sb, this.indentLevel + 1);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(": ");
+ sb.push(element.type.toString());
+ sb.push("\n");
+ indent(sb, this.indentLevel + 1);
+ if (moduleName != "env") {
+ sb.push("__module");
+ sb.push(moduleId.toString());
+ sb.push(".");
+ }
+ sb.push(name);
+ sb.push("\n");
+ indent(sb, this.indentLevel);
+ sb.push(")");
+ } else {
+ sb.push("{\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(": ");
+ sb.push(element.type.toString());
+ sb.push("\n");
+ indent(sb, this.indentLevel);
+ sb.push("// not supported: cannot lower before instantiate completes\n");
+ indent(sb, --this.indentLevel);
+ sb.push("}");
+ }
+ sb.push(",\n");
+ }
+
+ makeFunctionImport(moduleName: string, name: string, element: Function, code: string | null = null): void {
+ var sb = this.sb;
+ var signature = element.signature;
+ indent(sb, this.indentLevel);
+ if (isIdentifier(name)) {
+ sb.push(name);
+ } else {
+ sb.push("\"");
+ sb.push(escapeString(name, CharCode.DOUBLEQUOTE));
+ sb.push("\"");
+ }
+ if (isPlainFunction(signature, Mode.IMPORT) && !code) {
+ sb.push(": (\n");
+ indent(sb, this.indentLevel + 1);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(element.signature.toString());
+ sb.push("\n");
+ indent(sb, this.indentLevel + 1);
+ if (moduleName != "env") {
+ sb.push(moduleName);
+ sb.push(".");
+ }
+ sb.push(name);
+ sb.push("\n");
+ indent(sb, this.indentLevel);
+ sb.push(")");
+ } else {
+ sb.push("(");
+ let parameterTypes = signature.parameterTypes;
+ let parameterNames = new Array();
+ for (let i = 0, k = parameterTypes.length; i < k; ++i) {
+ parameterNames.push(element.getParameterName(i));
+ }
+ sb.push(parameterNames.join(", "));
+ sb.push(") {\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(element.signature.toString());
+ sb.push("\n");
+ for (let i = 0, k = parameterTypes.length; i < k; ++i) {
+ let type = parameterTypes[i];
+ if (!isPlainValue(type, Mode.EXPORT)) {
+ let name = element.getParameterName(i);
+ indent(sb, this.indentLevel);
+ sb.push(name);
+ sb.push(" = ");
+ this.makeLiftFromValue(name, type, sb);
+ sb.push(";\n");
+ }
+ }
+ let expr = new Array();
+ let moduleId = this.ensureModuleId(moduleName);
+ if (code) {
+ expr.push("(() => {\n");
+ indent(expr, 1);
+ expr.push("// @external.js\n");
+ indentText(code, 1, expr);
+ expr.push("\n})()");
+ } else {
+ if (moduleName != "env") {
+ expr.push("__module");
+ expr.push(moduleId.toString());
+ expr.push(".");
+ }
+ expr.push(name);
+ expr.push("(");
+ expr.push(parameterNames.join(", "));
+ expr.push(")");
+ }
+ code = expr.join("");
+ expr.length = 0;
+ indentText(code, this.indentLevel, expr, true);
+ code = expr.join("");
+ indent(sb, this.indentLevel);
+ if (signature.returnType != Type.void) {
+ sb.push("return ");
+ this.makeLowerToValue(code, signature.returnType, sb);
+ sb.push(";\n");
+ } else {
+ sb.push(code);
+ sb.push(";\n");
+ }
+ indent(sb, --this.indentLevel);
+ sb.push("}");
+ }
+ sb.push(",\n");
+ }
+
+ visitFunction(name: string, element: Function): void {
+ if (element.is(CommonFlags.PRIVATE)) return;
+ var sb = this.sb;
+ var signature = element.signature;
+ this.exports.push(name);
+ if (!isPlainFunction(signature, Mode.EXPORT)) {
+ indent(sb, this.indentLevel);
+ sb.push(name);
+ sb.push("(");
+ let parameterTypes = signature.parameterTypes;
+ let numReferences = 0;
+ for (let i = 0, k = parameterTypes.length; i < k; ++i) {
+ if (parameterTypes[i].isInternalReference) numReferences++;
+ if (i > 0) sb.push(", ");
+ sb.push(element.getParameterName(i));
+ }
+ sb.push(") {\n");
+ indent(sb, ++this.indentLevel);
+ sb.push("// ");
+ sb.push(element.internalName);
+ sb.push(signature.toString());
+ sb.push("\n");
+ let releases = new Array();
+ for (let i = 0, k = parameterTypes.length; i < k; ++i) {
+ let type = parameterTypes[i];
+ if (!isPlainValue(type, Mode.IMPORT)) {
+ let name = element.getParameterName(i);
+ indent(sb, this.indentLevel);
+ sb.push(name);
+ sb.push(" = ");
+ let needsRetainRelease = type.isInternalReference && --numReferences > 0;
+ if (needsRetainRelease) {
+ this.needsRetain = true;
+ this.needsRelease = true;
+ sb.push("__retain(");
+ releases.push(name);
+ }
+ this.makeLowerToValue(name, type, sb);
+ if (needsRetainRelease) {
+ sb.push(")");
+ }
+ sb.push(";\n");
+ }
+ }
+ if (releases.length) {
+ indent(sb, this.indentLevel++);
+ sb.push("try {\n");
+ }
+ if (signature.requiredParameters < parameterTypes.length) {
+ indent(sb, this.indentLevel);
+ sb.push("exports.__setArgumentsLength(arguments.length);\n");
+ }
+ const expr = new Array();
+ expr.push("exports.");
+ expr.push(name);
+ expr.push("(");
+ for (let i = 0, k = parameterTypes.length; i < k; ++i) {
+ if (i > 0) expr.push(", ");
+ expr.push(element.getParameterName(i));
+ }
+ expr.push(")");
+ if (signature.returnType != Type.void) {
+ indent(sb, this.indentLevel);
+ sb.push("return ");
+ this.makeLiftFromValue(expr.join(""), signature.returnType, sb);
+ } else {
+ indent(sb, this.indentLevel);
+ sb.push(expr.join(""));
+ }
+ sb.push(";\n");
+ if (releases.length) {
+ indent(sb, this.indentLevel - 1);
+ sb.push("} finally {\n");
+ for (let i = 0, k = releases.length; i < k; ++i) {
+ indent(sb, this.indentLevel);
+ sb.push("__release(");
+ sb.push(releases[i]);
+ sb.push(");\n");
+ }
+ indent(sb, --this.indentLevel);
+ sb.push("}\n");
+ }
+ indent(sb, --this.indentLevel);
+ sb.push("},\n");
+ }
+ this.visitNamespace(name, element);
+ }
+
+ visitClass(name: string, element: Class): void {
+ // not implemented
+ }
+
+ visitInterface(name: string, element: Interface): void {
+ this.visitClass(name, element);
+ }
+
+ visitField(name: string, element: Field): void {
+ // not implemented
+ }
+
+ visitNamespace(name: string, element: Element): void {
+ // not implemented
+ }
+
+ visitAlias(name: string, element: Element, originalName: string): void {
+ // not implemented
+ // var sb = this.sb;
+ // sb.push("export const ");
+ // sb.push(name);
+ // sb.push(" = ");
+ // sb.push(originalName);
+ // sb.push(";\n");
+ }
+
+ getExternalCode(element: Function): string | null {
+ let decorator = findDecorator(DecoratorKind.EXTERNAL_JS, element.decoratorNodes);
+ if (decorator) {
+ let args = decorator.args;
+ if (args && args.length == 1) {
+ let codeArg = args[0];
+ if (codeArg.kind == NodeKind.LITERAL) {
+ let literal = codeArg;
+ if (literal.literalKind == LiteralKind.STRING) {
+ return (literal).value;
+ }
+ if (literal.literalKind == LiteralKind.TEMPLATE) {
+ let parts = (literal).parts;
+ if (parts.length == 1) {
+ return parts[0];
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ build(): string {
+ var exports = this.exports;
+ var moduleImports = this.program.moduleImports;
+ var program = this.program;
+ var options = program.options;
+ var sb = this.sb;
+
+ sb.push(""); // placeholder
+ indent(sb, this.indentLevel++);
+ if (!this.esm) sb.push("export ");
+ sb.push("async function instantiate(module, imports = {}) {\n");
+ const insertPos = sb.push("") - 1;
+
+ // Instrument module imports. Keeps raw (JS) imports on the respective
+ // prototypes and overrides selectively where instrumentation is required.
+ indent(sb, this.indentLevel++);
+ sb.push("const adaptedImports = {\n");
+ let sbLengthBefore = sb.length;
+ for (let _keys = Map_keys(moduleImports), i = 0, k = _keys.length; i < k; ++i) {
+ let moduleName = _keys[i];
+ let moduleId = this.ensureModuleId(moduleName);
+ let module =