Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AssemblyScript/assemblyscript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.26.2
Choose a base ref
...
head repository: AssemblyScript/assemblyscript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.26.3
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jan 13, 2023

  1. Copy the full SHA
    e1a5fce View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6a7aaef View commit details
Showing with 14 additions and 31 deletions.
  1. +14 −31 scripts/build-web.js
45 changes: 14 additions & 31 deletions scripts/build-web.js
Original file line number Diff line number Diff line change
@@ -25,35 +25,18 @@ const importmap = {

fs.writeFileSync(path.join(dirname, "..", "dist", "importmap.json"), `${JSON.stringify(importmap, null, 2)}
`);
fs.writeFileSync(path.join(dirname, "..", "dist", "importmap.js"), `export const importmap = ${JSON.stringify(importmap, null, 2)}
export default importmap;
`);
fs.writeFileSync(path.join(dirname, "..", "dist", "web.html"), `<script async src="https://cdn.jsdelivr.net/npm/es-module-shims@1/dist/es-module-shims.js"></script>
<script type="importmap">
${JSON.stringify(importmap, null, 2)}
</script>
<script type="module">
import asc from "assemblyscript/asc";
const files = {
"index.ts": "export function add(a: i32, b: i32): i32 { return a + b; }"
};
const { error, stdout } = await asc.main([
"index.ts", "--textFile", "--optimize"
], {
readFile(name, baseDir) {
if (Object.prototype.hasOwnProperty.call(files, name)) return files[name];
return null;
},
writeFile(name, data, baseDir) {
},
listFiles(dirname, baseDir) {
return [];
}
});
if (error) throw error;
console.log(stdout.toString());
</script>
fs.writeFileSync(path.join(dirname, "..", "dist", "web.js"), `var ASSEMBLYSCRIPT_VERSION = ${JSON.stringify(mainVersion)};
var ASSEMBLYSCRIPT_IMPORTMAP = ${JSON.stringify(importmap, null, 2)};
if (!document.currentScript.src.includes("noinstall")) {
let elem = document.createElement("script");
elem.type = "importmap";
elem.text = JSON.stringify(ASSEMBLYSCRIPT_IMPORTMAP);
document.head.appendChild(elem);
}
if (!document.currentScript.src.includes("noshim")) {
let elem = document.createElement("script");
elem.async = true;
elem.src = "https://cdn.jsdelivr.net/npm/es-module-shims@1/dist/es-module-shims.wasm.min.js";
document.head.appendChild(elem);
}
`);