GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: basic command implementation by wan9chi · Pull Request #3 · voidzero-dev/vite-plus

Conversation

@wan9chi

@wan9chi wan9chi commented May 22, 2025

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
wan9chi added 3 commits May 22, 2025 19:54
@wan9chi
chore: enable pure esm
9670cc7
@wan9chi
chore: rename script name dev to start to avoid confusing `pnpm d…
d807ef1
…ev dev`
@wan9chi
feat: basic command implementation
e2ab7c0
@wan9chi
wan9chi force-pushed the basic-cmd branch from fc2c361 to e2ab7c0 Compare May 22, 2025 12:04
@wan9chi
wan9chi requested a review from Boshen May 22, 2025 12:10
@Boshen Boshen self-assigned this May 22, 2025
sxzz
sxzz reviewed May 22, 2025
View reviewed changes
Comment thread packages/cli/src/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/cli/src/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/cli/src/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

wan9chi added 3 commits May 23, 2025 10:36
@wan9chi
chore: require a Node.js version that supports import.meta.dirname
d203e30
@wan9chi
fix: exit with 255 for critical error
69e228e
@wan9chi
fix: use process.execPath as node path
b780615
@Boshen
Boshen merged commit e751174 into main May 23, 2025
@Boshen
Boshen deleted the basic-cmd branch May 23, 2025 06:47
@fengmk2 fengmk2 mentioned this pull request May 19, 2026
Fresh vp create monorepo requires 2–3 vp run ready invocations before cache stabilizes #1638
Closed
Brooooooklyn added a commit that referenced this pull request Jun 16, 2026
@Brooooooklyn @claude
fix(migration): resolve 4 reviewer threads on vitest pinning & snap s…
9b59731
…tability

#3 (migrator): a monorepo root injects vite-plus before rewritePackageJson, so
existingVitePlus is truthy and a root with a vitest-adjacent dep (e.g.
vitest-browser-svelte, whose vitest peer is non-optional) never got a direct
vitest pin — unresolvable under pnpm strict / Yarn PnP. Fold isVitestAdjacent
into needDirectVitest so the pin is added independent of vite-plus presence.
Flip the stale "stays undefined" test, add a genuine-normalize-pass test, and
add a migration-monorepo-root-vitest-adjacent fixture.

#1 (snap masking): replaceUnstableOutput only masked @/slash/whitespace-prefixed
semver, so JSON "vitest": "4.1.9" (bun catalog, devDeps) churned on every daily
bump while YAML vitest: 4.1.9 was already masked. Mask vitest-family JSON pins
to <semver>, but only major >= 4 (the migrator-supported range) so unsupported
pre-4 echoes like "vitest": "3.2.4" stay visible to prove a refused migration
left package.json untouched. Exclude @vitest/coverage-* (user-owned peers
vite-plus never pins; define-config.ts guards their exact version).

#2 (upgrade-deps): the daily bump rewrote VITEST_VERSION, the catalog, and the
vp-create workflow but left README.md's hardcoded manual-migration vitest pins
stale. Add updateReadmeVitestPins (root + cli mirror), asserting exactly 2 JSON
+ 1 YAML pins per file so a reworded section fails loudly like the other updaters.

