Skip to content

Commit d6c545c

Browse files
committed
Drop the compile target to es5
1 parent ba3b775 commit d6c545c

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

packages/credential-provider-ini/__mocks__/fs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ interface FsModule {
55
}
66

77
const fs: FsModule = <FsModule>jest.genMockFromModule('fs');
8-
const matchers = new Map<string, string>();
8+
let matchers: {[key: string]: string} = {};
99

1010
function __addMatcher(toMatch: string, toReturn: string): void {
11-
matchers.set(toMatch, toReturn);
11+
matchers[toMatch] = toReturn;
1212
}
1313

1414
function __clearMatchers(): void {
15-
matchers.clear();
15+
matchers = {};
1616
}
1717

1818
function readFile(
1919
path: string,
2020
encoding: string,
2121
callback: (err: Error|null, data?: string) => void
2222
): void {
23-
for (let [matcher, data] of matchers.entries()) {
24-
if (matcher === path) {
25-
callback(null, data);
23+
for (let key of Object.keys(matchers)) {
24+
if (key === path) {
25+
callback(null, matchers[key]);
2626
return;
2727
}
2828
}

packages/credential-provider-ini/__tests__/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ const envAtLoadTime: {[key: string]: string} = [
3535
'USERPROFILE',
3636
'HOMEPATH',
3737
'HOMEDRIVE',
38-
].reduce((envState, varName) => Object.assign(
39-
envState,
40-
{[varName]: process.env[varName]}
41-
), {});
38+
].reduce((envState: {[key: string]: string}, varName: string) => {
39+
envState[varName] = process.env[varName];
40+
return envState;
41+
}, {});
4242

4343
beforeEach(() => {
4444
__clearMatchers();

packages/credential-provider-ini/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ export function fromIni(init: FromIniInit = {}): CredentialProvider {
138138
}
139139

140140
async function resolveProfileData(
141-
profile: string,
141+
profileName: string,
142142
profiles: ParsedIniData,
143143
options: FromIniInit
144144
): Promise<Credentials> {
145-
const data = profiles[profile];
145+
const data = profiles[profileName];
146146
if (isStaticCredsProfile(data)) {
147147
return Promise.resolve({
148148
accessKeyId: data.aws_access_key_id,
@@ -152,7 +152,7 @@ async function resolveProfileData(
152152
} else if (isAssumeRoleProfile(data)) {
153153
if (!options.roleAssumer) {
154154
throw new CredentialError(
155-
`Profile ${profile} requires a role to be assumed, but no` +
155+
`Profile ${profileName} requires a role to be assumed, but no` +
156156
` role assumption callback was provided.`,
157157
false
158158
);
@@ -174,7 +174,7 @@ async function resolveProfileData(
174174
if (mfa_serial) {
175175
if (!options.mfaCodeProvider) {
176176
throw new CredentialError(
177-
`Profile ${profile} requires multi-factor authentication,` +
177+
`Profile ${profileName} requires multi-factor authentication,` +
178178
` but no MFA code callback was provided.`,
179179
false
180180
);
@@ -187,9 +187,9 @@ async function resolveProfileData(
187187
}
188188

189189
throw new CredentialError(
190-
`Profile ${profile} could not be found or parsed in shared` +
190+
`Profile ${profileName} could not be found or parsed in shared` +
191191
` credentials file.`,
192-
profile === DEFAULT_PROFILE
192+
profileName === DEFAULT_PROFILE
193193
);
194194
}
195195

packages/credential-provider-ini/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
"license": "UNLICENSED",
1818
"dependencies": {
1919
"@aws/credential-provider-base": "^0.0.1",
20-
"@aws/types": "^0.0.1"
20+
"@aws/types": "^0.0.1",
21+
"tslib": "^1.7.1"
2122
},
2223
"devDependencies": {
23-
"@types/jest": "^19.2.2",
24+
"@types/jest": "^20.0.1",
2425
"@types/node": "^7.0.12",
25-
"jest": "^19.0.2",
26+
"jest": "^20.0.4",
2627
"typescript": "^2.3"
2728
}
2829
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
22
"compilerOptions": {
33
"module": "commonjs",
4-
"target": "es6",
4+
"target": "es5",
55
"declaration": true,
66
"strict": true,
7-
"sourceMap": true
7+
"sourceMap": true,
8+
"importHelpers": true,
9+
"lib": [
10+
"es5",
11+
"es2015.promise"
12+
]
813
}
914
}

0 commit comments

Comments
 (0)