@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,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderPool = exports.GoogleUnofficialProvider = exports.LingvaProvider = exports.MyMemoryProvider = exports.LlamaCppProvider = exports.RateLimitError = void 0;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
const llama_cpp_translator_1 = require("./llama-cpp-translator");
|
|
6
|
+
class RateLimitError extends Error {
|
|
7
|
+
constructor(provider) {
|
|
8
|
+
super(`${provider} rate limited`);
|
|
9
|
+
this.name = 'RateLimitError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.RateLimitError = RateLimitError;
|
|
13
|
+
class LlamaCppProvider {
|
|
14
|
+
constructor(host = 'http://127.0.0.1:8080') {
|
|
15
|
+
this.name = 'llama-cpp';
|
|
16
|
+
this.translator = new llama_cpp_translator_1.LlamaCppTranslator({ host });
|
|
17
|
+
}
|
|
18
|
+
static async create(host) {
|
|
19
|
+
const provider = new LlamaCppProvider(host);
|
|
20
|
+
const available = await provider.translator.isAvailable();
|
|
21
|
+
return available ? provider : null;
|
|
22
|
+
}
|
|
23
|
+
async translate(text, fromLang, toLang) {
|
|
24
|
+
return this.translator.suggestTranslation({
|
|
25
|
+
sourceLanguage: fromLang,
|
|
26
|
+
targetLanguage: toLang,
|
|
27
|
+
translationKey: text,
|
|
28
|
+
sourceText: text,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** Single inference → all target langs at once — far fewer GPU cycles than one-per-lang. */
|
|
32
|
+
async translateBatch(text, fromLang, langCodes) {
|
|
33
|
+
return this.translator.suggestBatchTranslations(text, fromLang, langCodes);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.LlamaCppProvider = LlamaCppProvider;
|
|
37
|
+
// Languages confirmed supported by MyMemory API (ISO 639-1 mainstream set)
|
|
38
|
+
const MYMEMORY_SUPPORTED = new Set([
|
|
39
|
+
'af', 'sq', 'am', 'ar', 'hy', 'az', 'eu', 'be', 'bn', 'bs', 'bg', 'ca', 'hr', 'cs', 'da',
|
|
40
|
+
'nl', 'en', 'et', 'fi', 'fr', 'gl', 'ka', 'de', 'el', 'gu', 'ht', 'ha', 'he', 'hi', 'hu',
|
|
41
|
+
'is', 'id', 'ga', 'it', 'ja', 'kn', 'kk', 'km', 'ko', 'ku', 'ky', 'lv', 'lt', 'mk', 'ms',
|
|
42
|
+
'ml', 'mt', 'mr', 'mn', 'my', 'ne', 'no', 'or', 'fa', 'pl', 'pt', 'pa', 'ro', 'ru', 'gd',
|
|
43
|
+
'sr', 'si', 'sk', 'sl', 'so', 'es', 'su', 'sw', 'sv', 'tg', 'ta', 'te', 'th', 'tr', 'uk',
|
|
44
|
+
'ur', 'uz', 'vi', 'cy', 'xh', 'yi', 'zu',
|
|
45
|
+
]);
|
|
46
|
+
class MyMemoryProvider {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.name = 'MyMemory';
|
|
49
|
+
}
|
|
50
|
+
supportsLang(lang) {
|
|
51
|
+
return MYMEMORY_SUPPORTED.has(lang);
|
|
52
|
+
}
|
|
53
|
+
async translate(text, fromLang, toLang) {
|
|
54
|
+
if (!this.supportsLang(toLang))
|
|
55
|
+
return null;
|
|
56
|
+
const url = `https://api.mymemory.translated.net/get?q=${encodeURIComponent(text)}&langpair=${fromLang}|${toLang}`;
|
|
57
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(8000) });
|
|
58
|
+
if (res.status === 429)
|
|
59
|
+
throw new RateLimitError('MyMemory');
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
return null;
|
|
62
|
+
const data = await res.json();
|
|
63
|
+
if (data.responseStatus === 429)
|
|
64
|
+
throw new RateLimitError('MyMemory');
|
|
65
|
+
if (data.responseStatus !== 200)
|
|
66
|
+
return null;
|
|
67
|
+
const translated = data.responseData.translatedText?.trim();
|
|
68
|
+
if (!translated || translated === text)
|
|
69
|
+
return null;
|
|
70
|
+
return translated;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.MyMemoryProvider = MyMemoryProvider;
|
|
74
|
+
class LingvaProvider {
|
|
75
|
+
constructor() {
|
|
76
|
+
this.name = 'Lingva';
|
|
77
|
+
this.instances = [
|
|
78
|
+
'https://lingva.ml',
|
|
79
|
+
'https://translate.plausibility.cloud',
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
async translate(text, fromLang, toLang) {
|
|
83
|
+
for (const base of this.instances) {
|
|
84
|
+
try {
|
|
85
|
+
const url = `${base}/api/v1/${fromLang}/${toLang}/${encodeURIComponent(text)}`;
|
|
86
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(8000) });
|
|
87
|
+
if (!res.ok)
|
|
88
|
+
continue;
|
|
89
|
+
const data = await res.json();
|
|
90
|
+
const translated = data.translation?.trim();
|
|
91
|
+
if (translated && translated !== text)
|
|
92
|
+
return translated;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.LingvaProvider = LingvaProvider;
|
|
102
|
+
class GoogleUnofficialProvider {
|
|
103
|
+
constructor() {
|
|
104
|
+
this.name = 'Google';
|
|
105
|
+
}
|
|
106
|
+
async translate(text, fromLang, toLang) {
|
|
107
|
+
const url = `https://translate.googleapis.com/translate_a/single?client=gtx&sl=${fromLang}&tl=${toLang}&dt=t&q=${encodeURIComponent(text)}`;
|
|
108
|
+
const res = await fetch(url, { signal: AbortSignal.timeout(8000) });
|
|
109
|
+
if (!res.ok)
|
|
110
|
+
return null;
|
|
111
|
+
const data = await res.json();
|
|
112
|
+
if (!Array.isArray(data) || !Array.isArray(data[0]))
|
|
113
|
+
return null;
|
|
114
|
+
const translated = data[0].map((seg) => seg[0]).join('').trim();
|
|
115
|
+
if (!translated || translated === text)
|
|
116
|
+
return null;
|
|
117
|
+
return translated;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.GoogleUnofficialProvider = GoogleUnofficialProvider;
|
|
121
|
+
class ProviderPool {
|
|
122
|
+
constructor(options = {}) {
|
|
123
|
+
// Maps provider name → earliest timestamp it can be retried (0 = available now)
|
|
124
|
+
this.rateLimitUntil = new Map();
|
|
125
|
+
this.delayMs = options.delayMs ?? 80;
|
|
126
|
+
this.logger = new logger_1.Logger(options.verbose ?? false);
|
|
127
|
+
this.google = new GoogleUnofficialProvider();
|
|
128
|
+
this.providers = [new MyMemoryProvider(), new LingvaProvider()];
|
|
129
|
+
}
|
|
130
|
+
/** True for languages with reliable web API coverage. Others go direct to Ollama. */
|
|
131
|
+
isMainstreamLang(lang) {
|
|
132
|
+
return MYMEMORY_SUPPORTED.has(lang);
|
|
133
|
+
}
|
|
134
|
+
async delay() {
|
|
135
|
+
await new Promise((r) => setTimeout(r, this.delayMs));
|
|
136
|
+
}
|
|
137
|
+
isAvailable(name) {
|
|
138
|
+
const until = this.rateLimitUntil.get(name) ?? 0;
|
|
139
|
+
return Date.now() >= until;
|
|
140
|
+
}
|
|
141
|
+
backoff(name) {
|
|
142
|
+
this.rateLimitUntil.set(name, Date.now() + 60000);
|
|
143
|
+
this.logger.warn(`${name} rate limited — skipping for 60s`);
|
|
144
|
+
}
|
|
145
|
+
async translate(text, fromLang, toLang) {
|
|
146
|
+
await this.delay();
|
|
147
|
+
const isMainstream = this.isMainstreamLang(toLang);
|
|
148
|
+
// Mainstream langs: try MyMemory + Lingva, skip on rate limit
|
|
149
|
+
if (isMainstream) {
|
|
150
|
+
for (const provider of this.providers) {
|
|
151
|
+
if (provider.supportsLang && !provider.supportsLang(toLang))
|
|
152
|
+
continue;
|
|
153
|
+
if (!this.isAvailable(provider.name))
|
|
154
|
+
continue;
|
|
155
|
+
try {
|
|
156
|
+
const result = await provider.translate(text, fromLang, toLang);
|
|
157
|
+
if (result)
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
if (e instanceof RateLimitError) {
|
|
162
|
+
this.backoff(provider.name);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// All langs: Google unofficial covers ~130+ languages
|
|
168
|
+
try {
|
|
169
|
+
const result = await this.google.translate(text, fromLang, toLang);
|
|
170
|
+
if (result)
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// ignore
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
getStatus() {
|
|
179
|
+
const now = Date.now();
|
|
180
|
+
const limited = Array.from(this.rateLimitUntil.entries())
|
|
181
|
+
.filter(([, until]) => now < until)
|
|
182
|
+
.map(([name]) => name);
|
|
183
|
+
return {
|
|
184
|
+
active: this.providers.filter((p) => this.isAvailable(p.name)).map((p) => p.name),
|
|
185
|
+
rateLimited: limited,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.ProviderPool = ProviderPool;
|
|
190
|
+
//# sourceMappingURL=web-translation-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-translation-providers.js","sourceRoot":"","sources":["../../../../../libs/cli/src/utils/web-translation-providers.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,iEAA4D;AAE5D,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,QAAgB;QAC1B,KAAK,CAAC,GAAG,QAAQ,eAAe,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAQD,MAAa,gBAAgB;IAI3B,YAAY,IAAI,GAAG,uBAAuB;QAHjC,SAAI,GAAG,WAAW,CAAC;QAI1B,IAAI,CAAC,UAAU,GAAG,IAAI,yCAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAa;QAC/B,MAAM,QAAQ,G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;CACF;AA7ED,oCA6EC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a file is a YAML file
|
|
3
|
+
*/
|
|
4
|
+
export declare function isYAMLFile(filePath: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Determine if YAML input is array of arrays
|
|
7
|
+
*/
|
|
8
|
+
export declare function isArrayOfArraysYaml(input: unknown): boolean;
|
|
9
|
+
//# sourceMappingURL=yaml-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-utils.d.ts","sourceRoot":"","sources":["../../../../../libs/cli/src/utils/yaml-utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO3D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isYAMLFile = isYAMLFile;
|
|
4
|
+
exports.isArrayOfArraysYaml = isArrayOfArraysYaml;
|
|
5
|
+
/**
|
|
6
|
+
* Shared YAML utilities for compilers
|
|
7
|
+
*/
|
|
8
|
+
const file_utils_1 = require("./file-utils");
|
|
9
|
+
/**
|
|
10
|
+
* Check if a file is a YAML file
|
|
11
|
+
*/
|
|
12
|
+
function isYAMLFile(filePath) {
|
|
13
|
+
const ext = file_utils_1.FileUtils.getFileExtension(filePath);
|
|
14
|
+
return ext === '.yml' || ext === '.yaml';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Determine if YAML input is array of arrays
|
|
18
|
+
*/
|
|
19
|
+
function isArrayOfArraysYaml(input) {
|
|
20
|
+
if (!Array.isArray(input) || input.length === 0) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
// Check if the first element is an array
|
|
24
|
+
return Array.isArray(input[0]);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=yaml-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-utils.js","sourceRoot":"","sources":["../../../../../libs/cli/src/utils/yaml-utils.ts"],"names":[],"mappings":";;AAQA,gCAGC;AAKD,kDAOC;AAvBD;;GAEG;AACH,6CAAyC;AAEzC;;GAEG;AACH,SAAgB,UAAU,CAAC,QAAgB;IACzC,MAAM,GAAG,GAAG,sBAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yCAAyC;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Custom paths configuration
|
|
3
|
+
// Single project:
|
|
4
|
+
paths: {
|
|
5
|
+
source: 'src/shared/mag_assets',
|
|
6
|
+
output: 'src/shared/assets',
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
// Multiple projects (uncomment to use):
|
|
10
|
+
// paths: [
|
|
11
|
+
// {
|
|
12
|
+
// source: "main/mag_assets",
|
|
13
|
+
// output: "main/public/assets",
|
|
14
|
+
// },
|
|
15
|
+
// {
|
|
16
|
+
// source: "admin/mag_assets",
|
|
17
|
+
// output: "admin/public/assets",
|
|
18
|
+
// }
|
|
19
|
+
// ],
|
|
20
|
+
|
|
21
|
+
// SVG compilation configuration
|
|
22
|
+
svg: {
|
|
23
|
+
inputPaths: ['./src/shared/mag_assets/icons', './src/mag_assets/svg'],
|
|
24
|
+
outputPath: './assets',
|
|
25
|
+
patterns: ['**/*.svg'],
|
|
26
|
+
spriteSheet: true,
|
|
27
|
+
optimize: true,
|
|
28
|
+
iconSet: 'default',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Theme compilation configuration
|
|
32
|
+
theme: {
|
|
33
|
+
inputPaths: ['./src/shared/mag_assets/styles', './src/styles'],
|
|
34
|
+
outputPath: './assets/styles',
|
|
35
|
+
patterns: ['**/*.scss', '**/*.sass', '**/*.css'],
|
|
36
|
+
format: 'scss', // 'scss' | 'css' | 'json'
|
|
37
|
+
sassVariables: true,
|
|
38
|
+
cssCustomProperties: true,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Translation compilation configuration
|
|
42
|
+
i18n: {
|
|
43
|
+
inputPaths: ['./src/shared/mag_assets/i18n', './src/i18n'],
|
|
44
|
+
outputPath: './assets/i18n',
|
|
45
|
+
patterns: ['**/*.json', '**/*.yaml'],
|
|
46
|
+
defaultLocale: 'en',
|
|
47
|
+
supportedLocales: ['en', 'es', 'fr', 'de'],
|
|
48
|
+
keyFormat: 'nested', // 'flat' | 'nested'
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// Form compilation configuration
|
|
52
|
+
forms: {
|
|
53
|
+
inputPaths: ['./src/shared/mag_assets/forms'],
|
|
54
|
+
outputPath: './assets/forms',
|
|
55
|
+
patterns: ['**/*.json'],
|
|
56
|
+
validationRules: true,
|
|
57
|
+
generateTypes: true,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
// Button compilation configuration
|
|
61
|
+
buttons: {
|
|
62
|
+
inputPaths: ['./src/shared/mag_assets/buttons'],
|
|
63
|
+
outputPath: './assets/buttons',
|
|
64
|
+
patterns: ['**/*.json'],
|
|
65
|
+
variants: ['primary', 'secondary', 'danger'],
|
|
66
|
+
sizes: ['sm', 'md', 'lg'],
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Navigation compilation configuration
|
|
70
|
+
nav: {
|
|
71
|
+
inputPaths: ['./src/shared/mag_assets/navs'],
|
|
72
|
+
outputPath: './assets/navs',
|
|
73
|
+
patterns: ['**/*.json'],
|
|
74
|
+
hierarchical: true,
|
|
75
|
+
includeMetadata: true,
|
|
76
|
+
},
|
|
77
|
+
};
|