@vzn/vx-migrate 0.0.630 → 0.0.631

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/README.md CHANGED
@@ -290,17 +290,17 @@ export default defineWorkspace({
290
290
 
291
291
  Every option falls back to the tool's own environment variable, so a self-hosted setup carries over unchanged. A token with no `apiUrl` means Vercel's hosted Remote Cache (`https://vercel.com/api`), exactly as it does for `turbo` — so `npx turbo login && npx turbo link`, then `turboCache()` with `TURBO_TOKEN` / `TURBO_TEAM` set, is the whole hosted setup. Below the environment, in Turbo's order: a Vercel build's `VERCEL_ARTIFACTS_TOKEN` and `VERCEL_ARTIFACTS_OWNER` (the team id, where `TURBO_TOKEN` with a team is not set), then the repo's `.turbo/config.json` (what `turbo link` writes: `apiUrl`, `teamId`, `teamSlug`, `token`), then the root `turbo.json`'s `remoteCache` (`apiUrl`, `teamId`, `teamSlug`), whose `enabled: false` declines unless the options name a cache. With no token the plugin **declines** and the run stays local.
292
292
 
293
- | Option | Environment variable | Meaning |
294
- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
295
- | `apiUrl` | `TURBO_API` | base URL of the cache server; default with a token: `https://vercel.com/api`; a `user:pass@` in it is refused |
296
- | `token` | `TURBO_TOKEN` | Bearer token on every request |
297
- | `teamId` | `TURBO_TEAMID` | `teamId` query parameter; required with `signatureKey` |
298
- | `teamSlug` | `TURBO_TEAM` | `slug` query parameter |
299
- | `signatureKey` | `TURBO_REMOTE_CACHE_SIGNATURE_KEY`, read only under turbo.json's `remoteCache.signature: true` (or `TURBO_SIGNATURE`), as Turbo reads it | HMAC-SHA256 key (≥ 32 bytes, used raw); a download whose tag does not verify is a miss |
300
- | `timeoutMs` | `TURBO_REMOTE_CACHE_TIMEOUT`, then `remoteCache.timeout` (seconds) | HEAD/GET/POST deadline (default 30 s; 0 none) |
301
- | `uploadTimeoutMs` | `TURBO_REMOTE_CACHE_UPLOAD_TIMEOUT`, then `remoteCache.uploadTimeout` (seconds) | PUT deadline (default 60 s; 0 none) |
302
- | `retries` | — | resends of a request answered 429 / 5xx (not 501) or never connected (default 1, Turbo's); 0 turns them off |
303
- | `preflight` | `TURBO_PREFLIGHT` (1 or 0), then `remoteCache.preflight` | send Turbo's `OPTIONS` preflight before each artifact request and go where its `Location` points (relative to `apiUrl`); the token goes along only when `Access-Control-Allow-Headers` admits `Authorization` (default off) |
293
+ | Option | Environment variable | Meaning |
294
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
295
+ | `apiUrl` | `TURBO_API` | base URL of the cache server; default with a token: `https://vercel.com/api`; a `user:pass@` in it is refused |
296
+ | `token` | `TURBO_TOKEN` | Bearer token on every request |
297
+ | `teamId` | `TURBO_TEAMID` | `teamId` query parameter; required with `signatureKey` |
298
+ | `teamSlug` | `TURBO_TEAM` | `slug` query parameter |
299
+ | `signatureKey` | `TURBO_REMOTE_CACHE_SIGNATURE_KEY`, read only under turbo.json's `remoteCache.signature: true` (or `TURBO_SIGNATURE`), as Turbo reads it | HMAC-SHA256 key (≥ 32 bytes, used raw); a download whose tag does not verify is a miss |
300
+ | `timeoutMs` | `TURBO_REMOTE_CACHE_TIMEOUT`, then `remoteCache.timeout` (seconds) | HEAD/GET/POST deadline (default 30 s; 0 none) |
301
+ | `uploadTimeoutMs` | `TURBO_REMOTE_CACHE_UPLOAD_TIMEOUT`, then `remoteCache.uploadTimeout` (seconds) | PUT deadline (default 60 s; 0 none) |
302
+ | `retries` | — | resends of a request answered 429 / 5xx (not 501) or never connected (default 1, Turbo's); 0 turns them off |
303
+ | `preflight` | `TURBO_PREFLIGHT` (1 or 0), then `remoteCache.preflight` | send Turbo's `OPTIONS` preflight before each artifact request and go where its `Location` points (relative to `apiUrl`); the token goes along only when the API's `Access-Control-Allow-Headers` admits `Authorization`; a redirected preflight is not followed (default off) |
304
304
 
305
305
  The signature is Turbo's current scheme (`artifact-signature:v2`: prefix, hash, team id and body, each length-prefixed, under HMAC-SHA256, base64 in `x-artifact-tag`). A signed body is written to a temp file before its tag can be checked, so one past core's artifact ceiling (2 GiB, at zstd's bound) is refused as it passes it, and is a miss.
306
306
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx-migrate",
3
- "version": "0.0.630",
3
+ "version": "0.0.631",
4
4
  "license": "MIT",
5
5
  "description": "Adopt @vzn/vx from Turborepo or Nx: run the repo unchanged, migrate it to vx.config.ts, and keep your Turbo or Nx remote cache",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "access": "public"
40
40
  },
41
41
  "peerDependencies": {
42
- "@vzn/vx": "^0.0.630"
42
+ "@vzn/vx": "^0.0.631"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
@@ -426,7 +426,9 @@ export class TurboRemoteCache implements RemoteCacheLayer {
426
426
  * query, so nothing is appended — and the token goes along only when
427
427
  * `Access-Control-Allow-Headers` admits `Authorization` (or `*`), so it
428
428
  * never reaches a third-party store. The answer's status is not read, as
429
- * in Turbo.
429
+ * in Turbo. A redirect is not followed: its `Location` is the answer, and
430
+ * the token's verdict stays the API's. Following one let the redirected
431
+ * host's `Access-Control-Allow-Headers` admit the token to itself.
430
432
  */
431
433
  private async preflight(
432
434
  url: string,
@@ -442,13 +444,14 @@ export class TurboRemoteCache implements RemoteCacheLayer {
442
444
  'Access-Control-Request-Method': method === 'HEAD' ? 'GET' : method,
443
445
  'Access-Control-Request-Headers': ['Authorization', ...Object.keys(headers)].join(', '),
444
446
  },
447
+ redirect: 'manual',
445
448
  ...(s === undefined ? {} : { signal: s }),
446
449
  })
447
450
  await res.body?.cancel()
448
451
  const location = res.headers.get('location')
449
452
  const allowed = res.headers.get('access-control-allow-headers') ?? ''
450
453
  return {
451
- url: location === null ? res.url || url : new URL(location, this.config.apiUrl).toString(),
454
+ url: location === null ? url : new URL(location, this.config.apiUrl).toString(),
452
455
  auth:
453
456
  allowed.trim() === '*' ||
454
457
  allowed.split(',').some((h) => h.trim().toLowerCase() === 'authorization'),