@hywax/cms 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/cms.css +17 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +91 -84
- package/package.json +1 -1
package/.nuxt/cms.css
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
@source "./cms";
|
|
1
|
+
@source "./cms/autocomplete-select.ts";
|
|
2
|
+
@source "./cms/layout.ts";
|
|
3
|
+
@source "./cms/ms.ts";
|
|
4
|
+
@source "./cms/form-panel.ts";
|
|
5
|
+
@source "./cms/editor-full.ts";
|
|
6
|
+
@source "./cms/form-panel-section.ts";
|
|
7
|
+
@source "./cms/input-slug.ts";
|
|
8
|
+
@source "./cms/input-seo.ts";
|
|
9
|
+
@source "./cms/input-uplora-image.ts";
|
|
10
|
+
@source "./cms/uplora-image.ts";
|
|
11
|
+
@source "./cms/table-panel.ts";
|
|
12
|
+
@source "./cms/modal-confirm.ts";
|
|
13
|
+
@source "./cms/table-search-input.ts";
|
|
14
|
+
@source "./cms/ms-core-options.ts";
|
|
15
|
+
@source "./cms/ms-nuxt-context.ts";
|
|
16
|
+
@source "./cms/date-picker.ts";
|
|
17
|
+
@source "./cms/ss.ts";
|
|
2
18
|
|
|
3
19
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { defu } from 'defu';
|
|
|
7
7
|
import { globSync } from 'tinyglobby';
|
|
8
8
|
|
|
9
9
|
const name = "@hywax/cms";
|
|
10
|
-
const version = "2.0.
|
|
10
|
+
const version = "2.0.2";
|
|
11
11
|
|
|
12
12
|
function createContext(options, nuxt) {
|
|
13
13
|
const { resolve } = createResolver(import.meta.url);
|
|
@@ -149,7 +149,86 @@ const icons = {
|
|
|
149
149
|
editLine: "i-lucide-pen-line"
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
function
|
|
152
|
+
async function buildComponentDependencyGraph(componentDir, componentPattern) {
|
|
153
|
+
const dependencyGraph = /* @__PURE__ */ new Map();
|
|
154
|
+
const componentFiles = globSync(["**/*.vue"], {
|
|
155
|
+
cwd: componentDir,
|
|
156
|
+
absolute: true
|
|
157
|
+
});
|
|
158
|
+
for (const componentFile of componentFiles) {
|
|
159
|
+
try {
|
|
160
|
+
const content = await readFile(componentFile, "utf-8");
|
|
161
|
+
const componentName = pascalCase(componentFile.split("/").pop().replace(".vue", ""));
|
|
162
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
163
|
+
const matches = content.matchAll(componentPattern);
|
|
164
|
+
for (const match of matches) {
|
|
165
|
+
const depName = match[1] || match[2];
|
|
166
|
+
if (depName && depName !== componentName) {
|
|
167
|
+
dependencies.add(depName);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
dependencyGraph.set(componentName, dependencies);
|
|
171
|
+
} catch {
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return dependencyGraph;
|
|
175
|
+
}
|
|
176
|
+
function resolveComponentDependencies(component, dependencyGraph, resolved = /* @__PURE__ */ new Set()) {
|
|
177
|
+
if (resolved.has(component)) {
|
|
178
|
+
return resolved;
|
|
179
|
+
}
|
|
180
|
+
resolved.add(component);
|
|
181
|
+
const dependencies = dependencyGraph.get(component);
|
|
182
|
+
if (dependencies) {
|
|
183
|
+
for (const dep of dependencies) {
|
|
184
|
+
resolveComponentDependencies(dep, dependencyGraph, resolved);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return resolved;
|
|
188
|
+
}
|
|
189
|
+
async function detectUsedComponents(dirs, prefix, componentDir, includeComponents) {
|
|
190
|
+
const detectedComponents = /* @__PURE__ */ new Set();
|
|
191
|
+
if (includeComponents && includeComponents.length > 0) {
|
|
192
|
+
for (const component of includeComponents) {
|
|
193
|
+
detectedComponents.add(component);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
|
|
197
|
+
for (const dir of dirs) {
|
|
198
|
+
const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
|
|
199
|
+
cwd: dir,
|
|
200
|
+
ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
|
|
201
|
+
});
|
|
202
|
+
for (const file of appFiles) {
|
|
203
|
+
try {
|
|
204
|
+
const filePath = join(dir, file);
|
|
205
|
+
const content = await readFile(filePath, "utf-8");
|
|
206
|
+
const matches = content.matchAll(componentPattern);
|
|
207
|
+
for (const match of matches) {
|
|
208
|
+
const componentName = match[1] || match[2];
|
|
209
|
+
if (componentName) {
|
|
210
|
+
detectedComponents.add(componentName);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
} catch {
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (detectedComponents.size === 0) {
|
|
218
|
+
return void 0;
|
|
219
|
+
}
|
|
220
|
+
const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern);
|
|
221
|
+
const allComponents = /* @__PURE__ */ new Set();
|
|
222
|
+
for (const component of detectedComponents) {
|
|
223
|
+
const resolved = resolveComponentDependencies(component, dependencyGraph);
|
|
224
|
+
for (const resolvedComponent of resolved) {
|
|
225
|
+
allComponents.add(resolvedComponent);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return allComponents;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function prepareMergeConfigs({ nuxt, options, resolve }) {
|
|
153
232
|
nuxt.options.experimental = defu(nuxt.options.experimental || {}, {
|
|
154
233
|
typedPages: true
|
|
155
234
|
});
|
|
@@ -219,12 +298,17 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
219
298
|
}
|
|
220
299
|
}
|
|
221
300
|
});
|
|
301
|
+
const detectedComponents = await detectUsedComponents(
|
|
302
|
+
[resolve("./runtime/components"), resolve("./runtime/composables")],
|
|
303
|
+
"U",
|
|
304
|
+
resolve("./runtime/components")
|
|
305
|
+
);
|
|
222
306
|
nuxt.options.ui = defu(nuxt.options.ui || {}, {
|
|
223
307
|
colorMode: true,
|
|
224
308
|
fonts: true,
|
|
225
309
|
mdc: true,
|
|
226
310
|
experimental: {
|
|
227
|
-
componentDetection:
|
|
311
|
+
componentDetection: [...detectedComponents || []]
|
|
228
312
|
}
|
|
229
313
|
});
|
|
230
314
|
nuxt.options.colorMode = defu(nuxt.options.colorMode || {}, {
|
|
@@ -263,6 +347,8 @@ function prepareMergeConfigs({ nuxt, options }) {
|
|
|
263
347
|
"@uplora/serializer",
|
|
264
348
|
"@internationalized/date",
|
|
265
349
|
"tailwind-variants",
|
|
350
|
+
"plural-ru",
|
|
351
|
+
"object-to-formdata",
|
|
266
352
|
"fast-equals",
|
|
267
353
|
"fast-copy",
|
|
268
354
|
"reka-ui",
|
|
@@ -453,85 +539,6 @@ const themeProse = {
|
|
|
453
539
|
uploraImage: uploraImage
|
|
454
540
|
};
|
|
455
541
|
|
|
456
|
-
async function buildComponentDependencyGraph(componentDir, componentPattern) {
|
|
457
|
-
const dependencyGraph = /* @__PURE__ */ new Map();
|
|
458
|
-
const componentFiles = globSync(["**/*.vue"], {
|
|
459
|
-
cwd: componentDir,
|
|
460
|
-
absolute: true
|
|
461
|
-
});
|
|
462
|
-
for (const componentFile of componentFiles) {
|
|
463
|
-
try {
|
|
464
|
-
const content = await readFile(componentFile, "utf-8");
|
|
465
|
-
const componentName = pascalCase(componentFile.split("/").pop().replace(".vue", ""));
|
|
466
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
467
|
-
const matches = content.matchAll(componentPattern);
|
|
468
|
-
for (const match of matches) {
|
|
469
|
-
const depName = match[1] || match[2];
|
|
470
|
-
if (depName && depName !== componentName) {
|
|
471
|
-
dependencies.add(depName);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
dependencyGraph.set(componentName, dependencies);
|
|
475
|
-
} catch {
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return dependencyGraph;
|
|
479
|
-
}
|
|
480
|
-
function resolveComponentDependencies(component, dependencyGraph, resolved = /* @__PURE__ */ new Set()) {
|
|
481
|
-
if (resolved.has(component)) {
|
|
482
|
-
return resolved;
|
|
483
|
-
}
|
|
484
|
-
resolved.add(component);
|
|
485
|
-
const dependencies = dependencyGraph.get(component);
|
|
486
|
-
if (dependencies) {
|
|
487
|
-
for (const dep of dependencies) {
|
|
488
|
-
resolveComponentDependencies(dep, dependencyGraph, resolved);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return resolved;
|
|
492
|
-
}
|
|
493
|
-
async function detectUsedComponents(dirs, prefix, componentDir, includeComponents) {
|
|
494
|
-
const detectedComponents = /* @__PURE__ */ new Set();
|
|
495
|
-
if (includeComponents && includeComponents.length > 0) {
|
|
496
|
-
for (const component of includeComponents) {
|
|
497
|
-
detectedComponents.add(component);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
|
|
501
|
-
for (const dir of dirs) {
|
|
502
|
-
const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
|
|
503
|
-
cwd: dir,
|
|
504
|
-
ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
|
|
505
|
-
});
|
|
506
|
-
for (const file of appFiles) {
|
|
507
|
-
try {
|
|
508
|
-
const filePath = join(dir, file);
|
|
509
|
-
const content = await readFile(filePath, "utf-8");
|
|
510
|
-
const matches = content.matchAll(componentPattern);
|
|
511
|
-
for (const match of matches) {
|
|
512
|
-
const componentName = match[1] || match[2];
|
|
513
|
-
if (componentName) {
|
|
514
|
-
detectedComponents.add(componentName);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
} catch {
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
if (detectedComponents.size === 0) {
|
|
522
|
-
return void 0;
|
|
523
|
-
}
|
|
524
|
-
const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern);
|
|
525
|
-
const allComponents = /* @__PURE__ */ new Set();
|
|
526
|
-
for (const component of detectedComponents) {
|
|
527
|
-
const resolved = resolveComponentDependencies(component, dependencyGraph);
|
|
528
|
-
for (const resolvedComponent of resolved) {
|
|
529
|
-
allComponents.add(resolvedComponent);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
return allComponents;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
542
|
function getAppTemplates({ options, resolve, nuxt }) {
|
|
536
543
|
const templates = [];
|
|
537
544
|
let previousDetectedComponents;
|
|
@@ -746,7 +753,7 @@ const module$1 = defineNuxtModule({
|
|
|
746
753
|
meta: {
|
|
747
754
|
name,
|
|
748
755
|
version,
|
|
749
|
-
configKey: "
|
|
756
|
+
configKey: "cms"
|
|
750
757
|
},
|
|
751
758
|
moduleDependencies: {
|
|
752
759
|
"@nuxt/ui": {},
|
|
@@ -757,7 +764,7 @@ const module$1 = defineNuxtModule({
|
|
|
757
764
|
defaults: defaultModuleOptions,
|
|
758
765
|
async setup(options, nuxt) {
|
|
759
766
|
const context = createContext(options, nuxt);
|
|
760
|
-
prepareMergeConfigs(context);
|
|
767
|
+
await prepareMergeConfigs(context);
|
|
761
768
|
prepareTemplates(context);
|
|
762
769
|
prepareAutoImports(context);
|
|
763
770
|
prepareServerRoutes(context);
|