Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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 0.7.0 to 0.7.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.7.1](https://github.com/rx-ts/pkgr/compare/@pkgr/utils@0.7.0...@pkgr/utils@0.7.1) (2021-04-25)
### Bug Fixes
* rollback to open@7, add missing define option ([ffaeabf](https://github.com/rx-ts/pkgr/commit/ffaeabff8ea877eef09a285c8103fa313984cee2))
# [0.7.0](https://github.com/rx-ts/pkgr/compare/@pkgr/utils@0.6.0...@pkgr/utils@0.7.0) (2021-04-20)

@@ -8,0 +19,0 @@

16

lib/browser.js

@@ -85,2 +85,6 @@ "use strict";

}
// If there are arguments, they must be passed as array with the browser
if (typeof browser === 'string' && args.length > 0) {
browser = [browser, ...args];
}
// Fallback to open

@@ -90,11 +94,5 @@ // (It will always open new tab)

try {
open_1.default(url, {
app: browser
? {
name: browser,
arguments: args,
}
: undefined,
wait: false,
}).catch(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function -- Prevent `unhandledRejection` error.
const options = { app: browser, wait: false };
// eslint-disable-next-line @typescript-eslint/no-empty-function
open_1.default(url, options).catch(() => { }); // Prevent `unhandledRejection` error.
return true;

@@ -101,0 +99,0 @@ }

@@ -101,2 +101,6 @@ 'use strict';

}
// If there are arguments, they must be passed as array with the browser
if (typeof browser === 'string' && args.length > 0) {
browser = tslib.__spreadArray([browser], args);
}
// Fallback to open

@@ -106,11 +110,5 @@ // (It will always open new tab)

try {
open__default['default'](url, {
app: browser
? {
name: browser,
arguments: args,
}
: undefined,
wait: false,
}).catch(function () { }); // eslint-disable-line @typescript-eslint/no-empty-function -- Prevent `unhandledRejection` error.
var options = { app: browser, wait: false };
// eslint-disable-next-line @typescript-eslint/no-empty-function
open__default['default'](url, options).catch(function () { }); // Prevent `unhandledRejection` error.
return true;

@@ -117,0 +115,0 @@ }

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("child_process"),t=require("chalk"),o=require("cross-spawn"),s=require("open"),n=require("fs"),a=require("path"),i=require("is-glob"),u=require("tiny-glob/sync");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c,p,d=l(t),f=l(o),v=l(s),y=l(n),x=l(a),_=l(i),R=l(u);!function(e){e[e.NONE=0]="NONE",e[e.BROWSER=1]="BROWSER",e[e.SCRIPT=2]="SCRIPT"}(c||(c={}));var g="development",E=void 0===(p=process.env.NODE_ENV)?g:p,h=E===g,S="production"===E,A=process.cwd(),O=e.__spreadArray([".ts",".tsx"],Object.keys(require.extensions)),b=function(e){try{return require.resolve(e)}catch(e){}},m=function(e){try{return require(e)}catch(e){}},w=function(e){return!!b(e)},N=w("typescript"),q=w("@angular/core"),W=w("@mdx/mdx")||w("@mdx/react"),D=w("react"),B=w("svelte"),P=w("vue"),k=function(e,r){if(void 0===r&&(r=!1),"string"==typeof e)return y.default.existsSync(e)&&(r||y.default.statSync(e).isFile())?e:"";for(var t=0,o=e||[];t<o.length;t++){var s=o[t];if(k(s,r))return s}return""},C=function(r,t){void 0===t&&(t={});var o="string"==typeof t?{baseDir:t}:t,s=o.absolute,n=void 0===s||s,a=o.baseDir,i=void 0===a?A:a;return r.reduce((function(r,t){return e.__spreadArray(e.__spreadArray([],r),_.default(t)?R.default(t,{absolute:n,cwd:i}):[k(x.default.resolve(i,t),!0)]).filter(Boolean)}),[])},j=m(x.default.resolve("package.json"))||{},T=(m(x.default.resolve("lerna.json"))||{}).packages||j.workspaces||[],I=Array.isArray(T)&&T.length>0,G=I?C(T):[];exports.CWD=A,exports.DEV=g,exports.EXTENSIONS=O,exports.NODE_ENV=E,exports.NODE_MODULES_REG=/[/\\]node_modules[/\\]/,exports.PROD="production",exports.__DEV__=h,exports.__PROD__=S,exports.arrayify=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.reduce((function(e,r){return e.push.apply(e,Array.isArray(r)?r:null==r?[]:[r]),e}),[])},exports.findUp=function(e,r){if(void 0===r&&(r="package.json"),console.assert(x.default.isAbsolute(e)),!k(e,!0)||e!==A&&!e.startsWith(A+x.default.sep))return"";e=x.default.resolve(y.default.statSync(e).isDirectory()?e:x.default.resolve(e,".."));do{var t=k(x.default.resolve(e,r));if(t)return t;e=x.default.resolve(e,"..")}while(e===A||e.startsWith(A+x.default.sep));return""},exports.identify=function(e){return!!e},exports.isAngularAvailable=q,exports.isMdxAvailable=W,exports.isMonorepo=I,exports.isPkgAvailable=w,exports.isReactAvailable=D,exports.isSvelteAvailable=B,exports.isTsAvailable=N,exports.isVueAvailable=P,exports.monorepoPkgs=G,exports.openBrowser=function(t){var o=function(){var e=process.env.BROWSER,r=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];return{action:e?e.toLowerCase().endsWith(".js")?c.SCRIPT:"none"===e.toLowerCase()?c.NONE:c.BROWSER:c.BROWSER,value:e,args:r}}(),s=o.action,n=o.value,a=o.args;switch(s){case c.NONE:return!1;case c.SCRIPT:return function(r,t){var o=process.argv.slice(2);return f.default("node",e.__spreadArray(e.__spreadArray([r],o),[t]),{stdio:"inherit"}).on("close",(function(e){0!==e&&(console.log(),console.log(d.default.red("The script specified as BROWSER environment variable failed.")),console.log(d.default.cyan(r)+" exited with code "+e+".\n"))})),!0}(n,t);case c.BROWSER:return function(e,t,o){if("darwin"===process.platform&&("string"!=typeof e||"google chrome"===e))try{return r.execSync('ps cax | grep "Google Chrome"'),r.execSync('osascript ../openChrome.applescript "'+encodeURI(t)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(e){}"darwin"===process.platform&&"open"===e&&(e=void 0);try{return v.default(t,{app:e?{name:e,arguments:o}:void 0,wait:!1}).catch((function(){})),!0}catch(e){return!1}}(n,t,a);default:throw new Error("Not implemented.")}},exports.tryExtensions=function(r,t){void 0===t&&(t=O);var o=e.__spreadArray(e.__spreadArray([],t),[""]).find((function(e){return k(r+e)}));return null==o?"":r+o},exports.tryFile=k,exports.tryGlob=C,exports.tryPkg=b,exports.tryRequirePkg=m;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("child_process"),t=require("chalk"),o=require("cross-spawn"),s=require("open"),n=require("fs"),a=require("path"),i=require("is-glob"),u=require("tiny-glob/sync");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c,p,d=l(t),f=l(o),v=l(s),y=l(n),x=l(a),_=l(i),g=l(u);!function(e){e[e.NONE=0]="NONE",e[e.BROWSER=1]="BROWSER",e[e.SCRIPT=2]="SCRIPT"}(c||(c={}));var R="development",E=void 0===(p=process.env.NODE_ENV)?R:p,h=E===R,S="production"===E,A=process.cwd(),O=e.__spreadArray([".ts",".tsx"],Object.keys(require.extensions)),b=function(e){try{return require.resolve(e)}catch(e){}},w=function(e){try{return require(e)}catch(e){}},N=function(e){return!!b(e)},m=N("typescript"),q=N("@angular/core"),W=N("@mdx/mdx")||N("@mdx/react"),D=N("react"),B=N("svelte"),P=N("vue"),k=function(e,r){if(void 0===r&&(r=!1),"string"==typeof e)return y.default.existsSync(e)&&(r||y.default.statSync(e).isFile())?e:"";for(var t=0,o=e||[];t<o.length;t++){var s=o[t];if(k(s,r))return s}return""},C=function(r,t){void 0===t&&(t={});var o="string"==typeof t?{baseDir:t}:t,s=o.absolute,n=void 0===s||s,a=o.baseDir,i=void 0===a?A:a;return r.reduce((function(r,t){return e.__spreadArray(e.__spreadArray([],r),_.default(t)?g.default(t,{absolute:n,cwd:i}):[k(x.default.resolve(i,t),!0)]).filter(Boolean)}),[])},j=w(x.default.resolve("package.json"))||{},T=(w(x.default.resolve("lerna.json"))||{}).packages||j.workspaces||[],I=Array.isArray(T)&&T.length>0,G=I?C(T):[];exports.CWD=A,exports.DEV=R,exports.EXTENSIONS=O,exports.NODE_ENV=E,exports.NODE_MODULES_REG=/[/\\]node_modules[/\\]/,exports.PROD="production",exports.__DEV__=h,exports.__PROD__=S,exports.arrayify=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.reduce((function(e,r){return e.push.apply(e,Array.isArray(r)?r:null==r?[]:[r]),e}),[])},exports.findUp=function(e,r){if(void 0===r&&(r="package.json"),console.assert(x.default.isAbsolute(e)),!k(e,!0)||e!==A&&!e.startsWith(A+x.default.sep))return"";e=x.default.resolve(y.default.statSync(e).isDirectory()?e:x.default.resolve(e,".."));do{var t=k(x.default.resolve(e,r));if(t)return t;e=x.default.resolve(e,"..")}while(e===A||e.startsWith(A+x.default.sep));return""},exports.identify=function(e){return!!e},exports.isAngularAvailable=q,exports.isMdxAvailable=W,exports.isMonorepo=I,exports.isPkgAvailable=N,exports.isReactAvailable=D,exports.isSvelteAvailable=B,exports.isTsAvailable=m,exports.isVueAvailable=P,exports.monorepoPkgs=G,exports.openBrowser=function(t){var o=function(){var e=process.env.BROWSER,r=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];return{action:e?e.toLowerCase().endsWith(".js")?c.SCRIPT:"none"===e.toLowerCase()?c.NONE:c.BROWSER:c.BROWSER,value:e,args:r}}(),s=o.action,n=o.value,a=o.args;switch(s){case c.NONE:return!1;case c.SCRIPT:return function(r,t){var o=process.argv.slice(2);return f.default("node",e.__spreadArray(e.__spreadArray([r],o),[t]),{stdio:"inherit"}).on("close",(function(e){0!==e&&(console.log(),console.log(d.default.red("The script specified as BROWSER environment variable failed.")),console.log(d.default.cyan(r)+" exited with code "+e+".\n"))})),!0}(n,t);case c.BROWSER:return function(t,o,s){if("darwin"===process.platform&&("string"!=typeof t||"google chrome"===t))try{return r.execSync('ps cax | grep "Google Chrome"'),r.execSync('osascript ../openChrome.applescript "'+encodeURI(o)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(e){}"darwin"===process.platform&&"open"===t&&(t=void 0),"string"==typeof t&&s.length>0&&(t=e.__spreadArray([t],s));try{var n={app:t,wait:!1};return v.default(o,n).catch((function(){})),!0}catch(e){return!1}}(n,t,a);default:throw new Error("Not implemented.")}},exports.tryExtensions=function(r,t){void 0===t&&(t=O);var o=e.__spreadArray(e.__spreadArray([],t),[""]).find((function(e){return k(r+e)}));return null==o?"":r+o},exports.tryFile=k,exports.tryGlob=C,exports.tryPkg=b,exports.tryRequirePkg=w;

@@ -86,2 +86,6 @@ import { execSync } from 'child_process';

}
// If there are arguments, they must be passed as array with the browser
if (typeof browser === 'string' && args.length > 0) {
browser = [browser, ...args];
}
// Fallback to open

@@ -91,11 +95,5 @@ // (It will always open new tab)

try {
open(url, {
app: browser
? {
name: browser,
arguments: args,
}
: undefined,
wait: false,
}).catch(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function -- Prevent `unhandledRejection` error.
const options = { app: browser, wait: false };
// eslint-disable-next-line @typescript-eslint/no-empty-function
open(url, options).catch(() => { }); // Prevent `unhandledRejection` error.
return true;

@@ -102,0 +100,0 @@ }

@@ -1,1 +0,1 @@

import{execSync as e}from"child_process";import r from"chalk";import o from"cross-spawn";import t from"open";import s from"fs";import n from"path";import c from"is-glob";import i from"tiny-glob/sync";var a;function p(s){const{action:n,value:c,args:i}=function(){const e=process.env.BROWSER,r=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];let o;return o=e?e.toLowerCase().endsWith(".js")?a.SCRIPT:"none"===e.toLowerCase()?a.NONE:a.BROWSER:a.BROWSER,{action:o,value:e,args:r}}();switch(n){case a.NONE:return!1;case a.SCRIPT:return function(e,t){const s=process.argv.slice(2);return o("node",[e,...s,t],{stdio:"inherit"}).on("close",(o=>{0!==o&&(console.log(),console.log(r.red("The script specified as BROWSER environment variable failed.")),console.log(`${r.cyan(e)} exited with code ${o}.\n`))})),!0}(c,s);case a.BROWSER:return function(r,o,s){if("darwin"===process.platform&&("string"!=typeof r||"google chrome"===r))try{return e('ps cax | grep "Google Chrome"'),e('osascript ../openChrome.applescript "'+encodeURI(o)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(e){}"darwin"===process.platform&&"open"===r&&(r=void 0);try{return t(o,{app:r?{name:r,arguments:s}:void 0,wait:!1}).catch((()=>{})),!0}catch(e){return!1}}(c,s,i);default:throw new Error("Not implemented.")}}!function(e){e[e.NONE=0]="NONE",e[e.BROWSER=1]="BROWSER",e[e.SCRIPT=2]="SCRIPT"}(a||(a={}));const l="development",u="production",{NODE_ENV:d=l}=process.env,m=d===l,f="production"===d,R=/[/\\]node_modules[/\\]/,v=process.cwd(),g=[".ts",".tsx",...Object.keys(require.extensions)],h=e=>{try{return require.resolve(e)}catch(e){}},y=e=>{try{return require(e)}catch(e){}},S=e=>!!h(e),E=S("typescript"),w=S("@angular/core"),O=S("@mdx/mdx")||S("@mdx/react"),W=S("react"),N=S("svelte"),B=S("vue"),b=(e,r=!1)=>{if("string"==typeof e)return s.existsSync(e)&&(r||s.statSync(e).isFile())?e:"";for(const o of e||[])if(b(o,r))return o;return""},x=(e,r=g)=>{const o=[...r,""].find((r=>b(e+r)));return null==o?"":e+o},C=(e,r={})=>{const{absolute:o=!0,baseDir:t=v}="string"==typeof r?{baseDir:r}:r;return e.reduce(((e,r)=>[...e,...c(r)?i(r,{absolute:o,cwd:t}):[b(n.resolve(t,r),!0)]].filter(Boolean)),[])},A=e=>!!e,_=(e,r="package.json")=>{if(console.assert(n.isAbsolute(e)),!b(e,!0)||e!==v&&!e.startsWith(v+n.sep))return"";e=n.resolve(s.statSync(e).isDirectory()?e:n.resolve(e,".."));do{const o=b(n.resolve(e,r));if(o)return o;e=n.resolve(e,"..")}while(e===v||e.startsWith(v+n.sep));return""},k=(...e)=>e.reduce(((e,r)=>(e.push(...Array.isArray(r)?r:null==r?[]:[r]),e)),[]),j=y(n.resolve("package.json"))||{},I=(y(n.resolve("lerna.json"))||{}).packages||j.workspaces||[],T=Array.isArray(I)&&I.length>0,D=T?C(I):[];export{v as CWD,l as DEV,g as EXTENSIONS,d as NODE_ENV,R as NODE_MODULES_REG,u as PROD,m as __DEV__,f as __PROD__,k as arrayify,_ as findUp,A as identify,w as isAngularAvailable,O as isMdxAvailable,T as isMonorepo,S as isPkgAvailable,W as isReactAvailable,N as isSvelteAvailable,E as isTsAvailable,B as isVueAvailable,D as monorepoPkgs,p as openBrowser,x as tryExtensions,b as tryFile,C as tryGlob,h as tryPkg,y as tryRequirePkg};
import{execSync as e}from"child_process";import r from"chalk";import o from"cross-spawn";import t from"open";import s from"fs";import n from"path";import c from"is-glob";import i from"tiny-glob/sync";var a;function p(s){const{action:n,value:c,args:i}=function(){const e=process.env.BROWSER,r=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];let o;return o=e?e.toLowerCase().endsWith(".js")?a.SCRIPT:"none"===e.toLowerCase()?a.NONE:a.BROWSER:a.BROWSER,{action:o,value:e,args:r}}();switch(n){case a.NONE:return!1;case a.SCRIPT:return function(e,t){const s=process.argv.slice(2);return o("node",[e,...s,t],{stdio:"inherit"}).on("close",(o=>{0!==o&&(console.log(),console.log(r.red("The script specified as BROWSER environment variable failed.")),console.log(`${r.cyan(e)} exited with code ${o}.\n`))})),!0}(c,s);case a.BROWSER:return function(r,o,s){if("darwin"===process.platform&&("string"!=typeof r||"google chrome"===r))try{return e('ps cax | grep "Google Chrome"'),e('osascript ../openChrome.applescript "'+encodeURI(o)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(e){}"darwin"===process.platform&&"open"===r&&(r=void 0),"string"==typeof r&&s.length>0&&(r=[r,...s]);try{return t(o,{app:r,wait:!1}).catch((()=>{})),!0}catch(e){return!1}}(c,s,i);default:throw new Error("Not implemented.")}}!function(e){e[e.NONE=0]="NONE",e[e.BROWSER=1]="BROWSER",e[e.SCRIPT=2]="SCRIPT"}(a||(a={}));const l="development",u="production",{NODE_ENV:d=l}=process.env,f=d===l,m="production"===d,R=/[/\\]node_modules[/\\]/,g=process.cwd(),h=[".ts",".tsx",...Object.keys(require.extensions)],v=e=>{try{return require.resolve(e)}catch(e){}},y=e=>{try{return require(e)}catch(e){}},S=e=>!!v(e),E=S("typescript"),w=S("@angular/core"),O=S("@mdx/mdx")||S("@mdx/react"),W=S("react"),N=S("svelte"),B=S("vue"),b=(e,r=!1)=>{if("string"==typeof e)return s.existsSync(e)&&(r||s.statSync(e).isFile())?e:"";for(const o of e||[])if(b(o,r))return o;return""},x=(e,r=h)=>{const o=[...r,""].find((r=>b(e+r)));return null==o?"":e+o},C=(e,r={})=>{const{absolute:o=!0,baseDir:t=g}="string"==typeof r?{baseDir:r}:r;return e.reduce(((e,r)=>[...e,...c(r)?i(r,{absolute:o,cwd:t}):[b(n.resolve(t,r),!0)]].filter(Boolean)),[])},A=e=>!!e,_=(e,r="package.json")=>{if(console.assert(n.isAbsolute(e)),!b(e,!0)||e!==g&&!e.startsWith(g+n.sep))return"";e=n.resolve(s.statSync(e).isDirectory()?e:n.resolve(e,".."));do{const o=b(n.resolve(e,r));if(o)return o;e=n.resolve(e,"..")}while(e===g||e.startsWith(g+n.sep));return""},k=(...e)=>e.reduce(((e,r)=>(e.push(...Array.isArray(r)?r:null==r?[]:[r]),e)),[]),j=y(n.resolve("package.json"))||{},I=(y(n.resolve("lerna.json"))||{}).packages||j.workspaces||[],T=Array.isArray(I)&&I.length>0,D=T?C(I):[];export{g as CWD,l as DEV,h as EXTENSIONS,d as NODE_ENV,R as NODE_MODULES_REG,u as PROD,f as __DEV__,m as __PROD__,k as arrayify,_ as findUp,A as identify,w as isAngularAvailable,O as isMdxAvailable,T as isMonorepo,S as isPkgAvailable,W as isReactAvailable,N as isSvelteAvailable,E as isTsAvailable,B as isVueAvailable,D as monorepoPkgs,p as openBrowser,x as tryExtensions,b as tryFile,C as tryGlob,v as tryPkg,y as tryRequirePkg};

@@ -87,2 +87,6 @@ import { __spreadArray } from 'tslib';

}
// If there are arguments, they must be passed as array with the browser
if (typeof browser === 'string' && args.length > 0) {
browser = __spreadArray([browser], args);
}
// Fallback to open

@@ -92,11 +96,5 @@ // (It will always open new tab)

try {
open(url, {
app: browser
? {
name: browser,
arguments: args,
}
: undefined,
wait: false,
}).catch(function () { }); // eslint-disable-line @typescript-eslint/no-empty-function -- Prevent `unhandledRejection` error.
var options = { app: browser, wait: false };
// eslint-disable-next-line @typescript-eslint/no-empty-function
open(url, options).catch(function () { }); // Prevent `unhandledRejection` error.
return true;

@@ -103,0 +101,0 @@ }

@@ -1,1 +0,1 @@

import{__spreadArray as r}from"tslib";import{execSync as e}from"child_process";import o from"chalk";import t from"cross-spawn";import n from"open";import s from"fs";import i from"path";import c from"is-glob";import a from"tiny-glob/sync";var u,p;function l(s){var i=function(){var r=process.env.BROWSER,e=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];return{action:r?r.toLowerCase().endsWith(".js")?u.SCRIPT:"none"===r.toLowerCase()?u.NONE:u.BROWSER:u.BROWSER,value:r,args:e}}(),c=i.action,a=i.value,p=i.args;switch(c){case u.NONE:return!1;case u.SCRIPT:return function(e,n){var s=process.argv.slice(2);return t("node",r(r([e],s),[n]),{stdio:"inherit"}).on("close",(function(r){0!==r&&(console.log(),console.log(o.red("The script specified as BROWSER environment variable failed.")),console.log(o.cyan(e)+" exited with code "+r+".\n"))})),!0}(a,s);case u.BROWSER:return function(r,o,t){if("darwin"===process.platform&&("string"!=typeof r||"google chrome"===r))try{return e('ps cax | grep "Google Chrome"'),e('osascript ../openChrome.applescript "'+encodeURI(o)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(r){}"darwin"===process.platform&&"open"===r&&(r=void 0);try{return n(o,{app:r?{name:r,arguments:t}:void 0,wait:!1}).catch((function(){})),!0}catch(r){return!1}}(a,s,p);default:throw new Error("Not implemented.")}}!function(r){r[r.NONE=0]="NONE",r[r.BROWSER=1]="BROWSER",r[r.SCRIPT=2]="SCRIPT"}(u||(u={}));var f="development",d="production",v=void 0===(p=process.env.NODE_ENV)?f:p,m=v===f,R="production"===v,g=/[/\\]node_modules[/\\]/,h=process.cwd(),y=r([".ts",".tsx"],Object.keys(require.extensions)),S=function(r){try{return require.resolve(r)}catch(r){}},E=function(r){try{return require(r)}catch(r){}},w=function(r){return!!S(r)},O=w("typescript"),W=w("@angular/core"),N=w("@mdx/mdx")||w("@mdx/react"),b=w("react"),B=w("svelte"),x=w("vue"),C=function(r,e){if(void 0===e&&(e=!1),"string"==typeof r)return s.existsSync(r)&&(e||s.statSync(r).isFile())?r:"";for(var o=0,t=r||[];o<t.length;o++){var n=t[o];if(C(n,e))return n}return""},A=function(e,o){void 0===o&&(o=y);var t=r(r([],o),[""]).find((function(r){return C(e+r)}));return null==t?"":e+t},_=function(e,o){void 0===o&&(o={});var t="string"==typeof o?{baseDir:o}:o,n=t.absolute,s=void 0===n||n,u=t.baseDir,p=void 0===u?h:u;return e.reduce((function(e,o){return r(r([],e),c(o)?a(o,{absolute:s,cwd:p}):[C(i.resolve(p,o),!0)]).filter(Boolean)}),[])},k=function(r){return!!r},j=function(r,e){if(void 0===e&&(e="package.json"),console.assert(i.isAbsolute(r)),!C(r,!0)||r!==h&&!r.startsWith(h+i.sep))return"";r=i.resolve(s.statSync(r).isDirectory()?r:i.resolve(r,".."));do{var o=C(i.resolve(r,e));if(o)return o;r=i.resolve(r,"..")}while(r===h||r.startsWith(h+i.sep));return""},I=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r.reduce((function(r,e){return r.push.apply(r,Array.isArray(e)?e:null==e?[]:[e]),r}),[])},T=E(i.resolve("package.json"))||{},D=(E(i.resolve("lerna.json"))||{}).packages||T.workspaces||[],P=Array.isArray(D)&&D.length>0,q=P?_(D):[];export{h as CWD,f as DEV,y as EXTENSIONS,v as NODE_ENV,g as NODE_MODULES_REG,d as PROD,m as __DEV__,R as __PROD__,I as arrayify,j as findUp,k as identify,W as isAngularAvailable,N as isMdxAvailable,P as isMonorepo,w as isPkgAvailable,b as isReactAvailable,B as isSvelteAvailable,O as isTsAvailable,x as isVueAvailable,q as monorepoPkgs,l as openBrowser,A as tryExtensions,C as tryFile,_ as tryGlob,S as tryPkg,E as tryRequirePkg};
import{__spreadArray as r}from"tslib";import{execSync as e}from"child_process";import o from"chalk";import t from"cross-spawn";import n from"open";import s from"fs";import i from"path";import c from"is-glob";import a from"tiny-glob/sync";var u,p;function l(s){var i=function(){var r=process.env.BROWSER,e=process.env.BROWSER_ARGS?process.env.BROWSER_ARGS.split(" "):[];return{action:r?r.toLowerCase().endsWith(".js")?u.SCRIPT:"none"===r.toLowerCase()?u.NONE:u.BROWSER:u.BROWSER,value:r,args:e}}(),c=i.action,a=i.value,p=i.args;switch(c){case u.NONE:return!1;case u.SCRIPT:return function(e,n){var s=process.argv.slice(2);return t("node",r(r([e],s),[n]),{stdio:"inherit"}).on("close",(function(r){0!==r&&(console.log(),console.log(o.red("The script specified as BROWSER environment variable failed.")),console.log(o.cyan(e)+" exited with code "+r+".\n"))})),!0}(a,s);case u.BROWSER:return function(o,t,s){if("darwin"===process.platform&&("string"!=typeof o||"google chrome"===o))try{return e('ps cax | grep "Google Chrome"'),e('osascript ../openChrome.applescript "'+encodeURI(t)+'"',{cwd:__dirname,stdio:"ignore"}),!0}catch(r){}"darwin"===process.platform&&"open"===o&&(o=void 0),"string"==typeof o&&s.length>0&&(o=r([o],s));try{return n(t,{app:o,wait:!1}).catch((function(){})),!0}catch(r){return!1}}(a,s,p);default:throw new Error("Not implemented.")}}!function(r){r[r.NONE=0]="NONE",r[r.BROWSER=1]="BROWSER",r[r.SCRIPT=2]="SCRIPT"}(u||(u={}));var f="development",d="production",v=void 0===(p=process.env.NODE_ENV)?f:p,m=v===f,g="production"===v,h=/[/\\]node_modules[/\\]/,R=process.cwd(),y=r([".ts",".tsx"],Object.keys(require.extensions)),S=function(r){try{return require.resolve(r)}catch(r){}},E=function(r){try{return require(r)}catch(r){}},w=function(r){return!!S(r)},O=w("typescript"),W=w("@angular/core"),N=w("@mdx/mdx")||w("@mdx/react"),b=w("react"),B=w("svelte"),x=w("vue"),C=function(r,e){if(void 0===e&&(e=!1),"string"==typeof r)return s.existsSync(r)&&(e||s.statSync(r).isFile())?r:"";for(var o=0,t=r||[];o<t.length;o++){var n=t[o];if(C(n,e))return n}return""},A=function(e,o){void 0===o&&(o=y);var t=r(r([],o),[""]).find((function(r){return C(e+r)}));return null==t?"":e+t},_=function(e,o){void 0===o&&(o={});var t="string"==typeof o?{baseDir:o}:o,n=t.absolute,s=void 0===n||n,u=t.baseDir,p=void 0===u?R:u;return e.reduce((function(e,o){return r(r([],e),c(o)?a(o,{absolute:s,cwd:p}):[C(i.resolve(p,o),!0)]).filter(Boolean)}),[])},k=function(r){return!!r},j=function(r,e){if(void 0===e&&(e="package.json"),console.assert(i.isAbsolute(r)),!C(r,!0)||r!==R&&!r.startsWith(R+i.sep))return"";r=i.resolve(s.statSync(r).isDirectory()?r:i.resolve(r,".."));do{var o=C(i.resolve(r,e));if(o)return o;r=i.resolve(r,"..")}while(r===R||r.startsWith(R+i.sep));return""},I=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r.reduce((function(r,e){return r.push.apply(r,Array.isArray(e)?e:null==e?[]:[e]),r}),[])},T=E(i.resolve("package.json"))||{},D=(E(i.resolve("lerna.json"))||{}).packages||T.workspaces||[],P=Array.isArray(D)&&D.length>0,q=P?_(D):[];export{R as CWD,f as DEV,y as EXTENSIONS,v as NODE_ENV,h as NODE_MODULES_REG,d as PROD,m as __DEV__,g as __PROD__,I as arrayify,j as findUp,k as identify,W as isAngularAvailable,N as isMdxAvailable,P as isMonorepo,w as isPkgAvailable,b as isReactAvailable,B as isSvelteAvailable,O as isTsAvailable,x as isVueAvailable,q as monorepoPkgs,l as openBrowser,A as tryExtensions,C as tryFile,_ as tryGlob,S as tryPkg,E as tryRequirePkg};
{
"name": "@pkgr/utils",
"version": "0.7.0",
"version": "0.7.1",
"description": "Shared utils for `@pkgr` packages or any package else",

@@ -27,3 +27,3 @@ "repository": "git+https://github.com/rx-ts/pkgr.git",

"is-glob": "^4.0.1",
"open": "^8.0.6",
"open": "^7.4.2",
"tiny-glob": "^0.2.6",

@@ -36,3 +36,3 @@ "tslib": "^2.2.0"

"sideEffects": false,
"gitHead": "0de7f36554e8ef886fdfb2cdfc75a225e23b1304"
"gitHead": "364879dfeb4bfa372e32464976124e1b184d4934"
}

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