diff --git a/package.json b/package.json new file mode 120000 index 000000000000..c30d0ba92b5b --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +src/irvisualizer/package.json \ No newline at end of file diff --git a/src/irvisualizer/.eslintrc.js b/src/irvisualizer/.eslintrc.js new file mode 100644 index 000000000000..5baa4115614e --- /dev/null +++ b/src/irvisualizer/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + "env": { + "browser": true, + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "2017", + "sourceType": "module", + }, + "rules": { + "comma-dangle": ["error", "only-multiline"] + } +} \ No newline at end of file diff --git a/src/irvisualizer/.gitignore b/src/irvisualizer/.gitignore new file mode 100644 index 000000000000..c2658d7d1b31 --- /dev/null +++ b/src/irvisualizer/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/src/irvisualizer/README.md b/src/irvisualizer/README.md new file mode 100644 index 000000000000..0c9c5ef582ed --- /dev/null +++ b/src/irvisualizer/README.md @@ -0,0 +1,58 @@ +# Javascript toolchain for IRVisualizer: the single page web application + +## Features: + +* To trigger Github's online Dependabot alerts for security vulnerabilities. + +* To enable static analyzer for the Javascript/ES6 language. + +* To visualize the Halide IR and the assembly code interactively +with a web browser. + +## Usage: + +* Execute `yarn install` to scan for broken Javascript dependencies. + +* (To be completed) execute `yarn run lint` to scan the main script for potential syntax errors and + bugs. + +## Recommended Makefile build rules + +```make +ESBUILD=node_modules/.bin/esbuild +ESLINT=node_modules/.bin/eslint + +help: ## Display this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) + +all: depend build ## Download dependencies and build everything + +depend: ## Download Nodejs dependencies + yarn install + +watch: ## Debug mode, monitor file changes and then compile automatically + yarn run watch + +build: ## Release mode, optimize and minimize the Javascript file + yarn run build + +lint: ## Run static analyzer on the main javascript + yarn run lint + +.PHONY: depend watch build lint +``` + +## Development roadmap + +* [ ] Rename the extensions from `*.template.html` to `template/*.[js|css|html]`. + +* [ ] Modernize the main script to ES6. + +* [ ] Import all dependencies with the `import` statement, not via the ` + diff --git a/src/irvisualizer/package.json b/src/irvisualizer/package.json new file mode 100644 index 000000000000..3eddd4cb0eef --- /dev/null +++ b/src/irvisualizer/package.json @@ -0,0 +1,29 @@ +{ + "name": "halide-irvisualizer", + "description": "Halide IRVisualizer web toolchain", + "author": "Halide IRVisualizer workgroup", + "version": "0.0.1", + "private": true, + "repository": { + "type": "git", + "url": "" + }, + "scripts": { + "build": "esbuild StmtToViz_javascript.template.html --bundle --minify --sourcemap --outdir=build --target=es6", + "lint": "eslint StmtToViz_javascript.template.html", + "watch": "esbuild StmtToViz_javascript.template.html --bundle --watch --outdir=build" + }, + "dependencies": { + "@speed-highlight/core": "speed-highlight/core", + "bootstrap": "5.2.0", + "bootstrap-icons": "1.5.0", + "font-awesome": "4.1.0", + "jquery": "3.7.0", + "treeflex": "^2.0.1" + }, + "devDependencies": { + "esbuild": "^0.18.13", + "eslint": "^2.11.1", + "yarn": "^1.22.10" + } +}