@ngrx/data 13.2.0 → 14.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.
Files changed (60) hide show
  1. package/esm2020/src/actions/entity-action-factory.mjs +4 -4
  2. package/esm2020/src/dataservices/default-data.service.mjs +4 -4
  3. package/esm2020/src/dataservices/entity-cache-data.service.mjs +4 -4
  4. package/esm2020/src/dataservices/entity-data.service.mjs +4 -4
  5. package/esm2020/src/dataservices/http-url-generator.mjs +6 -5
  6. package/esm2020/src/dataservices/persistence-result-handler.service.mjs +4 -4
  7. package/esm2020/src/dispatchers/entity-cache-dispatcher.mjs +4 -4
  8. package/esm2020/src/dispatchers/entity-dispatcher-default-options.mjs +4 -4
  9. package/esm2020/src/dispatchers/entity-dispatcher-factory.mjs +4 -4
  10. package/esm2020/src/effects/entity-cache-effects.mjs +4 -4
  11. package/esm2020/src/effects/entity-effects.mjs +4 -4
  12. package/esm2020/src/entity-data-without-effects.module.mjs +6 -8
  13. package/esm2020/src/entity-data.module.mjs +7 -9
  14. package/esm2020/src/entity-metadata/entity-definition.service.mjs +4 -4
  15. package/esm2020/src/entity-services/entity-collection-service-base.mjs +1 -1
  16. package/esm2020/src/entity-services/entity-collection-service-elements-factory.mjs +4 -4
  17. package/esm2020/src/entity-services/entity-collection-service-factory.mjs +4 -4
  18. package/esm2020/src/entity-services/entity-services-base.mjs +4 -4
  19. package/esm2020/src/entity-services/entity-services-elements.mjs +4 -4
  20. package/esm2020/src/entity-services/entity-services.mjs +1 -1
  21. package/esm2020/src/reducers/entity-cache-reducer.mjs +4 -4
  22. package/esm2020/src/reducers/entity-collection-creator.mjs +4 -4
  23. package/esm2020/src/reducers/entity-collection-reducer-methods.mjs +4 -4
  24. package/esm2020/src/reducers/entity-collection-reducer-registry.mjs +4 -4
  25. package/esm2020/src/reducers/entity-collection-reducer.mjs +4 -4
  26. package/esm2020/src/selectors/entity-selectors$.mjs +5 -5
  27. package/esm2020/src/selectors/entity-selectors.mjs +4 -4
  28. package/esm2020/src/utils/correlation-id-generator.mjs +4 -4
  29. package/esm2020/src/utils/default-logger.mjs +4 -4
  30. package/esm2020/src/utils/default-pluralizer.mjs +5 -5
  31. package/fesm2015/ngrx-data.mjs +93 -96
  32. package/fesm2015/ngrx-data.mjs.map +1 -1
  33. package/fesm2020/ngrx-data.mjs +93 -96
  34. package/fesm2020/ngrx-data.mjs.map +1 -1
  35. package/package.json +11 -10
  36. package/schematics/ng-add/index.js +1 -1
  37. package/schematics/ng-add/index.js.map +1 -1
  38. package/schematics-core/index.js +5 -1
  39. package/schematics-core/index.js.map +1 -1
  40. package/schematics-core/utility/ast-utils.js +26 -26
  41. package/schematics-core/utility/ast-utils.js.map +1 -1
  42. package/schematics-core/utility/change.js +7 -7
  43. package/schematics-core/utility/change.js.map +1 -1
  44. package/schematics-core/utility/config.js +1 -1
  45. package/schematics-core/utility/config.js.map +1 -1
  46. package/schematics-core/utility/find-component.js +4 -4
  47. package/schematics-core/utility/find-component.js.map +1 -1
  48. package/schematics-core/utility/find-module.js +4 -4
  49. package/schematics-core/utility/find-module.js.map +1 -1
  50. package/schematics-core/utility/libs-version.js +1 -1
  51. package/schematics-core/utility/libs-version.js.map +1 -1
  52. package/schematics-core/utility/ngrx-utils.js +19 -21
  53. package/schematics-core/utility/ngrx-utils.js.map +1 -1
  54. package/schematics-core/utility/project.js +3 -3
  55. package/schematics-core/utility/project.js.map +1 -1
  56. package/schematics-core/utility/strings.js +5 -5
  57. package/schematics-core/utility/strings.js.map +1 -1
  58. package/schematics-core/utility/update.js +2 -2
  59. package/schematics-core/utility/update.js.map +1 -1
  60. package/ngrx-data.d.ts +0 -5
