mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-22 12:09:32 +01:00
Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
98bffa7b6d
commit
d43d662db8
2 changed files with 61 additions and 42 deletions
|
@ -163,7 +163,13 @@ target "build" {
|
||||||
inherits = ["docker-metadata-action"]
|
inherits = ["docker-metadata-action"]
|
||||||
context = "./"
|
context = "./"
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"]
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm/v6",
|
||||||
|
"linux/arm/v7",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/386"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
95
dist/index.js
generated
vendored
95
dist/index.js
generated
vendored
|
@ -5123,7 +5123,7 @@ class Parser extends Transform {
|
||||||
}else{
|
}else{
|
||||||
throw new CsvError('CSV_INVALID_OPTION_COLUMNS', [
|
throw new CsvError('CSV_INVALID_OPTION_COLUMNS', [
|
||||||
'Invalid option columns:',
|
'Invalid option columns:',
|
||||||
'expect an object, a function or true,',
|
'expect an array, a function or true,',
|
||||||
`got ${JSON.stringify(options.columns)}`
|
`got ${JSON.stringify(options.columns)}`
|
||||||
], options)
|
], options)
|
||||||
}
|
}
|
||||||
|
@ -5136,6 +5136,11 @@ class Parser extends Transform {
|
||||||
'expect an boolean,',
|
'expect an boolean,',
|
||||||
`got ${JSON.stringify(options.columns_duplicates_to_array)}`
|
`got ${JSON.stringify(options.columns_duplicates_to_array)}`
|
||||||
], options)
|
], options)
|
||||||
|
}else if(options.columns === false){
|
||||||
|
throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', [
|
||||||
|
'Invalid option columns_duplicates_to_array:',
|
||||||
|
'the `columns` mode must be activated.'
|
||||||
|
], options)
|
||||||
}
|
}
|
||||||
// Normalize option `comment`
|
// Normalize option `comment`
|
||||||
if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){
|
if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){
|
||||||
|
@ -5450,10 +5455,10 @@ class Parser extends Transform {
|
||||||
escaping: false,
|
escaping: false,
|
||||||
// escapeIsQuote: options.escape === options.quote,
|
// escapeIsQuote: options.escape === options.quote,
|
||||||
escapeIsQuote: Buffer.isBuffer(options.escape) && Buffer.isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0,
|
escapeIsQuote: Buffer.isBuffer(options.escape) && Buffer.isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0,
|
||||||
expectedRecordLength: options.columns === null ? 0 : options.columns.length,
|
// columns can be `false`, `true`, `Array`
|
||||||
|
expectedRecordLength: Array.isArray(options.columns) ? options.columns.length : undefined,
|
||||||
field: new ResizeableBuffer(20),
|
field: new ResizeableBuffer(20),
|
||||||
firstLineToHeaders: fnFirstLineToHeaders,
|
firstLineToHeaders: fnFirstLineToHeaders,
|
||||||
info: Object.assign({}, this.info),
|
|
||||||
needMoreDataSize: Math.max(
|
needMoreDataSize: Math.max(
|
||||||
// Skip if the remaining buffer smaller than comment
|
// Skip if the remaining buffer smaller than comment
|
||||||
options.comment !== null ? options.comment.length : 0,
|
options.comment !== null ? options.comment.length : 0,
|
||||||
|
@ -5496,7 +5501,7 @@ class Parser extends Transform {
|
||||||
}
|
}
|
||||||
// Central parser implementation
|
// Central parser implementation
|
||||||
__parse(nextBuf, end){
|
__parse(nextBuf, end){
|
||||||
const {bom, comment, escape, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options
|
const {bom, comment, escape, from_line, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options
|
||||||
let {record_delimiter} = this.options
|
let {record_delimiter} = this.options
|
||||||
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state
|
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state
|
||||||
let buf
|
let buf
|
||||||
|
@ -5547,9 +5552,6 @@ class Parser extends Transform {
|
||||||
}
|
}
|
||||||
if(this.state.wasRowDelimiter === true){
|
if(this.state.wasRowDelimiter === true){
|
||||||
this.info.lines++
|
this.info.lines++
|
||||||
if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){
|
|
||||||
this.state.info = Object.assign({}, this.info)
|
|
||||||
}
|
|
||||||
this.state.wasRowDelimiter = false
|
this.state.wasRowDelimiter = false
|
||||||
}
|
}
|
||||||
if(to_line !== -1 && this.info.lines > to_line){
|
if(to_line !== -1 && this.info.lines > to_line){
|
||||||
|
@ -5618,7 +5620,7 @@ class Parser extends Transform {
|
||||||
`at line ${this.info.lines}`,
|
`at line ${this.info.lines}`,
|
||||||
'instead of delimiter, record delimiter, trimable character',
|
'instead of delimiter, record delimiter, trimable character',
|
||||||
'(if activated) or comment',
|
'(if activated) or comment',
|
||||||
], this.options, this.__context())
|
], this.options, this.__infoField())
|
||||||
)
|
)
|
||||||
if(err !== undefined) return err
|
if(err !== undefined) return err
|
||||||
}else{
|
}else{
|
||||||
|
@ -5635,7 +5637,7 @@ class Parser extends Transform {
|
||||||
new CsvError('INVALID_OPENING_QUOTE', [
|
new CsvError('INVALID_OPENING_QUOTE', [
|
||||||
'Invalid Opening Quote:',
|
'Invalid Opening Quote:',
|
||||||
`a quote is found inside a field at line ${this.info.lines}`,
|
`a quote is found inside a field at line ${this.info.lines}`,
|
||||||
], this.options, this.__context(), {
|
], this.options, this.__infoField(), {
|
||||||
field: this.state.field,
|
field: this.state.field,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -5710,12 +5712,11 @@ class Parser extends Transform {
|
||||||
'record exceed the maximum number of tolerated bytes',
|
'record exceed the maximum number of tolerated bytes',
|
||||||
`of ${max_record_size}`,
|
`of ${max_record_size}`,
|
||||||
`at line ${this.info.lines}`,
|
`at line ${this.info.lines}`,
|
||||||
], this.options, this.__context())
|
], this.options, this.__infoField())
|
||||||
)
|
)
|
||||||
if(err !== undefined) return err
|
if(err !== undefined) return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)
|
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)
|
||||||
// rtrim in non quoting is handle in __onField
|
// rtrim in non quoting is handle in __onField
|
||||||
const rappend = rtrim === false || this.state.wasQuoting === false
|
const rappend = rtrim === false || this.state.wasQuoting === false
|
||||||
|
@ -5727,7 +5728,7 @@ class Parser extends Transform {
|
||||||
'Invalid Closing Quote:',
|
'Invalid Closing Quote:',
|
||||||
'found non trimable byte after quote',
|
'found non trimable byte after quote',
|
||||||
`at line ${this.info.lines}`,
|
`at line ${this.info.lines}`,
|
||||||
], this.options, this.__context())
|
], this.options, this.__infoField())
|
||||||
)
|
)
|
||||||
if(err !== undefined) return err
|
if(err !== undefined) return err
|
||||||
}
|
}
|
||||||
|
@ -5739,7 +5740,7 @@ class Parser extends Transform {
|
||||||
new CsvError('CSV_QUOTE_NOT_CLOSED', [
|
new CsvError('CSV_QUOTE_NOT_CLOSED', [
|
||||||
'Quote Not Closed:',
|
'Quote Not Closed:',
|
||||||
`the parsing is finished with an opening quote at line ${this.info.lines}`,
|
`the parsing is finished with an opening quote at line ${this.info.lines}`,
|
||||||
], this.options, this.__context())
|
], this.options, this.__infoField())
|
||||||
)
|
)
|
||||||
if(err !== undefined) return err
|
if(err !== undefined) return err
|
||||||
}else{
|
}else{
|
||||||
|
@ -5772,7 +5773,7 @@ class Parser extends Transform {
|
||||||
// Convert the first line into column names
|
// Convert the first line into column names
|
||||||
const recordLength = record.length
|
const recordLength = record.length
|
||||||
if(columns === true){
|
if(columns === true){
|
||||||
if(isRecordEmpty(record)){
|
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
|
||||||
this.__resetRecord()
|
this.__resetRecord()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5789,7 +5790,7 @@ class Parser extends Transform {
|
||||||
'Invalid Record Length:',
|
'Invalid Record Length:',
|
||||||
`expect ${this.state.expectedRecordLength},`,
|
`expect ${this.state.expectedRecordLength},`,
|
||||||
`got ${recordLength} on line ${this.info.lines}`,
|
`got ${recordLength} on line ${this.info.lines}`,
|
||||||
], this.options, this.__context(), {
|
], this.options, this.__infoField(), {
|
||||||
record: record,
|
record: record,
|
||||||
})
|
})
|
||||||
:
|
:
|
||||||
|
@ -5799,7 +5800,7 @@ class Parser extends Transform {
|
||||||
'Invalid Record Length:',
|
'Invalid Record Length:',
|
||||||
`columns length is ${columns.length},`, // rename columns
|
`columns length is ${columns.length},`, // rename columns
|
||||||
`got ${recordLength} on line ${this.info.lines}`,
|
`got ${recordLength} on line ${this.info.lines}`,
|
||||||
], this.options, this.__context(), {
|
], this.options, this.__infoField(), {
|
||||||
record: record,
|
record: record,
|
||||||
})
|
})
|
||||||
if(relax_column_count === true ||
|
if(relax_column_count === true ||
|
||||||
|
@ -5813,11 +5814,9 @@ class Parser extends Transform {
|
||||||
if(finalErr) return finalErr
|
if(finalErr) return finalErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(skip_lines_with_empty_values === true){
|
if(skip_lines_with_empty_values === true && isRecordEmpty(record)){
|
||||||
if(isRecordEmpty(record)){
|
this.__resetRecord()
|
||||||
this.__resetRecord()
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(this.state.recordHasError === true){
|
if(this.state.recordHasError === true){
|
||||||
this.__resetRecord()
|
this.__resetRecord()
|
||||||
|
@ -5826,6 +5825,7 @@ class Parser extends Transform {
|
||||||
}
|
}
|
||||||
this.info.records++
|
this.info.records++
|
||||||
if(from === 1 || this.info.records >= from){
|
if(from === 1 || this.info.records >= from){
|
||||||
|
// With columns, records are object
|
||||||
if(columns !== false){
|
if(columns !== false){
|
||||||
const obj = {}
|
const obj = {}
|
||||||
// Transform record array to an object
|
// Transform record array to an object
|
||||||
|
@ -5843,12 +5843,13 @@ class Parser extends Transform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const {objname} = this.options
|
const {objname} = this.options
|
||||||
|
// Without objname (default)
|
||||||
if(objname === undefined){
|
if(objname === undefined){
|
||||||
if(raw === true || info === true){
|
if(raw === true || info === true){
|
||||||
const err = this.__push(Object.assign(
|
const err = this.__push(Object.assign(
|
||||||
{record: obj},
|
{record: obj},
|
||||||
(raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {}),
|
(raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {}),
|
||||||
(info === true ? {info: this.state.info}: {})
|
(info === true ? {info: this.__infoRecord()}: {})
|
||||||
))
|
))
|
||||||
if(err){
|
if(err){
|
||||||
return err
|
return err
|
||||||
|
@ -5859,12 +5860,13 @@ class Parser extends Transform {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// With objname (default)
|
||||||
}else{
|
}else{
|
||||||
if(raw === true || info === true){
|
if(raw === true || info === true){
|
||||||
const err = this.__push(Object.assign(
|
const err = this.__push(Object.assign(
|
||||||
{record: [obj[objname], obj]},
|
{record: [obj[objname], obj]},
|
||||||
raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},
|
raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},
|
||||||
info === true ? {info: this.state.info}: {}
|
info === true ? {info: this.__infoRecord()}: {}
|
||||||
))
|
))
|
||||||
if(err){
|
if(err){
|
||||||
return err
|
return err
|
||||||
|
@ -5876,12 +5878,13 @@ class Parser extends Transform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Without columns, records are array
|
||||||
}else{
|
}else{
|
||||||
if(raw === true || info === true){
|
if(raw === true || info === true){
|
||||||
const err = this.__push(Object.assign(
|
const err = this.__push(Object.assign(
|
||||||
{record: record},
|
{record: record},
|
||||||
raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},
|
raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},
|
||||||
info === true ? {info: this.state.info}: {}
|
info === true ? {info: this.__infoRecord()}: {}
|
||||||
))
|
))
|
||||||
if(err){
|
if(err){
|
||||||
return err
|
return err
|
||||||
|
@ -5906,7 +5909,7 @@ class Parser extends Transform {
|
||||||
'Invalid Column Mapping:',
|
'Invalid Column Mapping:',
|
||||||
'expect an array from column function,',
|
'expect an array from column function,',
|
||||||
`got ${JSON.stringify(headers)}`
|
`got ${JSON.stringify(headers)}`
|
||||||
], this.options, this.__context(), {
|
], this.options, this.__infoField(), {
|
||||||
headers: headers,
|
headers: headers,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -5932,7 +5935,7 @@ class Parser extends Transform {
|
||||||
const {cast, encoding, rtrim, max_record_size} = this.options
|
const {cast, encoding, rtrim, max_record_size} = this.options
|
||||||
const {enabled, wasQuoting} = this.state
|
const {enabled, wasQuoting} = this.state
|
||||||
// Short circuit for the from_line options
|
// Short circuit for the from_line options
|
||||||
if(enabled === false){ /* this.options.columns !== true && */
|
if(enabled === false){
|
||||||
return this.__resetField()
|
return this.__resetField()
|
||||||
}
|
}
|
||||||
let field = this.state.field.toString(encoding)
|
let field = this.state.field.toString(encoding)
|
||||||
|
@ -5958,9 +5961,9 @@ class Parser extends Transform {
|
||||||
__push(record){
|
__push(record){
|
||||||
const {on_record} = this.options
|
const {on_record} = this.options
|
||||||
if(on_record !== undefined){
|
if(on_record !== undefined){
|
||||||
const context = this.__context()
|
const info = this.__infoRecord()
|
||||||
try{
|
try{
|
||||||
record = on_record.call(null, record, context)
|
record = on_record.call(null, record, info)
|
||||||
}catch(err){
|
}catch(err){
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -5978,10 +5981,10 @@ class Parser extends Transform {
|
||||||
if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){
|
if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){
|
||||||
return [undefined, undefined]
|
return [undefined, undefined]
|
||||||
}
|
}
|
||||||
const context = this.__context()
|
|
||||||
if(this.state.castField !== null){
|
if(this.state.castField !== null){
|
||||||
try{
|
try{
|
||||||
return [undefined, this.state.castField.call(null, field, context)]
|
const info = this.__infoField()
|
||||||
|
return [undefined, this.state.castField.call(null, field, info)]
|
||||||
}catch(err){
|
}catch(err){
|
||||||
return [err]
|
return [err]
|
||||||
}
|
}
|
||||||
|
@ -5989,7 +5992,8 @@ class Parser extends Transform {
|
||||||
if(this.__isFloat(field)){
|
if(this.__isFloat(field)){
|
||||||
return [undefined, parseFloat(field)]
|
return [undefined, parseFloat(field)]
|
||||||
}else if(this.options.cast_date !== false){
|
}else if(this.options.cast_date !== false){
|
||||||
return [undefined, this.options.cast_date.call(null, field, context)]
|
const info = this.__infoField()
|
||||||
|
return [undefined, this.options.cast_date.call(null, field, info)]
|
||||||
}
|
}
|
||||||
return [undefined, field]
|
return [undefined, field]
|
||||||
}
|
}
|
||||||
|
@ -6121,24 +6125,33 @@ class Parser extends Transform {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__context(){
|
__infoDataSet(){
|
||||||
|
return {
|
||||||
|
...this.info,
|
||||||
|
columns: this.options.columns
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__infoRecord(){
|
||||||
|
const {columns} = this.options
|
||||||
|
return {
|
||||||
|
...this.__infoDataSet(),
|
||||||
|
error: this.state.error,
|
||||||
|
header: columns === true,
|
||||||
|
index: this.state.record.length,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__infoField(){
|
||||||
const {columns} = this.options
|
const {columns} = this.options
|
||||||
const isColumns = Array.isArray(columns)
|
const isColumns = Array.isArray(columns)
|
||||||
return {
|
return {
|
||||||
|
...this.__infoRecord(),
|
||||||
column: isColumns === true ?
|
column: isColumns === true ?
|
||||||
( columns.length > this.state.record.length ?
|
( columns.length > this.state.record.length ?
|
||||||
columns[this.state.record.length].name :
|
columns[this.state.record.length].name :
|
||||||
null
|
null
|
||||||
) :
|
) :
|
||||||
this.state.record.length,
|
this.state.record.length,
|
||||||
empty_lines: this.info.empty_lines,
|
|
||||||
error: this.state.error,
|
|
||||||
header: columns === true,
|
|
||||||
index: this.state.record.length,
|
|
||||||
invalid_field_length: this.info.invalid_field_length,
|
|
||||||
quoting: this.state.wasQuoting,
|
quoting: this.state.wasQuoting,
|
||||||
lines: this.info.lines,
|
|
||||||
records: this.info.records
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6175,10 +6188,10 @@ const parse = function(){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
parser.on('error', function(err){
|
parser.on('error', function(err){
|
||||||
callback(err, undefined, parser.info)
|
callback(err, undefined, parser.__infoDataSet())
|
||||||
})
|
})
|
||||||
parser.on('end', function(){
|
parser.on('end', function(){
|
||||||
callback(undefined, records, parser.info)
|
callback(undefined, records, parser.__infoDataSet())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(data !== undefined){
|
if(data !== undefined){
|
||||||
|
|
Loading…
Reference in a new issue