battleaxedotco / bombino-brutalism-router

Vue router bombino template for Battleaxe's brutalism design library
https://brutalism.netlify.app/#/router
MIT License
5 stars 1 forks source link

Error rendering in Adobe context #1

Closed rbuikman closed 4 years ago

rbuikman commented 4 years ago

Dear Bombino developers,

I've started a fresh new plugin created with Bombino (VUE). In the browser it shows fine (commented the configureWebpack target/node lines in vue.config.js).

After restoring the configureWebpack config, and run the code from Visual Studio Code: When this panel is opened in InDesign (CEP 9), the panel stays black and there is a message in de CEPHtmlEngine9-IDSN-15.0.3-com.hello-world.panel-renderer.log showing:

undefined:1

SyntaxError: Unexpected end of JSON input at JSON.parse () at eval (webpack-internal:///./node_modules/cep-spy/index.js:192:17) at Module../node_modules/cep-spy/index.js (http://localhost:8080/js/chunk-vendors.js:47:1) at webpack_require (http://localhost:8080/js/app.js:854:30) at fn (http://localhost:8080/js/app.js:151:20) at eval (webpack-internal:///./node_modules/cluecumber/index.js:18:24) at Module../node_modules/cluecumber/index.js (http://localhost:8080/js/chunk-vendors.js:59:1) at webpack_require (http://localhost:8080/js/app.js:854:30) at fn (http://localhost:8080/js/app.js:151:20) at eval (webpack-internal:///./node_modules/vuetify-loader/lib/loader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/HelloWorld.vue?vue&type=script&lang=js&:2:68)

Do you know what is wrong here?

Kind regards,

Rene

Inventsable commented 4 years ago

Hey there,

Just to confirm, did you restart your localhost between commenting/uncommenting the vue.config.js options? As in canceling your current session then re-running the npm run serve command?

Unfortunately vue.config.js does not have hot reloading and is only read during the cold start of the command, so this may be the issue though I'd wonder why it's pointing at cep-spy in particular. I can test this in the morning for InDesign in particular.

rbuikman commented 4 years ago

Yes, I noticed this behaviour and did restart (a lot ;-))

rbuikman commented 4 years ago

Please note, this happens with MacOS Catalina 10.15.5 and Adobe CC 2019 / 2020.

rbuikman commented 4 years ago

fyi: it works on Windows 10, InDesign 15.0.3!

rbuikman commented 4 years ago

OK, the problem for MacOS is in the cep-spy/index.js.

Everywhere you use window.cep.fs.readFile, and replaced the 'file:/' part, the Mac path is broken. It requires a starting '/'.

So to make it work on both Windows and Mac, I've added (navigator.platform.indexOf("Mac") > -1) ? "/" : "" + on every line that does a ReadFile with the extension folder.

FE: author: JSON.parse( window.cep.fs.readFile(((navigator.platform.indexOf("Mac") > -1) ? "/" : "") + ${decodeURI(window.__adobe_cep__.getSystemPath("extension")).replace( /file\:\/{1,}/, "" )}/package.json ).data ).author,

Perhaps better to have a function returning the extension systempath. And off course there are also other properties containing a path that need a fix.

Inventsable commented 4 years ago

Hello and sorry for the late reply, I had another user reporting the same thing a few days earlier and I believe this is the same issue:

https://github.com/Inventsable/CEP-Spy/issues/1

I've just made a push to the repo and republished, can you verify with an npm i cep-spy@1.1.3 command on one of the templates?

rbuikman commented 4 years ago

No problem. Indeed same issue. I noticed there is a separate cep-spy in the node_modules of the brutalism module ( referenced in cluecumber ). Do you need to update those too?

rbuikman commented 4 years ago

And on line 377 of the cep-spy index, think you want to define the realSpy before exporting... const realSpy = window.__adobe_cep__ ? spy : fakeSpy;

Inventsable commented 4 years ago

Nice catch! That last part was definitely a typo on my end. I could update these and will once we've guaranteed a solution. Would you mind copying the index.js of 1.1.4, then pasting it inside this cluecumber/node_modules/cep-spy/index.js file?

I'm a bit hesitant to push this latest commit to these other dependencies without knowing, otherwise may risk breaking more (especially with sloppy typos).

Inventsable commented 4 years ago

Just pushed a new commit to fix that typo and republished, btw.

Inventsable commented 4 years ago

In terms of inner dependencies, these all rely on cep-spy:

The latter two are dependencies within brutalism itself as well. I may go ahead and republish these with the latest commit, should update all with an npm install command afterward

rbuikman commented 4 years ago

Thanx, for some reason, the window.cep.fs.readFile function does not like the escaping of the spaces when it is returned from the getRealString function. If you leave out the .replace(/\s/g, "\ ") part it works on the Mac (also with spaces in the path).

Inventsable commented 4 years ago

Hmmm, okay. Can we move this discussion over to the CEP-Spy repo here?

https://github.com/Inventsable/CEP-Spy/issues/1

You two seem to have the same issue, but are reporting different results. There might be a difference of OS versions or use cases, want to find a single solution that works for every one. I'll close this and quote you there if you don't mind, that way we can all tackle it together.