Skip to content

Commit

Permalink
optimize(projects): remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeng889 committed Aug 24, 2024
1 parent 045d427 commit 732bb7c
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/unplugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import path from 'node:path';
import { createUnplugin } from 'unplugin';
import ElegantReactRouter from './route-core';
import type { ElegantConstRoute, ElegantReactRouterOption } from './types';

export default createUnplugin<Partial<ElegantReactRouterOption> | undefined>((options, _meta) => {
export default createUnplugin<Partial<ElegantReactRouterOption> | undefined>((options) => {
const ctx = new ElegantReactRouter(options);

return [
Expand All @@ -20,23 +19,6 @@ export default createUnplugin<Partial<ElegantReactRouterOption> | undefined>((op
}
}
},
{
name: '@ohh-899/inject-name',
enforce: 'pre',
transformInclude(id) {
const { cwd, pageDir } = ctx.elegantRouter.options;

const isInPageDir = id.startsWith(path.posix.join(cwd, pageDir));

if (!isInPageDir) return null;

const filePath = path.posix.join(cwd, pageDir);

const glob = id.replace(`${filePath}/`, '');

return ctx.elegantRouter.isMatchPageGlob(glob);
}
}
];
});

Expand Down

0 comments on commit 732bb7c

Please sign in to comment.