@yoamigo.com/core 0.2.0 → 0.3.0

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/plugin.js CHANGED
@@ -6,6 +6,37 @@ function yoamigoPlugin(options = {}) {
6
6
  const templateDir = process.cwd();
7
7
  const resolveFromTemplate = (relativePath) => path.resolve(templateDir, relativePath);
8
8
  return [
9
+ // Content HMR plugin - enables hot reloading of content.ts without full page refresh
10
+ {
11
+ name: "yoamigo:content-hmr",
12
+ handleHotUpdate({ file, server }) {
13
+ if (!file.endsWith("/content.ts") && !file.endsWith("\\content.ts")) return;
14
+ server.ws.send({
15
+ type: "custom",
16
+ event: "yoamigo:content-update"
17
+ });
18
+ return [];
19
+ },
20
+ transform(code, id) {
21
+ if (!id.match(/\/main\.tsx?$/) && !id.match(/\\main\.tsx?$/)) return;
22
+ const hmrCode = `
23
+ // YoAmigo Content HMR - injected by yoamigo:content-hmr plugin
24
+ if (import.meta.hot) {
25
+ import.meta.hot.on('yoamigo:content-update', async () => {
26
+ try {
27
+ const { default: newContent } = await import(/* @vite-ignore */ './content?t=' + Date.now())
28
+ const { registerContent } = await import('@yoamigo.com/core')
29
+ registerContent(newContent)
30
+ window.dispatchEvent(new CustomEvent('content-updated'))
31
+ } catch (err) {
32
+ console.error('[yoamigo:content-hmr] Failed to hot reload content:', err)
33
+ }
34
+ })
35
+ }
36
+ `;
37
+ return { code: code + "\n" + hmrCode, map: null };
38
+ }
39
+ },
9
40
  {
10
41
  name: "yoamigo:config",
11
42
  config(config, { mode }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoamigo.com/core",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Core components, router, and utilities for YoAmigo templates",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -62,6 +62,7 @@
62
62
  "prepublishOnly": "pnpm build"
63
63
  },
64
64
  "dependencies": {
65
+ "@floating-ui/react": "^0.27.16",
65
66
  "clsx": "^2.1.1",
66
67
  "html2canvas-pro": "^1.6.1",
67
68
  "preact": "^10.27.2",