@ngageoint/mage.web-core-lib 6.3.0-beta.1 → 6.3.0-beta.4
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 +33 -2
- package/angular-cli/README.md +30 -0
- package/angular-cli/builders/fesm-amd.d.ts +2 -0
- package/angular-cli/builders/fesm-amd.js +112 -0
- package/angular-cli/builders/fesm-amd.js.map +1 -0
- package/angular-cli/builders/index.d.ts +1 -0
- package/angular-cli/builders/index.js +18 -0
- package/angular-cli/builders/index.js.map +1 -0
- package/angular-cli/builders/schema.json +23 -0
- package/angular-cli/builders.json +9 -0
- package/angular-cli/collection.json +14 -0
- package/angular-cli/schematics/ng-add/index.d.ts +8 -0
- package/angular-cli/schematics/ng-add/index.js +14 -0
- package/angular-cli/schematics/ng-add/index.js.map +1 -0
- package/angular-cli/schematics/plugin-library/index.d.ts +5 -0
- package/angular-cli/schematics/plugin-library/index.js +127 -0
- package/angular-cli/schematics/plugin-library/index.js.map +1 -0
- package/common/xhr-img.component.d.ts +2 -2
- package/common/xhr-img.component.d.ts.map +1 -1
- package/esm2020/common/xhr-img.component.mjs +4 -4
- package/esm2020/feed/feed.service.mjs +20 -20
- package/esm2020/paging/paging.cdk-data-source.adapter.mjs +1 -1
- package/esm2020/static-icon/static-icon.service.mjs +5 -5
- package/esm2020/user/user-read.service.mjs +4 -10
- package/feed/feed.service.d.ts +2 -2
- package/feed/feed.service.d.ts.map +1 -1
- package/fesm2015/ngageoint-mage.web-core-lib-common.mjs +3 -3
- package/fesm2015/ngageoint-mage.web-core-lib-common.mjs.map +1 -1
- package/fesm2015/ngageoint-mage.web-core-lib-feed.mjs +19 -19
- package/fesm2015/ngageoint-mage.web-core-lib-feed.mjs.map +1 -1
- package/fesm2015/ngageoint-mage.web-core-lib-paging.mjs.map +1 -1
- package/fesm2015/ngageoint-mage.web-core-lib-static-icon.mjs +4 -4
- package/fesm2015/ngageoint-mage.web-core-lib-static-icon.mjs.map +1 -1
- package/fesm2015/ngageoint-mage.web-core-lib-user.mjs +3 -9
- package/fesm2015/ngageoint-mage.web-core-lib-user.mjs.map +1 -1
- package/fesm2020/ngageoint-mage.web-core-lib-common.mjs +3 -3
- package/fesm2020/ngageoint-mage.web-core-lib-common.mjs.map +1 -1
- package/fesm2020/ngageoint-mage.web-core-lib-feed.mjs +19 -19
- package/fesm2020/ngageoint-mage.web-core-lib-feed.mjs.map +1 -1
- package/fesm2020/ngageoint-mage.web-core-lib-paging.mjs.map +1 -1
- package/fesm2020/ngageoint-mage.web-core-lib-static-icon.mjs +4 -4
- package/fesm2020/ngageoint-mage.web-core-lib-static-icon.mjs.map +1 -1
- package/fesm2020/ngageoint-mage.web-core-lib-user.mjs +3 -9
- package/fesm2020/ngageoint-mage.web-core-lib-user.mjs.map +1 -1
- package/package.json +35 -21
- package/paging/paging.cdk-data-source.adapter.d.ts +1 -1
- package/paging/paging.cdk-data-source.adapter.d.ts.map +1 -1
- package/static-icon/static-icon.service.d.ts +2 -2
- package/static-icon/static-icon.service.d.ts.map +1 -1
- package/user/user-read.service.d.ts +2 -2
- package/user/user-read.service.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MAGE Web Core Lib
|
|
2
2
|
|
|
3
3
|
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.13.
|
|
4
4
|
|
|
5
|
+
## Dependency notes
|
|
6
|
+
This library depends on Angular's `library` [schematic](https://github.com/angular/angular-cli/tree/main/packages/schematics/angular/library),
|
|
7
|
+
as well as Angular's `ng-packagr` [builder](https://github.com/angular/angular-cli/tree/main/packages/angular_devkit/build_angular/src/builders/ng-packagr),
|
|
8
|
+
to generate a library project, and bundle the project, respectively. This library's builder also directly invokes
|
|
9
|
+
`rollup` as the last step of the bundle process to generate an AMD module.
|
|
10
|
+
|
|
11
|
+
Ideally, this project would have peer dependencies on these packages to facilitate managing versions, while specifying
|
|
12
|
+
correlating `devDependencies` that reference the this root project's Angular-related dependencies. This would allow
|
|
13
|
+
development of this DevKit library to use the appropriate Angular libraries already installed at the parent level.
|
|
14
|
+
Similarly, a consuming project that adds this library would have Angular libraries installed at the top level of the
|
|
15
|
+
workspace, which should satisfy this library's peer dependencies, or cause an error during NPM's install process if the
|
|
16
|
+
consuming project does not supply compatible Angular libraries.
|
|
17
|
+
|
|
18
|
+
There are some hangups with that strategy, though, as of version 14 of the Angular suite of packages.
|
|
19
|
+
1. One of MAGE's dependencies, `@ajsf/material`, requires `rxjs` `^7.0.0`, but `@angular-devkit/*` libraries pin `rxjs`
|
|
20
|
+
to `6.6.7`, which causes TypeScript type conflicts at build time for this DevKit library. There are presently
|
|
21
|
+
some undesirable `any` casts to overcome the `rxjs` type conflicts. This should be fixed after upgrading to the
|
|
22
|
+
latest Angular, currently 17, whose `@angular-devkit/core` package pins `rxjs` to `7.8.1`.
|
|
23
|
+
1. This library tries to reference a dev dependency on `rollup` through `../node_modules/rollup`. This relative path
|
|
24
|
+
dependency triggers NPM to try to run `rollup`'s `prepare` script, which invokes a tool called `husky`, pulled from
|
|
25
|
+
`rollup`'s `devDependencies`. However, NPM does not install `devDependencies` of dependencies, so `husky` is absent
|
|
26
|
+
and `npm install` in this DevKit project exits with error. The workaround is to install `husky` as a dev dependency
|
|
27
|
+
of this project, which is not really correct.
|
|
28
|
+
|
|
29
|
+
Perhaps a better strategy is to just install the dependencies DevKit needs at the top level to manage the Angular
|
|
30
|
+
family of dependencies in one place, as opposed to managing and reconciling those dependency versions between the
|
|
31
|
+
root and sub-packages manually or with a custom script. NPM's workspaces feature may also facilitate shared dependency
|
|
32
|
+
management by hoisting common dependencies, but the [documentation](https://docs.npmjs.com/cli/v10/using-npm/workspaces)
|
|
33
|
+
does not mention that specifically. Other resources [state](https://blog.faizahmed.in/npm-workspaces#heading-what-are-npm-workspaces)
|
|
34
|
+
NPM does in fact hoist common dependencies.
|
|
35
|
+
|
|
5
36
|
## Code scaffolding
|
|
6
37
|
|
|
7
38
|
Run `ng generate component component-name --project core-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project core-lib`.
|
|
8
|
-
> Note: Don't forget to add `--project core-lib` or else it will be added to the default project in your `angular.json` file.
|
|
39
|
+
> Note: Don't forget to add `--project core-lib` or else it will be added to the default project in your `angular.json` file.
|
|
9
40
|
|
|
10
41
|
## Build
|
|
11
42
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Angular CLI Integration
|
|
2
|
+
|
|
3
|
+
This subfolder of modules contains Angular CLI integrations, including a [schematic]() and
|
|
4
|
+
[builder](), that facilitates creating MAGE web plugin bundles.
|
|
5
|
+
|
|
6
|
+
## Background
|
|
7
|
+
Before Angular 13, the Angular [Library](https://angular.dev/tools/libraries/creating-libraries) CLI tools and
|
|
8
|
+
[Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview#heading=h.k0mh3o8u5hx)
|
|
9
|
+
produced a [UMD](https://github.com/umdjs/umd) bundle by default. The UMD bundle was suitable to include in a plugin's
|
|
10
|
+
NPM package and for the core web app to download directly and load with [SystemJS](https://github.com/systemjs/systemjs)
|
|
11
|
+
at runtime to hook the plugin module into the web app. Angular 13, however, eliminated the UMD bundle output from the
|
|
12
|
+
[Angular Package Format](https://angular.dev/tools/libraries/angular-package-format) leaving only ECMAScript Module
|
|
13
|
+
(ESM) outputs, as opposed to a concatenated, resolved bundle. Angular's intention is that libraries are strictly a
|
|
14
|
+
development time construct, with the hosting application left to resolving, bundling, and tree-shaking the library's
|
|
15
|
+
`import` statements. MAGE, however, is using Angular libraries differently, creating a bundle that excludes shared
|
|
16
|
+
dependencies the host web app provides, but including dependencies specific to the library, such that the host web app
|
|
17
|
+
can load the library as one chunk dynamically at runtime. While native ESM could be a possibility for MAGE in the
|
|
18
|
+
future, a significant amount of evaluation and testing is necessary, and at minimum MAGE would require all instances to
|
|
19
|
+
run on HTTP/2 to maximize performance. The major issue would be all the transactions required to load the large number
|
|
20
|
+
of module entry points that MAGE, Angular, Angular Material, and others comprise. Whereas a conventional web app can
|
|
21
|
+
provide all the shared entry points by bare module specifier to SystemJS's named registry from a single bundle
|
|
22
|
+
downloaded initially, an ESM app must download each module separately on-demand as the JS engine processes `import`
|
|
23
|
+
statements. Even with HTTP/2 multiplexing, this could be a serious performance hit.
|
|
24
|
+
|
|
25
|
+
## Plugin Library Schematic
|
|
26
|
+
|
|
27
|
+
## AMD Builder
|
|
28
|
+
|
|
29
|
+
## TODO
|
|
30
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const build_angular_1 = require("@angular-devkit/build-angular");
|
|
5
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const rollup_1 = require("rollup");
|
|
8
|
+
const discover_packages_1 = require("ng-packagr/lib/ng-package/discover-packages");
|
|
9
|
+
const plugin_node_resolve_1 = require("@rollup/plugin-node-resolve");
|
|
10
|
+
const plugin_commonjs_1 = require("@rollup/plugin-commonjs");
|
|
11
|
+
const promises_1 = require("fs/promises");
|
|
12
|
+
function ngPackagrThenAmd(options, context) {
|
|
13
|
+
return (0, rxjs_1.concat)((0, build_angular_1.executeNgPackagrBuilder)(options, context).pipe((0, rxjs_1.tap)((x) => {
|
|
14
|
+
if (x.error) {
|
|
15
|
+
context.logger.error(x.error);
|
|
16
|
+
}
|
|
17
|
+
})),
|
|
18
|
+
/*
|
|
19
|
+
TODO:
|
|
20
|
+
cast to any works around type incompatibility between rxjs 6.6.7 from @angular-devkit/*
|
|
21
|
+
packages and rxjs 7 other angular packages. hopefully that goes away with an angular upgrade.
|
|
22
|
+
*/
|
|
23
|
+
(0, rxjs_1.defer)(async () => {
|
|
24
|
+
const buildInfo = await resolveBuildInfo(options, context);
|
|
25
|
+
const rollupResult = await rollupFesmToAmd(buildInfo);
|
|
26
|
+
if (rollupResult.success !== true) {
|
|
27
|
+
return rollupResult;
|
|
28
|
+
}
|
|
29
|
+
const packageJsonResult = await writeDistPackageJson(buildInfo);
|
|
30
|
+
return packageJsonResult;
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
async function resolveBuildInfo(options, context) {
|
|
34
|
+
const root = context.workspaceRoot;
|
|
35
|
+
const ngPackagePath = path.resolve(root, options.project);
|
|
36
|
+
const packages = await (0, discover_packages_1.discoverPackages)({ project: ngPackagePath });
|
|
37
|
+
const destDir = packages.dest;
|
|
38
|
+
const fesm2020Path = packages.primary.destinationFiles.fesm2020;
|
|
39
|
+
const amdName = `${packages.primary.flatModuleFile}.amd.js`;
|
|
40
|
+
const amdPath = path.resolve(destDir, amdName);
|
|
41
|
+
return {
|
|
42
|
+
options,
|
|
43
|
+
context,
|
|
44
|
+
packages,
|
|
45
|
+
ngPackagePath,
|
|
46
|
+
destDir,
|
|
47
|
+
fesm2020Path,
|
|
48
|
+
amdName: amdName,
|
|
49
|
+
amdPath: amdPath
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async function rollupFesmToAmd(buildInfo) {
|
|
53
|
+
const { context, fesm2020Path, amdPath } = buildInfo;
|
|
54
|
+
context.logger.info(`rolling FESM2020 to AMD ${JSON.stringify({
|
|
55
|
+
fesm2020Path,
|
|
56
|
+
amdPath
|
|
57
|
+
}, null, 2)}`);
|
|
58
|
+
try {
|
|
59
|
+
const roller = await (0, rollup_1.rollup)({
|
|
60
|
+
input: fesm2020Path,
|
|
61
|
+
plugins: [
|
|
62
|
+
(0, plugin_node_resolve_1.nodeResolve)({
|
|
63
|
+
resolveOnly: moduleId => {
|
|
64
|
+
const external = false
|
|
65
|
+
|| moduleId.startsWith('@angular/')
|
|
66
|
+
|| moduleId.startsWith('@ng-select/')
|
|
67
|
+
|| /^rxjs(\/.+)?/.test(moduleId);
|
|
68
|
+
return !external;
|
|
69
|
+
},
|
|
70
|
+
preferBuiltins: false
|
|
71
|
+
}),
|
|
72
|
+
(0, plugin_commonjs_1.default)()
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
const rolled = await roller.write({
|
|
76
|
+
format: 'amd',
|
|
77
|
+
file: amdPath
|
|
78
|
+
});
|
|
79
|
+
for (const rollOut of rolled.output) {
|
|
80
|
+
context.logger.info(`rolled ${rollOut.name} ${rollOut.type} ${rollOut.fileName}`);
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
success: true
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
context.logger.error('error creating amd module from fesm: ' + err);
|
|
88
|
+
console.error(err);
|
|
89
|
+
return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: err
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function writeDistPackageJson(buildInfo) {
|
|
96
|
+
const distPkg = {
|
|
97
|
+
...buildInfo.packages.primary.packageJson,
|
|
98
|
+
main: buildInfo.amdName
|
|
99
|
+
};
|
|
100
|
+
const distPkgPath = path.resolve(buildInfo.packages.primary.destinationPath, 'package.json');
|
|
101
|
+
const distPkgContent = JSON.stringify(distPkg, null, 2);
|
|
102
|
+
try {
|
|
103
|
+
buildInfo.context.logger.info(`writing dist package to ${distPkgPath}`);
|
|
104
|
+
await (0, promises_1.writeFile)(distPkgPath, distPkgContent);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
buildInfo.context.logger.error(`error writing dist package ${distPkgPath}: ${err}`);
|
|
108
|
+
}
|
|
109
|
+
return { success: true };
|
|
110
|
+
}
|
|
111
|
+
exports.default = (0, architect_1.createBuilder)(ngPackagrThenAmd);
|
|
112
|
+
//# sourceMappingURL=fesm-amd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fesm-amd.js","sourceRoot":"","sources":["../../../../projects/core-lib/angular-cli/builders/fesm-amd.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-0,0 +1 @@
|
|
|
1
|
+
export * from './fesm-amd';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fesm-amd"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/core-lib/angular-cli/builders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "ng-packagr Target",
|
|
4
|
+
"description": "plugin-library target options for Build Architect. Use to build MAGE plugin library projects.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The file path for the ng-packagr configuration file, relative to the current workspace."
|
|
10
|
+
},
|
|
11
|
+
"tsConfig": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
14
|
+
},
|
|
15
|
+
"watch": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"description": "Run build when files change.",
|
|
18
|
+
"default": false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"required": ["project"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Install the library to the target project.",
|
|
6
|
+
"factory": "./schematics/ng-add/index#ngAdd"
|
|
7
|
+
},
|
|
8
|
+
"plugin-library": {
|
|
9
|
+
"description": "Generate a new MAGE web plugin library project.",
|
|
10
|
+
"factory": "./schematics/plugin-library/index#mageWebPluginLibrary",
|
|
11
|
+
"schema": "../../../node_modules/@schematics/angular/library/schema.json"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Return an identity rule that leaves the workspace tree unchanged, as there
|
|
4
|
+
* are no default artifacts to add on installation. However, an ng-add
|
|
5
|
+
* schematic is necessary to support the `"ng-add"` package.json entry which
|
|
6
|
+
* tells `ng-add` to add the lib to `"devDependencies"`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ngAdd(): Rule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Return an identity rule that leaves the workspace tree unchanged, as there
|
|
6
|
+
* are no default artifacts to add on installation. However, an ng-add
|
|
7
|
+
* schematic is necessary to support the `"ng-add"` package.json entry which
|
|
8
|
+
* tells `ng-add` to add the lib to `"devDependencies"`.
|
|
9
|
+
*/
|
|
10
|
+
function ngAdd() {
|
|
11
|
+
return tree => tree;
|
|
12
|
+
}
|
|
13
|
+
exports.ngAdd = ngAdd;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/core-lib/angular-cli/schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,KAAK;IACnB,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;AACrB,CAAC;AAFD,sBAEC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { Schema as BaseLibraryOptions } from '@schematics/angular/library/schema';
|
|
3
|
+
export declare function mageWebPluginLibrary(options: PluginLibraryOptions): Rule;
|
|
4
|
+
export interface PluginLibraryOptions extends BaseLibraryOptions {
|
|
5
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mageWebPluginLibrary = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
6
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
7
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
8
|
+
const ts = require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript");
|
|
9
|
+
const semver_1 = require("semver");
|
|
10
|
+
function addPluginHookToEntryPoint(options) {
|
|
11
|
+
const entryFile = options.entryFile;
|
|
12
|
+
if (!entryFile) {
|
|
13
|
+
throw new schematics_1.SchematicsException('missing entryFile');
|
|
14
|
+
}
|
|
15
|
+
return async (tree, _context) => {
|
|
16
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
17
|
+
const project = workspace.projects.get(options.name);
|
|
18
|
+
if (!project) {
|
|
19
|
+
throw new schematics_1.SchematicsException(`project not found in workspace: ${project}`);
|
|
20
|
+
}
|
|
21
|
+
const libDirPath = `${project.sourceRoot}/lib`;
|
|
22
|
+
const libDir = tree.getDir(libDirPath);
|
|
23
|
+
const module = findLibraryNgModule(tree, libDir);
|
|
24
|
+
const moduleClassName = module.classDecl.name?.text;
|
|
25
|
+
const component = findLibraryComponent(tree, libDir);
|
|
26
|
+
const componentClassName = component.classDecl.name?.text;
|
|
27
|
+
const entryFilePath = `${project.sourceRoot}/${entryFile}.ts`;
|
|
28
|
+
const entryFileText = tree.readText(entryFilePath);
|
|
29
|
+
const entrySource = ts.createSourceFile(entryFilePath, entryFileText, ts.ScriptTarget.Latest, true);
|
|
30
|
+
const importCoreChange = (0, ast_utils_1.insertImport)(entrySource, entryFilePath, 'PluginHooks', '@ngageoint/mage.web-core-lib/plugin');
|
|
31
|
+
const importModuleChange = moduleClassName ? (0, ast_utils_1.insertImport)(entrySource, entryFilePath, moduleClassName, `./lib/${module.sourceFile.fileName.slice(0, -3)}`) : new change_1.NoopChange();
|
|
32
|
+
const importComponentChange = componentClassName ? (0, ast_utils_1.insertImport)(entrySource, entryFilePath, componentClassName, `./lib/${component.sourceFile.fileName.slice(0, -3)}`) : new change_1.NoopChange();
|
|
33
|
+
const packageJson = tree.readJson(`${project.root}/package.json`);
|
|
34
|
+
const packageName = packageJson.name;
|
|
35
|
+
const pluginExport = `
|
|
36
|
+
export const MAGE_WEB_HOOKS: PluginHooks = {
|
|
37
|
+
module: ${moduleClassName},
|
|
38
|
+
adminTab: {
|
|
39
|
+
title: '${packageName}',
|
|
40
|
+
tabContentComponent: ${componentClassName},
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const exportNodes = (0, ast_utils_1.findNodes)(entrySource, ((x) => {
|
|
45
|
+
return [
|
|
46
|
+
ts.SyntaxKind.ExportAssignment,
|
|
47
|
+
ts.SyntaxKind.ExportDeclaration,
|
|
48
|
+
ts.SyntaxKind.ExportSpecifier,
|
|
49
|
+
ts.SyntaxKind.NamedExports,
|
|
50
|
+
].includes(x.kind);
|
|
51
|
+
}))
|
|
52
|
+
.sort((a, b) => a.getStart() - b.getStart());
|
|
53
|
+
const pluginExportChange = (0, ast_utils_1.insertAfterLastOccurrence)(exportNodes, pluginExport, entryFilePath, entrySource.end);
|
|
54
|
+
const edit = tree.beginUpdate(entryFilePath);
|
|
55
|
+
(0, change_1.applyToUpdateRecorder)(edit, [importCoreChange, importModuleChange, importComponentChange, pluginExportChange].filter(x => !!x));
|
|
56
|
+
tree.commitUpdate(edit);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function findLibraryNgModule(tree, baseDir) {
|
|
60
|
+
const fileName = baseDir.subfiles.find(x => /\.module\.ts$/.test(x)) || '';
|
|
61
|
+
const filePath = `${baseDir.path}/${fileName}`;
|
|
62
|
+
const fileText = tree.readText(filePath);
|
|
63
|
+
const source = ts.createSourceFile(fileName, fileText, ts.ScriptTarget.Latest, true);
|
|
64
|
+
const classDecl = (0, ast_utils_1.findNodes)(source, ts.SyntaxKind.ClassDeclaration)[0];
|
|
65
|
+
return { sourceFile: source, classDecl: classDecl };
|
|
66
|
+
}
|
|
67
|
+
function findLibraryComponent(tree, baseDir) {
|
|
68
|
+
const fileName = baseDir.subfiles.find(x => /\.component\.ts$/.test(x)) || '';
|
|
69
|
+
const filePath = `${baseDir.path}/${fileName}`;
|
|
70
|
+
const fileText = tree.readText(filePath);
|
|
71
|
+
const source = ts.createSourceFile(fileName, fileText, ts.ScriptTarget.Latest, true);
|
|
72
|
+
const classDecl = (0, ast_utils_1.findNodes)(source, ts.SyntaxKind.ClassDeclaration)[0];
|
|
73
|
+
return { sourceFile: source, classDecl: classDecl };
|
|
74
|
+
}
|
|
75
|
+
function useCustomBuilder(options) {
|
|
76
|
+
return (0, workspace_1.updateWorkspace)(workspace => {
|
|
77
|
+
const projName = options.name;
|
|
78
|
+
const project = workspace.projects.get(projName);
|
|
79
|
+
if (!project) {
|
|
80
|
+
throw new schematics_1.SchematicsException(`project not found in workspace: ${projName}`);
|
|
81
|
+
}
|
|
82
|
+
const target = project.targets.get('build');
|
|
83
|
+
project.targets.set('build', {
|
|
84
|
+
...target,
|
|
85
|
+
builder: '@ngageoint/mage.web-core-lib:amd'
|
|
86
|
+
});
|
|
87
|
+
workspace.projects.set(projName, project);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function addCorePeerDependency(options) {
|
|
91
|
+
return async (tree, _context) => {
|
|
92
|
+
const corePkg = require('@ngageoint/mage.web-core-lib/package.json');
|
|
93
|
+
const coreVersion = (0, semver_1.parse)(corePkg.version);
|
|
94
|
+
const coreVersionConstraint = !!coreVersion ? `^${coreVersion.major}.${coreVersion.minor}.${coreVersion.patch}` : null;
|
|
95
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
96
|
+
const project = workspace.projects.get(options.name);
|
|
97
|
+
if (!project) {
|
|
98
|
+
throw new schematics_1.SchematicsException(`project not found in workspace: ${options.name}`);
|
|
99
|
+
}
|
|
100
|
+
const packageJsonPath = `${project.root}/package.json`;
|
|
101
|
+
const packageJson = tree.readJson(packageJsonPath);
|
|
102
|
+
const packageJsonMod = {
|
|
103
|
+
...packageJson,
|
|
104
|
+
dependencies: {},
|
|
105
|
+
peerDependencies: {
|
|
106
|
+
'@ngageoint/mage.web-app': coreVersionConstraint
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
tree.overwrite(packageJsonPath, JSON.stringify(packageJsonMod, null, 2));
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function mageWebPluginLibrary(options) {
|
|
113
|
+
if (!options.name) {
|
|
114
|
+
throw new schematics_1.SchematicsException('missing name of the library to generate');
|
|
115
|
+
}
|
|
116
|
+
return (0, schematics_1.chain)([
|
|
117
|
+
(_tree, context) => {
|
|
118
|
+
context.logger.info(`creating MAGE web plugin library ${options.name}`);
|
|
119
|
+
},
|
|
120
|
+
(0, schematics_1.externalSchematic)('@schematics/angular', 'library', options),
|
|
121
|
+
useCustomBuilder(options),
|
|
122
|
+
addPluginHookToEntryPoint(options),
|
|
123
|
+
addCorePeerDependency(options),
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
exports.mageWebPluginLibrary = mageWebPluginLibrary;
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/core-lib/angular-cli/schematics/plugin-library/index.ts"],"names":[],"mappings":";;;AAAA,2DAAkH;AAElH,qEAAuF;AACvF,qEAA0G;AAC1G,+DAAsF;AACtF,qGAAoG;AAEpG,mCAA6C;AAE7C,SAAS,yBAAyB,CAAC,OAA6B;IAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;IACnC,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,gCAAmB,CAAC,mBAAmB,CAAC,CAAA;KACnD;IACD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC9B,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACpD,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,gCAAmB,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAA;SAC5E;QACD,MAAM,UAAU,GAAG,GAAG,OAAO,CAAC,UAAU,MAAM,CAAA;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACtC,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAChD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAA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Ac,GAAG;YACrB,GAAG,WAAW;YACd,YAAY,EAAE,EAAE;YAChB,gBAAgB,EAAE;gBAChB,yBAAyB,EAAE,qBAAqB;aACjD;SACF,CAAA;QACD,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC1E,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,OAA6B;IAChE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjB,MAAM,IAAI,gCAAmB,CAAC,yCAAyC,CAAC,CAAA;KACzE;IACD,OAAO,IAAA,kBAAK,EAAC;QACX,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACjB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QACzE,CAAC;QACD,IAAA,8BAAiB,EAAC,qBAAqB,EAAE,SAAS,EAAE,OAAO,CAAC;QAC5D,gBAAgB,CAAC,OAAO,CAAC;QACzB,yBAAyB,CAAC,OAAO,CAAC;QAClC,qBAAqB,CAAC,OAAO,CAAC;KAC/B,CAAC,CAAA;AACJ,CAAC;AAbD,oDAaC"}
|
|
@@ -42,13 +42,13 @@ export declare const OBJECT_URL_SERVICE: InjectionToken<ObjectUrlService>;
|
|
|
42
42
|
*/
|
|
43
43
|
export declare class XhrImgComponent implements OnChanges, OnDestroy {
|
|
44
44
|
private objectUrlService;
|
|
45
|
-
private
|
|
45
|
+
private webClient;
|
|
46
46
|
private sanitizer;
|
|
47
47
|
sourceUrl: string | null;
|
|
48
48
|
safeBlobUrl: SafeUrl | null;
|
|
49
49
|
private blobUrl;
|
|
50
50
|
private subscription;
|
|
51
|
-
constructor(objectUrlService: ObjectUrlService,
|
|
51
|
+
constructor(objectUrlService: ObjectUrlService, webClient: HttpClient, sanitizer: DomSanitizer);
|
|
52
52
|
ngOnChanges(changes: SimpleChanges): void;
|
|
53
53
|
ngOnDestroy(): void;
|
|
54
54
|
onImgLoad(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr-img.component.d.ts","sourceRoot":"","sources":["../../../projects/core-lib/common/xhr-img.component.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"xhr-img.component.d.ts","sourceRoot":"","sources":["../../../projects/core-lib/common/xhr-img.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,cAAc,EAAS,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;;AAKjE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAA;IAChD,eAAe,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAA;CACjD;AACD,eAAO,MAAM,kBAAkB,kCAAuE,CAAA;AAEtG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAWa,eAAgB,YAAW,SAAS,EAAE,SAAS;IASlB,OAAO,CAAC,gBAAgB;IAAoB,OAAO,CAAC,SAAS;IAAc,OAAO,CAAC,SAAS;IANpI,SAAS,EAAE,MAAM,GAAG,IAAI,CAAO;IAC/B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAO;IAElC,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,YAAY,CAAc;gBAEc,gBAAgB,EAAE,gBAAgB,EAAU,SAAS,EAAE,UAAU,EAAU,SAAS,EAAE,YAAY;IAElJ,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAmBzC,WAAW,IAAI,IAAI;IAInB,SAAS,IAAI,IAAI;IAIjB,OAAO,CAAC,cAAc;yCAtCX,eAAe;2CAAf,eAAe;CA+C3B"}
|
|
@@ -32,9 +32,9 @@ export const OBJECT_URL_SERVICE = new InjectionToken(`${selector}.objectUrlServi
|
|
|
32
32
|
* URLs for the image data, preventing memory leaks.
|
|
33
33
|
*/
|
|
34
34
|
export class XhrImgComponent {
|
|
35
|
-
constructor(objectUrlService,
|
|
35
|
+
constructor(objectUrlService, webClient, sanitizer) {
|
|
36
36
|
this.objectUrlService = objectUrlService;
|
|
37
|
-
this.
|
|
37
|
+
this.webClient = webClient;
|
|
38
38
|
this.sanitizer = sanitizer;
|
|
39
39
|
this.sourceUrl = null;
|
|
40
40
|
this.safeBlobUrl = null;
|
|
@@ -50,7 +50,7 @@ export class XhrImgComponent {
|
|
|
50
50
|
if (!this.sourceUrl) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
this.subscription = this.
|
|
53
|
+
this.subscription = this.webClient.get(this.sourceUrl, { responseType: 'blob' })
|
|
54
54
|
.subscribe(x => {
|
|
55
55
|
this.objectUrlService.revokeObjectURL(this.blobUrl);
|
|
56
56
|
this.blobUrl = this.objectUrlService.createObjectURL(x);
|
|
@@ -101,4 +101,4 @@ XhrImgComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: XhrImgCompo
|
|
|
101
101
|
type: Input,
|
|
102
102
|
args: ['src']
|
|
103
103
|
}] }); })();
|
|
104
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
104
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieGhyLWltZy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jb3JlLWxpYi9jb21tb24veGhyLWltZy5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsY0FBYyxFQUFFLEtBQUssRUFBd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