@graphty/graph-io 0.2.4 → 0.3.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 +29 -7
- package/dist/chunks/{escape-DyI8JofU.js → escape-CKied3Ri.js} +16 -10
- package/dist/chunks/escape-CKied3Ri.js.map +1 -0
- package/dist/chunks/{importer-DbnGYr3_.js → importer-C6QcIRIb.js} +129 -39
- package/dist/chunks/importer-C6QcIRIb.js.map +1 -0
- package/dist/chunks/{importer-CpCpfbxr.js → importer-D5pAsweZ.js} +136 -31
- package/dist/chunks/importer-D5pAsweZ.js.map +1 -0
- package/dist/chunks/{importer-GozH8DkN.js → importer-DbMrAR_w.js} +10 -4
- package/dist/chunks/importer-DbMrAR_w.js.map +1 -0
- package/dist/chunks/{importer-CQnJuWJw.js → importer-DkzjTvHc.js} +82 -40
- package/dist/chunks/importer-DkzjTvHc.js.map +1 -0
- package/dist/chunks/{records-CGpxszm1.js → records-BKSMowhR.js} +3 -3
- package/dist/chunks/{records-CGpxszm1.js.map → records-BKSMowhR.js.map} +1 -1
- package/dist/chunks/{text-CajMdVFy.js → text-Dr0Ifpag.js} +2 -2
- package/dist/chunks/{text-CajMdVFy.js.map → text-Dr0Ifpag.js.map} +1 -1
- package/dist/chunks/{writer-DxSKC7TL.js → writer-BdMak4_J.js} +341 -112
- package/dist/chunks/writer-BdMak4_J.js.map +1 -0
- package/dist/csv.js +24 -6
- package/dist/csv.js.map +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +42 -10
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +69 -25
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +186 -129
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +10 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts +5 -4
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +6 -5
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/format.d.ts +3 -3
- package/dist/src/common/format.js +5 -5
- package/dist/src/common/format.js.map +1 -1
- package/dist/src/common/input.d.ts +24 -6
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +259 -23
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/options.d.ts +2 -0
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +17 -0
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/text.js +4 -4
- package/dist/src/common/text.js.map +1 -1
- package/dist/src/common/weights.d.ts.map +1 -1
- package/dist/src/common/weights.js +8 -0
- package/dist/src/common/weights.js.map +1 -1
- package/dist/src/common/xml.d.ts +7 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +12 -0
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts +5 -1
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +8 -1
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/csv/importer.d.ts.map +1 -1
- package/dist/src/formats/csv/importer.js +1 -0
- package/dist/src/formats/csv/importer.js.map +1 -1
- package/dist/src/formats/csv/index.d.ts +6 -0
- package/dist/src/formats/csv/index.d.ts.map +1 -1
- package/dist/src/formats/csv/index.js +7 -1
- package/dist/src/formats/csv/index.js.map +1 -1
- package/dist/src/formats/csv/records.js +1 -1
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +1 -1
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +3 -3
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +151 -24
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +32 -7
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +2 -2
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +6 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +7 -1
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +2 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +66 -25
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +7 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +8 -2
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +6 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +7 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +2 -2
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +14 -5
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +8 -0
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +84 -37
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/neo4j/importer.js +1 -1
- package/dist/src/formats/neo4j/importer.js.map +1 -1
- package/dist/src/formats/neo4j/index.d.ts +6 -0
- package/dist/src/formats/neo4j/index.d.ts.map +1 -1
- package/dist/src/formats/neo4j/index.js +7 -1
- package/dist/src/formats/neo4j/index.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +13 -2
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +8 -2
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +122 -26
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +26 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +101 -35
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +1 -1
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +6 -1
- package/dist/src/sniff.js.map +1 -1
- package/dist/src/types.d.ts +22 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +4 -3
- package/src/common/codes.ts +9 -0
- package/src/common/escape.ts +6 -5
- package/src/common/format.ts +5 -5
- package/src/common/input.ts +293 -22
- package/src/common/options.ts +24 -0
- package/src/common/text.ts +4 -4
- package/src/common/weights.ts +9 -0
- package/src/common/xml.ts +14 -0
- package/src/formats/csv/exporter.ts +12 -1
- package/src/formats/csv/importer.ts +1 -0
- package/src/formats/csv/index.ts +9 -0
- package/src/formats/csv/records.ts +1 -1
- package/src/formats/dot/exporter.ts +3 -3
- package/src/formats/dot/importer.ts +172 -32
- package/src/formats/gexf/exporter.ts +38 -7
- package/src/formats/gexf/importer.ts +12 -2
- package/src/formats/gexf/index.ts +9 -0
- package/src/formats/gml/importer.ts +75 -22
- package/src/formats/gml/index.ts +10 -1
- package/src/formats/graphml/constants.ts +9 -0
- package/src/formats/graphml/importer.ts +9 -2
- package/src/formats/json/exporter.ts +14 -5
- package/src/formats/json/importer.ts +104 -36
- package/src/formats/neo4j/importer.ts +1 -1
- package/src/formats/neo4j/index.ts +9 -0
- package/src/formats/pajek/exporter.ts +19 -2
- package/src/formats/pajek/importer.ts +145 -28
- package/src/index.ts +1 -0
- package/src/registry.ts +131 -40
- package/src/sniff.ts +6 -1
- package/src/types.ts +26 -3
- package/dist/chunks/escape-DyI8JofU.js.map +0 -1
- package/dist/chunks/importer-CQnJuWJw.js.map +0 -1
- package/dist/chunks/importer-CpCpfbxr.js.map +0 -1
- package/dist/chunks/importer-DbnGYr3_.js.map +0 -1
- package/dist/chunks/importer-GozH8DkN.js.map +0 -1
- package/dist/chunks/writer-DxSKC7TL.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/pajek.js
CHANGED
|
@@ -52,6 +52,12 @@ export declare const SINK_OPTION_CODE = "W_SINK_OPTION";
|
|
|
52
52
|
export declare const OPTION_IGNORED_CODE = "W_OPTION_IGNORED";
|
|
53
53
|
/** An invalid UTF-8 sequence in the input (fatal). */
|
|
54
54
|
export declare const INVALID_UTF8_CODE = "E_INVALID_UTF8";
|
|
55
|
+
/** Bytes that are not valid in the encoding a BOM, a declaration or the `encoding` option chose (fatal). */
|
|
56
|
+
export declare const INVALID_ENCODING_CODE = "E_INVALID_ENCODING";
|
|
57
|
+
/** Bytes that are not valid UTF-8 (and declare no other encoding) were read as windows-1252. */
|
|
58
|
+
export declare const ENCODING_FALLBACK_CODE = "W_ENCODING_FALLBACK";
|
|
59
|
+
/** The file declares an encoding the platform's TextDecoder does not know; the declaration is ignored. */
|
|
60
|
+
export declare const UNKNOWN_ENCODING_CODE = "W_UNKNOWN_ENCODING";
|
|
55
61
|
/** The sink refused the file's direction (locked or non-empty); the file is read as the sink's. */
|
|
56
62
|
export declare const DIRECTION_REFUSED_CODE = "W_DIRECTION_REFUSED";
|
|
57
63
|
/** Edges of the other direction were forced to the policy's direction. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/common/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,uFAAuF;AACvF,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,0CAA0C;AAC1C,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,8EAA8E;AAC9E,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,qDAAqD;AACrD,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,0FAA0F;AAC1F,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC,uFAAuF;AACvF,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD,8DAA8D;AAC9D,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,kEAAkE;AAClE,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,6GAA6G;AAC7G,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,mFAAmF;AACnF,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,uFAAuF;AACvF,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,uGAAuG;AACvG,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,uHAAuH;AACvH,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,sDAAsD;AACtD,eAAO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AO,MAAM,0BAA0B,4BAA4B,CAAC;AAEpE,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAEhE,kGAAkG;AAClG,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,2GAA2G;AAC3G,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAE5D,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,8GAA8G;AAC9G,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC"}
|
package/dist/src/common/codes.js
CHANGED
|
@@ -53,6 +53,12 @@ export const SINK_OPTION_CODE = "W_SINK_OPTION";
|
|
|
53
53
|
export const OPTION_IGNORED_CODE = "W_OPTION_IGNORED";
|
|
54
54
|
/** An invalid UTF-8 sequence in the input (fatal). */
|
|
55
55
|
export const INVALID_UTF8_CODE = "E_INVALID_UTF8";
|
|
56
|
+
/** Bytes that are not valid in the encoding a BOM, a declaration or the `encoding` option chose (fatal). */
|
|
57
|
+
export const INVALID_ENCODING_CODE = "E_INVALID_ENCODING";
|
|
58
|
+
/** Bytes that are not valid UTF-8 (and declare no other encoding) were read as windows-1252. */
|
|
59
|
+
export const ENCODING_FALLBACK_CODE = "W_ENCODING_FALLBACK";
|
|
60
|
+
/** The file declares an encoding the platform's TextDecoder does not know; the declaration is ignored. */
|
|
61
|
+
export const UNKNOWN_ENCODING_CODE = "W_UNKNOWN_ENCODING";
|
|
56
62
|
/** The sink refused the file's direction (locked or non-empty); the file is read as the sink's. */
|
|
57
63
|
export const DIRECTION_REFUSED_CODE = "W_DIRECTION_REFUSED";
|
|
58
64
|
/** Edges of the other direction were forced to the policy's direction. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/common/codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+EAA+E;AAE/E,uFAAuF;AACvF,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,0CAA0C;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAE1C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAExD,kCAAkC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;AAEtC,uFAAuF;AACvF,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,uEAAuE;AACvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAExD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,kEAAkE;AAClE,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAEtD,6GAA6G;AAC7G,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C,uFAA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B,CAAC;AAEhE,kGAAkG;AAClG,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAElE,2GAA2G;AAC3G,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE5D,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD,8GAA8G;AAC9G,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEpD,wFAAwF;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,yFAAyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC"}
|
|
@@ -46,10 +46,11 @@ export declare function decodeGmlString(body: string): string;
|
|
|
46
46
|
export declare function isBareDotId(text: string): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Whether a text can be written as a DOT ID at all. Graphviz's scanner consumes a backslash pair
|
|
49
|
-
* `\\` as one unit
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
* `\\` as one unit, `\"` as an escaped quote and a backslash before a line break as a line
|
|
50
|
+
* continuation (both removed), left to right, so a backslash that precedes a double quote or a
|
|
51
|
+
* line break, or ends the text, cannot be written: the written `\\"` reads as a pair and a closing
|
|
52
|
+
* quote, a backslash before a line break vanishes with the break, and a trailing backslash escapes
|
|
53
|
+
* the closing quote. Every other text is writable; quoteDotId() writes it.
|
|
53
54
|
* @param text - the id, name or value text
|
|
54
55
|
* @returns true when quoteDotId(text) reads back as `text`
|
|
55
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../../src/common/escape.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,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function isDotIdentifier(text) {
|
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Whether a text can be written as a DOT ID at all. Graphviz's scanner consumes a backslash pair
|
|
137
|
-
* `\\` as one unit
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
137
|
+
* `\\` as one unit, `\"` as an escaped quote and a backslash before a line break as a line
|
|
138
|
+
* continuation (both removed), left to right, so a backslash that precedes a double quote or a
|
|
139
|
+
* line break, or ends the text, cannot be written: the written `\\"` reads as a pair and a closing
|
|
140
|
+
* quote, a backslash before a line break vanishes with the break, and a trailing backslash escapes
|
|
141
|
+
* the closing quote. Every other text is writable; quoteDotId() writes it.
|
|
141
142
|
* @param text - the id, name or value text
|
|
142
143
|
* @returns true when quoteDotId(text) reads back as `text`
|
|
143
144
|
*/
|
|
144
145
|
export function isWritableDotText(text) {
|
|
145
|
-
return !text.endsWith("\\") && !text.includes('\\"');
|
|
146
|
+
return !text.endsWith("\\") && !text.includes('\\"') && !/\\[\r\n]/.test(text);
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
148
149
|
* Write a DOT ID: bare when the grammar allows, otherwise double-quoted with `"` escaped as `\"`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../../src/common/escape.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AACzC,MAAM,gBAAgB,GAAqC;IACvD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CAChB,CAAC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AAe,EAAE,6DAA6D,EAAE;YACvG,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;IACP,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,IAAI,GAAG,CAAC;AACvB,CAAC"}
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* The shortest decimal text that reads back to the same f32 value through Math.fround.
|
|
10
10
|
* @param value - an f32 value (a JS number holding one)
|
|
11
|
-
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "0" for
|
|
11
|
+
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "-0" for negative zero
|
|
12
12
|
*/
|
|
13
13
|
export declare function formatF32(value: number): string;
|
|
14
14
|
/**
|
|
15
15
|
* The shortest text of an f64 value: `String(x)`, which is already the shortest round-tripping
|
|
16
|
-
* decimal in JS.
|
|
16
|
+
* decimal in JS, except for negative zero, which `String()` writes as "0".
|
|
17
17
|
* @param value - the value
|
|
18
|
-
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values
|
|
18
|
+
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "-0" for negative zero
|
|
19
19
|
*/
|
|
20
20
|
export declare function formatF64(value: number): string;
|
|
21
21
|
/**
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* The shortest decimal text that reads back to the same f32 value through Math.fround.
|
|
10
10
|
* @param value - an f32 value (a JS number holding one)
|
|
11
|
-
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "0" for
|
|
11
|
+
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "-0" for negative zero
|
|
12
12
|
*/
|
|
13
13
|
export function formatF32(value) {
|
|
14
14
|
if (!Number.isFinite(value)) {
|
|
15
15
|
return String(value);
|
|
16
16
|
}
|
|
17
17
|
if (value === 0) {
|
|
18
|
-
return "0";
|
|
18
|
+
return Object.is(value, -0) ? "-0" : "0";
|
|
19
19
|
}
|
|
20
20
|
for (let digits = 1; digits <= 9; digits++) {
|
|
21
21
|
const text = value.toPrecision(digits);
|
|
@@ -27,12 +27,12 @@ export function formatF32(value) {
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* The shortest text of an f64 value: `String(x)`, which is already the shortest round-tripping
|
|
30
|
-
* decimal in JS.
|
|
30
|
+
* decimal in JS, except for negative zero, which `String()` writes as "0".
|
|
31
31
|
* @param value - the value
|
|
32
|
-
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values
|
|
32
|
+
* @returns the text; "Infinity" / "-Infinity" / "NaN" for the non-finite values, "-0" for negative zero
|
|
33
33
|
*/
|
|
34
34
|
export function formatF64(value) {
|
|
35
|
-
return String(value);
|
|
35
|
+
return Object.is(value, -0) ? "-0" : String(value);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* A decimal text with a decimal point or an exponent guaranteed for a finite value (`2.0`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/common/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/common/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACnC,IAAI,C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,CAAC,KAAa,EAAE,KAA2C;IACnF,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Input handling shared by every importer (design section 8.4): the ImportInput union (whole
|
|
3
3
|
* text, whole bytes, a byte stream, an async iterable of text or byte chunks) read as a sequence of
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* text chunks, as lines, or as one string, with BOM handling, cancellation through an AbortSignal
|
|
5
|
+
* and byte progress.
|
|
6
6
|
*
|
|
7
|
-
* Bytes are decoded
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Bytes are decoded ONCE, here, for every importer. The encoding is, in order of precedence: the
|
|
8
|
+
* caller's `encoding` option; a byte order mark (UTF-8, UTF-16LE, UTF-16BE); the encoding the file
|
|
9
|
+
* declares (the importer's `declaredEncoding` reader: the XML prolog for GEXF and GraphML, the
|
|
10
|
+
* `charset` attribute for DOT); else UTF-8. Decoding is strict (`fatal: true`): an invalid sequence
|
|
11
|
+
* is never a silent U+FFFD that could alias two ids. Only in the last case, when bytes that are not
|
|
12
|
+
* valid UTF-8 appear while everything before them was ASCII, is the rest of the input read as
|
|
13
|
+
* windows-1252 (the superset of ISO 8859-1 that Excel, Pajek and older tools write), with the
|
|
14
|
+
* warning W_ENCODING_FALLBACK; invalid UTF-8 after valid non-ASCII UTF-8 is E_INVALID_UTF8. A
|
|
15
|
+
* leading U+FEFF is stripped from text and from decoded bytes alike.
|
|
11
16
|
*/
|
|
12
17
|
import { type ImportInput } from "../types.js";
|
|
13
18
|
import { INVALID_UTF8_CODE } from "./codes.js";
|
|
@@ -23,7 +28,20 @@ export interface ReadOptions {
|
|
|
23
28
|
readonly signal?: AbortSignal | null | undefined;
|
|
24
29
|
/** The progress callback, or null / undefined for none. */
|
|
25
30
|
readonly onProgress?: ((bytesDone: number, bytesTotal?: number) => void) | null | undefined;
|
|
31
|
+
/** The caller's `encoding` option (a label TextDecoder knows), or null / undefined for detection. */
|
|
32
|
+
readonly encoding?: string | null | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The format's reader of a declared encoding: given the head of the input decoded as
|
|
35
|
+
* windows-1252 (ASCII-compatible), the encoding label it declares, or null.
|
|
36
|
+
*/
|
|
37
|
+
readonly declaredEncoding?: ((head: string) => string | null) | undefined;
|
|
26
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The canonical name of an encoding label, or null when the platform's TextDecoder does not know it.
|
|
41
|
+
* @param label - a WHATWG encoding label ("latin1", "UTF-16LE", "cp1252", ...)
|
|
42
|
+
* @returns the canonical name ("windows-1252", "utf-16le", ...) or null
|
|
43
|
+
*/
|
|
44
|
+
export declare function canonicalEncoding(label: string): string | null;
|
|
27
45
|
/**
|
|
28
46
|
* Whether a value is an ImportInput this module can read.
|
|
29
47
|
* @param input - any value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/common/input.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/common/input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAiD,iBAAiB,EAAyB,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,CA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AAQ,CAAC,OAAO,CAAc;IAEtC,OAAO,CAAC,UAAU,CAAK;IAEvB;;;;;OAKG;gBACS,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,GAAE,WAAgB;IAMtF;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC;CAoE3E"}
|
package/dist/src/common/input.js
CHANGED
|
@@ -1,17 +1,230 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Input handling shared by every importer (design section 8.4): the ImportInput union (whole
|
|
3
3
|
* text, whole bytes, a byte stream, an async iterable of text or byte chunks) read as a sequence of
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* text chunks, as lines, or as one string, with BOM handling, cancellation through an AbortSignal
|
|
5
|
+
* and byte progress.
|
|
6
6
|
*
|
|
7
|
-
* Bytes are decoded
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Bytes are decoded ONCE, here, for every importer. The encoding is, in order of precedence: the
|
|
8
|
+
* caller's `encoding` option; a byte order mark (UTF-8, UTF-16LE, UTF-16BE); the encoding the file
|
|
9
|
+
* declares (the importer's `declaredEncoding` reader: the XML prolog for GEXF and GraphML, the
|
|
10
|
+
* `charset` attribute for DOT); else UTF-8. Decoding is strict (`fatal: true`): an invalid sequence
|
|
11
|
+
* is never a silent U+FFFD that could alias two ids. Only in the last case, when bytes that are not
|
|
12
|
+
* valid UTF-8 appear while everything before them was ASCII, is the rest of the input read as
|
|
13
|
+
* windows-1252 (the superset of ISO 8859-1 that Excel, Pajek and older tools write), with the
|
|
14
|
+
* warning W_ENCODING_FALLBACK; invalid UTF-8 after valid non-ASCII UTF-8 is E_INVALID_UTF8. A
|
|
15
|
+
* leading U+FEFF is stripped from text and from decoded bytes alike.
|
|
11
16
|
*/
|
|
12
17
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
13
|
-
import { INVALID_UTF8_CODE } from "./codes.js";
|
|
18
|
+
import { ENCODING_FALLBACK_CODE, INVALID_ENCODING_CODE, INVALID_UTF8_CODE, UNKNOWN_ENCODING_CODE } from "./codes.js";
|
|
14
19
|
export { INVALID_UTF8_CODE };
|
|
20
|
+
/** How many leading bytes the declaration check sees (an XML prolog, a DOT `charset` near the top). */
|
|
21
|
+
const HEAD_BYTES = 1024;
|
|
22
|
+
/** How many leading bytes the BOM check needs. */
|
|
23
|
+
const BOM_BYTES = 3;
|
|
24
|
+
/**
|
|
25
|
+
* The canonical name of an encoding label, or null when the platform's TextDecoder does not know it.
|
|
26
|
+
* @param label - a WHATWG encoding label ("latin1", "UTF-16LE", "cp1252", ...)
|
|
27
|
+
* @returns the canonical name ("windows-1252", "utf-16le", ...) or null
|
|
28
|
+
*/
|
|
29
|
+
export function canonicalEncoding(label) {
|
|
30
|
+
try {
|
|
31
|
+
return new TextDecoder(label.trim()).encoding;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The encoding a byte order mark announces.
|
|
39
|
+
* @param head - the first bytes
|
|
40
|
+
* @returns "utf-8", "utf-16le", "utf-16be" or null
|
|
41
|
+
*/
|
|
42
|
+
function bomEncoding(head) {
|
|
43
|
+
if (head.byteLength >= 3 && head[0] === 0xef && head[1] === 0xbb && head[2] === 0xbf) {
|
|
44
|
+
return "utf-8";
|
|
45
|
+
}
|
|
46
|
+
if (head.byteLength >= 2 && head[0] === 0xff && head[1] === 0xfe) {
|
|
47
|
+
return "utf-16le";
|
|
48
|
+
}
|
|
49
|
+
if (head.byteLength >= 2 && head[0] === 0xfe && head[1] === 0xff) {
|
|
50
|
+
return "utf-16be";
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The one byte decoder of an import: picks the encoding from the head (option, BOM, declaration,
|
|
56
|
+
* UTF-8) and decodes strictly, switching to windows-1252 with a warning when undeclared input
|
|
57
|
+
* turns out not to be UTF-8 while everything decoded so far was ASCII.
|
|
58
|
+
*/
|
|
59
|
+
class ByteDecoder {
|
|
60
|
+
/**
|
|
61
|
+
* Create the decoder of one import.
|
|
62
|
+
* @param report - where warnings and the fatal decode error go
|
|
63
|
+
* @param options - the encoding option and the format's declaration reader
|
|
64
|
+
*/
|
|
65
|
+
constructor(report, options) {
|
|
66
|
+
this.report = report;
|
|
67
|
+
this.options = options;
|
|
68
|
+
this.decoder = null;
|
|
69
|
+
this.encoding = "utf-8";
|
|
70
|
+
/** Whether a failed UTF-8 decode may switch to windows-1252 (nothing chose UTF-8 explicitly). */
|
|
71
|
+
this.mayFallBack = false;
|
|
72
|
+
/** Whether every character decoded so far was ASCII (so switching encodings changes no earlier text). */
|
|
73
|
+
this.asciiSoFar = true;
|
|
74
|
+
/** While asciiSoFar: the bytes the UTF-8 decoder holds back (a sequence split across chunks). */
|
|
75
|
+
this.carry = new Uint8Array(0);
|
|
76
|
+
/** Bytes decoded so far, for error positions. */
|
|
77
|
+
this.offset = 0;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether start() ran.
|
|
81
|
+
* @returns true once the encoding is chosen
|
|
82
|
+
*/
|
|
83
|
+
get started() {
|
|
84
|
+
return this.decoder !== null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Choose the encoding from the first bytes of the input.
|
|
88
|
+
* @param head - the first bytes (up to HEAD_BYTES; fewer when the input is shorter)
|
|
89
|
+
*/
|
|
90
|
+
start(head) {
|
|
91
|
+
const explicit = this.options.encoding ?? null;
|
|
92
|
+
if (explicit !== null) {
|
|
93
|
+
this.use(explicit, false);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const bom = bomEncoding(head);
|
|
97
|
+
if (bom !== null) {
|
|
98
|
+
this.use(bom, false);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const declared = this.options.declaredEncoding?.(new TextDecoder("windows-1252").decode(head)) ?? null;
|
|
102
|
+
if (declared !== null) {
|
|
103
|
+
const canonical = canonicalEncoding(declared);
|
|
104
|
+
if (canonical === null) {
|
|
105
|
+
this.report.warning("unsupported", UNKNOWN_ENCODING_CODE, `the input declares the encoding ${JSON.stringify(declared)}, which this platform cannot decode; reading it as UTF-8`, { element: declared });
|
|
106
|
+
}
|
|
107
|
+
else if (canonical !== "utf-8" && !canonical.startsWith("utf-16")) {
|
|
108
|
+
// a declared UTF-16 without a BOM is not UTF-16 (its declaration read as ASCII), and
|
|
109
|
+
// a declared UTF-8 gets the same undeclared treatment: tools often write the default
|
|
110
|
+
// prolog over Latin-1 bytes
|
|
111
|
+
this.use(canonical, false);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
this.use("utf-8", true);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Decode the next bytes.
|
|
119
|
+
* @param bytes - the bytes
|
|
120
|
+
* @param stream - whether more bytes follow
|
|
121
|
+
* @returns the text
|
|
122
|
+
*/
|
|
123
|
+
decode(bytes, stream) {
|
|
124
|
+
const decoder = this.decoder;
|
|
125
|
+
let text;
|
|
126
|
+
try {
|
|
127
|
+
text = decoder.decode(bytes, { stream });
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
if (!(err instanceof TypeError)) {
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
text = this.recover(bytes, stream);
|
|
134
|
+
}
|
|
135
|
+
if (this.asciiSoFar && this.mayFallBack) {
|
|
136
|
+
if (/[\u0080-\uffff]/.test(text)) {
|
|
137
|
+
this.asciiSoFar = false;
|
|
138
|
+
this.carry = new Uint8Array(0);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// every character so far is one ASCII byte, so what was not emitted is held back
|
|
142
|
+
const all = this.carry.byteLength === 0 ? bytes : concatBytes([this.carry, bytes]);
|
|
143
|
+
this.carry = all.slice(text.length);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
this.offset += bytes.byteLength;
|
|
147
|
+
return text;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A decode failed: switch to windows-1252 when allowed, else fail the import.
|
|
151
|
+
* @param bytes - the bytes that failed
|
|
152
|
+
* @param stream - whether more bytes follow
|
|
153
|
+
* @returns the bytes decoded as windows-1252
|
|
154
|
+
*/
|
|
155
|
+
recover(bytes, stream) {
|
|
156
|
+
const where = { byteOffset: this.offset };
|
|
157
|
+
const all = this.carry.byteLength === 0 ? bytes : concatBytes([this.carry, bytes]);
|
|
158
|
+
// a NUL byte never occurs in windows-1252 text: it marks binary data (or BOM-less UTF-16)
|
|
159
|
+
if (this.mayFallBack && this.asciiSoFar && !all.includes(0) && !startsWithUtf8(all)) {
|
|
160
|
+
this.report.warning("coercion", ENCODING_FALLBACK_CODE, `the input is not valid UTF-8 (near byte ${this.offset}) and declares no encoding; read as windows-1252 (pass the encoding option to choose another)`);
|
|
161
|
+
this.use("windows-1252", false);
|
|
162
|
+
return this.decoder.decode(all, { stream });
|
|
163
|
+
}
|
|
164
|
+
if (this.encoding === "utf-8") {
|
|
165
|
+
const after = this.mayFallBack ? " after valid non-ASCII UTF-8 text; pass the encoding option" : "";
|
|
166
|
+
return this.report.fail(INVALID_UTF8_CODE, `invalid UTF-8 near byte ${this.offset}${after}`, undefined, where);
|
|
167
|
+
}
|
|
168
|
+
return this.report.fail(INVALID_ENCODING_CODE, `the bytes near byte ${this.offset} are not valid ${this.encoding}`, undefined, where);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Switch to an encoding.
|
|
172
|
+
* @param label - the encoding label
|
|
173
|
+
* @param mayFallBack - whether a UTF-8 failure may switch to windows-1252
|
|
174
|
+
*/
|
|
175
|
+
use(label, mayFallBack) {
|
|
176
|
+
this.decoder = new TextDecoder(label, { fatal: true, ignoreBOM: true });
|
|
177
|
+
this.encoding = this.decoder.encoding;
|
|
178
|
+
this.mayFallBack = mayFallBack;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Whether the first non-ASCII byte of a chunk starts a valid UTF-8 sequence: then the chunk holds
|
|
183
|
+
* valid non-ASCII UTF-8 before whatever made it fail, and the input is not windows-1252.
|
|
184
|
+
* @param bytes - a chunk that failed to decode as UTF-8
|
|
185
|
+
* @returns true when its first non-ASCII sequence is valid UTF-8
|
|
186
|
+
*/
|
|
187
|
+
function startsWithUtf8(bytes) {
|
|
188
|
+
const i = bytes.findIndex((b) => b >= 0x80);
|
|
189
|
+
const lead = bytes[i];
|
|
190
|
+
let length = 0;
|
|
191
|
+
if (lead >= 0xc2 && lead <= 0xdf) {
|
|
192
|
+
length = 2;
|
|
193
|
+
}
|
|
194
|
+
else if (lead >= 0xe0 && lead <= 0xef) {
|
|
195
|
+
length = 3;
|
|
196
|
+
}
|
|
197
|
+
else if (lead >= 0xf0 && lead <= 0xf4) {
|
|
198
|
+
length = 4;
|
|
199
|
+
}
|
|
200
|
+
if (i < 0 || length === 0 || i + length > bytes.byteLength) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
new TextDecoder("utf-8", { fatal: true }).decode(bytes.subarray(i, i + length));
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Join byte chunks.
|
|
213
|
+
* @param chunks - the chunks
|
|
214
|
+
* @returns one array holding them in order
|
|
215
|
+
*/
|
|
216
|
+
function concatBytes(chunks) {
|
|
217
|
+
if (chunks.length === 1) {
|
|
218
|
+
return chunks[0];
|
|
219
|
+
}
|
|
220
|
+
const out = new Uint8Array(chunks.reduce((sum, c) => sum + c.byteLength, 0));
|
|
221
|
+
let offset = 0;
|
|
222
|
+
for (const chunk of chunks) {
|
|
223
|
+
out.set(chunk, offset);
|
|
224
|
+
offset += chunk.byteLength;
|
|
225
|
+
}
|
|
226
|
+
return out;
|
|
227
|
+
}
|
|
15
228
|
/**
|
|
16
229
|
* Bytes decoded per call when the input is one in-memory Uint8Array: every consumer of textChunks()
|
|
17
230
|
* then sees bounded chunks whatever the input shape (a line reader or a record reader that holds
|
|
@@ -115,23 +328,13 @@ export async function* textChunks(input, report, options = {}) {
|
|
|
115
328
|
onProgress?.(done, total ?? undefined);
|
|
116
329
|
return;
|
|
117
330
|
}
|
|
118
|
-
const decoder = new
|
|
119
|
-
const decode = (bytes, stream) => {
|
|
120
|
-
try {
|
|
121
|
-
return decoder.decode(bytes, { stream });
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
if (err instanceof TypeError) {
|
|
125
|
-
report.fail(INVALID_UTF8_CODE, `invalid UTF-8 near byte ${done}`, undefined, { byteOffset: done });
|
|
126
|
-
}
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
331
|
+
const decoder = new ByteDecoder(report, options);
|
|
130
332
|
if (input instanceof Uint8Array) {
|
|
333
|
+
decoder.start(input.subarray(0, HEAD_BYTES));
|
|
131
334
|
for (let offset = 0; offset < input.byteLength; offset += DECODE_SLICE) {
|
|
132
335
|
throwIfAborted(signal);
|
|
133
336
|
const slice = input.subarray(offset, Math.min(offset + DECODE_SLICE, input.byteLength));
|
|
134
|
-
const text = emit(decode(slice, offset + DECODE_SLICE < input.byteLength));
|
|
337
|
+
const text = emit(decoder.decode(slice, offset + DECODE_SLICE < input.byteLength));
|
|
135
338
|
done = Math.min(offset + DECODE_SLICE, input.byteLength);
|
|
136
339
|
if (text.length > 0) {
|
|
137
340
|
yield text;
|
|
@@ -143,19 +346,45 @@ export async function* textChunks(input, report, options = {}) {
|
|
|
143
346
|
}
|
|
144
347
|
return;
|
|
145
348
|
}
|
|
349
|
+
// the first bytes of a stream are held back until the BOM check (and the declaration check,
|
|
350
|
+
// when the format has one) can see enough of them, or the input ended, or text arrived, so a
|
|
351
|
+
// BOM or a declaration split across small chunks is still seen
|
|
352
|
+
const needed = options.declaredEncoding === undefined ? BOM_BYTES : HEAD_BYTES;
|
|
353
|
+
let head = [];
|
|
354
|
+
let headLength = 0;
|
|
355
|
+
const flushHead = (stream) => {
|
|
356
|
+
const bytes = concatBytes(head);
|
|
357
|
+
head = [];
|
|
358
|
+
headLength = 0;
|
|
359
|
+
decoder.start(bytes.subarray(0, HEAD_BYTES));
|
|
360
|
+
return decoder.decode(bytes, stream);
|
|
361
|
+
};
|
|
146
362
|
const chunks = isReadableStream(input) ? streamChunks(input, signal) : input;
|
|
147
363
|
for await (const chunk of chunks) {
|
|
148
364
|
throwIfAborted(signal);
|
|
149
365
|
let text;
|
|
150
366
|
if (typeof chunk === "string") {
|
|
151
367
|
// finish any byte sequence still pending in the decoder before switching to text
|
|
152
|
-
|
|
368
|
+
let pending = "";
|
|
369
|
+
if (!decoder.started && headLength > 0) {
|
|
370
|
+
pending = flushHead(false);
|
|
371
|
+
}
|
|
372
|
+
else if (decoder.started) {
|
|
373
|
+
pending = decoder.decode(new Uint8Array(0), false);
|
|
374
|
+
}
|
|
153
375
|
text = emit(pending + chunk);
|
|
154
376
|
done += chunk.length;
|
|
155
377
|
}
|
|
156
378
|
else if (chunk instanceof Uint8Array) {
|
|
157
|
-
text = emit(decode(chunk, true));
|
|
158
379
|
done += chunk.byteLength;
|
|
380
|
+
if (decoder.started) {
|
|
381
|
+
text = emit(decoder.decode(chunk, true));
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
head.push(chunk);
|
|
385
|
+
headLength += chunk.byteLength;
|
|
386
|
+
text = headLength >= needed ? emit(flushHead(true)) : "";
|
|
387
|
+
}
|
|
159
388
|
}
|
|
160
389
|
else {
|
|
161
390
|
throw new GraphFormatError("E_UNSUPPORTED", "an input chunk must be a string or a Uint8Array", {
|
|
@@ -168,7 +397,14 @@ export async function* textChunks(input, report, options = {}) {
|
|
|
168
397
|
}
|
|
169
398
|
onProgress?.(done);
|
|
170
399
|
}
|
|
171
|
-
|
|
400
|
+
let tail = "";
|
|
401
|
+
if (!decoder.started && headLength > 0) {
|
|
402
|
+
tail = flushHead(false);
|
|
403
|
+
}
|
|
404
|
+
else if (decoder.started) {
|
|
405
|
+
tail = decoder.decode(new Uint8Array(0), false);
|
|
406
|
+
}
|
|
407
|
+
tail = emit(tail);
|
|
172
408
|
if (tail.length > 0) {
|
|
173
409
|
yield tail;
|
|
174
410
|
}
|