@magmonium/cli 0.7.8
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 +392 -0
- package/bin/README.md +244 -0
- package/bin/cli.js +55 -0
- package/bin/commands/assets-wc.js +249 -0
- package/bin/commands/assets.js +943 -0
- package/bin/commands/build.js +242 -0
- package/bin/commands/clean.js +621 -0
- package/bin/commands/compile-i18n.js +91 -0
- package/bin/commands/config-ci.js +266 -0
- package/bin/commands/configure-wc.js +167 -0
- package/bin/commands/connect.js +188 -0
- package/bin/commands/create-app.js +946 -0
- package/bin/commands/deploy.js +100 -0
- package/bin/commands/fix-i18n.js +40 -0
- package/bin/commands/generate.js +765 -0
- package/bin/commands/init/config-files.js +1114 -0
- package/bin/commands/init/mag-assets.js +541 -0
- package/bin/commands/init/mag-cli-config.js +120 -0
- package/bin/commands/init/monorepo-structure.js +735 -0
- package/bin/commands/init/package-json.js +308 -0
- package/bin/commands/init/project-structure.js +189 -0
- package/bin/commands/init/pwa-files.js +204 -0
- package/bin/commands/init/source-files.js +2596 -0
- package/bin/commands/init.js +591 -0
- package/bin/commands/lib.js +508 -0
- package/bin/commands/patch-wc-env.js +136 -0
- package/bin/commands/refractor.js +51 -0
- package/bin/commands/sanitize-i18n.js +41 -0
- package/bin/commands/translate.js +32 -0
- package/bin/commands/zip.js +540 -0
- package/package.json +53 -0
- package/src/compilers/button-group-compiler.d.ts +18 -0
- package/src/compilers/button-group-compiler.d.ts.map +1 -0
- package/src/compilers/button-group-compiler.js +151 -0
- package/src/compilers/button-group-compiler.js.map +1 -0
- package/src/compilers/copy-compiler.d.ts +14 -0
- package/src/compilers/copy-compiler.d.ts.map +1 -0
- package/src/compilers/copy-compiler.js +170 -0
- package/src/compilers/copy-compiler.js.map +1 -0
- package/src/compilers/field-compiler.d.ts +15 -0
- package/src/compilers/field-compiler.d.ts.map +1 -0
- package/src/compilers/field-compiler.js +153 -0
- package/src/compilers/field-compiler.js.map +1 -0
- package/src/compilers/form-compiler.d.ts +15 -0
- package/src/compilers/form-compiler.d.ts.map +1 -0
- package/src/compilers/form-compiler.js +220 -0
- package/src/compilers/form-compiler.js.map +1 -0
- package/src/compilers/logo-compiler.d.ts +14 -0
- package/src/compilers/logo-compiler.d.ts.map +1 -0
- package/src/compilers/logo-compiler.js +114 -0
- package/src/compilers/logo-compiler.js.map +1 -0
- package/src/compilers/options-compiler.d.ts +46 -0
- package/src/compilers/options-compiler.d.ts.map +1 -0
- package/src/compilers/options-compiler.js +329 -0
- package/src/compilers/options-compiler.js.map +1 -0
- package/src/compilers/pwa-build.d.ts +7 -0
- package/src/compilers/pwa-build.d.ts.map +1 -0
- package/src/compilers/pwa-build.js +62 -0
- package/src/compilers/pwa-build.js.map +1 -0
- package/src/compilers/svg-compiler.d.ts +12 -0
- package/src/compilers/svg-compiler.d.ts.map +1 -0
- package/src/compilers/svg-compiler.js +123 -0
- package/src/compilers/svg-compiler.js.map +1 -0
- package/src/compilers/tabs-compiler.d.ts +25 -0
- package/src/compilers/tabs-compiler.d.ts.map +1 -0
- package/src/compilers/tabs-compiler.js +422 -0
- package/src/compilers/tabs-compiler.js.map +1 -0
- package/src/compilers/theme-compiler.d.ts +14 -0
- package/src/compilers/theme-compiler.d.ts.map +1 -0
- package/src/compilers/theme-compiler.js +144 -0
- package/src/compilers/theme-compiler.js.map +1 -0
- package/src/compilers/translation-compiler.d.ts +17 -0
- package/src/compilers/translation-compiler.d.ts.map +1 -0
- package/src/compilers/translation-compiler.js +232 -0
- package/src/compilers/translation-compiler.js.map +1 -0
- package/src/compilers/web-component/index.d.ts +3 -0
- package/src/compilers/web-component/index.d.ts.map +1 -0
- package/src/compilers/web-component/index.js +6 -0
- package/src/compilers/web-component/index.js.map +1 -0
- package/src/compilers/web-component/lib/builder.d.ts +45 -0
- package/src/compilers/web-component/lib/builder.d.ts.map +1 -0
- package/src/compilers/web-component/lib/builder.js +341 -0
- package/src/compilers/web-component/lib/builder.js.map +1 -0
- package/src/compilers/web-component/lib/class-name.d.ts +4 -0
- package/src/compilers/web-component/lib/class-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/class-name.js +24 -0
- package/src/compilers/web-component/lib/class-name.js.map +1 -0
- package/src/compilers/web-component/lib/config-data.d.ts +9 -0
- package/src/compilers/web-component/lib/config-data.d.ts.map +1 -0
- package/src/compilers/web-component/lib/config-data.js +14 -0
- package/src/compilers/web-component/lib/config-data.js.map +1 -0
- package/src/compilers/web-component/lib/ng-build.d.ts +8 -0
- package/src/compilers/web-component/lib/ng-build.d.ts.map +1 -0
- package/src/compilers/web-component/lib/ng-build.js +685 -0
- package/src/compilers/web-component/lib/ng-build.js.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts +9 -0
- package/src/compilers/web-component/lib/resource-inliner.d.ts.map +1 -0
- package/src/compilers/web-component/lib/resource-inliner.js +355 -0
- package/src/compilers/web-component/lib/resource-inliner.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-name.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-name.js +47 -0
- package/src/compilers/web-component/lib/web-component-name.js.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts +3 -0
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js +335 -0
- package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -0
- package/src/compilers/web-component/model/type.d.ts +29 -0
- package/src/compilers/web-component/model/type.d.ts.map +1 -0
- package/src/compilers/web-component/model/type.js +3 -0
- package/src/compilers/web-component/model/type.js.map +1 -0
- package/src/compilers/worker-compiler.d.ts +12 -0
- package/src/compilers/worker-compiler.d.ts.map +1 -0
- package/src/compilers/worker-compiler.js +123 -0
- package/src/compilers/worker-compiler.js.map +1 -0
- package/src/compilers/yaml-compiler.d.ts +18 -0
- package/src/compilers/yaml-compiler.d.ts.map +1 -0
- package/src/compilers/yaml-compiler.js +139 -0
- package/src/compilers/yaml-compiler.js.map +1 -0
- package/src/core/base-compiler.d.ts +17 -0
- package/src/core/base-compiler.d.ts.map +1 -0
- package/src/core/base-compiler.js +78 -0
- package/src/core/base-compiler.js.map +1 -0
- package/src/core/config.d.ts +640 -0
- package/src/core/config.d.ts.map +1 -0
- package/src/core/config.js +432 -0
- package/src/core/config.js.map +1 -0
- package/src/core/file-watcher.d.ts +23 -0
- package/src/core/file-watcher.d.ts.map +1 -0
- package/src/core/file-watcher.js +63 -0
- package/src/core/file-watcher.js.map +1 -0
- package/src/index.d.ts +31 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +34 -0
- package/src/index.js.map +1 -0
- package/src/types/asset-configs.d.ts +189 -0
- package/src/types/asset-configs.d.ts.map +1 -0
- package/src/types/asset-configs.js +7 -0
- package/src/types/asset-configs.js.map +1 -0
- package/src/types/theme.d.ts +67 -0
- package/src/types/theme.d.ts.map +1 -0
- package/src/types/theme.js +3 -0
- package/src/types/theme.js.map +1 -0
- package/src/utils/file-utils.d.ts +16 -0
- package/src/utils/file-utils.d.ts.map +1 -0
- package/src/utils/file-utils.js +58 -0
- package/src/utils/file-utils.js.map +1 -0
- package/src/utils/i18n-compile-validator.d.ts +20 -0
- package/src/utils/i18n-compile-validator.d.ts.map +1 -0
- package/src/utils/i18n-compile-validator.js +198 -0
- package/src/utils/i18n-compile-validator.js.map +1 -0
- package/src/utils/i18n-fixer.d.ts +39 -0
- package/src/utils/i18n-fixer.d.ts.map +1 -0
- package/src/utils/i18n-fixer.js +396 -0
- package/src/utils/i18n-fixer.js.map +1 -0
- package/src/utils/i18n-sanitizer.d.ts +17 -0
- package/src/utils/i18n-sanitizer.d.ts.map +1 -0
- package/src/utils/i18n-sanitizer.js +101 -0
- package/src/utils/i18n-sanitizer.js.map +1 -0
- package/src/utils/i18n-utils.d.ts +21 -0
- package/src/utils/i18n-utils.d.ts.map +1 -0
- package/src/utils/i18n-utils.js +89 -0
- package/src/utils/i18n-utils.js.map +1 -0
- package/src/utils/interactive-translator.d.ts +18 -0
- package/src/utils/interactive-translator.d.ts.map +1 -0
- package/src/utils/interactive-translator.js +401 -0
- package/src/utils/interactive-translator.js.map +1 -0
- package/src/utils/llama-cpp-translator.d.ts +33 -0
- package/src/utils/llama-cpp-translator.d.ts.map +1 -0
- package/src/utils/llama-cpp-translator.js +267 -0
- package/src/utils/llama-cpp-translator.js.map +1 -0
- package/src/utils/logger.d.ts +14 -0
- package/src/utils/logger.d.ts.map +1 -0
- package/src/utils/logger.js +42 -0
- package/src/utils/logger.js.map +1 -0
- package/src/utils/ollama-translator.d.ts +38 -0
- package/src/utils/ollama-translator.d.ts.map +1 -0
- package/src/utils/ollama-translator.js +371 -0
- package/src/utils/ollama-translator.js.map +1 -0
- package/src/utils/option-utils.d.ts +58 -0
- package/src/utils/option-utils.d.ts.map +1 -0
- package/src/utils/option-utils.js +123 -0
- package/src/utils/option-utils.js.map +1 -0
- package/src/utils/platform-utils.d.ts +33 -0
- package/src/utils/platform-utils.d.ts.map +1 -0
- package/src/utils/platform-utils.js +114 -0
- package/src/utils/platform-utils.js.map +1 -0
- package/src/utils/pwa-utils.d.ts +28 -0
- package/src/utils/pwa-utils.d.ts.map +1 -0
- package/src/utils/pwa-utils.js +48 -0
- package/src/utils/pwa-utils.js.map +1 -0
- package/src/utils/translation-manager.d.ts +43 -0
- package/src/utils/translation-manager.d.ts.map +1 -0
- package/src/utils/translation-manager.js +302 -0
- package/src/utils/translation-manager.js.map +1 -0
- package/src/utils/web-translation-providers.d.ts +53 -0
- package/src/utils/web-translation-providers.d.ts.map +1 -0
- package/src/utils/web-translation-providers.js +190 -0
- package/src/utils/web-translation-providers.js.map +1 -0
- package/src/utils/yaml-utils.d.ts +9 -0
- package/src/utils/yaml-utils.d.ts.map +1 -0
- package/src/utils/yaml-utils.js +26 -0
- package/src/utils/yaml-utils.js.map +1 -0
- package/templates/mag-compile.config.js +77 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonGroupCompiler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_compiler_1 = require("../core/base-compiler");
|
|
6
|
+
const file_utils_1 = require("../utils/file-utils");
|
|
7
|
+
const file_watcher_1 = require("../core/file-watcher");
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
const yaml_1 = tslib_1.__importDefault(require("yaml"));
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
class ButtonGroupCompiler extends base_compiler_1.BaseCompiler {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super(config);
|
|
14
|
+
this.watcher = null;
|
|
15
|
+
const baseDir = path_1.default.dirname(this.outputPath);
|
|
16
|
+
this.buttonsDir = path_1.default.join(baseDir, 'buttons');
|
|
17
|
+
this.lookupDirs = config.outputPaths?.map((p) => path_1.default.dirname(p)) || [
|
|
18
|
+
baseDir,
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
async compile() {
|
|
22
|
+
this.logger.group('Button Group Compilation');
|
|
23
|
+
try {
|
|
24
|
+
const yamlFiles = await this.findYAMLFiles();
|
|
25
|
+
if (yamlFiles.length === 0) {
|
|
26
|
+
this.logger.info('No YAML files found in button group input paths');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const compiledButtonsData = await this.loadAllCompiledButtons();
|
|
30
|
+
const buttonGroupData = await this.processYAMLFiles(yamlFiles, compiledButtonsData);
|
|
31
|
+
await this.writeButtonGroupFiles(buttonGroupData);
|
|
32
|
+
this.logger.success(`✓ Compiled ${yamlFiles.length} button group file${yamlFiles.length !== 1 ? 's' : ''}`);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.logger.error(`Button group compilation failed: ${error}`);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
this.logger.endGroup();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async watch() {
|
|
43
|
+
this.watcher = new file_watcher_1.FileWatcher({
|
|
44
|
+
verbose: this.logger.constructor.name === 'Logger',
|
|
45
|
+
});
|
|
46
|
+
const handleFileChange = async (filePath, action) => {
|
|
47
|
+
if (this.isYAMLFile(filePath)) {
|
|
48
|
+
this.logger.info(`Button group file ${action}: ${filePath}`);
|
|
49
|
+
await this.compile();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.watcher.on('change', (filePath) => handleFileChange(filePath, 'changed'));
|
|
53
|
+
this.watcher.on('add', (filePath) => handleFileChange(filePath, 'added'));
|
|
54
|
+
this.watcher.on('unlink', (filePath) => handleFileChange(filePath, 'removed'));
|
|
55
|
+
this.watcher.watch(this.config.inputPaths);
|
|
56
|
+
}
|
|
57
|
+
async findYAMLFiles() {
|
|
58
|
+
const patterns = this.config.patterns ?? ['**/*.yml', '**/*.yaml'];
|
|
59
|
+
const allFiles = [];
|
|
60
|
+
for (const inputPath of this.config.inputPaths) {
|
|
61
|
+
const files = await file_utils_1.FileUtils.findFiles(patterns.map((pattern) => path_1.default.join(inputPath, pattern)), process.cwd());
|
|
62
|
+
allFiles.push(...files);
|
|
63
|
+
}
|
|
64
|
+
return allFiles.filter((file) => this.isYAMLFile(file));
|
|
65
|
+
}
|
|
66
|
+
async loadAllCompiledButtons() {
|
|
67
|
+
const compiledButtonsData = {};
|
|
68
|
+
const uniqueDirs = [...new Set(this.lookupDirs)];
|
|
69
|
+
for (const baseDir of uniqueDirs) {
|
|
70
|
+
const directory = path_1.default.join(baseDir, 'buttons');
|
|
71
|
+
try {
|
|
72
|
+
const files = await fs_1.promises.readdir(directory);
|
|
73
|
+
const jsonFiles = files.filter((file) => file.endsWith('.json') && file !== 'index.json');
|
|
74
|
+
await Promise.all(jsonFiles.map(async (file) => {
|
|
75
|
+
const itemName = file.replace('.json', '');
|
|
76
|
+
// Skip if already loaded (prefer local/first found)
|
|
77
|
+
if (compiledButtonsData[itemName])
|
|
78
|
+
return;
|
|
79
|
+
const filePath = path_1.default.join(directory, file);
|
|
80
|
+
try {
|
|
81
|
+
const content = await fs_1.promises.readFile(filePath, 'utf8');
|
|
82
|
+
compiledButtonsData[itemName] = JSON.parse(content);
|
|
83
|
+
this.logger.debug(`✓ Loaded button: ${itemName} from ${baseDir}`);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.logger.warn(`Failed to read button "${itemName}": ${error instanceof Error ? error.message : String(error)}`);
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Silently skip missing directories in lookup paths
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
this.logger.info(`Loaded ${Object.keys(compiledButtonsData).length} compiled button${Object.keys(compiledButtonsData).length !== 1 ? 's' : ''}`);
|
|
95
|
+
return compiledButtonsData;
|
|
96
|
+
}
|
|
97
|
+
async processYAMLFiles(files, compiledButtonsData) {
|
|
98
|
+
const buttonGroupData = {};
|
|
99
|
+
for (const file of files) {
|
|
100
|
+
try {
|
|
101
|
+
const content = await this.readFile(file);
|
|
102
|
+
const groupName = file_utils_1.FileUtils.getFileName(file);
|
|
103
|
+
const buttonGroupConfig = yaml_1.default.parse(content);
|
|
104
|
+
const processedGroup = {
|
|
105
|
+
...this.omitProperty(buttonGroupConfig, 'buttons'),
|
|
106
|
+
buttons: this.processButtons(buttonGroupConfig.buttons ?? [], compiledButtonsData, groupName),
|
|
107
|
+
};
|
|
108
|
+
buttonGroupData[groupName] = processedGroup;
|
|
109
|
+
this.logger.debug(`✓ Processed ${path_1.default.basename(file)} → ${groupName}.json (${processedGroup.buttons.length} button${processedGroup.buttons.length !== 1 ? 's' : ''})`);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.logger.error(`Failed to process "${path_1.default.basename(file)}": ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return buttonGroupData;
|
|
116
|
+
}
|
|
117
|
+
processButtons(buttonIds, compiledButtonsData, groupName) {
|
|
118
|
+
const buttons = [];
|
|
119
|
+
for (const buttonId of buttonIds) {
|
|
120
|
+
if (compiledButtonsData[buttonId]) {
|
|
121
|
+
// Add the 'name' property with the button's filename
|
|
122
|
+
buttons.push({
|
|
123
|
+
name: buttonId,
|
|
124
|
+
...compiledButtonsData[buttonId],
|
|
125
|
+
});
|
|
126
|
+
this.logger.debug(` ✓ Added button "${buttonId}" to "${groupName}"`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.logger.warn(` ⚠ Button "${buttonId}" in "${groupName}" not found in compiled buttons`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return buttons;
|
|
133
|
+
}
|
|
134
|
+
async writeButtonGroupFiles(buttonGroupData) {
|
|
135
|
+
const writePromises = Object.entries(buttonGroupData).map(async ([groupName, groupConfig]) => {
|
|
136
|
+
await this.writeFile(`${groupName}.json`, this.formatOutput(groupConfig));
|
|
137
|
+
});
|
|
138
|
+
await Promise.all(writePromises);
|
|
139
|
+
}
|
|
140
|
+
isYAMLFile(filePath) {
|
|
141
|
+
const ext = file_utils_1.FileUtils.getFileExtension(filePath);
|
|
142
|
+
return ext === '.yml' || ext === '.yaml';
|
|
143
|
+
}
|
|
144
|
+
omitProperty(obj, key) {
|
|
145
|
+
const copy = { ...obj };
|
|
146
|
+
delete copy[key];
|
|
147
|
+
return copy;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.ButtonGroupCompiler = ButtonGroupCompiler;
|
|
151
|
+
//# sourceMappingURL=button-group-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/button-group-compiler.ts"],"names":[],"mappings":";;;;AAAA,yDAAqD;AAErD,oDAAgD;AAChD,uDAAmD;AACnD,wDAAwB;AACxB,wDA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D,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,QAAQ;oBACd,GAAG,mBAAmB,CAAC,QAAQ,CAAC;iBACjC,CAAC,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,QAAQ,SAAS,SAAS,GAAG,CAAC,CAAC;YACxE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,eAAe,QAAQ,SAAS,SAAS,iCAAiC,CAC3E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,qBAAqB,CACjC,eAAqD;QAErD,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CACvD,KAAK,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE;YACjC,MAAM,IAAI,CAAC,SAAS,CAClB,GAAG,SAAS,OAAO,EACnB,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAC/B,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAEO,UAAU,CAAC,QAAgB;QACjC,MAAM,GAAG,GAAG,sBAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO,CAAC;IAC3C,CAAC;IAEO,YAAY,CAClB,GAAM,EACN,GAAM;QAEN,MAAM,IAAI,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA7ND,kDA6NC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCompiler } from '../core/base-compiler';
|
|
2
|
+
import { CopyCompilerConfig } from '../core/config';
|
|
3
|
+
export declare class CopyCompiler extends BaseCompiler {
|
|
4
|
+
private watcher;
|
|
5
|
+
constructor(config: CopyCompilerConfig);
|
|
6
|
+
compile(): Promise<void>;
|
|
7
|
+
watch(): Promise<void>;
|
|
8
|
+
private shouldCopyFile;
|
|
9
|
+
private findFilesToCopy;
|
|
10
|
+
private copyFile;
|
|
11
|
+
private deleteFile;
|
|
12
|
+
private getRelativePath;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=copy-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/copy-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,CAAC,OAAO,CAA4B;gBAE/B,MAAM,EAAE,kBAAkB;IAIhC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B5B,OAAO,CAAC,cAAc;YA0CR,eAAe;YA6Bf,QAAQ;YA2BR,UAAU;IAiBxB,OAAO,CAAC,eAAe;CAcxB"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CopyCompiler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const base_compiler_1 = require("../core/base-compiler");
|
|
8
|
+
const file_watcher_1 = require("../core/file-watcher");
|
|
9
|
+
const file_utils_1 = require("../utils/file-utils");
|
|
10
|
+
class CopyCompiler extends base_compiler_1.BaseCompiler {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
super(config);
|
|
13
|
+
this.watcher = null;
|
|
14
|
+
}
|
|
15
|
+
async compile() {
|
|
16
|
+
this.logger.group('File Copy');
|
|
17
|
+
try {
|
|
18
|
+
const files = await this.findFilesToCopy();
|
|
19
|
+
let copiedCount = 0;
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
if (this.shouldCopyFile(file)) {
|
|
22
|
+
await this.copyFile(file);
|
|
23
|
+
copiedCount++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
this.logger.success(`Copied ${copiedCount} files from mag_assets to assets`);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
this.logger.error(`Copy operation failed: ${error}`);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
this.logger.endGroup();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async watch() {
|
|
37
|
+
this.watcher = new file_watcher_1.FileWatcher({
|
|
38
|
+
verbose: this.logger.constructor.name === 'Logger',
|
|
39
|
+
});
|
|
40
|
+
this.watcher.on('change', async (filePath) => {
|
|
41
|
+
if (this.shouldCopyFile(filePath)) {
|
|
42
|
+
this.logger.info(`File changed: ${filePath}`);
|
|
43
|
+
await this.copyFile(filePath);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
this.watcher.on('add', async (filePath) => {
|
|
47
|
+
if (this.shouldCopyFile(filePath)) {
|
|
48
|
+
this.logger.info(`File added: ${filePath}`);
|
|
49
|
+
await this.copyFile(filePath);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
this.watcher.on('unlink', async (filePath) => {
|
|
53
|
+
this.logger.info(`File deleted: ${filePath}`);
|
|
54
|
+
await this.deleteFile(filePath);
|
|
55
|
+
});
|
|
56
|
+
this.watcher.watch(this.config.inputPaths);
|
|
57
|
+
}
|
|
58
|
+
shouldCopyFile(filePath) {
|
|
59
|
+
const config = this.config;
|
|
60
|
+
// Check exclude patterns
|
|
61
|
+
if (config.exclude) {
|
|
62
|
+
const fileExtension = file_utils_1.FileUtils.getFileExtension(filePath);
|
|
63
|
+
const fileName = path_1.default.basename(filePath);
|
|
64
|
+
const normalizedPath = filePath.replace(/\\/g, '/'); // Normalize path separators
|
|
65
|
+
for (const excludePattern of config.exclude) {
|
|
66
|
+
// Handle different pattern types
|
|
67
|
+
if (excludePattern.startsWith('**/*.')) {
|
|
68
|
+
// Simple extension pattern: **/*.ext
|
|
69
|
+
const ext = excludePattern.replace('**/*', '');
|
|
70
|
+
if (fileExtension === ext) {
|
|
71
|
+
this.logger.debug(`Excluding file (will be compiled): ${filePath}`);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (excludePattern.includes('**/') &&
|
|
76
|
+
excludePattern.includes('*.')) {
|
|
77
|
+
// Directory-specific pattern: **/theme/*.ts
|
|
78
|
+
const pattern = excludePattern
|
|
79
|
+
.replace(/\*\*/g, '.*')
|
|
80
|
+
.replace(/\*/g, '[^/]*');
|
|
81
|
+
const regex = new RegExp(pattern);
|
|
82
|
+
if (regex.test(normalizedPath)) {
|
|
83
|
+
this.logger.debug(`Excluding file (will be compiled): ${filePath}`);
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (excludePattern === fileName) {
|
|
88
|
+
// Exact filename match
|
|
89
|
+
this.logger.debug(`Excluding file (will be compiled): ${filePath}`);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
async findFilesToCopy() {
|
|
97
|
+
const patterns = this.config.patterns || ['**/*'];
|
|
98
|
+
const allFiles = [];
|
|
99
|
+
for (const inputPath of this.config.inputPaths) {
|
|
100
|
+
const files = await file_utils_1.FileUtils.findFiles(patterns.map((pattern) => path_1.default.join(inputPath, pattern)), process.cwd());
|
|
101
|
+
allFiles.push(...files);
|
|
102
|
+
}
|
|
103
|
+
// Filter to only include actual files (not directories)
|
|
104
|
+
const actualFiles = [];
|
|
105
|
+
for (const file of allFiles) {
|
|
106
|
+
try {
|
|
107
|
+
const stats = await fs_1.promises.stat(file);
|
|
108
|
+
if (stats.isFile()) {
|
|
109
|
+
actualFiles.push(file);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Skip files that can't be accessed
|
|
114
|
+
this.logger.debug(`Skipping inaccessible file: ${file}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return actualFiles;
|
|
118
|
+
}
|
|
119
|
+
async copyFile(sourceFile) {
|
|
120
|
+
try {
|
|
121
|
+
const config = this.config;
|
|
122
|
+
const relativePath = this.getRelativePath(sourceFile);
|
|
123
|
+
// Copy to the output path
|
|
124
|
+
const outputFile = path_1.default.join(this.outputPath, relativePath);
|
|
125
|
+
// Check if file should be overwritten
|
|
126
|
+
if (!config.overwrite && (await file_utils_1.FileUtils.exists(outputFile))) {
|
|
127
|
+
this.logger.debug(`Skipping existing file: ${outputFile}`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// Ensure output directory exists
|
|
131
|
+
await file_utils_1.FileUtils.ensureDir(path_1.default.dirname(outputFile));
|
|
132
|
+
// Copy the file
|
|
133
|
+
await fs_1.promises.copyFile(sourceFile, outputFile);
|
|
134
|
+
this.logger.success(`Copied: ${sourceFile} → ${outputFile}`);
|
|
135
|
+
this.emit('fileCopied', { sourceFile, outputFile });
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
this.logger.warn(`Failed to copy file ${sourceFile}: ${error}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async deleteFile(sourceFile) {
|
|
142
|
+
try {
|
|
143
|
+
const relativePath = this.getRelativePath(sourceFile);
|
|
144
|
+
// Delete from the output path
|
|
145
|
+
const outputFile = path_1.default.join(this.outputPath, relativePath);
|
|
146
|
+
if (await file_utils_1.FileUtils.exists(outputFile)) {
|
|
147
|
+
await fs_1.promises.unlink(outputFile);
|
|
148
|
+
this.logger.success(`Deleted: ${outputFile}`);
|
|
149
|
+
this.emit('fileDeleted', { outputFile });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
this.logger.warn(`Failed to delete file: ${error}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
getRelativePath(filePath) {
|
|
157
|
+
// Find which input path this file belongs to
|
|
158
|
+
for (const inputPath of this.config.inputPaths) {
|
|
159
|
+
const absoluteInputPath = path_1.default.resolve(inputPath);
|
|
160
|
+
const absoluteFilePath = path_1.default.resolve(filePath);
|
|
161
|
+
if (absoluteFilePath.startsWith(absoluteInputPath)) {
|
|
162
|
+
return path_1.default.relative(absoluteInputPath, absoluteFilePath);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Fallback to just the filename
|
|
166
|
+
return path_1.default.basename(filePath);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.CopyCompiler = CopyCompiler;
|
|
170
|
+
//# sourceMappingURL=copy-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/copy-compiler.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAoC;AACpC,yDAAqD;AAErD,uDAAmD;AACnD,oDAAgD;AAEhD,MAAa,YAAa,SAAQ,4BAAY;IAG5C,YAAY,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAHR,YAAO,GAAuB,IAAI,CAAC;IAI3C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/B,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;YAC3C,IAAI,WAAW,GAAG,CAAC,CAAC;YAEpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACz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QACH,CAAC;QAED,gCAAgC;QAChC,OAAO,cAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF;AA5LD,oCA4LC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCompiler } from '../core/base-compiler';
|
|
2
|
+
import { FieldCompilerConfig } from '../core/config';
|
|
3
|
+
export declare class FieldCompiler extends BaseCompiler {
|
|
4
|
+
private watcher;
|
|
5
|
+
private readonly lookupDirs;
|
|
6
|
+
constructor(config: FieldCompilerConfig);
|
|
7
|
+
compile(): Promise<void>;
|
|
8
|
+
watch(): Promise<void>;
|
|
9
|
+
private findYAMLFiles;
|
|
10
|
+
private loadOptions;
|
|
11
|
+
private processYAMLFiles;
|
|
12
|
+
private processField;
|
|
13
|
+
private isYAMLFile;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=field-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAqBrD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAW;gBAE1B,MAAM,EAAE,mBAAmB;IAOjC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA6Bd,aAAa;YAeb,WAAW;YAoCX,gBAAgB;IAgC9B,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,UAAU;CAInB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldCompiler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const base_compiler_1 = require("../core/base-compiler");
|
|
6
|
+
const file_utils_1 = require("../utils/file-utils");
|
|
7
|
+
const file_watcher_1 = require("../core/file-watcher");
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
+
const yaml_1 = tslib_1.__importDefault(require("yaml"));
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
class FieldCompiler extends base_compiler_1.BaseCompiler {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super(config);
|
|
14
|
+
this.watcher = null;
|
|
15
|
+
this.lookupDirs = config.outputPaths?.map((p) => path_1.default.dirname(p)) || [
|
|
16
|
+
path_1.default.dirname(this.outputPath),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
async compile() {
|
|
20
|
+
this.logger.group('Field Compilation');
|
|
21
|
+
try {
|
|
22
|
+
const yamlFiles = await this.findYAMLFiles();
|
|
23
|
+
if (yamlFiles.length === 0) {
|
|
24
|
+
this.logger.info('No YAML files found in field input paths');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Load options data
|
|
28
|
+
const optionsData = await this.loadOptions();
|
|
29
|
+
const fieldData = await this.processYAMLFiles(yamlFiles, optionsData);
|
|
30
|
+
// Write individual field JSON files only
|
|
31
|
+
for (const [fieldName, fieldConfig] of Object.entries(fieldData)) {
|
|
32
|
+
await this.writeFile(`${fieldName}.json`, this.formatOutput(fieldConfig));
|
|
33
|
+
}
|
|
34
|
+
this.logger.success(`Compiled ${yamlFiles.length} field files`);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.logger.error(`Field compilation failed: ${error}`);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
this.logger.endGroup();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async watch() {
|
|
45
|
+
this.watcher = new file_watcher_1.FileWatcher({
|
|
46
|
+
verbose: this.logger.constructor.name === 'Logger',
|
|
47
|
+
});
|
|
48
|
+
this.watcher.on('change', async (filePath) => {
|
|
49
|
+
if (this.isYAMLFile(filePath)) {
|
|
50
|
+
this.logger.info(`Field file changed: ${filePath}`);
|
|
51
|
+
await this.compile();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this.watcher.on('add', async (filePath) => {
|
|
55
|
+
if (this.isYAMLFile(filePath)) {
|
|
56
|
+
this.logger.info(`Field file added: ${filePath}`);
|
|
57
|
+
await this.compile();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.watcher.on('unlink', async (filePath) => {
|
|
61
|
+
if (this.isYAMLFile(filePath)) {
|
|
62
|
+
this.logger.info(`Field file removed: ${filePath}`);
|
|
63
|
+
await this.compile();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.watcher.watch(this.config.inputPaths);
|
|
67
|
+
}
|
|
68
|
+
async findYAMLFiles() {
|
|
69
|
+
const patterns = this.config.patterns || ['**/*.yml', '**/*.yaml'];
|
|
70
|
+
const allFiles = [];
|
|
71
|
+
for (const inputPath of this.config.inputPaths) {
|
|
72
|
+
const files = await file_utils_1.FileUtils.findFiles(patterns.map((pattern) => path_1.default.join(inputPath, pattern)), process.cwd());
|
|
73
|
+
allFiles.push(...files);
|
|
74
|
+
}
|
|
75
|
+
return allFiles.filter((file) => this.isYAMLFile(file));
|
|
76
|
+
}
|
|
77
|
+
async loadOptions() {
|
|
78
|
+
const optionsData = {};
|
|
79
|
+
const uniqueDirs = [...new Set(this.lookupDirs)];
|
|
80
|
+
for (const baseDir of uniqueDirs) {
|
|
81
|
+
const optionsDir = path_1.default.join(baseDir, 'options');
|
|
82
|
+
try {
|
|
83
|
+
const optionFiles = await fs_1.promises.readdir(optionsDir);
|
|
84
|
+
for (const file of optionFiles) {
|
|
85
|
+
if (file.endsWith('.json')) {
|
|
86
|
+
const optionName = file.replace('.json', '');
|
|
87
|
+
if (optionsData[optionName])
|
|
88
|
+
continue;
|
|
89
|
+
const optionFilePath = path_1.default.join(optionsDir, file);
|
|
90
|
+
try {
|
|
91
|
+
const optionContent = await fs_1.promises.readFile(optionFilePath, 'utf8');
|
|
92
|
+
optionsData[optionName] = JSON.parse(optionContent);
|
|
93
|
+
this.logger.debug(`Loaded options data for: ${optionName} from ${baseDir}`);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
this.logger.warn(`Could not read options data for ${optionName}: ${error}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Silently skip missing options directories
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return optionsData;
|
|
106
|
+
}
|
|
107
|
+
async processYAMLFiles(files, optionsData) {
|
|
108
|
+
const fieldData = {};
|
|
109
|
+
for (const file of files) {
|
|
110
|
+
try {
|
|
111
|
+
const content = await this.readFile(file);
|
|
112
|
+
const fieldName = file_utils_1.FileUtils.getFileName(file);
|
|
113
|
+
// Parse YAML content
|
|
114
|
+
const fieldConfig = yaml_1.default.parse(content);
|
|
115
|
+
// Process field - resolve options if they're string references
|
|
116
|
+
const processedField = this.processField(fieldConfig, optionsData);
|
|
117
|
+
fieldData[fieldName] = processedField;
|
|
118
|
+
this.logger.debug(`✓ Compiled ${path_1.default.basename(file)} → ${fieldName}.json`);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
this.logger.error(`Failed to process field file ${file}: ${error}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return fieldData;
|
|
125
|
+
}
|
|
126
|
+
processField(field, options) {
|
|
127
|
+
// Create base processed field without options
|
|
128
|
+
const { options: fieldOptions, ...fieldWithoutOptions } = field;
|
|
129
|
+
const processedField = { ...fieldWithoutOptions };
|
|
130
|
+
if (fieldOptions && typeof fieldOptions === 'string') {
|
|
131
|
+
// If options is a string, look it up in the options directory
|
|
132
|
+
if (options[fieldOptions]) {
|
|
133
|
+
processedField.options = options[fieldOptions];
|
|
134
|
+
this.logger.debug(`Resolved options "${fieldOptions}" for field "${field.model}"`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.logger.warn(`Options "${fieldOptions}" referenced in field "${field.model}" not found in options directory`);
|
|
138
|
+
processedField.options = [];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (Array.isArray(fieldOptions)) {
|
|
142
|
+
// If options is already an array, keep it as is
|
|
143
|
+
processedField.options = fieldOptions;
|
|
144
|
+
}
|
|
145
|
+
return processedField;
|
|
146
|
+
}
|
|
147
|
+
isYAMLFile(filePath) {
|
|
148
|
+
const ext = file_utils_1.FileUtils.getFileExtension(filePath);
|
|
149
|
+
return ext === '.yml' || ext === '.yaml';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.FieldCompiler = FieldCompiler;
|
|
153
|
+
//# sourceMappingURL=field-compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-compiler.js","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/field-compiler.ts"],"names":[],"mappings":";;;;AAAA,yDAAqD;AAErD,oDAAgD;AAChD,uDAAmD;AACnD,wDAAwB;AACxB,wDAAwB;AACxB,2BAAoC;AAgBpC,MAAa,aAAc,SAAQ,4BAAY;IAI7C,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,CAAC,CAAC;QAJR,YAAO,GAAuB,IAAI,CAAC;QAKzC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;YACnE,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;SAC9B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEvC,IAA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AE,GAAG,KAAK,CAAC;QAChE,MAAM,cAAc,GAAmB,EAAE,GAAG,mBAAmB,EAAE,CAAC;QAElE,IAAI,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACrD,8DAA8D;YAC9D,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC1B,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;gBAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,qBAAqB,YAAY,gBAAgB,KAAK,CAAC,KAAK,GAAG,CAChE,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,YAAY,YAAY,0BAA0B,KAAK,CAAC,KAAK,kCAAkC,CAChG,CAAC;gBACF,cAAc,CAAC,OAAO,GAAG,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,gDAAgD;YAChD,cAAc,CAAC,OAAO,GAAG,YAAY,CAAC;QACxC,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,UAAU,CAAC,QAAgB;QACjC,MAAM,GAAG,GAAG,sBAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO,CAAC;IAC3C,CAAC;CACF;AA7LD,sCA6LC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCompiler } from '../core/base-compiler';
|
|
2
|
+
import { FormCompilerConfig } from '../core/config';
|
|
3
|
+
export declare class FormCompiler extends BaseCompiler {
|
|
4
|
+
private watcher;
|
|
5
|
+
constructor(config: FormCompilerConfig);
|
|
6
|
+
compile(): Promise<void>;
|
|
7
|
+
watch(): Promise<void>;
|
|
8
|
+
private findYAMLFiles;
|
|
9
|
+
private loadFieldConfigs;
|
|
10
|
+
private processYAMLFiles;
|
|
11
|
+
private compileForm;
|
|
12
|
+
private combineValidators;
|
|
13
|
+
private isYAMLFile;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=form-compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-compiler.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/compilers/form-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAuDpD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,CAAC,OAAO,CAA4B;gBAE/B,MAAM,EAAE,kBAAkB;IAIhC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA6Bd,aAAa;YAeb,gBAAgB;YAkChB,gBAAgB;IAuC9B,OAAO,CAAC,WAAW;IA+FnB,OAAO,CAAC,iBAAiB;IA6BzB,OAAO,CAAC,UAAU;CAInB"}
|