chore: lock the plugin boundary and remove 2.9.0 leftovers

This commit is contained in:
LukeGus committed 2026-09-25 07:24:46 -05:00
1 parent 6489b62ece
commit 2961297989
399 files changed
+3964 -5627

No files matched your search

+1 -39
View File
@@ -1,36 +1,7 @@
import fs from "fs";
import path from "path";
import { defineConfig, type Plugin } from "vitest/config";
/**
* The built plugin bundles the boot tests load (dist/plugins) still reach
* compiled core by relative path for a few plugins. Point those imports at
* core's source, so the bundle shares the one database and the singletons the
* test booted instead of loading a second, uninitialized copy of core.
*/
function builtPluginCoreImports(): Plugin {
return {
name: "built-plugin-core-imports",
enforce: "pre",
resolveId(source, importer) {
if (!importer || !source.startsWith(".")) return null;
if (!importer.replace(/\\/g, "/").includes("/dist/plugins/")) return null;
const target = path
.resolve(path.dirname(importer), source)
.replace(/\\/g, "/");
const match = /\/dist\/backend\/(backend|types)\/(.*)\.js$/.exec(target);
if (!match) return null;
const base = path.resolve(__dirname, "src", match[1], match[2]);
for (const candidate of [`${base}.ts`, `${base}.tsx`]) {
if (fs.existsSync(candidate)) return candidate;
}
return null;
},
};
}
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [builtPluginCoreImports()],
resolve: {
alias: [
{
@@ -51,15 +22,6 @@ export default defineConfig({
"./src/ui/plugin-host/testing-host.tsx",
),
},
// What built plugin frontends import instead of "@/...". D1 removes it.
{
find: /^@termix\/legacy-core\/ui\/(.*)$/,
replacement: path.resolve(__dirname, "./src/ui") + "/$1",
},
{
find: /^@termix\/legacy-core\/types(.*)$/,
replacement: path.resolve(__dirname, "./src/types") + "$1",
},
{ find: "@/types", replacement: path.resolve(__dirname, "./src/types") },
{ find: "@", replacement: path.resolve(__dirname, "./src/ui") },
],