@yannosay/sinth 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/project/project.js +24 -4
- package/dist/server/dev.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.1.1
|
|
4
|
+
|
|
5
|
+
- Dynamic routes and page detection now work when the project path contains a symlink or junction (macOS temp folders, linked workspaces).
|
|
6
|
+
- Dev server logs use forward slashes on Windows.
|
|
7
|
+
- CI: ESLint runs on Node 22 only.
|
|
8
|
+
|
|
3
9
|
## 5.1.0
|
|
4
10
|
|
|
5
11
|
### Routing
|
package/dist/project/project.js
CHANGED
|
@@ -82,7 +82,8 @@ class Project {
|
|
|
82
82
|
const parsed = (0, parser_1.parseSinth)(source, abs);
|
|
83
83
|
parsed.isPage = this.isPageFile(abs, parsed);
|
|
84
84
|
if (parsed.isPage) {
|
|
85
|
-
const
|
|
85
|
+
const rel = relativeInside(this.pagesBase(), abs);
|
|
86
|
+
const params = rel ? routeParams(rel) : [];
|
|
86
87
|
if (params.length)
|
|
87
88
|
parsed.params = params;
|
|
88
89
|
}
|
|
@@ -100,13 +101,13 @@ class Project {
|
|
|
100
101
|
const pagesDir = this.config.pagesDir;
|
|
101
102
|
const hasPagesDir = fs.existsSync(pagesDir);
|
|
102
103
|
const base = hasPagesDir ? pagesDir : this.root;
|
|
103
|
-
const rel =
|
|
104
|
-
if (!rel
|
|
104
|
+
const rel = relativeInside(base, abs);
|
|
105
|
+
if (!rel)
|
|
105
106
|
return false;
|
|
106
107
|
const parts = rel.split(/[\\/]/);
|
|
107
108
|
if (parts.some(p => p.startsWith("_") || p.startsWith(".") || IGNORED_DIRS.has(p)))
|
|
108
109
|
return false;
|
|
109
|
-
if (
|
|
110
|
+
if (relativeInside(this.config.outDir, abs))
|
|
110
111
|
return false;
|
|
111
112
|
if (!hasPagesDir && parts.length > 1 && ROOT_MODULE_DIRS.has(parts[0]))
|
|
112
113
|
return false;
|
|
@@ -508,6 +509,25 @@ class Project {
|
|
|
508
509
|
}
|
|
509
510
|
}
|
|
510
511
|
exports.Project = Project;
|
|
512
|
+
/**
|
|
513
|
+
* Path of `file` relative to `dir`, or undefined when it is outside. Falls back to real paths,
|
|
514
|
+
* because bundlers resolve symlinks (macOS /var -> /private/var, junctions, linked workspaces).
|
|
515
|
+
*/
|
|
516
|
+
function relativeInside(dir, file) {
|
|
517
|
+
const check = (d, f) => {
|
|
518
|
+
const rel = path.relative(d, f);
|
|
519
|
+
return rel && !rel.startsWith("..") && !path.isAbsolute(rel) ? rel : undefined;
|
|
520
|
+
};
|
|
521
|
+
const direct = check(dir, file);
|
|
522
|
+
if (direct)
|
|
523
|
+
return direct;
|
|
524
|
+
try {
|
|
525
|
+
return check(fs.realpathSync.native(dir), fs.realpathSync.native(file));
|
|
526
|
+
}
|
|
527
|
+
catch {
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
511
531
|
function routeParams(rel) {
|
|
512
532
|
const names = [];
|
|
513
533
|
const shown = rel.replace(/\\/g, "/");
|
package/dist/server/dev.js
CHANGED
|
@@ -92,7 +92,7 @@ async function startDevServer(project, opts) {
|
|
|
92
92
|
(0, ui_1.printDiagnostic)(w);
|
|
93
93
|
broadcast({ type: "update", pages: next, full: routesChanged });
|
|
94
94
|
if (changed)
|
|
95
|
-
ui_1.log.success(`${ui_1.c.gray(path.relative(project.root, changed))} ${ui_1.c.dim("updated in " + (0, ui_1.formatMs)(Date.now() - started))}`);
|
|
95
|
+
ui_1.log.success(`${ui_1.c.gray(path.relative(project.root, changed).replace(/\\/g, "/"))} ${ui_1.c.dim("updated in " + (0, ui_1.formatMs)(Date.now() - started))}`);
|
|
96
96
|
}
|
|
97
97
|
catch (err) {
|
|
98
98
|
if (!(err instanceof diagnostics_1.SinthError)) {
|
package/package.json
CHANGED