-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GitHub Actions
committed
May 2, 2024
1 parent
fbd177f
commit bd5198e
Showing
12 changed files
with
102 additions
and
83 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 was deleted.
Oops, something went wrong.
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,49 @@ | ||
import path from 'node:path' | ||
|
||
import type { PagesDependency } from '@redwoodjs/project-config' | ||
import { | ||
ensurePosixPath, | ||
getPaths, | ||
processPagesDir, | ||
} from '@redwoodjs/project-config' | ||
|
||
const getPathRelativeToSrc = (maybeAbsolutePath: string) => { | ||
// If the path is already relative | ||
if (!path.isAbsolute(maybeAbsolutePath)) { | ||
return maybeAbsolutePath | ||
} | ||
|
||
return `./${path.relative(getPaths().web.src, maybeAbsolutePath)}` | ||
} | ||
|
||
const withRelativeImports = (page: PagesDependency) => { | ||
return { | ||
...page, | ||
relativeImport: ensurePosixPath(getPathRelativeToSrc(page.importPath)), | ||
} | ||
} | ||
|
||
export function getEntries() { | ||
const entries: Record<string, string> = {} | ||
|
||
// Add the various pages | ||
const pages = processPagesDir().map(withRelativeImports) | ||
for (const page of pages) { | ||
entries[page.importName] = page.path | ||
} | ||
|
||
// Add the "ServerEntry" entry | ||
const serverEntry = getPaths().web.entryServer | ||
if (!serverEntry) { | ||
throw new Error('Server Entry file not found') | ||
} | ||
entries['ServerEntry'] = serverEntry | ||
|
||
return entries | ||
} | ||
|
||
export async function getEntriesFromDist(): Promise<Record<string, string>> { | ||
const entriesDist = getPaths().web.distRscEntries | ||
const { serverEntries } = await import(`file://${entriesDist}`) | ||
return serverEntries | ||
} |
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