@angular/cli 18.1.0-next.3 → 18.1.0-rc.0

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.
@@ -6,14 +6,39 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
- return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
10
+ var useValue = arguments.length > 2;
11
+ for (var i = 0; i < initializers.length; i++) {
12
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13
+ }
14
+ return useValue ? value : void 0;
14
15
  };
15
- var __metadata = (this && this.__metadata) || function (k, v) {
16
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
16
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
18
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
19
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
21
+ var _, done = false;
22
+ for (var i = decorators.length - 1; i >= 0; i--) {
23
+ var context = {};
24
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
25
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
26
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
27
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
28
+ if (kind === "accessor") {
29
+ if (result === void 0) continue;
30
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
31
+ if (_ = accept(result.get)) descriptor.get = _;
32
+ if (_ = accept(result.set)) descriptor.set = _;
33
+ if (_ = accept(result.init)) initializers.unshift(_);
34
+ }
35
+ else if (_ = accept(result)) {
36
+ if (kind === "field") initializers.unshift(_);
37
+ else descriptor[key] = _;
38
+ }
39
+ }
40
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
41
+ done = true;
17
42
  };
18
43
  Object.defineProperty(exports, "__esModule", { value: true });
19
44
  exports.PackageManagerUtils = void 0;
@@ -25,257 +50,258 @@ const path_1 = require("path");
25
50
  const workspace_schema_1 = require("../../lib/config/workspace-schema");
26
51
  const config_1 = require("./config");
27
52
  const memoize_1 = require("./memoize");
