@jsenv/core 40.0.1 → 40.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{js → client/autoreload}/autoreload.js +45 -2
- package/dist/{html → client/directory_listing}/directory_listing.html +2 -2
- package/dist/client/directory_listing/js/directory_listing.js +247 -0
- package/dist/{js → client/new_stylesheet}/new_stylesheet.js +1 -1
- package/dist/{js → client/regenerator_runtime}/regenerator_runtime.js +1 -1
- package/dist/{js → client/server_events_client}/server_events_client.js +0 -1
- package/dist/js/build.js +2637 -0
- package/dist/js/start_build_server.js +210 -0
- package/dist/js/start_dev_server.js +840 -0
- package/dist/jsenv_core.js +14 -21359
- package/dist/jsenv_core_packages.js +10061 -0
- package/dist/main.js +117 -0
- package/dist/plugins.js +7944 -0
- package/package.json +18 -14
- package/src/build/build.js +61 -60
- package/src/build/build_params.js +20 -0
- package/src/build/build_specifier_manager.js +12 -1
- package/src/build/build_urls_generator.js +5 -1
- package/src/build/jsenv_plugin_subbuilds.js +71 -0
- package/src/dev/start_dev_server.js +21 -7
- package/src/kitchen/fetched_content_compliance.js +7 -3
- package/src/kitchen/kitchen.js +3 -0
- package/src/main.js +13 -3
- package/src/plugins/autoreload/jsenv_plugin_autoreload_client.js +1 -4
- package/src/plugins/html_syntax_error_fallback/jsenv_plugin_html_syntax_error_fallback.js +4 -3
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +2 -3
- package/src/plugins/protocol_file/jsenv_plugin_directory_listing.js +1 -2
- package/src/plugins/resolution_node_esm/node_esm_resolver.js +17 -1
- package/src/plugins/ribbon/jsenv_plugin_ribbon.js +2 -2
- package/dist/js/directory_listing.js +0 -247
- /package/dist/babel_helpers/{OverloadYield → overloadYield}/OverloadYield.js +0 -0
- /package/dist/{css → client/directory_listing/css}/directory_listing.css +0 -0
- /package/dist/{other → client/directory_listing/other}/dir.png +0 -0
- /package/dist/{other → client/directory_listing/other}/file.png +0 -0
- /package/dist/{other → client/directory_listing/other}/home.svg +0 -0
- /package/dist/{html → client/html_syntax_error}/html_syntax_error.html +0 -0
- /package/dist/{js → client/import_meta_hot}/import_meta_hot.js +0 -0
- /package/dist/{js → client/inline_content}/inline_content.js +0 -0
- /package/dist/{js → client/ribbon}/ribbon.js +0 -0
|
@@ -1,5 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const parseSrcSet = (srcset) => {
|
|
2
|
+
const srcCandidates = [];
|
|
3
|
+
srcset.split(",").forEach((set) => {
|
|
4
|
+
const [specifier, descriptor] = set.trim().split(" ");
|
|
5
|
+
srcCandidates.push({
|
|
6
|
+
specifier,
|
|
7
|
+
descriptor,
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
return srcCandidates;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const stringifySrcSet = (srcCandidates) => {
|
|
14
|
+
const srcset = srcCandidates
|
|
15
|
+
.map(({ specifier, descriptor }) => `${specifier} ${descriptor}`)
|
|
16
|
+
.join(", ");
|
|
17
|
+
return srcset;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* https://vitejs.dev/guide/api-hmr.html#hot-accept-deps-cb
|
|
22
|
+
* https://modern-web.dev/docs/dev-server/plugins/hmr/
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const urlHotMetas = {};
|
|
26
|
+
|
|
27
|
+
const createEvent = () => {
|
|
28
|
+
const callbackSet = new Set();
|
|
29
|
+
const addCallback = (callback) => {
|
|
30
|
+
callbackSet.add(callback);
|
|
31
|
+
return () => {
|
|
32
|
+
callbackSet.delete(callback);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const dispatch = () => {
|
|
36
|
+
for (const callback of callbackSet) {
|
|
37
|
+
callback();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return [{ addCallback }, dispatch];
|
|
41
|
+
};
|
|
42
|
+
const [beforePartialReload, dispatchBeforePartialReload] = createEvent();
|
|
43
|
+
const [afterPartialReload, dispatchAfterPartialReload] = createEvent();
|
|
44
|
+
const [beforeFullReload, dispatchBeforeFullReload] = createEvent();
|
|
45
|
+
const [beforePrune, dispatchBeforePrune] = createEvent();
|
|
3
46
|
|
|
4
47
|
const initAutoreload = ({ mainFilePath }) => {
|
|
5
48
|
const reloader = {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>Directory explorer</title>
|
|
5
5
|
<meta charset="utf-8">
|
|
6
6
|
<link rel="icon" href="data:,">
|
|
7
|
-
<link rel="stylesheet" href="
|
|
7
|
+
<link rel="stylesheet" href="/client/directory_listing/css/directory_listing.css">
|
|
8
8
|
</head>
|
|
9
9
|
|
|
10
10
|
<body data-theme="dark">
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
// eslint-disable-next-line no-undef
|
|
14
14
|
window.DIRECTORY_LISTING = __DIRECTORY_LISTING__;
|
|
15
15
|
</script>
|
|
16
|
-
<script type="module" src="
|
|
16
|
+
<script type="module" src="/client/directory_listing/js/directory_listing.js"></script>
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
var n,l$1,t$1,i$1,r$1,o$1,e$1,f$2,c$1,s$1,a$1,p$1={},v$1=[],y$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d$1=Array.isArray;function w$1(n,l){for(var t in l)n[t]=l[t];return n}function g$1(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function _$1(l,t,u){var i,r,o,e={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:e[o]=t[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):u),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return m$1(l,e,i,r,null)}function m$1(n,u,i,r,o){var e={type:n,props:u,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++t$1:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function k$1(n){return n.children}function x$1(n,l){this.props=n,this.context=l;}function S(n,l){if(null==l)return n.__?S(n.__,n.__i+1):null;for(var t;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e)return t.__e;return "function"==typeof n.type?S(n):null}function C$2(n){var l,t;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(t=n.__k[l])&&null!=t.__e){n.__e=n.__c.base=t.__e;break}return C$2(n)}}function M(n){(!n.__d&&(n.__d=true)&&i$1.push(n)&&!$.__r++||r$1!==l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$1)($);}function $(){for(var n,t,u,r,o,f,c,s=1;i$1.length;)i$1.length>s&&i$1.sort(e$1),n=i$1.shift(),s=i$1.length,n.__d&&(u=void 0,o=(r=(t=n).__v).__e,f=[],c=[],t.__P&&((u=w$1({},r)).__v=r.__v+1,l$1.vnode&&l$1.vnode(u),O(t.__P,u,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,f,null==o?S(r):o,!!(32&r.__u),c),u.__v=r.__v,u.__.__k[u.__i]=u,z$1(f,u,c),u.__e!=o&&C$2(u)));$.__r=0;}function I(n,l,t,u,i,r,o,e,f,c,s){var a,h,y,d,w,g,_=u&&u.__k||v$1,m=l.length;for(f=P$1(t,l,_,f,m),a=0;a<m;a++)null!=(y=t.__k[a])&&(h=-1===y.__i?p$1:_[y.__i]||p$1,y.__i=a,g=O(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&q$1(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&void 0!==g?f=g:d&&(f=d.nextSibling),y.__u&=-7);return t.__e=w,f}function P$1(n,l,t,u,i){var r,o,e,f,c,s=t.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m$1(null,o,null,null,null):d$1(o)?m$1(k$1,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?m$1(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,t,f,a))&&(a--,(e=t[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=t[r])&&0==(2&e.__u)&&(e.__e==u&&(u=S(e)),B$2(e,e));return u}function A(n,l,t){var u,i;if("function"==typeof n.type){for(u=n.__k,i=0;u&&i<u.length;i++)u[i]&&(u[i].__=n,l=A(u[i],l,t));return l}n.__e!=l&&(l&&n.type&&!t.contains(l)&&(l=S(n)),t.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function H$1(n,l){return l=l||[],null==n||"boolean"==typeof n||(d$1(n)?n.some(function(n){H$1(n,l);}):l.push(n)),l}function L(n,l,t,u){var i,r,o=n.key,e=n.type,f=l[t];if(null===f&&null==n.key||f&&o==f.key&&e===f.type&&0==(2&f.__u))return t;if(u>(null!=f&&0==(2&f.__u)?1:0))for(i=t-1,r=t+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T$1(n,l,t){"-"==l[0]?n.setProperty(l,null==t?"":t):n[l]=null==t?"":"number"!=typeof t||y$1.test(l)?t:t+"px";}function j$2(n,l,t,u,i){var r;n:if("style"==l)if("string"==typeof t)n.style.cssText=t;else {if("string"==typeof u&&(n.style.cssText=u=""),u)for(l in u)t&&l in t||T$1(n.style,l,"");if(t)for(l in t)u&&t[l]===u[l]||T$1(n.style,l,t[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f$2,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=t,t?u?t.t=u.t:(t.t=c$1,n.addEventListener(l,r?a$1:s$1,r)):n.removeEventListener(l,r?a$1:s$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==t?"":t;break n}catch(n){}"function"==typeof t||(null==t||false===t&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==t?"":t));}}function F$1(n){return function(t){if(this.l){var u=this.l[t.type+n];if(null==t.u)t.u=c$1++;else if(t.u<u.t)return;return u(l$1.event?l$1.event(t):t)}}}function O(n,t,u,i,r,o,e,f,c,s){var a,h,p,v,y,_,m,b,S,C,M,$,P,A,H,L,T,j=t.type;if(void 0!==t.constructor)return null;128&u.__u&&(c=!!(32&u.__u),o=[f=t.__e=u.__e]),(a=l$1.__b)&&a(t);n:if("function"==typeof j)try{if(b=t.props,S="prototype"in j&&j.prototype.render,C=(a=j.contextType)&&i[a.__c],M=a?C?C.props.value:a.__:i,u.__c?m=(h=t.__c=u.__c).__=h.__E:(S?t.__c=h=new j(b,M):(t.__c=h=new x$1(b,M),h.constructor=j,h.render=D$1),C&&C.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=j.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=w$1({},h.__s)),w$1(h.__s,j.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=t,p)S&&null==j.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(S&&null==j.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||t.__v==u.__v)){for(t.__v!=u.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=u.__e,t.__k=u.__k,t.__k.some(function(n){n&&(n.__=t);}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,_);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,P=l$1.__r,A=0,S){for(h.state=h.__s,h.__d=!1,P&&P(t),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,P&&P(t),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=w$1(w$1({},i),h.getChildContext())),S&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,y)),L=a,null!=a&&a.type===k$1&&null==a.key&&(L=N$1(a.props.children)),f=I(n,d$1(L)?L:[L],t,u,i,r,o,e,f,c,s),h.base=t.__e,t.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(t.__v=null,c||null!=o)if(n.then){for(t.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,t.__e=f;}else for(T=o.length;T--;)g$1(o[T]);else t.__e=u.__e,t.__k=u.__k;l$1.__e(n,t,u);}else null==o&&t.__v==u.__v?(t.__k=u.__k,t.__e=u.__e):f=t.__e=V$1(u.__e,t,u,i,r,o,e,c,s);return (a=l$1.diffed)&&a(t),128&t.__u?void 0:f}function z$1(n,t,u){for(var i=0;i<u.length;i++)q$1(u[i],u[++i],u[++i]);l$1.__c&&l$1.__c(t,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(n){n.call(t);});}catch(n){l$1.__e(n,t.__v);}});}function N$1(n){return "object"!=typeof n||null==n?n:d$1(n)?n.map(N$1):w$1({},n)}function V$1(t,u,i,r,o,e,f,c,s){var a,h,v,y,w,_,m,b=i.props,k=u.props,x=u.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((w=e[a])&&"setAttribute"in w==!!x&&(x?w.localName==x:3==w.nodeType)){t=w,e[a]=null;break}if(null==t){if(null==x)return document.createTextNode(k);t=document.createElementNS(o,x,k.is&&k),c&&(l$1.__m&&l$1.__m(u,e),c=false),e=null;}if(null===x)b===k||c&&t.data===k||(t.data=k);else {if(e=e&&n.call(t.childNodes),b=i.props||p$1,!c&&null!=e)for(b={},a=0;a<t.attributes.length;a++)b[(w=t.attributes[a]).name]=w.value;for(a in b)if(w=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=w;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;j$2(t,a,null,w,o);}for(a in k)w=k[a],"children"==a?y=w:"dangerouslySetInnerHTML"==a?h=w:"value"==a?_=w:"checked"==a?m=w:c&&"function"!=typeof w||b[a]===w||j$2(t,a,w,b[a],o);if(h)c||v&&(h.__html===v.__html||h.__html===t.innerHTML)||(t.innerHTML=h.__html),u.__k=[];else if(v&&(t.innerHTML=""),I("template"===u.type?t.content:t,d$1(y)?y:[y],u,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&S(i,0),c,s),null!=e)for(a=e.length;a--;)g$1(e[a]);c||(a="value","progress"==x&&null==_?t.removeAttribute("value"):void 0!==_&&(_!==t[a]||"progress"==x&&!_||"option"==x&&_!==b[a])&&j$2(t,a,_,b[a],o),a="checked",void 0!==m&&m!==t[a]&&j$2(t,a,m,b[a],o));}return t}function q$1(n,t,u){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==t||(n.__u=n(t));}else n.current=t;}catch(n){l$1.__e(n,u);}}function B$2(n,t,u){var i,r;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||q$1(i,null,t)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,t);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&B$2(i[r],t,u||"function"!=typeof n.type);u||g$1(n.__e),n.__c=n.__=n.__e=void 0;}function D$1(n,l,t){return this.constructor(n,t)}function E$1(t,u,i){var r,o,e,f;u==document&&(u=document.documentElement),l$1.__&&l$1.__(t,u),o=(r="function"=="undefined")?null:u.__k,e=[],f=[],O(u,t=(u).__k=_$1(k$1,null,[t]),o||p$1,p$1,u.namespaceURI,o?null:u.firstChild?n.call(u.childNodes):null,e,o?o.__e:u.firstChild,r,f),z$1(e,t,f);}n=v$1.slice,l$1={__e:function(n,l,t,u){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,u||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},t$1=0,x$1.prototype.setState=function(n,l){var t;t=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=w$1({},this.state),"function"==typeof n&&(n=n(w$1({},t),this.props)),n&&w$1(t,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x$1.prototype.render=k$1,i$1=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},$.__r=0,f$2=/(PointerCapture)$|Capture$/i,c$1=0,s$1=F$1(false),a$1=F$1(true);
|
|
2
|
+
|
|
3
|
+
var t,r,u$1,i,o=0,f$1=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return true;var u=o.__c.__H.__.filter(function(n){return !!n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=true);}}),c&&c.call(this,n,t,r)||i};r.__f=true;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function y(n,u){var i=p(t++,3);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i));}function _(n,u){var i=p(t++,4);!c.__s&&C$1(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i));}function j$1(){for(var n;n=f$1.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B$1),n.__H.__h=[];}catch(t){n.__H.__h=[],c.__e(t,n.__v);}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t);},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u$1===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(i.__h.forEach(z),i.__h.forEach(B$1),i.__h=[],t=0)),u$1=r;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f$1.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j$1)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0;})),u$1=r=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return !n.__||B$1(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B$1(n){var t=r;n.__c=n.__(),r=t;}function C$1(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
|
|
4
|
+
|
|
5
|
+
function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if("__source"!==e&&!(e in t))return true;for(var r in t)if("__source"!==r&&n[r]!==t[r])return true;return false}function C(n,t){var e=t(),r=d({t:{__:e,u:t}}),u=r[0].t,o=r[1];return _(function(){u.__=e,u.u=t,x(u)&&o({t:u});},[n,e,t]),y(function(){return x(u)&&o({t:u}),n(function(){x(u)&&o({t:u});})},[n]),e}function x(n){var t,e,r=n.u,u=n.__;try{var o=r();return !((t=u)===(e=o)&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return true}}function N(n,t){this.props=n,this.context=t;}(N.prototype=new x$1).isPureReactComponent=true,N.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var T=l$1.__b;l$1.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),T&&T(n);};var F=l$1.__e;l$1.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);F(n,t,e,r);};var U=l$1.unmount;function V(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){"function"==typeof n.__c&&n.__c();}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return V(n,t,e)})),n}function W(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return W(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=true,n.__c.__P=e)),n}function P(){this.__u=0,this.o=null,this.__b=null;}function j(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function B(){this.i=null,this.l=null;}l$1.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),U&&U(n);},(P.prototype=new x$1).__c=function(n,t){var e=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(e);var u=j(r.__v),o=false,i=function(){o||(o=true,e.__R=null,u?u(c):c());};e.__R=i;var c=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=W(n,n.__c.__P,n.__c.__O);}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate();}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i);},P.prototype.componentWillUnmount=function(){this.o=[];},P.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=V(this.__b,r,o.__O=o.__P);}this.__b=null;}var i=e.__a&&_$1(k$1,null,n.fallback);return i&&(i.__u&=-33),[_$1(k$1,null,e.__a?null:n.children),i]};var H=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&("t"!==n.props.revealOrder[0]||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2];}};(B.prototype=new x$1).__a=function(n){var t=this,e=j(t.__v),r=t.l.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),H(t,n,r)):u();};e?e(o):o();}},B.prototype.render=function(n){this.i=null,this.l=new Map;var t=H$1(n.children);n.revealOrder&&"b"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},B.prototype.componentDidUpdate=B.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){H(n,e,t);});};var q="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,G=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,J=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,K=/[A-Z0-9]/g,Q="undefined"!=typeof document,X=function(n){return ("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};x$1.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(x$1.prototype,t,{configurable:true,get:function(){return this["UNSAFE_"+t]},set:function(n){Object.defineProperty(this,t,{configurable:true,writable:true,value:n});}});});var en=l$1.event;function rn(){}function un(){return this.cancelBubble}function on(){return this.defaultPrevented}l$1.event=function(n){return en&&(n=en(n)),n.persist=rn,n.isPropagationStopped=un,n.isDefaultPrevented=on,n.nativeEvent=n};var ln={enumerable:false,configurable:true,get:function(){return this.class}},fn=l$1.vnode;l$1.vnode=function(n){"string"==typeof n.type&&function(n){var t=n.props,e=n.type,u={},o=-1===e.indexOf("-");for(var i in t){var c=t[i];if(!("value"===i&&"defaultValue"in t&&null==c||Q&&"children"===i&&"noscript"===e||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&true===c?c="":"translate"===l&&"no"===c?c=false:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==e&&"textarea"!==e||X(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":J.test(i)&&(i=l):l=i="oninput":o&&G.test(i)?i=i.replace(K,"-$&").toLowerCase():null===c&&(c=void 0),"oninput"===l&&u[i=l]&&(i="oninputCapture"),u[i]=c;}}"select"==e&&u.multiple&&Array.isArray(u.value)&&(u.value=H$1(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value);})),"select"==e&&null!=u.defaultValue&&(u.value=H$1(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value;})),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,"className",ln)):(t.className&&!t.class||t.class&&t.className)&&(u.class=u.className=t.className),n.props=u;}(n),n.$$typeof=q,fn&&fn(n);};var an=l$1.__r;l$1.__r=function(n){an&&an(n),n.__c;};var sn=l$1.diffed;l$1.diffed=function(n){sn&&sn(n);var t=n.props,e=n.__e;null!=e&&"textarea"===n.type&&"value"in t&&t.value!==e.value&&(e.value=null==t.value?"":t.value);};
|
|
6
|
+
|
|
7
|
+
var f=0;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a) void 0===p[c]&&(p[c]=a[c]);return l$1.vnode&&l$1.vnode(l),l}
|
|
8
|
+
|
|
9
|
+
const directoryIconUrl = new URL("/client/directory_listing/other/dir.png", import.meta.url).href;
|
|
10
|
+
const fileIconUrl = new URL("/client/directory_listing/other/file.png", import.meta.url).href;
|
|
11
|
+
const homeIconUrl = new URL("/client/directory_listing/other/home.svg#root", import.meta.url).href;
|
|
12
|
+
let {
|
|
13
|
+
navItems,
|
|
14
|
+
mainFilePath,
|
|
15
|
+
directoryContentItems,
|
|
16
|
+
enoentDetails,
|
|
17
|
+
websocketUrl,
|
|
18
|
+
autoreload
|
|
19
|
+
} = window.DIRECTORY_LISTING;
|
|
20
|
+
const directoryItemsChangeCallbackSet = new Set();
|
|
21
|
+
const updateDirectoryContentItems = value => {
|
|
22
|
+
directoryContentItems = value;
|
|
23
|
+
for (const dirContentItem of value) {
|
|
24
|
+
if (dirContentItem.isMainFile && window.location.pathname === "/") {
|
|
25
|
+
window.location.reload();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const isDirectory = new URL(dirContentItem.url).pathname.endsWith("/");
|
|
29
|
+
if (!isDirectory && dirContentItem.urlRelativeToServer === window.location.pathname) {
|
|
30
|
+
window.location.reload();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const directoryItemsChangeCallback of directoryItemsChangeCallbackSet) {
|
|
35
|
+
directoryItemsChangeCallback();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const DirectoryListing = () => {
|
|
39
|
+
const directoryItems = C(callback => {
|
|
40
|
+
directoryItemsChangeCallbackSet.add(callback);
|
|
41
|
+
}, () => {
|
|
42
|
+
return directoryContentItems;
|
|
43
|
+
});
|
|
44
|
+
return u(k$1, {
|
|
45
|
+
children: [enoentDetails ? u(ErrorMessage, {}) : null, u(Nav, {}), u(DirectoryContent, {
|
|
46
|
+
items: directoryItems
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const ErrorMessage = () => {
|
|
51
|
+
const {
|
|
52
|
+
fileUrl,
|
|
53
|
+
filePathExisting,
|
|
54
|
+
filePathNotFound
|
|
55
|
+
} = enoentDetails;
|
|
56
|
+
return u("p", {
|
|
57
|
+
className: "error_message",
|
|
58
|
+
children: [u("span", {
|
|
59
|
+
className: "error_text",
|
|
60
|
+
children: ["No filesystem entry at", " ", u("code", {
|
|
61
|
+
title: fileUrl,
|
|
62
|
+
children: [u("span", {
|
|
63
|
+
className: "file_path_good",
|
|
64
|
+
children: filePathExisting
|
|
65
|
+
}), u("span", {
|
|
66
|
+
className: "file_path_bad",
|
|
67
|
+
children: filePathNotFound
|
|
68
|
+
})]
|
|
69
|
+
}), "."]
|
|
70
|
+
}), u("br", {}), u("span", {
|
|
71
|
+
className: "error_text",
|
|
72
|
+
style: "font-size: 70%;",
|
|
73
|
+
children: ["See also available routes in the", " ", u("a", {
|
|
74
|
+
href: "/.internal/route_inspector",
|
|
75
|
+
children: "route inspector"
|
|
76
|
+
}), "."]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const Nav = () => {
|
|
81
|
+
return u("h1", {
|
|
82
|
+
className: "nav",
|
|
83
|
+
children: navItems.map(navItem => {
|
|
84
|
+
const {
|
|
85
|
+
url,
|
|
86
|
+
urlRelativeToServer,
|
|
87
|
+
name,
|
|
88
|
+
isCurrent,
|
|
89
|
+
isServerRootDirectory
|
|
90
|
+
} = navItem;
|
|
91
|
+
const isDirectory = new URL(url).pathname.endsWith("/");
|
|
92
|
+
return u(k$1, {
|
|
93
|
+
children: [u(NavItem, {
|
|
94
|
+
url: urlRelativeToServer,
|
|
95
|
+
isCurrent: isCurrent,
|
|
96
|
+
iconImageUrl: isServerRootDirectory ? homeIconUrl : "",
|
|
97
|
+
iconLinkUrl: isServerRootDirectory ? `/${mainFilePath}` : "",
|
|
98
|
+
children: name
|
|
99
|
+
}, url), isDirectory ? u("span", {
|
|
100
|
+
className: "directory_separator",
|
|
101
|
+
children: "/"
|
|
102
|
+
}) : null]
|
|
103
|
+
});
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const NavItem = ({
|
|
108
|
+
url,
|
|
109
|
+
iconImageUrl,
|
|
110
|
+
iconLinkUrl,
|
|
111
|
+
isCurrent,
|
|
112
|
+
children
|
|
113
|
+
}) => {
|
|
114
|
+
return u("span", {
|
|
115
|
+
className: "nav_item",
|
|
116
|
+
"data-current": isCurrent ? "" : undefined,
|
|
117
|
+
children: [iconLinkUrl ? u("a", {
|
|
118
|
+
className: "nav_item_icon"
|
|
119
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
120
|
+
,
|
|
121
|
+
"hot-decline": true,
|
|
122
|
+
href: iconLinkUrl,
|
|
123
|
+
children: u(Icon, {
|
|
124
|
+
url: iconImageUrl
|
|
125
|
+
})
|
|
126
|
+
}) : iconImageUrl ? u("span", {
|
|
127
|
+
className: "nav_item_icon",
|
|
128
|
+
children: u(Icon, {
|
|
129
|
+
url: iconImageUrl
|
|
130
|
+
})
|
|
131
|
+
}) : null, url ? u("a", {
|
|
132
|
+
className: "nav_item_text",
|
|
133
|
+
href: url,
|
|
134
|
+
children: children
|
|
135
|
+
}) : u("span", {
|
|
136
|
+
className: "nav_item_text",
|
|
137
|
+
children: children
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const DirectoryContent = ({
|
|
142
|
+
items
|
|
143
|
+
}) => {
|
|
144
|
+
if (items.length === 0) {
|
|
145
|
+
return u("p", {
|
|
146
|
+
className: "directory_empty_message",
|
|
147
|
+
children: "Directory is empty"
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return u("ul", {
|
|
151
|
+
className: "directory_content",
|
|
152
|
+
children: items.map(directoryItem => {
|
|
153
|
+
return u(DirectoryContentItem, {
|
|
154
|
+
url: directoryItem.urlRelativeToServer,
|
|
155
|
+
isDirectory: directoryItem.url.endsWith("/"),
|
|
156
|
+
isMainFile: directoryItem.isMainFile,
|
|
157
|
+
children: directoryItem.urlRelativeToCurrentDirectory
|
|
158
|
+
}, directoryItem.url);
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const DirectoryContentItem = ({
|
|
163
|
+
url,
|
|
164
|
+
isDirectory,
|
|
165
|
+
isMainFile,
|
|
166
|
+
children
|
|
167
|
+
}) => {
|
|
168
|
+
return u("li", {
|
|
169
|
+
className: "directory_content_item",
|
|
170
|
+
"data-directory": isDirectory ? "" : undefined,
|
|
171
|
+
"data-file": isDirectory ? undefined : "",
|
|
172
|
+
children: u("a", {
|
|
173
|
+
className: "directory_content_item_link",
|
|
174
|
+
href: url
|
|
175
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
176
|
+
,
|
|
177
|
+
"hot-decline": isMainFile ? true : undefined,
|
|
178
|
+
children: [u("span", {
|
|
179
|
+
className: "directory_content_item_icon",
|
|
180
|
+
children: u(Icon, {
|
|
181
|
+
url: isMainFile ? homeIconUrl : isDirectory ? directoryIconUrl : fileIconUrl
|
|
182
|
+
})
|
|
183
|
+
}), children, isDirectory ? u(k$1, {
|
|
184
|
+
children: [u("span", {
|
|
185
|
+
style: "flex:1"
|
|
186
|
+
}), u("span", {
|
|
187
|
+
className: "directory_content_item_arrow",
|
|
188
|
+
children: u(RightArrowSvg, {})
|
|
189
|
+
})]
|
|
190
|
+
}) : null]
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
const RightArrowSvg = () => {
|
|
195
|
+
return u("svg", {
|
|
196
|
+
fill: "currentColor",
|
|
197
|
+
viewBox: "0 0 330 330",
|
|
198
|
+
children: u("path", {
|
|
199
|
+
stroke: "currentColor",
|
|
200
|
+
d: "M250.606,154.389l-150-149.996c-5.857-5.858-15.355-5.858-21.213,0.001 c-5.857,5.858-5.857,15.355,0.001,21.213l139.393,139.39L79.393,304.394c-5.857,5.858-5.857,15.355,0.001,21.213 C82.322,328.536,86.161,330,90,330s7.678-1.464,10.607-4.394l149.999-150.004c2.814-2.813,4.394-6.628,4.394-10.606 C255,161.018,253.42,157.202,250.606,154.389z"
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
const Icon = ({
|
|
205
|
+
url
|
|
206
|
+
}) => {
|
|
207
|
+
if (urlToFilename(url).endsWith(".svg")) {
|
|
208
|
+
return u("svg", {
|
|
209
|
+
children: u("use", {
|
|
210
|
+
href: url
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return u("img", {
|
|
215
|
+
src: url
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const urlToFilename = url => {
|
|
219
|
+
const pathname = new URL(url).pathname;
|
|
220
|
+
const pathnameBeforeLastSlash = pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
221
|
+
const slashLastIndex = pathnameBeforeLastSlash.lastIndexOf("/");
|
|
222
|
+
const filename = slashLastIndex === -1 ? pathnameBeforeLastSlash : pathnameBeforeLastSlash.slice(slashLastIndex + 1);
|
|
223
|
+
return filename;
|
|
224
|
+
};
|
|
225
|
+
if (autoreload) {
|
|
226
|
+
const socket = new WebSocket(websocketUrl, ["watch-directory"]);
|
|
227
|
+
socket.onopen = () => {
|
|
228
|
+
socket.onopen = null;
|
|
229
|
+
setInterval(() => {
|
|
230
|
+
socket.send('{"type":"ping"}');
|
|
231
|
+
}, 30_000);
|
|
232
|
+
};
|
|
233
|
+
socket.onmessage = messageEvent => {
|
|
234
|
+
const event = JSON.parse(messageEvent.data);
|
|
235
|
+
const {
|
|
236
|
+
type,
|
|
237
|
+
reason,
|
|
238
|
+
items
|
|
239
|
+
} = event;
|
|
240
|
+
if (type === "change") {
|
|
241
|
+
console.log(`update list (reason: ${reason})`);
|
|
242
|
+
// TODO: if index.html is added AND we are at "/" we must reload
|
|
243
|
+
updateDirectoryContentItems(items);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
E$1(u(DirectoryListing, {}), document.querySelector("#root"));
|
|
@@ -225,7 +225,7 @@ var runtime = (function (exports) {
|
|
|
225
225
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
226
226
|
// the final result produced by the iterator.
|
|
227
227
|
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
228
|
-
if (PromiseImpl ===
|
|
228
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
229
229
|
|
|
230
230
|
var iter = new AsyncIterator(
|
|
231
231
|
wrap(innerFn, outerFn, self, tryLocsList),
|