Socket
Socket
Sign inDemoInstall

@pkgr/utils

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pkgr/utils - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

2

lib/browser.js
// based on https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js
import { execSync } from 'child_process';
import { execSync } from 'node:child_process';
import path from 'node:path';

@@ -4,0 +4,0 @@ import { fileURLToPath } from 'node:url';

@@ -12,1 +12,11 @@ /// <reference types="node" />

export declare const EXTENSIONS: string[];
export declare const SCRIPT_RUNNERS: {
readonly npm: "npx";
readonly pnpm: "pnpm";
readonly yarn: "yarn";
};
export declare const SCRIPT_EXECUTORS: {
readonly npm: "npx";
readonly pnpm: "pnpx";
readonly yarn: "yarn dlx";
};
var _a;
import { createRequire } from 'module';
import { createRequire } from 'node:module';
export const DEV = 'development';

@@ -13,2 +13,12 @@ export const PROD = 'production';

export const EXTENSIONS = ['.ts', '.tsx', ...Object.keys(cjsRequire.extensions)];
export const SCRIPT_RUNNERS = {
npm: 'npx',
pnpm: 'pnpm',
yarn: 'yarn',
};
export const SCRIPT_EXECUTORS = {
npm: 'npx',
pnpm: 'pnpx',
yarn: 'yarn dlx',
};
//# sourceMappingURL=constants.js.map

@@ -10,3 +10,3 @@ export declare const tryPkg: (pkg: string) => string | undefined;

export declare const isVueAvailable: boolean;
export declare const tryFile: (filePath?: string | string[] | undefined, includeDir?: boolean) => string;
export declare const tryFile: (filePath?: string[] | string, includeDir?: boolean) => string;
export declare const tryExtensions: (filepath: string, extensions?: string[]) => string;

@@ -20,1 +20,4 @@ export declare const tryGlob: (paths: string[], options?: string | {

export declare const arrayify: <T, R = T extends (infer S)[] ? NonNullable<S> : NonNullable<T>>(...args: (R | R[])[]) => R[];
export declare const getPackageManager: () => "pnpm" | "yarn" | "npm" | undefined;
export declare const getScriptRunner: () => "npx" | "pnpm" | "yarn" | undefined;
export declare const getScriptExecutor: () => "npx" | "pnpx" | "yarn dlx" | undefined;
import fs from 'node:fs';
import path from 'node:path';
import isGlob from 'is-glob';
import { CWD, EXTENSIONS, cjsRequire } from './constants.js';
import { CWD, EXTENSIONS, cjsRequire, SCRIPT_RUNNERS, SCRIPT_EXECUTORS, } from './constants.js';
export const tryPkg = (pkg) => {

@@ -79,2 +79,32 @@ try {

}, []);
export const getPackageManager = () => {
const execPath = process.env.npm_execpath;
if (!execPath) {
return;
}
if (/\byarn\b/.test(execPath)) {
return 'yarn';
}
if (/\bpnpm\b/.test(execPath)) {
return 'pnpm';
}
if (/\bnpm\b/.test(execPath)) {
return 'npm';
}
console.warn('unknown package manager:', execPath);
};
export const getScriptRunner = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_RUNNERS[pm];
};
export const getScriptExecutor = () => {
const pm = getPackageManager();
if (!pm) {
return;
}
return SCRIPT_EXECUTORS[pm];
};
//# sourceMappingURL=helpers.js.map
{
"name": "@pkgr/utils",
"version": "2.2.0",
"version": "2.3.0",
"type": "module",
"description": "Shared utils for `@pkgr` packages or any package else",
"repository": "git+https://github.com/rx-ts/pkgr.git",
"homepage": "https://github.com/rx-ts/pkgr/blob/master/packages/utils",
"author": "JounQin <admin@1stg.me>",
"repository": "git+https://github.com/un-ts/pkgr.git",
"homepage": "https://github.com/un-ts/pkgr/blob/master/packages/utils",
"author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
"donate": {
"recipients": [
{
"name": "unts",
"platform": "opencollective",
"address": "https://opencollective.com/unts",
"weight": 60
},
{
"name": "rxts",
"platform": "opencollective",
"address": "https://opencollective.com/rxts",
"weight": 20
},
{
"name": "1stG",
"email": "i@1stg.me",
"weight": 20,
"platforms": [
{
"platform": "opencollective",
"address": "https://opencollective.com/1stG"
},
{
"platform": "patreon",
"address": "https://www.patreon.com/1stG"
}
]
}
]
},
"funding": "https://opencollective.com/unts",
"license": "MIT",
"engines": {
"node": ">=12"
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},

@@ -13,0 +45,0 @@ "main": "./lib/index.cjs",

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

Sorry, the diff of this file is not supported yet

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