@ngrx/store-devtools 20.1.0 → 21.0.0-beta.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.
- package/fesm2022/ngrx-store-devtools.mjs +13 -13
- package/migrations/17_0_0-beta/index.js +11 -14
- package/migrations/17_0_0-beta/index.js.map +1 -1
- package/migrations/6_0_0/index.js +3 -6
- package/migrations/6_0_0/index.js.map +1 -1
- package/package.json +5 -5
- package/schematics/ng-add/index.js +30 -33
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.js +0 -2
- package/schematics-core/index.js +24 -75
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +28 -44
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +8 -15
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +4 -8
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +17 -22
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +19 -24
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +1 -4
- package/schematics-core/utility/json-utilts.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -4
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +28 -36
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +1 -4
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +5 -8
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +9 -15
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/standalone.js +13 -18
- package/schematics-core/utility/standalone.js.map +1 -1
- package/schematics-core/utility/strings.js +9 -20
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +4 -7
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +16 -30
- package/schematics-core/utility/visitors.js.map +1 -1
- package/types/ngrx-store-devtools.d.ts +252 -0
- package/index.d.ts +0 -6
- package/public_api.d.ts +0 -1
- package/src/actions.d.ts +0 -79
- package/src/config.d.ts +0 -126
- package/src/devtools-dispatcher.d.ts +0 -6
- package/src/devtools.d.ts +0 -35
- package/src/extension.d.ts +0 -52
- package/src/index.d.ts +0 -6
- package/src/instrument.d.ts +0 -9
- package/src/provide-store-devtools.d.ts +0 -26
- package/src/reducer.d.ts +0 -47
- package/src/utils.d.ts +0 -42
- 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: "
|
|
294
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
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: "
|
|
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: "
|
|
449
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
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: "
|
|
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: "
|
|
927
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
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: "
|
|
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: "
|
|
1028
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1029
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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: "
|
|
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,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __read = (this && this.__read) || function (o, n) {
|
|
3
2
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
3
|
if (!m) return o;
|
|
@@ -24,14 +23,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
24
23
|
}
|
|
25
24
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var schematics_1 = require("@angular-devkit/schematics");
|
|
31
|
-
var schematics_core_1 = require("../..//schematics-core");
|
|
26
|
+
import * as ts from 'typescript';
|
|
27
|
+
import { chain } from '@angular-devkit/schematics';
|
|
28
|
+
import { visitTSSourceFiles, commitChanges, InsertChange, createReplaceChange, } from '../..//schematics-core';
|
|
32
29
|
function migrate() {
|
|
33
30
|
return function (tree) {
|
|
34
|
-
|
|
31
|
+
visitTSSourceFiles(tree, function (sourceFile) {
|
|
35
32
|
var devtoolsImports = sourceFile.statements
|
|
36
33
|
.filter(ts.isImportDeclaration)
|
|
37
34
|
.filter(function (_a) {
|
|
@@ -42,7 +39,7 @@ function migrate() {
|
|
|
42
39
|
return;
|
|
43
40
|
}
|
|
44
41
|
var changes = __spreadArray([], __read(findAndUpdateConfigs(sourceFile)), false);
|
|
45
|
-
|
|
42
|
+
commitChanges(tree, sourceFile.fileName, changes);
|
|
46
43
|
});
|
|
47
44
|
};
|
|
48
45
|
}
|
|
@@ -111,14 +108,14 @@ function updateConfig(sourceFile, devtoolsConfig, addChange) {
|
|
|
111
108
|
.endsWith(',')
|
|
112
109
|
? ''
|
|
113
110
|
: ',';
|
|
114
|
-
addChange(new
|
|
111
|
+
addChange(new InsertChange(sourceFile.fileName, devtoolsConfig.getEnd() - 1, "".concat(comma, " connectInZone: true").trim()));
|
|
115
112
|
}
|
|
116
113
|
function replaceConnectOutsideZoneConfig(connectOutsideZone) {
|
|
117
114
|
var currentValue = connectOutsideZone.initializer
|
|
118
115
|
.getText(sourceFile)
|
|
119
116
|
.trim();
|
|
120
|
-
addChange(
|
|
121
|
-
addChange(
|
|
117
|
+
addChange(createReplaceChange(sourceFile, connectOutsideZone.name, 'connectOutsideZone', 'connectInZone'));
|
|
118
|
+
addChange(createReplaceChange(sourceFile, connectOutsideZone.initializer, currentValue, currentValue === 'true'
|
|
122
119
|
? 'false'
|
|
123
120
|
: currentValue === 'false'
|
|
124
121
|
? 'true'
|
|
@@ -126,9 +123,9 @@ function updateConfig(sourceFile, devtoolsConfig, addChange) {
|
|
|
126
123
|
}
|
|
127
124
|
}
|
|
128
125
|
function createDevtoolsConfig(sourceFile, callExpression, addChange) {
|
|
129
|
-
addChange(new
|
|
126
|
+
addChange(new InsertChange(sourceFile.fileName, callExpression.getEnd() - 1, "{connectInZone: true}"));
|
|
130
127
|
}
|
|
131
|
-
function
|
|
132
|
-
return
|
|
128
|
+
export default function () {
|
|
129
|
+
return chain([migrate()]);
|
|
133
130
|
}
|
|
134
131
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/17_0_0-beta/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/17_0_0-beta/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,YAA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IACJ,CAAC;IAED,SAAS,+BAA+B,CACtC,kBAAyC;QAEzC,IAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW;aAChD,OAAO,CAAC,UAAU,CAAC;aACnB,IAAI,EAAE,CAAC;QACV,SAAS,CACP,mBAAmB,CACjB,UAAU,EACV,kBAAkB,CAAC,IAAI,EACvB,oBAAoB,EACpB,eAAe,CAChB,CACF,CAAC;QACF,SAAS,CACP,mBAAmB,CACjB,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,WAAI,YAAY,CAAE,CACzB,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,UAAyB,EACzB,cAAiC,EACjC,SAAyC;IAEzC,SAAS,CACP,IAAI,YAAY,CACd,UAAU,CAAC,QAAQ,EACnB,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,uBAAuB,CACxB,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO;IACZ,OAAO,KAAK,CAAC,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,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var schematics_core_1 = require("../../schematics-core");
|
|
5
|
-
function default_1() {
|
|
6
|
-
return (0, schematics_core_1.updatePackage)('store-devtools');
|
|
1
|
+
import { updatePackage } from '../../schematics-core';
|
|
2
|
+
export default function () {
|
|
3
|
+
return updatePackage('store-devtools');
|
|
7
4
|
}
|
|
8
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/6_0_0/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/migrations/6_0_0/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,OAAO;IACZ,OAAO,aAAa,CAAC,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": "
|
|
3
|
+
"version": "21.0.0-beta.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": "^
|
|
24
|
-
"@ngrx/store": "
|
|
23
|
+
"@angular/core": "^21.0.0",
|
|
24
|
+
"@ngrx/store": "21.0.0-beta.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": "
|
|
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": "./
|
|
57
|
+
"types": "./types/ngrx-store-devtools.d.ts",
|
|
58
58
|
"default": "./fesm2022/ngrx-store-devtools.mjs"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __read = (this && this.__read) || function (o, n) {
|
|
3
2
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
3
|
if (!m) return o;
|
|
@@ -26,15 +25,13 @@ var __values = (this && this.__values) || function(o) {
|
|
|
26
25
|
};
|
|
27
26
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
28
27
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var project_1 = require("../../schematics-core/utility/project");
|
|
37
|
-
var ng_ast_utils_1 = require("@schematics/angular/utility/ng-ast-utils");
|
|
28
|
+
import * as ts from 'typescript';
|
|
29
|
+
import { SchematicsException, branchAndMerge, chain, noop, } from '@angular-devkit/schematics';
|
|
30
|
+
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
|
31
|
+
import { InsertChange, addImportToModule, findModuleFromOptions, getProjectPath, insertImport, addPackageToPackageJson, platformVersion, parseName, } from '../../schematics-core';
|
|
32
|
+
import { addFunctionalProvidersToStandaloneBootstrap, callsProvidersFunction, } from '../../schematics-core/utility/standalone';
|
|
33
|
+
import { getProjectMainFile } from '../../schematics-core/utility/project';
|
|
34
|
+
import { isStandaloneApp } from '@schematics/angular/utility/ng-ast-utils';
|
|
38
35
|
function addImportToNgModule(options) {
|
|
39
36
|
return function (host) {
|
|
40
37
|
var e_1, _a;
|
|
@@ -47,21 +44,21 @@ function addImportToNgModule(options) {
|
|
|
47
44
|
}
|
|
48
45
|
var text = host.read(modulePath);
|
|
49
46
|
if (text === null) {
|
|
50
|
-
throw new
|
|
47
|
+
throw new SchematicsException("File ".concat(modulePath, " does not exist."));
|
|
51
48
|
}
|
|
52
49
|
var sourceText = text.toString('utf-8');
|
|
53
50
|
var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
|
|
54
|
-
var _b = __read(
|
|
51
|
+
var _b = __read(addImportToModule(source, modulePath, "StoreDevtoolsModule.instrument({ maxAge: ".concat(options.maxAge, ", logOnly: !isDevMode() })"), modulePath), 1), instrumentNgModuleImport = _b[0];
|
|
55
52
|
var changes = [
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
insertImport(source, modulePath, 'StoreDevtoolsModule', '@ngrx/store-devtools'),
|
|
54
|
+
insertImport(source, modulePath, 'isDevMode', '@angular/core'),
|
|
58
55
|
instrumentNgModuleImport,
|
|
59
56
|
];
|
|
60
57
|
var recorder = host.beginUpdate(modulePath);
|
|
61
58
|
try {
|
|
62
59
|
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
|
|
63
60
|
var change = changes_1_1.value;
|
|
64
|
-
if (change instanceof
|
|
61
|
+
if (change instanceof InsertChange) {
|
|
65
62
|
recorder.insertLeft(change.pos, change.toAdd);
|
|
66
63
|
}
|
|
67
64
|
}
|
|
@@ -79,36 +76,36 @@ function addImportToNgModule(options) {
|
|
|
79
76
|
}
|
|
80
77
|
function addNgRxStoreDevToolsToPackageJson() {
|
|
81
78
|
return function (host, context) {
|
|
82
|
-
|
|
83
|
-
context.addTask(new
|
|
79
|
+
addPackageToPackageJson(host, 'dependencies', '@ngrx/store-devtools', platformVersion);
|
|
80
|
+
context.addTask(new NodePackageInstallTask());
|
|
84
81
|
return host;
|
|
85
82
|
};
|
|
86
83
|
}
|
|
87
84
|
function addStandaloneConfig(options) {
|
|
88
85
|
return function (host) {
|
|
89
86
|
var e_2, _a;
|
|
90
|
-
var mainFile =
|
|
87
|
+
var mainFile = getProjectMainFile(host, options);
|
|
91
88
|
if (host.exists(mainFile)) {
|
|
92
89
|
var providerFn = 'provideStoreDevtools';
|
|
93
|
-
if (
|
|
90
|
+
if (callsProvidersFunction(host, mainFile, providerFn)) {
|
|
94
91
|
// exit because the store config is already provided
|
|
95
92
|
return host;
|
|
96
93
|
}
|
|
97
94
|
var providerOptions = [
|
|
98
95
|
ts.factory.createIdentifier("{ maxAge: ".concat(options.maxAge, ", logOnly: !isDevMode() }")),
|
|
99
96
|
];
|
|
100
|
-
var patchedConfigFile =
|
|
97
|
+
var patchedConfigFile = addFunctionalProvidersToStandaloneBootstrap(host, mainFile, providerFn, '@ngrx/store-devtools', providerOptions);
|
|
101
98
|
// insert reducers import into the patched file
|
|
102
99
|
var configFileContent = host.read(patchedConfigFile);
|
|
103
100
|
var source = ts.createSourceFile(patchedConfigFile, (configFileContent === null || configFileContent === void 0 ? void 0 : configFileContent.toString('utf-8')) || '', ts.ScriptTarget.Latest, true);
|
|
104
101
|
var recorder = host.beginUpdate(patchedConfigFile);
|
|
105
102
|
var changes = [
|
|
106
|
-
|
|
103
|
+
insertImport(source, patchedConfigFile, 'isDevMode', '@angular/core'),
|
|
107
104
|
];
|
|
108
105
|
try {
|
|
109
106
|
for (var changes_2 = __values(changes), changes_2_1 = changes_2.next(); !changes_2_1.done; changes_2_1 = changes_2.next()) {
|
|
110
107
|
var change = changes_2_1.value;
|
|
111
|
-
if (change instanceof
|
|
108
|
+
if (change instanceof InsertChange) {
|
|
112
109
|
recorder.insertLeft(change.pos, change.toAdd);
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -123,33 +120,33 @@ function addStandaloneConfig(options) {
|
|
|
123
120
|
host.commitUpdate(recorder);
|
|
124
121
|
return host;
|
|
125
122
|
}
|
|
126
|
-
throw new
|
|
123
|
+
throw new SchematicsException("Main file not found for a project ".concat(options.project));
|
|
127
124
|
};
|
|
128
125
|
}
|
|
129
|
-
function
|
|
126
|
+
export default function (options) {
|
|
130
127
|
return function (host, context) {
|
|
131
|
-
var mainFile =
|
|
132
|
-
var isStandalone =
|
|
133
|
-
options.path =
|
|
128
|
+
var mainFile = getProjectMainFile(host, options);
|
|
129
|
+
var isStandalone = isStandaloneApp(host, mainFile);
|
|
130
|
+
options.path = getProjectPath(host, options);
|
|
134
131
|
if (options.module && !isStandalone) {
|
|
135
|
-
options.module =
|
|
132
|
+
options.module = findModuleFromOptions(host, {
|
|
136
133
|
name: '',
|
|
137
134
|
module: options.module,
|
|
138
135
|
path: options.path,
|
|
139
136
|
});
|
|
140
137
|
}
|
|
141
|
-
var parsedPath =
|
|
138
|
+
var parsedPath = parseName(options.path, '');
|
|
142
139
|
options.path = parsedPath.path;
|
|
143
140
|
if (options.maxAge && (options.maxAge < 0 || options.maxAge === 1)) {
|
|
144
|
-
throw new
|
|
141
|
+
throw new SchematicsException("maxAge should be an integer greater than 1.");
|
|
145
142
|
}
|
|
146
143
|
var configOrModuleUpdate = isStandalone
|
|
147
144
|
? addStandaloneConfig(options)
|
|
148
145
|
: addImportToNgModule(options);
|
|
149
|
-
return
|
|
150
|
-
|
|
146
|
+
return chain([
|
|
147
|
+
branchAndMerge(chain([configOrModuleUpdate])),
|
|
151
148
|
options && options.skipPackageJson
|
|
152
|
-
?
|
|
149
|
+
? noop()
|
|
153
150
|
: addNgRxStoreDevToolsToPackageJson(),
|
|
154
151
|
])(host, context);
|
|
155
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics/ng-add/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/store-devtools/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAGL,mBAAmB,EAEnB,cAAc,EACd,KAAK,EACL,IAAI,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,SAAS,GACV,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2CAA2C,EAC3C,sBAAsB,GACvB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,SAAS,mBAAm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AC;QACL,CAAC;QAED,IAAM,UAAU,GAAG,SAAS,CAAC,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,mBAAmB,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,KAAK,CAAC;YACX,cAAc,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;YAC7C,OAAO,IAAI,OAAO,CAAC,eAAe;gBAChC,CAAC,CAAC,IAAI,EAAE;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"]}
|
package/schematics-core/index.js
CHANGED
|
@@ -1,77 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var change_1 = require("./utility/change");
|
|
21
|
-
Object.defineProperty(exports, "NoopChange", { enumerable: true, get: function () { return change_1.NoopChange; } });
|
|
22
|
-
Object.defineProperty(exports, "InsertChange", { enumerable: true, get: function () { return change_1.InsertChange; } });
|
|
23
|
-
Object.defineProperty(exports, "RemoveChange", { enumerable: true, get: function () { return change_1.RemoveChange; } });
|
|
24
|
-
Object.defineProperty(exports, "ReplaceChange", { enumerable: true, get: function () { return change_1.ReplaceChange; } });
|
|
25
|
-
Object.defineProperty(exports, "createReplaceChange", { enumerable: true, get: function () { return change_1.createReplaceChange; } });
|
|
26
|
-
Object.defineProperty(exports, "createChangeRecorder", { enumerable: true, get: function () { return change_1.createChangeRecorder; } });
|
|
27
|
-
Object.defineProperty(exports, "commitChanges", { enumerable: true, get: function () { return change_1.commitChanges; } });
|
|
28
|
-
var config_1 = require("./utility/config");
|
|
29
|
-
Object.defineProperty(exports, "getWorkspace", { enumerable: true, get: function () { return config_1.getWorkspace; } });
|
|
30
|
-
Object.defineProperty(exports, "getWorkspacePath", { enumerable: true, get: function () { return config_1.getWorkspacePath; } });
|
|
31
|
-
var find_component_1 = require("./utility/find-component");
|
|
32
|
-
Object.defineProperty(exports, "findComponentFromOptions", { enumerable: true, get: function () { return find_component_1.findComponentFromOptions; } });
|
|
33
|
-
var find_module_1 = require("./utility/find-module");
|
|
34
|
-
Object.defineProperty(exports, "findModule", { enumerable: true, get: function () { return find_module_1.findModule; } });
|
|
35
|
-
Object.defineProperty(exports, "findModuleFromOptions", { enumerable: true, get: function () { return find_module_1.findModuleFromOptions; } });
|
|
36
|
-
Object.defineProperty(exports, "buildRelativePath", { enumerable: true, get: function () { return find_module_1.buildRelativePath; } });
|
|
37
|
-
var json_utilts_1 = require("./utility/json-utilts");
|
|
38
|
-
Object.defineProperty(exports, "findPropertyInAstObject", { enumerable: true, get: function () { return json_utilts_1.findPropertyInAstObject; } });
|
|
39
|
-
var ngrx_utils_1 = require("./utility/ngrx-utils");
|
|
40
|
-
Object.defineProperty(exports, "addReducerToState", { enumerable: true, get: function () { return ngrx_utils_1.addReducerToState; } });
|
|
41
|
-
Object.defineProperty(exports, "addReducerToStateInterface", { enumerable: true, get: function () { return ngrx_utils_1.addReducerToStateInterface; } });
|
|
42
|
-
Object.defineProperty(exports, "addReducerImportToNgModule", { enumerable: true, get: function () { return ngrx_utils_1.addReducerImportToNgModule; } });
|
|
43
|
-
Object.defineProperty(exports, "addReducerToActionReducerMap", { enumerable: true, get: function () { return ngrx_utils_1.addReducerToActionReducerMap; } });
|
|
44
|
-
Object.defineProperty(exports, "omit", { enumerable: true, get: function () { return ngrx_utils_1.omit; } });
|
|
45
|
-
Object.defineProperty(exports, "getPrefix", { enumerable: true, get: function () { return ngrx_utils_1.getPrefix; } });
|
|
46
|
-
var project_1 = require("./utility/project");
|
|
47
|
-
Object.defineProperty(exports, "getProjectPath", { enumerable: true, get: function () { return project_1.getProjectPath; } });
|
|
48
|
-
Object.defineProperty(exports, "getProject", { enumerable: true, get: function () { return project_1.getProject; } });
|
|
49
|
-
Object.defineProperty(exports, "isLib", { enumerable: true, get: function () { return project_1.isLib; } });
|
|
50
|
-
exports.stringUtils = {
|
|
51
|
-
dasherize: strings_1.dasherize,
|
|
52
|
-
decamelize: strings_1.decamelize,
|
|
53
|
-
camelize: strings_1.camelize,
|
|
54
|
-
classify: strings_1.classify,
|
|
55
|
-
underscore: strings_1.underscore,
|
|
56
|
-
group: strings_1.group,
|
|
57
|
-
capitalize: strings_1.capitalize,
|
|
58
|
-
featurePath: strings_1.featurePath,
|
|
59
|
-
pluralize: strings_1.pluralize,
|
|
1
|
+
import { dasherize, decamelize, camelize, classify, underscore, group, capitalize, featurePath, pluralize, } from './utility/strings';
|
|
2
|
+
export { findNodes, getSourceNodes, getDecoratorMetadata, getContentOfKeyLiteral, insertAfterLastOccurrence, insertImport, addBootstrapToModule, addDeclarationToModule, addExportToModule, addImportToModule, addProviderToComponent, addProviderToModule, replaceImport, containsProperty, } from './utility/ast-utils';
|
|
3
|
+
export { NoopChange, InsertChange, RemoveChange, ReplaceChange, createReplaceChange, createChangeRecorder, commitChanges, } from './utility/change';
|
|
4
|
+
export { getWorkspace, getWorkspacePath } from './utility/config';
|
|
5
|
+
export { findComponentFromOptions } from './utility/find-component';
|
|
6
|
+
export { findModule, findModuleFromOptions, buildRelativePath, } from './utility/find-module';
|
|
7
|
+
export { findPropertyInAstObject } from './utility/json-utilts';
|
|
8
|
+
export { addReducerToState, addReducerToStateInterface, addReducerImportToNgModule, addReducerToActionReducerMap, omit, getPrefix, } from './utility/ngrx-utils';
|
|
9
|
+
export { getProjectPath, getProject, isLib } from './utility/project';
|
|
10
|
+
export var stringUtils = {
|
|
11
|
+
dasherize: dasherize,
|
|
12
|
+
decamelize: decamelize,
|
|
13
|
+
camelize: camelize,
|
|
14
|
+
classify: classify,
|
|
15
|
+
underscore: underscore,
|
|
16
|
+
group: group,
|
|
17
|
+
capitalize: capitalize,
|
|
18
|
+
featurePath: featurePath,
|
|
19
|
+
pluralize: pluralize,
|
|
60
20
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Object.defineProperty(exports, "addPackageToPackageJson", { enumerable: true, get: function () { return package_1.addPackageToPackageJson; } });
|
|
67
|
-
var libs_version_1 = require("./utility/libs-version");
|
|
68
|
-
Object.defineProperty(exports, "platformVersion", { enumerable: true, get: function () { return libs_version_1.platformVersion; } });
|
|
69
|
-
var visitors_1 = require("./utility/visitors");
|
|
70
|
-
Object.defineProperty(exports, "visitTSSourceFiles", { enumerable: true, get: function () { return visitors_1.visitTSSourceFiles; } });
|
|
71
|
-
Object.defineProperty(exports, "visitNgModuleImports", { enumerable: true, get: function () { return visitors_1.visitNgModuleImports; } });
|
|
72
|
-
Object.defineProperty(exports, "visitNgModuleExports", { enumerable: true, get: function () { return visitors_1.visitNgModuleExports; } });
|
|
73
|
-
Object.defineProperty(exports, "visitComponents", { enumerable: true, get: function () { return visitors_1.visitComponents; } });
|
|
74
|
-
Object.defineProperty(exports, "visitDecorator", { enumerable: true, get: function () { return visitors_1.visitDecorator; } });
|
|
75
|
-
Object.defineProperty(exports, "visitNgModules", { enumerable: true, get: function () { return visitors_1.visitNgModules; } });
|
|
76
|
-
Object.defineProperty(exports, "visitTemplates", { enumerable: true, get: function () { return visitors_1.visitTemplates; } });
|
|
21
|
+
export { updatePackage } from './utility/update';
|
|
22
|
+
export { parseName } from './utility/parse-name';
|
|
23
|
+
export { addPackageToPackageJson } from './utility/package';
|
|
24
|
+
export { platformVersion } from './utility/libs-version';
|
|
25
|
+
export { visitTSSourceFiles, visitNgModuleImports, visitNgModuleExports, visitComponents, visitDecorator, visitNgModules, visitTemplates, } from './utility/visitors';
|
|
77
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/store-devtools/schematics-core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/store-devtools/schematics-core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAGL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAa,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,iBAAiB,GAElB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,IAAI,EACJ,SAAS,GACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,CAAC,IAAM,WAAW,GAAG;IACzB,SAAS,WAAA;IACT,UAAU,YAAA;IACV,QAAQ,UAAA;IACR,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,KAAK,OAAA;IACL,UAAU,YAAA;IACV,WAAW,aAAA;IACX,SAAS,WAAA;CACV,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC","sourcesContent":["import {\n dasherize,\n decamelize,\n camelize,\n classify,\n underscore,\n group,\n capitalize,\n featurePath,\n pluralize,\n} from './utility/strings';\n\nexport {\n findNodes,\n getSourceNodes,\n getDecoratorMetadata,\n getContentOfKeyLiteral,\n insertAfterLastOccurrence,\n insertImport,\n addBootstrapToModule,\n addDeclarationToModule,\n addExportToModule,\n addImportToModule,\n addProviderToComponent,\n addProviderToModule,\n replaceImport,\n containsProperty,\n} from './utility/ast-utils';\n\nexport {\n Host,\n Change,\n NoopChange,\n InsertChange,\n RemoveChange,\n ReplaceChange,\n createReplaceChange,\n createChangeRecorder,\n commitChanges,\n} from './utility/change';\n\nexport { AppConfig, getWorkspace, getWorkspacePath } from './utility/config';\n\nexport { findComponentFromOptions } from './utility/find-component';\n\nexport {\n findModule,\n findModuleFromOptions,\n buildRelativePath,\n ModuleOptions,\n} from './utility/find-module';\n\nexport { findPropertyInAstObject } from './utility/json-utilts';\n\nexport {\n addReducerToState,\n addReducerToStateInterface,\n addReducerImportToNgModule,\n addReducerToActionReducerMap,\n omit,\n getPrefix,\n} from './utility/ngrx-utils';\n\nexport { getProjectPath, getProject, isLib } from './utility/project';\n\nexport const stringUtils = {\n dasherize,\n decamelize,\n camelize,\n classify,\n underscore,\n group,\n capitalize,\n featurePath,\n pluralize,\n};\n\nexport { updatePackage } from './utility/update';\n\nexport { parseName } from './utility/parse-name';\n\nexport { addPackageToPackageJson } from './utility/package';\n\nexport { platformVersion } from './utility/libs-version';\n\nexport {\n visitTSSourceFiles,\n visitNgModuleImports,\n visitNgModuleExports,\n visitComponents,\n visitDecorator,\n visitNgModules,\n visitTemplates,\n} from './utility/visitors';\n"]}
|