@ngrx/entity 18.0.2 → 18.1.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/migrations/6_0_0/index.js +1 -1
- package/migrations/6_0_0/index.js.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +14 -15
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +5 -5
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +2 -3
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +3 -4
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +3 -4
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +1 -2
- package/schematics-core/utility/json-utilts.js.map +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/schematics-core/utility/ngrx-utils.js +6 -7
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +1 -2
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +1 -2
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +4 -5
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/strings.js +9 -10
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +1 -2
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +7 -8
- package/schematics-core/utility/visitors.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/find-component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/find-component.ts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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"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.findModuleFromOptions = findModuleFromOptions;
|
|
4
|
+
exports.findModule = findModule;
|
|
5
|
+
exports.buildRelativePath = buildRelativePath;
|
|
4
6
|
/**
|
|
5
7
|
* @license
|
|
6
8
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -41,7 +43,6 @@ function findModuleFromOptions(host, options) {
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
exports.findModuleFromOptions = findModuleFromOptions;
|
|
45
46
|
/**
|
|
46
47
|
* Function to find the "closest" module to a generated file's path.
|
|
47
48
|
*/
|
|
@@ -63,7 +64,6 @@ function findModule(host, generateDir) {
|
|
|
63
64
|
throw new Error('Could not find an NgModule. Use the skip-import ' +
|
|
64
65
|
'option to skip importing in NgModule.');
|
|
65
66
|
}
|
|
66
|
-
exports.findModule = findModule;
|
|
67
67
|
/**
|
|
68
68
|
* Build a relative path from one file path to another file path.
|
|
69
69
|
*/
|
|
@@ -80,7 +80,6 @@ function buildRelativePath(from, to) {
|
|
|
80
80
|
? fixedRelativePath
|
|
81
81
|
: fixedRelativePath + '/').concat(convertToTypeScriptFileName(toFileName));
|
|
82
82
|
}
|
|
83
|
-
exports.buildRelativePath = buildRelativePath;
|
|
84
83
|
function parsePath(path) {
|
|
85
84
|
var pathNormalized = (0, core_1.normalize)(path);
|
|
86
85
|
var filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/find-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;AA8BA,sDA8BC;AAKD,gCA2BC;AAKD,8CAuBC;AAxHD;;;;;;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,CAAC;QAC/D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,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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B,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,iBAAiB,GAAG,GAAG,SAC1B,2BAA2B,CAAC,UAAU,CAAC,CAAE,CAAC;AACnD,CAAC;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"]}
|
|
@@ -11,7 +11,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
11
11
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.findPropertyInAstObject =
|
|
14
|
+
exports.findPropertyInAstObject = findPropertyInAstObject;
|
|
15
15
|
// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts
|
|
16
16
|
function findPropertyInAstObject(node, propertyName) {
|
|
17
17
|
var e_1, _a;
|
|
@@ -33,5 +33,4 @@ function findPropertyInAstObject(node, propertyName) {
|
|
|
33
33
|
}
|
|
34
34
|
return maybeNode;
|
|
35
35
|
}
|
|
36
|
-
exports.findPropertyInAstObject = findPropertyInAstObject;
|
|
37
36
|
//# sourceMappingURL=json-utilts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/json-utilts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/json-utilts.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,0DAYC;AAbD,uGAAuG;AACvG,SAAgB,uBAAuB,CACrC,IAAS,EACT,YAAoB;;IAEpB,IAAI,SAAS,GAAe,IAAI,CAAC;;QACjC,KAAuB,IAAA,KAAA,SAAA,IAAI,CAAC,UAAU,CAAA,gBAAA,4BAAE,CAAC;YAApC,IAAM,QAAQ,WAAA;YACjB,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;gBACvC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC7B,CAAC;QACH,CAAC;;;;;;;;;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts\nexport function findPropertyInAstObject(\n node: any,\n propertyName: string\n): any | null {\n let maybeNode: any | null = null;\n for (const property of node.properties) {\n if (property.key.value == propertyName) {\n maybeNode = property.value;\n }\n }\n\n return maybeNode;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^18.0
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^18.1.0';\n"]}
|
|
@@ -36,7 +36,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.addReducerToState = addReducerToState;
|
|
40
|
+
exports.addReducerToStateInterface = addReducerToStateInterface;
|
|
41
|
+
exports.addReducerToActionReducerMap = addReducerToActionReducerMap;
|
|
42
|
+
exports.addReducerImportToNgModule = addReducerImportToNgModule;
|
|
43
|
+
exports.omit = omit;
|
|
44
|
+
exports.getPrefix = getPrefix;
|
|
40
45
|
var ts = require("typescript");
|
|
41
46
|
var stringUtils = require("./strings");
|
|
42
47
|
var change_1 = require("./change");
|
|
@@ -90,7 +95,6 @@ function addReducerToState(options) {
|
|
|
90
95
|
return host;
|
|
91
96
|
};
|
|
92
97
|
}
|
|
93
|
-
exports.addReducerToState = addReducerToState;
|
|
94
98
|
/**
|
|
95
99
|
* Insert the reducer into the first defined top level interface
|
|
96
100
|
*/
|
|
@@ -126,7 +130,6 @@ function addReducerToStateInterface(source, reducersPath, options) {
|
|
|
126
130
|
}
|
|
127
131
|
return new change_1.InsertChange(reducersPath, position, toInsert);
|
|
128
132
|
}
|
|
129
|
-
exports.addReducerToStateInterface = addReducerToStateInterface;
|
|
130
133
|
/**
|
|
131
134
|
* Insert the reducer into the ActionReducerMap
|
|
132
135
|
*/
|
|
@@ -176,7 +179,6 @@ function addReducerToActionReducerMap(source, reducersPath, options) {
|
|
|
176
179
|
}
|
|
177
180
|
return new change_1.InsertChange(reducersPath, position, toInsert);
|
|
178
181
|
}
|
|
179
|
-
exports.addReducerToActionReducerMap = addReducerToActionReducerMap;
|
|
180
182
|
/**
|
|
181
183
|
* Add reducer feature to NgModule
|
|
182
184
|
*/
|
|
@@ -231,7 +233,6 @@ function addReducerImportToNgModule(options) {
|
|
|
231
233
|
return host;
|
|
232
234
|
};
|
|
233
235
|
}
|
|
234
|
-
exports.addReducerImportToNgModule = addReducerImportToNgModule;
|
|
235
236
|
function omit(object, keyToRemove) {
|
|
236
237
|
return Object.keys(object)
|
|
237
238
|
.filter(function (key) { return key !== keyToRemove; })
|
|
@@ -240,9 +241,7 @@ function omit(object, keyToRemove) {
|
|
|
240
241
|
return Object.assign(result, (_a = {}, _a[key] = object[key], _a));
|
|
241
242
|
}, {});
|
|
242
243
|
}
|
|
243
|
-
exports.omit = omit;
|
|
244
244
|
function getPrefix(options) {
|
|
245
245
|
return stringUtils.camelize(options.prefix || 'load');
|
|
246
246
|
}
|
|
247
|
-
exports.getPrefix = getPrefix;
|
|
248
247
|
//# sourceMappingURL=ngrx-utils.js.map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,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;;;;;;;;;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"]}
|
|
1
|
+
{"version":3,"file":"ngrx-utils.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/ngrx-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,8CAgEC;AAKD,gEA6CC;AAKD,oEA8DC;AAKD,gEAkEC;AAED,oBAOC;AAED,8BAEC;AAjRD,+BAAiC;AACjC,uC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ACT,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;AAED,SAAgB,SAAS,CAAC,OAA4B;IACpD,OAAO,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;AACxD,CAAC","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPackageToPackageJson =
|
|
3
|
+
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
4
4
|
/**
|
|
5
5
|
* Adds a package to the package.json
|
|
6
6
|
*/
|
|
@@ -19,5 +19,4 @@ function addPackageToPackageJson(host, type, pkg, version) {
|
|
|
19
19
|
}
|
|
20
20
|
return host;
|
|
21
21
|
}
|
|
22
|
-
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
23
22
|
//# sourceMappingURL=package.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/package.ts"],"names":[],"mappings":";;AAKA,0DAqBC;AAxBD;;GAEG;AACH,SAAgB,uBAAuB,CACrC,IAAU,EACV,IAAY,EACZ,GAAW,EACX,OAAe;;IAEf,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,IAAM,UAAU,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,mCAAI,IAAI,CAAC;QACxE,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tree } from '@angular-devkit/schematics';\n\n/**\n * Adds a package to the package.json\n */\nexport function addPackageToPackageJson(\n host: Tree,\n type: string,\n pkg: string,\n version: string\n): Tree {\n if (host.exists('package.json')) {\n const sourceText = host.read('package.json')?.toString('utf-8') ?? '{}';\n const json = JSON.parse(sourceText);\n if (!json[type]) {\n json[type] = {};\n }\n\n if (!json[type][pkg]) {\n json[type][pkg] = version;\n }\n\n host.overwrite('package.json', JSON.stringify(json, null, 2));\n }\n\n return host;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseName =
|
|
3
|
+
exports.parseName = parseName;
|
|
4
4
|
var core_1 = require("@angular-devkit/core");
|
|
5
5
|
function parseName(path, name) {
|
|
6
6
|
var nameWithoutPath = (0, core_1.basename)(name);
|
|
@@ -10,5 +10,4 @@ function parseName(path, name) {
|
|
|
10
10
|
path: (0, core_1.normalize)('/' + namePath),
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
exports.parseName = parseName;
|
|
14
13
|
//# sourceMappingURL=parse-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-name.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/parse-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-name.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/parse-name.ts"],"names":[],"mappings":";;AAOA,8BAQC;AAfD,6CAA0E;AAO1E,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,IAAM,eAAe,GAAG,IAAA,eAAQ,EAAC,IAAY,CAAC,CAAC;IAC/C,IAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAS,CAAC,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,IAAA,gBAAS,EAAC,GAAG,GAAG,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC","sourcesContent":["import { Path, basename, dirname, normalize } from '@angular-devkit/core';\n\nexport interface Location {\n name: string;\n path: Path;\n}\n\nexport function parseName(path: string, name: string): Location {\n const nameWithoutPath = basename(name as Path);\n const namePath = dirname((path + '/' + name) as Path);\n\n return {\n name: nameWithoutPath,\n path: normalize('/' + namePath),\n };\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getProject = getProject;
|
|
4
|
+
exports.getProjectPath = getProjectPath;
|
|
5
|
+
exports.isLib = isLib;
|
|
6
|
+
exports.getProjectMainFile = getProjectMainFile;
|
|
4
7
|
var config_1 = require("./config");
|
|
5
8
|
var schematics_1 = require("@angular-devkit/schematics");
|
|
6
9
|
function getProject(host, options) {
|
|
@@ -15,7 +18,6 @@ function getProject(host, options) {
|
|
|
15
18
|
}
|
|
16
19
|
return workspace.projects[options.project];
|
|
17
20
|
}
|
|
18
|
-
exports.getProject = getProject;
|
|
19
21
|
function getProjectPath(host, options) {
|
|
20
22
|
var project = getProject(host, options);
|
|
21
23
|
if (project.root.slice(-1) === '/') {
|
|
@@ -27,12 +29,10 @@ function getProjectPath(host, options) {
|
|
|
27
29
|
}
|
|
28
30
|
return options.path;
|
|
29
31
|
}
|
|
30
|
-
exports.getProjectPath = getProjectPath;
|
|
31
32
|
function isLib(host, options) {
|
|
32
33
|
var project = getProject(host, options);
|
|
33
34
|
return project.projectType === 'library';
|
|
34
35
|
}
|
|
35
|
-
exports.isLib = isLib;
|
|
36
36
|
function getProjectMainFile(host, options) {
|
|
37
37
|
if (isLib(host, options)) {
|
|
38
38
|
throw new schematics_1.SchematicsException("Invalid project type");
|
|
@@ -44,5 +44,4 @@ function getProjectMainFile(host, options) {
|
|
|
44
44
|
}
|
|
45
45
|
return (projectOptions.browser || projectOptions.main);
|
|
46
46
|
}
|
|
47
|
-
exports.getProjectMainFile = getProjectMainFile;
|
|
48
47
|
//# sourceMappingURL=project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/project.ts"],"names":[],"mappings":";;AAYA,gCAgBC;AAED,wCAkBC;AAED,sBAOC;AAED,gDAeC;AAzED,mCAAwC;AACxC,yDAAuE;AAUvE,SAAgB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C,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC;AAC3C,CAAC;AAED,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAAoE;IAEpE,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,gCAAmB,CAAC,sBAAsB,CAAC,CAAC;IACxD,CAAC;IACD,IAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,IAAM,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAE1D,IAAI,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,CAAA,IAAI,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAA,EAAE,CAAC;QACtD,MAAM,IAAI,gCAAmB,CAAC,uCAAgC,OAAO,CAAE,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,CAAC,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAW,CAAC;AACnE,CAAC","sourcesContent":["import { TargetDefinition } from '@angular-devkit/core/src/workspace';\nimport { getWorkspace } from './config';\nimport { SchematicsException, Tree } from '@angular-devkit/schematics';\n\nexport interface WorkspaceProject {\n root: string;\n projectType: string;\n architect: {\n [key: string]: TargetDefinition;\n };\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\nexport function getProjectMainFile(\n host: Tree,\n options: { project?: string | undefined; path?: string | undefined }\n) {\n if (isLib(host, options)) {\n throw new SchematicsException(`Invalid project type`);\n }\n const project = getProject(host, options);\n const projectOptions = project.architect['build'].options;\n\n if (!projectOptions?.main && !projectOptions?.browser) {\n throw new SchematicsException(`Could not find the main file ${project}`);\n }\n\n return (projectOptions.browser || projectOptions.main) as string;\n}\n"]}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.decamelize = decamelize;
|
|
4
|
+
exports.dasherize = dasherize;
|
|
5
|
+
exports.camelize = camelize;
|
|
6
|
+
exports.classify = classify;
|
|
7
|
+
exports.underscore = underscore;
|
|
8
|
+
exports.capitalize = capitalize;
|
|
9
|
+
exports.pluralize = pluralize;
|
|
10
|
+
exports.group = group;
|
|
11
|
+
exports.featurePath = featurePath;
|
|
4
12
|
/**
|
|
5
13
|
* @license
|
|
6
14
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -26,7 +34,6 @@ var STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g;
|
|
|
26
34
|
function decamelize(str) {
|
|
27
35
|
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
|
|
28
36
|
}
|
|
29
|
-
exports.decamelize = decamelize;
|
|
30
37
|
/**
|
|
31
38
|
Replaces underscores, spaces, or camelCase with dashes.
|
|
32
39
|
|
|
@@ -40,7 +47,6 @@ exports.decamelize = decamelize;
|
|
|
40
47
|
function dasherize(str) {
|
|
41
48
|
return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');
|
|
42
49
|
}
|
|
43
|
-
exports.dasherize = dasherize;
|
|
44
50
|
/**
|
|
45
51
|
Returns the lowerCamelCase form of a string.
|
|
46
52
|
|
|
@@ -59,7 +65,6 @@ function camelize(str) {
|
|
|
59
65
|
})
|
|
60
66
|
.replace(/^([A-Z])/, function (match) { return match.toLowerCase(); });
|
|
61
67
|
}
|
|
62
|
-
exports.camelize = camelize;
|
|
63
68
|
/**
|
|
64
69
|
Returns the UpperCamelCase form of a string.
|
|
65
70
|
|
|
@@ -76,7 +81,6 @@ function classify(str) {
|
|
|
76
81
|
.map(function (part) { return capitalize(camelize(part)); })
|
|
77
82
|
.join('.');
|
|
78
83
|
}
|
|
79
|
-
exports.classify = classify;
|
|
80
84
|
/**
|
|
81
85
|
More general than decamelize. Returns the lower\_case\_and\_underscored
|
|
82
86
|
form of a string.
|
|
@@ -94,7 +98,6 @@ function underscore(str) {
|
|
|
94
98
|
.replace(STRING_UNDERSCORE_REGEXP_2, '_')
|
|
95
99
|
.toLowerCase();
|
|
96
100
|
}
|
|
97
|
-
exports.underscore = underscore;
|
|
98
101
|
/**
|
|
99
102
|
Returns the Capitalized form of a string
|
|
100
103
|
|
|
@@ -108,7 +111,6 @@ exports.underscore = underscore;
|
|
|
108
111
|
function capitalize(str) {
|
|
109
112
|
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
110
113
|
}
|
|
111
|
-
exports.capitalize = capitalize;
|
|
112
114
|
/**
|
|
113
115
|
Returns the plural form of a string
|
|
114
116
|
|
|
@@ -123,16 +125,13 @@ exports.capitalize = capitalize;
|
|
|
123
125
|
function pluralize(str) {
|
|
124
126
|
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
127
|
}
|
|
126
|
-
exports.pluralize = pluralize;
|
|
127
128
|
function group(name, group) {
|
|
128
129
|
return group ? "".concat(group, "/").concat(name) : name;
|
|
129
130
|
}
|
|
130
|
-
exports.group = group;
|
|
131
131
|
function featurePath(group, flat, path, name) {
|
|
132
132
|
if (group && !flat) {
|
|
133
133
|
return "../../".concat(path, "/").concat(name, "/");
|
|
134
134
|
}
|
|
135
135
|
return group ? "../".concat(path, "/") : './';
|
|
136
136
|
}
|
|
137
|
-
exports.featurePath = featurePath;
|
|
138
137
|
//# sourceMappingURL=strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/strings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/strings.ts"],"names":[],"mappings":";;AAuBA,gCAEC;AAYD,8BAEC;AAaD,4BASC;AAYD,4BAKC;AAaD,gCAKC;AAYD,gCAEC;AAaD,8BAMC;AAED,sBAEC;AAED,kCAWC;AAlJD;;;;;;GAMG;AACH,IAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,IAAM,wBAAwB,GAAG,mBAAmB,CAAC;AACrD,IAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACnD,IAAM,0BAA0B,GAAG,oBAAoB,CAAC;AACxD,IAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,SAAS,CAAC,GAAY;IACpC,OAAO,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,OAAO,GAA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AG,GAAG,GAAG,CACf,CAAC;AACJ,CAAC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,KAAyB;IAC3D,OAAO,KAAK,CAAC,CAAC,CAAC,UAAG,KAAK,cAAI,IAAI,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED,SAAgB,WAAW,CACzB,KAA0B,EAC1B,IAAyB,EACzB,IAAY,EACZ,IAAY;IAEZ,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,gBAAS,IAAI,cAAI,IAAI,MAAG,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,aAAM,IAAI,MAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACtC,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 */\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_CAMELIZE_REGEXP = /(-|_|\\.|\\s)+(.)?/g;\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\nconst STRING_UNDERSCORE_REGEXP_2 = /-|\\s+/g;\n\n/**\n * Converts a camelized string into all lower case separated by underscores.\n *\n ```javascript\n decamelize('innerHTML'); // 'inner_html'\n decamelize('action_name'); // 'action_name'\n decamelize('css-class-name'); // 'css-class-name'\n decamelize('my favorite items'); // 'my favorite items'\n ```\n */\nexport function decamelize(str: string): string {\n return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();\n}\n\n/**\n Replaces underscores, spaces, or camelCase with dashes.\n\n ```javascript\n dasherize('innerHTML'); // 'inner-html'\n dasherize('action_name'); // 'action-name'\n dasherize('css-class-name'); // 'css-class-name'\n dasherize('my favorite items'); // 'my-favorite-items'\n ```\n */\nexport function dasherize(str?: string): string {\n return decamelize(str || '').replace(STRING_DASHERIZE_REGEXP, '-');\n}\n\n/**\n Returns the lowerCamelCase form of a string.\n\n ```javascript\n camelize('innerHTML'); // 'innerHTML'\n camelize('action_name'); // 'actionName'\n camelize('css-class-name'); // 'cssClassName'\n camelize('my favorite items'); // 'myFavoriteItems'\n camelize('My Favorite Items'); // 'myFavoriteItems'\n ```\n */\nexport function camelize(str: string): string {\n return str\n .replace(\n STRING_CAMELIZE_REGEXP,\n (_match: string, _separator: string, chr: string) => {\n return chr ? chr.toUpperCase() : '';\n }\n )\n .replace(/^([A-Z])/, (match: string) => match.toLowerCase());\n}\n\n/**\n Returns the UpperCamelCase form of a string.\n\n ```javascript\n 'innerHTML'.classify(); // 'InnerHTML'\n 'action_name'.classify(); // 'ActionName'\n 'css-class-name'.classify(); // 'CssClassName'\n 'my favorite items'.classify(); // 'MyFavoriteItems'\n ```\n */\nexport function classify(str: string): string {\n return str\n .split('.')\n .map((part) => capitalize(camelize(part)))\n .join('.');\n}\n\n/**\n More general than decamelize. Returns the lower\\_case\\_and\\_underscored\n form of a string.\n\n ```javascript\n 'innerHTML'.underscore(); // 'inner_html'\n 'action_name'.underscore(); // 'action_name'\n 'css-class-name'.underscore(); // 'css_class_name'\n 'my favorite items'.underscore(); // 'my_favorite_items'\n ```\n */\nexport function underscore(str: string): string {\n return str\n .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')\n .replace(STRING_UNDERSCORE_REGEXP_2, '_')\n .toLowerCase();\n}\n\n/**\n Returns the Capitalized form of a string\n\n ```javascript\n 'innerHTML'.capitalize() // 'InnerHTML'\n 'action_name'.capitalize() // 'Action_name'\n 'css-class-name'.capitalize() // 'Css-class-name'\n 'my favorite items'.capitalize() // 'My favorite items'\n ```\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.substring(1);\n}\n\n/**\n Returns the plural form of a string\n\n ```javascript\n 'innerHTML'.pluralize() // 'innerHTMLs'\n 'action_name'.pluralize() // 'actionNames'\n 'css-class-name'.pluralize() // 'cssClassNames'\n 'regex'.pluralize() // 'regexes'\n 'user'.pluralize() // 'users'\n ```\n */\nexport function pluralize(str: string): string {\n return camelize(\n [/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(\n (c, i) => (str = str.replace(c, `$1${'iv'[i] || ''}e`))\n ) && str + 's'\n );\n}\n\nexport function group(name: string, group: string | undefined) {\n return group ? `${group}/${name}` : name;\n}\n\nexport function featurePath(\n group: boolean | undefined,\n flat: boolean | undefined,\n path: string,\n name: string\n) {\n if (group && !flat) {\n return `../../${path}/${name}/`;\n }\n\n return group ? `../${path}/` : './';\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updatePackage =
|
|
3
|
+
exports.updatePackage = updatePackage;
|
|
4
4
|
var schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
function updatePackage(name) {
|
|
6
6
|
return function (tree, context) {
|
|
@@ -27,7 +27,6 @@ function updatePackage(name) {
|
|
|
27
27
|
return tree;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
exports.updatePackage = updatePackage;
|
|
31
30
|
function match(value, test) {
|
|
32
31
|
return value === test ? test : '';
|
|
33
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../../modules/entity/schematics-core/utility/update.ts"],"names":[],"mappings":";;AAOA,sCA+BC;AAtCD,yDAKoC;AAEpC,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAM,OAAO,GAAG,eAAe,CAAC;QAChC,IAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,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AC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import {\n Rule,\n SchematicContext,\n Tree,\n SchematicsException,\n} from '@angular-devkit/schematics';\n\nexport function updatePackage(name: string): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const pkgPath = '/package.json';\n const buffer = tree.read(pkgPath);\n if (buffer === null) {\n throw new SchematicsException('Could not read package.json');\n }\n const content = buffer.toString();\n const pkg = JSON.parse(content);\n\n if (pkg === null || typeof pkg !== 'object' || Array.isArray(pkg)) {\n throw new SchematicsException('Error reading package.json');\n }\n\n const dependencyCategories = ['dependencies', 'devDependencies'];\n\n dependencyCategories.forEach((category) => {\n const packageName = `@ngrx/${name}`;\n\n if (pkg[category] && pkg[category][packageName]) {\n const firstChar = pkg[category][packageName][0];\n const suffix = match(firstChar, '^') || match(firstChar, '~');\n\n pkg[category][packageName] = `${suffix}6.0.0`;\n }\n });\n\n tree.overwrite(pkgPath, JSON.stringify(pkg, null, 2));\n\n return tree;\n };\n}\n\nfunction match(value: string, test: string) {\n return value === test ? test : '';\n}\n"]}
|
|
@@ -54,7 +54,13 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
54
54
|
return ar;
|
|
55
55
|
};
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.
|
|
57
|
+
exports.visitTSSourceFiles = visitTSSourceFiles;
|
|
58
|
+
exports.visitTemplates = visitTemplates;
|
|
59
|
+
exports.visitNgModuleImports = visitNgModuleImports;
|
|
60
|
+
exports.visitNgModuleExports = visitNgModuleExports;
|
|
61
|
+
exports.visitComponents = visitComponents;
|
|
62
|
+
exports.visitNgModules = visitNgModules;
|
|
63
|
+
exports.visitDecorator = visitDecorator;
|
|
58
64
|
var ts = require("typescript");
|
|
59
65
|
var core_1 = require("@angular-devkit/core");
|
|
60
66
|
function visitTSSourceFiles(tree, visitor) {
|
|
@@ -75,7 +81,6 @@ function visitTSSourceFiles(tree, visitor) {
|
|
|
75
81
|
}
|
|
76
82
|
return result;
|
|
77
83
|
}
|
|
78
|
-
exports.visitTSSourceFiles = visitTSSourceFiles;
|
|
79
84
|
function visitTemplates(tree, visitor) {
|
|
80
85
|
visitTSSourceFiles(tree, function (source) {
|
|
81
86
|
visitComponents(source, function (_, decoratorExpressionNode) {
|
|
@@ -119,15 +124,12 @@ function visitTemplates(tree, visitor) {
|
|
|
119
124
|
});
|
|
120
125
|
});
|
|
121
126
|
}
|
|
122
|
-
exports.visitTemplates = visitTemplates;
|
|
123
127
|
function visitNgModuleImports(sourceFile, callback) {
|
|
124
128
|
visitNgModuleProperty(sourceFile, callback, 'imports');
|
|
125
129
|
}
|
|
126
|
-
exports.visitNgModuleImports = visitNgModuleImports;
|
|
127
130
|
function visitNgModuleExports(sourceFile, callback) {
|
|
128
131
|
visitNgModuleProperty(sourceFile, callback, 'exports');
|
|
129
132
|
}
|
|
130
|
-
exports.visitNgModuleExports = visitNgModuleExports;
|
|
131
133
|
function visitNgModuleProperty(sourceFile, callback, property) {
|
|
132
134
|
visitNgModules(sourceFile, function (_, decoratorExpressionNode) {
|
|
133
135
|
ts.forEachChild(decoratorExpressionNode, function findTemplates(n) {
|
|
@@ -145,11 +147,9 @@ function visitNgModuleProperty(sourceFile, callback, property) {
|
|
|
145
147
|
function visitComponents(sourceFile, callback) {
|
|
146
148
|
visitDecorator(sourceFile, 'Component', callback);
|
|
147
149
|
}
|
|
148
|
-
exports.visitComponents = visitComponents;
|
|
149
150
|
function visitNgModules(sourceFile, callback) {
|
|
150
151
|
visitDecorator(sourceFile, 'NgModule', callback);
|
|
151
152
|
}
|
|
152
|
-
exports.visitNgModules = visitNgModules;
|
|
153
153
|
function visitDecorator(sourceFile, decoratorName, callback) {
|
|
154
154
|
ts.forEachChild(sourceFile, function findClassDeclaration(node) {
|
|
155
155
|
if (!ts.isClassDeclaration(node)) {
|
|
@@ -179,7 +179,6 @@ function visitDecorator(sourceFile, decoratorName, callback) {
|
|
|
179
179
|
callback(classDeclarationNode, arg);
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
exports.visitDecorator = visitDecorator;
|
|
183
182
|
function visit(directory) {
|
|
184
183
|
var _a, _b, path, entry, content, source, e_2_1, _c, _d, path, e_3_1;
|
|
185
184
|
var e_2, _e, e_3, _f;
|