thread-cpu-usage
Advanced tools
Comparing version 0.2.0-alpha.7 to 0.2.0-alpha.8
12
index.js
@@ -1,13 +0,5 @@ | ||
import { existsSync } from 'node:fs' | ||
import { createRequire } from 'node:module' | ||
import { arch, platform } from 'node:os' | ||
import { resolve } from 'node:path' | ||
import { getNativeAddonPath } from './lib/utils.js' | ||
const addonPath = resolve( | ||
import.meta.dirname, | ||
'native', | ||
`${platform()}-${arch()}-${existsSync('/etc/alpine-release') ? 'musl' : 'glibc'}.node` | ||
) | ||
const require = createRequire(import.meta.url) | ||
export const threadCpuUsage = require(addonPath).threadCpuUsage | ||
export const threadCpuUsage = require(getNativeAddonPath()).threadCpuUsage |
{ | ||
"name": "thread-cpu-usage", | ||
"version": "0.2.0-alpha.7", | ||
"version": "0.2.0-alpha.8", | ||
"description": "Get CPU usage per thread", | ||
@@ -20,2 +20,3 @@ "homepage": "https://github.com/platformatic/thread-cpu-usage#readme", | ||
"index.js", | ||
"lib", | ||
"native", | ||
@@ -22,0 +23,0 @@ "scripts", |
import { spawn } from 'node:child_process' | ||
import { once } from 'node:events' | ||
import { existsSync } from 'node:fs' | ||
import { platform } from 'node:os' | ||
import { getNativeAddonPath } from './helper.js' | ||
import { getNativeAddonPath, isWindows } from '../lib/utils.js' | ||
@@ -10,6 +9,5 @@ const addonPath = getNativeAddonPath() | ||
if (process.env.npm_config_build_from_source === 'true' || !existsSync(addonPath)) { | ||
const subprocess = | ||
platform() === 'win32' | ||
? spawn('npm run build', { shell: true, windowsVerbatimArguments: true, stdio: 'inherit' }) | ||
: spawn('npm', ['run', 'build'], { stdio: 'inherit' }) | ||
const subprocess = isWindows | ||
? spawn('npm run build', { shell: true, windowsVerbatimArguments: true, stdio: 'inherit' }) | ||
: spawn('npm', ['run', 'build'], { stdio: 'inherit' }) | ||
@@ -16,0 +14,0 @@ const [code] = await once(subprocess, 'exit') |
import { cp, rm } from 'node:fs/promises' | ||
import { resolve } from 'node:path' | ||
import { cleanNativeDirectory, getNativeAddonPath } from './helper.js' | ||
import { cleanNativeDirectory, getNativeAddonPath } from '../lib/utils.js' | ||
@@ -5,0 +5,0 @@ try { |
@@ -1,3 +0,3 @@ | ||
import { getNativeTriplet } from './helper.js' | ||
import { getNativeTriplet } from '../lib/utils.js' | ||
console.log(`Current target: ${getNativeTriplet().join('-')}`) |
import { cp, glob } from 'node:fs/promises' | ||
import { basename, dirname, resolve } from 'node:path' | ||
import { cleanNativeDirectory, nativeDir } from './helper.js' | ||
import { cleanNativeDirectory, nativeDir } from '../lib/utils.js' | ||
@@ -5,0 +5,0 @@ await cleanNativeDirectory() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
514877
67