@elementspanel/panel 0.0.0-stage → 1.0.1

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.
Files changed (139) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +6 -2
  3. package/app.js +6400 -0
  4. package/app.js.map +1 -0
  5. package/bin/panel.cjs +2 -0
  6. package/package.json +107 -4
  7. package/public/assets/AppDialog.vue_vue_type_style_index_0_lang-e6e38e8b.js +2 -0
  8. package/public/assets/AppDialog.vue_vue_type_style_index_0_lang-e6e38e8b.js.map +1 -0
  9. package/public/assets/CardPanel-59b7da2e.js +2 -0
  10. package/public/assets/CardPanel-59b7da2e.js.map +1 -0
  11. package/public/assets/DesktopDialog-e4041e4e.js +2 -0
  12. package/public/assets/DesktopDialog-e4041e4e.js.map +1 -0
  13. package/public/assets/Loading.vue_vue_type_script_setup_true_lang-1b74dd54.js +2 -0
  14. package/public/assets/Loading.vue_vue_type_script_setup_true_lang-1b74dd54.js.map +1 -0
  15. package/public/assets/PageToolbar-7130e13d.js +2 -0
  16. package/public/assets/PageToolbar-7130e13d.js.map +1 -0
  17. package/public/assets/_elements-sdk_cordis-b0b88a2c.js +2 -0
  18. package/public/assets/_elements-sdk_cordis-b0b88a2c.js.map +1 -0
  19. package/public/assets/_elements-sdk_cordis-e3bebc89.js +9 -0
  20. package/public/assets/_elements-sdk_cordis-e3bebc89.js.map +1 -0
  21. package/public/assets/_elements-sdk_cosmokit-e4842f5c.js +2 -0
  22. package/public/assets/_elements-sdk_cosmokit-e4842f5c.js.map +1 -0
  23. package/public/assets/_elements-sdk_pinia-2c56d2c1.js +6 -0
  24. package/public/assets/_elements-sdk_pinia-2c56d2c1.js.map +1 -0
  25. package/public/assets/_elements-sdk_vue-80f42d87.js +2 -0
  26. package/public/assets/_elements-sdk_vue-80f42d87.js.map +1 -0
  27. package/public/assets/_elements-sdk_vue-i18n-4b8a106a.js +2 -0
  28. package/public/assets/_elements-sdk_vue-i18n-4b8a106a.js.map +1 -0
  29. package/public/assets/_elements-sdk_vue-router-a171591a.js +2 -0
  30. package/public/assets/_elements-sdk_vue-router-a171591a.js.map +1 -0
  31. package/public/assets/_plugin-vue_export-helper-c27b6911.js +2 -0
  32. package/public/assets/_plugin-vue_export-helper-c27b6911.js.map +1 -0
  33. package/public/assets/chartjs-1e331dfb.js +19 -0
  34. package/public/assets/chartjs-1e331dfb.js.map +1 -0
  35. package/public/assets/codemirror-1b74112a.js +29 -0
  36. package/public/assets/codemirror-1b74112a.js.map +1 -0
  37. package/public/assets/const-93b324c0.js +2 -0
  38. package/public/assets/const-93b324c0.js.map +1 -0
  39. package/public/assets/const-ea30795c.js +38 -0
  40. package/public/assets/const-ea30795c.js.map +1 -0
  41. package/public/assets/context-cc90576e.js +2 -0
  42. package/public/assets/context-cc90576e.js.map +1 -0
  43. package/public/assets/copy-b106bb10.js +2 -0
  44. package/public/assets/copy-b106bb10.js.map +1 -0
  45. package/public/assets/core-d3bfdede.js +2 -0
  46. package/public/assets/core-d3bfdede.js.map +1 -0
  47. package/public/assets/daemon_connection_error-9eb654cc.png +0 -0
  48. package/public/assets/dayjs.min-25183c0a.js +2 -0
  49. package/public/assets/dayjs.min-25183c0a.js.map +1 -0
  50. package/public/assets/desktopNotice-5ca3448c.js +2 -0
  51. package/public/assets/desktopNotice-5ca3448c.js.map +1 -0
  52. package/public/assets/dom-ff483262.js +2 -0
  53. package/public/assets/dom-ff483262.js.map +1 -0
  54. package/public/assets/htmlparser2-bcb8f9db.js +3 -0
  55. package/public/assets/htmlparser2-bcb8f9db.js.map +1 -0
  56. package/public/assets/i18n-e810b9fa.js +2 -0
  57. package/public/assets/i18n-e810b9fa.js.map +1 -0
  58. package/public/assets/index-6e8d74f8.js +2 -0
  59. package/public/assets/index-6e8d74f8.js.map +1 -0
  60. package/public/assets/index-c684efbd.js +2 -0
  61. package/public/assets/index-c684efbd.js.map +1 -0
  62. package/public/assets/index-e3f35709.js +2 -0
  63. package/public/assets/index-e3f35709.js.map +1 -0
  64. package/public/assets/instance-cc59e210.js +2 -0
  65. package/public/assets/instance-cc59e210.js.map +1 -0
  66. package/public/assets/instance_contract-0115efe5.js +2 -0
  67. package/public/assets/instance_contract-0115efe5.js.map +1 -0
  68. package/public/assets/lodash-001e4f93.js +28 -0
  69. package/public/assets/lodash-001e4f93.js.map +1 -0
  70. package/public/assets/logo-9e2a668b.svg +15 -0
  71. package/public/assets/logo_b-35ccadda.svg +8 -0
  72. package/public/assets/materialdesignicons-webfont-0b183104.eot +0 -0
  73. package/public/assets/materialdesignicons-webfont-61e8aba5.ttf +0 -0
  74. package/public/assets/materialdesignicons-webfont-662fefa8.woff2 +0 -0
  75. package/public/assets/materialdesignicons-webfont-a5928a0d.woff +0 -0
  76. package/public/assets/msl-logo-699c8076.png +0 -0
  77. package/public/assets/nodes-a56b1b35.js +2 -0
  78. package/public/assets/nodes-a56b1b35.js.map +1 -0
  79. package/public/assets/plugin_contract-691cd37a.js +2 -0
  80. package/public/assets/plugin_contract-691cd37a.js.map +1 -0
  81. package/public/assets/preload-helper-a4192956.js +2 -0
  82. package/public/assets/preload-helper-a4192956.js.map +1 -0
  83. package/public/assets/protocol-97f7bab7.js +2 -0
  84. package/public/assets/protocol-97f7bab7.js.map +1 -0
  85. package/public/assets/randId-56f93901.js +2 -0
  86. package/public/assets/randId-56f93901.js.map +1 -0
  87. package/public/assets/router-eff205cc.js +3 -0
  88. package/public/assets/router-eff205cc.js.map +1 -0
  89. package/public/assets/safe-87846d89.js +89 -0
  90. package/public/assets/safe-87846d89.js.map +1 -0
  91. package/public/assets/sdk-3f2277ab.js +2 -0
  92. package/public/assets/sdk-3f2277ab.js.map +1 -0
  93. package/public/assets/shared-597ef52b.js +2 -0
  94. package/public/assets/shared-597ef52b.js.map +1 -0
  95. package/public/assets/useAppConfigStore-352fe033.js +2 -0
  96. package/public/assets/useAppConfigStore-352fe033.js.map +1 -0
  97. package/public/assets/useAppRouters-747b627a.js +2 -0
  98. package/public/assets/useAppRouters-747b627a.js.map +1 -0
  99. package/public/assets/useAppStateStore-a438b9a6.js +2 -0
  100. package/public/assets/useAppStateStore-a438b9a6.js.map +1 -0
  101. package/public/assets/useAppToolsStore-288c4fe8.js +2 -0
  102. package/public/assets/useAppToolsStore-288c4fe8.js.map +1 -0
  103. package/public/assets/useDefineApi-b726db1e.js +7 -0
  104. package/public/assets/useDefineApi-b726db1e.js.map +1 -0
  105. package/public/assets/useInstanceActionAvailability-16de3001.js +2 -0
  106. package/public/assets/useInstanceActionAvailability-16de3001.js.map +1 -0
  107. package/public/assets/useKeyboardEvents-6f7f845c.js +2 -0
  108. package/public/assets/useKeyboardEvents-6f7f845c.js.map +1 -0
  109. package/public/assets/useMountComponent-4043cb4c.js +2 -0
  110. package/public/assets/useMountComponent-4043cb4c.js.map +1 -0
  111. package/public/assets/useOverviewChart-7d758bc4.js +2 -0
  112. package/public/assets/useOverviewChart-7d758bc4.js.map +1 -0
  113. package/public/assets/useOverviewInfo-9ca25ab9.js +2 -0
  114. package/public/assets/useOverviewInfo-9ca25ab9.js.map +1 -0
  115. package/public/assets/usePolling-1bc2009b.js +2 -0
  116. package/public/assets/usePolling-1bc2009b.js.map +1 -0
  117. package/public/assets/useScreen-fad29b7c.js +2 -0
  118. package/public/assets/useScreen-fad29b7c.js.map +1 -0
  119. package/public/assets/useSocketIo-ea3c9a61.js +2 -0
  120. package/public/assets/useSocketIo-ea3c9a61.js.map +1 -0
  121. package/public/assets/useThemeSwitch-dc70883c.js +2 -0
  122. package/public/assets/useThemeSwitch-dc70883c.js.map +1 -0
  123. package/public/assets/vue-4c6a2976.css +1 -0
  124. package/public/assets/vue-6b52a630.js +64 -0
  125. package/public/assets/vue-6b52a630.js.map +1 -0
  126. package/public/assets/vuetifyModal-8382b175.js +2 -0
  127. package/public/assets/vuetifyModal-8382b175.js.map +1 -0
  128. package/public/assets/xterm-62ba073f.js +67 -0
  129. package/public/assets/xterm-62ba073f.js.map +1 -0
  130. package/public/favicon.ico +0 -0
  131. package/public/index.html +207 -0
  132. package/public/robots.txt +2 -0
  133. package/public/stats.html +4950 -0
  134. package/runtime/cli.cjs +305 -0
  135. package/runtime/daemon-tools.cjs +113 -0
  136. package/runtime/npm-plugins.cjs +207 -0
  137. package/runtime/plugin-resolution.cjs +141 -0
  138. package/runtime/shared-dependencies.cjs +35 -0
  139. package/runtime/worker.cjs +25 -0
