Description: workaround nodejs bug Author: Yadd Forwarded: not-needed Last-Update: 2023-12-02 --- a/fastify-busboy/deps/dicer/lib/Dicer.js +++ b/fastify-busboy/deps/dicer/lib/Dicer.js @@ -1,7 +1,7 @@ 'use strict' -const WritableStream = require('node:stream').Writable -const inherits = require('node:util').inherits +const WritableStream = require('stream').Writable +const inherits = require('util').inherits const StreamSearch = require('../../streamsearch/sbmh') --- a/fastify-busboy/deps/dicer/lib/HeaderParser.js +++ b/fastify-busboy/deps/dicer/lib/HeaderParser.js @@ -1,7 +1,7 @@ 'use strict' -const EventEmitter = require('node:events').EventEmitter -const inherits = require('node:util').inherits +const EventEmitter = require('events').EventEmitter +const inherits = require('util').inherits const getLimit = require('../../../lib/utils/getLimit') const StreamSearch = require('../../streamsearch/sbmh') --- a/fastify-busboy/deps/dicer/lib/PartStream.js +++ b/fastify-busboy/deps/dicer/lib/PartStream.js @@ -1,7 +1,7 @@ 'use strict' -const inherits = require('node:util').inherits -const ReadableStream = require('node:stream').Readable +const inherits = require('util').inherits +const ReadableStream = require('stream').Readable function PartStream (opts) { ReadableStream.call(this, opts) --- a/fastify-busboy/deps/streamsearch/sbmh.js +++ b/fastify-busboy/deps/streamsearch/sbmh.js @@ -26,8 +26,8 @@ * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool */ -const EventEmitter = require('node:events').EventEmitter -const inherits = require('node:util').inherits +const EventEmitter = require('events').EventEmitter +const inherits = require('util').inherits function SBMH (needle) { if (typeof needle === 'string') { --- a/fastify-busboy/lib/main.js +++ b/fastify-busboy/lib/main.js @@ -1,7 +1,7 @@ 'use strict' -const WritableStream = require('node:stream').Writable -const { inherits } = require('node:util') +const WritableStream = require('stream').Writable +const { inherits } = require('util') const Dicer = require('../deps/dicer/lib/Dicer') const MultipartParser = require('./types/multipart') --- a/fastify-busboy/lib/types/multipart.js +++ b/fastify-busboy/lib/types/multipart.js @@ -7,8 +7,8 @@ // * support limits.fieldNameSize // -- this will require modifications to utils.parseParams -const { Readable } = require('node:stream') -const { inherits } = require('node:util') +const { Readable } = require('stream') +const { inherits } = require('util') const Dicer = require('../../deps/dicer/lib/Dicer') --- a/fastify-busboy/test/dicer-multipart.test.js +++ b/fastify-busboy/test/dicer-multipart.test.js @@ -1,10 +1,10 @@ 'use strict' const Dicer = require('../deps/dicer/lib/Dicer') -const assert = require('node:assert') -const fs = require('node:fs') -const path = require('node:path') -const inspect = require('node:util').inspect +const assert = require('assert') +const fs = require('fs') +const path = require('path') +const inspect = require('util').inspect const { test } = require('tap') const FIXTURES_ROOT = path.join(__dirname, 'fixtures/') --- a/fastify-busboy/test/parse-params.test.js +++ b/fastify-busboy/test/parse-params.test.js @@ -1,6 +1,6 @@ 'use strict' -const { inspect } = require('node:util') +const { inspect } = require('util') const { test } = require('tap') const parseParams = require('../lib/utils/parseParams') --- a/scripts/generate-undici-types-package-json.js +++ b/scripts/generate-undici-types-package-json.js @@ -1,5 +1,5 @@ -const fs = require('node:fs') -const path = require('node:path') +const fs = require('fs') +const path = require('path') const packageJSONPath = path.join(__dirname, '..', 'package.json') const packageJSONRaw = fs.readFileSync(packageJSONPath, 'utf-8') --- a/test/client-node-max-header-size.js +++ b/test/client-node-max-header-size.js @@ -1,6 +1,6 @@ 'use strict' -const { execSync } = require('node:child_process') +const { execSync } = require('child_process') const { test } = require('tap') const command = 'node -e "require(\'.\').request(\'https://httpbin.org/get\')"' --- a/test/fetch/client-node-max-header-size.js +++ b/test/fetch/client-node-max-header-size.js @@ -1,6 +1,6 @@ 'use strict' -const { execSync } = require('node:child_process') +const { execSync } = require('child_process') const { test, skip } = require('tap') const { nodeMajor } = require('../../lib/core/util') --- a/test/fetch/http2.js +++ b/test/fetch/http2.js @@ -1,10 +1,10 @@ 'use strict' -const { createSecureServer } = require('node:http2') -const { createReadStream, readFileSync } = require('node:fs') -const { once } = require('node:events') -const { Blob } = require('node:buffer') -const { Readable } = require('node:stream') +const { createSecureServer } = require('http2') +const { createReadStream, readFileSync } = require('fs') +const { once } = require('events') +const { Blob } = require('buffer') +const { Readable } = require('stream') const { test, plan } = require('tap') const pem = require('https-pem') --- a/test/http2-alpn.js +++ b/test/http2-alpn.js @@ -1,10 +1,10 @@ 'use strict' -const https = require('node:https') -const { once } = require('node:events') -const { createSecureServer } = require('node:http2') -const { readFileSync } = require('node:fs') -const { join } = require('node:path') +const https = require('https') +const { once } = require('events') +const { createSecureServer } = require('http2') +const { readFileSync } = require('fs') +const { join } = require('path') const { test } = require('tap') const { Client } = require('..') --- a/test/http2.js +++ b/test/http2.js @@ -1,10 +1,10 @@ 'use strict' -const { createSecureServer } = require('node:http2') -const { createReadStream, readFileSync } = require('node:fs') -const { once } = require('node:events') -const { Blob } = require('node:buffer') -const { Writable, pipeline, PassThrough, Readable } = require('node:stream') +const { createSecureServer } = require('http2') +const { createReadStream, readFileSync } = require('fs') +const { once } = require('events') +const { Blob } = require('buffer') +const { Writable, pipeline, PassThrough, Readable } = require('stream') const { test, plan } = require('tap') const { gte } = require('semver') --- a/test/retry-handler.js +++ b/test/retry-handler.js @@ -1,6 +1,6 @@ 'use strict' -const { createServer } = require('node:http') -const { once } = require('node:events') +const { createServer } = require('http') +const { once } = require('events') const tap = require('tap')