Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Nov 5, 2024
1 parent 5641671 commit b9c54ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/Server/__tests__/getWebpackEarlyHints.jest.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import fs from "fs"
import path from "path"
import { getWebpackEalyHints } from "Server/getWebpackEarlyHints"
import { getWebpackEarlyHints } from "Server/getWebpackEarlyHints"

jest.mock("fs")
jest.mock("Server/config", () => ({ CDN_URL: "https://cdn.example.com" }))

const HINTS_PATH = path.join(process.cwd(), "public/assets", "early-hints.json")

describe("getWebpackEalyHints", () => {
describe("getWebpackEarlyHints", () => {
const mockReadFileSync = fs.readFileSync as jest.Mock

afterEach(() => {
Expand All @@ -20,7 +20,7 @@ describe("getWebpackEalyHints", () => {

mockReadFileSync.mockReturnValueOnce(JSON.stringify(mockChunkFiles))

const result = getWebpackEalyHints()
const result = getWebpackEarlyHints()

expect(fs.readFileSync).toHaveBeenCalledWith(HINTS_PATH, "utf-8")
expect(result.linkHeaders).toEqual([
Expand All @@ -39,7 +39,7 @@ describe("getWebpackEalyHints", () => {

mockReadFileSync.mockReturnValueOnce(JSON.stringify(mockChunkFiles))

const result = getWebpackEalyHints()
const result = getWebpackEarlyHints()

expect(fs.readFileSync).toHaveBeenCalledWith(HINTS_PATH, "utf-8")
expect(result.linkHeaders).toEqual([
Expand Down
2 changes: 1 addition & 1 deletion src/Server/getWebpackEarlyHints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "fs"

const HINTS_PATH = path.join(process.cwd(), "public/assets", "early-hints.json")

export const getWebpackEalyHints = (): {
export const getWebpackEarlyHints = (): {
linkHeaders: string[]
linkPreloadTags: string[]
} => {
Expand Down
4 changes: 2 additions & 2 deletions src/Server/middleware/linkHeadersMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextFunction } from "express"
import type { ArtsyRequest, ArtsyResponse } from "./artsyExpress"
import { CDN_URL, GEMINI_CLOUDFRONT_URL, WEBFONT_URL } from "Server/config"
import { getWebpackEalyHints } from "Server/getWebpackEarlyHints"
import { getWebpackEarlyHints } from "Server/getWebpackEarlyHints"

/**
* Link headers allow 103: Early Hints to be sent to the client (by Cloudflare).
Expand All @@ -13,7 +13,7 @@ export function linkHeadersMiddleware(
res: ArtsyResponse,
next: NextFunction
) {
const { linkHeaders } = getWebpackEalyHints()
const { linkHeaders } = getWebpackEarlyHints()

if (!res.headersSent) {
res.header("Link", [
Expand Down
4 changes: 2 additions & 2 deletions src/System/Router/renderServerApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getENV } from "Utils/getENV"
import { ServerAppResults } from "System/Router/serverRouter"
import { Transform } from "stream"
import { ENABLE_SSR_STREAMING } from "Server/config"
import { getWebpackEalyHints } from "Server/getWebpackEarlyHints"
import { getWebpackEarlyHints } from "Server/getWebpackEarlyHints"

// TODO: Use the same variables as the asset middleware. Both config and sharify
// have a default CDN_URL while this does not.
Expand Down Expand Up @@ -50,7 +50,7 @@ export const renderServerApp = ({

const scripts = extractScriptTags?.()

const { linkPreloadTags } = getWebpackEalyHints()
const { linkPreloadTags } = getWebpackEarlyHints()

const options = {
cdnUrl: NODE_ENV === "production" ? CDN_URL : "",
Expand Down

0 comments on commit b9c54ea

Please sign in to comment.