Skip to content

Commit ba31738

Browse files
authored
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
2 parents 84580d7 + 43721d2 commit ba31738

File tree

7 files changed

+31
-25
lines changed

7 files changed

+31
-25
lines changed

dist/index.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
module.exports = {
22
clearMocks: false,
33
moduleFileExtensions: ['js', 'ts'],
4-
setupFiles: ["dotenv/config"],
4+
setupFiles: ['dotenv/config'],
55
testMatch: ['**/*.test.ts'],
66
transform: {
77
'^.+\\.ts$': 'ts-jest'
88
},
9+
moduleNameMapper: {
10+
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
11+
},
912
verbose: true
10-
}
13+
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@actions/core": "^1.6.0",
3232
"@actions/exec": "^1.1.1",
3333
"@actions/github": "^5.0.1",
34-
"csv-parse": "^4.16.3",
34+
"csv-parse": "^5.0.4",
3535
"handlebars": "^4.7.7",
3636
"semver": "^7.3.7",
3737
"tmp": "^0.2.1"

src/buildx.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import csvparse from 'csv-parse/lib/sync';
1+
import {parse} from 'csv-parse/sync';
22
import fs from 'fs';
33
import path from 'path';
44
import * as semver from 'semver';
@@ -77,18 +77,19 @@ export async function getSecret(kvp: string, file: boolean): Promise<string> {
7777
}
7878

7979
export function isLocalOrTarExporter(outputs: string[]): boolean {
80-
for (const output of csvparse(outputs.join(`\n`), {
80+
const records = parse(outputs.join(`\n`), {
8181
delimiter: ',',
8282
trim: true,
8383
columns: false,
8484
relaxColumnCount: true
85-
})) {
85+
});
86+
for (const record of records) {
8687
// Local if no type is defined
8788
// https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43
88-
if (output.length == 1 && !output[0].startsWith('type=')) {
89+
if (record.length == 1 && !record[0].startsWith('type=')) {
8990
return true;
9091
}
91-
for (const [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) {
92+
for (const [key, value] of record.map(chunk => chunk.split('=').map(item => item.trim()))) {
9293
if (key == 'type' && (value == 'local' || value == 'tar')) {
9394
return true;
9495
}

src/context.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import csvparse from 'csv-parse/lib/sync';
1+
import {parse} from 'csv-parse/sync';
22
import * as fs from 'fs';
33
import * as os from 'os';
44
import * as path from 'path';
@@ -217,20 +217,22 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
217217
return res;
218218
}
219219

220-
for (const output of (await csvparse(items, {
220+
const records = await parse(items, {
221221
columns: false,
222-
relax: true,
222+
relaxQuotes: true,
223223
relaxColumnCount: true,
224-
skipLinesWithEmptyValues: true
225-
})) as Array<string[]>) {
226-
if (output.length == 1) {
227-
res.push(output[0]);
224+
skipEmptyLines: true
225+
});
226+
227+
for (const record of records as Array<string[]>) {
228+
if (record.length == 1) {
229+
res.push(record[0]);
228230
continue;
229231
} else if (!ignoreComma) {
230-
res.push(...output);
232+
res.push(...record);
231233
continue;
232234
}
233-
res.push(output.join(','));
235+
res.push(record.join(','));
234236
}
235237

236238
return res.filter(item => item).map(pat => pat.trim());

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1601,10 +1601,10 @@ cssstyle@^2.3.0:
16011601
dependencies:
16021602
cssom "~0.3.6"
16031603

1604-
csv-parse@*, csv-parse@^4.16.3:
1605-
version "4.16.3"
1606-
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.3.tgz#7ca624d517212ebc520a36873c3478fa66efbaf7"
1607-
integrity sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==
1604+
csv-parse@*, csv-parse@^5.0.4:
1605+
version "5.0.4"
1606+
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.0.4.tgz#97e5e654413bcf95f2714ce09bcb2be6de0eb8e3"
1607+
integrity sha512-5AIdl8l6n3iYQYxan5djB5eKDa+vBnhfWZtRpJTcrETWfVLYN0WSj3L9RwvgYt+psoO77juUr8TG8qpfGZifVQ==
16081608

16091609
data-urls@^2.0.0:
16101610
version "2.0.0"

0 commit comments

Comments
 (0)