Skip to content

Commit

Permalink
Drop node: protocol for importing Node.js modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Sep 11, 2024
1 parent 6d0070b commit 9416ca7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"style": {
"noParameterAssign": "warn",
"noDefaultExport": "warn",
"useCollapsedElseIf": "error"
"useCollapsedElseIf": "error",
"useNodejsImportProtocol": "off"
},
"suspicious": {
"noExplicitAny": "warn",
Expand Down
4 changes: 2 additions & 2 deletions demos/cordova/hooks/before_prepare/copy_tus_files.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion demos/nodejs/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('node:fs')
const fs = require('fs')
const tus = require('../..')

const path = `${__dirname}/../../README.md`
Expand Down
2 changes: 1 addition & 1 deletion lib/node/fileReader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReadStream } from 'node:fs'
import { ReadStream } from 'fs'
import isStream from 'is-stream'

import BufferSource from './sources/BufferSource.js'
Expand Down
6 changes: 3 additions & 3 deletions lib/node/fileSignature.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/node/httpStack.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/node/sources/FileSource.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/node/urlStorage.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
12 changes: 6 additions & 6 deletions test/spec/test-node-specific.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down

0 comments on commit 9416ca7

Please sign in to comment.