Unverified Commit de1add25 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Remove unused turbo-tasks items and add lint check (#90801)

### What?

Adds a lint script (`scripts/check-unused-turbo-tasks.mjs`) that detects
unused `#[turbo_tasks::function]`, `#[turbo_tasks::value]`, and
`#[turbo_tasks::value_trait]` definitions across the Rust codebase, and
removes all currently unused items.

### Why?

Dead turbo-tasks definitions add compilation overhead (each generates
trait impls, registrations, etc.) and make the codebase harder to
navigate. A lint check prevents regressions.

### How?

**New script** (`scripts/check-unused-turbo-tasks.mjs`):
1. Discovers all `.rs` files in `turbopack/crates/` and `crates/`
(excluding `turbo-tasks-macros-tests`)
2. Parses three kinds of turbo-tasks annotations:
- `#[turbo_tasks::function]` → extracts `fn` name + context (free,
inherent impl, trait impl, trait default)
   - `#[turbo_tasks::value]` → extracts `struct`/`enum` name
   - `#[turbo_tasks::value_trait]` → extracts `trait` name
3. Scans all files for identifier references, excluding definition sites
4. Reports any name that has no external references

The script is added to the `pnpm lint` command (runs in parallel with
other checks).

**Removed 23 unused items** across 18 files:

| Kind | Count | Examples |
|------|-------|---------|
| `value` (struct/enum) | 9 | `OutputAssetsWithAvailability`,
`ModuleNameMap`, `OptionModuleIds`, `LockedVersions`,
`AssetContentSnapshot` |
| `function` | 14 | `client_env`, `next_js_file`, `convert_path`,
`is_hot_module_replacement_enabled`,
`any_content_changed_of_output_asset` |

Also cleaned up imports that became unused after the removals.
parent ea56922a
......@@ -41,7 +41,6 @@ use turbo_tasks::{
Completion, NonLocalValue, ResolvedVc, TryJoinIterExt, ValueToString, Vc, fxindexset,
trace::TraceRawVcs,
};
use turbo_tasks_env::{CustomProcessEnv, ProcessEnv};
use turbo_tasks_fs::{File, FileContent, FileSystemPath};
use turbopack::{
ModuleAssetContext,
......@@ -785,14 +784,6 @@ impl AppProject {
))
}
#[turbo_tasks::function]
fn client_env(self: Vc<Self>) -> Vc<Box<dyn ProcessEnv>> {
Vc::upcast(CustomProcessEnv::new(
self.project().env(),
self.project().next_config().env(),
))
}
#[turbo_tasks::function]
async fn client_runtime_entries(self: Vc<Self>) -> Result<Vc<EvaluatableAssets>> {
Ok(get_client_runtime_entries(
......@@ -1098,9 +1089,6 @@ pub fn app_entry_point_to_route(
.cell()
}
#[turbo_tasks::value(transparent)]
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
#[derive(Copy, Clone, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode)]
enum AppPageEndpointType {
Html,
......
......@@ -766,11 +766,6 @@ impl Issue for CssGlobalImportIssue {
// TODO(PACK-4879): compute the source information by following the module references
}
type FxModuleNameMap = FxIndexMap<ResolvedVc<Box<dyn Module>>, RcStr>;
#[turbo_tasks::value(transparent)]
struct ModuleNameMap(#[bincode(with = "turbo_bincode::indexmap")] pub FxModuleNameMap);
#[tracing::instrument(level = "info", name = "validate pages css imports", skip_all)]
#[turbo_tasks::function]
async fn validate_pages_css_imports_individual(
......
use anyhow::Result;
use turbo_rcstr::RcStr;
use turbo_tasks::Vc;
use turbo_tasks_fs::{FileContent, FileSystem, FileSystemPath};
use turbo_tasks_fs::{FileSystem, FileSystemPath};
pub const VIRTUAL_PACKAGE_NAME: &str = "@vercel/turbopack-next";
......@@ -11,11 +11,6 @@ pub(crate) fn next_js_fs() -> Vc<Box<dyn FileSystem>> {
turbo_tasks_fs::embed_directory!("next", "$CARGO_MANIFEST_DIR/js/src")
}
#[turbo_tasks::function]
pub(crate) async fn next_js_file(path: RcStr) -> Result<Vc<FileContent>> {
Ok(next_js_fs().root().await?.join(&path)?.read())
}
#[turbo_tasks::function]
pub(crate) async fn next_js_file_path(path: RcStr) -> Result<Vc<FileSystemPath>> {
Ok(next_js_fs().root().await?.join(&path)?.cell())
......
......@@ -917,9 +917,6 @@ pub enum ModuleIds {
Deterministic,
}
#[turbo_tasks::value(transparent)]
pub struct OptionModuleIds(pub Option<ModuleIds>);
#[turbo_tasks::value(operation)]
#[derive(Copy, Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
......@@ -1409,9 +1406,6 @@ pub struct OptionSubResourceIntegrity(Option<SubResourceIntegrity>);
#[turbo_tasks::value(transparent)]
pub struct OptionFileSystemPath(Option<FileSystemPath>);
#[turbo_tasks::value(transparent)]
pub struct OptionServerActions(Option<ServerActions>);
#[turbo_tasks::value(transparent)]
pub struct IgnoreIssues(Vec<IgnoreIssue>);
......@@ -1933,11 +1927,6 @@ impl NextConfig {
Vc::cell(self.experimental.gesture_transition.unwrap_or(false))
}
#[turbo_tasks::function]
pub fn enable_app_new_scroll_handler(&self) -> Vc<bool> {
Vc::cell(self.experimental.app_new_scroll_handler.unwrap_or(false))
}
#[turbo_tasks::function]
pub fn enable_cache_components(&self) -> Vc<bool> {
Vc::cell(self.cache_components.unwrap_or(false))
......
......@@ -74,7 +74,8 @@
"types-and-precompiled": "run-p \"lint-typescript --log-order=stream\" check-compiler-fixtures types:test-lib && pnpm check-precompiled",
"check-compiler-fixtures": "find crates/next-custom-transforms/tests/fixture -type f -name 'tsconfig.json' -print0 | xargs --null -n1 -I'{}' pnpm tsc --noEmit --project '{}'",
"validate-externals-doc": "node ./scripts/validate-externals-doc.js",
"lint": "run-p test-types lint-typescript prettier-check \"lint-eslint .\" lint-ast-grep lint-language",
"check-unused-turbo-tasks": "node scripts/check-unused-turbo-tasks.mjs",
"lint": "run-p test-types lint-typescript prettier-check \"lint-eslint .\" lint-ast-grep lint-language check-unused-turbo-tasks",
"lint-fix": "pnpm prettier-fix && pnpm lint-eslint --fix .",
"lint-language": "alex .",
"prettier-check": "prettier --check .",
......
#!/usr/bin/env node
/**
* Scans the Rust codebase to find unused turbo-tasks items:
* - #[turbo_tasks::function] → fn definitions
* - #[turbo_tasks::value] → struct/enum definitions
* - #[turbo_tasks::value_trait] → trait definitions
*
* Exit code 0: no unused items found
* Exit code 1: unused items found
*
* Usage: node scripts/check-unused-turbo-tasks.mjs
*/
import { readdir, readFile } from 'node:fs/promises'
import { join, relative } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const ROOT = join(__dirname, '..')
const SCAN_DIRS = [join(ROOT, 'turbopack/crates'), join(ROOT, 'crates')]
const EXCLUDE_DIRS = ['turbo-tasks-macros-tests']
// After seeing an attribute, give up looking for the item it annotates
// if we haven't found it within this many lines.
const MAX_ANNOTATION_DISTANCE = 10
// ---------------------------------------------------------------------------
// Regexes
// ---------------------------------------------------------------------------
// Attribute detection (applied to trimmed lines)
const TT_FUNCTION_RE = /^#\[turbo_tasks::function/
const TT_VALUE_RE = /^#\[turbo_tasks::value(?![_a-zA-Z0-9])/ // not value_impl or value_trait
const TT_VALUE_IMPL_RE = /^#\[turbo_tasks::value_impl/
const TT_VALUE_TRAIT_RE = /^#\[turbo_tasks::value_trait/
// Item-header extraction
const FN_NAME_RE = /\bfn\s+([a-zA-Z_][a-zA-Z0-9_]*)/
const STRUCT_ENUM_RE =
/^\s*(?:pub(?:\([^)]*\))?\s+)?(?:struct|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/
const TRAIT_RE = /^\s*(?:pub\s+)?trait\s+([A-Za-z_][A-Za-z0-9_]*)/
const IMPL_TRAIT_FOR_RE =
/^\s*impl\s*(?:<[^>]*>\s*)?([A-Za-z_][A-Za-z0-9_:]*(?:<[^>]*>)?)\s+for\s+([A-Za-z_][A-Za-z0-9_:]*)/
const IMPL_INHERENT_RE = /^\s*impl\s*(?:<[^>]*>\s*)?([A-Za-z_][A-Za-z0-9_:]*)/
// Usage scanning
const IDENT_RE = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g
// ---------------------------------------------------------------------------
// Types
// ---------------------------------------------------------------------------
/**
* @typedef {{
* name: string,
* kind: 'function' | 'value' | 'value_trait',
* filePath: string,
* line: number,
* context: 'free' | 'inherent_impl' | 'trait_impl' | 'trait_def',
* typeName?: string,
* traitName?: string,
* }} Definition
*/
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
/**
* Tracks a "pending annotation": an attribute was seen on some line and we are
* scanning forward to find the item it annotates (a fn, struct, enum, or trait).
*
* Returns null when a match is found or the search window expires, along with
* the matched name (or null).
*/
function resolvePending(pending, currentLine, trimmed, itemRe) {
if (pending < 0) return { pending, match: null }
const m = itemRe.exec(trimmed)
if (m) return { pending: -1, match: m[1] }
if (currentLine - pending > MAX_ANNOTATION_DISTANCE)
return { pending: -1, match: null }
return { pending, match: null }
}
/**
* Count unbalanced braces on a line, ignoring string literals and comments.
*/
function countBraces(line) {
let depth = 0
let inString = false
let escape = false
let inChar = false
for (let i = 0; i < line.length; i++) {
const ch = line[i]
if (escape) {
escape = false
continue
}
if (ch === '\\') {
escape = true
continue
}
// Line comment — stop processing
if (!inString && !inChar && ch === '/' && line[i + 1] === '/') break
if (inString) {
if (ch === '"') inString = false
continue
}
if (inChar) {
if (ch === "'") inChar = false
continue
}
if (ch === '"') {
inString = true
continue
}
// Simplified char literal detection ('x')
if (ch === "'" && i + 2 < line.length && line[i + 2] === "'") {
i += 2
continue
}
if (ch === '{') depth++
if (ch === '}') depth--
}
return depth
}
/**
* Format a Definition for display.
*/
function formatDefinition(def, relPath) {
const loc = `${relPath}:${def.line}`
if (def.kind === 'value') return ` ${loc} - value ${def.name}`
if (def.kind === 'value_trait') return ` ${loc} - value_trait ${def.name}`
const contextLabels = {
free: 'free function',
inherent_impl: `method on ${def.typeName}`,
trait_impl: `impl ${def.traitName} for ${def.typeName}`,
trait_def: `trait ${def.traitName} default method`,
}
const ctx = contextLabels[def.context] ?? def.context
return ` ${loc} - fn ${def.name} (${ctx})`
}
// ---------------------------------------------------------------------------
// Phase 0: Discover all .rs files
// ---------------------------------------------------------------------------
async function discoverRsFiles(dirs) {
const files = []
for (const dir of dirs) {
let entries
try {
entries = await readdir(dir, { recursive: true, withFileTypes: false })
} catch {
continue
}
for (const entry of entries) {
if (entry.endsWith('.rs')) {
const parts = entry.split('/')
if (parts.some((p) => EXCLUDE_DIRS.includes(p))) continue
files.push(join(dir, entry))
}
}
}
return files
}
// ---------------------------------------------------------------------------
// Phase 1: Extract definitions
// ---------------------------------------------------------------------------
/**
* Parse a single .rs file for turbo-tasks definitions.
*
* Tracks three kinds of pending annotations:
* - #[turbo_tasks::function] → expects `fn <name>`
* - #[turbo_tasks::value] → expects `struct <name>` or `enum <name>`
* - #[turbo_tasks::value_trait] → expects `trait <name>`
*
* Also maintains a block stack to determine whether a function lives inside a
* #[turbo_tasks::value_impl] or #[turbo_tasks::value_trait] block, which gives
* the function its context (inherent method, trait impl, trait default method).
*/
function parseDefinitions(filePath, content) {
const lines = content.split('\n')
/** @type {Definition[]} */
const definitions = []
let braceDepth = 0
/**
* Stack of impl/trait blocks we're inside (for function context).
* @type {Array<{ startDepth: number, typeName?: string, traitName?: string, implKind: 'inherent' | 'trait' | 'trait_def' }>}
*/
const blockStack = []
// Pending attribute state: line index where the attribute was seen, or -1.
let pendingFn = -1
let pendingValue = -1
let pendingValueTrait = -1
let pendingBlockType = null // 'value_impl' | 'value_trait'
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
const trimmed = line.trimStart()
const isComment = trimmed.startsWith('//')
if (!isComment) {
// --- Detect attributes ---
if (TT_VALUE_IMPL_RE.test(trimmed)) pendingBlockType = 'value_impl'
if (TT_VALUE_TRAIT_RE.test(trimmed)) {
pendingBlockType = 'value_trait'
pendingValueTrait = i
}
if (TT_VALUE_RE.test(trimmed)) pendingValue = i
if (TT_FUNCTION_RE.test(trimmed)) pendingFn = i
// --- Resolve pending value/value_trait annotations into definitions ---
{
const r = resolvePending(pendingValue, i, trimmed, STRUCT_ENUM_RE)
pendingValue = r.pending
if (r.match) {
definitions.push({
name: r.match,
kind: 'value',
filePath,
line: i + 1,
context: 'free',
})
}
}
{
const r = resolvePending(pendingValueTrait, i, trimmed, TRAIT_RE)
pendingValueTrait = r.pending
if (r.match) {
definitions.push({
name: r.match,
kind: 'value_trait',
filePath,
line: i + 1,
context: 'free',
})
}
}
// --- Resolve pending function annotations ---
{
const r = resolvePending(pendingFn, i, trimmed, FN_NAME_RE)
pendingFn = r.pending
if (r.match) {
const block =
blockStack.length > 0 ? blockStack[blockStack.length - 1] : null
let context = 'free'
let typeName, traitName
if (block) {
if (block.implKind === 'inherent') {
context = 'inherent_impl'
typeName = block.typeName
} else if (block.implKind === 'trait') {
context = 'trait_impl'
typeName = block.typeName
traitName = block.traitName
} else if (block.implKind === 'trait_def') {
context = 'trait_def'
traitName = block.traitName
}
}
definitions.push({
name: r.match,
kind: 'function',
filePath,
line: i + 1,
context,
...(typeName && { typeName }),
...(traitName && { traitName }),
})
}
}
// --- Resolve pending block headers (value_impl / value_trait) ---
if (pendingBlockType === 'value_impl') {
const traitImplMatch = IMPL_TRAIT_FOR_RE.exec(trimmed)
if (traitImplMatch) {
blockStack.push({
startDepth: braceDepth,
traitName: traitImplMatch[1],
typeName: traitImplMatch[2],
implKind: 'trait',
})
pendingBlockType = null
} else {
const inherentMatch = IMPL_INHERENT_RE.exec(trimmed)
if (inherentMatch && trimmed.includes('{')) {
blockStack.push({
startDepth: braceDepth,
typeName: inherentMatch[1],
implKind: 'inherent',
})
pendingBlockType = null
}
// else: impl line without opening brace yet — keep waiting
}
} else if (pendingBlockType === 'value_trait') {
const traitMatch = TRAIT_RE.exec(trimmed)
if (traitMatch) {
blockStack.push({
startDepth: braceDepth,
traitName: traitMatch[1],
implKind: 'trait_def',
})
pendingBlockType = null
}
}
}
// Track brace depth (even for comment lines — countBraces skips //)
braceDepth += countBraces(line)
// Pop blocks that have closed
while (
blockStack.length > 0 &&
braceDepth <= blockStack[blockStack.length - 1].startDepth
) {
blockStack.pop()
}
}
return definitions
}
// ---------------------------------------------------------------------------
// Phase 2: Find used names
// ---------------------------------------------------------------------------
/**
* Scan all file contents and return the set of definition names that appear
* at least once outside their definition site.
*
* @param {Map<string, string>} fileContents
* @param {Set<string>} names
* @param {Map<string, Set<string>>} definitionLocations name → Set<"path:line">
* @returns {Set<string>}
*/
function findUsedNames(fileContents, names, definitionLocations) {
const used = new Set()
for (const [filePath, content] of fileContents) {
const lines = content.split('\n')
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
if (line.trimStart().startsWith('//')) continue
let match
IDENT_RE.lastIndex = 0
while ((match = IDENT_RE.exec(line)) !== null) {
const name = match[1]
if (used.has(name) || !names.has(name)) continue
// Skip the definition site itself
const defLocs = definitionLocations.get(name)
if (defLocs && defLocs.has(`${filePath}:${i + 1}`)) continue
used.add(name)
if (used.size === names.size) return used
}
}
}
return used
}
// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------
async function main() {
const rsFiles = await discoverRsFiles(SCAN_DIRS)
/** @type {Map<string, string>} */
const fileContents = new Map()
await Promise.all(
rsFiles.map(async (filePath) => {
try {
fileContents.set(filePath, await readFile(filePath, 'utf-8'))
} catch {
/* skip unreadable files */
}
})
)
// Parse definitions from all files
/** @type {Definition[]} */
const allDefinitions = []
for (const [filePath, content] of fileContents) {
allDefinitions.push(...parseDefinitions(filePath, content))
}
// Build indexes
const allNames = new Set(allDefinitions.map((d) => d.name))
/** @type {Map<string, Set<string>>} */
const definitionLocations = new Map()
for (const def of allDefinitions) {
const key = `${def.filePath}:${def.line}`
if (!definitionLocations.has(def.name)) {
definitionLocations.set(def.name, new Set())
}
definitionLocations.get(def.name).add(key)
}
// Find which names have external usage
const usedNames = findUsedNames(fileContents, allNames, definitionLocations)
// Collect and sort unused definitions
const unused = allDefinitions
.filter((d) => !usedNames.has(d.name))
.sort((a, b) => a.filePath.localeCompare(b.filePath) || a.line - b.line)
// Report
if (unused.length === 0) {
console.log(
`No unused turbo-tasks items found (${allDefinitions.length} total checked).`
)
process.exit(0)
}
console.log('Unused turbo-tasks items:\n')
for (const def of unused) {
console.log(formatDefinition(def, relative(ROOT, def.filePath)))
}
console.log(
`\nFound ${unused.length} unused turbo-tasks item(s) out of ${allDefinitions.length} total.`
)
process.exit(1)
}
main().catch((err) => {
console.error(err)
process.exit(2)
})
......@@ -142,6 +142,8 @@ async fn test_trait_methods() {
async fn test_trait_methods_operation() -> Result<Vc<()>> {
assert_eq!(*Value::static_trait_method().await?, 42);
assert_eq!(*Value::async_static_trait_method().await?, 42);
assert_eq!(*Value::default_static_trait_method().await?, 42);
assert_eq!(*Value::default_async_static_trait_method().await?, 42);
let value = Value(43).cell();
assert_eq!(*value.trait_method().await?, 43);
......
......@@ -153,6 +153,40 @@ async fn test_struct_transparent_debug() {
.unwrap()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_struct_option_debug() {
run_once(&REGISTRATION, || async {
let a = StructWithOption { option: None }.resolved_cell();
assert_eq!(
format!(
"{:?}",
dbg_operation(ResolvedVc::upcast(a))
.read_strongly_consistent()
.await?,
),
"StructWithOption {\n option: None,\n}",
);
let b = StructWithOption {
option: Some(Transparent(42).resolved_cell()),
}
.resolved_cell();
assert_eq!(
format!(
"{:?}",
dbg_operation(ResolvedVc::upcast(b))
.read_strongly_consistent()
.await?,
),
"StructWithOption {\n option: Some(\n 42,\n ),\n}",
);
Ok(())
})
.await
.unwrap()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_struct_vec_debug() {
run_once(&REGISTRATION, || async {
......
......@@ -36,34 +36,6 @@ impl AttachedFileSystem {
.cell())
}
/// Converts the given [FileSystemPath] to a path in this [FileSystem].
///
/// The given path has to be inside of the root [FileSystem], the child
/// [FileSystem] or this [AttachedFileSystem].
#[turbo_tasks::function]
pub async fn convert_path(
self: ResolvedVc<Self>,
contained_path: FileSystemPath,
) -> Result<Vc<FileSystemPath>> {
let self_fs: ResolvedVc<Box<dyn FileSystem>> = ResolvedVc::upcast(self);
let this = self.await?;
match contained_path.fs {
// already on this filesystem
fs if fs == self_fs => Ok(contained_path.cell()),
// in the root filesystem, just need to rebase on this filesystem
fs if fs == this.root_fs => Ok(self.root().await?.join(&contained_path.path)?.cell()),
// in the child filesystem, so we expand to the full path by appending to child_path
fs if fs == this.child_fs => {
Ok(self.child_path().await?.join(&contained_path.path)?.cell())
}
_ => bail!(
"path {} not part of self, the root fs or the child fs",
contained_path.value_to_string().await?
),
}
}
/// Constructs a [FileSystemPath] of the attachment point referencing
/// this [AttachedFileSystem]
#[turbo_tasks::function]
......
......@@ -686,11 +686,6 @@ impl ChunkingContext for BrowserChunkingContext {
.cell()
}
#[turbo_tasks::function]
fn is_hot_module_replacement_enabled(&self) -> Vc<bool> {
Vc::cell(self.enable_hot_module_replacement)
}
#[turbo_tasks::function]
fn chunking_configs(&self) -> Result<Vc<ChunkingConfigs>> {
Ok(Vc::cell(self.chunking_configs.iter().cloned().collect()))
......
......@@ -4,12 +4,7 @@ use turbo_tasks::{
graph::{AdjacencyMap, GraphTraversal},
};
use crate::{
asset::Asset,
module::Module,
output::{ExpandOutputAssetsInput, OutputAsset, expand_output_assets},
reference::primary_referenced_modules,
};
use crate::{asset::Asset, module::Module, reference::primary_referenced_modules};
pub async fn get_referenced_modules(
parent: ResolvedVc<Box<dyn Module>>,
......@@ -39,24 +34,6 @@ pub async fn any_source_content_changed_of_module(
Ok(Vc::<Completions>::cell(completions).completed())
}
/// Returns a completion that changes when any content of any asset in the whole
/// asset graph changes.
#[turbo_tasks::function]
pub async fn any_content_changed_of_output_asset(
root: ResolvedVc<Box<dyn OutputAsset>>,
) -> Result<Vc<Completion>> {
let completions =
expand_output_assets(std::iter::once(ExpandOutputAssetsInput::Asset(root)), true)
.await?
.into_iter()
.map(|m| content_changed(*ResolvedVc::upcast(m)))
.map(|v| v.to_resolved())
.try_join()
.await?;
Ok(Vc::<Completions>::cell(completions).completed())
}
/// Returns a completion that changes when the content of the given asset
/// changes.
#[turbo_tasks::function]
......
......@@ -366,11 +366,6 @@ pub trait ChunkingContext {
.cell()
}
#[turbo_tasks::function]
fn is_hot_module_replacement_enabled(self: Vc<Self>) -> Vc<bool> {
Vc::cell(false)
}
#[turbo_tasks::function]
fn chunking_configs(self: Vc<Self>) -> Vc<ChunkingConfigs> {
Vc::cell(Default::default())
......
......@@ -475,9 +475,6 @@ pub struct ChunkItemWithAsyncModuleInfo {
pub async_info: Option<ResolvedVc<AsyncModuleInfo>>,
}
#[turbo_tasks::value(transparent)]
pub struct ChunkItemsWithAsyncModuleInfo(Vec<ChunkItemWithAsyncModuleInfo>);
pub trait ChunkItemExt {
/// Returns the module id of this chunk item.
fn id(self: Vc<Self>) -> impl Future<Output = Result<ModuleId>> + Send;
......
......@@ -7,9 +7,6 @@ use crate::{
module_graph::{GraphTraversalAction, ModuleGraph, ModuleGraphLayer},
};
#[turbo_tasks::value(transparent)]
pub struct ModulesSet(FxHashSet<ResolvedVc<Box<dyn Module>>>);
/// This lists all the modules that are async (self or transitively because they reference another
/// module in this list).
#[turbo_tasks::value(transparent, cell = "keyed")]
......
......@@ -20,10 +20,6 @@ use crate::{
},
};
#[turbo_tasks::value(shared)]
#[derive(Hash, Debug)]
pub struct LockedVersions {}
#[turbo_tasks::value(transparent)]
#[derive(Debug)]
pub struct ExcludedExtensions(#[bincode(with = "turbo_bincode::indexset")] pub FxIndexSet<RcStr>);
......
......@@ -6,7 +6,6 @@ use turbo_tasks::{
IntoTraitRef, NonLocalValue, OperationValue, ReadRef, ResolvedVc, State, TraitRef, Vc,
debug::ValueDebugFormat, trace::TraceRawVcs,
};
use turbo_tasks_fs::{FileContent, LinkType};
use turbo_tasks_hash::HashAlgorithm;
use crate::asset::AssetContent;
......@@ -68,13 +67,6 @@ pub struct VersionedAssetContent {
asset_content: ReadRef<AssetContent>,
}
#[turbo_tasks::value]
#[derive(Clone)]
enum AssetContentSnapshot {
File(ReadRef<FileContent>),
Redirect { target: String, link_type: LinkType },
}
#[turbo_tasks::value_impl]
impl VersionedContent for VersionedAssetContent {
#[turbo_tasks::function]
......
......@@ -26,20 +26,6 @@ impl VirtualOutputAsset {
}
.cell()
}
#[turbo_tasks::function]
pub fn new_with_references(
path: FileSystemPath,
content: ResolvedVc<AssetContent>,
references: ResolvedVc<OutputAssets>,
) -> Vc<Self> {
VirtualOutputAsset {
path,
content,
references,
}
.cell()
}
}
#[turbo_tasks::value_impl]
......
......@@ -63,33 +63,6 @@ impl AssetGraphContentSource {
})
}
/// Serves all assets references by all root_assets.
#[turbo_tasks::function]
pub fn new_eager_multiple(
root_path: FileSystemPath,
root_assets: ResolvedVc<OutputAssetsSet>,
) -> Vc<Self> {
Self::cell(AssetGraphContentSource {
root_path,
root_assets,
expanded: None,
})
}
/// Serves all assets references by all root_assets. Only serve references
/// of an asset when it has served its content before.
#[turbo_tasks::function]
pub fn new_lazy_multiple(
root_path: FileSystemPath,
root_assets: ResolvedVc<OutputAssetsSet>,
) -> Vc<Self> {
Self::cell(AssetGraphContentSource {
root_path,
root_assets,
expanded: Some(State::new(FxHashSet::default())),
})
}
#[turbo_tasks::function]
async fn all_assets_map(&self) -> Result<Vc<OutputAssetsMap>> {
Ok(Vc::cell(
......
......@@ -32,19 +32,6 @@ impl IssueFilePathContentSource {
}
.cell()
}
#[turbo_tasks::function]
pub fn new_description(
description: RcStr,
source: ResolvedVc<Box<dyn ContentSource>>,
) -> Vc<Self> {
IssueFilePathContentSource {
file_path: None,
description,
source,
}
.cell()
}
}
#[turbo_tasks::value_impl]
......
......@@ -133,23 +133,6 @@ impl ContentSourceContent {
.cell())
}
#[turbo_tasks::function]
pub fn static_with_headers(
content: ResolvedVc<Box<dyn VersionedContent>>,
status_code: u16,
headers: ResolvedVc<HeaderList>,
) -> Vc<ContentSourceContent> {
ContentSourceContent::Static(
StaticContent {
content,
status_code,
headers,
}
.resolved_cell(),
)
.cell()
}
#[turbo_tasks::function]
pub fn not_found() -> Vc<ContentSourceContent> {
ContentSourceContent::NotFound.cell()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment