rdfa-streaming-parser 1.5.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/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];
@@ -2,7 +2,7 @@
2
2
  import EventEmitter = NodeJS.EventEmitter;
3
3
  import { Parser as HtmlParser } from "htmlparser2";
4
4
  import * as RDF from "@rdfjs/types";
5
- import { Transform, TransformCallback } from "stream";
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.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.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "A fast and lightweight streaming RDFa parser",
5
5
  "keywords": [
6
6
  "rdfa",
@@ -29,9 +29,10 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@rdfjs/types": "*",
32
- "htmlparser2": "^6.0.0",
32
+ "htmlparser2": "^8.0.0",
33
33
  "rdf-data-factory": "^1.1.0",
34
- "relative-to-absolute-iri": "^1.0.2"
34
+ "relative-to-absolute-iri": "^1.0.2",
35
+ "readable-stream": "^4.0.0"
35
36
  },
36
37
  "pre-commit": [
37
38
  "build",
@@ -39,28 +40,31 @@
39
40
  "test"
40
41
  ],
41
42
  "devDependencies": {
42
- "@types/jest": "^26.0.0",
43
+ "@types/jest": "^28.0.0",
43
44
  "@types/jest-each": "^24.3.0",
44
- "@types/node": "^13.1.0",
45
- "arrayify-stream": "^1.0.0",
45
+ "@types/readable-stream": "^2.3.14",
46
+ "arrayify-stream": "^2.0.0",
46
47
  "coveralls": "^3.0.0",
47
- "jest": "^26.0.0",
48
- "jest-each": "^26.0.0",
48
+ "jest": "^28.0.0",
49
+ "jest-each": "^28.0.0",
49
50
  "jest-rdf": "^1.7.0",
50
51
  "manual-git-changelog": "^1.0.1",
51
52
  "pre-commit": "^1.2.2",
52
53
  "rdf-quad": "^1.5.0",
53
54
  "rdf-test-suite": "^1.13.4",
54
55
  "streamify-string": "^1.0.1",
55
- "ts-jest": "^26.0.0",
56
+ "ts-jest": "^28.0.0",
57
+ "ts-loader": "^9.3.1",
56
58
  "tslint": "^6.0.0",
57
59
  "tslint-eslint-rules": "^5.3.1",
58
- "typescript": "^4.0.0"
60
+ "typescript": "^4.0.0",
61
+ "webpack": "^5.73.0",
62
+ "webpack-cli": "^4.10.0"
59
63
  },
60
64
  "jest": {
61
65
  "globals": {
62
66
  "ts-jest": {
63
- "tsConfig": "test/tsconfig.json"
67
+ "tsconfig": "test/tsconfig.json"
64
68
  }
65
69
  },
66
70
  "setupFilesAfterEnv": [
@@ -123,7 +127,5 @@
123
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",
124
128
  "spec-clean": "rm -r .rdf-test-suite-cache/"
125
129
  },
126
- "resolutions": {
127
- "@types/rdf-js": "^4.0.0"
128
- }
130
+ "sideEffects": false
129
131
  }