blob: 205bda4adb831614aa85a49f9b40add094b62578 (
plain)
1
2
3
4
5
6
7
8
|
/**
* Wraps JavaScript source code in a base64-encoded data URI so it can be
* used as an inline webpack entry point without writing a physical file.
*
* @param {string} code - The JavaScript source to inline.
* @returns {string} A `data:text/javascript;base64,…` URI.
*/
export const inlineJavascript = code => `data:text/javascript;base64,${Buffer.from(code).toString("base64")}`;
|