Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface Existing {
value: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "dts-self-resolution-overlap",
"private": true,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"scripts": {
"overlap": "tsdown --logLevel silent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Existing } from 'dts-self-resolution-overlap';

export type Public = Existing;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"target": "ES2023"
},
"include": ["src"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
clean: false,
dts: { emitDtsOnly: true },
entry: ['src/index.ts'],
fixedExtension: false,
format: 'esm',
logLevel: 'silent',
outDir: 'dist',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "oxfmt-in-place-overlap",
"private": true,
"scripts": {
"overlap": "oxfmt --threads=1 source.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const value={answer:42}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.stale {
color: blue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.fixture {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "tailwind-output-overlap",
"private": true,
"scripts": {
"overlap": "tailwindcss -i input.css -o dist/output.css --minify"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const stale = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "tsdown-clean-overlap",
"private": true,
"type": "module",
"scripts": {
"overlap": "tsdown --logLevel silent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const answer: number = 42;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
clean: true,
dts: false,
entry: ['src/index.ts'],
fixedExtension: false,
format: 'esm',
logLevel: 'silent',
outDir: 'dist',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "tsdown-shebang-overlap",
"private": true,
"type": "module",
"scripts": {
"overlap": "tsdown --logLevel silent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

export const answer: number = 42;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
clean: false,
dts: false,
entry: ['src/index.ts'],
fixedExtension: false,
format: 'esm',
logLevel: 'silent',
outDir: 'dist',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "real-package-read-write-overlaps",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- cases/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[[e2e]]
name = "tsdown_clean_reads_and_rewrites_dist"
comment = """
tsdown expands the configured clean paths with `tinyglobby` and removes every matched entry before the bundle writes its replacement. With an existing `dist/index.js`, the build therefore observes and removes that path before emitting `dist/index.js` again. See [`cleanOutDir`](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/features/clean.ts#L14-L45).
"""
cwd = "cases/tsdown-clean"
ignore = true
steps = [{ argv = ["vt", "run", "-v", "overlap"] }]

[[e2e]]
name = "tsdown_shebang_reads_and_changes_emitted_entry"
comment = """
After Rolldown writes a shebang entry, tsdown checks that emitted file with `access` and then changes its mode with `chmod`. The same `dist/index.js` is consequently read and mutated during one build. See [the shebang plugin](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/features/shebang.ts#L18-L34) and [`fsExists`](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/utils/fs.ts#L5-L9).
"""
cwd = "cases/tsdown-shebang"
ignore = true
steps = [{ argv = ["vt", "run", "-v", "overlap"] }]

[[e2e]]
name = "dts_self_resolution_reads_and_rewrites_declaration"
comment = """
The source imports a type through its own package name, whose `exports.types` target is the existing `dist/index.d.ts`. rolldown-plugin-dts delegates that import to TypeScript's bundler resolver and creates a TypeScript program, so the declaration is resolved and read before the declaration bundle replaces the same path. See [`tscResolve`](https://github.com/sxzz/rolldown-plugin-dts/blob/363cc09b660675e15ec8791ce0f05f1044a7048a/src/tsc/resolver.ts#L7-L38) and [the TypeScript program construction](https://github.com/sxzz/rolldown-plugin-dts/blob/363cc09b660675e15ec8791ce0f05f1044a7048a/src/tsc/emit-compiler.ts#L112-L128).
"""
cwd = "cases/dts-self-resolution"
ignore = true
steps = [{ argv = ["vt", "run", "-v", "overlap"] }]

[[e2e]]
name = "tailwind_reads_and_rewrites_output"
comment = """
Tailwind's CLI stats and reads an existing output file to compare its contents with the newly generated CSS, then writes the file when the contents differ. This makes `dist/output.css` both a read and a write in one command. See [`outputFile`](https://github.com/tailwindlabs/tailwindcss/blob/8a14a710102cae195f6811e8578bef9477bc6be9/packages/%40tailwindcss-cli/src/commands/build/utils.ts#L15-L34).
"""
cwd = "cases/tailwind-output"
ignore = true
steps = [{ argv = ["vt", "run", "-v", "overlap"] }]

[[e2e]]
name = "oxfmt_reads_and_rewrites_source"
comment = """
In write mode, oxfmt reads each source file, formats the text, and writes changed text back to that same path. The checked-in `source.ts` is intentionally unformatted, so the file is both read and written. See [the formatter service's read and write sequence](https://github.com/oxc-project/oxc/blob/5306f24d9e82ae36ad9c3c964f33075bc589c799/apps/oxfmt/src/cli/service.rs#L42-L82) and [`read_to_string`](https://github.com/oxc-project/oxc/blob/5306f24d9e82ae36ad9c3c964f33075bc589c799/apps/oxfmt/src/core/utils.rs#L50-L53).
"""
cwd = "cases/oxfmt-in-place"
ignore = true
steps = [{ argv = ["vt", "run", "-v", "overlap"] }]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# dts_self_resolution_reads_and_rewrites_declaration

The source imports a type through its own package name, whose `exports.types` target is the existing `dist/index.d.ts`. rolldown-plugin-dts delegates that import to TypeScript's bundler resolver and creates a TypeScript program, so the declaration is resolved and read before the declaration bundle replaces the same path. See [`tscResolve`](https://github.com/sxzz/rolldown-plugin-dts/blob/363cc09b660675e15ec8791ce0f05f1044a7048a/src/tsc/resolver.ts#L7-L38) and [the TypeScript program construction](https://github.com/sxzz/rolldown-plugin-dts/blob/363cc09b660675e15ec8791ce0f05f1044a7048a/src/tsc/emit-compiler.ts#L112-L128).

## `vt run -v overlap`

```
~/cases/dts-self-resolution$ tsdown --logLevel silent


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 1 cache misses
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] dts-self-resolution-overlap#overlap: ~/cases/dts-self-resolution$ tsdown --logLevel silent ✓
→ Not cached: read and wrote 'cases/dts-self-resolution/dist/index.d.ts'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# oxfmt_reads_and_rewrites_source

In write mode, oxfmt reads each source file, formats the text, and writes changed text back to that same path. The checked-in `source.ts` is intentionally unformatted, so the file is both read and written. See [the formatter service's read and write sequence](https://github.com/oxc-project/oxc/blob/5306f24d9e82ae36ad9c3c964f33075bc589c799/apps/oxfmt/src/cli/service.rs#L42-L82) and [`read_to_string`](https://github.com/oxc-project/oxc/blob/5306f24d9e82ae36ad9c3c964f33075bc589c799/apps/oxfmt/src/core/utils.rs#L50-L53).

## `vt run -v overlap`

```
~/cases/oxfmt-in-place$ oxfmt --threads=1 source.ts
Finished in <duration> on 1 files using <n> threads.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 1 cache misses
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] oxfmt-in-place-overlap#overlap: ~/cases/oxfmt-in-place$ oxfmt --threads=1 source.ts ✓
→ Not cached: read and wrote 'cases/oxfmt-in-place/source.ts'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# tailwind_reads_and_rewrites_output

Tailwind's CLI stats and reads an existing output file to compare its contents with the newly generated CSS, then writes the file when the contents differ. This makes `dist/output.css` both a read and a write in one command. See [`outputFile`](https://github.com/tailwindlabs/tailwindcss/blob/8a14a710102cae195f6811e8578bef9477bc6be9/packages/%40tailwindcss-cli/src/commands/build/utils.ts#L15-L34).

## `vt run -v overlap`

```
~/cases/tailwind-output$ tailwindcss -i input.css -o dist/output.css --minify
≈ tailwindcss v4.3.1

Done in <duration>


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 1 cache misses
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] tailwind-output-overlap#overlap: ~/cases/tailwind-output$ tailwindcss -i input.css -o dist/output.css --minify ✓
→ Not cached: read and wrote 'cases/tailwind-output/dist/output.css'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# tsdown_clean_reads_and_rewrites_dist

tsdown expands the configured clean paths with `tinyglobby` and removes every matched entry before the bundle writes its replacement. With an existing `dist/index.js`, the build therefore observes and removes that path before emitting `dist/index.js` again. See [`cleanOutDir`](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/features/clean.ts#L14-L45).

## `vt run -v overlap`

```
~/cases/tsdown-clean$ tsdown --logLevel silent


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 1 cache misses
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] tsdown-clean-overlap#overlap: ~/cases/tsdown-clean$ tsdown --logLevel silent ✓
→ Not cached: read and wrote 'cases/tsdown-clean/dist/index.js'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# tsdown_shebang_reads_and_changes_emitted_entry

After Rolldown writes a shebang entry, tsdown checks that emitted file with `access` and then changes its mode with `chmod`. The same `dist/index.js` is consequently read and mutated during one build. See [the shebang plugin](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/features/shebang.ts#L18-L34) and [`fsExists`](https://github.com/rolldown/tsdown/blob/49cc5f953f1b6ab13968fef8509d69767373253b/src/utils/fs.ts#L5-L9).

## `vt run -v overlap`

```
~/cases/tsdown-shebang$ tsdown --logLevel silent


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Vite+ Task Runner • Execution Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Statistics: 1 tasks • 0 cache hits • 1 cache misses
Performance: 0% cache hit rate

Task Details:
────────────────────────────────────────────────
[1] tsdown-shebang-overlap#overlap: ~/cases/tsdown-shebang$ tsdown --logLevel silent ✓
→ Not cached: read and wrote 'cases/tsdown-shebang/dist/index.js'
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cache": true
}
3 changes: 3 additions & 0 deletions packages/tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "module",
"dependencies": {
"@playwright/browser-chromium": "catalog:",
"@tailwindcss/cli": "catalog:",
"@vitest/browser-playwright": "catalog:",
"@voidzero-dev/vite-task-client": "workspace:*",
"bun": "catalog:",
Expand All @@ -13,6 +14,8 @@
"oxlint": "catalog:",
"oxlint-tsgolint": "catalog:",
"playwright": "catalog:",
"rolldown-plugin-dts": "catalog:",
"tsdown": "catalog:",
"vite": "catalog:",
"vitest": "catalog:"
}
Expand Down
Loading
Loading