@archilogic/plugin-container 1.0.1 → 1.1.0
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/README.md +4 -0
- package/index.html +2 -36
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -20,3 +20,7 @@ Open a browser and visit: `https://esm.sh/@archilogic/plugin-container/index.htm
|
|
|
20
20
|
|
|
21
21
|
- `?pluginUrl` (required): the JS entry point for a plugin
|
|
22
22
|
- `?pluginName` (optional): the name of the plugin
|
|
23
|
+
|
|
24
|
+
## Deployment
|
|
25
|
+
|
|
26
|
+
The plugin-container is currently manually deployed to the `archilogic-production-extensions` S3 bucket in the `container` folder. This surfaces the container at https://extensions.archilogic.io/container/index.html
|
package/index.html
CHANGED
|
@@ -26,42 +26,8 @@
|
|
|
26
26
|
<body>
|
|
27
27
|
<div id="app"></div>
|
|
28
28
|
<script type="module">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!url) {
|
|
33
|
-
const exampleUrl = `${
|
|
34
|
-
window.location.href.split('?')[0]
|
|
35
|
-
}?pluginUrl=https://esm.sh/@archilogic/editor-plugin-graph`
|
|
36
|
-
|
|
37
|
-
document.getElementById('app').innerHTML =
|
|
38
|
-
`Please provide a plugin URL as a query parameter, e.g. <a href="${exampleUrl}">${exampleUrl}</a>`
|
|
39
|
-
|
|
40
|
-
throw new Error('No plugin URL provided')
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const name = queries.get('pluginName') ?? url.split('/').pop()
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
console.info(`${name}: Loading plugin from ${url}`)
|
|
47
|
-
|
|
48
|
-
import(/* @vite-ignore */ url).then(pluginModule => {
|
|
49
|
-
if (typeof pluginModule.runPlugin !== 'function') {
|
|
50
|
-
throw new Error(`${name}: Could not find plugin method 'runPlugin' in ${url}`)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.info(`${name}: Loaded plugin from ${url}`)
|
|
54
|
-
|
|
55
|
-
pluginModule.runPlugin({
|
|
56
|
-
pluginModule,
|
|
57
|
-
container: document.getElementById('app'),
|
|
58
|
-
url,
|
|
59
|
-
name
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error(`${name}: Error loading plugin from ${url}`, error)
|
|
64
|
-
}
|
|
29
|
+
import { initExtension } from './src/main.ts'
|
|
30
|
+
initExtension()
|
|
65
31
|
</script>
|
|
66
32
|
</body>
|
|
67
33
|
</html>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archilogic/plugin-container",
|
|
3
3
|
"description": "An HTML container for Archilogic plugins",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
"index.html"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "vite"
|
|
13
|
+
"dev": "vite",
|
|
14
|
+
"build": "vite build",
|
|
15
|
+
"dev:e2e": "vite --config ./vite.config-e2e.ts",
|
|
16
|
+
"dev:all": "concurrently \"npm run dev\" \"npm run dev:e2e\"",
|
|
17
|
+
"preview": "vite preview --outDir=../ --port 3000",
|
|
18
|
+
"test:e2e": "npx playwright test"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"concurrently": "^9.2.1"
|
|
14
22
|
}
|
|
15
23
|
}
|