@visulima/package 3.3.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/package-json.cjs +1 -1
- package/dist/package-json.d.cts +2 -2
- package/dist/package-json.d.mts +2 -2
- package/dist/package-json.d.ts +2 -2
- package/dist/package-json.mjs +1 -1
- package/dist/packem_shared/{package-json-DvR0jmEM.d.cts → package-json-BJTpWpJd.d.cts} +16 -15
- package/dist/packem_shared/{package-json-DvR0jmEM.d.mjs → package-json-BJTpWpJd.d.mjs} +16 -15
- package/dist/packem_shared/{package-json-DvR0jmEM.d.mts → package-json-BJTpWpJd.d.mts} +16 -15
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## @visulima/package [3.4.1](https://github.com/visulima/visulima/compare/@visulima/package@3.4.0...@visulima/package@3.4.1) (2025-01-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/fs:** upgraded to 2.3.4
|
|
7
|
+
* **@visulima/path:** upgraded to 1.3.0
|
|
8
|
+
|
|
9
|
+
## @visulima/package [3.4.0](https://github.com/visulima/visulima/compare/@visulima/package@3.3.0...@visulima/package@3.4.0) (2025-01-03)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **package:** ensurePackages confirm message key support now a function call ([aa8d64c](https://github.com/visulima/visulima/commit/aa8d64c72103d13996f922ec7aa4de74dafe0f1d))
|
|
14
|
+
|
|
1
15
|
## @visulima/package [3.3.0](https://github.com/visulima/visulima/compare/@visulima/package@3.2.2...@visulima/package@3.3.0) (2025-01-02)
|
|
2
16
|
|
|
3
17
|
### Features
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { PackageNotFoundError } from './error.cjs';
|
|
2
2
|
export { RootMonorepo, Strategy, findMonorepoRoot, findMonorepoRootSync } from './monorepo.cjs';
|
|
3
3
|
export { findPackageRoot, findPackageRootSync } from './package.cjs';
|
|
4
|
-
export { d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
4
|
+
export { E as EnsurePackagesOptions, d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.cjs';
|
|
5
5
|
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.cjs';
|
|
6
|
-
import '@antfu/install-pkg';
|
|
7
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
8
8
|
import 'normalize-package-data';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { PackageNotFoundError } from './error.mjs';
|
|
2
2
|
export { RootMonorepo, Strategy, findMonorepoRoot, findMonorepoRootSync } from './monorepo.mjs';
|
|
3
3
|
export { findPackageRoot, findPackageRootSync } from './package.mjs';
|
|
4
|
-
export { d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
4
|
+
export { E as EnsurePackagesOptions, d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.mjs';
|
|
5
5
|
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.mjs';
|
|
6
|
-
import '@antfu/install-pkg';
|
|
7
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
8
8
|
import 'normalize-package-data';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { PackageNotFoundError } from './error.js';
|
|
2
2
|
export { RootMonorepo, Strategy, findMonorepoRoot, findMonorepoRootSync } from './monorepo.js';
|
|
3
3
|
export { findPackageRoot, findPackageRootSync } from './package.js';
|
|
4
|
-
export { d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
4
|
+
export { E as EnsurePackagesOptions, d as NormalizedPackageJson, N as NormalizedReadResult, P as PackageJson, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.d.mjs';
|
|
5
5
|
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.js';
|
|
6
|
-
import '@antfu/install-pkg';
|
|
7
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
8
8
|
import 'normalize-package-data';
|
package/dist/package-json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var A=Object.defineProperty;var s=(e,n)=>A(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("node:fs"),q=require("@antfu/install-pkg"),$=require("@inquirer/confirm"),h=require("@visulima/fs"),E=require("@visulima/fs/error"),k=require("@visulima/fs/utils"),j=require("@visulima/path"),O=require("normalize-package-data"),S=s(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),T=S($),J=S(O);var C=Object.defineProperty,f=s((e,n)=>C(e,"name",{value:n,configurable:!0}),"s");const p=f(e=>{const n=typeof e;return e!==null&&(n==="object"||n==="function")},"isObject"),F=f(e=>p(e)&&Object.keys(e).length===0,"isEmptyObject"),b=new Set(["__proto__","prototype","constructor"]),K=new Set("0123456789");function w(e){const n=[];let r="",t="start",o=!1;for(const a of e)switch(a){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");o&&(r+=a),t="property",o=!o;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(o){o=!1,r+=a;break}if(b.has(r))return[];n.push(r),r="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(o){o=!1,r+=a;break}if(t==="property"){if(b.has(r))return[];n.push(r),r=""}t="index";break}case"]":{if(t==="index"){n.push(Number.parseInt(r,10)),r="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!K.has(a))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),o&&(o=!1,r+="\\"),r+=a}}switch(o&&(r+="\\"),t){case"property":{if(b.has(r))return[];n.push(r);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}s(w,"d");f(w,"getPathSegments");function P(e,n){if(typeof n!="number"&&Array.isArray(e)){const r=Number.parseInt(n,10);return Number.isInteger(r)&&e[r]===e[n]}return!1}s(P,"l");f(P,"isStringIndex");function m(e,n){if(P(e,n))throw new Error("Cannot use string index")}s(m,"p");f(m,"assertNotStringIndex");function u(e,n,r){if(!p(e)||typeof n!="string")return r===void 0?e:r;const t=w(n);if(t.length===0)return r;for(let o=0;o<t.length;o++){const a=t[o];if(P(e,a)?e=o===t.length-1?void 0:null:e=e[a],e==null){if(o!==t.length-1)return r;break}}return e===void 0?r:e}s(u,"getProperty");f(u,"getProperty");function M(e,n,r){if(!p(e)||typeof n!="string")return e;const t=e,o=w(n);for(let a=0;a<o.length;a++){const c=o[a];m(e,c),a===o.length-1?e[c]=r:p(e[c])||(e[c]=typeof o[a+1]=="number"?[]:{}),e=e[c]}return t}s(M,"setProperty");f(M,"setProperty");function U(e,n){if(!p(e)||typeof n!="string")return!1;const r=w(n);for(let t=0;t<r.length;t++){const o=r[t];if(m(e,o),t===r.length-1)return delete e[o],!0;if(e=e[o],!p(e))return!1}}s(U,"deleteProperty");f(U,"deleteProperty");function l(e,n){if(!p(e)||typeof n!="string")return!1;const r=w(n);if(r.length===0)return!1;for(const t of r){if(!p(e)||!(t in e)||P(e,t))return!1;e=e[t]}return!0}s(l,"hasProperty");f(l,"hasProperty");function D(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}s(D,"escapePath");f(D,"escapePath");function v(e){const n=Object.entries(e);return Array.isArray(e)?n.map(([r,t])=>[Number(r),t]):n}s(v,"h");f(v,"entries");function I(e){let n="";for(let[r,t]of v(e))typeof t=="number"?n+=`[${t}]`:(t=D(t),n+=r===0?t:`.${t}`);return n}s(I,"w");f(I,"stringifyPath");function*x(e,n=[]){if(!p(e)||F(e)){n.length>0&&(yield I(n));return}for(const[r,t]of v(e))yield*x(t,[...n,r])}s(x,"y$1");f(x,"deepKeysIterator");function Y(e){return[...x(e)]}s(Y,"deepKeys");f(Y,"deepKeys");const z=typeof process.stdout<"u"&&!process.versions?.deno&&!globalThis.window;var B=Object.defineProperty,d=s((e,n)=>B(e,"name",{value:n,configurable:!0}),"r");const N=new Map,G=d(async(e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=await h.findUp("package.json",r);if(!t)throw new E.NotFoundError("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:N;if(n.cache&&o.has(t))return o.get(t);const a=await h.readJson(t);J(a);const c={packageJson:a,path:t};return o.set(t,c),c},"findPackageJson"),H=d((e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=h.findUpSync("package.json",r);if(!t)throw new E.NotFoundError("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:N;if(n.cache&&o.has(t))return o.get(t);const a=h.readJsonSync(t);J(a);const c={packageJson:a,path:t};return o.set(t,c),c},"findPackageJsonSync"),L=d(async(e,n={})=>{const{cwd:r,...t}=n,o=k.toPath(n.cwd??process.cwd());await h.writeJson(j.join(o,"package.json"),e,t)},"writePackageJson"),Q=d((e,n={})=>{const{cwd:r,...t}=n,o=k.toPath(n.cwd??process.cwd());h.writeJsonSync(j.join(o,"package.json"),e,t)},"writePackageJsonSync"),R=d(e=>{const n=e!==null&&typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");const r=n?structuredClone(e):_.existsSync(e)?h.readJsonSync(e):k.parseJson(e);return J(r),r},"parsePackageJson"),V=d((e,n,r)=>u(e,n,r),"getPackageJsonProperty"),W=d((e,n)=>l(e,n),"hasPackageJsonProperty"),X=d((e,n,r)=>{const t=u(e,"dependencies",{}),o=u(e,"devDependencies",{}),a=u(e,"peerDependencies",{}),c={...t,...o,...r?.peerDeps===!1?{}:a};for(const g of n)if(l(c,g))return!0;return!1},"hasPackageJsonAnyDependency"),Z=d(async(e,n,r="dependencies",t={})=>{if(process.env.CI||z&&!process.stdout?.isTTY){console.warn("Skipping package installation because the process is not interactive.");return}const o=u(e,"dependencies",{}),a=u(e,"devDependencies",{}),c=u(e,"peerDependencies",{}),g=[],i={deps:!0,devDeps:!0,peerDeps:!1,...t};for(const y of n)i.deps&&l(o,y)||i.devDeps&&l(a,y)||i.peerDeps&&l(c,y)||g.push(y);if(typeof i.confirm?.message=="function"&&(i.confirm.message=i.confirm.message(g)),i.confirm?.message===void 0){const y=`${g.length===1?"Package is":"Packages are"} required for this config: ${g.join(", ")}. Do you want to install them?`;i.confirm===void 0?i.confirm={message:y}:i.confirm.message=y}await T(i.confirm)&&await q.installPackage(g,{...i.installPackage,cwd:i.cwd?k.toPath(i.cwd):void 0,dev:r==="devDependencies"})},"ensurePackages");exports.ensurePackages=Z;exports.findPackageJson=G;exports.findPackageJsonSync=H;exports.getPackageJsonProperty=V;exports.hasPackageJsonAnyDependency=X;exports.hasPackageJsonProperty=W;exports.parsePackageJson=R;exports.writePackageJson=L;exports.writePackageJsonSync=Q;
|
package/dist/package-json.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
2
|
-
import '@antfu/install-pkg';
|
|
1
|
+
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.cjs';
|
|
3
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
4
4
|
import 'normalize-package-data';
|
package/dist/package-json.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
2
|
-
import '@antfu/install-pkg';
|
|
1
|
+
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.mjs';
|
|
3
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
4
4
|
import 'normalize-package-data';
|
package/dist/package-json.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-
|
|
2
|
-
import '@antfu/install-pkg';
|
|
1
|
+
export { N as NormalizedReadResult, e as ensurePackages, f as findPackageJson, a as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, b as hasPackageJsonProperty, p as parsePackageJson, w as writePackageJson, c as writePackageJsonSync } from './packem_shared/package-json-BJTpWpJd.d.mjs';
|
|
3
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
4
4
|
import 'normalize-package-data';
|
package/dist/package-json.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var A=Object.defineProperty;var
|
|
1
|
+
var A=Object.defineProperty;var c=(e,n)=>A(e,"name",{value:n,configurable:!0});import{existsSync as N}from"node:fs";import{installPackage as $}from"@antfu/install-pkg";import O from"@inquirer/confirm";import{findUp as T,readJson as _,findUpSync as C,readJsonSync as J,writeJson as K,writeJsonSync as F}from"@visulima/fs";import{NotFoundError as E}from"@visulima/fs/error";import{toPath as m,parseJson as U}from"@visulima/fs/utils";import{join as j}from"@visulima/path";import P from"normalize-package-data";var q=Object.defineProperty,f=c((e,n)=>q(e,"name",{value:n,configurable:!0}),"s");const p=f(e=>{const n=typeof e;return e!==null&&(n==="object"||n==="function")},"isObject"),M=f(e=>p(e)&&Object.keys(e).length===0,"isEmptyObject"),k=new Set(["__proto__","prototype","constructor"]),Y=new Set("0123456789");function l(e){const n=[];let r="",t="start",o=!1;for(const a of e)switch(a){case"\\":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");o&&(r+=a),t="property",o=!o;break}case".":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="property";break}if(o){o=!1,r+=a;break}if(k.has(r))return[];n.push(r),r="",t="property";break}case"[":{if(t==="index")throw new Error("Invalid character in an index");if(t==="indexEnd"){t="index";break}if(o){o=!1,r+=a;break}if(t==="property"){if(k.has(r))return[];n.push(r),r=""}t="index";break}case"]":{if(t==="index"){n.push(Number.parseInt(r,10)),r="",t="indexEnd";break}if(t==="indexEnd")throw new Error("Invalid character after an index")}default:{if(t==="index"&&!Y.has(a))throw new Error("Invalid character in an index");if(t==="indexEnd")throw new Error("Invalid character after an index");t==="start"&&(t="property"),o&&(o=!1,r+="\\"),r+=a}}switch(o&&(r+="\\"),t){case"property":{if(k.has(r))return[];n.push(r);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}c(l,"d");f(l,"getPathSegments");function w(e,n){if(typeof n!="number"&&Array.isArray(e)){const r=Number.parseInt(n,10);return Number.isInteger(r)&&e[r]===e[n]}return!1}c(w,"l");f(w,"isStringIndex");function b(e,n){if(w(e,n))throw new Error("Cannot use string index")}c(b,"p");f(b,"assertNotStringIndex");function u(e,n,r){if(!p(e)||typeof n!="string")return r===void 0?e:r;const t=l(n);if(t.length===0)return r;for(let o=0;o<t.length;o++){const a=t[o];if(w(e,a)?e=o===t.length-1?void 0:null:e=e[a],e==null){if(o!==t.length-1)return r;break}}return e===void 0?r:e}c(u,"getProperty");f(u,"getProperty");function z(e,n,r){if(!p(e)||typeof n!="string")return e;const t=e,o=l(n);for(let a=0;a<o.length;a++){const s=o[a];b(e,s),a===o.length-1?e[s]=r:p(e[s])||(e[s]=typeof o[a+1]=="number"?[]:{}),e=e[s]}return t}c(z,"setProperty");f(z,"setProperty");function B(e,n){if(!p(e)||typeof n!="string")return!1;const r=l(n);for(let t=0;t<r.length;t++){const o=r[t];if(b(e,o),t===r.length-1)return delete e[o],!0;if(e=e[o],!p(e))return!1}}c(B,"deleteProperty");f(B,"deleteProperty");function y(e,n){if(!p(e)||typeof n!="string")return!1;const r=l(n);if(r.length===0)return!1;for(const t of r){if(!p(e)||!(t in e)||w(e,t))return!1;e=e[t]}return!0}c(y,"hasProperty");f(y,"hasProperty");function I(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}c(I,"escapePath");f(I,"escapePath");function x(e){const n=Object.entries(e);return Array.isArray(e)?n.map(([r,t])=>[Number(r),t]):n}c(x,"h");f(x,"entries");function S(e){let n="";for(let[r,t]of x(e))typeof t=="number"?n+=`[${t}]`:(t=I(t),n+=r===0?t:`.${t}`);return n}c(S,"w");f(S,"stringifyPath");function*v(e,n=[]){if(!p(e)||M(e)){n.length>0&&(yield S(n));return}for(const[r,t]of x(e))yield*v(t,[...n,r])}c(v,"y$1");f(v,"deepKeysIterator");function G(e){return[...v(e)]}c(G,"deepKeys");f(G,"deepKeys");const H=typeof process.stdout<"u"&&!process.versions?.deno&&!globalThis.window;var L=Object.defineProperty,d=c((e,n)=>L(e,"name",{value:n,configurable:!0}),"r");const D=new Map,re=d(async(e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=await T("package.json",r);if(!t)throw new E("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:D;if(n.cache&&o.has(t))return o.get(t);const a=await _(t);P(a);const s={packageJson:a,path:t};return o.set(t,s),s},"findPackageJson"),oe=d((e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=C("package.json",r);if(!t)throw new E("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:D;if(n.cache&&o.has(t))return o.get(t);const a=J(t);P(a);const s={packageJson:a,path:t};return o.set(t,s),s},"findPackageJsonSync"),ae=d(async(e,n={})=>{const{cwd:r,...t}=n,o=m(n.cwd??process.cwd());await K(j(o,"package.json"),e,t)},"writePackageJson"),se=d((e,n={})=>{const{cwd:r,...t}=n,o=m(n.cwd??process.cwd());F(j(o,"package.json"),e,t)},"writePackageJsonSync"),ce=d(e=>{const n=e!==null&&typeof e=="object"&&!Array.isArray(e);if(!n&&typeof e!="string")throw new TypeError("`packageFile` should be either an `object` or a `string`.");const r=n?structuredClone(e):N(e)?J(e):U(e);return P(r),r},"parsePackageJson"),ie=d((e,n,r)=>u(e,n,r),"getPackageJsonProperty"),fe=d((e,n)=>y(e,n),"hasPackageJsonProperty"),pe=d((e,n,r)=>{const t=u(e,"dependencies",{}),o=u(e,"devDependencies",{}),a=u(e,"peerDependencies",{}),s={...t,...o,...r?.peerDeps===!1?{}:a};for(const g of n)if(y(s,g))return!0;return!1},"hasPackageJsonAnyDependency"),de=d(async(e,n,r="dependencies",t={})=>{if(process.env.CI||H&&!process.stdout?.isTTY){console.warn("Skipping package installation because the process is not interactive.");return}const o=u(e,"dependencies",{}),a=u(e,"devDependencies",{}),s=u(e,"peerDependencies",{}),g=[],i={deps:!0,devDeps:!0,peerDeps:!1,...t};for(const h of n)i.deps&&y(o,h)||i.devDeps&&y(a,h)||i.peerDeps&&y(s,h)||g.push(h);if(typeof i.confirm?.message=="function"&&(i.confirm.message=i.confirm.message(g)),i.confirm?.message===void 0){const h=`${g.length===1?"Package is":"Packages are"} required for this config: ${g.join(", ")}. Do you want to install them?`;i.confirm===void 0?i.confirm={message:h}:i.confirm.message=h}await O(i.confirm)&&await $(g,{...i.installPackage,cwd:i.cwd?m(i.cwd):void 0,dev:r==="devDependencies"})},"ensurePackages");export{de as ensurePackages,re as findPackageJson,oe as findPackageJsonSync,ie as getPackageJsonProperty,pe as hasPackageJsonAnyDependency,fe as hasPackageJsonProperty,ce as parsePackageJson,ae as writePackageJson,se as writePackageJsonSync};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
3
3
|
import { Package } from 'normalize-package-data';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1832,6 +1832,19 @@ type Theme<Extension extends object = object> = Prettify<Extension & DefaultThem
|
|
|
1832
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1833
1833
|
type PackageJson = PackageJson$1;
|
|
1834
1834
|
type Cache<T = any> = Map<string, T>;
|
|
1835
|
+
type EnsurePackagesOptions = {
|
|
1836
|
+
confirm?: {
|
|
1837
|
+
default?: boolean;
|
|
1838
|
+
message: string | ((packages: string[]) => string);
|
|
1839
|
+
theme?: PartialDeep<Theme>;
|
|
1840
|
+
transformer?: (value: boolean) => string;
|
|
1841
|
+
};
|
|
1842
|
+
cwd?: URL | string;
|
|
1843
|
+
deps?: boolean;
|
|
1844
|
+
devDeps?: boolean;
|
|
1845
|
+
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1846
|
+
peerDeps?: boolean;
|
|
1847
|
+
};
|
|
1835
1848
|
|
|
1836
1849
|
type ReadOptions = {
|
|
1837
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1854,18 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1854
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1855
1868
|
peerDeps?: boolean;
|
|
1856
1869
|
}) => boolean;
|
|
1857
|
-
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?:
|
|
1858
|
-
confirm?: {
|
|
1859
|
-
default?: boolean;
|
|
1860
|
-
message: string;
|
|
1861
|
-
theme?: PartialDeep<Theme>;
|
|
1862
|
-
transformer?: (value: boolean) => string;
|
|
1863
|
-
};
|
|
1864
|
-
cwd?: URL | string;
|
|
1865
|
-
deps?: boolean;
|
|
1866
|
-
devDeps?: boolean;
|
|
1867
|
-
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1868
|
-
peerDeps?: boolean;
|
|
1869
|
-
}) => Promise<void>;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1870
1871
|
|
|
1871
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
|
1872
|
+
export { type EnsurePackagesOptions as E, type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
3
3
|
import { Package } from 'normalize-package-data';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1832,6 +1832,19 @@ type Theme<Extension extends object = object> = Prettify<Extension & DefaultThem
|
|
|
1832
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1833
1833
|
type PackageJson = PackageJson$1;
|
|
1834
1834
|
type Cache<T = any> = Map<string, T>;
|
|
1835
|
+
type EnsurePackagesOptions = {
|
|
1836
|
+
confirm?: {
|
|
1837
|
+
default?: boolean;
|
|
1838
|
+
message: string | ((packages: string[]) => string);
|
|
1839
|
+
theme?: PartialDeep<Theme>;
|
|
1840
|
+
transformer?: (value: boolean) => string;
|
|
1841
|
+
};
|
|
1842
|
+
cwd?: URL | string;
|
|
1843
|
+
deps?: boolean;
|
|
1844
|
+
devDeps?: boolean;
|
|
1845
|
+
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1846
|
+
peerDeps?: boolean;
|
|
1847
|
+
};
|
|
1835
1848
|
|
|
1836
1849
|
type ReadOptions = {
|
|
1837
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1854,18 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1854
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1855
1868
|
peerDeps?: boolean;
|
|
1856
1869
|
}) => boolean;
|
|
1857
|
-
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?:
|
|
1858
|
-
confirm?: {
|
|
1859
|
-
default?: boolean;
|
|
1860
|
-
message: string;
|
|
1861
|
-
theme?: PartialDeep<Theme>;
|
|
1862
|
-
transformer?: (value: boolean) => string;
|
|
1863
|
-
};
|
|
1864
|
-
cwd?: URL | string;
|
|
1865
|
-
deps?: boolean;
|
|
1866
|
-
devDeps?: boolean;
|
|
1867
|
-
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1868
|
-
peerDeps?: boolean;
|
|
1869
|
-
}) => Promise<void>;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1870
1871
|
|
|
1871
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
|
1872
|
+
export { type EnsurePackagesOptions as E, type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
3
3
|
import { Package } from 'normalize-package-data';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1832,6 +1832,19 @@ type Theme<Extension extends object = object> = Prettify<Extension & DefaultThem
|
|
|
1832
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1833
1833
|
type PackageJson = PackageJson$1;
|
|
1834
1834
|
type Cache<T = any> = Map<string, T>;
|
|
1835
|
+
type EnsurePackagesOptions = {
|
|
1836
|
+
confirm?: {
|
|
1837
|
+
default?: boolean;
|
|
1838
|
+
message: string | ((packages: string[]) => string);
|
|
1839
|
+
theme?: PartialDeep<Theme>;
|
|
1840
|
+
transformer?: (value: boolean) => string;
|
|
1841
|
+
};
|
|
1842
|
+
cwd?: URL | string;
|
|
1843
|
+
deps?: boolean;
|
|
1844
|
+
devDeps?: boolean;
|
|
1845
|
+
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1846
|
+
peerDeps?: boolean;
|
|
1847
|
+
};
|
|
1835
1848
|
|
|
1836
1849
|
type ReadOptions = {
|
|
1837
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1854,18 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1854
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1855
1868
|
peerDeps?: boolean;
|
|
1856
1869
|
}) => boolean;
|
|
1857
|
-
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?:
|
|
1858
|
-
confirm?: {
|
|
1859
|
-
default?: boolean;
|
|
1860
|
-
message: string;
|
|
1861
|
-
theme?: PartialDeep<Theme>;
|
|
1862
|
-
transformer?: (value: boolean) => string;
|
|
1863
|
-
};
|
|
1864
|
-
cwd?: URL | string;
|
|
1865
|
-
deps?: boolean;
|
|
1866
|
-
devDeps?: boolean;
|
|
1867
|
-
installPackage?: Omit<InstallPackageOptions, "cwd" | "dev">;
|
|
1868
|
-
peerDeps?: boolean;
|
|
1869
|
-
}) => Promise<void>;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1870
1871
|
|
|
1871
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
|
1872
|
+
export { type EnsurePackagesOptions as E, type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, ensurePackages as e, findPackageJson as f, getPackageJsonProperty as g, hasPackageJsonAnyDependency as h, parsePackageJson as p, writePackageJson as w };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/package",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "One Package to rule them all, finds your root-dir, monorepo, or package manager.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
"LICENSE.md"
|
|
146
146
|
],
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@visulima/fs": "2.3.
|
|
149
|
-
"@visulima/path": "1.
|
|
148
|
+
"@visulima/fs": "2.3.4",
|
|
149
|
+
"@visulima/path": "1.3.0",
|
|
150
150
|
"normalize-package-data": "^7.0.0",
|
|
151
151
|
"@inquirer/confirm": "^5.1.1",
|
|
152
152
|
"@antfu/install-pkg": "^0.5.0"
|