(options: LocalExecutorOptions = {})
| 58 | } |
| 59 | |
| 60 | const loadLocalPlugins = (options: LocalExecutorOptions = {}) => |
| 61 | Effect.gen(function* () { |
| 62 | const cwd = process.env.EXECUTOR_SCOPE_DIR || process.cwd(); |
| 63 | const staticPlugins = executorConfig.plugins({ |
| 64 | activeToolkitSlug: options.activeToolkitSlug, |
| 65 | }); |
| 66 | const dynamicPlugins = |
| 67 | (yield* Effect.promise(() => loadPluginsFromJsonc({ path: resolvePluginConfigPath(cwd) }))) ?? |
| 68 | []; |
| 69 | |
| 70 | const staticPackageNames = new Set( |
| 71 | staticPlugins.map((plugin) => plugin.packageName).filter((name): name is string => !!name), |
| 72 | ); |
| 73 | const dedupedDynamic = dynamicPlugins.filter((plugin) => { |
| 74 | if (plugin.packageName && staticPackageNames.has(plugin.packageName)) { |
| 75 | console.warn( |
| 76 | `[executor] plugin "${plugin.packageName}" appears in both ` + |
| 77 | `executor.config.ts and executor.jsonc#plugins. The static ` + |
| 78 | `entry wins; the jsonc entry is ignored.`, |
| 79 | ); |
| 80 | return false; |
| 81 | } |
| 82 | return true; |
| 83 | }); |
| 84 | |
| 85 | return { |
| 86 | cwd, |
| 87 | plugins: [...staticPlugins, ...dedupedDynamic] as LocalPlugins, |
| 88 | }; |
| 89 | }); |
| 90 | |
| 91 | interface LocalExecutorBundle { |
| 92 | readonly executor: Executor<LocalPlugins>; |
no test coverage detected