Socket
Socket
Sign inDemoInstall

@oclif/core

Package Overview
Dependencies
Maintainers
2
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version 4.0.0-beta.14 to 4.0.0-beta.15

35

lib/config/ts-path.js

@@ -81,2 +81,20 @@ "use strict";

}
async function registerTsx(root, moduleType) {
if (REGISTERED.has(root))
return;
try {
const apiPath = moduleType === 'module' ? 'tsx/esm/api' : 'tsx/cjs/api';
const tsxPath = require.resolve(apiPath, { paths: [root] });
if (!tsxPath)
return;
debug('registering tsx at', root);
debug('tsx path:', tsxPath);
const { register } = await import(tsxPath);
register();
REGISTERED.add(root);
}
catch {
debug(`Could not find tsx. Skipping tsx registration for ${root}.`);
}
}
async function registerTSNode(root, tsconfig) {

@@ -139,3 +157,3 @@ if (REGISTERED.has(root))

* Skip ts-node registration for ESM plugins in production.
* The node ecosystem is not mature enough to support auto-transpiling ESM modules at this time.
* The node/ts-node ecosystem is not mature enough to support auto-transpiling ESM modules at this time.
* See the following:

@@ -147,7 +165,9 @@ * - https://github.com/TypeStrong/ts-node/issues/1791#issuecomment-1149754228

*
* We still register ts-node for ESM plugins when NODE_ENV is "test" or "development" and root plugin is also ESM
* We still register tsx/ts-node for ESM plugins when NODE_ENV is "test" or "development" and root plugin is also ESM
* since that allows plugins to be auto-transpiled when developing locally using `bin/dev.js`.
*/
function cannotTranspileEsm(rootPlugin, plugin, isProduction) {
return (isProduction || rootPlugin?.moduleType === 'commonjs') && plugin?.moduleType === 'module';
return ((isProduction || rootPlugin?.moduleType === 'commonjs') &&
plugin?.moduleType === 'module' &&
!plugin?.pjson.devDependencies?.tsx);
}

@@ -172,3 +192,3 @@ /**

*/
async function determinePath(root, orig) {
async function determinePath(root, orig, plugin) {
const tsconfig = await loadTSConfig(root);

@@ -178,6 +198,9 @@ if (!tsconfig)

debug(`Determining path for ${orig}`);
if (RUN_TIME === 'tsx' || RUN_TIME === 'bun') {
if (RUN_TIME === 'bun') {
debug(`Skipping ts-node registration for ${root} because the runtime is: ${RUN_TIME}`);
}
else {
// attempt to register tsx first. If it fails to register, we will fall back to ts-node
await registerTsx(root, plugin?.moduleType);
// if tsx registration succeeded, then this will exit early since the path will be in REGISTERED already
await registerTSNode(root, tsconfig);

@@ -259,3 +282,3 @@ }

try {
return await determinePath(root, orig);
return await determinePath(root, orig, plugin);
}

@@ -262,0 +285,0 @@ catch (error) {

2

package.json
{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "4.0.0-beta.14",
"version": "4.0.0-beta.15",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc