MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / joinJsChunks

Function joinJsChunks

packages/core/src/compiler/htmlBundler.ts:579–585  ·  view source on GitHub ↗

* Concatenate JS chunks safely. Goals: * - Each chunk's last statement is terminated, so joining can't introduce ASI * surprises (e.g. `a()` followed by `(b)()` — the second chunk would parse * as a call on the first's return value). * - In the common case (chunk already ends with `;

(chunks: string[])

Source from the content-addressed store, hash-verified

577 * comment, and the standalone `;` becomes the statement separator.
578 */
579function joinJsChunks(chunks: string[]): string {
580 return chunks
581 .map((chunk) => chunk.trim())
582 .filter((chunk) => chunk.length > 0)
583 .map((chunk) => (chunk.endsWith(";") ? chunk : chunk + "\n;"))
584 .join("\n");
585}
586
587function stripJsCommentsParserSafe(source: string): string {
588 if (!source) return source;

Callers 2

bundleToSingleHtmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected