mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 15:09:41 +00:00
fix app startup & render error
This commit is contained in:
23
deps/shui/src/logseq/shui/util.cljs
vendored
23
deps/shui/src/logseq/shui/util.cljs
vendored
@@ -42,14 +42,25 @@
|
||||
(defn $LSUtils [] (aget js/window "LSUtils"))
|
||||
(def dev? (some-> ($LSUtils) (aget "isDev")))
|
||||
|
||||
(defn- callable-export
|
||||
[module]
|
||||
(or (when (fn? module)
|
||||
module)
|
||||
(when-let [default (some-> module (gobj/get "default"))]
|
||||
(when (fn? default)
|
||||
default))
|
||||
(when-let [module-exports (some-> module (gobj/get "module.exports"))]
|
||||
(when (fn? module-exports)
|
||||
module-exports))))
|
||||
|
||||
(defn uuid-color
|
||||
[uuid-str]
|
||||
(some-> ($LSUtils) (aget "uniqolor")
|
||||
(apply [uuid-str
|
||||
#js {:saturation #js [55, 70],
|
||||
:lightness 70,
|
||||
:differencePoint 60}])
|
||||
(aget "color")))
|
||||
(when-let [uniqolor (some-> ($LSUtils) (aget "uniqolor") callable-export)]
|
||||
(some-> (uniqolor uuid-str
|
||||
#js {:saturation #js [55, 70],
|
||||
:lightness 70,
|
||||
:differencePoint 60})
|
||||
(aget "color"))))
|
||||
|
||||
(defn get-path
|
||||
"Returns the component path."
|
||||
|
||||
@@ -47,5 +47,11 @@
|
||||
},
|
||||
"resolutions": {
|
||||
"node-abi": "4.28.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"electron",
|
||||
"keytar"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,19 @@ const staticCleanKeep = new Set([
|
||||
])
|
||||
|
||||
function run(command, args, options = {}) {
|
||||
const env = { ...process.env }
|
||||
|
||||
for (const [key, value] of Object.entries(options.env ?? {})) {
|
||||
if (value == null) {
|
||||
delete env[key]
|
||||
} else {
|
||||
env[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
execFileSync(command, args, {
|
||||
cwd: options.cwd ?? rootDir,
|
||||
env: { ...process.env, ...(options.env ?? {}) },
|
||||
env,
|
||||
shell: process.platform === 'win32',
|
||||
stdio: 'inherit',
|
||||
})
|
||||
@@ -56,7 +66,10 @@ function ensureStaticNodeModules() {
|
||||
|
||||
function electron() {
|
||||
ensureStaticNodeModules()
|
||||
run('pnpm', ['electron:dev'], { cwd: staticDir })
|
||||
run('pnpm', ['electron:dev'], {
|
||||
cwd: staticDir,
|
||||
env: { ELECTRON_RUN_AS_NODE: null },
|
||||
})
|
||||
}
|
||||
|
||||
function versionFromSource() {
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
(defn default-export
|
||||
"Returns the callable/default value from ESM, CommonJS interop, or namespace-shaped modules."
|
||||
[module]
|
||||
(or (when (some? module)
|
||||
(or (when (fn? module)
|
||||
module)
|
||||
(when (some? module)
|
||||
(gobj/get module "default"))
|
||||
(when (some? module)
|
||||
(gobj/get module "module.exports"))
|
||||
|
||||
Reference in New Issue
Block a user