Skip to content

Commit dcfd6d4

Browse files
authored
Merge pull request #1307 from github/dependabot/npm_and_yarn/extensions/ql-vscode/js-yaml-4.1.0
Bump js-yaml from 3.14.0 to 4.1.0 in /extensions/ql-vscode
2 parents 50197ba + 4e4d8b2 commit dcfd6d4

14 files changed

Lines changed: 87 additions & 95 deletions

File tree

extensions/ql-vscode/gulpfile.ts/textmate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ function transformFile(yaml: any) {
219219
}
220220

221221
export function transpileTextMateGrammar() {
222-
return through.obj((file: Vinyl, _encoding: string, callback: Function): void => {
222+
return through.obj((file: Vinyl, _encoding: string, callback: (err: string | null, file: Vinyl | PluginError) => void): void => {
223223
if (file.isNull()) {
224224
callback(null, file);
225225
}
226226
else if (file.isBuffer()) {
227227
const buf: Buffer = file.contents;
228228
const yamlText: string = buf.toString('utf8');
229-
const jsonData: any = jsYaml.safeLoad(yamlText);
229+
const jsonData: any = jsYaml.load(yamlText);
230230
transformFile(jsonData);
231231

232232
file.contents = Buffer.from(JSON.stringify(jsonData, null, 2), 'utf8');

extensions/ql-vscode/package-lock.json

Lines changed: 63 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@
11391139
"d3-graphviz": "^2.6.1",
11401140
"fs-extra": "^10.0.1",
11411141
"glob-promise": "^3.4.0",
1142-
"js-yaml": "^3.14.0",
1142+
"js-yaml": "^4.1.0",
11431143
"minimist": "~1.2.6",
11441144
"nanoid": "^3.2.0",
11451145
"node-fetch": "~2.6.7",

extensions/ql-vscode/src/contextual/queryResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function resolveQueriesFromPacks(cli: CodeQLCliServer, qlpacks: string[],
4545
}
4646
});
4747
}
48-
await fs.writeFile(suiteFile, yaml.safeDump(suiteYaml), 'utf8');
48+
await fs.writeFile(suiteFile, yaml.dump(suiteYaml), 'utf8');
4949

5050
const queries = await cli.resolveQueriesInSuite(suiteFile, helpers.getOnDiskWorkspaceFolders());
5151
return queries;

extensions/ql-vscode/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ interface QlPackWithPath {
289289
async function findDbschemePack(packs: QlPackWithPath[], dbschemePath: string): Promise<{ name: string; isLibraryPack: boolean; }> {
290290
for (const { packDir, packName } of packs) {
291291
if (packDir !== undefined) {
292-
const qlpack = yaml.safeLoad(await fs.readFile(path.join(packDir, 'qlpack.yml'), 'utf8')) as { dbscheme?: string; library?: boolean; };
292+
const qlpack = yaml.load(await fs.readFile(path.join(packDir, 'qlpack.yml'), 'utf8')) as { dbscheme?: string; library?: boolean; };
293293
if (qlpack.dbscheme !== undefined && path.basename(qlpack.dbscheme) === path.basename(dbschemePath)) {
294294
return {
295295
name: packName,

extensions/ql-vscode/src/quick-query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export async function displayQuickQuery(
123123
version: '1.0.0',
124124
libraryPathDependencies: [qlpack]
125125
};
126-
await fs.writeFile(qlPackFile, QLPACK_FILE_HEADER + yaml.safeDump(quickQueryQlpackYaml), 'utf8');
126+
await fs.writeFile(qlPackFile, QLPACK_FILE_HEADER + yaml.dump(quickQueryQlpackYaml), 'utf8');
127127
}
128128

129129
if (shouldRewrite || !(await fs.pathExists(qlFile))) {
@@ -144,6 +144,6 @@ async function checkShouldRewrite(qlPackFile: string, newDependency: string) {
144144
if (!(await fs.pathExists(qlPackFile))) {
145145
return true;
146146
}
147-
const qlPackContents: any = yaml.safeLoad(await fs.readFile(qlPackFile, 'utf8'));
147+
const qlPackContents: any = yaml.load(await fs.readFile(qlPackFile, 'utf8'));
148148
return qlPackContents.libraryPathDependencies?.[0] !== newDependency;
149149
}

extensions/ql-vscode/src/remote-queries/run-remote-query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async function generateQueryPack(cliServer: cli.CodeQLCliServer, queryFile: stri
110110
[`codeql/${language}-all`]: '*',
111111
}
112112
};
113-
await fs.writeFile(path.join(queryPackDir, 'qlpack.yml'), yaml.safeDump(syntheticQueryPack));
113+
await fs.writeFile(path.join(queryPackDir, 'qlpack.yml'), yaml.dump(syntheticQueryPack));
114114
}
115115
if (!language) {
116116
throw new UserCancellationException('Could not determine language.');
@@ -378,7 +378,7 @@ export function parseResponse(owner: string, repo: string, response: QueriesResp
378378
*/
379379
async function ensureNameAndSuite(queryPackDir: string, packRelativePath: string): Promise<void> {
380380
const packPath = path.join(queryPackDir, 'qlpack.yml');
381-
const qlpack = yaml.safeLoad(await fs.readFile(packPath, 'utf8')) as QlPack;
381+
const qlpack = yaml.load(await fs.readFile(packPath, 'utf8')) as QlPack;
382382
delete qlpack.defaultSuiteFile;
383383

384384
qlpack.name = QUERY_PACK_NAME;
@@ -388,7 +388,7 @@ async function ensureNameAndSuite(queryPackDir: string, packRelativePath: string
388388
}, {
389389
query: packRelativePath.replace(/\\/g, '/')
390390
}];
391-
await fs.writeFile(packPath, yaml.safeDump(qlpack));
391+
await fs.writeFile(packPath, yaml.dump(qlpack));
392392
}
393393

394394
async function buildRemoteQueryEntity(

extensions/ql-vscode/src/vscode-tests/cli-integration/queries.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ describe('Queries', function() {
149149
expect(fs.pathExistsSync(qlFile)).to.be.true;
150150
expect(fs.pathExistsSync(qlpackFile)).to.be.true;
151151

152-
const qlpackContents: any = await yaml.safeLoad(
152+
const qlpackContents: any = await yaml.load(
153153
fs.readFileSync(qlpackFile, 'utf8')
154154
);
155155
// Should have chosen the js libraries
156156
expect(qlpackContents.libraryPathDependencies[0]).to.include('javascript');
157157
});
158158

159159
it('should avoid creating a quick query', async () => {
160-
fs.writeFileSync(qlpackFile, yaml.safeDump({
160+
fs.writeFileSync(qlpackFile, yaml.dump({
161161
name: 'quick-query',
162162
version: '1.0.0',
163163
libraryPathDependencies: ['codeql-javascript']

0 commit comments

Comments
 (0)