@archilogic/plugin-container 0.0.0-20240209175834 → 0.0.0-20240209180426
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/index.html +35 -0
- package/package.json +3 -4
- package/dist/assets/index-WgfBxxC8.js +0 -7
- package/dist/index.html +0 -12
package/index.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Archilogic Plugin Container</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module">
|
|
11
|
+
const queries = new URLSearchParams(window.location.search)
|
|
12
|
+
const url = queries.get('pluginUrl')
|
|
13
|
+
const name = queries.get('pluginName')
|
|
14
|
+
|
|
15
|
+
const runPlugin = ({ pluginModule, container, url, name }) => {
|
|
16
|
+
if (typeof pluginModule.runPlugin !== 'function') {
|
|
17
|
+
throw new Error(`${name}: could not find plugin method ${pluginMethod} in ${url}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pluginModule.runPlugin({ pluginModule, container, url, name })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
console.info(`${name}: loading plugin from ${url}`)
|
|
25
|
+
/** @vite-ignore */
|
|
26
|
+
import(url).then(pluginModule => {
|
|
27
|
+
console.info(`${name}: loaded plugin from ${url}`)
|
|
28
|
+
runPlugin({ pluginModule, container: document.getElementById('app'), url, name })
|
|
29
|
+
})
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(`${name}: error loading plugin from ${url}`, error)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archilogic/plugin-container",
|
|
3
3
|
"description": "An HTML container for Archilogic plugins",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-20240209180426",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
10
|
+
"index.html"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "vite"
|
|
14
|
-
"build": "vite build"
|
|
13
|
+
"dev": "vite"
|
|
15
14
|
},
|
|
16
15
|
"devDependencies": {
|
|
17
16
|
"vite": "^5.1.0"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))s(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const r of t.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function o(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function s(e){if(e.ep)return;e.ep=!0;const t=o(e);fetch(e.href,t)}})();const p="modulepreload",y=function(n){return"/"+n},m={},P=function(i,o,s){let e=Promise.resolve();if(o&&o.length>0){const t=document.getElementsByTagName("link");e=Promise.all(o.map(r=>{if(r=y(r),r in m)return;m[r]=!0;const c=r.endsWith(".css"),g=c?'[rel="stylesheet"]':"";if(!!s)for(let u=t.length-1;u>=0;u--){const f=t[u];if(f.href===r&&(!c||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${g}`))return;const l=document.createElement("link");if(l.rel=c?"stylesheet":p,c||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),c)return new Promise((u,f)=>{l.addEventListener("load",u),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${r}`)))})}))}return e.then(()=>i()).catch(t=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=t,window.dispatchEvent(r),!r.defaultPrevented)throw t})},h=new URLSearchParams(window.location.search),a=h.get("pluginUrl"),d=h.get("pluginName"),v=({pluginModule:n,container:i,url:o,name:s})=>{if(typeof n.runPlugin!="function")throw new Error(`${s}: could not find plugin method ${pluginMethod} in ${o}`);n.runPlugin({pluginModule:n,container:i,url:o,name:s})};try{console.info(`${d}: loading plugin from ${a}`),P(()=>import(a),__vite__mapDeps([])).then(n=>{console.info(`${d}: loaded plugin from ${a}`),v({pluginModule:n,container:document.getElementById("app"),url:a,name:d})})}catch(n){console.error(`${d}: error loading plugin from ${a}`,n)}
|
|
2
|
-
function __vite__mapDeps(indexes) {
|
|
3
|
-
if (!__vite__mapDeps.viteFileDeps) {
|
|
4
|
-
__vite__mapDeps.viteFileDeps = []
|
|
5
|
-
}
|
|
6
|
-
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
7
|
-
}
|
package/dist/index.html
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title>Archilogic Plugin Container</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-WgfBxxC8.js"></script>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|