Skip to content

Move platform code to index so that lib/jsonld is platform-independent #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -5,4 +5,8 @@
*
* Copyright 2010-2021 Digital Bazaar, Inc.
*/
module.exports = require('./jsonld');
const platform = require('./platform');
const jsonld = require('./jsonld');
platform.setupGlobals(jsonld);
platform.setupDocumentLoaders(jsonld);
module.exports = jsonld;
4 changes: 0 additions & 4 deletions lib/jsonld.js
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
const canonize = require('rdf-canonize');
const platform = require('./platform');
const util = require('./util');
const ContextResolver = require('./ContextResolver');
const IdentifierIssuer = util.IdentifierIssuer;
@@ -1024,9 +1023,6 @@ jsonld.RequestQueue = require('./RequestQueue');
/* WebIDL API */
jsonld.JsonLdProcessor = require('./JsonLdProcessor')(jsonld);

platform.setupGlobals(jsonld);
platform.setupDocumentLoaders(jsonld);

function _setDefaults(options, {
documentLoader = jsonld.documentLoader,
...defaults
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@
]
},
"browser": {
"./lib/index.js": "./lib/jsonld.js",
"./lib/index.js": "./lib/index.js",
"./lib/platform.js": "./lib/platform-browser.js",
"crypto": false,
"http": false,