mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-21 14:55:04 +00:00
Group route filters
This commit is contained in:
@@ -74,6 +74,9 @@ export default function create_manifest_data(cwd: string): ManifestData {
|
|||||||
const is_dir = fs.statSync(resolved).isDirectory();
|
const is_dir = fs.statSync(resolved).isDirectory();
|
||||||
|
|
||||||
const ext = path.extname(basename);
|
const ext = path.extname(basename);
|
||||||
|
|
||||||
|
if (basename[0] === '_') return null;
|
||||||
|
if (basename[0] === '.' && basename !== '.well-known') return null;
|
||||||
if (!is_dir && !/^\.[a-z]+$/i.test(ext)) return null; // filter out tmp files etc
|
if (!is_dir && !/^\.[a-z]+$/i.test(ext)) return null; // filter out tmp files etc
|
||||||
|
|
||||||
const segment = is_dir
|
const segment = is_dir
|
||||||
@@ -108,22 +111,17 @@ export default function create_manifest_data(cwd: string): ManifestData {
|
|||||||
.sort(comparator);
|
.sort(comparator);
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item.basename[0] === '_') return;
|
|
||||||
|
|
||||||
if (item.basename[0] === '.') {
|
|
||||||
if (item.file !== '.well-known') return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const segments = parent_segments.slice();
|
const segments = parent_segments.slice();
|
||||||
|
|
||||||
if (item.is_index && segments.length > 0) {
|
if (item.is_index && segments.length > 0) {
|
||||||
const last_segment = segments[segments.length - 1].slice();
|
|
||||||
const suffix = item.basename
|
const suffix = item.basename
|
||||||
.slice(0, -item.ext.length)
|
.slice(0, -item.ext.length)
|
||||||
.replace('index', '');
|
.replace('index', '');
|
||||||
|
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
|
const last_segment = segments[segments.length - 1].slice();
|
||||||
const last_part = last_segment[last_segment.length - 1];
|
const last_part = last_segment[last_segment.length - 1];
|
||||||
|
|
||||||
if (last_part.dynamic) {
|
if (last_part.dynamic) {
|
||||||
last_segment.push({ dynamic: false, content: suffix });
|
last_segment.push({ dynamic: false, content: suffix });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user