Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Mar 17, 2020
1 parent 6bc68b6 commit d974801
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/remax-cli/src/build/turboPages.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import * as path from 'path';
import { RemaxOptions, Entries } from 'remax-types';
import { isMatch } from 'micromatch';
import { getEntryInfo } from '../getEntries';
import { rename } from '../extensions';
import winPath from '../winPath';

export function validate(route: string, options: RemaxOptions) {
if (!route) {
return false;
}
const page = rename(
winPath(route).replace(
winPath(path.join(options.cwd, options.rootDir)) + '/',
''
),
''
);

return isMatch(getEntryInfo(route, options).route, options.turboPages);
return isMatch(page, options.turboPages);
}

export function filter(entries: Entries, options: RemaxOptions) {
return entries.pages.filter(p =>
isMatch(
rename(
p.replace(winPath(path.join(options.cwd, options.rootDir)) + '/', ''),
''
),
options.turboPages
)
);
return entries.pages.filter(p => validate(p, options));
}

0 comments on commit d974801

Please sign in to comment.