Merge pull request #533 from docker/dependabot/npm_and_yarn/csv-parse-5.0.4

Bump csv-parse from 4.16.3 to 5.0.4
This commit is contained in:
CrazyMax 2022-04-25 06:51:12 +02:00 committed by GitHub
commit ba317382dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 25 deletions

6
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

@ -1,10 +1,13 @@
module.exports = { module.exports = {
clearMocks: false, clearMocks: false,
moduleFileExtensions: ['js', 'ts'], moduleFileExtensions: ['js', 'ts'],
setupFiles: ["dotenv/config"], setupFiles: ['dotenv/config'],
testMatch: ['**/*.test.ts'], testMatch: ['**/*.test.ts'],
transform: { transform: {
'^.+\\.ts$': 'ts-jest' '^.+\\.ts$': 'ts-jest'
}, },
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
verbose: true verbose: true
} };

@ -31,7 +31,7 @@
"@actions/core": "^1.6.0", "@actions/core": "^1.6.0",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^5.0.1", "@actions/github": "^5.0.1",
"csv-parse": "^4.16.3", "csv-parse": "^5.0.4",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"semver": "^7.3.7", "semver": "^7.3.7",
"tmp": "^0.2.1" "tmp": "^0.2.1"

@ -1,4 +1,4 @@
import csvparse from 'csv-parse/lib/sync'; import {parse} from 'csv-parse/sync';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
@ -77,18 +77,19 @@ export async function getSecret(kvp: string, file: boolean): Promise<string> {
} }
export function isLocalOrTarExporter(outputs: string[]): boolean { export function isLocalOrTarExporter(outputs: string[]): boolean {
for (const output of csvparse(outputs.join(`\n`), { const records = parse(outputs.join(`\n`), {
delimiter: ',', delimiter: ',',
trim: true, trim: true,
columns: false, columns: false,
relaxColumnCount: true relaxColumnCount: true
})) { });
for (const record of records) {
// Local if no type is defined // Local if no type is defined
// https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43 // https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43
if (output.length == 1 && !output[0].startsWith('type=')) { if (record.length == 1 && !record[0].startsWith('type=')) {
return true; return true;
} }
for (const [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) { for (const [key, value] of record.map(chunk => chunk.split('=').map(item => item.trim()))) {
if (key == 'type' && (value == 'local' || value == 'tar')) { if (key == 'type' && (value == 'local' || value == 'tar')) {
return true; return true;
} }

@ -1,4 +1,4 @@
import csvparse from 'csv-parse/lib/sync'; import {parse} from 'csv-parse/sync';
import * as fs from 'fs'; import * as fs from 'fs';
import * as os from 'os'; import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
@ -217,20 +217,22 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
return res; return res;
} }
for (const output of (await csvparse(items, { const records = await parse(items, {
columns: false, columns: false,
relax: true, relaxQuotes: true,
relaxColumnCount: true, relaxColumnCount: true,
skipLinesWithEmptyValues: true skipEmptyLines: true
})) as Array<string[]>) { });
if (output.length == 1) {
res.push(output[0]); for (const record of records as Array<string[]>) {
if (record.length == 1) {
res.push(record[0]);
continue; continue;
} else if (!ignoreComma) { } else if (!ignoreComma) {
res.push(...output); res.push(...record);
continue; continue;
} }
res.push(output.join(',')); res.push(record.join(','));
} }
return res.filter(item => item).map(pat => pat.trim()); return res.filter(item => item).map(pat => pat.trim());

@ -1601,10 +1601,10 @@ cssstyle@^2.3.0:
dependencies: dependencies:
cssom "~0.3.6" cssom "~0.3.6"
csv-parse@*, csv-parse@^4.16.3: csv-parse@*, csv-parse@^5.0.4:
version "4.16.3" version "5.0.4"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.3.tgz#7ca624d517212ebc520a36873c3478fa66efbaf7" resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.0.4.tgz#97e5e654413bcf95f2714ce09bcb2be6de0eb8e3"
integrity sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg== integrity sha512-5AIdl8l6n3iYQYxan5djB5eKDa+vBnhfWZtRpJTcrETWfVLYN0WSj3L9RwvgYt+psoO77juUr8TG8qpfGZifVQ==
data-urls@^2.0.0: data-urls@^2.0.0:
version "2.0.0" version "2.0.0"