Skip to content

Commit 5fef8d6

Browse files
talentlessguyserhalpndhoule
authored
fix(deps): remove stream utils (#7120)
* fix(deps): remove `is-stream` micro-utility * fix(deps): remove from2-array microutility * fix(deps): remove through2-filter dependency * fix(deps): remove flush-write-stream * chore: fmt * chore(dev-deps): remove `@types/flush-write-stream` * fix(deps): remove through2-map micro-utility * chore: update lockfile I had rebased with the wrong npm version * refactor: fix eslint errors from rebase * Update src/utils/deploy/hasher-segments.ts Co-authored-by: Nathan Houle <[email protected]> * fix(deps): use built-in `isReadable` (available since v17.4) * Revert "fix(deps): use built-in `isReadable` (available since v17.4)" This reverts commit d812303. * Revert "fix(deps): remove `is-stream` micro-utility" This reverts commit 5d6dd8f. --------- Co-authored-by: Philippe Serhal <[email protected]> Co-authored-by: Nathan Houle <[email protected]>
1 parent 5069b7c commit 5fef8d6

File tree

7 files changed

+67
-205
lines changed

7 files changed

+67
-205
lines changed

package-lock.json

-150
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-6
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@
100100
"fastest-levenshtein": "1.0.16",
101101
"fastify": "4.29.0",
102102
"find-up": "7.0.0",
103-
"flush-write-stream": "2.0.0",
104103
"folder-walker": "3.2.0",
105-
"from2-array": "0.0.4",
106104
"fuzzy": "0.1.3",
107105
"get-port": "5.1.1",
108106
"gh-release-fetch": "4.0.3",
@@ -148,8 +146,6 @@
148146
"strip-ansi-control-characters": "2.0.0",
149147
"tempy": "3.1.0",
150148
"terminal-link": "4.0.0",
151-
"through2-filter": "4.0.0",
152-
"through2-map": "4.0.0",
153149
"toml": "3.0.0",
154150
"tomlify-j0.4": "3.0.0",
155151
"ulid": "2.3.0",
@@ -173,7 +169,6 @@
173169
"@types/envinfo": "7.8.4",
174170
"@types/eslint-config-prettier": "^6.11.3",
175171
"@types/etag": "1.8.3",
176-
"@types/flush-write-stream": "1.0.2",
177172
"@types/folder-walker": "3.2.4",
178173
"@types/gitconfiglocal": "2.0.3",
179174
"@types/inquirer": "9.0.7",
@@ -191,7 +186,6 @@
191186
"@types/semver": "7.7.0",
192187
"@types/serialize-javascript": "^5.0.4",
193188
"@types/source-map-support": "0.5.10",
194-
"@types/through2-map": "3.0.4",
195189
"@types/write-file-atomic": "4.0.3",
196190
"@types/ws": "8.18.1",
197191
"@vitest/coverage-v8": "3.1.1",

src/utils/deploy/deploy-site.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import hashFiles from './hash-files.js'
2020
import hashFns from './hash-fns.js'
2121
import uploadFiles from './upload-files.js'
2222
import { getUploadList, waitForDeploy, waitForDiff } from './util.js'
23+
import type { DeployEvent } from './status-cb.js'
24+
25+
export type { DeployEvent }
2326

2427
const buildStatsString = (possibleParts: (string | false | undefined)[]) => {
2528
const parts = possibleParts.filter(Boolean)
@@ -28,13 +31,6 @@ const buildStatsString = (possibleParts: (string | false | undefined)[]) => {
2831
return parts.length > 1 ? `${message} and ${parts[parts.length - 1]}` : message
2932
}
3033

31-
// TODO(serhalp): This is alternatingly called "event", "status", and "progress". Standardize.
32-
export interface DeployEvent {
33-
type: string
34-
msg: string
35-
phase: 'start' | 'progress' | 'error' | 'stop'
36-
}
37-
3834
export const deploySite = async (
3935
command: BaseCommand,
4036
api: $TSFixMe,
@@ -115,7 +111,6 @@ export const deploySite = async (
115111
concurrentHash,
116112
hashAlgorithm,
117113
statusCb,
118-
assetType,
119114
manifestPath,
120115
skipFunctionsCache,
121116
rootDir: siteRoot,

src/utils/deploy/hash-files.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const hashFiles = async ({
3030
const files = {}
3131
// hash: [fileObj, fileObj, fileObj]
3232
const filesShaMap = {}
33-
const manifestCollector = manifestCollectorCtor(files, filesShaMap, { statusCb, assetType })
33+
const manifestCollector = manifestCollectorCtor(files, filesShaMap, { statusCb })
3434

3535
await pipeline([fileStream, fileFilter, hasher, fileNormalizer, manifestCollector])
3636

src/utils/deploy/hash-fns.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { readFile } from 'fs/promises'
22
import path from 'path'
33
import { pipeline } from 'stream/promises'
4+
import { Readable } from 'stream'
45

56
import { zipFunctions, type FunctionResult, type TrafficRules } from '@netlify/zip-it-and-ship-it'
6-
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'from... Remove this comment to see the full error message
7-
import fromArray from 'from2-array'
87

98
import BaseCommand from '../../commands/base-command.js'
109
import { $TSFixMe } from '../../commands/types.js'
@@ -109,8 +108,6 @@ const hashFns = async (
109108
command: BaseCommand,
110109
directories: string[],
111110
config: {
112-
/** @default 'function' */
113-
assetType?: string
114111
concurrentHash?: number
115112
functionsConfig: $TSFixMe
116113
/** @default 'sha256' */
@@ -123,7 +120,6 @@ const hashFns = async (
123120
},
124121
): Promise<$TSFixMe> => {
125122
const {
126-
assetType = 'function',
127123
concurrentHash,
128124
functionsConfig,
129125
hashAlgorithm = 'sha256',
@@ -211,7 +207,7 @@ const hashFns = async (
211207
({ nativeNodeModules }) => nativeNodeModules !== undefined && Object.keys(nativeNodeModules).length !== 0,
212208
)
213209

214-
const functionStream = fromArray.obj(fileObjs)
210+
const functionStream = Readable.from(fileObjs)
215211

216212
const hasher = hasherCtor({ concurrentHash, hashAlgorithm })
217213

@@ -220,7 +216,7 @@ const hashFns = async (
220216
const functions = {}
221217
// hash: [fileObj, fileObj, fileObj]
222218
const fnShaMap = {}
223-
const manifestCollector = manifestCollectorCtor(functions, fnShaMap, { statusCb, assetType })
219+
const manifestCollector = manifestCollectorCtor(functions, fnShaMap, { statusCb })
224220

225221
await pipeline([functionStream, hasher, manifestCollector])
226222
return { functionSchedules, functions, functionsWithNativeModules, fnShaMap, fnConfig }

0 commit comments

Comments
 (0)