rflib-plugin 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/rflib/logging/apex/instrument.d.ts +1 -0
- package/lib/commands/rflib/logging/apex/instrument.js +44 -98
- package/lib/commands/rflib/logging/apex/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/aura/instrument.d.ts +1 -0
- package/lib/commands/rflib/logging/aura/instrument.js +18 -49
- package/lib/commands/rflib/logging/aura/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/flow/instrument.d.ts +1 -0
- package/lib/commands/rflib/logging/flow/instrument.js +9 -2
- package/lib/commands/rflib/logging/flow/instrument.js.map +1 -1
- package/lib/commands/rflib/logging/lwc/instrument.d.ts +1 -0
- package/lib/commands/rflib/logging/lwc/instrument.js +18 -49
- package/lib/commands/rflib/logging/lwc/instrument.js.map +1 -1
- package/lib/shared/concurrency.d.ts +1 -0
- package/lib/shared/concurrency.js +16 -0
- package/lib/shared/concurrency.js.map +1 -0
- package/lib/shared/formatting.d.ts +9 -0
- package/lib/shared/formatting.js +45 -0
- package/lib/shared/formatting.js.map +1 -0
- package/lib/shared/types.d.ts +15 -0
- package/lib/shared/types.js +2 -0
- package/lib/shared/types.js.map +1 -0
- package/messages/rflib.logging.apex.instrument.md +8 -0
- package/messages/rflib.logging.aura.instrument.md +8 -0
- package/messages/rflib.logging.flow.instrument.md +8 -0
- package/messages/rflib.logging.lwc.instrument.md +8 -0
- package/oclif.manifest.json +41 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/lwc/instrument.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6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AAQ,EAAE,CAAC,CAAC;oBAC/D,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;oBAC9C,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;wBAChC,IAAI,CAAC,GAAG,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable no-await-in-loop */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as prettier from 'prettier';\nimport { minimatch } from 'minimatch';\n\ntype InstrumentationOptions = {\n readonly prettier: boolean;\n readonly noIf: boolean;\n readonly skipInstrumented: boolean;\n readonly verbose: boolean;\n readonly exclude?: string;\n}\n\ntype LoggerInfo = {\n readonly exists: boolean;\n readonly variableName: string;\n}\n\ntype IfCondition = {\n readonly condition: string;\n readonly position: number;\n}\n\nexport type RflibLoggingLwcInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n modifiedFilePaths?: string[];\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.lwc.instrument');\n\nclass LwcInstrumentationService {\n private static readonly IMPORT_REGEX = /import\\s*{\\s*createLogger\\s*}\\s*from\\s*['\"]c\\/rflibLogger['\"]/;\n private static readonly LOGGER_REGEX = /const\\s+(\\w+)\\s*=\\s*createLogger\\s*\\(['\"]([\\w-]+)['\"]\\)/;\n private static readonly METHOD_REGEX =\n /(?:async\\s+)?(?!(?:if|switch|case|while|for|catch)\\b)(\\b\\w+)\\s*\\((.*?)\\)\\s*{/g;\n private static readonly EXPORT_DEFAULT_REGEX = /export\\s+default\\s+class\\s+(\\w+)/;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX =\n /}\\s*else(?!\\s+if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{].*?)(?=\\n|;|$))/g;\n private static readonly PROMISE_CHAIN_REGEX =\n /\\.(then|catch|finally)\\s*\\(\\s*(?:async\\s+)?(?:\\(?([^)]*)\\)?)?\\s*=>\\s*(?:\\{((?:[^{}]|`[^`]*`)*?)\\}|([^{;]*?(?:\\.[^{;]*?)*(?:\\([^)]*\\))?)(?=\\s*(?:\\)\\)|\\.|\\))))/g;\n private static readonly TRY_CATCH_BLOCK_REGEX = /try\\s*{[\\s\\S]*?}\\s*catch\\s*\\(([^)]*)\\)\\s*{/g;\n private static readonly CONSOLE_LOG_REGEX = /console\\.(log|debug|info|warn|error)\\s*\\(\\s*([^)]+)\\s*\\)\\s*;?/g;\n\n private static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'babel',\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n public static async formatContent(content: string): Promise<string> {\n try {\n return await prettier.format(content, this.PRETTIER_CONFIG);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Formatting failed: ${error.message}`);\n }\n throw new Error('Formatting failed with unknown error');\n }\n }\n\n public static isInstrumented(content: string): boolean {\n return this.IMPORT_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.LOGGER_REGEX);\n return {\n exists: match !== null,\n variableName: match ? match[1] : 'logger',\n };\n }\n\n public static addImportAndLogger(content: string, componentName: string): string {\n let modified = content;\n\n if (!this.IMPORT_REGEX.test(content)) {\n modified = `import { createLogger } from 'c/rflibLogger';\\n${modified}`;\n }\n\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const exportMatch = content.match(this.EXPORT_DEFAULT_REGEX);\n const className = exportMatch ? exportMatch[1] : componentName;\n const loggerDeclaration = `\\nconst ${variableName} = createLogger('${className}');\\n`;\n modified = modified.replace(this.EXPORT_DEFAULT_REGEX, `${loggerDeclaration}$&`);\n }\n\n return modified;\n }\n\n public static processIfStatements(content: string, loggerName: string): string {\n const conditions: IfCondition[] = [];\n\n let modified = content.replace(\n this.IF_STATEMENT_REGEX,\n (match: string, condition: string, blockBody: string, singleLineBody: string, offset: number) => {\n const cleanedUpCondition = condition.trim().replaceAll(\"'\", \"\\\\'\");\n conditions.push({ condition: cleanedUpCondition, position: offset });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\n }`;\n }\n return match;\n },\n );\n\n modified = modified.replace(\n this.ELSE_REGEX,\n (match: string, blockBody: string, singleLineBody: string, offset: number) => {\n const nearestIf = conditions\n .filter((c) => c.position <= (offset ?? 0))\n .reduce((prev, curr) => (!prev || curr.position > prev.position ? curr : prev));\n\n const logStatement = nearestIf\n ? `${loggerName}.debug('else for if (${nearestIf.condition})');\\n `\n : `${loggerName}.debug('else statement');\\n `;\n\n if (blockBody) {\n return `} else {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n return `} else {\\n ${logStatement}${singleLineBody};\\n }`;\n }\n return match;\n },\n );\n\n return modified;\n }\n\n public static processMethodLogging(content: string, loggerName: string, options: InstrumentationOptions): string {\n let modified = content.replace(this.METHOD_REGEX, (match: string, methodName: string, args: string) => {\n const parameters = args\n .split(',')\n .map((p) => p.trim())\n .filter((p) => p);\n const placeholders = parameters.map((_, i) => `{${i}}`).join(', ');\n const logArgs = parameters.length > 0 ? `, ${parameters.join(', ')}` : '';\n\n return `${match}\\n ${loggerName}.info('${methodName}(${placeholders})'${logArgs});`;\n });\n\n if (!options.noIf) {\n modified = this.processIfStatements(modified, loggerName);\n }\n\n return modified;\n }\n\n public static processTryCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.TRY_CATCH_BLOCK_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const errorVar = exceptionVar.trim().split(' ')[0] || 'error';\n\n return match.replace(\n /catch\\s*\\(([^)]*)\\)\\s*{/,\n `catch(${exceptionVar}) {\n ${loggerName}.error('An error occurred in function ${methodName}()', ${errorVar});`,\n );\n });\n }\n\n public static processPromiseChains(content: string, loggerName: string): string {\n return content.replace(\n this.PROMISE_CHAIN_REGEX,\n (match, type, param, blockBody, singleLineBody, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const paramName = typeof param === 'string' ? param.trim() : type === 'then' ? 'result' : 'error';\n const indentation = match.match(/\\n\\s*/)?.[0] ?? '\\n ';\n\n let logStatement: string;\n switch (type) {\n case 'then':\n logStatement = `${loggerName}.info('${methodName}() promise resolved. Result={0}', ${paramName});`;\n break;\n case 'catch':\n logStatement = `${loggerName}.error('An error occurred in function ${methodName}()', ${paramName});`;\n break;\n case 'finally':\n logStatement = `${loggerName}.info('${methodName}() promise chain completed');`;\n break;\n default:\n logStatement = '';\n }\n\n if (singleLineBody) {\n const trimmedBody = (singleLineBody as string).trim();\n const adjustedBody =\n trimmedBody.split(')').length > trimmedBody.split('(').length ? trimmedBody.slice(0, -1) : trimmedBody;\n\n return `.${type}((${paramName}) => {\n ${logStatement}\n return ${adjustedBody};\n }`;\n }\n\n if (blockBody) {\n return `.${type}((${paramName}) => {${indentation}${logStatement}${indentation}${blockBody}}`;\n }\n\n return match;\n },\n );\n }\n\n public static processConsoleStatements(methodBody: string, loggerName: string): string {\n return methodBody.replace(this.CONSOLE_LOG_REGEX, (match: string, logType: string, argument: string) => {\n const logLevel = logType === 'info' || logType === 'warn' || logType === 'error' ? logType : 'debug';\n return `${loggerName}.${logLevel}(${argument});`;\n });\n }\n\n private static findEnclosingMethod(content: string, position: number): string {\n const beforeCatch = content.substring(0, position);\n const methods = [...beforeCatch.matchAll(this.METHOD_REGEX)].reverse();\n const closestMethod = methods[0];\n return closestMethod ? closestMethod[1] : 'unknown';\n }\n}\n\nexport default class RflibLoggingLwcInstrument extends SfCommand<RflibLoggingLwcInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n char: 's',\n required: true,\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n }),\n dryrun: Flags.boolean({\n char: 'd',\n default: false,\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n }),\n prettier: Flags.boolean({\n char: 'p',\n default: false,\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\n }),\n 'no-if': Flags.boolean({\n summary: messages.getMessage('flags.no-if.summary'),\n description: messages.getMessage('flags.no-if.description'),\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary'),\n description: messages.getMessage('flags.skip-instrumented.description'),\n default: false,\n }),\n verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingLwcInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n modifiedFilePaths: [],\n };\n\n public async run(): Promise<RflibLoggingLwcInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const { flags } = await this.parse(RflibLoggingLwcInstrument);\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n skipInstrumented: flags['skip-instrumented'],\n verbose: flags.verbose,\n exclude: flags.exclude,\n };\n\n this.log(`Scanning LWC components in ${flags.sourcepath}...`);\n\n this.spinner.start('Running...');\n\n const files = await this.findAllLwcFiles(flags.sourcepath, instrumentationOpts.exclude);\n await Promise.all(\n files.map(async (filePath) => {\n await this.instrumentLwcFile(filePath, flags.dryrun, instrumentationOpts);\n })\n );\n\n this.spinner.stop();\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n this.log(`Formatted files: ${this.stats.formattedFiles}`);\n\n return { ...this.stats };\n }\n\n private async findAllLwcFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (excludePattern && minimatch(filePath, excludePattern, { matchBase: true })) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllLwcFiles(filePath, excludePattern);\n }\n\n const parentDir = path.dirname(filePath);\n if (\n entry.name.endsWith('.js') &&\n !parentDir.includes('aura') &&\n !parentDir.includes('__tests__')\n ) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentLwcFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const componentName = path.basename(path.dirname(filePath));\n this.logger.debug(`Processing LWC: ${componentName}`);\n\n try {\n this.stats.processedFiles++;\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && LwcInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented component: ${componentName}`);\n return;\n }\n\n const { variableName } = LwcInstrumentationService.detectLogger(content);\n content = LwcInstrumentationService.addImportAndLogger(content, componentName);\n content = LwcInstrumentationService.processMethodLogging(content, variableName, instrumentationOpts);\n content = LwcInstrumentationService.processTryCatchBlocks(content, variableName);\n content = LwcInstrumentationService.processPromiseChains(content, variableName);\n content = LwcInstrumentationService.processConsoleStatements(content, variableName);\n\n if (content !== originalContent) {\n this.stats.modifiedFiles++;\n this.stats.modifiedFilePaths?.push(filePath);\n if (!isDryRun) {\n try {\n const finalContent = instrumentationOpts.prettier\n ? await LwcInstrumentationService.formatContent(content)\n : content;\n\n await fs.promises.writeFile(filePath, finalContent);\n\n if (instrumentationOpts.prettier) {\n this.stats.formattedFiles++;\n this.logger.info(`Modified and formatted: ${filePath}`);\n } else {\n this.logger.info(`Modified: ${filePath}`);\n }\n } catch (error) {\n this.logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);\n await fs.promises.writeFile(filePath, content);\n this.logger.info(`Modified without formatting: ${filePath}`);\n }\n } else {\n this.logger.info(`Would modify: ${filePath}`);\n if (instrumentationOpts.verbose) {\n this.log(`Would modify: ${filePath}`);\n }\n }\n }\n } catch (error) {\n this.logger.error(`Error processing LWC ${componentName}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../../../src/commands/rflib/logging/lwc/instrument.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,SA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AAe,EACf,mBAAmB,EACnB,QAAQ,EACR,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EACtB,yBAAyB,CAAC,eAAe,CAC1C,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC","sourcesContent":["/* eslint-disable no-await-in-loop */\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { SfCommand, Flags } from '@salesforce/sf-plugins-core';\nimport { Messages, Logger } from '@salesforce/core';\nimport * as prettier from 'prettier';\nimport { minimatch } from 'minimatch';\nimport { processWithConcurrency } from '../../../../shared/concurrency.js';\n\nimport { IfCondition, InstrumentationOptions, LoggerInfo } from '../../../../shared/types.js';\nimport { writeInstrumentedFile } from '../../../../shared/formatting.js';\n\nexport type RflibLoggingLwcInstrumentResult = {\n processedFiles: number;\n modifiedFiles: number;\n formattedFiles: number;\n modifiedFilePaths?: string[];\n}\n\nMessages.importMessagesDirectoryFromMetaUrl(import.meta.url);\nconst messages = Messages.loadMessages('rflib-plugin', 'rflib.logging.lwc.instrument');\n\nclass LwcInstrumentationService {\n public static readonly PRETTIER_CONFIG: prettier.Options = {\n parser: 'babel',\n printWidth: 120,\n tabWidth: 4,\n useTabs: false,\n singleQuote: true,\n };\n\n private static readonly IMPORT_REGEX = /import\\s*{\\s*createLogger\\s*}\\s*from\\s*['\"]c\\/rflibLogger['\"]/;\n private static readonly LOGGER_REGEX = /const\\s+(\\w+)\\s*=\\s*createLogger\\s*\\(['\"]([\\w-]+)['\"]\\)/;\n private static readonly METHOD_REGEX =\n /(?:async\\s+)?(?!(?:if|switch|case|while|for|catch)\\b)(\\b\\w+)\\s*\\((.*?)\\)\\s*{/g;\n private static readonly EXPORT_DEFAULT_REGEX = /export\\s+default\\s+class\\s+(\\w+)/;\n private static readonly IF_STATEMENT_REGEX =\n /if\\s*\\((.*?)\\)\\s*(?:{([^]*?(?:(?<!{){(?:[^]*?)}(?!})[^]*?)*)}|([^{].*?)(?=\\s*(?:;|$));)/g;\n private static readonly ELSE_REGEX =\n /}\\s*else(?!\\s+if\\b)\\s*(?:{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}|([^{].*?)(?=\\n|;|$))/g;\n private static readonly PROMISE_CHAIN_REGEX =\n /\\.(then|catch|finally)\\s*\\(\\s*(?:async\\s+)?(?:\\(?([^)]*)\\)?)?\\s*=>\\s*(?:\\{((?:[^{}]|`[^`]*`)*?)\\}|([^{;]*?(?:\\.[^{;]*?)*(?:\\([^)]*\\))?)(?=\\s*(?:\\)\\)|\\.|\\))))/g;\n private static readonly TRY_CATCH_BLOCK_REGEX = /try\\s*{[\\s\\S]*?}\\s*catch\\s*\\(([^)]*)\\)\\s*{/g;\n private static readonly CONSOLE_LOG_REGEX = /console\\.(log|debug|info|warn|error)\\s*\\(\\s*([^)]+)\\s*\\)\\s*;?/g;\n\n\n\n\n\n public static isInstrumented(content: string): boolean {\n return this.IMPORT_REGEX.test(content);\n }\n\n public static detectLogger(content: string): LoggerInfo {\n const match = content.match(this.LOGGER_REGEX);\n return {\n exists: match !== null,\n variableName: match ? match[1] : 'logger',\n };\n }\n\n public static addImportAndLogger(content: string, componentName: string): string {\n let modified = content;\n\n if (!this.IMPORT_REGEX.test(content)) {\n modified = `import { createLogger } from 'c/rflibLogger';\\n${modified}`;\n }\n\n const { exists, variableName } = this.detectLogger(content);\n if (!exists) {\n const exportMatch = content.match(this.EXPORT_DEFAULT_REGEX);\n const className = exportMatch ? exportMatch[1] : componentName;\n const loggerDeclaration = `\\nconst ${variableName} = createLogger('${className}');\\n`;\n modified = modified.replace(this.EXPORT_DEFAULT_REGEX, `${loggerDeclaration}$&`);\n }\n\n return modified;\n }\n\n public static processIfStatements(content: string, loggerName: string): string {\n const conditions: IfCondition[] = [];\n\n let modified = content.replace(\n this.IF_STATEMENT_REGEX,\n (match: string, condition: string, blockBody: string, singleLineBody: string, offset: number) => {\n const cleanedUpCondition = condition.trim().replaceAll(\"'\", \"\\\\'\");\n conditions.push({ condition: cleanedUpCondition, position: offset });\n\n const logStatement = `${loggerName}.debug('if (${cleanedUpCondition})');\\n `;\n\n if (blockBody) {\n return `if (${condition}) {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n const cleanBody = singleLineBody.replace(/;$/, '').trim();\n return `if (${condition}) {\\n ${logStatement}${cleanBody};\\n }`;\n }\n return match;\n },\n );\n\n modified = modified.replace(\n this.ELSE_REGEX,\n (match: string, blockBody: string, singleLineBody: string, offset: number) => {\n const nearestIf = conditions\n .filter((c) => c.position <= (offset ?? 0))\n .reduce((prev, curr) => (!prev || curr.position > prev.position ? curr : prev));\n\n const logStatement = nearestIf\n ? `${loggerName}.debug('else for if (${nearestIf.condition})');\\n `\n : `${loggerName}.debug('else statement');\\n `;\n\n if (blockBody) {\n return `} else {\\n ${logStatement}${blockBody}}`;\n } else if (singleLineBody) {\n return `} else {\\n ${logStatement}${singleLineBody};\\n }`;\n }\n return match;\n },\n );\n\n return modified;\n }\n\n public static processMethodLogging(content: string, loggerName: string, options: InstrumentationOptions): string {\n let modified = content.replace(this.METHOD_REGEX, (match: string, methodName: string, args: string) => {\n const parameters = args\n .split(',')\n .map((p) => p.trim())\n .filter((p) => p);\n const placeholders = parameters.map((_, i) => `{${i}}`).join(', ');\n const logArgs = parameters.length > 0 ? `, ${parameters.join(', ')}` : '';\n\n return `${match}\\n ${loggerName}.info('${methodName}(${placeholders})'${logArgs});`;\n });\n\n if (!options.noIf) {\n modified = this.processIfStatements(modified, loggerName);\n }\n\n return modified;\n }\n\n public static processTryCatchBlocks(content: string, loggerName: string): string {\n return content.replace(this.TRY_CATCH_BLOCK_REGEX, (match: string, exceptionVar: string, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const errorVar = exceptionVar.trim().split(' ')[0] || 'error';\n\n return match.replace(\n /catch\\s*\\(([^)]*)\\)\\s*{/,\n `catch(${exceptionVar}) {\n ${loggerName}.error('An error occurred in function ${methodName}()', ${errorVar});`,\n );\n });\n }\n\n public static processPromiseChains(content: string, loggerName: string): string {\n return content.replace(\n this.PROMISE_CHAIN_REGEX,\n (match, type, param, blockBody, singleLineBody, offset: number) => {\n const methodName = this.findEnclosingMethod(content, offset);\n const paramName = typeof param === 'string' ? param.trim() : type === 'then' ? 'result' : 'error';\n const indentation = match.match(/\\n\\s*/)?.[0] ?? '\\n ';\n\n let logStatement: string;\n switch (type) {\n case 'then':\n logStatement = `${loggerName}.info('${methodName}() promise resolved. Result={0}', ${paramName});`;\n break;\n case 'catch':\n logStatement = `${loggerName}.error('An error occurred in function ${methodName}()', ${paramName});`;\n break;\n case 'finally':\n logStatement = `${loggerName}.info('${methodName}() promise chain completed');`;\n break;\n default:\n logStatement = '';\n }\n\n if (singleLineBody) {\n const trimmedBody = (singleLineBody as string).trim();\n const adjustedBody =\n trimmedBody.split(')').length > trimmedBody.split('(').length ? trimmedBody.slice(0, -1) : trimmedBody;\n\n return `.${type}((${paramName}) => {\n ${logStatement}\n return ${adjustedBody};\n }`;\n }\n\n if (blockBody) {\n return `.${type}((${paramName}) => {${indentation}${logStatement}${indentation}${blockBody}}`;\n }\n\n return match;\n },\n );\n }\n\n public static processConsoleStatements(methodBody: string, loggerName: string): string {\n return methodBody.replace(this.CONSOLE_LOG_REGEX, (match: string, logType: string, argument: string) => {\n const logLevel = logType === 'info' || logType === 'warn' || logType === 'error' ? logType : 'debug';\n return `${loggerName}.${logLevel}(${argument});`;\n });\n }\n\n private static findEnclosingMethod(content: string, position: number): string {\n const beforeCatch = content.substring(0, position);\n const methods = [...beforeCatch.matchAll(this.METHOD_REGEX)].reverse();\n const closestMethod = methods[0];\n return closestMethod ? closestMethod[1] : 'unknown';\n }\n}\n\nexport default class RflibLoggingLwcInstrument extends SfCommand<RflibLoggingLwcInstrumentResult> {\n public static readonly summary = messages.getMessage('summary');\n public static readonly description = messages.getMessage('description');\n public static readonly examples = messages.getMessages('examples');\n\n public static readonly flags = {\n sourcepath: Flags.string({\n char: 's',\n required: true,\n summary: messages.getMessage('flags.sourcepath.summary'),\n description: messages.getMessage('flags.sourcepath.description'),\n }),\n dryrun: Flags.boolean({\n char: 'd',\n default: false,\n summary: messages.getMessage('flags.dryrun.summary'),\n description: messages.getMessage('flags.dryrun.description'),\n }),\n prettier: Flags.boolean({\n char: 'p',\n default: false,\n summary: messages.getMessage('flags.prettier.summary'),\n description: messages.getMessage('flags.prettier.description'),\n }),\n 'no-if': Flags.boolean({\n summary: messages.getMessage('flags.no-if.summary'),\n description: messages.getMessage('flags.no-if.description'),\n default: false,\n }),\n 'skip-instrumented': Flags.boolean({\n summary: messages.getMessage('flags.skip-instrumented.summary'),\n description: messages.getMessage('flags.skip-instrumented.description'),\n default: false,\n }),\n verbose: Flags.boolean({\n summary: messages.getMessage('flags.verbose.summary'),\n description: messages.getMessage('flags.verbose.description'),\n char: 'v',\n default: false,\n }),\n exclude: Flags.string({\n summary: messages.getMessage('flags.exclude.summary'),\n description: messages.getMessage('flags.exclude.description'),\n char: 'e',\n }),\n concurrency: Flags.integer({\n summary: messages.getMessage('flags.concurrency.summary'),\n description: messages.getMessage('flags.concurrency.description'),\n char: 'c',\n default: 10,\n }),\n };\n\n private logger!: Logger;\n private readonly stats: RflibLoggingLwcInstrumentResult = {\n processedFiles: 0,\n modifiedFiles: 0,\n formattedFiles: 0,\n modifiedFilePaths: [],\n };\n\n public async run(): Promise<RflibLoggingLwcInstrumentResult> {\n this.logger = await Logger.child(this.ctor.name);\n const { flags } = await this.parse(RflibLoggingLwcInstrument);\n\n const instrumentationOpts: InstrumentationOptions = {\n prettier: flags.prettier,\n noIf: flags['no-if'],\n skipInstrumented: flags['skip-instrumented'],\n verbose: flags.verbose,\n exclude: flags.exclude,\n };\n\n this.log(`Scanning LWC components in ${flags.sourcepath}...`);\n\n this.spinner.start('Running...');\n\n const files = await this.findAllLwcFiles(flags.sourcepath, instrumentationOpts.exclude);\n await processWithConcurrency(\n files,\n flags.concurrency,\n async (filePath) => {\n await this.instrumentLwcFile(filePath, flags.dryrun, instrumentationOpts);\n }\n );\n\n this.spinner.stop();\n\n this.log('\\nInstrumentation complete.');\n this.log(`Processed files: ${this.stats.processedFiles}`);\n this.log(`Modified files: ${this.stats.modifiedFiles}`);\n this.log(`Formatted files: ${this.stats.formattedFiles}`);\n\n return { ...this.stats };\n }\n\n private async findAllLwcFiles(dirPath: string, excludePattern?: string): Promise<string[]> {\n this.logger.debug(`Scanning directory: ${dirPath}`);\n const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });\n\n const results = await Promise.all(\n entries.map(async (entry) => {\n const filePath = path.join(dirPath, entry.name);\n\n if (excludePattern && minimatch(filePath, excludePattern, { matchBase: true })) {\n this.logger.debug(`Skipping excluded path: ${filePath}`);\n return [];\n }\n\n if (entry.isDirectory()) {\n return this.findAllLwcFiles(filePath, excludePattern);\n }\n\n const parentDir = path.dirname(filePath);\n if (\n entry.name.endsWith('.js') &&\n !parentDir.includes('aura') &&\n !parentDir.includes('__tests__')\n ) {\n return [filePath];\n }\n\n return [];\n })\n );\n\n return results.flat();\n }\n\n private async instrumentLwcFile(\n filePath: string,\n isDryRun: boolean,\n instrumentationOpts: InstrumentationOptions,\n ): Promise<void> {\n const componentName = path.basename(path.dirname(filePath));\n this.logger.debug(`Processing LWC: ${componentName}`);\n\n try {\n this.stats.processedFiles++;\n let content = await fs.promises.readFile(filePath, 'utf8');\n const originalContent = content;\n\n if (instrumentationOpts.skipInstrumented && LwcInstrumentationService.isInstrumented(content)) {\n this.logger.info(`Skipping instrumented component: ${componentName}`);\n return;\n }\n\n const { variableName } = LwcInstrumentationService.detectLogger(content);\n content = LwcInstrumentationService.addImportAndLogger(content, componentName);\n content = LwcInstrumentationService.processMethodLogging(content, variableName, instrumentationOpts);\n content = LwcInstrumentationService.processTryCatchBlocks(content, variableName);\n content = LwcInstrumentationService.processPromiseChains(content, variableName);\n content = LwcInstrumentationService.processConsoleStatements(content, variableName);\n\n if (content !== originalContent) {\n await writeInstrumentedFile(\n filePath,\n content,\n originalContent,\n instrumentationOpts,\n isDryRun,\n this.stats,\n this.logger,\n (msg) => this.log(msg),\n LwcInstrumentationService.PRETTIER_CONFIG,\n );\n }\n } catch (error) {\n this.logger.error(`Error processing LWC ${componentName}`, error);\n throw error;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function processWithConcurrency<T>(items: T[], concurrencyLimit: number, action: (item: T) => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export async function processWithConcurrency(items, concurrencyLimit, action) {
|
|
2
|
+
const limit = Math.max(1, concurrencyLimit);
|
|
3
|
+
const queue = [...items];
|
|
4
|
+
const worker = async () => {
|
|
5
|
+
while (queue.length > 0) {
|
|
6
|
+
const item = queue.shift();
|
|
7
|
+
if (item !== undefined) {
|
|
8
|
+
// eslint-disable-next-line no-await-in-loop
|
|
9
|
+
await action(item);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const workers = Array.from({ length: Math.min(limit, items.length) }, () => worker());
|
|
14
|
+
await Promise.all(workers);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=concurrency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../../src/shared/concurrency.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAU,EACV,gBAAwB,EACxB,MAAkC;IAElC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAEzB,MAAM,MAAM,GAAG,KAAK,IAAmB,EAAE;QACvC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,4CAA4C;gBAC5C,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["export async function processWithConcurrency<T>(\n items: T[],\n concurrencyLimit: number,\n action: (item: T) => Promise<void>\n): Promise<void> {\n const limit = Math.max(1, concurrencyLimit);\n const queue = [...items];\n\n const worker = async (): Promise<void> => {\n while (queue.length > 0) {\n const item = queue.shift();\n if (item !== undefined) {\n // eslint-disable-next-line no-await-in-loop\n await action(item);\n }\n }\n };\n\n const workers = Array.from({ length: Math.min(limit, items.length) }, () => worker());\n await Promise.all(workers);\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as prettier from 'prettier';
|
|
2
|
+
import { Logger } from '@salesforce/core';
|
|
3
|
+
import { InstrumentationOptions } from './types.js';
|
|
4
|
+
export declare function formatContent(content: string, config: prettier.Options): Promise<string>;
|
|
5
|
+
export declare function writeInstrumentedFile(filePath: string, content: string, originalContent: string, options: InstrumentationOptions, isDryRun: boolean, stats: {
|
|
6
|
+
modifiedFiles: number;
|
|
7
|
+
modifiedFilePaths?: string[];
|
|
8
|
+
formattedFiles: number;
|
|
9
|
+
}, logger: Logger, logAction: (message: string) => void, prettierConfig: prettier.Options): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as prettier from 'prettier';
|
|
4
|
+
export async function formatContent(content, config) {
|
|
5
|
+
try {
|
|
6
|
+
return await prettier.format(content, config);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
if (error instanceof Error) {
|
|
10
|
+
throw new Error(`Formatting failed: ${error.message}`);
|
|
11
|
+
}
|
|
12
|
+
throw new Error('Formatting failed with unknown error');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export async function writeInstrumentedFile(filePath, content, originalContent, options, isDryRun, stats, logger, logAction, prettierConfig) {
|
|
16
|
+
if (content !== originalContent) {
|
|
17
|
+
stats.modifiedFiles++;
|
|
18
|
+
stats.modifiedFilePaths?.push(filePath);
|
|
19
|
+
if (!isDryRun) {
|
|
20
|
+
try {
|
|
21
|
+
const finalContent = options.prettier ? await formatContent(content, prettierConfig) : content;
|
|
22
|
+
await fs.promises.writeFile(filePath, finalContent);
|
|
23
|
+
if (options.prettier) {
|
|
24
|
+
stats.formattedFiles++;
|
|
25
|
+
logger.info(`Modified and formatted: ${filePath}`);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
logger.info(`Modified: ${filePath}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
logger.warn(`Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
await fs.promises.writeFile(filePath, content);
|
|
34
|
+
logger.info(`Modified without formatting: ${filePath}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
logger.info(`Would modify: ${filePath}`);
|
|
39
|
+
if (options.verbose) {
|
|
40
|
+
logAction(`Would modify: ${filePath}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=form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AK,CAAC,cAAc,EAAE,CAAC;oBACvB,MAAM,CAAC,IAAI,CAAC,2BAA2B,QAAQ,EAAE,CAAC,CAAC;gBACrD,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAC;gBACvC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CACT,oBAAoB,QAAQ,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC1F,CAAC;gBACF,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAC/C,MAAM,CAAC,IAAI,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;YACzC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,SAAS,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-param-reassign */\nimport * as fs from 'node:fs';\nimport * as prettier from 'prettier';\nimport { Logger } from '@salesforce/core';\nimport { InstrumentationOptions } from './types.js';\n\nexport async function formatContent(content: string, config: prettier.Options): Promise<string> {\n try {\n return await prettier.format(content, config);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Formatting failed: ${error.message}`);\n }\n throw new Error('Formatting failed with unknown error');\n }\n}\n\nexport async function writeInstrumentedFile(\n filePath: string,\n content: string,\n originalContent: string,\n options: InstrumentationOptions,\n isDryRun: boolean,\n stats: { modifiedFiles: number; modifiedFilePaths?: string[]; formattedFiles: number },\n logger: Logger,\n logAction: (message: string) => void,\n prettierConfig: prettier.Options,\n): Promise<void> {\n if (content !== originalContent) {\n stats.modifiedFiles++;\n stats.modifiedFilePaths?.push(filePath);\n\n if (!isDryRun) {\n try {\n const finalContent = options.prettier ? await formatContent(content, prettierConfig) : content;\n\n await fs.promises.writeFile(filePath, finalContent);\n\n if (options.prettier) {\n stats.formattedFiles++;\n logger.info(`Modified and formatted: ${filePath}`);\n } else {\n logger.info(`Modified: ${filePath}`);\n }\n } catch (error) {\n logger.warn(\n `Failed to format ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n await fs.promises.writeFile(filePath, content);\n logger.info(`Modified without formatting: ${filePath}`);\n }\n } else {\n logger.info(`Would modify: ${filePath}`);\n if (options.verbose) {\n logAction(`Would modify: ${filePath}`);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type InstrumentationOptions = {
|
|
2
|
+
readonly prettier: boolean;
|
|
3
|
+
readonly noIf: boolean;
|
|
4
|
+
readonly skipInstrumented: boolean;
|
|
5
|
+
readonly verbose: boolean;
|
|
6
|
+
readonly exclude?: string;
|
|
7
|
+
};
|
|
8
|
+
export type LoggerInfo = {
|
|
9
|
+
readonly exists: boolean;
|
|
10
|
+
readonly variableName: string;
|
|
11
|
+
};
|
|
12
|
+
export type IfCondition = {
|
|
13
|
+
readonly condition: string;
|
|
14
|
+
readonly position: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"","sourcesContent":["export type InstrumentationOptions = {\n readonly prettier: boolean;\n readonly noIf: boolean;\n readonly skipInstrumented: boolean;\n readonly verbose: boolean;\n readonly exclude?: string;\n};\n\nexport type LoggerInfo = {\n readonly exists: boolean;\n readonly variableName: string;\n};\n\nexport type IfCondition = {\n readonly condition: string;\n readonly position: number;\n};\n"]}
|
|
@@ -69,6 +69,14 @@ Exclude files or directories from instrumentation based on a glob pattern.
|
|
|
69
69
|
|
|
70
70
|
Exclude specific files or directories that match the provided glob pattern. For example, use --exclude "**/Generated_*.cls" to skip auto-generated classes.
|
|
71
71
|
|
|
72
|
+
# flags.concurrency.summary
|
|
73
|
+
|
|
74
|
+
Limits the number of files processed concurrently.
|
|
75
|
+
|
|
76
|
+
# flags.concurrency.description
|
|
77
|
+
|
|
78
|
+
Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.
|
|
79
|
+
|
|
72
80
|
# examples
|
|
73
81
|
|
|
74
82
|
- Add logging statements to all Apex classes in a directory:
|
|
@@ -88,6 +88,14 @@ Exclude files or directories from instrumentation based on a glob pattern.
|
|
|
88
88
|
|
|
89
89
|
Exclude specific files or directories that match the provided glob pattern. For example, use --exclude "**/Generated_*.cmp" to skip auto-generated components.
|
|
90
90
|
|
|
91
|
+
# flags.concurrency.summary
|
|
92
|
+
|
|
93
|
+
Limits the number of files processed concurrently.
|
|
94
|
+
|
|
95
|
+
# flags.concurrency.description
|
|
96
|
+
|
|
97
|
+
Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.
|
|
98
|
+
|
|
91
99
|
# examples
|
|
92
100
|
|
|
93
101
|
- Add logging to all aura files:
|
|
@@ -54,6 +54,14 @@ Exclude files or directories from instrumentation based on a glob pattern.
|
|
|
54
54
|
|
|
55
55
|
Exclude specific files or directories that match the provided glob pattern. For example, use --exclude "**/Test_*.flow-meta.xml" to skip certain flows.
|
|
56
56
|
|
|
57
|
+
# flags.concurrency.summary
|
|
58
|
+
|
|
59
|
+
Limits the number of files processed concurrently.
|
|
60
|
+
|
|
61
|
+
# flags.concurrency.description
|
|
62
|
+
|
|
63
|
+
Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.
|
|
64
|
+
|
|
57
65
|
# examples
|
|
58
66
|
|
|
59
67
|
- <%= config.bin %> <%= command.id %> --sourcepath force-app
|
|
@@ -82,6 +82,14 @@ Exclude files or directories from instrumentation based on a glob pattern.
|
|
|
82
82
|
|
|
83
83
|
Exclude specific files or directories that match the provided glob pattern. For example, use --exclude "**/Generated_*.js" to skip auto-generated components.
|
|
84
84
|
|
|
85
|
+
# flags.concurrency.summary
|
|
86
|
+
|
|
87
|
+
Limits the number of files processed concurrently.
|
|
88
|
+
|
|
89
|
+
# flags.concurrency.description
|
|
90
|
+
|
|
91
|
+
Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.
|
|
92
|
+
|
|
85
93
|
# examples
|
|
86
94
|
|
|
87
95
|
- Add logging to all LWC files:
|
package/oclif.manifest.json
CHANGED
|
@@ -79,6 +79,16 @@
|
|
|
79
79
|
"hasDynamicHelp": false,
|
|
80
80
|
"multiple": false,
|
|
81
81
|
"type": "option"
|
|
82
|
+
},
|
|
83
|
+
"concurrency": {
|
|
84
|
+
"char": "c",
|
|
85
|
+
"description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
|
|
86
|
+
"name": "concurrency",
|
|
87
|
+
"summary": "Limits the number of files processed concurrently.",
|
|
88
|
+
"default": 10,
|
|
89
|
+
"hasDynamicHelp": false,
|
|
90
|
+
"multiple": false,
|
|
91
|
+
"type": "option"
|
|
82
92
|
}
|
|
83
93
|
},
|
|
84
94
|
"hasDynamicHelp": false,
|
|
@@ -206,6 +216,16 @@
|
|
|
206
216
|
"hasDynamicHelp": false,
|
|
207
217
|
"multiple": false,
|
|
208
218
|
"type": "option"
|
|
219
|
+
},
|
|
220
|
+
"concurrency": {
|
|
221
|
+
"char": "c",
|
|
222
|
+
"description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
|
|
223
|
+
"name": "concurrency",
|
|
224
|
+
"summary": "Limits the number of files processed concurrently.",
|
|
225
|
+
"default": 10,
|
|
226
|
+
"hasDynamicHelp": false,
|
|
227
|
+
"multiple": false,
|
|
228
|
+
"type": "option"
|
|
209
229
|
}
|
|
210
230
|
},
|
|
211
231
|
"hasDynamicHelp": false,
|
|
@@ -320,6 +340,16 @@
|
|
|
320
340
|
"hasDynamicHelp": false,
|
|
321
341
|
"multiple": false,
|
|
322
342
|
"type": "option"
|
|
343
|
+
},
|
|
344
|
+
"concurrency": {
|
|
345
|
+
"char": "c",
|
|
346
|
+
"description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
|
|
347
|
+
"name": "concurrency",
|
|
348
|
+
"summary": "Limits the number of files processed concurrently.",
|
|
349
|
+
"default": 10,
|
|
350
|
+
"hasDynamicHelp": false,
|
|
351
|
+
"multiple": false,
|
|
352
|
+
"type": "option"
|
|
323
353
|
}
|
|
324
354
|
},
|
|
325
355
|
"hasDynamicHelp": false,
|
|
@@ -447,6 +477,16 @@
|
|
|
447
477
|
"hasDynamicHelp": false,
|
|
448
478
|
"multiple": false,
|
|
449
479
|
"type": "option"
|
|
480
|
+
},
|
|
481
|
+
"concurrency": {
|
|
482
|
+
"char": "c",
|
|
483
|
+
"description": "Controls the maximum number of files to process at the same time. This is useful in very large codebases to prevent excessive memory usage or file descriptor exhaustion. Defaults to 10.",
|
|
484
|
+
"name": "concurrency",
|
|
485
|
+
"summary": "Limits the number of files processed concurrently.",
|
|
486
|
+
"default": 10,
|
|
487
|
+
"hasDynamicHelp": false,
|
|
488
|
+
"multiple": false,
|
|
489
|
+
"type": "option"
|
|
450
490
|
}
|
|
451
491
|
},
|
|
452
492
|
"hasDynamicHelp": false,
|
|
@@ -496,5 +536,5 @@
|
|
|
496
536
|
]
|
|
497
537
|
}
|
|
498
538
|
},
|
|
499
|
-
"version": "0.
|
|
539
|
+
"version": "0.16.1"
|
|
500
540
|
}
|
package/package.json
CHANGED