pubm 0.1.2 → 0.1.3
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/bin/cli.js +32 -7
- package/dist/index.cjs +30 -5
- package/dist/index.js +32 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -5595,7 +5595,7 @@ import process12 from "node:process";
|
|
|
5595
5595
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
5596
5596
|
|
|
5597
5597
|
// src/registry/jsr.ts
|
|
5598
|
-
import {
|
|
5598
|
+
import { exec as exec4, NonZeroExitError } from "tinyexec";
|
|
5599
5599
|
|
|
5600
5600
|
// src/utils/db.ts
|
|
5601
5601
|
import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
|
|
@@ -5801,6 +5801,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5801
5801
|
try {
|
|
5802
5802
|
const response = await this.fetch("/user");
|
|
5803
5803
|
if (response.status === 401) return null;
|
|
5804
|
+
if (!response.ok) {
|
|
5805
|
+
throw new Error(
|
|
5806
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5807
|
+
);
|
|
5808
|
+
}
|
|
5804
5809
|
return await response.json();
|
|
5805
5810
|
} catch (error) {
|
|
5806
5811
|
throw new JsrError(`Failed to fetch \`${this.apiEndpoint}/user\``, {
|
|
@@ -5812,6 +5817,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5812
5817
|
try {
|
|
5813
5818
|
const response = await this.fetch(`/user/member/${scope}`);
|
|
5814
5819
|
if (response.status === 401) return null;
|
|
5820
|
+
if (!response.ok) {
|
|
5821
|
+
throw new Error(
|
|
5822
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5823
|
+
);
|
|
5824
|
+
}
|
|
5815
5825
|
return await response.json();
|
|
5816
5826
|
} catch (error) {
|
|
5817
5827
|
throw new JsrError(
|
|
@@ -5826,9 +5836,18 @@ var _JsrClient = class _JsrClient {
|
|
|
5826
5836
|
try {
|
|
5827
5837
|
const response = await this.fetch("/user/scopes");
|
|
5828
5838
|
if (response.status === 401) return [];
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5839
|
+
if (!response.ok) {
|
|
5840
|
+
throw new Error(
|
|
5841
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5842
|
+
);
|
|
5843
|
+
}
|
|
5844
|
+
const body = await response.json();
|
|
5845
|
+
if (!Array.isArray(body)) {
|
|
5846
|
+
throw new Error(
|
|
5847
|
+
`Expected array response but got ${typeof body}`
|
|
5848
|
+
);
|
|
5849
|
+
}
|
|
5850
|
+
return body.map(({ scope }) => scope);
|
|
5832
5851
|
} catch (error) {
|
|
5833
5852
|
throw new JsrError(
|
|
5834
5853
|
`Failed to fetch \`${this.apiEndpoint}/user/scopes\``,
|
|
@@ -5842,10 +5861,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5842
5861
|
const [scope, name] = getScopeAndName(packageName);
|
|
5843
5862
|
try {
|
|
5844
5863
|
const response = await this.fetch(`/scopes/${scope}/packages/${name}`);
|
|
5864
|
+
if (!response.ok) return null;
|
|
5845
5865
|
return await response.json();
|
|
5846
5866
|
} catch (error) {
|
|
5847
5867
|
throw new JsrError(
|
|
5848
|
-
`Failed to fetch \`${this.apiEndpoint}/
|
|
5868
|
+
`Failed to fetch \`${this.apiEndpoint}/scopes/${scope}/packages/${name}\``,
|
|
5849
5869
|
{
|
|
5850
5870
|
cause: error
|
|
5851
5871
|
}
|
|
@@ -5916,6 +5936,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5916
5936
|
async searchPackage(query) {
|
|
5917
5937
|
try {
|
|
5918
5938
|
const response = await this.fetch(`/packages?query=${query}`);
|
|
5939
|
+
if (!response.ok) {
|
|
5940
|
+
throw new Error(
|
|
5941
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5942
|
+
);
|
|
5943
|
+
}
|
|
5919
5944
|
return await response.json();
|
|
5920
5945
|
} catch (error) {
|
|
5921
5946
|
throw new JsrError(
|
|
@@ -5935,7 +5960,7 @@ async function jsrRegistry() {
|
|
|
5935
5960
|
}
|
|
5936
5961
|
|
|
5937
5962
|
// src/registry/npm.ts
|
|
5938
|
-
import {
|
|
5963
|
+
import { exec as exec5, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
|
|
5939
5964
|
var NpmError = class extends AbstractError {
|
|
5940
5965
|
constructor() {
|
|
5941
5966
|
super(...arguments);
|
|
@@ -6147,7 +6172,7 @@ Generate a token from ${color.bold(link2("jsr.io", "https://jsr.io/account/token
|
|
|
6147
6172
|
scopes.map(
|
|
6148
6173
|
(scope2) => jsr.client.package(`@${scope2}/${jsr.packageName}`)
|
|
6149
6174
|
)
|
|
6150
|
-
)).filter((v) => v);
|
|
6175
|
+
)).filter((v) => v !== null);
|
|
6151
6176
|
if (searchResults.length > 0) {
|
|
6152
6177
|
jsrName = await task.prompt(ListrEnquirerPromptAdapter).run({
|
|
6153
6178
|
type: "select",
|
package/dist/index.cjs
CHANGED
|
@@ -5368,6 +5368,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5368
5368
|
try {
|
|
5369
5369
|
const response = await this.fetch("/user");
|
|
5370
5370
|
if (response.status === 401) return null;
|
|
5371
|
+
if (!response.ok) {
|
|
5372
|
+
throw new Error(
|
|
5373
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5374
|
+
);
|
|
5375
|
+
}
|
|
5371
5376
|
return await response.json();
|
|
5372
5377
|
} catch (error) {
|
|
5373
5378
|
throw new JsrError(`Failed to fetch \`${this.apiEndpoint}/user\``, {
|
|
@@ -5379,6 +5384,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5379
5384
|
try {
|
|
5380
5385
|
const response = await this.fetch(`/user/member/${scope}`);
|
|
5381
5386
|
if (response.status === 401) return null;
|
|
5387
|
+
if (!response.ok) {
|
|
5388
|
+
throw new Error(
|
|
5389
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5390
|
+
);
|
|
5391
|
+
}
|
|
5382
5392
|
return await response.json();
|
|
5383
5393
|
} catch (error) {
|
|
5384
5394
|
throw new JsrError(
|
|
@@ -5393,9 +5403,18 @@ var _JsrClient = class _JsrClient {
|
|
|
5393
5403
|
try {
|
|
5394
5404
|
const response = await this.fetch("/user/scopes");
|
|
5395
5405
|
if (response.status === 401) return [];
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5406
|
+
if (!response.ok) {
|
|
5407
|
+
throw new Error(
|
|
5408
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5409
|
+
);
|
|
5410
|
+
}
|
|
5411
|
+
const body = await response.json();
|
|
5412
|
+
if (!Array.isArray(body)) {
|
|
5413
|
+
throw new Error(
|
|
5414
|
+
`Expected array response but got ${typeof body}`
|
|
5415
|
+
);
|
|
5416
|
+
}
|
|
5417
|
+
return body.map(({ scope }) => scope);
|
|
5399
5418
|
} catch (error) {
|
|
5400
5419
|
throw new JsrError(
|
|
5401
5420
|
`Failed to fetch \`${this.apiEndpoint}/user/scopes\``,
|
|
@@ -5409,10 +5428,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5409
5428
|
const [scope, name] = getScopeAndName(packageName);
|
|
5410
5429
|
try {
|
|
5411
5430
|
const response = await this.fetch(`/scopes/${scope}/packages/${name}`);
|
|
5431
|
+
if (!response.ok) return null;
|
|
5412
5432
|
return await response.json();
|
|
5413
5433
|
} catch (error) {
|
|
5414
5434
|
throw new JsrError(
|
|
5415
|
-
`Failed to fetch \`${this.apiEndpoint}/
|
|
5435
|
+
`Failed to fetch \`${this.apiEndpoint}/scopes/${scope}/packages/${name}\``,
|
|
5416
5436
|
{
|
|
5417
5437
|
cause: error
|
|
5418
5438
|
}
|
|
@@ -5483,6 +5503,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5483
5503
|
async searchPackage(query) {
|
|
5484
5504
|
try {
|
|
5485
5505
|
const response = await this.fetch(`/packages?query=${query}`);
|
|
5506
|
+
if (!response.ok) {
|
|
5507
|
+
throw new Error(
|
|
5508
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5509
|
+
);
|
|
5510
|
+
}
|
|
5486
5511
|
return await response.json();
|
|
5487
5512
|
} catch (error) {
|
|
5488
5513
|
throw new JsrError(
|
|
@@ -5714,7 +5739,7 @@ Generate a token from ${color.bold(link2("jsr.io", "https://jsr.io/account/token
|
|
|
5714
5739
|
scopes.map(
|
|
5715
5740
|
(scope2) => jsr.client.package(`@${scope2}/${jsr.packageName}`)
|
|
5716
5741
|
)
|
|
5717
|
-
)).filter((v) => v);
|
|
5742
|
+
)).filter((v) => v !== null);
|
|
5718
5743
|
if (searchResults.length > 0) {
|
|
5719
5744
|
jsrName = await task.prompt(import_prompt_adapter_enquirer.ListrEnquirerPromptAdapter).run({
|
|
5720
5745
|
type: "select",
|
package/dist/index.js
CHANGED
|
@@ -5127,7 +5127,7 @@ import process8 from "node:process";
|
|
|
5127
5127
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
5128
5128
|
|
|
5129
5129
|
// src/registry/jsr.ts
|
|
5130
|
-
import {
|
|
5130
|
+
import { exec as exec4, NonZeroExitError } from "tinyexec";
|
|
5131
5131
|
|
|
5132
5132
|
// src/utils/db.ts
|
|
5133
5133
|
import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
|
|
@@ -5333,6 +5333,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5333
5333
|
try {
|
|
5334
5334
|
const response = await this.fetch("/user");
|
|
5335
5335
|
if (response.status === 401) return null;
|
|
5336
|
+
if (!response.ok) {
|
|
5337
|
+
throw new Error(
|
|
5338
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5339
|
+
);
|
|
5340
|
+
}
|
|
5336
5341
|
return await response.json();
|
|
5337
5342
|
} catch (error) {
|
|
5338
5343
|
throw new JsrError(`Failed to fetch \`${this.apiEndpoint}/user\``, {
|
|
@@ -5344,6 +5349,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5344
5349
|
try {
|
|
5345
5350
|
const response = await this.fetch(`/user/member/${scope}`);
|
|
5346
5351
|
if (response.status === 401) return null;
|
|
5352
|
+
if (!response.ok) {
|
|
5353
|
+
throw new Error(
|
|
5354
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5355
|
+
);
|
|
5356
|
+
}
|
|
5347
5357
|
return await response.json();
|
|
5348
5358
|
} catch (error) {
|
|
5349
5359
|
throw new JsrError(
|
|
@@ -5358,9 +5368,18 @@ var _JsrClient = class _JsrClient {
|
|
|
5358
5368
|
try {
|
|
5359
5369
|
const response = await this.fetch("/user/scopes");
|
|
5360
5370
|
if (response.status === 401) return [];
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5371
|
+
if (!response.ok) {
|
|
5372
|
+
throw new Error(
|
|
5373
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5374
|
+
);
|
|
5375
|
+
}
|
|
5376
|
+
const body = await response.json();
|
|
5377
|
+
if (!Array.isArray(body)) {
|
|
5378
|
+
throw new Error(
|
|
5379
|
+
`Expected array response but got ${typeof body}`
|
|
5380
|
+
);
|
|
5381
|
+
}
|
|
5382
|
+
return body.map(({ scope }) => scope);
|
|
5364
5383
|
} catch (error) {
|
|
5365
5384
|
throw new JsrError(
|
|
5366
5385
|
`Failed to fetch \`${this.apiEndpoint}/user/scopes\``,
|
|
@@ -5374,10 +5393,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5374
5393
|
const [scope, name] = getScopeAndName(packageName);
|
|
5375
5394
|
try {
|
|
5376
5395
|
const response = await this.fetch(`/scopes/${scope}/packages/${name}`);
|
|
5396
|
+
if (!response.ok) return null;
|
|
5377
5397
|
return await response.json();
|
|
5378
5398
|
} catch (error) {
|
|
5379
5399
|
throw new JsrError(
|
|
5380
|
-
`Failed to fetch \`${this.apiEndpoint}/
|
|
5400
|
+
`Failed to fetch \`${this.apiEndpoint}/scopes/${scope}/packages/${name}\``,
|
|
5381
5401
|
{
|
|
5382
5402
|
cause: error
|
|
5383
5403
|
}
|
|
@@ -5448,6 +5468,11 @@ var _JsrClient = class _JsrClient {
|
|
|
5448
5468
|
async searchPackage(query) {
|
|
5449
5469
|
try {
|
|
5450
5470
|
const response = await this.fetch(`/packages?query=${query}`);
|
|
5471
|
+
if (!response.ok) {
|
|
5472
|
+
throw new Error(
|
|
5473
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
5474
|
+
);
|
|
5475
|
+
}
|
|
5451
5476
|
return await response.json();
|
|
5452
5477
|
} catch (error) {
|
|
5453
5478
|
throw new JsrError(
|
|
@@ -5467,7 +5492,7 @@ async function jsrRegistry() {
|
|
|
5467
5492
|
}
|
|
5468
5493
|
|
|
5469
5494
|
// src/registry/npm.ts
|
|
5470
|
-
import {
|
|
5495
|
+
import { exec as exec5, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
|
|
5471
5496
|
var NpmError = class extends AbstractError {
|
|
5472
5497
|
constructor() {
|
|
5473
5498
|
super(...arguments);
|
|
@@ -5679,7 +5704,7 @@ Generate a token from ${color.bold(link2("jsr.io", "https://jsr.io/account/token
|
|
|
5679
5704
|
scopes.map(
|
|
5680
5705
|
(scope2) => jsr.client.package(`@${scope2}/${jsr.packageName}`)
|
|
5681
5706
|
)
|
|
5682
|
-
)).filter((v) => v);
|
|
5707
|
+
)).filter((v) => v !== null);
|
|
5683
5708
|
if (searchResults.length > 0) {
|
|
5684
5709
|
jsrName = await task.prompt(ListrEnquirerPromptAdapter).run({
|
|
5685
5710
|
type: "select",
|