Skip to content

Commit b138ed1

Browse files
committed
refactor!: remove legacy timing plugin
1 parent 104bfe7 commit b138ed1

File tree

8 files changed

+2
-134
lines changed

8 files changed

+2
-134
lines changed

docs/3.config/0.index.md

-9
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,6 @@ Uses built-in SWR functionality (using caching layer and storage) for Netlify an
128128

129129
Storage configuration, read more in the [Storage Layer](/guide/storage) section.
130130

131-
### `timing`
132-
133-
- Default: `false`{lang=ts}
134-
135-
Enable timing information:
136-
137-
- Nitro startup time log
138-
- `Server-Timing` header on HTTP responses
139-
140131
### `renderer`
141132

142133
Path to main render (file should export an event handler as default)

src/build/rollup/base.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { isAbsolute, join, dirname, resolve } from "pathe";
1010
import { hash } from "ohash";
1111
import { defu } from "defu";
1212
import { resolveModulePath } from "exsolve";
13-
import { isTest, isWindows } from "std-env";
13+
import { isWindows } from "std-env";
1414
import { defineEnv } from "unenv";
1515
import { runtimeDir, runtimeDependencies } from "nitro/runtime/meta";
1616
import unimportPlugin from "unimport/unplugin";
@@ -23,7 +23,6 @@ import { publicAssets } from "./plugins/public-assets";
2323
import { raw } from "./plugins/raw";
2424
import { serverAssets } from "./plugins/server-assets";
2525
import { storage } from "./plugins/storage";
26-
import { timing } from "./plugins/timing";
2726
import { virtual } from "./plugins/virtual";
2827
import { errorHandler } from "./plugins/error-handler";
2928
import { externals } from "./plugins/externals";
@@ -34,15 +33,6 @@ export function baseRollupPlugins(
3433
) {
3534
const plugins: Plugin[] = [];
3635

37-
// Server timing
38-
if (nitro.options.timing) {
39-
plugins.push(
40-
timing({
41-
silent: isTest,
42-
})
43-
);
44-
}
45-
4636
// Auto imports
4737
if (nitro.options.imports) {
4838
plugins.push(unimportPlugin.rollup(nitro.options.imports) as Plugin);

src/build/rollup/plugins/timing.ts

-53
This file was deleted.

src/config/defaults.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { isDebug, isTest } from "std-env";
66
export const NitroDefaults: NitroConfig = {
77
// General
88
debug: isDebug,
9-
timing: isDebug,
109
logLevel: isTest ? 1 : 3,
1110
runtimeConfig: { app: {}, nitro: {} },
1211

src/nitro.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,11 @@ export async function createNitro(
4747
await nitro.storage.dispose();
4848
});
4949

50-
// Debug and timing
50+
// Debug
5151
if (nitro.options.debug) {
5252
createDebugger(nitro.hooks, { tag: "nitro" });
5353
nitro.options.plugins.push(join(runtimeDir, "internal/debug"));
5454
}
55-
if (nitro.options.timing) {
56-
nitro.options.plugins.push(join(runtimeDir, "internal/timing"));
57-
}
5855

5956
// Logger
6057
if (nitro.options.logLevel !== undefined) {

src/runtime/internal/timing.ts

-44
This file was deleted.

src/types/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export interface NitroOptions extends PresetOptions {
7272
database: DatabaseConnectionConfigs;
7373
devDatabase: DatabaseConnectionConfigs;
7474
bundledStorage: string[];
75-
timing: boolean;
7675
renderer?: string;
7776
serveStatic: boolean | "node" | "deno" | "inline";
7877
noPublicDir: boolean;

test/tests.ts

-11
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export async function setupTest(
132132
output: {
133133
dir: ctx.outDir,
134134
},
135-
timing: !ctx.isWorker,
136135
});
137136
const nitro = (ctx.nitro = await createNitro(config, {
138137
compatibilityDate: opts.compatibilityDate || formatDate(new Date()),
@@ -569,16 +568,6 @@ export function testNitro(
569568
});
570569
});
571570

572-
if (ctx.nitro!.options.timing) {
573-
it("set server timing header", async () => {
574-
const { status, headers } = await callHandler({
575-
url: "/api/hello",
576-
});
577-
expect(status).toBe(200);
578-
expect(headers["server-timing"]).toMatch(/-;dur=\d+;desc="Generate"/);
579-
});
580-
}
581-
582571
it("static build flags", async () => {
583572
const { data } = await callHandler({ url: "/static-flags" });
584573
expect(data).toMatchObject({

0 commit comments

Comments
 (0)