@elementspanel/panel 0.0.0-stage → 1.0.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/LICENSE +201 -0
- package/README.md +6 -2
- package/app.js +2640 -0
- package/app.js.map +1 -0
- package/bin/panel.cjs +2 -0
- package/package.json +107 -4
- package/public/assets/AppDialog.vue_vue_type_style_index_0_lang-8b56f871.js +2 -0
- package/public/assets/AppDialog.vue_vue_type_style_index_0_lang-8b56f871.js.map +1 -0
- package/public/assets/CardPanel-a704f146.js +2 -0
- package/public/assets/CardPanel-a704f146.js.map +1 -0
- package/public/assets/DesktopDialog-081410ca.js +2 -0
- package/public/assets/DesktopDialog-081410ca.js.map +1 -0
- package/public/assets/Loading.vue_vue_type_script_setup_true_lang-9e79de95.js +2 -0
- package/public/assets/Loading.vue_vue_type_script_setup_true_lang-9e79de95.js.map +1 -0
- package/public/assets/PageToolbar-5ca1a069.js +2 -0
- package/public/assets/PageToolbar-5ca1a069.js.map +1 -0
- package/public/assets/_elements-sdk_cordis-b0b88a2c.js +2 -0
- package/public/assets/_elements-sdk_cordis-b0b88a2c.js.map +1 -0
- package/public/assets/_elements-sdk_cordis-e3bebc89.js +9 -0
- package/public/assets/_elements-sdk_cordis-e3bebc89.js.map +1 -0
- package/public/assets/_elements-sdk_cosmokit-e4842f5c.js +2 -0
- package/public/assets/_elements-sdk_cosmokit-e4842f5c.js.map +1 -0
- package/public/assets/_elements-sdk_pinia-fc8ba898.js +6 -0
- package/public/assets/_elements-sdk_pinia-fc8ba898.js.map +1 -0
- package/public/assets/_elements-sdk_vue-b86b0db6.js +2 -0
- package/public/assets/_elements-sdk_vue-b86b0db6.js.map +1 -0
- package/public/assets/_elements-sdk_vue-i18n-64f8e172.js +2 -0
- package/public/assets/_elements-sdk_vue-i18n-64f8e172.js.map +1 -0
- package/public/assets/_elements-sdk_vue-router-a62f518d.js +2 -0
- package/public/assets/_elements-sdk_vue-router-a62f518d.js.map +1 -0
- package/public/assets/_plugin-vue_export-helper-c27b6911.js +2 -0
- package/public/assets/_plugin-vue_export-helper-c27b6911.js.map +1 -0
- package/public/assets/chartjs-1e331dfb.js +19 -0
- package/public/assets/chartjs-1e331dfb.js.map +1 -0
- package/public/assets/codemirror-1b74112a.js +29 -0
- package/public/assets/codemirror-1b74112a.js.map +1 -0
- package/public/assets/const-01673e6b.js +38 -0
- package/public/assets/const-01673e6b.js.map +1 -0
- package/public/assets/const-cfe7ddfe.js +2 -0
- package/public/assets/const-cfe7ddfe.js.map +1 -0
- package/public/assets/context-b16af9cc.js +2 -0
- package/public/assets/context-b16af9cc.js.map +1 -0
- package/public/assets/copy-4d64fc1f.js +2 -0
- package/public/assets/copy-4d64fc1f.js.map +1 -0
- package/public/assets/core-b6992169.js +2 -0
- package/public/assets/core-b6992169.js.map +1 -0
- package/public/assets/daemon_connection_error-9eb654cc.png +0 -0
- package/public/assets/dayjs.min-25183c0a.js +2 -0
- package/public/assets/dayjs.min-25183c0a.js.map +1 -0
- package/public/assets/desktopNotice-2c886f6b.js +2 -0
- package/public/assets/desktopNotice-2c886f6b.js.map +1 -0
- package/public/assets/dom-ff483262.js +2 -0
- package/public/assets/dom-ff483262.js.map +1 -0
- package/public/assets/htmlparser2-bcb8f9db.js +3 -0
- package/public/assets/htmlparser2-bcb8f9db.js.map +1 -0
- package/public/assets/i18n-fe0f1ee7.js +2 -0
- package/public/assets/i18n-fe0f1ee7.js.map +1 -0
- package/public/assets/index-76b0df52.js +2 -0
- package/public/assets/index-76b0df52.js.map +1 -0
- package/public/assets/index-c684efbd.js +2 -0
- package/public/assets/index-c684efbd.js.map +1 -0
- package/public/assets/index-e3f35709.js +2 -0
- package/public/assets/index-e3f35709.js.map +1 -0
- package/public/assets/instance-26cca4c8.js +2 -0
- package/public/assets/instance-26cca4c8.js.map +1 -0
- package/public/assets/instance_contract-0115efe5.js +2 -0
- package/public/assets/instance_contract-0115efe5.js.map +1 -0
- package/public/assets/lodash-001e4f93.js +28 -0
- package/public/assets/lodash-001e4f93.js.map +1 -0
- package/public/assets/logo-9e2a668b.svg +15 -0
- package/public/assets/logo_b-35ccadda.svg +8 -0
- package/public/assets/materialdesignicons-webfont-0b183104.eot +0 -0
- package/public/assets/materialdesignicons-webfont-61e8aba5.ttf +0 -0
- package/public/assets/materialdesignicons-webfont-662fefa8.woff2 +0 -0
- package/public/assets/materialdesignicons-webfont-a5928a0d.woff +0 -0
- package/public/assets/msl-logo-699c8076.png +0 -0
- package/public/assets/nodes-402cdcbd.js +2 -0
- package/public/assets/nodes-402cdcbd.js.map +1 -0
- package/public/assets/plugin_contract-691cd37a.js +2 -0
- package/public/assets/plugin_contract-691cd37a.js.map +1 -0
- package/public/assets/preload-helper-a4192956.js +2 -0
- package/public/assets/preload-helper-a4192956.js.map +1 -0
- package/public/assets/protocol-97f7bab7.js +2 -0
- package/public/assets/protocol-97f7bab7.js.map +1 -0
- package/public/assets/randId-ed0b95b7.js +2 -0
- package/public/assets/randId-ed0b95b7.js.map +1 -0
- package/public/assets/router-0f7d4714.js +3 -0
- package/public/assets/router-0f7d4714.js.map +1 -0
- package/public/assets/safe-87846d89.js +89 -0
- package/public/assets/safe-87846d89.js.map +1 -0
- package/public/assets/sdk-01dda668.js +2 -0
- package/public/assets/sdk-01dda668.js.map +1 -0
- package/public/assets/shared-f2e37690.js +2 -0
- package/public/assets/shared-f2e37690.js.map +1 -0
- package/public/assets/useAppConfigStore-289073ec.js +2 -0
- package/public/assets/useAppConfigStore-289073ec.js.map +1 -0
- package/public/assets/useAppRouters-5f58db32.js +2 -0
- package/public/assets/useAppRouters-5f58db32.js.map +1 -0
- package/public/assets/useAppStateStore-a644582a.js +2 -0
- package/public/assets/useAppStateStore-a644582a.js.map +1 -0
- package/public/assets/useAppToolsStore-3a911226.js +2 -0
- package/public/assets/useAppToolsStore-3a911226.js.map +1 -0
- package/public/assets/useDefineApi-ead2616e.js +7 -0
- package/public/assets/useDefineApi-ead2616e.js.map +1 -0
- package/public/assets/useInstanceActionAvailability-dec16c10.js +2 -0
- package/public/assets/useInstanceActionAvailability-dec16c10.js.map +1 -0
- package/public/assets/useKeyboardEvents-dba9d5ca.js +2 -0
- package/public/assets/useKeyboardEvents-dba9d5ca.js.map +1 -0
- package/public/assets/useMountComponent-dd1fcfea.js +2 -0
- package/public/assets/useMountComponent-dd1fcfea.js.map +1 -0
- package/public/assets/useOverviewChart-119bda3b.js +2 -0
- package/public/assets/useOverviewChart-119bda3b.js.map +1 -0
- package/public/assets/useOverviewInfo-a149d634.js +2 -0
- package/public/assets/useOverviewInfo-a149d634.js.map +1 -0
- package/public/assets/usePolling-f2f09d27.js +2 -0
- package/public/assets/usePolling-f2f09d27.js.map +1 -0
- package/public/assets/useScreen-e3715e1f.js +2 -0
- package/public/assets/useScreen-e3715e1f.js.map +1 -0
- package/public/assets/useSocketIo-bc0a62c2.js +2 -0
- package/public/assets/useSocketIo-bc0a62c2.js.map +1 -0
- package/public/assets/useThemeSwitch-6ff90248.js +2 -0
- package/public/assets/useThemeSwitch-6ff90248.js.map +1 -0
- package/public/assets/vue-2433bd89.js +64 -0
- package/public/assets/vue-2433bd89.js.map +1 -0
- package/public/assets/vue-4c6a2976.css +1 -0
- package/public/assets/vuetifyModal-49cb95ba.js +2 -0
- package/public/assets/vuetifyModal-49cb95ba.js.map +1 -0
- package/public/assets/xterm-62ba073f.js +67 -0
- package/public/assets/xterm-62ba073f.js.map +1 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +207 -0
- package/public/robots.txt +2 -0
- package/public/stats.html +4950 -0
- package/runtime/cli.cjs +305 -0
- package/runtime/daemon-tools.cjs +113 -0
- package/runtime/npm-plugins.cjs +176 -0
- package/runtime/plugin-resolution.cjs +123 -0
- package/runtime/shared-dependencies.cjs +35 -0
- package/runtime/worker.cjs +25 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
const { createRequire, isBuiltin, registerHooks } = require("node:module");
|
|
4
|
+
const { fileURLToPath, pathToFileURL } = require("node:url");
|
|
5
|
+
const { sharedModules, createSharedResolver } = require("./shared-dependencies.cjs");
|
|
6
|
+
const { resolveNpmPlugins, projectManifestFile } = require("./npm-plugins.cjs");
|
|
7
|
+
|
|
8
|
+
const shared = new Set(sharedModules);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The plugin market installs dependencies into the project while the process is
|
|
12
|
+
* running. Caching the npm plugin list by the project manifest's mtime lets a
|
|
13
|
+
* freshly installed package be resolved without restarting the process.
|
|
14
|
+
*/
|
|
15
|
+
let npmPluginSnapshot = { key: "", records: [] };
|
|
16
|
+
|
|
17
|
+
function fileStamp(filename) {
|
|
18
|
+
try {
|
|
19
|
+
return String(fs.statSync(filename).mtimeMs);
|
|
20
|
+
} catch {
|
|
21
|
+
return "-";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function npmPlugins(packageRoot) {
|
|
26
|
+
const files = [path.join(packageRoot, "package.json")];
|
|
27
|
+
const projectFile = projectManifestFile(packageRoot);
|
|
28
|
+
if (projectFile) files.push(projectFile);
|
|
29
|
+
// Paths are part of the key: two fixtures created within the same millisecond
|
|
30
|
+
// must not share a cached plugin list.
|
|
31
|
+
const key = files.map((file) => `${file}:${fileStamp(file)}`).join("|");
|
|
32
|
+
if (key !== npmPluginSnapshot.key) {
|
|
33
|
+
npmPluginSnapshot = {
|
|
34
|
+
key,
|
|
35
|
+
records: resolveNpmPlugins(packageRoot, undefined, { skipInvalid: true })
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return npmPluginSnapshot.records;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resolveFile(filename, context, nextResolve) {
|
|
42
|
+
return nextResolve(
|
|
43
|
+
context.conditions.includes("require") ? filename : pathToFileURL(filename).href,
|
|
44
|
+
context
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function within(root, filename) {
|
|
49
|
+
const relative = path.relative(root, filename);
|
|
50
|
+
return (
|
|
51
|
+
relative === "" ||
|
|
52
|
+
(relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Apply to CJS and ESM plugins, without relying on hoisting or changing NODE_PATH. */
|
|
57
|
+
function installPluginResolution(packageRoot, workRoot) {
|
|
58
|
+
const metadata = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
59
|
+
const hostPackages = new Set(Object.keys(metadata.dependencies || {}));
|
|
60
|
+
const hostURL = pathToFileURL(path.join(packageRoot, "app.js")).href;
|
|
61
|
+
const hostRequire = createRequire(hostURL);
|
|
62
|
+
const resolveShared = createSharedResolver(packageRoot);
|
|
63
|
+
// Development checkouts load their source plugins from <side>/plugins; a
|
|
64
|
+
// published runtime loads npm plugins only and has no source root.
|
|
65
|
+
const roots = process.env.EPANEL_PACKAGE_ROOT ? [] : [path.join(workRoot, "plugins")];
|
|
66
|
+
// Node 24 routes require.resolve() calls made by this hook back through the
|
|
67
|
+
// hook itself. Without this guard, resolving plugin metadata recurses forever.
|
|
68
|
+
let resolving = false;
|
|
69
|
+
return registerHooks({
|
|
70
|
+
resolve(specifier, context, nextResolve) {
|
|
71
|
+
if (
|
|
72
|
+
isBuiltin(specifier) ||
|
|
73
|
+
/^(?:[./\\]|[a-zA-Z][\w+.-]*:)/.test(specifier) ||
|
|
74
|
+
!context.parentURL?.startsWith("file:") ||
|
|
75
|
+
resolving
|
|
76
|
+
) {
|
|
77
|
+
return nextResolve(specifier, context);
|
|
78
|
+
}
|
|
79
|
+
resolving = true;
|
|
80
|
+
try {
|
|
81
|
+
const parent = fileURLToPath(context.parentURL);
|
|
82
|
+
const plugins = npmPlugins(packageRoot);
|
|
83
|
+
const npmPlugin = plugins.find((plugin) => within(plugin.packageRoot, parent));
|
|
84
|
+
const root = roots.find((directory) => within(directory, parent));
|
|
85
|
+
if (!npmPlugin && !root) return nextResolve(specifier, context);
|
|
86
|
+
const plugin =
|
|
87
|
+
npmPlugin?.packageRoot || path.join(root, path.relative(root, parent).split(path.sep)[0]);
|
|
88
|
+
const name = specifier.startsWith("@")
|
|
89
|
+
? specifier.split("/").slice(0, 2).join("/")
|
|
90
|
+
: specifier.split("/")[0];
|
|
91
|
+
// Explicit CJS filenames keep ESM plugins on the same Context/Service
|
|
92
|
+
// classes as the CJS host, instead of selecting the second "import" build.
|
|
93
|
+
if (shared.has(name)) return resolveFile(resolveShared(specifier), context, nextResolve);
|
|
94
|
+
|
|
95
|
+
let resolved;
|
|
96
|
+
let failure;
|
|
97
|
+
try {
|
|
98
|
+
resolved = nextResolve(specifier, context);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (!["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"].includes(error.code)) throw error;
|
|
101
|
+
failure = error;
|
|
102
|
+
}
|
|
103
|
+
// A plugin's private dependencies take precedence over ordinary host dependencies.
|
|
104
|
+
if (
|
|
105
|
+
resolved?.url.startsWith("file:") &&
|
|
106
|
+
(within(plugin, fileURLToPath(resolved.url)) || npmPlugin?.dependencies.includes(name))
|
|
107
|
+
)
|
|
108
|
+
return resolved;
|
|
109
|
+
if (hostPackages.has(name)) {
|
|
110
|
+
if (context.conditions.includes("import"))
|
|
111
|
+
return nextResolve(specifier, { ...context, parentURL: hostURL });
|
|
112
|
+
return resolveFile(hostRequire.resolve(specifier), context, nextResolve);
|
|
113
|
+
}
|
|
114
|
+
if (failure) throw failure;
|
|
115
|
+
return resolved;
|
|
116
|
+
} finally {
|
|
117
|
+
resolving = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = { installPluginResolution };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const { createRequire } = require("node:module");
|
|
3
|
+
|
|
4
|
+
// Kept in step with webpack-cordis-externals.cjs. These must resolve to the
|
|
5
|
+
// runtime's actual Cordis dependency graph, including nested installations.
|
|
6
|
+
const sharedModules = [
|
|
7
|
+
"cordis",
|
|
8
|
+
"@cordisjs/core",
|
|
9
|
+
"@cordisjs/logger",
|
|
10
|
+
"@cordisjs/timer",
|
|
11
|
+
"@cordisjs/schema",
|
|
12
|
+
"cosmokit",
|
|
13
|
+
"schemastery",
|
|
14
|
+
"reggol"
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
function createSharedResolver(packageRoot) {
|
|
18
|
+
const host = createRequire(path.join(packageRoot, "package.json"));
|
|
19
|
+
let cordis;
|
|
20
|
+
let schema;
|
|
21
|
+
return (specifier) => {
|
|
22
|
+
const name = specifier.startsWith("@")
|
|
23
|
+
? specifier.split("/").slice(0, 2).join("/")
|
|
24
|
+
: specifier.split("/")[0];
|
|
25
|
+
if (name === "cordis") return host.resolve(specifier);
|
|
26
|
+
cordis ||= createRequire(host.resolve("cordis"));
|
|
27
|
+
if (name === "schemastery") {
|
|
28
|
+
schema ||= createRequire(cordis.resolve("@cordisjs/schema"));
|
|
29
|
+
return schema.resolve(specifier);
|
|
30
|
+
}
|
|
31
|
+
return cordis.resolve(specifier);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = { sharedModules, createSharedResolver };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const { installPluginResolution } = require("./plugin-resolution.cjs");
|
|
3
|
+
|
|
4
|
+
// This file is copied to <package>/runtime. Resolve assets from the real package,
|
|
5
|
+
// independently of the directory in which npm start was invoked.
|
|
6
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
7
|
+
process.env.EPANEL_PACKAGE_ROOT = packageRoot;
|
|
8
|
+
process.env.NODE_ENV = "production";
|
|
9
|
+
|
|
10
|
+
let stopping = false;
|
|
11
|
+
function stop() {
|
|
12
|
+
if (stopping) return;
|
|
13
|
+
stopping = true;
|
|
14
|
+
// IPC also permits graceful shutdown on Windows, where child.kill() would
|
|
15
|
+
// otherwise terminate the process before the instance shutdown hooks run.
|
|
16
|
+
if (process.listenerCount("SIGTERM")) process.emit("SIGTERM", "SIGTERM");
|
|
17
|
+
else process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
process.on("message", (message) => {
|
|
20
|
+
if (message?.type === "elementspanel:stop") stop();
|
|
21
|
+
});
|
|
22
|
+
process.on("disconnect", stop);
|
|
23
|
+
|
|
24
|
+
installPluginResolution(packageRoot, process.cwd());
|
|
25
|
+
require(path.join(packageRoot, "app.js"));
|