mirror of
https://github.com/penpot/penpot.git
synced 2026-10-31 23:10:31 +00:00
♻️ Consolidate build identity macros and helpers
AI-assisted-by: deepseek-flash
This commit is contained in:
parent
be10fb784b
commit
18ef4f96b5
@ -1,14 +0,0 @@
|
||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.identity
|
||||
(:require
|
||||
[app.render-wasm.performance :as performance]))
|
||||
|
||||
(defmacro compiled-profile-marks
|
||||
"Captures the profiling switch used by renderer macros in this compiler."
|
||||
[]
|
||||
(performance/enabled?))
|
||||
36
frontend/performance/benches/render_wasm/identity.cljc
Normal file
36
frontend/performance/benches/render_wasm/identity.cljc
Normal file
@ -0,0 +1,36 @@
|
||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.identity
|
||||
"Build identity shared by the isolated Node catalog and browser bundle."
|
||||
#?(:cljs (:require-macros [benches.render-wasm.identity :refer [compiled-profile-marks]]))
|
||||
#?(:clj (:require [app.render-wasm.performance :as performance])))
|
||||
|
||||
#?(:clj
|
||||
(defmacro compiled-profile-marks
|
||||
"Captures the profiling switch used by renderer macros in this compiler."
|
||||
[]
|
||||
(performance/enabled?)))
|
||||
|
||||
#?(:cljs
|
||||
(do
|
||||
(goog-define build-id "unprepared")
|
||||
|
||||
(defn data
|
||||
[]
|
||||
{:build-id build-id :cljs-profile-marks (compiled-profile-marks)})
|
||||
|
||||
(defn check
|
||||
"Checks a loaded bundle's identity against the selected build."
|
||||
[expected-id actual]
|
||||
(when-not (and (map? actual)
|
||||
(string? (:build-id actual))
|
||||
(= expected-id (:build-id actual)))
|
||||
(throw (ex-info "renderer build identity mismatch"
|
||||
{:type ::mismatch
|
||||
:expected-id expected-id
|
||||
:actual-id (:build-id actual)})))
|
||||
actual)))
|
||||
@ -1,27 +0,0 @@
|
||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns benches.render-wasm.identity
|
||||
"Build identity shared by the isolated Node catalog and browser bundle."
|
||||
(:require-macros [benches.render-wasm.identity :refer [compiled-profile-marks]]))
|
||||
|
||||
(goog-define build-id "unprepared")
|
||||
|
||||
(defn data
|
||||
[]
|
||||
{:build-id build-id :cljs-profile-marks (compiled-profile-marks)})
|
||||
|
||||
(defn check
|
||||
"Checks a loaded bundle's identity against the selected build."
|
||||
[expected-id actual]
|
||||
(when-not (and (map? actual)
|
||||
(string? (:build-id actual))
|
||||
(= expected-id (:build-id actual)))
|
||||
(throw (ex-info "renderer build identity mismatch"
|
||||
{:type ::mismatch
|
||||
:expected-id expected-id
|
||||
:actual-id (:build-id actual)})))
|
||||
actual)
|
||||
Loading…
x
Reference in New Issue
Block a user