@pyreon/vite-plugin 0.24.4 → 0.24.6

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.
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
5386
5386
  </script>
5387
5387
  <script>
5388
5388
  /*<!--*/
5389
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src/index.ts","uid":"e04d9c6c-1"}]},{"name":"rocketstyle-collapse-C4eMAnwR.js","children":[{"name":"src/rocketstyle-collapse.ts","uid":"e04d9c6c-3"}]}],"isRoot":true},"nodeParts":{"e04d9c6c-1":{"renderedLength":45559,"gzipLength":14773,"brotliLength":0,"metaUid":"e04d9c6c-0"},"e04d9c6c-3":{"renderedLength":3424,"gzipLength":1530,"brotliLength":0,"metaUid":"e04d9c6c-2"}},"nodeMetas":{"e04d9c6c-0":{"id":"/src/index.ts","moduleParts":{"index.js":"e04d9c6c-1"},"imported":[{"uid":"e04d9c6c-4"},{"uid":"e04d9c6c-5"},{"uid":"e04d9c6c-6"},{"uid":"e04d9c6c-2","dynamic":true},{"uid":"e04d9c6c-7","dynamic":true}],"importedBy":[],"isEntry":true},"e04d9c6c-2":{"id":"/src/rocketstyle-collapse.ts","moduleParts":{"rocketstyle-collapse-C4eMAnwR.js":"e04d9c6c-3"},"imported":[{"uid":"e04d9c6c-8","dynamic":true}],"importedBy":[{"uid":"e04d9c6c-0"}]},"e04d9c6c-4":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"e04d9c6c-0"}]},"e04d9c6c-5":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"e04d9c6c-0"}]},"e04d9c6c-6":{"id":"@pyreon/compiler","moduleParts":{},"imported":[],"importedBy":[{"uid":"e04d9c6c-0"}]},"e04d9c6c-7":{"id":"node:fs/promises","moduleParts":{},"imported":[],"importedBy":[{"uid":"e04d9c6c-0"}]},"e04d9c6c-8":{"id":"vite","moduleParts":{},"imported":[],"importedBy":[{"uid":"e04d9c6c-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5389
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src/index.ts","uid":"4f3120a0-1"}]},{"name":"rocketstyle-collapse-C4eMAnwR.js","children":[{"name":"src/rocketstyle-collapse.ts","uid":"4f3120a0-3"}]}],"isRoot":true},"nodeParts":{"4f3120a0-1":{"renderedLength":45599,"gzipLength":14790,"brotliLength":0,"metaUid":"4f3120a0-0"},"4f3120a0-3":{"renderedLength":3424,"gzipLength":1530,"brotliLength":0,"metaUid":"4f3120a0-2"}},"nodeMetas":{"4f3120a0-0":{"id":"/src/index.ts","moduleParts":{"index.js":"4f3120a0-1"},"imported":[{"uid":"4f3120a0-4"},{"uid":"4f3120a0-5"},{"uid":"4f3120a0-6"},{"uid":"4f3120a0-2","dynamic":true},{"uid":"4f3120a0-7","dynamic":true}],"importedBy":[],"isEntry":true},"4f3120a0-2":{"id":"/src/rocketstyle-collapse.ts","moduleParts":{"rocketstyle-collapse-C4eMAnwR.js":"4f3120a0-3"},"imported":[{"uid":"4f3120a0-8","dynamic":true}],"importedBy":[{"uid":"4f3120a0-0"}]},"4f3120a0-4":{"id":"node:fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"4f3120a0-0"}]},"4f3120a0-5":{"id":"node:path","moduleParts":{},"imported":[],"importedBy":[{"uid":"4f3120a0-0"}]},"4f3120a0-6":{"id":"@pyreon/compiler","moduleParts":{},"imported":[],"importedBy":[{"uid":"4f3120a0-0"}]},"4f3120a0-7":{"id":"node:fs/promises","moduleParts":{},"imported":[],"importedBy":[{"uid":"4f3120a0-0"}]},"4f3120a0-8":{"id":"vite","moduleParts":{},"imported":[],"importedBy":[{"uid":"4f3120a0-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5390
5390
 
5391
5391
  const run = () => {
5392
5392
  const width = window.innerWidth;
package/lib/index.js CHANGED
@@ -236,6 +236,7 @@ function pyreonPlugin(options) {
236
236
  const pyreonExclude = scanPyreonDeps(projectRoot);
237
237
  return {
238
238
  resolve: { conditions: ["bun"] },
239
+ ssr: { noExternal: [/@pyreon\//] },
239
240
  optimizeDeps: { exclude: Array.from(new Set([...compatExclude, ...pyreonExclude])) },
240
241
  oxc: { jsx: {
241
242
  runtime: "automatic",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/vite-plugin",
3
- "version": "0.24.4",
3
+ "version": "0.24.6",
4
4
  "description": "Vite plugin for Pyreon — .pyreon SFC support, HMR, compiler integration",
5
5
  "homepage": "https://github.com/pyreon/pyreon/tree/main/packages/vite-plugin#readme",
6
6
  "bugs": {
@@ -15,7 +15,6 @@
15
15
  "files": [
16
16
  "lib",
17
17
  "!lib/**/*.map",
18
- "src",
19
18
  "README.md",
20
19
  "LICENSE"
21
20
  ],
@@ -26,7 +25,6 @@
26
25
  "types": "./lib/types/index.d.ts",
27
26
  "exports": {
28
27
  ".": {
29
- "bun": "./src/index.ts",
30
28
  "import": "./lib/index.js",
31
29
  "types": "./lib/types/index.d.ts"
32
30
  }
@@ -43,7 +41,7 @@
43
41
  "prepublishOnly": "bun run build"
44
42
  },
45
43
  "dependencies": {
46
- "@pyreon/compiler": "^0.24.4"
44
+ "@pyreon/compiler": "^0.24.6"
47
45
  },
48
46
  "devDependencies": {
49
47
  "vite": "^8.0.0"
@@ -1,92 +0,0 @@
1
- /**
2
- * Pyreon HMR Runtime — preserves signal state across hot module reloads.
3
- *
4
- * Served as a virtual module `\0pyreon/hmr-runtime` and injected into every
5
- * .tsx/.jsx module during development.
6
- *
7
- * ## How it works
8
- *
9
- * 1. The Vite plugin rewrites top-level `signal()` calls:
10
- * `const count = signal(0)` → `const count = __hmr_signal("src/App.tsx", "count", signal, 0)`
11
- *
12
- * 2. `__hmr_signal` checks a global registry for a saved value under the
13
- * composite key `moduleId + ":" + name`. If found, it creates the signal
14
- * with the preserved value instead of the initial one.
15
- *
16
- * 3. When `import.meta.hot.accept()` fires, a `dispose` callback saves every
17
- * registered signal's current value into the registry before the old module
18
- * is discarded.
19
- *
20
- * The registry lives on `globalThis` so it survives module re-execution.
21
- */
22
-
23
- interface SignalLike {
24
- peek(): unknown
25
- set(value: unknown): void
26
- }
27
-
28
- interface ModuleSignals {
29
- entries: Map<string, SignalLike>
30
- }
31
-
32
- const REGISTRY_KEY = '__pyreon_hmr_registry__'
33
-
34
- type Registry = Map<string, Map<string, unknown>>
35
-
36
- function getRegistry(): Registry {
37
- const g = globalThis as Record<string, unknown>
38
- if (!g[REGISTRY_KEY]) {
39
- g[REGISTRY_KEY] = new Map()
40
- }
41
- return g[REGISTRY_KEY] as Registry
42
- }
43
-
44
- const moduleSignals = new Map<string, ModuleSignals>()
45
-
46
- /**
47
- * Called in place of `signal(initialValue)` for module-scope signals.
48
- * Restores the previous value if the module is being hot-reloaded.
49
- */
50
- export function __hmr_signal<T>(
51
- moduleId: string,
52
- name: string,
53
- signalFn: (value: T, options?: { name?: string }) => SignalLike,
54
- initialValue: T,
55
- ): ReturnType<typeof signalFn> {
56
- const registry = getRegistry()
57
- const saved = registry.get(moduleId)
58
-
59
- // Use saved value if available (hot reload), otherwise use initial
60
- const value = saved?.has(name) ? (saved.get(name) as T) : initialValue
61
-
62
- const s = signalFn(value, { name })
63
-
64
- // Track this signal for future disposal
65
- let mod = moduleSignals.get(moduleId)
66
- if (!mod) {
67
- mod = { entries: new Map() }
68
- moduleSignals.set(moduleId, mod)
69
- }
70
- mod.entries.set(name, s)
71
-
72
- return s
73
- }
74
-
75
- /**
76
- * Called in the `import.meta.hot.dispose` callback.
77
- * Saves all registered signal values for the module before it is discarded.
78
- */
79
- export function __hmr_dispose(moduleId: string): void {
80
- const mod = moduleSignals.get(moduleId)
81
- if (!mod) return
82
-
83
- const registry = getRegistry()
84
- const saved = new Map<string, unknown>()
85
- for (const [name, s] of mod.entries) {
86
- saved.set(name, s.peek())
87
- }
88
- registry.set(moduleId, saved)
89
-
90
- // Clear entries so the new module can re-register
91
- moduleSignals.delete(moduleId)
92
- }