Skip to content

Commit 69af581

Browse files
authored
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.
1 parent 4914f32 commit 69af581

File tree

4 files changed

+2
-32
lines changed

4 files changed

+2
-32
lines changed

crates/next-core/src/app_page_loader_tree.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use crate::{
2727
pub struct AppPageLoaderTreeBuilder {
2828
base: BaseLoaderTreeBuilder,
2929
loader_tree_code: String,
30-
pages: Vec<FileSystemPath>,
3130
/// next.config.js' basePath option to construct og metadata.
3231
base_path: Option<RcStr>,
3332
}
@@ -41,7 +40,6 @@ impl AppPageLoaderTreeBuilder {
4140
AppPageLoaderTreeBuilder {
4241
base: BaseLoaderTreeBuilder::new(module_asset_context, server_component_transition),
4342
loader_tree_code: String::new(),
44-
pages: Vec::new(),
4543
base_path,
4644
}
4745
}
@@ -52,10 +50,6 @@ impl AppPageLoaderTreeBuilder {
5250
path: Option<FileSystemPath>,
5351
) -> Result<()> {
5452
if let Some(path) = path {
55-
if matches!(module_type, AppDirModuleType::Page) {
56-
self.pages.push(path.clone());
57-
}
58-
5953
let tuple_code = self
6054
.base
6155
.create_module_tuple_code(module_type, path)
@@ -427,7 +421,6 @@ impl AppPageLoaderTreeBuilder {
427421
imports: self.base.imports,
428422
loader_tree_code: self.loader_tree_code.into(),
429423
inner_assets: self.base.inner_assets,
430-
pages: self.pages,
431424
})
432425
}
433426
}
@@ -436,7 +429,6 @@ pub struct AppPageLoaderTreeModule {
436429
pub imports: Vec<RcStr>,
437430
pub loader_tree_code: RcStr,
438431
pub inner_assets: FxIndexMap<RcStr, ResolvedVc<Box<dyn Module>>>,
439-
pub pages: Vec<FileSystemPath>,
440432
}
441433

442434
impl AppPageLoaderTreeModule {

crates/next-core/src/next_app/app_page_entry.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::io::Write;
22

33
use anyhow::Result;
44
use turbo_rcstr::RcStr;
5-
use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc, fxindexmap};
5+
use turbo_tasks::{ResolvedVc, Vc, fxindexmap};
66
use turbo_tasks_fs::{self, File, FileSystemPath, rope::RopeBuilder};
77
use turbopack::ModuleAssetContext;
88
use turbopack_core::{
@@ -13,10 +13,7 @@ use turbopack_core::{
1313
source::Source,
1414
virtual_source::VirtualSource,
1515
};
16-
use turbopack_ecmascript::{
17-
runtime_functions::{TURBOPACK_LOAD, TURBOPACK_REQUIRE},
18-
utils::StringifyJs,
19-
};
16+
use turbopack_ecmascript::runtime_functions::{TURBOPACK_LOAD, TURBOPACK_REQUIRE};
2017

2118
use super::app_entry::AppEntry;
2219
use crate::{
@@ -64,7 +61,6 @@ pub async fn get_app_page_entry(
6461
inner_assets,
6562
imports,
6663
loader_tree_code,
67-
pages,
6864
} = loader_tree;
6965

7066
let mut result = RopeBuilder::default();
@@ -73,12 +69,6 @@ pub async fn get_app_page_entry(
7369
writeln!(result, "{import}")?;
7470
}
7571

76-
let pages = pages
77-
.iter()
78-
.map(|page| page.value_to_string())
79-
.try_join()
80-
.await?;
81-
8272
let original_name: RcStr = page.to_string().into();
8373
let pathname: RcStr = AppPath::from(page.clone()).to_string().into();
8474

@@ -100,7 +90,6 @@ pub async fn get_app_page_entry(
10090
],
10191
&[
10292
("tree", &*loader_tree_code),
103-
("pages", &StringifyJs(&pages).to_string()),
10493
("__next_app_require__", &TURBOPACK_REQUIRE.bound()),
10594
("__next_app_load_chunk__", &TURBOPACK_LOAD.bound()),
10695
],

packages/next/src/build/templates/app-page.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,10 @@ import { NoFallbackError } from '../../shared/lib/no-fallback-error.external'
6363
* and I've updated it.
6464
*/
6565
declare const tree: LoaderTree
66-
declare const pages: any
6766

6867
// We inject the tree and pages here so that we can use them in the route
6968
// module.
7069
// INJECT:tree
71-
// INJECT:pages
72-
73-
export { pages }
7470

7571
import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' }
7672

@@ -334,7 +330,6 @@ export async function handler(
334330
const ComponentMod = {
335331
...entryBase,
336332
tree,
337-
pages,
338333
GlobalError,
339334
handler,
340335
routeModule,

packages/next/src/build/webpack/loaders/next-app-loader/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ async function createTreeCodeFromPath(
152152
}
153153
): Promise<{
154154
treeCode: string
155-
pages: string
156155
rootLayout: string | undefined
157156
globalError: string
158157
globalNotFound: string
@@ -163,7 +162,6 @@ async function createTreeCodeFromPath(
163162
const isDefaultNotFound = isAppBuiltinPage(pagePath)
164163

165164
const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]
166-
const pages: string[] = []
167165

168166
let rootLayout: string | undefined
169167
let globalError: string = defaultGlobalErrorPath
@@ -248,8 +246,6 @@ async function createTreeCodeFromPath(
248246

249247
const resolvedPagePath = await resolver(matchedPagePath)
250248
if (resolvedPagePath) {
251-
pages.push(resolvedPagePath)
252-
253249
const varName = `page${nestedCollectedDeclarations.length}`
254250
nestedCollectedDeclarations.push([varName, resolvedPagePath])
255251

@@ -576,7 +572,6 @@ async function createTreeCodeFromPath(
576572

577573
return {
578574
treeCode: `${treeCode}.children;`,
579-
pages: `${JSON.stringify(pages)};`,
580575
rootLayout,
581576
globalError,
582577
globalNotFound,
@@ -891,7 +886,6 @@ const nextAppLoader: AppLoader = async function nextAppLoader() {
891886
},
892887
{
893888
tree: treeCodeResult.treeCode,
894-
pages: treeCodeResult.pages,
895889
__next_app_require__: '__webpack_require__',
896890
// all modules are in the entry chunk, so we never actually need to load chunks in webpack
897891
__next_app_load_chunk__: '() => Promise.resolve()',

0 commit comments

Comments
 (0)