@visulima/package 5.0.12 → 5.0.13
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 +2 -0
- package/LICENSE.md +126 -61
- package/dist/error.js +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/lockfile.js +1 -1
- package/dist/monorepo.js +1 -1
- package/dist/package-json.d.ts +2 -4
- package/dist/package-json.js +3 -3
- package/dist/package-manager.js +3 -3
- package/dist/package.js +1 -1
- package/dist/packem_shared/PackageNotFoundError-PwPSQ1F3.js +1 -0
- package/dist/packem_shared/json-value.d-AIF0oxA6.d.ts +29 -0
- package/dist/packem_shared/package-json.d-Ba7sjsO5.d.ts +2856 -0
- package/dist/pnpm.d.ts +1 -1
- package/dist/pnpm.js +1 -1
- package/package.json +23 -23
- package/dist/packem_shared/PackageNotFoundError-Bi41exhP.js +0 -1
- package/dist/packem_shared/package-json.d-62php2nC.d.ts +0 -186
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
## @visulima/package [5.0.13](https://github.com/visulima/visulima/compare/%40visulima%2Fpackage%405.0.12...%40visulima%2Fpackage%405.0.13) (2026-08-17)
|
|
2
|
+
|
|
1
3
|
## @visulima/package [5.0.12](https://github.com/visulima/visulima/compare/%40visulima%2Fpackage%405.0.11...%40visulima%2Fpackage%405.0.12) (2026-08-08)
|
|
2
4
|
|
|
3
5
|
|
package/LICENSE.md
CHANGED
|
@@ -47,70 +47,135 @@ Repository: sindresorhus/dot-prop
|
|
|
47
47
|
<!-- TYPE_DEPENDENCIES -->
|
|
48
48
|
|
|
49
49
|
# Licenses of bundled types
|
|
50
|
-
|
|
51
50
|
The published @visulima/package artifact additionally contains code with the following licenses:
|
|
52
|
-
MIT
|
|
51
|
+
(MIT OR CC0-1.0)
|
|
53
52
|
|
|
54
53
|
# Bundled types:
|
|
54
|
+
## type-fest
|
|
55
|
+
License: (MIT OR CC0-1.0)
|
|
56
|
+
By: Sindre Sorhus
|
|
57
|
+
Repository: sindresorhus/type-fest
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
>
|
|
63
|
-
>
|
|
64
|
-
>
|
|
65
|
-
>
|
|
66
|
-
>
|
|
67
|
-
>
|
|
68
|
-
>
|
|
69
|
-
>
|
|
70
|
-
>
|
|
71
|
-
>
|
|
72
|
-
>
|
|
73
|
-
>
|
|
74
|
-
>
|
|
75
|
-
>
|
|
76
|
-
>
|
|
77
|
-
>
|
|
78
|
-
>
|
|
79
|
-
>
|
|
80
|
-
>
|
|
81
|
-
>
|
|
82
|
-
>
|
|
83
|
-
>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
>
|
|
94
|
-
>
|
|
95
|
-
>
|
|
96
|
-
>
|
|
97
|
-
>
|
|
98
|
-
>
|
|
99
|
-
>
|
|
100
|
-
>
|
|
101
|
-
>
|
|
102
|
-
>
|
|
103
|
-
>
|
|
104
|
-
>
|
|
105
|
-
>
|
|
106
|
-
>
|
|
107
|
-
>
|
|
108
|
-
>
|
|
109
|
-
>
|
|
110
|
-
>
|
|
111
|
-
>
|
|
112
|
-
>
|
|
113
|
-
>
|
|
114
|
-
>
|
|
59
|
+
> Creative Commons Legal Code
|
|
60
|
+
>
|
|
61
|
+
> CC0 1.0 Universal
|
|
62
|
+
>
|
|
63
|
+
> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
64
|
+
> LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
65
|
+
> ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
66
|
+
> INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
67
|
+
> REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
68
|
+
> PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
69
|
+
> THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
70
|
+
> HEREUNDER.
|
|
71
|
+
>
|
|
72
|
+
> Statement of Purpose
|
|
73
|
+
>
|
|
74
|
+
> The laws of most jurisdictions throughout the world automatically confer
|
|
75
|
+
> exclusive Copyright and Related Rights (defined below) upon the creator
|
|
76
|
+
> and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
77
|
+
> authorship and/or a database (each, a "Work").
|
|
78
|
+
>
|
|
79
|
+
> Certain owners wish to permanently relinquish those rights to a Work for
|
|
80
|
+
> the purpose of contributing to a commons of creative, cultural and
|
|
81
|
+
> scientific works ("Commons") that the public can reliably and without fear
|
|
82
|
+
> of later claims of infringement build upon, modify, incorporate in other
|
|
83
|
+
> works, reuse and redistribute as freely as possible in any form whatsoever
|
|
84
|
+
> and for any purposes, including without limitation commercial purposes.
|
|
85
|
+
> These owners may contribute to the Commons to promote the ideal of a free
|
|
86
|
+
> culture and the further production of creative, cultural and scientific
|
|
87
|
+
> works, or to gain reputation or greater distribution for their Work in
|
|
88
|
+
> part through the use and efforts of others.
|
|
89
|
+
>
|
|
90
|
+
> For these and/or other purposes and motivations, and without any
|
|
91
|
+
> expectation of additional consideration or compensation, the person
|
|
92
|
+
> associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
93
|
+
> is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
94
|
+
> elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
95
|
+
> terms, with knowledge of his or her Copyright and Related Rights in the
|
|
96
|
+
> Work and the meaning and intended legal effect of CC0 on those rights.
|
|
97
|
+
>
|
|
98
|
+
> 1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
99
|
+
> protected by copyright and related or neighboring rights ("Copyright and
|
|
100
|
+
> Related Rights"). Copyright and Related Rights include, but are not
|
|
101
|
+
> limited to, the following:
|
|
102
|
+
>
|
|
103
|
+
> i. the right to reproduce, adapt, distribute, perform, display,
|
|
104
|
+
> communicate, and translate a Work;
|
|
105
|
+
> ii. moral rights retained by the original author(s) and/or performer(s);
|
|
106
|
+
> iii. publicity and privacy rights pertaining to a person's image or
|
|
107
|
+
> likeness depicted in a Work;
|
|
108
|
+
> iv. rights protecting against unfair competition in regards to a Work,
|
|
109
|
+
> subject to the limitations in paragraph 4(a), below;
|
|
110
|
+
> v. rights protecting the extraction, dissemination, use and reuse of data
|
|
111
|
+
> in a Work;
|
|
112
|
+
> vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
113
|
+
> European Parliament and of the Council of 11 March 1996 on the legal
|
|
114
|
+
> protection of databases, and under any national implementation
|
|
115
|
+
> thereof, including any amended or successor version of such
|
|
116
|
+
> directive); and
|
|
117
|
+
> vii. other similar, equivalent or corresponding rights throughout the
|
|
118
|
+
> world based on applicable law or treaty, and any national
|
|
119
|
+
> implementations thereof.
|
|
120
|
+
>
|
|
121
|
+
> 2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
122
|
+
> of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
123
|
+
> irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
124
|
+
> Affirmer's Copyright and Related Rights and associated claims and causes
|
|
125
|
+
> of action, whether now known or unknown (including existing as well as
|
|
126
|
+
> future claims and causes of action), in the Work (i) in all territories
|
|
127
|
+
> worldwide, (ii) for the maximum duration provided by applicable law or
|
|
128
|
+
> treaty (including future time extensions), (iii) in any current or future
|
|
129
|
+
> medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
130
|
+
> including without limitation commercial, advertising or promotional
|
|
131
|
+
> purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
132
|
+
> member of the public at large and to the detriment of Affirmer's heirs and
|
|
133
|
+
> successors, fully intending that such Waiver shall not be subject to
|
|
134
|
+
> revocation, rescission, cancellation, termination, or any other legal or
|
|
135
|
+
> equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
136
|
+
> as contemplated by Affirmer's express Statement of Purpose.
|
|
137
|
+
>
|
|
138
|
+
> 3. Public License Fallback. Should any part of the Waiver for any reason
|
|
139
|
+
> be judged legally invalid or ineffective under applicable law, then the
|
|
140
|
+
> Waiver shall be preserved to the maximum extent permitted taking into
|
|
141
|
+
> account Affirmer's express Statement of Purpose. In addition, to the
|
|
142
|
+
> extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
143
|
+
> person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
144
|
+
> irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
145
|
+
> Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
146
|
+
> maximum duration provided by applicable law or treaty (including future
|
|
147
|
+
> time extensions), (iii) in any current or future medium and for any number
|
|
148
|
+
> of copies, and (iv) for any purpose whatsoever, including without
|
|
149
|
+
> limitation commercial, advertising or promotional purposes (the
|
|
150
|
+
> "License"). The License shall be deemed effective as of the date CC0 was
|
|
151
|
+
> applied by Affirmer to the Work. Should any part of the License for any
|
|
152
|
+
> reason be judged legally invalid or ineffective under applicable law, such
|
|
153
|
+
> partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
154
|
+
> of the License, and in such case Affirmer hereby affirms that he or she
|
|
155
|
+
> will not (i) exercise any of his or her remaining Copyright and Related
|
|
156
|
+
> Rights in the Work or (ii) assert any associated claims and causes of
|
|
157
|
+
> action with respect to the Work, in either case contrary to Affirmer's
|
|
158
|
+
> express Statement of Purpose.
|
|
159
|
+
>
|
|
160
|
+
> 4. Limitations and Disclaimers.
|
|
161
|
+
>
|
|
162
|
+
> a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
163
|
+
> surrendered, licensed or otherwise affected by this document.
|
|
164
|
+
> b. Affirmer offers the Work as-is and makes no representations or
|
|
165
|
+
> warranties of any kind concerning the Work, express, implied,
|
|
166
|
+
> statutory or otherwise, including without limitation warranties of
|
|
167
|
+
> title, merchantability, fitness for a particular purpose, non
|
|
168
|
+
> infringement, or the absence of latent or other defects, accuracy, or
|
|
169
|
+
> the present or absence of errors, whether or not discoverable, all to
|
|
170
|
+
> the greatest extent permissible under applicable law.
|
|
171
|
+
> c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
172
|
+
> that may apply to the Work or any use thereof, including without
|
|
173
|
+
> limitation any person's Copyright and Related Rights in the Work.
|
|
174
|
+
> Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
175
|
+
> consents, permissions or other rights required for any use of the
|
|
176
|
+
> Work.
|
|
177
|
+
> d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
178
|
+
> party to this document and has no duty or obligation with respect to
|
|
179
|
+
> this CC0 or use of the Work.
|
|
115
180
|
|
|
116
181
|
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/error.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"./packem_shared/PackageNotFoundError-
|
|
1
|
+
import{default as a}from"./packem_shared/PackageNotFoundError-PwPSQ1F3.js";export{a as PackageNotFoundError};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,10 @@ export { PackageNotFoundError } from "./error.js";
|
|
|
2
2
|
export { type LockFileEntry, type LockFileIntegrity, type LockFileIntegrityAlgorithm, type LockFileParseResult, type LockFileType, decodeSriIntegrity, parseBunLockFile, parseLockFile, parseLockFileContent, parseLockFileSync, parseNpmLockFile, parsePnpmLockFile, parseYarnLockFile } from "./lockfile.js";
|
|
3
3
|
export { type RootMonorepo, type Strategy, findMonorepoRoot, findMonorepoRootSync } from "./monorepo.js";
|
|
4
4
|
export { findPackageRoot, findPackageRootSync } from "./package.js";
|
|
5
|
-
export { type E as EnsurePackagesOptions, type F as FindPackageJsonCache, type N as NormalizedPackageJson, type a as NormalizedReadResult, type P as PackageJson, c as clearPackageJsonCache, e as ensurePackages, f as findPackageJson, b as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, d as hasPackageJsonProperty, p as parsePackageJson, i as parsePackageJsonSync, w as writePackageJson, j as writePackageJsonSync } from "./packem_shared/package-json.d-
|
|
5
|
+
export { type E as EnsurePackagesOptions, type F as FindPackageJsonCache, type N as NormalizedPackageJson, type a as NormalizedReadResult, type P as PackageJson, c as clearPackageJsonCache, e as ensurePackages, f as findPackageJson, b as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, d as hasPackageJsonProperty, p as parsePackageJson, i as parsePackageJsonSync, w as writePackageJson, j as writePackageJsonSync } from "./packem_shared/package-json.d-Ba7sjsO5.js";
|
|
6
6
|
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from "./package-manager.js";
|
|
7
7
|
export { type PnpmCatalog, type PnpmCatalogs, isPackageInWorkspace, readPnpmCatalogs, readPnpmCatalogsSync, resolveCatalogReference, resolveCatalogReferences, resolveDependenciesCatalogReferences } from "./pnpm.js";
|
|
8
8
|
import '@visulima/fs';
|
|
9
|
-
import 'type-fest';
|
|
10
9
|
import '@antfu/install-pkg';
|
|
11
|
-
import '@inquirer/core';
|
|
12
|
-
import '@inquirer/type';
|
|
13
10
|
import 'normalize-package-data';
|
|
11
|
+
import "./packem_shared/json-value.d-AIF0oxA6.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"./packem_shared/PackageNotFoundError-
|
|
1
|
+
import{default as o}from"./packem_shared/PackageNotFoundError-PwPSQ1F3.js";import{decodeSriIntegrity as r,parseBunLockFile as c,parseLockFile as s,parseLockFileContent as g,parseLockFileSync as i,parseNpmLockFile as t,parsePnpmLockFile as k,parseYarnLockFile as p}from"./lockfile.js";import{findMonorepoRoot as f,findMonorepoRootSync as l}from"./monorepo.js";import{findPackageRoot as y,findPackageRootSync as m}from"./package.js";import{clearPackageJsonCache as J,ensurePackages as S,findPackageJson as L,findPackageJsonSync as M,getPackageJsonProperty as x,hasPackageJsonAnyDependency as C,hasPackageJsonProperty as R,parsePackageJson as u,parsePackageJsonSync as I,writePackageJson as h,writePackageJsonSync as v}from"./package-json.js";import{findLockFile as D,findLockFileSync as N,findPackageManager as A,findPackageManagerSync as B,generateMissingPackagesInstallMessage as E,getPackageManagerVersion as V,identifyInitiatingPackageManager as W}from"./package-manager.js";import{isPackageInWorkspace as b,readPnpmCatalogs as j,readPnpmCatalogsSync as q,resolveCatalogReference as z,resolveCatalogReferences as G,resolveDependenciesCatalogReferences as H}from"./pnpm.js";export{o as PackageNotFoundError,J as clearPackageJsonCache,r as decodeSriIntegrity,S as ensurePackages,D as findLockFile,N as findLockFileSync,f as findMonorepoRoot,l as findMonorepoRootSync,L as findPackageJson,M as findPackageJsonSync,A as findPackageManager,B as findPackageManagerSync,y as findPackageRoot,m as findPackageRootSync,E as generateMissingPackagesInstallMessage,x as getPackageJsonProperty,V as getPackageManagerVersion,C as hasPackageJsonAnyDependency,R as hasPackageJsonProperty,W as identifyInitiatingPackageManager,b as isPackageInWorkspace,c as parseBunLockFile,s as parseLockFile,g as parseLockFileContent,i as parseLockFileSync,t as parseNpmLockFile,u as parsePackageJson,I as parsePackageJsonSync,k as parsePnpmLockFile,p as parseYarnLockFile,j as readPnpmCatalogs,q as readPnpmCatalogsSync,z as resolveCatalogReference,G as resolveCatalogReferences,H as resolveDependenciesCatalogReferences,h as writePackageJson,v as writePackageJsonSync};
|
package/dist/lockfile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as N}from"node:module";import{findUp as F,findUpSync as W}from"@visulima/fs";import{L as P}from"./packem_shared/lockfile-candidates-B-i5hlDs.js";let A;const M=n=>(A??=N(import.meta.url))(n),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=n=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(n)}return M(n)},{readFileSync:T}=b("node:fs"),{readFile:$}=b("node:fs/promises"),C={sha256:"sha256",sha384:"sha384",sha512:"sha512"},U=1024,Y=/^[A-Z0-9+/]+={0,2}$/i,D="node_modules/",m=/^['"]/,y=/['"]$/,B=/^[a-z][a-zA-Z0-9]*:\s*$/m,G=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,K=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^\n]+\n((?:[\t ][^\n]*(?:\n|$))+)/gm,q=/^\s+version:?\s+"?([^"\n]+)"?/m,V=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,v=n=>{if(n.length>U)return;const e=n.indexOf("-");if(e<=0)return;const t=C[n.slice(0,e).toLowerCase()];if(!t)return;const s=n.slice(e+1);if(Y.test(s))try{const o=Buffer.from(s,"base64");return o.length===0?void 0:{algorithm:t,hex:o.toString("hex")}}catch{return}},x=(n,e,t)=>{const s=`${t.name}@${t.version}`;e.has(s)||(e.add(s),n.push(t))},u=(n,e,t)=>{t&&Object.keys(t).length>0&&(n[e]={...t})},g=n=>{if(!n)return;const e={};for(const[t,s]of Object.entries(n))e[t]=[s];return Object.keys(e).length>0?e:void 0},X=n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n)}catch{return e}if(!s.packages)return e;for(const[o,c]of Object.entries(s.packages)){if(!o||!c.version)continue;const r=o.lastIndexOf(D);if(r===-1)continue;const a=o.slice(r+D.length);if(a.length===0)continue;const i=a.split("/"),p=a.startsWith("@")?2:1;if(i.length!==p||i.some(f=>f.length===0))continue;const l=c.name??a;if(l.startsWith("."))continue;const d={name:l,version:c.version};if(c.integrity){const f=v(c.integrity);f&&(d.integrity=f)}u(d,"dependencies",g(c.dependencies)),u(d,"peerDependencies",g(c.peerDependencies)),u(d,"optionalDependencies",g(c.optionalDependencies)),x(e,t,d)}return e},I=n=>{let e=n.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(m,"").replace(y,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const s=e.lastIndexOf("@");if(s<=0)return;const o=e.slice(0,s),c=e.slice(s+1);if(!(!o||!c||c.startsWith("link:")||c.startsWith("workspace:")||c.startsWith("file:")))return{name:o,version:c}},O=(n,e)=>{const s=new RegExp(String.raw`^${e}:\s*$`,"m").exec(n);if(!s)return;const o=s.index+s[0].length,c=B.exec(n.slice(o));return n.slice(o,c?o+c.index:n.length)},H=n=>{const e=new Map,t=O(n,"snapshots");if(!t)return e;const s=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let o;for(;(o=s.exec(t)??void 0)!==void 0;){const c=I(o[1]);if(!c)continue;const r=`${c.name}@${c.version}`,a=o[2],i=e.get(r)??{};for(const p of["dependencies","peerDependencies","optionalDependencies"]){const l=k(a,p);if(!l)continue;const d=i[p]??{};for(const[f,L]of Object.entries(l)){const E=d[f]??[];for(const w of L)E.includes(w)||E.push(w);d[f]=E}i[p]=d}e.set(r,i)}return e},z=n=>{const e=[],t=new Set,s=O(n,"packages");if(!s)return e;const o=H(n),c=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let r;for(;(r=c.exec(s)??void 0)!==void 0;){const a=I(r[1]);if(!a)continue;const i=r[2],p=G.exec(i),l={name:a.name,version:a.version};if(p?.[1]){const f=v(p[1]);f&&(l.integrity=f)}const d=o.get(`${a.name}@${a.version}`);u(l,"dependencies",d?.dependencies??k(i,"dependencies")),u(l,"peerDependencies",d?.peerDependencies??k(i,"peerDependencies")),u(l,"optionalDependencies",d?.optionalDependencies??k(i,"optionalDependencies")),x(e,t,l)}return e},k=(n,e)=>{const s=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(n);if(!s?.[1])return;const o={},c=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=c.exec(s[1])??void 0)!==void 0;){const a=r[1].replace(m,"").replace(y,"");let i=r[2].trim();i=i.replace(m,"").replace(y,"");const p=i.indexOf("(");if(p>0&&(i=i.slice(0,p).trim()),!a||!i)continue;const l=o[a]??[];l.includes(i)||l.push(i),o[a]=l}return Object.keys(o).length>0?o:void 0},J=n=>{const e=[],t=new Set,s=K;s.lastIndex=0;let o;for(;(o=s.exec(n)??void 0)!==void 0;){const c=o[1].replace(m,"").replace(y,"");if(!c)continue;const r=o[2],a=q.exec(r);if(!a?.[1])continue;const i={name:c,version:a[1].trim()},p=V.exec(r);if(p?.[1]){const l=v(p[1]);l&&(i.integrity=l)}u(i,"dependencies",_(r,"dependencies")),u(i,"peerDependencies",_(r,"peerDependencies")),u(i,"optionalDependencies",_(r,"optionalDependencies")),x(e,t,i)}return e},_=(n,e)=>{const s=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(n);if(!s?.[1])return;const o={},c=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=c.exec(s[1])??void 0)!==void 0;){const a=r[1].replace(m,"").replace(y,""),i=r[2];if(a&&i){const p=o[a]??[];p.includes(i)||p.push(i),o[a]=p}}return Object.keys(o).length>0?o:void 0},Q=/,(?=\s*[}\]])/g,Z=n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n.replaceAll(Q,""))}catch{return e}if(!s.packages)return e;for(const o of Object.values(s.packages)){const c=o[0];if(typeof c!="string")continue;const r=c.indexOf("@",1);if(r<=0)continue;const a=c.slice(0,r),i=c.slice(r+1);if(!a||!i||i.startsWith("workspace:")||i.startsWith("link:")||i.startsWith("file:"))continue;const p={name:a,version:i},l=o[3];if(typeof l=="string"&&l.length>0){const f=v(l);f&&(p.integrity=f)}const d=o[2];if(d&&typeof d=="object"&&!Array.isArray(d)){const f=d;u(p,"dependencies",g(f.dependencies)),u(p,"peerDependencies",g(f.peerDependencies)),u(p,"optionalDependencies",g(f.optionalDependencies))}x(e,t,p)}return e},R=n=>{if(n.endsWith("pnpm-lock.yaml"))return"pnpm";if(n.endsWith("package-lock.json")||n.endsWith("npm-shrinkwrap.json"))return"npm";if(n.endsWith("yarn.lock"))return"yarn";if(n.endsWith("bun.lockb")||n.endsWith("bun.lock"))return"bun"},S=(n,e)=>{switch(e){case"bun":return Z(n);case"npm":return X(n);case"pnpm":return z(n);case"yarn":return J(n);default:return[]}},j=[...P],se=async n=>{const e=await F(j,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, npm-shrinkwrap.json, yarn.lock, bun.lock)");const t=R(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);const s=await $(e,"utf8");return{entries:S(s,t),path:e,type:t}},oe=n=>{const e=W(j,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, npm-shrinkwrap.json, yarn.lock, bun.lock)");const t=R(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);return{entries:S(T(e,"utf8"),t),path:e,type:t}};export{v as decodeSriIntegrity,Z as parseBunLockFile,se as parseLockFile,S as parseLockFileContent,oe as parseLockFileSync,X as parseNpmLockFile,z as parsePnpmLockFile,J as parseYarnLockFile};
|
package/dist/monorepo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as m}from"node:module";import{findUp as k,readJson as j,findUpSync as b,readJsonSync as _}from"@visulima/fs";import{NotFoundError as u}from"@visulima/fs/error";import{parseJson as w}from"@visulima/fs/utils";import{dirname as l,join as a}from"@visulima/path";import{findPackageManager as F,findPackageManagerSync as P}from"./package-manager.js";let d;const g=n=>(d??=m(import.meta.url))(n),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=n=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[e,t]=i.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return i.getBuiltinModule(n)}return g(n)},{existsSync:c,readFileSync:f}=h("node:fs"),y=n=>{let e;try{e=w(n)}catch{return!1}if(!e||typeof e!="object"||Array.isArray(e))return!1;const{workspaces:t}=e;return typeof t=="object"&&t!==null},T=async n=>{const e=await k(["lerna.json","turbo.json"],{type:"file",...n&&{cwd:n}});if(e?.endsWith("lerna.json")){const r=await j(e);if(r&&typeof r=="object"&&!Array.isArray(r)){const o=r;if(o.useWorkspaces||o.packages)return{path:l(e),strategy:"lerna"}}}const t=e?.endsWith("turbo.json");try{const{packageManager:r,path:o}=await F(n);if(["npm","yarn"].includes(r)){const s=a(o,"package.json");if(c(s)){const p=f(a(o,"package.json"),"utf8");if(y(p))return{path:o,strategy:t?"turbo":r}}}else if(r==="pnpm"){const s=a(o,"pnpm-workspace.yaml");if(c(s))return{path:o,strategy:t?"turbo":"pnpm"}}}catch(r){if(!(r instanceof u))throw r}throw new Error(`No monorepo root could be found upwards from the directory ${String(n??process.cwd())} using lerna, yarn, pnpm, or npm as indicators.`)},q=n=>{const e=b(["lerna.json","turbo.json"],{type:"file",...n&&{cwd:n}});if(e?.endsWith("lerna.json")){const r=_(e);if(r&&typeof r=="object"&&!Array.isArray(r)){const o=r;if(o.useWorkspaces||o.packages)return{path:l(e),strategy:"lerna"}}}const t=e?.endsWith("turbo.json");try{const{packageManager:r,path:o}=P(n);if(["npm","yarn"].includes(r)){const s=a(o,"package.json");if(c(s)){const p=f(a(o,"package.json"),"utf8");if(y(p))return{path:o,strategy:t?"turbo":r}}}else if(r==="pnpm"){const s=a(o,"pnpm-workspace.yaml");if(c(s))return{path:o,strategy:t?"turbo":"pnpm"}}}catch(r){if(!(r instanceof u))throw r}throw new Error(`No monorepo root could be found upwards from the directory ${String(n??process.cwd())} using lerna, yarn, pnpm, or npm as indicators.`)};export{T as findMonorepoRoot,q as findMonorepoRootSync};
|
package/dist/package-json.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import '@visulima/fs';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export { F as FindPackageJsonCache, a as NormalizedReadResult, c as clearPackageJsonCache, e as ensurePackages, f as findPackageJson, b as findPackageJsonSync, g as getPackageJsonProperty, h as hasPackageJsonAnyDependency, d as hasPackageJsonProperty, p as parsePackageJson, i as parsePackageJsonSync, w as writePackageJson, j as writePackageJsonSync } from "./packem_shared/package-json.d-Ba7sjsO5.js";
|
|
3
|
+
import "./packem_shared/json-value.d-AIF0oxA6.js";
|
|
4
4
|
import '@antfu/install-pkg';
|
|
5
|
-
import '@inquirer/core';
|
|
6
|
-
import '@inquirer/type';
|
|
7
5
|
import 'normalize-package-data';
|
package/dist/package-json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
${
|
|
1
|
+
import{createRequire as M}from"node:module";import{installPackage as q}from"@antfu/install-pkg";import{findUp as z,findUpSync as K,writeJson as V,writeJsonSync as X,readJson as G,readJsonSync as U,readFile as F,readFileSync as L}from"@visulima/fs";import{NotFoundError as P}from"@visulima/fs/error";import{toPath as x,parseJson as k}from"@visulima/fs/utils";import{readYaml as H,readYamlSync as Q}from"@visulima/fs/yaml";import{join as j}from"@visulima/path";import v from"json5";import Z from"normalize-package-data";import{readPnpmCatalogs as N,resolveCatalogReferences as p,readPnpmCatalogsSync as _}from"./pnpm.js";let B;const Y=r=>(B??=M(import.meta.url))(r),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=r=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(r)}return Y(r)},{existsSync:S}=E("node:fs"),{createInterface:ee}=E("node:readline"),{styleText:d}=E("node:util"),b=r=>{const e=typeof r;return r!==null&&(e==="object"||e==="function")},A=new Set(["__proto__","prototype","constructor"]),C=1e6,re=r=>r>="0"&&r<="9";function D(r){if(r==="0")return!0;if(/^[1-9]\d*$/.test(r)){const e=Number.parseInt(r,10);return e<=Number.MAX_SAFE_INTEGER&&e<=C}return!1}function $(r,e){return A.has(r)?!1:(r&&D(r)?e.push(Number.parseInt(r,10)):e.push(r),!0)}function ne(r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);const e=[];let t="",n="start",s=!1,o=0;for(const a of r){if(o++,s){t+=a,s=!1;continue}if(a==="\\"){if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);s=!0,n=n==="start"?"property":n;continue}switch(a){case".":{if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd"){n="property";break}if(!$(t,e))return[];t="",n="property";break}case"[":{if(n==="index")throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd"){n="index";break}if(n==="property"||n==="start"){if((t||n==="property")&&!$(t,e))return[];t=""}n="index";break}case"]":{if(n==="index"){if(t==="")t=(e.pop()||"")+"[]",n="property";else{const i=Number.parseInt(t,10);!Number.isNaN(i)&&Number.isFinite(i)&&i>=0&&i<=Number.MAX_SAFE_INTEGER&&i<=C&&t===String(i)?e.push(i):e.push(t),t="",n="indexEnd"}break}if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);t+=a;break}default:{if(n==="index"&&!re(a))throw new Error(`Invalid character '${a}' in an index at position ${o}`);if(n==="indexEnd")throw new Error(`Invalid character '${a}' after an index at position ${o}`);n==="start"&&(n="property"),t+=a}}}switch(s&&(t+="\\"),n){case"property":{if(!$(t,e))return[];break}case"index":throw new Error("Index was not closed");case"start":{e.push("");break}}return e}function I(r){if(typeof r=="string")return ne(r);if(Array.isArray(r)){const e=[];for(const[t,n]of r.entries()){if(typeof n!="string"&&typeof n!="number")throw new TypeError(`Expected a string or number for path segment at index ${t}, got ${typeof n}`);if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`Path segment at index ${t} must be a finite number, got ${n}`);if(A.has(n))return[];typeof n=="string"&&D(n)?e.push(Number.parseInt(n,10)):e.push(n)}return e}return[]}function u(r,e,t){if(!b(r)||typeof e!="string"&&!Array.isArray(e))return t===void 0?r:t;const n=I(e);if(n.length===0)return t;for(let s=0;s<n.length;s++){const o=n[s];if(r=r[o],r==null){if(s!==n.length-1)return t;break}}return r===void 0?t:r}function te(r,e){if(!b(r)||typeof e!="string"&&!Array.isArray(e))return!1;const t=I(e);if(t.length===0)return!1;for(const n of t){if(!b(r)||!(n in r))return!1;r=r[n]}return!0}const se=async r=>{const{default:e=!1,message:t,transformer:n}=r,s=a=>{const i=d(["cyan","bold"],"?"),c=d(["bold"],a),l=e?`${d(["greenBright"],"Y")}${d(["gray"],"/n")}`:`y/${d(["yellowBright"],"N")}`;return`${i} ${c} ${d(["gray"],`(${l})`)}`},o=a=>n?n(a):a?d(["greenBright"],"Yes"):d(["yellowBright"],"No");return new Promise(a=>{const i=ee({input:process.stdin,output:process.stdout}),c=s(t);i.question(c,l=>{i.close();const f=l.trim().toLowerCase();if(f===""){a(e);return}if(f==="y"||f==="yes"){console.log(`${d(["greenBright"],"✓")} ${o(!0)}`),a(!0);return}if(f==="n"||f==="no"){console.log(`${d(["yellowBright"],"✗")} ${o(!1)}`),a(!1);return}console.log(`${d(["gray"],"→")} ${o(e)}`),a(e)}),i.on("SIGINT",()=>{i.close(),console.log(`
|
|
2
|
+
${d(["gray"],"→")} ${o(!1)}`),a(!1)})})},ae=typeof process.stdout<"u"&&!process.versions.deno&&!globalThis.window,J=/, ([^,]*)$/,g=new Map,m=new Map,h=(r,e={})=>{const t=e.strict&&e.ignoreWarnings?e.ignoreWarnings.map(String).toSorted((n,s)=>n.localeCompare(s)).join(","):"";return`${r}|s${String(e.strict?1:0)}|c${String(e.resolveCatalogs?1:0)}|j${String(e.json5===!1?0:1)}|y${String(e.yaml===!1?0:1)}|w${t}`},T=r=>r.trimStart().startsWith("{"),W=r=>{const e=`${r}|`;for(const t of[m,g])for(const n of t.keys())n.startsWith(e)&&t.delete(n)};class oe extends Error{constructor(e){super(`The following warnings were encountered while normalizing package data:
|
|
3
3
|
- ${e.join(`
|
|
4
|
-
- `)}`),this.name="PackageJsonValidationError"}}const w=(r,e,
|
|
4
|
+
- `)}`),this.name="PackageJsonValidationError"}}const w=(r,e,t=[])=>{const n=[];if(Z(r,s=>{n.push(s)},e),e&&n.length>0){const s=n.filter(o=>!t.some(a=>a instanceof RegExp?a.test(o):a===o));if(s.length>0)throw new oe(s)}return r},ce=async r=>await H(r),ie=r=>Q(r),fe=async r=>{const e=await F(r);return v.parse(e)},le=r=>{const e=L(r);return v.parse(e)},O=async(r,e)=>e?.yaml!==!1&&(r.endsWith(".yaml")||r.endsWith(".yml"))?ce(r):e?.json5!==!1&&r.endsWith(".json5")?fe(r):G(r),R=(r,e)=>e?.yaml!==!1&&(r.endsWith(".yaml")||r.endsWith(".yml"))?ie(r):e?.json5!==!1&&r.endsWith(".json5")?le(r):U(r),Ee=async(r,e={})=>{const t={type:"file"};r&&(t.cwd=r);const n=["package.json"];e.yaml!==!1&&n.push("package.yaml","package.yml"),e.json5!==!1&&n.push("package.json5");const s=await z(n,t);if(!s)throw new P(`No such file or directory, for ${n.join(", ").replace(J," or $1")} found.`);const o=e.cache&&typeof e.cache!="boolean"?e.cache:m,a=h(s,e);if(e.cache&&o.has(a))return o.get(a);const i=await O(s,e);if(e.resolveCatalogs){const l=await N(s);l&&p(i,l)}w(i,e.strict??!1,e.ignoreWarnings);const c={packageJson:i,path:s};return e.cache&&o.set(a,c),c},xe=(r,e={})=>{const t={type:"file"};r&&(t.cwd=r);const n=["package.json"];e.yaml!==!1&&n.push("package.yaml","package.yml"),e.json5!==!1&&n.push("package.json5");const s=K(n,t);if(!s)throw new P(`No such file or directory, for ${n.join(", ").replace(J," or $1")} found.`);const o=e.cache&&typeof e.cache!="boolean"?e.cache:m,a=h(s,e);if(e.cache&&o.has(a))return o.get(a);const i=R(s,e);if(e.resolveCatalogs){const l=_(s);l&&p(i,l)}w(i,e.strict??!1,e.ignoreWarnings);const c={packageJson:i,path:s};return e.cache&&o.set(a,c),c},Se=async(r,e={})=>{const{cwd:t,...n}=e,s=x(t??process.cwd()),o=j(s,"package.json");await V(o,r,n),W(o)},Pe=(r,e={})=>{const{cwd:t,...n}=e,s=x(t??process.cwd()),o=j(s,"package.json");X(o,r,n),W(o)},ke=()=>{m.clear(),g.clear()},je=(r,e)=>{const t=typeof r=="object"&&!Array.isArray(r);if(!t&&!(typeof r=="string"))throw new TypeError("`packageFile` should be either an `object` or a `string`.");let s,o=!1,a;if(t)s=structuredClone(r);else if(!T(r)&&S(r)){a=r;const c=e?.cache&&typeof e.cache!="boolean"?e.cache:g,l=h(a,e);if(e?.cache&&c.has(l))return c.get(l);s=R(a,e),o=!0}else s=k(r);if(e?.resolveCatalogs)if(o){const c=_(r);c&&p(s,c)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");w(s,e?.strict??!1,e?.ignoreWarnings);const i=s;return o&&e?.cache&&(typeof e.cache=="boolean"?g:e.cache).set(h(a,e),i),i},ve=async(r,e)=>{const t=typeof r=="object"&&!Array.isArray(r);if(!t&&!(typeof r=="string"))throw new TypeError("`packageFile` should be either an `object` or a `string`.");let s,o=!1,a;if(t)s=structuredClone(r);else if(!T(r)&&S(r)){a=r;const c=e?.cache&&typeof e.cache!="boolean"?e.cache:g,l=h(a,e);if(e?.cache&&c.has(l))return c.get(l);s=await O(a,e),o=!0}else s=k(r);if(e?.resolveCatalogs)if(o){const c=await N(r);c&&p(s,c)}else throw new Error("The 'resolveCatalogs' option can only be used on a file path.");w(s,e?.strict??!1,e?.ignoreWarnings);const i=s;return o&&e?.cache&&(typeof e.cache=="boolean"?g:e.cache).set(h(a,e),i),i},Ne=(r,e,t)=>u(r,e,t),_e=(r,e)=>te(r,e),Ae=(r,e,t)=>{const n=u(r,"dependencies",{}),s=u(r,"devDependencies",{}),o=u(r,"peerDependencies",{}),a={...n,...s,...t?.peerDeps===!1?{}:o};for(const i of e)if(Object.hasOwn(a,i))return!0;return!1},Ce=async(r,e,t="dependencies",n={})=>{const s=u(r,"dependencies",{}),o=u(r,"devDependencies",{}),a=u(r,"peerDependencies",{}),i=[],c={deps:!0,devDeps:!0,peerDeps:!1,...n,...n.confirm?{confirm:{...n.confirm}}:{}};for(const f of e)c.deps&&Object.hasOwn(s??{},f)||c.devDeps&&Object.hasOwn(o??{},f)||c.peerDeps&&Object.hasOwn(a??{},f)||i.push(f);if(i.length===0)return;if(process.env.CI||ae&&!process.stdout.isTTY){const f=`Skipping package installation for [${e.join(", ")}] because the process is not interactive.`;if(n.throwOnWarn)throw new Error(f);n.logger?.warn?n.logger.warn(f):console.warn(f);return}if(typeof c.confirm?.message=="function"&&(c.confirm.message=c.confirm.message(i)),c.confirm?.message===void 0){const f=`${i.length===1?"Package is":"Packages are"} required for this config: ${i.join(", ")}. Do you want to install them?`;c.confirm===void 0?c.confirm={message:f}:c.confirm.message=f}await se(c.confirm)&&await q(i,{...c.installPackage,cwd:c.cwd?x(c.cwd):void 0,dev:t==="devDependencies"})};export{ke as clearPackageJsonCache,Ce as ensurePackages,Ee as findPackageJson,xe as findPackageJsonSync,Ne as getPackageJsonProperty,Ae as hasPackageJsonAnyDependency,_e as hasPackageJsonProperty,ve as parsePackageJson,je as parsePackageJsonSync,Se as writePackageJson,Pe as writePackageJsonSync};
|
package/dist/package-manager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as E}from"node:module";import{findUp as k,findUpSync as h}from"@visulima/fs";import{NotFoundError as f}from"@visulima/fs/error";import{parseJson as N}from"@visulima/fs/utils";import{join as g,dirname as c}from"@visulima/path";import{L as W}from"./packem_shared/lockfile-candidates-B-i5hlDs.js";let b;const P=e=>(b??=E(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[n,a]=o.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return o.getBuiltinModule(e)}return P(e)},{execFileSync:S}=u("node:child_process"),{existsSync:m,readFileSync:$}=u("node:fs"),l=[...W],d=new Set(["bun","npm","pnpm","yarn"]),M=e=>{const n=N($(e,"utf8"));return typeof n?.packageManager=="string"?n.packageManager:void 0},_=e=>{let n;if(l.forEach(r=>{!n&&m(g(e,r))&&(n=g(e,r))}),n)return n;const a=g(e,"package.json");if(m(a)&&M(a)!==void 0)return a},w=e=>{if(!e)throw new f("Could not find a package manager");if(e.endsWith("package.json")){const n=M(e);if(n){const r=["npm","yarn","pnpm","bun"].find(i=>n.startsWith(i));if(r)return{packageManager:r,path:c(e)}}}if(e.endsWith("yarn.lock"))return{packageManager:"yarn",path:c(e)};if(e.endsWith("package-lock.json")||e.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:c(e)};if(e.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:c(e)};if(e.endsWith("bun.lock")||e.endsWith("bun.lockb"))return{packageManager:"bun",path:c(e)};throw new f("Could not find a package manager")},U=async e=>{const n=await k(l,{type:"file",...e&&{cwd:e}});if(!n)throw new Error("Could not find lock file");return n},q=e=>{const n=h(l,{type:"file",...e&&{cwd:e}});if(!n)throw new Error("Could not find lock file");return n},D=async e=>{const n=await k(_,{...e&&{cwd:e}});return w(n)},O=e=>{const n=h(_,{...e&&{cwd:e}});return w(n)},R=e=>{if(!d.has(e))throw new Error(`Unsupported package manager "${e}". Expected one of: ${[...d].join(", ")}.`);return S(e,["--version"]).toString("utf8").trim()},K=()=>{if(!process.env.npm_config_user_agent)return;const e=process.env.npm_config_user_agent.split(" ")[0],n=e.lastIndexOf("/"),a=e.slice(0,Math.max(0,n));return{name:a==="npminstall"?"cnpm":a,version:e.slice(Math.max(0,n+1))}},B=(e,n,a)=>{const r=n.length===1?"":"s",i=a.packageManagers??["npm","pnpm","yarn"];if(i.length===0)throw new Error("No package managers provided, please provide at least one package manager");if(n.length===0)throw new Error("No missing packages provided, please provide at least one missing package");let p=`
|
|
2
2
|
${a.preMessage??""}
|
|
3
3
|
${e} could not find the following package${r}
|
|
4
4
|
|
|
@@ -6,8 +6,8 @@ ${e} could not find the following package${r}
|
|
|
6
6
|
`)}
|
|
7
7
|
|
|
8
8
|
To install the missing package${r}, please run the following command:
|
|
9
|
-
`;const
|
|
9
|
+
`;const y=t=>t.lastIndexOf("@")>0?t:`${t}@latest`,v=i.map(t=>{const s=n.map(j=>y(j)).join(" ");switch(t){case"bun":return` bun add ${s} -D`;case"npm":return` npm install ${s} --save-dev`;case"pnpm":return` pnpm add ${s} -D`;case"yarn":return` yarn add ${s} --dev`;default:throw new Error("Unknown package manager")}});return p+=v.join(`
|
|
10
10
|
|
|
11
11
|
or
|
|
12
12
|
|
|
13
|
-
`),a.postMessage&&(
|
|
13
|
+
`),a.postMessage&&(p+=a.postMessage),p};export{U as findLockFile,q as findLockFileSync,D as findPackageManager,O as findPackageManagerSync,B as generateMissingPackagesInstallMessage,R as getPackageManagerVersion,K as identifyInitiatingPackageManager};
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as l}from"node:module";import{findUp as s,findUpSync as c,readJsonSync as y}from"@visulima/fs";import{dirname as n,join as a}from"@visulima/path";import{findLockFile as m,findLockFileSync as _}from"./package-manager.js";let p;const u=e=>(p??=l(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,t]=r.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return r.getBuiltinModule(e)}return u(e)},{existsSync:d}=g("node:fs"),f=e=>{if(d(a(e,"package.json"))){const o=y(a(e,"package.json"));if(o.name&&o.private!==!0)return"package.json"}},P=async e=>{try{const i=await m(e);return n(i)}catch{}const o=await s(".git/config",{...e&&{cwd:e},type:"file"});if(o)return n(n(o));const t=await s(f,{...e&&{cwd:e},type:"file"});if(t)return n(t);throw new Error("Could not find root directory")},R=e=>{try{const i=_(e);return n(i)}catch{}const o=c(".git/config",{...e&&{cwd:e},type:"file"});if(o)return n(n(o));const t=c(f,{...e&&{cwd:e},type:"file"});if(t)return n(t);throw new Error("Could not find root directory")};export{P as findPackageRoot,R as findPackageRootSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findPackageManagerSync as n}from"../package-manager.js";class i extends Error{constructor(r,o){if(typeof r=="string"&&(r=[r]),r.length===0){super("Package was not found.");return}if(o===void 0)try{o=n().packageManager}catch{}o??="npm",super(`Package '${r.join(" ")}' was not found. Please install it using '${o} install ${r.join(" ")}'`)}get code(){return"PACKAGE_NOT_FOUND"}set code(r){throw new Error("Cannot overwrite code PACKAGE_NOT_FOUND")}get name(){return"PackageNotFoundError"}set name(r){throw new Error("Cannot overwrite name of PackageNotFoundError")}}export{i as default};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Matches a JSON object.
|
|
3
|
+
|
|
4
|
+
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
|
5
|
+
|
|
6
|
+
@category JSON
|
|
7
|
+
*/
|
|
8
|
+
type JsonObject = { [Key in string]: JsonValue; };
|
|
9
|
+
/**
|
|
10
|
+
Matches a JSON array.
|
|
11
|
+
|
|
12
|
+
@category JSON
|
|
13
|
+
*/
|
|
14
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
15
|
+
/**
|
|
16
|
+
Matches any valid JSON primitive value.
|
|
17
|
+
|
|
18
|
+
@category JSON
|
|
19
|
+
*/
|
|
20
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
21
|
+
/**
|
|
22
|
+
Matches any valid JSON value.
|
|
23
|
+
|
|
24
|
+
@see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
|
|
25
|
+
|
|
26
|
+
@category JSON
|
|
27
|
+
*/
|
|
28
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
29
|
+
export { JsonObject as J, JsonValue as a };
|