Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to latest aspect and compiler #138

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules/
*.lock
dist/
*.wat
*.wasm
.vscode
.DS_Store
*.log
Expand Down
24 changes: 24 additions & 0 deletions as-pect.asconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"targets": {
"coverage": {
"lib": ["./node_modules/@as-covers/assembly/index.ts"],
"transform": ["@as-covers/transform", "@as-pect/transform"]
},
"noCoverage": {
"transform": ["@as-pect/transform"]
}
},
"options": {
"exportMemory": true,
"outFile": "output.wasm",
"textFile": "output.wat",
"bindings": "raw",
"exportStart": "_start",
"exportRuntime": true,
"use": ["RTRACE=1"],
"debug": true,
"exportTable": true
},
"extends": "./asconfig.json",
"entries": ["./node_modules/@as-pect/assembly/assembly/index.ts"]
}
76 changes: 0 additions & 76 deletions as-pect.config.cjs

This file was deleted.

60 changes: 60 additions & 0 deletions as-pect.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { initASWebGLue } from 'aswebglue/src/ASWebGLue.js'

///////////// Setup a fake document that allows creating canvases from which webgl contexts can be created. {{

import webgl from 'webgl-raub'
import gflw from 'glfw-raub'
const { Document } = gflw
Document.setWebgl(webgl)

const doc = new Document()
global.document = global.window = doc

// Trick ASWebGLue by returning a new canvas for any ID, since there is no real DOM.
global.document.getElementById = () => {
return document.createElement('canvas')
}

// }}

export default {
/**
* A set of globs passed to the glob package that qualify typescript files for testing.
*/
entries: ['src/as/index.spec.ts'],
/**
* A set of globs passed to the glob package that quality files to be added to each test.
*/
include: ['src/as/**/*.include.ts'],
/**
* A set of regexp that will disclude source files from testing.
*/
disclude: [/node_modules/],
/**
* Add your required AssemblyScript imports here.
*/
async instantiate(memory, createImports, instantiate, binary) {
const myImports = initASWebGLue({
env: {
seed: Date.now,
memory,
'Date.now': Date.now.bind(Date),
},
})
const { shouldLogAborts, setExports } = myImports

const imports = createImports(myImports)
const result = await instantiate(binary, imports)

setExports(result.exports)
shouldLogAborts(false)

return result
},
/** Enable code coverage. */
coverage: ['src/as/**/*.ts'],
/**
* Specify if the binary wasm file should be written to the file system.
*/
outputBinary: false,
}
3 changes: 2 additions & 1 deletion asconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"options": {
"exportTable": true,
"sourceMap": true
"sourceMap": true,
"bindings": "esm"
},

"targets": {
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:verbose": "npm run asp -- --verbose",
"test:trace": "npm run asp -- --verbose 2>&1 | grep \"\\[Fail\\]\" -A 5",
"^// test:trace comment": "This shows only failed tests, along with a few stack traces lines if any",
"asp": "xvfb-maybe asp --config=as-pect.config.cjs",
"asp": "xvfb-maybe asp",
"// ^ asp": "Running asp under xvfb-maybe allows a headless X11 server to be spawned in case there's no DISPLAY. This is needed for webgl-raub which will open a window with GLFW.",
"/////////////////// BUILDS //////////////////////////": "",
"build:as": "asc src/as/index.ts --config --target debug",
Expand All @@ -44,30 +44,30 @@
"prepare": "npm run build && npm rebuild --build-from-source gl"
},
"dependencies": {
"@assemblyscript/loader": "^0.19.3",
"@as-pect/cli": "^7.0.7",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a particular reason to move the cli to dependencies? Or just accidental?

"@assemblyscript/loader": "^0.21.3",
"@lume/as-loader": "^0.18.10",
"aswebglue": "lume/aswebglue#653897e69c6d7f74a7dcf71cdb5e4cea1d3f322d"
},
"devDependencies": {
"@as-pect/cli": "^6.2.4",
"@types/node": "^15.12.4",
"assemblyscript": "^0.19.3",
"deasync": "^0.1.21",
"glfw-raub": "^4.6.0",
"live-server": "^1.2.1",
"@types/node": "^18.7.14",
"assemblyscript": "^0.21.3",
"deasync": "^0.1.28",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks like we can remove some dependencies that were needed for importSync.

"glfw-raub": "^4.6.2",
"live-server": "^1.2.2",
"make-dir-cli": "^3.0.0",
"prettier": "^2.3.1",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"source-map-loader": "^3.0.0",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tslib": "^2.3.0",
"typescript": "^4.3.4",
"webgl-raub": "^2.2.4",
"webpack": "^5.40.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2",
"source-map-loader": "^4.0.0",
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"tslib": "^2.4.0",
"typescript": "^4.8.2",
"webgl-raub": "^2.2.6",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.10.1",
"xvfb-maybe": "^0.2.1",
"yaml": "^1.10.2"
"yaml": "^2.1.1"
}
}