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
/** | |
* Returns SHA-256 hash from supplied message. | |
* | |
* @param {String} message. | |
* @returns {String} hash as hex string. | |
* | |
* @example | |
* sha256('abc').then(hash => console.log(hash)); | |
* const hash = await sha256('abc'); | |
*/ |
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
import prettier from "prettier/standalone"; | |
import produce from "immer"; | |
import { parse } from "svelte/compiler"; | |
import type { Ast } from "svelte/types/compiler/interfaces"; | |
// @ts-ignore | |
import * as sveltePlugin from "prettier-plugin-svelte"; | |
function printTemplate(ast: Ast) { | |
const overridePlugin = produce(sveltePlugin, (d: any) => { | |
d.parsers.svelte.parse = () => { |
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
export class Plugin { | |
private src: String; | |
private callbacks: any; | |
private iframe?: HTMLIFrameElement; | |
private messageHandler: (e: MessageEvent) => void; | |
private recvMsgHandler: (msg: string) => void; | |
private nextCallId: number = 0; | |
private resolveMap: any; | |
onLoad: () => void = () => {}; |