diff --git a/biome.json b/biome.json index 433a297e0..a5190ef93 100644 --- a/biome.json +++ b/biome.json @@ -18,7 +18,8 @@ "style": { "noParameterAssign": "warn", "noDefaultExport": "warn", - "useCollapsedElseIf": "error" + "useCollapsedElseIf": "error", + "useNodejsImportProtocol": "off" }, "suspicious": { "noExplicitAny": "warn", diff --git a/demos/cordova/hooks/before_prepare/copy_tus_files.js b/demos/cordova/hooks/before_prepare/copy_tus_files.js index 711902858..2954f7456 100755 --- a/demos/cordova/hooks/before_prepare/copy_tus_files.js +++ b/demos/cordova/hooks/before_prepare/copy_tus_files.js @@ -1,7 +1,7 @@ #!/usr/bin/env node -const fs = require('node:fs') -const path = require('node:path') +const fs = require('fs') +const path = require('path') const rootDir = path.join(__dirname, '..', '..') const tusJsPath = path.join(rootDir, '..', '..', 'dist', 'tus.js') diff --git a/demos/nodejs/index.js b/demos/nodejs/index.js index 88323e295..d0354689e 100644 --- a/demos/nodejs/index.js +++ b/demos/nodejs/index.js @@ -1,4 +1,4 @@ -const fs = require('node:fs') +const fs = require('fs') const tus = require('../..') const path = `${__dirname}/../../README.md` diff --git a/lib/node/fileReader.js b/lib/node/fileReader.js index 5db4b25ff..2596ca2ff 100644 --- a/lib/node/fileReader.js +++ b/lib/node/fileReader.js @@ -1,4 +1,4 @@ -import { ReadStream } from 'node:fs' +import { ReadStream } from 'fs' import isStream from 'is-stream' import BufferSource from './sources/BufferSource.js' diff --git a/lib/node/fileSignature.js b/lib/node/fileSignature.js index 3c9d6ae1a..9af62b704 100644 --- a/lib/node/fileSignature.js +++ b/lib/node/fileSignature.js @@ -1,6 +1,6 @@ -import { createHash } from 'node:crypto' -import * as fs from 'node:fs' -import * as path from 'node:path' +import { createHash } from 'crypto' +import * as fs from 'fs' +import * as path from 'path' /** * Generate a fingerprint for a file which will be used the store the endpoint diff --git a/lib/node/httpStack.js b/lib/node/httpStack.js index 002049881..09a9ba520 100644 --- a/lib/node/httpStack.js +++ b/lib/node/httpStack.js @@ -1,9 +1,9 @@ // The url.parse method is superseeded by the url.URL constructor, // but it is still included in Node.js -import * as http from 'node:http' -import * as https from 'node:https' -import { Readable, Transform } from 'node:stream' -import { parse } from 'node:url' +import * as http from 'http' +import * as https from 'https' +import { Readable, Transform } from 'stream' +import { parse } from 'url' import throttle from 'lodash.throttle' export default class NodeHttpStack { diff --git a/lib/node/sources/FileSource.js b/lib/node/sources/FileSource.js index 19fa95f7d..a5ab175ff 100644 --- a/lib/node/sources/FileSource.js +++ b/lib/node/sources/FileSource.js @@ -1,4 +1,4 @@ -import { createReadStream, promises as fsPromises } from 'node:fs' +import { createReadStream, promises as fsPromises } from 'fs' export default async function getFileSource(stream) { const path = stream.path.toString() diff --git a/lib/node/urlStorage.js b/lib/node/urlStorage.js index d0d0f6a0d..7906335bd 100644 --- a/lib/node/urlStorage.js +++ b/lib/node/urlStorage.js @@ -1,4 +1,4 @@ -import { readFile, writeFile } from 'node:fs' +import { readFile, writeFile } from 'fs' import combineErrors from 'combine-errors' import * as lockfile from 'proper-lockfile' diff --git a/test/spec/test-node-specific.js b/test/spec/test-node-specific.js index c578da011..9b25a5784 100644 --- a/test/spec/test-node-specific.js +++ b/test/spec/test-node-specific.js @@ -1,11 +1,11 @@ -const stream = require('node:stream') +const stream = require('stream') const temp = require('temp') -const fs = require('node:fs') -const https = require('node:https') -const http = require('node:http') -const crypto = require('node:crypto') +const fs = require('fs') +const https = require('https') +const http = require('http') +const crypto = require('crypto') const intoStream = require('into-stream') -const { once } = require('node:events') +const { once } = require('events') const tus = require('../..') const assertUrlStorage = require('./helpers/assertUrlStorage') const { TestHttpStack, waitableFunction } = require('./helpers/utils')