-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description First step in having separate traits for Source, Module and Outputs. next.js PR: vercel/next.js#52401
- Loading branch information
Showing
52 changed files
with
363 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use crate::asset::{Asset, AssetVc}; | ||
|
||
/// A module. This usually represents parsed source code, which has references | ||
/// to other modules. | ||
#[turbo_tasks::value_trait] | ||
pub trait Module: Asset {} | ||
|
||
#[turbo_tasks::value(transparent)] | ||
pub struct OptionModule(Option<ModuleVc>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::{ | ||
asset::{Asset, AssetContentVc, AssetVc}, | ||
ident::AssetIdentVc, | ||
module::{Module, ModuleVc}, | ||
}; | ||
|
||
/// A module where source code doesn't need to be parsed but can be usd as is. | ||
/// This module has no references to other modules. | ||
#[turbo_tasks::value] | ||
pub struct RawModule { | ||
source: AssetVc, | ||
} | ||
|
||
#[turbo_tasks::value_impl] | ||
impl Module for RawModule {} | ||
|
||
#[turbo_tasks::value_impl] | ||
impl Asset for RawModule { | ||
#[turbo_tasks::function] | ||
fn ident(&self) -> AssetIdentVc { | ||
self.source.ident() | ||
} | ||
|
||
#[turbo_tasks::function] | ||
fn content(&self) -> AssetContentVc { | ||
self.source.content() | ||
} | ||
} | ||
|
||
#[turbo_tasks::value_impl] | ||
impl RawModuleVc { | ||
#[turbo_tasks::function] | ||
pub fn new(source: AssetVc) -> RawModuleVc { | ||
RawModule { source }.cell() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.