@oclif/core
Advanced tools
Comparing version 4.0.0-beta.6 to 4.0.0-beta.7
@@ -78,3 +78,3 @@ "use strict"; | ||
debug(`Could not parse tsconfig.json. Skipping typescript path lookup for ${root}.`); | ||
(0, warn_1.warn)(`Could not parse tsconfig.json for ${root}. Falling back to compiled source.`); | ||
(0, warn_1.memoizedWarn)(`Could not parse tsconfig.json for ${root}. Falling back to compiled source.`); | ||
} | ||
@@ -94,3 +94,3 @@ } | ||
debug(`Could not find ts-node at ${tsNodePath}. Skipping ts-node registration for ${root}.`); | ||
(0, warn_1.warn)(`Could not find ts-node at ${tsNodePath}. Please ensure that ts-node is a devDependency. Falling back to compiled source.`); | ||
(0, warn_1.memoizedWarn)(`Could not find ts-node at ${tsNodePath}. Please ensure that ts-node is a devDependency. Falling back to compiled source.`); | ||
return; | ||
@@ -224,3 +224,3 @@ } | ||
if (!(0, util_1.isProd)()) | ||
(0, warn_1.warn)(`Could not find source for ${orig} based on tsconfig. Defaulting to compiled source.`); | ||
(0, warn_1.memoizedWarn)(`Could not find source for ${orig} based on tsconfig. Defaulting to compiled source.`); | ||
return orig; | ||
@@ -248,3 +248,3 @@ } | ||
if (plugin?.type === 'link') | ||
(0, warn_1.warn)(`${plugin?.name} is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.`); | ||
(0, warn_1.memoizedWarn)(`${plugin?.name} is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.`); | ||
return orig; | ||
@@ -254,3 +254,3 @@ } | ||
debug(`Skipping typescript path lookup for ${root} because ts-node is run in node version ${process.version}"`); | ||
(0, warn_1.warn)(`ts-node executable cannot transpile ESM in Node 20. Existing compiled source will be used instead. See https://github.com/oclif/core/issues/817.`); | ||
(0, warn_1.memoizedWarn)(`ts-node executable cannot transpile ESM in Node 20. Existing compiled source will be used instead. See https://github.com/oclif/core/issues/817.`); | ||
return orig; | ||
@@ -257,0 +257,0 @@ } |
@@ -1,7 +0,1 @@ | ||
type Options = { | ||
/** | ||
* If true, will only print the same warning once. | ||
*/ | ||
ignoreDuplicates?: boolean; | ||
}; | ||
/** | ||
@@ -11,5 +5,5 @@ * Prints a pretty warning message to stderr. | ||
* @param input The error or string to print. | ||
* @param options.ignoreDuplicates If true, will only print the same warning once. | ||
*/ | ||
export declare function warn(input: Error | string, options?: Options): void; | ||
export declare function warn(input: Error | string): void; | ||
export declare function memoizedWarn(input: Error | string): void; | ||
export default warn; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.warn = void 0; | ||
exports.memoizedWarn = exports.warn = void 0; | ||
const logger_1 = require("../logger"); | ||
@@ -12,3 +12,2 @@ const write_1 = require("../ux/write"); | ||
const pretty_print_1 = __importDefault(require("./errors/pretty-print")); | ||
const WARNINGS = new Set(); | ||
/** | ||
@@ -18,9 +17,4 @@ * Prints a pretty warning message to stderr. | ||
* @param input The error or string to print. | ||
* @param options.ignoreDuplicates If true, will only print the same warning once. | ||
*/ | ||
function warn(input, options) { | ||
const ignoreDuplicates = options?.ignoreDuplicates ?? true; | ||
if (ignoreDuplicates && WARNINGS.has(input)) | ||
return; | ||
WARNINGS.add(input); | ||
function warn(input) { | ||
let err; | ||
@@ -43,2 +37,9 @@ if (typeof input === 'string') { | ||
exports.warn = warn; | ||
const WARNINGS = new Set(); | ||
function memoizedWarn(input) { | ||
if (!WARNINGS.has(input)) | ||
warn(input); | ||
WARNINGS.add(input); | ||
} | ||
exports.memoizedWarn = memoizedWarn; | ||
exports.default = warn; |
@@ -46,9 +46,7 @@ "use strict"; | ||
if (!typescript) { | ||
(0, warn_1.warn)('Could not find typescript. Please ensure that typescript is a devDependency. Falling back to compiled source.'); | ||
(0, warn_1.memoizedWarn)('Could not find typescript. Please ensure that typescript is a devDependency. Falling back to compiled source.'); | ||
return; | ||
} | ||
const read = async (path) => { | ||
const localRoot = await upUntil(path, async (p) => | ||
// eslint-disable-next-line unicorn/no-await-expression-member | ||
(await (0, promises_1.readdir)(p)).includes('package.json')); | ||
const localRoot = await upUntil(path, async (p) => (await (0, promises_1.readdir)(p)).includes('package.json')); | ||
if (!localRoot) | ||
@@ -55,0 +53,0 @@ return; |
{ | ||
"name": "@oclif/core", | ||
"description": "base library for oclif CLIs", | ||
"version": "4.0.0-beta.6", | ||
"version": "4.0.0-beta.7", | ||
"author": "Salesforce", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues", |
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
393265
9910