Skip to content

Commit c805cb3

Browse files
author
Marius
authored
Drop node: protocol for importing Node.js modules (#720)
1 parent 6d0070b commit c805cb3

File tree

9 files changed

+21
-20
lines changed

9 files changed

+21
-20
lines changed

biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"style": {
1919
"noParameterAssign": "warn",
2020
"noDefaultExport": "warn",
21-
"useCollapsedElseIf": "error"
21+
"useCollapsedElseIf": "error",
22+
"useNodejsImportProtocol": "off"
2223
},
2324
"suspicious": {
2425
"noExplicitAny": "warn",

demos/cordova/hooks/before_prepare/copy_tus_files.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

3-
const fs = require('node:fs')
4-
const path = require('node:path')
3+
const fs = require('fs')
4+
const path = require('path')
55

66
const rootDir = path.join(__dirname, '..', '..')
77
const tusJsPath = path.join(rootDir, '..', '..', 'dist', 'tus.js')

demos/nodejs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('node:fs')
1+
const fs = require('fs')
22
const tus = require('../..')
33

44
const path = `${__dirname}/../../README.md`

lib/node/fileReader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReadStream } from 'node:fs'
1+
import { ReadStream } from 'fs'
22
import isStream from 'is-stream'
33

44
import BufferSource from './sources/BufferSource.js'

lib/node/fileSignature.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createHash } from 'node:crypto'
2-
import * as fs from 'node:fs'
3-
import * as path from 'node:path'
1+
import { createHash } from 'crypto'
2+
import * as fs from 'fs'
3+
import * as path from 'path'
44

55
/**
66
* Generate a fingerprint for a file which will be used the store the endpoint

lib/node/httpStack.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// The url.parse method is superseeded by the url.URL constructor,
22
// but it is still included in Node.js
3-
import * as http from 'node:http'
4-
import * as https from 'node:https'
5-
import { Readable, Transform } from 'node:stream'
6-
import { parse } from 'node:url'
3+
import * as http from 'http'
4+
import * as https from 'https'
5+
import { Readable, Transform } from 'stream'
6+
import { parse } from 'url'
77
import throttle from 'lodash.throttle'
88

99
export default class NodeHttpStack {

lib/node/sources/FileSource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createReadStream, promises as fsPromises } from 'node:fs'
1+
import { createReadStream, promises as fsPromises } from 'fs'
22

33
export default async function getFileSource(stream) {
44
const path = stream.path.toString()

lib/node/urlStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readFile, writeFile } from 'node:fs'
1+
import { readFile, writeFile } from 'fs'
22
import combineErrors from 'combine-errors'
33
import * as lockfile from 'proper-lockfile'
44

test/spec/test-node-specific.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const stream = require('node:stream')
1+
const stream = require('stream')
22
const temp = require('temp')
3-
const fs = require('node:fs')
4-
const https = require('node:https')
5-
const http = require('node:http')
6-
const crypto = require('node:crypto')
3+
const fs = require('fs')
4+
const https = require('https')
5+
const http = require('http')
6+
const crypto = require('crypto')
77
const intoStream = require('into-stream')
8-
const { once } = require('node:events')
8+
const { once } = require('events')
99
const tus = require('../..')
1010
const assertUrlStorage = require('./helpers/assertUrlStorage')
1111
const { TestHttpStack, waitableFunction } = require('./helpers/utils')

0 commit comments

Comments
 (0)