WickPM - #197
Conversation
…e terminal up with annoying deprecation warnings
…equire('classnames')
…stick into vite-migrate
…com/hobbsythe6th/Candlestick into engine-package.json-update-betterer
…stick into vite-migrate
…y exists todo: make uninstall() exist
|
I don't like the way WickPM works. Firstly, the name WickPM is misleading, it doesn't load scripts or objects made for Wick Editor. Secondly, I'm pretty sure you can just do |
|
No, you can't, you get main.381ffc55.js:2 Error: Unexpected token on line 1 in script "default". |
|
I think it's better to do this as a |
|
But then we'd have a MASSIVE boost in file size if we downloaded a lot of NPM packages like the old Wick Engine. My opinion is that script assets are definitely useful, but this would cut down on size if the majority of script assets are from NPM since we only really store the package names. |
My idea for script assets isn't to import them with the engine, but instead to provide an easy and simple way to run and execute JS code. I could even say it's better to make the actual 'running scripts' part another dedicated |
|
Even so, I still think this is a good feature. Our current code editor doesn't have |
Fetch is an async function to do HTTP requests. fetch('example.com').then(res => {
if(!res.ok) throw new Error('error'); // error handling should be done properly
}).then(async (res) => {
const txt = await res.text();
document.body.innerHTML = txt;
}) |
Another opinion, why should we allow importing libraries? Almost no wick games actually do this, we're just wasting time to simplify things for the 0.0001% of users who use script injection to get |
|
After looking more into this feature, I believe it should be implemented as a |
|
I'd say a require() would basically be the same thing as this. WickPM's usage would be (I think) like basically every package that you want to install you can put into frame 1's default script and then reuse, whereas I think the only way to share require()d packages between scripts is to require() them in each one, which slows down installation. |
WickPM is a package importer class that generates a script tag on the DOM to use to artificially construct esm.sh import statements, which are then attached to WickPM.imports . This PR has attached WickPM, WickPM.imports, and WickPM' s install/uninstall functions to the global API. It's also branched off the Rolldown migration branch of my fork (sorry), but the changed files from that are:
GlobalAPI.js,
WickPM.js,
Wick.mjs (some tiny import updates),
Editor.jsx,
and Project.js .
Read the diff here