@samva/vite 0.3.0 → 0.5.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/AGENTS.md CHANGED
@@ -7,13 +7,24 @@ programmatic template builds and `@samva/vite/emit` only for module-preview inte
7
7
  The CLI loads `@samva/vite/build` from the current project. Keep these authoring dependencies in the
8
8
  project lockfile so local preview, check, and build use the same compiler version as the project.
9
9
 
10
+ This package is plain TypeScript like `@samva/markup`, and adds no runtime framework of its own to
11
+ a template project. `@samva/vite/build` and the preview surfaces answer with discriminated results
12
+ carrying an `ok` field, and `@samva/vite/emit` passes the compiler's better-result `Result`
13
+ through. A missing `vite`, or an entry that does not default-export a template definition, throws.
14
+
10
15
  Hosted synchronization is ordinary Git. A CLI-created project has a repository-local Samva
11
16
  credential helper, and `samva templates publish` accepts only a clean exact commit reachable from
12
17
  the fetched `origin` default branch. Publish creates an immutable receipt; it does not push or
13
18
  rewrite history.
14
19
 
15
20
  Template discovery is `.tsx` only. The local email editor writes the canonical TSX entry with a
16
- revision check and a fresh comparison against disk; SMS and WhatsApp stay read-only. Every discovered entry is imported once through the dev
21
+ revision check and a fresh comparison against disk; SMS and WhatsApp stay read-only. A change
22
+ published without a client is what the editor reads as a foreign edit, so nothing the editor itself
23
+ did may reach it that way. A save and a fixture switch both run in the store's mutation queue, so no
24
+ rebuild can straddle one and publish the difference anonymously; the editor's write comes back
25
+ through the file watcher like any other edit, and a changed file that still holds the bytes its
26
+ entry was built from re-evaluates nothing. Watcher events arrive in bursts and one rebuild re-reads
27
+ the whole project, so a rebuild that has not started yet covers every event queued before it. Every discovered entry is imported once through the dev
17
28
  server's own SSR graph, and a default export that is a template definition takes the email lane —
18
29
  compiled and rendered through `compileEmailProject`, so a local render cannot drift from a published
19
30
  one. Email requires an executable definition. Structured SMS/WhatsApp entries emit SML, and
package/dist/build.js CHANGED
@@ -152,8 +152,15 @@ const createTemplateBuildSession = async (dir, options = {}) => {
152
152
  }
153
153
  return { files: entries };
154
154
  };
155
+ const fileEvents = /* @__PURE__ */ new Set([
156
+ "add",
157
+ "change",
158
+ "unlink"
159
+ ]);
155
160
  const subscribe = (listener) => {
156
- const onChange = (_event, path) => listener(path);
161
+ const onChange = (event, path) => {
162
+ if (fileEvents.has(event)) listener(path);
163
+ };
157
164
  server.watcher.on("all", onChange);
158
165
  return () => server.watcher.off("all", onChange);
159
166
  };