Add prefer-node-protocol ESLint rule (#21532)

* Add `unicorn/prefer-node-protocol`

* Fix `unicorn/prefer-node-protocol` ESLint errors

* Run `npm run format:fix`

* Add sandboxed-module sourceTransformers in mocha setups

Fix `no such file or directory, open 'node:fs'` in `sandboxed-module`

* Remove `node:` in the SandboxedModule requires

* Fix new linting errors with `node:`

GitOrigin-RevId: 68f6e31e2191fcff4cb8058dd0a6914c14f59926
This commit is contained in:
Antoine Clausse 2024-11-08 11:21:56 +01:00 committed by Copybot
parent 4563273396
commit 7f48c67512
217 changed files with 461 additions and 381 deletions

View file

@ -1,5 +1,5 @@
const { promisify } = require('util') const { promisify } = require('node:util')
const crypto = require('crypto') const crypto = require('node:crypto')
const ALGORITHM = 'aes-256-ctr' const ALGORITHM = 'aes-256-ctr'

View file

@ -1,4 +1,13 @@
const chai = require('chai') const chai = require('chai')
const chaiAsPromised = require('chai-as-promised') const chaiAsPromised = require('chai-as-promised')
const SandboxedModule = require('sandboxed-module')
chai.use(chaiAsPromised) chai.use(chaiAsPromised)
SandboxedModule.configure({
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
})

View file

@ -1,9 +1,9 @@
const _ = require('lodash') const _ = require('lodash')
const { Readable } = require('stream') const { Readable } = require('node:stream')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const fetch = require('node-fetch') const fetch = require('node-fetch')
const http = require('http') const http = require('node:http')
const https = require('https') const https = require('node:https')
/** /**
* @import { Response } from 'node-fetch' * @import { Response } from 'node-fetch'

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const { FetchError, AbortError } = require('node-fetch') const { FetchError, AbortError } = require('node-fetch')
const { Readable } = require('stream') const { Readable } = require('node:stream')
const { once } = require('events') const { once } = require('node:events')
const { TestServer } = require('./helpers/TestServer') const { TestServer } = require('./helpers/TestServer')
const selfsigned = require('selfsigned') const selfsigned = require('selfsigned')
const { const {
@ -24,7 +24,7 @@ const pems = selfsigned.generate(attrs, { days: 365 })
const PRIVATE_KEY = pems.private const PRIVATE_KEY = pems.private
const PUBLIC_CERT = pems.cert const PUBLIC_CERT = pems.cert
const dns = require('dns') const dns = require('node:dns')
const _originalLookup = dns.lookup const _originalLookup = dns.lookup
// Custom DNS resolver function // Custom DNS resolver function
dns.lookup = (hostname, options, callback) => { dns.lookup = (hostname, options, callback) => {

View file

@ -1,9 +1,9 @@
const express = require('express') const express = require('express')
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const { EventEmitter } = require('events') const { EventEmitter } = require('node:events')
const http = require('http') const http = require('node:http')
const https = require('https') const https = require('node:https')
const { promisify } = require('util') const { promisify } = require('node:util')
class TestServer { class TestServer {
constructor() { constructor() {

View file

@ -1,5 +1,5 @@
const { fetchString } = require('@overleaf/fetch-utils') const { fetchString } = require('@overleaf/fetch-utils')
const fs = require('fs') const fs = require('node:fs')
class LogLevelChecker { class LogLevelChecker {
constructor(logger, defaultLevel) { constructor(logger, defaultLevel) {

View file

@ -1,4 +1,4 @@
const Stream = require('stream') const Stream = require('node:stream')
const bunyan = require('bunyan') const bunyan = require('bunyan')
const GCPManager = require('./gcp-manager') const GCPManager = require('./gcp-manager')
const SentryManager = require('./sentry-manager') const SentryManager = require('./sentry-manager')

View file

@ -8,4 +8,9 @@ chai.use(sinonChai)
SandboxedModule.configure({ SandboxedModule.configure({
globals: { Buffer, JSON, console, process }, globals: { Buffer, JSON, console, process },
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
}) })

View file

@ -1,5 +1,5 @@
const Path = require('path') const Path = require('node:path')
const { promisify } = require('util') const { promisify } = require('node:util')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const bunyan = require('bunyan') const bunyan = require('bunyan')
const { expect } = require('chai') const { expect } = require('chai')
const path = require('path') const path = require('node:path')
const sinon = require('sinon') const sinon = require('sinon')
const MODULE_PATH = path.join(__dirname, '../../logging-manager.js') const MODULE_PATH = path.join(__dirname, '../../logging-manager.js')

View file

@ -1,4 +1,4 @@
const Path = require('path') const Path = require('node:path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')

View file

@ -88,7 +88,7 @@ function initializeProfileAgent() {
} }
function initializePrometheus() { function initializePrometheus() {
const os = require('os') const os = require('node:os')
const promClient = require('prom-client') const promClient = require('prom-client')
promClient.register.setDefaultLabels({ app: APP_NAME, host: os.hostname() }) promClient.register.setDefaultLabels({ app: APP_NAME, host: os.hostname() })
promClient.collectDefaultMetrics({ timeout: 5000, prefix: '' }) promClient.collectDefaultMetrics({ timeout: 5000, prefix: '' })

View file

@ -6,8 +6,8 @@
* logged along with the corresponding information from /proc/net/tcp. * logged along with the corresponding information from /proc/net/tcp.
*/ */
const fs = require('fs') const fs = require('node:fs')
const diagnosticsChannel = require('diagnostics_channel') const diagnosticsChannel = require('node:diagnostics_channel')
const SOCKET_MONITOR_INTERVAL = 60 * 1000 const SOCKET_MONITOR_INTERVAL = 60 * 1000
// set the threshold for logging leaked sockets in minutes, defaults to 15 // set the threshold for logging leaked sockets in minutes, defaults to 15

View file

@ -11,13 +11,13 @@ const seconds = 1000
// In Node 0.10 the default is 5, which means only 5 open connections at one. // In Node 0.10 the default is 5, which means only 5 open connections at one.
// Node 0.12 has a default of Infinity. Make sure we have no limit set, // Node 0.12 has a default of Infinity. Make sure we have no limit set,
// regardless of Node version. // regardless of Node version.
require('http').globalAgent.maxSockets = Infinity require('node:http').globalAgent.maxSockets = Infinity
require('https').globalAgent.maxSockets = Infinity require('node:https').globalAgent.maxSockets = Infinity
const SOCKETS_HTTP = require('http').globalAgent.sockets const SOCKETS_HTTP = require('node:http').globalAgent.sockets
const SOCKETS_HTTPS = require('https').globalAgent.sockets const SOCKETS_HTTPS = require('node:https').globalAgent.sockets
const FREE_SOCKETS_HTTP = require('http').globalAgent.freeSockets const FREE_SOCKETS_HTTP = require('node:http').globalAgent.freeSockets
const FREE_SOCKETS_HTTPS = require('https').globalAgent.freeSockets const FREE_SOCKETS_HTTPS = require('node:https').globalAgent.freeSockets
// keep track of set gauges and reset them in the next collection cycle // keep track of set gauges and reset them in the next collection cycle
const SEEN_HOSTS_HTTP = new Set() const SEEN_HOSTS_HTTP = new Set()

View file

@ -1,6 +1,6 @@
const { promisify } = require('util') const { promisify } = require('node:util')
const os = require('os') const os = require('node:os')
const http = require('http') const http = require('node:http')
const { expect } = require('chai') const { expect } = require('chai')
const Metrics = require('../..') const Metrics = require('../..')

View file

@ -5,7 +5,7 @@
*/ */
const chai = require('chai') const chai = require('chai')
const { expect } = chai const { expect } = chai
const path = require('path') const path = require('node:path')
const modulePath = path.join(__dirname, '../../../event_loop.js') const modulePath = path.join(__dirname, '../../../event_loop.js')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')

View file

@ -1,4 +1,4 @@
const Path = require('path') const Path = require('node:path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')

View file

@ -70,7 +70,7 @@ sayHi3(43, (err, result) => {
} }
}) })
const promisify = require('util').promisify const promisify = require('node:util').promisify
demoDatabase.findUserAsync = promisify(demoDatabase.findUser) demoDatabase.findUserAsync = promisify(demoDatabase.findUser)
async function sayHi4NoHandling(userId) { async function sayHi4NoHandling(userId) {

View file

@ -1,5 +1,5 @@
const { expect } = require('chai') const { expect } = require('chai')
const { promisify } = require('util') const { promisify } = require('node:util')
const OError = require('..') const OError = require('..')

View file

@ -23,7 +23,7 @@ exports.expectError = function OErrorExpectError(e, expected) {
).to.be.true ).to.be.true
expect( expect(
require('util').types.isNativeError(e), require('node:util').types.isNativeError(e),
'error should be recognised by util.types.isNativeError' 'error should be recognised by util.types.isNativeError'
).to.be.true ).to.be.true

View file

@ -1,11 +1,11 @@
const crypto = require('crypto') const crypto = require('node:crypto')
const fs = require('fs') const fs = require('node:fs')
const fsPromises = require('fs/promises') const fsPromises = require('node:fs/promises')
const globCallbacks = require('glob') const globCallbacks = require('glob')
const Path = require('path') const Path = require('node:path')
const { PassThrough } = require('stream') const { PassThrough } = require('node:stream')
const { pipeline } = require('stream/promises') const { pipeline } = require('node:stream/promises')
const { promisify } = require('util') const { promisify } = require('node:util')
const AbstractPersistor = require('./AbstractPersistor') const AbstractPersistor = require('./AbstractPersistor')
const { ReadError, WriteError, NotImplementedError } = require('./Errors') const { ReadError, WriteError, NotImplementedError } = require('./Errors')

View file

@ -1,6 +1,6 @@
const fs = require('fs') const fs = require('node:fs')
const { pipeline } = require('stream/promises') const { pipeline } = require('node:stream/promises')
const { PassThrough } = require('stream') const { PassThrough } = require('node:stream')
const { Storage, IdempotencyStrategy } = require('@google-cloud/storage') const { Storage, IdempotencyStrategy } = require('@google-cloud/storage')
const { WriteError, ReadError, NotFoundError } = require('./Errors') const { WriteError, ReadError, NotFoundError } = require('./Errors')
const asyncPool = require('tiny-async-pool') const asyncPool = require('tiny-async-pool')

View file

@ -1,8 +1,8 @@
const AbstractPersistor = require('./AbstractPersistor') const AbstractPersistor = require('./AbstractPersistor')
const Logger = require('@overleaf/logger') const Logger = require('@overleaf/logger')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const Stream = require('stream') const Stream = require('node:stream')
const { pipeline } = require('stream/promises') const { pipeline } = require('node:stream/promises')
const { NotFoundError, WriteError } = require('./Errors') const { NotFoundError, WriteError } = require('./Errors')
// Persistor that wraps two other persistors. Talks to the 'primary' by default, // Persistor that wraps two other persistors. Talks to the 'primary' by default,

View file

@ -1,8 +1,8 @@
// @ts-check // @ts-check
const Crypto = require('crypto') const Crypto = require('node:crypto')
const Stream = require('stream') const Stream = require('node:stream')
const fs = require('fs') const fs = require('node:fs')
const { promisify } = require('util') const { promisify } = require('node:util')
const { WritableBuffer } = require('@overleaf/stream-utils') const { WritableBuffer } = require('@overleaf/stream-utils')
const { S3Persistor, SSECOptions } = require('./S3Persistor.js') const { S3Persistor, SSECOptions } = require('./S3Persistor.js')
const { const {
@ -13,7 +13,7 @@ const {
ReadError, ReadError,
} = require('./Errors') } = require('./Errors')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Path = require('path') const Path = require('node:path')
const generateKey = promisify(Crypto.generateKey) const generateKey = promisify(Crypto.generateKey)
const hkdf = promisify(Crypto.hkdf) const hkdf = promisify(Crypto.hkdf)

View file

@ -1,6 +1,6 @@
const Crypto = require('crypto') const Crypto = require('node:crypto')
const Stream = require('stream') const Stream = require('node:stream')
const { pipeline } = require('stream/promises') const { pipeline } = require('node:stream/promises')
const Logger = require('@overleaf/logger') const Logger = require('@overleaf/logger')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const { WriteError, NotFoundError, AlreadyWrittenError } = require('./Errors') const { WriteError, NotFoundError, AlreadyWrittenError } = require('./Errors')

View file

@ -1,6 +1,6 @@
// @ts-check // @ts-check
const http = require('http') const http = require('node:http')
const https = require('https') const https = require('node:https')
if (http.globalAgent.maxSockets < 300) { if (http.globalAgent.maxSockets < 300) {
http.globalAgent.maxSockets = 300 http.globalAgent.maxSockets = 300
} }
@ -8,15 +8,15 @@ if (https.globalAgent.maxSockets < 300) {
https.globalAgent.maxSockets = 300 https.globalAgent.maxSockets = 300
} }
const Crypto = require('crypto') const Crypto = require('node:crypto')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const AbstractPersistor = require('./AbstractPersistor') const AbstractPersistor = require('./AbstractPersistor')
const PersistorHelper = require('./PersistorHelper') const PersistorHelper = require('./PersistorHelper')
const { pipeline, PassThrough } = require('stream') const { pipeline, PassThrough } = require('node:stream')
const fs = require('fs') const fs = require('node:fs')
const S3 = require('aws-sdk/clients/s3') const S3 = require('aws-sdk/clients/s3')
const { URL } = require('url') const { URL } = require('node:url')
const { WriteError, ReadError, NotFoundError } = require('./Errors') const { WriteError, ReadError, NotFoundError } = require('./Errors')
/** /**

View file

@ -25,4 +25,9 @@ SandboxedModule.configure({
}, },
}, },
globals: { Buffer, Math, console, process, URL }, globals: { Buffer, Math, console, process, URL },
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
}) })

View file

@ -1,10 +1,10 @@
const crypto = require('crypto') const crypto = require('node:crypto')
const { expect } = require('chai') const { expect } = require('chai')
const mockFs = require('mock-fs') const mockFs = require('mock-fs')
const fs = require('fs') const fs = require('node:fs')
const fsPromises = require('fs/promises') const fsPromises = require('node:fs/promises')
const Path = require('path') const Path = require('node:path')
const StreamPromises = require('stream/promises') const StreamPromises = require('node:stream/promises')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const Errors = require('../../src/Errors') const Errors = require('../../src/Errors')

View file

@ -1,4 +1,4 @@
const { EventEmitter } = require('events') const { EventEmitter } = require('node:events')
const sinon = require('sinon') const sinon = require('sinon')
const chai = require('chai') const chai = require('chai')
const { expect } = chai const { expect } = chai

View file

@ -1,7 +1,7 @@
const chai = require('chai') const chai = require('chai')
const { expect } = chai const { expect } = chai
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const StreamPromises = require('stream/promises') const StreamPromises = require('node:stream/promises')
const MODULE_PATH = '../../src/PersistorFactory.js' const MODULE_PATH = '../../src/PersistorFactory.js'

View file

@ -3,7 +3,7 @@ const chai = require('chai')
const { expect } = chai const { expect } = chai
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const Errors = require('../../src/Errors') const Errors = require('../../src/Errors')
const { EventEmitter } = require('events') const { EventEmitter } = require('node:events')
const MODULE_PATH = '../../src/S3Persistor.js' const MODULE_PATH = '../../src/S3Persistor.js'

View file

@ -1,4 +1,4 @@
const { promisify, callbackify } = require('util') const { promisify, callbackify } = require('node:util')
const pLimit = require('p-limit') const pLimit = require('p-limit')
module.exports = { module.exports = {

View file

@ -0,0 +1,3 @@
{
"require": "test/setup.js"
}

View file

@ -1,8 +1,8 @@
const { promisify } = require('util') const { promisify } = require('node:util')
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const os = require('os') const os = require('node:os')
const crypto = require('crypto') const crypto = require('node:crypto')
const HOST = os.hostname() const HOST = os.hostname()
const PID = process.pid const PID = process.pid

View file

@ -1,8 +1,8 @@
const { callbackify, promisify } = require('util') const { callbackify, promisify } = require('node:util')
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const os = require('os') const os = require('node:os')
const crypto = require('crypto') const crypto = require('node:crypto')
const async = require('async') const async = require('async')
const HOST = os.hostname() const HOST = os.hostname()

View file

@ -1,6 +1,6 @@
const crypto = require('crypto') const crypto = require('node:crypto')
const os = require('os') const os = require('node:os')
const { promisify } = require('util') const { promisify } = require('node:util')
const Redis = require('ioredis') const Redis = require('ioredis')

View file

@ -0,0 +1,9 @@
const SandboxedModule = require('sandboxed-module')
SandboxedModule.configure({
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
})

View file

@ -6,8 +6,8 @@
*/ */
require('chai').should() require('chai').should()
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('node:assert')
const path = require('path') const path = require('node:path')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = path.join(__dirname, './../../../index.js') const modulePath = path.join(__dirname, './../../../index.js')
const redisLockerModulePath = path.join(__dirname, './../../../RedisLocker.js') const redisLockerModulePath = path.join(__dirname, './../../../RedisLocker.js')

View file

@ -1,6 +1,6 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { merge } = require('./merge') const { merge } = require('./merge')
const CWD = process.cwd() const CWD = process.cwd()

View file

@ -1,4 +1,4 @@
const { Writable, Readable, PassThrough, Transform } = require('stream') const { Writable, Readable, PassThrough, Transform } = require('node:stream')
/** /**
* A writable stream that stores all data written to it in a node Buffer. * A writable stream that stores all data written to it in a node Buffer.

3
package-lock.json generated
View file

@ -51,6 +51,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-unicorn": "^56.0.0",
"prettier": "3.3.3", "prettier": "3.3.3",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
@ -39877,6 +39878,7 @@
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
"eslint-plugin-unicorn": "^56.0.0",
"expect": "^1.15.2", "expect": "^1.15.2",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"jsdom": "^20.0.0", "jsdom": "^20.0.0",
@ -66149,6 +66151,7 @@
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-react": "^7.32.2", "eslint-plugin-react": "^7.32.2",
"eslint-plugin-unicorn": "^56.0.0",
"expect": "^1.15.2", "expect": "^1.15.2",
"express": "^4.21.0", "express": "^4.21.0",
"express-basic-auth": "^1.2.0", "express-basic-auth": "^1.2.0",

View file

@ -19,6 +19,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.0.0",
"eslint-plugin-unicorn": "^56.0.0",
"prettier": "3.3.3", "prettier": "3.3.3",
"typescript": "^5.5.4" "typescript": "^5.5.4"
}, },

View file

@ -4,6 +4,9 @@
"standard", "standard",
"prettier" "prettier"
], ],
"plugins": [
"unicorn"
],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020 "ecmaVersion": 2020
}, },
@ -12,7 +15,8 @@
}, },
"rules": { "rules": {
// Do not allow importing of implicit dependencies. // Do not allow importing of implicit dependencies.
"import/no-extraneous-dependencies": "error" "import/no-extraneous-dependencies": "error",
"unicorn/prefer-node-protocol": "error"
}, },
"overrides": [ "overrides": [
// Extra rules for Cypress tests // Extra rules for Cypress tests

View file

@ -1,10 +1,10 @@
import http from 'http' import http from 'node:http'
import metrics from '@overleaf/metrics' import metrics from '@overleaf/metrics'
import logger from '@overleaf/logger' import logger from '@overleaf/logger'
import express from 'express' import express from 'express'
import exegesisExpress from 'exegesis-express' import exegesisExpress from 'exegesis-express'
import path from 'path' import path from 'node:path'
import { fileURLToPath } from 'url' import { fileURLToPath } from 'node:url'
import * as messagesController from './Features/Messages/MessageHttpController.js' import * as messagesController from './Features/Messages/MessageHttpController.js'
const __dirname = fileURLToPath(new URL('.', import.meta.url)) const __dirname = fileURLToPath(new URL('.', import.meta.url))

View file

@ -1,5 +1,5 @@
import { createServer } from '../../../../app/js/server.js' import { createServer } from '../../../../app/js/server.js'
import { promisify } from 'util' import { promisify } from 'node:util'
export { db } from '../../../../app/js/mongodb.js' export { db } from '../../../../app/js/mongodb.js'

View file

@ -16,7 +16,7 @@ const ContentTypeMapper = require('./app/js/ContentTypeMapper')
const Errors = require('./app/js/Errors') const Errors = require('./app/js/Errors')
const { createOutputZip } = require('./app/js/OutputController') const { createOutputZip } = require('./app/js/OutputController')
const Path = require('path') const Path = require('node:path')
Metrics.open_sockets.monitor(true) Metrics.open_sockets.monitor(true)
Metrics.memory.monitor(logger) Metrics.memory.monitor(logger)
@ -316,8 +316,8 @@ app.use(function (error, req, res, next) {
} }
}) })
const net = require('net') const net = require('node:net')
const os = require('os') const os = require('node:os')
let STATE = 'up' let STATE = 'up'

View file

@ -1,7 +1,7 @@
const fsPromises = require('fs/promises') const fsPromises = require('node:fs/promises')
const os = require('os') const os = require('node:os')
const Path = require('path') const Path = require('node:path')
const { callbackify } = require('util') const { callbackify } = require('node:util')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -2,10 +2,10 @@
* ContentCacheManager - maintains a cache of stream hashes from a PDF file * ContentCacheManager - maintains a cache of stream hashes from a PDF file
*/ */
const { callbackify } = require('util') const { callbackify } = require('node:util')
const fs = require('fs') const fs = require('node:fs')
const crypto = require('crypto') const crypto = require('node:crypto')
const Path = require('path') const Path = require('node:path')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const pLimit = require('p-limit') const pLimit = require('p-limit')

View file

@ -1,6 +1,6 @@
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const os = require('os') const os = require('node:os')
let CACHED_LOAD = { let CACHED_LOAD = {
expires: -1, expires: -1,

View file

@ -1,4 +1,4 @@
const Path = require('path') const Path = require('node:path')
const send = require('send') const send = require('send')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const OutputCacheManager = require('./OutputCacheManager') const OutputCacheManager = require('./OutputCacheManager')

View file

@ -4,7 +4,7 @@
// TODO: This file was created by bulk-decaffeinate. // TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint. // Fix any style issues and re-enable lint.
let ContentTypeMapper let ContentTypeMapper
const Path = require('path') const Path = require('node:path')
// here we coerce html, css and js to text/plain, // here we coerce html, css and js to text/plain,
// otherwise choose correct mime type based on file extension, // otherwise choose correct mime type based on file extension,

View file

@ -1,13 +1,13 @@
const { promisify } = require('util') const { promisify } = require('node:util')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Docker = require('dockerode') const Docker = require('dockerode')
const dockerode = new Docker() const dockerode = new Docker()
const crypto = require('crypto') const crypto = require('node:crypto')
const async = require('async') const async = require('async')
const LockManager = require('./DockerLockManager') const LockManager = require('./DockerLockManager')
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const ONE_HOUR_IN_MS = 60 * 60 * 1000 const ONE_HOUR_IN_MS = 60 * 60 * 1000

View file

@ -1,5 +1,5 @@
const fsPromises = require('fs/promises') const fsPromises = require('node:fs/promises')
const { callbackify } = require('util') const { callbackify } = require('node:util')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
async function injectDraftMode(filename) { async function injectDraftMode(filename) {

View file

@ -1,9 +1,9 @@
const Path = require('path') const Path = require('node:path')
const { promisify } = require('util') const { promisify } = require('node:util')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const CommandRunner = require('./CommandRunner') const CommandRunner = require('./CommandRunner')
const fs = require('fs') const fs = require('node:fs')
const ProcessTable = {} // table of currently running jobs (pids or docker container names) const ProcessTable = {} // table of currently running jobs (pids or docker container names)

View file

@ -12,8 +12,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let CommandRunner let CommandRunner
const { spawn } = require('child_process') const { spawn } = require('node:child_process')
const { promisify } = require('util') const { promisify } = require('node:util')
const _ = require('lodash') const _ = require('lodash')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -1,12 +1,12 @@
let OutputCacheManager let OutputCacheManager
const { callbackify, promisify } = require('util') const { callbackify, promisify } = require('node:util')
const async = require('async') const async = require('async')
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const _ = require('lodash') const _ = require('lodash')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const crypto = require('crypto') const crypto = require('node:crypto')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const OutputFileOptimiser = require('./OutputFileOptimiser') const OutputFileOptimiser = require('./OutputFileOptimiser')

View file

@ -1,5 +1,5 @@
const Path = require('path') const Path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
const { callbackifyMultiResult } = require('@overleaf/promise-utils') const { callbackifyMultiResult } = require('@overleaf/promise-utils')
async function walkFolder(compileDir, d, files, allEntries) { async function walkFolder(compileDir, d, files, allEntries) {

View file

@ -13,9 +13,9 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let OutputFileOptimiser let OutputFileOptimiser
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { spawn } = require('child_process') const { spawn } = require('node:child_process')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const _ = require('lodash') const _ = require('lodash')

View file

@ -15,9 +15,9 @@ const logger = require('@overleaf/logger')
const oneDay = 24 * 60 * 60 * 1000 const oneDay = 24 * 60 * 60 * 1000
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const diskusage = require('diskusage') const diskusage = require('diskusage')
const { callbackify } = require('util') const { callbackify } = require('node:util')
const Path = require('path') const Path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
// projectId -> timestamp mapping. // projectId -> timestamp mapping.
const LAST_ACCESS = new Map() const LAST_ACCESS = new Map()

View file

@ -1,5 +1,5 @@
const Path = require('path') const Path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Errors = require('./Errors') const Errors = require('./Errors')
const SafeReader = require('./SafeReader') const SafeReader = require('./SafeReader')

View file

@ -13,10 +13,10 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let ResourceWriter let ResourceWriter
const { promisify } = require('util') const { promisify } = require('node:util')
const UrlCache = require('./UrlCache') const UrlCache = require('./UrlCache')
const Path = require('path') const Path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
const async = require('async') const async = require('async')
const OutputFileFinder = require('./OutputFileFinder') const OutputFileFinder = require('./OutputFileFinder')
const ResourceStateManager = require('./ResourceStateManager') const ResourceStateManager = require('./ResourceStateManager')

View file

@ -12,7 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let SafeReader let SafeReader
const fs = require('fs') const fs = require('node:fs')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
module.exports = SafeReader = { module.exports = SafeReader = {

View file

@ -13,8 +13,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let ForbidSymlinks let ForbidSymlinks
const Path = require('path') const Path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -1,4 +1,4 @@
const Path = require('path') const Path = require('node:path')
/** /**
* Parse output from the `synctex view` command * Parse output from the `synctex view` command

View file

@ -11,9 +11,9 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let TikzManager let TikzManager
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { promisify } = require('util') const { promisify } = require('node:util')
const ResourceWriter = require('./ResourceWriter') const ResourceWriter = require('./ResourceWriter')
const SafeReader = require('./SafeReader') const SafeReader = require('./SafeReader')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -12,9 +12,9 @@
*/ */
const UrlFetcher = require('./UrlFetcher') const UrlFetcher = require('./UrlFetcher')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { callbackify } = require('util') const { callbackify } = require('node:util')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const PENDING_DOWNLOADS = new Map() const PENDING_DOWNLOADS = new Map()

View file

@ -1,4 +1,4 @@
const fs = require('fs') const fs = require('node:fs')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const { const {
@ -6,8 +6,8 @@ const {
CustomHttpsAgent, CustomHttpsAgent,
fetchStream, fetchStream,
} = require('@overleaf/fetch-utils') } = require('@overleaf/fetch-utils')
const { URL } = require('url') const { URL } = require('node:url')
const { pipeline } = require('stream/promises') const { pipeline } = require('node:stream/promises')
const Metrics = require('./Metrics') const Metrics = require('./Metrics')
const MAX_CONNECT_TIME = 1000 const MAX_CONNECT_TIME = 1000

View file

@ -1,5 +1,5 @@
const { NoXrefTableError } = require('./Errors') const { NoXrefTableError } = require('./Errors')
const fs = require('fs') const fs = require('node:fs')
const { O_RDONLY, O_NOFOLLOW } = fs.constants const { O_RDONLY, O_NOFOLLOW } = fs.constants
const MAX_XREF_FILE_SIZE = 1024 * 1024 const MAX_XREF_FILE_SIZE = 1024 * 1024

View file

@ -1,5 +1,5 @@
const Path = require('path') const Path = require('node:path')
const os = require('os') const os = require('node:os')
const isPreEmptible = os.hostname().includes('pre-emp') const isPreEmptible = os.hostname().includes('pre-emp')
@ -131,7 +131,7 @@ if (process.env.DOCKER_RUNNER) {
try { try {
seccompProfilePath = Path.resolve(__dirname, '../seccomp/clsi-profile.json') seccompProfilePath = Path.resolve(__dirname, '../seccomp/clsi-profile.json')
module.exports.clsi.docker.seccomp_profile = JSON.stringify( module.exports.clsi.docker.seccomp_profile = JSON.stringify(
JSON.parse(require('fs').readFileSync(seccompProfilePath)) JSON.parse(require('node:fs').readFileSync(seccompProfilePath))
) )
} catch (error) { } catch (error) {
console.error( console.error(

View file

@ -1,4 +1,4 @@
const fs = require('fs') const fs = require('node:fs')
const { parseXrefTable } = require('../app/lib/pdfjs/parseXrefTable') const { parseXrefTable } = require('../app/lib/pdfjs/parseXrefTable')
const pdfPath = process.argv[2] const pdfPath = process.argv[2]

View file

@ -14,19 +14,19 @@
*/ */
const Client = require('./helpers/Client') const Client = require('./helpers/Client')
const fetch = require('node-fetch') const fetch = require('node-fetch')
const { pipeline } = require('stream') const { pipeline } = require('node:stream')
const fs = require('fs') const fs = require('node:fs')
const ChildProcess = require('child_process') const ChildProcess = require('node:child_process')
const ClsiApp = require('./helpers/ClsiApp') const ClsiApp = require('./helpers/ClsiApp')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Path = require('path') const Path = require('node:path')
const fixturePath = path => { const fixturePath = path => {
if (path.slice(0, 3) === 'tmp') { if (path.slice(0, 3) === 'tmp') {
return '/tmp/clsi_acceptance_tests' + path.slice(3) return '/tmp/clsi_acceptance_tests' + path.slice(3)
} }
return Path.join(__dirname, '../fixtures/', path) return Path.join(__dirname, '../fixtures/', path)
} }
const process = require('process') const process = require('node:process')
console.log( console.log(
process.pid, process.pid,
process.ppid, process.ppid,

View file

@ -13,7 +13,7 @@ const Client = require('./helpers/Client')
const request = require('request') const request = require('request')
const { expect } = require('chai') const { expect } = require('chai')
const ClsiApp = require('./helpers/ClsiApp') const ClsiApp = require('./helpers/ClsiApp')
const crypto = require('crypto') const crypto = require('node:crypto')
describe('Syncing', function () { describe('Syncing', function () {
before(function (done) { before(function (done) {

View file

@ -10,7 +10,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const express = require('express') const express = require('express')
const Path = require('path') const Path = require('node:path')
const Client = require('./helpers/Client') const Client = require('./helpers/Client')
const sinon = require('sinon') const sinon = require('sinon')
const ClsiApp = require('./helpers/ClsiApp') const ClsiApp = require('./helpers/ClsiApp')

View file

@ -12,8 +12,8 @@
const Client = require('./helpers/Client') const Client = require('./helpers/Client')
const request = require('request') const request = require('request')
const { expect } = require('chai') const { expect } = require('chai')
const path = require('path') const path = require('node:path')
const fs = require('fs') const fs = require('node:fs')
const ClsiApp = require('./helpers/ClsiApp') const ClsiApp = require('./helpers/ClsiApp')
describe('Syncing', function () { describe('Syncing', function () {

View file

@ -13,7 +13,7 @@
let Client let Client
const express = require('express') const express = require('express')
const request = require('request') const request = require('request')
const fs = require('fs') const fs = require('node:fs')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
module.exports = Client = { module.exports = Client = {

View file

@ -1,8 +1,8 @@
const ContentCacheManager = require('../../app/js/ContentCacheManager') const ContentCacheManager = require('../../app/js/ContentCacheManager')
const fs = require('fs') const fs = require('node:fs')
const crypto = require('crypto') const crypto = require('node:crypto')
const path = require('path') const path = require('node:path')
const os = require('os') const os = require('node:os')
const async = require('async') const async = require('async')
const _createHash = crypto.createHash const _createHash = crypto.createHash

View file

@ -9,7 +9,7 @@
const request = require('request') const request = require('request')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const async = require('async') const async = require('async')
const fs = require('fs') const fs = require('node:fs')
const _ = require('lodash') const _ = require('lodash')
const concurentCompiles = 5 const concurentCompiles = 5
const totalCompiles = 50 const totalCompiles = 50

View file

@ -21,4 +21,9 @@ SandboxedModule.configure({
}, },
}, },
globals: { Buffer, console, process, URL }, globals: { Buffer, console, process, URL },
sourceTransformers: {
removeNodePrefix: function (source) {
return source.replace(/require\(['"]node:/g, "require('")
},
},
}) })

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/CompileController' '../../../app/js/CompileController'
) )

View file

@ -1,9 +1,9 @@
const Path = require('path') const Path = require('node:path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const MODULE_PATH = require('path').join( const MODULE_PATH = require('node:path').join(
__dirname, __dirname,
'../../../app/js/CompileManager' '../../../app/js/CompileManager'
) )

View file

@ -1,5 +1,5 @@
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { expect } = require('chai') const { expect } = require('chai')
const MODULE_PATH = '../../../app/js/ContentCacheManager' const MODULE_PATH = '../../../app/js/ContentCacheManager'

View file

@ -11,7 +11,7 @@
*/ */
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/ContentTypeMapper' '../../../app/js/ContentTypeMapper'
) )

View file

@ -11,7 +11,7 @@
*/ */
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/DockerLockManager' '../../../app/js/DockerLockManager'
) )

View file

@ -15,11 +15,11 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/DockerRunner' '../../../app/js/DockerRunner'
) )
const Path = require('path') const Path = require('node:path')
describe('DockerRunner', function () { describe('DockerRunner', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -1,5 +1,5 @@
const Path = require('path') const Path = require('node:path')
const fsPromises = require('fs/promises') const fsPromises = require('node:fs/promises')
const { expect } = require('chai') const { expect } = require('chai')
const mockFs = require('mock-fs') const mockFs = require('mock-fs')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const MODULE_PATH = require('path').join( const MODULE_PATH = require('node:path').join(
__dirname, __dirname,
'../../../app/js/LatexRunner' '../../../app/js/LatexRunner'
) )

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/LockManager' '../../../app/js/LockManager'
) )

View file

@ -1,6 +1,6 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const MODULE_PATH = require('path').join( const MODULE_PATH = require('node:path').join(
__dirname, __dirname,
'../../../app/js/OutputController' '../../../app/js/OutputController'
) )
@ -19,7 +19,7 @@ describe('OutputController', function () {
'./OutputFileArchiveManager': { './OutputFileArchiveManager': {
archiveFilesForBuild: this.archiveFilesForBuild, archiveFilesForBuild: this.archiveFilesForBuild,
}, },
'node:stream/promises': { 'stream/promises': {
pipeline: this.pipeline, pipeline: this.pipeline,
}, },
}, },

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { assert, expect } = require('chai') const { assert, expect } = require('chai')
const MODULE_PATH = require('path').join( const MODULE_PATH = require('node:path').join(
__dirname, __dirname,
'../../../app/js/OutputFileArchiveManager' '../../../app/js/OutputFileArchiveManager'
) )
@ -50,7 +50,7 @@ describe('OutputFileArchiveManager', function () {
'./OutputFileFinder': this.OutputFileFinder, './OutputFileFinder': this.OutputFileFinder,
'./OutputCacheManager': this.OutputCacheManger, './OutputCacheManager': this.OutputCacheManger,
archiver: this.archiver, archiver: this.archiver,
'node:fs/promises': this.fs, 'fs/promises': this.fs,
'@overleaf/settings': { '@overleaf/settings': {
path: { path: {
outputDir: this.outputDir, outputDir: this.outputDir,

View file

@ -1,6 +1,6 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/OutputFileFinder' '../../../app/js/OutputFileFinder'
) )

View file

@ -12,13 +12,13 @@
*/ */
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/OutputFileOptimiser' '../../../app/js/OutputFileOptimiser'
) )
const path = require('path') const path = require('node:path')
const { expect } = require('chai') const { expect } = require('chai')
const { EventEmitter } = require('events') const { EventEmitter } = require('node:events')
describe('OutputFileOptimiser', function () { describe('OutputFileOptimiser', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -13,7 +13,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const assert = require('chai').assert const assert = require('chai').assert
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/ProjectPersistenceManager' '../../../app/js/ProjectPersistenceManager'
) )

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/RequestParser' '../../../app/js/RequestParser'
) )

View file

@ -12,11 +12,11 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/ResourceStateManager' '../../../app/js/ResourceStateManager'
) )
const Path = require('path') const Path = require('node:path')
const Errors = require('../../../app/js/Errors') const Errors = require('../../../app/js/Errors')
describe('ResourceStateManager', function () { describe('ResourceStateManager', function () {

View file

@ -13,11 +13,11 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/ResourceWriter' '../../../app/js/ResourceWriter'
) )
const path = require('path') const path = require('node:path')
describe('ResourceWriter', function () { describe('ResourceWriter', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -10,8 +10,8 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('node:assert')
const path = require('path') const path = require('node:path')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = path.join( const modulePath = path.join(
__dirname, __dirname,

View file

@ -1,4 +1,4 @@
const Path = require('path') const Path = require('node:path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')

View file

@ -10,7 +10,7 @@
*/ */
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = require('path').join( const modulePath = require('node:path').join(
__dirname, __dirname,
'../../../app/js/TikzManager' '../../../app/js/TikzManager'
) )

View file

@ -13,7 +13,10 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = require('path').join(__dirname, '../../../app/js/UrlCache') const modulePath = require('node:path').join(
__dirname,
'../../../app/js/UrlCache'
)
describe('UrlCache', function () { describe('UrlCache', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -1,5 +1,5 @@
const fs = require('fs') const fs = require('node:fs')
const Path = require('path') const Path = require('node:path')
const { expect } = require('chai') const { expect } = require('chai')
const { parseXrefTable } = require('../../../app/js/XrefParser') const { parseXrefTable } = require('../../../app/js/XrefParser')
const { NoXrefTableError } = require('../../../app/js/Errors') const { NoXrefTableError } = require('../../../app/js/Errors')

Some files were not shown because too many files have changed in this diff Show more