rdflib 2.3.3 → 2.3.5-1dbb8a1d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/515.rdflib.min.js +1 -1
- package/dist/515.rdflib.min.js.map +1 -1
- package/dist/rdflib.min.js +1 -1
- package/dist/rdflib.min.js.map +1 -1
- package/esm/fetcher.js +12 -3
- package/lib/fetcher.js +12 -3
- package/package.json +20 -20
- package/src/fetcher.ts +12 -3
package/esm/fetcher.js
CHANGED
|
@@ -119,7 +119,7 @@ class RDFXMLHandler extends Handler {
|
|
|
119
119
|
this.dom = Util.parseXML(responseText);
|
|
120
120
|
}
|
|
121
121
|
let root = this.dom.documentElement;
|
|
122
|
-
if (root.nodeName === 'parsererror') {
|
|
122
|
+
if (root && root.nodeName === 'parsererror') {
|
|
123
123
|
// Mozilla only See issue/issue110
|
|
124
124
|
// have to fail the request
|
|
125
125
|
return fetcher.failFetch(options, 'Badly formed XML in ' + options.resource.value, 'parse_error');
|
|
@@ -475,10 +475,19 @@ export default class Fetcher {
|
|
|
475
475
|
this.timeout = options.timeout || 30000;
|
|
476
476
|
|
|
477
477
|
// solidFetcher is deprecated
|
|
478
|
-
|
|
479
|
-
if (!
|
|
478
|
+
let fetchFunc = options.fetch || typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch) || typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch) || crossFetch;
|
|
479
|
+
if (!fetchFunc) {
|
|
480
480
|
throw new Error('No _fetch function available for Fetcher');
|
|
481
481
|
}
|
|
482
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
483
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
484
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
485
|
+
this._fetch = fetchFunc.bind(window);
|
|
486
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
487
|
+
this._fetch = fetchFunc.bind(global);
|
|
488
|
+
} else {
|
|
489
|
+
this._fetch = fetchFunc;
|
|
490
|
+
}
|
|
482
491
|
// This is the name of the graph we store all the HTTP metadata in
|
|
483
492
|
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
484
493
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/lib/fetcher.js
CHANGED
|
@@ -128,7 +128,7 @@ class RDFXMLHandler extends Handler {
|
|
|
128
128
|
this.dom = Util.parseXML(responseText);
|
|
129
129
|
}
|
|
130
130
|
let root = this.dom.documentElement;
|
|
131
|
-
if (root.nodeName === 'parsererror') {
|
|
131
|
+
if (root && root.nodeName === 'parsererror') {
|
|
132
132
|
// Mozilla only See issue/issue110
|
|
133
133
|
// have to fail the request
|
|
134
134
|
return fetcher.failFetch(options, 'Badly formed XML in ' + options.resource.value, 'parse_error');
|
|
@@ -484,10 +484,19 @@ class Fetcher {
|
|
|
484
484
|
this.timeout = options.timeout || 30000;
|
|
485
485
|
|
|
486
486
|
// solidFetcher is deprecated
|
|
487
|
-
|
|
488
|
-
if (!
|
|
487
|
+
let fetchFunc = options.fetch || typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch) || typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch) || _crossFetch.default;
|
|
488
|
+
if (!fetchFunc) {
|
|
489
489
|
throw new Error('No _fetch function available for Fetcher');
|
|
490
490
|
}
|
|
491
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
492
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
493
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
494
|
+
this._fetch = fetchFunc.bind(window);
|
|
495
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
496
|
+
this._fetch = fetchFunc.bind(global);
|
|
497
|
+
} else {
|
|
498
|
+
this._fetch = fetchFunc;
|
|
499
|
+
}
|
|
491
500
|
// This is the name of the graph we store all the HTTP metadata in
|
|
492
501
|
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
493
502
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rdflib",
|
|
3
3
|
"description": "an RDF library for node.js. Suitable for client and server side.",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.5-1dbb8a1d",
|
|
5
5
|
"private": false,
|
|
6
6
|
"browserslist": [
|
|
7
7
|
"> 0.5%"
|
|
@@ -44,51 +44,51 @@
|
|
|
44
44
|
"homepage": "http://github.com/linkeddata/rdflib.js",
|
|
45
45
|
"bugs": "http://github.com/linkeddata/rdflib.js/issues",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@babel/runtime": "^7.28.
|
|
47
|
+
"@babel/runtime": "^7.28.6",
|
|
48
48
|
"@frogcat/ttl2jsonld": "^0.0.10",
|
|
49
49
|
"@rdfjs/types": "^2.0.1",
|
|
50
50
|
"@xmldom/xmldom": "^0.8.11",
|
|
51
51
|
"cross-fetch": "^4.1.0",
|
|
52
52
|
"jsonld": "^9.0.0",
|
|
53
|
-
"n3": "^
|
|
53
|
+
"n3": "^2.0.3",
|
|
54
54
|
"solid-namespace": "^0.5.4"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/cli": "^7.28.
|
|
58
|
-
"@babel/core": "^7.
|
|
57
|
+
"@babel/cli": "^7.28.6",
|
|
58
|
+
"@babel/core": "^7.29.0",
|
|
59
59
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
60
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
60
|
+
"@babel/plugin-transform-runtime": "^7.29.0",
|
|
61
|
+
"@babel/preset-env": "^7.29.0",
|
|
62
62
|
"@babel/preset-typescript": "^7.28.5",
|
|
63
|
-
"@babel/register": "^7.28.
|
|
63
|
+
"@babel/register": "^7.28.6",
|
|
64
64
|
"@types/chai": "^5.2.3",
|
|
65
65
|
"@types/dirty-chai": "^2.0.5",
|
|
66
66
|
"@types/express": "^5.0.6",
|
|
67
67
|
"@types/jsonld": "^1.5.15",
|
|
68
68
|
"@types/mocha": "^10.0.10",
|
|
69
|
-
"@types/node": "^25.0
|
|
69
|
+
"@types/node": "^25.4.0",
|
|
70
70
|
"@types/sinon-chai": "^4.0.0",
|
|
71
|
-
"babel-loader": "^10.
|
|
72
|
-
"chai": "^6.2.
|
|
71
|
+
"babel-loader": "^10.1.1",
|
|
72
|
+
"chai": "^6.2.2",
|
|
73
73
|
"colors": "^1.4.0",
|
|
74
|
-
"diff": "^8.0.
|
|
75
|
-
"eslint": "^9.39.
|
|
76
|
-
"globals": "^
|
|
74
|
+
"diff": "^8.0.3",
|
|
75
|
+
"eslint": "^9.39.4",
|
|
76
|
+
"globals": "^17.4.0",
|
|
77
77
|
"locate-path": "^8.0.0",
|
|
78
78
|
"mocha": "^11.7.5",
|
|
79
|
-
"nock": "^14.0.
|
|
79
|
+
"nock": "^14.0.11",
|
|
80
80
|
"node-fetch": "^3.3.2",
|
|
81
81
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
82
|
-
"rimraf": "^6.1.
|
|
83
|
-
"sinon": "^21.0.
|
|
82
|
+
"rimraf": "^6.1.3",
|
|
83
|
+
"sinon": "^21.0.2",
|
|
84
84
|
"sinon-chai": "^4.0.1",
|
|
85
85
|
"source-map-loader": "^5.0.0",
|
|
86
86
|
"ts-node": "^10.9.2",
|
|
87
|
-
"typedoc": "^0.28.
|
|
87
|
+
"typedoc": "^0.28.17",
|
|
88
88
|
"typescript": "^5.9.3",
|
|
89
|
-
"webpack": "^5.
|
|
89
|
+
"webpack": "^5.105.4",
|
|
90
90
|
"webpack-cli": "^6.0.1",
|
|
91
|
-
"webpack-dev-server": "^5.2.
|
|
91
|
+
"webpack-dev-server": "^5.2.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"build": "babel src --extensions \".ts,.js\" -d lib",
|
package/src/fetcher.ts
CHANGED
|
@@ -235,7 +235,7 @@ class RDFXMLHandler extends Handler {
|
|
|
235
235
|
this.dom = Util.parseXML(responseText)
|
|
236
236
|
}
|
|
237
237
|
let root = this.dom.documentElement
|
|
238
|
-
if (root.nodeName === 'parsererror') { // Mozilla only See issue/issue110
|
|
238
|
+
if (root && root.nodeName === 'parsererror') { // Mozilla only See issue/issue110
|
|
239
239
|
// have to fail the request
|
|
240
240
|
return fetcher.failFetch(options, 'Badly formed XML in ' +
|
|
241
241
|
options.resource!.value, 'parse_error')
|
|
@@ -756,13 +756,22 @@ export default class Fetcher implements CallbackifyInterface {
|
|
|
756
756
|
this.timeout = options.timeout || 30000
|
|
757
757
|
|
|
758
758
|
// solidFetcher is deprecated
|
|
759
|
-
|
|
759
|
+
let fetchFunc = options.fetch
|
|
760
760
|
|| (typeof global !== 'undefined' && (global.solidFetcher || global.solidFetch))
|
|
761
761
|
|| (typeof window !== 'undefined' && (window.solidFetcher || window.solidFetch))
|
|
762
762
|
|| crossFetch
|
|
763
|
-
if (!
|
|
763
|
+
if (!fetchFunc) {
|
|
764
764
|
throw new Error('No _fetch function available for Fetcher')
|
|
765
765
|
}
|
|
766
|
+
// Bind fetch to its context to avoid "Illegal invocation" errors
|
|
767
|
+
// Check if it's the native browser fetch or global fetch that needs binding
|
|
768
|
+
if (typeof window !== 'undefined' && fetchFunc === window.fetch) {
|
|
769
|
+
this._fetch = fetchFunc.bind(window)
|
|
770
|
+
} else if (typeof global !== 'undefined' && fetchFunc === global.fetch) {
|
|
771
|
+
this._fetch = fetchFunc.bind(global)
|
|
772
|
+
} else {
|
|
773
|
+
this._fetch = fetchFunc
|
|
774
|
+
}
|
|
766
775
|
// This is the name of the graph we store all the HTTP metadata in
|
|
767
776
|
this.appNode = this.store.sym('chrome://TheCurrentSession')
|
|
768
777
|
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|