8000 rushstack/libraries/stream-collator at main · IIIMADDINIII/rushstack · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"libraries/stream-collator","repo":{"id":762832249,"defaultBranch":"main","name":"rushstack","ownerLogin":"IIIMADDINIII","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-02-24T20:13:05.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/20095647?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"main","listCacheKey":"v0:1708810911.0","canEdit":false,"refType":"branch","currentOid":"ca15f1bca906f05700cb9dcfee8e4db6280b42cc"},"tree":{"items":[{"name":"config","path":"libraries/stream-collator/config","contentType":"directory"},{"name":"src","path":"libraries/stream-collator/src","contentType":"directory"},{"name":".eslintrc.js","path":"libraries/stream-collator/.eslintrc.js","contentType":"file"},{"name":".npmignore","path":"libraries/stream-collator/.npmignore","contentType":"file"},{"name":"CHANGELOG.json","path":"libraries/stream-collator/CHANGELOG.json","contentType":"file"},{"name":"CHANGELOG.md","path":"libraries/stream-collator/CHANGELOG.md","contentType":"file"},{"name":"LICENSE","path":"libraries/stream-collator/LICENSE","contentType":"file"},{"name":"README.md","path":"libraries/stream-collator/README.md","contentType":"file"},{"name":"package.json","path":"libraries/stream-collator/package.json","contentType":"file"},{"name":"tsconfig.json","path":"libraries/stream-collator/tsconfig.json","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e@rushstack/stream-collator\u003c/h2\u003e\u003ca id=\"user-content-rushstackstream-collator\" class=\"anchor\" aria-label=\"Permalink: @rushstack/stream-collator\" href=\"#rushstackstream-collator\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis library enables a tool to display live console output from multiple concurrent processes,\nwhile ensuring that their output does not get jumbled together.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow does it work?\u003c/h2\u003e\u003ca id=\"user-content-how-does-it-work\" class=\"anchor\" aria-label=\"Permalink: How does it work?\" href=\"#how-does-it-work\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe \u003cstrong\u003estream-collator\u003c/strong\u003e manages the output of these streams, ensuring that no two streams are writing to the console\nat the same time. At any given time, one stream registered with the collator is the \u003cstrong\u003eactive stream\u003c/strong\u003e, which means\nthat particular stream will be live streaming, while the others will wait for that stream to finish before their\noutput is displayed.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFor example, if you have 3 streams (e.g. from using \u003ccode\u003echild_process.spawn()\u003c/code\u003e).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eStream A will write: \u003ccode\u003eAAAAA\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eStream B will write: \u003ccode\u003eBBBBBBBBBBBBBBBBBBBB\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eStream C will write: \u003ccode\u003eCCCCCCCCCC\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIf these streams are all being piped directly to stdout (without \u003ccode\u003e@rushstack/stream-collator\u003c/code\u003e), you could end up\nwith jumbled output:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003eABACCCBCCCCBBABBCBBABBBBBBCCAB\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSomething like the following would be much more useful to users of your application:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003eAAAAABBBBBBBBBBBBBBBCCCCCCCCCC\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThis is where the \u003ccode\u003e@rushstack/stream-collator\u003c/code\u003e comes in!\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eThe active stream\u003c/h2\u003e\u003ca id=\"user-content-the-active-stream\" class=\"anchor\" aria-label=\"Permalink: The active stream\" href=\"#the-active-stream\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAt any given time, a single stream is designated as the \u003cstrong\u003eactive stream\u003c/strong\u003e. The output of the active stream will always be\nlive-streamed. This is particularly useful for long-running streams. When the active stream finishes, a new stream\nis selected as the active stream and all of its contents up to that point will be emitted. Whenever an active stream finishes,\nall background streams which have been completed will be emitted.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsage\u003c/h2\u003e\u003ca id=\"user-content-usage\" class=\"anchor\" aria-label=\"Permalink: Usage\" href=\"#usage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e🚨 \u003cem\u003eThis is an early preview release. Please report issues!\u003c/em\u003e 🚨\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eWITH VERSION 4.X, THIS PACKAGE HAS BEEN REDESIGNED TO USE THE NEW\n\u003ca href=\"https://www.npmjs.com/package/@rushstack/terminal\" rel=\"nofollow\"\u003e@rushstack/terminal\u003c/a\u003e SYSTEM.\nIN THE NEXT RELEASE, THE \u003ccode\u003eCollatedTerminal\u003c/code\u003e API WILL BE REPLACED WITH\nTHE \u003ccode\u003eTerminal\u003c/code\u003e API.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe usage instructions will be updated once that refactoring is complete.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLinks\u003c/h2\u003e\u003ca id=\"user-content-links\" class=\"anchor\" aria-label=\"Permalink: Links\" href=\"#links\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/microsoft/rushstack/blob/main/libraries/stream-collator/CHANGELOG.md\"\u003eCHANGELOG.md\u003c/a\u003e - Find\nout what's new in the latest version\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://api.rushstack.io/pages/stream-collator/\" rel=\"nofollow\"\u003eAPI Reference\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e@rushstack/stream-collator\u003c/code\u003e is part of the \u003ca href=\"https://rushstack.io/\" rel=\"nofollow\"\u003eRush Stack\u003c/a\u003e family of projects.\u003c/p\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":2,"text":"@rushstack/stream-collator","anchor":"rushstackstream-collator","htmlText":"@rushstack/stream-collator"},{"level":2,"text":"How does it work?","anchor":"how-does-it-work","htmlText":"How does it work?"},{"level":2,"text":"The active stream","anchor":"the-active-stream","htmlText":"The active stream"},{"level":2,"text":"Usage","anchor":"usage","htmlText":"Usage"},{"level":2,"text":"Links","anchor":"links","htmlText":"Links"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2FIIIMADDINIII%2Frushstack%2Ftree%2Fmain%2Flibraries%2Fstream-collator"}},"totalCount":10,"showBranchInfobar":true},"fileTree":{"libraries":{"items":[{"name":"api-extractor-model","path":"libraries/api-extractor-model","contentType":"directory"},{"name":"debug-certificate-manager","path":"libraries/debug-certificate-manager","contentType":"directory"},{"name":"heft-config-file","path":"libraries/heft-config-file","contentType":"directory"},{"name":"load-themed-styles","path":"libraries/load-themed-styles","contentType":"directory"},{"name":"localization-utilities","path":"libraries/localization-utilities","contentType":"directory"},{"name":"module-minifier","path":"libraries/module-minifier","contentType":"directory"},{"name":"node-core-library","path":"libraries/node-core-library","contentType":"directory"},{"name":"operation-graph","path":"libraries/operation-graph","contentType":"directory"},{"name":"package-deps-hash","path":"libraries/package-deps-hash","contentType":"directory"},{"name":"package-extractor","path":"libraries/package-extractor","contentType":"directory"},{"name":"rig-package","path":"libraries/rig-package","contentType":"directory"},{"name":"rush-lib","path":"libraries/rush-lib","contentType":"directory"},{"name":"rush-sdk","path":"libraries/rush-sdk","contentType":"directory"},{"name":"rush-themed-ui","path":"libraries/rush-themed-ui","contentType":"directory"},{"name":"rushell","path":"libraries/rushell","contentType":"directory"},{"name":"stream-collator","path":"libraries/stream-collator","contentType":"directory"},{"name":"terminal","path":"libraries/terminal","contentType":"directory"},{"name":"tree-pattern","path":"libraries/tree-pattern","contentType":"directory"},{"name":"ts-command-line","path":"libraries/ts-command-line","contentType":"directory"},{"name":"typings-generator","path":"libraries/typings-generator","contentType":"directory"},{"name":"worker-pool","path":"libraries/worker-pool","contentType":"directory"}],"totalCount":21},"":{"items":[{"name":".devcontainer","path":".devcontainer","contentType":"directory"},{"name":".github","path":".github","contentType":"directory"},{"name":".vscode","path":".vscode","contentType":"directory"},{"name":"apps","path":"apps","contentType":"directory"},{"name":"build-tests-samples","path":"build-tests-samples","contentType":"directory"},{"name":"build-tests","path":"build-tests","contentType":"directory"},{"name":"common","path":"common","contentType":"directory"},{"name":"eslint","path":"eslint","contentType":"directory"},{"name":"heft-plugins","path":"heft-plugins","contentType":"directory"},{"name":"libraries","path":"libraries","contentType":"directory"},{"name":"repo-scripts","path":"repo-scripts","contentType":"directory"},{"name":"rigs","path":"rigs","contentType":"directory"},{"name":"rush-plugins","path":"rush-plugins","contentType":"directory"},{"name":"vscode-extensions","path":"vscode-extensions","contentType":"directory"},{"name":"webpack","path":"webpack","contentType":"directory"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".prettierignore","path":".prettierignore","contentType":"file"},{"name":".prettierrc.js","path":".prettierrc.js","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SECURITY.md","path":"SECURITY.md","contentType":"file"},{"name":"rush.json","path":"rush.json","contentType":"file"}],"totalCount":23}},"fileTreeProcessingTime":28.309931,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/IIIMADDINIII/rushstack/branches":{"post":"Jd3UBxuC_sFKObrBslXjjBqhVCM6ND7zO2PsiG7r2e9vkUw9P7OuYxfKXUW4QEw8_opvsgFTHgoS7dkysD-Nig"},"/IIIMADDINIII/rushstack/branches/fetch_and_merge/main":{"post":"KLQnndKH--Zco4EaqfZayRsdjFerGFlXIA1nAUy8kJ1nDebcnqdr5OiFTeHlh5eAFOa-N9ZIcYpOQFmvcI8NUg"},"/IIIMADDINIII/rushstack/branches/fetch_and_merge/main?discard_changes=true":{"post":"mfwfbLh7gZBma-aH9Y4R4t1K-0vre_H4kCE9uC-lNnnWRd4t9FsRktJNKny5_9yr0rHJK5Yr2SX-bAMWE5artg"}}},"title":"rushstack/libraries/stream-collator at main · IIIMADDINIII/rushstack","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0