diff --git a/src/bareforge/export/cljs_project.cljs b/src/bareforge/export/cljs_project.cljs index bae4919..5cfd6f9 100644 --- a/src/bareforge/export/cljs_project.cljs +++ b/src/bareforge/export/cljs_project.cljs @@ -65,7 +65,6 @@ ;; go away. (def detect-groups em/detect-groups) -(def ^:private collect-group-data em/collect-group-data) (defn- field-type->spec "Convert a field type keyword to a spec predicate string." @@ -170,13 +169,9 @@ ;; --- code generation: views ------------------------------------------------ -(def ^:private template-group? em/template-group?) -(def ^:private stateful-group? em/stateful-group?) (def ^:private computed-field? em/computed?) (def ^:private collection-field? em/collection-field?) -(def ^:private field-owner-index em/field-owner-index) -(def ^:private name->ns-name-map em/name->ns-name-map) (def ^:private explicit-field-owners em/explicit-field-owners) (def ^:private collect-read-bindings em/collect-read-bindings) (def ^:private collect-trigger-payload-fields em/collect-trigger-payload-fields) @@ -539,17 +534,18 @@ data bundle — the data assembly is large enough to read as a small program of its own, and the formatting step is easier to audit when it stops sharing scope with 25 derived locals." - [doc group all-groups app-ns] - (let [node (m/get-node doc (:id group)) + [doc group lowered app-ns] + (let [all-groups (:groups lowered) + template-groups (:template-names lowered) + owner-idx (:field-owner-ns lowered) + name->ns (:name->ns-name lowered) + node (m/get-node doc (:id group)) fn-name (:ns-name group) parent-info (m/parent-of doc (:id group)) root-slot (when parent-info (:slot parent-info)) ns-path (str app-ns "." (:ns-name group) ".views") own-ns-name (:ns-name group) - template? (template-group? doc group) - template-groups (into #{} - (for [g all-groups :when (template-group? doc g)] - (:ns-name g))) + template? (:template? group) sub-groups (find-sub-groups node all-groups) sub-group-ids (set (map :id sub-groups)) read-fields (collect-read-bindings node sub-group-ids) @@ -566,8 +562,6 @@ distinct (remove own-field-set)) has-let? (seq let-fields) - owner-idx (field-owner-index doc all-groups) - name->ns (name->ns-name-map doc all-groups) explicit (into {} (for [[f owner] (explicit-field-owners node sub-group-ids)] [f (get name->ns owner owner)])) @@ -691,10 +685,10 @@ Data assembly lives in `view-context`; this fn formats the file string from that bundle." - [doc group all-groups app-ns] + [doc group lowered app-ns] (let [{:keys [fn-name ns-path fn-sig require-entries hiccup-ctx node root-slot let-fields field->owner has-let?]} - (view-context doc group all-groups app-ns) + (view-context doc group lowered app-ns) hiccup-form (node->hiccup-with-events hiccup-ctx node root-slot) hiccup-str (cf/format-form hiccup-form) ns-clause (if (seq require-entries) @@ -820,10 +814,10 @@ produce a `(s/coll-of ::.db/record)` spec and carry their seed records in `:default` verbatim. Computed fields are excluded — their sub is derived in `generate-subs`." - [doc group all-groups app-ns] - (if (template-group? doc group) + [doc group _lowered app-ns] + (if (:template? group) (generate-db-template doc group app-ns) - (let [data (collect-group-data doc (:instance-ids group) all-groups) + (let [data (:data group) all-fields (:fields data) declared-keys (set (map :name all-fields)) stored (remove computed-field? all-fields) @@ -1075,12 +1069,13 @@ - One derived sub per computed field. - Per-field `any?`-typed subs for any binding-only fields not already declared (legacy binding path)." - [doc group all-groups app-ns] - (let [ns-path (str app-ns "." (:ns-name group) ".subs") + [doc group lowered app-ns] + (let [all-groups (:groups lowered) + ns-path (str app-ns "." (:ns-name group) ".subs") db-alias (str (:ns-name group) ".db") db-ns (str app-ns "." (:ns-name group) ".db")] - (when-not (template-group? doc group) - (let [data (collect-group-data doc (:instance-ids group) all-groups) + (when-not (:template? group) + (let [data (:data group) bindings (filter #(contains? #{:read :read-write} (:direction %)) (:bindings data)) fields (:fields data) @@ -1313,8 +1308,8 @@ db require is the group's own db namespace. Returns nil when the group has neither fields nor declared actions." - [doc group all-groups app-ns] - (let [data (collect-group-data doc (:instance-ids group) all-groups) + [_doc group _lowered app-ns] + (let [data (:data group) fields (:fields data) actions (:actions data) emitting-ns (:ns-name group) @@ -1322,7 +1317,7 @@ db-ns (str app-ns "." emitting-ns ".db") db-alias (str emitting-ns ".db") declared-names (into #{} (map (comp cljs.core/name :name) actions)) - template? (template-group? doc group) + template? (:template? group) setter-fields (if template? ;; Template groups own no state — no setters. [] @@ -1348,8 +1343,8 @@ "Generate the root db.cljs that merges the `default-db` of every stateful group. Template groups carry no state, so they're excluded from the require list and the merge." - [doc groups app-ns] - (let [stateful (filter #(stateful-group? doc %) groups) + [_doc lowered app-ns] + (let [stateful (remove :template? (:groups lowered)) requires (str/join "\n " (cons (str "[" app-ns ".framework :as rf]") (for [g stateful] @@ -1560,13 +1555,13 @@ x-gaussian-blur, …) render as inline hiccup; named descendants inside them are recognised and emitted as group-view calls so the group's own subtree stays self-contained." - [doc groups root-order app-ns] - (let [root-groups (filter :group? root-order) - template-names (into #{} - (for [g groups :when (template-group? doc g)] - (:ns-name g))) - owner-idx (field-owner-index doc groups) - name->ns (name->ns-name-map doc groups) + [doc lowered app-ns] + (let [groups (:groups lowered) + root-order (:root-order lowered) + template-names (:template-names lowered) + owner-idx (:field-owner-ns lowered) + name->ns (:name->ns-name lowered) + root-groups (filter :group? root-order) root-tpl-subs (distinct (for [entry root-groups :when (contains? template-names (:ns-name entry)) @@ -1736,21 +1731,27 @@ :title — HTML page title (default \"Bareforge Export\") :port — dev server port (default 9000) - Returns a map of {relative-file-path -> file-content-string}." + Returns a map of {relative-file-path -> file-content-string}. + + Per-document facts (group classification, field owners, + name->ns map, per-group `:data`) are computed once via + `bareforge.export.model/lower-document` and threaded through + the per-group generators as `lowered` — no generator re-derives." [doc & [{:keys [app-ns title port] :or {app-ns "app" title "Bareforge Export" port 9000}}]] - (let [{:keys [groups root-order]} (detect-groups doc) + (let [lowered (em/lower-document doc) + groups (:groups lowered) src-base (str "src/" (kebab->snake app-ns) "/") group-files (into {} (for [g groups - [suffix content] [["db.cljs" (generate-db doc g groups app-ns)] - ["subs.cljs" (generate-subs doc g groups app-ns)] - ["events.cljs" (generate-events doc g groups app-ns)] - ["views.cljs" (generate-views doc g groups app-ns)]] + [suffix content] [["db.cljs" (generate-db doc g lowered app-ns)] + ["subs.cljs" (generate-subs doc g lowered app-ns)] + ["events.cljs" (generate-events doc g lowered app-ns)] + ["views.cljs" (generate-views doc g lowered app-ns)]] :when content] [(str src-base (kebab->snake (:ns-name g)) "/" suffix) content])) - core-file (generate-core doc groups root-order app-ns)] + core-file (generate-core doc lowered app-ns)] (merge {"deps.edn" (generate-deps-edn) "shadow-cljs.edn" (generate-shadow-cljs-edn app-ns port) @@ -1760,7 +1761,7 @@ {(str src-base "framework.cljs") (generate-framework app-ns) (str src-base "renderer.cljs") (generate-renderer app-ns)} - {(str src-base "db.cljs") (generate-root-db doc groups app-ns) + {(str src-base "db.cljs") (generate-root-db doc lowered app-ns) (str src-base "core.cljs") core-file} group-files))) diff --git a/src/bareforge/export/vanilla_js/codegen.cljs b/src/bareforge/export/vanilla_js/codegen.cljs index 191a685..90f5891 100644 --- a/src/bareforge/export/vanilla_js/codegen.cljs +++ b/src/bareforge/export/vanilla_js/codegen.cljs @@ -38,19 +38,21 @@ is unknown computed operations (a pre-v1 op like `:first-of` or a typo in a hand-edited doc); the seven v1 ops all have emitters below. `:inner-html` is supported via `parse-html` - at codegen — see `node->js-hiccup`." - [doc groups] + at codegen — see `node->js-hiccup`. + + Consumes lowered groups so it walks `(:data g)` instead of + re-deriving via `collect-group-data` per group." + [groups] (doseq [g groups] - (let [data (em/collect-group-data doc (:instance-ids g) groups)] - (doseq [fd (:fields data) - :when (em/computed? fd) - :let [op (get-in fd [:computed :operation])]] - (when-not (contains? known-computed-ops op) - (throw (ex-info (str "Vanilla-JS plugin doesn't recognise " - "computed op " op " on `" (:name fd) - "` of group `" (:ns-name g) "`. Known " - "ops: " (pr-str known-computed-ops)) - {:error :nyi :op op :field (:name fd)}))))))) + (doseq [fd (:fields (:data g)) + :when (em/computed? fd) + :let [op (get-in fd [:computed :operation])]] + (when-not (contains? known-computed-ops op) + (throw (ex-info (str "Vanilla-JS plugin doesn't recognise " + "computed op " op " on `" (:name fd) + "` of group `" (:ns-name g) "`. Known " + "ops: " (pr-str known-computed-ops)) + {:error :nyi :op op :field (:name fd)})))))) ;; --- helpers ------------------------------------------------------------- @@ -141,11 +143,10 @@ groups (no stored state) return nil — the app.js merger skips them. Stateful groups contribute one entry per stored field, scalar or collection." - [doc group _all-groups] - (when (em/stateful-group? doc group) + [_doc group _lowered] + (when-not (:template? group) (let [app-ns "app" - node (m/get-node doc (:id group)) - fields (remove em/computed? (:fields node))] + fields (remove em/computed? (:fields (:data group)))] (when (seq fields) (str "// Auto-generated: db slice for group \"" (:ns-name group) "\".\n" "export const defaultDb = {\n" @@ -174,13 +175,12 @@ underlying COLLECTION field on the owning stateful group. Used by `:sum-of` with a `:project-field` and by `:filter-by` to qualify the project/match keys." - [doc all-groups source-field] + [all-groups source-field] (some (fn [g] - (let [n (m/get-node doc (first (:instance-ids g)))] - (some (fn [f] - (when (= source-field (:name f)) - (:of-group f))) - (:fields n)))) + (some (fn [f] + (when (= source-field (:name f)) + (:of-group f))) + (:fields (:data g)))) all-groups)) (defn- emit-computed-simple @@ -188,7 +188,7 @@ sub: `regSubDerived(id, [src-sub], extract-fn)`. Covers :count-of, :empty-of, :negation, and :sum-of (with or without :project-field)." - [app-ns group fd doc all-groups] + [app-ns group fd _doc all-groups] (let [id (sub-id app-ns (:ns-name group) (:name fd)) src (:source-field (:computed fd)) src-sub (sub-id app-ns (:ns-name group) src) @@ -205,7 +205,7 @@ ;; collection's :of-group; pluck the project field via ;; that full key. When :of-group is absent (degenerate ;; legacy path), fall back to a bare-key lookup. - (let [og (source-field-of-group doc all-groups src) + (let [og (source-field-of-group all-groups src) k (if og (record-key app-ns og (cljs.core/name proj)) (cljs.core/name proj))] @@ -308,11 +308,11 @@ (defn emit-group-subs "Direct subs for stored fields + derived / multi-signal subs for each computed field. Template groups own no state — return nil." - [doc group all-groups] - (when (em/stateful-group? doc group) - (let [app-ns "app" - data (em/collect-group-data doc (:instance-ids group) all-groups) - fields (:fields data)] + [doc group lowered] + (when-not (:template? group) + (let [app-ns "app" + all-groups (:groups lowered) + fields (:fields (:data group))] (when (seq fields) (let [imports (subs-imports-needed fields)] (str "// Auto-generated: subs for group \"" (:ns-name group) "\".\n" @@ -331,11 +331,10 @@ "The `:of-group` value on a stateful group's target-field, or nil if the target is scalar. Drives `:add` / `:remove` qualifyMap re-keying." - [doc group all-groups target-field] - (let [data (em/collect-group-data doc (:instance-ids group) all-groups)] - (some (fn [fd] - (when (= target-field (:name fd)) (:of-group fd))) - (:fields data)))) + [group target-field] + (some (fn [fd] + (when (= target-field (:name fd)) (:of-group fd))) + (:fields (:data group)))) (defn- qualify-expr "JS expression that re-keys `x` under `..db` when @@ -372,10 +371,10 @@ "JS expression that returns the new db given the prior `db`, with one step applied. Used inside the multi-step handler's `(db => …)` reducer." - [app-ns group doc all-groups step prev-db] + [app-ns group step prev-db] (let [{:keys [operation target-field]} step fk (field-key app-ns (:ns-name group) target-field) - og (field-of-group doc group all-groups target-field) + og (field-of-group group target-field) vexpr (step-payload-js step) q-v (qualify-expr app-ns og vexpr) cur (str prev-db "[\"" fk "\"]")] @@ -409,7 +408,7 @@ respects its own `:payload` (literal-only in v1) so a step like `:set is-popover-open false` lands the literal verbatim while a `:add` step still consumes the dispatched record." - [app-ns group action doc all-groups] + [app-ns group action] (let [{:keys [name]} action aname (cljs.core/name name) ev-id (str app-ns "." (:ns-name group) ".events/" aname) @@ -417,7 +416,7 @@ (if (= 1 (count steps)) (let [{:keys [operation target-field]} (first steps) fk (field-key app-ns (:ns-name group) target-field) - og (field-of-group doc group all-groups target-field) + og (field-of-group group target-field) q-x (qualify-expr app-ns og "x")] (case operation :set @@ -447,8 +446,7 @@ ;; Multi-step: thread db through each step's mutator. (let [body (reduce (fn [acc step] - (str "(db => " (step-mutator-expr app-ns group doc all-groups - step "db") + (str "(db => " (step-mutator-expr app-ns group step "db") ")(" acc ")")) "db0" steps)] @@ -458,19 +456,19 @@ (defn- step-needs-qualify? "True when a single step's operation + target combination forces `qualifyMap` in the emitted JS." - [doc group all-groups step] + [group step] (and (contains? #{:add :remove :set} (:operation step)) - (field-of-group doc group all-groups (:target-field step)))) + (field-of-group group (:target-field step)))) (defn- uses-qualify? "Does any declared action need `qualifyMap` — i.e. :add or :remove (or :set) on an :of-group target? Iterates step-by-step so multi-step actions surface as needing qualifyMap if any one of their steps does." - [doc group all-groups actions] + [group actions] (boolean (some (fn [a] - (some (partial step-needs-qualify? doc group all-groups) + (some (partial step-needs-qualify? group) (actions/step-list a))) actions))) @@ -487,20 +485,20 @@ "JS module registering every event handler the group owns — auto setters for stored fields plus declared actions. Skipped for template groups (they own no state)." - [doc group all-groups] - (when (em/stateful-group? doc group) - (let [app-ns "app" - data (em/collect-group-data doc (:instance-ids group) all-groups) - stored (remove em/computed? (:fields data)) - declared (:actions data) + [_doc group _lowered] + (when-not (:template? group) + (let [app-ns "app" + data (:data group) + stored (remove em/computed? (:fields data)) + declared (:actions data) declared-names (set (map :name declared)) - setter-kw (fn [fd] (keyword (str (cljs.core/name (:name fd)) "-changed"))) - auto-setters (remove #(contains? declared-names (setter-kw %)) stored) - extra-imports (concat ["regEvent" "trimV" "path"] - (when (uses-qualify? doc group all-groups declared) - ["qualifyMap"]) - (when (uses-deep-equal? declared) - ["deepEqual"]))] + setter-kw (fn [fd] (keyword (str (cljs.core/name (:name fd)) "-changed"))) + auto-setters (remove #(contains? declared-names (setter-kw %)) stored) + extra-imports (concat ["regEvent" "trimV" "path"] + (when (uses-qualify? group declared) + ["qualifyMap"]) + (when (uses-deep-equal? declared) + ["deepEqual"]))] (when (or (seq declared) (seq auto-setters)) (str "// Auto-generated: events for group \"" (:ns-name group) "\".\n" "import { " (str/join ", " extra-imports) @@ -508,7 +506,7 @@ (str/join "\n\n" (concat (for [fd auto-setters] (emit-auto-setter app-ns group fd)) - (for [a declared] (emit-action app-ns group a doc all-groups)))) + (for [a declared] (emit-action app-ns group a)))) "\n"))))) ;; --- views --------------------------------------------------------------- @@ -859,11 +857,14 @@ arg, destructures its namespaced keys into local symbols, and returns the hiccup tree with those symbols substituting for `:text-field`-bound nodes and bindings that read the record." - [doc group all-groups] - (let [app-ns "app" - node (m/get-node doc (:id group)) - fields (remove em/computed? (:fields node)) - field-syms (set (map :name fields)) + [doc group lowered] + (let [app-ns "app" + all-groups (:groups lowered) + template-groups (:template-names lowered) + owner-idx (:field-owner-ns lowered) + node (m/get-node doc (:id group)) + fields (remove em/computed? (:fields (:data group))) + field-syms (set (map :name fields)) destructure (str "const { " (str/join ", " @@ -872,20 +873,16 @@ (str "\"" (record-key app-ns (:ns-name group) (:name fd)) "\": " fname))) " } = record;") - sub-groups (em/find-sub-groups node all-groups) + sub-groups (em/find-sub-groups node all-groups) sub-groups-by-id (into {} (map (juxt :id identity)) sub-groups) - template-groups (into #{} - (for [g all-groups :when (em/template-group? doc g)] - (:ns-name g))) - owner-idx (em/field-owner-index doc all-groups) - field->owner (fn [field] - (or (get owner-idx field) (:ns-name group))) - ctx {:app-ns app-ns - :doc doc - :all-groups all-groups - :field->owner field->owner - :sub-groups-by-id sub-groups-by-id - :template-groups template-groups + field->owner (fn [field] + (or (get owner-idx field) (:ns-name group))) + ctx {:app-ns app-ns + :doc doc + :all-groups all-groups + :field->owner field->owner + :sub-groups-by-id sub-groups-by-id + :template-groups template-groups :template-field-syms field-syms :template-record-sym "record"}] (str "export function view(record) {\n" @@ -895,23 +892,22 @@ (defn- stateful-view "Emit the no-arg view function for a stateful group." - [doc group all-groups] - (let [app-ns "app" - node (m/get-node doc (:id group)) - sub-groups (em/find-sub-groups node all-groups) + [doc group lowered] + (let [app-ns "app" + all-groups (:groups lowered) + template-groups (:template-names lowered) + owner-idx (:field-owner-ns lowered) + node (m/get-node doc (:id group)) + sub-groups (em/find-sub-groups node all-groups) sub-groups-by-id (into {} (map (juxt :id identity)) sub-groups) - template-groups (into #{} - (for [g all-groups :when (em/template-group? doc g)] - (:ns-name g))) - owner-idx (em/field-owner-index doc all-groups) - field->owner (fn [field] - (or (get owner-idx field) (:ns-name group))) - ctx {:app-ns app-ns - :doc doc - :all-groups all-groups - :field->owner field->owner - :sub-groups-by-id sub-groups-by-id - :template-groups template-groups + field->owner (fn [field] + (or (get owner-idx field) (:ns-name group))) + ctx {:app-ns app-ns + :doc doc + :all-groups all-groups + :field->owner field->owner + :sub-groups-by-id sub-groups-by-id + :template-groups template-groups :template-field-syms #{} :template-record-sym nil}] (str "export function view() {\n" @@ -923,13 +919,13 @@ `template-iteration-expr` can call it. Runs for both stateful AND template-group views (a template can itself host another template, though v0.2 tests don't exercise that)." - [doc group all-groups] - (let [node (m/get-node doc (:id group)) - sub-groups (em/find-sub-groups node all-groups) - templates (filter (fn [sg] - (some #(= (:ns-name sg) (:ns-name %)) - (filter #(em/template-group? doc %) all-groups))) - sub-groups)] + [doc group lowered] + (let [all-groups (:groups lowered) + template-groups (:template-names lowered) + node (m/get-node doc (:id group)) + sub-groups (em/find-sub-groups node all-groups) + templates (filter #(contains? template-groups (:ns-name %)) + sub-groups)] (str/join "\n" (for [sg (->> templates (map :ns-name) (filter some?) distinct)] ;; tpl_ is a JS binding name (must be a valid JS @@ -942,15 +938,15 @@ (defn emit-group-views "Pick the right view shape based on whether the group is a template (takes a `record` arg) or stateful (no args)." - [doc group all-groups] - (let [tpl? (em/template-group? doc group) + [doc group lowered] + (let [tpl? (:template? group) imports (str "import { query, dispatch } from \"../runtime.js\";\n" - (let [tpl-imports (template-sub-imports doc group all-groups)] + (let [tpl-imports (template-sub-imports doc group lowered)] (when (seq tpl-imports) (str tpl-imports "\n")))) body (if tpl? - (template-view doc group all-groups) - (stateful-view doc group all-groups))] + (template-view doc group lowered) + (stateful-view doc group lowered))] (str "// Auto-generated: view for group \"" (:ns-name group) "\".\n" imports "\n" @@ -966,8 +962,11 @@ `x-navbar` and `x-gaussian-blur` come along for the ride — they're decorative containers rendered inline; their named descendants jump out into their own view fns." - [doc groups] - (let [stateful (filter #(em/stateful-group? doc %) groups) + [doc lowered] + (let [groups (:groups lowered) + template-groups (:template-names lowered) + owner-idx (:field-owner-ns lowered) + stateful (remove :template? groups) ;; Path segments stay kebab-case (the on-disk file layout ;; mirrors `/`); JS binding names use `js-ident` ;; so a group named "product-feed" imports as @@ -988,20 +987,16 @@ ;; emits a `View()` call for each, and unnamed ;; wrappers (x-navbar, x-gaussian-blur, …) stay inline as ;; hiccup arrays. - root-node (:root doc) - sub-groups (em/find-sub-groups root-node groups) + root-node (:root doc) + sub-groups (em/find-sub-groups root-node groups) sub-groups-by-id (into {} (map (juxt :id identity)) sub-groups) - template-groups (into #{} - (for [g groups :when (em/template-group? doc g)] - (:ns-name g))) - owner-idx (em/field-owner-index doc groups) - field->owner (fn [field] (or (get owner-idx field) "main")) - ctx {:app-ns "app" - :doc doc - :all-groups groups - :field->owner field->owner - :sub-groups-by-id sub-groups-by-id - :template-groups template-groups + field->owner (fn [field] (or (get owner-idx field) "main")) + ctx {:app-ns "app" + :doc doc + :all-groups groups + :field->owner field->owner + :sub-groups-by-id sub-groups-by-id + :template-groups template-groups :template-field-syms #{} :template-record-sym nil} root-tree (node->js-hiccup root-node nil ctx)] diff --git a/src/bareforge/export/vanilla_js/plugin.cljs b/src/bareforge/export/vanilla_js/plugin.cljs index 5aea337..e4b02b9 100644 --- a/src/bareforge/export/vanilla_js/plugin.cljs +++ b/src/bareforge/export/vanilla_js/plugin.cljs @@ -129,20 +129,21 @@ silently emit broken JS." [doc {:keys [title integrity-manifest] :or {title "Bareforge Vanilla JS Export"}}] - (let [{:keys [groups]} (em/detect-groups doc) - _ (codegen/assert-supported! doc groups)] + (let [lowered (em/lower-document doc) + groups (:groups lowered) + _ (codegen/assert-supported! groups)] (merge {"index.html" (index-html doc title integrity-manifest) "package.json" (package-json title) "runtime.js" runtime-js-template "renderer.js" renderer-js-template - "app.js" (codegen/emit-app-js doc groups)} + "app.js" (codegen/emit-app-js doc lowered)} (into {} (for [g groups - [suffix content] [["db.js" (codegen/emit-group-db doc g groups)] - ["subs.js" (codegen/emit-group-subs doc g groups)] - ["events.js" (codegen/emit-group-events doc g groups)] - ["views.js" (codegen/emit-group-views doc g groups)]] + [suffix content] [["db.js" (codegen/emit-group-db doc g lowered)] + ["subs.js" (codegen/emit-group-subs doc g lowered)] + ["events.js" (codegen/emit-group-events doc g lowered)] + ["views.js" (codegen/emit-group-views doc g lowered)]] :when content] [(str (:ns-name g) "/" suffix) content]))))) diff --git a/test/bareforge/export/vanilla_js_test.cljs b/test/bareforge/export/vanilla_js_test.cljs index b20ca81..cfc8b5c 100644 --- a/test/bareforge/export/vanilla_js_test.cljs +++ b/test/bareforge/export/vanilla_js_test.cljs @@ -512,10 +512,10 @@ ;; --- codegen helpers in isolation --------------------------------------- (deftest assert-supported-accepts-minimal-doc - (let [doc (scalar-only-doc) - groups (:groups (em/detect-groups doc))] + (let [doc (scalar-only-doc) + groups (:groups (em/lower-document doc))] ;; No throw = pass. - (codegen/assert-supported! doc groups) + (codegen/assert-supported! groups) (is true "assert-supported! accepts scalar-only docs silently"))) (defn- icon-doc [inner-html] @@ -535,8 +535,8 @@ ;; v0.3 parses the HTML into hiccup at codegen time and emits it ;; inline, so assert-supported! no longer rejects. (let [doc (icon-doc "") - groups (:groups (em/detect-groups doc))] - (codegen/assert-supported! doc groups) + groups (:groups (em/lower-document doc))] + (codegen/assert-supported! groups) (is true "no throw on inner-html-bearing docs"))) (deftest inner-html-emits-as-nested-hiccup