Add Job System (#656)
* Add Job System * Remove testing stuff * changelog * plugin work * Convert a couple more jobs * simplify callback * assert * Logging changes and rendezvous perf * changelog * sb segment viewed job * clear cache, and few changes * Lint fix * a couple more jobs * reduce rendezvous in web server * refactor * Lint fix * no message * test shutdown * comment * free fields --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
45983a67af
commit
d70a07049a
74 files changed
+1090
-298
No files matched your search
@@ -1,4 +1,5 @@
|
||||
// This plugin generates logging functions based on the usage of the LogError, LogWarn, LogInfo, and LogDebug functions.
|
||||
// Also strips out print statements and comments when not in debug mode.
|
||||
|
||||
import {
|
||||
AstEditor,
|
||||
@@ -102,10 +103,25 @@ export class LoggerPlugin implements CompilerPlugin {
|
||||
const isDebug = !!event.program.options.debug;
|
||||
|
||||
const visitor = createVisitor({
|
||||
PrintStatement: (statement) => {
|
||||
if (!isDebug) {
|
||||
event.editor.overrideTranspileResult(statement, '');
|
||||
}
|
||||
},
|
||||
CommentStatement: (statement) => {
|
||||
if (!isDebug) {
|
||||
event.editor.overrideTranspileResult(statement, '');
|
||||
}
|
||||
},
|
||||
ExpressionStatement: (statement) => {
|
||||
// @ts-ignore
|
||||
const funcName = statement.expression.callee?.name?.text;
|
||||
if (funcName && logFunctionKeys.includes(funcName)) {
|
||||
if (!isDebug && funcName === 'LogDebug') {
|
||||
event.editor.overrideTranspileResult(statement, '');
|
||||
return;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
const args = statement.expression.args;
|
||||
if (isDebug) {
|
||||
|
||||
Reference in new issue
Block a user