Function: projectile--pnpm-workspace-patterns

projectile--pnpm-workspace-patterns is a byte-compiled function defined in projectile.el.

Signature

(projectile--pnpm-workspace-patterns FILE)

Documentation

Return the packages: entries of the pnpm workspace manifest FILE.

A deliberately small YAML reader: it takes the list items under the top-level packages: key and stops at the next top-level key, which is all this file shape needs (catalog: and friends live alongside it).

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--pnpm-workspace-patterns (file)
  "Return the `packages:' entries of the pnpm workspace manifest FILE.
A deliberately small YAML reader: it takes the list items under the
top-level `packages:' key and stops at the next top-level key, which is
all this file shape needs (`catalog:' and friends live alongside it)."
  (let ((lines (split-string (projectile--file-contents file) "\n"))
        (in-packages nil)
        (patterns nil))
    (dolist (line lines)
      (cond
       ((string-match "\\`packages:[[:space:]]*\\'" line)
        (setq in-packages t))
       ;; any other unindented, non-comment line ends the block
       ((and in-packages (string-match-p "\\`[^[:space:]#-]" line))
        (setq in-packages nil))
       ((and in-packages
             (string-match "\\`[[:space:]]*-[[:space:]]*['\"]?\\([^'\"#]+?\\)['\"]?[[:space:]]*\\'" line))
        (push (match-string 1 line) patterns))))
    (nreverse patterns)))