Skip to content

Commit d950552

Browse files
authored
Allow trailing commas while minifying json resources (microsoft#165870)
I noticed a few of our built-in extension's json resources were not being minified. The root cause appears to be trailing commas in the json
1 parent c05297c commit d950552

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

build/lib/extensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function minifyExtensionResources(input) {
3737
.pipe(buffer())
3838
.pipe(es.mapSync((f) => {
3939
const errors = [];
40-
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
40+
const value = jsoncParser.parse(f.contents.toString('utf8'), errors, { allowTrailingComma: true });
4141
if (errors.length === 0) {
4242
// file parsed OK => just stringify to drop whitespace and comments
4343
f.contents = Buffer.from(JSON.stringify(value));

build/lib/extensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function minifyExtensionResources(input: Stream): Stream {
3939
.pipe(buffer())
4040
.pipe(es.mapSync((f: File) => {
4141
const errors: jsoncParser.ParseError[] = [];
42-
const value = jsoncParser.parse(f.contents.toString('utf8'), errors);
42+
const value = jsoncParser.parse(f.contents.toString('utf8'), errors, { allowTrailingComma: true });
4343
if (errors.length === 0) {
4444
// file parsed OK => just stringify to drop whitespace and comments
4545
f.contents = Buffer.from(JSON.stringify(value));

0 commit comments

Comments
 (0)