@visulima/package 3.1.5 → 3.2.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 +30 -0
- package/LICENSE.md +122 -0
- package/README.md +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/monorepo.cjs +1 -1
- package/dist/package-json.cjs +1 -1
- package/dist/package-json.d.cts +1 -1
- package/dist/package-json.d.mts +1 -1
- package/dist/package-json.d.ts +1 -1
- package/dist/package-json.mjs +1 -1
- package/dist/package-manager.cjs +13 -1
- package/dist/package-manager.d.cts +6 -1
- package/dist/package-manager.d.mts +6 -1
- package/dist/package-manager.d.ts +6 -1
- package/dist/package-manager.mjs +13 -1
- package/dist/packem_shared/{package-json-DH2MJseY.d.cts → package-json-CT7xU1f_.d.cts} +5 -1
- package/dist/packem_shared/{package-json-DH2MJseY.d.mjs → package-json-CT7xU1f_.d.mjs} +5 -1
- package/dist/packem_shared/{package-json-DH2MJseY.d.mts → package-json-CT7xU1f_.d.mts} +5 -1
- package/package.json +17 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
## @visulima/package [3.2.0](https://github.com/visulima/visulima/compare/@visulima/package@3.1.6...@visulima/package@3.2.0) (2024-12-16)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **package:** added new generateMissingPackagesInstallMessage function ([4503cd8](https://github.com/visulima/visulima/commit/4503cd8db2c09f705d8261a73dc47bc10fa24b31))
|
|
6
|
+
|
|
7
|
+
## @visulima/package [3.1.6](https://github.com/visulima/visulima/compare/@visulima/package@3.1.5...@visulima/package@3.1.6) (2024-12-12)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
|
|
12
|
+
* allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
|
|
13
|
+
* updated packem to v1.8.2 ([23f869b](https://github.com/visulima/visulima/commit/23f869b4120856cc97e2bffa6d508e2ae30420ea))
|
|
14
|
+
* updated packem to v1.9.2 ([47bdc2d](https://github.com/visulima/visulima/commit/47bdc2dfaeca4e7014dbe7772eae2fdf8c8b35bb))
|
|
15
|
+
|
|
16
|
+
### Styles
|
|
17
|
+
|
|
18
|
+
* cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **package:** removed old dev dependency ([827e535](https://github.com/visulima/visulima/commit/827e535ac360b05b34503f0ef143bf9ee3d4b4ef))
|
|
23
|
+
* updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* **@visulima/fs:** upgraded to 2.3.1
|
|
29
|
+
* **@visulima/path:** upgraded to 1.1.2
|
|
30
|
+
|
|
1
31
|
## @visulima/package [3.1.5](https://github.com/visulima/visulima/compare/@visulima/package@3.1.4...@visulima/package@3.1.5) (2024-10-25)
|
|
2
32
|
|
|
3
33
|
|
package/LICENSE.md
CHANGED
|
@@ -56,4 +56,126 @@ License: (MIT OR CC0-1.0)
|
|
|
56
56
|
By: Sindre Sorhus
|
|
57
57
|
Repository: sindresorhus/type-fest
|
|
58
58
|
|
|
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.
|
|
180
|
+
|
|
59
181
|
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -152,14 +152,14 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
152
152
|
|
|
153
153
|
## Credits
|
|
154
154
|
|
|
155
|
-
-
|
|
156
|
-
-
|
|
155
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
156
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
157
157
|
|
|
158
158
|
## About
|
|
159
159
|
|
|
160
160
|
### Related Projects
|
|
161
161
|
|
|
162
|
-
-
|
|
162
|
+
- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file.
|
|
163
163
|
|
|
164
164
|
## License
|
|
165
165
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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"),a=require("./package-json.cjs"),e=require("./package-manager.cjs");exports.PackageNotFoundError=g;exports.findMonorepoRoot=n.findMonorepoRoot;exports.findMonorepoRootSync=n.findMonorepoRootSync;exports.findPackageRoot=o.findPackageRoot;exports.findPackageRootSync=o.findPackageRootSync;exports.findPackageJson=a.findPackageJson;exports.findPackageJsonSync=a.findPackageJsonSync;exports.getPackageJsonProperty=a.getPackageJsonProperty;exports.hasPackageJsonAnyDependency=a.hasPackageJsonAnyDependency;exports.hasPackageJsonProperty=a.hasPackageJsonProperty;exports.parsePackageJson=a.parsePackageJson;exports.writePackageJson=a.writePackageJson;exports.writePackageJsonSync=a.writePackageJsonSync;exports.findLockFile=e.findLockFile;exports.findLockFileSync=e.findLockFileSync;exports.findPackageManager=e.findPackageManager;exports.findPackageManagerSync=e.findPackageManagerSync;exports.generateMissingPackagesInstallMessage=e.generateMissingPackagesInstallMessage;exports.getPackageManagerVersion=e.getPackageManagerVersion;exports.identifyInitiatingPackageManager=e.identifyInitiatingPackageManager;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
5
|
-
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.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-CT7xU1f_.cjs';
|
|
5
|
+
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.cjs';
|
|
6
6
|
import '@visulima/fs';
|
|
7
7
|
import 'normalize-package-data';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
5
|
-
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.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-CT7xU1f_.mjs';
|
|
5
|
+
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.mjs';
|
|
6
6
|
import '@visulima/fs';
|
|
7
7
|
import 'normalize-package-data';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
5
|
-
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.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-CT7xU1f_.d.mjs';
|
|
5
|
+
export { PackageManager, PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager } from './package-manager.js';
|
|
6
6
|
import '@visulima/fs';
|
|
7
7
|
import 'normalize-package-data';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as
|
|
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{findPackageJson as k,findPackageJsonSync as P,getPackageJsonProperty as f,hasPackageJsonAnyDependency as d,hasPackageJsonProperty as p,parsePackageJson as y,writePackageJson as J,writePackageJsonSync as M}from"./package-json.mjs";import{findLockFile as l,findLockFileSync as m,findPackageManager as x,findPackageManagerSync as R,generateMissingPackagesInstallMessage as F,getPackageManagerVersion as h,identifyInitiatingPackageManager as u}from"./package-manager.mjs";export{n as PackageNotFoundError,l as findLockFile,m as findLockFileSync,r as findMonorepoRoot,g as findMonorepoRootSync,k as findPackageJson,P as findPackageJsonSync,x as findPackageManager,R as findPackageManagerSync,i as findPackageRoot,t as findPackageRootSync,F as generateMissingPackagesInstallMessage,f as getPackageJsonProperty,h as getPackageManagerVersion,d as hasPackageJsonAnyDependency,p as hasPackageJsonProperty,u as identifyInitiatingPackageManager,y as parsePackageJson,J as writePackageJson,M as writePackageJsonSync};
|
package/dist/monorepo.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var p=(n,e)=>y(n,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),c=require("@visulima/fs"),u=require("@visulima/fs/error"),
|
|
1
|
+
"use strict";var y=Object.defineProperty;var p=(n,e)=>y(n,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),c=require("@visulima/fs"),u=require("@visulima/fs/error"),a=require("@visulima/path"),d=require("./package-manager.cjs");var g=Object.defineProperty,f=p((n,e)=>g(n,"name",{value:e,configurable:!0}),"i");const l=f(async n=>{const e=await c.findUp(["lerna.json","turbo.json"],{type:"file",...n&&{cwd:n}});if(e?.endsWith("lerna.json")){const o=await c.readJson(e);if(o.useWorkspaces||o.packages)return{path:a.dirname(e),strategy:"lerna"}}const i=e?.endsWith("turbo.json");try{const{packageManager:o,path:r}=await d.findPackageManager(n);if(["npm","yarn"].includes(o)){const t=a.join(r,"package.json");if(s.existsSync(t)&&s.readFileSync(a.join(r,"package.json"),"utf8").includes("workspaces"))return{path:r,strategy:i?"turbo":o}}else if(o==="pnpm"){const t=a.join(r,"pnpm-workspace.yaml");if(s.existsSync(t))return{path:r,strategy:i?"turbo":"pnpm"}}}catch(o){if(!(o instanceof u.NotFoundError))throw o}throw new Error(`No monorepo root could be found upwards from the directory ${n} using lerna, yarn, pnpm, or npm as indicators.`)},"findMonorepoRoot"),m=f(n=>{const e=c.findUpSync(["lerna.json","turbo.json"],{type:"file",...n&&{cwd:n}});if(e?.endsWith("lerna.json")){const o=c.readJsonSync(e);if(o.useWorkspaces||o.packages)return{path:a.dirname(e),strategy:"lerna"}}const i=e?.endsWith("turbo.json");try{const{packageManager:o,path:r}=d.findPackageManagerSync(n);if(["npm","yarn"].includes(o)){const t=a.join(r,"package.json");if(s.existsSync(t)&&s.readFileSync(a.join(r,"package.json"),"utf8").includes("workspaces"))return{path:r,strategy:i?"turbo":o}}else if(o==="pnpm"){const t=a.join(r,"pnpm-workspace.yaml");if(s.existsSync(t))return{path:r,strategy:i?"turbo":"pnpm"}}}catch(o){if(!(o instanceof u.NotFoundError))throw o}throw new Error(`No monorepo root could be found upwards from the directory ${n} using lerna, yarn, pnpm, or npm as indicators.`)},"findMonorepoRootSync");exports.findMonorepoRoot=l;exports.findMonorepoRootSync=m;
|
package/dist/package-json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=Object.defineProperty;var c=(e,n)=>I(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("node:fs"),d=require("@visulima/fs"),x=require("@visulima/fs/error"),l=require("@visulima/fs/utils"),E=require("@visulima/path"),N=require("normalize-package-data"),_=c(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),w=_(N);var D=Object.defineProperty,s=c((e,n)=>D(e,"name",{value:n,configurable:!0}),"s$1");const f=s(e=>{const n=typeof e;return e!==null&&(n==="object"||n==="function")},"isObject"),O=s(e=>f(e)&&Object.keys(e).length===0,"isEmptyObject"),g=new Set(["__proto__","prototype","constructor"]),q=new Set("0123456789");function y(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(g.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(g.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"&&!q.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(g.has(r))return[];n.push(r);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}c(y,"d");s(y,"getPathSegments");function h(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(h,"l");s(h,"isStringIndex");function P(e,n){if(h(e,n))throw new Error("Cannot use string index")}c(P,"p");s(P,"assertNotStringIndex");function u(e,n,r){if(!f(e)||typeof n!="string")return r===void 0?e:r;const t=y(n);if(t.length===0)return r;for(let o=0;o<t.length;o++){const a=t[o];if(h(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");s(u,"getProperty");function $(e,n,r){if(!f(e)||typeof n!="string")return e;const t=e,o=y(n);for(let a=0;a<o.length;a++){const i=o[a];P(e,i),a===o.length-1?e[i]=r:f(e[i])||(e[i]=typeof o[a+1]=="number"?[]:{}),e=e[i]}return t}c($,"setProperty");s($,"setProperty");function C(e,n){if(!f(e)||typeof n!="string")return!1;const r=y(n);for(let t=0;t<r.length;t++){const o=r[t];if(P(e,o),t===r.length-1)return delete e[o],!0;if(e=e[o],!f(e))return!1}}c(C,"deleteProperty");s(C,"deleteProperty");function k(e,n){if(!f(e)||typeof n!="string")return!1;const r=y(n);if(r.length===0)return!1;for(const t of r){if(!f(e)||!(t in e)||h(e,t))return!1;e=e[t]}return!0}c(k,"hasProperty");s(k,"hasProperty");function j(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}c(j,"escapePath");s(j,"escapePath");function b(e){const n=Object.entries(e);return Array.isArray(e)?n.map(([r,t])=>[Number(r),t]):n}c(b,"h");s(b,"entries");function v(e){let n="";for(let[r,t]of b(e))typeof t=="number"?n+=`[${t}]`:(t=j(t),n+=r===0?t:`.${t}`);return n}c(v,"w");s(v,"stringifyPath");function*J(e,n=[]){if(!f(e)||O(e)){n.length>0&&(yield v(n));return}for(const[r,t]of b(e))yield*J(t,[...n,r])}c(J,"y");s(J,"deepKeysIterator");function F(e){return[...J(e)]}c(F,"deepKeys");s(F,"deepKeys");var K=Object.defineProperty,p=c((e,n)=>K(e,"name",{value:n,configurable:!0}),"s");const S=new Map,T=p(async(e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=await d.findUp("package.json",r);if(!t)throw new x.NotFoundError("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:S;if(n.cache&&o.has(t))return o.get(t);const a=await d.readJson(t);w(a);const i={packageJson:a,path:t};return o.set(t,i),i},"findPackageJson"),M=p((e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=d.findUpSync("package.json",r);if(!t)throw new x.NotFoundError("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:S;if(n.cache&&o.has(t))return o.get(t);const a=d.readJsonSync(t);w(a);const i={packageJson:a,path:t};return o.set(t,i),i},"findPackageJsonSync"),U=p(async(e,n={})=>{const{cwd:r,...t}=n,o=l.toPath(n.cwd??process.cwd());await d.writeJson(E.join(o,"package.json"),e,t)},"writePackageJson"),z=p((e,n={})=>{const{cwd:r,...t}=n,o=l.toPath(n.cwd??process.cwd());d.writeJsonSync(E.join(o,"package.json"),e,t)},"writePackageJsonSync"),B=p(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):A.existsSync(e)?d.readJsonSync(e):l.parseJson(e);return w(r),r},"parsePackageJson"),G=p((e,n,r)=>u(e,n,r),"getPackageJsonProperty"),H=p((e,n)=>k(e,n),"hasPackageJsonProperty"),L=p((e,n,r)=>{const t=u(e,"dependencies",{}),o=u(e,"devDependencies",{}),a=u(e,"peerDependencies",{}),i={...t,...o,...r?.peerDeps===!1?{}:a};for(const m of n)if(k(i,m))return!0;return!1},"hasPackageJsonAnyDependency");exports.findPackageJson=T;exports.findPackageJsonSync=M;exports.getPackageJsonProperty=G;exports.hasPackageJsonAnyDependency=L;exports.hasPackageJsonProperty=H;exports.parsePackageJson=B;exports.writePackageJson=U;exports.writePackageJsonSync=z;
|
package/dist/package-json.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, 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-CT7xU1f_.cjs';
|
|
2
2
|
import '@visulima/fs';
|
|
3
3
|
import 'normalize-package-data';
|
package/dist/package-json.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, 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-CT7xU1f_.mjs';
|
|
2
2
|
import '@visulima/fs';
|
|
3
3
|
import 'normalize-package-data';
|
package/dist/package-json.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, 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-CT7xU1f_.d.mjs';
|
|
2
2
|
import '@visulima/fs';
|
|
3
3
|
import 'normalize-package-data';
|
package/dist/package-json.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var S=Object.defineProperty;var c=(e,n)=>S(e,"name",{value:n,configurable:!0});import{existsSync as A}from"node:fs";import{findUp as N,readJson as O,findUpSync as $,readJsonSync as b,writeJson as D,writeJsonSync as _}from"@visulima/fs";import{NotFoundError as x}from"@visulima/fs/error";import{toPath as m,parseJson as K}from"@visulima/fs/utils";import{join as J}from"@visulima/path";import g from"normalize-package-data";var C=Object.defineProperty,i=c((e,n)=>C(e,"name",{value:n,configurable:!0}),"s$1");const f=i(e=>{const n=typeof e;return e!==null&&(n==="object"||n==="function")},"isObject"),F=i(e=>f(e)&&Object.keys(e).length===0,"isEmptyObject"),y=new Set(["__proto__","prototype","constructor"]),T=new Set("0123456789");function u(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(y.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(y.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"&&!T.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(y.has(r))return[];n.push(r);break}case"index":throw new Error("Index was not closed");case"start":{n.push("");break}}return n}c(u,"d");i(u,"getPathSegments");function h(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(h,"l");i(h,"isStringIndex");function l(e,n){if(h(e,n))throw new Error("Cannot use string index")}c(l,"p");i(l,"assertNotStringIndex");function d(e,n,r){if(!f(e)||typeof n!="string")return r===void 0?e:r;const t=u(n);if(t.length===0)return r;for(let o=0;o<t.length;o++){const a=t[o];if(h(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(d,"getProperty");i(d,"getProperty");function U(e,n,r){if(!f(e)||typeof n!="string")return e;const t=e,o=u(n);for(let a=0;a<o.length;a++){const s=o[a];l(e,s),a===o.length-1?e[s]=r:f(e[s])||(e[s]=typeof o[a+1]=="number"?[]:{}),e=e[s]}return t}c(U,"setProperty");i(U,"setProperty");function M(e,n){if(!f(e)||typeof n!="string")return!1;const r=u(n);for(let t=0;t<r.length;t++){const o=r[t];if(l(e,o),t===r.length-1)return delete e[o],!0;if(e=e[o],!f(e))return!1}}c(M,"deleteProperty");i(M,"deleteProperty");function w(e,n){if(!f(e)||typeof n!="string")return!1;const r=u(n);if(r.length===0)return!1;for(const t of r){if(!f(e)||!(t in e)||h(e,t))return!1;e=e[t]}return!0}c(w,"hasProperty");i(w,"hasProperty");function E(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replaceAll(/[\\.[]/g,"\\$&")}c(E,"escapePath");i(E,"escapePath");function k(e){const n=Object.entries(e);return Array.isArray(e)?n.map(([r,t])=>[Number(r),t]):n}c(k,"h");i(k,"entries");function v(e){let n="";for(let[r,t]of k(e))typeof t=="number"?n+=`[${t}]`:(t=E(t),n+=r===0?t:`.${t}`);return n}c(v,"w");i(v,"stringifyPath");function*P(e,n=[]){if(!f(e)||F(e)){n.length>0&&(yield v(n));return}for(const[r,t]of k(e))yield*P(t,[...n,r])}c(P,"y");i(P,"deepKeysIterator");function q(e){return[...P(e)]}c(q,"deepKeys");i(q,"deepKeys");var z=Object.defineProperty,p=c((e,n)=>z(e,"name",{value:n,configurable:!0}),"s");const j=new Map,W=p(async(e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=await N("package.json",r);if(!t)throw new x("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:j;if(n.cache&&o.has(t))return o.get(t);const a=await O(t);g(a);const s={packageJson:a,path:t};return o.set(t,s),s},"findPackageJson"),X=p((e,n={})=>{const r={type:"file"};e&&(r.cwd=e);const t=$("package.json",r);if(!t)throw new x("No such file or directory, for package.json found.");const o=n.cache&&typeof n.cache!="boolean"?n.cache:j;if(n.cache&&o.has(t))return o.get(t);const a=b(t);g(a);const s={packageJson:a,path:t};return o.set(t,s),s},"findPackageJsonSync"),Y=p(async(e,n={})=>{const{cwd:r,...t}=n,o=m(n.cwd??process.cwd());await D(J(o,"package.json"),e,t)},"writePackageJson"),Z=p((e,n={})=>{const{cwd:r,...t}=n,o=m(n.cwd??process.cwd());_(J(o,"package.json"),e,t)},"writePackageJsonSync"),ee=p(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):A(e)?b(e):K(e);return g(r),r},"parsePackageJson"),ne=p((e,n,r)=>d(e,n,r),"getPackageJsonProperty"),te=p((e,n)=>w(e,n),"hasPackageJsonProperty"),re=p((e,n,r)=>{const t=d(e,"dependencies",{}),o=d(e,"devDependencies",{}),a=d(e,"peerDependencies",{}),s={...t,...o,...r?.peerDeps===!1?{}:a};for(const I of n)if(w(s,I))return!0;return!1},"hasPackageJsonAnyDependency");export{W as findPackageJson,X as findPackageJsonSync,ne as getPackageJsonProperty,re as hasPackageJsonAnyDependency,te as hasPackageJsonProperty,ee as parsePackageJson,Y as writePackageJson,Z as writePackageJsonSync};
|
package/dist/package-manager.cjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.defineProperty;var l=(e,n)=>w(e,"name",{value:n,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("node:child_process"),p=require("node:fs"),o=require("@visulima/fs"),k=require("@visulima/fs/error"),i=require("@visulima/path"),f=require("./package-json.cjs");var v=Object.defineProperty,r=l((e,n)=>v(e,"name",{value:n,configurable:!0}),"r");const d=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],u=r(e=>{let n;if(d.forEach(t=>{!n&&p.existsSync(i.join(e,t))&&(n=i.join(e,t))}),n)return n;const a=i.join(e,"package.json");if(p.existsSync(a)&&f.parsePackageJson(p.readFileSync(a,"utf8")).packageManager!==void 0)return a},"packageMangerFindUpMatcher"),m=r(e=>{if(!e)throw new k.NotFoundError("Could not find a package manager");if(e.endsWith("package.json")){const n=f.parsePackageJson(e);if(n.packageManager){const a=["npm","yarn","pnpm","bun"].find(t=>n.packageManager.startsWith(t));if(a)return{packageManager:a,path:i.dirname(e)}}}if(e.endsWith("yarn.lock"))return{packageManager:"yarn",path:i.dirname(e)};if(e.endsWith("package-lock.json")||e.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:i.dirname(e)};if(e.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:i.dirname(e)};if(e.endsWith("bun.lockb"))return{packageManager:"bun",path:i.dirname(e)};throw new k.NotFoundError("Could not find a package manager")},"findPackageManagerOnFile"),S=r(async e=>{const n=await o.findUp(d,{type:"file",...e&&{cwd:e}});if(!n)throw new Error("Could not find lock file");return n},"findLockFile"),j=r(e=>{const n=o.findUpSync(d,{type:"file",...e&&{cwd:e}});if(!n)throw new Error("Could not find lock file");return n},"findLockFileSync"),b=r(async e=>{const n=await o.findUp(u,{...e&&{cwd:e}});return m(n)},"findPackageManager"),F=r(e=>{const n=o.findUpSync(u,{...e&&{cwd:e}});return m(n)},"findPackageManagerSync"),$=r(e=>P.execSync(`${e} --version`).toString("utf8").trim(),"getPackageManagerVersion"),_=r(async()=>{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))}},"identifyInitiatingPackageManager"),E=r((e,n,a)=>{const t=n.length===1?"":"s";if(a.packageManagers===void 0&&(a.packageManagers=["npm","pnpm","yarn"]),a.packageManagers.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 g=`
|
|
2
|
+
${a.preMessage??""}
|
|
3
|
+
${e} could not find the following package${t}
|
|
4
|
+
|
|
5
|
+
${n.join(`
|
|
6
|
+
`)}
|
|
7
|
+
|
|
8
|
+
To install the missing package${t}, please run the following command:
|
|
9
|
+
`;const M=r(s=>s.split("@").includes("@")?s:`${s}@latest`,"atLatest"),h=a.packageManagers.map(s=>{const c=n.map(y=>M(y)).join(" ");switch(s){case"bun":return` bun add ${c} -D`;case"npm":return` npm install ${c} --save-dev`;case"pnpm":return` pnpm add ${c} -D`;case"yarn":return` yarn add ${c} --dev`;default:throw new Error("Unknown package manager")}});return g+=h.join(`
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
`),a.postMessage&&(g+=a.postMessage),g},"generateMissingPackagesInstallMessage");exports.findLockFile=S;exports.findLockFileSync=j;exports.findPackageManager=b;exports.findPackageManagerSync=F;exports.generateMissingPackagesInstallMessage=E;exports.getPackageManagerVersion=$;exports.identifyInitiatingPackageManager=_;
|
|
@@ -12,5 +12,10 @@ declare const identifyInitiatingPackageManager: () => Promise<{
|
|
|
12
12
|
name: PackageManager | "cnpm";
|
|
13
13
|
version: string;
|
|
14
14
|
} | undefined>;
|
|
15
|
+
declare const generateMissingPackagesInstallMessage: (packageName: string, missingPackages: string[], options: {
|
|
16
|
+
packageManagers?: PackageManager[];
|
|
17
|
+
postMessage?: string;
|
|
18
|
+
preMessage?: string;
|
|
19
|
+
}) => string;
|
|
15
20
|
|
|
16
|
-
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager };
|
|
21
|
+
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager };
|
|
@@ -12,5 +12,10 @@ declare const identifyInitiatingPackageManager: () => Promise<{
|
|
|
12
12
|
name: PackageManager | "cnpm";
|
|
13
13
|
version: string;
|
|
14
14
|
} | undefined>;
|
|
15
|
+
declare const generateMissingPackagesInstallMessage: (packageName: string, missingPackages: string[], options: {
|
|
16
|
+
packageManagers?: PackageManager[];
|
|
17
|
+
postMessage?: string;
|
|
18
|
+
preMessage?: string;
|
|
19
|
+
}) => string;
|
|
15
20
|
|
|
16
|
-
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager };
|
|
21
|
+
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager };
|
|
@@ -12,5 +12,10 @@ declare const identifyInitiatingPackageManager: () => Promise<{
|
|
|
12
12
|
name: PackageManager | "cnpm";
|
|
13
13
|
version: string;
|
|
14
14
|
} | undefined>;
|
|
15
|
+
declare const generateMissingPackagesInstallMessage: (packageName: string, missingPackages: string[], options: {
|
|
16
|
+
packageManagers?: PackageManager[];
|
|
17
|
+
postMessage?: string;
|
|
18
|
+
preMessage?: string;
|
|
19
|
+
}) => string;
|
|
15
20
|
|
|
16
|
-
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, getPackageManagerVersion, identifyInitiatingPackageManager };
|
|
21
|
+
export { type PackageManager, type PackageManagerResult, findLockFile, findLockFileSync, findPackageManager, findPackageManagerSync, generateMissingPackagesInstallMessage, getPackageManagerVersion, identifyInitiatingPackageManager };
|
package/dist/package-manager.mjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var l=(n,a)=>P(n,"name",{value:a,configurable:!0});import{execSync as j}from"node:child_process";import{existsSync as d,readFileSync as $}from"node:fs";import{findUp as k,findUpSync as m}from"@visulima/fs";import{NotFoundError as f}from"@visulima/fs/error";import{join as g,dirname as o}from"@visulima/path";import{parsePackageJson as u}from"./package-json.mjs";var b=Object.defineProperty,r=l((n,a)=>b(n,"name",{value:a,configurable:!0}),"r");const p=["yarn.lock","package-lock.json","pnpm-lock.yaml","npm-shrinkwrap.json","bun.lockb"],h=r(n=>{let a;if(p.forEach(t=>{!a&&d(g(n,t))&&(a=g(n,t))}),a)return a;const e=g(n,"package.json");if(d(e)&&u($(e,"utf8")).packageManager!==void 0)return e},"packageMangerFindUpMatcher"),M=r(n=>{if(!n)throw new f("Could not find a package manager");if(n.endsWith("package.json")){const a=u(n);if(a.packageManager){const e=["npm","yarn","pnpm","bun"].find(t=>a.packageManager.startsWith(t));if(e)return{packageManager:e,path:o(n)}}}if(n.endsWith("yarn.lock"))return{packageManager:"yarn",path:o(n)};if(n.endsWith("package-lock.json")||n.endsWith("npm-shrinkwrap.json"))return{packageManager:"npm",path:o(n)};if(n.endsWith("pnpm-lock.yaml"))return{packageManager:"pnpm",path:o(n)};if(n.endsWith("bun.lockb"))return{packageManager:"bun",path:o(n)};throw new f("Could not find a package manager")},"findPackageManagerOnFile"),L=r(async n=>{const a=await k(p,{type:"file",...n&&{cwd:n}});if(!a)throw new Error("Could not find lock file");return a},"findLockFile"),C=r(n=>{const a=m(p,{type:"file",...n&&{cwd:n}});if(!a)throw new Error("Could not find lock file");return a},"findLockFileSync"),U=r(async n=>{const a=await k(h,{...n&&{cwd:n}});return M(a)},"findPackageManager"),N=r(n=>{const a=m(h,{...n&&{cwd:n}});return M(a)},"findPackageManagerSync"),O=r(n=>j(`${n} --version`).toString("utf8").trim(),"getPackageManagerVersion"),D=r(async()=>{if(!process.env.npm_config_user_agent)return;const n=process.env.npm_config_user_agent.split(" ")[0],a=n.lastIndexOf("/"),e=n.slice(0,Math.max(0,a));return{name:e==="npminstall"?"cnpm":e,version:n.slice(Math.max(0,a+1))}},"identifyInitiatingPackageManager"),V=r((n,a,e)=>{const t=a.length===1?"":"s";if(e.packageManagers===void 0&&(e.packageManagers=["npm","pnpm","yarn"]),e.packageManagers.length===0)throw new Error("No package managers provided, please provide at least one package manager");if(a.length===0)throw new Error("No missing packages provided, please provide at least one missing package");let c=`
|
|
2
|
+
${e.preMessage??""}
|
|
3
|
+
${n} could not find the following package${t}
|
|
4
|
+
|
|
5
|
+
${a.join(`
|
|
6
|
+
`)}
|
|
7
|
+
|
|
8
|
+
To install the missing package${t}, please run the following command:
|
|
9
|
+
`;const w=r(i=>i.split("@").includes("@")?i:`${i}@latest`,"atLatest"),y=e.packageManagers.map(i=>{const s=a.map(v=>w(v)).join(" ");switch(i){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 c+=y.join(`
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
`),e.postMessage&&(c+=e.postMessage),c},"generateMissingPackagesInstallMessage");export{L as findLockFile,C as findLockFileSync,U as findPackageManager,N as findPackageManagerSync,V as generateMissingPackagesInstallMessage,O as getPackageManagerVersion,D as identifyInitiatingPackageManager};
|
|
@@ -178,6 +178,10 @@ type VariablePartOfArray<T extends UnknownArray> =
|
|
|
178
178
|
: []
|
|
179
179
|
: never;
|
|
180
180
|
|
|
181
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
182
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
183
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
184
|
+
|
|
181
185
|
/**
|
|
182
186
|
Returns a boolean for whether the given type is `any`.
|
|
183
187
|
|
|
@@ -206,7 +210,7 @@ const anyA = get(anyObject, 'a');
|
|
|
206
210
|
@category Type Guard
|
|
207
211
|
@category Utilities
|
|
208
212
|
*/
|
|
209
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
213
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
210
214
|
|
|
211
215
|
type Numeric = number | bigint;
|
|
212
216
|
|
|
@@ -178,6 +178,10 @@ type VariablePartOfArray<T extends UnknownArray> =
|
|
|
178
178
|
: []
|
|
179
179
|
: never;
|
|
180
180
|
|
|
181
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
182
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
183
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
184
|
+
|
|
181
185
|
/**
|
|
182
186
|
Returns a boolean for whether the given type is `any`.
|
|
183
187
|
|
|
@@ -206,7 +210,7 @@ const anyA = get(anyObject, 'a');
|
|
|
206
210
|
@category Type Guard
|
|
207
211
|
@category Utilities
|
|
208
212
|
*/
|
|
209
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
213
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
210
214
|
|
|
211
215
|
type Numeric = number | bigint;
|
|
212
216
|
|
|
@@ -178,6 +178,10 @@ type VariablePartOfArray<T extends UnknownArray> =
|
|
|
178
178
|
: []
|
|
179
179
|
: never;
|
|
180
180
|
|
|
181
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
182
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
183
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
184
|
+
|
|
181
185
|
/**
|
|
182
186
|
Returns a boolean for whether the given type is `any`.
|
|
183
187
|
|
|
@@ -206,7 +210,7 @@ const anyA = get(anyObject, 'a');
|
|
|
206
210
|
@category Type Guard
|
|
207
211
|
@category Utilities
|
|
208
212
|
*/
|
|
209
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
213
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
210
214
|
|
|
211
215
|
type Numeric = number | bigint;
|
|
212
216
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/package",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "One Package to rule them all, finds your root-dir, monorepo, or package manager.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -145,25 +145,25 @@
|
|
|
145
145
|
"LICENSE.md"
|
|
146
146
|
],
|
|
147
147
|
"dependencies": {
|
|
148
|
-
"@visulima/fs": "2.3.
|
|
149
|
-
"@visulima/path": "1.1.
|
|
148
|
+
"@visulima/fs": "2.3.1",
|
|
149
|
+
"@visulima/path": "1.1.2",
|
|
150
150
|
"normalize-package-data": "^7.0.0"
|
|
151
151
|
},
|
|
152
152
|
"devDependencies": {
|
|
153
153
|
"@anolilab/eslint-config": "^15.0.3",
|
|
154
154
|
"@anolilab/prettier-config": "^5.0.14",
|
|
155
|
-
"@anolilab/semantic-release-pnpm": "^1.1.
|
|
156
|
-
"@anolilab/semantic-release-preset": "^9.0.
|
|
157
|
-
"@arethetypeswrong/cli": "^0.
|
|
158
|
-
"@babel/core": "^7.
|
|
159
|
-
"@pnpm/exe": "^9.
|
|
155
|
+
"@anolilab/semantic-release-pnpm": "^1.1.5",
|
|
156
|
+
"@anolilab/semantic-release-preset": "^9.0.2",
|
|
157
|
+
"@arethetypeswrong/cli": "^0.17.1",
|
|
158
|
+
"@babel/core": "^7.26.0",
|
|
159
|
+
"@pnpm/exe": "^9.15.0",
|
|
160
160
|
"@rushstack/eslint-plugin-security": "^0.8.3",
|
|
161
161
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
162
162
|
"@types/node": "18.19.15",
|
|
163
163
|
"@types/normalize-package-data": "^2.4.4",
|
|
164
|
-
"@visulima/packem": "1.
|
|
165
|
-
"@vitest/coverage-v8": "^2.1.
|
|
166
|
-
"@vitest/ui": "^2.1.
|
|
164
|
+
"@visulima/packem": "1.9.2",
|
|
165
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
166
|
+
"@vitest/ui": "^2.1.8",
|
|
167
167
|
"@yarnpkg/pnp": "4.0.6",
|
|
168
168
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
169
169
|
"cross-env": "^7.0.3",
|
|
@@ -176,20 +176,19 @@
|
|
|
176
176
|
"eslint-plugin-mdx": "^3.1.5",
|
|
177
177
|
"eslint-plugin-vitest": "^0.4.1",
|
|
178
178
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
179
|
-
"execa": "^9.
|
|
180
|
-
"npm": "^10.9.
|
|
181
|
-
"prettier": "^3.
|
|
179
|
+
"execa": "^9.5.2",
|
|
180
|
+
"npm": "^10.9.2",
|
|
181
|
+
"prettier": "^3.4.2",
|
|
182
182
|
"rimraf": "5.0.9",
|
|
183
183
|
"semantic-release": "24.0.0",
|
|
184
184
|
"tempy": "^3.1.0",
|
|
185
|
-
"type-fest": "^4.
|
|
185
|
+
"type-fest": "^4.30.0",
|
|
186
186
|
"typescript": "5.4.5",
|
|
187
|
-
"vitest": "^2.1.
|
|
188
|
-
"which-pm-runs": "file:",
|
|
187
|
+
"vitest": "^2.1.8",
|
|
189
188
|
"yarn": "^1.22.22"
|
|
190
189
|
},
|
|
191
190
|
"engines": {
|
|
192
|
-
"node": ">=18.* <=
|
|
191
|
+
"node": ">=18.* <=23.*"
|
|
193
192
|
},
|
|
194
193
|
"os": [
|
|
195
194
|
"darwin",
|