This is a version of jsonld.js in ES.next, with the goal of making it as small as possible while still supporting the test suite.
uglifyjs ./node_modules/jsonld/js/jsonld.js -o jsonld.old.min.js
=> 120,758 B
rollup -c rollup.config.browser.js
=> 90,357 B
Further enhancements over jsonld.js:
- Runs
setImmediate
at "full speed" in all modern browsers and Node via setImmediate polyfill - Enables http caching in Node.js via superagent-cache. superagent-cache is not used in the browser, because browsers natively support http caching.
git clone https://github.com/ariutta/jsonld-next.git
cd jsonld-next
npm install
You can re-run the build step at any time, if you choose:
npm run build
Clone the following two repos as sibling directories of the directory for your local jsonld-next
repo:
git clone https://github.com/json-ld/normalization.git
git clone https://github.com/json-ld/json-ld.org.git
Currently only passes automated tests for Node. There is a problem with the browser tests. So here's a temporary workaround.
npm test-node
You can see it working in the browser:
http-server
Then visit http://localhost:8080/ and open the browser console to see it running every fully fleshed-out example from the jsonld.js README.
The following doesn't work at the moment because of the browser tests:
Then run the tests: npm test
If you're on Windows, you may need to instead run: npm run test-windows
cd jsonld-next
mv package.json package.prod.json
mv package.latest.json package.json
rm -rf node_modules/jsonld
npm install
rm -rf ../jsonld.js/lib/*
cp ./lib/* ../jsonld.js/lib/*
cp ./dist/esnext/* ../jsonld.js/lib/*
Compare rollup.config.js, rollup.config.browser.js, rollup.config.node.js
cd ../jsonld.js
npm run build
Go back to production in jsonld-next
cd ../jsonld-next
mv package.json package.latest.json
mv package.prod.json package.json
rm -rf node_modules/jsonld
npm install