Files
hyperframes/packages/core/src
andybpan a765c93791 fix(figma): write .media and component outputs without following links (#8111)
* fix(figma): write .media and component outputs without following links

The figma importer's writers (index.md, manifest.jsonl, figma-bindings.jsonl,
figma-tokens.json and component files) used writeFileSync, appendFileSync and
recursive mkdirSync, which follow a link at the target or in its folders.

- Folders under the project (.media, .media/images,
  compositions/components/<name>) are created one level at a time and refused
  when one is a link or resolves outside the project.
- Whole-file rewrites go through replaceFileAtomically (temp file + rename),
  so a link at the target is replaced rather than written through.
- Appends open with O_NOFOLLOW and refuse a link at the target.
- index.md cells collapse line breaks, matching media-use's index-gen.mjs
  byte for byte, so each record stays on one line.

* chore(figma): trim added comments; check the component folder right before writing

* fix(figma): open appends first, then check the path holds that same file

appendWithoutFollowing checked the path with lstat and then opened it, leaving
a gap between check and use. It now opens with O_NOFOLLOW first and writes
through the descriptor only when lstat finds the same single-link plain file at
the path, the pattern projectRecords' appendRecord already uses.
2026-11-17 21:36:57 +00:00
..