Giter Site home page Giter Site logo

jsonld-slim's Introduction

jsonld-next

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.

Installation

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

Testing (doesn't work for new yet)

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

TEMPORARY WORKAROUND

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.

WHAT IS SUPPOSED TO WORK

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

Transfer to jsonld.js

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

jsonld-slim's People

Contributors

ariutta avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.