JerryI / wolfram-js-frontend

Dynamic Notebook Environment for Wolfram Language written in Javascript
https://jerryi.github.io/wljs-docs/
GNU General Public License v3.0
313 stars 15 forks source link

Compressed expression in start.wls #235

Closed soegaard closed 4 months ago

soegaard commented 4 months ago

The following expression is in the top of start.wls.

Why is the expression is compressed? What does it uncompress to?

Uncompress["1:eJx1T8tuwjAQDBT1wo0/6Ac0vveKKAoNCJoDZ5NugsXGtrwbBf6edawKLlzG+5rxzMfJ/TZvWZbRVKBomkms5wLfBmF1NcR0qN6lL/fbfMC0j4Q18
PM80mkmcDR8TlexK0Ug7SKnAh5f9F0aRoGi8y5wVUp5Zvb0pVTQQ96KTn/qCULtLIPlvHad2kAIt0IN+Imu1uh1fdEtkOq0seoHggVUydForuJgbJsCLgSWTj7r7d/q6gMQGWfT
Lt7KLPp4ZPq3+qz0Iv6Yddcj3gGoDVPG"]
JerryI commented 4 months ago

This is a package manager script. A long time ago I was looking for an issue with text encoding and decided to compress it to base64.

it just downloads LPM package manager to the root directory of WLJS

JerryI commented 4 months ago

HoldComplete[If[FileExistsQ["LPM.wl"], Get["LPM.wl"], With[{lpm = Import["https://raw.githubusercontent.com/JerryI/wl-localpackages/main/Kernel/LPM.wl", "String"]}, Export["LPM.wl", lpm, "String"]; Get["LPM.wl"]; ]]]

soegaard commented 4 months ago

I finally figured out the trick:

Uncompress[the-string, Hold]

I think, it better to avoid using Compress in the script if possible. It just looks sketchy.

JerryI commented 4 months ago

Sure. Will be fixed in a new release

JerryI commented 4 months ago

Fixed in Canary branch soon will be merged...