@ngrx/store-devtools 20.1.0 → 21.0.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.
Files changed (54) hide show
  1. package/fesm2022/ngrx-store-devtools.mjs +13 -13
  2. package/migrations/17_0_0-beta/index.js +58 -63
  3. package/migrations/17_0_0-beta/index.js.map +1 -1
  4. package/migrations/6_0_0/index.js +1 -1
  5. package/migrations/6_0_0/index.js.map +1 -1
  6. package/package.json +5 -5
  7. package/schematics/ng-add/index.js +71 -87
  8. package/schematics/ng-add/index.js.map +1 -1
  9. package/schematics-core/index.js +1 -1
  10. package/schematics-core/index.js.map +1 -1
  11. package/schematics-core/utility/ast-utils.js +198 -240
  12. package/schematics-core/utility/ast-utils.js.map +1 -1
  13. package/schematics-core/utility/change.js +68 -85
  14. package/schematics-core/utility/change.js.map +1 -1
  15. package/schematics-core/utility/config.js +7 -7
  16. package/schematics-core/utility/config.js.map +1 -1
  17. package/schematics-core/utility/find-component.js +20 -20
  18. package/schematics-core/utility/find-component.js.map +1 -1
  19. package/schematics-core/utility/find-module.js +21 -21
  20. package/schematics-core/utility/find-module.js.map +1 -1
  21. package/schematics-core/utility/json-utilts.js +4 -26
  22. package/schematics-core/utility/json-utilts.js.map +1 -1
  23. package/schematics-core/utility/libs-version.js +1 -1
  24. package/schematics-core/utility/libs-version.js.map +1 -1
  25. package/schematics-core/utility/ngrx-utils.js +110 -141
  26. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  27. package/schematics-core/utility/package.js +2 -3
  28. package/schematics-core/utility/package.js.map +1 -1
  29. package/schematics-core/utility/parse-name.js +3 -3
  30. package/schematics-core/utility/parse-name.js.map +1 -1
  31. package/schematics-core/utility/project.js +13 -13
  32. package/schematics-core/utility/project.js.map +1 -1
  33. package/schematics-core/utility/standalone.js +133 -211
  34. package/schematics-core/utility/standalone.js.map +1 -1
  35. package/schematics-core/utility/strings.js +12 -12
  36. package/schematics-core/utility/strings.js.map +1 -1
  37. package/schematics-core/utility/update.js +12 -12
  38. package/schematics-core/utility/update.js.map +1 -1
  39. package/schematics-core/utility/visitors.js +78 -180
  40. package/schematics-core/utility/visitors.js.map +1 -1
  41. package/types/ngrx-store-devtools.d.ts +252 -0
  42. package/index.d.ts +0 -6
  43. package/public_api.d.ts +0 -1
  44. package/src/actions.d.ts +0 -79
  45. package/src/config.d.ts +0 -126
  46. package/src/devtools-dispatcher.d.ts +0 -6
  47. package/src/devtools.d.ts +0 -35
  48. package/src/extension.d.ts +0 -52
  49. package/src/index.d.ts +0 -6
  50. package/src/instrument.d.ts +0 -9
  51. package/src/provide-store-devtools.d.ts +0 -26
  52. package/src/reducer.d.ts +0 -47
  53. package/src/utils.d.ts +0 -42
  54. package/src/zone-config.d.ts +0 -9
@@ -290,10 +290,10 @@ function injectZoneConfig(connectInZone) {
290
290
  }
291
291
 
292
292
  class DevtoolsDispatcher extends ActionsSubject {
293
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
294
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsDispatcher }); }
293
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
294
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsDispatcher }); }
295
295
  }
296
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsDispatcher, decorators: [{
296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsDispatcher, decorators: [{
297
297
  type: Injectable
298
298
  }] });
299
299
 
@@ -445,10 +445,10 @@ class DevtoolsExtension {
445
445
  console.warn('@ngrx/store-devtools: something went wrong inside the redux devtools', err);
446
446
  }
447
447
  }
448
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsExtension, deps: [{ token: REDUX_DEVTOOLS_EXTENSION }, { token: STORE_DEVTOOLS_CONFIG }, { token: DevtoolsDispatcher }], target: i0.ɵɵFactoryTarget.Injectable }); }
449
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsExtension }); }
448
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsExtension, deps: [{ token: REDUX_DEVTOOLS_EXTENSION }, { token: STORE_DEVTOOLS_CONFIG }, { token: DevtoolsDispatcher }], target: i0.ɵɵFactoryTarget.Injectable }); }
449
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsExtension }); }
450
450
  }
451
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: DevtoolsExtension, decorators: [{
451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: DevtoolsExtension, decorators: [{
452
452
  type: Injectable
453
453
  }], ctorParameters: () => [{ type: undefined, decorators: [{
454
454
  type: Inject,
@@ -923,10 +923,10 @@ class StoreDevtools {
923
923
  pauseRecording(status) {
924
924
  this.dispatch(new PauseRecording(status));
925
925
  }
926
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtools, deps: [{ token: DevtoolsDispatcher }, { token: i2.ActionsSubject }, { token: i2.ReducerObservable }, { token: DevtoolsExtension }, { token: i2.ScannedActionsSubject }, { token: i0.ErrorHandler }, { token: INITIAL_STATE }, { token: STORE_DEVTOOLS_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
927
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtools }); }
926
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtools, deps: [{ token: DevtoolsDispatcher }, { token: i2.ActionsSubject }, { token: i2.ReducerObservable }, { token: DevtoolsExtension }, { token: i2.ScannedActionsSubject }, { token: i0.ErrorHandler }, { token: INITIAL_STATE }, { token: STORE_DEVTOOLS_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
927
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtools }); }
928
928
  }
929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtools, decorators: [{
929
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtools, decorators: [{
930
930
  type: Injectable
931
931
  }], ctorParameters: () => [{ type: DevtoolsDispatcher }, { type: i2.ActionsSubject }, { type: i2.ReducerObservable }, { type: DevtoolsExtension }, { type: i2.ScannedActionsSubject }, { type: i0.ErrorHandler }, { type: undefined, decorators: [{
932
932
  type: Inject,
@@ -1024,11 +1024,11 @@ class StoreDevtoolsModule {
1024
1024
  providers: [provideStoreDevtools(options)],
1025
1025
  };
1026
1026
  }
1027
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1028
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtoolsModule }); }
1029
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtoolsModule }); }
1027
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1028
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtoolsModule }); }
1029
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtoolsModule }); }
1030
1030
  }
