@vixt/vue 0.6.3 → 0.6.4

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.
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <RouterView />
3
+ </template>
@@ -1,6 +1,6 @@
1
- import * as vue0 from "vue";
2
1
  import "virtual:vixt:css";
3
2
  import "virtual:uno.css";
3
+ import * as vue0 from "vue";
4
4
 
5
5
  //#region src/client/entry.d.ts
6
6
  declare function entry(): Promise<vue0.App<Element>>;
@@ -1,10 +1,10 @@
1
- import { createApp } from "vue";
2
1
  import "virtual:vixt:css";
3
2
  import "virtual:uno.css";
4
3
  import { applyPlugins, createVixtApp } from "@vixt/core/client";
5
4
  import appConfig from "virtual:vixt:app-config";
6
5
  import plugins from "virtual:vixt:plugins";
7
- import RootComponent from "virtual:vixt:root-component";
6
+ import RootComponent from "virtual:vixt:root-component.vue";
7
+ import { createApp } from "vue";
8
8
 
9
9
  //#region src/client/entry.ts
10
10
  async function entry() {
@@ -1,6 +1,6 @@
1
- import { createRouter, createWebHistory } from "vue-router";
2
1
  import { defineVixtPlugin } from "@vixt/core/client";
3
2
  import { setupLayouts } from "virtual:generated-layouts";
3
+ import { createRouter, createWebHistory } from "vue-router";
4
4
  import { routes } from "vue-router/auto-routes";
5
5
 
6
6
  //#region src/client/plugins/router.ts
package/dist/index.mjs CHANGED
@@ -16,6 +16,7 @@ import { VueRouterAutoImports } from "unplugin-vue-router";
16
16
  import VueRouter from "unplugin-vue-router/vite";
17
17
  import VueDevTools from "vite-plugin-vue-devtools";
18
18
  import Layouts from "vite-plugin-vue-layouts";
19
+ import { parse } from "@vue/compiler-sfc";
19
20
 
20
21
  //#region rolldown:runtime
21
22
  var __create = Object.create;
@@ -3272,7 +3273,7 @@ var prototypeAccessors = {
3272
3273
  allowNewDotTarget: { configurable: true },
3273
3274
  inClassStaticBlock: { configurable: true }
3274
3275
  };
3275
- Parser.prototype.parse = function parse$1() {
3276
+ Parser.prototype.parse = function parse$2() {
3276
3277
  var node = this.options.program || this.startNode();
3277
3278
  this.nextToken();
3278
3279
  return this.parseTopLevel(node);
@@ -3320,7 +3321,7 @@ Parser.extend = function extend() {
3320
3321
  for (var i$1 = 0; i$1 < plugins$1.length; i$1++) cls = plugins$1[i$1](cls);
3321
3322
  return cls;
3322
3323
  };
3323
- Parser.parse = function parse$1(input, options) {
3324
+ Parser.parse = function parse$2(input, options) {
3324
3325
  return new this(options, input).parse();
3325
3326
  };
3326
3327
  Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
@@ -7432,7 +7433,7 @@ const basename = function(p, extension) {
7432
7433
  }
7433
7434
  return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
7434
7435
  };
7435
- const parse = function(p) {
7436
+ const parse$1 = function(p) {
7436
7437
  const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
7437
7438
  const base = basename(p);
7438
7439
  const extension = extname$1(base);
@@ -7458,7 +7459,7 @@ const _path = {
7458
7459
  matchesGlob,
7459
7460
  normalize,
7460
7461
  normalizeString,
7461
- parse,
7462
+ parse: parse$1,
7462
7463
  relative,
7463
7464
  resolve,
7464
7465
  sep,
@@ -8758,28 +8759,44 @@ var preset_vue_default = defineVixtModule({
8758
8759
 
8759
8760
  //#endregion
8760
8761
  //#region src/modules/virtual-root-component.ts
8761
- function resolveRootComponentPath(vixt) {
8762
+ function resolveRootComponent(vixt) {
8762
8763
  for (const layer of vixt._layers) {
8763
8764
  const layerRootComponentPath = posix.resolve(layer.config.srcDir, "App.vue");
8764
- if (import_lib.default.existsSync(layerRootComponentPath)) return layerRootComponentPath;
8765
+ const layerRootComponentCode = import_lib.default.existsSync(layerRootComponentPath) && import_lib.default.readFileSync(layerRootComponentPath, "utf-8") || "";
8766
+ if (!isEmptyCode(layerRootComponentCode)) return {
8767
+ path: layerRootComponentPath,
8768
+ code: layerRootComponentCode
8769
+ };
8770
+ }
8771
+ const defaultRootComponentPath = resolvePathSync("@vixt/vue/client/App");
8772
+ return {
8773
+ path: defaultRootComponentPath,
8774
+ code: import_lib.default.readFileSync(defaultRootComponentPath, "utf-8")
8775
+ };
8776
+ }
8777
+ function isEmptyCode(code) {
8778
+ if (!code) return true;
8779
+ try {
8780
+ const { descriptor: { template, script, scriptSetup } } = parse(code);
8781
+ return !template && !script && !scriptSetup;
8782
+ } catch {
8783
+ return false;
8765
8784
  }
8766
- return resolvePathSync("@vixt/vue/client/App");
8767
8785
  }
8768
- const name = "virtual:vixt:root-component";
8769
- const virtualModuleId = name;
8770
- const resolvedVirtualModuleId = `\0${virtualModuleId}`;
8786
+ const name = "virtual:vixt:root-component.vue";
8771
8787
  var virtual_root_component_default = defineVixtModule({
8772
8788
  meta: { name },
8773
8789
  setup(_, vixt) {
8774
8790
  return {
8775
8791
  name,
8776
8792
  resolveId(id) {
8777
- if (id === virtualModuleId) return resolvedVirtualModuleId;
8793
+ if (id === name) return name;
8778
8794
  },
8779
8795
  load(id) {
8780
- if (id === resolvedVirtualModuleId) {
8781
- const rootComponentPath = resolveRootComponentPath(vixt);
8782
- return import_lib.default.readFileSync(rootComponentPath, "utf-8");
8796
+ if (id === name) {
8797
+ const { path: path$13, code } = resolveRootComponent(vixt);
8798
+ this.addWatchFile(path$13);
8799
+ return code;
8783
8800
  }
8784
8801
  }
8785
8802
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/vue",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://soullyoko.github.io/vixt/",
@@ -13,6 +13,7 @@
13
13
  ],
14
14
  "exports": {
15
15
  ".": "./dist/index.mjs",
16
+ "./client/App": "./dist/client/App.vue",
16
17
  "./client/*": "./dist/client/*.js",
17
18
  "./types": "./dist/types/index.d.ts",
18
19
  "./package.json": "./package.json"
@@ -37,6 +38,6 @@
37
38
  "vue": "^3.5.26",
38
39
  "vue-router": "^4.6.4",
39
40
  "vue-tsc": "^3.2.1",
40
- "@vixt/core": "0.6.3"
41
+ "@vixt/core": "0.6.4"
41
42
  }
42
43
  }
@@ -1,8 +0,0 @@
1
- import * as vue0 from "vue";
2
-
3
- //#region src/client/App.d.ts
4
- declare const _default: () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
5
- [key: string]: any;
6
- }>;
7
- //#endregion
8
- export { _default as default };
@@ -1,8 +0,0 @@
1
- import { h } from "vue";
2
- import { RouterView } from "vue-router";
3
-
4
- //#region src/client/App.ts
5
- var App_default = () => h(RouterView);
6
-
7
- //#endregion
8
- export { App_default as default };