Skip to content

Commit 2eeb4cb

Browse files
authored
perf: use node: prefix to bypass require.cache call for builtins (#785)
1 parent a8f531a commit 2eeb4cb

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

templates/app-esm/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import path from 'path'
1+
import path from 'node:path'
22
import AutoLoad from '@fastify/autoload'
3-
import { fileURLToPath } from 'url'
3+
import { fileURLToPath } from 'node:url'
44

55
const __filename = fileURLToPath(import.meta.url)
66
const __dirname = path.dirname(__filename)

templates/app-esm/test/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// between our tests.
33

44
import helper from 'fastify-cli/helper.js'
5-
import path from 'path'
6-
import { fileURLToPath } from 'url'
5+
import path from 'node:path'
6+
import { fileURLToPath } from 'node:url'
77

88
const __filename = fileURLToPath(import.meta.url)
99
const __dirname = path.dirname(__filename)

templates/app-ts-esm/src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as path from 'path';
1+
import * as path from 'node:path';
22
import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload';
33
import { FastifyPluginAsync } from 'fastify';
4-
import { fileURLToPath } from 'url'
4+
import { fileURLToPath } from 'node:url'
55

66
const __filename = fileURLToPath(import.meta.url)
77
const __dirname = path.dirname(__filename)

templates/app-ts-esm/test/helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// This file contains code that we reuse between our tests.
22
import helper from 'fastify-cli/helper.js'
33
import * as test from 'node:test'
4-
import * as path from 'path'
5-
import { fileURLToPath } from 'url'
4+
import * as path from 'node:path'
5+
import { fileURLToPath } from 'node:url'
66

77
export type TestContext = {
88
after: typeof test.after

templates/app-ts/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'path';
1+
import { join } from 'node:path';
22
import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload';
33
import { FastifyPluginAsync, FastifyServerOptions } from 'fastify';
44

templates/app-ts/test/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file contains code that we reuse between our tests.
22
const helper = require('fastify-cli/helper.js')
3-
import * as path from 'path'
3+
import * as path from 'node:path'
44
import * as test from 'node:test'
55

66
export type TestContext = {

test/esm/util.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { requireModule } from '../../util.js'
22
import { resolve, join } from 'node:path'
33
import t from 'tap'
4-
import * as url from 'url'
4+
import * as url from 'node:url'
55

66
const test = t.test
77

0 commit comments

Comments
 (0)