mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-22 12:09:32 +01:00
Bump csv-parse from 4.14.2 to 4.15.1 (#42)
* Bump csv-parse from 4.14.2 to 4.15.1 Bumps [csv-parse](https://github.com/wdavidw/node-csv-parse) from 4.14.2 to 4.15.1. - [Release notes](https://github.com/wdavidw/node-csv-parse/releases) - [Changelog](https://github.com/adaltas/node-csv-parse/blob/master/CHANGELOG.md) - [Commits](https://github.com/wdavidw/node-csv-parse/compare/v4.14.2...v4.15.1) Signed-off-by: dependabot[bot] <support@github.com> * Update generated content Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
cae03854eb
commit
94e634192d
3 changed files with 69 additions and 40 deletions
99
dist/index.js
generated
vendored
99
dist/index.js
generated
vendored
|
@ -4240,10 +4240,14 @@ additional information.
|
|||
const { Transform } = __webpack_require__(2413)
|
||||
const ResizeableBuffer = __webpack_require__(6942)
|
||||
|
||||
// white space characters
|
||||
// https://en.wikipedia.org/wiki/Whitespace_character
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types
|
||||
// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff
|
||||
const tab = 9
|
||||
const nl = 10
|
||||
const nl = 10 // \n, 0x0A in hexadecimal, 10 in decimal
|
||||
const np = 12
|
||||
const cr = 13
|
||||
const cr = 13 // \r, 0x0D in hexadécimal, 13 in decimal
|
||||
const space = 32
|
||||
const boms = {
|
||||
// Note, the following are equals:
|
||||
|
@ -4432,6 +4436,27 @@ class Parser extends Transform {
|
|||
throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)
|
||||
}
|
||||
}
|
||||
// Normalize options `ignore_last_delimiters`
|
||||
if(options.ignore_last_delimiters === undefined || options.ignore_last_delimiters === null){
|
||||
options.ignore_last_delimiters = false
|
||||
}else if(typeof options.ignore_last_delimiters === 'number'){
|
||||
options.ignore_last_delimiters = Math.floor(options.ignore_last_delimiters)
|
||||
if(options.ignore_last_delimiters === 0){
|
||||
options.ignore_last_delimiters = false
|
||||
}
|
||||
}else if(typeof options.ignore_last_delimiters !== 'boolean'){
|
||||
throw new CsvError('CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS', [
|
||||
'Invalid option `ignore_last_delimiters`:',
|
||||
'the value must be a boolean value or an integer,',
|
||||
`got ${JSON.stringify(options.ignore_last_delimiters)}`
|
||||
], options)
|
||||
}
|
||||
if(options.ignore_last_delimiters === true && options.columns === false){
|
||||
throw new CsvError('CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS', [
|
||||
'The option `ignore_last_delimiters`',
|
||||
'requires the activation of the `columns` option'
|
||||
], options)
|
||||
}
|
||||
// Normalize option `info`
|
||||
if(options.info === undefined || options.info === null || options.info === false){
|
||||
options.info = false
|
||||
|
@ -4749,7 +4774,7 @@ class Parser extends Transform {
|
|||
}
|
||||
// Auto discovery of record_delimiter, unix, mac and windows supported
|
||||
if(this.state.quoting === false && record_delimiter.length === 0){
|
||||
const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos)
|
||||
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(buf, pos)
|
||||
if(record_delimiterCount){
|
||||
record_delimiter = this.options.record_delimiter
|
||||
}
|
||||
|
@ -4790,12 +4815,12 @@ class Parser extends Transform {
|
|||
const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)
|
||||
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+quote.length, nextChr)
|
||||
const isNextChrDelimiter = this.__isDelimiter(buf, pos+quote.length, nextChr)
|
||||
const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+quote.length) : this.__isRecordDelimiter(nextChr, buf, pos+quote.length)
|
||||
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos+quote.length) : this.__isRecordDelimiter(nextChr, buf, pos+quote.length)
|
||||
// Escape a quote
|
||||
// Treat next char as a regular character
|
||||
if(escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)){
|
||||
pos += escape.length - 1
|
||||
}else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){
|
||||
}else if(!nextChr || isNextChrDelimiter || isNextChrRecordDelimiter || isNextChrComment || isNextChrTrimable){
|
||||
this.state.quoting = false
|
||||
this.state.wasQuoting = true
|
||||
pos += quote.length - 1
|
||||
|
@ -4806,7 +4831,7 @@ class Parser extends Transform {
|
|||
'Invalid Closing Quote:',
|
||||
`got "${String.fromCharCode(nextChr)}"`,
|
||||
`at line ${this.info.lines}`,
|
||||
'instead of delimiter, row delimiter, trimable character',
|
||||
'instead of delimiter, record delimiter, trimable character',
|
||||
'(if activated) or comment',
|
||||
], this.options, this.__context())
|
||||
)
|
||||
|
@ -4847,25 +4872,24 @@ class Parser extends Transform {
|
|||
this.info.comment_lines++
|
||||
// Skip full comment line
|
||||
}else{
|
||||
// Activate records emition if above from_line
|
||||
if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0) >= from_line){
|
||||
this.state.enabled = true
|
||||
this.__resetField()
|
||||
this.__resetRecord()
|
||||
pos += recordDelimiterLength - 1
|
||||
continue
|
||||
}
|
||||
// Skip if line is empty and skip_empty_lines activated
|
||||
if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){
|
||||
this.info.empty_lines++
|
||||
pos += recordDelimiterLength - 1
|
||||
continue
|
||||
}
|
||||
// Activate records emition if above from_line
|
||||
if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){
|
||||
this.state.enabled = true
|
||||
this.__resetField()
|
||||
this.__resetRow()
|
||||
pos += recordDelimiterLength - 1
|
||||
continue
|
||||
}else{
|
||||
const errField = this.__onField()
|
||||
if(errField !== undefined) return errField
|
||||
const errRecord = this.__onRow()
|
||||
if(errRecord !== undefined) return errRecord
|
||||
}
|
||||
const errField = this.__onField()
|
||||
if(errField !== undefined) return errField
|
||||
const errRecord = this.__onRecord()
|
||||
if(errRecord !== undefined) return errRecord
|
||||
if(to !== -1 && this.info.records >= to){
|
||||
this.state.stop = true
|
||||
this.push(null)
|
||||
|
@ -4938,7 +4962,7 @@ class Parser extends Transform {
|
|||
if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){
|
||||
const errField = this.__onField()
|
||||
if(errField !== undefined) return errField
|
||||
const errRecord = this.__onRow()
|
||||
const errRecord = this.__onRecord()
|
||||
if(errRecord !== undefined) return errRecord
|
||||
}else if(this.state.wasRowDelimiter === true){
|
||||
this.info.empty_lines++
|
||||
|
@ -4954,21 +4978,17 @@ class Parser extends Transform {
|
|||
this.state.wasRowDelimiter = false
|
||||
}
|
||||
}
|
||||
// Helper to test if a character is a space or a line delimiter
|
||||
__isCharTrimable(chr){
|
||||
return chr === space || chr === tab || chr === cr || chr === nl || chr === np
|
||||
}
|
||||
__onRow(){
|
||||
__onRecord(){
|
||||
const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options
|
||||
const {enabled, record} = this.state
|
||||
if(enabled === false){
|
||||
return this.__resetRow()
|
||||
return this.__resetRecord()
|
||||
}
|
||||
// Convert the first line into column names
|
||||
const recordLength = record.length
|
||||
if(columns === true){
|
||||
if(isRecordEmpty(record)){
|
||||
this.__resetRow()
|
||||
this.__resetRecord()
|
||||
return
|
||||
}
|
||||
return this.__firstLineToColumns(record)
|
||||
|
@ -5010,12 +5030,12 @@ class Parser extends Transform {
|
|||
}
|
||||
if(skip_lines_with_empty_values === true){
|
||||
if(isRecordEmpty(record)){
|
||||
this.__resetRow()
|
||||
this.__resetRecord()
|
||||
return
|
||||
}
|
||||
}
|
||||
if(this.state.recordHasError === true){
|
||||
this.__resetRow()
|
||||
this.__resetRecord()
|
||||
this.state.recordHasError = false
|
||||
return
|
||||
}
|
||||
|
@ -5089,7 +5109,7 @@ class Parser extends Transform {
|
|||
}
|
||||
}
|
||||
}
|
||||
this.__resetRow()
|
||||
this.__resetRecord()
|
||||
}
|
||||
__firstLineToColumns(record){
|
||||
const {firstLineToHeaders} = this.state
|
||||
|
@ -5109,13 +5129,13 @@ class Parser extends Transform {
|
|||
const normalizedHeaders = normalizeColumnsArray(headers)
|
||||
this.state.expectedRecordLength = normalizedHeaders.length
|
||||
this.options.columns = normalizedHeaders
|
||||
this.__resetRow()
|
||||
this.__resetRecord()
|
||||
return
|
||||
}catch(err){
|
||||
return err
|
||||
}
|
||||
}
|
||||
__resetRow(){
|
||||
__resetRecord(){
|
||||
if(this.options.raw === true){
|
||||
this.state.rawBuffer.reset()
|
||||
}
|
||||
|
@ -5188,6 +5208,10 @@ class Parser extends Transform {
|
|||
}
|
||||
return [undefined, field]
|
||||
}
|
||||
// Helper to test if a character is a space or a line delimiter
|
||||
__isCharTrimable(chr){
|
||||
return chr === space || chr === tab || chr === cr || chr === nl || chr === np
|
||||
}
|
||||
// Keep it in case we implement the `cast_int` option
|
||||
// __isInt(value){
|
||||
// // return Number.isInteger(parseInt(value))
|
||||
|
@ -5214,14 +5238,19 @@ class Parser extends Transform {
|
|||
needMoreDataSize,
|
||||
// Skip if the remaining buffer smaller than record delimiter
|
||||
recordDelimiterMaxLength,
|
||||
// Skip if the remaining buffer can be row delimiter following the closing quote
|
||||
// Skip if the remaining buffer can be record delimiter following the closing quote
|
||||
// 1 is for quote.length
|
||||
quoting ? (quote.length + recordDelimiterMaxLength) : 0,
|
||||
)
|
||||
return numOfCharLeft < requiredLength
|
||||
}
|
||||
__isDelimiter(buf, pos, chr){
|
||||
const {delimiter} = this.options
|
||||
const {delimiter, ignore_last_delimiters} = this.options
|
||||
if(ignore_last_delimiters === true && this.state.record.length === this.options.columns.length - 1){
|
||||
return 0
|
||||
}else if(ignore_last_delimiters !== false && typeof ignore_last_delimiters === 'number' && this.state.record.length === ignore_last_delimiters - 1){
|
||||
return 0
|
||||
}
|
||||
loop1: for(let i = 0; i < delimiter.length; i++){
|
||||
const del = delimiter[i]
|
||||
if(del[0] === chr){
|
||||
|
@ -5276,7 +5305,7 @@ class Parser extends Transform {
|
|||
}
|
||||
return true
|
||||
}
|
||||
__autoDiscoverRowDelimiter(buf, pos){
|
||||
__autoDiscoverRecordDelimiter(buf, pos){
|
||||
const {encoding} = this.options
|
||||
const chr = buf[pos]
|
||||
if(chr === cr){
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"csv-parse": "^4.14.2",
|
||||
"csv-parse": "^4.15.1",
|
||||
"handlebars": "^4.7.6",
|
||||
"moment": "^2.29.1",
|
||||
"semver": "^7.3.4"
|
||||
|
|
|
@ -1176,10 +1176,10 @@ cssstyle@^2.2.0:
|
|||
dependencies:
|
||||
cssom "~0.3.6"
|
||||
|
||||
csv-parse@^4.14.2:
|
||||
version "4.14.2"
|
||||
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.14.2.tgz#c1329cff95a99b8773a92c4e62f8bff114b34726"
|
||||
integrity sha512-YE2xlTKtM035/94llhgsp9qFQxGi47EkQJ1pZ+mLT/98GpIsbjkMGAb7Rmu9hNxVfYFOLf10hP+rPVqnoccLgw==
|
||||
csv-parse@^4.15.1:
|
||||
version "4.15.1"
|
||||
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.15.1.tgz#fc5a0a1b24eaa6d4c24892daa387c46f7f92f8d2"
|
||||
integrity sha512-TXIvRtNp0fqMJbk3yPR35bQIDzMH4khDwduElzE7Fl1wgnl25mnWYLSLqd/wS5GsDoX1rWtysivEYMNsz5jKwQ==
|
||||
|
||||
dashdash@^1.12.0:
|
||||
version "1.14.1"
|
||||
|
|
Loading…
Reference in a new issue