MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parsePnpmPackages

Function parsePnpmPackages

src/resolution/workspace-packages.ts:900–920  ·  view source on GitHub ↗

* Minimal pnpm-workspace.yaml `packages:` extractor. Handles the only shape * pnpm actually uses: * packages: * - 'packages/*' * - "apps/*" * - tools/build

(yaml: string)

Source from the content-addressed store, hash-verified

898 * - tools/build
899 */
900function parsePnpmPackages(yaml: string): string[] {
901 const out: string[] = [];
902 const lines = yaml.split(/\r?\n/);
903 let inPackages = false;
904 for (const line of lines) {
905 if (/^\s*packages\s*:/.test(line)) {
906 inPackages = true;
907 continue;
908 }
909 if (inPackages) {
910 const item = line.match(/^\s*-\s*(.+?)\s*$/);
911 if (item) {
912 out.push(item[1]!.replace(/^['"]|['"]$/g, ''));
913 continue;
914 }
915 // A non-list, non-blank line ends the `packages:` block.
916 if (line.trim() !== '' && !/^\s/.test(line)) inPackages = false;
917 }
918 }
919 return out;
920}
921
922/** Folders no wildcard matches: installed packages. */
923const GLOB_SKIP_DIRS = new Set(['node_modules', 'bower_components']);

Callers 1

readWorkspaceGlobsFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected