Socket
Socket
Sign inDemoInstall

rdfa-streaming-parser

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdfa-streaming-parser - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

9

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
<a name="v1.2.0"></a>
## [v1.2.0](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.1.1...v1.2.0) - 2020-01-27
### Added
* [Add typings for RDF.Sink implementation, Closes #9](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/ee48998a0426b41a0a88a61d523273f719c12d05)
### Changed
* [Make implementation more strongly typed](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/e0fb225419a350d8fd5cb6e759800bc673f3b327)
<a name="v1.1.1"></a>

@@ -5,0 +14,0 @@ ## [v1.1.1](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.1.0...v1.1.1) - 2019-08-07

8

lib/IActiveTag.d.ts

@@ -14,6 +14,6 @@ import * as RDF from "rdf-js";

};
subject?: RDF.Term | boolean;
subject?: RDF.NamedNode | RDF.BlankNode | boolean;
explicitNewSubject?: boolean;
predicates?: RDF.Term[];
object?: RDF.Term | boolean;
predicates?: RDF.NamedNode[];
object?: RDF.NamedNode | RDF.BlankNode | boolean;
text?: string[];

@@ -27,3 +27,3 @@ vocab?: string;

incompleteTriples?: {
predicate: RDF.Term;
predicate: RDF.Quad_Predicate;
reverse: boolean;

@@ -30,0 +30,0 @@ list?: boolean;

@@ -13,3 +13,3 @@ /// <reference types="node" />

*/
export declare class RdfaParser extends Transform {
export declare class RdfaParser extends Transform implements RDF.Sink<EventEmitter, RDF.Stream> {
private readonly options;

@@ -28,5 +28,5 @@ private readonly util;

* @param {NodeJS.EventEmitter} stream A text stream.
* @return {NodeJS.EventEmitter} A quad stream.
* @return {RDF.Stream} A quad stream.
*/
import(stream: EventEmitter): EventEmitter;
import(stream: EventEmitter): RDF.Stream;
_transform(chunk: any, encoding: string, callback: TransformCallback): void;

@@ -55,3 +55,3 @@ _flush(callback: TransformCallback): void;

*/
protected addListMapping(activeTag: IActiveTag, subject: RDF.Term | boolean, predicate: RDF.Term, currentObjectResource: RDF.Term | boolean): void;
protected addListMapping(activeTag: IActiveTag, subject: RDF.Quad_Subject | boolean, predicate: RDF.Quad_Predicate, currentObjectResource: RDF.Quad_Object | boolean): void;
/**

@@ -63,3 +63,3 @@ * Emit the given triple to the stream.

*/
protected emitTriple(subject: RDF.Term, predicate: RDF.Term, object: RDF.Term): void;
protected emitTriple(subject: RDF.Quad_Subject, predicate: RDF.Quad_Predicate, object: RDF.Quad_Object): void;
/**

@@ -105,3 +105,3 @@ * Emit an instantiation of the given pattern with the given parent tag.

*/
defaultGraph?: RDF.Term;
defaultGraph?: RDF.Quad_Graph;
/**

@@ -108,0 +108,0 @@ * A hash of features that should be enabled.

@@ -33,3 +33,3 @@ "use strict";

name: '',
prefixesAll: Object.assign({}, INITIAL_CONTEXT['@context'], this.features.xhtmlInitialContext ? INITIAL_CONTEXT_XHTML['@context'] : {}),
prefixesAll: Object.assign(Object.assign({}, INITIAL_CONTEXT['@context']), this.features.xhtmlInitialContext ? INITIAL_CONTEXT_XHTML['@context'] : {}),
prefixesCustom: {},

@@ -43,3 +43,3 @@ skipElement: false,

* @param {NodeJS.EventEmitter} stream A text stream.
* @return {NodeJS.EventEmitter} A quad stream.
* @return {RDF.Stream} A quad stream.
*/

@@ -71,3 +71,3 @@ import(stream) {

if (parentTagI !== this.activeTagStack.length - 1) {
parentTag = Object.assign({}, parentTag, { language: this.activeTagStack[this.activeTagStack.length - 1].language, prefixesAll: this.activeTagStack[this.activeTagStack.length - 1].prefixesAll, prefixesCustom: this.activeTagStack[this.activeTagStack.length - 1].prefixesCustom, vocab: this.activeTagStack[this.activeTagStack.length - 1].vocab });
parentTag = Object.assign(Object.assign({}, parentTag), { language: this.activeTagStack[this.activeTagStack.length - 1].language, prefixesAll: this.activeTagStack[this.activeTagStack.length - 1].prefixesAll, prefixesCustom: this.activeTagStack[this.activeTagStack.length - 1].prefixesCustom, vocab: this.activeTagStack[this.activeTagStack.length - 1].vocab });
}

@@ -200,3 +200,3 @@ // Create a new active tag and inherit language scope and baseIRI from parent

activeTag.prefixesAll = Object.keys(activeTag.prefixesCustom).length > 0
? Object.assign({}, parentTag.prefixesAll, activeTag.prefixesCustom) : parentTag.prefixesAll;
? Object.assign(Object.assign({}, parentTag.prefixesAll), activeTag.prefixesCustom) : parentTag.prefixesAll;
// Handle role attribute

@@ -203,0 +203,0 @@ if (this.features.roleAttribute && attributes.role) {

@@ -65,3 +65,3 @@ import * as RDF from "rdf-js";

*/
getResourceOrBaseIri(term: RDF.Term | boolean, activeTag: IActiveTag): RDF.Term;
getResourceOrBaseIri(term: RDF.Term | boolean, activeTag: IActiveTag): RDF.NamedNode;
/**

@@ -81,3 +81,3 @@ * Get the active base IRI as an RDF term.

*/
createVocabIris(terms: string, activeTag: IActiveTag, allowTerms: boolean, allowBlankNode: boolean): RDF.Term[];
createVocabIris<B extends boolean>(terms: string, activeTag: IActiveTag, allowTerms: boolean, allowBlankNode: B): B extends true ? (RDF.BlankNode | RDF.NamedNode)[] : RDF.NamedNode[];
/**

@@ -108,3 +108,3 @@ * Create a new literal node.

*/
createIri(term: string, activeTag: IActiveTag, vocab: boolean, allowSafeCurie: boolean, allowBlankNode: boolean): RDF.Term;
createIri<B extends boolean>(term: string, activeTag: IActiveTag, vocab: boolean, allowSafeCurie: boolean, allowBlankNode: B): B extends true ? (RDF.NamedNode | RDF.BlankNode) : RDF.NamedNode;
}

@@ -31,3 +31,3 @@ "use strict";

if (attributes.prefix || Object.keys(additionalPrefixes).length > 0) {
const prefixes = Object.assign({}, parentPrefixes, additionalPrefixes);
const prefixes = Object.assign(Object.assign({}, parentPrefixes), additionalPrefixes);
if (attributes.prefix) {

@@ -128,10 +128,2 @@ let prefixMatch;

}
/**
* Create vocab terms for the given terms attribute.
* @param {string} terms An attribute value.
* @param {IActiveTag} activeTag The current active tag.
* @param {boolean} allowTerms If terms are allowed (strings without ':')
* @param {boolean} allowBlankNode If blank nodes are allowed.
* @return {Term[]} The IRI terms.
*/
createVocabIris(terms, activeTag, allowTerms, allowBlankNode) {

@@ -170,15 +162,2 @@ return terms.split(/\s+/)

}
/**
* Create a named node for the given term.
* This will take care of prefix detection.
* @param {string} term A term string (CURIE or IRI, aka safe-CURIE in RDFa spec).
* @param {IActiveTag} activeTag The current active tag.
* @param {boolean} vocab If creating an IRI in vocab-mode (based on vocab IRI),
* or in base-mode (based on base IRI).
* @param {boolean} allowSafeCurie If safe CURIEs are allowed
* (invalid CURIEs between square brackets will return null)
* Otherwise, only IRIs are allowed.
* @param {boolean} allowBlankNode If blank nodes are allowed. Otherwise null will be returned.
* @return {Term} An RDF term or null.
*/
createIri(term, activeTag, vocab, allowSafeCurie, allowBlankNode) {

@@ -228,2 +207,3 @@ term = term || '';

}
exports.Util = Util;
Util.RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';

@@ -248,3 +228,2 @@ Util.XSD = 'http://www.w3.org/2001/XMLSchema#';

Util.IRI_REGEX = /^([A-Za-z][A-Za-z0-9+-.]*|_):[^ "<>{}|\\\[\]`]*$/;
exports.Util = Util;
//# sourceMappingURL=Util.js.map
{
"name": "rdfa-streaming-parser",
"version": "1.1.1",
"version": "1.2.0",
"description": "A fast and lightweight streaming RDFa parser",

@@ -32,3 +32,3 @@ "keywords": [

"@rdfjs/data-model": "^1.1.1",
"@types/rdf-js": "^2.0.1",
"@types/rdf-js": "^2.0.10",
"htmlparser2": "^4.0.0",

@@ -44,8 +44,8 @@ "relative-to-absolute-iri": "^1.0.2"

"@types/jest": "^24.0.1",
"@types/jest-each": "^0.3.4",
"@types/node": "^12.6.8",
"@types/jest-each": "^24.3.0",
"@types/node": "^13.1.0",
"arrayify-stream": "^1.0.0",
"coveralls": "^3.0.0",
"jest": "^24.3.0",
"jest-each": "^24.3.0",
"jest-each": "^25.1.0",
"jest-rdf": "^1.3.0",

@@ -52,0 +52,0 @@ "manual-git-changelog": "^1.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc