Skip to content

Commit

Permalink
fix: use merge-stream replace combinestream
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Mar 10, 2020
1 parent 5dd98a0 commit 79aa0e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 3 additions & 1 deletion packages/ykfe-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ykfe-utils",
"version": "3.5.2",
"version": "3.5.3",
"description": "utils for ykfe",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -14,8 +14,10 @@
},
"author": "zhangyuang",
"dependencies": {
"@types/merge-stream": "^1.1.2",
"axios": "^0.19.0",
"lodash.clonedeepwith": "^4.5.0",
"merge-stream": "^2.0.0",
"path-to-regexp": "^6.1.0",
"rax": "^1.1.1",
"rax-server-renderer": "^1.1.6",
Expand Down
5 changes: 3 additions & 2 deletions packages/ykfe-utils/src/renderToStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Context } from 'midway'
import { getVersion, ReadableString, combineStream } from './utils'
import mergeStream from 'merge-stream'
import { getVersion, ReadableString } from './utils'
import { renderLayout } from './renderLayout'
import { useCdn } from './useCdn'
import { Config } from './interface/config'
Expand Down Expand Up @@ -51,7 +52,7 @@ const renderToStream = async (ctx: Context, config: Config) => {
} else {
const doctypeStream = new ReadableString('<!DOCTYPE html>')
// @ts-ignore
return combineStream(doctypeStream, stream)
return mergeStream(doctypeStream, stream)
}
}

Expand Down
11 changes: 1 addition & 10 deletions packages/ykfe-utils/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,10 @@ class ReadableString extends Readable {
}
}

const combineStream = function () {
const writeableStream = new PassThrough()
Array.prototype.slice.call(arguments).forEach(readableStream => {
readableStream.pipe(writeableStream)
})
return writeableStream
}

export {
resolveDir,
logGreen,
reactToStream,
getVersion,
ReadableString,
combineStream
ReadableString
}

0 comments on commit 79aa0e6

Please sign in to comment.