@ngrx/signals 20.0.1 → 21.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngrx-signals-entities.mjs.map +1 -1
- package/fesm2022/ngrx-signals-events.mjs +223 -61
- package/fesm2022/ngrx-signals-events.mjs.map +1 -1
- package/fesm2022/ngrx-signals-rxjs-interop.mjs +5 -5
- package/fesm2022/ngrx-signals-rxjs-interop.mjs.map +1 -1
- package/fesm2022/ngrx-signals.mjs +31 -25
- package/fesm2022/ngrx-signals.mjs.map +1 -1
- package/migrations/18_0_0-rc_3-protected-state/index.js +54 -23
- package/migrations/18_0_0-rc_3-protected-state/index.js.map +1 -1
- package/migrations/18_0_0-rc_3-writablestatesource/index.js +45 -12
- package/migrations/18_0_0-rc_3-writablestatesource/index.js.map +1 -1
- package/migrations/19_0_0-rc_0-props/index.js +72 -83
- package/migrations/19_0_0-rc_0-props/index.js.map +1 -1
- package/migrations/21_0_0-beta_0-rename-withEffects-to-withEventHandlers/index.js +103 -0
- package/migrations/21_0_0-beta_0-rename-withEffects-to-withEventHandlers/index.js.map +1 -0
- package/migrations/migration.json +5 -0
- package/package.json +8 -8
- package/schematics/ng-add/index.js +5 -5
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics-core/index.js +1 -1
- package/schematics-core/index.js.map +1 -1
- package/schematics-core/utility/ast-utils.js +198 -240
- package/schematics-core/utility/ast-utils.js.map +1 -1
- package/schematics-core/utility/change.js +68 -85
- package/schematics-core/utility/change.js.map +1 -1
- package/schematics-core/utility/config.js +7 -7
- package/schematics-core/utility/config.js.map +1 -1
- package/schematics-core/utility/find-component.js +20 -20
- package/schematics-core/utility/find-component.js.map +1 -1
- package/schematics-core/utility/find-module.js +21 -21
- package/schematics-core/utility/find-module.js.map +1 -1
- package/schematics-core/utility/json-utilts.js +4 -26
- 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 +110 -141
- package/schematics-core/utility/ngrx-utils.js.map +1 -1
- package/schematics-core/utility/package.js +2 -3
- package/schematics-core/utility/package.js.map +1 -1
- package/schematics-core/utility/parse-name.js +3 -3
- package/schematics-core/utility/parse-name.js.map +1 -1
- package/schematics-core/utility/project.js +13 -13
- package/schematics-core/utility/project.js.map +1 -1
- package/schematics-core/utility/strings.js +12 -12
- package/schematics-core/utility/strings.js.map +1 -1
- package/schematics-core/utility/update.js +12 -12
- package/schematics-core/utility/update.js.map +1 -1
- package/schematics-core/utility/visitors.js +78 -180
- package/schematics-core/utility/visitors.js.map +1 -1
- package/types/ngrx-signals-entities.d.ts +324 -0
- package/types/ngrx-signals-events.d.ts +360 -0
- package/types/ngrx-signals-rxjs-interop.d.ts +15 -0
- package/{testing/src/unprotected.d.ts → types/ngrx-signals-testing.d.ts} +5 -3
- package/types/ngrx-signals.d.ts +332 -0
- package/entities/index.d.ts +0 -1
- package/entities/src/entity-config.d.ts +0 -17
- package/entities/src/helpers.d.ts +0 -25
- package/entities/src/index.d.ts +0 -18
- package/entities/src/models.d.ts +0 -24
- package/entities/src/updaters/add-entities.d.ts +0 -17
- package/entities/src/updaters/add-entity.d.ts +0 -17
- package/entities/src/updaters/prepend-entities.d.ts +0 -17
- package/entities/src/updaters/prepend-entity.d.ts +0 -17
- package/entities/src/updaters/remove-all-entities.d.ts +0 -6
- package/entities/src/updaters/remove-entities.d.ts +0 -10
- package/entities/src/updaters/remove-entity.d.ts +0 -6
- package/entities/src/updaters/set-all-entities.d.ts +0 -17
- package/entities/src/updaters/set-entities.d.ts +0 -17
- package/entities/src/updaters/set-entity.d.ts +0 -17
- package/entities/src/updaters/update-all-entities.d.ts +0 -17
- package/entities/src/updaters/update-entities.d.ts +0 -56
- package/entities/src/updaters/update-entity.d.ts +0 -29
- package/entities/src/updaters/upsert-entities.d.ts +0 -17
- package/entities/src/updaters/upsert-entity.d.ts +0 -17
- package/entities/src/with-entities.d.ts +0 -22
- package/events/index.d.ts +0 -1
- package/events/src/case-reducer.d.ts +0 -20
- package/events/src/dispatcher.d.ts +0 -33
- package/events/src/event-creator-group.d.ts +0 -33
- package/events/src/event-creator.d.ts +0 -9
- package/events/src/event-instance.d.ts +0 -8
- package/events/src/events-service.d.ts +0 -47
- package/events/src/index.d.ts +0 -9
- package/events/src/inject-dispatch.d.ts +0 -46
- package/events/src/with-effects.d.ts +0 -28
- package/events/src/with-reducer.d.ts +0 -30
- package/index.d.ts +0 -1
- package/rxjs-interop/index.d.ts +0 -1
- package/rxjs-interop/src/index.d.ts +0 -1
- package/rxjs-interop/src/rx-method.d.ts +0 -12
- package/src/deep-computed.d.ts +0 -2
- package/src/deep-signal.d.ts +0 -6
- package/src/index.d.ts +0 -16
- package/src/signal-method.d.ts +0 -7
- package/src/signal-state.d.ts +0 -4
- package/src/signal-store-assertions.d.ts +0 -2
- package/src/signal-store-feature.d.ts +0 -29
- package/src/signal-store-models.d.ts +0 -30
- package/src/signal-store.d.ts +0 -142
- package/src/state-source.d.ts +0 -23
- package/src/ts-helpers.d.ts +0 -11
- package/src/with-computed.d.ts +0 -12
- package/src/with-feature.d.ts +0 -26
- package/src/with-hooks.d.ts +0 -14
- package/src/with-linked-state.d.ts +0 -52
- package/src/with-methods.d.ts +0 -8
- package/src/with-props.d.ts +0 -8
- package/src/with-state.d.ts +0 -11
- package/testing/index.d.ts +0 -1
- package/testing/src/index.d.ts +0 -1
|
@@ -10,7 +10,7 @@ exports.buildRelativePath = buildRelativePath;
|
|
|
10
10
|
* Use of this source code is governed by an MIT-style license that can be
|
|
11
11
|
* found in the LICENSE file at https://angular.io/license
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
14
|
/**
|
|
15
15
|
* Find the component referred by a set of options passed to the schematics.
|
|
16
16
|
*/
|
|
@@ -19,13 +19,13 @@ function findComponentFromOptions(host, options) {
|
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
if (!options.component) {
|
|
22
|
-
|
|
22
|
+
const pathToCheck = (options.path || '') +
|
|
23
23
|
(options.flat ? '' : '/' + core_1.strings.dasherize(options.name));
|
|
24
24
|
return (0, core_1.normalize)(findComponent(host, pathToCheck));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const componentPath = (0, core_1.normalize)('/' + options.path + '/' + options.component);
|
|
28
|
+
const componentBaseName = (0, core_1.normalize)(componentPath).split('/').pop();
|
|
29
29
|
if (host.exists(componentPath)) {
|
|
30
30
|
return (0, core_1.normalize)(componentPath);
|
|
31
31
|
}
|
|
@@ -39,7 +39,7 @@ function findComponentFromOptions(host, options) {
|
|
|
39
39
|
return (0, core_1.normalize)(componentPath + '/' + componentBaseName + '.component.ts');
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
throw new Error(
|
|
42
|
+
throw new Error(`Specified component path ${componentPath} does not exist`);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -47,10 +47,10 @@ function findComponentFromOptions(host, options) {
|
|
|
47
47
|
* Function to find the "closest" component to a generated file's path.
|
|
48
48
|
*/
|
|
49
49
|
function findComponent(host, generateDir) {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let dir = host.getDir('/' + generateDir);
|
|
51
|
+
const componentRe = /\.component\.ts$/;
|
|
52
52
|
while (dir) {
|
|
53
|
-
|
|
53
|
+
const matches = dir.subfiles.filter((p) => componentRe.test(p));
|
|
54
54
|
if (matches.length == 1) {
|
|
55
55
|
return (0, core_1.join)(dir.path, matches[0]);
|
|
56
56
|
}
|
|
@@ -67,26 +67,26 @@ function findComponent(host, generateDir) {
|
|
|
67
67
|
* Build a relative path from one file path to another file path.
|
|
68
68
|
*/
|
|
69
69
|
function buildRelativePath(from, to) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const { path: fromPath, filename: fromFileName, directory: fromDirectory, } = parsePath(from);
|
|
71
|
+
const { path: toPath, filename: toFileName, directory: toDirectory, } = parsePath(to);
|
|
72
|
+
const relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
|
|
73
|
+
const fixedRelativePath = relativePath.startsWith('.')
|
|
74
74
|
? relativePath
|
|
75
|
-
:
|
|
75
|
+
: `./${relativePath}`;
|
|
76
76
|
return !toFileName || toFileName === 'index.ts'
|
|
77
77
|
? fixedRelativePath
|
|
78
|
-
:
|
|
78
|
+
: `${fixedRelativePath.endsWith('/')
|
|
79
79
|
? fixedRelativePath
|
|
80
|
-
: fixedRelativePath + '/'
|
|
80
|
+
: fixedRelativePath + '/'}${convertToTypeScriptFileName(toFileName)}`;
|
|
81
81
|
}
|
|
82
82
|
function parsePath(path) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
const pathNormalized = (0, core_1.normalize)(path);
|
|
84
|
+
const filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : '';
|
|
85
|
+
const directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized;
|
|
86
86
|
return {
|
|
87
87
|
path: pathNormalized,
|
|
88
|
-
filename
|
|
89
|
-
directory
|
|
88
|
+
filename,
|
|
89
|
+
directory,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;AA8BA,4DAsCC;AAKD,sCAwBC;AAKD,8CAuBC;AA7HD;;;;;;GAMG;AACH
|
|
1
|
+
{"version":3,"file":"find-component.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/find-component.ts"],"names":[],"mappings":";;AA8BA,4DAsCC;AAKD,sCAwBC;AAKD,8CAuBC;AA7HD;;;;;;GAMG;AACH,+CAS8B;AAW9B;;GAEG;AACH,SA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ACZ,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,WAAW,GACvB,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;IAClB,MAAM,YAAY,GAAG,IAAA,eAAQ,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAC1D,MAAM,iBAAiB,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;IAExB,OAAO,CAAC,UAAU,IAAI,UAAU,KAAK,UAAU;QAC7C,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,GACE,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC7B,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,iBAAiB,GAAG,GAC1B,GAAG,2BAA2B,CAAC,UAAU,CAAC,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAS,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAA,eAAQ,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACtE,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ;QACR,SAAS;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"]}
|
|
@@ -10,7 +10,7 @@ exports.buildRelativePath = buildRelativePath;
|
|
|
10
10
|
* Use of this source code is governed by an MIT-style license that can be
|
|
11
11
|
* found in the LICENSE file at https://angular.io/license
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
14
|
/**
|
|
15
15
|
* Find the module referred by a set of options passed to the schematics.
|
|
16
16
|
*/
|
|
@@ -19,13 +19,13 @@ function findModuleFromOptions(host, options) {
|
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
if (!options.module) {
|
|
22
|
-
|
|
22
|
+
const pathToCheck = (options.path || '') +
|
|
23
23
|
(options.flat ? '' : '/' + core_1.strings.dasherize(options.name));
|
|
24
24
|
return (0, core_1.normalize)(findModule(host, pathToCheck));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const modulePath = (0, core_1.normalize)('/' + options.path + '/' + options.module);
|
|
28
|
+
const moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();
|
|
29
29
|
if (host.exists(modulePath)) {
|
|
30
30
|
return (0, core_1.normalize)(modulePath);
|
|
31
31
|
}
|
|
@@ -45,7 +45,7 @@ function findModuleFromOptions(host, options) {
|
|
|
45
45
|
return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '-module.ts');
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
throw new Error(
|
|
48
|
+
throw new Error(`Specified module path ${modulePath} does not exist`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -53,11 +53,11 @@ function findModuleFromOptions(host, options) {
|
|
|
53
53
|
* Function to find the "closest" module to a generated file's path.
|
|
54
54
|
*/
|
|
55
55
|
function findModule(host, generateDir) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
let dir = host.getDir('/' + generateDir);
|
|
57
|
+
const moduleRe = /(\.|-)module\.ts$/;
|
|
58
|
+
const routingModuleRe = /-routing(\.|-)module\.ts/;
|
|
59
59
|
while (dir) {
|
|
60
|
-
|
|
60
|
+
const matches = dir.subfiles.filter((p) => moduleRe.test(p) && !routingModuleRe.test(p));
|
|
61
61
|
if (matches.length == 1) {
|
|
62
62
|
return (0, core_1.join)(dir.path, matches[0]);
|
|
63
63
|
}
|
|
@@ -74,26 +74,26 @@ function findModule(host, generateDir) {
|
|
|
74
74
|
* Build a relative path from one file path to another file path.
|
|
75
75
|
*/
|
|
76
76
|
function buildRelativePath(from, to) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const { path: fromPath, filename: fromFileName, directory: fromDirectory, } = parsePath(from);
|
|
78
|
+
const { path: toPath, filename: toFileName, directory: toDirectory, } = parsePath(to);
|
|
79
|
+
const relativePath = (0, core_1.relative)(fromDirectory, toDirectory);
|
|
80
|
+
const fixedRelativePath = relativePath.startsWith('.')
|
|
81
81
|
? relativePath
|
|
82
|
-
:
|
|
82
|
+
: `./${relativePath}`;
|
|
83
83
|
return !toFileName || toFileName === 'index.ts'
|
|
84
84
|
? fixedRelativePath
|
|
85
|
-
:
|
|
85
|
+
: `${fixedRelativePath.endsWith('/')
|
|
86
86
|
? fixedRelativePath
|
|
87
|
-
: fixedRelativePath + '/'
|
|
87
|
+
: fixedRelativePath + '/'}${convertToTypeScriptFileName(toFileName)}`;
|
|
88
88
|
}
|
|
89
89
|
function parsePath(path) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
const pathNormalized = (0, core_1.normalize)(path);
|
|
91
|
+
const filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : '';
|
|
92
|
+
const directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized;
|
|
93
93
|
return {
|
|
94
94
|
path: pathNormalized,
|
|
95
|
-
filename
|
|
96
|
-
directory
|
|
95
|
+
filename,
|
|
96
|
+
directory,
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;AA8BA,sDAkCC;AAKD,gCA2BC;AAKD,8CAuBC;AA5HD;;;;;;GAMG;AACH
|
|
1
|
+
{"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/find-module.ts"],"names":[],"mappings":";;AA8BA,sDAkCC;AAKD,gCA2BC;AAKD,8CAuBC;AA5HD;;;;;;GAMG;AACH,+CAS8B;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,EA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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 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,35 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function(o) {
|
|
3
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
-
if (m) return m.call(o);
|
|
5
|
-
if (o && typeof o.length === "number") return {
|
|
6
|
-
next: function () {
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.findPropertyInAstObject = findPropertyInAstObject;
|
|
15
4
|
// https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/json-utils.ts
|
|
16
5
|
function findPropertyInAstObject(node, propertyName) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var property = _c.value;
|
|
22
|
-
if (property.key.value == propertyName) {
|
|
23
|
-
maybeNode = property.value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
28
|
-
finally {
|
|
29
|
-
try {
|
|
30
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6
|
+
let maybeNode = null;
|
|
7
|
+
for (const property of node.properties) {
|
|
8
|
+
if (property.key.value == propertyName) {
|
|
9
|
+
maybeNode = property.value;
|
|
31
10
|
}
|
|
32
|
-
finally { if (e_1) throw e_1.error; }
|
|
33
11
|
}
|
|
34
12
|
return maybeNode;
|
|
35
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/json-utilts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-utilts.js","sourceRoot":"","sources":["../../../../../modules/signals/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;IACjC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACvC,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;YACvC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,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/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAC","sourcesContent":["export const platformVersion = '^21.0.0-beta.0';\n"]}
|