mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
Revert "Revert "handle magic-portal""
This reverts commit 9011fa7f9e54ae8a3b587da6d61affa31e3cd727.
This commit is contained in:
committed by
Tienson Qin
parent
a19c5feb85
commit
deb0a43e8b
@@ -3,6 +3,7 @@ const utils = require('util')
|
||||
const cp = require('child_process')
|
||||
const exec = utils.promisify(cp.exec)
|
||||
const path = require('path')
|
||||
const rename = require('gulp-rename')
|
||||
const gulp = require('gulp')
|
||||
const cleanCSS = require('gulp-clean-css')
|
||||
const del = require('del')
|
||||
@@ -65,6 +66,9 @@ const common = {
|
||||
'node_modules/@highlightjs/cdn-assets/highlight.min.js',
|
||||
'node_modules/@isomorphic-git/lightning-fs/dist/lightning-fs.min.js'
|
||||
]).pipe(gulp.dest(path.join(outputPath, 'js'))),
|
||||
() => gulp.src([
|
||||
'node_modules/magic-portal/dist/index.umd.js',
|
||||
]).pipe(rename('magic_portal.js')).pipe(gulp.dest(path.join(outputPath, 'js'))),
|
||||
() => gulp.src([
|
||||
'node_modules/@tabler/icons/iconfont/tabler-icons.min.css',
|
||||
'node_modules/inter-ui/inter.css',
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"del": "^6.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-clean-css": "^4.3.0",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"ip": "1.1.8",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"playwright": "=1.31.0",
|
||||
@@ -122,6 +123,7 @@
|
||||
"interactjs": "^1.10.17",
|
||||
"jszip": "3.8.0",
|
||||
"katex": "^0.16.7",
|
||||
"magic-portal": "^1.0.0",
|
||||
"marked": "^5.1.2",
|
||||
"mldoc": "1.5.7",
|
||||
"path": "0.12.7",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.MagicPortal=t()}(this,function(){var e=function(e){var t=this;this.rpc_counter=0,this.channel=e,this.foreign=new Map,this.local=new Map,this.calls=new Map,this.queue=[],this.connectionEstablished=!1,this.channel.addEventListener("message",function(e){var n=e.data;if(n&&"object"==typeof n)switch(n.type){case"MP_INIT":return t.onInit(n);case"MP_SET":return t.onSet(n);case"MP_CALL":return t.onCall(n);case"MP_RETURN":return t.onReturn(n)}}),this.channel.postMessage({type:"MP_INIT",id:1,reply:!0})};e.prototype.onInit=function(e){this.connectionEstablished=!0;var t=this.queue;this.queue=[];for(var n=0,o=t;n<o.length;n+=1){this.channel.postMessage(o[n])}e.reply&&this.channel.postMessage({type:"MP_INIT",reply:!1})},e.prototype.onSet=function(e){for(var t=this,n={},o=e.object,i=function(){var i=r[s],c=!e.void.includes(i);n[i]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return t.rpc_counter=(t.rpc_counter+1)%Number.MAX_SAFE_INTEGER,new Promise(function(n,s){t.postMessage({type:"MP_CALL",object:o,method:i,id:t.rpc_counter,args:e,reply:c}),c?t.calls.set(t.rpc_counter,{resolve:n,reject:s}):n()})}},s=0,r=e.methods;s<r.length;s+=1)i();var c=this.foreign.get(e.object);this.foreign.set(e.object,n),"function"==typeof c&&c(n)},e.prototype.onCall=function(e){var t=this,n=this.local.get(e.object);n&&n[e.method].apply(n,e.args).then(function(n){return e.reply&&t.channel.postMessage({type:"MP_RETURN",id:e.id,result:n})}).catch(function(n){return t.channel.postMessage({type:"MP_RETURN",id:e.id,error:n.message})})},e.prototype.onReturn=function(e){if(this.calls.has(e.id)){var t=this.calls.get(e.id),n=t.resolve,o=t.reject;this.calls.delete(e.id),e.error?o(e.error):n(e.result)}},e.prototype.postMessage=function(e){this.connectionEstablished?this.channel.postMessage(e):this.queue.push(e)},e.prototype.set=function(e,t,n){void 0===n&&(n={}),this.local.set(e,t);var o=Object.entries(t).filter(function(e){return"function"==typeof e[1]}).map(function(e){return e[0]});this.postMessage({type:"MP_SET",object:e,methods:o,void:n.void||[]})},e.prototype.get=function(e){return new Promise(function(t,n){var o=this;return this.foreign.has(e)?t(this.foreign.get(e)):t(new Promise(function(t,n){return o.foreign.set(e,t)}))}.bind(this))};return function(t){var n=new e(t);Object.defineProperties(this,{get:{writable:!1,configurable:!1,value:n.get.bind(n)},set:{writable:!1,configurable:!1,value:n.set.bind(n)}})}});
|
||||
10
yarn.lock
10
yarn.lock
@@ -3492,6 +3492,11 @@ gulp-cli@^2.2.0:
|
||||
v8flags "^3.2.0"
|
||||
yargs "^7.1.0"
|
||||
|
||||
gulp-rename@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.npmjs.org/gulp-rename/-/gulp-rename-2.0.0.tgz#9bbc3962b0c0f52fc67cd5eaff6c223ec5b9cf6c"
|
||||
integrity sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==
|
||||
|
||||
gulp@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/gulp/-/gulp-4.0.2.tgz#543651070fd0f6ab0a0650c6a3e6ff5a7cb09caa"
|
||||
@@ -4502,6 +4507,11 @@ lru-cache@^6.0.0:
|
||||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
magic-portal@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/magic-portal/-/magic-portal-1.0.0.tgz#b7c07e6675e11428b42649807430b2628b214bd1"
|
||||
integrity sha512-RRFQ9N1LQFETObTOmDoQeyAfsUUnSW59LqVpJjFxyCYE7vHb7EkYsw9PImvcI6ZdGzYs46Yc1r47n6RptYliUw==
|
||||
|
||||
make-iterator@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6"
|
||||
|
||||
Reference in New Issue
Block a user