Skip to content

Commit

Permalink
fix: little issuse (#59)
Browse files Browse the repository at this point in the history
Co-authored-by: huang yao <[email protected]>
  • Loading branch information
kirakiray and kirakiray authored Jul 26, 2024
1 parent 297dd80 commit 639a8e4
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/drill.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! drill.js - v5.3.10 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
//! drill.js - v5.3.11 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down
2 changes: 1 addition & 1 deletion dist/drill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/drill.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/drill.min.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//! drill.js - v5.3.10 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
//! drill.js - v5.3.11 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
const t="https://ofajs.github.io/ofa-errors/errors",e={};if(globalThis.navigator&&navigator.language){let a=navigator.language.toLowerCase().split("-")[0];"zh"===a&&"zh-cn"!==navigator.language.toLowerCase()&&(a="zhft"),(async()=>{if(localStorage["ofa-errors"]){const t=JSON.parse(localStorage["ofa-errors"]);Object.assign(e,t)}const s=localStorage["ofa-errors-time"];if(!s||Date.now()>Number(s)+3e5){const s=await fetch(`${t}/${a}.json`).then((t=>t.json())).catch((()=>null));s?(localStorage["ofa-errors"]=JSON.stringify(s),localStorage["ofa-errors-time"]=Date.now()):s=await fetch(`${t}/en.json`).then((t=>t.json())).catch((t=>(console.error(t),null))),Object.assign(e,s)}})()}let a=!1;globalThis.navigator&&(a=navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome"));const s=(t,e,s)=>{let r,o=n(t,e);return s?(a&&(o+=`\nCaused by: ${s.toString()}\n ${s.stack.replace(/\n/g,"\n ")}`),r=new Error(o,{cause:s})):r=new Error(o),r.code=t,r},n=(t,a)=>{if(!e[t])return`Error code: "${t}", please go to https://github.com/ofajs/ofa-errors to view the corresponding error information`;let s=e[t];if(a)for(let t in a)s=s.replace(new RegExp(`{${t}}`,"g"),a[t]);return s};class r{constructor(){this._middlewares=new Map}use(t){const e=Math.random().toString(32).slice(2);return this._middlewares.set(e,t),e}unuse(t){return this._middlewares.delete(t)}async run(t){let e=-1;const a=Array.from(this._middlewares.values()),s=async()=>{e++,e<a.length&&await a[e](t,s)};await s()}}const o=new Map,i=async(t,e)=>{const a=new URL(t),s=e.includes("-direct")?t:`${a.origin}${a.pathname}`;let n=o.get(s);n||(n=fetch(s),o.set(s,n));return(await n).clone()},l={},c=(t,e)=>{(l[t]||(l[t]=new r)).use(e)},u=(t,e)=>{t instanceof Function&&(e=t,t=["js","mjs"]),t instanceof Array?t.forEach((t=>{c(t,e)})):c(t,e)};u(["mjs","js"],(async(t,e)=>{if(!t.result){const{url:e,params:a}=t,n=new URL(e),r=/^blob:/.test(e)||/^data:/.test(e);try{r||a.includes("-direct")?t.result=await import(e):t.result=await import(`${n.origin}${n.pathname}`)}catch(a){const n=s("load_module",{url:t.realUrl||e},a);throw r&&console.warn(n,t),n}}await e()})),u(["txt","html","htm"],(async(t,e)=>{if(!t.result){const{url:e,params:a}=t;let n;try{n=await i(e,a)}catch(t){throw s("load_fail",{url:e},t)}if(!/^2.{2}$/.test(n.status))throw s("load_fail_status",{url:e,status:n.status});t.result=await n.text()}await e()})),u("json",(async(t,e)=>{if(!t.result){const{url:e,params:a}=t;t.result=await i(e,a).then((t=>t.json()))}await e()})),u("wasm",(async(t,e)=>{if(!t.result){const{url:e,params:a}=t,s=await i(e,a).then((t=>t.arrayBuffer())),n=await WebAssembly.compile(s),r=new WebAssembly.Instance(n);t.result=r.exports}await e()})),u("css",(async(t,e)=>{if(!t.result){const{url:e,element:a,params:s}=t;if(a){const t=document.createElement("link");t.rel="stylesheet",t.href=e;const s=a.getRootNode();let n;s===document?s.head.append(t):s.appendChild(t),a.addEventListener("disconnected",n=e=>{t.remove(),a.removeEventListener("disconnected",n)})}else t.result=await i(e,s).then((t=>t.text()))}await e()}));const h={};const d=(t,e)=>{if(t.startsWith("http://")||t.startsWith("https://"))return t;const[a,...n]=t.split(" ");let r=a;if(/^@/.test(a)){const[e,...n]=a.split("/");if(!h[e])throw s("no_alias",{name:e,url:t});r=[h[e].replace(/\/$/,""),...n].join("/")}if("undefined"!=typeof location){const t=e?new URL(e,location.href):location.href;r=new URL(r,t).href}return n.length?`${r} ${n.join(" ")}`:r},f=Symbol("loaded"),m=async(t,e)=>{const a=new URL(t),{pathname:s}=a;let n,r=null;e.params&&e.params.forEach((t=>{/^\..+/.test(t)?n=t.replace(/^\.(.+)/,"$1"):/^\-\-real/.test(t)&&(r=t.replace(/^\-\-real\:/,""))})),n||(n=s.slice(2+(s.lastIndexOf(".")-1>>>0)));const o={url:t,result:null,realUrl:r,...e},i=l[n];if(i)await i.run(o);else{const e=await fetch(t),a=e.headers.get("Content-Type"),s=[["application/javascript","js"],["application/json","json"],["text/html","html"],["text/xml","xml"]].find((t=>a.includes(t[0])));let n;s&&(n=l[s[1]]),n?await n.run(o):o.result=e}if(e&&e.element){const{element:t}=e;t[f]=!0;const a=new Event("load");t.dispatchEvent(a)}return e.params&&e.params.includes("-ctx")?o:o.result};function p(t,e){return((t,e)=>(t||(t={url:document.location.href}),a=>{let[s,...n]=a.split(" ");const r=d(s,t.url);return m(r,{params:n,...e})}))(t,e)}Object.defineProperties(p,{use:{value:u},alias:{get:()=>({...h})}});class w extends HTMLElement{constructor(...t){super(...t),this[f]=!1,Object.defineProperties(this,{loaded:{get:()=>this[f]}}),this._init()}_init(){if(this.__initSrc||this.attributes.hasOwnProperty("pause"))return;let t=this.getAttribute("src");if(!t)return;this.__initSrc=t;lm(void 0,{element:this})(t),Object.defineProperties(this,{src:{configurable:!0,value:t}})}connectedCallback(){const t=new CustomEvent("connected");t.root=this._root=this.getRootNode(),this.dispatchEvent(t)}disconnectedCallback(){const t=new CustomEvent("disconnected");t.root=this._root,delete this._root,this.dispatchEvent(t)}attributeChangedCallback(t,e,a){if("src"===t){if(a&&null===e)this._init();else if(this.__initSrc&&e&&a!==this.__initSrc)throw this.setAttribute("src",this.__initSrc),s("change_lm_src",{tag:this.tagName.toLowerCase()})}else"pause"===t&&null===a&&this._init()}static get observedAttributes(){return["src","pause"]}}class g extends w{constructor(...t){super(...t)}}const _=()=>{customElements.define("load-module",w),customElements.define("l-m",g),window.removeEventListener("load",_)};"complete"===document.readyState?_():window.addEventListener("load",_),p.config=async function(t){const{alias:e}=t;return e&&Object.entries(e).forEach((([t,e])=>{if(!/^@.+/.test(t))throw s("config_alias_name_error",{name:t});if(h[t])throw s("alias_already",{name:t});if(/^\./.test(e))throw s("alias_relate_name",{name:t,path:e});h[t]=e})),!0},p.path=d,Object.freeze(p),window.lm=p;export{p as default};
//# sourceMappingURL=drill.min.mjs.map
2 changes: 1 addition & 1 deletion dist/drill.min.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/drill.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! drill.js - v5.3.10 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
//! drill.js - v5.3.11 https://github.com/kirakiray/drill.js (c) 2018-2024 YAO
// const error_origin = "http://127.0.0.1:5793/errors";
const error_origin = "https://ofajs.github.io/ofa-errors/errors";

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drill.js",
"version": "5.3.10",
"version": "5.3.11",
"description": "A declarative modular framework that runs on the browser",
"main": "dist/drill.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/component.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getErr } from "../ofa-error/main";
import { getErr } from "../ofa-error/main.js";
import { agent, LOADED } from "./main.mjs";

class LoadModule extends HTMLElement {
Expand Down

0 comments on commit 639a8e4

Please sign in to comment.