Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down