@rdfjs/serializer-jsonld
Advanced tools
Comparing version 1.2.3 to 2.0.0
@@ -1,3 +0,3 @@ | ||
const SerializerStream = require('./lib/SerializerStream') | ||
const Sink = require('@rdfjs/sink') | ||
import Sink from '@rdfjs/sink' | ||
import SerializerStream from './lib/SerializerStream.js' | ||
@@ -10,2 +10,2 @@ class Serializer extends Sink { | ||
module.exports = Serializer | ||
export default Serializer |
@@ -17,2 +17,2 @@ class ObjectEncoder { | ||
module.exports = ObjectEncoder | ||
export default ObjectEncoder |
@@ -1,4 +0,4 @@ | ||
const Readable = require('readable-stream') | ||
const ObjectEncoder = require('./ObjectEncoder') | ||
const StringEncoder = require('./StringEncoder') | ||
import { Readable } from 'readable-stream' | ||
import ObjectEncoder from './ObjectEncoder.js' | ||
import StringEncoder from './StringEncoder.js' | ||
@@ -73,2 +73,2 @@ class SerializerStream extends Readable { | ||
module.exports = SerializerStream | ||
export default SerializerStream |
@@ -25,2 +25,2 @@ class StringEncoder { | ||
module.exports = StringEncoder | ||
export default StringEncoder |
{ | ||
"name": "@rdfjs/serializer-jsonld", | ||
"version": "1.2.3", | ||
"description": "JSON-LD serializer that implements the RDFJS Sink interface", | ||
"version": "2.0.0", | ||
"description": "JSON-LD serializer that implements the RDF/JS Sink interface", | ||
"type": "module", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard && mocha" | ||
"test": "stricter-standard && c8 --reporter=lcov --reporter=text mocha" | ||
}, | ||
@@ -26,12 +27,14 @@ "repository": { | ||
"dependencies": { | ||
"@rdfjs/namespace": "^1.1.0", | ||
"@rdfjs/sink": "^1.0.3", | ||
"readable-stream": "^3.6.0" | ||
"@rdfjs/sink": "^2.0.0", | ||
"readable-stream": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"@rdfjs/data-model": "^1.2.0", | ||
"get-stream": "^6.0.1", | ||
"mocha": "^8.4.0", | ||
"standard": "^16.0.3" | ||
"@rdfjs/data-model": "^2.0.1", | ||
"@rdfjs/namespace": "^2.0.0", | ||
"assert": "^2.0.0", | ||
"c8": "^7.12.0", | ||
"mocha": "^10.0.0", | ||
"stream-chunks": "^1.0.0", | ||
"stricter-standard": "^0.2.0" | ||
} | ||
} |
# @rdfjs/serializer-jsonld | ||
[![Build Status](https://travis-ci.org/rdfjs/serializer-jsonld.svg?branch=master)](https://travis-ci.org/rdfjs/serializer-jsonld) | ||
[![build status](https://img.shields.io/github/workflow/status/rdfjs-base/serializer-jsonld/Test)](https://github.com/rdfjs-base/serializer-jsonld/actions/workflows/test.yaml) | ||
[![npm version](https://img.shields.io/npm/v/@rdfjs/serializer-jsonld.svg)](https://www.npmjs.com/package/@rdfjs/serializer-jsonld) | ||
JSON-LD serializer that implements the [RDFJS Sink interface](http://rdf.js.org/). | ||
JSON-LD serializer that implements the [RDF/JS Sink interface](http://rdf.js.org/). | ||
@@ -12,3 +10,3 @@ ## Usage | ||
The package exports the serializer as a class, so an instance must be created before it can be used. | ||
The `.import` method, as defined in the [RDFJS specification](http://rdf.js.org/#sink-interface), must be called to do the actual serialization. | ||
The `.import` method, as defined in the [RDF/JS specification](http://rdf.js.org/#sink-interface), must be called to do the actual serialization. | ||
It expects a quad stream as argument. | ||
@@ -32,5 +30,5 @@ The method will return a stream which emits the JSON-LD as a plain object or string. | ||
```javascript | ||
const rdf = require('@rdfjs/data-model') | ||
const Readable = require('stream').Readable | ||
const SerializerJsonld = require('@rdfjs/serializer-jsonld') | ||
import rdf from '@rdfjs/data-model' | ||
import { Readable } from 'readable-stream' | ||
import SerializerJsonld from '@rdfjs/serializer-jsonld' | ||
@@ -37,0 +35,0 @@ const serializerJsonld = new SerializerJsonld() |
@@ -1,6 +0,9 @@ | ||
const namespace = require('@rdfjs/namespace') | ||
import namespace from '@rdfjs/namespace' | ||
module.exports = { | ||
ex: namespace('http://example.org/'), | ||
rdf: namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') | ||
const ex = namespace('http://example.org/') | ||
const rdf = namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') | ||
export { | ||
ex, | ||
rdf | ||
} |
@@ -1,9 +0,10 @@ | ||
const { deepStrictEqual, throws } = require('assert') | ||
const rdf = require('@rdfjs/data-model') | ||
const sinkTest = require('@rdfjs/sink/test') | ||
const getStream = require('get-stream') | ||
const { describe, it } = require('mocha') | ||
const Readable = require('readable-stream') | ||
const ns = require('./support/namespaces') | ||
const JsonLdSerializer = require('..') | ||
import { deepStrictEqual, throws } from 'assert' | ||
import rdf from '@rdfjs/data-model' | ||
import sinkTest from '@rdfjs/sink/test/index.js' | ||
import { describe, it } from 'mocha' | ||
import { Readable } from 'readable-stream' | ||
import chunks from 'stream-chunks/chunks.js' | ||
import decode from 'stream-chunks/decode.js' | ||
import JsonLdSerializer from '../index.js' | ||
import * as ns from './support/namespaces.js' | ||
@@ -22,3 +23,3 @@ describe('@rdfjs/serializer-jsonld', () => { | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -37,3 +38,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -52,3 +53,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -69,3 +70,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -86,3 +87,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -101,3 +102,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -119,3 +120,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -137,3 +138,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -156,3 +157,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -181,3 +182,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -200,3 +201,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream.array(serializer.import(input)) | ||
const content = await chunks(serializer.import(input)) | ||
@@ -219,3 +220,3 @@ deepStrictEqual(content[0], jsonld) | ||
const content = await getStream(serializer.import(input)) | ||
const content = await decode(serializer.import(input)) | ||
@@ -222,0 +223,0 @@ deepStrictEqual(JSON.parse(content), jsonld) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14126
2
289
Yes
7
58
+ Added@rdfjs/sink@2.0.1(transitive)
+ Addedabort-controller@3.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedreadable-stream@4.7.0(transitive)
- Removed@rdfjs/namespace@^1.1.0
- Removed@rdfjs/data-model@1.3.4(transitive)
- Removed@rdfjs/namespace@1.1.0(transitive)
- Removed@rdfjs/sink@1.0.3(transitive)
- Removed@rdfjs/types@2.0.1(transitive)
- Removed@types/node@22.10.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updated@rdfjs/sink@^2.0.0
Updatedreadable-stream@^4.2.0