@ngrx/data 15.4.0 → 16.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.
- package/esm2022/src/actions/entity-action-factory.mjs +51 -0
- package/esm2022/src/actions/entity-action-guard.mjs +130 -0
- package/esm2022/src/dataservices/default-data.service.mjs +210 -0
- package/esm2022/src/dataservices/entity-cache-data.service.mjs +147 -0
- package/esm2022/src/dataservices/entity-data.service.mjs +64 -0
- package/esm2022/src/dataservices/http-url-generator.mjs +88 -0
- package/esm2022/src/dataservices/persistence-result-handler.service.mjs +50 -0
- package/esm2022/src/dispatchers/entity-cache-dispatcher.mjs +164 -0
- package/esm2022/src/dispatchers/entity-commands.mjs +2 -0
- package/esm2022/src/dispatchers/entity-dispatcher-default-options.mjs +31 -0
- package/esm2022/src/dispatchers/entity-dispatcher-factory.mjs +68 -0
- package/esm2022/src/effects/entity-cache-effects.mjs +116 -0
- package/esm2022/src/effects/entity-effects.mjs +149 -0
- package/esm2022/src/entity-data-without-effects.module.mjs +28 -0
- package/esm2022/src/entity-data.module.mjs +29 -0
- package/esm2022/src/entity-metadata/entity-definition.service.mjs +94 -0
- package/esm2022/src/entity-services/entity-collection-service-elements-factory.mjs +39 -0
- package/esm2022/src/entity-services/entity-collection-service-factory.mjs +29 -0
- package/esm2022/src/entity-services/entity-services-base.mjs +120 -0
- package/esm2022/src/entity-services/entity-services-elements.mjs +34 -0
- package/esm2022/src/reducers/entity-cache-reducer.mjs +272 -0
- package/esm2022/src/reducers/entity-collection-creator.mjs +38 -0
- package/{esm2020 → esm2022}/src/reducers/entity-collection-reducer-methods.mjs +6 -5
- package/esm2022/src/reducers/entity-collection-reducer-registry.mjs +69 -0
- package/esm2022/src/reducers/entity-collection-reducer.mjs +25 -0
- package/esm2022/src/selectors/entity-selectors$.mjs +53 -0
- package/esm2022/src/selectors/entity-selectors.mjs +97 -0
- package/esm2022/src/utils/correlation-id-generator.mjs +31 -0
- package/esm2022/src/utils/default-logger.mjs +26 -0
- package/esm2022/src/utils/default-pluralizer.mjs +72 -0
- package/{fesm2020 → fesm2022}/ngrx-data.mjs +90 -90
- package/fesm2022/ngrx-data.mjs.map +1 -0
- package/package.json +10 -16
- package/schematics/ng-add/index.js +6 -6
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.js +1 -1
- package/schematics-core/index.js +50 -61
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +3 -3
- package/schematics-core/utility/change.js +2 -2
- package/schematics-core/utility/config.js +1 -1
- package/schematics-core/utility/find-component.js +2 -2
- package/schematics-core/utility/find-module.js +2 -2
- package/schematics-core/utility/json-utilts.js +2 -2
- package/schematics-core/utility/libs-version.js +2 -2
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +3 -3
- package/schematics-core/utility/package.js +1 -1
- package/schematics-core/utility/parse-name.js +2 -2
- package/schematics-core/utility/project.js +1 -1
- package/schematics-core/utility/strings.js +1 -1
- package/schematics-core/utility/update.js +1 -1
- package/schematics-core/utility/visitors.js +7 -7
- package/src/actions/entity-cache-change-set.d.ts +1 -1
- package/src/dataservices/interfaces.d.ts +2 -2
- package/src/dispatchers/entity-commands.d.ts +6 -0
- package/src/entity-metadata/entity-filters.d.ts +1 -1
- package/src/reducers/entity-collection-reducer.d.ts +1 -1
- package/src/reducers/entity-collection.d.ts +1 -1
- package/src/selectors/entity-cache-selector.d.ts +1 -1
- package/esm2020/src/actions/entity-action-factory.mjs +0 -50
- package/esm2020/src/actions/entity-action-guard.mjs +0 -130
- package/esm2020/src/dataservices/default-data.service.mjs +0 -209
- package/esm2020/src/dataservices/entity-cache-data.service.mjs +0 -146
- package/esm2020/src/dataservices/entity-data.service.mjs +0 -63
- package/esm2020/src/dataservices/http-url-generator.mjs +0 -87
- package/esm2020/src/dataservices/persistence-result-handler.service.mjs +0 -49
- package/esm2020/src/dispatchers/entity-cache-dispatcher.mjs +0 -163
- package/esm2020/src/dispatchers/entity-commands.mjs +0 -2
- package/esm2020/src/dispatchers/entity-dispatcher-default-options.mjs +0 -30
- package/esm2020/src/dispatchers/entity-dispatcher-factory.mjs +0 -67
- package/esm2020/src/effects/entity-cache-effects.mjs +0 -115
- package/esm2020/src/effects/entity-effects.mjs +0 -148
- package/esm2020/src/entity-data-without-effects.module.mjs +0 -27
- package/esm2020/src/entity-data.module.mjs +0 -28
- package/esm2020/src/entity-metadata/entity-definition.service.mjs +0 -93
- package/esm2020/src/entity-services/entity-collection-service-elements-factory.mjs +0 -38
- package/esm2020/src/entity-services/entity-collection-service-factory.mjs +0 -28
- package/esm2020/src/entity-services/entity-services-base.mjs +0 -119
- package/esm2020/src/entity-services/entity-services-elements.mjs +0 -33
- package/esm2020/src/reducers/entity-cache-reducer.mjs +0 -271
- package/esm2020/src/reducers/entity-collection-creator.mjs +0 -37
- package/esm2020/src/reducers/entity-collection-reducer-registry.mjs +0 -68
- package/esm2020/src/reducers/entity-collection-reducer.mjs +0 -24
- package/esm2020/src/selectors/entity-selectors$.mjs +0 -52
- package/esm2020/src/selectors/entity-selectors.mjs +0 -96
- package/esm2020/src/utils/correlation-id-generator.mjs +0 -30
- package/esm2020/src/utils/default-logger.mjs +0 -25
- package/esm2020/src/utils/default-pluralizer.mjs +0 -71
- package/fesm2015/ngrx-data.mjs +0 -4956
- package/fesm2015/ngrx-data.mjs.map +0 -1
- package/fesm2020/ngrx-data.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/ngrx-data.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/entity-action-operators.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/entity-action.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/entity-cache-action.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/entity-cache-change-set.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/entity-op.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/merge-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/src/actions/update-response-data.mjs +0 -0
- /package/{esm2020 → esm2022}/src/dataservices/data-service-error.mjs +0 -0
- /package/{esm2020 → esm2022}/src/dataservices/default-data-service-config.mjs +0 -0
- /package/{esm2020 → esm2022}/src/dataservices/interfaces.mjs +0 -0
- /package/{esm2020 → esm2022}/src/dispatchers/entity-dispatcher-base.mjs +0 -0
- /package/{esm2020 → esm2022}/src/dispatchers/entity-dispatcher.mjs +0 -0
- /package/{esm2020 → esm2022}/src/effects/entity-effects-scheduler.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-data-config.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-metadata/entity-definition.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-metadata/entity-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-metadata/entity-metadata.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-services/entity-collection-service-base.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-services/entity-collection-service.mjs +0 -0
- /package/{esm2020 → esm2022}/src/entity-services/entity-services.mjs +0 -0
- /package/{esm2020 → esm2022}/src/index.mjs +0 -0
- /package/{esm2020 → esm2022}/src/provide-entity-data.mjs +0 -0
- /package/{esm2020 → esm2022}/src/reducers/constants.mjs +0 -0
- /package/{esm2020 → esm2022}/src/reducers/entity-cache.mjs +0 -0
- /package/{esm2020 → esm2022}/src/reducers/entity-change-tracker-base.mjs +0 -0
- /package/{esm2020 → esm2022}/src/reducers/entity-change-tracker.mjs +0 -0
- /package/{esm2020 → esm2022}/src/reducers/entity-collection.mjs +0 -0
- /package/{esm2020 → esm2022}/src/selectors/entity-cache-selector.mjs +0 -0
- /package/{esm2020 → esm2022}/src/utils/guid-fns.mjs +0 -0
- /package/{esm2020 → esm2022}/src/utils/interfaces.mjs +0 -0
- /package/{esm2020 → esm2022}/src/utils/utilities.mjs +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrx/data",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0-rc.0",
|
|
4
4
|
"description": "API management for NgRx",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/ngrx/platform#readme",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@angular/common": "^
|
|
24
|
-
"@angular/core": "^
|
|
25
|
-
"@ngrx/store": "
|
|
26
|
-
"@ngrx/effects": "
|
|
27
|
-
"@ngrx/entity": "
|
|
23
|
+
"@angular/common": "^16.0.0",
|
|
24
|
+
"@angular/core": "^16.0.0",
|
|
25
|
+
"@ngrx/store": "16.0.0-rc.0",
|
|
26
|
+
"@ngrx/effects": "16.0.0-rc.0",
|
|
27
|
+
"@ngrx/entity": "16.0.0-rc.0",
|
|
28
28
|
"rxjs": "^6.5.3 || ^7.5.0"
|
|
29
29
|
},
|
|
30
30
|
"schematics": "./schematics/collection.json",
|
|
@@ -47,11 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"tslib": "^2.0.0"
|
|
49
49
|
},
|
|
50
|
-
"module": "
|
|
51
|
-
"es2020": "fesm2020/ngrx-data.mjs",
|
|
52
|
-
"esm2020": "esm2020/ngrx-data.mjs",
|
|
53
|
-
"fesm2020": "fesm2020/ngrx-data.mjs",
|
|
54
|
-
"fesm2015": "fesm2015/ngrx-data.mjs",
|
|
50
|
+
"module": "fesm2022/ngrx-data.mjs",
|
|
55
51
|
"typings": "index.d.ts",
|
|
56
52
|
"exports": {
|
|
57
53
|
"./package.json": {
|
|
@@ -59,11 +55,9 @@
|
|
|
59
55
|
},
|
|
60
56
|
".": {
|
|
61
57
|
"types": "./index.d.ts",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"node": "./fesm2015/ngrx-data.mjs",
|
|
66
|
-
"default": "./fesm2020/ngrx-data.mjs"
|
|
58
|
+
"esm2022": "./esm2022/ngrx-data.mjs",
|
|
59
|
+
"esm": "./esm2022/ngrx-data.mjs",
|
|
60
|
+
"default": "./fesm2022/ngrx-data.mjs"
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
}
|
|
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
}
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
|
-
exports
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var ts = require("typescript");
|
|
40
40
|
var schematics_1 = require("@angular-devkit/schematics");
|
|
41
41
|
var tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
@@ -72,7 +72,7 @@ function addEntityDataToNgModule(options) {
|
|
|
72
72
|
var renames = {
|
|
73
73
|
NgrxDataModule: 'EntityDataModule',
|
|
74
74
|
NgrxDataModuleWithoutEffects: 'EntityDataModuleWithoutEffects',
|
|
75
|
-
NgrxDataModuleConfig: 'EntityDataModuleConfig'
|
|
75
|
+
NgrxDataModuleConfig: 'EntityDataModuleConfig',
|
|
76
76
|
};
|
|
77
77
|
function removeAngularNgRxDataFromPackageJson() {
|
|
78
78
|
return function (host) {
|
|
@@ -150,14 +150,14 @@ function findNgrxDataReplacements(sourceFile) {
|
|
|
150
150
|
renameKeys.includes(node.initializer.getText(sourceFile))) {
|
|
151
151
|
change = {
|
|
152
152
|
node: node.initializer,
|
|
153
|
-
text: node.initializer.getText(sourceFile)
|
|
153
|
+
text: node.initializer.getText(sourceFile),
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
if (ts.isPropertyAccessExpression(node) &&
|
|
157
157
|
renameKeys.includes(node.expression.getText(sourceFile))) {
|
|
158
158
|
change = {
|
|
159
159
|
node: node.expression,
|
|
160
|
-
text: node.expression.getText(sourceFile)
|
|
160
|
+
text: node.expression.getText(sourceFile),
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
if (ts.isVariableDeclaration(node) &&
|
|
@@ -165,7 +165,7 @@ function findNgrxDataReplacements(sourceFile) {
|
|
|
165
165
|
renameKeys.includes(node.type.getText(sourceFile))) {
|
|
166
166
|
change = {
|
|
167
167
|
node: node.type,
|
|
168
|
-
text: node.type.getText(sourceFile)
|
|
168
|
+
text: node.type.getText(sourceFile),
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
if (change) {
|
|
@@ -216,5 +216,5 @@ function default_1(options) {
|
|
|
216
216
|
])(host, context);
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
-
exports
|
|
219
|
+
exports.default = default_1;
|
|
220
220
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/data/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AAEjC,yDAYoC;AACpC,0DAA0E;AAC1E,yDAa+B;AAG/B,SAAS,wBAAwB;IAC/B,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAA,yCAAuB,EACrB,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,iCAAe,CAChB,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,OAA0B;IACzD,OAAO,UAAC,IAAU;QAChB,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAEhD,IAAM,UAAU,GAAG,OAAO,CAAC,MAAO,CAAC;QACnC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAE,CAAC,QAAQ,EAAE,CAAC;QAE/C,I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n move,\n noop,\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n url,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport {\n addImportToModule,\n addPackageToPackageJson,\n commitChanges,\n createReplaceChange,\n findModuleFromOptions,\n getProjectPath,\n insertImport,\n parseName,\n platformVersion,\n ReplaceChange,\n stringUtils,\n visitTSSourceFiles,\n} from '../../schematics-core';\nimport { Schema as EntityDataOptions } from './schema';\n\nfunction addNgRxDataToPackageJson() {\n return (host: Tree, context: SchematicContext) => {\n addPackageToPackageJson(\n host,\n 'dependencies',\n '@ngrx/data',\n platformVersion\n );\n context.addTask(new NodePackageInstallTask());\n return host;\n };\n}\n\nfunction addEntityDataToNgModule(options: EntityDataOptions): Rule {\n return (host: Tree) => {\n throwIfModuleNotSpecified(host, options.module);\n\n const modulePath = options.module!;\n const text = host.read(modulePath)!.toString();\n\n const source = ts.createSourceFile(\n modulePath,\n text,\n ts.ScriptTarget.Latest,\n true\n );\n\n const moduleToImport = options.effects\n ? 'EntityDataModule'\n : 'EntityDataModuleWithoutEffects';\n\n const effectsModuleImport = insertImport(\n source,\n modulePath,\n moduleToImport,\n '@ngrx/data'\n );\n\n const [dateEntityNgModuleImport] = addImportToModule(\n source,\n modulePath,\n options.entityConfig\n ? [moduleToImport, 'forRoot(entityConfig)'].join('.')\n : moduleToImport,\n ''\n );\n\n const changes = [effectsModuleImport, dateEntityNgModuleImport];\n\n if (options.entityConfig) {\n const entityConfigImport = insertImport(\n source,\n modulePath,\n 'entityConfig',\n './entity-metadata'\n );\n changes.push(entityConfigImport);\n }\n\n commitChanges(host, source.fileName, changes);\n\n return host;\n };\n}\n\nconst renames = {\n NgrxDataModule: 'EntityDataModule',\n NgrxDataModuleWithoutEffects: 'EntityDataModuleWithoutEffects',\n NgrxDataModuleConfig: 'EntityDataModuleConfig',\n};\n\nfunction removeAngularNgRxDataFromPackageJson() {\n return (host: Tree) => {\n if (host.exists('package.json')) {\n const sourceText = host.read('package.json')!.toString('utf-8');\n const json = JSON.parse(sourceText);\n\n if (json['dependencies'] && json['dependencies']['ngrx-data']) {\n delete json['dependencies']['ngrx-data'];\n }\n\n host.overwrite('package.json', JSON.stringify(json, null, 2));\n }\n\n return host;\n };\n}\n\nfunction renameNgrxDataModule() {\n return (host: Tree) => {\n visitTSSourceFiles(host, (sourceFile) => {\n const ngrxDataImports = sourceFile.statements\n .filter(ts.isImportDeclaration)\n .filter(\n ({ moduleSpecifier }) =>\n moduleSpecifier.getText(sourceFile) === \"'ngrx-data'\"\n );\n\n if (ngrxDataImports.length === 0) {\n return;\n }\n\n const changes = [\n ...findNgrxDataImports(sourceFile, ngrxDataImports),\n ...findNgrxDataImportDeclarations(sourceFile, ngrxDataImports),\n ...findNgrxDataReplacements(sourceFile),\n ];\n\n commitChanges(host, sourceFile.fileName, changes);\n });\n };\n}\n\nfunction findNgrxDataImports(\n sourceFile: ts.SourceFile,\n imports: ts.ImportDeclaration[]\n) {\n const changes = imports.map((specifier) =>\n createReplaceChange(\n sourceFile,\n specifier.moduleSpecifier,\n \"'ngrx-data'\",\n \"'@ngrx/data'\"\n )\n );\n\n return changes;\n}\n\nfunction findNgrxDataImportDeclarations(\n sourceFile: ts.SourceFile,\n imports: ts.ImportDeclaration[]\n) {\n const changes = imports\n .map((p) => (p.importClause!.namedBindings! as ts.NamedImports).elements)\n .reduce((imports, curr) => imports.concat(curr), [] as ts.ImportSpecifier[])\n .map((specifier) => {\n if (!ts.isImportSpecifier(specifier)) {\n return { hit: false };\n }\n\n const ngrxDataImports = Object.keys(renames);\n if (ngrxDataImports.includes(specifier.name.text)) {\n return { hit: true, specifier, text: specifier.name.text };\n }\n\n // if import is renamed\n if (\n specifier.propertyName &&\n ngrxDataImports.includes(specifier.propertyName.text)\n ) {\n return { hit: true, specifier, text: specifier.propertyName.text };\n }\n\n return { hit: false };\n })\n .filter(({ hit }) => hit)\n .map(({ specifier, text }) =>\n createReplaceChange(\n sourceFile,\n specifier!,\n text!,\n (renames as any)[text!]\n )\n );\n\n return changes;\n}\n\nfunction findNgrxDataReplacements(sourceFile: ts.SourceFile) {\n const renameKeys = Object.keys(renames);\n const changes: ReplaceChange[] = [];\n ts.forEachChild(sourceFile, (node) => find(node, changes));\n return changes;\n\n function find(node: ts.Node, changes: ReplaceChange[]) {\n let change = undefined;\n\n if (\n ts.isPropertyAssignment(node) &&\n renameKeys.includes(node.initializer.getText(sourceFile))\n ) {\n change = {\n node: node.initializer,\n text: node.initializer.getText(sourceFile),\n };\n }\n\n if (\n ts.isPropertyAccessExpression(node) &&\n renameKeys.includes(node.expression.getText(sourceFile))\n ) {\n change = {\n node: node.expression,\n text: node.expression.getText(sourceFile),\n };\n }\n\n if (\n ts.isVariableDeclaration(node) &&\n node.type &&\n renameKeys.includes(node.type.getText(sourceFile))\n ) {\n change = {\n node: node.type,\n text: node.type.getText(sourceFile),\n };\n }\n\n if (change) {\n changes.push(\n createReplaceChange(\n sourceFile,\n change.node,\n change.text,\n (renames as any)[change.text]\n )\n );\n }\n\n ts.forEachChild(node, (childNode) => find(childNode, changes));\n }\n}\n\nfunction throwIfModuleNotSpecified(host: Tree, module?: string) {\n if (!module) {\n throw new Error('Module not specified');\n }\n\n if (!host.exists(module)) {\n throw new Error('Specified module does not exist');\n }\n\n const text = host.read(module);\n if (text === null) {\n throw new SchematicsException(`File ${module} does not exist.`);\n }\n}\n\nfunction createEntityConfigFile(options: EntityDataOptions, path: Path) {\n return mergeWith(\n apply(url('./files'), [\n applyTemplates({\n ...stringUtils,\n ...options,\n }),\n move(path),\n ])\n );\n}\n\nexport default function (options: EntityDataOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n (options as any).name = '';\n options.path = getProjectPath(host, options);\n options.effects = options.effects === undefined ? true : options.effects;\n options.module = options.module\n ? findModuleFromOptions(host, options as any)\n : options.module;\n\n const parsedPath = parseName(options.path, '');\n options.path = parsedPath.path;\n\n return chain([\n options && options.skipPackageJson ? noop() : addNgRxDataToPackageJson(),\n options.migrateNgrxData\n ? chain([\n removeAngularNgRxDataFromPackageJson(),\n renameNgrxDataModule(),\n ])\n : addEntityDataToNgModule(options),\n options.entityConfig\n ? createEntityConfigFile(options, parsedPath.path)\n : noop(),\n ])(host, context);\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/data/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AAEjC,yDAYoC;AACpC,0DAA0E;AAC1E,yDAa+B;AAG/B,SAAS,wBAAwB;IAC/B,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAA,yCAAuB,EACrB,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,iCAAe,CAChB,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,OAA0B;IACzD,OAAO,UAAC,IAAU;QAChB,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAEhD,IAAM,UAAU,GAAG,OAAO,CAAC,MAAO,CAAC;QACnC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAE,CAAC,QAAQ,EAAE,CAAC;QAE/C,IAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,UAAU,EACV,IAAI,EACJ,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;QAEF,IAAM,cAAc,GAAG,OAAO,CAAC,OAAO;YACpC,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,gCAAgC,CAAC;QAErC,IAAM,mBAAmB,GAAG,IAAA,8BAAY,EACtC,MAAM,EACN,UAAU,EACV,cAAc,EACd,YAAY,CACb,CAAC;QAEI,IAAA,KAAA,OAA6B,IAAA,mC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,OAAO,CAAC,MAAM;YAC7B,CAAC,CAAC,IAAA,uCAAqB,EAAC,IAAI,EAAE,OAAc,CAAC;YAC7C,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QAEnB,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,OAAO,IAAA,kBAAK,EAAC;YACX,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE;YACxE,OAAO,CAAC,eAAe;gBACrB,CAAC,CAAC,IAAA,kBAAK,EAAC;oBACJ,oCAAoC,EAAE;oBACtC,oBAAoB,EAAE;iBACvB,CAAC;gBACJ,CAAC,CAAC,uBAAuB,CAAC,OAAO,CAAC;YACpC,OAAO,CAAC,YAAY;gBAClB,CAAC,CAAC,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC;gBAClD,CAAC,CAAC,IAAA,iBAAI,GAAE;SACX,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAzBD,4BAyBC","sourcesContent":["import * as ts from 'typescript';\nimport { Path } from '@angular-devkit/core';\nimport {\n apply,\n applyTemplates,\n chain,\n mergeWith,\n move,\n noop,\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n url,\n} from '@angular-devkit/schematics';\nimport { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';\nimport {\n addImportToModule,\n addPackageToPackageJson,\n commitChanges,\n createReplaceChange,\n findModuleFromOptions,\n getProjectPath,\n insertImport,\n parseName,\n platformVersion,\n ReplaceChange,\n stringUtils,\n visitTSSourceFiles,\n} from '../../schematics-core';\nimport { Schema as EntityDataOptions } from './schema';\n\nfunction addNgRxDataToPackageJson() {\n return (host: Tree, context: SchematicContext) => {\n addPackageToPackageJson(\n host,\n 'dependencies',\n '@ngrx/data',\n platformVersion\n );\n context.addTask(new NodePackageInstallTask());\n return host;\n };\n}\n\nfunction addEntityDataToNgModule(options: EntityDataOptions): Rule {\n return (host: Tree) => {\n throwIfModuleNotSpecified(host, options.module);\n\n const modulePath = options.module!;\n const text = host.read(modulePath)!.toString();\n\n const source = ts.createSourceFile(\n modulePath,\n text,\n ts.ScriptTarget.Latest,\n true\n );\n\n const moduleToImport = options.effects\n ? 'EntityDataModule'\n : 'EntityDataModuleWithoutEffects';\n\n const effectsModuleImport = insertImport(\n source,\n modulePath,\n moduleToImport,\n '@ngrx/data'\n );\n\n const [dateEntityNgModuleImport] = addImportToModule(\n source,\n modulePath,\n options.entityConfig\n ? [moduleToImport, 'forRoot(entityConfig)'].join('.')\n : moduleToImport,\n ''\n );\n\n const changes = [effectsModuleImport, dateEntityNgModuleImport];\n\n if (options.entityConfig) {\n const entityConfigImport = insertImport(\n source,\n modulePath,\n 'entityConfig',\n './entity-metadata'\n );\n changes.push(entityConfigImport);\n }\n\n commitChanges(host, source.fileName, changes);\n\n return host;\n };\n}\n\nconst renames = {\n NgrxDataModule: 'EntityDataModule',\n NgrxDataModuleWithoutEffects: 'EntityDataModuleWithoutEffects',\n NgrxDataModuleConfig: 'EntityDataModuleConfig',\n};\n\nfunction removeAngularNgRxDataFromPackageJson() {\n return (host: Tree) => {\n if (host.exists('package.json')) {\n const sourceText = host.read('package.json')!.toString('utf-8');\n const json = JSON.parse(sourceText);\n\n if (json['dependencies'] && json['dependencies']['ngrx-data']) {\n delete json['dependencies']['ngrx-data'];\n }\n\n host.overwrite('package.json', JSON.stringify(json, null, 2));\n }\n\n return host;\n };\n}\n\nfunction renameNgrxDataModule() {\n return (host: Tree) => {\n visitTSSourceFiles(host, (sourceFile) => {\n const ngrxDataImports = sourceFile.statements\n .filter(ts.isImportDeclaration)\n .filter(\n ({ moduleSpecifier }) =>\n moduleSpecifier.getText(sourceFile) === \"'ngrx-data'\"\n );\n\n if (ngrxDataImports.length === 0) {\n return;\n }\n\n const changes = [\n ...findNgrxDataImports(sourceFile, ngrxDataImports),\n ...findNgrxDataImportDeclarations(sourceFile, ngrxDataImports),\n ...findNgrxDataReplacements(sourceFile),\n ];\n\n commitChanges(host, sourceFile.fileName, changes);\n });\n };\n}\n\nfunction findNgrxDataImports(\n sourceFile: ts.SourceFile,\n imports: ts.ImportDeclaration[]\n) {\n const changes = imports.map((specifier) =>\n createReplaceChange(\n sourceFile,\n specifier.moduleSpecifier,\n \"'ngrx-data'\",\n \"'@ngrx/data'\"\n )\n );\n\n return changes;\n}\n\nfunction findNgrxDataImportDeclarations(\n sourceFile: ts.SourceFile,\n imports: ts.ImportDeclaration[]\n) {\n const changes = imports\n .map((p) => (p.importClause!.namedBindings! as ts.NamedImports).elements)\n .reduce((imports, curr) => imports.concat(curr), [] as ts.ImportSpecifier[])\n .map((specifier) => {\n if (!ts.isImportSpecifier(specifier)) {\n return { hit: false };\n }\n\n const ngrxDataImports = Object.keys(renames);\n if (ngrxDataImports.includes(specifier.name.text)) {\n return { hit: true, specifier, text: specifier.name.text };\n }\n\n // if import is renamed\n if (\n specifier.propertyName &&\n ngrxDataImports.includes(specifier.propertyName.text)\n ) {\n return { hit: true, specifier, text: specifier.propertyName.text };\n }\n\n return { hit: false };\n })\n .filter(({ hit }) => hit)\n .map(({ specifier, text }) =>\n createReplaceChange(\n sourceFile,\n specifier!,\n text!,\n (renames as any)[text!]\n )\n );\n\n return changes;\n}\n\nfunction findNgrxDataReplacements(sourceFile: ts.SourceFile) {\n const renameKeys = Object.keys(renames);\n const changes: ReplaceChange[] = [];\n ts.forEachChild(sourceFile, (node) => find(node, changes));\n return changes;\n\n function find(node: ts.Node, changes: ReplaceChange[]) {\n let change = undefined;\n\n if (\n ts.isPropertyAssignment(node) &&\n renameKeys.includes(node.initializer.getText(sourceFile))\n ) {\n change = {\n node: node.initializer,\n text: node.initializer.getText(sourceFile),\n };\n }\n\n if (\n ts.isPropertyAccessExpression(node) &&\n renameKeys.includes(node.expression.getText(sourceFile))\n ) {\n change = {\n node: node.expression,\n text: node.expression.getText(sourceFile),\n };\n }\n\n if (\n ts.isVariableDeclaration(node) &&\n node.type &&\n renameKeys.includes(node.type.getText(sourceFile))\n ) {\n change = {\n node: node.type,\n text: node.type.getText(sourceFile),\n };\n }\n\n if (change) {\n changes.push(\n createReplaceChange(\n sourceFile,\n change.node,\n change.text,\n (renames as any)[change.text]\n )\n );\n }\n\n ts.forEachChild(node, (childNode) => find(childNode, changes));\n }\n}\n\nfunction throwIfModuleNotSpecified(host: Tree, module?: string) {\n if (!module) {\n throw new Error('Module not specified');\n }\n\n if (!host.exists(module)) {\n throw new Error('Specified module does not exist');\n }\n\n const text = host.read(module);\n if (text === null) {\n throw new SchematicsException(`File ${module} does not exist.`);\n }\n}\n\nfunction createEntityConfigFile(options: EntityDataOptions, path: Path) {\n return mergeWith(\n apply(url('./files'), [\n applyTemplates({\n ...stringUtils,\n ...options,\n }),\n move(path),\n ])\n );\n}\n\nexport default function (options: EntityDataOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n (options as any).name = '';\n options.path = getProjectPath(host, options);\n options.effects = options.effects === undefined ? true : options.effects;\n options.module = options.module\n ? findModuleFromOptions(host, options as any)\n : options.module;\n\n const parsedPath = parseName(options.path, '');\n options.path = parsedPath.path;\n\n return chain([\n options && options.skipPackageJson ? noop() : addNgRxDataToPackageJson(),\n options.migrateNgrxData\n ? chain([\n removeAngularNgRxDataFromPackageJson(),\n renameNgrxDataModule(),\n ])\n : addEntityDataToNgModule(options),\n options.entityConfig\n ? createEntityConfigFile(options, parsedPath.path)\n : noop(),\n ])(host, context);\n };\n}\n"]}
|
package/schematics-core/index.js
CHANGED
|
@@ -1,63 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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]; } };
|
|
7
|
-
}
|
|
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.visitTemplates = exports.visitNgModules = exports.visitDecorator = exports.visitComponents = exports.visitNgModuleExports = exports.visitNgModuleImports = exports.visitTSSourceFiles = exports.platformVersion = exports.addPackageToPackageJson = exports.parseName = exports.updatePackage = exports.stringUtils = exports.isLib = exports.getProject = exports.getProjectPath = exports.getPrefix = exports.omit = exports.addReducerToActionReducerMap = exports.addReducerImportToNgModule = exports.addReducerToStateInterface = exports.addReducerToState = exports.findPropertyInAstObject = exports.buildRelativePath = exports.findModuleFromOptions = exports.findModule = exports.findComponentFromOptions = exports.getWorkspacePath = exports.getWorkspace = exports.commitChanges = exports.createChangeRecorder = exports.createReplaceChange = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = exports.containsProperty = exports.replaceImport = exports.addProviderToModule = exports.addProviderToComponent = exports.addImportToModule = exports.addExportToModule = exports.addDeclarationToModule = exports.addBootstrapToModule = exports.insertImport = exports.insertAfterLastOccurrence = exports.getContentOfKeyLiteral = exports.getDecoratorMetadata = exports.getSourceNodes = exports.findNodes = void 0;
|
|
15
4
|
var strings_1 = require("./utility/strings");
|
|
16
5
|
var ast_utils_1 = require("./utility/ast-utils");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
Object.defineProperty(exports, "findNodes", { enumerable: true, get: function () { return ast_utils_1.findNodes; } });
|
|
7
|
+
Object.defineProperty(exports, "getSourceNodes", { enumerable: true, get: function () { return ast_utils_1.getSourceNodes; } });
|
|
8
|
+
Object.defineProperty(exports, "getDecoratorMetadata", { enumerable: true, get: function () { return ast_utils_1.getDecoratorMetadata; } });
|
|
9
|
+
Object.defineProperty(exports, "getContentOfKeyLiteral", { enumerable: true, get: function () { return ast_utils_1.getContentOfKeyLiteral; } });
|
|
10
|
+
Object.defineProperty(exports, "insertAfterLastOccurrence", { enumerable: true, get: function () { return ast_utils_1.insertAfterLastOccurrence; } });
|
|
11
|
+
Object.defineProperty(exports, "insertImport", { enumerable: true, get: function () { return ast_utils_1.insertImport; } });
|
|
12
|
+
Object.defineProperty(exports, "addBootstrapToModule", { enumerable: true, get: function () { return ast_utils_1.addBootstrapToModule; } });
|
|
13
|
+
Object.defineProperty(exports, "addDeclarationToModule", { enumerable: true, get: function () { return ast_utils_1.addDeclarationToModule; } });
|
|
14
|
+
Object.defineProperty(exports, "addExportToModule", { enumerable: true, get: function () { return ast_utils_1.addExportToModule; } });
|
|
15
|
+
Object.defineProperty(exports, "addImportToModule", { enumerable: true, get: function () { return ast_utils_1.addImportToModule; } });
|
|
16
|
+
Object.defineProperty(exports, "addProviderToComponent", { enumerable: true, get: function () { return ast_utils_1.addProviderToComponent; } });
|
|
17
|
+
Object.defineProperty(exports, "addProviderToModule", { enumerable: true, get: function () { return ast_utils_1.addProviderToModule; } });
|
|
18
|
+
Object.defineProperty(exports, "replaceImport", { enumerable: true, get: function () { return ast_utils_1.replaceImport; } });
|
|
19
|
+
Object.defineProperty(exports, "containsProperty", { enumerable: true, get: function () { return ast_utils_1.containsProperty; } });
|
|
31
20
|
var change_1 = require("./utility/change");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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; } });
|
|
39
28
|
var config_1 = require("./utility/config");
|
|
40
|
-
|
|
41
|
-
|
|
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; } });
|
|
42
31
|
var find_component_1 = require("./utility/find-component");
|
|
43
|
-
|
|
32
|
+
Object.defineProperty(exports, "findComponentFromOptions", { enumerable: true, get: function () { return find_component_1.findComponentFromOptions; } });
|
|
44
33
|
var find_module_1 = require("./utility/find-module");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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; } });
|
|
48
37
|
var json_utilts_1 = require("./utility/json-utilts");
|
|
49
|
-
|
|
38
|
+
Object.defineProperty(exports, "findPropertyInAstObject", { enumerable: true, get: function () { return json_utilts_1.findPropertyInAstObject; } });
|
|
50
39
|
var ngrx_utils_1 = require("./utility/ngrx-utils");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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; } });
|
|
57
46
|
var project_1 = require("./utility/project");
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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; } });
|
|
61
50
|
exports.stringUtils = {
|
|
62
51
|
dasherize: strings_1.dasherize,
|
|
63
52
|
decamelize: strings_1.decamelize,
|
|
@@ -67,22 +56,22 @@ exports.stringUtils = {
|
|
|
67
56
|
group: strings_1.group,
|
|
68
57
|
capitalize: strings_1.capitalize,
|
|
69
58
|
featurePath: strings_1.featurePath,
|
|
70
|
-
pluralize: strings_1.pluralize
|
|
59
|
+
pluralize: strings_1.pluralize,
|
|
71
60
|
};
|
|
72
61
|
var update_1 = require("./utility/update");
|
|
73
|
-
|
|
62
|
+
Object.defineProperty(exports, "updatePackage", { enumerable: true, get: function () { return update_1.updatePackage; } });
|
|
74
63
|
var parse_name_1 = require("./utility/parse-name");
|
|
75
|
-
|
|
64
|
+
Object.defineProperty(exports, "parseName", { enumerable: true, get: function () { return parse_name_1.parseName; } });
|
|
76
65
|
var package_1 = require("./utility/package");
|
|
77
|
-
|
|
66
|
+
Object.defineProperty(exports, "addPackageToPackageJson", { enumerable: true, get: function () { return package_1.addPackageToPackageJson; } });
|
|
78
67
|
var libs_version_1 = require("./utility/libs-version");
|
|
79
|
-
|
|
68
|
+
Object.defineProperty(exports, "platformVersion", { enumerable: true, get: function () { return libs_version_1.platformVersion; } });
|
|
80
69
|
var visitors_1 = require("./utility/visitors");
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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; } });
|
|
88
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/data/schematics-core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/data/schematics-core/index.ts"],"names":[],"mappings":";;;AAAA,6CAU2B;AAE3B,iD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,iBAAA;IACL,UAAU,sBAAA;IACV,WAAW,uBAAA;IACX,SAAS,qBAAA;CACV,CAAC;AAEF,2CAAiD;AAAxC,uGAAA,aAAa,OAAA;AAEtB,mDAAiD;AAAxC,uGAAA,SAAS,OAAA;AAElB,6CAA4D;AAAnD,kHAAA,uBAAuB,OAAA;AAEhC,uDAAyD;AAAhD,+GAAA,eAAe,OAAA;AAExB,+CAQ4B;AAP1B,8GAAA,kBAAkB,OAAA;AAClB,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AACpB,2GAAA,eAAe,OAAA;AACf,0GAAA,cAAc,OAAA;AACd,0GAAA,cAAc,OAAA;AACd,0GAAA,cAAc,OAAA","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"]}
|
|
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
}
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
|
-
exports
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.containsProperty = exports.replaceImport = exports.insertImport = exports.addBootstrapToModule = exports.addExportToModule = exports.addProviderToComponent = exports.addProviderToModule = exports.addImportToModule = exports.addDeclarationToModule = exports.getDecoratorMetadata = exports.getContentOfKeyLiteral = exports.insertAfterLastOccurrence = exports.getSourceNodes = exports.findNodes = void 0;
|
|
40
40
|
/* istanbul ignore file */
|
|
41
41
|
/**
|
|
@@ -83,7 +83,7 @@ function findNodes(node, kind, max) {
|
|
|
83
83
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
84
84
|
finally {
|
|
85
85
|
try {
|
|
86
|
-
if (_c && !_c.done && (_a = _b
|
|
86
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
87
87
|
}
|
|
88
88
|
finally { if (e_1) throw e_1.error; }
|
|
89
89
|
}
|
|
@@ -221,7 +221,7 @@ function getDecoratorMetadata(source, identifier, module) {
|
|
|
221
221
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
222
222
|
finally {
|
|
223
223
|
try {
|
|
224
|
-
if (_c && !_c.done && (_a = _b
|
|
224
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
225
225
|
}
|
|
226
226
|
finally { if (e_2) throw e_2.error; }
|
|
227
227
|
}
|
|
@@ -10,7 +10,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
10
10
|
};
|
|
11
11
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.commitChanges = exports.createChangeRecorder = exports.createRemoveChange = exports.createReplaceChange = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = void 0;
|
|
15
15
|
/**
|
|
16
16
|
* An operation that does nothing.
|
|
@@ -143,7 +143,7 @@ function createChangeRecorder(tree, path, changes) {
|
|
|
143
143
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
144
144
|
finally {
|
|
145
145
|
try {
|
|
146
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1
|
|
146
|
+
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
147
147
|
}
|
|
148
148
|
finally { if (e_1) throw e_1.error; }
|
|
149
149
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildRelativePath = exports.findComponent = exports.findComponentFromOptions = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
@@ -87,7 +87,7 @@ function parsePath(path) {
|
|
|
87
87
|
return {
|
|
88
88
|
path: pathNormalized,
|
|
89
89
|
filename: filename,
|
|
90
|
-
directory: directory
|
|
90
|
+
directory: directory,
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildRelativePath = exports.findModule = exports.findModuleFromOptions = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
@@ -88,7 +88,7 @@ function parsePath(path) {
|
|
|
88
88
|
return {
|
|
89
89
|
path: pathNormalized,
|
|
90
90
|
filename: filename,
|
|
91
|
-
directory: directory
|
|
91
|
+
directory: directory,
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -10,7 +10,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
10
10
|
};
|
|
11
11
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.findPropertyInAstObject = void 0;
|
|
15
15
|
// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts
|
|
16
16
|
function findPropertyInAstObject(node, propertyName) {
|
|
@@ -27,7 +27,7 @@ function findPropertyInAstObject(node, propertyName) {
|
|
|
27
27
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
28
28
|
finally {
|
|
29
29
|
try {
|
|
30
|
-
if (_c && !_c.done && (_a = _b
|
|
30
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
31
31
|
}
|
|
32
32
|
finally { if (e_1) throw e_1.error; }
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.platformVersion = void 0;
|
|
4
|
-
exports.platformVersion = '^
|
|
4
|
+
exports.platformVersion = '^16.0.0-rc.0';
|
|
5
5
|
//# sourceMappingURL=libs-version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,cAAc,CAAC","sourcesContent":["export const platformVersion = '^16.0.0-rc.0';\n"]}
|
|
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
}
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
|
-
exports
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getPrefix = exports.omit = exports.addReducerImportToNgModule = exports.addReducerToActionReducerMap = exports.addReducerToStateInterface = exports.addReducerToState = void 0;
|
|
40
40
|
var ts = require("typescript");
|
|
41
41
|
var stringUtils = require("./strings");
|
|
@@ -82,7 +82,7 @@ function addReducerToState(options) {
|
|
|
82
82
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
83
83
|
finally {
|
|
84
84
|
try {
|
|
85
|
-
if (changes_1_1 && !changes_1_1.done && (_a = changes_1
|
|
85
|
+
if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
|
|
86
86
|
}
|
|
87
87
|
finally { if (e_1) throw e_1.error; }
|
|
88
88
|
}
|
|
@@ -223,7 +223,7 @@ function addReducerImportToNgModule(options) {
|
|
|
223
223
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
224
224
|
finally {
|
|
225
225
|
try {
|
|
226
|
-
if (changes_2_1 && !changes_2_1.done && (_a = changes_2
|
|
226
|
+
if (changes_2_1 && !changes_2_1.done && (_a = changes_2.return)) _a.call(changes_2);
|
|
227
227
|
}
|
|
228
228
|
finally { if (e_2) throw e_2.error; }
|
|
229
229
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseName = void 0;
|
|
4
4
|
var core_1 = require("@angular-devkit/core");
|
|
5
5
|
function parseName(path, name) {
|
|
@@ -7,7 +7,7 @@ function parseName(path, name) {
|
|
|
7
7
|
var namePath = (0, core_1.dirname)((path + '/' + name));
|
|
8
8
|
return {
|
|
9
9
|
name: nameWithoutPath,
|
|
10
|
-
path: (0, core_1.normalize)('/' + namePath)
|
|
10
|
+
path: (0, core_1.normalize)('/' + namePath),
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
exports.parseName = parseName;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.featurePath = exports.group = exports.pluralize = exports.capitalize = exports.underscore = exports.classify = exports.camelize = exports.dasherize = exports.decamelize = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
@@ -5,7 +5,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
5
5
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6
6
|
function step(op) {
|
|
7
7
|
if (f) throw new TypeError("Generator is already executing.");
|
|
8
|
-
while (_) try {
|
|
8
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
9
9
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
10
10
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
11
11
|
switch (op[0]) {
|
|
@@ -53,7 +53,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
53
|
}
|
|
54
54
|
return ar;
|
|
55
55
|
};
|
|
56
|
-
exports
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
exports.visitDecorator = exports.visitNgModules = exports.visitComponents = exports.visitNgModuleExports = exports.visitNgModuleImports = exports.visitTemplates = exports.visitTSSourceFiles = void 0;
|
|
58
58
|
var ts = require("typescript");
|
|
59
59
|
var core_1 = require("@angular-devkit/core");
|
|
@@ -69,7 +69,7 @@ function visitTSSourceFiles(tree, visitor) {
|
|
|
69
69
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70
70
|
finally {
|
|
71
71
|
try {
|
|
72
|
-
if (_c && !_c.done && (_a = _b
|
|
72
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
73
73
|
}
|
|
74
74
|
finally { if (e_1) throw e_1.error; }
|
|
75
75
|
}
|
|
@@ -90,7 +90,7 @@ function visitTemplates(tree, visitor) {
|
|
|
90
90
|
fileName: source.fileName,
|
|
91
91
|
content: n.initializer.text,
|
|
92
92
|
inline: true,
|
|
93
|
-
start: templateStartIdx
|
|
93
|
+
start: templateStartIdx,
|
|
94
94
|
}, tree);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -109,7 +109,7 @@ function visitTemplates(tree, visitor) {
|
|
|
109
109
|
fileName: templatePath,
|
|
110
110
|
content: fileContent.toString(),
|
|
111
111
|
inline: false,
|
|
112
|
-
start: 0
|
|
112
|
+
start: 0,
|
|
113
113
|
}, tree);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
@@ -211,7 +211,7 @@ function visit(directory) {
|
|
|
211
211
|
return [3 /*break*/, 7];
|
|
212
212
|
case 6:
|
|
213
213
|
try {
|
|
214
|
-
if (_b && !_b.done && (_e = _a
|
|
214
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
215
215
|
}
|
|
216
216
|
finally { if (e_2) throw e_2.error; }
|
|
217
217
|
return [7 /*endfinally*/];
|
|
@@ -239,7 +239,7 @@ function visit(directory) {
|
|
|
239
239
|
return [3 /*break*/, 14];
|
|
240
240
|
case 13:
|
|
241
241
|
try {
|
|
242
|
-
if (_d && !_d.done && (_f = _c
|
|
242
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
243
243
|
}
|
|
244
244
|
finally { if (e_3) throw e_3.error; }
|
|
245
245
|
return [7 /*endfinally*/];
|