@nx/angular 21.0.0-canary.20250416-caa26a7 → 21.0.0-canary.20250419-8619c1d
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.
- package/fesm2022/nx-angular.mjs +0 -352
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.json +2 -2
- package/index.d.ts +1 -1
- package/migrations.json +18 -69
- package/package.json +9 -14
- package/src/builders/dev-server/schema.d.ts +3 -0
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/webpack-browser/schema.d.ts +0 -5
- package/src/builders/webpack-browser/webpack-browser.impl.js +3 -4
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -0
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
- package/src/generators/application/application.js +6 -0
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
- package/src/generators/application/lib/add-e2e.js +0 -7
- package/src/generators/convert-to-rspack/convert-to-rspack.js +10 -15
- package/src/generators/move/move.d.ts +3 -0
- package/src/generators/move/move.js +3 -0
- package/src/generators/ngrx/ngrx.d.ts +3 -0
- package/src/generators/ngrx/ngrx.js +3 -0
- package/src/generators/ngrx/schema.json +1 -1
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
- package/src/migrations/{update-16-1-0/remove-ngcc-invocation.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
- package/src/utils/nx-devkit/ast-utils.d.ts +0 -8
- package/src/utils/nx-devkit/ast-utils.js +7 -12
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/fesm2022/nx-angular-testing.mjs +0 -45
- package/fesm2022/nx-angular-testing.mjs.map +0 -1
- package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
- package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
- package/src/migrations/update-16-1-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-16-1-0/update-angular-cli.js +0 -23
- package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
- package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
- package/src/runtime/nx/data-persistence.d.ts +0 -276
- package/testing/index.d.ts +0 -1
- package/testing/ng-package.json +0 -6
- package/testing/src/testing-utils.d.ts +0 -33
package/fesm2022/nx-angular.mjs
CHANGED
@@ -1,356 +1,4 @@
|
|
1
|
-
import { ROUTER_NAVIGATION } from '@ngrx/router-store';
|
2
|
-
import { isObservable, of } from 'rxjs';
|
3
|
-
import { concatMap, groupBy, mergeMap, switchMap, filter, map, catchError } from 'rxjs/operators';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @whatItDoes Handles pessimistic updates (updating the server first).
|
7
|
-
*
|
8
|
-
* Updating the server, when implemented naively, suffers from race conditions and poor error handling.
|
9
|
-
*
|
10
|
-
* `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions
|
11
|
-
* and forces the developer to handle errors.
|
12
|
-
*
|
13
|
-
* ## Example:
|
14
|
-
*
|
15
|
-
* ```typescript
|
16
|
-
* @Injectable()
|
17
|
-
* class TodoEffects {
|
18
|
-
* updateTodo$ = createEffect(() =>
|
19
|
-
* this.actions$.pipe(
|
20
|
-
* ofType('UPDATE_TODO'),
|
21
|
-
* pessimisticUpdate({
|
22
|
-
* // provides an action
|
23
|
-
* run: (action: UpdateTodo) => {
|
24
|
-
* // update the backend first, and then dispatch an action that will
|
25
|
-
* // update the client side
|
26
|
-
* return this.backend.updateTodo(action.todo.id, action.todo).pipe(
|
27
|
-
* map((updated) => ({
|
28
|
-
* type: 'UPDATE_TODO_SUCCESS',
|
29
|
-
* todo: updated,
|
30
|
-
* }))
|
31
|
-
* );
|
32
|
-
* },
|
33
|
-
* onError: (action: UpdateTodo, error: any) => {
|
34
|
-
* // we don't need to undo the changes on the client side.
|
35
|
-
* // we can dispatch an error, or simply log the error here and return `null`
|
36
|
-
* return null;
|
37
|
-
* },
|
38
|
-
* })
|
39
|
-
* )
|
40
|
-
* );
|
41
|
-
*
|
42
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
43
|
-
* }
|
44
|
-
* ```
|
45
|
-
*
|
46
|
-
* Note that if you don't return a new action from the run callback, you must set the dispatch property
|
47
|
-
* of the effect to false, like this:
|
48
|
-
*
|
49
|
-
* ```typescript
|
50
|
-
* class TodoEffects {
|
51
|
-
* updateTodo$ = createEffect(() =>
|
52
|
-
* this.actions$.pipe(
|
53
|
-
* //...
|
54
|
-
* ), { dispatch: false }
|
55
|
-
* );
|
56
|
-
* }
|
57
|
-
* ```
|
58
|
-
*
|
59
|
-
* @param opts
|
60
|
-
*
|
61
|
-
* @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
|
62
|
-
*/
|
63
|
-
function pessimisticUpdate(opts) {
|
64
|
-
return (source) => {
|
65
|
-
return source.pipe(mapActionAndState(), concatMap(runWithErrorHandling(opts.run, opts.onError)));
|
66
|
-
};
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* @whatItDoes Handles optimistic updates (updating the client first).
|
70
|
-
*
|
71
|
-
* It runs all fetches in order, which removes race conditions and forces the developer to handle errors.
|
72
|
-
*
|
73
|
-
* When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,
|
74
|
-
* so the developer must provide an undo action.
|
75
|
-
*
|
76
|
-
* The error handling must be done in the callback, or by means of the undo action.
|
77
|
-
*
|
78
|
-
* ## Example:
|
79
|
-
*
|
80
|
-
* ```typescript
|
81
|
-
* @Injectable()
|
82
|
-
* class TodoEffects {
|
83
|
-
* updateTodo$ = createEffect(() =>
|
84
|
-
* this.actions$.pipe(
|
85
|
-
* ofType('UPDATE_TODO'),
|
86
|
-
* optimisticUpdate({
|
87
|
-
* // provides an action
|
88
|
-
* run: (action: UpdateTodo) => {
|
89
|
-
* return this.backend.updateTodo(action.todo.id, action.todo).pipe(
|
90
|
-
* mapTo({
|
91
|
-
* type: 'UPDATE_TODO_SUCCESS',
|
92
|
-
* })
|
93
|
-
* );
|
94
|
-
* },
|
95
|
-
* undoAction: (action: UpdateTodo, error: any) => {
|
96
|
-
* // dispatch an undo action to undo the changes in the client state
|
97
|
-
* return {
|
98
|
-
* type: 'UNDO_TODO_UPDATE',
|
99
|
-
* todo: action.todo,
|
100
|
-
* };
|
101
|
-
* },
|
102
|
-
* })
|
103
|
-
* )
|
104
|
-
* );
|
105
|
-
*
|
106
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
107
|
-
* }
|
108
|
-
* ```
|
109
|
-
*
|
110
|
-
* Note that if you don't return a new action from the run callback, you must set the dispatch property
|
111
|
-
* of the effect to false, like this:
|
112
|
-
*
|
113
|
-
* ```typescript
|
114
|
-
* class TodoEffects {
|
115
|
-
* updateTodo$ = createEffect(() =>
|
116
|
-
* this.actions$.pipe(
|
117
|
-
* //...
|
118
|
-
* ), { dispatch: false }
|
119
|
-
* );
|
120
|
-
* }
|
121
|
-
* ```
|
122
|
-
*
|
123
|
-
* @param opts
|
124
|
-
*
|
125
|
-
* @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.
|
126
|
-
*/
|
127
|
-
function optimisticUpdate(opts) {
|
128
|
-
return (source) => {
|
129
|
-
return source.pipe(mapActionAndState(), concatMap(runWithErrorHandling(opts.run, opts.undoAction)));
|
130
|
-
};
|
131
|
-
}
|
132
|
-
/**
|
133
|
-
* @whatItDoes Handles data fetching.
|
134
|
-
*
|
135
|
-
* Data fetching implemented naively suffers from race conditions and poor error handling.
|
136
|
-
*
|
137
|
-
* `fetch` addresses these problems. It runs all fetches in order, which removes race conditions
|
138
|
-
* and forces the developer to handle errors.
|
139
|
-
*
|
140
|
-
* ## Example:
|
141
|
-
*
|
142
|
-
* ```typescript
|
143
|
-
* @Injectable()
|
144
|
-
* class TodoEffects {
|
145
|
-
* loadTodos$ = createEffect(() =>
|
146
|
-
* this.actions$.pipe(
|
147
|
-
* ofType('GET_TODOS'),
|
148
|
-
* fetch({
|
149
|
-
* // provides an action
|
150
|
-
* run: (a: GetTodos) => {
|
151
|
-
* return this.backend.getAll().pipe(
|
152
|
-
* map((response) => ({
|
153
|
-
* type: 'TODOS',
|
154
|
-
* todos: response.todos,
|
155
|
-
* }))
|
156
|
-
* );
|
157
|
-
* },
|
158
|
-
* onError: (action: GetTodos, error: any) => {
|
159
|
-
* // dispatch an undo action to undo the changes in the client state
|
160
|
-
* return null;
|
161
|
-
* },
|
162
|
-
* })
|
163
|
-
* )
|
164
|
-
* );
|
165
|
-
*
|
166
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
167
|
-
* }
|
168
|
-
* ```
|
169
|
-
*
|
170
|
-
* This is correct, but because it set the concurrency to 1, it may not be performant.
|
171
|
-
*
|
172
|
-
* To fix that, you can provide the `id` function, like this:
|
173
|
-
*
|
174
|
-
* ```typescript
|
175
|
-
* @Injectable()
|
176
|
-
* class TodoEffects {
|
177
|
-
* loadTodo$ = createEffect(() =>
|
178
|
-
* this.actions$.pipe(
|
179
|
-
* ofType('GET_TODO'),
|
180
|
-
* fetch({
|
181
|
-
* id: (todo: GetTodo) => {
|
182
|
-
* return todo.id;
|
183
|
-
* },
|
184
|
-
* // provides an action
|
185
|
-
* run: (todo: GetTodo) => {
|
186
|
-
* return this.backend.getTodo(todo.id).map((response) => ({
|
187
|
-
* type: 'LOAD_TODO_SUCCESS',
|
188
|
-
* todo: response.todo,
|
189
|
-
* }));
|
190
|
-
* },
|
191
|
-
* onError: (action: GetTodo, error: any) => {
|
192
|
-
* // dispatch an undo action to undo the changes in the client state
|
193
|
-
* return null;
|
194
|
-
* },
|
195
|
-
* })
|
196
|
-
* )
|
197
|
-
* );
|
198
|
-
*
|
199
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
200
|
-
* }
|
201
|
-
* ```
|
202
|
-
*
|
203
|
-
* With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.
|
204
|
-
*
|
205
|
-
* In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.
|
206
|
-
*
|
207
|
-
* @param opts
|
208
|
-
*
|
209
|
-
* @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.
|
210
|
-
*/
|
211
|
-
function fetch(opts) {
|
212
|
-
return (source) => {
|
213
|
-
if (opts.id) {
|
214
|
-
const groupedFetches = source.pipe(mapActionAndState(), groupBy(([action, ...store]) => {
|
215
|
-
return opts.id(action, ...store);
|
216
|
-
}));
|
217
|
-
return groupedFetches.pipe(mergeMap((pairs) => pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))));
|
218
|
-
}
|
219
|
-
return source.pipe(mapActionAndState(), concatMap(runWithErrorHandling(opts.run, opts.onError)));
|
220
|
-
};
|
221
|
-
}
|
222
|
-
/**
|
223
|
-
* @whatItDoes Handles data fetching as part of router navigation.
|
224
|
-
*
|
225
|
-
* Data fetching implemented naively suffers from race conditions and poor error handling.
|
226
|
-
*
|
227
|
-
* `navigation` addresses these problems.
|
228
|
-
*
|
229
|
-
* It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`
|
230
|
-
* callback. It provides the activated snapshot associated with the component and the current state. And it only runs
|
231
|
-
* the last request.
|
232
|
-
*
|
233
|
-
* ## Example:
|
234
|
-
*
|
235
|
-
* ```typescript
|
236
|
-
* @Injectable()
|
237
|
-
* class TodoEffects {
|
238
|
-
* loadTodo$ = createEffect(() =>
|
239
|
-
* this.actions$.pipe(
|
240
|
-
* // listens for the routerNavigation action from @ngrx/router-store
|
241
|
-
* navigation(TodoComponent, {
|
242
|
-
* run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {
|
243
|
-
* return this.backend
|
244
|
-
* .fetchTodo(activatedRouteSnapshot.params['id'])
|
245
|
-
* .pipe(
|
246
|
-
* map((todo) => ({
|
247
|
-
* type: 'LOAD_TODO_SUCCESS',
|
248
|
-
* todo: todo,
|
249
|
-
* }))
|
250
|
-
* );
|
251
|
-
* },
|
252
|
-
* onError: (
|
253
|
-
* activatedRouteSnapshot: ActivatedRouteSnapshot,
|
254
|
-
* error: any
|
255
|
-
* ) => {
|
256
|
-
* // we can log and error here and return null
|
257
|
-
* // we can also navigate back
|
258
|
-
* return null;
|
259
|
-
* },
|
260
|
-
* })
|
261
|
-
* )
|
262
|
-
* );
|
263
|
-
*
|
264
|
-
* constructor(private actions$: Actions, private backend: Backend) {}
|
265
|
-
* }
|
266
|
-
* ```
|
267
|
-
*
|
268
|
-
* @param component
|
269
|
-
* @param opts
|
270
|
-
*
|
271
|
-
* @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.
|
272
|
-
*/
|
273
|
-
function navigation(component, opts) {
|
274
|
-
return (source) => {
|
275
|
-
const nav = source.pipe(mapActionAndState(), filter(([action]) => isStateSnapshot(action)), map(([action, ...slices]) => {
|
276
|
-
if (!isStateSnapshot(action)) {
|
277
|
-
// Because of the above filter we'll never get here,
|
278
|
-
// but this properly type narrows `action`
|
279
|
-
return;
|
280
|
-
}
|
281
|
-
return [
|
282
|
-
findSnapshot(component, action.payload.routerState.root),
|
283
|
-
...slices,
|
284
|
-
];
|
285
|
-
}), filter(([snapshot]) => !!snapshot));
|
286
|
-
return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));
|
287
|
-
};
|
288
|
-
}
|
289
|
-
function isStateSnapshot(action) {
|
290
|
-
return action.type === ROUTER_NAVIGATION;
|
291
|
-
}
|
292
|
-
function runWithErrorHandling(run, onError) {
|
293
|
-
return ([action, ...slices]) => {
|
294
|
-
try {
|
295
|
-
const r = wrapIntoObservable(run(action, ...slices));
|
296
|
-
return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));
|
297
|
-
}
|
298
|
-
catch (e) {
|
299
|
-
return wrapIntoObservable(onError(action, e));
|
300
|
-
}
|
301
|
-
};
|
302
|
-
}
|
303
|
-
/**
|
304
|
-
* @whatItDoes maps Observable<Action | [Action, State]> to
|
305
|
-
* Observable<[Action, State]>
|
306
|
-
*/
|
307
|
-
function mapActionAndState() {
|
308
|
-
return (source) => {
|
309
|
-
return source.pipe(map((value) => normalizeActionAndState(value)));
|
310
|
-
};
|
311
|
-
}
|
312
|
-
/**
|
313
|
-
* @whatItDoes Normalizes either a bare action or an array of action and slices
|
314
|
-
* into an array of action and slices (or undefined)
|
315
|
-
*/
|
316
|
-
function normalizeActionAndState(args) {
|
317
|
-
let action, slices;
|
318
|
-
if (args instanceof Array) {
|
319
|
-
[action, ...slices] = args;
|
320
|
-
}
|
321
|
-
else {
|
322
|
-
slices = [];
|
323
|
-
action = args;
|
324
|
-
}
|
325
|
-
return [action, ...slices];
|
326
|
-
}
|
327
|
-
function findSnapshot(component, s) {
|
328
|
-
if (s.routeConfig && s.routeConfig.component === component) {
|
329
|
-
return s;
|
330
|
-
}
|
331
|
-
for (const c of s.children) {
|
332
|
-
const ss = findSnapshot(component, c);
|
333
|
-
if (ss) {
|
334
|
-
return ss;
|
335
|
-
}
|
336
|
-
}
|
337
|
-
return null;
|
338
|
-
}
|
339
|
-
function wrapIntoObservable(obj) {
|
340
|
-
if (isObservable(obj)) {
|
341
|
-
return obj;
|
342
|
-
}
|
343
|
-
else if (!obj) {
|
344
|
-
return of();
|
345
|
-
}
|
346
|
-
else {
|
347
|
-
return of(obj);
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
1
|
/**
|
352
2
|
* Generated bundle index. Do not edit.
|
353
3
|
*/
|
354
|
-
|
355
|
-
export { fetch, navigation, optimisticUpdate, pessimisticUpdate };
|
356
4
|
//# sourceMappingURL=nx-angular.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/src/runtime/nx/data-persistence.ts","../../../../packages/angular/nx-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport type {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport type { RouterNavigationAction } from '@ngrx/router-store';\nimport { ROUTER_NAVIGATION } from '@ngrx/router-store';\nimport type { Action } from '@ngrx/store';\nimport type { Observable } from 'rxjs';\nimport { isObservable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n} from 'rxjs/operators';\n\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\n/**\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Updating the server, when implemented naively, suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * pessimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * map((updated) => ({\n * type: 'UPDATE_TODO_SUCCESS',\n * todo: updated,\n * }))\n * );\n * },\n * onError: (action: UpdateTodo, error: any) => {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.\n *\n * When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,\n * so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * optimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * mapTo({\n * type: 'UPDATE_TODO_SUCCESS',\n * })\n * );\n * },\n * undoAction: (action: UpdateTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return {\n * type: 'UNDO_TODO_UPDATE',\n * todo: action.todo,\n * };\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodos$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODOS'),\n * fetch({\n * // provides an action\n * run: (a: GetTodos) => {\n * return this.backend.getAll().pipe(\n * map((response) => ({\n * type: 'TODOS',\n * todos: response.todos,\n * }))\n * );\n * },\n * onError: (action: GetTodos, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODO'),\n * fetch({\n * id: (todo: GetTodo) => {\n * return todo.id;\n * },\n * // provides an action\n * run: (todo: GetTodo) => {\n * return this.backend.getTodo(todo.id).map((response) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: response.todo,\n * }));\n * },\n * onError: (action: GetTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * // listens for the routerNavigation action from @ngrx/router-store\n * navigation(TodoComponent, {\n * run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {\n * return this.backend\n * .fetchTodo(activatedRouteSnapshot.params['id'])\n * .pipe(\n * map((todo) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: todo,\n * }))\n * );\n * },\n * onError: (\n * activatedRouteSnapshot: ActivatedRouteSnapshot,\n * error: any\n * ) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * @param component\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;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AAE,EAAE;;SACN;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC;;AAEvB;;ACpcA;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/nx-angular.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
|
package/generators.json
CHANGED
@@ -86,7 +86,7 @@
|
|
86
86
|
"schema": "./src/generators/move/schema.json",
|
87
87
|
"aliases": ["mv"],
|
88
88
|
"description": "Moves an Angular application or library to another folder within the workspace and updates the project configuration.",
|
89
|
-
"x-deprecated": "Use the `@nx/workspace:move` generator instead. This generator will be removed in Nx
|
89
|
+
"x-deprecated": "Use the `@nx/workspace:move` generator instead. This generator will be removed in Nx v22."
|
90
90
|
},
|
91
91
|
"convert-to-with-mf": {
|
92
92
|
"factory": "./src/generators/convert-to-with-mf/convert-to-with-mf",
|
@@ -110,7 +110,7 @@
|
|
110
110
|
"factory": "./src/generators/ngrx/ngrx",
|
111
111
|
"schema": "./src/generators/ngrx/schema.json",
|
112
112
|
"description": "Adds NgRx support to an application or library.",
|
113
|
-
"x-deprecated": "
|
113
|
+
"x-deprecated": "Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22."
|
114
114
|
},
|
115
115
|
"ngrx-feature-store": {
|
116
116
|
"factory": "./src/generators/ngrx-feature-store/ngrx-feature-store",
|
package/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export {
|
1
|
+
export {};
|
package/migrations.json
CHANGED
@@ -1,74 +1,5 @@
|
|
1
1
|
{
|
2
2
|
"generators": {
|
3
|
-
"remove-library-generator-simple-module-name-option": {
|
4
|
-
"cli": "nx",
|
5
|
-
"version": "16.0.0-beta.1",
|
6
|
-
"description": "Replace the deprecated library generator 'simpleModuleName' option from generator defaults with 'simpleName'",
|
7
|
-
"factory": "./src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option"
|
8
|
-
},
|
9
|
-
"update-16-0-0-add-nx-packages": {
|
10
|
-
"cli": "nx",
|
11
|
-
"version": "16.0.0-beta.1",
|
12
|
-
"description": "Replace @nrwl/angular with @nx/angular",
|
13
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
14
|
-
},
|
15
|
-
"remove-protractor-defaults-from-generators": {
|
16
|
-
"cli": "nx",
|
17
|
-
"version": "16.0.0-beta.6",
|
18
|
-
"description": "Remove protractor as default e2eTestRunner from nxJson and project configurations",
|
19
|
-
"implementation": "./src/migrations/update-16-0-0/remove-protractor-defaults"
|
20
|
-
},
|
21
|
-
"remove-karma-defaults-from-generators": {
|
22
|
-
"cli": "nx",
|
23
|
-
"version": "16.0.0-beta.6",
|
24
|
-
"description": "Remove karma as default unitTestRunner from nxJson and project configurations",
|
25
|
-
"implementation": "./src/migrations/update-16-0-0/remove-karma-defaults"
|
26
|
-
},
|
27
|
-
"remove-render-module-platform-server-exports": {
|
28
|
-
"cli": "nx",
|
29
|
-
"version": "16.1.0-beta.1",
|
30
|
-
"requires": {
|
31
|
-
"@angular/core": ">=15.0.0"
|
32
|
-
},
|
33
|
-
"description": "Remove exported `@angular/platform-server` `renderModule` method. The `renderModule` method is now exported by the Angular CLI.",
|
34
|
-
"factory": "./src/migrations/update-16-1-0/remove-render-module-platform-server-exports"
|
35
|
-
},
|
36
|
-
"remove-ngcc-invocation": {
|
37
|
-
"cli": "nx",
|
38
|
-
"version": "16.1.0-beta.1",
|
39
|
-
"requires": {
|
40
|
-
"@angular/core": ">=16.0.0-rc.4"
|
41
|
-
},
|
42
|
-
"description": "Remove 'ngcc' invocation if exists from the 'postinstall' script in package.json.",
|
43
|
-
"factory": "./src/migrations/update-16-1-0/remove-ngcc-invocation"
|
44
|
-
},
|
45
|
-
"extract-app-config-for-standalone": {
|
46
|
-
"cli": "nx",
|
47
|
-
"version": "16.1.0-beta.1",
|
48
|
-
"requires": {
|
49
|
-
"@angular/core": ">=16.0.0-rc.4"
|
50
|
-
},
|
51
|
-
"description": "Extract the app config for standalone apps",
|
52
|
-
"factory": "./src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap"
|
53
|
-
},
|
54
|
-
"update-server-executor-config": {
|
55
|
-
"cli": "nx",
|
56
|
-
"version": "16.1.0-beta.1",
|
57
|
-
"requires": {
|
58
|
-
"@angular/core": ">=16.0.0-rc.4"
|
59
|
-
},
|
60
|
-
"description": "Update server executors' configuration to disable 'buildOptimizer' for non optimized builds.",
|
61
|
-
"factory": "./src/migrations/update-16-1-0/update-server-executor-config"
|
62
|
-
},
|
63
|
-
"update-angular-cli-version-16-0-0": {
|
64
|
-
"cli": "nx",
|
65
|
-
"version": "16.1.0-beta.1",
|
66
|
-
"requires": {
|
67
|
-
"@angular/core": ">=16.0.0"
|
68
|
-
},
|
69
|
-
"description": "Update the @angular/cli package version to ~16.0.0.",
|
70
|
-
"factory": "./src/migrations/update-16-1-0/update-angular-cli"
|
71
|
-
},
|
72
3
|
"switch-data-persistence-operators-imports-to-ngrx-router-store": {
|
73
4
|
"cli": "nx",
|
74
5
|
"version": "16.2.0-beta.0",
|
@@ -362,6 +293,15 @@
|
|
362
293
|
"version": "21.0.0-beta.3",
|
363
294
|
"description": "Set the `continuous` option to `true` for continuous tasks.",
|
364
295
|
"factory": "./src/migrations/update-21-0-0/set-continuous-option"
|
296
|
+
},
|
297
|
+
"change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence": {
|
298
|
+
"cli": "nx",
|
299
|
+
"version": "21.0.0-beta.5",
|
300
|
+
"requires": {
|
301
|
+
"@ngrx/store": ">=16.0.0"
|
302
|
+
},
|
303
|
+
"description": "Change the data persistence operator imports to '@ngrx/router-store/data-persistence'.",
|
304
|
+
"factory": "./src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence"
|
365
305
|
}
|
366
306
|
},
|
367
307
|
"packageJsonUpdates": {
|
@@ -1666,6 +1606,15 @@
|
|
1666
1606
|
"alwaysAddToPackageJson": false
|
1667
1607
|
}
|
1668
1608
|
}
|
1609
|
+
},
|
1610
|
+
"20.8.1": {
|
1611
|
+
"version": "20.8.1-beta.0",
|
1612
|
+
"packages": {
|
1613
|
+
"@nx/angular-rspack": {
|
1614
|
+
"version": "^20.7.0",
|
1615
|
+
"alwaysAddToPackageJson": false
|
1616
|
+
}
|
1617
|
+
}
|
1669
1618
|
}
|
1670
1619
|
}
|
1671
1620
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "21.0.0-canary.
|
3
|
+
"version": "21.0.0-canary.20250419-8619c1d",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
6
6
|
"repository": {
|
@@ -33,7 +33,6 @@
|
|
33
33
|
"./src/builders/*.impl": "./src/builders/*.impl.js",
|
34
34
|
"./src/executors/*/schema.json": "./src/executors/*/schema.json",
|
35
35
|
"./src/executors/*.impl": "./src/executors/*.impl.js",
|
36
|
-
"./src/executors/*/compat": "./src/executors/*/compat.js",
|
37
36
|
"./package.json": {
|
38
37
|
"default": "./package.json"
|
39
38
|
},
|
@@ -44,10 +43,6 @@
|
|
44
43
|
"./mf": {
|
45
44
|
"types": "./mf/index.d.ts",
|
46
45
|
"default": "./fesm2022/nx-angular-mf.mjs"
|
47
|
-
},
|
48
|
-
"./testing": {
|
49
|
-
"types": "./testing/index.d.ts",
|
50
|
-
"default": "./fesm2022/nx-angular-testing.mjs"
|
51
46
|
}
|
52
47
|
},
|
53
48
|
"author": "Victor Savkin",
|
@@ -72,14 +67,14 @@
|
|
72
67
|
"semver": "^7.5.3",
|
73
68
|
"tslib": "^2.3.0",
|
74
69
|
"webpack-merge": "^5.8.0",
|
75
|
-
"@nx/devkit": "21.0.0-canary.
|
76
|
-
"@nx/js": "21.0.0-canary.
|
77
|
-
"@nx/eslint": "21.0.0-canary.
|
78
|
-
"@nx/webpack": "21.0.0-canary.
|
79
|
-
"@nx/rspack": "21.0.0-canary.
|
80
|
-
"@nx/module-federation": "21.0.0-canary.
|
81
|
-
"@nx/web": "21.0.0-canary.
|
82
|
-
"@nx/workspace": "21.0.0-canary.
|
70
|
+
"@nx/devkit": "21.0.0-canary.20250419-8619c1d",
|
71
|
+
"@nx/js": "21.0.0-canary.20250419-8619c1d",
|
72
|
+
"@nx/eslint": "21.0.0-canary.20250419-8619c1d",
|
73
|
+
"@nx/webpack": "21.0.0-canary.20250419-8619c1d",
|
74
|
+
"@nx/rspack": "21.0.0-canary.20250419-8619c1d",
|
75
|
+
"@nx/module-federation": "21.0.0-canary.20250419-8619c1d",
|
76
|
+
"@nx/web": "21.0.0-canary.20250419-8619c1d",
|
77
|
+
"@nx/workspace": "21.0.0-canary.20250419-8619c1d",
|
83
78
|
"piscina": "^4.4.0"
|
84
79
|
},
|
85
80
|
"peerDependencies": {
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"type": "string",
|
18
18
|
"description": "A browser builder target to serve in the format of `project:target[:configuration]`. Ignored if `buildTarget` is set.",
|
19
19
|
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
20
|
-
"x-deprecated": "Use 'buildTarget' instead. It will be removed
|
20
|
+
"x-deprecated": "Use 'buildTarget' instead. It will be removed when Angular v20 is released."
|
21
21
|
},
|
22
22
|
"buildTarget": {
|
23
23
|
"type": "string",
|
@@ -7,9 +7,4 @@ export type BrowserBuilderSchema = Schema & {
|
|
7
7
|
indexHtmlTransformer?: string;
|
8
8
|
buildLibsFromSource?: boolean;
|
9
9
|
watchDependencies?: boolean;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* @deprecated Use `indexHtmlTransformer` instead. It will be removed in Nx 21.
|
13
|
-
*/
|
14
|
-
indexFileTransformer?: string;
|
15
10
|
};
|
@@ -26,7 +26,7 @@ function shouldSkipInitialTargetRun(projectGraph, project, target) {
|
|
26
26
|
function executeWebpackBrowserBuilder(options, context) {
|
27
27
|
options.buildLibsFromSource ??= true;
|
28
28
|
options.watchDependencies ??= true;
|
29
|
-
const { buildLibsFromSource, customWebpackConfig, indexHtmlTransformer,
|
29
|
+
const { buildLibsFromSource, customWebpackConfig, indexHtmlTransformer, watchDependencies, ...delegateBuilderOptions } = options;
|
30
30
|
process.env.NX_BUILD_LIBS_FROM_SOURCE = `${buildLibsFromSource}`;
|
31
31
|
process.env.NX_BUILD_TARGET = (0, devkit_1.targetToTargetString)({ ...context.target });
|
32
32
|
const pathToWebpackConfig = customWebpackConfig?.path &&
|
@@ -34,9 +34,8 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
34
34
|
if (pathToWebpackConfig && !(0, fs_1.existsSync)(pathToWebpackConfig)) {
|
35
35
|
throw new Error(`Custom Webpack Config File Not Found!\nTo use a custom webpack config, please ensure the path to the custom webpack file is correct: \n${pathToWebpackConfig}`);
|
36
36
|
}
|
37
|
-
const
|
38
|
-
|
39
|
-
(0, devkit_1.joinPathFragments)(context.workspaceRoot, normalizedIndexHtmlTransformer);
|
37
|
+
const pathToIndexFileTransformer = indexHtmlTransformer &&
|
38
|
+
(0, devkit_1.joinPathFragments)(context.workspaceRoot, indexHtmlTransformer);
|
40
39
|
if (pathToIndexFileTransformer && !(0, fs_1.existsSync)(pathToIndexFileTransformer)) {
|
41
40
|
throw new Error(`File containing Index File Transformer function Not Found!\n Please ensure the path to the file containing the function is correct: \n${pathToIndexFileTransformer}`);
|
42
41
|
}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"type": "string",
|
16
16
|
"description": "A browser builder target to serve in the format of `project:target[:configuration]`.",
|
17
17
|
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
18
|
-
"x-deprecated": "Use 'buildTarget' instead. It will be removed
|
18
|
+
"x-deprecated": "Use 'buildTarget' instead. It will be removed when Angular v20 is released."
|
19
19
|
},
|
20
20
|
"buildTarget": {
|
21
21
|
"type": "string",
|
@@ -5,7 +5,7 @@ type EslintExtensionSchema = {
|
|
5
5
|
prefix: string;
|
6
6
|
};
|
7
7
|
/**
|
8
|
-
* @deprecated Use tools from `@nx/eslint/src/generators/utils/eslint-file` instead
|
8
|
+
* @deprecated Use tools from `@nx/eslint/src/generators/utils/eslint-file` instead. It will be removed in Nx v22.
|
9
9
|
*/
|
10
10
|
export declare const extendAngularEslintJson: (json: Linter.Config, options: EslintExtensionSchema) => {
|
11
11
|
overrides: ({
|
@@ -75,7 +75,7 @@ export declare const extendAngularEslintJson: (json: Linter.Config, options: Esl
|
|
75
75
|
rules?: Partial<Linter.RulesRecord>;
|
76
76
|
};
|
77
77
|
/**
|
78
|
-
* @deprecated Use {@link extendAngularEslintJson} instead
|
78
|
+
* @deprecated Use {@link extendAngularEslintJson} instead. It will be removed in Nx v22.
|
79
79
|
*/
|
80
80
|
export declare function createEsLintConfiguration(tree: Tree, options: AddLintingGeneratorSchema): void;
|
81
81
|
export {};
|