Multi-use JavaScript Package System with two formats:
- JPAK 1.0 — monolithic package (data + JSON file table appended)
- JPAK 2.0 EXT / JMS — metadata (
*.jms) + volume data stores (*.jds), supporting partial loading and volume spanning
JavaScript loader runs in both browser and Node.js (detected via typeof module !== 'undefined').
| Path | Purpose |
|---|---|
jssrc/ |
JS source files (concatenated in alphabetical order — alpha.js creates JPAK namespace, zzzz.js exports it) |
dist/ |
Built output: jpak.js (UMD/CJS), jpak.min.js (minified UMD), jpak.mjs (ESM) |
tools/ |
build.js (JS build), packer.py + packer1.py (JPAK 1.0/2.0 packers), unpacker.py (extract), extpacker.js (JMS), jpaktool.py (shared Python lib) |
cpp/ |
C++ shared library (libjpak.so) with jsoncpp submodule |
test/ |
Manual browser tests + test_node.js |
npm install # install jshint + terser
npm run build # build dist/jpak.js, dist/jpak.min.js, dist/jpak.mjs
npm run lint # jshint on jssrc/*.js
npm test # build + run test_node.jstools/build.js — concats all jssrc/*.js in alphabetical order, produces three outputs:
dist/jpak.js— UMD bundle (works with<script>tag andrequire())dist/jpak.min.js— minified UMD (terser, no mangling)dist/jpak.mjs— ES module (works withimport JPAK from '@teskevirtualsystem/jpak'orimport { JPAK } from '@teskevirtualsystem/jpak')
No external dependencies at runtime (Q library replaced by native Promises).
pip install -r tools/requirements.txt # pycryptodome
python3 tools/packer1.py folder/ # create JPAK 1.0 package
python3 tools/packer.py 0 0 0 "" folder/ # create JPAK 2.0 package
python3 tools/unpacker.py file.jpak # extract any JPAK fileci.yml— runs lint + test on push/PR to master (Node 18/20/22 matrix)publish.yml— triggered byv*tags or manual dispatch; runs full validation thennpm publishvia OIDC trusted publisher
Requires NPM_TOKEN secret set in GitHub repo settings (from npmjs.com Access Tokens, with publish permission scoped to @teskevirtualsystem/jpak).
To publish a release:
npm version patch|minor|major # bumps version + creates git tag
git push --follow-tags # triggers publish workflowIMPORTANT: Never delete an existing git tag that has already been pushed/deployed.
Deleting and re-creating a tag that triggered a publish workflow corrupts the release history
and may break downstream consumers relying on the immutable tag reference.
If npm version already created the tag, push it as-is. If the tag already exists from
a prior deploy, bump to the next version instead of reusing it.
JPAKglobal namespace split intoJPAK.Constants,JPAK.Generics,JPAK.Loader,JPAK.Classes,JPAK.Tools- File loading uses
RangeHTTP headers for partial reads (browser XHR) orfs.readwith offset (Node) - GZIP decompression code forked from JSXGraph, in
jssrc/zip.js - Verbosity controlled via
JPAK.Constants.verbosity(0 error, 3 debug) - C++ build:
makeincpp/produceslibjpak.so(jsoncpp compiled from submodule, no system deps)
node --test test/test.js # run 47 automated tests via node:test (zero dependencies)Six test suites: namespace, utilities, classes, JMS loader, JPAK 1.0 loader, error handling.
Manual browser tests at test/test_jpak.html and test_jms.html.
const/letfor variables,classsyntax for constructors- Native Promises (
.then()/.catch()chains,Promise.reject()for errors) Uint8Arrayutility functions:JPAK.Tools.bytesToString(),JPAK.Tools.stringToBytes(),JPAK.Tools.stringToArrayBuffer()Buffer.alloc()instead of deprecatednew Buffer()lowerCamelCasefor identifiers (except constructor names likeJPKDirectoryEntry,JPKFileEntry)- Git submodule:
cpp/jsoncpp→https://github.com/open-source-parsers/jsoncpp - Target: Node.js >= 18, modern browsers
dist/jpak.js, dist/jpak.min.js, and dist/jpak.mjs are build artifacts. Edit jssrc/*.js and run npm run build.