Unverified Commit 69af581d authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove pages export as it is unused (#82990)

## What?

As far as I can tell there's no usage of this variable. No TS errors and
all tests pass.
parent 4914f32b
...@@ -27,7 +27,6 @@ use crate::{ ...@@ -27,7 +27,6 @@ use crate::{
pub struct AppPageLoaderTreeBuilder { pub struct AppPageLoaderTreeBuilder {
base: BaseLoaderTreeBuilder, base: BaseLoaderTreeBuilder,
loader_tree_code: String, loader_tree_code: String,
pages: Vec<FileSystemPath>,
/// next.config.js' basePath option to construct og metadata. /// next.config.js' basePath option to construct og metadata.
base_path: Option<RcStr>, base_path: Option<RcStr>,
} }
...@@ -41,7 +40,6 @@ impl AppPageLoaderTreeBuilder { ...@@ -41,7 +40,6 @@ impl AppPageLoaderTreeBuilder {
AppPageLoaderTreeBuilder { AppPageLoaderTreeBuilder {
base: BaseLoaderTreeBuilder::new(module_asset_context, server_component_transition), base: BaseLoaderTreeBuilder::new(module_asset_context, server_component_transition),
loader_tree_code: String::new(), loader_tree_code: String::new(),
pages: Vec::new(),
base_path, base_path,
} }
} }
...@@ -52,10 +50,6 @@ impl AppPageLoaderTreeBuilder { ...@@ -52,10 +50,6 @@ impl AppPageLoaderTreeBuilder {
path: Option<FileSystemPath>, path: Option<FileSystemPath>,
) -> Result<()> { ) -> Result<()> {
if let Some(path) = path { if let Some(path) = path {
if matches!(module_type, AppDirModuleType::Page) {
self.pages.push(path.clone());
}
let tuple_code = self let tuple_code = self
.base .base
.create_module_tuple_code(module_type, path) .create_module_tuple_code(module_type, path)
...@@ -427,7 +421,6 @@ impl AppPageLoaderTreeBuilder { ...@@ -427,7 +421,6 @@ impl AppPageLoaderTreeBuilder {
imports: self.base.imports, imports: self.base.imports,
loader_tree_code: self.loader_tree_code.into(), loader_tree_code: self.loader_tree_code.into(),
inner_assets: self.base.inner_assets, inner_assets: self.base.inner_assets,
pages: self.pages,
}) })
} }
} }
...@@ -436,7 +429,6 @@ pub struct AppPageLoaderTreeModule { ...@@ -436,7 +429,6 @@ pub struct AppPageLoaderTreeModule {
pub imports: Vec<RcStr>, pub imports: Vec<RcStr>,
pub loader_tree_code: RcStr, pub loader_tree_code: RcStr,
pub inner_assets: FxIndexMap<RcStr, ResolvedVc<Box<dyn Module>>>, pub inner_assets: FxIndexMap<RcStr, ResolvedVc<Box<dyn Module>>>,
pub pages: Vec<FileSystemPath>,
} }
impl AppPageLoaderTreeModule { impl AppPageLoaderTreeModule {
......
...@@ -2,7 +2,7 @@ use std::io::Write; ...@@ -2,7 +2,7 @@ use std::io::Write;
use anyhow::Result; use anyhow::Result;
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc, fxindexmap}; use turbo_tasks::{ResolvedVc, Vc, fxindexmap};
use turbo_tasks_fs::{self, File, FileSystemPath, rope::RopeBuilder}; use turbo_tasks_fs::{self, File, FileSystemPath, rope::RopeBuilder};
use turbopack::ModuleAssetContext; use turbopack::ModuleAssetContext;
use turbopack_core::{ use turbopack_core::{
...@@ -13,10 +13,7 @@ use turbopack_core::{ ...@@ -13,10 +13,7 @@ use turbopack_core::{
source::Source, source::Source,
virtual_source::VirtualSource, virtual_source::VirtualSource,
}; };
use turbopack_ecmascript::{ use turbopack_ecmascript::runtime_functions::{TURBOPACK_LOAD, TURBOPACK_REQUIRE};
runtime_functions::{TURBOPACK_LOAD, TURBOPACK_REQUIRE},
utils::StringifyJs,
};
use super::app_entry::AppEntry; use super::app_entry::AppEntry;
use crate::{ use crate::{
...@@ -64,7 +61,6 @@ pub async fn get_app_page_entry( ...@@ -64,7 +61,6 @@ pub async fn get_app_page_entry(
inner_assets, inner_assets,
imports, imports,
loader_tree_code, loader_tree_code,
pages,
} = loader_tree; } = loader_tree;
let mut result = RopeBuilder::default(); let mut result = RopeBuilder::default();
...@@ -73,12 +69,6 @@ pub async fn get_app_page_entry( ...@@ -73,12 +69,6 @@ pub async fn get_app_page_entry(
writeln!(result, "{import}")?; writeln!(result, "{import}")?;
} }
let pages = pages
.iter()
.map(|page| page.value_to_string())
.try_join()
.await?;
let original_name: RcStr = page.to_string().into(); let original_name: RcStr = page.to_string().into();
let pathname: RcStr = AppPath::from(page.clone()).to_string().into(); let pathname: RcStr = AppPath::from(page.clone()).to_string().into();
...@@ -100,7 +90,6 @@ pub async fn get_app_page_entry( ...@@ -100,7 +90,6 @@ pub async fn get_app_page_entry(
], ],
&[ &[
("tree", &*loader_tree_code), ("tree", &*loader_tree_code),
("pages", &StringifyJs(&pages).to_string()),
("__next_app_require__", &TURBOPACK_REQUIRE.bound()), ("__next_app_require__", &TURBOPACK_REQUIRE.bound()),
("__next_app_load_chunk__", &TURBOPACK_LOAD.bound()), ("__next_app_load_chunk__", &TURBOPACK_LOAD.bound()),
], ],
......
...@@ -63,14 +63,10 @@ import { NoFallbackError } from '../../shared/lib/no-fallback-error.external' ...@@ -63,14 +63,10 @@ import { NoFallbackError } from '../../shared/lib/no-fallback-error.external'
* and I've updated it. * and I've updated it.
*/ */
declare const tree: LoaderTree declare const tree: LoaderTree
declare const pages: any
// We inject the tree and pages here so that we can use them in the route // We inject the tree and pages here so that we can use them in the route
// module. // module.
// INJECT:tree // INJECT:tree
// INJECT:pages
export { pages }
import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' } import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' }
...@@ -334,7 +330,6 @@ export async function handler( ...@@ -334,7 +330,6 @@ export async function handler(
const ComponentMod = { const ComponentMod = {
...entryBase, ...entryBase,
tree, tree,
pages,
GlobalError, GlobalError,
handler, handler,
routeModule, routeModule,
......
...@@ -152,7 +152,6 @@ async function createTreeCodeFromPath( ...@@ -152,7 +152,6 @@ async function createTreeCodeFromPath(
} }
): Promise<{ ): Promise<{
treeCode: string treeCode: string
pages: string
rootLayout: string | undefined rootLayout: string | undefined
globalError: string globalError: string
globalNotFound: string globalNotFound: string
...@@ -163,7 +162,6 @@ async function createTreeCodeFromPath( ...@@ -163,7 +162,6 @@ async function createTreeCodeFromPath(
const isDefaultNotFound = isAppBuiltinPage(pagePath) const isDefaultNotFound = isAppBuiltinPage(pagePath)
const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0] const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]
const pages: string[] = []
let rootLayout: string | undefined let rootLayout: string | undefined
let globalError: string = defaultGlobalErrorPath let globalError: string = defaultGlobalErrorPath
...@@ -248,8 +246,6 @@ async function createTreeCodeFromPath( ...@@ -248,8 +246,6 @@ async function createTreeCodeFromPath(
const resolvedPagePath = await resolver(matchedPagePath) const resolvedPagePath = await resolver(matchedPagePath)
if (resolvedPagePath) { if (resolvedPagePath) {
pages.push(resolvedPagePath)
const varName = `page${nestedCollectedDeclarations.length}` const varName = `page${nestedCollectedDeclarations.length}`
nestedCollectedDeclarations.push([varName, resolvedPagePath]) nestedCollectedDeclarations.push([varName, resolvedPagePath])
...@@ -576,7 +572,6 @@ async function createTreeCodeFromPath( ...@@ -576,7 +572,6 @@ async function createTreeCodeFromPath(
return { return {
treeCode: `${treeCode}.children;`, treeCode: `${treeCode}.children;`,
pages: `${JSON.stringify(pages)};`,
rootLayout, rootLayout,
globalError, globalError,
globalNotFound, globalNotFound,
...@@ -891,7 +886,6 @@ const nextAppLoader: AppLoader = async function nextAppLoader() { ...@@ -891,7 +886,6 @@ const nextAppLoader: AppLoader = async function nextAppLoader() {
}, },
{ {
tree: treeCodeResult.treeCode, tree: treeCodeResult.treeCode,
pages: treeCodeResult.pages,
__next_app_require__: '__webpack_require__', __next_app_require__: '__webpack_require__',
// all modules are in the entry chunk, so we never actually need to load chunks in webpack // all modules are in the entry chunk, so we never actually need to load chunks in webpack
__next_app_load_chunk__: '() => Promise.resolve()', __next_app_load_chunk__: '() => Promise.resolve()',
......
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