A big commit with a bunch of node modules so I could run puppeteer for Walmart. Added some todos and Headway's templates.
This commit is contained in:
46
Scripts/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
46
Scripts/node_modules/cosmiconfig/dist/ExplorerBase.js
generated
vendored
@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExtensionDescription = exports.ExplorerBase = void 0;
|
||||
const env_paths_1 = __importDefault(require("env-paths"));
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const util_js_1 = require("./util.js");
|
||||
/**
|
||||
@ -62,13 +64,55 @@ class ExplorerBase {
|
||||
}
|
||||
if (this.config.applyPackagePropertyPathToConfiguration ||
|
||||
this.#loadingMetaConfig) {
|
||||
config = (0, util_js_1.getPropertyByPath)(config, this.config.packageProp);
|
||||
const packageProp = this.config.packageProp ?? this.config.moduleName;
|
||||
config = (0, util_js_1.getPropertyByPath)(config, packageProp);
|
||||
}
|
||||
if (config === undefined) {
|
||||
return { filepath, config: undefined, isEmpty: true };
|
||||
}
|
||||
return { config, filepath };
|
||||
}
|
||||
validateImports(containingFilePath, imports, importStack) {
|
||||
const fileDirectory = path_1.default.dirname(containingFilePath);
|
||||
for (const importPath of imports) {
|
||||
if (typeof importPath !== 'string') {
|
||||
throw new Error(`${containingFilePath}: Key $import must contain a string or a list of strings`);
|
||||
}
|
||||
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
||||
if (fullPath === containingFilePath) {
|
||||
throw new Error(`Self-import detected in ${containingFilePath}`);
|
||||
}
|
||||
const idx = importStack.indexOf(fullPath);
|
||||
if (idx !== -1) {
|
||||
throw new Error(`Circular import detected:
|
||||
${[...importStack, fullPath]
|
||||
.map((path, i) => `${i + 1}. ${path}`)
|
||||
.join('\n')} (same as ${idx + 1}.)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
getSearchPlacesForDir(dir, globalConfigPlaces) {
|
||||
return (dir.isGlobalConfig ? globalConfigPlaces : this.config.searchPlaces).map((place) => path_1.default.join(dir.path, place));
|
||||
}
|
||||
getGlobalConfigDir() {
|
||||
return (0, env_paths_1.default)(this.config.moduleName, { suffix: '' }).config;
|
||||
}
|
||||
*getGlobalDirs(startDir) {
|
||||
const stopDir = path_1.default.resolve(this.config.stopDir ?? os_1.default.homedir());
|
||||
yield { path: startDir, isGlobalConfig: false };
|
||||
let currentDir = startDir;
|
||||
while (currentDir !== stopDir) {
|
||||
const parentDir = path_1.default.dirname(currentDir);
|
||||
/* istanbul ignore if -- @preserve */
|
||||
if (parentDir === currentDir) {
|
||||
// we're probably at the root of the directory structure
|
||||
break;
|
||||
}
|
||||
yield { path: parentDir, isGlobalConfig: false };
|
||||
currentDir = parentDir;
|
||||
}
|
||||
yield { path: this.getGlobalConfigDir(), isGlobalConfig: true };
|
||||
}
|
||||
}
|
||||
exports.ExplorerBase = ExplorerBase;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user