Skip to content

Commit 501230b

Browse files
committed
enhance(plugin): support development entry for plugins
1 parent 12f65c3 commit 501230b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

libs/src/LSPlugin.core.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,21 +573,22 @@ class PluginLocal extends EventEmitter<
573573
const { repo, version } = this._options
574574
const localRoot = (this._localRoot = this.isWebPlugin ? `${repo || url}/${version}` : safetyPathNormalize(url))
575575
const logseq: Partial<LSPluginPkgConfig> = pkg.logseq || {}
576-
const validateEntry = (main) => main && /\.(js|html)$/.test(main)
576+
// const validateEntry = (main) => main && /\.(js|html)$/.test(main)
577577

578-
// Entry from main
578+
// entry from main
579579
const entry = logseq.entry || logseq.main || pkg.main
580580

581-
if (validateEntry(entry)) {
582-
// Theme has no main
583-
this._options.entry = this._resolveResourceFullUrl(entry, localRoot)
584-
581+
if (logseq.devEntry) {
585582
// development mode entry
586583
this._options.devEntry = logseq.devEntry
584+
this._options.entry = logseq.devEntry
585+
} else {
586+
// theme has no main
587+
this._options.entry = this._resolveResourceFullUrl(entry, localRoot)
588+
}
587589

588-
if (logseq.mode) {
589-
this._options.mode = logseq.mode
590-
}
590+
if (logseq.mode) {
591+
this._options.mode = logseq.mode
591592
}
592593

593594
const title = logseq.title || pkg.title

libs/src/LSPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export interface LSPluginPkgConfig {
7777
/**
7878
* Alternative entrypoint for development.
7979
*/
80-
devEntry: unknown
80+
devEntry: string
8181
/**
8282
* For legacy themes, do not use.
8383
*/

0 commit comments

Comments
 (0)