-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: ts conversion of plugin loader #568
Conversation
src/trace-plugin-loader.ts
Outdated
} | ||
|
||
export interface Patch { | ||
file?: string; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
intercept: <T>(module: T, agent: TraceAgent) => T; | ||
} | ||
|
||
export type Plugin = (Patch | Intercept)[]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
if (first !== '@google-cloud/trace-agent') { | ||
logger_.error('Tracing might not work as ' + first + | ||
' was loaded with --require before the trace agent was initialized.'); | ||
} | ||
} | ||
} | ||
|
||
function checkPatch(patch) { | ||
function checkPatch(patch: any) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
interface InternalPatch<T> extends Patch<T> { | ||
file: string; | ||
module?: T; | ||
patch: (module: T, agent: TraceAgent) => void; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
interface InternalIntercept<T> extends Intercept<T> { | ||
file: string; | ||
module?: T; | ||
intercept: (module: T, agent: TraceAgent) => T; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
|
||
var logger_; | ||
function isPatch<T>(obj: Patch<T> | Intercept<T>): obj is Patch<T> { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
file: string; | ||
patches: { | ||
[patchName: string]: { | ||
[file: string]: InternalPatch<any> | InternalIntercept<any>; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
if (first !== '@google-cloud/trace-agent') { | ||
logger_.error('Tracing might not work as ' + first + | ||
' was loaded with --require before the trace agent was initialized.'); | ||
} | ||
} | ||
} | ||
|
||
function checkPatch(patch) { | ||
function checkPatch(patch: any) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/trace-plugin-loader.ts
Outdated
if (!pluginConfig[moduleName]) { | ||
continue; | ||
} | ||
var agent = new TraceAgent(moduleName); | ||
const agent: TraceAgent = new TraceAgent(moduleName); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This change turns
trace-plugin-loader.ts
into TS.