@vixt/core 0.6.3 → 0.6.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/dist/node/index.mjs +45 -47
- package/package.json +2 -1
package/dist/node/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import Legacy from "@vitejs/plugin-legacy";
|
|
|
12
12
|
import Analyzer from "vite-bundle-analyzer";
|
|
13
13
|
import Ssl from "@vitejs/plugin-basic-ssl";
|
|
14
14
|
import Checker from "vite-plugin-checker";
|
|
15
|
+
import { builders, parseExpression, parseModule } from "magicast";
|
|
15
16
|
|
|
16
17
|
//#region src/node/env.ts
|
|
17
18
|
function loadCLIOptions() {
|
|
@@ -464,33 +465,35 @@ const resolvedVirtualModuleId$2 = `\0${virtualModuleId$2}`;
|
|
|
464
465
|
var virtual_app_config_default = defineVixtModule({
|
|
465
466
|
meta: { name: name$3 },
|
|
466
467
|
setup(_, vixt) {
|
|
467
|
-
let appConfigsImportTemplate = "";
|
|
468
|
-
let appConfigsMergeTemplate = "";
|
|
469
|
-
let i = 0;
|
|
470
|
-
for (const layer of vixt._layers) {
|
|
471
|
-
const appConfigPath = path.resolve(layer.config.srcDir, "app.config.ts");
|
|
472
|
-
if (fs.existsSync(appConfigPath)) {
|
|
473
|
-
const appConfigName = `__app_config_${i}`;
|
|
474
|
-
appConfigsImportTemplate += `import ${appConfigName} from '${appConfigPath}'\n`;
|
|
475
|
-
appConfigsMergeTemplate += `${appConfigName}, `;
|
|
476
|
-
i++;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
468
|
return {
|
|
480
469
|
name: name$3,
|
|
481
470
|
resolveId(id) {
|
|
482
471
|
if (id === virtualModuleId$2) return resolvedVirtualModuleId$2;
|
|
483
472
|
},
|
|
484
473
|
load(id) {
|
|
485
|
-
if (id
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
474
|
+
if (id !== resolvedVirtualModuleId$2) return;
|
|
475
|
+
const { baseURL = "/", rootId = "app" } = vixt.options.app ?? {};
|
|
476
|
+
const code = parseModule("import { defu } from \"defu\"");
|
|
477
|
+
const defuCall = builders.functionCall("defu");
|
|
478
|
+
let i = 0;
|
|
479
|
+
for (const layer of vixt._layers) {
|
|
480
|
+
const appConfigPath = path.resolve(layer.config.srcDir, "app.config.ts");
|
|
481
|
+
if (fs.existsSync(appConfigPath)) {
|
|
482
|
+
const appConfigName = `__app_config_${i++}`;
|
|
483
|
+
code.imports.$append({
|
|
484
|
+
local: appConfigName,
|
|
485
|
+
imported: "default",
|
|
486
|
+
from: appConfigPath
|
|
487
|
+
});
|
|
488
|
+
defuCall.$args.push(parseExpression(appConfigName));
|
|
489
|
+
}
|
|
493
490
|
}
|
|
491
|
+
defuCall.$args.push({
|
|
492
|
+
baseURL,
|
|
493
|
+
rootId
|
|
494
|
+
});
|
|
495
|
+
code.exports.default = defuCall;
|
|
496
|
+
return code.generate();
|
|
494
497
|
}
|
|
495
498
|
};
|
|
496
499
|
}
|
|
@@ -504,14 +507,13 @@ const resolvedVirtualModuleId$1 = `\0${virtualModuleId$1}`;
|
|
|
504
507
|
var virtual_css_default = defineVixtModule({
|
|
505
508
|
meta: { name: name$2 },
|
|
506
509
|
setup(_, vixt) {
|
|
507
|
-
const cssTemplate = vixt.options.app?.css?.map((css) => `import '${css}'`).join("\n") ?? "";
|
|
508
510
|
return {
|
|
509
511
|
name: name$2,
|
|
510
512
|
resolveId(id) {
|
|
511
513
|
if (id === virtualModuleId$1) return resolvedVirtualModuleId$1;
|
|
512
514
|
},
|
|
513
515
|
load(id) {
|
|
514
|
-
if (id === resolvedVirtualModuleId$1) return
|
|
516
|
+
if (id === resolvedVirtualModuleId$1) return vixt.options.app?.css?.map((css) => `import '${css}'`).join("\n") ?? "";
|
|
515
517
|
}
|
|
516
518
|
};
|
|
517
519
|
}
|
|
@@ -525,37 +527,33 @@ const resolvedVirtualModuleId = `\0${virtualModuleId}`;
|
|
|
525
527
|
var virtual_plugins_default = defineVixtModule({
|
|
526
528
|
meta: { name: name$1 },
|
|
527
529
|
setup(_, vixt) {
|
|
528
|
-
const { plugins: pluginsDirs = [] } = resolveLayersDirs(vixt._layers);
|
|
529
|
-
let pluginsImportTemplate = "";
|
|
530
|
-
let pluginsMergeTemplate = "";
|
|
531
|
-
let i = 0;
|
|
532
|
-
for (const plugin of vixt.options.plugins ?? []) {
|
|
533
|
-
const pluginName = `__plugin_${i}`;
|
|
534
|
-
pluginsImportTemplate += `import ${pluginName} from '${plugin}'\n`;
|
|
535
|
-
pluginsMergeTemplate += `${pluginName}, `;
|
|
536
|
-
i++;
|
|
537
|
-
}
|
|
538
|
-
for (const pluginsDir of pluginsDirs.reverse()) {
|
|
539
|
-
const files = fs.existsSync(pluginsDir) ? fs.readdirSync(pluginsDir) : [];
|
|
540
|
-
for (const f of files.filter((f$1) => /[jt]sx?$/.test(f$1))) {
|
|
541
|
-
const p = path.resolve(pluginsDir, f);
|
|
542
|
-
const pluginName = `__plugin_${i}`;
|
|
543
|
-
pluginsImportTemplate += `import ${pluginName} from '${p}'\n`;
|
|
544
|
-
pluginsMergeTemplate += `${pluginName}, `;
|
|
545
|
-
i++;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
530
|
return {
|
|
549
531
|
name: name$1,
|
|
550
532
|
resolveId(id) {
|
|
551
533
|
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
552
534
|
},
|
|
553
535
|
load(id) {
|
|
554
|
-
if (id
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
536
|
+
if (id !== resolvedVirtualModuleId) return;
|
|
537
|
+
const { plugins: pluginsDirs = [] } = resolveLayersDirs(vixt._layers);
|
|
538
|
+
const code = parseModule("");
|
|
539
|
+
const pluginsArray = parseExpression("[]");
|
|
540
|
+
let i = 0;
|
|
541
|
+
function addPlugin(from) {
|
|
542
|
+
const pluginName = `__plugin_${i++}`;
|
|
543
|
+
code.imports.$append({
|
|
544
|
+
local: pluginName,
|
|
545
|
+
imported: "default",
|
|
546
|
+
from
|
|
547
|
+
});
|
|
548
|
+
pluginsArray.push(parseExpression(pluginName));
|
|
549
|
+
}
|
|
550
|
+
for (const pluginPath of vixt.options.plugins ?? []) addPlugin(pluginPath);
|
|
551
|
+
for (const pluginsDir of pluginsDirs.reverse()) {
|
|
552
|
+
const files = fs.existsSync(pluginsDir) ? fs.readdirSync(pluginsDir) : [];
|
|
553
|
+
for (const file of files.filter((f) => /[jt]sx?$/.test(f))) addPlugin(path.resolve(pluginsDir, file));
|
|
554
|
+
}
|
|
555
|
+
code.exports.default = pluginsArray;
|
|
556
|
+
return code.generate();
|
|
559
557
|
}
|
|
560
558
|
};
|
|
561
559
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixt/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.5",
|
|
5
5
|
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://soullyoko.github.io/vixt/",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"find-up": "^8.0.0",
|
|
38
38
|
"fs-extra": "^11.3.3",
|
|
39
39
|
"jiti": "^2.6.1",
|
|
40
|
+
"magicast": "^0.5.1",
|
|
40
41
|
"mlly": "^1.8.0",
|
|
41
42
|
"pathe": "^2.0.3",
|
|
42
43
|
"pkg-types": "^2.3.0",
|