mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
🔥 Remove graaljs and commons-pool.
This commit is contained in:
parent
ecff4c5dce
commit
50aef6ab65
4 changed files with 2 additions and 134 deletions
|
@ -19,8 +19,6 @@
|
|||
org.slf4j/slf4j-api {:mvn/version "1.7.30"}
|
||||
org.zeromq/jeromq {:mvn/version "0.5.2"}
|
||||
|
||||
|
||||
org.graalvm.js/js {:mvn/version "21.0.0.2"}
|
||||
com.taoensso/nippy {:mvn/version "3.1.1"}
|
||||
com.github.luben/zstd-jni {:mvn/version "1.4.9-1"}
|
||||
|
||||
|
@ -66,7 +64,6 @@
|
|||
org.im4java/im4java {:mvn/version "1.4.0"}
|
||||
org.lz4/lz4-java {:mvn/version "1.7.1"}
|
||||
commons-io/commons-io {:mvn/version "2.8.0"}
|
||||
org.apache.commons/commons-pool2 {:mvn/version "2.9.0"}
|
||||
com.sun.mail/jakarta.mail {:mvn/version "2.0.0"}
|
||||
|
||||
org.clojars.pntblnk/clj-ldap {:mvn/version "0.0.17"}
|
||||
|
|
|
@ -5,20 +5,16 @@
|
|||
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
;; defined by the Mozilla Public License, v. 2.0.
|
||||
;;
|
||||
;; Copyright (c) 2020 UXBOX Labs SL
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.svgparse
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.metrics :as mtx]
|
||||
[app.util.graal :as graal]
|
||||
[app.util.pool :as pool]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.xml :as xml]
|
||||
[integrant.core :as ig])
|
||||
(:import
|
||||
java.util.function.Consumer
|
||||
org.apache.commons.io.IOUtils))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -41,7 +37,7 @@
|
|||
(mtx/instrument handler))))
|
||||
|
||||
(defn- handler
|
||||
[cfg {:keys [headers body] :as request}]
|
||||
[_ {:keys [headers body] :as request}]
|
||||
(when (not= "image/svg+xml" (get headers "content-type"))
|
||||
(ex/raise :type :validation
|
||||
:code :unsupported-mime-type
|
||||
|
|
|
@ -1,60 +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/.
|
||||
;;
|
||||
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
;; defined by the Mozilla Public License, v. 2.0.
|
||||
;;
|
||||
;; Copyright (c) 2021 UXBOX Labs SL
|
||||
|
||||
(ns app.util.graal
|
||||
"Graal Polyglot integration layer."
|
||||
(:import
|
||||
org.graalvm.polyglot.Context
|
||||
org.graalvm.polyglot.Source
|
||||
org.graalvm.polyglot.Value))
|
||||
|
||||
(defn ^Source source
|
||||
[lang content]
|
||||
(if (string? content)
|
||||
(Source/create ^String lang ^String content)
|
||||
(.. (Source/newBuilder lang content)
|
||||
(build))))
|
||||
|
||||
(defn ^Context context
|
||||
[lang]
|
||||
(.. (Context/newBuilder (into-array String [lang]))
|
||||
(allowAllAccess true)
|
||||
(allowIO true)
|
||||
(build)))
|
||||
|
||||
(defn ^Value eval!
|
||||
[ctx source]
|
||||
(.eval ^Context ctx ^Source source))
|
||||
|
||||
(defn ^Value get-bindings
|
||||
[ctx lang]
|
||||
(.getBindings ^Context ctx ^String lang))
|
||||
|
||||
(defn ^Value get-member
|
||||
[vobj name]
|
||||
(.getMember ^Value vobj ^String name))
|
||||
|
||||
(defn ^Value invoke
|
||||
[vobj & params]
|
||||
(.execute ^Value vobj (into-array Object params)))
|
||||
|
||||
(defn ^Value invoke-member
|
||||
[vobj name & params]
|
||||
(let [params (into-array Object params)]
|
||||
(.invokeMember ^Value vobj ^String name params)))
|
||||
|
||||
(defn ^Value set-member!
|
||||
[vobj name obj]
|
||||
(.putMember ^Value vobj ^String name ^Object obj)
|
||||
vobj)
|
||||
|
||||
(defn close!
|
||||
[ctx]
|
||||
(when ctx
|
||||
(.close ^Context ctx)))
|
|
@ -1,65 +0,0 @@
|
|||
(ns app.util.pool
|
||||
(:import
|
||||
java.lang.AutoCloseable
|
||||
org.apache.commons.pool2.PooledObject
|
||||
org.apache.commons.pool2.PooledObjectFactory
|
||||
org.apache.commons.pool2.impl.GenericObjectPool
|
||||
org.apache.commons.pool2.impl.DefaultPooledObject
|
||||
org.apache.commons.pool2.impl.BaseGenericObjectPool))
|
||||
|
||||
(def noop (constantly true))
|
||||
|
||||
(deftype CloseableWrapper [obj pool]
|
||||
clojure.lang.IDeref
|
||||
(deref [_] obj)
|
||||
|
||||
AutoCloseable
|
||||
(close [_]
|
||||
(.returnObject ^GenericObjectPool pool obj)))
|
||||
|
||||
(defn create
|
||||
[{:keys [create destroy validate activate passivate max-idle max-total min-idle]
|
||||
:or {destroy noop
|
||||
validate noop
|
||||
activate noop
|
||||
passivate noop
|
||||
max-idle 10
|
||||
max-total 10
|
||||
min-idle 0}}]
|
||||
(let [object-factory
|
||||
(proxy [PooledObjectFactory] []
|
||||
(makeObject [] (DefaultPooledObject. (create)))
|
||||
(destroyObject [^PooledObject o] (destroy (.getObject o)))
|
||||
(validateObject [^PooledObject o] (validate (.getObject o)))
|
||||
(activateObject [^PooledObject o] (activate (.getObject o)))
|
||||
(passivateObject [^PooledObject o] (passivate (.getObject o))))
|
||||
|
||||
config
|
||||
(doto (org.apache.commons.pool2.impl.GenericObjectPoolConfig.)
|
||||
(.setMaxTotal max-total)
|
||||
(.setMaxIdle max-idle)
|
||||
(.setMinIdle min-idle)
|
||||
(.setBlockWhenExhausted true))]
|
||||
(GenericObjectPool. object-factory config)))
|
||||
|
||||
(defn borrow
|
||||
[^GenericObjectPool pool]
|
||||
(.borrowObject pool))
|
||||
|
||||
(defn return
|
||||
[^GenericObjectPool pool object]
|
||||
(.returnObject pool object))
|
||||
|
||||
(defn acquire
|
||||
[pool]
|
||||
(let [obj (borrow pool)]
|
||||
(CloseableWrapper. obj pool)))
|
||||
|
||||
(defn clear!
|
||||
"Clear idle objects in pool."
|
||||
[pool]
|
||||
(.clear ^GenericObjectPool pool))
|
||||
|
||||
(defn close!
|
||||
[^BaseGenericObjectPool pool]
|
||||
(.close pool))
|
Loading…
Reference in a new issue