Switch to TypeScript

This commit is contained in:
asraelite 2024-05-13 18:29:10 +02:00 committed by Markus Scully
parent 1648b7e3d0
commit bf71f55130
45 changed files with 754 additions and 159 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.cache/ .cache/
*.map *.map
dist/improcket.min.js dist/improcket.min.js
node_modules

View file

@ -1,9 +1,11 @@
# Improcket # Improcket
A little 2D space rocket game. Not done tho. A little 2D space rocket game originally made for a game jam.
### Building ### Building
Install `rollup` and run `./rollup`. `npm install`
`npm run build`
Host `dist/` on some static HTTP server. Host `dist/` on some static HTTP server.

View file

@ -1,3 +0,0 @@
import { init } from './game/index.mjs';
window.addEventListener('load', init);

553
package-lock.json generated Normal file
View file

@ -0,0 +1,553 @@
{
"name": "improcket",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.6.2"
}
},
"node_modules/@babel/code-frame": {
"version": "7.24.2",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz",
"integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==",
"dev": true,
"dependencies": {
"@babel/highlight": "^7.24.2",
"picocolors": "^1.0.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "7.24.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz",
"integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==",
"dev": true,
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/highlight": {
"version": "7.24.5",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz",
"integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==",
"dev": true,
"dependencies": {
"@babel/helper-validator-identifier": "^7.24.5",
"chalk": "^2.4.2",
"js-tokens": "^4.0.0",
"picocolors": "^1.0.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
"integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==",
"dev": true,
"dependencies": {
"@jridgewell/set-array": "^1.2.1",
"@jridgewell/sourcemap-codec": "^1.4.10",
"@jridgewell/trace-mapping": "^0.3.24"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"dev": true,
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/set-array": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
"dev": true,
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/source-map": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz",
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
"dev": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.15",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
"dev": true
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.25",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
"dev": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@rollup/plugin-typescript": {
"version": "11.1.6",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz",
"integrity": "sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^5.1.0",
"resolve": "^1.22.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^2.14.0||^3.0.0||^4.0.0",
"tslib": "*",
"typescript": ">=3.7.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
},
"tslib": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz",
"integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==",
"dev": true,
"dependencies": {
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@types/estree": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
"dev": true
},
"node_modules/@types/node": {
"version": "20.12.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz",
"integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/acorn": {
"version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"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==",
"dev": true
},
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"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/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/is-core-module": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
"dev": true,
"dependencies": {
"hasown": "^2.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/jest-worker": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz",
"integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==",
"dev": true,
"dependencies": {
"@types/node": "*",
"merge-stream": "^2.0.0",
"supports-color": "^7.0.0"
},
"engines": {
"node": ">= 10.13.0"
}
},
"node_modules/jest-worker/node_modules/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,
"engines": {
"node": ">=8"
}
},
"node_modules/jest-worker/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
"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/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/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.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"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/resolve": {
"version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
"dev": true,
"dependencies": {
"is-core-module": "^2.13.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/rollup": {
"version": "2.79.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
"integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=10.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/rollup-plugin-terser": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
"integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==",
"deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"jest-worker": "^26.2.1",
"serialize-javascript": "^4.0.0",
"terser": "^5.0.0"
},
"peerDependencies": {
"rollup": "^2.0.0"
}
},
"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/serialize-javascript": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
"dev": true,
"dependencies": {
"randombytes": "^2.1.0"
}
},
"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==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-support": {
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/terser": {
"version": "5.31.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz",
"integrity": "sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg==",
"dev": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
"acorn": "^8.8.2",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
"bin": {
"terser": "bin/terser"
},
"engines": {
"node": ">=10"
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"dev": true
},
"node_modules/typescript": {
"version": "5.4.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
"dev": true,
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
}
}
}

11
package.json Normal file
View file

@ -0,0 +1,11 @@
{
"scripts": {
"build": "rollup -c"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.6.2"
}
}

2
rollup
View file

@ -1,2 +0,0 @@
#!/bin/bash
npx rollup js/index.mjs --o dist/improcket.min.js -m --f es --watch

13
rollup.config.js Executable file
View file

@ -0,0 +1,13 @@
import typescript from '@rollup/plugin-typescript';
export default {
input: 'src/main.ts',
output: {
file: 'dist/improcket.min.js',
format: 'iife',
sourcemap: true
},
plugins: [
typescript(),
]
};

View file

@ -1,4 +1,4 @@
import {audio} from '../assets.mjs'; import {audio} from '../assets';
const playing = new Map(); const playing = new Map();

View file

@ -1,11 +1,11 @@
import * as input from '../input.mjs'; import * as input from '../input';
import * as events from './events.mjs'; import * as events from './events';
import * as graphics from '../graphics/index.mjs'; import * as graphics from '../graphics/index';
import * as inventory from './inventory.mjs'; import * as inventory from './inventory';
import * as audio from './audio.mjs'; import * as audio from './audio';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import {playerShip} from '../world/index.mjs'; import {playerShip} from '../world/index';
import {state} from './index.mjs'; import {state} from './index';
export const mapping = { export const mapping = {
thrust: 'KeyW', thrust: 'KeyW',

View file

@ -1,11 +1,11 @@
import * as game from './index.mjs'; import * as game from './index';
import * as graphics from '../graphics/index.mjs'; import * as graphics from '../graphics/index';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
import * as events from './events.mjs'; import * as events from './events';
import * as inventory from './inventory.mjs'; import * as inventory from './inventory';
import {modules} from '../data.mjs'; import {modules} from '../data';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
export let tiles = new Map(); export let tiles = new Map();
export let width = 0; export let width = 0;
@ -217,7 +217,11 @@ function posId(x, y) {
} }
function getBoundaries() { function getBoundaries() {
let sx = sy = ex = ey = null let sx = null;
let sy = null;
let ex = null;
let ey = null;
tiles.forEach(t => { tiles.forEach(t => {
if (t.type === null) return; if (t.type === null) return;
if (sx === null || t.x < sx) sx = t.x; if (sx === null || t.x < sx) sx = t.x;

View file

@ -1,11 +1,11 @@
import * as game from './index.mjs'; import * as game from './index';
import * as graphics from '../graphics/index.mjs'; import * as graphics from '../graphics/index';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import * as inventory from './inventory.mjs'; import * as inventory from './inventory';
import * as particle from '../world/particle.mjs'; import * as particle from '../world/particle';
import * as edit from './edit.mjs'; import * as edit from './edit';
import * as audio from './audio.mjs'; import * as audio from './audio';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
export let shipLanded = false; export let shipLanded = false;
export let score = 0; export let score = 0;

View file

@ -1,14 +1,14 @@
import * as graphics from '../graphics/index.mjs'; import * as graphics from '../graphics/index';
import * as gui from '../gui/index.mjs'; import * as gui from '../gui/index';
import * as assets from '../assets.mjs'; import * as assets from '../assets';
import * as input from '../input.mjs'; import * as input from '../input';
import * as inventory from './inventory.mjs'; import * as inventory from './inventory';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import * as events from './events.mjs'; import * as events from './events';
import * as control from './control.mjs'; import * as control from './control';
import * as edit from './edit.mjs'; import * as edit from './edit';
export let state; export let state: any;
export async function init() { export async function init() {
state = { state = {

View file

@ -1,9 +1,9 @@
import {state} from './index.mjs'; import {state} from './index';
import {modules} from '../data.mjs'; import {modules} from '../data';
import {playerShip} from '../world/index.mjs'; import {playerShip} from '../world/index';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
import * as edit from '../game/edit.mjs'; import * as edit from './edit';
import * as events from './events.mjs'; import * as events from './events';
export const items = new Map(); export const items = new Map();
export let currentItem = null; export let currentItem = null;

View file

@ -1,5 +1,5 @@
import {canvas, context, perspective} from './index.mjs'; import {canvas, context, perspective} from './index';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
let patterns = null; let patterns = null;

View file

@ -1,4 +1,4 @@
import {canvas, context} from './index.mjs'; import {canvas, context} from './index';
export function text(string, x, y, export function text(string, x, y,
{font = '52pt Arial', align = 'left', valign = 'top', color = null}) { {font = '52pt Arial', align = 'left', valign = 'top', color = null}) {

View file

@ -1,6 +1,6 @@
import {canvas, context} from './index.mjs'; import {canvas, context} from './index';
import * as gui from '../gui/index.mjs'; import * as gui from '../gui/index';
import * as draw from './draw.mjs'; import * as draw from './draw';
export function render() { export function render() {
renderElement(gui.root); renderElement(gui.root);

View file

@ -1,10 +1,10 @@
import * as gui from './gui.mjs'; import * as gui from './gui';
import * as draw from './draw.mjs'; import * as draw from './draw';
import * as input from '../input.mjs'; import * as input from '../input';
import {render as renderWorld} from './world.mjs'; import {render as renderWorld} from './world';
import {render as renderBackground} from './background.mjs'; import {render as renderBackground} from './background';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
const TAU = consts.TAU; const TAU = consts.TAU;

View file

@ -1,15 +1,17 @@
import { canvas, context } from './index.mjs'; import { canvas, context } from './index';
import * as graphics from './index.mjs'; import * as graphics from './index';
import { images as assets } from '../assets.mjs'; import { images as assets } from '../assets';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
import { state } from '../game/index.mjs'; import { state } from '../game/index';
export function render() { export function render() {
for (particle of world.particles) renderParticle(particle); for (const particle of world.particles) renderParticle(particle);
for (celestial of world.celestials) if (isVisible(celestial)) renderCelestial(celestial); for (const celestial of world.celestials) if (isVisible(celestial)) renderCelestial(celestial);
if (graphics.trace) for (tracer of world.tracers) renderTracer(tracer); if (graphics.trace) {
for (ship of world.ships) renderShip(ship); for (const tracer of world.tracers) renderTracer(tracer);
for (entity of world.entities) if (isVisible(entity)) renderEntity(entity); }
for (const ship of world.ships) renderShip(ship);
for (const entity of world.entities) if (isVisible(entity)) renderEntity(entity);
/* /*
if (typeof window.q === 'undefined') window.q = []; if (typeof window.q === 'undefined') window.q = [];

View file

@ -1,5 +1,5 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
export default class GuiButton extends GuiElement { export default class GuiButton extends GuiElement {
constructor(text, onclick, x, y, w = 100, h = 30) { constructor(text, onclick, x, y, w = 100, h = 30) {

View file

@ -1,9 +1,9 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
import GuiItemButton from './item.mjs'; import GuiItemButton from './item';
import {state} from '../game/index.mjs'; import {state} from '../game/index';
import * as edit from '../game/edit.mjs'; import * as edit from '../game/edit';
import * as inventory from './inventory.mjs'; import * as inventory from './inventory';
export default class GuiEdit extends GuiElement { export default class GuiEdit extends GuiElement {
constructor(x, y, w = 100, h = 30) { constructor(x, y, w = 100, h = 30) {

View file

@ -1,4 +1,4 @@
import {Rect} from './misc.mjs'; import {Rect} from './misc';
const defaultOptions = { const defaultOptions = {
draw: true, // Whether the element itself will be rendered. draw: true, // Whether the element itself will be rendered.

View file

@ -1,5 +1,5 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
export default class GuiFrame extends GuiElement { export default class GuiFrame extends GuiElement {
constructor(x, y, w, h, options) { constructor(x, y, w, h, options) {

View file

@ -1,5 +1,5 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
export default class GuiImage extends GuiElement { export default class GuiImage extends GuiElement {
constructor(src, x, y, w, h) { constructor(src, x, y, w, h) {

View file

@ -1,5 +1,5 @@
import {context} from '../graphics/index.mjs'; import {context} from '../graphics/index';
import * as modules from './modules.mjs'; import * as modules from './modules';
export const elements = new Set(); export const elements = new Set();
export let root; export let root;

View file

@ -1,8 +1,8 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
import GuiItemButton from './item.mjs'; import GuiItemButton from './item';
import {state} from '../game/index.mjs'; import {state} from '../game/index';
import * as inventory from '../game/inventory.mjs'; import * as inventory from '../game/inventory';
export default class GuiInventory extends GuiElement { export default class GuiInventory extends GuiElement {
constructor(x, y, w = 100, h = 30) { constructor(x, y, w = 100, h = 30) {

View file

@ -1,5 +1,5 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiButton from './button.mjs'; import GuiButton from './button';
export default class GuiItemButton extends GuiButton { export default class GuiItemButton extends GuiButton {
constructor(tile, onclick, x, y, w = 50, h = 50, { constructor(tile, onclick, x, y, w = 50, h = 50, {

View file

@ -1,4 +1,4 @@
import * as input from '../input.mjs'; import * as input from '../input';
export class Rect { export class Rect {
constructor(x = 0, y = 0, w = 0, h = 0) { constructor(x = 0, y = 0, w = 0, h = 0) {

View file

@ -1,17 +1,17 @@
import * as gui from './index.mjs'; import * as gui from './index';
import {message as editMessage} from '../game/edit.mjs'; import {message as editMessage} from '../game/edit';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
import {canvas} from '../graphics/index.mjs'; import {canvas} from '../graphics/index';
import GuiFrame from './frame.mjs'; import GuiFrame from './frame';
import GuiImage from './image.mjs'; import GuiImage from './image';
import GuiButton from './button.mjs'; import GuiButton from './button';
import GuiEdit from './edit.mjs'; import GuiEdit from './edit';
import GuiText from './text.mjs'; import GuiText from './text';
import GuiInventory from './inventory.mjs'; import GuiInventory from './inventory';
import * as inventory from '../game/inventory.mjs'; import * as inventory from '../game/inventory';
import * as events from '../game/events.mjs'; import * as events from '../game/events';
import {state} from '../game/index.mjs'; import {state} from '../game/index';
import * as world from '../world/index.mjs'; import * as world from '../world/index';
export function root() { export function root() {
return new GuiFrame(0, 0, canvas.width, canvas.height, { return new GuiFrame(0, 0, canvas.width, canvas.height, {

View file

@ -1,6 +1,6 @@
import * as gui from './index.mjs'; import * as gui from './index';
import GuiElement from './element.mjs'; import GuiElement from './element';
import {context} from '../graphics/index.mjs'; import {context} from '../graphics/index';
export default class GuiText extends GuiElement { export default class GuiText extends GuiElement {
constructor(text = '', x, y, w, h, { constructor(text = '', x, y, w, h, {

View file

@ -1,4 +1,4 @@
import {canvas} from './graphics/index.mjs'; import {canvas} from './graphics/index';
export const mouse = { pressed: {}, held: {}, x: 0, y: 0, scroll: 0 }; export const mouse = { pressed: {}, held: {}, x: 0, y: 0, scroll: 0 };
export const keyCode = { pressed: {}, held: {} }; export const keyCode = { pressed: {}, held: {} };
@ -26,11 +26,10 @@ export function init() {
keyCode.held[event.code] = false; keyCode.held[event.code] = false;
key.held[event.key] = false; key.held[event.key] = false;
}); });
// Ṕ͕͖ẖ̨̖̺͓̪̹n̼͇͔̯̝̖g̙̩̭͕ͅͅl̻̰͘u͎̥͍̗ͅi̼̞̪̩͚̜͖ ̫̝̻͚͟m͎̳̙̭̩̩̕g̟̤̬̮l̫̕w̶͚͈͚̟͔͖n͏̝͖̞̺ͅa͏̹͓̬̺f̗̬̬̬̖̫͜h͙̘̝̱̬̗͜ ̼͎͖C̱͔̱͖ṭ̬̱͖h̵̰̼̘̩ùlh̙́u̪̫ ̪̺̹̙̯R̞͓̹̞͍͎͉͎̦͙ͅl͇̠̮y̙̪̰̪͙̖e̢̩͉͙̼h̗͔̹̳ ̶w̨̼͍̝̭̣̣ͅg̶̳̦̳a̴͉̹͙̭̟ͅh͈͎̞̜͉̼̜̠́͞n̲a̯g̮͚͓̝l̠ ̹̹̱͙̝f̧̝͖̱h̪̟̻͖̖t͎͘aͅg̤̘͜n̶͈̻̻̝̳
window.addEventListener('mousedown', event => { window.addEventListener('mousedown', event => {
mouse.pressed[event.button] = !mouse.held[event.button]; mouse.pressed[event.button] = !mouse.held[event.button];
mouse.held[event.button] = true; mouse.held[event.button] = true;
tickAfterMouse = false;
}); });
window.addEventListener('mouseup', event => { window.addEventListener('mouseup', event => {

3
src/main.ts Normal file
View file

@ -0,0 +1,3 @@
import { init } from './game/index';
window.addEventListener('load', init);

View file

@ -1,4 +1,4 @@
import {GRAVITATIONAL_CONSTANT as G, TAU} from '../consts.mjs'; import {GRAVITATIONAL_CONSTANT as G, TAU} from '../consts';
export default class Body { export default class Body {
constructor(x, y, mass) { constructor(x, y, mass) {

View file

@ -1,7 +1,7 @@
import {tempCanvas, tempContext} from '../graphics/index.mjs'; import {tempCanvas, tempContext} from '../graphics/index';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
import Body from './body.mjs'; import Body from './body';
import { PLANET_IMAGE_SIZE } from '../consts.mjs'; import { PLANET_IMAGE_SIZE } from '../consts';
export default class Celestial extends Body { export default class Celestial extends Body {
constructor(x, y, radius, { constructor(x, y, radius, {

View file

@ -1,11 +1,11 @@
import Body from './body.mjs'; import Body from './body';
import {modules} from '../data.mjs'; import {modules} from '../data';
import {playerShip} from './index.mjs'; import {playerShip} from './index';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
import {celestials, particles, entities} from './index.mjs'; import {celestials, particles, entities} from './index';
import * as particle from './particle.mjs'; import * as particle from './particle';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
import * as events from '../game/events.mjs'; import * as events from '../game/events';
export default class Entity extends Body { export default class Entity extends Body {
constructor(x, y, type = 'fuel', id = 'small', { constructor(x, y, type = 'fuel', id = 'small', {

View file

@ -1,5 +1,5 @@
import * as spawn from './spawn.mjs'; import * as spawn from './spawn';
import * as graphics from '../graphics/index.mjs'; import * as graphics from '../graphics/index';
export const entities = new Set(); export const entities = new Set();
export const celestials = new Set(); export const celestials = new Set();

View file

@ -1,5 +1,5 @@
import {modules} from '../data.mjs'; import {modules} from '../data';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
export default class Module { export default class Module {
constructor(x, y, ship, { constructor(x, y, ship, {

View file

@ -1,5 +1,5 @@
import Body from './body.mjs'; import Body from './body';
import {celestials, particles} from './index.mjs'; import {celestials, particles} from './index';
export function createThrustExhaust(thruster) { export function createThrustExhaust(thruster) {
let ship = thruster.ship; let ship = thruster.ship;

View file

@ -1,11 +1,11 @@
import Module from './module.mjs'; import Module from './module';
import Body from './body.mjs'; import Body from './body';
import * as world from './index.mjs'; import * as world from './index';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
import * as particle from './particle.mjs'; import * as particle from './particle';
import * as events from '../game/events.mjs'; import * as events from '../game/events';
import Tracer from './tracer.mjs'; import Tracer from './tracer';
import {state} from '../game/index.mjs'; import {state} from '../game/index';
export default class Ship extends Body { export default class Ship extends Body {
constructor(x, y) { constructor(x, y) {

View file

@ -1,12 +1,12 @@
import Ship from './ship.mjs'; import Ship from './ship';
import Module from './module.mjs'; import Module from './module';
import Celestial from './celestial.mjs'; import Celestial from './celestial';
import Entity from './entity.mjs'; import Entity from './entity';
import Tracer from './tracer.mjs'; import Tracer from './tracer';
import {modules} from '../data.mjs'; import {modules} from '../data';
import * as world from './index.mjs'; import * as world from './index';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
import {SECTOR_SIZE as SS} from '../consts.mjs'; import {SECTOR_SIZE as SS} from '../consts';
let spawnedSectors = new Map(); let spawnedSectors = new Map();

View file

@ -1,11 +1,11 @@
import Body from './body.mjs'; import Body from './body';
import {modules} from '../data.mjs'; import {modules} from '../data';
import {playerShip} from './index.mjs'; import {playerShip} from './index';
import {images as assets} from '../assets.mjs'; import {images as assets} from '../assets';
import {celestials, particles, entities} from './index.mjs'; import {celestials, particles, entities} from './index';
import * as particle from './particle.mjs'; import * as particle from './particle';
import * as consts from '../consts.mjs'; import * as consts from '../consts';
import * as events from '../game/events.mjs'; import * as events from '../game/events';
export default class Tracer extends Body { export default class Tracer extends Body {
constructor(ship) { constructor(ship) {

12
tsconfig.json Normal file
View file

@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es2022",
"module": "esnext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"skipLibCheck": true,
"outDir": "out",
},
"include": ["./src/**/*.ts"]
}