create-avalon 0.1.13 → 0.1.14

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/dist/cli.js +13 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1763,10 +1763,23 @@ async function scaffoldProject(config, targetDir) {
1763
1763
  await writeFile(join(targetDir, "server/renderer.ts"), [
1764
1764
  `import { createNitroRenderer } from '@useavalon/avalon/nitro/renderer';`,
1765
1765
  `import avalonConfig from 'virtual:avalon/config';`,
1766
+ `import { loadPage } from 'virtual:avalon/page-loader';`,
1766
1767
  ``,
1767
1768
  `export default createNitroRenderer({`,
1768
1769
  ` avalonConfig,`,
1769
1770
  ` isDev: avalonConfig.isDev,`,
1771
+ ` resolvePageRoute: async (pathname) => {`,
1772
+ ` const mod = loadPage(pathname);`,
1773
+ ` if (!mod) return null;`,
1774
+ ` return { filePath: \`[virtual:\${pathname}]\`, pattern: pathname, params: {} };`,
1775
+ ` },`,
1776
+ ` loadPageModule: async (filePath) => {`,
1777
+ ` const match = filePath.match(/^\\[virtual:(.+)\\]$/);`,
1778
+ ` const pathname = match ? match[1] : filePath;`,
1779
+ ` const mod = loadPage(pathname);`,
1780
+ ` if (mod) return mod;`,
1781
+ ` return { default: () => null, metadata: { title: 'Avalon' } };`,
1782
+ ` },`,
1770
1783
  `});`,
1771
1784
  ``
1772
1785
  ].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-avalon",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Scaffold a new Avalon project with multi-framework islands architecture",
5
5
  "license": "MIT",
6
6
  "type": "module",