@volpe/astro-svelte-spa 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/index.js +13 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,8 +6,12 @@ const RESOLVED_VIRTUAL_MODULE_ID = "\0" + VIRTUAL_MODULE_ID;
6
6
 
7
7
  const PACKAGE_ID = "@volpe/astro-svelte-spa";
8
8
  const RESOLVED_PACKAGE_ID = "\0" + PACKAGE_ID;
9
- const VIRTUAL_APP_ID = "\0svelte-spa-app.svelte";
10
- const VIRTUAL_LINK_ID = "\0svelte-spa-link.svelte";
9
+
10
+ const VIRTUAL_APP_ID = "virtual:svelte-spa-app";
11
+ const RESOLVED_VIRTUAL_APP_ID = "\0" + VIRTUAL_APP_ID;
12
+
13
+ const VIRTUAL_LINK_ID = "virtual:svelte-spa-link";
14
+ const RESOLVED_VIRTUAL_LINK_ID = "\0" + VIRTUAL_LINK_ID;
11
15
 
12
16
  /**
13
17
  * @typedef {Object} RouteNode
@@ -381,8 +385,11 @@ export function plugin(options = {}) {
381
385
  return RESOLVED_PACKAGE_ID;
382
386
  }
383
387
  // Handle virtual component IDs
384
- if (id === VIRTUAL_APP_ID || id === VIRTUAL_LINK_ID) {
385
- return id;
388
+ if (id === VIRTUAL_APP_ID) {
389
+ return RESOLVED_VIRTUAL_APP_ID;
390
+ }
391
+ if (id === VIRTUAL_LINK_ID) {
392
+ return RESOLVED_VIRTUAL_LINK_ID;
386
393
  }
387
394
  },
388
395
 
@@ -398,10 +405,10 @@ export { default as Link } from "${VIRTUAL_LINK_ID}";
398
405
  export { plugin, default } from "@volpe/astro-svelte-spa/plugin";
399
406
  `;
400
407
  }
401
- if (id === VIRTUAL_APP_ID) {
408
+ if (id === RESOLVED_VIRTUAL_APP_ID) {
402
409
  return generateAppComponent();
403
410
  }
404
- if (id === VIRTUAL_LINK_ID) {
411
+ if (id === RESOLVED_VIRTUAL_LINK_ID) {
405
412
  return generateLinkComponent();
406
413
  }
407
414
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volpe/astro-svelte-spa",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Vite plugin for file-based routing with svelte5-router in Astro",
5
5
  "type": "module",
6
6
  "main": "index.js",