@pnpm/engine.runtime.bun-resolver 1101.0.7 → 1101.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/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { FetchFromRegistry } from '@pnpm/fetching.types';
2
- import type { NpmResolver } from '@pnpm/resolving.npm-resolver';
3
- import type { ResolveOptions, ResolveResult, VariationsResolution, WantedDependency } from '@pnpm/resolving.resolver-base';
2
+ import { type NpmResolver } from '@pnpm/resolving.npm-resolver';
3
+ import type { LatestInfo, LatestQuery, ResolveOptions, ResolveResult, VariationsResolution, WantedDependency } from '@pnpm/resolving.resolver-base';
4
4
  export interface BunRuntimeResolveResult extends ResolveResult {
5
5
  resolution: VariationsResolution;
6
6
  resolvedVia: 'github.com/oven-sh/bun';
@@ -10,3 +10,6 @@ export declare function resolveBunRuntime(ctx: {
10
10
  offline?: boolean;
11
11
  resolveFromNpm: NpmResolver;
12
12
  }, wantedDependency: WantedDependency, opts?: Partial<ResolveOptions>): Promise<BunRuntimeResolveResult | null>;
13
+ export declare function resolveLatestBunRuntime(ctx: {
14
+ resolveFromNpm: NpmResolver;
15
+ }, query: LatestQuery, opts: ResolveOptions): Promise<LatestInfo | undefined>;
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { fetchShasumsFile } from '@pnpm/crypto.shasums-file';
2
2
  import { PnpmError } from '@pnpm/error';
3
+ import { MINIMUM_RELEASE_AGE_VIOLATION_CODE } from '@pnpm/resolving.npm-resolver';
3
4
  import { lexCompare } from '@pnpm/util.lex-comparator';
4
5
  export async function resolveBunRuntime(ctx, wantedDependency, opts) {
5
6
  if (wantedDependency.alias !== 'bun' || !wantedDependency.bareSpecifier?.startsWith('runtime:'))
@@ -36,6 +37,26 @@ export async function resolveBunRuntime(ctx, wantedDependency, opts) {
36
37
  },
37
38
  };
38
39
  }
40
+ export async function resolveLatestBunRuntime(ctx, query, opts) {
41
+ const manifestSpec = query.wantedDependency.bareSpecifier;
42
+ if (query.wantedDependency.alias !== 'bun' || !manifestSpec?.startsWith('runtime:'))
43
+ return undefined;
44
+ const versionSpec = query.compatible ? manifestSpec.substring('runtime:'.length) : 'latest';
45
+ try {
46
+ const npmResolution = await ctx.resolveFromNpm({ alias: 'bun', bareSpecifier: versionSpec }, query.compatible ? opts : { ...opts, update: 'latest' });
47
+ if (npmResolution?.policyViolation?.code === MINIMUM_RELEASE_AGE_VIOLATION_CODE)
48
+ return {};
49
+ if (!npmResolution?.manifest)
50
+ return {};
51
+ return { latestManifest: { name: 'bun', version: npmResolution.manifest.version } };
52
+ }
53
+ catch (err) {
54
+ if (opts.publishedBy && err.code === 'ERR_PNPM_NO_MATCHING_VERSION') {
55
+ return {};
56
+ }
57
+ throw err;
58
+ }
59
+ }
39
60
  async function readBunAssets(fetch, version) {
40
61
  const integritiesFileUrl = `https://github.com/oven-sh/bun/releases/download/bun-v${version}/SHASUMS256.txt`;
41
62
  const shasumsFileItems = await fetchShasumsFile(fetch, integritiesFileUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/engine.runtime.bun-resolver",
3
- "version": "1101.0.7",
3
+ "version": "1101.1.0",
4
4
  "description": "Resolves the Bun runtime",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,20 +29,20 @@
29
29
  "@pnpm/util.lex-comparator": "^3.0.2",
30
30
  "semver": "^7.7.2",
31
31
  "@pnpm/crypto.shasums-file": "1100.0.1",
32
- "@pnpm/error": "1100.0.0",
33
- "@pnpm/fetching.fetcher-base": "1100.1.4",
34
- "@pnpm/resolving.npm-resolver": "1101.2.0",
35
- "@pnpm/types": "1101.1.0",
36
- "@pnpm/resolving.resolver-base": "1100.2.0",
37
- "@pnpm/fetching.binary-fetcher": "1101.0.6",
38
- "@pnpm/fetching.types": "1100.0.1"
32
+ "@pnpm/fetching.binary-fetcher": "1101.0.7",
33
+ "@pnpm/fetching.fetcher-base": "1100.1.5",
34
+ "@pnpm/fetching.types": "1100.0.1",
35
+ "@pnpm/resolving.npm-resolver": "1101.3.0",
36
+ "@pnpm/types": "1101.1.1",
37
+ "@pnpm/resolving.resolver-base": "1100.3.0",
38
+ "@pnpm/error": "1100.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@pnpm/worker": "^1100.1.6"
41
+ "@pnpm/worker": "^1100.1.7"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/semver": "7.7.1",
45
- "@pnpm/engine.runtime.bun-resolver": "1101.0.7"
45
+ "@pnpm/engine.runtime.bun-resolver": "1101.1.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=22.13"