#4 (upgrade.md): document that after upgrading vite-plus users must re-pin
vitest to the bundled version (vp --version) or rerun vp migrate, and where the
pin lives per package manager (incl. the package.json pnpm.overrides case).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@gsmeira gsmeira mentioned this pull request Jun 20, 2026
Task cache: a build with outDir under a tracked dir (e.g. Laravel public/build) never caches — emptyOutDir delete-probe counted as a read #1894
Closed
4 tasks done
fengmk2 added a commit that referenced this pull request Jun 25, 2026
@shulaoda @fengmk2
fix(install): retry truncated downloads in HttpClient::get_bytes (#1940)
1bbf3f1
#### Problem

`HttpClient::get_bytes` read the response body
(`response.bytes().await`) **outside** the retry. The retry only wrapped
request setup (`send().await?.error_for_status()`), which resolves as
soon as the response *headers* arrive — so a connection dropped mid-body
(a response truncated relative to its advertised `Content-Length`)
surfaced as a hard error that was **never retried**. `download_file`
already handles this by streaming the body inside its retry and checking
`Content-Length`.

`get_bytes` is the download path for the **platform tarball** in:

- `vp upgrade` — `crates/vite_global_cli/src/commands/upgrade`
- the standalone installer — `crates/vite_installer`

So a transient mid-body drop (flaky wifi, a proxy/CDN closing the
connection early) failed the upgrade/install outright with `… end of
file before message length reached`, even though a single retry would
usually succeed. Node-runtime and package-manager tarball downloads
(which go through `download_file`) already retried.

#### Fix

Read the body **inside** the retried closure — one send+body unit,
mirroring `download_file` — so a mid-body drop is retried. The
now-unused private `get` / `get_with_accept` helpers are removed
(`get_with_accept` was only ever called with `accept = None`).

#### Test

`test_get_bytes_retries_on_truncated_body`: a raw `tokio` TCP server
truncates the first response (advertises the full `Content-Length`,
sends half the body, drops the connection) and serves the full body on
the retry. Against the old code it fails with hyper `IncompleteBody`
after **1** attempt; with the fix it succeeds after **2**.

#### Reproduce end-to-end with `vp upgrade`

A mock registry truncates the platform tarball on **every** request. The
fixed `get_bytes` retries (4 tarball hits); the old one gives up after
1.

```bash
# build vp from this branch
cargo build -p vite_global_cli

# terminal A — truncating mock registry (script below)
node mock-registry.js

# terminal B — a real upgrade against it
# NO_PROXY is needed if you run a local/system HTTP proxy, so loopback isn't intercepted
NO_PROXY=127.0.0.1,localhost target/debug/vp upgrade --registry http://127.0.0.1:8911 --force
```

Watch terminal A's `[tarball] hit #N`:

| build | terminal A | result |
| --- | --- | --- |
| this branch (fixed) | `hit #1 #2 #3 #4` — retried | `Failed to
download platform package: … end of file before message length reached`
|
| before the fix | `hit #1` — no retry | same error |

Both end with the same error (the mock always truncates); the **hit
count** is the difference — on a real flaky network the retry usually
succeeds on attempt 2–4.

<details>
<summary><code>mock-registry.js</code></summary>

```js
// Truncates the platform tarball on every request (advertises a full
// Content-Length, sends a few bytes, drops the connection). Fixed get_bytes
// retries -> 4 tarball hits; the buggy one does not -> 1 hit.
const http = require('http');

const PORT = Number(process.env.PORT || 8911);
const VERSION = '9.9.9';
const FULL = 4096; // advertised Content-Length
const SENT = 100; // bytes actually sent before the drop

let tarballHits = 0;

function meta(tarballPath) {
  return JSON.stringify({
    version: VERSION,
    dist: {
      tarball: `http://127.0.0.1:${PORT}${tarballPath}`,
      integrity: 'sha512-AAAA', // never reached: the download always fails first
    },
  });
}

const server = http.createServer((req, res) => {
  const url = req.url;

  // Platform tarball: truncate every time.
  if (url === '/platform.tgz') {
    tarballHits += 1;
    console.log(`[tarball] hit #${tarballHits}  ->  send ${SENT}/${FULL} bytes then drop the connection`);
    const sock = res.socket;
    sock.write(
      'HTTP/1.1 200 OK\r\n' +
        'Content-Type: application/octet-stream\r\n' +
        `Content-Length: ${FULL}\r\n` +
        'Connection: close\r\n' +
        '\r\n',
    );
    sock.write(Buffer.alloc(SENT, 0x41));
    setTimeout(() => sock.destroy(), 80); // flush, then mid-body connection drop
    return;
  }

  console.log(`[meta] ${req.method} ${url}`);

  // Platform package metadata: /@voidzero-dev/vite-plus-cli-<suffix>/<version>
  if (url.includes('/vite-plus-cli-')) {
    res.writeHead(200, { 'content-type': 'application/json' });
    res.end(meta('/platform.tgz'));
    return;
  }

  // Main package metadata: /vite-plus/<tag-or-version>
  if (url.startsWith('/vite-plus/')) {
    res.writeHead(200, { 'content-type': 'application/json' });
    res.end(meta('/main.tgz'));
    return;
  }

  res.writeHead(404, { 'content-type': 'text/plain' });
  res.end('not found');
});

server.listen(PORT, '127.0.0.1', () => {
  console.log(`mock registry listening on http://127.0.0.1:${PORT}`);
});
```

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: MK (fengmk2) <[email protected]>
@fengmk2 fengmk2 mentioned this pull request Jun 30, 2026
feat(deps): upgrade upstream dependencies #1989
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Boshen Boshen Awaiting requested review from Boshen
1 more reviewer
@sxzz sxzz sxzz left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Boshen Boshen

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@wan9chi @sxzz @Boshen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.