Skip to content

Commit 6e58093

Browse files
authored
refactor: join join arguments (#278)
1 parent e472c6b commit 6e58093

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/cloudflare/src/cli/build/patches/to-investigate/inline-eval-manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { normalizePath } from "../../utils/index.js";
1414
*/
1515
export function inlineEvalManifest(code: string, config: Config): string {
1616
const manifestJss = globSync(
17-
normalizePath(join(config.paths.output.standaloneAppDotNext, "**", "*_client-reference-manifest.js"))
17+
normalizePath(join(config.paths.output.standaloneAppDotNext, "**/*_client-reference-manifest.js"))
1818
).map((file) =>
1919
normalizePath(file).replace(normalizePath(config.paths.output.standaloneApp) + posix.sep, "")
2020
);

packages/cloudflare/src/cli/build/patches/to-investigate/patch-read-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function patchLoadManifest(code: string, config: Config): string {
2424
// (source: https://github.com/vercel/next.js/blob/15aeb92e/packages/next/src/server/load-manifest.ts#L34-L56)
2525
// Note: we could/should probably just patch readFileSync here or something!
2626
const manifestJsons = globSync(
27-
normalizePath(join(config.paths.output.standaloneAppDotNext, "**", "*-manifest.json"))
27+
normalizePath(join(config.paths.output.standaloneAppDotNext, "**/*-manifest.json"))
2828
).map((file) =>
2929
normalizePath(file).replace(normalizePath(config.paths.output.standaloneApp) + posix.sep, "")
3030
);

packages/cloudflare/src/cli/build/patches/to-investigate/wrangler-deps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function patchWranglerDeps(config: Config) {
1717
// [alias]
1818
// # critters is `require`d from `pages.runtime.prod.js` when running wrangler dev, so we need to stub it out
1919
// "critters" = "./.next/standalone/node_modules/cf/templates/shims/empty.ts"
20-
const pagesRuntimeFile = join(distPath, "compiled", "next-server", "pages.runtime.prod.js");
20+
const pagesRuntimeFile = join(distPath, "compiled/next-server/pages.runtime.prod.js");
2121

2222
const patchedPagesRuntime = readFileSync(pagesRuntimeFile, "utf-8").replace(
2323
`e.exports=require("critters")`,
@@ -38,7 +38,7 @@ export function patchWranglerDeps(config: Config) {
3838
// # try block here: https://github.com/vercel/next.js/blob/9e8266a7/packages/next/src/server/lib/trace/tracer.ts#L27-L31
3939
// # causing the code to require the 'next/dist/compiled/@opentelemetry/api' module instead (which properly works)
4040
// #"@opentelemetry/api" = "./.next/standalone/node_modules/cf/templates/shims/throw.ts"
41-
const tracerFile = join(distPath, "server", "lib", "trace", "tracer.js");
41+
const tracerFile = join(distPath, "server/lib/trace/tracer.js");
4242

4343
const patchedTracer = readFileSync(tracerFile, "utf-8").replaceAll(
4444
/\w+\s*=\s*require\([^/]*opentelemetry.*\)/g,
@@ -63,7 +63,7 @@ export function patchWranglerDeps(config: Config) {
6363
function getDistPath(config: Config): string {
6464
for (const root of [config.paths.output.standaloneApp, config.paths.output.standaloneRoot]) {
6565
try {
66-
const distPath = join(root, "node_modules", "next", "dist");
66+
const distPath = join(root, "node_modules/next/dist");
6767
if (statSync(distPath).isDirectory()) return distPath;
6868
} catch {
6969
/* empty */
@@ -92,7 +92,7 @@ function patchRequireReactDomServerEdge(config: Config) {
9292
const distPath = getDistPath(config);
9393

9494
// Patch .next/standalone/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js
95-
const pagesRuntimeFile = join(distPath, "compiled", "next-server", "pages.runtime.prod.js");
95+
const pagesRuntimeFile = join(distPath, "compiled/next-server/pages.runtime.prod.js");
9696

9797
const code = readFileSync(pagesRuntimeFile, "utf-8");
9898
const file = tsParseFile(code);

packages/cloudflare/src/cli/build/utils/create-config-files.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function createWranglerConfigIfNotExistent(projectOpts: ProjectOpti
4141
return;
4242
}
4343

44-
let wranglerConfig = readFileSync(join(getPackageTemplatesDirPath(), "defaults", "wrangler.json"), "utf8");
44+
let wranglerConfig = readFileSync(join(getPackageTemplatesDirPath(), "defaults/wrangler.json"), "utf8");
4545

4646
const appName = getAppNameFromPackageJson(projectOpts.sourceDir) ?? "app-name";
4747
if (appName) {
@@ -111,6 +111,6 @@ export async function createOpenNextConfigIfNotExistent(projectOpts: ProjectOpti
111111
throw new Error("The `open-next.config.ts` file is required, aborting!");
112112
}
113113

114-
cpSync(join(getPackageTemplatesDirPath(), "defaults", "open-next.config.ts"), openNextConfigPath);
114+
cpSync(join(getPackageTemplatesDirPath(), "defaults/open-next.config.ts"), openNextConfigPath);
115115
}
116116
}

packages/cloudflare/src/cli/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function getConfig(projectOpts: ProjectOptions): Config {
6666

6767
const nodeModules = join(standaloneApp, "node_modules");
6868
const internalPackage = join(nodeModules, ...PACKAGE_NAME.split("/"));
69-
const internalTemplates = join(internalPackage, "cli", "templates");
69+
const internalTemplates = join(internalPackage, "cli/templates");
7070

7171
return {
7272
build: {
@@ -141,7 +141,7 @@ function getNextjsApplicationPath(dotNextDir: string): string {
141141

142142
function findServerParentPath(parentPath: string): string | undefined {
143143
try {
144-
if (statSync(join(parentPath, ".next", "server")).isDirectory()) {
144+
if (statSync(join(parentPath, ".next/server")).isDirectory()) {
145145
return parentPath;
146146
}
147147
} catch {

0 commit comments

Comments
 (0)