chore: updating deps

This commit is contained in:
Joel Male
2024-03-28 12:25:32 +10:00
parent 0de33a6f62
commit c54aaa0ec6
779 changed files with 586281 additions and 1021521 deletions
+6
View File
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
## [3.15.0] - 2023-12-14
### Added
- Add support for extends as array of strings to v3 (backport of #245). See PR #260. Thanks to [@domdomegg](https://github.com/domdomegg) for this PR!
## [3.14.1] - 2022-03-22
### Fixed
+1 -1
View File
@@ -2,7 +2,7 @@
* Typing for the parts of tsconfig that we care about
*/
export interface Tsconfig {
extends?: string;
extends?: string | string[];
compilerOptions?: {
baseUrl?: string;
paths?: {
+48 -18
View File
@@ -82,30 +82,60 @@ function loadTsconfig(configFilePath, existsSync, readFileSync) {
}
var configString = readFileSync(configFilePath);
var cleanedJson = StripBom(configString);
var config = JSON5.parse(cleanedJson);
var config;
try {
config = JSON5.parse(cleanedJson);
}
catch (e) {
throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
}
var extendedConfig = config.extends;
if (extendedConfig) {
if (typeof extendedConfig === "string" &&
extendedConfig.indexOf(".json") === -1) {
extendedConfig += ".json";
var base = void 0;
if (Array.isArray(extendedConfig)) {
base = extendedConfig.reduce(function (currBase, extendedConfigElement) {
return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync, readFileSync));
}, {});
}
var currentDir = path.dirname(configFilePath);
var extendedConfigPath = path.join(currentDir, extendedConfig);
if (extendedConfig.indexOf("/") !== -1 &&
extendedConfig.indexOf(".") !== -1 &&
!existsSync(extendedConfigPath)) {
extendedConfigPath = path.join(currentDir, "node_modules", extendedConfig);
else {
base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync, readFileSync);
}
var base = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
// baseUrl should be interpreted as relative to the base tsconfig,
// but we need to update it so it is relative to the original tsconfig being loaded
if (base.compilerOptions && base.compilerOptions.baseUrl) {
var extendsDir = path.dirname(extendedConfig);
base.compilerOptions.baseUrl = path.join(extendsDir, base.compilerOptions.baseUrl);
}
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
return mergeTsconfigs(base, config);
}
return config;
}
exports.loadTsconfig = loadTsconfig;
/**
* Intended to be called only from loadTsconfig.
* Parameters don't have defaults because they should use the same as loadTsconfig.
*/
function loadTsconfigFromExtends(configFilePath, extendedConfigValue,
// eslint-disable-next-line no-shadow
existsSync, readFileSync) {
var _a;
if (typeof extendedConfigValue === "string" &&
extendedConfigValue.indexOf(".json") === -1) {
extendedConfigValue += ".json";
}
var currentDir = path.dirname(configFilePath);
var extendedConfigPath = path.join(currentDir, extendedConfigValue);
if (extendedConfigValue.indexOf("/") !== -1 &&
extendedConfigValue.indexOf(".") !== -1 &&
!existsSync(extendedConfigPath)) {
extendedConfigPath = path.join(currentDir, "node_modules", extendedConfigValue);
}
var config = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
// baseUrl should be interpreted as relative to extendedConfigPath,
// but we need to update it so it is relative to the original tsconfig being loaded
if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
var extendsDir = path.dirname(extendedConfigValue);
config.compilerOptions.baseUrl = path.join(extendsDir, config.compilerOptions.baseUrl);
}
return config;
}
function mergeTsconfigs(base, config) {
base = base || {};
config = config || {};
return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
}
//# sourceMappingURL=tsconfig-loader.js.map
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "tsconfig-paths",
"version": "3.14.1",
"version": "3.15.0",
"description": "Load node modules according to tsconfig paths, in run-time or via API.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -34,7 +34,7 @@
},
"dependencies": {
"@types/json5": "^0.0.29",
"json5": "^1.0.1",
"json5": "^1.0.2",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
},