恢复平台个人页并阻断旧业务回流
恢复创作、项目、我的平台侧栏与现役搜索 恢复全宽个人页及资料编辑、充值兑换、社区反馈和 API Key 入口 迁移平台资料、钱包和设置客户端并移除旧创作依赖 新增 Vite 与 ESLint 退役模块门禁并补齐界面和搜索测试 同步旧创作退役方案、平台入口决策与踩坑记录
This commit is contained in:
@@ -3,15 +3,17 @@ import { describe, expect, it } from 'vitest';
|
||||
|
||||
import viteConfig from '../vite.config';
|
||||
|
||||
async function resolveRetiredCssPlugin() {
|
||||
async function resolveVitePlugin(name: string) {
|
||||
const resolvedConfig =
|
||||
typeof viteConfig === 'function'
|
||||
? await viteConfig({ command: 'serve', mode: 'test' })
|
||||
: viteConfig;
|
||||
const plugins = (resolvedConfig.plugins ?? []).flat(Infinity) as Plugin[];
|
||||
return plugins.find(
|
||||
(plugin) => plugin?.name === 'retired-creation-template-css',
|
||||
);
|
||||
return plugins.find((plugin) => plugin?.name === name);
|
||||
}
|
||||
|
||||
function resolveRetiredCssPlugin() {
|
||||
return resolveVitePlugin('retired-creation-template-css');
|
||||
}
|
||||
|
||||
describe('retired creation template CSS plugin', () => {
|
||||
@@ -43,3 +45,63 @@ describe('retired creation template CSS plugin', () => {
|
||||
expect(code).toContain('@source "./components/creation-home"');
|
||||
});
|
||||
});
|
||||
|
||||
describe('retired creation template module boundary plugin', () => {
|
||||
it('rejects retired component and service modules from the active Vite graph', async () => {
|
||||
const plugin = await resolveVitePlugin('retired-creation-template-modules');
|
||||
const transform = plugin?.transform;
|
||||
|
||||
expect(plugin?.enforce).toBe('pre');
|
||||
expect(typeof transform).toBe('function');
|
||||
if (typeof transform !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
expect(() =>
|
||||
transform.call(
|
||||
{} as never,
|
||||
'export {}',
|
||||
'/workspace/src/components/rpg-entry/RpgEntryHomeView.tsx',
|
||||
),
|
||||
).toThrow(/退役创作模板模块不得进入现役 Vite 依赖图/u);
|
||||
expect(() =>
|
||||
transform.call(
|
||||
{} as never,
|
||||
'export {}',
|
||||
'/workspace/src/services/rpg-entry/rpgProfileClient.ts?t=1',
|
||||
),
|
||||
).toThrow(/退役创作模板模块不得进入现役 Vite 依赖图/u);
|
||||
});
|
||||
|
||||
it('allows active creation, project, and profile modules', async () => {
|
||||
const plugin = await resolveVitePlugin('retired-creation-template-modules');
|
||||
const transform = plugin?.transform;
|
||||
|
||||
expect(typeof transform).toBe('function');
|
||||
if (typeof transform !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
expect(
|
||||
transform.call(
|
||||
{} as never,
|
||||
'export {}',
|
||||
'/workspace/src/components/creation-home/CreationLandingView.tsx',
|
||||
),
|
||||
).toBeNull();
|
||||
expect(
|
||||
transform.call(
|
||||
{} as never,
|
||||
'export {}',
|
||||
'/workspace/src/components/platform-entry/PlatformActiveProfileView.tsx',
|
||||
),
|
||||
).toBeNull();
|
||||
expect(
|
||||
transform.call(
|
||||
{} as never,
|
||||
'export {}',
|
||||
'/workspace/src/services/platform-entry/platformProfileClient.ts',
|
||||
),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user