-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESM script base class #6367
base: main
Are you sure you want to change the base?
ESM script base class #6367
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
What would be the impact to users in terms of migrations or API changes? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, added few small comments.
But I'd suggest some additional approvals before merging.
Please make sure no unwanted functions are exposed in the public API here.
This is amazing! Can we provide a few examples of old-vs-new ways for most common use cases? Also, as there are expected few other systems and improvements for ESM (engine and editor), would it be beneficial to mark this API in a way that devs know it is still in the works? So the community can try and battle test the new ESM system fully, before it is a recommended way for everyone? |
Yep thats right. Both types of scripts can be used interchangeably within the same component.
For now ESM Scripts will be opt-in. You need to manually create a script with the For engine only, |
Co-authored-by: Martin Valigursky <[email protected]>
Co-authored-by: Martin Valigursky <[email protected]>
…6662) Co-authored-by: Martin Valigursky <[email protected]>
Co-authored-by: Martin Valigursky <[email protected]>
* [BREAKING] Remove support for legaxy scripts * removed pc.script.attribute --------- Co-authored-by: Martin Valigursky <[email protected]>
… into esm-script-class
This PR proposes a new
Script
base class for ESM Scripts. Attributes are declared via jsdoc tags as opposed toScript.attributes.add()
.ScriptType
class persists for legacy support. The newScript
base class:ScriptAttribtues
classAPI Changes
New ESM
Script
ClassA new minimal base. Attributes are declared via jsdoc tags. Runtime attributes via
Script.attributes.add()
is removed. Fixes ScriptType does not support class syntax #6316assignRawToValue
- New method that takes a script instance, a schema and value and assigns a new value on the script instance`ScriptRegistry.addSchema
/getSchema
- Stores and fetches an attributes schema from it's associated asset<scriptName, schema>
Files renaming
For consistency, the following files have been renamed
script.js
->script-create.js
- Contains legacypc.createScript()
andpc.registerScript()
script.js
contains newScript
base classscript-type.js
contains legacyScriptType
classTests
npm run test:karma