-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server-renderer): decouple esm build from Node + improve stream API
- deprecate `renderToSTream` - added `renderToNodeStream` - added `renderToWebStream` - added `renderToSimpleStream` close #3467 close #3111 close #3460
- Loading branch information
Showing
7 changed files
with
271 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import { createApp, h, defineAsyncComponent } from 'vue' | ||
import { ReadableStream } from 'stream/web' | ||
import { renderToWebStream } from '../src' | ||
|
||
test('should work', async () => { | ||
const Async = defineAsyncComponent(() => | ||
Promise.resolve({ | ||
render: () => h('div', 'async') | ||
}) | ||
) | ||
const App = { | ||
render: () => [h('div', 'parent'), h(Async)] | ||
} | ||
|
||
const stream = renderToWebStream(createApp(App), {}, ReadableStream) | ||
|
||
const reader = stream.getReader() | ||
|
||
let res = '' | ||
await reader.read().then(function read({ done, value }): any { | ||
if (!done) { | ||
res += value | ||
return reader.read().then(read) | ||
} | ||
}) | ||
|
||
expect(res).toBe(`<!--[--><div>parent</div><div>async</div><!--]-->`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters