@escapace/pnpm-pack 0.1.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/LICENSE ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # pnpm-pack
@@ -0,0 +1,336 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __esm = (fn, res) => function() {
4
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
+ };
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ };
10
+
11
+ // src/utilities/get-name-archive.ts
12
+ function getNameArchive(value) {
13
+ return `${value.name.replace("@", "").replace("/", "-")}-${value.version}.tgz`;
14
+ }
15
+ var init_get_name_archive = __esm({
16
+ "src/utilities/get-name-archive.ts"() {
17
+ "use strict";
18
+ }
19
+ });
20
+
21
+ // src/utilities/get-path-directory-workspace.ts
22
+ import assert from "node:assert";
23
+ import { findUp } from "find-up";
24
+ import path from "path";
25
+ async function getPathDirectoryWorkspace(cwd) {
26
+ assert(typeof cwd == "string");
27
+ let pathFileWorkspaceYaml = await findUp("pnpm-workspace.yaml", {
28
+ cwd,
29
+ type: "file"
30
+ });
31
+ return assert(typeof pathFileWorkspaceYaml == "string"), path.dirname(pathFileWorkspaceYaml);
32
+ }
33
+ var init_get_path_directory_workspace = __esm({
34
+ "src/utilities/get-path-directory-workspace.ts"() {
35
+ "use strict";
36
+ }
37
+ });
38
+
39
+ // src/utilities/read-package-json.ts
40
+ import path2 from "path";
41
+ import fse from "fs-extra";
42
+ import assert2 from "assert";
43
+ import { readFile } from "fs/promises";
44
+ async function readPackageJSON(directory) {
45
+ let pathPackageJSON = path2.join(directory, "package.json");
46
+ assert2(fse.exists(pathPackageJSON));
47
+ let content = await readFile(pathPackageJSON, "utf8");
48
+ assert2(typeof content == "string");
49
+ let packageJSON = JSON.parse(content);
50
+ return assert2(typeof packageJSON == "object"), assert2(typeof packageJSON.name == "string"), packageJSON;
51
+ }
52
+ var init_read_package_json = __esm({
53
+ "src/utilities/read-package-json.ts"() {
54
+ "use strict";
55
+ }
56
+ });
57
+
58
+ // src/pack-workspace.ts
59
+ var pack_workspace_exports = {};
60
+ __export(pack_workspace_exports, {
61
+ packWorkspace: () => packWorkspace
62
+ });
63
+ import arg from "arg";
64
+ import { execa } from "execa";
65
+ import fse2 from "fs-extra";
66
+ import assert3 from "node:assert";
67
+ import { mkdtemp } from "node:fs/promises";
68
+ import { isNativeError as isNativeError2 } from "node:util/types";
69
+ import os from "os";
70
+ import path3 from "path";
71
+ import semver from "semver";
72
+ import { fileURLToPath } from "url";
73
+ import {
74
+ readWantedLockfileAndAutofixConflicts,
75
+ writeWantedLockfile
76
+ } from "@pnpm/lockfile-file";
77
+ import { mapValues } from "lodash-es";
78
+ async function packWorkspace() {
79
+ let error2, pathDirectoryTemporary, cwd = await getPathDirectoryWorkspace(process.cwd());
80
+ process.chdir(cwd);
81
+ let options = arg(
82
+ {
83
+ "--changed-files-ignore-pattern": String,
84
+ "--filter": [String],
85
+ "--filter-prod": [String],
86
+ "--pack-destination": String,
87
+ "--test-pattern": String,
88
+ "--version": String,
89
+ "--workspace-concurrency": Number
90
+ },
91
+ { permissive: !1 }
92
+ ), version = options["--version"] ?? "0.0.0";
93
+ assert3(typeof semver.valid(version) == "string");
94
+ let pathDirectoryDestination = path3.resolve(
95
+ cwd,
96
+ options["--pack-destination"] ?? "lib"
97
+ ), packageJSON = await readPackageJSON(cwd), nameArchive = getNameArchive({ name: packageJSON.name, version }), filters = [
98
+ ...Array.isArray(options["--filter-prod"]) ? options["--filter-prod"].flatMap((value) => ["--filter-prod", value]) : [],
99
+ ...Array.isArray(options["--filter"]) ? options["--filter"].flatMap((value) => ["--filter", value]) : []
100
+ ].filter((value) => typeof value == "string"), pnpmExecArguments = [
101
+ "--fail-if-no-match",
102
+ "--workspace-root",
103
+ typeof options["--workspace-concurrency"] == "number" ? `--workspace-concurrency=${options["--workspace-concurrency"]}` : void 0,
104
+ typeof options["--test-pattern"] == "string" ? `--test-pattern=${options["--test-pattern"]}` : void 0,
105
+ typeof options["--changed-files-ignore-pattern"] == "string" ? `--changed-files-ignore-pattern=${options["--changed-files-ignore-pattern"]}` : void 0,
106
+ ...filters.length === 0 ? ["--filter", "*"] : filters,
107
+ "exec",
108
+ "node",
109
+ fileURLToPath(import.meta.url)
110
+ ];
111
+ try {
112
+ pathDirectoryTemporary = await mkdtemp(path3.join(os.tmpdir(), "pnpm-pack")), assert3(typeof pathDirectoryTemporary == "string"), await execa(
113
+ "pnpm",
114
+ [
115
+ ...pnpmExecArguments,
116
+ "package",
117
+ "--no-cleanup",
118
+ "--temporary-directory",
119
+ pathDirectoryTemporary,
120
+ "--version",
121
+ version
122
+ ].filter((value) => typeof value == "string"),
123
+ {
124
+ stdio: "inherit",
125
+ cwd
126
+ }
127
+ );
128
+ let directoryPathContext = path3.join(pathDirectoryTemporary, "package"), pathFileArchive = path3.join(pathDirectoryTemporary, nameArchive);
129
+ assert3(fse2.exists(directoryPathContext)), assert3(fse2.exists(pathFileArchive)), await execa("pnpm", ["install", "--lockfile-only", "--ignore-scripts"], {
130
+ stdio: "inherit",
131
+ cwd
132
+ });
133
+ let { lockfile } = await readWantedLockfileAndAutofixConflicts(
134
+ directoryPathContext,
135
+ { ignoreIncompatible: !1 }
136
+ );
137
+ assert3(lockfile !== null);
138
+ let importers = mapValues(lockfile.importers, (value) => ({
139
+ ...value,
140
+ specifiers: mapValues(value.specifiers, (value2) => value2.startsWith("workspace:") ? version : value2)
141
+ }));
142
+ lockfile.importers = importers, await writeWantedLockfile(directoryPathContext, lockfile), await execa(
143
+ "tar",
144
+ ["-czf", pathFileArchive, "-C", pathDirectoryTemporary, "package"],
145
+ {
146
+ stdio: "inherit",
147
+ cwd
148
+ }
149
+ ), await fse2.remove(directoryPathContext), await fse2.mkdirp(pathDirectoryDestination), await fse2.move(
150
+ pathFileArchive,
151
+ path3.join(pathDirectoryDestination, nameArchive),
152
+ { overwrite: !0 }
153
+ );
154
+ } catch (e) {
155
+ error2 = isNativeError2(e) ? e : new Error("Unknown Error");
156
+ }
157
+ return await execa(
158
+ "pnpm",
159
+ [...pnpmExecArguments, "cleanup"].filter(
160
+ (value) => typeof value == "string"
161
+ ),
162
+ {
163
+ stdio: "inherit",
164
+ cwd
165
+ }
166
+ ), await execa("pnpm", ["install", "--lockfile-only", "--ignore-scripts"], {
167
+ stdio: "inherit",
168
+ cwd
169
+ }), typeof pathDirectoryTemporary == "string" && await fse2.remove(pathDirectoryTemporary), error2;
170
+ }
171
+ var init_pack_workspace = __esm({
172
+ "src/pack-workspace.ts"() {
173
+ "use strict";
174
+ init_get_name_archive();
175
+ init_get_path_directory_workspace();
176
+ init_read_package_json();
177
+ }
178
+ });
179
+
180
+ // src/utilities/get-path-directory-package.ts
181
+ import assert4 from "node:assert";
182
+ import { findUp as findUp2 } from "find-up";
183
+ import path4 from "path";
184
+ async function getPathDirectoryPackage(cwd) {
185
+ assert4(typeof cwd == "string");
186
+ let pathFilePackageJSON = await findUp2("package.json", {
187
+ cwd,
188
+ type: "file"
189
+ });
190
+ return assert4(typeof pathFilePackageJSON == "string"), path4.dirname(pathFilePackageJSON);
191
+ }
192
+ var init_get_path_directory_package = __esm({
193
+ "src/utilities/get-path-directory-package.ts"() {
194
+ "use strict";
195
+ }
196
+ });
197
+
198
+ // src/pack-package.ts
199
+ var pack_package_exports = {};
200
+ __export(pack_package_exports, {
201
+ packPackage: () => packPackage
202
+ });
203
+ import arg2 from "arg";
204
+ import { execa as execa2 } from "execa";
205
+ import fse3 from "fs-extra";
206
+ import assert5 from "node:assert";
207
+ import { mkdtemp as mkdtemp2, writeFile } from "node:fs/promises";
208
+ import os2 from "node:os";
209
+ import path5 from "node:path";
210
+ import { isNativeError as isNativeError3 } from "node:util/types";
211
+ import process2 from "process";
212
+ import semver2 from "semver";
213
+ async function packPackage() {
214
+ let error2, pathDirectoryTemporary, options = arg2({
215
+ "--no-cleanup": Boolean,
216
+ "--pack-destination": String,
217
+ "--temporary-directory": String,
218
+ "--version": String
219
+ }), cleanup = options["--no-cleanup"] !== !0, pathDirectoryPackage = await getPathDirectoryPackage(process2.cwd()), pathDirectoryRoot = await getPathDirectoryWorkspace(pathDirectoryPackage);
220
+ process2.chdir(pathDirectoryPackage);
221
+ let pathDirectoryDestination = path5.resolve(
222
+ pathDirectoryPackage,
223
+ options["--pack-destination"] ?? "lib"
224
+ ), pathDirectoryPackageRelative = path5.relative(
225
+ pathDirectoryRoot,
226
+ pathDirectoryPackage
227
+ ), isRoot = pathDirectoryPackageRelative === "", pathPackageJSON = path5.join(pathDirectoryPackage, "package.json"), packageJSON = await readPackageJSON(pathDirectoryPackage), version = options["--version"] ?? "0.0.0";
228
+ assert5(typeof semver2.valid(version) == "string"), await writeFile(
229
+ pathPackageJSON,
230
+ JSON.stringify(Object.assign(packageJSON, { version }), null, 2)
231
+ );
232
+ try {
233
+ pathDirectoryTemporary = typeof options["--temporary-directory"] == "string" ? path5.resolve(pathDirectoryPackage, options["--temporary-directory"]) : await mkdtemp2(path5.join(os2.tmpdir(), "pnpm-pack"));
234
+ let pathDirectoryContext = path5.join(pathDirectoryTemporary, "package"), nameArchive = getNameArchive({ name: packageJSON.name, version }), pathFileArchive = path5.join(pathDirectoryTemporary, nameArchive);
235
+ await execa2(
236
+ "pnpm",
237
+ ["pack", "--pack-destination", pathDirectoryTemporary],
238
+ {
239
+ stdio: "inherit"
240
+ }
241
+ ), assert5(fse3.exists(pathFileArchive));
242
+ let pathDirectoryPackageContext = path5.join(
243
+ pathDirectoryContext,
244
+ pathDirectoryPackageRelative
245
+ );
246
+ await fse3.mkdirp(pathDirectoryPackageContext), await execa2(
247
+ "tar",
248
+ [
249
+ "-xf",
250
+ pathFileArchive,
251
+ "--strip-components=1",
252
+ "-C",
253
+ pathDirectoryPackageContext
254
+ ],
255
+ {
256
+ stdio: "inherit"
257
+ }
258
+ ), isRoot ? await fse3.remove(pathFileArchive) : (await fse3.mkdirp(pathDirectoryPackageContext), await fse3.move(
259
+ pathFileArchive,
260
+ path5.join(pathDirectoryDestination, nameArchive),
261
+ { overwrite: !0 }
262
+ ));
263
+ } catch (e) {
264
+ error2 = isNativeError3(e) ? e : new Error("Unknown Error");
265
+ }
266
+ return cleanup && (await writeFile(
267
+ pathPackageJSON,
268
+ JSON.stringify(Object.assign(packageJSON, { version: "0.0.0" }), null, 2)
269
+ ), typeof pathDirectoryTemporary == "string" && await fse3.remove(pathDirectoryTemporary)), error2;
270
+ }
271
+ var init_pack_package = __esm({
272
+ "src/pack-package.ts"() {
273
+ "use strict";
274
+ init_get_name_archive();
275
+ init_get_path_directory_package();
276
+ init_get_path_directory_workspace();
277
+ init_read_package_json();
278
+ }
279
+ });
280
+
281
+ // src/pack-cleanup.ts
282
+ var pack_cleanup_exports = {};
283
+ __export(pack_cleanup_exports, {
284
+ packCleanup: () => packCleanup
285
+ });
286
+ import { writeFile as writeFile2 } from "node:fs/promises";
287
+ import path6 from "node:path";
288
+ import process3 from "process";
289
+ async function packCleanup() {
290
+ let pathDirectoryPackage = await getPathDirectoryPackage(process3.cwd());
291
+ process3.chdir(pathDirectoryPackage);
292
+ let pathPackageJSON = path6.join(pathDirectoryPackage, "package.json"), packageJSON = await readPackageJSON(pathDirectoryPackage);
293
+ await writeFile2(
294
+ pathPackageJSON,
295
+ JSON.stringify(Object.assign(packageJSON, { version: "0.0.0" }), null, 2)
296
+ );
297
+ }
298
+ var init_pack_cleanup = __esm({
299
+ "src/pack-cleanup.ts"() {
300
+ "use strict";
301
+ init_get_path_directory_package();
302
+ init_read_package_json();
303
+ }
304
+ });
305
+
306
+ // src/index.ts
307
+ import arg3 from "arg";
308
+ import assert6 from "assert";
309
+
310
+ // src/utilities/assert-requirements.ts
311
+ import which from "which";
312
+ async function assertRequirements() {
313
+ await which("tar"), await which("pnpm");
314
+ }
315
+
316
+ // src/utilities/exit.ts
317
+ import { isNativeError } from "util/types";
318
+ function exit(error2) {
319
+ error2 !== void 0 && (console.error(isNativeError(error2) ? error2.message : "Unknown Error"), process.exit(1));
320
+ }
321
+
322
+ // src/index.ts
323
+ await assertRequirements();
324
+ var { _ } = arg3({}, { permissive: !0 });
325
+ assert6(_.length = 1);
326
+ var command = _[0];
327
+ assert6(
328
+ command === "workspace" || command === "package" || command === "cleanup"
329
+ );
330
+ var run = await {
331
+ workspace: async () => (await Promise.resolve().then(() => (init_pack_workspace(), pack_workspace_exports))).packWorkspace,
332
+ package: async () => (await Promise.resolve().then(() => (init_pack_package(), pack_package_exports))).packPackage,
333
+ cleanup: async () => (await Promise.resolve().then(() => (init_pack_cleanup(), pack_cleanup_exports))).packCleanup
334
+ }[command](), error = await run();
335
+ exit(error);
336
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utilities/get-name-archive.ts", "../../src/utilities/get-path-directory-workspace.ts", "../../src/utilities/read-package-json.ts", "../../src/pack-workspace.ts", "../../src/utilities/get-path-directory-package.ts", "../../src/pack-package.ts", "../../src/pack-cleanup.ts", "../../src/index.ts", "../../src/utilities/assert-requirements.ts", "../../src/utilities/exit.ts"],
4
+ "sourcesContent": ["export function getNameArchive(value: { name: string; version: string }) {\n // https://github.com/pnpm/pnpm/blob/6caec8109b563fd27ad262ce06a1f587cebbc044/releasing/plugin-commands-publishing/src/pack.ts#L98C1-L98C100\n return `${value.name.replace('@', '').replace('/', '-')}-${value.version}.tgz`\n}\n", "import assert from 'node:assert'\nimport { findUp } from 'find-up'\nimport path from 'path'\n\nexport async function getPathDirectoryWorkspace(cwd: string) {\n assert(typeof cwd === 'string')\n const pathFileWorkspaceYaml = await findUp('pnpm-workspace.yaml', {\n cwd,\n type: 'file'\n })\n\n assert(typeof pathFileWorkspaceYaml === 'string')\n return path.dirname(pathFileWorkspaceYaml)\n}\n", "import path from 'path'\nimport fse from 'fs-extra'\nimport assert from 'assert'\nimport { readFile } from 'fs/promises'\n\nexport async function readPackageJSON(directory: string) {\n const pathPackageJSON = path.join(directory, 'package.json')\n assert(fse.exists(pathPackageJSON))\n const content = await readFile(pathPackageJSON, 'utf8')\n assert(typeof content === 'string')\n const packageJSON = JSON.parse(content) as { name: string }\n assert(typeof packageJSON === 'object')\n assert(typeof packageJSON.name === 'string')\n\n return packageJSON\n}\n", "import arg from 'arg'\nimport { execa } from 'execa'\nimport fse from 'fs-extra'\nimport assert from 'node:assert'\nimport { mkdtemp } from 'node:fs/promises'\nimport { isNativeError } from 'node:util/types'\nimport os from 'os'\nimport path from 'path'\nimport semver from 'semver'\nimport { fileURLToPath } from 'url'\nimport { getNameArchive } from './utilities/get-name-archive'\nimport { getPathDirectoryWorkspace } from './utilities/get-path-directory-workspace'\nimport { readPackageJSON } from './utilities/read-package-json'\nimport {\n readWantedLockfileAndAutofixConflicts,\n writeWantedLockfile\n} from '@pnpm/lockfile-file'\nimport { mapValues } from 'lodash-es'\n\nexport async function packWorkspace() {\n let error: Error | undefined\n let pathDirectoryTemporary: string | undefined\n\n const cwd = await getPathDirectoryWorkspace(process.cwd())\n process.chdir(cwd)\n\n // https://pnpm.io/filtering\n const options = arg(\n {\n '--changed-files-ignore-pattern': String,\n '--filter': [String],\n '--filter-prod': [String],\n '--pack-destination': String,\n '--test-pattern': String,\n '--version': String,\n '--workspace-concurrency': Number\n },\n { permissive: false }\n )\n\n const version = options['--version'] ?? '0.0.0'\n assert(typeof semver.valid(version) === 'string')\n\n const pathDirectoryDestination = path.resolve(\n cwd,\n options['--pack-destination'] ?? 'lib'\n )\n\n const packageJSON = await readPackageJSON(cwd)\n const nameArchive = getNameArchive({ name: packageJSON.name, version })\n\n const filters = [\n ...(Array.isArray(options['--filter-prod'])\n ? options['--filter-prod'].flatMap((value) => ['--filter-prod', value])\n : []),\n ...(Array.isArray(options['--filter'])\n ? options['--filter'].flatMap((value) => ['--filter', value])\n : [])\n ].filter((value): value is string => typeof value === 'string')\n\n const pnpmExecArguments = [\n '--fail-if-no-match',\n '--workspace-root',\n typeof options['--workspace-concurrency'] === 'number'\n ? `--workspace-concurrency=${options['--workspace-concurrency']}`\n : undefined,\n typeof options['--test-pattern'] === 'string'\n ? `--test-pattern=${options['--test-pattern']}`\n : undefined,\n typeof options['--changed-files-ignore-pattern'] === 'string'\n ? `--changed-files-ignore-pattern=${options['--changed-files-ignore-pattern']}`\n : undefined,\n ...(filters.length === 0 ? ['--filter', '*'] : filters),\n 'exec',\n 'node',\n fileURLToPath(import.meta.url)\n ]\n\n try {\n pathDirectoryTemporary = await mkdtemp(path.join(os.tmpdir(), 'pnpm-pack'))\n\n assert(typeof pathDirectoryTemporary === 'string')\n\n await execa(\n 'pnpm',\n [\n ...pnpmExecArguments,\n 'package',\n '--no-cleanup',\n '--temporary-directory',\n pathDirectoryTemporary,\n '--version',\n version\n ].filter((value): value is string => typeof value === 'string'),\n {\n stdio: 'inherit',\n cwd\n }\n )\n\n const directoryPathContext = path.join(pathDirectoryTemporary, 'package')\n const pathFileArchive = path.join(pathDirectoryTemporary, nameArchive)\n\n assert(fse.exists(directoryPathContext))\n assert(fse.exists(pathFileArchive))\n\n await execa('pnpm', ['install', '--lockfile-only', '--ignore-scripts'], {\n stdio: 'inherit',\n cwd\n })\n\n const { lockfile } = await readWantedLockfileAndAutofixConflicts(\n directoryPathContext,\n { ignoreIncompatible: false }\n )\n\n assert(lockfile !== null)\n\n const importers = mapValues(lockfile.importers, (value) => ({\n ...value,\n specifiers: mapValues(value.specifiers, (value) => {\n if (value.startsWith('workspace:')) {\n return version\n }\n\n return value\n })\n }))\n\n lockfile.importers = importers\n\n await writeWantedLockfile(directoryPathContext, lockfile)\n\n await execa(\n 'tar',\n ['-czf', pathFileArchive, '-C', pathDirectoryTemporary, 'package'],\n {\n stdio: 'inherit',\n cwd\n }\n )\n\n await fse.remove(directoryPathContext)\n await fse.mkdirp(pathDirectoryDestination)\n await fse.move(\n pathFileArchive,\n path.join(pathDirectoryDestination, nameArchive),\n { overwrite: true }\n )\n } catch (e) {\n error = isNativeError(e) ? e : new Error('Unknown Error')\n }\n\n await execa(\n 'pnpm',\n [...pnpmExecArguments, 'cleanup'].filter(\n (value): value is string => typeof value === 'string'\n ),\n {\n stdio: 'inherit',\n cwd\n }\n )\n\n await execa('pnpm', ['install', '--lockfile-only', '--ignore-scripts'], {\n stdio: 'inherit',\n cwd\n })\n\n if (typeof pathDirectoryTemporary === 'string') {\n await fse.remove(pathDirectoryTemporary)\n }\n\n return error\n}\n", "import assert from 'node:assert'\nimport { findUp } from 'find-up'\nimport path from 'path'\n\nexport async function getPathDirectoryPackage(cwd: string) {\n assert(typeof cwd === 'string')\n const pathFilePackageJSON = await findUp('package.json', {\n cwd,\n type: 'file'\n })\n\n assert(typeof pathFilePackageJSON === 'string')\n return path.dirname(pathFilePackageJSON)\n}\n", "import arg from 'arg'\nimport { execa } from 'execa'\nimport fse from 'fs-extra'\nimport assert from 'node:assert'\nimport { mkdtemp, writeFile } from 'node:fs/promises'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { isNativeError } from 'node:util/types'\nimport process from 'process'\nimport semver from 'semver'\nimport { getNameArchive } from './utilities/get-name-archive'\nimport { getPathDirectoryPackage } from './utilities/get-path-directory-package'\nimport { getPathDirectoryWorkspace } from './utilities/get-path-directory-workspace'\nimport { readPackageJSON } from './utilities/read-package-json'\n\nexport async function packPackage() {\n let error: Error | undefined\n let pathDirectoryTemporary: string | undefined\n\n const options = arg({\n '--no-cleanup': Boolean,\n '--pack-destination': String,\n '--temporary-directory': String,\n '--version': String\n })\n\n const cleanup = options['--no-cleanup'] !== true\n\n const pathDirectoryPackage = await getPathDirectoryPackage(process.cwd())\n const pathDirectoryRoot =\n await getPathDirectoryWorkspace(pathDirectoryPackage)\n\n process.chdir(pathDirectoryPackage)\n\n const pathDirectoryDestination = path.resolve(\n pathDirectoryPackage,\n options['--pack-destination'] ?? 'lib'\n )\n\n const pathDirectoryPackageRelative = path.relative(\n pathDirectoryRoot,\n pathDirectoryPackage\n )\n\n const isRoot = pathDirectoryPackageRelative === ''\n const pathPackageJSON = path.join(pathDirectoryPackage, 'package.json')\n const packageJSON = await readPackageJSON(pathDirectoryPackage)\n\n const version = options['--version'] ?? '0.0.0'\n\n assert(typeof semver.valid(version) === 'string')\n\n await writeFile(\n pathPackageJSON,\n JSON.stringify(Object.assign(packageJSON, { version }), null, 2)\n )\n\n try {\n pathDirectoryTemporary =\n typeof options['--temporary-directory'] === 'string'\n ? path.resolve(pathDirectoryPackage, options['--temporary-directory'])\n : await mkdtemp(path.join(os.tmpdir(), 'pnpm-pack'))\n\n const pathDirectoryContext = path.join(pathDirectoryTemporary, 'package')\n\n // https://github.com/pnpm/pnpm/blob/6caec8109b563fd27ad262ce06a1f587cebbc044/releasing/plugin-commands-publishing/src/pack.ts#L98C1-L98C100\n const nameArchive = getNameArchive({ name: packageJSON.name, version })\n const pathFileArchive = path.join(pathDirectoryTemporary, nameArchive)\n\n await execa(\n 'pnpm',\n ['pack', '--pack-destination', pathDirectoryTemporary],\n {\n stdio: 'inherit'\n }\n )\n assert(fse.exists(pathFileArchive))\n const pathDirectoryPackageContext = path.join(\n pathDirectoryContext,\n pathDirectoryPackageRelative\n )\n await fse.mkdirp(pathDirectoryPackageContext)\n await execa(\n 'tar',\n [\n '-xf',\n pathFileArchive,\n '--strip-components=1',\n '-C',\n pathDirectoryPackageContext\n ],\n {\n stdio: 'inherit'\n }\n )\n\n if (isRoot) {\n await fse.remove(pathFileArchive)\n } else {\n await fse.mkdirp(pathDirectoryPackageContext)\n await fse.move(\n pathFileArchive,\n path.join(pathDirectoryDestination, nameArchive),\n { overwrite: true }\n )\n }\n } catch (e) {\n error = isNativeError(e) ? e : new Error('Unknown Error')\n }\n\n if (cleanup) {\n await writeFile(\n pathPackageJSON,\n JSON.stringify(Object.assign(packageJSON, { version: '0.0.0' }), null, 2)\n )\n\n if (typeof pathDirectoryTemporary === 'string') {\n await fse.remove(pathDirectoryTemporary)\n }\n }\n\n return error\n}\n", "import { writeFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport process from 'process'\nimport { getPathDirectoryPackage } from './utilities/get-path-directory-package'\nimport { readPackageJSON } from './utilities/read-package-json'\n\nexport async function packCleanup() {\n const pathDirectoryPackage = await getPathDirectoryPackage(process.cwd())\n\n process.chdir(pathDirectoryPackage)\n\n const pathPackageJSON = path.join(pathDirectoryPackage, 'package.json')\n const packageJSON = await readPackageJSON(pathDirectoryPackage)\n\n await writeFile(\n pathPackageJSON,\n JSON.stringify(Object.assign(packageJSON, { version: '0.0.0' }), null, 2)\n )\n\n return undefined\n}\n", "import arg from 'arg'\nimport assert from 'assert'\nimport { assertRequirements } from './utilities/assert-requirements'\nimport { exit } from './utilities/exit'\n\nawait assertRequirements()\n\nconst { _ } = arg({}, { permissive: true })\n\nassert((_.length = 1))\nconst command = _[0]\nassert(\n command === 'workspace' || command === 'package' || command === 'cleanup'\n)\n\n// prettier-ignore\nconst run = await ({\n workspace: async () => (await import('./pack-workspace')).packWorkspace,\n package: async () => (await import('./pack-package')).packPackage,\n cleanup: async () => (await import('./pack-cleanup')).packCleanup\n}[command]())\n\nconst error = await run()\nexit(error)\n", "import which from 'which'\n\nexport async function assertRequirements() {\n await which('tar')\n await which('pnpm')\n}\n", "import { isNativeError } from 'util/types'\n\nexport function exit(error: unknown) {\n if (error !== undefined) {\n console.error(isNativeError(error) ? error.message : 'Unknown Error')\n process.exit(1)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAAO,SAAS,eAAe,OAA0C;AAEvE,SAAO,GAAG,MAAM,KAAK,QAAQ,KAAK,EAAE,EAAE,QAAQ,KAAK,GAAG,CAAC,IAAI,MAAM,OAAO;AAC1E;AAHA;AAAA;AAAA;AAAA;AAAA;;;ACAA,OAAO,YAAY;AACnB,SAAS,cAAc;AACvB,OAAO,UAAU;AAEjB,eAAsB,0BAA0B,KAAa;AAC3D,SAAO,OAAO,OAAQ,QAAQ;AAC9B,MAAM,wBAAwB,MAAM,OAAO,uBAAuB;AAAA,IAChE;AAAA,IACA,MAAM;AAAA,EACR,CAAC;AAED,gBAAO,OAAO,yBAA0B,QAAQ,GACzC,KAAK,QAAQ,qBAAqB;AAC3C;AAbA;AAAA;AAAA;AAAA;AAAA;;;ACAA,OAAOA,WAAU;AACjB,OAAO,SAAS;AAChB,OAAOC,aAAY;AACnB,SAAS,gBAAgB;AAEzB,eAAsB,gBAAgB,WAAmB;AACvD,MAAM,kBAAkBD,MAAK,KAAK,WAAW,cAAc;AAC3D,EAAAC,QAAO,IAAI,OAAO,eAAe,CAAC;AAClC,MAAM,UAAU,MAAM,SAAS,iBAAiB,MAAM;AACtD,EAAAA,QAAO,OAAO,WAAY,QAAQ;AAClC,MAAM,cAAc,KAAK,MAAM,OAAO;AACtC,SAAAA,QAAO,OAAO,eAAgB,QAAQ,GACtCA,QAAO,OAAO,YAAY,QAAS,QAAQ,GAEpC;AACT;AAfA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,OAAO,SAAS;AAChB,SAAS,aAAa;AACtB,OAAOC,UAAS;AAChB,OAAOC,aAAY;AACnB,SAAS,eAAe;AACxB,SAAS,iBAAAC,sBAAqB;AAC9B,OAAO,QAAQ;AACf,OAAOC,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ACA,KAAK,UAAU,OAAO,OAAO,aAAa,EAAE,SAAS,QAAQ,CAAC,GAAG,MAAM,CAAC;AAAA,EAC1E;AAGF;AApBA;AAAA;AAAA;AAGA;AACA;AAAA;AAAA;;;ACJA,OAAOG,UAAS;AAChB,OAAOC,aAAY;;;ACDnB,OAAO,WAAW;AAElB,eAAsB,qBAAqB;AACzC,QAAM,MAAM,KAAK,GACjB,MAAM,MAAM,MAAM;AACpB;;;ACLA,SAAS,qBAAqB;AAEvB,SAAS,KAAKC,QAAgB;AACnC,EAAIA,WAAU,WACZ,QAAQ,MAAM,cAAcA,MAAK,IAAIA,OAAM,UAAU,eAAe,GACpE,QAAQ,KAAK,CAAC;AAElB;;;AFFA,MAAM,mBAAmB;AAEzB,IAAM,EAAE,EAAE,IAAIC,KAAI,CAAC,GAAG,EAAE,YAAY,GAAK,CAAC;AAE1CC,QAAQ,EAAE,SAAS,CAAE;AACrB,IAAM,UAAU,EAAE,CAAC;AACnBA;AAAA,EACE,YAAY,eAAe,YAAY,aAAa,YAAY;AAClE;AAGA,IAAM,MAAM,MAAO;AAAA,EACjB,WAAW,aAAa,MAAM,+EAA4B;AAAA,EAC1D,SAAS,aAAa,MAAM,2EAA0B;AAAA,EACtD,SAAS,aAAa,MAAM,2EAA0B;AACxD,EAAE,OAAO,EAAE,GAEL,QAAQ,MAAM,IAAI;AACxB,KAAK,KAAK;",
6
+ "names": ["path", "assert", "fse", "assert", "isNativeError", "path", "error", "value", "assert", "findUp", "path", "arg", "execa", "fse", "assert", "mkdtemp", "os", "path", "isNativeError", "process", "semver", "error", "writeFile", "path", "process", "arg", "assert", "error", "arg", "assert"]
7
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare function packCleanup(): Promise<undefined>;
2
+ //# sourceMappingURL=pack-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-cleanup.d.ts","sourceRoot":"","sources":["../../src/pack-cleanup.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,uBAchC"}
@@ -0,0 +1,2 @@
1
+ export declare function packPackage(): Promise<Error | undefined>;
2
+ //# sourceMappingURL=pack-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-package.d.ts","sourceRoot":"","sources":["../../src/pack-package.ts"],"names":[],"mappings":"AAeA,wBAAsB,WAAW,+BA2GhC"}
@@ -0,0 +1,2 @@
1
+ export declare function packWorkspace(): Promise<Error | undefined>;
2
+ //# sourceMappingURL=pack-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-workspace.d.ts","sourceRoot":"","sources":["../../src/pack-workspace.ts"],"names":[],"mappings":"AAmBA,wBAAsB,aAAa,+BA2JlC"}
@@ -0,0 +1,2 @@
1
+ export declare function assertRequirements(): Promise<void>;
2
+ //# sourceMappingURL=assert-requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-requirements.d.ts","sourceRoot":"","sources":["../../../src/utilities/assert-requirements.ts"],"names":[],"mappings":"AAEA,wBAAsB,kBAAkB,kBAGvC"}
@@ -0,0 +1,2 @@
1
+ export declare function exit(error: unknown): void;
2
+ //# sourceMappingURL=exit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit.d.ts","sourceRoot":"","sources":["../../../src/utilities/exit.ts"],"names":[],"mappings":"AAEA,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,QAKlC"}
@@ -0,0 +1,5 @@
1
+ export declare function getNameArchive(value: {
2
+ name: string;
3
+ version: string;
4
+ }): string;
5
+ //# sourceMappingURL=get-name-archive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-name-archive.d.ts","sourceRoot":"","sources":["../../../src/utilities/get-name-archive.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,UAGtE"}
@@ -0,0 +1,2 @@
1
+ export declare function getPathDirectoryPackage(cwd: string): Promise<string>;
2
+ //# sourceMappingURL=get-path-directory-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-path-directory-package.d.ts","sourceRoot":"","sources":["../../../src/utilities/get-path-directory-package.ts"],"names":[],"mappings":"AAIA,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,mBASxD"}
@@ -0,0 +1,2 @@
1
+ export declare function getPathDirectoryWorkspace(cwd: string): Promise<string>;
2
+ //# sourceMappingURL=get-path-directory-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-path-directory-workspace.d.ts","sourceRoot":"","sources":["../../../src/utilities/get-path-directory-workspace.ts"],"names":[],"mappings":"AAIA,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,MAAM,mBAS1D"}
@@ -0,0 +1,4 @@
1
+ export declare function readPackageJSON(directory: string): Promise<{
2
+ name: string;
3
+ }>;
4
+ //# sourceMappingURL=read-package-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-package-json.d.ts","sourceRoot":"","sources":["../../../src/utilities/read-package-json.ts"],"names":[],"mappings":"AAKA,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM;UAKF,MAAM;GAK1D"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@escapace/pnpm-pack",
3
+ "description": "",
4
+ "version": "0.1.0",
5
+ "author": {
6
+ "name": "escapace",
7
+ "email": "opensource@escapace.com"
8
+ },
9
+ "bin": {
10
+ "pnpm-pack": "./lib/esm/index.mjs"
11
+ },
12
+ "bugs": "https://github.com/escapace/pnpm-pack/issues",
13
+ "dependencies": {
14
+ "@pnpm/lockfile-file": "^8.1.8",
15
+ "arg": "^5.0.2",
16
+ "execa": "^8.0.1",
17
+ "find-up": "^7.0.0",
18
+ "fs-extra": "^11.2.0",
19
+ "lodash-es": "^4.17.21",
20
+ "semver": "^7.6.0",
21
+ "which": "^4.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@commitlint/cli": "19.2.1",
25
+ "@commitlint/config-conventional": "19.1.0",
26
+ "@ls-lint/ls-lint": "2.2.3",
27
+ "@types/fs-extra": "11.0.4",
28
+ "@types/lodash-es": "4.17.12",
29
+ "@types/node": "20.12.2",
30
+ "@types/semver": "7.5.8",
31
+ "@types/which": "3.0.3",
32
+ "@typescript-eslint/eslint-plugin": "7.4.0",
33
+ "@typescript-eslint/parser": "7.4.0",
34
+ "esbuild": "0.20.2",
35
+ "eslint": "8.57.0",
36
+ "eslint-config-escapace": "3.19.0",
37
+ "eslint-config-prettier": "9.1.0",
38
+ "eslint-plugin-editorconfig": "4.0.3",
39
+ "eslint-plugin-no-null": "1.0.2",
40
+ "fast-glob": "3.3.2",
41
+ "husky": "9.0.11",
42
+ "is-ci": "3.0.1",
43
+ "lint-staged": "15.2.2",
44
+ "prettier": "3.2.5",
45
+ "prettier-config-escapace": "1.0.6",
46
+ "syncpack": "12.3.0",
47
+ "typescript": "5.4.3"
48
+ },
49
+ "engines": {
50
+ "node": ">=20.11.1",
51
+ "pnpm": ">=8.15.1"
52
+ },
53
+ "exports": {
54
+ ".": {
55
+ "types": "./lib/types/index.d.ts",
56
+ "import": "./lib/esm/index.mjs"
57
+ }
58
+ },
59
+ "files": [
60
+ "lib/esm",
61
+ "lib/types"
62
+ ],
63
+ "homepage": "https://github.com/escapace/pnpm-pack",
64
+ "license": "MPL-2.0",
65
+ "module": "lib/esm/index.mjs",
66
+ "private": false,
67
+ "publishConfig": {
68
+ "provenance": true
69
+ },
70
+ "repository": "escapace/pnpm-pack",
71
+ "sideEffects": false,
72
+ "type": "module",
73
+ "types": "lib/types/index.d.ts",
74
+ "scripts": {
75
+ "build": "node ./scripts/build.mjs",
76
+ "lint": "ls-lint && eslint 'src/**/*.{js,mjs,cjs,ts,mts,cts}'",
77
+ "release": "node ./scripts/release.mjs",
78
+ "test": "echo ok",
79
+ "typecheck": "tsc --noEmit"
80
+ }
81
+ }