@@ -0,0 +1,141 @@
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: [], expires: 0 };
16
+
17
+ function fileStamp(filename) {
18
+ try {
19
+ const stat = fs.statSync(filename);
20
+ return `${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}`;
21
+ } catch {
22
+ return "-";
23
+ }
24
+ }
25
+
26
+ function npmPlugins(packageRoot) {
27
+ const files = [];
28
+ const projectFile = projectManifestFile(packageRoot);
29
+ for (const root of [packageRoot, ...(projectFile ? [path.dirname(projectFile)] : [])]) {
30
+ for (const filename of [
31
+ "package.json",
32
+ "package-lock.json",
33
+ "npm-shrinkwrap.json",
34
+ "node_modules/.package-lock.json",
35
+ "node_modules"
36
+ ])
37
+ files.push(path.join(root, filename));
38
+ }
39
+ // Paths are part of the key: two fixtures created within the same millisecond
40
+ // must not share a cached plugin list.
41
+ const key = files.map((file) => `${file}:${fileStamp(file)}`).join("|");
42
+ if (key !== npmPluginSnapshot.key || Date.now() >= npmPluginSnapshot.expires) {
43
+ npmPluginSnapshot = {
44
+ key,
45
+ expires: Date.now() + 2000,
46
+ records: resolveNpmPlugins(packageRoot, undefined, { skipInvalid: true })
47
+ };
48
+ }
49
+ return npmPluginSnapshot.records;
50
+ }
51
+
52
+ function resolveFile(filename, context, nextResolve) {
53
+ // Node.js versions expose hook conditions as either an array or a Set.
54
+ return nextResolve(
55
+ Array.from(context.conditions).includes("require") ? filename : pathToFileURL(filename).href,
56
+ context
57
+ );
58
+ }
59
+
60
+ function within(root, filename) {
61
+ const relative = path.relative(root, filename);
62
+ return (
63
+ relative === "" ||
64
+ (relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative))
65
+ );
66
+ }
67
+
68
+ /** Apply to CJS and ESM plugins, without relying on hoisting or changing NODE_PATH. */
69
+ function installPluginResolution(packageRoot, workRoot) {
70
+ const metadata = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
71
+ const hostPackages = new Set(Object.keys(metadata.dependencies || {}));
72
+ const hostURL = pathToFileURL(path.join(packageRoot, "app.js")).href;
73
+ const hostRequire = createRequire(hostURL);
74
+ const resolveShared = createSharedResolver(packageRoot);
75
+ // Development checkouts load unified source packages from <project>/plugins; a
76
+ // published runtime loads npm plugins only and has no source root.
77
+ const roots = process.env.EPANEL_PACKAGE_ROOT
78
+ ? []
79
+ : [
80
+ path.basename(path.dirname(packageRoot)) === "core"
81
+ ? path.resolve(packageRoot, "../../plugins")
82
+ : path.join(workRoot, "plugins")
83
+ ];
84
+ // Node 24 routes require.resolve() calls made by this hook back through the
85
+ // hook itself. Without this guard, resolving plugin metadata recurses forever.
86
+ let resolving = false;
87
+ return registerHooks({
88
+ resolve(specifier, context, nextResolve) {
89
+ if (
90
+ isBuiltin(specifier) ||
91
+ /^(?:[./\\]|[a-zA-Z][\w+.-]*:)/.test(specifier) ||
92
+ !context.parentURL?.startsWith("file:") ||
93
+ resolving
94
+ ) {
95
+ return nextResolve(specifier, context);
96
+ }
97
+ resolving = true;
98
+ try {
99
+ const parent = fileURLToPath(context.parentURL);
100
+ const plugins = npmPlugins(packageRoot);
101
+ const npmPlugin = plugins.find((plugin) => within(plugin.packageRoot, parent));
102
+ const root = roots.find((directory) => within(directory, parent));
103
+ if (!npmPlugin && !root) return nextResolve(specifier, context);
104
+ const plugin =
105
+ npmPlugin?.packageRoot || path.join(root, path.relative(root, parent).split(path.sep)[0]);
106
+ const name = specifier.startsWith("@")
107
+ ? specifier.split("/").slice(0, 2).join("/")
108
+ : specifier.split("/")[0];
109
+ // Explicit CJS filenames keep ESM plugins on the same Context/Service
110
+ // classes as the CJS host, instead of selecting the second "import" build.
111
+ if (shared.has(name)) return resolveFile(resolveShared(specifier), context, nextResolve);
112
+
113
+ let resolved;
114
+ let failure;
115
+ try {
116
+ resolved = nextResolve(specifier, context);
117
+ } catch (error) {
118
+ if (!["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"].includes(error.code)) throw error;
119
+ failure = error;
120
+ }
121
+ // A plugin's private dependencies take precedence over ordinary host dependencies.
122
+ if (
123
+ resolved?.url.startsWith("file:") &&
124
+ (within(plugin, fileURLToPath(resolved.url)) || npmPlugin?.dependencies.includes(name))
125
+ )
126
+ return resolved;
127
+ if (hostPackages.has(name)) {
128
+ if (Array.from(context.conditions).includes("import"))
129
+ return nextResolve(specifier, { ...context, parentURL: hostURL });
130
+ return resolveFile(hostRequire.resolve(specifier), context, nextResolve);
131
+ }
132
+ if (failure) throw failure;
133
+ return resolved;
134
+ } finally {
135
+ resolving = false;
136
+ }
137
+ }
138
+ });
139
+ }
140
+
141
+ 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"));