Skip to content
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

Merged
merged 4 commits into from
Oct 2, 2017
Merged

Conversation

kjin
Copy link
Contributor

@kjin kjin commented Sep 26, 2017

This change turns trace-plugin-loader.ts into TS.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 26, 2017
}

export interface Patch {
file?: string;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

intercept: <T>(module: T, agent: TraceAgent) => T;
}

export type Plugin = (Patch | Intercept)[];

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

interface InternalPatch<T> extends Patch<T> {
file: string;
module?: T;
patch: (module: T, agent: TraceAgent) => void;

This comment was marked as spam.

interface InternalIntercept<T> extends Intercept<T> {
file: string;
module?: T;
intercept: (module: T, agent: TraceAgent) => T;

This comment was marked as spam.


var logger_;
function isPatch<T>(obj: Patch<T> | Intercept<T>): obj is Patch<T> {

This comment was marked as spam.

file: string;
patches: {
[patchName: string]: {
[file: string]: InternalPatch<any> | InternalIntercept<any>;

This comment was marked as spam.

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.

if (!pluginConfig[moduleName]) {
continue;
}
var agent = new TraceAgent(moduleName);
const agent: TraceAgent = new TraceAgent(moduleName);

This comment was marked as spam.

@kjin kjin merged commit 212f45f into googleapis:master Oct 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants