@elementspanel/epanel-plugin-file 1.0.2 → 1.0.3
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/daemon/backend/index.cjs +14 -9
- package/package.json +3 -3
package/daemon/backend/index.cjs
CHANGED
|
@@ -2884,9 +2884,9 @@ function recordFromPackage(pluginId, name, source, packageRoot, metadata, side)
|
|
|
2884
2884
|
/**
|
|
2885
2885
|
* Every npm plugin the runtime can load for a side, built-in and project-installed.
|
|
2886
2886
|
*
|
|
2887
|
-
* Built-in
|
|
2888
|
-
*
|
|
2889
|
-
* that does not describe the requested side is skipped instead of failing, which
|
|
2887
|
+
* Built-in package names win over a project mapping for the same id. An explicit
|
|
2888
|
+
* project dependency on that same package selects the user's installed version.
|
|
2889
|
+
* A project package that does not describe the requested side is skipped instead of failing, which
|
|
2890
2890
|
* is what lets a two-sided project share one dependency list between sides.
|
|
2891
2891
|
*/
|
|
2892
2892
|
function listNpmPlugins(side, options = {}) {
|
|
@@ -2923,7 +2923,10 @@ function listNpmPlugins(side, options = {}) {
|
|
|
2923
2923
|
continue;
|
|
2924
2924
|
if (dependenciesOf(host)[name] === undefined)
|
|
2925
2925
|
continue;
|
|
2926
|
-
mappings.set(pluginId, {
|
|
2926
|
+
mappings.set(pluginId, {
|
|
2927
|
+
name,
|
|
2928
|
+
source: dependenciesOf(project)[name] === undefined ? "bundled" : "project"
|
|
2929
|
+
});
|
|
2927
2930
|
}
|
|
2928
2931
|
const hostDependencies = dependenciesOf(host);
|
|
2929
2932
|
const projectDependencies = dependenciesOf(project);
|
|
@@ -3098,9 +3101,9 @@ async function installNpmPlugin(options) {
|
|
|
3098
3101
|
if (!host)
|
|
3099
3102
|
throw new Error(`Missing runtime package metadata: ${packageRoot}`);
|
|
3100
3103
|
const hostId = Object.entries(mappingsOf(host)).find(([, value]) => value === name && dependenciesOf(host)[name] !== undefined)?.[0];
|
|
3101
|
-
const targetRoot = hostId
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
+
const targetRoot = hostId && dependenciesOf(readProjectManifest(projectRoot))[name] === undefined
|
|
3105
|
+
? packageRoot
|
|
3106
|
+
: projectRoot;
|
|
3104
3107
|
if (options.pluginId &&
|
|
3105
3108
|
mappingsOf(host)[options.pluginId] &&
|
|
3106
3109
|
dependenciesOf(host)[String(mappingsOf(host)[options.pluginId])] !== undefined &&
|
|
@@ -3147,7 +3150,7 @@ async function installNpmPlugin(options) {
|
|
|
3147
3150
|
const mapped = mappingsOf(readProjectManifest(targetRoot))[pluginId];
|
|
3148
3151
|
if (mapped !== undefined && mapped !== name)
|
|
3149
3152
|
throw new Error(`Plugin id ${pluginId} is already installed as ${String(mapped)}.`);
|
|
3150
|
-
const record = recordFromPackage(pluginId, name,
|
|
3153
|
+
const record = recordFromPackage(pluginId, name, targetRoot === packageRoot ? "bundled" : "project", entry.root, entry.metadata, side);
|
|
3151
3154
|
if (!record)
|
|
3152
3155
|
throw new Error(`The package ${name} does not provide a ${side} plugin named ${pluginId}.`);
|
|
3153
3156
|
if (/^[0-9]/.test(version) && record.version !== version)
|
|
@@ -3230,7 +3233,9 @@ async function uninstallNpmPlugin(pluginId, options = {}) {
|
|
|
3230
3233
|
return withProjectLock(projectRoot, async () => {
|
|
3231
3234
|
const host = readJson(path_1.default.join(packageRoot, "package.json"));
|
|
3232
3235
|
const bundledName = mappingsOf(host)[pluginId];
|
|
3233
|
-
const targetRoot = typeof bundledName === "string" &&
|
|
3236
|
+
const targetRoot = typeof bundledName === "string" &&
|
|
3237
|
+
dependenciesOf(host)[bundledName] !== undefined &&
|
|
3238
|
+
dependenciesOf(readProjectManifest(projectRoot))[bundledName] === undefined
|
|
3234
3239
|
? packageRoot
|
|
3235
3240
|
: projectRoot;
|
|
3236
3241
|
const manifest = readProjectManifest(targetRoot);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementspanel/epanel-plugin-file",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Instance file management, editing and transfers.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Csituka_D <694428809@qq.com> (https://github.com/JessDaodao)",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@elementspanel/panel": "1.0.
|
|
54
|
-
"@elementspanel/daemon": "1.0.
|
|
53
|
+
"@elementspanel/panel": "^1.0.2",
|
|
54
|
+
"@elementspanel/daemon": "^1.0.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@elementspanel/panel": {
|