rdfa-streaming-parser 1.3.0 → 2.0.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RDFa Streaming Parser
2
2
 
3
- [![Build Status](https://travis-ci.org/rubensworks/rdfa-streaming-parser.js.svg?branch=master)](https://travis-ci.org/rubensworks/rdfa-streaming-parser.js)
3
+ [![Build status](https://github.com/rubensworks/rdfa-streaming-parser.js/workflows/CI/badge.svg)](https://github.com/rubensworks/rdfa-streaming-parser.js/actions?query=workflow%3ACI)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/rubensworks/rdfa-streaming-parser.js/badge.svg?branch=master)](https://coveralls.io/github/rubensworks/rdfa-streaming-parser.js?branch=master)
5
5
  [![npm version](https://badge.fury.io/js/rdfa-streaming-parser.svg)](https://www.npmjs.com/package/rdfa-streaming-parser)
6
6
 
package/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,4 +1,4 @@
1
- import * as RDF from "rdf-js";
1
+ import * as RDF from "@rdfjs/types";
2
2
  import { IRdfaPattern } from "./IRdfaPattern";
3
3
  /**
4
4
  * Data holder for the RDFa state in XML tags.
@@ -1,4 +1,4 @@
1
- import * as RDF from "rdf-js";
1
+ import * as RDF from "@rdfjs/types";
2
2
  import { IActiveTag } from "./IActiveTag";
3
3
  /**
4
4
  * A datastructure for storing an rdfa:Pattern.
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter = NodeJS.EventEmitter;
3
3
  import { Parser as HtmlParser } from "htmlparser2";
4
- import * as RDF from "rdf-js";
5
- import { Transform, TransformCallback } from "stream";
4
+ import * as RDF from "@rdfjs/types";
5
+ import { Transform } from "readable-stream";
6
6
  import { IActiveTag } from "./IActiveTag";
7
7
  import { IHtmlParseListener } from "./IHtmlParseListener";
8
8
  import { IRdfaPattern } from "./IRdfaPattern";
@@ -27,8 +27,8 @@ export declare class RdfaParser extends Transform implements RDF.Sink<EventEmitt
27
27
  * @return {RDF.Stream} A quad stream.
28
28
  */
29
29
  import(stream: EventEmitter): RDF.Stream;
30
- _transform(chunk: any, encoding: string, callback: TransformCallback): void;
31
- _flush(callback: TransformCallback): void;
30
+ _transform(chunk: any, encoding: string, callback: (error?: Error | null, data?: any) => void): void;
31
+ _flush(callback: (error?: Error | null, data?: any) => void): void;
32
32
  onTagOpen(name: string, attributes: {
33
33
  [s: string]: string;
34
34
  }): void;
package/lib/RdfaParser.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RdfaParser = void 0;
4
4
  const htmlparser2_1 = require("htmlparser2");
5
- const stream_1 = require("stream");
5
+ const readable_stream_1 = require("readable-stream");
6
6
  const INITIAL_CONTEXT_XHTML = require("./initial-context-xhtml.json");
7
7
  const INITIAL_CONTEXT = require("./initial-context.json");
8
8
  const RdfaProfile_1 = require("./RdfaProfile");
@@ -10,7 +10,7 @@ const Util_1 = require("./Util");
10
10
  /**
11
11
  * A stream transformer that parses RDFa (text) streams to an {@link RDF.Stream}.
12
12
  */
13
- class RdfaParser extends stream_1.Transform {
13
+ class RdfaParser extends readable_stream_1.Transform {
14
14
  constructor(options) {
15
15
  super({ readableObjectMode: true });
16
16
  this.activeTagStack = [];
@@ -43,7 +43,7 @@ class RdfaParser extends stream_1.Transform {
43
43
  * @return {RDF.Stream} A quad stream.
44
44
  */
45
45
  import(stream) {
46
- const output = new stream_1.PassThrough({ readableObjectMode: true });
46
+ const output = new readable_stream_1.PassThrough({ readableObjectMode: true });
47
47
  stream.on('error', (error) => parsed.emit('error', error));
48
48
  stream.on('data', (data) => output.push(data));
49
49
  stream.on('end', () => output.push(null));
@@ -51,7 +51,7 @@ class RdfaParser extends stream_1.Transform {
51
51
  return parsed;
52
52
  }
53
53
  _transform(chunk, encoding, callback) {
54
- this.parser.write(chunk);
54
+ this.parser.write(chunk.toString());
55
55
  callback();
56
56
  }
57
57
  _flush(callback) {
package/lib/Util.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as RDF from "rdf-js";
1
+ import * as RDF from "@rdfjs/types";
2
2
  import { IActiveTag } from "./IActiveTag";
3
3
  import { RdfaProfile } from "./RdfaProfile";
4
4
  /**
package/lib/Util.js CHANGED
@@ -107,7 +107,7 @@ class Util {
107
107
  if (fragmentIndex >= 0) {
108
108
  href = href.substr(0, fragmentIndex);
109
109
  }
110
- return this.dataFactory.namedNode(relative_to_absolute_iri_1.resolve(href, this.baseIRI.value));
110
+ return this.dataFactory.namedNode((0, relative_to_absolute_iri_1.resolve)(href, this.baseIRI.value));
111
111
  }
112
112
  /**
113
113
  * If the term is a boolean, return the baseIRI, otherwise return the term as-is.
@@ -163,7 +163,7 @@ class Util {
163
163
  term = term || '';
164
164
  if (!allowSafeCurie) {
165
165
  if (!vocab) {
166
- term = relative_to_absolute_iri_1.resolve(term, this.getBaseIriTerm(activeTag).value);
166
+ term = (0, relative_to_absolute_iri_1.resolve)(term, this.getBaseIriTerm(activeTag).value);
167
167
  }
168
168
  if (!Util.isValidIri(term)) {
169
169
  return null;
@@ -192,10 +192,10 @@ class Util {
192
192
  let iri = Util.expandPrefixedTerm(term, activeTag);
193
193
  // Resolve against baseIRI if in base-mode, or if the term was a prefixed relative IRI
194
194
  if (!vocab) {
195
- iri = relative_to_absolute_iri_1.resolve(iri, this.getBaseIriTerm(activeTag).value);
195
+ iri = (0, relative_to_absolute_iri_1.resolve)(iri, this.getBaseIriTerm(activeTag).value);
196
196
  }
197
197
  else if (term !== iri) {
198
- iri = relative_to_absolute_iri_1.resolve(iri, this.baseIRIDocument.value);
198
+ iri = (0, relative_to_absolute_iri_1.resolve)(iri, this.baseIRIDocument.value);
199
199
  }
200
200
  if (!Util.isValidIri(iri)) {
201
201
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdfa-streaming-parser",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "A fast and lightweight streaming RDFa parser",
5
5
  "keywords": [
6
6
  "rdfa",
@@ -28,10 +28,11 @@
28
28
  "index.js"
29
29
  ],
30
30
  "dependencies": {
31
- "@types/rdf-js": "*",
32
- "rdf-data-factory": "^1.0.2",
33
- "htmlparser2": "^4.0.0",
34
- "relative-to-absolute-iri": "^1.0.2"
31
+ "@rdfjs/types": "*",
32
+ "htmlparser2": "^8.0.0",
33
+ "rdf-data-factory": "^1.1.0",
34
+ "relative-to-absolute-iri": "^1.0.2",
35
+ "readable-stream": "^4.0.0"
35
36
  },
36
37
  "pre-commit": [
37
38
  "build",
@@ -39,29 +40,31 @@
39
40
  "test"
40
41
  ],
41
42
  "devDependencies": {
42
- "@types/rdf-js": "^4.0.0",
43
- "@types/jest": "^26.0.0",
43
+ "@types/jest": "^28.0.0",
44
44
  "@types/jest-each": "^24.3.0",
45
- "@types/node": "^13.1.0",
46
- "arrayify-stream": "^1.0.0",
45
+ "@types/readable-stream": "^2.3.14",
46
+ "arrayify-stream": "^2.0.0",
47
47
  "coveralls": "^3.0.0",
48
- "jest": "^26.0.0",
49
- "jest-each": "^26.0.0",
50
- "jest-rdf": "^1.6.0",
48
+ "jest": "^28.0.0",
49
+ "jest-each": "^28.0.0",
50
+ "jest-rdf": "^1.7.0",
51
51
  "manual-git-changelog": "^1.0.1",
52
52
  "pre-commit": "^1.2.2",
53
- "rdf-test-suite": "^1.13.4",
54
53
  "rdf-quad": "^1.5.0",
54
+ "rdf-test-suite": "^1.13.4",
55
55
  "streamify-string": "^1.0.1",
56
- "ts-jest": "^26.0.0",
56
+ "ts-jest": "^28.0.0",
57
+ "ts-loader": "^9.3.1",
57
58
  "tslint": "^6.0.0",
58
59
  "tslint-eslint-rules": "^5.3.1",
59
- "typescript": "^4.0.0"
60
+ "typescript": "^4.0.0",
61
+ "webpack": "^5.73.0",
62
+ "webpack-cli": "^4.10.0"
60
63
  },
61
64
  "jest": {
62
65
  "globals": {
63
66
  "ts-jest": {
64
- "tsConfig": "test/tsconfig.json"
67
+ "tsconfig": "test/tsconfig.json"
65
68
  }
66
69
  },
67
70
  "setupFilesAfterEnv": [
@@ -124,7 +127,5 @@
124
127
  "spec-1-xml-earl": "rdf-test-suite spec/parser.js http://rdfa.info/test-suite/test-cases/rdfa1.0/xml/manifest.ttl -i '{ \"profile\": \"xml\" }' -c .rdf-test-suite-cache/ -o earl -p spec/earl-meta.json > spec/earl-1-rdfastreamingparser-xml.ttl",
125
128
  "spec-clean": "rm -r .rdf-test-suite-cache/"
126
129
  },
127
- "resolutions": {
128
- "@types/rdf-js": "^4.0.0"
129
- }
130
+ "sideEffects": false
130
131
  }
package/CHANGELOG.md DELETED
@@ -1,53 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- <a name="v1.3.0"></a>
5
- ## [v1.3.0](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.2.2...v1.3.0) - 2020-09-15
6
-
7
- ### Changed
8
- * [Migrate to rdf-data-factory](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/0552eb287b228cdfa305070803f9dd176041bbe0)
9
-
10
- ### Fixed
11
- * [Fix import method sometimes failing on large streams](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/93c8f5f7d002d05bf5e23fa2c3fa5c97d6ac88d3)
12
-
13
- <a name="v1.2.2"></a>
14
- ## [v1.2.2](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.2.0...v1.2.2) - 2020-06-03
15
-
16
- ### Fixed
17
- * [Fix incompatibility with WhatWG streams](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/8b7964eb24f70b23f0c5811b730b752e95d3695d)
18
-
19
- ### Changed
20
- * [Update dependency @types/rdf-js to v3, Closes #17](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/4c45c2f3b41146934678c6c9e53b29afcd5c440c)
21
-
22
- <a name="v1.2.1"></a>
23
- ## [v1.2.1](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.2.0...v1.2.1) - 2020-03-28
24
-
25
- ### Fixed
26
- * [Fix crash on relative base tag values](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/e564188e5fb41cbbbbfd78ff1269e1e57959ef86)
27
- * [Properly delegate errors from listeners to the stream](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/730201ce16bc27b80ca046da015d48ce77b8ee8d)
28
-
29
- <a name="v1.2.0"></a>
30
- ## [v1.2.0](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.1.1...v1.2.0) - 2020-01-27
31
-
32
- ### Added
33
- * [Add typings for RDF.Sink implementation, Closes #9](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/ee48998a0426b41a0a88a61d523273f719c12d05)
34
-
35
- ### Changed
36
- * [Make implementation more strongly typed](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/e0fb225419a350d8fd5cb6e759800bc673f3b327)
37
-
38
- <a name="v1.1.1"></a>
39
- ## [v1.1.1](https://github.com/rubensworks/rdfa-streaming-parser.js/compare/v1.1.0...v1.1.1) - 2019-08-07
40
-
41
- ### Changed
42
- * [Update to htmlparser2 4.x.x, Closes #5](https://github.com/rubensworks/rdfa-streaming-parser.js/commit/f1c950a956ac33c7cbd570b5df3f521ca02b2eeb)
43
-
44
- <a name="v1.1.0"></a>
45
- ## [v1.1.0](https://github.com/rubensworks/streaming-rdfa-parser.js/compare/v1.0.0...v1.1.0) - 2019-07-16
46
-
47
- ### Fixed
48
- * [Fix inner HTML parser not being ended properly](https://github.com/rubensworks/streaming-rdfa-parser.js/commit/f9c3b443d46f15d327c3661507e28b91b9d16abf)
49
-
50
- <a name="v1.0.0"></a>
51
- ## [v1.0.0] - 2019-07-08
52
-
53
- Initial release