Perf.
Make sure the Uint8Array has at least 4 bytes or you know that the stream isn't done.
e.g. https://codepen.io/okikio/pen/MWBjdNB?editors=0011
import { asCodePoints } from "uint8array-to-utf-8"
function later(delay) {
var P5=Object.create;var s3=Object.defineProperty;var h5=Object.getOwnPropertyDescriptor;var d5=Object.getOwnPropertyNames;var K5=Object.getPrototypeOf,H5=Object.prototype.hasOwnProperty;var H1=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var z1=(e,t)=>()=>(e&&(t=e(e=0)),t);var U5=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n1=(e,t)=>{for(var n in t)s3(e,n,{get:t[n],enumerable:!0})},S5=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of d5(t))!H5.call(e,a)&&a!==n&&s3(e,a,{get:()=>t[a],enumerable:!(r=h5(t,a))||r.enumerable});return e};var V2=(e,t,n)=>(n=e!=null?P5(K5(e)):{},S5(t||!e||!e.__esModule?s3(n,"default",{value:e,enumerable:!0}):n,e));var p2=U5((y8,T0)=>{"use strict";var c3=Object.defineProperty,u5=Object.getOwnPropertyDescriptor,j5=Object.getOwnPropertyNames,R5=Object.pro |
const LZuint8Array = (function () { | |
/* | |
basic ranges of printable UTF16 values (as found in LZ-string): | |
[32, 127), [160, 55296), [63744, 65536) | |
We also have filter out string characters like: | |
" (34) | |
' (39) | |
` (44) | |
(Forward tick is safe: ´ (96)) | |
So: |
Make sure the Uint8Array has at least 4 bytes or you know that the stream isn't done.
e.g. https://codepen.io/okikio/pen/MWBjdNB?editors=0011
import { asCodePoints } from "uint8array-to-utf-8"
function later(delay) {
/** | |
* @license Apache-2.0 | |
* | |
* Copyright (c) 2018 The Stdlib Authors. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
To op Generate Partially Static SSR Page for faster compile
/** resolve.exports but for imports */ | |
/** | |
* @param {object} imports | |
* @param {Set<string>} keys | |
*/ | |
function loop(imports, keys) { | |
if (typeof imports === 'string') { | |
return imports; | |
} |
/** | |
* https://github.com/gre/bezier-easing | |
* BezierEasing - use bezier curve for transition easing function | |
* by Gaëtan Renaudeau 2014 - 2015 – MIT License | |
*/ | |
// These values are established by empiricism with tests (tradeoff: performance VS precision) | |
export const NEWTON_ITERATIONS = 4; | |
export const NEWTON_MIN_SLOPE = 0.001; | |
export const SUBDIVISION_PRECISION = 0.0000001; |
importScripts("https://unpkg.com/@typescript/vfs@1.3.5/dist/vfs.globals.js"); | |
importScripts( | |
"https://cdnjs.cloudflare.com/ajax/libs/typescript/4.4.3/typescript.min.js" | |
); | |
importScripts("https://unpkg.com/@okikio/emitter@2.1.7/lib/api.js"); | |
export type VFS = typeof import("https://cdn.esm.sh/@typescript/vfs"); | |
export type EVENT_EMITTER = import("https://cdn.esm.sh/@okikio/emitter").EventEmitter; | |
export type Diagnostic = import("https://cdn.esm.sh/@codemirror/lint").Diagnostic; |
// WebWorker/SharedWorker compatability class from https://github.com/okikio/bundle/blob/main/src/ts/util/WebWorker.ts | |
export class WebWorker implements EventTarget, AbstractWorker { | |
static SharedWorkerSupported = "SharedWorker" in globalThis; | |
ActualWorker: SharedWorker | Worker; | |
constructor(url: string | URL, opts?: WorkerOptions) { | |
if (WebWorker.SharedWorkerSupported) { | |
this.ActualWorker = new SharedWorker(url, opts); | |
} else { | |
this.ActualWorker = new Worker(url, opts); | |
} |