refactor: use the node: protocol (#6710)

This commit is contained in:
Almeida
2021-10-02 12:40:02 +01:00
committed by GitHub
parent 466e796a1d
commit 531b46c60d
17 changed files with 28 additions and 28 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
const EventEmitter = require('events');
const path = require('path');
const EventEmitter = require('node:events');
const path = require('node:path');
const { Error } = require('../errors');
const Util = require('../util/Util');
let childProcess = null;
@@ -21,8 +21,8 @@ class Shard extends EventEmitter {
constructor(manager, id) {
super();
if (manager.mode === 'process') childProcess = require('child_process');
else if (manager.mode === 'worker') Worker = require('worker_threads').Worker;
if (manager.mode === 'process') childProcess = require('node:child_process');
else if (manager.mode === 'worker') Worker = require('node:worker_threads').Worker;
/**
* Manager that created the shard

View File

@@ -44,7 +44,7 @@ class ShardClientUtil {
process.send({ _reconnecting: true });
});
} else if (mode === 'worker') {
this.parentPort = require('worker_threads').parentPort;
this.parentPort = require('node:worker_threads').parentPort;
this.parentPort.on('message', this._handleMessage.bind(this));
client.on('ready', () => {
this.parentPort.postMessage({ _ready: true });

View File

@@ -1,8 +1,8 @@
'use strict';
const EventEmitter = require('events');
const fs = require('fs');
const path = require('path');
const EventEmitter = require('node:events');
const fs = require('node:fs');
const path = require('node:path');
const { Collection } = require('@discordjs/collection');
const Shard = require('./Shard');
const { Error, TypeError, RangeError } = require('../errors');