mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
The frontend replay of generated component programs runs in node, where the WASM render engine is not available. A `test-wasm` build runs the same replay in a browser page: it loads the engine on a canvas, turns on render-wasm/v1 and loads the shapes of the replayed page into the engine whenever they change, so every layout goes through it. Text edits commit through the SVG editor, as the WASM editor needs its own editing session. The page reads the programs the common tests pin, which a script writes out, and reports each one to the console. Build with `pnpm run build:test-wasm`, then open `/test-wasm.html?programs=programs.js`. Test tooling only; the benchmark is not run. AI-assisted-by: claude-opus-5-5
193 lines
5.8 KiB
Clojure
193 lines
5.8 KiB
Clojure
{:deps {:aliases [:dev]}
|
|
:http {:port #shadow/env ["HTTP_PORT" :as :int :default 3448]}
|
|
:nrepl {:port #shadow/env ["NREPL_PORT" :as :int :default 3447] :host "0.0.0.0"}
|
|
:dev-http {#shadow/env ["DEV_PORT" :as :int :default 8888] "classpath:public"}
|
|
:cache-root #shadow/env ["CACHE" :default ".shadow-cljs"]
|
|
|
|
:builds
|
|
{:main
|
|
{:target :esm
|
|
:output-dir "resources/public/js/"
|
|
:asset-path "/js"
|
|
:devtools {:watch-dir "resources/public"
|
|
:reload-strategy :full}
|
|
|
|
:dev {;; allows remote-relay per parallel environment
|
|
;; inside :dev so the integration tests won't use it
|
|
:devtools {:devtools-url #shadow/env ["SHADOW_SERVER_URL" :default ""]}}
|
|
:build-options {:manifest-name "manifest.json"}
|
|
:modules
|
|
{:shared
|
|
{:entries []}
|
|
|
|
:main
|
|
{:entries [app.main app.plugins.api]
|
|
:depends-on #{:shared}
|
|
:exports {init app.main/init}}
|
|
|
|
:util-highlight
|
|
{:entries [app.util.code-highlight]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-auth
|
|
{:entries [app.main.ui.auth
|
|
app.main.ui.auth.verify-token]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-viewer
|
|
{:entries [app.main.ui.viewer]
|
|
:depends-on #{:shared :main-auth}}
|
|
|
|
:main-workspace
|
|
{:entries [app.main.ui.workspace]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-dashboard
|
|
{:entries [app.main.ui.dashboard]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-settings
|
|
{:entries [app.main.ui.settings]
|
|
:depends-on #{:shared}}
|
|
|
|
:render
|
|
{:entries [app.render]
|
|
:depends-on #{:shared}
|
|
:exports {init app.render/init}}
|
|
|
|
:rasterizer
|
|
{:entries [app.rasterizer]
|
|
:depends-on #{:shared}
|
|
:exports {init app.rasterizer/init}}}
|
|
|
|
:js-options
|
|
{:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]
|
|
:js-provider :external
|
|
:external-index "target/index.js"
|
|
:external-index-format :esm}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:closure-defines {goog.DEBUG false
|
|
goog.debug.LOGGING_ENABLED true
|
|
app.config/compiled-version-tag #shadow/env ["VERSION_TAG" :default "develop"]}
|
|
:compiler-options
|
|
{:fn-invoke-direct true
|
|
:optimizations #shadow/env ["PENPOT_BUILD_OPTIMIZATIONS" :as :keyword :default :advanced]
|
|
:source-map true
|
|
:pseudo-names true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off
|
|
:cross-chunk-method-motion false
|
|
:source-map-detail-level :all}}}
|
|
|
|
:worker
|
|
{:target :browser
|
|
:output-dir "resources/public/js/worker/"
|
|
:asset-path "/js/worker"
|
|
:devtools {:watch-dir "resources/public"
|
|
:reload-strategy :full
|
|
:browser-inject :main}
|
|
:dev {;; allows remote-relay per parallel environment
|
|
;; inside :dev so the integration tests won't use it
|
|
:devtools {:devtools-url #shadow/env ["SHADOW_SERVER_URL" :default ""]}}
|
|
:build-options {:manifest-name "manifest.json"}
|
|
:modules
|
|
{:main
|
|
{:entries [app.worker]
|
|
:web-worker true
|
|
:prepend-js "importScripts('./render.js');"
|
|
:depends-on #{}}}
|
|
|
|
:js-options
|
|
{:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:compiler-options
|
|
{:fn-invoke-direct true
|
|
:optimizations #shadow/env ["PENPOT_BUILD_OPTIMIZATIONS" :as :keyword :default :advanced]
|
|
:output-wrapper true
|
|
:rename-prefix-namespace "PENPOT"
|
|
:source-map true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off
|
|
:source-map-detail-level :all}}}
|
|
|
|
;; FIXME: maybe rename to :components ? (there are nothing storybook
|
|
;; related, is just an ESM export of components that will be used
|
|
;; initially on storybook but not limited to storybook)
|
|
:storybook
|
|
{:target :esm
|
|
:output-dir "target/storybook/"
|
|
:devtools {:enabled false
|
|
:console-support false}
|
|
:js-options
|
|
{:js-provider :import
|
|
:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]}
|
|
|
|
:modules
|
|
{:components
|
|
{:exports {default app.main.ui.ds/default
|
|
helpers app.main.ui.ds.helpers/default}
|
|
:prepend-js ";(globalThis.goog.provide = globalThis.goog.constructNamespace_);(globalThis.goog.require = globalThis.goog.module.get);"
|
|
:depends-on #{}}}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es-next
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}}
|
|
|
|
:test
|
|
{:target :esm
|
|
:output-dir "target/tests"
|
|
:runtime :custom
|
|
:js-options {:js-provider :import}
|
|
|
|
|
|
:modules
|
|
{:test {:init-fn frontend-tests.runner/init
|
|
:prepend-js ";if (typeof globalThis.navigator?.userAgent === 'undefined') { globalThis.navigator = {userAgent: ''}; };"}}}
|
|
|
|
:test-wasm
|
|
{:target :esm
|
|
:output-dir "resources/public/js/test-wasm/"
|
|
:asset-path "/js/test-wasm"
|
|
:runtime :browser
|
|
:js-options {:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]
|
|
:js-provider :external
|
|
:external-index "target/test-wasm-index.js"
|
|
:external-index-format :esm}
|
|
:modules {:test-wasm {:init-fn frontend-tests.wasm-replay/init}}
|
|
:compiler-options {:output-feature-set :es2020
|
|
:warnings {:fn-deprecated false}}}
|
|
|
|
:bench
|
|
{:target :node-script
|
|
:output-to "target/bench.js"
|
|
:output-dir "target/bench/"
|
|
:main bench/main
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:compiler-options
|
|
{:fn-invoke-direct true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off}}}}}
|