-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into getCodeActions
- Loading branch information
Showing
11 changed files
with
182 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = async (suite, name, brighterscript, projectPath, options) => { | ||
const { ProgramBuilder } = brighterscript; | ||
|
||
const builder = new ProgramBuilder(); | ||
//run the first run | ||
await builder.run({ | ||
cwd: projectPath, | ||
createPackage: false, | ||
copyToStaging: false, | ||
//disable diagnostic reporting (they still get collected) | ||
diagnosticFilters: ['**/*'], | ||
logLevel: 'error' | ||
}); | ||
//collect all the XML files | ||
const files = Object.values(builder.program.files).filter(x => ['.brs', '.bs', '.d.bs'].includes(x.extension)); | ||
if (files.length === 0) { | ||
console.log('[parse-brs] No brs files found in program'); | ||
return; | ||
} | ||
suite.add(name, (deferred) => { | ||
const promises = []; | ||
for (const file of files) { | ||
promises.push( | ||
builder.program.addOrReplaceFile(file.pkgPath, file.fileContents) | ||
); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
Promise.all(promises).then(() => deferred.resolve()); | ||
}, { | ||
...options, | ||
'defer': true | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = async (suite, name, brighterscript, projectPath, options) => { | ||
const { ProgramBuilder } = brighterscript; | ||
|
||
const builder = new ProgramBuilder(); | ||
//run the first run | ||
await builder.run({ | ||
cwd: projectPath, | ||
createPackage: false, | ||
copyToStaging: false, | ||
//disable diagnostic reporting (they still get collected) | ||
diagnosticFilters: ['**/*'], | ||
logLevel: 'error' | ||
}); | ||
//collect all the brs files | ||
const files = Object.values(builder.program.files).filter(x => ['.brs', '.bs'].includes(x.extension)); | ||
|
||
//flag every file for transpilation | ||
for (const file of files) { | ||
file.needsTranspiled = true; | ||
} | ||
|
||
if (files.length === 0) { | ||
console.log('[transpile-brs] No brs|bs|d.bs files found in program'); | ||
return; | ||
} | ||
suite.add(name, () => { | ||
for (const x of files) { | ||
x.transpile(); | ||
} | ||
}, options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module.exports = async (suite, name, brighterscript, projectPath, options) => { | ||
const { ProgramBuilder } = brighterscript; | ||
|
||
const builder = new ProgramBuilder(); | ||
//run the first run outside of the test | ||
await builder.run({ | ||
cwd: projectPath, | ||
createPackage: false, | ||
copyToStaging: false, | ||
//disable diagnostic reporting (they still get collected) | ||
diagnosticFilters: ['**/*'], | ||
logLevel: 'error' | ||
}); | ||
if (Object.keys(builder.program.files).length === 0) { | ||
throw new Error('No files found in program'); | ||
} | ||
|
||
const files = Object.values(builder.program.files); | ||
|
||
//force transpile for every file | ||
for (const file of files) { | ||
file.needsTranspiled = true; | ||
} | ||
|
||
suite.add(name, () => { | ||
for (const file of files) { | ||
file.transpile(); | ||
} | ||
}, options); | ||
}; |
Oops, something went wrong.