<commit_before>import PrototypoCanvas from 'prototypo-canvas';

const workerDeps = document.querySelector('script[src*=prototypo\\.]').src;
let workerUrl;

// The worker will be built from URL during development, and from
// source in production.
if (process.env.NODE_ENV !== 'production') {
	workerUrl = '/prototypo-canvas/src/worker.js';
}

const canvas = document.getElementById('prototypo-canvas');

const fontPromise = PrototypoCanvas.init({
	canvas,
	workerUrl,
	workerDeps,
	jQueryListeners: false,
});

fontPromise.then(function(data) {
	const font = window.fontInstance = data;
	data.worker.port.addEventListener('message', function(e) {
		if (e.data instanceof ArrayBuffer) {
			if (window.parent) {
				window.parent.postMessage(e.data, '*');
			}
			else {
				document.fonts.add(new FontFace('Prototypo Elzevir', e.data));
			}
		}
	});
});<commit_msg>more web export<commit_after>import PrototypoCanvas from 'prototypo-canvas';

const workerDeps = document.querySelector('script[src*=prototypo\\.]').src;
let workerUrl;

// The worker will be built from URL during development, and from
// source in production.
if (process.env.NODE_ENV !== 'production') {
	workerUrl = '/prototypo-canvas/src/worker.js';
}

const canvas = document.getElementById('prototypo-canvas');

const fontPromise = PrototypoCanvas.init({
	canvas,
	workerUrl,
	workerDeps,
	jQueryListeners: false,
	export: true,
});

fontPromise.then(function(data) {
	const font = window.fontInstance = data;
	data.worker.port.addEventListener('message', function(e) {
		if (e.data[0] instanceof ArrayBuffer) {
			if (window.parent) {
				window.parent.postMessage(e.data, '*');
			}
			else {
				document.fonts.add(new FontFace(e.data[1], e.data[0]));
			}
		}
	});
});
{'fraction_non_alphanumeric': 0.14974182444061962, 'fraction_numerical': 0.0017211703958691911, 'mean_word_length': 4.662337662337662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4706494', 'n_tokens_mistral': 615, 'n_tokens_neox': 567, 'n_words': 119}