28
- class PackageManagerUtils {
29
- context;
30
- constructor(context) {
31
- this.context = context;
32
- }
33
- /** Get the package manager name. */
34
- get name() {
35
- return this.getName();
36
- }
37
- /** Get the package manager version. */
38
- get version() {
39
- return this.getVersion(this.name);
40
- }
41
- /** Install a single package. */
42
- async install(packageName, save = true, extraArgs = [], cwd) {
43
- const packageManagerArgs = this.getArguments();
44
- const installArgs = [packageManagerArgs.install, packageName];
45
- if (save === 'devDependencies') {
46
- installArgs.push(packageManagerArgs.saveDev);
53
+ let PackageManagerUtils = (() => {
54
+ let _instanceExtraInitializers = [];
55
+ let _getVersion_decorators;
56
+ let _getName_decorators;
57
+ return class PackageManagerUtils {
58
+ static {
59
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
60
+ _getVersion_decorators = [memoize_1.memoize];
61
+ _getName_decorators = [memoize_1.memoize];
62
+ __esDecorate(this, null, _getVersion_decorators, { kind: "method", name: "getVersion", static: false, private: false, access: { has: obj => "getVersion" in obj, get: obj => obj.getVersion }, metadata: _metadata }, null, _instanceExtraInitializers);
63
+ __esDecorate(this, null, _getName_decorators, { kind: "method", name: "getName", static: false, private: false, access: { has: obj => "getName" in obj, get: obj => obj.getName }, metadata: _metadata }, null, _instanceExtraInitializers);
64
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
47
65
  }
48
- return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
49
- }
50
- /** Install all packages. */
51
- async installAll(extraArgs = [], cwd) {
52
- const packageManagerArgs = this.getArguments();
53
- const installArgs = [];
54
- if (packageManagerArgs.installAll) {
55
- installArgs.push(packageManagerArgs.installAll);
66
+ context = __runInitializers(this, _instanceExtraInitializers);
67
+ constructor(context) {
68
+ this.context = context;
56
69
  }
57
- return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
58
- }
59
- /** Install a single package temporary. */
60
- async installTemp(packageName, extraArgs) {
61
- const tempPath = await fs_1.promises.mkdtemp((0, path_1.join)((0, fs_1.realpathSync)((0, os_1.tmpdir)()), 'angular-cli-packages-'));
62
- // clean up temp directory on process exit
63
- process.on('exit', () => {
64
- try {
65
- (0, fs_1.rmSync)(tempPath, { recursive: true, maxRetries: 3 });
70
+ /** Get the package manager name. */
71
+ get name() {
72
+ return this.getName();
73
+ }
74
+ /** Get the package manager version. */
75
+ get version() {
76
+ return this.getVersion(this.name);
77
+ }
78
+ /** Install a single package. */
79
+ async install(packageName, save = true, extraArgs = [], cwd) {
80
+ const packageManagerArgs = this.getArguments();
81
+ const installArgs = [packageManagerArgs.install, packageName];
82
+ if (save === 'devDependencies') {
83
+ installArgs.push(packageManagerArgs.saveDev);
66
84
  }
67
- catch { }
68
- });
69
- // NPM will warn when a `package.json` is not found in the install directory
70
- // Example:
71
- // npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
72
- // npm WARN .ng-temp-packages-84Qi7y No description
73
- // npm WARN .ng-temp-packages-84Qi7y No repository field.
74
- // npm WARN .ng-temp-packages-84Qi7y No license field.
75
- // While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
76
- // because of missing fields.
77
- await fs_1.promises.writeFile((0, path_1.join)(tempPath, 'package.json'), JSON.stringify({
78
- name: 'temp-cli-install',
79
- description: 'temp-cli-install',
80
- repository: 'temp-cli-install',
81
- license: 'MIT',
82
- }));
83
- // setup prefix/global modules path
84
- const packageManagerArgs = this.getArguments();
85
- const tempNodeModules = (0, path_1.join)(tempPath, 'node_modules');
86
- // Yarn will not append 'node_modules' to the path
87
- const prefixPath = this.name === workspace_schema_1.PackageManager.Yarn ? tempNodeModules : tempPath;
88
- const installArgs = [
89
- ...(extraArgs ?? []),
90
- `${packageManagerArgs.prefix}="${prefixPath}"`,
91
- packageManagerArgs.noLockfile,
92
- ];
93
- return {
94
- success: await this.install(packageName, true, installArgs, tempPath),
95
- tempNodeModules,
96
- };
97
- }
98
- getArguments() {
99
- switch (this.name) {
100
- case workspace_schema_1.PackageManager.Yarn:
101
- return {
102
- saveDev: '--dev',
103
- install: 'add',
104
- prefix: '--modules-folder',
105
- noLockfile: '--no-lockfile',
106
- };
107
- case workspace_schema_1.PackageManager.Pnpm:
108
- return {
109
- saveDev: '--save-dev',
110
- install: 'add',
111
- installAll: 'install',
112
- prefix: '--prefix',
113
- noLockfile: '--no-lockfile',
114
- };
115
- case workspace_schema_1.PackageManager.Bun:
116
- return {
117
- saveDev: '--development',
118
- install: 'add',
119
- installAll: 'install',
120
- prefix: '--cwd',
121
- noLockfile: '',
122
- };
123
- default:
124
- return {
125
- saveDev: '--save-dev',
126
- install: 'install',
127
- installAll: 'install',
128
- prefix: '--prefix',
129
- noLockfile: '--no-package-lock',
130
- };
85
+ return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
131
86
  }
132
- }
133
- async run(args, options = {}) {
134
- const { cwd = process.cwd(), silent = false } = options;
135
- return new Promise((resolve) => {
136
- const bufferedOutput = [];
137
- const childProcess = (0, child_process_1.spawn)(this.name, args, {
138
- // Always pipe stderr to allow for failures to be reported
139
- stdio: silent ? ['ignore', 'ignore', 'pipe'] : 'pipe',
140
- shell: true,
141
- cwd,
142
- }).on('close', (code) => {
143
- if (code === 0) {
144
- resolve(true);
145
- }
146
- else {
147
- bufferedOutput.forEach(({ stream, data }) => stream.write(data));
148
- resolve(false);
87
+ /** Install all packages. */
88
+ async installAll(extraArgs = [], cwd) {
89
+ const packageManagerArgs = this.getArguments();
90
+ const installArgs = [];
91
+ if (packageManagerArgs.installAll) {
92
+ installArgs.push(packageManagerArgs.installAll);
93
+ }
94
+ return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
95
+ }
96
+ /** Install a single package temporary. */
97
+ async installTemp(packageName, extraArgs) {
98
+ const tempPath = await fs_1.promises.mkdtemp((0, path_1.join)((0, fs_1.realpathSync)((0, os_1.tmpdir)()), 'angular-cli-packages-'));
99
+ // clean up temp directory on process exit
100
+ process.on('exit', () => {
101
+ try {
102
+ (0, fs_1.rmSync)(tempPath, { recursive: true, maxRetries: 3 });
149
103
  }
104
+ catch { }
150
105
  });
151
- childProcess.stdout?.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
152
- childProcess.stderr?.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
153
- });
154
- }
155
- getVersion(name) {
156
- try {
157
- return (0, child_process_1.execSync)(`${name} --version`, {
158
- encoding: 'utf8',
159
- stdio: ['ignore', 'pipe', 'ignore'],
160
- env: {
161
- ...process.env,
162
- // NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
163
- NO_UPDATE_NOTIFIER: '1',
164
- NPM_CONFIG_UPDATE_NOTIFIER: 'false',
165
- },
166
- }).trim();
106
+ // NPM will warn when a `package.json` is not found in the install directory
107
+ // Example:
108
+ // npm WARN enoent ENOENT: no such file or directory, open '/tmp/.ng-temp-packages-84Qi7y/package.json'
109
+ // npm WARN .ng-temp-packages-84Qi7y No description
110
+ // npm WARN .ng-temp-packages-84Qi7y No repository field.
111
+ // npm WARN .ng-temp-packages-84Qi7y No license field.
112
+ // While we can use `npm init -y` we will end up needing to update the 'package.json' anyways
113
+ // because of missing fields.
114
+ await fs_1.promises.writeFile((0, path_1.join)(tempPath, 'package.json'), JSON.stringify({
115
+ name: 'temp-cli-install',
116
+ description: 'temp-cli-install',
117
+ repository: 'temp-cli-install',
118
+ license: 'MIT',
119
+ }));
120
+ // setup prefix/global modules path
121
+ const packageManagerArgs = this.getArguments();
122
+ const tempNodeModules = (0, path_1.join)(tempPath, 'node_modules');
123
+ // Yarn will not append 'node_modules' to the path
124
+ const prefixPath = this.name === workspace_schema_1.PackageManager.Yarn ? tempNodeModules : tempPath;
125
+ const installArgs = [
126
+ ...(extraArgs ?? []),
127
+ `${packageManagerArgs.prefix}="${prefixPath}"`,
128
+ packageManagerArgs.noLockfile,
129
+ ];
130
+ return {
131
+ success: await this.install(packageName, true, installArgs, tempPath),
132
+ tempNodeModules,
133
+ };
167
134
  }
168
- catch {
169
- return undefined;
170
- }
171
- }
172
- getName() {
173
- const packageManager = this.getConfiguredPackageManager();
174
- if (packageManager) {
175
- return packageManager;
176
- }
177
- const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
178
- const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
179
- const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
180
- const hasBunLock = this.hasLockfile(workspace_schema_1.PackageManager.Bun);
181
- // PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
182
- // Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
183
- // The result of this method is not stored in a variable because it's memoized.
184
- if (hasNpmLock) {
185
- // Has NPM lock file.
186
- if (!hasYarnLock && !hasPnpmLock && !hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
187
- // Only NPM lock file and NPM binary is available.
188
- return workspace_schema_1.PackageManager.Npm;
135
+ getArguments() {
136
+ switch (this.name) {
137
+ case workspace_schema_1.PackageManager.Yarn:
138
+ return {
139
+ saveDev: '--dev',
140
+ install: 'add',
141
+ prefix: '--modules-folder',
142
+ noLockfile: '--no-lockfile',
143
+ };
144
+ case workspace_schema_1.PackageManager.Pnpm:
145
+ return {
146
+ saveDev: '--save-dev',
147
+ install: 'add',
148
+ installAll: 'install',
149
+ prefix: '--prefix',
150
+ noLockfile: '--no-lockfile',
151
+ };
152
+ case workspace_schema_1.PackageManager.Bun:
153
+ return {
154
+ saveDev: '--development',
155
+ install: 'add',
156
+ installAll: 'install',
157
+ prefix: '--cwd',
158
+ noLockfile: '',
159
+ };
160
+ default:
161
+ return {
162
+ saveDev: '--save-dev',
163
+ install: 'install',
164
+ installAll: 'install',
165
+ prefix: '--prefix',
166
+ noLockfile: '--no-package-lock',
167
+ };
189
168
  }
190
169
  }
191
- else {
192
- // No NPM lock file.
193
- if (hasYarnLock && this.getVersion(workspace_schema_1.PackageManager.Yarn)) {
194
- // Yarn lock file and Yarn binary is available.
195
- return workspace_schema_1.PackageManager.Yarn;
196
- }
197
- else if (hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Pnpm)) {
198
- // PNPM lock file and PNPM binary is available.
199
- return workspace_schema_1.PackageManager.Pnpm;
170
+ async run(args, options = {}) {
171
+ const { cwd = process.cwd(), silent = false } = options;
172
+ return new Promise((resolve) => {
173
+ const bufferedOutput = [];
174
+ const childProcess = (0, child_process_1.spawn)(this.name, args, {
175
+ // Always pipe stderr to allow for failures to be reported
176
+ stdio: silent ? ['ignore', 'ignore', 'pipe'] : 'pipe',
177
+ shell: true,
178
+ cwd,
179
+ }).on('close', (code) => {
180
+ if (code === 0) {
181
+ resolve(true);
182
+ }
183
+ else {
184
+ bufferedOutput.forEach(({ stream, data }) => stream.write(data));
185
+ resolve(false);
186
+ }
187
+ });
188
+ childProcess.stdout?.on('data', (data) => bufferedOutput.push({ stream: process.stdout, data: data }));
189
+ childProcess.stderr?.on('data', (data) => bufferedOutput.push({ stream: process.stderr, data: data }));
190
+ });
191
+ }
192
+ getVersion(name) {
193
+ try {
194
+ return (0, child_process_1.execSync)(`${name} --version`, {
195
+ encoding: 'utf8',
196
+ stdio: ['ignore', 'pipe', 'ignore'],
197
+ env: {
198
+ ...process.env,
199
+ // NPM updater notifier will prevents the child process from closing until it timeout after 3 minutes.
200
+ NO_UPDATE_NOTIFIER: '1',
201
+ NPM_CONFIG_UPDATE_NOTIFIER: 'false',
202
+ },
203
+ }).trim();
200
204
  }
201
- else if (hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Bun)) {
202
- // Bun lock file and Bun binary is available.
203
- return workspace_schema_1.PackageManager.Bun;
205
+ catch {
206
+ return undefined;
204
207
  }
205
208
  }
206
- if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
207
- // Doesn't have NPM installed.
208
- const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
209
- const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
210
- const hasBun = !!this.getVersion(workspace_schema_1.PackageManager.Bun);
211
- if (hasYarn && !hasPnpm && !hasBun) {
212
- return workspace_schema_1.PackageManager.Yarn;
209
+ getName() {
210
+ const packageManager = this.getConfiguredPackageManager();
211
+ if (packageManager) {
212
+ return packageManager;
213
213
  }
214
- else if (hasPnpm && !hasYarn && !hasBun) {
215
- return workspace_schema_1.PackageManager.Pnpm;
214
+ const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
215
+ const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
216
+ const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
217
+ const hasBunLock = this.hasLockfile(workspace_schema_1.PackageManager.Bun);
218
+ // PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
219
+ // Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
220
+ // The result of this method is not stored in a variable because it's memoized.
221
+ if (hasNpmLock) {
222
+ // Has NPM lock file.
223
+ if (!hasYarnLock && !hasPnpmLock && !hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
224
+ // Only NPM lock file and NPM binary is available.
225
+ return workspace_schema_1.PackageManager.Npm;
226
+ }
216
227
  }
217
- else if (hasBun && !hasYarn && !hasPnpm) {
218
- return workspace_schema_1.PackageManager.Bun;
228
+ else {
229
+ // No NPM lock file.
230
+ if (hasYarnLock && this.getVersion(workspace_schema_1.PackageManager.Yarn)) {
231
+ // Yarn lock file and Yarn binary is available.
232
+ return workspace_schema_1.PackageManager.Yarn;
233
+ }
234
+ else if (hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Pnpm)) {
235
+ // PNPM lock file and PNPM binary is available.
236
+ return workspace_schema_1.PackageManager.Pnpm;
237
+ }
238
+ else if (hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Bun)) {
239
+ // Bun lock file and Bun binary is available.
240
+ return workspace_schema_1.PackageManager.Bun;
241
+ }
219
242
  }
243
+ if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
244
+ // Doesn't have NPM installed.
245
+ const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
246
+ const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
247
+ const hasBun = !!this.getVersion(workspace_schema_1.PackageManager.Bun);
248
+ if (hasYarn && !hasPnpm && !hasBun) {
249
+ return workspace_schema_1.PackageManager.Yarn;
250
+ }
251
+ else if (hasPnpm && !hasYarn && !hasBun) {
252
+ return workspace_schema_1.PackageManager.Pnpm;
253
+ }
254
+ else if (hasBun && !hasYarn && !hasPnpm) {
255
+ return workspace_schema_1.PackageManager.Bun;
256
+ }
257
+ }
258
+ // TODO: This should eventually inform the user of ambiguous package manager usage.
259
+ // Potentially with a prompt to choose and optionally set as the default.
260
+ return workspace_schema_1.PackageManager.Npm;
220
261
  }
221
- // TODO: This should eventually inform the user of ambiguous package manager usage.
222
- // Potentially with a prompt to choose and optionally set as the default.
223
- return workspace_schema_1.PackageManager.Npm;
224
- }
225
- hasLockfile(packageManager) {
226
- let lockfileName;
227
- switch (packageManager) {
228
- case workspace_schema_1.PackageManager.Yarn:
229
- lockfileName = 'yarn.lock';
230
- break;
231
- case workspace_schema_1.PackageManager.Pnpm:
232
- lockfileName = 'pnpm-lock.yaml';
233
- break;
234
- case workspace_schema_1.PackageManager.Bun:
235
- lockfileName = 'bun.lockb';
236
- break;
237
- case workspace_schema_1.PackageManager.Npm:
238
- default:
239
- lockfileName = 'package-lock.json';
240
- break;
262
+ hasLockfile(packageManager) {
263
+ let lockfileName;
264
+ switch (packageManager) {
265
+ case workspace_schema_1.PackageManager.Yarn:
266
+ lockfileName = 'yarn.lock';
267
+ break;
268
+ case workspace_schema_1.PackageManager.Pnpm:
269
+ lockfileName = 'pnpm-lock.yaml';
270
+ break;
271
+ case workspace_schema_1.PackageManager.Bun:
272
+ lockfileName = 'bun.lockb';
273
+ break;
274
+ case workspace_schema_1.PackageManager.Npm:
275
+ default:
276
+ lockfileName = 'package-lock.json';
277
+ break;
278
+ }
279
+ return (0, fs_1.existsSync)((0, path_1.join)(this.context.root, lockfileName));
241
280
  }
242
- return (0, fs_1.existsSync)((0, path_1.join)(this.context.root, lockfileName));
243
- }
244
- getConfiguredPackageManager() {
245
- const getPackageManager = (source) => {
246
- if (source && (0, core_1.isJsonObject)(source)) {
247
- const value = source['packageManager'];
248
- if (typeof value === 'string') {
249
- return value;
281
+ getConfiguredPackageManager() {
282
+ const getPackageManager = (source) => {
283
+ if (source && (0, core_1.isJsonObject)(source)) {
284
+ const value = source['packageManager'];
285
+ if (typeof value === 'string') {
286
+ return value;
287
+ }
288
+ }
289
+ return undefined;
290
+ };
291
+ let result;
292
+ const { workspace: localWorkspace, globalConfiguration: globalWorkspace } = this.context;
293
+ if (localWorkspace) {
294
+ const project = (0, config_1.getProjectByCwd)(localWorkspace);
295
+ if (project) {
296
+ result = getPackageManager(localWorkspace.projects.get(project)?.extensions['cli']);
250
297
  }
298
+ result ??= getPackageManager(localWorkspace.extensions['cli']);
251
299
  }
252
- return undefined;
253
- };
254
- let result;
255
- const { workspace: localWorkspace, globalConfiguration: globalWorkspace } = this.context;
256
- if (localWorkspace) {
257
- const project = (0, config_1.getProjectByCwd)(localWorkspace);
258
- if (project) {
259
- result = getPackageManager(localWorkspace.projects.get(project)?.extensions['cli']);
300
+ if (!result) {
301
+ result = getPackageManager(globalWorkspace.extensions['cli']);
260
302
  }
261
- result ??= getPackageManager(localWorkspace.extensions['cli']);
303
+ return result;
262
304
  }
263
- if (!result) {
264
- result = getPackageManager(globalWorkspace.extensions['cli']);
265
- }
266
- return result;
267
- }
268
- }
305
+ };
306
+ })();
269
307
  exports.PackageManagerUtils = PackageManagerUtils;
270
- __decorate([
271
- memoize_1.memoize,
272
- __metadata("design:type", Function),
273
- __metadata("design:paramtypes", [String]),
274
- __metadata("design:returntype", Object)
275
- ], PackageManagerUtils.prototype, "getVersion", null);
276
- __decorate([
277
- memoize_1.memoize,
278
- __metadata("design:type", Function),
279
- __metadata("design:paramtypes", []),
280
- __metadata("design:returntype", String)
281
- ], PackageManagerUtils.prototype, "getName", null);
@@ -5,4 +5,4 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- export declare function isTTY(): boolean;
8
+ export declare function isTTY(stream?: NodeJS.WriteStream): boolean;
@@ -12,11 +12,11 @@ function _isTruthy(value) {
12
12
  // Returns true if value is a string that is anything but 0 or false.
13
13
  return value !== undefined && value !== '0' && value.toUpperCase() !== 'FALSE';
14
14
  }
15
- function isTTY() {
15
+ function isTTY(stream = process.stdout) {
16
16
  // If we force TTY, we always return true.
17
17
  const force = process.env['NG_FORCE_TTY'];
18
18
  if (force !== undefined) {
19
19
  return _isTruthy(force);
20
20
  }
21
- return !!process.stdout.isTTY && !_isTruthy(process.env['CI']);
21
+ return !!stream.isTTY && !_isTruthy(process.env['CI']);
22
22
  }
@@ -25,5 +25,5 @@ class Version {
25
25
  }
26
26
  }
27
27
  // TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
28
- // export const VERSION = new Version('18.1.0-next.3');
28
+ // export const VERSION = new Version('18.1.0-rc.0');
29
29
  exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8')).version);