File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import { __internalHelper , logger } from '../dist/index.js ' ;
2+ import nodeModule from 'node:module ' ;
33
4- const { runCli, prepareCli } = __internalHelper ;
4+ // enable on-disk code caching of all modules loaded by Node.js
5+ // requires Nodejs >= 22.8.0
6+ // @ts -expect-error enableCompileCache is not typed in `@types/node` 18.x
7+ const { enableCompileCache } = nodeModule ;
8+ if ( enableCompileCache && ! process . env . NODE_DISABLE_COMPILE_CACHE ) {
9+ try {
10+ enableCompileCache ( ) ;
11+ } catch {
12+ // ignore errors
13+ }
14+ }
515
616async function main ( ) {
17+ const { __internalHelper, logger } = await import ( '../dist/index.js' ) ;
18+ const { runCli, prepareCli } = __internalHelper ;
19+
720 prepareCli ( ) ;
821
922 try {
Original file line number Diff line number Diff line change 1- import nodeModule from 'node:module' ;
21import { logger } from '../logger' ;
32
43function initNodeEnv ( ) {
@@ -13,16 +12,6 @@ function initNodeEnv() {
1312export function prepareCli ( ) : void {
1413 initNodeEnv ( ) ;
1514
16- // @ts -expect-error enableCompileCache is not typed yet
17- const { enableCompileCache } = nodeModule ;
18- if ( enableCompileCache && ! process . env . NODE_DISABLE_COMPILE_CACHE ) {
19- try {
20- enableCompileCache ( ) ;
21- } catch {
22- // ignore errors
23- }
24- }
25-
2615 // Print a blank line to keep the greet log nice.
2716 // Some package managers automatically output a blank line, some do not.
2817 const { npm_execpath } = process . env ;
You can’t perform that action at this time.
0 commit comments