@breadstone-infrastructure/nx-tasks 0.0.12-beta.13 → 0.0.12-beta.5
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/Index.d.ts +24 -21
- package/Index.d.ts.map +1 -1
- package/Index.js +39 -43
- package/Index.js.map +1 -1
- package/executors/alias-replace/executor.d.ts +3 -3
- package/executors/alias-replace/executor.d.ts.map +1 -1
- package/executors/alias-replace/executor.js +2 -25
- package/executors/alias-replace/executor.js.map +1 -1
- package/executors/clean/executor.d.ts +3 -3
- package/executors/clean/executor.d.ts.map +1 -1
- package/executors/clean/executor.js +2 -25
- package/executors/clean/executor.js.map +1 -1
- package/executors/copy/executor.d.ts +3 -3
- package/executors/copy/executor.d.ts.map +1 -1
- package/executors/copy/executor.js +2 -25
- package/executors/copy/executor.js.map +1 -1
- package/executors/docs/executor.d.ts +1 -1
- package/executors/docs/executor.d.ts.map +1 -1
- package/executors/docs/executor.js +2 -25
- package/executors/docs/executor.js.map +1 -1
- package/executors/doppler-config-sync/executor.d.ts +1 -1
- package/executors/doppler-config-sync/executor.d.ts.map +1 -1
- package/executors/doppler-config-sync/executor.js +2 -25
- package/executors/doppler-config-sync/executor.js.map +1 -1
- package/executors/icon-collection-builder/executor.d.ts +1 -1
- package/executors/icon-collection-builder/executor.d.ts.map +1 -1
- package/executors/icon-collection-builder/executor.js +2 -25
- package/executors/icon-collection-builder/executor.js.map +1 -1
- package/executors/icon-collection-downloader/executor.d.ts +2 -2
- package/executors/icon-collection-downloader/executor.d.ts.map +1 -1
- package/executors/icon-collection-downloader/executor.js +2 -25
- package/executors/icon-collection-downloader/executor.js.map +1 -1
- package/executors/lit-docs/executor.d.ts +3 -3
- package/executors/lit-docs/executor.d.ts.map +1 -1
- package/executors/lit-docs/executor.js +3 -28
- package/executors/lit-docs/executor.js.map +1 -1
- package/executors/lit-style-transform/executor.d.ts +2 -2
- package/executors/lit-style-transform/executor.d.ts.map +1 -1
- package/executors/lit-style-transform/executor.js +7 -30
- package/executors/lit-style-transform/executor.js.map +1 -1
- package/executors/localizator/executor.d.ts +1 -1
- package/executors/localizator/executor.d.ts.map +1 -1
- package/executors/localizator/executor.js +5 -26
- package/executors/localizator/executor.js.map +1 -1
- package/executors/markdown-to-typescript-transform/executor.d.ts +1 -1
- package/executors/markdown-to-typescript-transform/executor.d.ts.map +1 -1
- package/executors/markdown-to-typescript-transform/executor.js +2 -25
- package/executors/markdown-to-typescript-transform/executor.js.map +1 -1
- package/executors/ng-packagr-build/executor.d.ts +3 -3
- package/executors/ng-packagr-build/executor.d.ts.map +1 -1
- package/executors/ng-packagr-build/executor.js +2 -25
- package/executors/ng-packagr-build/executor.js.map +1 -1
- package/executors/ng-proxy-transform/executor.d.ts +3 -3
- package/executors/ng-proxy-transform/executor.d.ts.map +1 -1
- package/executors/ng-proxy-transform/executor.js +2 -25
- package/executors/ng-proxy-transform/executor.js.map +1 -1
- package/executors/openapi-generator/executor.d.ts +1 -1
- package/executors/openapi-generator/executor.d.ts.map +1 -1
- package/executors/openapi-generator/executor.js +2 -25
- package/executors/openapi-generator/executor.js.map +1 -1
- package/executors/react-proxy-transform/executor.d.ts +3 -3
- package/executors/react-proxy-transform/executor.d.ts.map +1 -1
- package/executors/react-proxy-transform/executor.js +2 -25
- package/executors/react-proxy-transform/executor.js.map +1 -1
- package/executors/release-package/executor.d.ts +3 -3
- package/executors/release-package/executor.d.ts.map +1 -1
- package/executors/release-package/executor.js +2 -25
- package/executors/release-package/executor.js.map +1 -1
- package/executors/release-package-json/executor.d.ts +3 -3
- package/executors/release-package-json/executor.d.ts.map +1 -1
- package/executors/release-package-json/executor.js +2 -25
- package/executors/release-package-json/executor.js.map +1 -1
- package/executors/styles-bundle/executor.d.ts +3 -3
- package/executors/styles-bundle/executor.d.ts.map +1 -1
- package/executors/styles-bundle/executor.js +2 -25
- package/executors/styles-bundle/executor.js.map +1 -1
- package/executors/unrelease-package/executor.d.ts +3 -3
- package/executors/unrelease-package/executor.d.ts.map +1 -1
- package/executors/unrelease-package/executor.js +2 -25
- package/executors/unrelease-package/executor.js.map +1 -1
- package/executors/vercel-edge-config-sync/executor.d.ts +1 -1
- package/executors/vercel-edge-config-sync/executor.d.ts.map +1 -1
- package/executors/vercel-edge-config-sync/executor.js +2 -25
- package/executors/vercel-edge-config-sync/executor.js.map +1 -1
- package/executors/vue-proxy-transform/executor.d.ts +3 -3
- package/executors/vue-proxy-transform/executor.d.ts.map +1 -1
- package/executors/vue-proxy-transform/executor.js +2 -25
- package/executors/vue-proxy-transform/executor.js.map +1 -1
- package/package.json +5 -24
- package/executors/alias-replace/executor.task.d.ts +0 -74
- package/executors/alias-replace/executor.task.d.ts.map +0 -1
- package/executors/alias-replace/executor.task.js +0 -256
- package/executors/alias-replace/executor.task.js.map +0 -1
- package/executors/clean/executor.task.d.ts +0 -17
- package/executors/clean/executor.task.d.ts.map +0 -1
- package/executors/clean/executor.task.js +0 -41
- package/executors/clean/executor.task.js.map +0 -1
- package/executors/copy/executor.task.d.ts +0 -36
- package/executors/copy/executor.task.d.ts.map +0 -1
- package/executors/copy/executor.task.js +0 -53
- package/executors/copy/executor.task.js.map +0 -1
- package/executors/docs/executor.task.d.ts +0 -23
- package/executors/docs/executor.task.d.ts.map +0 -1
- package/executors/docs/executor.task.js +0 -74
- package/executors/docs/executor.task.js.map +0 -1
- package/executors/doppler-config-sync/executor.task.d.ts +0 -23
- package/executors/doppler-config-sync/executor.task.d.ts.map +0 -1
- package/executors/doppler-config-sync/executor.task.js +0 -163
- package/executors/doppler-config-sync/executor.task.js.map +0 -1
- package/executors/icon-collection-builder/executor.task.d.ts +0 -14
- package/executors/icon-collection-builder/executor.task.d.ts.map +0 -1
- package/executors/icon-collection-builder/executor.task.js +0 -69
- package/executors/icon-collection-builder/executor.task.js.map +0 -1
- package/executors/icon-collection-downloader/executor.task.d.ts +0 -10
- package/executors/icon-collection-downloader/executor.task.d.ts.map +0 -1
- package/executors/icon-collection-downloader/executor.task.js +0 -122
- package/executors/icon-collection-downloader/executor.task.js.map +0 -1
- package/executors/lit-docs/JSDocChecker.d.ts +0 -104
- package/executors/lit-docs/JSDocChecker.d.ts.map +0 -1
- package/executors/lit-docs/JSDocChecker.js +0 -240
- package/executors/lit-docs/JSDocChecker.js.map +0 -1
- package/executors/lit-docs/executor.task.d.ts +0 -12
- package/executors/lit-docs/executor.task.d.ts.map +0 -1
- package/executors/lit-docs/executor.task.js +0 -233
- package/executors/lit-docs/executor.task.js.map +0 -1
- package/executors/lit-style-transform/executor.task.d.ts +0 -37
- package/executors/lit-style-transform/executor.task.d.ts.map +0 -1
- package/executors/lit-style-transform/executor.task.js +0 -351
- package/executors/lit-style-transform/executor.task.js.map +0 -1
- package/executors/localizator/executor.task.d.ts +0 -8
- package/executors/localizator/executor.task.d.ts.map +0 -1
- package/executors/localizator/executor.task.js +0 -153
- package/executors/localizator/executor.task.js.map +0 -1
- package/executors/markdown-to-typescript-transform/MarkdownRenderer.d.ts +0 -20
- package/executors/markdown-to-typescript-transform/MarkdownRenderer.d.ts.map +0 -1
- package/executors/markdown-to-typescript-transform/MarkdownRenderer.js +0 -74
- package/executors/markdown-to-typescript-transform/MarkdownRenderer.js.map +0 -1
- package/executors/markdown-to-typescript-transform/executor.task.d.ts +0 -25
- package/executors/markdown-to-typescript-transform/executor.task.d.ts.map +0 -1
- package/executors/markdown-to-typescript-transform/executor.task.js +0 -97
- package/executors/markdown-to-typescript-transform/executor.task.js.map +0 -1
- package/executors/ng-packagr-build/executor.task.d.ts +0 -11
- package/executors/ng-packagr-build/executor.task.d.ts.map +0 -1
- package/executors/ng-packagr-build/executor.task.js +0 -43
- package/executors/ng-packagr-build/executor.task.js.map +0 -1
- package/executors/ng-proxy-transform/executor.task.d.ts +0 -49
- package/executors/ng-proxy-transform/executor.task.d.ts.map +0 -1
- package/executors/ng-proxy-transform/executor.task.js +0 -386
- package/executors/ng-proxy-transform/executor.task.js.map +0 -1
- package/executors/openapi-generator/executor.task.d.ts +0 -20
- package/executors/openapi-generator/executor.task.d.ts.map +0 -1
- package/executors/openapi-generator/executor.task.js +0 -29
- package/executors/openapi-generator/executor.task.js.map +0 -1
- package/executors/react-proxy-transform/executor.task.d.ts +0 -44
- package/executors/react-proxy-transform/executor.task.d.ts.map +0 -1
- package/executors/react-proxy-transform/executor.task.js +0 -217
- package/executors/react-proxy-transform/executor.task.js.map +0 -1
- package/executors/release-package/executor.task.d.ts +0 -17
- package/executors/release-package/executor.task.d.ts.map +0 -1
- package/executors/release-package/executor.task.js +0 -177
- package/executors/release-package/executor.task.js.map +0 -1
- package/executors/release-package-json/executor.task.d.ts +0 -29
- package/executors/release-package-json/executor.task.d.ts.map +0 -1
- package/executors/release-package-json/executor.task.js +0 -167
- package/executors/release-package-json/executor.task.js.map +0 -1
- package/executors/styles-bundle/executor.task.d.ts +0 -20
- package/executors/styles-bundle/executor.task.d.ts.map +0 -1
- package/executors/styles-bundle/executor.task.js +0 -78
- package/executors/styles-bundle/executor.task.js.map +0 -1
- package/executors/unrelease-package/executor.task.d.ts +0 -13
- package/executors/unrelease-package/executor.task.d.ts.map +0 -1
- package/executors/unrelease-package/executor.task.js +0 -101
- package/executors/unrelease-package/executor.task.js.map +0 -1
- package/executors/vercel-edge-config-sync/executor.task.d.ts +0 -7
- package/executors/vercel-edge-config-sync/executor.task.d.ts.map +0 -1
- package/executors/vercel-edge-config-sync/executor.task.js +0 -46
- package/executors/vercel-edge-config-sync/executor.task.js.map +0 -1
- package/executors/vue-proxy-transform/executor.task.d.ts +0 -43
- package/executors/vue-proxy-transform/executor.task.d.ts.map +0 -1
- package/executors/vue-proxy-transform/executor.task.js +0 -201
- package/executors/vue-proxy-transform/executor.task.js.map +0 -1
- package/utils/TaskBase.d.ts +0 -13
- package/utils/TaskBase.d.ts.map +0 -1
- package/utils/TaskBase.js +0 -27
- package/utils/TaskBase.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.js","sourceRoot":"","s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K,CAAC,KAAK,GAAG,CAAC;YACrC,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;gBACb,GAAG,IAAI,WAAW,KAAK,CAAC,IAAI,GAAG,CAAC;YACpC,CAAC;YACD,GAAG,IAAI,mBAAmB,CAAC;YAC3B,OAAO,GAAG,CAAC;QACf,CAAC;KACJ,CAAC;AACN,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC1B,IAAI,CAAC;QACD,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,IAAiB,gBAAgB,CAEhC;AAFD,WAAiB,gBAAgB;IAChB,wBAAO,GAAG,oBAAoB,EAAE,CAAC;AAClD,CAAC,EAFgB,gBAAgB,gCAAhB,gBAAgB,QAEhC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type IFileCacheOptions } from '@breadstone-infrastructure/utilities';
|
|
2
|
-
import type { PackageJson, TsConfigJson } from 'type-fest';
|
|
3
|
-
/**
|
|
4
|
-
* @description Task to generate ts from markdown docs.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare namespace MarkdownToTypescriptTransformTask {
|
|
8
|
-
const DEFAULT_OPTIONS: {
|
|
9
|
-
templateFile: string;
|
|
10
|
-
ignore: string[];
|
|
11
|
-
verbose: boolean;
|
|
12
|
-
};
|
|
13
|
-
interface IMarkdownToTypescriptTransformTaskOptions {
|
|
14
|
-
cwd: string;
|
|
15
|
-
path: string;
|
|
16
|
-
packageJson: PackageJson;
|
|
17
|
-
tsConfigJson: TsConfigJson;
|
|
18
|
-
templateFile: string;
|
|
19
|
-
ignore: Array<string>;
|
|
20
|
-
verbose?: boolean;
|
|
21
|
-
cache: IFileCacheOptions;
|
|
22
|
-
}
|
|
23
|
-
function run(options: IMarkdownToTypescriptTransformTaskOptions): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=executor.task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.d.ts","sourceRoot":"","sources":["../../../src/executors/markdown-to-typescript-transform/executor.task.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,iBAAiB,EAA6D,MAAM,sCAAsC,CAAC;AAG/K,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAK3D;;;GAGG;AACH,yBAAiB,iCAAiC,CAAC;IAExC,MAAM,eAAe;;;;KAI3B,CAAC;IAEF,UAAiB,yCAAyC;QACtD,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,WAAW,CAAC;QACzB,YAAY,EAAE,YAAY,CAAC;QAC3B,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,EAAE,iBAAiB,CAAC;KAC5B;IAED,SAAsB,GAAG,CAAC,OAAO,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+E3F;CAMJ"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// #region Imports
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.MarkdownToTypescriptTransformTask = void 0;
|
|
8
|
-
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
9
|
-
const marked_1 = require("marked");
|
|
10
|
-
const prettier_1 = __importDefault(require("prettier"));
|
|
11
|
-
const MarkdownRenderer_1 = require("./MarkdownRenderer");
|
|
12
|
-
// #endregion
|
|
13
|
-
/**
|
|
14
|
-
* @description Task to generate ts from markdown docs.
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
var MarkdownToTypescriptTransformTask;
|
|
18
|
-
(function (MarkdownToTypescriptTransformTask) {
|
|
19
|
-
MarkdownToTypescriptTransformTask.DEFAULT_OPTIONS = {
|
|
20
|
-
templateFile: '.build/templates/DocTransform.ts.tpl',
|
|
21
|
-
ignore: ['index', 'app'],
|
|
22
|
-
verbose: false
|
|
23
|
-
};
|
|
24
|
-
async function run(options) {
|
|
25
|
-
const logger = new utilities_1.ConsoleLogger();
|
|
26
|
-
(0, utilities_1.logSeparator)(logger, 'Transforming docs');
|
|
27
|
-
const fileCache = new utilities_1.FileCache(options.cache);
|
|
28
|
-
if (!options.cache.enabled) {
|
|
29
|
-
(0, utilities_1.logBanner)(logger, 'warning', 'Caching is disabled', {
|
|
30
|
-
prefixSpaceLength: 2
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
// quickfix for txt files
|
|
34
|
-
utilities_1.File.glob(utilities_1.Path.combine(options.cwd, options.path, '**/*.txt')).forEach((x) => {
|
|
35
|
-
utilities_1.File.move(x, utilities_1.Path.changeExtension(x, '.json'));
|
|
36
|
-
});
|
|
37
|
-
const filesPath = utilities_1.Path.combine(options.cwd, options.path, '**/*.json');
|
|
38
|
-
const files = utilities_1.File.glob(filesPath);
|
|
39
|
-
let hasChanges = false;
|
|
40
|
-
if (options.verbose) {
|
|
41
|
-
logger.log((0, utilities_1.gray)(`search in: ${filesPath}`));
|
|
42
|
-
}
|
|
43
|
-
if (files.length) {
|
|
44
|
-
if (options.verbose) {
|
|
45
|
-
logger.log((0, utilities_1.gray)(`${files.length} files to transform`));
|
|
46
|
-
}
|
|
47
|
-
for (const x of files) {
|
|
48
|
-
// eslint-disable-next-line no-await-in-loop
|
|
49
|
-
if (!await fileCache.isFileCached(x)) {
|
|
50
|
-
hasChanges = true;
|
|
51
|
-
const fileName = utilities_1.Path.getFileName(x);
|
|
52
|
-
const outName = utilities_1.Path.changeExtension(x, '.ts');
|
|
53
|
-
(0, utilities_1.logPair)(logger, (0, utilities_1.magenta)(`from: '${utilities_1.Path.relative(options.cwd, x)}'`), (0, utilities_1.magenta)(`to: '${utilities_1.Path.relative(options.cwd, outName)}'`), {
|
|
54
|
-
prefixSpaceLength: 2
|
|
55
|
-
});
|
|
56
|
-
try {
|
|
57
|
-
const renderer = (0, MarkdownRenderer_1.createMarkedRenderer)({ wrapText: true });
|
|
58
|
-
marked_1.marked.use({ renderer });
|
|
59
|
-
const renderResult = (0, marked_1.marked)(utilities_1.File.readAllText(x));
|
|
60
|
-
const tplPath = utilities_1.Path.combine(options.cwd, options.templateFile);
|
|
61
|
-
const templateContent = utilities_1.File.readAllText(tplPath);
|
|
62
|
-
// const formatResult = await formatHtml(renderResult.toString());
|
|
63
|
-
const tpl = utilities_1.Template.create({
|
|
64
|
-
// TODO: add replaceFn here from options
|
|
65
|
-
name: utilities_1.Path.getFileNameWithoutExtension(fileName).replace('mosaik-', ''),
|
|
66
|
-
content: renderResult
|
|
67
|
-
}, { unescapeContent: true }).apply(templateContent)
|
|
68
|
-
.toString();
|
|
69
|
-
utilities_1.File.writeAllText(outName, tpl);
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
logger.error(`Error while transpiling '${fileName}'.`);
|
|
73
|
-
logger.error(`${error.message} in ${error.file} at ${error.line},${error.column}`);
|
|
74
|
-
utilities_1.File.writeAllText(outName, 'ERROR');
|
|
75
|
-
process.exit(-1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else if (options.verbose) {
|
|
79
|
-
logger.log((0, utilities_1.gray)(` File ${utilities_1.Path.relative(options.cwd, x)} is up to date.`));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (!hasChanges) {
|
|
83
|
-
logger.log((0, utilities_1.gray)(' Everything is up to date.'));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
logger.log((0, utilities_1.gray)('\tFile or Folder is up to date.'));
|
|
88
|
-
}
|
|
89
|
-
(0, utilities_1.logSeparator)(logger);
|
|
90
|
-
return Promise.resolve();
|
|
91
|
-
}
|
|
92
|
-
MarkdownToTypescriptTransformTask.run = run;
|
|
93
|
-
function formatHtml(html) {
|
|
94
|
-
return prettier_1.default.format(html, { parser: 'html' });
|
|
95
|
-
}
|
|
96
|
-
})(MarkdownToTypescriptTransformTask || (exports.MarkdownToTypescriptTransformTask = MarkdownToTypescriptTransformTask = {}));
|
|
97
|
-
//# sourceMappingURL=executor.task.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.js","sourceRoot":"","sources":["../../../src/executors/markdown-to-typescript-transform/executor.task.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;AAElB,oEAA+K;AAC/K,mCAAgC;AAChC,wDAAgC;AAEhC,yDAA0D;AAE1D,aAAa;AAEb;;;GAGG;AACH,IAAiB,iCAAiC,CAwGjD;AAxGD,WAAiB,iCAAiC;IAEjC,iDAAe,GAAG;QAC3B,YAAY,EAAE,sCAAsC;QACpD,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;QACxB,OAAO,EAAE,KAAK;KACjB,CAAC;IAaK,KAAK,UAAU,GAAG,CAAC,OAAkD;QACxE,MAAM,MAAM,GAAG,IAAI,yBAAa,EAAE,CAAC;QACnC,IAAA,wBAAY,EAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAE1C,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE/C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACzB,IAAA,qBAAS,EAAC,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE;gBAChD,iBAAiB,EAAE,CAAC;aACvB,CAAC,CAAC;QACP,CAAC;QAED,yBAAyB;QAC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AAC,IAAI,OAAO,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;wBAEnF,gBAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;wBACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACrB,CAAC;gBACL,CAAC;qBAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;oBACzB,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,SAAS,gBAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBAC9E,CAAC;YACL,CAAC;YAED,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,6BAA6B,CAAC,CAAC,CAAC;YACpD,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,iCAAiC,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,IAAA,wBAAY,EAAC,MAAM,CAAC,CAAC;QAErB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IA/EqB,qCAAG,MA+ExB,CAAA;IAED,SAAS,UAAU,CAAC,IAAY;QAC5B,OAAO,kBAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,CAAC;AAEL,CAAC,EAxGgB,iCAAiC,iDAAjC,iCAAiC,QAwGjD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Task to build angular projects with ng-packagr
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export declare namespace NgPackagrBuildTask {
|
|
6
|
-
interface INgPackagrBuildTaskOptions {
|
|
7
|
-
cwd: string;
|
|
8
|
-
}
|
|
9
|
-
function run(options: INgPackagrBuildTaskOptions): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=executor.task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.d.ts","sourceRoot":"","sources":["../../../src/executors/ng-packagr-build/executor.task.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,yBAAiB,kBAAkB,CAAC;IAEhC,UAAiB,0BAA0B;QACvC,GAAG,EAAE,MAAM,CAAC;KACf;IAED,SAAsB,GAAG,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B5E;CAEJ"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// #region Imports
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.NgPackagrBuildTask = void 0;
|
|
5
|
-
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
6
|
-
const ng_packagr_1 = require("ng-packagr");
|
|
7
|
-
// #endregion
|
|
8
|
-
/**
|
|
9
|
-
* @description Task to build angular projects with ng-packagr
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
var NgPackagrBuildTask;
|
|
13
|
-
(function (NgPackagrBuildTask) {
|
|
14
|
-
async function run(options) {
|
|
15
|
-
const logger = new utilities_1.ConsoleLogger();
|
|
16
|
-
(0, utilities_1.logSeparator)(logger, 'Ng Packagr Build');
|
|
17
|
-
try {
|
|
18
|
-
await (0, ng_packagr_1.ngPackagr)()
|
|
19
|
-
.forProject(utilities_1.Path.combine(options.cwd, 'ng-package.json'))
|
|
20
|
-
.withTsConfig(utilities_1.Path.combine(options.cwd, 'tsconfig.json'))
|
|
21
|
-
.build();
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
logger.error('Error while building the project with ng-packagr');
|
|
25
|
-
logger.error(error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
(0, utilities_1.logSeparator)(logger);
|
|
29
|
-
// .then(() => {
|
|
30
|
-
// File.delete(Path.combine(options.cwd, 'dist', 'package.json'));
|
|
31
|
-
// // Validate the output.
|
|
32
|
-
// // Sometimes it happens that the __ivy_ngcc__ files are not deleted.
|
|
33
|
-
// // If this occurs the compilation is faulty.
|
|
34
|
-
// if (Directory.exists(Path.combine(options.cwd, '__ivy_ngcc__'))) {
|
|
35
|
-
// Directory.delete(Path.combine(options.cwd, '__ivy_ngcc__'));
|
|
36
|
-
// logger.error('The __ivy_ngcc__ files were not removed correctly. Please clean up and create the project again.');
|
|
37
|
-
// // Throw new Error('The __ivy_ngcc__ files were not removed correctly. Please clean up and create the project again.');
|
|
38
|
-
// }
|
|
39
|
-
// })
|
|
40
|
-
}
|
|
41
|
-
NgPackagrBuildTask.run = run;
|
|
42
|
-
})(NgPackagrBuildTask || (exports.NgPackagrBuildTask = NgPackagrBuildTask = {}));
|
|
43
|
-
//# sourceMappingURL=executor.task.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.js","sourceRoot":"","sources":["../../../src/executors/ng-packagr-build/executor.task.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,oEAAyF;AACzF,2CAAuC;AAEvC,aAAa;AAEb;;;GAGG;AACH,IAAiB,kBAAkB,CAqClC;AArCD,WAAiB,kBAAkB;IAMxB,KAAK,UAAU,GAAG,CAAC,OAAmC;QACzD,MAAM,MAAM,GAAG,IAAI,yBAAa,EAAE,CAAC;QAEnC,IAAA,wBAAY,EAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAEzC,IAAI,CAAC;YACD,MAAM,IAAA,sBAAS,GAAE;iBACZ,UAAU,CAAC,gBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;iBACxD,YAAY,CAAC,gBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;iBACxD,KAAK,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACjE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,IAAA,wBAAY,EAAC,MAAM,CAAC,CAAC;QACrB,gBAAgB;QAChB,sEAAsE;QAEtE,8BAA8B;QAC9B,2EAA2E;QAC3E,mDAAmD;QACnD,yEAAyE;QACzE,uEAAuE;QACvE,4HAA4H;QAC5H,kIAAkI;QAClI,QAAQ;QACR,KAAK;IACT,CAAC;IA7BqB,sBAAG,MA6BxB,CAAA;AAEL,CAAC,EArCgB,kBAAkB,kCAAlB,kBAAkB,QAqClC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type IFileCacheOptions } from '@breadstone-infrastructure/utilities';
|
|
2
|
-
import type { PackageJson, TsConfigJson } from 'type-fest';
|
|
3
|
-
export declare namespace NgProxyTransformTask {
|
|
4
|
-
const DEFAULT_OPTIONS: {
|
|
5
|
-
standalone: boolean;
|
|
6
|
-
verbose: boolean;
|
|
7
|
-
cleanOut: boolean;
|
|
8
|
-
aliases: {};
|
|
9
|
-
controlValueAccessors: never[];
|
|
10
|
-
ignore: never[];
|
|
11
|
-
additionalExports: never[];
|
|
12
|
-
prettier: {
|
|
13
|
-
arrowParens: "always";
|
|
14
|
-
bracketSameLine: false;
|
|
15
|
-
bracketSpacing: true;
|
|
16
|
-
semi: true;
|
|
17
|
-
experimentalTernaries: true;
|
|
18
|
-
singleQuote: true;
|
|
19
|
-
jsxSingleQuote: false;
|
|
20
|
-
quoteProps: "as-needed";
|
|
21
|
-
trailingComma: "none";
|
|
22
|
-
singleAttributePerLine: false;
|
|
23
|
-
proseWrap: "never";
|
|
24
|
-
insertPragma: false;
|
|
25
|
-
requirePragma: false;
|
|
26
|
-
tabWidth: number;
|
|
27
|
-
useTabs: false;
|
|
28
|
-
embeddedLanguageFormatting: "auto";
|
|
29
|
-
printWidth: number;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
interface INgProxyTransformTaskOptions {
|
|
33
|
-
cwd: string;
|
|
34
|
-
path: string;
|
|
35
|
-
out: string;
|
|
36
|
-
cleanOut?: boolean;
|
|
37
|
-
packageJson: PackageJson;
|
|
38
|
-
tsConfigJson: TsConfigJson;
|
|
39
|
-
standalone?: boolean;
|
|
40
|
-
verbose?: boolean;
|
|
41
|
-
aliases?: Record<string, string>;
|
|
42
|
-
ignore?: Array<string>;
|
|
43
|
-
controlValueAccessors?: Array<string>;
|
|
44
|
-
additionalExports?: Array<string>;
|
|
45
|
-
cache: IFileCacheOptions;
|
|
46
|
-
}
|
|
47
|
-
function run(options: INgProxyTransformTaskOptions): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=executor.task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.task.d.ts","sourceRoot":"","sources":["../../../src/executors/ng-proxy-transform/executor.task.ts"],"names":[],"mappings":"AAQA,OAAO,EAA4E,KAAK,iBAAiB,EAAiE,MAAM,sCAAsC,CAAC;AAEvN,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI3D,yBAAiB,oBAAoB,CAAC;IAE3B,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B3B,CAAC;IAEF,UAAiB,4BAA4B;QACzC,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,WAAW,EAAE,WAAW,CAAC;QACzB,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACvB,qBAAqB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtC,iBAAiB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,EAAE,iBAAiB,CAAC;KAC5B;IAED,SAAsB,GAAG,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiH9E;CA8RJ"}
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
3
|
-
/* eslint-disable max-depth */
|
|
4
|
-
/* eslint-disable no-await-in-loop */
|
|
5
|
-
/* eslint-disable complexity */
|
|
6
|
-
// path: src/tasks/NgProxyTransformTask.ts
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.NgProxyTransformTask = void 0;
|
|
12
|
-
// #region Imports
|
|
13
|
-
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
14
|
-
const prettier_1 = __importDefault(require("prettier"));
|
|
15
|
-
// #endregion
|
|
16
|
-
var NgProxyTransformTask;
|
|
17
|
-
(function (NgProxyTransformTask) {
|
|
18
|
-
NgProxyTransformTask.DEFAULT_OPTIONS = {
|
|
19
|
-
standalone: false,
|
|
20
|
-
verbose: false,
|
|
21
|
-
cleanOut: false,
|
|
22
|
-
aliases: {},
|
|
23
|
-
controlValueAccessors: [],
|
|
24
|
-
ignore: [],
|
|
25
|
-
additionalExports: [],
|
|
26
|
-
prettier: {
|
|
27
|
-
arrowParens: 'always',
|
|
28
|
-
bracketSameLine: false,
|
|
29
|
-
bracketSpacing: true,
|
|
30
|
-
semi: true,
|
|
31
|
-
experimentalTernaries: true,
|
|
32
|
-
singleQuote: true,
|
|
33
|
-
jsxSingleQuote: false,
|
|
34
|
-
quoteProps: 'as-needed',
|
|
35
|
-
trailingComma: 'none',
|
|
36
|
-
singleAttributePerLine: false,
|
|
37
|
-
proseWrap: 'never',
|
|
38
|
-
insertPragma: false,
|
|
39
|
-
requirePragma: false,
|
|
40
|
-
tabWidth: 4,
|
|
41
|
-
useTabs: false,
|
|
42
|
-
embeddedLanguageFormatting: 'auto',
|
|
43
|
-
printWidth: 1200
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
async function run(options) {
|
|
47
|
-
const logger = new utilities_1.ConsoleLogger();
|
|
48
|
-
(0, utilities_1.logSeparator)(logger, 'Ng Proxy Transform');
|
|
49
|
-
const fileCache = new utilities_1.FileCache(options.cache);
|
|
50
|
-
if (!options.cache.enabled) {
|
|
51
|
-
(0, utilities_1.logBanner)(logger, 'warning', 'Caching is disabled', { prefixSpaceLength: 2 });
|
|
52
|
-
}
|
|
53
|
-
const textFiles = utilities_1.File.glob(utilities_1.Path.combine(options.cwd, options.path, '**/*.txt'));
|
|
54
|
-
textFiles.forEach((file) => {
|
|
55
|
-
const content = utilities_1.File.readAllText(file);
|
|
56
|
-
utilities_1.File.writeAllText(file.replace('.txt', '.json'), content);
|
|
57
|
-
utilities_1.File.delete(file);
|
|
58
|
-
});
|
|
59
|
-
const filesPath = utilities_1.Path.combine(options.cwd, options.path, '**/*.json');
|
|
60
|
-
const files = utilities_1.File.glob(filesPath);
|
|
61
|
-
const createdFiles = new Array();
|
|
62
|
-
if (options.verbose) {
|
|
63
|
-
logger.log((0, utilities_1.gray)(` Search for: ${filesPath}`));
|
|
64
|
-
}
|
|
65
|
-
if (files.length) {
|
|
66
|
-
if (options.verbose) {
|
|
67
|
-
logger.log((0, utilities_1.gray)(` ${files.length} files to transform`));
|
|
68
|
-
}
|
|
69
|
-
for (const file of files) {
|
|
70
|
-
if (!await fileCache.isFileCached(file)) {
|
|
71
|
-
try {
|
|
72
|
-
const doc = utilities_1.File.readAllJson(file);
|
|
73
|
-
const def = utilities_1.CustomElementManifest.readDefinition(doc);
|
|
74
|
-
const properties = utilities_1.CustomElementManifest.readProperties(doc);
|
|
75
|
-
const methods = utilities_1.CustomElementManifest.readMethods(doc);
|
|
76
|
-
const events = utilities_1.CustomElementManifest.readEvents(doc);
|
|
77
|
-
const out = getOutPathAndFile(def.declaration.module ?? '');
|
|
78
|
-
const tsFile = utilities_1.Path.combine(options.cwd, '../', doc.modules[0].path.replace('./../../../', ''));
|
|
79
|
-
if (!utilities_1.File.exists(tsFile)) {
|
|
80
|
-
logger.error(` File ${tsFile} does not exist.`);
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
if (options.ignore?.includes(def.name)) {
|
|
84
|
-
logger.log((0, utilities_1.gray)(` [IGNORE] ${utilities_1.Path.relative(options.cwd, file)}`));
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const outPath = utilities_1.Path.combine(options.cwd, options.out, out ?? '');
|
|
88
|
-
const utilsPath = utilities_1.Path.combine(options.cwd, 'src/utils/Proxy.ts');
|
|
89
|
-
const relativeUtilsPath = utilities_1.Path.relative(utilities_1.Path.getDirectoryName(outPath), utilsPath);
|
|
90
|
-
let result = createAngularComponentDefinition(relativeUtilsPath, def.name, properties.map((x) => x.name), events.map((x) => x.name), methods.map((x) => x.name), options.standalone ?? false, options.controlValueAccessors ?? [], options.aliases ?? {}, logger);
|
|
91
|
-
result += utilities_1.StringExtensions.newLine;
|
|
92
|
-
result += utilities_1.StringExtensions.newLine;
|
|
93
|
-
result += createAngularMethodsType(def.name, options.aliases ?? {}, methods.map((x) => x.name));
|
|
94
|
-
result += utilities_1.StringExtensions.newLine;
|
|
95
|
-
result += utilities_1.StringExtensions.newLine;
|
|
96
|
-
result += createAngularProviderForComponent(def.name, options.aliases ?? {});
|
|
97
|
-
result += utilities_1.StringExtensions.newLine;
|
|
98
|
-
result += utilities_1.StringExtensions.newLine;
|
|
99
|
-
result += createAngularModuleForComponent(def.name, options.standalone ?? false, options.aliases ?? {});
|
|
100
|
-
const formatted = await formatTypeScript(result);
|
|
101
|
-
const outFileExists = utilities_1.File.exists(outPath);
|
|
102
|
-
utilities_1.File.writeAllText(outPath, formatted);
|
|
103
|
-
createdFiles.push(utilities_1.Path.relative(options.cwd, outPath));
|
|
104
|
-
if (outFileExists) {
|
|
105
|
-
logger.log((0, utilities_1.blue)(` [UPDATE] ${out}`));
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
logger.log((0, utilities_1.green)(` [CREATE] ${out}`));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
logger.error(' Error while transforming.');
|
|
113
|
-
logger.error(`${error}`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (options.verbose) {
|
|
117
|
-
logger.log((0, utilities_1.gray)(` File ${utilities_1.Path.relative(options.cwd, file)} is up to date.`));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
const indexExports = createIndexExports(createdFiles, options.additionalExports ?? []);
|
|
122
|
-
const outPath = utilities_1.Path.combine(options.cwd, options.out, 'index.ts');
|
|
123
|
-
const formatted = await formatTypeScript(indexExports);
|
|
124
|
-
utilities_1.File.writeAllText(outPath, formatted);
|
|
125
|
-
logger.log((0, utilities_1.blue)(' [CREATE] Index.ts'));
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
logger.error('Error while transforming.');
|
|
129
|
-
logger.error(`${error}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
logger.log((0, utilities_1.gray)('\tFile or Folder is up to date.'));
|
|
134
|
-
}
|
|
135
|
-
(0, utilities_1.logSeparator)(logger);
|
|
136
|
-
}
|
|
137
|
-
NgProxyTransformTask.run = run;
|
|
138
|
-
function formatTypeScript(code) {
|
|
139
|
-
return prettier_1.default.format(code, {
|
|
140
|
-
parser: 'typescript',
|
|
141
|
-
...NgProxyTransformTask.DEFAULT_OPTIONS.prettier
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function createAngularMethodsType(tagName, aliases, methods) {
|
|
145
|
-
const pascalName = dashToPascalCase(tagName);
|
|
146
|
-
const lookupName = aliases[tagName] ?? null;
|
|
147
|
-
const controlName = lookupName ?? pascalName.replace('Mosaik', '');
|
|
148
|
-
const methodNamesUnion = methods.map((method) => `'${method}'`).join(' | ');
|
|
149
|
-
return `
|
|
150
|
-
/**
|
|
151
|
-
* Declares the methods available on ${controlName}Component.
|
|
152
|
-
*/
|
|
153
|
-
export type ${controlName}MethodNames = ${methodNamesUnion};
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Declares the methods interface for ${controlName}Component.
|
|
157
|
-
*/
|
|
158
|
-
export type ${controlName}ComponentMethods = MethodMap<${controlName}MethodNames>;
|
|
159
|
-
`.trim();
|
|
160
|
-
}
|
|
161
|
-
function createAngularProviderForComponent(componentTagName, aliases) {
|
|
162
|
-
const pascalName = dashToPascalCase(componentTagName);
|
|
163
|
-
const lookupName = Object.keys(aliases).includes(componentTagName) ? aliases[componentTagName] : null;
|
|
164
|
-
const controlName = lookupName ?? pascalName.replace('Mosaik', '');
|
|
165
|
-
const controlNameWithoutSuffix = lookupName ?? pascalName.replace('Mosaik', '');
|
|
166
|
-
return `
|
|
167
|
-
/**
|
|
168
|
-
* @public
|
|
169
|
-
*/
|
|
170
|
-
export function provide${controlName}(config: Partial<${controlNameWithoutSuffix}Element.Props>): EnvironmentProviders {
|
|
171
|
-
return makeEnvironmentProviders([
|
|
172
|
-
{
|
|
173
|
-
provide: ${controlNameWithoutSuffix.toUpperCase()}_DEFAULT_PROPS,
|
|
174
|
-
useValue: config,
|
|
175
|
-
},
|
|
176
|
-
]);
|
|
177
|
-
}`.trim();
|
|
178
|
-
}
|
|
179
|
-
function createAngularModuleForComponent(componentTagName, standalone, aliases) {
|
|
180
|
-
if (!standalone) {
|
|
181
|
-
const tagNameAsPascal = dashToPascalCase(componentTagName);
|
|
182
|
-
const componentClassName = `${tagNameAsPascal.replace('Mosaik', '')}Component`;
|
|
183
|
-
const moduleClassName = `${tagNameAsPascal}Module`;
|
|
184
|
-
const lookupName = Object.keys(aliases).includes(componentTagName) ? aliases[componentTagName] : null;
|
|
185
|
-
const controlNameWithoutSuffix = lookupName ?? tagNameAsPascal.replace('Mosaik', '');
|
|
186
|
-
return `
|
|
187
|
-
/**
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
190
|
-
@NgModule({
|
|
191
|
-
declarations: [${componentClassName}],
|
|
192
|
-
exports: [${componentClassName}]
|
|
193
|
-
})
|
|
194
|
-
export class ${moduleClassName} {
|
|
195
|
-
public static forRoot(config: Partial<${controlNameWithoutSuffix}Element.Props>): ModuleWithProviders<${moduleClassName}> {
|
|
196
|
-
return {
|
|
197
|
-
ngModule: ${moduleClassName},
|
|
198
|
-
providers: [{
|
|
199
|
-
provide: ${controlNameWithoutSuffix.toUpperCase()}_DEFAULT_PROPS,
|
|
200
|
-
useValue: config,
|
|
201
|
-
}]
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
}`.trim();
|
|
205
|
-
}
|
|
206
|
-
return '';
|
|
207
|
-
}
|
|
208
|
-
function createIndexExports(componentTagNames, additionalExports) {
|
|
209
|
-
return componentTagNames
|
|
210
|
-
.map((x) => utilities_1.Path.combine(utilities_1.Path.getDirectoryName(x), utilities_1.Path.getFileNameWithoutExtension(x)))
|
|
211
|
-
.map((x) => x.split('src/').pop())
|
|
212
|
-
.map((x) => `export * from './${x}';`)
|
|
213
|
-
.join('\n')
|
|
214
|
-
.concat('\n', additionalExports.map((x) => `export * from './${x}';`).join('\n'));
|
|
215
|
-
}
|
|
216
|
-
function dashToPascalCase(str) {
|
|
217
|
-
return str.toLowerCase()
|
|
218
|
-
.split('-')
|
|
219
|
-
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
220
|
-
.join('');
|
|
221
|
-
}
|
|
222
|
-
function getOutPathAndFile(original) {
|
|
223
|
-
return original.split('/src').pop()
|
|
224
|
-
?.replace('Element.ts', 'Component.ts');
|
|
225
|
-
}
|
|
226
|
-
function createAngularComponentDefinition(rootPath, tagName, inputs, outputs, methods, standalone, controlValueAccessors, aliases, logger) {
|
|
227
|
-
const pascalName = dashToPascalCase(tagName);
|
|
228
|
-
const lookupName = aliases[tagName] ?? null;
|
|
229
|
-
const controlValueAccessor = controlValueAccessors.includes(tagName);
|
|
230
|
-
const controlName = lookupName ?? pascalName.replace('Mosaik', '');
|
|
231
|
-
const className = `${controlName.replace('Mosaik', '')}Component`;
|
|
232
|
-
const parts = [
|
|
233
|
-
generateHeader(),
|
|
234
|
-
generateImports(rootPath, controlName, controlValueAccessor),
|
|
235
|
-
generatePropsToken(controlName),
|
|
236
|
-
generateProxyCmpDecorator(tagName, inputs, methods, controlName),
|
|
237
|
-
generateComponentDecorator(tagName, inputs, outputs, standalone, controlValueAccessor, className), `export class ${className} ${controlValueAccessor ? 'implements ControlValueAccessor' : ''} {`,
|
|
238
|
-
generateClassFields(controlName, outputs, controlValueAccessor),
|
|
239
|
-
generateConstructor(controlName, outputs, controlValueAccessor),
|
|
240
|
-
generateInputs(inputs, controlName),
|
|
241
|
-
generateOutputs(outputs),
|
|
242
|
-
controlValueAccessor ? generateControlValueAccessorMethods() : '',
|
|
243
|
-
generateInvokeMethod(controlName),
|
|
244
|
-
generateOnEmitMethod(),
|
|
245
|
-
'',
|
|
246
|
-
'}'
|
|
247
|
-
];
|
|
248
|
-
return parts.filter(Boolean).join('\n\n');
|
|
249
|
-
}
|
|
250
|
-
function generateHeader() {
|
|
251
|
-
return `
|
|
252
|
-
// ------------------------------------------------------------------------------
|
|
253
|
-
// <auto-generated>
|
|
254
|
-
// This code was generated by a tool.
|
|
255
|
-
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
256
|
-
// </auto-generated>
|
|
257
|
-
// ------------------------------------------------------------------------------
|
|
258
|
-
`;
|
|
259
|
-
}
|
|
260
|
-
function generateImports(rootPath, controlName, useCVA) {
|
|
261
|
-
return [
|
|
262
|
-
`import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EnvironmentProviders, EventEmitter, inject, InjectionToken, Input, makeEnvironmentProviders, ModuleWithProviders, NgModule, NgZone, Output${useCVA ? ', forwardRef' : ''} } from '@angular/core';`,
|
|
263
|
-
useCVA ? 'import { ControlValueAccessor, NG_VALUE_ACCESSOR } from \'@angular/forms\';' : '',
|
|
264
|
-
`import { ${controlName}Element${useCVA ? `, IElementValueAccessor, ${utilities_1.StringExtensions.firstCharToLowerCase(controlName)}ElementValueAccessor` : ''} } from '@breadstone/mosaik-elements-foundation';`,
|
|
265
|
-
`import { applyDefaults, HTMLComponent, ProxyCmp, proxyOutputs, MethodMap } from '${rootPath.replace('.ts', '').replace('utils', 'Utils')}';`
|
|
266
|
-
].filter(Boolean).join('\n');
|
|
267
|
-
}
|
|
268
|
-
function generatePropsToken(controlName) {
|
|
269
|
-
return `
|
|
270
|
-
export const ${controlName.toUpperCase()}_DEFAULT_PROPS = new InjectionToken<Partial<${controlName}Element.Props>>('${controlName.toUpperCase()}_DEFAULT_PROPS');
|
|
271
|
-
`;
|
|
272
|
-
}
|
|
273
|
-
function generateProxyCmpDecorator(tagName, inputs, methods, controlName) {
|
|
274
|
-
const formattedInputs = inputs.map((i) => `'${i}'`).join(', ');
|
|
275
|
-
const formattedMethods = methods.map((m) => `'${m}'`).join(', ');
|
|
276
|
-
return `
|
|
277
|
-
@ProxyCmp({
|
|
278
|
-
defineCustomElementFn: () => customElements.define('${tagName}', ${controlName}Element),
|
|
279
|
-
${inputs.length ? `inputs: [${formattedInputs}],` : ''}
|
|
280
|
-
${methods.length ? `methods: [${formattedMethods}],` : ''}
|
|
281
|
-
})
|
|
282
|
-
`.trim();
|
|
283
|
-
}
|
|
284
|
-
function generateComponentDecorator(tagName, inputs, outputs, standalone, controlValueAccessor, className) {
|
|
285
|
-
return `
|
|
286
|
-
@Component({
|
|
287
|
-
selector: '${tagName}',
|
|
288
|
-
standalone: ${standalone},
|
|
289
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
290
|
-
template: '<ng-content></ng-content>',
|
|
291
|
-
inputs: [${inputs.map((i) => `'${i}'`).join(', ')}],
|
|
292
|
-
outputs: [${outputs.map((o) => `'${o}'`).join(', ')}],
|
|
293
|
-
${controlValueAccessor ? `providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ${className}), multi: true }]` : ''}
|
|
294
|
-
})
|
|
295
|
-
`.trim();
|
|
296
|
-
}
|
|
297
|
-
function generateClassFields(controlName, outputs, controlValueAccessor) {
|
|
298
|
-
return `
|
|
299
|
-
private readonly _element: ${controlName}Element;
|
|
300
|
-
private readonly _zone: NgZone;
|
|
301
|
-
${controlValueAccessor ? 'private readonly _accessor: IElementValueAccessor;' : ''}
|
|
302
|
-
${outputs.map((o) => `private readonly _${o}: EventEmitter<unknown>;`).join('\n')}
|
|
303
|
-
`.trim();
|
|
304
|
-
}
|
|
305
|
-
function generateConstructor(controlName, outputs, controlValueAccessor) {
|
|
306
|
-
return `
|
|
307
|
-
public constructor() {
|
|
308
|
-
const cdr = inject(ChangeDetectorRef);
|
|
309
|
-
const props = inject(${controlName.toUpperCase()}_DEFAULT_PROPS, { optional: true });
|
|
310
|
-
const elementRef = inject(ElementRef);
|
|
311
|
-
const zone = inject(NgZone);
|
|
312
|
-
cdr.detach();
|
|
313
|
-
this._element = elementRef.nativeElement;
|
|
314
|
-
this._zone = zone;
|
|
315
|
-
${controlValueAccessor ? `this._accessor = ${utilities_1.StringExtensions.firstCharToLowerCase(controlName)}ElementValueAccessor(this._element); this._element.addController(this._accessor);` : ''}
|
|
316
|
-
${outputs.map((eventName) => `this._${eventName} = new EventEmitter<unknown>(); this._element.on('${eventName}', (e) => this.onEmit(this._${eventName}, e));`).join('\n')}
|
|
317
|
-
applyDefaults(this._element, props ?? {});
|
|
318
|
-
}
|
|
319
|
-
`.trim();
|
|
320
|
-
}
|
|
321
|
-
function generateInputs(inputs, controlName) {
|
|
322
|
-
return inputs.map((prop) => `
|
|
323
|
-
@Input()
|
|
324
|
-
public get ${prop}(): ${controlName}Element['${prop}'] {
|
|
325
|
-
// @ts-ignore - temporary fix for the type error
|
|
326
|
-
return this._element.${prop};
|
|
327
|
-
}
|
|
328
|
-
public set ${prop}(value: ${controlName}Element['${prop}']) {
|
|
329
|
-
this._zone.runOutsideAngular(() => {
|
|
330
|
-
// @ts-ignore - temporary fix for the type error
|
|
331
|
-
this._element.${prop} = value;
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
`).join('\n');
|
|
335
|
-
}
|
|
336
|
-
function generateOutputs(outputs) {
|
|
337
|
-
return outputs.map((o) => `
|
|
338
|
-
@Output()
|
|
339
|
-
public get ${o}(): EventEmitter<unknown> {
|
|
340
|
-
return this._${o};
|
|
341
|
-
}
|
|
342
|
-
`).join('\n');
|
|
343
|
-
}
|
|
344
|
-
function generateControlValueAccessorMethods() {
|
|
345
|
-
return `
|
|
346
|
-
public writeValue(obj: unknown): void {
|
|
347
|
-
this._accessor.writeValue(obj);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
public registerOnChange(fn: unknown): void {
|
|
351
|
-
this._accessor.registerOnChange(fn);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
public registerOnTouched(fn: unknown): void {
|
|
355
|
-
this._accessor.registerOnTouched(fn);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
public setDisabledState?(isDisabled: boolean): void {
|
|
359
|
-
this._accessor.setDisabled?.(isDisabled);
|
|
360
|
-
}
|
|
361
|
-
`.trim();
|
|
362
|
-
}
|
|
363
|
-
function generateInvokeMethod(controlName) {
|
|
364
|
-
return `
|
|
365
|
-
public invoke<TMethod extends ${controlName}MethodNames>(
|
|
366
|
-
method: TMethod,
|
|
367
|
-
...args: Parameters<${controlName}ComponentMethods[TMethod]>
|
|
368
|
-
): ReturnType<${controlName}ComponentMethods[TMethod]> {
|
|
369
|
-
return (this._element as any)[method](...args);
|
|
370
|
-
}
|
|
371
|
-
`.trim();
|
|
372
|
-
}
|
|
373
|
-
function generateOnEmitMethod() {
|
|
374
|
-
return `
|
|
375
|
-
private onEmit<T>(emitter: EventEmitter<T>, event: Event): void {
|
|
376
|
-
if (event instanceof CustomEvent) {
|
|
377
|
-
emitter.emit(event.detail);
|
|
378
|
-
} else {
|
|
379
|
-
emitter.emit();
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
`.trim();
|
|
383
|
-
}
|
|
384
|
-
// #endregion Templates > Component Generation
|
|
385
|
-
})(NgProxyTransformTask || (exports.NgProxyTransformTask = NgProxyTransformTask = {}));
|
|
386
|
-
//# sourceMappingURL=executor.task.js.map
|