rdflib 2.3.8 → 2.3.9

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.
@@ -58,7 +58,11 @@ export default async function jsonldParser(str, kb, base) {
58
58
  const jsonld = await import('jsonld');
59
59
  // ⚠ Unit tests also work without accessing `jsonld.default` explicitly, but real browser usage will fail with
60
60
  // just calling `jsonld.flatten`, so please do not remove `default`
61
- const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
61
+ // Handle both ESM (browser) and CommonJS (Node.js) module formats
62
+ // Browser ESM: jsonld.default.flatten
63
+ // Node.js CommonJS: jsonld.flatten
64
+ const jsonldLib = jsonld.default || jsonld;
65
+ const flattened = await jsonldLib.flatten(JSON.parse(str), null, {
62
66
  base: baseString
63
67
  });
64
68
  return flattened.reduce((store, flatResource) => processResource(store, base, flatResource), kb);
package/esm/store.js CHANGED
@@ -33,7 +33,6 @@ import Variable from './variable';
33
33
  import { Query, indexedFormulaQuery } from './query';
34
34
  import { BlankNodeTermType, CollectionTermType, DefaultGraphTermType, EmptyTermType, GraphTermType, LiteralTermType, NamedNodeTermType, VariableTermType } from './types';
35
35
  import NamedNode from './named-node';
36
- import { namedNode } from './index';
37
36
  import serialize from "./serialize";
38
37
  import BlankNode from './blank-node';
39
38
  import DefaultGraph from './default-graph';
@@ -247,7 +246,7 @@ export default class IndexedFormula extends Formula {
247
246
  var query = new Query('patch');
248
247
  query.pat = patch.where;
249
248
  query.pat.statements.map(function (st) {
250
- st.graph = namedNode(target.value);
249
+ st.graph = new NamedNode(target.value);
251
250
  });
252
251
  //@ts-ignore TODO: add sync property to Query when converting Query to typescript
253
252
  query.sync = true;
@@ -65,7 +65,11 @@ async function jsonldParser(str, kb, base) {
65
65
  const jsonld = await Promise.resolve().then(() => _interopRequireWildcard(require('jsonld')));
66
66
  // ⚠ Unit tests also work without accessing `jsonld.default` explicitly, but real browser usage will fail with
67
67
  // just calling `jsonld.flatten`, so please do not remove `default`
68
- const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
68
+ // Handle both ESM (browser) and CommonJS (Node.js) module formats
69
+ // Browser ESM: jsonld.default.flatten
70
+ // Node.js CommonJS: jsonld.flatten
71
+ const jsonldLib = jsonld.default || jsonld;
72
+ const flattened = await jsonldLib.flatten(JSON.parse(str), null, {
69
73
  base: baseString
70
74
  });
71
75
  return flattened.reduce((store, flatResource) => processResource(store, base, flatResource), kb);
package/lib/store.js CHANGED
@@ -23,7 +23,6 @@ var _variable = _interopRequireDefault(require("./variable"));
23
23
  var _query = require("./query");
24
24
  var _types = require("./types");
25
25
  var _namedNode = _interopRequireDefault(require("./named-node"));
26
- var _index = require("./index");
27
26
  var _serialize = _interopRequireDefault(require("./serialize"));
28
27
  var _blankNode = _interopRequireDefault(require("./blank-node"));
29
28
  var _defaultGraph = _interopRequireDefault(require("./default-graph"));
@@ -255,7 +254,7 @@ class IndexedFormula extends _formula.default {
255
254
  var query = new _query.Query('patch');
256
255
  query.pat = patch.where;
257
256
  query.pat.statements.map(function (st) {
258
- st.graph = (0, _index.namedNode)(target.value);
257
+ st.graph = new _namedNode.default(target.value);
259
258
  });
260
259
  //@ts-ignore TODO: add sync property to Query when converting Query to typescript
261
260
  query.sync = true;
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.8",
4
+ "version": "2.3.9",
5
5
  "private": false,
6
6
  "browserslist": [
7
7
  "> 0.5%"
@@ -68,27 +68,27 @@
68
68
  "@types/express": "^5.0.6",
69
69
  "@types/jsonld": "^1.5.15",
70
70
  "@types/mocha": "^10.0.10",
71
- "@types/node": "^25.8.0",
71
+ "@types/node": "^25.9.1",
72
72
  "@types/sinon-chai": "^4.0.0",
73
73
  "babel-loader": "^10.1.1",
74
74
  "chai": "^6.2.2",
75
75
  "colors": "^1.4.0",
76
- "diff": "^8.0.4",
77
- "eslint": "^10.3.0",
76
+ "diff": "^9.0.0",
77
+ "eslint": "^10.4.0",
78
78
  "globals": "^17.6.0",
79
79
  "locate-path": "^8.0.0",
80
- "mocha": "^11.7.5",
80
+ "mocha": "^11.7.6",
81
81
  "nock": "^14.0.15",
82
82
  "node-fetch": "^3.3.2",
83
83
  "node-polyfill-webpack-plugin": "^4.1.0",
84
84
  "rimraf": "^6.1.3",
85
- "sinon": "^21.1.2",
85
+ "sinon": "^22.0.0",
86
86
  "sinon-chai": "^4.0.1",
87
87
  "source-map-loader": "^5.0.0",
88
88
  "ts-node": "^10.9.2",
89
89
  "typedoc": "^0.28.19",
90
90
  "typescript": "^5.9.3",
91
- "webpack": "^5.106.2",
91
+ "webpack": "^5.107.1",
92
92
  "webpack-cli": "^7.0.2",
93
93
  "webpack-dev-server": "^5.2.4"
94
94
  },
@@ -71,7 +71,11 @@ export default async function jsonldParser(str, kb, base) {
71
71
  const jsonld = await import('jsonld')
72
72
  // ⚠ Unit tests also work without accessing `jsonld.default` explicitly, but real browser usage will fail with
73
73
  // just calling `jsonld.flatten`, so please do not remove `default`
74
- const flattened = await jsonld.default.flatten(JSON.parse(str), null, {base: baseString})
74
+ // Handle both ESM (browser) and CommonJS (Node.js) module formats
75
+ // Browser ESM: jsonld.default.flatten
76
+ // Node.js CommonJS: jsonld.flatten
77
+ const jsonldLib = jsonld.default || jsonld
78
+ const flattened = await jsonldLib.flatten(JSON.parse(str), null, {base: baseString})
75
79
  return flattened.reduce((store, flatResource) => processResource(store, base, flatResource), kb)
76
80
  }
77
81
 
package/src/store.ts CHANGED
@@ -53,7 +53,6 @@ import {
53
53
  Quad_Subject,
54
54
  Term,
55
55
  } from './tf-types'
56
- import { namedNode } from './index'
57
56
  import serialize from "./serialize";
58
57
  import BlankNode from './blank-node'
59
58
  import DefaultGraph from './default-graph'
@@ -315,7 +314,7 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
315
314
  var query = new Query('patch')
316
315
  query.pat = patch.where
317
316
  query.pat.statements.map(function (st) {
318
- st.graph = namedNode(target.value)
317
+ st.graph = new NamedNode(target.value)
319
318
  })
320
319
  //@ts-ignore TODO: add sync property to Query when converting Query to typescript
321
320
  query.sync = true