made make-script compatible with nix
This commit is contained in:
parent
4330037206
commit
94dd2ec42d
|
@ -0,0 +1,93 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, bintools-unwrapped
|
||||
, callPackage
|
||||
, coreutils
|
||||
, substituteAll
|
||||
, unzip
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "cosmopolitan";
|
||||
version = "2.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jart";
|
||||
repo = "cosmopolitan";
|
||||
rev = finalAttrs.version;
|
||||
hash = "sha256-DTL1dXH+LhaxWpiCrsNjV74Bw5+kPbhEAA2Z1NKiPDk=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# make sure tests set PATH correctly
|
||||
(substituteAll {
|
||||
src = ./fix-paths.patch;
|
||||
inherit coreutils;
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bintools-unwrapped
|
||||
unzip
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
outputs = [ "out" "dist" ];
|
||||
|
||||
# slashes are significant because upstream uses o/$(MODE)/foo.o
|
||||
buildFlags = [
|
||||
"o/cosmopolitan.h"
|
||||
"o//cosmopolitan.a"
|
||||
"o//libc/crt/crt.o"
|
||||
"o//ape/ape.o"
|
||||
"o//ape/ape.lds"
|
||||
"o//tool/net/redbean.com"
|
||||
];
|
||||
|
||||
checkTarget = "o//test";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = false;
|
||||
dontConfigure = true;
|
||||
dontFixup = true;
|
||||
|
||||
preCheck = let
|
||||
failingTests = [
|
||||
# some syscall tests fail because we're in a sandbox
|
||||
"test/libc/calls/sched_setscheduler_test.c"
|
||||
"test/libc/thread/pthread_create_test.c"
|
||||
"test/libc/calls/getgroups_test.c"
|
||||
# fails
|
||||
"test/libc/stdio/posix_spawn_test.c"
|
||||
];
|
||||
in lib.concatStringsSep ";\n" (map (t: "rm -v ${t}") failingTests);
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{include,lib,bin}
|
||||
install o/cosmopolitan.h $out/include
|
||||
install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} o/ape/ape-no-modify-self.o $out/lib
|
||||
install o/tool/net/redbean.com $out/bin/xrsh.com
|
||||
cp -RT . "$dist"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
cosmocc = callPackage ./cosmocc.nix {
|
||||
cosmopolitan = finalAttrs.finalPackage;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://xrsh.isvery.ninja/";
|
||||
description = "XR shell runs a linux ISO in WebXR";
|
||||
license = lib.licenses.isc;
|
||||
maintainers = lib.teams.cosmopolitan.members;
|
||||
platforms = lib.platforms.x86_64;
|
||||
};
|
||||
})
|
14
make
14
make
|
@ -15,14 +15,18 @@ deps(){ # check dependencies
|
|||
}
|
||||
|
||||
standalone(){ # build standalone xrsh.com binary
|
||||
rm ${APP}.com || true
|
||||
deps
|
||||
FILE=${APP}.com
|
||||
test -z "$1" && {
|
||||
rm ${APP}.com || true
|
||||
deps
|
||||
}
|
||||
test -n "$1" && FILE="$1"
|
||||
#cp index.html /tmp/index.html
|
||||
#sed -i 's|isoterminal=".*"|isoterminal="iso: ./../xrsh.iso"|g' index.html
|
||||
zip -x "*.git*" -r ${APP}.com index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js}
|
||||
zip -x "*.git*" -r "$FILE" index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js,PromiseWorker.js,ISOTerminal.js,localforage.js,VT100.js,assets,worker.js}
|
||||
#cp /tmp/index.html index.html
|
||||
sha256sum ${APP}.com > ${APP}.txt
|
||||
ls -lah ${APP}.com
|
||||
sha256sum ${APP}.com > "$FILE".txt
|
||||
ls -lah "$FILE"
|
||||
}
|
||||
|
||||
dev(){ # start dev http server
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
{ stdenv, fetchurl, fetchzip, lib, zip }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.0.13";
|
||||
|
||||
redbean = fetchurl {
|
||||
url = "https://redbean.dev/redbean-2.2.com";
|
||||
hash = "sha256-24/HzFp3A7fMuDCjZutp5yj8eJL9PswJPAidg3qluRs=";
|
||||
};
|
||||
|
||||
xrsh = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz";
|
||||
sha256 = "1x0h5krz90y8ngrzgbpjd6xdr171y54p3lqwyirq8j6ilzlq5d5i";
|
||||
};
|
||||
|
||||
xrshcom = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh-com/archive/c668a8ba8f65c3d36e3a4da5ea8b87af5eb6091c.tar.gz";
|
||||
sha256 = "0mpl7h4fxg5i4lxw5447pqr12rsffcf24xdrqwqzr1zzpkdkslks";
|
||||
};
|
||||
|
||||
buildInputs = [ zip ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
dontFixup = true; # essential, otherwise cosmopolitcan libc exec-header gets corrupted
|
||||
|
||||
installPhase = ''
|
||||
install -D $redbean $out/bin/xrsh.com
|
||||
chmod +x $out/bin/xrsh.com
|
||||
|
||||
cd $xrsh
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com index.html src/index.{html,css} LICENSE src/assets
|
||||
|
||||
# add components
|
||||
mkdir /tmp/src
|
||||
cp -r $xrshcom/* /tmp/src/.
|
||||
cd /tmp
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com src/com/*.js src/com/isoterminal/{xrsh.iso,libv86.js,bios,v86.wasm}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "XR shell which runs a linux ISO in WebXR";
|
||||
license = "MPL";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
homepage = "https://xrsh.isvery.ninja";
|
||||
maintainers = with maintainers; [ coderofsalvation ];
|
||||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{ stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz";
|
||||
sha256 = "11v22pijnjm3mb3n8dki4m95rc73azschfwvh2c1pc3bxrfsk0k8";
|
||||
};
|
||||
|
||||
#cosmopolitan = pkgs.callPackage pkgs.cosmopolitan { };
|
||||
|
||||
## Override derivation to modify buildFlags
|
||||
#redbean = cosmopolitan.overrideDerivation (oldAttrs: {
|
||||
# buildFlags = oldAttrs.buildFlags ++ ["--enable-feature-x"];
|
||||
#});
|
||||
|
||||
buildInputs = [];
|
||||
|
||||
buildFlags = [];
|
||||
|
||||
# Define phases if needed, e.g., build, install, etc.
|
||||
# phases = [ "buildPhase" "installPhase" ];
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../../../aframe
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,251 @@
|
|||
// this is a highlevel way of loading buildless 'apps' (a collection of js components)
|
||||
AFRAME.required = {};
|
||||
AFRAME.app = new Proxy({
|
||||
add (component, entity) {
|
||||
this[component] = this[component] || [];
|
||||
this[component].push(entity);
|
||||
},
|
||||
foreach (cb) {
|
||||
for(let i in this)if (typeof this[i] != "function") this[i].map((app)=>cb({
|
||||
app,
|
||||
component: i
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
get (me, k) {
|
||||
return me[k];
|
||||
},
|
||||
set (me, k, v) {
|
||||
me[k] = v;
|
||||
}
|
||||
});
|
||||
AFRAME.registerComponent("app", {
|
||||
schema: {
|
||||
"uri": {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
events: {
|
||||
"app:ready": function() {
|
||||
let { id, component, type } = this.parseAppURI(this.data.uri);
|
||||
AFRAME.app[component].map((app)=>{
|
||||
if (!app.el.getAttribute(component)) app.el.setAttribute(component, app.data);
|
||||
});
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
let { id, component, type } = this.parseAppURI(this.data.uri);
|
||||
let sel = `script#${component}`;
|
||||
if (AFRAME.app[component] || AFRAME.components[component] || document.head.querySelector(sel)) return AFRAME.app.add(component, this);
|
||||
AFRAME.app.add(component, this);
|
||||
this.require([
|
||||
this.data.uri
|
||||
], "app:ready");
|
||||
},
|
||||
parseAppURI: AFRAME.AComponent.prototype.parseAppURI = function(uri) {
|
||||
return {
|
||||
id: String(uri).split("/").pop(),
|
||||
component: String(uri).split("/").pop().split(".js").shift(),
|
||||
type: String(uri).split(".").pop() // 'mycom.js' => 'js'
|
||||
};
|
||||
},
|
||||
// usage: require(["./app/foo.js"])
|
||||
// require({foo: "https://foo.com/foo.js"})
|
||||
require: AFRAME.AComponent.prototype.require = function(packages, readyEvent) {
|
||||
let deps = [];
|
||||
if (!packages.map) packages = Object.values(packages);
|
||||
packages.map((_package)=>{
|
||||
let id = _package.split("/").pop();
|
||||
// prevent duplicate requests
|
||||
if (AFRAME.required[id]) return;
|
||||
AFRAME.required[id] = true;
|
||||
if (!document.head.querySelector(`script#${id}`)) {
|
||||
let { id, component, type } = this.parseAppURI(_package);
|
||||
let p = new Promise((resolve, reject)=>{
|
||||
switch(type){
|
||||
case "js":
|
||||
let script = document.createElement("script");
|
||||
script.id = id;
|
||||
script.src = _package;
|
||||
script.onload = ()=>resolve();
|
||||
script.onerror = (e)=>reject(e);
|
||||
document.head.appendChild(script);
|
||||
break;
|
||||
case "css":
|
||||
let link = document.createElement("link");
|
||||
link.id = id;
|
||||
link.href = _package;
|
||||
link.rel = "stylesheet";
|
||||
document.head.appendChild(link);
|
||||
resolve();
|
||||
break;
|
||||
}
|
||||
});
|
||||
deps.push(p);
|
||||
}
|
||||
});
|
||||
Promise.all(deps).then(()=>this.el.emit(readyEvent || "ready", packages));
|
||||
}
|
||||
});
|
||||
// monkeypatching initComponent will trigger events when components
|
||||
// are initialized (that way apps can react to attached components)
|
||||
// basically, in both situations:
|
||||
// <a-entity foo="a:1"/>
|
||||
// <a-entity app="uri: myapp.js"/> <!-- myapp.js calls this.require(['foo.js']) -->
|
||||
//
|
||||
// event 'foo' will be triggered as both entities (in)directly require component 'foo'
|
||||
AFRAME.AComponent.prototype.initComponent = function(initComponent) {
|
||||
return function() {
|
||||
this.el.emit(this.attrName, this);
|
||||
this.scene = AFRAME.scenes[0] // mount scene for convenience
|
||||
;
|
||||
return initComponent.apply(this, arguments);
|
||||
};
|
||||
}(AFRAME.AComponent.prototype.initComponent);
|
||||
AFRAME.AComponent.prototype.updateProperties = function(updateProperties) {
|
||||
return function() {
|
||||
updateProperties.apply(this, arguments);
|
||||
if (this.dom && this.data && this.data.uri) {
|
||||
tasks = {
|
||||
generateUniqueId: ()=>{
|
||||
this.el.uid = String(Math.random()).substr(10);
|
||||
return tasks;
|
||||
},
|
||||
ensureOverlay: ()=>{
|
||||
let overlay = document.querySelector("#overlay");
|
||||
if (!overlay) {
|
||||
overlay = document.createElement("div");
|
||||
overlay.id = "overlay";
|
||||
document.body.appendChild(overlay);
|
||||
document.querySelector("a-scene").setAttribute("webxr", "overlayElement:#overlay");
|
||||
}
|
||||
tasks.overlay = overlay;
|
||||
return tasks;
|
||||
},
|
||||
createReactiveDOMElement: ()=>{
|
||||
const reactify = (el, aframe)=>new Proxy(this.data, {
|
||||
get (me, k, v) {
|
||||
return me[k];
|
||||
},
|
||||
set (me, k, v) {
|
||||
me[k] = v;
|
||||
aframe.emit(k, {
|
||||
el,
|
||||
k,
|
||||
v
|
||||
});
|
||||
}
|
||||
});
|
||||
this.el.dom = document.createElement("div");
|
||||
this.el.dom.className = this.parseAppURI(this.data.uri).component;
|
||||
this.el.dom.innerHTML = this.dom.html(this);
|
||||
this.data = reactify(this.dom.el, this.el);
|
||||
this.dom.events.map((e)=>this.el.dom.addEventListener(e, (ev)=>this.el.emit(e, ev)));
|
||||
return tasks;
|
||||
},
|
||||
addCSS: ()=>{
|
||||
if (this.dom.css && !document.head.querySelector(`style#${this.attrName}`)) document.head.innerHTML += `<style id="${this.attrName}">${this.dom.css}</style>`;
|
||||
return tasks;
|
||||
},
|
||||
scaleDOMvsXR: ()=>{
|
||||
if (this.dom.scale) this.el.setAttribute("scale", `${this.dom.scale} ${this.dom.scale} ${this.dom.scale}`);
|
||||
return tasks;
|
||||
},
|
||||
addModalFunctions: ()=>{
|
||||
this.el.close = ()=>{
|
||||
this.el.dom.remove();
|
||||
this.el.removeAttribute("html");
|
||||
};
|
||||
return tasks;
|
||||
}
|
||||
};
|
||||
tasks.generateUniqueId().ensureOverlay().addCSS().createReactiveDOMElement().scaleDOMvsXR().addModalFunctions();
|
||||
tasks.overlay.appendChild(this.el.dom);
|
||||
this.el.emit("DOMready", {
|
||||
el: this.el.dom
|
||||
});
|
||||
}
|
||||
};
|
||||
}(AFRAME.AComponent.prototype.updateProperties);
|
||||
document.head.innerHTML += `
|
||||
<style type="text/css">
|
||||
/* CSS reset */
|
||||
html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
|
||||
|
||||
a-scene{
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
canvas{
|
||||
z-index:10;
|
||||
}
|
||||
|
||||
#overlay{
|
||||
display: flex; /* tile modals */
|
||||
z-index:10;
|
||||
}
|
||||
#overlay.hide{
|
||||
z-index:-10;
|
||||
}
|
||||
|
||||
#toggle_overlay{
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
bottom: 73px;
|
||||
width: 58px;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
z-index: 100;
|
||||
border: 3px solid #3aacff;
|
||||
border-radius:11px;
|
||||
transition:0.3s;
|
||||
padding: 0px;
|
||||
font-weight: bold;
|
||||
cursor:pointer;
|
||||
font-family:sans-serif;
|
||||
font-size:15px;
|
||||
color: #FFF;
|
||||
background: #3aacff;
|
||||
transition:0.5s;
|
||||
}
|
||||
.XR #toggle_overlay{
|
||||
background: transparent;
|
||||
color: #3aacff;
|
||||
}
|
||||
|
||||
.XR #overlay{
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
`;
|
||||
// draw a button so we can toggle apps between 2D / XR
|
||||
let toggle = (state)=>{
|
||||
state = state || document.body.className.match(/XR/);
|
||||
document.body.classList[state ? "remove" : "add"]([
|
||||
"XR"
|
||||
]);
|
||||
AFRAME.scenes[0].emit(state ? "apps:2D" : "apps:XR");
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", (event)=>{
|
||||
let btn = document.createElement("button");
|
||||
btn.id = "toggle_overlay";
|
||||
btn.innerText = "XRSH";
|
||||
btn.addEventListener("click", (e)=>toggle());
|
||||
document.body.appendChild(btn);
|
||||
document.querySelector("a-scene").addEventListener("enter-vr", ()=>toggle(true));
|
||||
document.querySelector("a-scene").addEventListener("exit-vr", ()=>toggle(false));
|
||||
document.querySelector("a-scene").addEventListener("loaded", ()=>{
|
||||
let VRbtn = document.querySelector("a-scene .a-enter-vr");
|
||||
let ARbtn = document.querySelector("a-scene .a-enter-ar");
|
||||
if (VRbtn) document.body.appendChild(VRbtn) // move to body
|
||||
;
|
||||
if (ARbtn) document.body.appendChild(ARbtn) // so they will always be visible
|
||||
;
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=index.c2bf9ea7.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>xrsh</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<script src="/index.443d2602.js"></script>
|
||||
<script src="/index.c2bf9ea7.js"></script>
|
||||
|
||||
|
||||
<!-- user app extensions -->
|
||||
<!-- <script>AFRAME.components['helloworld'].Component.prototype.dependencies["https://acme.com/myExtension.js"]</script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<a-scene webxr="overlayElement:#-overlay;" light="defaultLightsEnabled: true" cursor="rayOrigin: mouse" raycaster="objects: [html]; interval:100;">
|
||||
|
||||
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
|
||||
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
|
||||
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
|
||||
|
||||
<a-entity position=" 0 1.5 -1" app="uri: app/helloworld.js; foo: bar"></a-entity>
|
||||
<a-entity position=" 0 1.5 -1" app="uri: app/manual.js; foo: bar"></a-entity>
|
||||
<a-entity app="uri: app/apptiler.js; foo: bar"></a-entity>
|
||||
|
||||
<a-entity id="player" wasd-controls="" look-controls="">
|
||||
<a-entity id="left-hand" laser-controls="hand: left" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor">
|
||||
<a-entity rotation="-35 0 0" position="0 0.1 0" id="navigator">
|
||||
<a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()" position="-0.025 0 0" class="ray"></a-entity>
|
||||
<a-entity id="next" xrf-button="label: >; width:0.05; action: history.forward()" position=" 0.025 0 0" class="ray"></a-entity>
|
||||
</a-entity>
|
||||
</a-entity>
|
||||
<a-entity id="right-hand" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: #floor"></a-entity>
|
||||
<a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
|
||||
</a-entity>
|
||||
|
||||
<!-- addressible & navigatable worlds -->
|
||||
<a-entity xrf=""></a-entity>
|
||||
|
||||
</a-scene>
|
||||
|
||||
<script src="/xrsh.3464ddca.js"></script></body>
|
||||
</html>
|
|
@ -0,0 +1,585 @@
|
|||
// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
|
||||
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
||||
/* eslint-disable no-undef */
|
||||
var globalObject =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {};
|
||||
/* eslint-enable no-undef */
|
||||
|
||||
// Save the require from previous bundle to this closure if any
|
||||
var previousRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
|
||||
var cache = previousRequire.cache || {};
|
||||
// Do not use `require` to prevent Webpack from trying to bundle this call
|
||||
var nodeRequire =
|
||||
typeof module !== 'undefined' &&
|
||||
typeof module.require === 'function' &&
|
||||
module.require.bind(module);
|
||||
|
||||
function newRequire(name, jumped) {
|
||||
if (!cache[name]) {
|
||||
if (!modules[name]) {
|
||||
// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var currentRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
if (!jumped && currentRequire) {
|
||||
return currentRequire(name, true);
|
||||
}
|
||||
|
||||
// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if (previousRequire) {
|
||||
return previousRequire(name, true);
|
||||
}
|
||||
|
||||
// Try the node require function if it exists.
|
||||
if (nodeRequire && typeof name === 'string') {
|
||||
return nodeRequire(name);
|
||||
}
|
||||
|
||||
var err = new Error("Cannot find module '" + name + "'");
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
|
||||
localRequire.resolve = resolve;
|
||||
localRequire.cache = {};
|
||||
|
||||
var module = (cache[name] = new newRequire.Module(name));
|
||||
|
||||
modules[name][0].call(
|
||||
module.exports,
|
||||
localRequire,
|
||||
module,
|
||||
module.exports,
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
return cache[name].exports;
|
||||
|
||||
function localRequire(x) {
|
||||
var res = localRequire.resolve(x);
|
||||
return res === false ? {} : newRequire(res);
|
||||
}
|
||||
|
||||
function resolve(x) {
|
||||
var id = modules[name][1][x];
|
||||
return id != null ? id : x;
|
||||
}
|
||||
}
|
||||
|
||||
function Module(moduleName) {
|
||||
this.id = moduleName;
|
||||
this.bundle = newRequire;
|
||||
this.exports = {};
|
||||
}
|
||||
|
||||
newRequire.isParcelRequire = true;
|
||||
newRequire.Module = Module;
|
||||
newRequire.modules = modules;
|
||||
newRequire.cache = cache;
|
||||
newRequire.parent = previousRequire;
|
||||
newRequire.register = function (id, exports) {
|
||||
modules[id] = [
|
||||
function (require, module) {
|
||||
module.exports = exports;
|
||||
},
|
||||
{},
|
||||
];
|
||||
};
|
||||
|
||||
Object.defineProperty(newRequire, 'root', {
|
||||
get: function () {
|
||||
return globalObject[parcelRequireName];
|
||||
},
|
||||
});
|
||||
|
||||
globalObject[parcelRequireName] = newRequire;
|
||||
|
||||
for (var i = 0; i < entry.length; i++) {
|
||||
newRequire(entry[i]);
|
||||
}
|
||||
|
||||
if (mainEntry) {
|
||||
// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var mainExports = newRequire(mainEntry);
|
||||
|
||||
// CommonJS
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = mainExports;
|
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return mainExports;
|
||||
});
|
||||
|
||||
// <script>
|
||||
} else if (globalName) {
|
||||
this[globalName] = mainExports;
|
||||
}
|
||||
}
|
||||
})({"lHQeq":[function(require,module,exports) {
|
||||
var global = arguments[3];
|
||||
var HMR_HOST = null;
|
||||
var HMR_PORT = null;
|
||||
var HMR_SECURE = false;
|
||||
var HMR_ENV_HASH = "d6ea1d42532a7575";
|
||||
module.bundle.HMR_BUNDLE_ID = "0907ca6d3464ddca";
|
||||
"use strict";
|
||||
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*::
|
||||
import type {
|
||||
HMRAsset,
|
||||
HMRMessage,
|
||||
} from '@parcel/reporter-dev-server/src/HMRServer.js';
|
||||
interface ParcelRequire {
|
||||
(string): mixed;
|
||||
cache: {|[string]: ParcelModule|};
|
||||
hotData: {|[string]: mixed|};
|
||||
Module: any;
|
||||
parent: ?ParcelRequire;
|
||||
isParcelRequire: true;
|
||||
modules: {|[string]: [Function, {|[string]: string|}]|};
|
||||
HMR_BUNDLE_ID: string;
|
||||
root: ParcelRequire;
|
||||
}
|
||||
interface ParcelModule {
|
||||
hot: {|
|
||||
data: mixed,
|
||||
accept(cb: (Function) => void): void,
|
||||
dispose(cb: (mixed) => void): void,
|
||||
// accept(deps: Array<string> | string, cb: (Function) => void): void,
|
||||
// decline(): void,
|
||||
_acceptCallbacks: Array<(Function) => void>,
|
||||
_disposeCallbacks: Array<(mixed) => void>,
|
||||
|};
|
||||
}
|
||||
interface ExtensionContext {
|
||||
runtime: {|
|
||||
reload(): void,
|
||||
getURL(url: string): string;
|
||||
getManifest(): {manifest_version: number, ...};
|
||||
|};
|
||||
}
|
||||
declare var module: {bundle: ParcelRequire, ...};
|
||||
declare var HMR_HOST: string;
|
||||
declare var HMR_PORT: string;
|
||||
declare var HMR_ENV_HASH: string;
|
||||
declare var HMR_SECURE: boolean;
|
||||
declare var chrome: ExtensionContext;
|
||||
declare var browser: ExtensionContext;
|
||||
declare var __parcel__import__: (string) => Promise<void>;
|
||||
declare var __parcel__importScripts__: (string) => Promise<void>;
|
||||
declare var globalThis: typeof self;
|
||||
declare var ServiceWorkerGlobalScope: Object;
|
||||
*/ var OVERLAY_ID = "__parcel__error__overlay__";
|
||||
var OldModule = module.bundle.Module;
|
||||
function Module(moduleName) {
|
||||
OldModule.call(this, moduleName);
|
||||
this.hot = {
|
||||
data: module.bundle.hotData[moduleName],
|
||||
_acceptCallbacks: [],
|
||||
_disposeCallbacks: [],
|
||||
accept: function(fn) {
|
||||
this._acceptCallbacks.push(fn || function() {});
|
||||
},
|
||||
dispose: function(fn) {
|
||||
this._disposeCallbacks.push(fn);
|
||||
}
|
||||
};
|
||||
module.bundle.hotData[moduleName] = undefined;
|
||||
}
|
||||
module.bundle.Module = Module;
|
||||
module.bundle.hotData = {};
|
||||
var checkedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]> */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ ;
|
||||
function getHostname() {
|
||||
return HMR_HOST || (location.protocol.indexOf("http") === 0 ? location.hostname : "localhost");
|
||||
}
|
||||
function getPort() {
|
||||
return HMR_PORT || location.port;
|
||||
}
|
||||
// eslint-disable-next-line no-redeclare
|
||||
var parent = module.bundle.parent;
|
||||
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== "undefined") {
|
||||
var hostname = getHostname();
|
||||
var port = getPort();
|
||||
var protocol = HMR_SECURE || location.protocol == "https:" && ![
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"0.0.0.0"
|
||||
].includes(hostname) ? "wss" : "ws";
|
||||
var ws;
|
||||
try {
|
||||
ws = new WebSocket(protocol + "://" + hostname + (port ? ":" + port : "") + "/");
|
||||
} catch (err) {
|
||||
if (err.message) console.error(err.message);
|
||||
ws = {};
|
||||
}
|
||||
// Web extension context
|
||||
var extCtx = typeof browser === "undefined" ? typeof chrome === "undefined" ? null : chrome : browser;
|
||||
// Safari doesn't support sourceURL in error stacks.
|
||||
// eval may also be disabled via CSP, so do a quick check.
|
||||
var supportsSourceURL = false;
|
||||
try {
|
||||
(0, eval)('throw new Error("test"); //# sourceURL=test.js');
|
||||
} catch (err) {
|
||||
supportsSourceURL = err.stack.includes("test.js");
|
||||
}
|
||||
// $FlowFixMe
|
||||
ws.onmessage = async function(event /*: {data: string, ...} */ ) {
|
||||
checkedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||
assetsToAccept = [];
|
||||
assetsToDispose = [];
|
||||
var data /*: HMRMessage */ = JSON.parse(event.data);
|
||||
if (data.type === "update") {
|
||||
// Remove error overlay if there is one
|
||||
if (typeof document !== "undefined") removeErrorOverlay();
|
||||
let assets = data.assets.filter((asset)=>asset.envHash === HMR_ENV_HASH);
|
||||
// Handle HMR Update
|
||||
let handled = assets.every((asset)=>{
|
||||
return asset.type === "css" || asset.type === "js" && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
||||
});
|
||||
if (handled) {
|
||||
console.clear();
|
||||
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
||||
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") window.dispatchEvent(new CustomEvent("parcelhmraccept"));
|
||||
await hmrApplyUpdates(assets);
|
||||
// Dispose all old assets.
|
||||
let processedAssets = {} /*: {|[string]: boolean|} */ ;
|
||||
for(let i = 0; i < assetsToDispose.length; i++){
|
||||
let id = assetsToDispose[i][1];
|
||||
if (!processedAssets[id]) {
|
||||
hmrDispose(assetsToDispose[i][0], id);
|
||||
processedAssets[id] = true;
|
||||
}
|
||||
}
|
||||
// Run accept callbacks. This will also re-execute other disposed assets in topological order.
|
||||
processedAssets = {};
|
||||
for(let i = 0; i < assetsToAccept.length; i++){
|
||||
let id = assetsToAccept[i][1];
|
||||
if (!processedAssets[id]) {
|
||||
hmrAccept(assetsToAccept[i][0], id);
|
||||
processedAssets[id] = true;
|
||||
}
|
||||
}
|
||||
} else fullReload();
|
||||
}
|
||||
if (data.type === "error") {
|
||||
// Log parcel errors to console
|
||||
for (let ansiDiagnostic of data.diagnostics.ansi){
|
||||
let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
|
||||
console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + "\n" + stack + "\n\n" + ansiDiagnostic.hints.join("\n"));
|
||||
}
|
||||
if (typeof document !== "undefined") {
|
||||
// Render the fancy html overlay
|
||||
removeErrorOverlay();
|
||||
var overlay = createErrorOverlay(data.diagnostics.html);
|
||||
// $FlowFixMe
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
}
|
||||
};
|
||||
ws.onerror = function(e) {
|
||||
if (e.message) console.error(e.message);
|
||||
};
|
||||
ws.onclose = function() {
|
||||
console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost");
|
||||
};
|
||||
}
|
||||
function removeErrorOverlay() {
|
||||
var overlay = document.getElementById(OVERLAY_ID);
|
||||
if (overlay) {
|
||||
overlay.remove();
|
||||
console.log("[parcel] \u2728 Error resolved");
|
||||
}
|
||||
}
|
||||
function createErrorOverlay(diagnostics) {
|
||||
var overlay = document.createElement("div");
|
||||
overlay.id = OVERLAY_ID;
|
||||
let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
|
||||
for (let diagnostic of diagnostics){
|
||||
let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
|
||||
return `${p}
|
||||
<a href="/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a>
|
||||
${frame.code}`;
|
||||
}, "") : diagnostic.stack;
|
||||
errorHTML += `
|
||||
<div>
|
||||
<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
|
||||
\u{1F6A8} ${diagnostic.message}
|
||||
</div>
|
||||
<pre>${stack}</pre>
|
||||
<div>
|
||||
${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + "</div>").join("")}
|
||||
</div>
|
||||
${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ""}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
errorHTML += "</div>";
|
||||
overlay.innerHTML = errorHTML;
|
||||
return overlay;
|
||||
}
|
||||
function fullReload() {
|
||||
if ("reload" in location) location.reload();
|
||||
else if (extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload();
|
||||
}
|
||||
function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return [];
|
||||
var parents = [];
|
||||
var k, d, dep;
|
||||
for(k in modules)for(d in modules[k][1]){
|
||||
dep = modules[k][1][d];
|
||||
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([
|
||||
bundle,
|
||||
k
|
||||
]);
|
||||
}
|
||||
if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id));
|
||||
return parents;
|
||||
}
|
||||
function updateLink(link) {
|
||||
var href = link.getAttribute("href");
|
||||
if (!href) return;
|
||||
var newLink = link.cloneNode();
|
||||
newLink.onload = function() {
|
||||
if (link.parentNode !== null) // $FlowFixMe
|
||||
link.parentNode.removeChild(link);
|
||||
};
|
||||
newLink.setAttribute("href", // $FlowFixMe
|
||||
href.split("?")[0] + "?" + Date.now());
|
||||
// $FlowFixMe
|
||||
link.parentNode.insertBefore(newLink, link.nextSibling);
|
||||
}
|
||||
var cssTimeout = null;
|
||||
function reloadCSS() {
|
||||
if (cssTimeout) return;
|
||||
cssTimeout = setTimeout(function() {
|
||||
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
||||
for(var i = 0; i < links.length; i++){
|
||||
// $FlowFixMe[incompatible-type]
|
||||
var href /*: string */ = links[i].getAttribute("href");
|
||||
var hostname = getHostname();
|
||||
var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort());
|
||||
var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
|
||||
if (!absolute) updateLink(links[i]);
|
||||
}
|
||||
cssTimeout = null;
|
||||
}, 50);
|
||||
}
|
||||
function hmrDownload(asset) {
|
||||
if (asset.type === "js") {
|
||||
if (typeof document !== "undefined") {
|
||||
let script = document.createElement("script");
|
||||
script.src = asset.url + "?t=" + Date.now();
|
||||
if (asset.outputFormat === "esmodule") script.type = "module";
|
||||
return new Promise((resolve, reject)=>{
|
||||
var _document$head;
|
||||
script.onload = ()=>resolve(script);
|
||||
script.onerror = reject;
|
||||
(_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
|
||||
});
|
||||
} else if (typeof importScripts === "function") {
|
||||
// Worker scripts
|
||||
if (asset.outputFormat === "esmodule") return import(asset.url + "?t=" + Date.now());
|
||||
else return new Promise((resolve, reject)=>{
|
||||
try {
|
||||
importScripts(asset.url + "?t=" + Date.now());
|
||||
resolve();
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
async function hmrApplyUpdates(assets) {
|
||||
global.parcelHotUpdate = Object.create(null);
|
||||
let scriptsToRemove;
|
||||
try {
|
||||
// If sourceURL comments aren't supported in eval, we need to load
|
||||
// the update from the dev server over HTTP so that stack traces
|
||||
// are correct in errors/logs. This is much slower than eval, so
|
||||
// we only do it if needed (currently just Safari).
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=137297
|
||||
// This path is also taken if a CSP disallows eval.
|
||||
if (!supportsSourceURL) {
|
||||
let promises = assets.map((asset)=>{
|
||||
var _hmrDownload;
|
||||
return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{
|
||||
// Web extension fix
|
||||
if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != "undefined" && global instanceof ServiceWorkerGlobalScope) {
|
||||
extCtx.runtime.reload();
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
});
|
||||
scriptsToRemove = await Promise.all(promises);
|
||||
}
|
||||
assets.forEach(function(asset) {
|
||||
hmrApply(module.bundle.root, asset);
|
||||
});
|
||||
} finally{
|
||||
delete global.parcelHotUpdate;
|
||||
if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
|
||||
if (script) {
|
||||
var _document$head2;
|
||||
(_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (asset.type === "css") reloadCSS();
|
||||
else if (asset.type === "js") {
|
||||
let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
|
||||
if (deps) {
|
||||
if (modules[asset.id]) {
|
||||
// Remove dependencies that are removed and will become orphaned.
|
||||
// This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
|
||||
let oldDeps = modules[asset.id][1];
|
||||
for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
|
||||
let id = oldDeps[dep];
|
||||
let parents = getParents(module.bundle.root, id);
|
||||
if (parents.length === 1) hmrDelete(module.bundle.root, id);
|
||||
}
|
||||
}
|
||||
if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
|
||||
// support for source maps is better with eval.
|
||||
(0, eval)(asset.output);
|
||||
// $FlowFixMe
|
||||
let fn = global.parcelHotUpdate[asset.id];
|
||||
modules[asset.id] = [
|
||||
fn,
|
||||
deps
|
||||
];
|
||||
} else if (bundle.parent) hmrApply(bundle.parent, asset);
|
||||
}
|
||||
}
|
||||
function hmrDelete(bundle, id) {
|
||||
let modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (modules[id]) {
|
||||
// Collect dependencies that will become orphaned when this module is deleted.
|
||||
let deps = modules[id][1];
|
||||
let orphans = [];
|
||||
for(let dep in deps){
|
||||
let parents = getParents(module.bundle.root, deps[dep]);
|
||||
if (parents.length === 1) orphans.push(deps[dep]);
|
||||
}
|
||||
// Delete the module. This must be done before deleting dependencies in case of circular dependencies.
|
||||
delete modules[id];
|
||||
delete bundle.cache[id];
|
||||
// Now delete the orphans.
|
||||
orphans.forEach((id)=>{
|
||||
hmrDelete(module.bundle.root, id);
|
||||
});
|
||||
} else if (bundle.parent) hmrDelete(bundle.parent, id);
|
||||
}
|
||||
function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||
if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
|
||||
// Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
|
||||
let parents = getParents(module.bundle.root, id);
|
||||
let accepted = false;
|
||||
while(parents.length > 0){
|
||||
let v = parents.shift();
|
||||
let a = hmrAcceptCheckOne(v[0], v[1], null);
|
||||
if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
|
||||
accepted = true;
|
||||
else {
|
||||
// Otherwise, queue the parents in the next level upward.
|
||||
let p = getParents(module.bundle.root, v[1]);
|
||||
if (p.length === 0) {
|
||||
// If there are no parents, then we've reached an entry without accepting. Reload.
|
||||
accepted = false;
|
||||
break;
|
||||
}
|
||||
parents.push(...p);
|
||||
}
|
||||
}
|
||||
return accepted;
|
||||
}
|
||||
function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
|
||||
var modules = bundle.modules;
|
||||
if (!modules) return;
|
||||
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
|
||||
// If we reached the root bundle without finding where the asset should go,
|
||||
// there's nothing to do. Mark as "accepted" so we don't reload the page.
|
||||
if (!bundle.parent) return true;
|
||||
return hmrAcceptCheck(bundle.parent, id, depsByBundle);
|
||||
}
|
||||
if (checkedAssets[id]) return true;
|
||||
checkedAssets[id] = true;
|
||||
var cached = bundle.cache[id];
|
||||
assetsToDispose.push([
|
||||
bundle,
|
||||
id
|
||||
]);
|
||||
if (!cached || cached.hot && cached.hot._acceptCallbacks.length) {
|
||||
assetsToAccept.push([
|
||||
bundle,
|
||||
id
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||
var cached = bundle.cache[id];
|
||||
bundle.hotData[id] = {};
|
||||
if (cached && cached.hot) cached.hot.data = bundle.hotData[id];
|
||||
if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
|
||||
cb(bundle.hotData[id]);
|
||||
});
|
||||
delete bundle.cache[id];
|
||||
}
|
||||
function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) {
|
||||
// Execute the module.
|
||||
bundle(id);
|
||||
// Run the accept callbacks in the new version of the module.
|
||||
var cached = bundle.cache[id];
|
||||
if (cached && cached.hot && cached.hot._acceptCallbacks.length) cached.hot._acceptCallbacks.forEach(function(cb) {
|
||||
var assetsToAlsoAccept = cb(function() {
|
||||
return getParents(module.bundle.root, id);
|
||||
});
|
||||
if (assetsToAlsoAccept && assetsToAccept.length) {
|
||||
assetsToAlsoAccept.forEach(function(a) {
|
||||
hmrDispose(a[0], a[1]);
|
||||
});
|
||||
// $FlowFixMe[method-unbinding]
|
||||
assetsToAccept.push.apply(assetsToAccept, assetsToAlsoAccept);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},{}],"j4kuM":[function(require,module,exports) {
|
||||
|
||||
},{}]},["lHQeq","j4kuM"], "j4kuM", "parcelRequire7788")
|
||||
|
||||
//# sourceMappingURL=xrsh.3464ddca.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="./index.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Welcome to XRSHell</h1>
|
||||
<br>
|
||||
<img src="https://i.imgur.com/BW22wrb.png"/>
|
||||
<br><br>
|
||||
The <b>xrsh</b> (xrshell) brings the <a href="https://en.wikipedia.org/wiki/Free_and_open-source_software" target="_blank">FOSS</a>- and <a href="https://en.wikipedia.org/wiki/Linux" target="_blank">Linux</a>-soul to <a href="https://en.wikipedia.org/wiki/WebXR" target="_blank">WebXR</a>, promoting the use of (interactive text) terminal and user-provided operating systems inside WebXR.
|
||||
<br><br>Technically, <b>xrsh</b> is a bundle of freshly created re-usable FOSS WebXR components.<br>These provide a common filesystem interface for interacting with WebXR, offering the well-known linux/unix toolchain including a commandline to invoke, store, edit and run WebXR utilities - regardless of their implementation.
|
||||
<br><br>Think of it as termux for the VR/AR headset browser, which can be used to e.g. livecode (using terminal auto-completion!) for XR component (registries).
|
||||
|
||||
<br>
|
||||
<ul>
|
||||
<li><a href="https://forgejo.isvery.ninja/xrsh" target="_blank">source xrsh</a></li>
|
||||
<li><a href="https://forgejo.isvery.ninja/xrsh-apps" target="_blank">source xrsh apps</a></li>
|
||||
<li><a href="https://forgejo.isvery.ninja/xrsh-media" target="_blank">roadmap meeting recordings</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
term = document.querySelector('[isoterminal]').components.isoterminal.term
|
||||
convert = ISOTerminal.prototype.convert
|
||||
|
||||
console.test("com/isoterminal/ISOTerminal.js", async () => {
|
||||
|
||||
term.worker['emulator.read_file']("root/.profile")
|
||||
.then( (res) => {
|
||||
try{
|
||||
let data = convert.Uint8ArrayToString( res )
|
||||
console.assert( data.length, "worker.postMessage.promise()")
|
||||
}catch(e){
|
||||
console.assert( false, "worker.postMessage.promise()")
|
||||
}
|
||||
})
|
||||
.catch(console.error)
|
||||
.finally(console.dir)
|
||||
|
||||
})
|
||||
|
||||
console.test("com/isoterminal/ISOTerminal.js", async () => {
|
||||
|
||||
term.worker['emulator.create_file']("foo", convert.toUint8Array("hello") )
|
||||
.then( (res) => {
|
||||
term.worker['emulator.read_file']("foo")
|
||||
.then( (res) => {
|
||||
try{
|
||||
let data = convert.Uint8ArrayToString( res )
|
||||
console.assert( data == "hello", "emulator.create_file")
|
||||
}catch(e){
|
||||
console.assert( false, "emulator.create_file")
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(console.error)
|
||||
.finally(console.dir)
|
||||
|
||||
})
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
// minimalistc testrunner
|
||||
console.test = async (name,cb) => {
|
||||
let tests = console.test.tests = console.test.tests || {}
|
||||
tests[name] = tests[name] || []
|
||||
tests[name].push(cb)
|
||||
console.test.run = async () => {
|
||||
for( let name in tests ){
|
||||
console.log("\x1b[34m\x1b[36;49m"+name+"\x1B[m")
|
||||
for( let test in tests[name] ){
|
||||
await tests[name][test]()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.assert = ((assert) => (a,reason,data) => {
|
||||
console.log("\x1b[34m\x1b[36;49m♥ \x1B[m"+reason)
|
||||
assert.call( console, a, {reason} )
|
||||
if( !a ){
|
||||
console.dir(data)
|
||||
throw 'abort..'
|
||||
}
|
||||
|
||||
})(console.assert)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
41309dca48ccd0c4b43a06fb58f2fc4ff8dd5f4135fe2a4af1ccfd77800c510d xrsh.com
|
70
xrsh.nix
70
xrsh.nix
|
@ -1,44 +1,53 @@
|
|||
{ stdenv, fetchurl, fetchzip, lib, zip }:
|
||||
{ lib, stdenv, fetchgit, cosmopolitan }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "xrsh";
|
||||
version = "0.0.13";
|
||||
version = "0.2";
|
||||
|
||||
redbean = fetchurl {
|
||||
url = "https://redbean.dev/redbean-2.2.com";
|
||||
hash = "sha256-24/HzFp3A7fMuDCjZutp5yj8eJL9PswJPAidg3qluRs=";
|
||||
src = cosmopolitan.src;
|
||||
|
||||
inherit (cosmopolitan) nativeBuildInputs buildInputs patches strictDeps cosmocc;
|
||||
|
||||
outputs = ["out"];
|
||||
|
||||
# xrsh = fetchzip {
|
||||
# url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz";
|
||||
# sha256 = "1x0h5krz90y8ngrzgbpjd6xdr171y54p3lqwyirq8j6ilzlq5d5i";
|
||||
# };
|
||||
#
|
||||
# xrshcom = fetchzip {
|
||||
# url = "https://codeberg.org/xrsh/xrsh-com/archive/c668a8ba8f65c3d36e3a4da5ea8b87af5eb6091c.tar.gz";
|
||||
# sha256 = "0mpl7h4fxg5i4lxw5447pqr12rsffcf24xdrqwqzr1zzpkdkslks";
|
||||
# };
|
||||
|
||||
xrsh = fetchgit {
|
||||
url = "https://codeberg.org/xrsh/xrsh";
|
||||
rev = "4330037206add994093c46eb5443fffd6f6221ce";
|
||||
hash = "sha256-igvhSR+n25iHfgHBUniStdVANtrIVHmKpY3LCEIYsx4=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
xrsh = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh/archive/24e117f5125e4b2ecd7432baf6fdd5f60e6b3a70.tar.gz";
|
||||
sha256 = "1x0h5krz90y8ngrzgbpjd6xdr171y54p3lqwyirq8j6ilzlq5d5i";
|
||||
};
|
||||
buildFlags = cosmopolitan.buildFlags ++ [ "o//tool/net/redbean.com" ];
|
||||
|
||||
xrshcom = fetchzip {
|
||||
url = "https://codeberg.org/xrsh/xrsh-com/archive/c668a8ba8f65c3d36e3a4da5ea8b87af5eb6091c.tar.gz";
|
||||
sha256 = "0mpl7h4fxg5i4lxw5447pqr12rsffcf24xdrqwqzr1zzpkdkslks";
|
||||
};
|
||||
|
||||
buildInputs = [ zip ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
dontBuild = true;
|
||||
#buildPhase = ''
|
||||
# make o//tool/net/redbean.com
|
||||
#'';
|
||||
|
||||
dontUnpack = false;
|
||||
dontBuild = false;
|
||||
dontFixup = true; # essential, otherwise cosmopolitcan libc exec-header gets corrupted
|
||||
|
||||
|
||||
installPhase = ''
|
||||
install -D $redbean $out/bin/xrsh.com
|
||||
chmod +x $out/bin/xrsh.com
|
||||
|
||||
cd $xrsh
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com index.html src/index.{html,css} LICENSE src/assets
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
|
||||
set -x
|
||||
cp o/tool/net/redbean.com $out/bin/xrsh.com
|
||||
chmod +x $out/bin/xrsh.com
|
||||
|
||||
cd $xrsh
|
||||
./make standalone $out/bin/xrsh.com
|
||||
|
||||
# add components
|
||||
mkdir /tmp/src
|
||||
cp -r $xrshcom/* /tmp/src/.
|
||||
cd /tmp
|
||||
zip -x "*.git*" -r $out/bin/xrsh.com src/com/*.js src/com/isoterminal/{xrsh.iso,libv86.js,bios,v86.wasm}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -50,4 +59,3 @@ stdenv.mkDerivation rec {
|
|||
platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue