Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- **Changed** When a task lists a folder, an entry named `dist` now counts like any other: a `dist` folder appearing in or disappearing from a folder the task lists makes the next run a cache miss. Every listing used to leave `dist` out, so that a lint task listing the package root still hit after another task's build made `dist` there. That also hid a `dist` that matters, and the next run replayed stale output: `oxlint` in a package that commits its built `dist/` passed on a cache hit after a `dist` folder with lint errors appeared. To keep `dist` out of a task's listings, add `"!dist/**"` to its `input`. A `dist` folder holding only files the task wrote still doesn't count, like any such folder ([#919](https://github.com/voidzero-dev/vite-task/pull/919)).
- **Changed** Exclusions in a task's `input`, like `"!build/**"`, now also keep matching entries out of the folders the task lists, and so do the paths a tool reports with `ignoreInput`. For example, a lint task with `"!build/**"` in its `input` that lists the package root is now a cache hit when another task's `build` folder appears there. Previously an exclusion only left out the files the task read, so the new folder was a cache miss. A folder entry is left out when the pattern matches the folder itself, as `build/**` does, but not `build/*` ([#941](https://github.com/voidzero-dev/vite-task/pull/941)).
- **Fixed** A task's automatically tracked outputs now include the symbolic links it creates, like the links Nitro's dependency tracer makes in `.output/server/node_modules`, so they no longer need an `output` glob that matches them. The next run is a cache hit if they are missing, as on a fresh clone, and the hit restores them as links if they're among the task's outputs. Previously a hit left them out, and removing one that the task had checked for was a cache miss ([#918](https://github.com/voidzero-dev/vite-task/pull/918)).
- **Fixed** A cache hit now restores the empty folders a task made if they're among its outputs, like the `.astro/collections` folder that `astro build` leaves empty: with automatic output tracking that's every such folder, and with `output` globs, the ones they match. A folder holding only such folders and files the task wrote, like `.astro`, may now be missing, as on a fresh clone, and the next run is still a cache hit, which restores it if what it holds is among the task's outputs. Previously a hit left empty folders missing, and removing a folder holding one was a cache miss ([#917](https://github.com/voidzero-dev/vite-task/pull/917)).
Expand Down
2 changes: 1 addition & 1 deletion crates/vt/src/session/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub fn split_path(path: &str) -> (Option<&str>, &str) {
/// its own cache warm across branch switches, and a cache from a different
/// version is simply ignored (it lives in a directory this build never looks
/// at) rather than aborting the run. Bumping the version starts a fresh cache.
const CACHE_SCHEMA_VERSION: u32 = 22;
const CACHE_SCHEMA_VERSION: u32 = 23;

/// Name of the per-version subdirectory (e.g. `v14`) under the task-cache
/// directory that holds the database and output archives for the current
Expand Down
2 changes: 1 addition & 1 deletion crates/vt/src/session/execute/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ fn leave_out_excluded_entries(

/// Check if a directory entry should be ignored in fingerprinting
const fn should_ignore_entry(name: &[u8]) -> bool {
matches!(name, b"." | b".." | b".DS_Store") || name.eq_ignore_ascii_case(b"dist")
matches!(name, b"." | b".." | b".DS_Store")
}

/// Fingerprint a single path
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "dist-appears-in-listed-folder",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[e2e]]
name = "dist_appears_in_listed_folder"
comment = """
The task lists the package root and prints its entries, like a tool looking for the files to process.
"""
steps = [
[
"vt",
"run",
"build",
],
{ argv = [
"vtt",
"mkdir",
"dist",
], comment = "a `dist` folder the task didn't make appears in the listed folder" },
[
"vt",
"run",
"build",
],
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# dist_appears_in_listed_folder

The task lists the package root and prints its entries, like a tool looking for the files to process.

## `vt run build`

```
$ vtt list-dir .
node_modules
package.json
snapshots
snapshots.toml
vite-task.json
```

## `vtt mkdir dist`

a `dist` folder the task didn't make appears in the listed folder

```
```

## `vt run build`

```
$ vtt list-dir . ○ cache miss: 'dist' added in workspace root, executing
dist
node_modules
package.json
snapshots
snapshots.toml
vite-task.json
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tasks": {
"build": {
"command": "vtt list-dir .",
"cache": true
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "oxlint-dist",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[[e2e]]
name = "oxlint_dist"
comment = """
`oxlint -D no-debugger` lints the package, whose `.gitignore` lists `node_modules` but not `dist/`, like a GitHub Action that commits its built `dist/`. It lists the package root and each folder it doesn't ignore, and reads the files in them.
"""
ignore = true
steps = [
{ argv = [
"vt",
"run",
"lint",
], redact = { 'with \d+ rules' = 'with <n> rules' } },
{ argv = [
"vtt",
"write-file",
"dist/bad.js",
"debugger;",
], comment = "a `dist` folder the task didn't write appears, holding code oxlint rejects" },
{ argv = [
"vt",
"run",
"lint",
], redact = { 'with \d+ rules' = 'with <n> rules' } },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# oxlint_dist

`oxlint -D no-debugger` lints the package, whose `.gitignore` lists `node_modules` but not `dist/`, like a GitHub Action that commits its built `dist/`. It lists the package root and each folder it doesn't ignore, and reads the files in them.

## `vt run lint`

```
$ oxlint -D no-debugger
Found 0 warnings and 0 errors.
Finished in <duration> on 1 file with <n> rules using <n> threads.
```

## `vtt write-file dist/bad.js debugger;`

a `dist` folder the task didn't write appears, holding code oxlint rejects

```
```

## `vt run lint`

**Exit code:** 1

```
$ oxlint -D no-debugger ○ cache miss: 'dist' added in workspace root, executing

× eslint(no-debugger): `debugger` statement is not allowed
╭─[dist/bad.js:1:1]
1 │ debugger;
· ─────────
╰────
help: Remove the debugger statement

Found 0 warnings and 1 error.
Finished in <duration> on 2 files with <n> rules using <n> threads.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const value = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tasks": {
"lint": {
"command": "oxlint -D no-debugger",
"cache": true
}
}
}
Loading