@bassist/node-utils
Advanced tools
Comparing version 0.2.0 to 0.2.1
/** | ||
* name: @bassist/node-utils | ||
* version: v0.2.0 | ||
* version: v0.2.1 | ||
* description: Opinionated collection of common Node.js utils by @chengpeiquan . | ||
@@ -9,2 +9,2 @@ * author: chengpeiquan <chengpeiquan@chengpeiquan.com> | ||
*/ | ||
(function(i,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@withtypes/fs-extra")):typeof define=="function"&&define.amd?define(["exports","@withtypes/fs-extra"],t):(i=typeof globalThis<"u"?globalThis:i||self,t(i["Node-utils"]={},i["@withtypes/fs-extra"]))})(this,function(i,t){"use strict";const{resolve:r}=(()=>{const e=require("path");return e&&e.__esModule?e:Object.assign(Object.create(null),e,{default:e,[Symbol.toStringTag]:"Module"})})();function l(e,n){n&&t.writeFileSync(e,n)}function y(e){try{t.statSync(e).isDirectory()?(o(e),t.rmdirSync(e)):t.unlinkSync(e)}catch{}}function u(e,n){t.statSync(e).isDirectory()?d(e,n):t.copyFileSync(e,n)}function d(e,n){try{t.mkdirSync(n,{recursive:!0});for(const c of t.readdirSync(e)){const a=r(e,c),s=r(n,c);u(a,s)}}catch{}}function m(e){return t.readdirSync(e).length===0}function o(e){if(t.existsSync(e))try{for(const n of t.readdirSync(e)){const c=r(e,n);t.lstatSync(c).isDirectory()?(o(c),t.rmdirSync(c)):t.unlinkSync(c)}}catch{}}const{dirname:g}=(()=>{const e=require("path");return e&&e.__esModule?e:Object.assign(Object.create(null),e,{default:e,[Symbol.toStringTag]:"Module"})})(),{fileURLToPath:f}=(()=>{const e=require("url");return e&&e.__esModule?e:Object.assign(Object.create(null),e,{default:e,[Symbol.toStringTag]:"Module"})})();function S(e){try{const n=f(e);return g(n)}catch{return""}}function p(e){return/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e)}function _(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z0-9-~]+/g,"-")}function b(){const e={name:"",version:"0.0.0"};try{const n=process.env.npm_config_user_agent;if(!n)return{...e};const c=n.split(" ")[0],[a,s]=c.split("/");return{name:a,version:s}}catch{return{...e}}}i.copy=u,i.copyDir=d,i.emptyDir=o,i.getDirnameInEsModule=S,i.getPackageManagerByUserAgent=b,i.isEmpty=m,i.isValidPackageName=p,i.remove=y,i.toValidPackageName=_,i.write=l,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); | ||
(function(i,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@withtypes/fs-extra")):typeof define=="function"&&define.amd?define(["exports","@withtypes/fs-extra"],n):(i=typeof globalThis<"u"?globalThis:i||self,n(i["Node-utils"]={},i["@withtypes/fs-extra"]))})(this,function(i,n){"use strict";const{resolve:o}=(()=>{const e=require("path");return e&&e.__esModule?e:Object.assign(Object.create(null),e,{default:e,[Symbol.toStringTag]:"Module"})})();function d(e,t){t&&n.writeFileSync(e,t)}function l(e){try{n.statSync(e).isDirectory()?(r(e),n.rmdirSync(e)):n.unlinkSync(e)}catch{}}function y(e,t){n.statSync(e).isDirectory()?u(e,t):n.copyFileSync(e,t)}function u(e,t){try{n.mkdirSync(t,{recursive:!0});for(const c of n.readdirSync(e)){const s=o(e,c),a=o(t,c);y(s,a)}}catch{}}function f(e){return n.readdirSync(e).length===0}function r(e){if(n.existsSync(e))try{for(const t of n.readdirSync(e)){const c=o(e,t);n.lstatSync(c).isDirectory()?(r(c),n.rmdirSync(c)):n.unlinkSync(c)}}catch{}}function g(e){return/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e)}function m(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z0-9-~]+/g,"-")}function p(){const e={name:"",version:"0.0.0"};try{const t=process.env.npm_config_user_agent;if(!t)return{...e};const c=t.split(" ")[0],[s,a]=c.split("/");return{name:s,version:a}}catch{return{...e}}}i.copy=y,i.copyDir=u,i.emptyDir=r,i.getPackageManagerByUserAgent=p,i.isEmpty=f,i.isValidPackageName=g,i.remove=l,i.toValidPackageName=m,i.write=d,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "@bassist/node-utils", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Opinionated collection of common Node.js utils by @chengpeiquan .", | ||
@@ -33,2 +33,2 @@ "author": "chengpeiquan <chengpeiquan@chengpeiquan.com>", | ||
} | ||
} | ||
} |
@@ -44,8 +44,2 @@ /** | ||
/** | ||
* @param metaUrl - import.meta.url | ||
* | ||
* @category path | ||
*/ | ||
export declare function getDirnameInEsModule(metaUrl: string): string; | ||
/** | ||
* Check the package name is valid | ||
@@ -52,0 +46,0 @@ * |
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
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
7
10413
177