1031
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: StoreDevtoolsModule, decorators: [{
1031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: StoreDevtoolsModule, decorators: [{
1032
1032
  type: NgModule,
1033
1033
  args: [{}]
1034
1034
  }] });
@@ -1,54 +1,59 @@
1
1
  "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
7
  }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
- if (ar || !(i in from)) {
21
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
- ar[i] = from[i];
23
- }
24
- }
25
- return to.concat(ar || Array.prototype.slice.call(from));
26
- };
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
27
35
  Object.defineProperty(exports, "__esModule", { value: true });
28
36
  exports.default = default_1;
29
- var ts = require("typescript");
30
- var schematics_1 = require("@angular-devkit/schematics");
31
- var schematics_core_1 = require("../..//schematics-core");
37
+ const ts = __importStar(require("typescript"));
38
+ const schematics_1 = require("@angular-devkit/schematics");
39
+ const schematics_core_1 = require("../..//schematics-core");
32
40
  function migrate() {
33
- return function (tree) {
34
- (0, schematics_core_1.visitTSSourceFiles)(tree, function (sourceFile) {
35
- var devtoolsImports = sourceFile.statements
41
+ return (tree) => {
42
+ (0, schematics_core_1.visitTSSourceFiles)(tree, (sourceFile) => {
43
+ const devtoolsImports = sourceFile.statements
36
44
  .filter(ts.isImportDeclaration)
37
- .filter(function (_a) {
38
- var moduleSpecifier = _a.moduleSpecifier;
39
- return moduleSpecifier.getText(sourceFile).includes('@ngrx/store-devtools');
40
- });
45
+ .filter(({ moduleSpecifier }) => moduleSpecifier.getText(sourceFile).includes('@ngrx/store-devtools'));
41
46
  if (devtoolsImports.length === 0) {
42
47
  return;
43
48
  }
44
- var changes = __spreadArray([], __read(findAndUpdateConfigs(sourceFile)), false);
49
+ const changes = [...findAndUpdateConfigs(sourceFile)];
45
50
  (0, schematics_core_1.commitChanges)(tree, sourceFile.fileName, changes);
46
51
  });
47
52
  };
48
53
  }
49
54
  function findAndUpdateConfigs(sourceFile) {
50
- var changes = [];
51
- ts.forEachChild(sourceFile, function (node) { return find(node, changes); });
55
+ const changes = [];
56
+ ts.forEachChild(sourceFile, (node) => find(node, changes));
52
57
  return changes;
53
58
  function find(node, changes) {
54
59
  if (ts.isPropertyAccessExpression(node) &&
@@ -57,45 +62,35 @@ function findAndUpdateConfigs(sourceFile) {
57
62
  node.expression.text === 'StoreDevtoolsModule' &&
58
63
  ts.isCallExpression(node.parent)) {
59
64
  if (node.parent.arguments.length) {
60
- var _a = __read(node.parent.arguments, 1), devtoolsConfig = _a[0];
65
+ const [devtoolsConfig] = node.parent.arguments;
61
66
  if (ts.isObjectLiteralExpression(devtoolsConfig)) {
62
- updateConfig(sourceFile, devtoolsConfig, function (change) {
63
- return changes.push(change);
64
- });
67
+ updateConfig(sourceFile, devtoolsConfig, (change) => changes.push(change));
65
68
  }
66
69
  }
67
70
  else {
68
- createDevtoolsConfig(sourceFile, node.parent, function (change) {
69
- return changes.push(change);
70
- });
71
+ createDevtoolsConfig(sourceFile, node.parent, (change) => changes.push(change));
71
72
  }
72
73
  }
73
74
  if (ts.isCallExpression(node) &&
74
75
  ts.isIdentifier(node.expression) &&
75
76
  node.expression.text === 'provideStoreDevtools') {
76
77
  if (node.arguments.length) {
77
- var _b = __read(node.arguments, 1), devtoolsConfig = _b[0];
78
+ const [devtoolsConfig] = node.arguments;
78
79
  if (ts.isObjectLiteralExpression(devtoolsConfig)) {
79
- updateConfig(sourceFile, devtoolsConfig, function (change) {
80
- return changes.push(change);
81
- });
80
+ updateConfig(sourceFile, devtoolsConfig, (change) => changes.push(change));
82
81
  }
83
82
  }
84
83
  else {
85
- createDevtoolsConfig(sourceFile, node, function (change) {
86
- return changes.push(change);
87
- });
84
+ createDevtoolsConfig(sourceFile, node, (change) => changes.push(change));
88
85
  }
89
86
  }
90
- ts.forEachChild(node, function (childNode) { return find(childNode, changes); });
87
+ ts.forEachChild(node, (childNode) => find(childNode, changes));
91
88
  }
92
89
  }
93
90
  function updateConfig(sourceFile, devtoolsConfig, addChange) {
94
- var connectOutsideZoneProperty = devtoolsConfig.properties.find(function (p) {
95
- return ts.isPropertyAssignment(p) &&
96
- ts.isIdentifier(p.name) &&
97
- p.name.text === 'connectOutsideZone';
98
- });
91
+ const connectOutsideZoneProperty = devtoolsConfig.properties.find((p) => ts.isPropertyAssignment(p) &&
92
+ ts.isIdentifier(p.name) &&
93
+ p.name.text === 'connectOutsideZone');
99
94
  if (!connectOutsideZoneProperty) {
100
95
  addConnectInZoneProperty();
101
96
  }
@@ -103,18 +98,18 @@ function updateConfig(sourceFile, devtoolsConfig, addChange) {
103
98
  replaceConnectOutsideZoneConfig(connectOutsideZoneProperty);
104
99
  }
105
100
  function addConnectInZoneProperty() {
106
- var configText = devtoolsConfig.getText(sourceFile);
107
- var comma = !devtoolsConfig.properties.length ||
101
+ const configText = devtoolsConfig.getText(sourceFile);
102
+ const comma = !devtoolsConfig.properties.length ||
108
103
  configText
109
104
  .substring(0, configText.length - 1)
110
105
  .trim()
111
106
  .endsWith(',')
112
107
  ? ''
113
108
  : ',';
114
- addChange(new schematics_core_1.InsertChange(sourceFile.fileName, devtoolsConfig.getEnd() - 1, "".concat(comma, " connectInZone: true").trim()));
109
+ addChange(new schematics_core_1.InsertChange(sourceFile.fileName, devtoolsConfig.getEnd() - 1, `${comma} connectInZone: true`.trim()));
115
110
  }
116
111
  function replaceConnectOutsideZoneConfig(connectOutsideZone) {
117
- var currentValue = connectOutsideZone.initializer
112
+ const currentValue = connectOutsideZone.initializer
118
113
  .getText(sourceFile)
119
114
  .trim();
120
115
  addChange((0, schematics_core_1.createReplaceChange)(sourceFile, connectOutsideZone.name, 'connectOutsideZone', 'connectInZone'));
@@ -122,11 +117,11 @@ function updateConfig(sourceFile, devtoolsConfig, addChange) {
122
117
  ? 'false'
123
118
  : currentValue === 'false'
124
119
  ? 'true'
125
- : "!".concat(currentValue)));
120
+ : `!${currentValue}`));
126
121
  }
127
122
  }
128
123
  function createDevtoolsConfig(sourceFile, callExpression, addChange) {
129
- addChange(new schematics_core_1.InsertChange(sourceFile.fileName, callExpression.getEnd() - 1, "{connectInZone: true}"));
124
+ addChange(new schematics_core_1.InsertChange(sourceFile.fileName, callExpression.getEnd() - 1, `{connectInZone: true}`));
130
125
  }
131
126
  function default_1() {
132
127
  return (0, schematics_1.chain)([migrate()]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/17_0_0-beta/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKA,4BAEC;AArKD,+BAAiC;AACjC,yDAA+D;AAC/D,0DAMgC;AAEhC,SAAS,OAAO;IACd,OAAO,UAAC,IAAU;QAChB,IAAA,oCAAkB,EAAC,IAAI,EAAE,UAAC,UAAU;YAClC,IAAM,eAAe,GAAG,UAAU,CAAC,UAAU;iBAC1C,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC;iBAC9B,MAAM,CAAC,UAAC,EAAmB;oBAAjB,eAAe,qBAAA;gBACxB,OAAA,e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CAAC,CAAC,YAAY,KAAK,OAAO;gBACxB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,WAAI,YAAY,CAAE,CACzB,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,UAAyB,EACzB,cAAiC,EACjC,SAAyC;IAEzC,SAAS,CACP,IAAI,8BAAY,CACd,UAAU,CAAC,QAAQ,EACnB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,uBAAuB,CACxB,CACF,CAAC;AACJ,CAAC;AAED;IACE,OAAO,IAAA,kBAAK,EAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport { Rule, chain, Tree } from '@angular-devkit/schematics';\nimport {\n visitTSSourceFiles,\n commitChanges,\n InsertChange,\n Change,\n createReplaceChange,\n} from '../..//schematics-core';\n\nfunction migrate() {\n return (tree: Tree) => {\n visitTSSourceFiles(tree, (sourceFile) => {\n const devtoolsImports = sourceFile.statements\n .filter(ts.isImportDeclaration)\n .filter(({ moduleSpecifier }) =>\n moduleSpecifier.getText(sourceFile).includes('@ngrx/store-devtools')\n );\n\n if (devtoolsImports.length === 0) {\n return;\n }\n\n const changes = [...findAndUpdateConfigs(sourceFile)];\n\n commitChanges(tree, sourceFile.fileName, changes);\n });\n };\n}\n\nfunction findAndUpdateConfigs(sourceFile: ts.SourceFile) {\n const changes: Change[] = [];\n ts.forEachChild(sourceFile, (node) => find(node, changes));\n return changes;\n\n function find(node: ts.Node, changes: Change[]) {\n if (\n ts.isPropertyAccessExpression(node) &&\n node.name.text === 'instrument' &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'StoreDevtoolsModule' &&\n ts.isCallExpression(node.parent)\n ) {\n if (node.parent.arguments.length) {\n const [devtoolsConfig] = node.parent.arguments;\n\n if (ts.isObjectLiteralExpression(devtoolsConfig)) {\n updateConfig(sourceFile, devtoolsConfig, (change) =>\n changes.push(change)\n );\n }\n } else {\n createDevtoolsConfig(sourceFile, node.parent, (change) =>\n changes.push(change)\n );\n }\n }\n\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'provideStoreDevtools'\n ) {\n if (node.arguments.length) {\n const [devtoolsConfig] = node.arguments;\n\n if (ts.isObjectLiteralExpression(devtoolsConfig)) {\n updateConfig(sourceFile, devtoolsConfig, (change) =>\n changes.push(change)\n );\n }\n } else {\n createDevtoolsConfig(sourceFile, node, (change) =>\n changes.push(change)\n );\n }\n }\n\n ts.forEachChild(node, (childNode) => find(childNode, changes));\n }\n}\n\nfunction updateConfig(\n sourceFile: ts.SourceFile,\n devtoolsConfig: ts.ObjectLiteralExpression,\n addChange: (changes: Change) => number\n) {\n const connectOutsideZoneProperty = devtoolsConfig.properties.find(\n (p) =>\n ts.isPropertyAssignment(p) &&\n ts.isIdentifier(p.name) &&\n p.name.text === 'connectOutsideZone'\n );\n\n if (!connectOutsideZoneProperty) {\n addConnectInZoneProperty();\n } else if (ts.isPropertyAssignment(connectOutsideZoneProperty)) {\n replaceConnectOutsideZoneConfig(connectOutsideZoneProperty);\n }\n\n function addConnectInZoneProperty() {\n const configText = devtoolsConfig.getText(sourceFile);\n const comma =\n !devtoolsConfig.properties.length ||\n configText\n .substring(0, configText.length - 1)\n .trim()\n .endsWith(',')\n ? ''\n : ',';\n\n addChange(\n new InsertChange(\n sourceFile.fileName,\n devtoolsConfig.getEnd() - 1,\n `${comma} connectInZone: true`.trim()\n )\n );\n }\n\n function replaceConnectOutsideZoneConfig(\n connectOutsideZone: ts.PropertyAssignment\n ) {\n const currentValue = connectOutsideZone.initializer\n .getText(sourceFile)\n .trim();\n addChange(\n createReplaceChange(\n sourceFile,\n connectOutsideZone.name,\n 'connectOutsideZone',\n 'connectInZone'\n )\n );\n addChange(\n createReplaceChange(\n sourceFile,\n connectOutsideZone.initializer,\n currentValue,\n currentValue === 'true'\n ? 'false'\n : currentValue === 'false'\n ? 'true'\n : `!${currentValue}`\n )\n );\n }\n}\n\nfunction createDevtoolsConfig(\n sourceFile: ts.SourceFile,\n callExpression: ts.CallExpression,\n addChange: (...items: Change[]) => number\n) {\n addChange(\n new InsertChange(\n sourceFile.fileName,\n callExpression.getEnd() - 1,\n `{connectInZone: true}`\n )\n );\n}\n\nexport default function (): Rule {\n return chain([migrate()]);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/17_0_0-beta/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKA,4BAEC;AArKD,+CAAiC;AACjC,2DAA+D;AAC/D,4DAMgC;AAEhC,SAAS,OAAO;IACd,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAA,oCAAkB,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;YACtC,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU;iBAC1C,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC;iBAC9B,MAAM,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAC9B,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CACrE,CAAC;YAEJ,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,MAAM,OAAO,GAAG,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;YAEtD,IAAA,+BAAa,EAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAyB;IACrD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,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,EAAE;YACJ,CAAC,CAAC,GAAG,CAAC;QAEV,SAAS,CACP,IAAI,8BAAY,CACd,UAAU,CAAC,QAAQ,EACnB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,GAAG,KAAK,sBAAsB,CAAC,IAAI,EAAE,CACtC,CACF,CAAC;IACJ,CAAC;IAED,SAAS,+BAA+B,CACtC,kBAAyC;QAEzC,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW;aAChD,OAAO,CAAC,UAAU,CAAC;aACnB,IAAI,EAAE,CAAC;QACV,SAAS,CACP,IAAA,qCAAmB,EACjB,UAAU,EACV,kBAAkB,CAAC,IAAI,EACvB,oBAAoB,EACpB,eAAe,CAChB,CACF,CAAC;QACF,SAAS,CACP,IAAA,qCAAmB,EACjB,UAAU,EACV,kBAAkB,CAAC,WAAW,EAC9B,YAAY,EACZ,YAAY,KAAK,MAAM;YACrB,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,YAAY,KAAK,OAAO;gBACxB,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,IAAI,YAAY,EAAE,CACzB,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,UAAyB,EACzB,cAAiC,EACjC,SAAyC;IAEzC,SAAS,CACP,IAAI,8BAAY,CACd,UAAU,CAAC,QAAQ,EACnB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,uBAAuB,CACxB,CACF,CAAC;AACJ,CAAC;AAED;IACE,OAAO,IAAA,kBAAK,EAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport { Rule, chain, Tree } from '@angular-devkit/schematics';\nimport {\n visitTSSourceFiles,\n commitChanges,\n InsertChange,\n Change,\n createReplaceChange,\n} from '../..//schematics-core';\n\nfunction migrate() {\n return (tree: Tree) => {\n visitTSSourceFiles(tree, (sourceFile) => {\n const devtoolsImports = sourceFile.statements\n .filter(ts.isImportDeclaration)\n .filter(({ moduleSpecifier }) =>\n moduleSpecifier.getText(sourceFile).includes('@ngrx/store-devtools')\n );\n\n if (devtoolsImports.length === 0) {\n return;\n }\n\n const changes = [...findAndUpdateConfigs(sourceFile)];\n\n commitChanges(tree, sourceFile.fileName, changes);\n });\n };\n}\n\nfunction findAndUpdateConfigs(sourceFile: ts.SourceFile) {\n const changes: Change[] = [];\n ts.forEachChild(sourceFile, (node) => find(node, changes));\n return changes;\n\n function find(node: ts.Node, changes: Change[]) {\n if (\n ts.isPropertyAccessExpression(node) &&\n node.name.text === 'instrument' &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'StoreDevtoolsModule' &&\n ts.isCallExpression(node.parent)\n ) {\n if (node.parent.arguments.length) {\n const [devtoolsConfig] = node.parent.arguments;\n\n if (ts.isObjectLiteralExpression(devtoolsConfig)) {\n updateConfig(sourceFile, devtoolsConfig, (change) =>\n changes.push(change)\n );\n }\n } else {\n createDevtoolsConfig(sourceFile, node.parent, (change) =>\n changes.push(change)\n );\n }\n }\n\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n node.expression.text === 'provideStoreDevtools'\n ) {\n if (node.arguments.length) {\n const [devtoolsConfig] = node.arguments;\n\n if (ts.isObjectLiteralExpression(devtoolsConfig)) {\n updateConfig(sourceFile, devtoolsConfig, (change) =>\n changes.push(change)\n );\n }\n } else {\n createDevtoolsConfig(sourceFile, node, (change) =>\n changes.push(change)\n );\n }\n }\n\n ts.forEachChild(node, (childNode) => find(childNode, changes));\n }\n}\n\nfunction updateConfig(\n sourceFile: ts.SourceFile,\n devtoolsConfig: ts.ObjectLiteralExpression,\n addChange: (changes: Change) => number\n) {\n const connectOutsideZoneProperty = devtoolsConfig.properties.find(\n (p) =>\n ts.isPropertyAssignment(p) &&\n ts.isIdentifier(p.name) &&\n p.name.text === 'connectOutsideZone'\n );\n\n if (!connectOutsideZoneProperty) {\n addConnectInZoneProperty();\n } else if (ts.isPropertyAssignment(connectOutsideZoneProperty)) {\n replaceConnectOutsideZoneConfig(connectOutsideZoneProperty);\n }\n\n function addConnectInZoneProperty() {\n const configText = devtoolsConfig.getText(sourceFile);\n const comma =\n !devtoolsConfig.properties.length ||\n configText\n .substring(0, configText.length - 1)\n .trim()\n .endsWith(',')\n ? ''\n : ',';\n\n addChange(\n new InsertChange(\n sourceFile.fileName,\n devtoolsConfig.getEnd() - 1,\n `${comma} connectInZone: true`.trim()\n )\n );\n }\n\n function replaceConnectOutsideZoneConfig(\n connectOutsideZone: ts.PropertyAssignment\n ) {\n const currentValue = connectOutsideZone.initializer\n .getText(sourceFile)\n .trim();\n addChange(\n createReplaceChange(\n sourceFile,\n connectOutsideZone.name,\n 'connectOutsideZone',\n 'connectInZone'\n )\n );\n addChange(\n createReplaceChange(\n sourceFile,\n connectOutsideZone.initializer,\n currentValue,\n currentValue === 'true'\n ? 'false'\n : currentValue === 'false'\n ? 'true'\n : `!${currentValue}`\n )\n );\n }\n}\n\nfunction createDevtoolsConfig(\n sourceFile: ts.SourceFile,\n callExpression: ts.CallExpression,\n addChange: (...items: Change[]) => number\n) {\n addChange(\n new InsertChange(\n sourceFile.fileName,\n callExpression.getEnd() - 1,\n `{connectInZone: true}`\n )\n );\n}\n\nexport default function (): Rule {\n return chain([migrate()]);\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
- var schematics_core_1 = require("../../schematics-core");
4
+ const schematics_core_1 = require("../../schematics-core");
5
5
  function default_1() {
6
6
  return (0, schematics_core_1.updatePackage)('store-devtools');
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/6_0_0/index.ts"],"names":[],"mappings":";;AAGA,4BAEC;AAJD,yDAAsD;AAEtD;IACE,OAAO,IAAA,+BAAa,EAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { Rule } from '@angular-devkit/schematics';\nimport { updatePackage } from '../../schematics-core';\n\nexport default function (): Rule {\n return updatePackage('store-devtools');\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/6_0_0/index.ts"],"names":[],"mappings":";;AAGA,4BAEC;AAJD,2DAAsD;AAEtD;IACE,OAAO,IAAA,+BAAa,EAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { Rule } from '@angular-devkit/schematics';\nimport { updatePackage } from '../../schematics-core';\n\nexport default function (): Rule {\n return updatePackage('store-devtools');\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrx/store-devtools",
3
- "version": "20.1.0",
3
+ "version": "21.0.0-rc.0",
4
4
  "description": "Developer tools for @ngrx/store",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "homepage": "https://github.com/ngrx/platform#readme",
22
22
  "peerDependencies": {
23
- "@angular/core": "^20.0.0",
24
- "@ngrx/store": "20.1.0",
23
+ "@angular/core": "^21.0.0",
24
+ "@ngrx/store": "21.0.0-rc.0",
25
25
  "rxjs": "^6.5.3 || ^7.5.0"
26
26
  },
27
27
  "schematics": "./schematics/collection.json",
@@ -48,13 +48,13 @@
48
48
  "tslib": "^2.0.0"
49
49
  },
50
50
  "module": "fesm2022/ngrx-store-devtools.mjs",
51
- "typings": "index.d.ts",
51
+ "typings": "types/ngrx-store-devtools.d.ts",
52
52
  "exports": {
53
53
  "./package.json": {
54
54
  "default": "./package.json"
55
55
  },
56
56
  ".": {
57
- "types": "./index.d.ts",
57
+ "types": "./types/ngrx-store-devtools.d.ts",
58
58
  "default": "./fesm2022/ngrx-store-devtools.mjs"
59
59
  }
60
60
  }
@@ -1,135 +1,119 @@
1
1
  "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
7
  }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __values = (this && this.__values) || function(o) {
19
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
20
- if (m) return m.call(o);
21
- if (o && typeof o.length === "number") return {
22
- next: function () {
23
- if (o && i >= o.length) o = void 0;
24
- return { value: o && o[i++], done: !o };
25
- }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
26
33
  };
27
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
28
- };
34
+ })();
29
35
  Object.defineProperty(exports, "__esModule", { value: true });
30
36
  exports.default = default_1;
31
- var ts = require("typescript");
32
- var schematics_1 = require("@angular-devkit/schematics");
33
- var tasks_1 = require("@angular-devkit/schematics/tasks");
34
- var schematics_core_1 = require("../../schematics-core");
35
- var standalone_1 = require("../../schematics-core/utility/standalone");
36
- var project_1 = require("../../schematics-core/utility/project");
37
- var ng_ast_utils_1 = require("@schematics/angular/utility/ng-ast-utils");
37
+ const ts = __importStar(require("typescript"));
38
+ const schematics_1 = require("@angular-devkit/schematics");
39
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
40
+ const schematics_core_1 = require("../../schematics-core");
41
+ const standalone_1 = require("../../schematics-core/utility/standalone");
42
+ const project_1 = require("../../schematics-core/utility/project");
43
+ const ng_ast_utils_1 = require("@schematics/angular/utility/ng-ast-utils");
38
44
  function addImportToNgModule(options) {
39
- return function (host) {
40
- var e_1, _a;
41
- var modulePath = options.module;
45
+ return (host) => {
46
+ const modulePath = options.module;
42
47
  if (!modulePath) {
43
48
  return host;
44
49
  }
45
50
  if (!host.exists(modulePath)) {
46
51
  throw new Error('Specified module does not exist');
47
52
  }
48
- var text = host.read(modulePath);
53
+ const text = host.read(modulePath);
49
54
  if (text === null) {
50
- throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist."));
55
+ throw new schematics_1.SchematicsException(`File ${modulePath} does not exist.`);
51
56
  }
52
- var sourceText = text.toString('utf-8');
53
- var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
54
- var _b = __read((0, schematics_core_1.addImportToModule)(source, modulePath, "StoreDevtoolsModule.instrument({ maxAge: ".concat(options.maxAge, ", logOnly: !isDevMode() })"), modulePath), 1), instrumentNgModuleImport = _b[0];
55
- var changes = [
57
+ const sourceText = text.toString('utf-8');
58
+ const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
59
+ const [instrumentNgModuleImport] = (0, schematics_core_1.addImportToModule)(source, modulePath, `StoreDevtoolsModule.instrument({ maxAge: ${options.maxAge}, logOnly: !isDevMode() })`, modulePath);
60
+ const changes = [
56
61
  (0, schematics_core_1.insertImport)(source, modulePath, 'StoreDevtoolsModule', '@ngrx/store-devtools'),
57
62
  (0, schematics_core_1.insertImport)(source, modulePath, 'isDevMode', '@angular/core'),
58
63
  instrumentNgModuleImport,
59
64
  ];
60
- var recorder = host.beginUpdate(modulePath);
61
- try {
62
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
63
- var change = changes_1_1.value;
64
- if (change instanceof schematics_core_1.InsertChange) {
65
- recorder.insertLeft(change.pos, change.toAdd);
66
- }
65
+ const recorder = host.beginUpdate(modulePath);
66
+ for (const change of changes) {
67
+ if (change instanceof schematics_core_1.InsertChange) {
68
+ recorder.insertLeft(change.pos, change.toAdd);
67
69
  }
68
70
  }
69
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
70
- finally {
71
- try {
72
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
73
- }
74
- finally { if (e_1) throw e_1.error; }
75
- }
76
71
  host.commitUpdate(recorder);
77
72
  return host;
78
73
  };
79
74
  }
80
75
  function addNgRxStoreDevToolsToPackageJson() {
81
- return function (host, context) {
76
+ return (host, context) => {
82
77
  (0, schematics_core_1.addPackageToPackageJson)(host, 'dependencies', '@ngrx/store-devtools', schematics_core_1.platformVersion);
83
78
  context.addTask(new tasks_1.NodePackageInstallTask());
84
79
  return host;
85
80
  };
86
81
  }
87
82
  function addStandaloneConfig(options) {
88
- return function (host) {
89
- var e_2, _a;
90
- var mainFile = (0, project_1.getProjectMainFile)(host, options);
83
+ return (host) => {
84
+ const mainFile = (0, project_1.getProjectMainFile)(host, options);
91
85
  if (host.exists(mainFile)) {
92
- var providerFn = 'provideStoreDevtools';
86
+ const providerFn = 'provideStoreDevtools';
93
87
  if ((0, standalone_1.callsProvidersFunction)(host, mainFile, providerFn)) {
94
88
  // exit because the store config is already provided
95
89
  return host;
96
90
  }
97
- var providerOptions = [
98
- ts.factory.createIdentifier("{ maxAge: ".concat(options.maxAge, ", logOnly: !isDevMode() }")),
91
+ const providerOptions = [
92
+ ts.factory.createIdentifier(`{ maxAge: ${options.maxAge}, logOnly: !isDevMode() }`),
99
93
  ];
100
- var patchedConfigFile = (0, standalone_1.addFunctionalProvidersToStandaloneBootstrap)(host, mainFile, providerFn, '@ngrx/store-devtools', providerOptions);
94
+ const patchedConfigFile = (0, standalone_1.addFunctionalProvidersToStandaloneBootstrap)(host, mainFile, providerFn, '@ngrx/store-devtools', providerOptions);
101
95
  // insert reducers import into the patched file
102
- var configFileContent = host.read(patchedConfigFile);
103
- var source = ts.createSourceFile(patchedConfigFile, (configFileContent === null || configFileContent === void 0 ? void 0 : configFileContent.toString('utf-8')) || '', ts.ScriptTarget.Latest, true);
104
- var recorder = host.beginUpdate(patchedConfigFile);
105
- var changes = [
96
+ const configFileContent = host.read(patchedConfigFile);
97
+ const source = ts.createSourceFile(patchedConfigFile, configFileContent?.toString('utf-8') || '', ts.ScriptTarget.Latest, true);
98
+ const recorder = host.beginUpdate(patchedConfigFile);
99
+ const changes = [
106
100
  (0, schematics_core_1.insertImport)(source, patchedConfigFile, 'isDevMode', '@angular/core'),
107
101
  ];
108
- try {
109
- for (var changes_2 = __values(changes), changes_2_1 = changes_2.next(); !changes_2_1.done; changes_2_1 = changes_2.next()) {
110
- var change = changes_2_1.value;
111
- if (change instanceof schematics_core_1.InsertChange) {
112
- recorder.insertLeft(change.pos, change.toAdd);
113
- }
114
- }
115
- }
116
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
117
- finally {
118
- try {
119
- if (changes_2_1 && !changes_2_1.done && (_a = changes_2.return)) _a.call(changes_2);
102
+ for (const change of changes) {
103
+ if (change instanceof schematics_core_1.InsertChange) {
104
+ recorder.insertLeft(change.pos, change.toAdd);
120
105
  }
121
- finally { if (e_2) throw e_2.error; }
122
106
  }
123
107
  host.commitUpdate(recorder);
124
108
  return host;
125
109
  }
126
- throw new schematics_1.SchematicsException("Main file not found for a project ".concat(options.project));
110
+ throw new schematics_1.SchematicsException(`Main file not found for a project ${options.project}`);
127
111
  };
128
112
  }
129
113
  function default_1(options) {
130
- return function (host, context) {
131
- var mainFile = (0, project_1.getProjectMainFile)(host, options);
132
- var isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, mainFile);
114
+ return (host, context) => {
115
+ const mainFile = (0, project_1.getProjectMainFile)(host, options);
116
+ const isStandalone = (0, ng_ast_utils_1.isStandaloneApp)(host, mainFile);
133
117
  options.path = (0, schematics_core_1.getProjectPath)(host, options);
134
118
  if (options.module && !isStandalone) {
135
119
  options.module = (0, schematics_core_1.findModuleFromOptions)(host, {
@@ -138,12 +122,12 @@ function default_1(options) {
138
122
  path: options.path,
139
123
  });
140
124
  }
141
- var parsedPath = (0, schematics_core_1.parseName)(options.path, '');
125
+ const parsedPath = (0, schematics_core_1.parseName)(options.path, '');
142
126
  options.path = parsedPath.path;
143
127
  if (options.maxAge && (options.maxAge < 0 || options.maxAge === 1)) {
144
- throw new schematics_1.SchematicsException("maxAge should be an integer greater than 1.");
128
+ throw new schematics_1.SchematicsException(`maxAge should be an integer greater than 1.`);
145
129
  }
146
- var configOrModuleUpdate = isStandalone
130
+ const configOrModuleUpdate = isStandalone
147
131
  ? addStandaloneConfig(options)
148
132
  : addImportToNgModule(options);
149
133
  return (0, schematics_1.chain)([
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2JA,4BAmCC;AA9LD,+BAAiC;AACjC,yDAQoC;AACpC,0DAA0E;AAC1E,yDAS+B;AAE/B,uEAGkD;AAClD,iEAA2E;AAC3E,yEAA2E;AAE3E,SAAS,mBAAmB,CAAC,OAA6B;IACxD,OAAO,UAAC,I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AAO,CAAC,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;QAED,IAAM,UAAU,GAAG,IAAA,2BAAS,EAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,gCAAmB,CAC3B,6CAA6C,CAC9C,CAAC;QACJ,CAAC;QAED,IAAM,oBAAoB,GAAG,YAAY;YACvC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,2BAAc,EAAC,IAAA,kBAAK,EAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;YAC7C,OAAO,IAAI,OAAO,CAAC,eAAe;gBAChC,CAAC,CAAC,IAAA,iBAAI,GAAE;gBACR,CAAC,CAAC,iCAAiC,EAAE;SACxC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport {\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n branchAndMerge,\n chain,\n noop,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport {\n InsertChange,\n addImportToModule,\n findModuleFromOptions,\n getProjectPath,\n insertImport,\n addPackageToPackageJson,\n platformVersion,\n parseName,\n} from '../../schematics-core';\nimport { Schema as StoreDevtoolsOptions } from './schema';\nimport {\n addFunctionalProvidersToStandaloneBootstrap,\n callsProvidersFunction,\n} from '../../schematics-core/utility/standalone';\nimport { getProjectMainFile } from '../../schematics-core/utility/project';\nimport { isStandaloneApp } from '@schematics/angular/utility/ng-ast-utils';\n\nfunction addImportToNgModule(options: StoreDevtoolsOptions): Rule {\n return (host: Tree) => {\n const modulePath = options.module;\n\n if (!modulePath) {\n return host;\n }\n\n if (!host.exists(modulePath)) {\n throw new Error('Specified module does not exist');\n }\n\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n modulePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const [instrumentNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreDevtoolsModule.instrument({ maxAge: ${options.maxAge}, logOnly: !isDevMode() })`,\n modulePath\n );\n\n const changes = [\n insertImport(\n source,\n modulePath,\n 'StoreDevtoolsModule',\n '@ngrx/store-devtools'\n ),\n insertImport(source, modulePath, 'isDevMode', '@angular/core'),\n instrumentNgModuleImport,\n ];\n const recorder = host.beginUpdate(modulePath);\n\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\nfunction addNgRxStoreDevToolsToPackageJson() {\n return (host: Tree, context: SchematicContext) => {\n addPackageToPackageJson(\n host,\n 'dependencies',\n '@ngrx/store-devtools',\n platformVersion\n );\n context.addTask(new NodePackageInstallTask());\n return host;\n };\n}\n\nfunction addStandaloneConfig(options: StoreDevtoolsOptions): Rule {\n return (host: Tree) => {\n const mainFile = getProjectMainFile(host, options);\n\n if (host.exists(mainFile)) {\n const providerFn = 'provideStoreDevtools';\n\n if (callsProvidersFunction(host, mainFile, providerFn)) {\n // exit because the store config is already provided\n return host;\n }\n\n const providerOptions = [\n ts.factory.createIdentifier(\n `{ maxAge: ${options.maxAge}, logOnly: !isDevMode() }`\n ),\n ];\n\n const patchedConfigFile = addFunctionalProvidersToStandaloneBootstrap(\n host,\n mainFile,\n providerFn,\n '@ngrx/store-devtools',\n providerOptions\n );\n\n // insert reducers import into the patched file\n const configFileContent = host.read(patchedConfigFile);\n const source = ts.createSourceFile(\n patchedConfigFile,\n configFileContent?.toString('utf-8') || '',\n ts.ScriptTarget.Latest,\n true\n );\n\n const recorder = host.beginUpdate(patchedConfigFile);\n\n const changes = [\n insertImport(source, patchedConfigFile, 'isDevMode', '@angular/core'),\n ];\n\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n\n host.commitUpdate(recorder);\n\n return host;\n }\n\n throw new SchematicsException(\n `Main file not found for a project ${options.project}`\n );\n };\n}\n\nexport default function (options: StoreDevtoolsOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n const mainFile = getProjectMainFile(host, options);\n const isStandalone = isStandaloneApp(host, mainFile);\n\n options.path = getProjectPath(host, options);\n\n if (options.module && !isStandalone) {\n options.module = findModuleFromOptions(host, {\n name: '',\n module: options.module,\n path: options.path,\n });\n }\n\n const parsedPath = parseName(options.path, '');\n options.path = parsedPath.path;\n\n if (options.maxAge && (options.maxAge < 0 || options.maxAge === 1)) {\n throw new SchematicsException(\n `maxAge should be an integer greater than 1.`\n );\n }\n\n const configOrModuleUpdate = isStandalone\n ? addStandaloneConfig(options)\n : addImportToNgModule(options);\n\n return chain([\n branchAndMerge(chain([configOrModuleUpdate])),\n options && options.skipPackageJson\n ? noop()\n : addNgRxStoreDevToolsToPackageJson(),\n ])(host, context);\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2JA,4BAmCC;AA9LD,+CAAiC;AACjC,2DAQoC;AACpC,4DAA0E;AAC1E,2DAS+B;AAE/B,yEAGkD;AAClD,mEAA2E;AAC3E,2EAA2E;AAE3E,SAAS,mBAAmB,CAAC,OAA6B;IACxD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,MAAM,UAAU,GAAG,OAAO,CAA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,CAAC,IAAI,CAAC;QAE/B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,gCAAmB,CAC3B,6CAA6C,CAC9C,CAAC;QACJ,CAAC;QAED,MAAM,oBAAoB,GAAG,YAAY;YACvC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAC9B,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEjC,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,2BAAc,EAAC,IAAA,kBAAK,EAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;YAC7C,OAAO,IAAI,OAAO,CAAC,eAAe;gBAChC,CAAC,CAAC,IAAA,iBAAI,GAAE;gBACR,CAAC,CAAC,iCAAiC,EAAE;SACxC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import * as ts from 'typescript';\nimport {\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n branchAndMerge,\n chain,\n noop,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport {\n InsertChange,\n addImportToModule,\n findModuleFromOptions,\n getProjectPath,\n insertImport,\n addPackageToPackageJson,\n platformVersion,\n parseName,\n} from '../../schematics-core';\nimport { Schema as StoreDevtoolsOptions } from './schema';\nimport {\n addFunctionalProvidersToStandaloneBootstrap,\n callsProvidersFunction,\n} from '../../schematics-core/utility/standalone';\nimport { getProjectMainFile } from '../../schematics-core/utility/project';\nimport { isStandaloneApp } from '@schematics/angular/utility/ng-ast-utils';\n\nfunction addImportToNgModule(options: StoreDevtoolsOptions): Rule {\n return (host: Tree) => {\n const modulePath = options.module;\n\n if (!modulePath) {\n return host;\n }\n\n if (!host.exists(modulePath)) {\n throw new Error('Specified module does not exist');\n }\n\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n modulePath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const [instrumentNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreDevtoolsModule.instrument({ maxAge: ${options.maxAge}, logOnly: !isDevMode() })`,\n modulePath\n );\n\n const changes = [\n insertImport(\n source,\n modulePath,\n 'StoreDevtoolsModule',\n '@ngrx/store-devtools'\n ),\n insertImport(source, modulePath, 'isDevMode', '@angular/core'),\n instrumentNgModuleImport,\n ];\n const recorder = host.beginUpdate(modulePath);\n\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(recorder);\n\n return host;\n };\n}\n\nfunction addNgRxStoreDevToolsToPackageJson() {\n return (host: Tree, context: SchematicContext) => {\n addPackageToPackageJson(\n host,\n 'dependencies',\n '@ngrx/store-devtools',\n platformVersion\n );\n context.addTask(new NodePackageInstallTask());\n return host;\n };\n}\n\nfunction addStandaloneConfig(options: StoreDevtoolsOptions): Rule {\n return (host: Tree) => {\n const mainFile = getProjectMainFile(host, options);\n\n if (host.exists(mainFile)) {\n const providerFn = 'provideStoreDevtools';\n\n if (callsProvidersFunction(host, mainFile, providerFn)) {\n // exit because the store config is already provided\n return host;\n }\n\n const providerOptions = [\n ts.factory.createIdentifier(\n `{ maxAge: ${options.maxAge}, logOnly: !isDevMode() }`\n ),\n ];\n\n const patchedConfigFile = addFunctionalProvidersToStandaloneBootstrap(\n host,\n mainFile,\n providerFn,\n '@ngrx/store-devtools',\n providerOptions\n );\n\n // insert reducers import into the patched file\n const configFileContent = host.read(patchedConfigFile);\n const source = ts.createSourceFile(\n patchedConfigFile,\n configFileContent?.toString('utf-8') || '',\n ts.ScriptTarget.Latest,\n true\n );\n\n const recorder = host.beginUpdate(patchedConfigFile);\n\n const changes = [\n insertImport(source, patchedConfigFile, 'isDevMode', '@angular/core'),\n ];\n\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n }\n\n host.commitUpdate(recorder);\n\n return host;\n }\n\n throw new SchematicsException(\n `Main file not found for a project ${options.project}`\n );\n };\n}\n\nexport default function (options: StoreDevtoolsOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n const mainFile = getProjectMainFile(host, options);\n const isStandalone = isStandaloneApp(host, mainFile);\n\n options.path = getProjectPath(host, options);\n\n if (options.module && !isStandalone) {\n options.module = findModuleFromOptions(host, {\n name: '',\n module: options.module,\n path: options.path,\n });\n }\n\n const parsedPath = parseName(options.path, '');\n options.path = parsedPath.path;\n\n if (options.maxAge && (options.maxAge < 0 || options.maxAge === 1)) {\n throw new SchematicsException(\n `maxAge should be an integer greater than 1.`\n );\n }\n\n const configOrModuleUpdate = isStandalone\n ? addStandaloneConfig(options)\n : addImportToNgModule(options);\n\n return chain([\n branchAndMerge(chain([configOrModuleUpdate])),\n options && options.skipPackageJson\n ? noop()\n : addNgRxStoreDevToolsToPackageJson(),\n ])(host, context);\n };\n}\n"]}