This repository has been archived by the owner on Feb 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
ldf-client.js
42 lines (38 loc) · 1.74 KB
/
ldf-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*! @license MIT ©2013-2016 Ruben Verborgh, Ghent University - imec */
/* Main ldf-client module exports. */
// Replace local `require` by a lazy loader,
// so we can keep `require` calls for static analyzers such as browserify
var globalRequire = require;
require = function (path) { return function () { return require(path); } };
// Temporarily set lazy initializers as exports
var exports = module.exports = {
SparqlIterator: require('./lib/sparql/SparqlIterator.js'),
FragmentsClient: require('./lib/triple-pattern-fragments/federated/FederatedFragmentsClient'),
Logger: require('./lib/util/Logger'),
HttpClient: require('./lib/util/HttpClient'),
SparqlResultWriter: function () {
var SparqlResultWriter = require('./lib/writers/SparqlResultWriter');
SparqlResultWriter.register('application/json', './JSONResultWriter');
SparqlResultWriter.register('application/sparql-results+json', './SparqlJSONResultWriter');
SparqlResultWriter.register('application/sparql-results+xml', './SparqlXMLResultWriter');
SparqlResultWriter.register('debug', './StatsResultWriter');
SparqlResultWriter.register('simple', './SimpleResultWriter');
SparqlResultWriter.register('table', './TableResultWriter');
return SparqlResultWriter;
},
};
// Replace exports by properties that load on demand
Object.keys(exports).forEach(function (submodule) {
var loadSubmodule = exports[submodule];
Object.defineProperty(exports, submodule, {
configurable: true,
enumerable: true,
get: function () {
// Replace the (currently executing) lazy property handler by the actual module
delete exports[submodule];
return exports[submodule] = loadSubmodule();
},
});
});
// Restore original require
require = globalRequire;