@smithy/shared-ini-file-loader
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -44,2 +44,5 @@ var __defProp = Object.defineProperty; | ||
// src/loadSharedConfigFiles.ts | ||
// src/getConfigData.ts | ||
@@ -78,2 +81,5 @@ var import_types = require("@smithy/types"); | ||
// src/loadSharedConfigFiles.ts | ||
var import_getHomeDir3 = require("././getHomeDir"); | ||
// src/parseIni.ts | ||
@@ -135,7 +141,17 @@ | ||
const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; | ||
const homeDir = (0, import_getHomeDir3.getHomeDir)(); | ||
const relativeHomeDirPrefix = "~/"; | ||
let resolvedFilepath = filepath; | ||
if (filepath.startsWith(relativeHomeDirPrefix)) { | ||
resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); | ||
} | ||
let resolvedConfigFilepath = configFilepath; | ||
if (configFilepath.startsWith(relativeHomeDirPrefix)) { | ||
resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); | ||
} | ||
const parsedFiles = await Promise.all([ | ||
(0, import_slurpFile.slurpFile)(configFilepath, { | ||
(0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { | ||
ignoreCache: init.ignoreCache | ||
}).then(parseIni).then(getConfigData).catch(swallowError), | ||
(0, import_slurpFile.slurpFile)(filepath, { | ||
(0, import_slurpFile.slurpFile)(resolvedFilepath, { | ||
ignoreCache: init.ignoreCache | ||
@@ -142,0 +158,0 @@ }).then(parseIni).catch(swallowError) |
@@ -0,4 +1,6 @@ | ||
import { join } from "path"; | ||
import { getConfigData } from "./getConfigData"; | ||
import { getConfigFilepath } from "./getConfigFilepath"; | ||
import { getCredentialsFilepath } from "./getCredentialsFilepath"; | ||
import { getHomeDir } from "./getHomeDir"; | ||
import { parseIni } from "./parseIni"; | ||
@@ -10,4 +12,14 @@ import { slurpFile } from "./slurpFile"; | ||
const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; | ||
const homeDir = getHomeDir(); | ||
const relativeHomeDirPrefix = "~/"; | ||
let resolvedFilepath = filepath; | ||
if (filepath.startsWith(relativeHomeDirPrefix)) { | ||
resolvedFilepath = join(homeDir, filepath.slice(2)); | ||
} | ||
let resolvedConfigFilepath = configFilepath; | ||
if (configFilepath.startsWith(relativeHomeDirPrefix)) { | ||
resolvedConfigFilepath = join(homeDir, configFilepath.slice(2)); | ||
} | ||
const parsedFiles = await Promise.all([ | ||
slurpFile(configFilepath, { | ||
slurpFile(resolvedConfigFilepath, { | ||
ignoreCache: init.ignoreCache, | ||
@@ -18,3 +30,3 @@ }) | ||
.catch(swallowError), | ||
slurpFile(filepath, { | ||
slurpFile(resolvedFilepath, { | ||
ignoreCache: init.ignoreCache, | ||
@@ -21,0 +33,0 @@ }) |
{ | ||
"name": "@smithy/shared-ini-file-loader", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@smithy/types": "^3.3.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48248
786
32