diff --git a/exporter/deps.edn b/exporter/deps.edn index 6f93671f2a..2d74f0efa7 100644 --- a/exporter/deps.edn +++ b/exporter/deps.edn @@ -14,7 +14,7 @@ :dev {:extra-deps - {thheller/shadow-cljs {:mvn/version "3.1.5"}}} + {thheller/shadow-cljs {:mvn/version "3.2.1"}}} :shadow-cljs {:main-opts ["-m" "shadow.cljs.devtools.cli"] diff --git a/exporter/package.json b/exporter/package.json index ab394fe62d..5db4dc52c8 100644 --- a/exporter/package.json +++ b/exporter/package.json @@ -9,13 +9,14 @@ "type": "git", "url": "https://github.com/penpot/penpot" }, + "type": "module", "dependencies": { "archiver": "^7.0.1", "cookies": "^0.9.1", + "date-fns": "^4.1.0", "generic-pool": "^3.9.0", "inflation": "^2.1.0", "ioredis": "^5.6.1", - "luxon": "^3.6.1", "playwright": "^1.53.0", "raw-body": "^3.0.0", "svgo": "penpot/svgo#v3.1", diff --git a/exporter/scripts/build b/exporter/scripts/build index 4bd911fc00..26763973e2 100755 --- a/exporter/scripts/build +++ b/exporter/scripts/build @@ -13,9 +13,6 @@ rm -rf target # Build the application clojure -M:dev:shadow-cljs release main; -# Remove source -rm -rf target/app; - # Copy package*.json files cp ../.yarnrc.yml target/; cp yarn.lock target/; diff --git a/exporter/shadow-cljs.edn b/exporter/shadow-cljs.edn index 9107cbcb7a..ae963cf311 100644 --- a/exporter/shadow-cljs.edn +++ b/exporter/shadow-cljs.edn @@ -3,13 +3,22 @@ :builds {:main - {:target :node-script - :main app.core/main - :output-to "target/app.js" - :output-dir "target/app/" + {:target :esm + :runtime :node + :output-dir "target/" :devtools {:before-load-async app.core/stop :after-load app.core/start} + :modules + {:app + {:entries [] + :init-fn app.core/main}} + + :js-options + {:entry-keys ["module" "browser" "main"] + :export-conditions ["module" "import", "browser" "require" "default"] + :js-provider :import} + :compiler-options {:output-feature-set :es2020 :output-wrapper false} diff --git a/exporter/src/app/browser.cljs b/exporter/src/app/browser.cljs index 46330ced58..816fb1c954 100644 --- a/exporter/src/app/browser.cljs +++ b/exporter/src/app/browser.cljs @@ -7,7 +7,7 @@ (ns app.browser (:require ["generic-pool" :as gp] - ["generic-pool/lib/errors" :as gpe] + ["generic-pool/lib/errors.js" :as gpe] ["playwright" :as pw] [app.common.exceptions :as ex] [app.common.logging :as l] diff --git a/exporter/src/app/core.cljs b/exporter/src/app/core.cljs index 6d30b9220d..dae498f5d3 100644 --- a/exporter/src/app/core.cljs +++ b/exporter/src/app/core.cljs @@ -6,7 +6,7 @@ (ns app.core (:require - ["process" :as proc] + ["node:process" :as proc] [app.browser :as bwr] [app.common.logging :as l] [app.config :as cf] @@ -41,9 +41,9 @@ (http/stop) (done))) -(proc/on "uncaughtException" - (fn [cause] - (js/console.error cause))) +(.on proc/default "uncaughtException" + (fn [cause] + (js/console.error cause))) -(proc/on "SIGTERM" (fn [] (proc/exit 0))) -(proc/on "SIGINT" (fn [] (proc/exit 0))) +(.on proc/default "SIGTERM" (fn [] (proc/exit 0))) +(.on proc/default "SIGINT" (fn [] (proc/exit 0))) diff --git a/exporter/src/app/http.cljs b/exporter/src/app/http.cljs index acfb6e909d..0024ce8b86 100644 --- a/exporter/src/app/http.cljs +++ b/exporter/src/app/http.cljs @@ -6,11 +6,11 @@ (ns app.http (:require - ["cookies" :as Cookies] - ["http" :as http] - ["inflation" :as inflate] - ["raw-body" :as raw-body] - ["stream" :as stream] + ["cookies$default" :as Cookies] + ["inflation$default" :as inflate] + ["node:http" :as http] + ["node:stream$default" :as stream] + ["raw-body$default" :as raw-body] [app.common.logging :as l] [app.common.transit :as t] [app.config :as cf] @@ -169,6 +169,7 @@ (wrap-error handlers/on-error)) server (create-server handler) port (cf/get :http-server-port 6061)] + (.listen server port) (l/info :hint "welcome to penpot" :module "exporter" diff --git a/exporter/src/app/redis.cljs b/exporter/src/app/redis.cljs index b04ccd0dee..0cc38ba3a9 100644 --- a/exporter/src/app/redis.cljs +++ b/exporter/src/app/redis.cljs @@ -18,7 +18,7 @@ (defn- create-client [uri] - (let [^js client (new redis uri)] + (let [^js client (new redis/default uri)] (.on client "connect" (fn [] (l/info :hint "redis connection established" :uri uri))) (.on client "error" diff --git a/exporter/yarn.lock b/exporter/yarn.lock index ab798ac2f5..cb28ada3ae 100644 --- a/exporter/yarn.lock +++ b/exporter/yarn.lock @@ -411,6 +411,13 @@ __metadata: languageName: node linkType: hard +"date-fns@npm:^4.1.0": + version: 4.1.0 + resolution: "date-fns@npm:4.1.0" + checksum: 10c0/b79ff32830e6b7faa009590af6ae0fb8c3fd9ffad46d930548fbb5acf473773b4712ae887e156ba91a7b3dc30591ce0f517d69fd83bd9c38650fdc03b4e0bac8 + languageName: node + linkType: hard + "debug@npm:4, debug@npm:^4.3.4": version: 4.4.1 resolution: "debug@npm:4.4.1" @@ -553,10 +560,10 @@ __metadata: dependencies: archiver: "npm:^7.0.1" cookies: "npm:^0.9.1" + date-fns: "npm:^4.1.0" generic-pool: "npm:^3.9.0" inflation: "npm:^2.1.0" ioredis: "npm:^5.6.1" - luxon: "npm:^3.6.1" playwright: "npm:^1.53.0" raw-body: "npm:^3.0.0" source-map-support: "npm:^0.5.21" @@ -859,13 +866,6 @@ __metadata: languageName: node linkType: hard -"luxon@npm:^3.6.1": - version: 3.6.1 - resolution: "luxon@npm:3.6.1" - checksum: 10c0/906d57a9dc4d1de9383f2e9223e378c298607c1b4d17b6657b836a3cd120feb1c1de3b5d06d846a3417e1ca764de8476e8c23b3cd4083b5cdb870adcb06a99d5 - languageName: node - linkType: hard - "make-fetch-happen@npm:^14.0.3": version: 14.0.3 resolution: "make-fetch-happen@npm:14.0.3"