@visulima/package 3.2.2 → 3.4.0
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 +12 -0
- package/LICENSE.md +61 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/package-json.cjs +1 -1
- package/dist/package-json.d.cts +2 -1
- package/dist/package-json.d.mts +2 -1
- package/dist/package-json.d.ts +2 -1
- package/dist/package-json.mjs +1 -1
- package/dist/packem_shared/{package-json-CpSz2EtJ.d.cts → package-json-BJTpWpJd.d.cts} +176 -1
- package/dist/packem_shared/{package-json-CpSz2EtJ.d.mjs → package-json-BJTpWpJd.d.mjs} +176 -1
- package/dist/packem_shared/{package-json-CpSz2EtJ.d.mts → package-json-BJTpWpJd.d.mts} +176 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## @visulima/package [3.4.0](https://github.com/visulima/visulima/compare/@visulima/package@3.3.0...@visulima/package@3.4.0) (2025-01-03)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **package:** ensurePackages confirm message key support now a function call ([aa8d64c](https://github.com/visulima/visulima/commit/aa8d64c72103d13996f922ec7aa4de74dafe0f1d))
|
|
6
|
+
|
|
7
|
+
## @visulima/package [3.3.0](https://github.com/visulima/visulima/compare/@visulima/package@3.2.2...@visulima/package@3.3.0) (2025-01-02)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* added new ensurePackages function to install missing packages ([20c05c0](https://github.com/visulima/visulima/commit/20c05c02e32b7c601f42e46bb2d49fe5db87e117))
|
|
12
|
+
|
|
1
13
|
## @visulima/package [3.2.2](https://github.com/visulima/visulima/compare/@visulima/package@3.2.1...@visulima/package@3.2.2) (2024-12-31)
|
|
2
14
|
|
|
3
15
|
|
package/LICENSE.md
CHANGED
|
@@ -48,9 +48,69 @@ Repository: sindresorhus/dot-prop
|
|
|
48
48
|
|
|
49
49
|
# Licenses of bundled types
|
|
50
50
|
The published @visulima/package artifact additionally contains code with the following licenses:
|
|
51
|
-
(MIT OR CC0-1.0)
|
|
51
|
+
MIT, (MIT OR CC0-1.0)
|
|
52
52
|
|
|
53
53
|
# Bundled types:
|
|
54
|
+
## @inquirer/core
|
|
55
|
+
License: MIT
|
|
56
|
+
By: Simon Boudrias
|
|
57
|
+
Repository: https://github.com/SBoudrias/Inquirer.js.git
|
|
58
|
+
|
|
59
|
+
> Copyright (c) 2023 Simon Boudrias
|
|
60
|
+
>
|
|
61
|
+
> Permission is hereby granted, free of charge, to any person
|
|
62
|
+
> obtaining a copy of this software and associated documentation
|
|
63
|
+
> files (the "Software"), to deal in the Software without
|
|
64
|
+
> restriction, including without limitation the rights to use,
|
|
65
|
+
> copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
66
|
+
> copies of the Software, and to permit persons to whom the
|
|
67
|
+
> Software is furnished to do so, subject to the following
|
|
68
|
+
> conditions:
|
|
69
|
+
>
|
|
70
|
+
> The above copyright notice and this permission notice shall be
|
|
71
|
+
> included in all copies or substantial portions of the Software.
|
|
72
|
+
>
|
|
73
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
74
|
+
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
75
|
+
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
76
|
+
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
77
|
+
> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
78
|
+
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
79
|
+
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
80
|
+
> OTHER DEALINGS IN THE SOFTWARE.
|
|
81
|
+
|
|
82
|
+
---------------------------------------
|
|
83
|
+
|
|
84
|
+
## @inquirer/type
|
|
85
|
+
License: MIT
|
|
86
|
+
By: Simon Boudrias
|
|
87
|
+
Repository: https://github.com/SBoudrias/Inquirer.js.git
|
|
88
|
+
|
|
89
|
+
> Copyright (c) 2023 Simon Boudrias
|
|
90
|
+
>
|
|
91
|
+
> Permission is hereby granted, free of charge, to any person
|
|
92
|
+
> obtaining a copy of this software and associated documentation
|
|
93
|
+
> files (the "Software"), to deal in the Software without
|
|
94
|
+
> restriction, including without limitation the rights to use,
|
|
95
|
+
> copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
96
|
+
> copies of the Software, and to permit persons to whom the
|
|
97
|
+
> Software is furnished to do so, subject to the following
|
|
98
|
+
> conditions:
|
|
99
|
+
>
|
|
100
|
+
> The above copyright notice and this permission notice shall be
|
|
101
|
+
> included in all copies or substantial portions of the Software.
|
|
102
|
+
>
|
|
103
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
104
|
+
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
105
|
+
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
106
|
+
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
107
|
+
> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
108
|
+
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
109
|
+
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
110
|
+
> OTHER DEALINGS IN THE SOFTWARE.
|
|
111
|
+
|
|
112
|
+
---------------------------------------
|
|
113
|
+
|
|
54
114
|
## type-fest
|
|
55
115
|
License: (MIT OR CC0-1.0)
|
|
56
116
|
By: Sindre Sorhus
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./packem_shared/PackageNotFoundError-CY57YCot.cjs"),n=require("./monorepo.cjs"),o=require("./package.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./packem_shared/PackageNotFoundError-CY57YCot.cjs"),n=require("./monorepo.cjs"),o=require("./package.cjs"),e=require("./package-json.cjs"),a=require("./package-manager.cjs");exports.PackageNotFoundError=g;exports.findMonorepoRoot=n.findMonorepoRoot;exports.findMonorepoRootSync=n.findMonorepoRootSync;exports.findPackageRoot=o.findPackageRoot;exports.findPackageRootSync=o.findPackageRootSync;exports.ensurePackages=e.ensurePackages;exports.findPackageJson=e.findPackageJson;exports.findPackageJsonSync=e.findPackageJsonSync;exports.getPackageJsonProperty=e.getPackageJsonProperty;exports.hasPackageJsonAnyDependency=e.hasPackageJsonAnyDependency;exports.hasPackageJsonProperty=e.hasPackageJsonProperty;exports.parsePackageJson=e.parsePackageJson;exports.writePackageJson=e.writePackageJson;exports.writePackageJsonSync=e.writePackageJsonSync;exports.findLockFile=a.findLockFile;exports.findLockFileSync=a.findLockFileSync;exports.findPackageManager=a.findPackageManager;exports.findPackageManagerSync=a.findPackageManagerSync;exports.generateMissingPackagesInstallMessage=a.generateMissingPackagesInstallMessage;exports.getPackageManagerVersion=a.getPackageManagerVersion;exports.identifyInitiatingPackageManager=a.identifyInitiatingPackageManager;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +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, 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
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
7
8
|
import 'normalize-package-data';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +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, 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
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
7
8
|
import 'normalize-package-data';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +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, 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
6
|
import '@visulima/fs';
|
|
7
|
+
import '@antfu/install-pkg';
|
|
7
8
|
import 'normalize-package-data';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as n}from"./packem_shared/PackageNotFoundError-4CX3Vfcu.mjs";import{findMonorepoRoot as r,findMonorepoRootSync as g}from"./monorepo.mjs";import{findPackageRoot as i,findPackageRootSync as t}from"./package.mjs";import{
|
|
1
|
+
import{default as n}from"./packem_shared/PackageNotFoundError-4CX3Vfcu.mjs";import{findMonorepoRoot as r,findMonorepoRootSync as g}from"./monorepo.mjs";import{findPackageRoot as i,findPackageRootSync as t}from"./package.mjs";import{ensurePackages as k,findPackageJson as P,findPackageJsonSync as f,getPackageJsonProperty as d,hasPackageJsonAnyDependency as p,hasPackageJsonProperty as y,parsePackageJson as J,writePackageJson as M,writePackageJsonSync as S}from"./package-json.mjs";import{findLockFile as m,findLockFileSync as x,findPackageManager as R,findPackageManagerSync as u,generateMissingPackagesInstallMessage as F,getPackageManagerVersion as h,identifyInitiatingPackageManager as w}from"./package-manager.mjs";export{n as PackageNotFoundError,k as ensurePackages,m as findLockFile,x as findLockFileSync,r as findMonorepoRoot,g as findMonorepoRootSync,P as findPackageJson,f as findPackageJsonSync,R as findPackageManager,u as findPackageManagerSync,i as findPackageRoot,t as findPackageRootSync,F as generateMissingPackagesInstallMessage,d as getPackageJsonProperty,h as getPackageManagerVersion,p as hasPackageJsonAnyDependency,y as hasPackageJsonProperty,w as identifyInitiatingPackageManager,J as parsePackageJson,M as writePackageJson,S as writePackageJsonSync};
|
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,3 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, 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-
|
|
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';
|
|
2
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
3
4
|
import 'normalize-package-data';
|
package/dist/package-json.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, 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-
|
|
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';
|
|
2
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
3
4
|
import 'normalize-package-data';
|
package/dist/package-json.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { N as NormalizedReadResult, 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-
|
|
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';
|
|
2
2
|
import '@visulima/fs';
|
|
3
|
+
import '@antfu/install-pkg';
|
|
3
4
|
import 'normalize-package-data';
|
package/dist/package-json.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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,4 +1,5 @@
|
|
|
1
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
3
|
import { Package } from 'normalize-package-data';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1668,9 +1669,182 @@ PackageJson$1.TypeScriptConfiguration &
|
|
|
1668
1669
|
PackageJson$1.YarnConfiguration &
|
|
1669
1670
|
PackageJson$1.JSPMConfiguration;
|
|
1670
1671
|
|
|
1672
|
+
type Prettify<T> = {
|
|
1673
|
+
[K in keyof T]: T[K];
|
|
1674
|
+
} & {};
|
|
1675
|
+
type PartialDeep<T> = T extends object ? {
|
|
1676
|
+
[P in keyof T]?: PartialDeep<T[P]>;
|
|
1677
|
+
} : T;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Union type representing the possible statuses of a prompt.
|
|
1681
|
+
*
|
|
1682
|
+
* - `'loading'`: The prompt is currently loading.
|
|
1683
|
+
* - `'idle'`: The prompt is loaded and currently waiting for the user to
|
|
1684
|
+
* submit an answer.
|
|
1685
|
+
* - `'done'`: The user has submitted an answer and the prompt is finished.
|
|
1686
|
+
* - `string`: Any other string: The prompt is in a custom state.
|
|
1687
|
+
*/
|
|
1688
|
+
type Status = 'loading' | 'idle' | 'done' | (string & {});
|
|
1689
|
+
type DefaultTheme = {
|
|
1690
|
+
/**
|
|
1691
|
+
* Prefix to prepend to the message. If a function is provided, it will be
|
|
1692
|
+
* called with the current status of the prompt, and the return value will be
|
|
1693
|
+
* used as the prefix.
|
|
1694
|
+
*
|
|
1695
|
+
* @remarks
|
|
1696
|
+
* If `status === 'loading'`, this property is ignored and the spinner (styled
|
|
1697
|
+
* by the `spinner` property) will be displayed instead.
|
|
1698
|
+
*
|
|
1699
|
+
* @defaultValue
|
|
1700
|
+
* ```ts
|
|
1701
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1702
|
+
* (status) => status === 'done' ? colors.green('✔') : colors.blue('?')
|
|
1703
|
+
* ```
|
|
1704
|
+
*/
|
|
1705
|
+
prefix: string | Prettify<Omit<Record<Status, string>, 'loading'>>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Configuration for the spinner that is displayed when the prompt is in the
|
|
1708
|
+
* `'loading'` state.
|
|
1709
|
+
*
|
|
1710
|
+
* We recommend the use of {@link https://github.com/sindresorhus/cli-spinners|cli-spinners} for a list of available spinners.
|
|
1711
|
+
*/
|
|
1712
|
+
spinner: {
|
|
1713
|
+
/**
|
|
1714
|
+
* The time interval between frames, in milliseconds.
|
|
1715
|
+
*
|
|
1716
|
+
* @defaultValue
|
|
1717
|
+
* ```ts
|
|
1718
|
+
* 80
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
interval: number;
|
|
1722
|
+
/**
|
|
1723
|
+
* A list of frames to show for the spinner.
|
|
1724
|
+
*
|
|
1725
|
+
* @defaultValue
|
|
1726
|
+
* ```ts
|
|
1727
|
+
* ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
1728
|
+
* ```
|
|
1729
|
+
*/
|
|
1730
|
+
frames: string[];
|
|
1731
|
+
};
|
|
1732
|
+
/**
|
|
1733
|
+
* Object containing functions to style different parts of the prompt.
|
|
1734
|
+
*/
|
|
1735
|
+
style: {
|
|
1736
|
+
/**
|
|
1737
|
+
* Style to apply to the user's answer once it has been submitted.
|
|
1738
|
+
*
|
|
1739
|
+
* @param text - The user's answer.
|
|
1740
|
+
* @returns The styled answer.
|
|
1741
|
+
*
|
|
1742
|
+
* @defaultValue
|
|
1743
|
+
* ```ts
|
|
1744
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1745
|
+
* (text) => colors.cyan(text)
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
answer: (text: string) => string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Style to apply to the message displayed to the user.
|
|
1751
|
+
*
|
|
1752
|
+
* @param text - The message to style.
|
|
1753
|
+
* @param status - The current status of the prompt.
|
|
1754
|
+
* @returns The styled message.
|
|
1755
|
+
*
|
|
1756
|
+
* @defaultValue
|
|
1757
|
+
* ```ts
|
|
1758
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1759
|
+
* (text, status) => colors.bold(text)
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
message: (text: string, status: Status) => string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Style to apply to error messages.
|
|
1765
|
+
*
|
|
1766
|
+
* @param text - The error message.
|
|
1767
|
+
* @returns The styled error message.
|
|
1768
|
+
*
|
|
1769
|
+
* @defaultValue
|
|
1770
|
+
* ```ts
|
|
1771
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1772
|
+
* (text) => colors.red(`> ${text}`)
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
error: (text: string) => string;
|
|
1776
|
+
/**
|
|
1777
|
+
* Style to apply to the default answer when one is provided.
|
|
1778
|
+
*
|
|
1779
|
+
* @param text - The default answer.
|
|
1780
|
+
* @returns The styled default answer.
|
|
1781
|
+
*
|
|
1782
|
+
* @defaultValue
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1785
|
+
* (text) => colors.dim(`(${text})`)
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
defaultAnswer: (text: string) => string;
|
|
1789
|
+
/**
|
|
1790
|
+
* Style to apply to help text.
|
|
1791
|
+
*
|
|
1792
|
+
* @param text - The help text.
|
|
1793
|
+
* @returns The styled help text.
|
|
1794
|
+
*
|
|
1795
|
+
* @defaultValue
|
|
1796
|
+
* ```ts
|
|
1797
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1798
|
+
* (text) => colors.dim(text)
|
|
1799
|
+
* ```
|
|
1800
|
+
*/
|
|
1801
|
+
help: (text: string) => string;
|
|
1802
|
+
/**
|
|
1803
|
+
* Style to apply to highlighted text.
|
|
1804
|
+
*
|
|
1805
|
+
* @param text - The text to highlight.
|
|
1806
|
+
* @returns The highlighted text.
|
|
1807
|
+
*
|
|
1808
|
+
* @defaultValue
|
|
1809
|
+
* ```ts
|
|
1810
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1811
|
+
* (text) => colors.cyan(text)
|
|
1812
|
+
* ```
|
|
1813
|
+
*/
|
|
1814
|
+
highlight: (text: string) => string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Style to apply to keyboard keys referred to in help texts.
|
|
1817
|
+
*
|
|
1818
|
+
* @param text - The key to style.
|
|
1819
|
+
* @returns The styled key.
|
|
1820
|
+
*
|
|
1821
|
+
* @defaultValue
|
|
1822
|
+
* ```ts
|
|
1823
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1824
|
+
* (text) => colors.cyan(colors.bold(`<${text}>`))
|
|
1825
|
+
* ```
|
|
1826
|
+
*/
|
|
1827
|
+
key: (text: string) => string;
|
|
1828
|
+
};
|
|
1829
|
+
};
|
|
1830
|
+
type Theme<Extension extends object = object> = Prettify<Extension & DefaultTheme>;
|
|
1831
|
+
|
|
1671
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1672
1833
|
type PackageJson = PackageJson$1;
|
|
1673
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
|
+
};
|
|
1674
1848
|
|
|
1675
1849
|
type ReadOptions = {
|
|
1676
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1693,5 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1693
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1694
1868
|
peerDeps?: boolean;
|
|
1695
1869
|
}) => boolean;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1696
1871
|
|
|
1697
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, 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,4 +1,5 @@
|
|
|
1
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
3
|
import { Package } from 'normalize-package-data';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1668,9 +1669,182 @@ PackageJson$1.TypeScriptConfiguration &
|
|
|
1668
1669
|
PackageJson$1.YarnConfiguration &
|
|
1669
1670
|
PackageJson$1.JSPMConfiguration;
|
|
1670
1671
|
|
|
1672
|
+
type Prettify<T> = {
|
|
1673
|
+
[K in keyof T]: T[K];
|
|
1674
|
+
} & {};
|
|
1675
|
+
type PartialDeep<T> = T extends object ? {
|
|
1676
|
+
[P in keyof T]?: PartialDeep<T[P]>;
|
|
1677
|
+
} : T;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Union type representing the possible statuses of a prompt.
|
|
1681
|
+
*
|
|
1682
|
+
* - `'loading'`: The prompt is currently loading.
|
|
1683
|
+
* - `'idle'`: The prompt is loaded and currently waiting for the user to
|
|
1684
|
+
* submit an answer.
|
|
1685
|
+
* - `'done'`: The user has submitted an answer and the prompt is finished.
|
|
1686
|
+
* - `string`: Any other string: The prompt is in a custom state.
|
|
1687
|
+
*/
|
|
1688
|
+
type Status = 'loading' | 'idle' | 'done' | (string & {});
|
|
1689
|
+
type DefaultTheme = {
|
|
1690
|
+
/**
|
|
1691
|
+
* Prefix to prepend to the message. If a function is provided, it will be
|
|
1692
|
+
* called with the current status of the prompt, and the return value will be
|
|
1693
|
+
* used as the prefix.
|
|
1694
|
+
*
|
|
1695
|
+
* @remarks
|
|
1696
|
+
* If `status === 'loading'`, this property is ignored and the spinner (styled
|
|
1697
|
+
* by the `spinner` property) will be displayed instead.
|
|
1698
|
+
*
|
|
1699
|
+
* @defaultValue
|
|
1700
|
+
* ```ts
|
|
1701
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1702
|
+
* (status) => status === 'done' ? colors.green('✔') : colors.blue('?')
|
|
1703
|
+
* ```
|
|
1704
|
+
*/
|
|
1705
|
+
prefix: string | Prettify<Omit<Record<Status, string>, 'loading'>>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Configuration for the spinner that is displayed when the prompt is in the
|
|
1708
|
+
* `'loading'` state.
|
|
1709
|
+
*
|
|
1710
|
+
* We recommend the use of {@link https://github.com/sindresorhus/cli-spinners|cli-spinners} for a list of available spinners.
|
|
1711
|
+
*/
|
|
1712
|
+
spinner: {
|
|
1713
|
+
/**
|
|
1714
|
+
* The time interval between frames, in milliseconds.
|
|
1715
|
+
*
|
|
1716
|
+
* @defaultValue
|
|
1717
|
+
* ```ts
|
|
1718
|
+
* 80
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
interval: number;
|
|
1722
|
+
/**
|
|
1723
|
+
* A list of frames to show for the spinner.
|
|
1724
|
+
*
|
|
1725
|
+
* @defaultValue
|
|
1726
|
+
* ```ts
|
|
1727
|
+
* ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
1728
|
+
* ```
|
|
1729
|
+
*/
|
|
1730
|
+
frames: string[];
|
|
1731
|
+
};
|
|
1732
|
+
/**
|
|
1733
|
+
* Object containing functions to style different parts of the prompt.
|
|
1734
|
+
*/
|
|
1735
|
+
style: {
|
|
1736
|
+
/**
|
|
1737
|
+
* Style to apply to the user's answer once it has been submitted.
|
|
1738
|
+
*
|
|
1739
|
+
* @param text - The user's answer.
|
|
1740
|
+
* @returns The styled answer.
|
|
1741
|
+
*
|
|
1742
|
+
* @defaultValue
|
|
1743
|
+
* ```ts
|
|
1744
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1745
|
+
* (text) => colors.cyan(text)
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
answer: (text: string) => string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Style to apply to the message displayed to the user.
|
|
1751
|
+
*
|
|
1752
|
+
* @param text - The message to style.
|
|
1753
|
+
* @param status - The current status of the prompt.
|
|
1754
|
+
* @returns The styled message.
|
|
1755
|
+
*
|
|
1756
|
+
* @defaultValue
|
|
1757
|
+
* ```ts
|
|
1758
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1759
|
+
* (text, status) => colors.bold(text)
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
message: (text: string, status: Status) => string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Style to apply to error messages.
|
|
1765
|
+
*
|
|
1766
|
+
* @param text - The error message.
|
|
1767
|
+
* @returns The styled error message.
|
|
1768
|
+
*
|
|
1769
|
+
* @defaultValue
|
|
1770
|
+
* ```ts
|
|
1771
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1772
|
+
* (text) => colors.red(`> ${text}`)
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
error: (text: string) => string;
|
|
1776
|
+
/**
|
|
1777
|
+
* Style to apply to the default answer when one is provided.
|
|
1778
|
+
*
|
|
1779
|
+
* @param text - The default answer.
|
|
1780
|
+
* @returns The styled default answer.
|
|
1781
|
+
*
|
|
1782
|
+
* @defaultValue
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1785
|
+
* (text) => colors.dim(`(${text})`)
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
defaultAnswer: (text: string) => string;
|
|
1789
|
+
/**
|
|
1790
|
+
* Style to apply to help text.
|
|
1791
|
+
*
|
|
1792
|
+
* @param text - The help text.
|
|
1793
|
+
* @returns The styled help text.
|
|
1794
|
+
*
|
|
1795
|
+
* @defaultValue
|
|
1796
|
+
* ```ts
|
|
1797
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1798
|
+
* (text) => colors.dim(text)
|
|
1799
|
+
* ```
|
|
1800
|
+
*/
|
|
1801
|
+
help: (text: string) => string;
|
|
1802
|
+
/**
|
|
1803
|
+
* Style to apply to highlighted text.
|
|
1804
|
+
*
|
|
1805
|
+
* @param text - The text to highlight.
|
|
1806
|
+
* @returns The highlighted text.
|
|
1807
|
+
*
|
|
1808
|
+
* @defaultValue
|
|
1809
|
+
* ```ts
|
|
1810
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1811
|
+
* (text) => colors.cyan(text)
|
|
1812
|
+
* ```
|
|
1813
|
+
*/
|
|
1814
|
+
highlight: (text: string) => string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Style to apply to keyboard keys referred to in help texts.
|
|
1817
|
+
*
|
|
1818
|
+
* @param text - The key to style.
|
|
1819
|
+
* @returns The styled key.
|
|
1820
|
+
*
|
|
1821
|
+
* @defaultValue
|
|
1822
|
+
* ```ts
|
|
1823
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1824
|
+
* (text) => colors.cyan(colors.bold(`<${text}>`))
|
|
1825
|
+
* ```
|
|
1826
|
+
*/
|
|
1827
|
+
key: (text: string) => string;
|
|
1828
|
+
};
|
|
1829
|
+
};
|
|
1830
|
+
type Theme<Extension extends object = object> = Prettify<Extension & DefaultTheme>;
|
|
1831
|
+
|
|
1671
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1672
1833
|
type PackageJson = PackageJson$1;
|
|
1673
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
|
+
};
|
|
1674
1848
|
|
|
1675
1849
|
type ReadOptions = {
|
|
1676
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1693,5 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1693
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1694
1868
|
peerDeps?: boolean;
|
|
1695
1869
|
}) => boolean;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1696
1871
|
|
|
1697
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, 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,4 +1,5 @@
|
|
|
1
1
|
import { WriteJsonOptions } from '@visulima/fs';
|
|
2
|
+
import { InstallPackageOptions } from '@antfu/install-pkg';
|
|
2
3
|
import { Package } from 'normalize-package-data';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -1668,9 +1669,182 @@ PackageJson$1.TypeScriptConfiguration &
|
|
|
1668
1669
|
PackageJson$1.YarnConfiguration &
|
|
1669
1670
|
PackageJson$1.JSPMConfiguration;
|
|
1670
1671
|
|
|
1672
|
+
type Prettify<T> = {
|
|
1673
|
+
[K in keyof T]: T[K];
|
|
1674
|
+
} & {};
|
|
1675
|
+
type PartialDeep<T> = T extends object ? {
|
|
1676
|
+
[P in keyof T]?: PartialDeep<T[P]>;
|
|
1677
|
+
} : T;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Union type representing the possible statuses of a prompt.
|
|
1681
|
+
*
|
|
1682
|
+
* - `'loading'`: The prompt is currently loading.
|
|
1683
|
+
* - `'idle'`: The prompt is loaded and currently waiting for the user to
|
|
1684
|
+
* submit an answer.
|
|
1685
|
+
* - `'done'`: The user has submitted an answer and the prompt is finished.
|
|
1686
|
+
* - `string`: Any other string: The prompt is in a custom state.
|
|
1687
|
+
*/
|
|
1688
|
+
type Status = 'loading' | 'idle' | 'done' | (string & {});
|
|
1689
|
+
type DefaultTheme = {
|
|
1690
|
+
/**
|
|
1691
|
+
* Prefix to prepend to the message. If a function is provided, it will be
|
|
1692
|
+
* called with the current status of the prompt, and the return value will be
|
|
1693
|
+
* used as the prefix.
|
|
1694
|
+
*
|
|
1695
|
+
* @remarks
|
|
1696
|
+
* If `status === 'loading'`, this property is ignored and the spinner (styled
|
|
1697
|
+
* by the `spinner` property) will be displayed instead.
|
|
1698
|
+
*
|
|
1699
|
+
* @defaultValue
|
|
1700
|
+
* ```ts
|
|
1701
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1702
|
+
* (status) => status === 'done' ? colors.green('✔') : colors.blue('?')
|
|
1703
|
+
* ```
|
|
1704
|
+
*/
|
|
1705
|
+
prefix: string | Prettify<Omit<Record<Status, string>, 'loading'>>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Configuration for the spinner that is displayed when the prompt is in the
|
|
1708
|
+
* `'loading'` state.
|
|
1709
|
+
*
|
|
1710
|
+
* We recommend the use of {@link https://github.com/sindresorhus/cli-spinners|cli-spinners} for a list of available spinners.
|
|
1711
|
+
*/
|
|
1712
|
+
spinner: {
|
|
1713
|
+
/**
|
|
1714
|
+
* The time interval between frames, in milliseconds.
|
|
1715
|
+
*
|
|
1716
|
+
* @defaultValue
|
|
1717
|
+
* ```ts
|
|
1718
|
+
* 80
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
interval: number;
|
|
1722
|
+
/**
|
|
1723
|
+
* A list of frames to show for the spinner.
|
|
1724
|
+
*
|
|
1725
|
+
* @defaultValue
|
|
1726
|
+
* ```ts
|
|
1727
|
+
* ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
|
|
1728
|
+
* ```
|
|
1729
|
+
*/
|
|
1730
|
+
frames: string[];
|
|
1731
|
+
};
|
|
1732
|
+
/**
|
|
1733
|
+
* Object containing functions to style different parts of the prompt.
|
|
1734
|
+
*/
|
|
1735
|
+
style: {
|
|
1736
|
+
/**
|
|
1737
|
+
* Style to apply to the user's answer once it has been submitted.
|
|
1738
|
+
*
|
|
1739
|
+
* @param text - The user's answer.
|
|
1740
|
+
* @returns The styled answer.
|
|
1741
|
+
*
|
|
1742
|
+
* @defaultValue
|
|
1743
|
+
* ```ts
|
|
1744
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1745
|
+
* (text) => colors.cyan(text)
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
answer: (text: string) => string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Style to apply to the message displayed to the user.
|
|
1751
|
+
*
|
|
1752
|
+
* @param text - The message to style.
|
|
1753
|
+
* @param status - The current status of the prompt.
|
|
1754
|
+
* @returns The styled message.
|
|
1755
|
+
*
|
|
1756
|
+
* @defaultValue
|
|
1757
|
+
* ```ts
|
|
1758
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1759
|
+
* (text, status) => colors.bold(text)
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
message: (text: string, status: Status) => string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Style to apply to error messages.
|
|
1765
|
+
*
|
|
1766
|
+
* @param text - The error message.
|
|
1767
|
+
* @returns The styled error message.
|
|
1768
|
+
*
|
|
1769
|
+
* @defaultValue
|
|
1770
|
+
* ```ts
|
|
1771
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1772
|
+
* (text) => colors.red(`> ${text}`)
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
error: (text: string) => string;
|
|
1776
|
+
/**
|
|
1777
|
+
* Style to apply to the default answer when one is provided.
|
|
1778
|
+
*
|
|
1779
|
+
* @param text - The default answer.
|
|
1780
|
+
* @returns The styled default answer.
|
|
1781
|
+
*
|
|
1782
|
+
* @defaultValue
|
|
1783
|
+
* ```ts
|
|
1784
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1785
|
+
* (text) => colors.dim(`(${text})`)
|
|
1786
|
+
* ```
|
|
1787
|
+
*/
|
|
1788
|
+
defaultAnswer: (text: string) => string;
|
|
1789
|
+
/**
|
|
1790
|
+
* Style to apply to help text.
|
|
1791
|
+
*
|
|
1792
|
+
* @param text - The help text.
|
|
1793
|
+
* @returns The styled help text.
|
|
1794
|
+
*
|
|
1795
|
+
* @defaultValue
|
|
1796
|
+
* ```ts
|
|
1797
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1798
|
+
* (text) => colors.dim(text)
|
|
1799
|
+
* ```
|
|
1800
|
+
*/
|
|
1801
|
+
help: (text: string) => string;
|
|
1802
|
+
/**
|
|
1803
|
+
* Style to apply to highlighted text.
|
|
1804
|
+
*
|
|
1805
|
+
* @param text - The text to highlight.
|
|
1806
|
+
* @returns The highlighted text.
|
|
1807
|
+
*
|
|
1808
|
+
* @defaultValue
|
|
1809
|
+
* ```ts
|
|
1810
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1811
|
+
* (text) => colors.cyan(text)
|
|
1812
|
+
* ```
|
|
1813
|
+
*/
|
|
1814
|
+
highlight: (text: string) => string;
|
|
1815
|
+
/**
|
|
1816
|
+
* Style to apply to keyboard keys referred to in help texts.
|
|
1817
|
+
*
|
|
1818
|
+
* @param text - The key to style.
|
|
1819
|
+
* @returns The styled key.
|
|
1820
|
+
*
|
|
1821
|
+
* @defaultValue
|
|
1822
|
+
* ```ts
|
|
1823
|
+
* // import colors from 'yoctocolors-cjs';
|
|
1824
|
+
* (text) => colors.cyan(colors.bold(`<${text}>`))
|
|
1825
|
+
* ```
|
|
1826
|
+
*/
|
|
1827
|
+
key: (text: string) => string;
|
|
1828
|
+
};
|
|
1829
|
+
};
|
|
1830
|
+
type Theme<Extension extends object = object> = Prettify<Extension & DefaultTheme>;
|
|
1831
|
+
|
|
1671
1832
|
type NormalizedPackageJson = Package & PackageJson;
|
|
1672
1833
|
type PackageJson = PackageJson$1;
|
|
1673
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
|
+
};
|
|
1674
1848
|
|
|
1675
1849
|
type ReadOptions = {
|
|
1676
1850
|
cache?: Cache<NormalizedReadResult> | boolean;
|
|
@@ -1693,5 +1867,6 @@ declare const hasPackageJsonProperty: (packageJson: NormalizedPackageJson, prope
|
|
|
1693
1867
|
declare const hasPackageJsonAnyDependency: (packageJson: NormalizedPackageJson, arguments_: string[], options?: {
|
|
1694
1868
|
peerDeps?: boolean;
|
|
1695
1869
|
}) => boolean;
|
|
1870
|
+
declare const ensurePackages: (packageJson: NormalizedPackageJson, packages: string[], installKey?: "dependencies" | "devDependencies", options?: EnsurePackagesOptions) => Promise<void>;
|
|
1696
1871
|
|
|
1697
|
-
export { type NormalizedReadResult as N, type PackageJson as P, findPackageJsonSync as a, hasPackageJsonProperty as b, writePackageJsonSync as c, type NormalizedPackageJson as d, 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.0",
|
|
4
4
|
"description": "One Package to rule them all, finds your root-dir, monorepo, or package manager.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -147,9 +147,13 @@
|
|
|
147
147
|
"dependencies": {
|
|
148
148
|
"@visulima/fs": "2.3.3",
|
|
149
149
|
"@visulima/path": "1.2.0",
|
|
150
|
-
"normalize-package-data": "^7.0.0"
|
|
150
|
+
"normalize-package-data": "^7.0.0",
|
|
151
|
+
"@inquirer/confirm": "^5.1.1",
|
|
152
|
+
"@antfu/install-pkg": "^0.5.0"
|
|
151
153
|
},
|
|
152
154
|
"devDependencies": {
|
|
155
|
+
"@inquirer/core": "^10.1.2",
|
|
156
|
+
"@inquirer/type": "^3.0.2",
|
|
153
157
|
"@anolilab/eslint-config": "^15.0.3",
|
|
154
158
|
"@anolilab/prettier-config": "^5.0.14",
|
|
155
159
|
"@anolilab/semantic-release-pnpm": "^1.1.6",
|