Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.55.0 to 8.56.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0) Updates `eslint-plugin-import` from 2.29.0 to 2.29.1 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
511f073971
commit
144b7d5b16
32 changed files with 618 additions and 251 deletions
66
node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
66
node_modules/tsconfig-paths/lib/tsconfig-loader.js
generated
vendored
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue