MCPcopy Index your code
hub / github.com/angular/angular / readPackage

Function readPackage

.pnpmfile.cjs:22–64  ·  view source on GitHub ↗
(pkg, context)

Source from the content-addressed store, hash-verified

20const peerDepsToChange = new Set(['zone.js', 'rxjs']);
21
22function readPackage(pkg, context) {
23 // TODO(devversion): This allows us to make compiler/TS a production dependency of compiler-cli
24 // because `rules_js` doesn't otherwise include the dependency in the `npm_package_store`.
25 // See: https://github.com/aspect-build/rules_js/issues/2226
26 if (pkg.name === '@angular/compiler-cli') {
27 pkg.dependencies = {
28 ...pkg.dependencies,
29 '@angular/compiler': 'workspace:*',
30 'typescript': pkg.devDependencies['typescript'],
31 };
32
33 delete pkg.devDependencies['typescript'];
34 }
35
36 for (const [key, version] of Object.entries(pkg.peerDependencies)) {
37 // Any package that has a peerDependency on rxjs or zone.js, should instead treat the peerDependency as a
38 // regular dependency.
39 if (peerDepsToChange.has(key)) {
40 pkg.dependencies = {
41 ...pkg.dependencies,
42 [key]: pkg.devDependencies[key] ?? version,
43 };
44
45 delete pkg.devDependencies[key];
46
47 continue;
48 }
49
50 // Change all locally generated packages to directly depend on the other local packages, instead
51 // of expecting them as peerDependencies automatically as we do not auto install peer deps. The
52 // package is also removed from peerDependencies as it was moved over and will just cause errors.
53 if (pkg.version === '0.0.0-PLACEHOLDER' && localAngularPackages.has(key)) {
54 pkg.dependencies = {
55 ...pkg.dependencies,
56 [key]: 'workspace: *',
57 };
58
59 delete pkg.peerDependencies[key];
60 }
61 }
62
63 return pkg;
64}
65
66module.exports = {
67 hooks: {

Callers

nothing calls this directly

Calls 2

hasMethod · 0.65
entriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…