Skip to content

Commit

Permalink
chore: upgrade gts to 0.7.1
Browse files Browse the repository at this point in the history
chore: also, update @google-cloud/common to 0.20 and tsc to 2.9
  • Loading branch information
kjin committed Jun 19, 2018
1 parent a5509e1 commit 1588183
Show file tree
Hide file tree
Showing 65 changed files with 439 additions and 377 deletions.
490 changes: 277 additions & 213 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@types/glob": "^5.0.32",
"@types/is": "0.0.20",
"@types/methods": "^1.1.0",
"@types/mocha": "^5.0.0",
"@types/mocha": "5.2.1",
"@types/ncp": "^2.0.1",
"@types/nock": "^9.1.2",
"@types/node": "^10.0.9",
Expand All @@ -72,7 +72,7 @@
"codecov": "^3.0.0",
"express": "^4.15.2",
"glob": "^7.0.3",
"gts": "^0.5.1",
"gts": "^0.7.1",
"js-green-licenses": "^0.5.0",
"jshint": "^2.9.1",
"mocha": "^5.0.0",
Expand All @@ -89,10 +89,10 @@
"timekeeper": "^2.0.0",
"tmp": "0.0.33",
"ts-node": "^6.0.0",
"typescript": "~2.7.2"
"typescript": "~2.9.2"
},
"dependencies": {
"@google-cloud/common": "^0.19.1",
"@google-cloud/common": "^0.20.0",
"builtin-modules": "^2.0.0",
"continuation-local-storage": "^3.2.1",
"extend": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-install.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'path';
import path from 'path';
import { globP, ncpP, spawnP, tmpDirP } from './utils';

/**
Expand Down
6 changes: 3 additions & 3 deletions scripts/compile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import path from 'path';
import { forkP } from './utils';
import * as ts from 'typescript';
import * as semver from 'semver';
import ts from 'typescript';
import semver from 'semver';

export interface CompileOptions {
strict: boolean;
Expand Down
4 changes: 2 additions & 2 deletions scripts/get-plugin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getPluginTypes() {
const indexTs = (await readFileP(`${TYPES_DIRECTORY}/index.d.ts`, 'utf8') as string)
.split('\n');
for (const line of indexTs) {
const matches = line.match(/^import \* as .* from '\.\/(.+)';\s*\/\/\s*(.+)@(.+)$/);
const matches = line.match(/^import .* from '\.\/(.+)';\s*\/\/\s*(.+)@(.+)$/);
if (!matches) {
continue;
}
Expand All @@ -34,7 +34,7 @@ export async function getPluginTypes() {
cwd: installDir
});
await writeFileP(`${installDir}/index.ts`,
`import * as _ from '${name}'; export = _;\n`, 'utf8');
`import _ from '${name}'; export = _;\n`, 'utf8');
}
}
}
6 changes: 3 additions & 3 deletions scripts/init-test-fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as path from 'path';
import path from 'path';
import { BUILD_DIRECTORY, globP, statP, ncpP, spawnP, readFileP, writeFileP, mkdirP } from './utils';
import { readdir } from 'fs';
import * as pify from 'pify';
import * as semver from 'semver';
import pify from 'pify';
import semver from 'semver';

const readdirP: (path: string) => Promise<string[]> = pify(readdir);

Expand Down
4 changes: 2 additions & 2 deletions scripts/report-coverage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BUILD_DIRECTORY, nodule, readFileP, forkP, spawnP } from './utils';
import * as path from 'path';
import * as pify from 'pify';
import path from 'path';
import pify from 'pify';

export async function reportCoverage() {
await forkP(nodule('.bin/codecov'), [], {
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'path';
import path from 'path';
import { globP, forkP } from './utils';

export interface Options {
Expand Down
10 changes: 5 additions & 5 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { mkdir, Stats, stat, readFile, writeFile } from 'fs';
import * as glob from 'glob';
import glob from 'glob';
import { ncp } from 'ncp';
import * as path from 'path';
import * as pify from 'pify';
import path from 'path';
import pify from 'pify';
import { ChildProcess, ForkOptions, fork, SpawnOptions, spawn } from 'child_process';
import * as once from 'once';
import * as tmp from 'tmp';
import once from 'once';
import tmp from 'tmp';

export const BUILD_DIRECTORY = 'build';

Expand Down
6 changes: 4 additions & 2 deletions src/cls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {Logger} from '@google-cloud/common';
import {EventEmitter} from 'events';
import * as semver from 'semver';
import semver from 'semver';

import {AsyncHooksCLS} from './cls/async-hooks';
import {AsyncListenerCLS} from './cls/async-listener';
Expand Down Expand Up @@ -83,7 +83,9 @@ export enum TraceCLSMechanism {
/**
* Configuration options passed to the TraceCLS constructor.
*/
export interface TraceCLSConfig { mechanism: TraceCLSMechanism; }
export interface TraceCLSConfig {
mechanism: TraceCLSMechanism;
}

interface CLSConstructor {
new(defaultContext: RootContext): CLS<RootContext>;
Expand Down
4 changes: 2 additions & 2 deletions src/cls/async-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

// This file calls require('async_hooks') in the AsyncHooksCLS constructor,
// rather than upon module load.
import * as asyncHooksModule from 'async_hooks';
import asyncHooksModule from 'async_hooks';
import {EventEmitter} from 'events';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';

import {CLS, Func} from './base';

Expand Down
2 changes: 1 addition & 1 deletion src/cls/async-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// This module requires continuation-local-storage in the AsyncListenerCLS
// constructor, rather than upon module load.
import * as clsModule from 'continuation-local-storage';
import clsModule from 'continuation-local-storage';
import {EventEmitter} from 'events';

import {CLS, Func} from './base';
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as path from 'path';
import path from 'path';

const pluginDirectory =
path.join(path.resolve(__dirname, '..'), 'src', 'plugins');
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const filesLoadedBeforeTrace = Object.keys(require.cache);

// This file's top-level imports must not transitively depend on modules that
// do I/O, or continuation-local-storage will not work.
import * as semver from 'semver';
import semver from 'semver';
import {Config, defaultConfig} from './config';
import * as extend from 'extend';
import * as path from 'path';
import extend from 'extend';
import path from 'path';
import * as PluginTypes from './plugin-types';
import {tracing, Tracing, NormalizedConfig} from './tracing';
import {Singleton, FORCE_NEW, Forceable} from './util';
Expand Down
4 changes: 3 additions & 1 deletion src/plugin-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import {TraceLabels} from './trace-labels';
export type Func<T> = (...args: any[]) => T;

// Defines an interface for storing Trace-Agent related data on patched modules.
export interface TraceAgentExtension { _google_trace_patched: boolean; }
export interface TraceAgentExtension {
_google_trace_patched: boolean;
}

/**
* Represents a trace span.
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {IncomingMessage, ServerResponse} from 'http';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';
import {parse as urlParse} from 'url';

import {PluginTypes} from '..';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin-express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import * as httpMethods from 'methods';
import * as shimmer from 'shimmer';
import httpMethods from 'methods';
import shimmer from 'shimmer';

import {PluginTypes} from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin-hapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {IncomingMessage, ServerResponse} from 'http';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';
import {parse as urlParse} from 'url';

import {PluginTypes} from '..';
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/plugin-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

import * as httpModule from 'http';
import httpModule from 'http';
import {Agent, ClientRequest, ClientRequestArgs, get, request} from 'http';
import * as httpsModule from 'https';
import * as is from 'is';
import * as semver from 'semver';
import * as shimmer from 'shimmer';
import * as url from 'url';
import httpsModule from 'https';
import is from 'is';
import semver from 'semver';
import shimmer from 'shimmer';
import url from 'url';

import {Plugin, TraceAgent} from '../plugin-types';

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin-http2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import {EventEmitter} from 'events';
// This is imported only for types. Generated .js file should NOT load 'http2'.
// `http2` must be used only in type annotations, not in expressions.
import * as http2 from 'http2';
import * as shimmer from 'shimmer';
import http2 from 'http2';
import shimmer from 'shimmer';
import {URL} from 'url';

import {TraceAgent} from '../plugin-types';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin-koa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {IncomingMessage, ServerResponse} from 'http';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';
import {parse as urlParse} from 'url';

import {PluginTypes} from '..';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin-pg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {EventEmitter} from 'events';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';
import {Readable} from 'stream';

import {Patch, Plugin, Span} from '../plugin-types';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin-restify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {ServerResponse} from 'http';
import * as shimmer from 'shimmer';
import shimmer from 'shimmer';
import {parse as urlParse} from 'url';

import {PluginTypes} from '..';
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
* contain dots.
*/

import * as connect_3 from './connect_3'; // connect@3
import * as express_4 from './express_4'; // express@4
import * as hapi_16 from './hapi_16'; // hapi@16
import * as hapi_17 from './hapi_17'; // hapi@17
import * as koa_2 from './koa_2'; // koa@2
import * as pg_7 from './pg_7'; // pg@7
import * as restify_5 from './restify_5'; // restify@5
import connect_3 from './connect_3'; // connect@3
import express_4 from './express_4'; // express@4
import hapi_16 from './hapi_16'; // hapi@16
import hapi_17 from './hapi_17'; // hapi@17
import koa_2 from './koa_2'; // koa@2
import pg_7 from './pg_7'; // pg@7
import restify_5 from './restify_5'; // restify@5

//---other imports---//

Expand Down
4 changes: 2 additions & 2 deletions src/span-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import * as crypto from 'crypto';
import * as util from 'util';
import crypto from 'crypto';
import util from 'util';

import {Constants, SpanType} from './constants';
import * as types from './plugin-types';
Expand Down
6 changes: 3 additions & 3 deletions src/trace-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import {Logger} from '@google-cloud/common';
import * as is from 'is';
import * as semver from 'semver';
import * as uuid from 'uuid';
import is from 'is';
import semver from 'semver';
import uuid from 'uuid';

import {cls, RootContext} from './cls';
import {Constants, SpanType} from './constants';
Expand Down
14 changes: 6 additions & 8 deletions src/trace-plugin-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/

import {Logger} from '@google-cloud/common';
import Module = require('module');
import * as hook from 'require-in-the-middle';
import * as path from 'path';
import * as semver from 'semver';
import * as shimmer from 'shimmer';
import * as util from './util';
import * as builtinModules from 'builtin-modules';
import builtinModules from 'builtin-modules';
import path from 'path';
import hook from 'require-in-the-middle';
import semver from 'semver';

import {Intercept, Patch, Plugin} from './plugin-types';
import {TraceAgent, TraceAgentConfig} from './trace-api';
import {Patch, Intercept, Plugin, Instrumentation} from './plugin-types';
import {Singleton} from './util';

/**
Expand Down
7 changes: 4 additions & 3 deletions src/trace-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import * as common from '@google-cloud/common';
import {AxiosError} from 'axios';
import * as gcpMetadata from 'gcp-metadata';
import {OutgoingHttpHeaders} from 'http';
import * as os from 'os';
import * as util from 'util';
import os from 'os';

import {Constants} from './constants';
import {SpanKind, Trace} from './trace';
Expand All @@ -46,7 +45,9 @@ export interface TraceWriterConfig extends common.GoogleAuthOptions {
serviceContext: {service?: string; version?: string; minorVersion?: string;};
}

export interface LabelObject { [key: string]: string; }
export interface LabelObject {
[key: string]: string;
}

/**
* A class representing a service that publishes traces in the background.
Expand Down
4 changes: 2 additions & 2 deletions src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import {Logger, logger} from '@google-cloud/common';
import * as path from 'path';
import * as semver from 'semver';
import path from 'path';
import semver from 'semver';

import {cls, TraceCLSConfig, TraceCLSMechanism} from './cls';
import {CLSMechanism, Config, defaultConfig} from './config';
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {Logger} from '@google-cloud/common'; // for types only.
import * as path from 'path';
import path from 'path';

// This symbol must be exported (for now).
// See: https://github.com/Microsoft/TypeScript/issues/20080
Expand Down
2 changes: 1 addition & 1 deletion test/nocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as nock from 'nock';
import nock from 'nock';

const accept = () => true;

Expand Down
4 changes: 2 additions & 2 deletions test/override-gcp-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

// Monkeypatch gcp-metadata to not ask for retries at all.

import * as rax from 'retry-axios';
import * as shimmer from 'shimmer';
import rax from 'retry-axios';
import shimmer from 'shimmer';
import { AxiosRequestConfig } from 'axios';

shimmer.wrap(rax, 'attach', attach => {
Expand Down
Loading

0 comments on commit 1588183

Please sign in to comment.