@dogsbay/format-astro 0.2.0-beta.157 → 0.2.0-beta.159

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.
Files changed (2) hide show
  1. package/dist/project.js +9 -3
  2. package/package.json +8 -8
package/dist/project.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Takes ExportPage[] + NavItem[] and generates a complete Astro project
5
5
  * with static .astro pages using real Dogsbay components.
6
6
  */
7
- import { existsSync, mkdirSync, readFileSync, cpSync, readdirSync, statSync, rmSync, rmdirSync, openSync, readSync, closeSync, } from "node:fs";
7
+ import { existsSync, mkdirSync, readFileSync, cpSync, readdirSync, rmSync, rmdirSync, openSync, readSync, closeSync, lstatSync } from "node:fs";
8
8
  // Unchanged files are not rewritten, so `site dev` reloads only what changed
9
9
  import { writeFileSync, copyFileSync } from "./write-if-changed.js";
10
10
  import { join, dirname, relative, resolve } from "node:path";
@@ -1662,8 +1662,9 @@ export async function emitAstroPages(pages, nav, outputDir, options) {
1662
1662
  const skipped = new Set((mount.skip ?? []).map((f) => join(mount.dir, f)));
1663
1663
  if (mount.mediaOnly)
1664
1664
  copyMediaTree(mount.dir, dest, skipped);
1665
+ // a link inside a mount is not followed or copied (it could name any file on the machine)
1665
1666
  else
1666
- cpSync(mount.dir, dest, { recursive: true, filter: (src) => !skipped.has(src) });
1667
+ cpSync(mount.dir, dest, { recursive: true, filter: (src) => !skipped.has(src) && (src === mount.dir || !lstatSync(src).isSymbolicLink()) });
1667
1668
  }
1668
1669
  }
1669
1670
  let generated = 0;
@@ -3669,7 +3670,12 @@ function copyMediaTree(srcDir, destDir, skip) {
3669
3670
  const full = join(srcDir, entry);
3670
3671
  if (skip?.has(full))
3671
3672
  continue;
3672
- if (statSync(full).isDirectory()) {
3673
+ // A link is never followed: an imported repo's `public/x -> /home/user` would copy the
3674
+ // user's files into the site, and `public/loop -> .` would recurse forever (a review)
3675
+ const stat = lstatSync(full);
3676
+ if (stat.isSymbolicLink())
3677
+ continue;
3678
+ if (stat.isDirectory()) {
3673
3679
  copyMediaTree(full, join(destDir, entry), skip);
3674
3680
  continue;
3675
3681
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/format-astro",
3
- "version": "0.2.0-beta.157",
3
+ "version": "0.2.0-beta.159",
4
4
  "description": "Astro format plugin for Dogsbay — export TreeNode[] to Astro component markup",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,13 +32,13 @@
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
34
  "markdown-it": "^14.3.0",
35
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.157",
36
- "@dogsbay/icons": "0.2.0-beta.157",
37
- "@dogsbay/render-html": "0.2.0-beta.157",
38
- "@dogsbay/site-files": "0.2.0-beta.157",
39
- "@dogsbay/serialize-core": "0.2.0-beta.157",
40
- "@dogsbay/types": "0.2.0-beta.157",
41
- "@dogsbay/ui": "0.2.0-beta.157"
35
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.159",
36
+ "@dogsbay/render-html": "0.2.0-beta.159",
37
+ "@dogsbay/icons": "0.2.0-beta.159",
38
+ "@dogsbay/serialize-core": "0.2.0-beta.159",
39
+ "@dogsbay/site-files": "0.2.0-beta.159",
40
+ "@dogsbay/types": "0.2.0-beta.159",
41
+ "@dogsbay/ui": "0.2.0-beta.159"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",