@abp/ng.schematics 5.0.1 → 5.0.2
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/README.md +3 -3
- package/collection.json +29 -29
- package/commands/api/files-enum/proxy/__namespace@dir__/__name@kebab__.enum.ts.template +8 -8
- package/commands/api/files-model/proxy/__namespace@dir__/models.ts.template +9 -9
- package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +25 -25
- package/commands/api/index.d.ts +2 -2
- package/commands/api/index.js +112 -112
- package/commands/api/schema.json +45 -45
- package/commands/proxy-add/index.d.ts +2 -2
- package/commands/proxy-add/index.js +41 -41
- package/commands/proxy-add/schema.json +45 -45
- package/commands/proxy-index/index.d.ts +4 -4
- package/commands/proxy-index/index.js +14 -14
- package/commands/proxy-index/schema.json +18 -18
- package/commands/proxy-refresh/index.d.ts +3 -3
- package/commands/proxy-refresh/index.js +27 -27
- package/commands/proxy-refresh/schema.json +45 -45
- package/commands/proxy-remove/index.d.ts +3 -3
- package/commands/proxy-remove/index.js +33 -33
- package/commands/proxy-remove/schema.json +45 -45
- package/constants/api.d.ts +1 -1
- package/constants/api.js +4 -4
- package/constants/index.d.ts +4 -4
- package/constants/index.js +16 -16
- package/constants/proxy.d.ts +4 -4
- package/constants/proxy.js +24 -24
- package/constants/system-types.d.ts +1 -1
- package/constants/system-types.js +27 -27
- package/constants/volo.d.ts +1 -1
- package/constants/volo.js +4 -4
- package/enums/binding-source-id.d.ts +6 -6
- package/enums/binding-source-id.js +10 -10
- package/enums/exception.d.ts +16 -16
- package/enums/exception.js +2 -2
- package/enums/import-keyword.d.ts +4 -4
- package/enums/import-keyword.js +8 -8
- package/enums/index.d.ts +4 -4
- package/enums/index.js +16 -16
- package/enums/method-modifier.d.ts +6 -6
- package/enums/method-modifier.js +10 -10
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/models/api-definition.d.ts +72 -72
- package/models/api-definition.js +2 -2
- package/models/generate-proxy-schema.d.ts +18 -18
- package/models/generate-proxy-schema.js +2 -2
- package/models/import.d.ts +11 -11
- package/models/import.js +13 -13
- package/models/index.d.ts +10 -10
- package/models/index.js +22 -22
- package/models/method.d.ts +31 -31
- package/models/method.js +61 -61
- package/models/model.d.ts +48 -48
- package/models/model.js +71 -71
- package/models/project.d.ts +5 -5
- package/models/project.js +2 -2
- package/models/proxy-config.d.ts +4 -4
- package/models/proxy-config.js +2 -2
- package/models/service.d.ts +21 -21
- package/models/service.js +11 -11
- package/models/tree.d.ts +1 -1
- package/models/tree.js +2 -2
- package/models/util.d.ts +7 -7
- package/models/util.js +2 -2
- package/package.json +1 -1
- package/test-setup.d.ts +1 -1
- package/test-setup.js +3 -3
- package/utils/angular/ast-utils.d.ts +115 -115
- package/utils/angular/ast-utils.js +598 -598
- package/utils/angular/change.d.ts +66 -66
- package/utils/angular/change.js +96 -96
- package/utils/angular/config.d.ts +455 -455
- package/utils/angular/config.js +70 -70
- package/utils/angular/dependencies.d.ts +23 -23
- package/utils/angular/dependencies.js +58 -58
- package/utils/angular/find-module.d.ts +35 -35
- package/utils/angular/find-module.js +105 -105
- package/utils/angular/index.d.ts +17 -17
- package/utils/angular/index.js +29 -29
- package/utils/angular/json-file.d.ts +23 -23
- package/utils/angular/json-file.js +61 -61
- package/utils/angular/json-utils.d.ts +14 -14
- package/utils/angular/json-utils.js +158 -158
- package/utils/angular/latest-versions.d.ts +18 -18
- package/utils/angular/latest-versions.js +26 -26
- package/utils/angular/lint-fix.d.ts +9 -9
- package/utils/angular/lint-fix.js +41 -41
- package/utils/angular/ng-ast-utils.d.ts +5 -5
- package/utils/angular/ng-ast-utils.js +75 -75
- package/utils/angular/parse-name.d.ts +13 -13
- package/utils/angular/parse-name.js +21 -21
- package/utils/angular/paths.d.ts +8 -8
- package/utils/angular/paths.js +21 -21
- package/utils/angular/project-targets.d.ts +9 -9
- package/utils/angular/project-targets.js +15 -15
- package/utils/angular/tsconfig.d.ts +16 -16
- package/utils/angular/tsconfig.js +62 -62
- package/utils/angular/validation.d.ts +4 -4
- package/utils/angular/validation.js +73 -73
- package/utils/angular/workspace-models.d.ts +159 -159
- package/utils/angular/workspace-models.js +29 -29
- package/utils/angular/workspace.d.ts +18 -18
- package/utils/angular/workspace.js +75 -75
- package/utils/api.d.ts +2 -2
- package/utils/api.js +8 -8
- package/utils/ast.d.ts +4 -4
- package/utils/ast.js +23 -23
- package/utils/barrel.d.ts +4 -4
- package/utils/barrel.js +92 -92
- package/utils/common.d.ts +6 -6
- package/utils/common.js +33 -33
- package/utils/enum.d.ts +18 -18
- package/utils/enum.js +40 -40
- package/utils/file.d.ts +2 -2
- package/utils/file.js +9 -9
- package/utils/generics.d.ts +24 -24
- package/utils/generics.js +87 -87
- package/utils/import.d.ts +3 -3
- package/utils/import.js +11 -11
- package/utils/index.d.ts +19 -19
- package/utils/index.js +31 -31
- package/utils/model.d.ts +11 -11
- package/utils/model.js +141 -141
- package/utils/namespace.d.ts +1 -1
- package/utils/namespace.js +18 -18
- package/utils/path.d.ts +2 -2
- package/utils/path.js +36 -36
- package/utils/rule.d.ts +4 -4
- package/utils/rule.js +27 -27
- package/utils/service.d.ts +6 -6
- package/utils/service.js +82 -82
- package/utils/source.d.ts +13 -13
- package/utils/source.js +162 -162
- package/utils/text.d.ts +9 -9
- package/utils/text.js +46 -46
- package/utils/tree.d.ts +13 -13
- package/utils/tree.js +56 -56
- package/utils/type.d.ts +12 -12
- package/utils/type.js +102 -102
- package/utils/workspace.d.ts +8 -8
- package/utils/workspace.js +66 -66
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Builders = exports.ProjectType = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
8
|
-
*
|
|
9
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
10
|
-
* found in the LICENSE file at https://angular.io/license
|
|
11
|
-
*/
|
|
12
|
-
var ProjectType;
|
|
13
|
-
(function (ProjectType) {
|
|
14
|
-
ProjectType["Application"] = "application";
|
|
15
|
-
ProjectType["Library"] = "library";
|
|
16
|
-
})(ProjectType = exports.ProjectType || (exports.ProjectType = {}));
|
|
17
|
-
var Builders;
|
|
18
|
-
(function (Builders) {
|
|
19
|
-
Builders["AppShell"] = "@angular-devkit/build-angular:app-shell";
|
|
20
|
-
Builders["Server"] = "@angular-devkit/build-angular:server";
|
|
21
|
-
Builders["Browser"] = "@angular-devkit/build-angular:browser";
|
|
22
|
-
Builders["Karma"] = "@angular-devkit/build-angular:karma";
|
|
23
|
-
Builders["TsLint"] = "@angular-devkit/build-angular:tslint";
|
|
24
|
-
Builders["DeprecatedNgPackagr"] = "@angular-devkit/build-ng-packagr:build";
|
|
25
|
-
Builders["NgPackagr"] = "@angular-devkit/build-angular:ng-packagr";
|
|
26
|
-
Builders["DevServer"] = "@angular-devkit/build-angular:dev-server";
|
|
27
|
-
Builders["ExtractI18n"] = "@angular-devkit/build-angular:extract-i18n";
|
|
28
|
-
Builders["Protractor"] = "@angular-devkit/build-angular:protractor";
|
|
29
|
-
})(Builders = exports.Builders || (exports.Builders = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Builders = exports.ProjectType = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
8
|
+
*
|
|
9
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10
|
+
* found in the LICENSE file at https://angular.io/license
|
|
11
|
+
*/
|
|
12
|
+
var ProjectType;
|
|
13
|
+
(function (ProjectType) {
|
|
14
|
+
ProjectType["Application"] = "application";
|
|
15
|
+
ProjectType["Library"] = "library";
|
|
16
|
+
})(ProjectType = exports.ProjectType || (exports.ProjectType = {}));
|
|
17
|
+
var Builders;
|
|
18
|
+
(function (Builders) {
|
|
19
|
+
Builders["AppShell"] = "@angular-devkit/build-angular:app-shell";
|
|
20
|
+
Builders["Server"] = "@angular-devkit/build-angular:server";
|
|
21
|
+
Builders["Browser"] = "@angular-devkit/build-angular:browser";
|
|
22
|
+
Builders["Karma"] = "@angular-devkit/build-angular:karma";
|
|
23
|
+
Builders["TsLint"] = "@angular-devkit/build-angular:tslint";
|
|
24
|
+
Builders["DeprecatedNgPackagr"] = "@angular-devkit/build-ng-packagr:build";
|
|
25
|
+
Builders["NgPackagr"] = "@angular-devkit/build-angular:ng-packagr";
|
|
26
|
+
Builders["DevServer"] = "@angular-devkit/build-angular:dev-server";
|
|
27
|
+
Builders["ExtractI18n"] = "@angular-devkit/build-angular:extract-i18n";
|
|
28
|
+
Builders["Protractor"] = "@angular-devkit/build-angular:protractor";
|
|
29
|
+
})(Builders = exports.Builders || (exports.Builders = {}));
|
|
30
30
|
//# sourceMappingURL=workspace-models.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { workspaces } from '@angular-devkit/core';
|
|
9
|
-
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
10
|
-
export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | PromiseLike<void>): Rule;
|
|
11
|
-
export declare function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule;
|
|
12
|
-
export declare function getWorkspace(tree: Tree, path?: string): Promise<workspaces.WorkspaceDefinition>;
|
|
13
|
-
/**
|
|
14
|
-
* Build a default project path for generating.
|
|
15
|
-
* @param project The project which will have its default path generated.
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildDefaultPath(project: workspaces.ProjectDefinition): string;
|
|
18
|
-
export declare function createDefaultPath(tree: Tree, projectName: string): Promise<string>;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { workspaces } from '@angular-devkit/core';
|
|
9
|
+
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
10
|
+
export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | PromiseLike<void>): Rule;
|
|
11
|
+
export declare function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule;
|
|
12
|
+
export declare function getWorkspace(tree: Tree, path?: string): Promise<workspaces.WorkspaceDefinition>;
|
|
13
|
+
/**
|
|
14
|
+
* Build a default project path for generating.
|
|
15
|
+
* @param project The project which will have its default path generated.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildDefaultPath(project: workspaces.ProjectDefinition): string;
|
|
18
|
+
export declare function createDefaultPath(tree: Tree, projectName: string): Promise<string>;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDefaultPath = exports.buildDefaultPath = exports.getWorkspace = exports.updateWorkspace = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
-
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*/
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const workspace_models_1 = require("./workspace-models");
|
|
13
|
-
function createHost(tree) {
|
|
14
|
-
return {
|
|
15
|
-
async readFile(path) {
|
|
16
|
-
const data = tree.read(path);
|
|
17
|
-
if (!data) {
|
|
18
|
-
throw new Error('File not found.');
|
|
19
|
-
}
|
|
20
|
-
return core_1.virtualFs.fileBufferToString(data);
|
|
21
|
-
},
|
|
22
|
-
async writeFile(path, data) {
|
|
23
|
-
return tree.overwrite(path, data);
|
|
24
|
-
},
|
|
25
|
-
async isDirectory(path) {
|
|
26
|
-
// approximate a directory check
|
|
27
|
-
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
28
|
-
},
|
|
29
|
-
async isFile(path) {
|
|
30
|
-
return tree.exists(path);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function updateWorkspace(updaterOrWorkspace) {
|
|
35
|
-
return async (tree) => {
|
|
36
|
-
const host = createHost(tree);
|
|
37
|
-
if (typeof updaterOrWorkspace === 'function') {
|
|
38
|
-
const { workspace } = await core_1.workspaces.readWorkspace('/', host);
|
|
39
|
-
const result = updaterOrWorkspace(workspace);
|
|
40
|
-
if (result !== undefined) {
|
|
41
|
-
await result;
|
|
42
|
-
}
|
|
43
|
-
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
await core_1.workspaces.writeWorkspace(updaterOrWorkspace, host);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
exports.updateWorkspace = updateWorkspace;
|
|
51
|
-
async function getWorkspace(tree, path = '/') {
|
|
52
|
-
const host = createHost(tree);
|
|
53
|
-
const { workspace } = await core_1.workspaces.readWorkspace(path, host);
|
|
54
|
-
return workspace;
|
|
55
|
-
}
|
|
56
|
-
exports.getWorkspace = getWorkspace;
|
|
57
|
-
/**
|
|
58
|
-
* Build a default project path for generating.
|
|
59
|
-
* @param project The project which will have its default path generated.
|
|
60
|
-
*/
|
|
61
|
-
function buildDefaultPath(project) {
|
|
62
|
-
const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
|
|
63
|
-
const projectDirName = project.extensions['projectType'] === workspace_models_1.ProjectType.Application ? 'app' : 'lib';
|
|
64
|
-
return `${root}${projectDirName}`;
|
|
65
|
-
}
|
|
66
|
-
exports.buildDefaultPath = buildDefaultPath;
|
|
67
|
-
async function createDefaultPath(tree, projectName) {
|
|
68
|
-
const workspace = await getWorkspace(tree);
|
|
69
|
-
const project = workspace.projects.get(projectName);
|
|
70
|
-
if (!project) {
|
|
71
|
-
throw new Error('Specified project does not exist.');
|
|
72
|
-
}
|
|
73
|
-
return buildDefaultPath(project);
|
|
74
|
-
}
|
|
75
|
-
exports.createDefaultPath = createDefaultPath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDefaultPath = exports.buildDefaultPath = exports.getWorkspace = exports.updateWorkspace = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
9
|
+
* found in the LICENSE file at https://angular.io/license
|
|
10
|
+
*/
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const workspace_models_1 = require("./workspace-models");
|
|
13
|
+
function createHost(tree) {
|
|
14
|
+
return {
|
|
15
|
+
async readFile(path) {
|
|
16
|
+
const data = tree.read(path);
|
|
17
|
+
if (!data) {
|
|
18
|
+
throw new Error('File not found.');
|
|
19
|
+
}
|
|
20
|
+
return core_1.virtualFs.fileBufferToString(data);
|
|
21
|
+
},
|
|
22
|
+
async writeFile(path, data) {
|
|
23
|
+
return tree.overwrite(path, data);
|
|
24
|
+
},
|
|
25
|
+
async isDirectory(path) {
|
|
26
|
+
// approximate a directory check
|
|
27
|
+
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
|
|
28
|
+
},
|
|
29
|
+
async isFile(path) {
|
|
30
|
+
return tree.exists(path);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function updateWorkspace(updaterOrWorkspace) {
|
|
35
|
+
return async (tree) => {
|
|
36
|
+
const host = createHost(tree);
|
|
37
|
+
if (typeof updaterOrWorkspace === 'function') {
|
|
38
|
+
const { workspace } = await core_1.workspaces.readWorkspace('/', host);
|
|
39
|
+
const result = updaterOrWorkspace(workspace);
|
|
40
|
+
if (result !== undefined) {
|
|
41
|
+
await result;
|
|
42
|
+
}
|
|
43
|
+
await core_1.workspaces.writeWorkspace(workspace, host);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
await core_1.workspaces.writeWorkspace(updaterOrWorkspace, host);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.updateWorkspace = updateWorkspace;
|
|
51
|
+
async function getWorkspace(tree, path = '/') {
|
|
52
|
+
const host = createHost(tree);
|
|
53
|
+
const { workspace } = await core_1.workspaces.readWorkspace(path, host);
|
|
54
|
+
return workspace;
|
|
55
|
+
}
|
|
56
|
+
exports.getWorkspace = getWorkspace;
|
|
57
|
+
/**
|
|
58
|
+
* Build a default project path for generating.
|
|
59
|
+
* @param project The project which will have its default path generated.
|
|
60
|
+
*/
|
|
61
|
+
function buildDefaultPath(project) {
|
|
62
|
+
const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
|
|
63
|
+
const projectDirName = project.extensions['projectType'] === workspace_models_1.ProjectType.Application ? 'app' : 'lib';
|
|
64
|
+
return `${root}${projectDirName}`;
|
|
65
|
+
}
|
|
66
|
+
exports.buildDefaultPath = buildDefaultPath;
|
|
67
|
+
async function createDefaultPath(tree, projectName) {
|
|
68
|
+
const workspace = await getWorkspace(tree);
|
|
69
|
+
const project = workspace.projects.get(projectName);
|
|
70
|
+
if (!project) {
|
|
71
|
+
throw new Error('Specified project does not exist.');
|
|
72
|
+
}
|
|
73
|
+
return buildDefaultPath(project);
|
|
74
|
+
}
|
|
75
|
+
exports.createDefaultPath = createDefaultPath;
|
|
76
76
|
//# sourceMappingURL=workspace.js.map
|
package/utils/api.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GenerateProxySchema } from '../models';
|
|
2
|
-
export declare function createApisGenerator(schema: GenerateProxySchema, generated: string[]): import("@angular-devkit/schematics").Rule;
|
|
1
|
+
import { GenerateProxySchema } from '../models';
|
|
2
|
+
export declare function createApisGenerator(schema: GenerateProxySchema, generated: string[]): import("@angular-devkit/schematics").Rule;
|
package/utils/api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createApisGenerator = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
function createApisGenerator(schema, generated) {
|
|
6
|
-
return schematics_1.chain(generated.map(m => schematics_1.schematic('api', Object.assign(Object.assign({}, schema), { module: m }))));
|
|
7
|
-
}
|
|
8
|
-
exports.createApisGenerator = createApisGenerator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApisGenerator = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
function createApisGenerator(schema, generated) {
|
|
6
|
+
return schematics_1.chain(generated.map(m => schematics_1.schematic('api', Object.assign(Object.assign({}, schema), { module: m }))));
|
|
7
|
+
}
|
|
8
|
+
exports.createApisGenerator = createApisGenerator;
|
|
9
9
|
//# sourceMappingURL=api.js.map
|
package/utils/ast.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
export declare function findEnvironmentExpression(source: ts.SourceFile): ts.ObjectLiteralExpression | undefined;
|
|
3
|
-
export declare function getAssignedPropertyFromObjectliteral(expression: ts.ObjectLiteralExpression, variableSelector: string[]): string | undefined;
|
|
4
|
-
export declare function isBooleanStringOrNumberLiteral(node: ts.Node): node is ts.StringLiteral | ts.NumericLiteral | ts.BooleanLiteral;
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
export declare function findEnvironmentExpression(source: ts.SourceFile): ts.ObjectLiteralExpression | undefined;
|
|
3
|
+
export declare function getAssignedPropertyFromObjectliteral(expression: ts.ObjectLiteralExpression, variableSelector: string[]): string | undefined;
|
|
4
|
+
export declare function isBooleanStringOrNumberLiteral(node: ts.Node): node is ts.StringLiteral | ts.NumericLiteral | ts.BooleanLiteral;
|
package/utils/ast.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBooleanStringOrNumberLiteral = exports.getAssignedPropertyFromObjectliteral = exports.findEnvironmentExpression = void 0;
|
|
4
|
-
const ts = require("typescript");
|
|
5
|
-
const ast_utils_1 = require("./angular/ast-utils");
|
|
6
|
-
function findEnvironmentExpression(source) {
|
|
7
|
-
const expressions = ast_utils_1.findNodes(source, ts.isObjectLiteralExpression);
|
|
8
|
-
return expressions.find(expr => expr.getText().includes('production'));
|
|
9
|
-
}
|
|
10
|
-
exports.findEnvironmentExpression = findEnvironmentExpression;
|
|
11
|
-
function getAssignedPropertyFromObjectliteral(expression, variableSelector) {
|
|
12
|
-
const expressions = ast_utils_1.findNodes(expression, isBooleanStringOrNumberLiteral);
|
|
13
|
-
const literal = expressions.find(node => Boolean(variableSelector.reduceRight((acc, key) => { var _a; return ((_a = acc === null || acc === void 0 ? void 0 : acc.name) === null || _a === void 0 ? void 0 : _a.getText()) === key ? acc.parent.parent : undefined; }, node.parent)));
|
|
14
|
-
return literal ? literal.getText() : undefined;
|
|
15
|
-
}
|
|
16
|
-
exports.getAssignedPropertyFromObjectliteral = getAssignedPropertyFromObjectliteral;
|
|
17
|
-
function isBooleanStringOrNumberLiteral(node) {
|
|
18
|
-
return (ts.isStringLiteral(node) ||
|
|
19
|
-
ts.isNumericLiteral(node) ||
|
|
20
|
-
node.kind === ts.SyntaxKind.TrueKeyword ||
|
|
21
|
-
node.kind === ts.SyntaxKind.FalseKeyword);
|
|
22
|
-
}
|
|
23
|
-
exports.isBooleanStringOrNumberLiteral = isBooleanStringOrNumberLiteral;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBooleanStringOrNumberLiteral = exports.getAssignedPropertyFromObjectliteral = exports.findEnvironmentExpression = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const ast_utils_1 = require("./angular/ast-utils");
|
|
6
|
+
function findEnvironmentExpression(source) {
|
|
7
|
+
const expressions = ast_utils_1.findNodes(source, ts.isObjectLiteralExpression);
|
|
8
|
+
return expressions.find(expr => expr.getText().includes('production'));
|
|
9
|
+
}
|
|
10
|
+
exports.findEnvironmentExpression = findEnvironmentExpression;
|
|
11
|
+
function getAssignedPropertyFromObjectliteral(expression, variableSelector) {
|
|
12
|
+
const expressions = ast_utils_1.findNodes(expression, isBooleanStringOrNumberLiteral);
|
|
13
|
+
const literal = expressions.find(node => Boolean(variableSelector.reduceRight((acc, key) => { var _a; return ((_a = acc === null || acc === void 0 ? void 0 : acc.name) === null || _a === void 0 ? void 0 : _a.getText()) === key ? acc.parent.parent : undefined; }, node.parent)));
|
|
14
|
+
return literal ? literal.getText() : undefined;
|
|
15
|
+
}
|
|
16
|
+
exports.getAssignedPropertyFromObjectliteral = getAssignedPropertyFromObjectliteral;
|
|
17
|
+
function isBooleanStringOrNumberLiteral(node) {
|
|
18
|
+
return (ts.isStringLiteral(node) ||
|
|
19
|
+
ts.isNumericLiteral(node) ||
|
|
20
|
+
node.kind === ts.SyntaxKind.TrueKeyword ||
|
|
21
|
+
node.kind === ts.SyntaxKind.FalseKeyword);
|
|
22
|
+
}
|
|
23
|
+
exports.isBooleanStringOrNumberLiteral = isBooleanStringOrNumberLiteral;
|
|
24
24
|
//# sourceMappingURL=ast.js.map
|
package/utils/barrel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
-
export declare function createProxyIndexGenerator(targetPath: string): (tree: import("@angular-devkit/schematics/src/tree/interface").Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
3
|
-
export declare function createBarrelsGenerator(rootPath: string): (tree: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
4
|
-
export declare function generateBarrelFromPath(tree: Tree, indexPath: string): void;
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
export declare function createProxyIndexGenerator(targetPath: string): (tree: import("@angular-devkit/schematics/src/tree/interface").Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
3
|
+
export declare function createBarrelsGenerator(rootPath: string): (tree: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
4
|
+
export declare function generateBarrelFromPath(tree: Tree, indexPath: string): void;
|
package/utils/barrel.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateBarrelFromPath = exports.createBarrelsGenerator = exports.createProxyIndexGenerator = void 0;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const file_1 = require("./file");
|
|
7
|
-
function createProxyIndexGenerator(targetPath) {
|
|
8
|
-
return createBarrelsGenerator(targetPath + constants_1.PROXY_PATH);
|
|
9
|
-
}
|
|
10
|
-
exports.createProxyIndexGenerator = createProxyIndexGenerator;
|
|
11
|
-
function createBarrelsGenerator(rootPath) {
|
|
12
|
-
return (tree) => {
|
|
13
|
-
generateBarrelFromPath(tree, rootPath);
|
|
14
|
-
return tree;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
exports.createBarrelsGenerator = createBarrelsGenerator;
|
|
18
|
-
function generateBarrelFromPath(tree, indexPath) {
|
|
19
|
-
const saveFile = file_1.createFileSaver(tree);
|
|
20
|
-
const asterisk = collectAsteriskBarrel(tree, indexPath);
|
|
21
|
-
const named = collectNamedBarrel(tree, indexPath);
|
|
22
|
-
if (asterisk.exports.length + named.exports.length)
|
|
23
|
-
saveFile(indexPath + '/index.ts', generateBarrelContent(asterisk, named));
|
|
24
|
-
}
|
|
25
|
-
exports.generateBarrelFromPath = generateBarrelFromPath;
|
|
26
|
-
function generateBarrelContent(asterisk, named) {
|
|
27
|
-
const namedImports = !named.imports.length
|
|
28
|
-
? ''
|
|
29
|
-
: named.imports.join(`
|
|
30
|
-
`) +
|
|
31
|
-
`
|
|
32
|
-
`;
|
|
33
|
-
const namedExports = !named.exports.length
|
|
34
|
-
? ''
|
|
35
|
-
: `export { ${named.exports.join(', ')} };
|
|
36
|
-
`;
|
|
37
|
-
const asteriskExports = !asterisk.exports.length
|
|
38
|
-
? ''
|
|
39
|
-
: asterisk.exports.join(`
|
|
40
|
-
`) +
|
|
41
|
-
`
|
|
42
|
-
`;
|
|
43
|
-
return namedImports + asteriskExports + namedExports;
|
|
44
|
-
}
|
|
45
|
-
function collectNamedBarrel(tree, indexPath) {
|
|
46
|
-
const dir = tree.getDir(indexPath);
|
|
47
|
-
const barrel = new NamedBarrel();
|
|
48
|
-
dir.subdirs.forEach(fragment => {
|
|
49
|
-
const subDirPath = indexPath + '/' + fragment;
|
|
50
|
-
const subDir = tree.getDir(subDirPath);
|
|
51
|
-
let hasFiles = false;
|
|
52
|
-
subDir.visit(() => (hasFiles = true));
|
|
53
|
-
if (!hasFiles)
|
|
54
|
-
return;
|
|
55
|
-
const namespaceFragment = core_1.strings.classify(fragment);
|
|
56
|
-
barrel.imports.push(`import * as ${namespaceFragment} from './${fragment}';`);
|
|
57
|
-
barrel.exports.push(namespaceFragment);
|
|
58
|
-
generateBarrelFromPath(tree, subDirPath);
|
|
59
|
-
});
|
|
60
|
-
barrel.imports.sort();
|
|
61
|
-
barrel.exports.sort();
|
|
62
|
-
return barrel;
|
|
63
|
-
}
|
|
64
|
-
function collectAsteriskBarrel(tree, indexPath) {
|
|
65
|
-
const dir = tree.getDir(indexPath);
|
|
66
|
-
const barrel = new AsteriskBarrel();
|
|
67
|
-
dir.subfiles.forEach(fragment => {
|
|
68
|
-
if (!fragment.endsWith('.ts') || fragment === 'index.ts')
|
|
69
|
-
return;
|
|
70
|
-
barrel.exports.push(`export * from './${fragment.replace(/\.ts$/, '')}';`);
|
|
71
|
-
});
|
|
72
|
-
barrel.exports.sort();
|
|
73
|
-
return barrel;
|
|
74
|
-
}
|
|
75
|
-
class Barrel {
|
|
76
|
-
constructor() {
|
|
77
|
-
this.imports = [];
|
|
78
|
-
this.exports = [];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
class AsteriskBarrel extends Barrel {
|
|
82
|
-
constructor() {
|
|
83
|
-
super(...arguments);
|
|
84
|
-
this.type = 'Asterisk';
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
class NamedBarrel extends Barrel {
|
|
88
|
-
constructor() {
|
|
89
|
-
super(...arguments);
|
|
90
|
-
this.type = 'Named';
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateBarrelFromPath = exports.createBarrelsGenerator = exports.createProxyIndexGenerator = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const file_1 = require("./file");
|
|
7
|
+
function createProxyIndexGenerator(targetPath) {
|
|
8
|
+
return createBarrelsGenerator(targetPath + constants_1.PROXY_PATH);
|
|
9
|
+
}
|
|
10
|
+
exports.createProxyIndexGenerator = createProxyIndexGenerator;
|
|
11
|
+
function createBarrelsGenerator(rootPath) {
|
|
12
|
+
return (tree) => {
|
|
13
|
+
generateBarrelFromPath(tree, rootPath);
|
|
14
|
+
return tree;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.createBarrelsGenerator = createBarrelsGenerator;
|
|
18
|
+
function generateBarrelFromPath(tree, indexPath) {
|
|
19
|
+
const saveFile = file_1.createFileSaver(tree);
|
|
20
|
+
const asterisk = collectAsteriskBarrel(tree, indexPath);
|
|
21
|
+
const named = collectNamedBarrel(tree, indexPath);
|
|
22
|
+
if (asterisk.exports.length + named.exports.length)
|
|
23
|
+
saveFile(indexPath + '/index.ts', generateBarrelContent(asterisk, named));
|
|
24
|
+
}
|
|
25
|
+
exports.generateBarrelFromPath = generateBarrelFromPath;
|
|
26
|
+
function generateBarrelContent(asterisk, named) {
|
|
27
|
+
const namedImports = !named.imports.length
|
|
28
|
+
? ''
|
|
29
|
+
: named.imports.join(`
|
|
30
|
+
`) +
|
|
31
|
+
`
|
|
32
|
+
`;
|
|
33
|
+
const namedExports = !named.exports.length
|
|
34
|
+
? ''
|
|
35
|
+
: `export { ${named.exports.join(', ')} };
|
|
36
|
+
`;
|
|
37
|
+
const asteriskExports = !asterisk.exports.length
|
|
38
|
+
? ''
|
|
39
|
+
: asterisk.exports.join(`
|
|
40
|
+
`) +
|
|
41
|
+
`
|
|
42
|
+
`;
|
|
43
|
+
return namedImports + asteriskExports + namedExports;
|
|
44
|
+
}
|
|
45
|
+
function collectNamedBarrel(tree, indexPath) {
|
|
46
|
+
const dir = tree.getDir(indexPath);
|
|
47
|
+
const barrel = new NamedBarrel();
|
|
48
|
+
dir.subdirs.forEach(fragment => {
|
|
49
|
+
const subDirPath = indexPath + '/' + fragment;
|
|
50
|
+
const subDir = tree.getDir(subDirPath);
|
|
51
|
+
let hasFiles = false;
|
|
52
|
+
subDir.visit(() => (hasFiles = true));
|
|
53
|
+
if (!hasFiles)
|
|
54
|
+
return;
|
|
55
|
+
const namespaceFragment = core_1.strings.classify(fragment);
|
|
56
|
+
barrel.imports.push(`import * as ${namespaceFragment} from './${fragment}';`);
|
|
57
|
+
barrel.exports.push(namespaceFragment);
|
|
58
|
+
generateBarrelFromPath(tree, subDirPath);
|
|
59
|
+
});
|
|
60
|
+
barrel.imports.sort();
|
|
61
|
+
barrel.exports.sort();
|
|
62
|
+
return barrel;
|
|
63
|
+
}
|
|
64
|
+
function collectAsteriskBarrel(tree, indexPath) {
|
|
65
|
+
const dir = tree.getDir(indexPath);
|
|
66
|
+
const barrel = new AsteriskBarrel();
|
|
67
|
+
dir.subfiles.forEach(fragment => {
|
|
68
|
+
if (!fragment.endsWith('.ts') || fragment === 'index.ts')
|
|
69
|
+
return;
|
|
70
|
+
barrel.exports.push(`export * from './${fragment.replace(/\.ts$/, '')}';`);
|
|
71
|
+
});
|
|
72
|
+
barrel.exports.sort();
|
|
73
|
+
return barrel;
|
|
74
|
+
}
|
|
75
|
+
class Barrel {
|
|
76
|
+
constructor() {
|
|
77
|
+
this.imports = [];
|
|
78
|
+
this.exports = [];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
class AsteriskBarrel extends Barrel {
|
|
82
|
+
constructor() {
|
|
83
|
+
super(...arguments);
|
|
84
|
+
this.type = 'Asterisk';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class NamedBarrel extends Barrel {
|
|
88
|
+
constructor() {
|
|
89
|
+
super(...arguments);
|
|
90
|
+
this.type = 'Named';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
93
|
//# sourceMappingURL=barrel.js.map
|
package/utils/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
-
import * as ts from 'typescript';
|
|
3
|
-
export declare function interpolate(text: string, ...params: (string | number | boolean)[]): string;
|
|
4
|
-
export declare function isNullOrUndefined(value: any): value is null | undefined;
|
|
5
|
-
export declare function readFileInTree(tree: Tree, filePath: string): ts.SourceFile;
|
|
6
|
-
export declare function removeDefaultPlaceholders<T>(oldParams: T): T;
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
export declare function interpolate(text: string, ...params: (string | number | boolean)[]): string;
|
|
4
|
+
export declare function isNullOrUndefined(value: any): value is null | undefined;
|
|
5
|
+
export declare function readFileInTree(tree: Tree, filePath: string): ts.SourceFile;
|
|
6
|
+
export declare function removeDefaultPlaceholders<T>(oldParams: T): T;
|
package/utils/common.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeDefaultPlaceholders = exports.readFileInTree = exports.isNullOrUndefined = exports.interpolate = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const ts = require("typescript");
|
|
6
|
-
function interpolate(text, ...params) {
|
|
7
|
-
params.forEach((param, i) => {
|
|
8
|
-
const pattern = new RegExp('{\\s*' + i + '\\s*}');
|
|
9
|
-
text = text.replace(pattern, String(param));
|
|
10
|
-
});
|
|
11
|
-
return text;
|
|
12
|
-
}
|
|
13
|
-
exports.interpolate = interpolate;
|
|
14
|
-
function isNullOrUndefined(value) {
|
|
15
|
-
return value === null || value === undefined;
|
|
16
|
-
}
|
|
17
|
-
exports.isNullOrUndefined = isNullOrUndefined;
|
|
18
|
-
function readFileInTree(tree, filePath) {
|
|
19
|
-
const buffer = tree.read(filePath);
|
|
20
|
-
if (isNullOrUndefined(buffer))
|
|
21
|
-
throw new schematics_1.SchematicsException(interpolate("[File Not Found] There is no file at \"{0}\" path." /* FileNotFound */, filePath));
|
|
22
|
-
const text = buffer.toString('utf-8');
|
|
23
|
-
return ts.createSourceFile(filePath, text, ts.ScriptTarget.Latest, true);
|
|
24
|
-
}
|
|
25
|
-
exports.readFileInTree = readFileInTree;
|
|
26
|
-
function removeDefaultPlaceholders(oldParams) {
|
|
27
|
-
const newParams = {};
|
|
28
|
-
Object.entries(oldParams).forEach(([key, value]) => {
|
|
29
|
-
newParams[key] = value === '__default' ? undefined : value;
|
|
30
|
-
});
|
|
31
|
-
return newParams;
|
|
32
|
-
}
|
|
33
|
-
exports.removeDefaultPlaceholders = removeDefaultPlaceholders;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeDefaultPlaceholders = exports.readFileInTree = exports.isNullOrUndefined = exports.interpolate = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
function interpolate(text, ...params) {
|
|
7
|
+
params.forEach((param, i) => {
|
|
8
|
+
const pattern = new RegExp('{\\s*' + i + '\\s*}');
|
|
9
|
+
text = text.replace(pattern, String(param));
|
|
10
|
+
});
|
|
11
|
+
return text;
|
|
12
|
+
}
|
|
13
|
+
exports.interpolate = interpolate;
|
|
14
|
+
function isNullOrUndefined(value) {
|
|
15
|
+
return value === null || value === undefined;
|
|
16
|
+
}
|
|
17
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
18
|
+
function readFileInTree(tree, filePath) {
|
|
19
|
+
const buffer = tree.read(filePath);
|
|
20
|
+
if (isNullOrUndefined(buffer))
|
|
21
|
+
throw new schematics_1.SchematicsException(interpolate("[File Not Found] There is no file at \"{0}\" path." /* FileNotFound */, filePath));
|
|
22
|
+
const text = buffer.toString('utf-8');
|
|
23
|
+
return ts.createSourceFile(filePath, text, ts.ScriptTarget.Latest, true);
|
|
24
|
+
}
|
|
25
|
+
exports.readFileInTree = readFileInTree;
|
|
26
|
+
function removeDefaultPlaceholders(oldParams) {
|
|
27
|
+
const newParams = {};
|
|
28
|
+
Object.entries(oldParams).forEach(([key, value]) => {
|
|
29
|
+
newParams[key] = value === '__default' ? undefined : value;
|
|
30
|
+
});
|
|
31
|
+
return newParams;
|
|
32
|
+
}
|
|
33
|
+
exports.removeDefaultPlaceholders = removeDefaultPlaceholders;
|
|
34
34
|
//# sourceMappingURL=common.js.map
|