mirror of
https://github.com/penpot/penpot.git
synced 2026-08-29 16:18:48 +00:00
🔧 Add FF to enable wasm export at team level (#11130)
This commit is contained in:
parent
43b12bc4b9
commit
30bc2a4bc3
@ -57,6 +57,7 @@
|
|||||||
"text-editor/v2"
|
"text-editor/v2"
|
||||||
"text-editor-wasm/v1"
|
"text-editor-wasm/v1"
|
||||||
"render-wasm/v1"
|
"render-wasm/v1"
|
||||||
|
"wasm-export/v1"
|
||||||
"variants/v1"})
|
"variants/v1"})
|
||||||
|
|
||||||
;; A set of features enabled by default
|
;; A set of features enabled by default
|
||||||
@ -82,7 +83,8 @@
|
|||||||
"text-editor/v2"
|
"text-editor/v2"
|
||||||
"text-editor-wasm/v1"
|
"text-editor-wasm/v1"
|
||||||
"tokens/numeric-input"
|
"tokens/numeric-input"
|
||||||
"render-wasm/v1"})
|
"render-wasm/v1"
|
||||||
|
"wasm-export/v1"})
|
||||||
|
|
||||||
;; Features that are mainly backend only or there are a proper
|
;; Features that are mainly backend only or there are a proper
|
||||||
;; fallback when frontend reports no support for it
|
;; fallback when frontend reports no support for it
|
||||||
@ -132,6 +134,7 @@
|
|||||||
:feature-text-editor-v2-html-paste "text-editor/v2-html-paste"
|
:feature-text-editor-v2-html-paste "text-editor/v2-html-paste"
|
||||||
:feature-text-editor-wasm "text-editor-wasm/v1"
|
:feature-text-editor-wasm "text-editor-wasm/v1"
|
||||||
:feature-render-wasm "render-wasm/v1"
|
:feature-render-wasm "render-wasm/v1"
|
||||||
|
:feature-wasm-export "wasm-export/v1"
|
||||||
:feature-variants "variants/v1"
|
:feature-variants "variants/v1"
|
||||||
:feature-token-input "tokens/numeric-input"
|
:feature-token-input "tokens/numeric-input"
|
||||||
nil))
|
nil))
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
(:require
|
(:require
|
||||||
[app.common.time :as ct]
|
[app.common.time :as ct]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
|
||||||
[app.main.data.event :as ev]
|
[app.main.data.event :as ev]
|
||||||
[app.main.data.exports.wasm :as wasm.exports]
|
[app.main.data.exports.wasm :as wasm.exports]
|
||||||
[app.main.data.helpers :as dsh]
|
[app.main.data.helpers :as dsh]
|
||||||
@ -183,11 +182,11 @@
|
|||||||
(def ^:private wasm-export-types #{:jpeg :webp :png :pdf})
|
(def ^:private wasm-export-types #{:jpeg :webp :png :pdf})
|
||||||
|
|
||||||
(defn- wasm-export-enabled?
|
(defn- wasm-export-enabled?
|
||||||
"WASM export is available: the flag is set AND render-wasm is active for the
|
"WASM export is available when the `wasm-export/v1` feature is active AND
|
||||||
current file. When render-wasm is inactive its shape tree isn't loaded, so a
|
render-wasm is active for the current file. When render-wasm is inactive its
|
||||||
client-side WASM render would crash."
|
shape tree isn't loaded, so a client-side WASM render would crash."
|
||||||
[state]
|
[state]
|
||||||
(and (contains? cf/flags :wasm-export)
|
(and (features/active-feature? state "wasm-export/v1")
|
||||||
(features/active-feature? state "render-wasm/v1")))
|
(features/active-feature? state "render-wasm/v1")))
|
||||||
|
|
||||||
(defn- use-wasm-export?
|
(defn- use-wasm-export?
|
||||||
|
|||||||
@ -1201,7 +1201,7 @@
|
|||||||
|
|
||||||
;; Call exporter to get image URI, then fetch blob and resolve the deferred.
|
;; Call exporter to get image URI, then fetch blob and resolve the deferred.
|
||||||
(->> (if (and (features/active-feature? state "render-wasm/v1")
|
(->> (if (and (features/active-feature? state "render-wasm/v1")
|
||||||
(contains? cf/flags :wasm-export))
|
(features/active-feature? state "wasm-export/v1"))
|
||||||
(rx/of {:uri (wasm.exports/export-image-uri export)})
|
(rx/of {:uri (wasm.exports/export-image-uri export)})
|
||||||
(rp/cmd! :export
|
(rp/cmd! :export
|
||||||
{:exports [export]
|
{:exports [export]
|
||||||
|
|||||||
@ -33,7 +33,6 @@
|
|||||||
[app.common.types.shape.shadow :as ctss]
|
[app.common.types.shape.shadow :as ctss]
|
||||||
[app.common.types.text :as txt]
|
[app.common.types.text :as txt]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
|
||||||
[app.main.data.exports.assets :as de]
|
[app.main.data.exports.assets :as de]
|
||||||
[app.main.data.exports.wasm :as wasm.exports]
|
[app.main.data.exports.wasm :as wasm.exports]
|
||||||
[app.main.data.persistence :as dwp]
|
[app.main.data.persistence :as dwp]
|
||||||
@ -50,6 +49,7 @@
|
|||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
[app.main.data.workspace.tokens.application :as dwta]
|
[app.main.data.workspace.tokens.application :as dwta]
|
||||||
[app.main.data.workspace.variants :as dwv]
|
[app.main.data.workspace.variants :as dwv]
|
||||||
|
[app.main.features :as features]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.plugins.exports :as exports]
|
[app.plugins.exports :as exports]
|
||||||
@ -1532,7 +1532,7 @@
|
|||||||
(u/not-valid plugin-id :export value)
|
(u/not-valid plugin-id :export value)
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(if (and (contains? cf/flags :wasm-export)
|
(if (and (features/active-feature? @st/state "wasm-export/v1")
|
||||||
(contains? #{:jpeg :webp :png} (:type value :png)))
|
(contains? #{:jpeg :webp :png} (:type value :png)))
|
||||||
;; New export with wasm
|
;; New export with wasm
|
||||||
(let [uri (wasm.exports/export-image-uri
|
(let [uri (wasm.exports/export-image-uri
|
||||||
|
|||||||
@ -80,7 +80,10 @@ flowchart TB
|
|||||||
The client-side WASM export — rendering in the browser through the vector path
|
The client-side WASM export — rendering in the browser through the vector path
|
||||||
(`render_shape_pdf` / `render_shape_pixels`) — is wired **only for single
|
(`render_shape_pdf` / `render_shape_pixels`) — is wired **only for single
|
||||||
exports** (`request-simple-export` in `frontend/.../exports/assets.cljs`), and
|
exports** (`request-simple-export` in `frontend/.../exports/assets.cljs`), and
|
||||||
only when render-wasm is active and the `:wasm-export` flag is set.
|
only when render-wasm is active and the `wasm-export/v1` feature is enabled
|
||||||
|
(instance-wide through the `enable-feature-wasm-export` flag, or per team
|
||||||
|
through the team `features` column). The exporter service keeps its own
|
||||||
|
`:wasm-export` flag to decide whether it can serve the headless WASM path.
|
||||||
|
|
||||||
**Multiple/batch export** (`request-multiple-export`) always runs **server-side**
|
**Multiple/batch export** (`request-multiple-export`) always runs **server-side**
|
||||||
via the `:export-shapes` command; it merely passes an `:is-wasm` hint so the
|
via the `:export-shapes` command; it merely passes an `:is-wasm` hint so the
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user