@@ -38,7 +38,7 @@ var InsertChange = /** @class */ (function () {
38
38
  if (pos < 0) {
39
39
  throw new Error('Negative positions are invalid');
40
40
  }
41
- this.description = "Inserted " + toAdd + " into position " + pos + " of " + path;
41
+ this.description = "Inserted ".concat(toAdd, " into position ").concat(pos, " of ").concat(path);
42
42
  this.order = pos;
43
43
  }
44
44
  /**
@@ -49,7 +49,7 @@ var InsertChange = /** @class */ (function () {
49
49
  return host.read(this.path).then(function (content) {
50
50
  var prefix = content.substring(0, _this.pos);
51
51
  var suffix = content.substring(_this.pos);
52
- return host.write(_this.path, "" + prefix + _this.toAdd + suffix);
52
+ return host.write(_this.path, "".concat(prefix).concat(_this.toAdd).concat(suffix));
53
53
  });
54
54
  };
55
55
  return InsertChange;
@@ -66,7 +66,7 @@ var RemoveChange = /** @class */ (function () {
66
66
  if (pos < 0 || end < 0) {
67
67
  throw new Error('Negative positions are invalid');
68
68
  }
69
- this.description = "Removed text in position " + pos + " to " + end + " of " + path;
69
+ this.description = "Removed text in position ".concat(pos, " to ").concat(end, " of ").concat(path);
70
70
  this.order = pos;
71
71
  }
72
72
  RemoveChange.prototype.apply = function (host) {
@@ -75,7 +75,7 @@ var RemoveChange = /** @class */ (function () {
75
75
  var prefix = content.substring(0, _this.pos);
76
76
  var suffix = content.substring(_this.end);
77
77
  // TODO: throw error if toRemove doesn't match removed string.
78
- return host.write(_this.path, "" + prefix + suffix);
78
+ return host.write(_this.path, "".concat(prefix).concat(suffix));
79
79
  });
80
80
  };
81
81
  return RemoveChange;
@@ -93,7 +93,7 @@ var ReplaceChange = /** @class */ (function () {
93
93
  if (pos < 0) {
94
94
  throw new Error('Negative positions are invalid');
95
95
  }
96
- this.description = "Replaced " + oldText + " into position " + pos + " of " + path + " with " + newText;
96
+ this.description = "Replaced ".concat(oldText, " into position ").concat(pos, " of ").concat(path, " with ").concat(newText);
97
97
  this.order = pos;
98
98
  }
99
99
  ReplaceChange.prototype.apply = function (host) {
@@ -103,10 +103,10 @@ var ReplaceChange = /** @class */ (function () {
103
103
  var suffix = content.substring(_this.pos + _this.oldText.length);
104
104
  var text = content.substring(_this.pos, _this.pos + _this.oldText.length);
105
105
  if (text !== _this.oldText) {
106
- return Promise.reject(new Error("Invalid replace: \"" + text + "\" != \"" + _this.oldText + "\"."));
106
+ return Promise.reject(new Error("Invalid replace: \"".concat(text, "\" != \"").concat(_this.oldText, "\".")));
107
107
  }
108
108
  // TODO: throw error if oldText doesn't match removed string.
109
- return host.write(_this.path, "" + prefix + _this.newText + suffix);
109
+ return host.write(_this.path, "".concat(prefix).concat(_this.newText).concat(suffix));
110
110
  });
111
111
  };
112
112
  return ReplaceChange;
@@ -1 +1 @@
1
- {"version":3,"file":"change.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/change.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCA;;GAEG;AACH;IAAA;QACE,gBAAW,GAAG,eAAe,CAAC;QAC9B,UAAK,GAAG,QAAQ,CAAC;QACjB,SAAI,GAAG,IAAI,CAAC;IAId,CAAC;IAHC,0BAAK,GAAL;QACE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACH,iBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,gCAAU;AASvB;;GAEG;AACH;IAIE,sBAAmB,IAAY,EAAS,GAAW,EAAS,KAAa;QAAtD,SAAI,GAAJ,IAAI,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QACvE,IAAI,GAAG,GAAG,CAAC,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACnD;QACD,IAAI,CAAC,WAAW,GAAG,cAAY,KAAK,uBAAkB,GAAG,YAAO,IAAM,CAAC;QACvE,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,4BAAK,GAAL,UAAM,IAAU;QAAhB,iBAOC;QANC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAC,OAAO;YACvC,IAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAI,CAAC,GAAG,CAAC,CAAC;YAC9C,IAAM,MAAM,GAAG,OAAO,CAAC,SA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AC;aACjD;SACF;;;;;;;;;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAjBD,oDAiBC;AAED,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY,EAAE,OAAiB;IACvE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IAED,IAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AARD,sCAQC","sourcesContent":["import * as ts from 'typescript';\nimport { Tree, UpdateRecorder } from '@angular-devkit/schematics';\nimport { Path } from '@angular-devkit/core';\n\n/* istanbul ignore file */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport interface Host {\n write(path: string, content: string): Promise<void>;\n read(path: string): Promise<string>;\n}\n\nexport interface Change {\n apply(host: Host): Promise<void>;\n\n // The file this change should be applied to. Some changes might not apply to\n // a file (maybe the config).\n readonly path: string | null;\n\n // The order this change should be applied. Normally the position inside the file.\n // Changes are applied from the bottom of a file to the top.\n readonly order: number;\n\n // The description of this change. This will be outputted in a dry or verbose run.\n readonly description: string;\n}\n\n/**\n * An operation that does nothing.\n */\nexport class NoopChange implements Change {\n description = 'No operation.';\n order = Infinity;\n path = null;\n apply() {\n return Promise.resolve();\n }\n}\n\n/**\n * Will add text to the source code.\n */\nexport class InsertChange implements Change {\n order: number;\n description: string;\n\n constructor(public path: string, public pos: number, public toAdd: string) {\n if (pos < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Inserted ${toAdd} into position ${pos} of ${path}`;\n this.order = pos;\n }\n\n /**\n * This method does not insert spaces if there is none in the original string.\n */\n apply(host: Host) {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.pos);\n\n return host.write(this.path, `${prefix}${this.toAdd}${suffix}`);\n });\n }\n}\n\n/**\n * Will remove text from the source code.\n */\nexport class RemoveChange implements Change {\n order: number;\n description: string;\n\n constructor(public path: string, public pos: number, public end: number) {\n if (pos < 0 || end < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Removed text in position ${pos} to ${end} of ${path}`;\n this.order = pos;\n }\n\n apply(host: Host): Promise<void> {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.end);\n\n // TODO: throw error if toRemove doesn't match removed string.\n return host.write(this.path, `${prefix}${suffix}`);\n });\n }\n}\n\n/**\n * Will replace text from the source code.\n */\nexport class ReplaceChange implements Change {\n order: number;\n description: string;\n\n constructor(\n public path: string,\n public pos: number,\n public oldText: string,\n public newText: string\n ) {\n if (pos < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`;\n this.order = pos;\n }\n\n apply(host: Host): Promise<void> {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.pos + this.oldText.length);\n const text = content.substring(this.pos, this.pos + this.oldText.length);\n\n if (text !== this.oldText) {\n return Promise.reject(\n new Error(`Invalid replace: \"${text}\" != \"${this.oldText}\".`)\n );\n }\n\n // TODO: throw error if oldText doesn't match removed string.\n return host.write(this.path, `${prefix}${this.newText}${suffix}`);\n });\n }\n}\n\nexport function createReplaceChange(\n sourceFile: ts.SourceFile,\n node: ts.Node,\n oldText: string,\n newText: string\n): ReplaceChange {\n return new ReplaceChange(\n sourceFile.fileName,\n node.getStart(sourceFile),\n oldText,\n newText\n );\n}\n\nexport function createRemoveChange(\n sourceFile: ts.SourceFile,\n node: ts.Node,\n from = node.getStart(sourceFile),\n to = node.getEnd()\n): RemoveChange {\n return new RemoveChange(sourceFile.fileName, from, to);\n}\n\nexport function createChangeRecorder(\n tree: Tree,\n path: string,\n changes: Change[]\n): UpdateRecorder {\n const recorder = tree.beginUpdate(path);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n } else if (change instanceof RemoveChange) {\n recorder.remove(change.pos, change.end - change.pos);\n } else if (change instanceof ReplaceChange) {\n recorder.remove(change.pos, change.oldText.length);\n recorder.insertLeft(change.pos, change.newText);\n }\n }\n return recorder;\n}\n\nexport function commitChanges(tree: Tree, path: string, changes: Change[]) {\n if (changes.length === 0) {\n return false;\n }\n\n const recorder = createChangeRecorder(tree, path, changes);\n tree.commitUpdate(recorder);\n return true;\n}\n"]}
1
+ {"version":3,"file":"change.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/change.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCA;;GAEG;AACH;IAAA;QACE,gBAAW,GAAG,eAAe,CAAC;QAC9B,UAAK,GAAG,QAAQ,CAAC;QACjB,SAAI,GAAG,IAAI,CAAC;IAId,CAAC;IAHC,0BAAK,GAAL;QACE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACH,iBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,gCAAU;AASvB;;GAEG;AACH;IAIE,sBAAmB,IAAY,EAAS,GAAW,EAAS,KAAa;QAAtD,SAAI,GAAJ,IAAI,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAQ;QACvE,IAAI,GAAG,GAAG,CAAC,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACnD;QACD,IAAI,CAAC,WAAW,GAAG,mBAAY,KAAK,4BAAkB,GAAG,iBAAO,IAAI,CAAE,CAAC;QACvE,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,4BAAK,GAAL,UAAM,IAAU;QAAhB,iBAOC;QANC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,I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E;gBAC1C,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACnD,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;aACjD;SACF;;;;;;;;;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAjBD,oDAiBC;AAED,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY,EAAE,OAAiB;IACvE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IAED,IAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AARD,sCAQC","sourcesContent":["import * as ts from 'typescript';\nimport { Tree, UpdateRecorder } from '@angular-devkit/schematics';\nimport { Path } from '@angular-devkit/core';\n\n/* istanbul ignore file */\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nexport interface Host {\n write(path: string, content: string): Promise<void>;\n read(path: string): Promise<string>;\n}\n\nexport interface Change {\n apply(host: Host): Promise<void>;\n\n // The file this change should be applied to. Some changes might not apply to\n // a file (maybe the config).\n readonly path: string | null;\n\n // The order this change should be applied. Normally the position inside the file.\n // Changes are applied from the bottom of a file to the top.\n readonly order: number;\n\n // The description of this change. This will be outputted in a dry or verbose run.\n readonly description: string;\n}\n\n/**\n * An operation that does nothing.\n */\nexport class NoopChange implements Change {\n description = 'No operation.';\n order = Infinity;\n path = null;\n apply() {\n return Promise.resolve();\n }\n}\n\n/**\n * Will add text to the source code.\n */\nexport class InsertChange implements Change {\n order: number;\n description: string;\n\n constructor(public path: string, public pos: number, public toAdd: string) {\n if (pos < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Inserted ${toAdd} into position ${pos} of ${path}`;\n this.order = pos;\n }\n\n /**\n * This method does not insert spaces if there is none in the original string.\n */\n apply(host: Host) {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.pos);\n\n return host.write(this.path, `${prefix}${this.toAdd}${suffix}`);\n });\n }\n}\n\n/**\n * Will remove text from the source code.\n */\nexport class RemoveChange implements Change {\n order: number;\n description: string;\n\n constructor(public path: string, public pos: number, public end: number) {\n if (pos < 0 || end < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Removed text in position ${pos} to ${end} of ${path}`;\n this.order = pos;\n }\n\n apply(host: Host): Promise<void> {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.end);\n\n // TODO: throw error if toRemove doesn't match removed string.\n return host.write(this.path, `${prefix}${suffix}`);\n });\n }\n}\n\n/**\n * Will replace text from the source code.\n */\nexport class ReplaceChange implements Change {\n order: number;\n description: string;\n\n constructor(\n public path: string,\n public pos: number,\n public oldText: string,\n public newText: string\n ) {\n if (pos < 0) {\n throw new Error('Negative positions are invalid');\n }\n this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`;\n this.order = pos;\n }\n\n apply(host: Host): Promise<void> {\n return host.read(this.path).then((content) => {\n const prefix = content.substring(0, this.pos);\n const suffix = content.substring(this.pos + this.oldText.length);\n const text = content.substring(this.pos, this.pos + this.oldText.length);\n\n if (text !== this.oldText) {\n return Promise.reject(\n new Error(`Invalid replace: \"${text}\" != \"${this.oldText}\".`)\n );\n }\n\n // TODO: throw error if oldText doesn't match removed string.\n return host.write(this.path, `${prefix}${this.newText}${suffix}`);\n });\n }\n}\n\nexport function createReplaceChange(\n sourceFile: ts.SourceFile,\n node: ts.Node,\n oldText: string,\n newText: string\n): ReplaceChange {\n return new ReplaceChange(\n sourceFile.fileName,\n node.getStart(sourceFile),\n oldText,\n newText\n );\n}\n\nexport function createRemoveChange(\n sourceFile: ts.SourceFile,\n node: ts.Node,\n from = node.getStart(sourceFile),\n to = node.getEnd()\n): RemoveChange {\n return new RemoveChange(sourceFile.fileName, from, to);\n}\n\nexport function createChangeRecorder(\n tree: Tree,\n path: string,\n changes: Change[]\n): UpdateRecorder {\n const recorder = tree.beginUpdate(path);\n for (const change of changes) {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n } else if (change instanceof RemoveChange) {\n recorder.remove(change.pos, change.end - change.pos);\n } else if (change instanceof ReplaceChange) {\n recorder.remove(change.pos, change.oldText.length);\n recorder.insertLeft(change.pos, change.newText);\n }\n }\n return recorder;\n}\n\nexport function commitChanges(tree: Tree, path: string, changes: Change[]) {\n if (changes.length === 0) {\n return false;\n }\n\n const recorder = createChangeRecorder(tree, path, changes);\n tree.commitUpdate(recorder);\n return true;\n}\n"]}
@@ -12,7 +12,7 @@ function getWorkspace(host) {
12
12
  var path = getWorkspacePath(host);
13
13
  var configBuffer = host.read(path);
14
14
  if (configBuffer === null) {
15
- throw new schematics_1.SchematicsException("Could not find (" + path + ")");
15
+ throw new schematics_1.SchematicsException("Could not find (".concat(path, ")"));
16
16
  }
17
17
  var config = configBuffer.toString();
18
18
  return JSON.parse(config);
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/config.ts"],"names":[],"mappings":";;;AAAA,yDAAuE;AAkIvE,SAAgB,gBAAgB,CAAC,IAAU;IACzC,IAAM,aAAa,GAAG,CAAC,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC7E,IAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAjB,CAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,OAAO,IAAI,CAAC;AACd,CAAC;AALD,4CAKC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,YAAY,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,gCAAmB,CAAC,qBAAmB,IAAI,MAAG,CAAC,CAAC;KAC3D;IACD,IAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IAEvC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AATD,oCASC","sourcesContent":["import { SchematicsException, Tree } from '@angular-devkit/schematics';\n\n// The interfaces below are generated from the Angular CLI configuration schema\n// https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/lib/config/schema.json\nexport interface AppConfig {\n /**\n * Name of the app.\n */\n name?: string;\n /**\n * Directory where app files are placed.\n */\n appRoot?: string;\n /**\n * The root directory of the app.\n */\n root?: string;\n /**\n * The output directory for build results.\n */\n outDir?: string;\n /**\n * List of application assets.\n */\n assets?: (\n | string\n | {\n /**\n * The pattern to match.\n */\n glob?: string;\n /**\n * The dir to search within.\n */\n input?: string;\n /**\n * The output path (relative to the outDir).\n */\n output?: string;\n }\n )[];\n /**\n * URL where files will be deployed.\n */\n deployUrl?: string;\n /**\n * Base url for the application being built.\n */\n baseHref?: string;\n /**\n * The runtime platform of the app.\n */\n platform?: 'browser' | 'server';\n /**\n * The name of the start HTML file.\n */\n index?: string;\n /**\n * The name of the main entry-point file.\n */\n main?: string;\n /**\n * The name of the polyfills file.\n */\n polyfills?: string;\n /**\n * The name of the test entry-point file.\n */\n test?: string;\n /**\n * The name of the TypeScript configuration file.\n */\n tsconfig?: string;\n /**\n * The name of the TypeScript configuration file for unit tests.\n */\n testTsconfig?: string;\n /**\n * The prefix to apply to generated selectors.\n */\n prefix?: string;\n /**\n * Experimental support for a service worker from @angular/service-worker.\n */\n serviceWorker?: boolean;\n /**\n * Global styles to be included in the build.\n */\n styles?: (\n | string\n | {\n input?: string;\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n )[];\n /**\n * Options to pass to style preprocessors\n */\n stylePreprocessorOptions?: {\n /**\n * Paths to include. Paths will be resolved to project root.\n */\n includePaths?: string[];\n };\n /**\n * Global scripts to be included in the build.\n */\n scripts?: (\n | string\n | {\n input: string;\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n )[];\n /**\n * Source file for environment config.\n */\n environmentSource?: string;\n /**\n * Name and corresponding file for environment config.\n */\n environments?: {\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n };\n appShell?: {\n app: string;\n route: string;\n };\n}\n\nexport function getWorkspacePath(host: Tree): string {\n const possibleFiles = ['/angular.json', '/.angular.json', '/workspace.json'];\n const path = possibleFiles.filter((path) => host.exists(path))[0];\n\n return path;\n}\n\nexport function getWorkspace(host: Tree) {\n const path = getWorkspacePath(host);\n const configBuffer = host.read(path);\n if (configBuffer === null) {\n throw new SchematicsException(`Could not find (${path})`);\n }\n const config = configBuffer.toString();\n\n return JSON.parse(config);\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/config.ts"],"names":[],"mappings":";;;AAAA,yDAAuE;AAkIvE,SAAgB,gBAAgB,CAAC,IAAU;IACzC,IAAM,aAAa,GAAG,CAAC,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC7E,IAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAjB,CAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,OAAO,IAAI,CAAC;AACd,CAAC;AALD,4CAKC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,IAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,YAAY,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,gCAAmB,CAAC,0BAAmB,IAAI,MAAG,CAAC,CAAC;KAC3D;IACD,IAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IAEvC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AATD,oCASC","sourcesContent":["import { SchematicsException, Tree } from '@angular-devkit/schematics';\n\n// The interfaces below are generated from the Angular CLI configuration schema\n// https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/lib/config/schema.json\nexport interface AppConfig {\n /**\n * Name of the app.\n */\n name?: string;\n /**\n * Directory where app files are placed.\n */\n appRoot?: string;\n /**\n * The root directory of the app.\n */\n root?: string;\n /**\n * The output directory for build results.\n */\n outDir?: string;\n /**\n * List of application assets.\n */\n assets?: (\n | string\n | {\n /**\n * The pattern to match.\n */\n glob?: string;\n /**\n * The dir to search within.\n */\n input?: string;\n /**\n * The output path (relative to the outDir).\n */\n output?: string;\n }\n )[];\n /**\n * URL where files will be deployed.\n */\n deployUrl?: string;\n /**\n * Base url for the application being built.\n */\n baseHref?: string;\n /**\n * The runtime platform of the app.\n */\n platform?: 'browser' | 'server';\n /**\n * The name of the start HTML file.\n */\n index?: string;\n /**\n * The name of the main entry-point file.\n */\n main?: string;\n /**\n * The name of the polyfills file.\n */\n polyfills?: string;\n /**\n * The name of the test entry-point file.\n */\n test?: string;\n /**\n * The name of the TypeScript configuration file.\n */\n tsconfig?: string;\n /**\n * The name of the TypeScript configuration file for unit tests.\n */\n testTsconfig?: string;\n /**\n * The prefix to apply to generated selectors.\n */\n prefix?: string;\n /**\n * Experimental support for a service worker from @angular/service-worker.\n */\n serviceWorker?: boolean;\n /**\n * Global styles to be included in the build.\n */\n styles?: (\n | string\n | {\n input?: string;\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n )[];\n /**\n * Options to pass to style preprocessors\n */\n stylePreprocessorOptions?: {\n /**\n * Paths to include. Paths will be resolved to project root.\n */\n includePaths?: string[];\n };\n /**\n * Global scripts to be included in the build.\n */\n scripts?: (\n | string\n | {\n input: string;\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n )[];\n /**\n * Source file for environment config.\n */\n environmentSource?: string;\n /**\n * Name and corresponding file for environment config.\n */\n environments?: {\n [name: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n };\n appShell?: {\n app: string;\n route: string;\n };\n}\n\nexport function getWorkspacePath(host: Tree): string {\n const possibleFiles = ['/angular.json', '/.angular.json', '/workspace.json'];\n const path = possibleFiles.filter((path) => host.exists(path))[0];\n\n return path;\n}\n\nexport function getWorkspace(host: Tree) {\n const path = getWorkspacePath(host);\n const configBuffer = host.read(path);\n if (configBuffer === null) {\n throw new SchematicsException(`Could not find (${path})`);\n }\n const config = configBuffer.toString();\n\n return JSON.parse(config);\n}\n"]}
@@ -37,7 +37,7 @@ function findComponentFromOptions(host, options) {
37
37
  return (0, core_1.normalize)(componentPath + '/' + componentBaseName + '.component.ts');
38
38
  }
39
39
  else {
40
- throw new Error("Specified component path " + componentPath + " does not exist");
40
+ throw new Error("Specified component path ".concat(componentPath, " does not exist"));
41
41
  }
42
42
  }
43
43
  }
@@ -72,12 +72,12 @@ function buildRelativePath(from, to) {
72
72
  var relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
73
73
  var fixedRelativePath = relativePath.startsWith('.')
74
74
  ? relativePath
75
- : "./" + relativePath;
75
+ : "./".concat(relativePath);
76
76
  return !toFileName || toFileName === 'index.ts'
77
77
  ? fixedRelativePath
78
- : "" + (fixedRelativePath.endsWith('/')
78
+ : "".concat(fixedRelativePath.endsWith('/')
79
79
  ? fixedRelativePath
80
- : fixedRelativePath + '/') + convertToTypeScriptFileName(toFileName);
80
+ : fixedRelativePath + '/').concat(convertToTypeScriptFileName(toFileName));
81
81
  }
82
82
  exports.buildRelativePath = buildRelativePath;
83
83
  function parsePath(path) {
@@ -1 +1 @@
1
- {"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,wBAAwB,CACtC,IAAU,EACV,OAAyB;IAEzB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACtB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9D,OAAO,IAAA,gBAAS,EAAC,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KACpD;SAAM;QACL,IAAM,aAAa,GAAG,IAAA,gBAAS,EAC7B,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,SAAS,CAC7C,CAAC;QACF,IAAM,iBAAiB,GAAG,IAAA,gBAAS,EAAC,aAAa,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAEpE,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC9B,OAAO,IAAA,gBAAS,EAAC,aAAa,CAAC,CAAC;SACjC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,KAAK,CAAC,EAAE;YAC7C,OAAO,IAAA,gBAAS,EAAC,aAAa,GAAG,KAAK,CAAC,CAAC;SACzC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,eAAe,CAAC,EAAE;Y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yright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ComponentOptions {\n component?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the component referred by a set of options passed to the schematics.\n */\nexport function findComponentFromOptions(\n host: Tree,\n options: ComponentOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.component) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findComponent(host, pathToCheck));\n } else {\n const componentPath = normalize(\n '/' + options.path + '/' + options.component\n );\n const componentBaseName = normalize(componentPath).split('/').pop();\n\n if (host.exists(componentPath)) {\n return normalize(componentPath);\n } else if (host.exists(componentPath + '.ts')) {\n return normalize(componentPath + '.ts');\n } else if (host.exists(componentPath + '.component.ts')) {\n return normalize(componentPath + '.component.ts');\n } else if (\n host.exists(componentPath + '/' + componentBaseName + '.component.ts')\n ) {\n return normalize(\n componentPath + '/' + componentBaseName + '.component.ts'\n );\n } else {\n throw new Error(\n `Specified component path ${componentPath} does not exist`\n );\n }\n }\n}\n\n/**\n * Function to find the \"closest\" component to a generated file's path.\n */\nexport function findComponent(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const componentRe = /\\.component\\.ts$/;\n\n while (dir) {\n const matches = dir.subfiles.filter((p) => componentRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one component matches. Use skip-import option to skip importing ' +\n 'the component store into the closest component.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an Component. Use the skip-import ' +\n 'option to skip importing in Component.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
1
+ {"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,wBAAwB,CACtC,IAAU,EACV,OAAyB;IAEzB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACtB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,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D,CAAC;AAvBD,8CAuBC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAS,CAAC;IAC/C,IAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ComponentOptions {\n component?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the component referred by a set of options passed to the schematics.\n */\nexport function findComponentFromOptions(\n host: Tree,\n options: ComponentOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.component) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findComponent(host, pathToCheck));\n } else {\n const componentPath = normalize(\n '/' + options.path + '/' + options.component\n );\n const componentBaseName = normalize(componentPath).split('/').pop();\n\n if (host.exists(componentPath)) {\n return normalize(componentPath);\n } else if (host.exists(componentPath + '.ts')) {\n return normalize(componentPath + '.ts');\n } else if (host.exists(componentPath + '.component.ts')) {\n return normalize(componentPath + '.component.ts');\n } else if (\n host.exists(componentPath + '/' + componentBaseName + '.component.ts')\n ) {\n return normalize(\n componentPath + '/' + componentBaseName + '.component.ts'\n );\n } else {\n throw new Error(\n `Specified component path ${componentPath} does not exist`\n );\n }\n }\n}\n\n/**\n * Function to find the \"closest\" component to a generated file's path.\n */\nexport function findComponent(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const componentRe = /\\.component\\.ts$/;\n\n while (dir) {\n const matches = dir.subfiles.filter((p) => componentRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one component matches. Use skip-import option to skip importing ' +\n 'the component store into the closest component.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an Component. Use the skip-import ' +\n 'option to skip importing in Component.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
@@ -37,7 +37,7 @@ function findModuleFromOptions(host, options) {
37
37
  return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '.module.ts');
38
38
  }
39
39
  else {
40
- throw new Error("Specified module path " + modulePath + " does not exist");
40
+ throw new Error("Specified module path ".concat(modulePath, " does not exist"));
41
41
  }
42
42
  }
43
43
  }
@@ -73,12 +73,12 @@ function buildRelativePath(from, to) {
73
73
  var relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
74
74
  var fixedRelativePath = relativePath.startsWith('.')
75
75
  ? relativePath
76
- : "./" + relativePath;
76
+ : "./".concat(relativePath);
77
77
  return !toFileName || toFileName === 'index.ts'
78
78
  ? fixedRelativePath
79
- : "" + (fixedRelativePath.endsWith('/')
79
+ : "".concat(fixedRelativePath.endsWith('/')
80
80
  ? fixedRelativePath
81
- : fixedRelativePath + '/') + convertToTypeScriptFileName(toFileName);
81
+ : fixedRelativePath + '/').concat(convertToTypeScriptFileName(toFileName));
82
82
  }
83
83
  exports.buildRelativePath = buildRelativePath;
84
84
  function parsePath(path) {
@@ -1 +1 @@
1
- {"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAsB;IAEtB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC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C,CAAC,MACE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,iBAAiB,GAAG,GAAG,IAC1B,2BAA2B,CAAC,UAAU,CAAG,CAAC;AACnD,CAAC;AAvBD,8CAuBC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAS,CAAC;IAC/C,IAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(\n host: Tree,\n options: ModuleOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize('/' + options.path + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(\n (p) => moduleRe.test(p) && !routingModuleRe.test(p)\n );\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one module matches. Use skip-import option to skip importing ' +\n 'the component into the closest module.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an NgModule. Use the skip-import ' +\n 'option to skip importing in NgModule.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
1
+ {"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,6CAS8B;AAW9B;;GAEG;AACH,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAsB;IAEtB,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,IAAM,WAAW,GACf,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9D,OAAO,IAAA,gBAAS,EAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KACjD;SAAM;QACL,IAAM,UAAU,GAAG,IAAA,gBAAS,EAAC,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QACxE,IAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAE9D,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,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CAAC,CAAC,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,UAAA;QACR,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AACD;;;;GAIG;AACH,SAAS,2BAA2B,CAAC,QAA4B;IAC/D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {\n Path,\n join,\n normalize,\n relative,\n strings,\n basename,\n extname,\n dirname,\n} from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(\n host: Tree,\n options: ModuleOptions\n): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck =\n (options.path || '') +\n (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize('/' + options.path + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error(`Specified module path ${modulePath} does not exist`);\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(\n (p) => moduleRe.test(p) && !routingModuleRe.test(p)\n );\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error(\n 'More than one module matches. Use skip-import option to skip importing ' +\n 'the component into the closest module.'\n );\n }\n\n dir = dir.parent;\n }\n\n throw new Error(\n 'Could not find an NgModule. Use the skip-import ' +\n 'option to skip importing in NgModule.'\n );\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n const {\n path: fromPath,\n filename: fromFileName,\n directory: fromDirectory,\n } = parsePath(from);\n const {\n path: toPath,\n filename: toFileName,\n directory: toDirectory,\n } = parsePath(to);\n const relativePath = relative(fromDirectory, toDirectory);\n const fixedRelativePath = relativePath.startsWith('.')\n ? relativePath\n : `./${relativePath}`;\n\n return !toFileName || toFileName === 'index.ts'\n ? fixedRelativePath\n : `${\n fixedRelativePath.endsWith('/')\n ? fixedRelativePath\n : fixedRelativePath + '/'\n }${convertToTypeScriptFileName(toFileName)}`;\n}\n\nfunction parsePath(path: string) {\n const pathNormalized = normalize(path) as Path;\n const filename = extname(pathNormalized) ? basename(pathNormalized) : '';\n const directory = filename ? dirname(pathNormalized) : pathNormalized;\n return {\n path: pathNormalized,\n filename,\n directory,\n };\n}\n/**\n * Strips the typescript extension and clears index filenames\n * foo.ts -> foo\n * index.ts -> empty\n */\nfunction convertToTypeScriptFileName(filename: string | undefined) {\n return filename ? filename.replace(/(\\.ts)|(index\\.ts)$/, '') : '';\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  exports.platformVersion = void 0;
4
- exports.platformVersion = '^13.2.0';
4
+ exports.platformVersion = '^14.0.0-beta.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,SAAS,CAAC","sourcesContent":["export const platformVersion = '^13.2.0';\n"]}
1
+ {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAC","sourcesContent":["export const platformVersion = '^14.0.0-beta.0';\n"]}
@@ -50,23 +50,23 @@ function addReducerToState(options) {
50
50
  if (!options.reducers) {
51
51
  return host;
52
52
  }
53
- var reducersPath = (0, core_1.normalize)("/" + options.path + "/" + options.reducers);
53
+ var reducersPath = (0, core_1.normalize)("/".concat(options.path, "/").concat(options.reducers));
54
54
  if (!host.exists(reducersPath)) {
55
- throw new Error("Specified reducers path " + reducersPath + " does not exist");
55
+ throw new Error("Specified reducers path ".concat(reducersPath, " does not exist"));
56
56
  }
57
57
  var text = host.read(reducersPath);
58
58
  if (text === null) {
59
- throw new schematics_1.SchematicsException("File " + reducersPath + " does not exist.");
59
+ throw new schematics_1.SchematicsException("File ".concat(reducersPath, " does not exist."));
60
60
  }
61
61
  var sourceText = text.toString('utf-8');
62
62
  var source = ts.createSourceFile(reducersPath, sourceText, ts.ScriptTarget.Latest, true);
63
- var reducerPath = "/" + options.path + "/" +
63
+ var reducerPath = "/".concat(options.path, "/") +
64
64
  (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +
65
65
  (options.group ? 'reducers/' : '') +
66
66
  stringUtils.dasherize(options.name) +
67
67
  '.reducer';
68
68
  var relativePath = (0, find_module_1.buildRelativePath)(reducersPath, reducerPath);
69
- var reducerImport = (0, ast_utils_1.insertImport)(source, reducersPath, "* as from" + stringUtils.classify(options.name), relativePath, true);
69
+ var reducerImport = (0, ast_utils_1.insertImport)(source, reducersPath, "* as from".concat(stringUtils.classify(options.name)), relativePath, true);
70
70
  var stateInterfaceInsert = addReducerToStateInterface(source, reducersPath, options);
71
71
  var reducerMapInsert = addReducerToActionReducerMap(source, reducersPath, options);
72
72
  var changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];
@@ -103,13 +103,13 @@ function addReducerToStateInterface(source, reducersPath, options) {
103
103
  var state = options.plural
104
104
  ? stringUtils.pluralize(options.name)
105
105
  : stringUtils.camelize(options.name);
106
- var keyInsert = "[from" + stringUtils.classify(options.name) + "." + stringUtils.camelize(state) + "FeatureKey]: from" + stringUtils.classify(options.name) + ".State;";
106
+ var keyInsert = "[from".concat(stringUtils.classify(options.name), ".").concat(stringUtils.camelize(state), "FeatureKey]: from").concat(stringUtils.classify(options.name), ".State;");
107
107
  var expr = node;
108
108
  var position;
109
109
  var toInsert;
110
110
  if (expr.members.length === 0) {
111
111
  position = expr.getEnd() - 1;
112
- toInsert = " " + keyInsert + "\n";
112
+ toInsert = " ".concat(keyInsert, "\n");
113
113
  }
114
114
  else {
115
115
  node = expr.members[expr.members.length - 1];
@@ -118,10 +118,10 @@ function addReducerToStateInterface(source, reducersPath, options) {
118
118
  var text = node.getFullText(source);
119
119
  var matches = text.match(/^\r?\n+(\s*)/);
120
120
  if (matches && matches.length > 0) {
121
- toInsert = "" + matches[1] + keyInsert + "\n";
121
+ toInsert = "".concat(matches[1]).concat(keyInsert, "\n");
122
122
  }
123
123
  else {
124
- toInsert = "\n" + keyInsert;
124
+ toInsert = "\n".concat(keyInsert);
125
125
  }
126
126
  }
127
127
  return new change_1.InsertChange(reducersPath, position, toInsert);
@@ -153,13 +153,13 @@ function addReducerToActionReducerMap(source, reducersPath, options) {
153
153
  var state = options.plural
154
154
  ? stringUtils.pluralize(options.name)
155
155
  : stringUtils.camelize(options.name);
156
- var keyInsert = "[from" + stringUtils.classify(options.name) + "." + stringUtils.camelize(state) + "FeatureKey]: from" + stringUtils.classify(options.name) + ".reducer,";
156
+ var keyInsert = "[from".concat(stringUtils.classify(options.name), ".").concat(stringUtils.camelize(state), "FeatureKey]: from").concat(stringUtils.classify(options.name), ".reducer,");
157
157
  var expr = node;
158
158
  var position;
159
159
  var toInsert;
160
160
  if (expr.properties.length === 0) {
161
161
  position = expr.getEnd() - 1;
162
- toInsert = " " + keyInsert + "\n";
162
+ toInsert = " ".concat(keyInsert, "\n");
163
163
  }
164
164
  else {
165
165
  node = expr.properties[expr.properties.length - 1];
@@ -168,10 +168,10 @@ function addReducerToActionReducerMap(source, reducersPath, options) {
168
168
  var text = node.getFullText(source);
169
169
  var matches = text.match(/^\r?\n+(\s*)/);
170
170
  if (matches && matches.length > 0) {
171
- toInsert = "\n" + matches[1] + keyInsert;
171
+ toInsert = "\n".concat(matches[1]).concat(keyInsert);
172
172
  }
173
173
  else {
174
- toInsert = "\n" + keyInsert;
174
+ toInsert = "\n".concat(keyInsert);
175
175
  }
176
176
  }
177
177
  return new change_1.InsertChange(reducersPath, position, toInsert);
@@ -188,28 +188,28 @@ function addReducerImportToNgModule(options) {
188
188
  }
189
189
  var modulePath = options.module;
190
190
  if (!host.exists(options.module)) {
191
- throw new Error("Specified module path " + modulePath + " does not exist");
191
+ throw new Error("Specified module path ".concat(modulePath, " does not exist"));
192
192
  }
193
193
  var text = host.read(modulePath);
194
194
  if (text === null) {
195
- throw new schematics_1.SchematicsException("File " + modulePath + " does not exist.");
195
+ throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist."));
196
196
  }
197
197
  var sourceText = text.toString('utf-8');
198
198
  var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
199
199
  var commonImports = [
200
200
  (0, ast_utils_1.insertImport)(source, modulePath, 'StoreModule', '@ngrx/store'),
201
201
  ];
202
- var reducerPath = "/" + options.path + "/" +
202
+ var reducerPath = "/".concat(options.path, "/") +
203
203
  (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +
204
204
  (options.group ? 'reducers/' : '') +
205
205
  stringUtils.dasherize(options.name) +
206
206
  '.reducer';
207
207
  var relativePath = (0, find_module_1.buildRelativePath)(modulePath, reducerPath);
208
- var reducerImport = (0, ast_utils_1.insertImport)(source, modulePath, "* as from" + stringUtils.classify(options.name), relativePath, true);
208
+ var reducerImport = (0, ast_utils_1.insertImport)(source, modulePath, "* as from".concat(stringUtils.classify(options.name)), relativePath, true);
209
209
  var state = options.plural
210
210
  ? stringUtils.pluralize(options.name)
211
211
  : stringUtils.camelize(options.name);
212
- var _b = __read((0, ast_utils_1.addImportToModule)(source, modulePath, "StoreModule.forFeature(from" + stringUtils.classify(options.name) + "." + state + "FeatureKey, from" + stringUtils.classify(options.name) + ".reducer)", relativePath), 1), storeNgModuleImport = _b[0];
212
+ var _b = __read((0, ast_utils_1.addImportToModule)(source, modulePath, "StoreModule.forFeature(from".concat(stringUtils.classify(options.name), ".").concat(state, "FeatureKey, from").concat(stringUtils.classify(options.name), ".reducer)"), relativePath), 1), storeNgModuleImport = _b[0];
213
213
  var changes = __spreadArray(__spreadArray([], __read(commonImports), false), [reducerImport, storeNgModuleImport], false);
214
214
  var recorder = host.beginUpdate(modulePath);
215
215
  try {
@@ -242,9 +242,7 @@ function omit(object, keyToRemove) {
242
242
  }
243
243
  exports.omit = omit;
244
244
  function getPrefix(options) {
245
- return options.creators
246
- ? stringUtils.camelize(options.prefix || 'load')
247
- : stringUtils.capitalize(options.prefix || 'load');
245
+ return stringUtils.camelize(options.prefix || 'load');
248
246
  }
249
247
  exports.getPrefix = getPrefix;
250
248
  //# sourceMappingURL=ngrx-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngrx-utils.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/ngrx-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,uCAAyC;AACzC,mCAA4D;AAC5D,yDAA6E;AAC7E,6CAAiD;AACjD,6CAAkD;AAClD,yCAA8D;AAE9D,SAAgB,iBAA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;AAChF,CAAC;AAPD,oBAOC;AAED,SAAgB,SAAS,CAAC,OAAgD;IACxE,OAAO,OAAO,CAAC,QAAQ;QACrB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC;QAChD,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;AACvD,CAAC;AAJD,8BAIC","sourcesContent":["import * as ts from 'typescript';\nimport * as stringUtils from './strings';\nimport { InsertChange, Change, NoopChange } from './change';\nimport { Tree, SchematicsException, Rule } from '@angular-devkit/schematics';\nimport { normalize } from '@angular-devkit/core';\nimport { buildRelativePath } from './find-module';\nimport { addImportToModule, insertImport } from './ast-utils';\n\nexport function addReducerToState(options: any): Rule {\n return (host: Tree) => {\n if (!options.reducers) {\n return host;\n }\n\n const reducersPath = normalize(`/${options.path}/${options.reducers}`);\n\n if (!host.exists(reducersPath)) {\n throw new Error(`Specified reducers path ${reducersPath} does not exist`);\n }\n\n const text = host.read(reducersPath);\n if (text === null) {\n throw new SchematicsException(`File ${reducersPath} does not exist.`);\n }\n\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n reducersPath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n\n const relativePath = buildRelativePath(reducersPath, reducerPath);\n const reducerImport = insertImport(\n source,\n reducersPath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n\n const stateInterfaceInsert = addReducerToStateInterface(\n source,\n reducersPath,\n options\n );\n const reducerMapInsert = addReducerToActionReducerMap(\n source,\n reducersPath,\n options\n );\n\n const changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];\n const recorder = host.beginUpdate(reducersPath);\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\n/**\n * Insert the reducer into the first defined top level interface\n */\nexport function addReducerToStateInterface(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n const stateInterface = source.statements.find(\n (stm) => stm.kind === ts.SyntaxKind.InterfaceDeclaration\n );\n let node = stateInterface as ts.Statement;\n\n if (!node) {\n return new NoopChange();\n }\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.State;`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.members.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.members[expr.members.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `${matches[1]}${keyInsert}\\n`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Insert the reducer into the ActionReducerMap\n */\nexport function addReducerToActionReducerMap(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n let initializer: any;\n const actionReducerMap: any = source.statements\n .filter((stm) => stm.kind === ts.SyntaxKind.VariableStatement)\n .filter((stm: any) => !!stm.declarationList)\n .map((stm: any) => {\n const {\n declarations,\n }: {\n declarations: ts.SyntaxKind.VariableDeclarationList[];\n } = stm.declarationList;\n const variable: any = declarations.find(\n (decl: any) => decl.kind === ts.SyntaxKind.VariableDeclaration\n );\n const type = variable ? variable.type : {};\n\n return { initializer: variable.initializer, type };\n })\n .filter((initWithType) => initWithType.type !== undefined)\n .find(({ type }) => type.typeName.text === 'ActionReducerMap');\n\n if (!actionReducerMap || !actionReducerMap.initializer) {\n return new NoopChange();\n }\n\n let node = actionReducerMap.initializer;\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.reducer,`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.properties.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `\\n${matches[1]}${keyInsert}`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Add reducer feature to NgModule\n */\nexport function addReducerImportToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (!options.module) {\n return host;\n }\n\n const modulePath = options.module;\n if (!host.exists(options.module)) {\n throw new Error(`Specified module path ${modulePath} 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 commonImports = [\n insertImport(source, modulePath, 'StoreModule', '@ngrx/store'),\n ];\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n const relativePath = buildRelativePath(modulePath, reducerPath);\n const reducerImport = insertImport(\n source,\n modulePath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n const [storeNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreModule.forFeature(from${stringUtils.classify(\n options.name\n )}.${state}FeatureKey, from${stringUtils.classify(\n options.name\n )}.reducer)`,\n relativePath\n );\n const changes = [...commonImports, reducerImport, storeNgModuleImport];\n const recorder = host.beginUpdate(modulePath);\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\nexport function omit<T extends { [key: string]: any }>(\n object: T,\n keyToRemove: keyof T\n): Partial<T> {\n return Object.keys(object)\n .filter((key) => key !== keyToRemove)\n .reduce((result, key) => Object.assign(result, { [key]: object[key] }), {});\n}\n\nexport function getPrefix(options: { prefix?: string; creators?: boolean }) {\n return options.creators\n ? stringUtils.camelize(options.prefix || 'load')\n : stringUtils.capitalize(options.prefix || 'load');\n}\n"]}
1
+ {"version":3,"file":"ngrx-utils.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/ngrx-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,uCAAyC;AACzC,mCAA4D;AAC5D,yDAA6E;AAC7E,6CAAiD;AACjD,6CAAkD;AAClD,yCAA8D;AAE9D,SAAgB,iBAAiB,CAAC,OAAY;IAC5C,OAAO,UAAC,IAAU;;QAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;QAED,IAAM,YAAY,GAAG,IAAA,gBAAS,EAAC,WAAI,OAAO,CAAC,IAAI,cAAI,OAAO,CAAC,QAAQ,CAAE,CAAC,CAAC;QAEvE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,kCAA2B,YAAY,oBAAiB,CAAC,CAAC;SAC3E;QAED,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,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CACb,IAAA,EATM,mBAAmB,QASzB,CAAC;QACF,IAAM,OAAO,0CAAO,aAAa,YAAE,aAAa,EAAE,mBAAmB,SAAC,CAAC;QACvE,IAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;;YAC9C,KAAqB,IAAA,YAAA,SAAA,OAAO,CAAA,gCAAA,qDAAE;gBAAzB,IAAM,MAAM,oBAAA;gBACf,IAAI,MAAM,YAAY,qBAAY,EAAE;oBAClC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;iBAC/C;aACF;;;;;;;;;QACD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAlED,gEAkEC;AAED,SAAgB,IAAI,CAClB,MAAS,EACT,WAAoB;IAEpB,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACvB,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,KAAK,WAAW,EAAnB,CAAmB,CAAC;SACpC,MAAM,CAAC,UAAC,MAAM,EAAE,GAAG;;QAAK,OAAA,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG;IAA7C,CAA6C,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC;AAPD,oBAOC;AAED,SAAgB,SAAS,CAAC,OAA4B;IACpD,OAAO,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;AACxD,CAAC;AAFD,8BAEC","sourcesContent":["import * as ts from 'typescript';\nimport * as stringUtils from './strings';\nimport { InsertChange, Change, NoopChange } from './change';\nimport { Tree, SchematicsException, Rule } from '@angular-devkit/schematics';\nimport { normalize } from '@angular-devkit/core';\nimport { buildRelativePath } from './find-module';\nimport { addImportToModule, insertImport } from './ast-utils';\n\nexport function addReducerToState(options: any): Rule {\n return (host: Tree) => {\n if (!options.reducers) {\n return host;\n }\n\n const reducersPath = normalize(`/${options.path}/${options.reducers}`);\n\n if (!host.exists(reducersPath)) {\n throw new Error(`Specified reducers path ${reducersPath} does not exist`);\n }\n\n const text = host.read(reducersPath);\n if (text === null) {\n throw new SchematicsException(`File ${reducersPath} does not exist.`);\n }\n\n const sourceText = text.toString('utf-8');\n\n const source = ts.createSourceFile(\n reducersPath,\n sourceText,\n ts.ScriptTarget.Latest,\n true\n );\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n\n const relativePath = buildRelativePath(reducersPath, reducerPath);\n const reducerImport = insertImport(\n source,\n reducersPath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n\n const stateInterfaceInsert = addReducerToStateInterface(\n source,\n reducersPath,\n options\n );\n const reducerMapInsert = addReducerToActionReducerMap(\n source,\n reducersPath,\n options\n );\n\n const changes = [reducerImport, stateInterfaceInsert, reducerMapInsert];\n const recorder = host.beginUpdate(reducersPath);\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\n/**\n * Insert the reducer into the first defined top level interface\n */\nexport function addReducerToStateInterface(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n const stateInterface = source.statements.find(\n (stm) => stm.kind === ts.SyntaxKind.InterfaceDeclaration\n );\n let node = stateInterface as ts.Statement;\n\n if (!node) {\n return new NoopChange();\n }\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.State;`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.members.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.members[expr.members.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `${matches[1]}${keyInsert}\\n`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Insert the reducer into the ActionReducerMap\n */\nexport function addReducerToActionReducerMap(\n source: ts.SourceFile,\n reducersPath: string,\n options: { name: string; plural: boolean }\n): Change {\n let initializer: any;\n const actionReducerMap: any = source.statements\n .filter((stm) => stm.kind === ts.SyntaxKind.VariableStatement)\n .filter((stm: any) => !!stm.declarationList)\n .map((stm: any) => {\n const {\n declarations,\n }: {\n declarations: ts.SyntaxKind.VariableDeclarationList[];\n } = stm.declarationList;\n const variable: any = declarations.find(\n (decl: any) => decl.kind === ts.SyntaxKind.VariableDeclaration\n );\n const type = variable ? variable.type : {};\n\n return { initializer: variable.initializer, type };\n })\n .filter((initWithType) => initWithType.type !== undefined)\n .find(({ type }) => type.typeName.text === 'ActionReducerMap');\n\n if (!actionReducerMap || !actionReducerMap.initializer) {\n return new NoopChange();\n }\n\n let node = actionReducerMap.initializer;\n\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n\n const keyInsert = `[from${stringUtils.classify(\n options.name\n )}.${stringUtils.camelize(state)}FeatureKey]: from${stringUtils.classify(\n options.name\n )}.reducer,`;\n const expr = node as any;\n let position;\n let toInsert;\n\n if (expr.properties.length === 0) {\n position = expr.getEnd() - 1;\n toInsert = ` ${keyInsert}\\n`;\n } else {\n node = expr.properties[expr.properties.length - 1];\n position = node.getEnd() + 1;\n // Get the indentation of the last element, if any.\n const text = node.getFullText(source);\n const matches = text.match(/^\\r?\\n+(\\s*)/);\n\n if (matches && matches.length > 0) {\n toInsert = `\\n${matches[1]}${keyInsert}`;\n } else {\n toInsert = `\\n${keyInsert}`;\n }\n }\n\n return new InsertChange(reducersPath, position, toInsert);\n}\n\n/**\n * Add reducer feature to NgModule\n */\nexport function addReducerImportToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (!options.module) {\n return host;\n }\n\n const modulePath = options.module;\n if (!host.exists(options.module)) {\n throw new Error(`Specified module path ${modulePath} 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 commonImports = [\n insertImport(source, modulePath, 'StoreModule', '@ngrx/store'),\n ];\n\n const reducerPath =\n `/${options.path}/` +\n (options.flat ? '' : stringUtils.dasherize(options.name) + '/') +\n (options.group ? 'reducers/' : '') +\n stringUtils.dasherize(options.name) +\n '.reducer';\n const relativePath = buildRelativePath(modulePath, reducerPath);\n const reducerImport = insertImport(\n source,\n modulePath,\n `* as from${stringUtils.classify(options.name)}`,\n relativePath,\n true\n );\n const state = options.plural\n ? stringUtils.pluralize(options.name)\n : stringUtils.camelize(options.name);\n const [storeNgModuleImport] = addImportToModule(\n source,\n modulePath,\n `StoreModule.forFeature(from${stringUtils.classify(\n options.name\n )}.${state}FeatureKey, from${stringUtils.classify(\n options.name\n )}.reducer)`,\n relativePath\n );\n const changes = [...commonImports, reducerImport, storeNgModuleImport];\n const recorder = host.beginUpdate(modulePath);\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\nexport function omit<T extends { [key: string]: any }>(\n object: T,\n keyToRemove: keyof T\n): Partial<T> {\n return Object.keys(object)\n .filter((key) => key !== keyToRemove)\n .reduce((result, key) => Object.assign(result, { [key]: object[key] }), {});\n}\n\nexport function getPrefix(options: { prefix?: string }) {\n return stringUtils.camelize(options.prefix || 'load');\n}\n"]}
@@ -17,12 +17,12 @@ function getProject(host, options) {
17
17
  exports.getProject = getProject;
18
18
  function getProjectPath(host, options) {
19
19
  var project = getProject(host, options);
20
- if (project.root.substr(-1) === '/') {
21
- project.root = project.root.substr(0, project.root.length - 1);
20
+ if (project.root.slice(-1) === '/') {
21
+ project.root = project.root.substring(0, project.root.length - 1);
22
22
  }
23
23
  if (options.path === undefined) {
24
24
  var projectDirName = project.projectType === 'application' ? 'app' : 'lib';
25
- return (project.root ? "/" + project.root : '') + "/src/" + projectDirName;
25
+ return "".concat(project.root ? "/".concat(project.root) : '', "/src/").concat(projectDirName);
26
26
  }
27
27
  return options.path;
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/project.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAQxC,SAAgB,UAAU,CACxB,IAAU,EACV,OAAoE;IAEpE,IAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,IAAM,cAAc,GAAI,SAAyC;aAC9D,cAAc,CAAC;QAClB,OAAO,CAAC,OAAO;YACb,cAAc,KAAK,SAAS;gBAC1B,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAhBD,gCAgBC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAChE;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QAC9B,IAAM,cAAc,GAClB,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,OAAO,CAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAI,OAAO,CAAC,IAAM,CAAC,CAAC,CAAC,EAAE,cAAQ,cAAgB,CAAC;KAC1E;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAlBD,wCAkBC;AAED,SAAgB,KAAK,CACnB,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;AAC3C,CAAC;AAPD,sBAOC","sourcesContent":["import { getWorkspace } from './config';\nimport { Tree } from '@angular-devkit/schematics';\n\nexport interface WorkspaceProject {\n root: string;\n projectType: string;\n}\n\nexport function getProject(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n): WorkspaceProject {\n const workspace = getWorkspace(host);\n\n if (!options.project) {\n const defaultProject = (workspace as { defaultProject?: string })\n .defaultProject;\n options.project =\n defaultProject !== undefined\n ? defaultProject\n : Object.keys(workspace.projects)[0];\n }\n\n return workspace.projects[options.project];\n}\n\nexport function getProjectPath(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n if (project.root.substr(-1) === '/') {\n project.root = project.root.substr(0, project.root.length - 1);\n }\n\n if (options.path === undefined) {\n const projectDirName =\n project.projectType === 'application' ? 'app' : 'lib';\n\n return `${project.root ? `/${project.root}` : ''}/src/${projectDirName}`;\n }\n\n return options.path;\n}\n\nexport function isLib(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n return project.projectType === 'library';\n}\n"]}
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/project.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAQxC,SAAgB,UAAU,CACxB,IAAU,EACV,OAAoE;IAEpE,IAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QACpB,IAAM,cAAc,GAAI,SAAyC;aAC9D,cAAc,CAAC;QAClB,OAAO,CAAC,OAAO;YACb,cAAc,KAAK,SAAS;gBAC1B,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IAED,OAAO,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAhBD,gCAgBC;AAED,SAAgB,cAAc,CAC5B,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAClC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACnE;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;QAC9B,IAAM,cAAc,GAClB,OAAO,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QAExD,OAAO,UAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAI,OAAO,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAE,kBAAQ,cAAc,CAAE,CAAC;KAC1E;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC;AAlBD,wCAkBC;AAED,SAAgB,KAAK,CACnB,IAAU,EACV,OAAoE;IAEpE,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;AAC3C,CAAC;AAPD,sBAOC","sourcesContent":["import { getWorkspace } from './config';\nimport { Tree } from '@angular-devkit/schematics';\n\nexport interface WorkspaceProject {\n root: string;\n projectType: string;\n}\n\nexport function getProject(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n): WorkspaceProject {\n const workspace = getWorkspace(host);\n\n if (!options.project) {\n const defaultProject = (workspace as { defaultProject?: string })\n .defaultProject;\n options.project =\n defaultProject !== undefined\n ? defaultProject\n : Object.keys(workspace.projects)[0];\n }\n\n return workspace.projects[options.project];\n}\n\nexport function getProjectPath(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n if (project.root.slice(-1) === '/') {\n project.root = project.root.substring(0, project.root.length - 1);\n }\n\n if (options.path === undefined) {\n const projectDirName =\n project.projectType === 'application' ? 'app' : 'lib';\n\n return `${project.root ? `/${project.root}` : ''}/src/${projectDirName}`;\n }\n\n return options.path;\n}\n\nexport function isLib(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n const project = getProject(host, options);\n\n return project.projectType === 'library';\n}\n"]}
@@ -106,7 +106,7 @@ exports.underscore = underscore;
106
106
  ```
107
107
  */
108
108
  function capitalize(str) {
109
- return str.charAt(0).toUpperCase() + str.substr(1);
109
+ return str.charAt(0).toUpperCase() + str.substring(1);
110
110
  }
111
111
  exports.capitalize = capitalize;
112
112
  /**
@@ -121,18 +121,18 @@ exports.capitalize = capitalize;
121
121
  ```
122
122
  */
123
123
  function pluralize(str) {
124
- return camelize([/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(function (c, i) { return (str = str.replace(c, "$1" + ('iv'[i] || '') + "e")); }) && str + 's');
124
+ return camelize([/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(function (c, i) { return (str = str.replace(c, "$1".concat('iv'[i] || '', "e"))); }) && str + 's');
125
125
  }
126
126
  exports.pluralize = pluralize;
127
127
  function group(name, group) {
128
- return group ? group + "/" + name : name;
128
+ return group ? "".concat(group, "/").concat(name) : name;
129
129
  }
130
130
  exports.group = group;
131
131
  function featurePath(group, flat, path, name) {
132
132
  if (group && !flat) {
133
- return "../../" + path + "/" + name + "/";
133
+ return "../../".concat(path, "/").concat(name, "/");
134
134
  }
135
- return group ? "../" + path + "/" : './';
135
+ return group ? "../".concat(path, "/") : './';
136
136
  }
137
137
  exports.featurePath = featurePath;
138
138
  //# sourceMappingURL=strings.js.map