From 410f4f540c6902779c6e7014fa4d5d527850cafa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 23:06:10 +0000 Subject: [PATCH 1/2] Bump csv-parse from 4.16.0 to 4.16.2 Bumps [csv-parse](https://github.com/wdavidw/node-csv-parse) from 4.16.0 to 4.16.2. - [Release notes](https://github.com/wdavidw/node-csv-parse/releases) - [Commits](https://github.com/wdavidw/node-csv-parse/commits) --- updated-dependencies: - dependency-name: csv-parse dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0559089..6ef0b95 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "dependencies": { "@actions/core": "^1.5.0", "@actions/exec": "^1.1.0", - "csv-parse": "^4.16.0", + "csv-parse": "^4.16.2", "semver": "^7.3.5" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index fbe022d..a212853 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1120,10 +1120,10 @@ cssstyle@^2.3.0: dependencies: cssom "~0.3.6" -csv-parse@^4.16.0: - version "4.16.0" - resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.0.tgz#b4c875e288a41f7ff917cb0d7d45880d563034f6" - integrity sha512-Zb4tGPANH4SW0LgC9+s9Mnequs9aqn7N3/pCqNbVjs2XhEF6yWNU2Vm4OGl1v2Go9nw8rXt87Cm2QN/o6Vpqgg== +csv-parse@^4.16.2: + version "4.16.2" + resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.2.tgz#cd7d25e9b9e1430ac6aa5ed9b5c1685e72d4a8d8" + integrity sha512-eq2BhB6JiIJaNv61pH5EC+o/iyCBxT+g6ukLu2UoNyS5daCN8YlzhOsLHGt/t9sGraMYt/aizaXPLQoNvxlIMw== data-urls@^2.0.0: version "2.0.0" From 5b8cde2fbda0e59f6cbdebe74e03207e50f42ef1 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Wed, 1 Sep 2021 21:26:02 +0200 Subject: [PATCH 2/2] Update generated content Signed-off-by: CrazyMax --- dist/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index df8a07a..391f177 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2533,6 +2533,7 @@ class Parser extends Transform { } } this.info = { + bytes: 0, comment_lines: 0, empty_lines: 0, invalid_field_length: 0, @@ -2542,6 +2543,7 @@ class Parser extends Transform { this.options = options this.state = { bomSkipped: false, + bufBytesStart: 0, castField: fnCastField, commenting: false, // Current error encountered by a record @@ -2628,7 +2630,9 @@ class Parser extends Transform { for(let encoding in boms){ if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){ // Skip BOM - buf = buf.slice(boms[encoding].length) + let bomLength = boms[encoding].length + this.state.bufBytesStart += bomLength + buf = buf.slice(bomLength) // Renormalize original options with the new encoding this.__normalizeOptions({...this.__originalOptions, encoding: encoding}) break @@ -2768,8 +2772,10 @@ class Parser extends Transform { pos += recordDelimiterLength - 1 continue } + this.info.bytes = this.state.bufBytesStart + pos; const errField = this.__onField() if(errField !== undefined) return errField + this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength; const errRecord = this.__onRecord() if(errRecord !== undefined) return errRecord if(to !== -1 && this.info.records >= to){ @@ -2792,6 +2798,7 @@ class Parser extends Transform { } let delimiterLength = this.__isDelimiter(buf, pos, chr) if(delimiterLength !== 0){ + this.info.bytes = this.state.bufBytesStart + pos; const errField = this.__onField() if(errField !== undefined) return errField pos += delimiterLength - 1 @@ -2841,6 +2848,7 @@ class Parser extends Transform { }else{ // Skip last line if it has no characters if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){ + this.info.bytes = this.state.bufBytesStart + pos; const errField = this.__onField() if(errField !== undefined) return errField const errRecord = this.__onRecord() @@ -2852,6 +2860,7 @@ class Parser extends Transform { } } }else{ + this.state.bufBytesStart += pos this.state.previousBuf = buf.slice(pos) } if(this.state.wasRowDelimiter === true){ @@ -3266,7 +3275,7 @@ const parse = function(){ throw new CsvError('CSV_INVALID_ARGUMENT', [ 'Invalid argument:', `got ${JSON.stringify(argument)} at index ${i}` - ], this.options) + ], options || {}) } } const parser = new Parser(options)