From 8d94925a445506aef3bbc1fadbb984c7a98eba0c Mon Sep 17 00:00:00 2001 From: ElenaTv Date: Wed, 15 Apr 2020 07:41:02 +0300 Subject: [PATCH] fix: add type module support --- dist/parse-env-file.js | 2 +- dist/parse-rc-file.js | 2 +- src/parse-env-file.ts | 2 +- src/parse-rc-file.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/parse-env-file.js b/dist/parse-env-file.js index dc1c854..6b6dafe 100644 --- a/dist/parse-env-file.js +++ b/dist/parse-env-file.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const fs = require("fs"); const path = require("path"); const utils_1 = require("./utils"); -const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js']; +const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs']; /** * Gets the environment vars from an env file */ diff --git a/dist/parse-rc-file.js b/dist/parse-rc-file.js index 5e7b46b..f3df690 100644 --- a/dist/parse-rc-file.js +++ b/dist/parse-rc-file.js @@ -23,7 +23,7 @@ async function getRCFileVars({ environments, filePath }) { const ext = path_1.extname(absolutePath).toLowerCase(); let parsedData; try { - if (ext === '.json' || ext === '.js') { + if (ext === '.json' || ext === '.js' || ext === '.cjs') { const possiblePromise = require(absolutePath); /* eslint-disable-line */ parsedData = utils_1.isPromise(possiblePromise) ? await possiblePromise : possiblePromise; } diff --git a/src/parse-env-file.ts b/src/parse-env-file.ts index 2992272..bbd6334 100644 --- a/src/parse-env-file.ts +++ b/src/parse-env-file.ts @@ -2,7 +2,7 @@ import * as fs from 'fs' import * as path from 'path' import { resolveEnvFilePath, isPromise } from './utils' -const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js'] +const REQUIRE_HOOK_EXTENSIONS = ['.json', '.js', '.cjs'] /** * Gets the environment vars from an env file diff --git a/src/parse-rc-file.ts b/src/parse-rc-file.ts index 1ea7cf0..b348532 100644 --- a/src/parse-rc-file.ts +++ b/src/parse-rc-file.ts @@ -26,7 +26,7 @@ export async function getRCFileVars ( const ext = extname(absolutePath).toLowerCase() let parsedData: { [key: string]: any } try { - if (ext === '.json' || ext === '.js') { + if (ext === '.json' || ext === '.js' || ext === '.cjs') { const possiblePromise = require(absolutePath) /* eslint-disable-line */ parsedData = isPromise(possiblePromise) ? await possiblePromise : possiblePromise } else {