Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins (#785
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Fdawgs authored Dec 15, 2024
1 parent a8f531a commit 2eeb4cb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions templates/app-esm/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'
import path from 'node:path'
import AutoLoad from '@fastify/autoload'
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
Expand Down
4 changes: 2 additions & 2 deletions templates/app-esm/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// between our tests.

import helper from 'fastify-cli/helper.js'
import path from 'path'
import { fileURLToPath } from 'url'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
Expand Down
4 changes: 2 additions & 2 deletions templates/app-ts-esm/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';
import * as path from 'node:path';
import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload';
import { FastifyPluginAsync } from 'fastify';
import { fileURLToPath } from 'url'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
Expand Down
4 changes: 2 additions & 2 deletions templates/app-ts-esm/test/helper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This file contains code that we reuse between our tests.
import helper from 'fastify-cli/helper.js'
import * as test from 'node:test'
import * as path from 'path'
import { fileURLToPath } from 'url'
import * as path from 'node:path'
import { fileURLToPath } from 'node:url'

export type TestContext = {
after: typeof test.after
Expand Down
2 changes: 1 addition & 1 deletion templates/app-ts/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'path';
import { join } from 'node:path';
import AutoLoad, {AutoloadPluginOptions} from '@fastify/autoload';
import { FastifyPluginAsync, FastifyServerOptions } from 'fastify';

Expand Down
2 changes: 1 addition & 1 deletion templates/app-ts/test/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file contains code that we reuse between our tests.
const helper = require('fastify-cli/helper.js')
import * as path from 'path'
import * as path from 'node:path'
import * as test from 'node:test'

export type TestContext = {
Expand Down
2 changes: 1 addition & 1 deletion test/esm/util.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { requireModule } from '../../util.js'
import { resolve, join } from 'node:path'
import t from 'tap'
import * as url from 'url'
import * as url from 'node:url'

const test = t.test

Expand Down

0 comments on commit 2eeb4cb

Please sign in to comment.