File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- import inspector from 'node:inspector'
43import nodeModule from 'node:module'
54import process from 'node:process'
65import { fileURLToPath } from 'node:url'
3433 process . argv . includes ( '--profile' )
3534 || process . argv . some ( a => a . startsWith ( '--profile=' ) )
3635) {
37- const session = new inspector . Session ( )
36+ const session = new ( process . getBuiltinModule ( 'node: inspector' ) . Session ) ( )
3837 session . connect ( )
3938 // eslint-disable-next-line antfu/no-top-level-await
4039 await new Promise ( ( resolve ) => {
Original file line number Diff line number Diff line change 11import type { CommandDef } from 'citty'
22
3- import nodeCrypto from 'node:crypto'
4- import { builtinModules , createRequire } from 'node:module'
53import { resolve } from 'node:path'
64import process from 'node:process'
75
@@ -17,22 +15,6 @@ import { debug, logger } from '../../nuxt-cli/src/utils/logger'
1715import { findInPath , withLocalBinPath } from '../../nuxt-cli/src/utils/path-env'
1816import { description , name , version } from '../package.json'
1917
20- // globalThis.crypto support for Node.js 18
21- if ( ! globalThis . crypto ) {
22- globalThis . crypto = nodeCrypto . webcrypto as unknown as Crypto
23- }
24-
25- // Node.js below v22.3.0, v20.16.0
26- if ( ! process . getBuiltinModule ) {
27- const _require = createRequire ( import . meta. url )
28- // @ts -expect-error we are overriding with inferior types
29- process . getBuiltinModule = ( name : string ) => {
30- if ( name . startsWith ( 'node:' ) || builtinModules . includes ( name ) ) {
31- return _require . resolve ( name )
32- }
33- }
34- }
35-
3618const commands = {
3719 init : ( ) => import ( '../../create-nuxt/src/init' ) . then ( m => m . default || m ) ,
3820} as const
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- import inspector from 'node:inspector'
43import nodeModule from 'node:module'
54import { homedir } from 'node:os'
65import { join } from 'node:path'
4241 process . argv . includes ( '--profile' )
4342 || process . argv . some ( a => a . startsWith ( '--profile=' ) )
4443) {
45- const session = new inspector . Session ( )
44+ const session = new ( process . getBuiltinModule ( 'node: inspector' ) . Session ) ( )
4645 session . connect ( )
4746
4847 try {
You can’t perform that action at this time.
0 commit comments