every-plugin 2.2.6 → 2.4.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/dist/build/rspack/dev-server-middleware.cjs +1 -2
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs +1 -2
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +20 -0
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +5 -0
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +5 -0
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +20 -0
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/plugin.cjs +2 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +2 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/index.cjs +2 -2
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +2 -2
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +12 -4
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +2 -2
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +2 -2
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +12 -4
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.cjs +5 -2
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.mjs +6 -3
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +1 -1
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs +1 -1
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/package.json +1 -1
- package/src/build/rspack/dev-server-middleware.ts +1 -6
- package/src/build/rspack/plugin.ts +38 -1
- package/src/index.ts +1 -0
- package/src/plugin.ts +8 -1
- package/src/runtime/index.ts +10 -2
- package/src/runtime/mf-config.ts +11 -2
- package/src/runtime/services/plugin-lifecycle.service.ts +18 -23
- package/src/runtime/services/plugin.service.ts +7 -4
package/src/runtime/mf-config.ts
CHANGED
|
@@ -11,6 +11,15 @@ function readPackageVersion(): string {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function getInstalledPackageVersion(packageName: string, fallbackRange: string): string {
|
|
15
|
+
try {
|
|
16
|
+
return require(`${packageName}/package.json`).version as string;
|
|
17
|
+
} catch {
|
|
18
|
+
const match = fallbackRange.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/);
|
|
19
|
+
return match ? match[0] : fallbackRange.replace(/^[\^~>=<\s]+/, "");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
export const PLUGIN_VERSION =
|
|
15
24
|
typeof __EVERY_PLUGIN_VERSION__ === "string" ? __EVERY_PLUGIN_VERSION__ : readPackageVersion();
|
|
16
25
|
|
|
@@ -27,11 +36,11 @@ export const MF_SHARED_DEPS = {
|
|
|
27
36
|
shareConfig: SHARE_CONFIG,
|
|
28
37
|
},
|
|
29
38
|
effect: {
|
|
30
|
-
version: "^3.21.0",
|
|
39
|
+
version: getInstalledPackageVersion("effect", "^3.21.0"),
|
|
31
40
|
shareConfig: SHARE_CONFIG,
|
|
32
41
|
},
|
|
33
42
|
zod: {
|
|
34
|
-
version: "^4.3.6",
|
|
43
|
+
version: getInstalledPackageVersion("zod", "^4.3.6"),
|
|
35
44
|
shareConfig: SHARE_CONFIG,
|
|
36
45
|
},
|
|
37
46
|
} as const;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Ref } from "effect";
|
|
1
|
+
import { Effect, Exit, Ref, Scope } from "effect";
|
|
2
2
|
import type { AnyPlugin, InitializedPlugin } from "../../types";
|
|
3
3
|
import { toPluginRuntimeError } from "../errors";
|
|
4
4
|
|
|
@@ -50,36 +50,31 @@ export class PluginLifecycleService extends Effect.Service<PluginLifecycleServic
|
|
|
50
50
|
Effect.gen(function* () {
|
|
51
51
|
const plugins = yield* Ref.get(activePlugins);
|
|
52
52
|
|
|
53
|
-
// Shutdown all active plugins concurrently
|
|
54
53
|
yield* Effect.forEach(
|
|
55
54
|
plugins,
|
|
56
55
|
(plugin) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
Effect.gen(function* () {
|
|
57
|
+
yield* plugin.plugin
|
|
58
|
+
.shutdown()
|
|
59
|
+
.pipe(
|
|
60
|
+
Effect.catchAll((error) =>
|
|
61
|
+
Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, error),
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
yield* Scope.close(plugin.scope, Exit.succeed(undefined)).pipe(
|
|
65
|
+
Effect.catchAll((error) =>
|
|
66
|
+
Effect.logWarning(
|
|
67
|
+
`Failed to close scope for plugin ${plugin.plugin.id}`,
|
|
68
|
+
error,
|
|
69
|
+
),
|
|
65
70
|
),
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
Effect.logError(
|
|
69
|
-
`Failed to shutdown plugin ${plugin.plugin.id} during cleanup`,
|
|
70
|
-
error,
|
|
71
|
-
{ pluginId: plugin.plugin.id },
|
|
72
|
-
),
|
|
73
|
-
),
|
|
74
|
-
),
|
|
71
|
+
);
|
|
72
|
+
}),
|
|
75
73
|
{ concurrency: "unbounded" },
|
|
76
74
|
);
|
|
77
75
|
|
|
78
|
-
// Clear the active plugins set
|
|
79
76
|
yield* Ref.set(activePlugins, new Set());
|
|
80
|
-
}).pipe(
|
|
81
|
-
Effect.catchAll(() => Effect.void), // Convert errors to void for cleanup
|
|
82
|
-
),
|
|
77
|
+
}).pipe(Effect.catchAll((error) => Effect.logWarning("Plugin cleanup failed", error))),
|
|
83
78
|
};
|
|
84
79
|
}),
|
|
85
80
|
},
|
|
@@ -27,13 +27,16 @@ export class PluginService extends Effect.Service<PluginService>()("PluginServic
|
|
|
27
27
|
initializePlugin: loader.initializePlugin,
|
|
28
28
|
shutdownPlugin: (plugin: InitializedPlugin<AnyPlugin>) =>
|
|
29
29
|
Effect.gen(function* () {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
yield* plugin.plugin
|
|
31
|
+
.shutdown()
|
|
32
|
+
.pipe(
|
|
33
|
+
Effect.catchAll((error) =>
|
|
34
|
+
Effect.logWarning(`Failed to shutdown plugin ${plugin.plugin.id}`, error),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
32
37
|
|
|
33
|
-
// Close the plugin scope to interrupt fibers and release resources
|
|
34
38
|
yield* Scope.close(plugin.scope, Exit.succeed(undefined));
|
|
35
39
|
|
|
36
|
-
// Unregister from lifecycle tracking
|
|
37
40
|
yield* lifecycle.unregister(plugin);
|
|
38
41
|
}),
|
|
39
42
|
cleanup: lifecycle.cleanup,
|