Comparing version 0.2.4 to 0.2.5
19
index.js
@@ -36,4 +36,19 @@ "use strict"; | ||
var core_1 = require("@swc/core"); | ||
var packagePath = path.join(process.cwd(), 'package.json'); | ||
var packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf-8')); | ||
/** | ||
* Loads closes package.json in the directory hierarchy | ||
*/ | ||
function loadClosesPackageJson(attempts) { | ||
if (attempts === void 0) { attempts = 1; } | ||
if (attempts > 5) { | ||
throw new Error('Can\'t resolve main package.json file'); | ||
} | ||
var mainPath = attempts === 1 ? './' : Array(attempts).join("../"); | ||
try { | ||
return require(mainPath + 'package.json'); | ||
} | ||
catch (e) { | ||
return loadClosesPackageJson(attempts + 1); | ||
} | ||
} | ||
var packageConfig = loadClosesPackageJson(); | ||
var isEsmProject = packageConfig.type === 'module'; | ||
@@ -40,0 +55,0 @@ // Jest use the `vm` [Module API](https://nodejs.org/api/vm.html#vm_class_vm_module) for ESM. |
{ | ||
"name": "@swc/jest", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "swc integration for jest", | ||
@@ -18,2 +18,6 @@ "main": "index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/swc-project/jest.git" | ||
}, | ||
"peerDependencies": { | ||
@@ -20,0 +24,0 @@ "@swc/core": "*" |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
7291
114