Skip to content
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

[jsscripting] Add an alternative MIME type/alias #13851

Merged
merged 3 commits into from
Dec 5, 2022

Conversation

florian-h05
Copy link
Contributor

@florian-h05 florian-h05 commented Dec 5, 2022

See openhab/openhab-core#2883 (comment) for discussion.

The new MIME types (especially the graaljs alias) are introduced to enhance working with JS Scripting in the SCRIPT transformation profile (openhab/openhab-core#2883, docs openhab/openhab-docs#1940).

Furthermore, this catches a potential NPE (it occured sometimes during testing due to reloading bundles I think) which I never experienced in production.
Also, I fiexed the syntax problems in the bndtools file.

I will provide the JS Scripting add-on docs for usage of the SCRIPT transformation soon, they will come with the openhab-js version bump to the add-on (for the docs, see openhab/openhab-js#190).

@J-N-K FYI
@wborn FYI, can you review and merge?

And can one of you both please have a look at my changes to bnd.bnd to verify that they are fine.

The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

Signed-off-by: Florian Hotze <[email protected]>
In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
@florian-h05 florian-h05 requested review from J-N-K and wborn December 5, 2022 16:14
@florian-h05 florian-h05 added the enhancement An enhancement or new feature for an existing add-on label Dec 5, 2022
Copy link
Member

@J-N-K J-N-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

florian-h05 added a commit to florian-h05/openhab-js that referenced this pull request Dec 5, 2022
Reference openhab/openhab-core#2883.

The "graaljs" MIME type is introduced in openhab/openhab-addons#13851.

Please note that the transformation docs link might not work now, as the doc updates aren't published yet.

Signed-off-by: Florian Hotze <[email protected]>
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@wborn wborn merged commit 54b2772 into openhab:main Dec 5, 2022
@wborn wborn added this to the 3.4 milestone Dec 5, 2022
@florian-h05 florian-h05 deleted the jsscripting-alias branch December 5, 2022 17:47
florian-h05 added a commit to openhab/openhab-js that referenced this pull request Dec 5, 2022
* README: Add `SCRIPT` transformation
Reference openhab/openhab-core#2883.
The "graaljs" MIME type is introduced in openhab/openhab-addons#13851.
Please note that the transformation docs link might not work now, as the doc updates aren't published yet.

* README: Use var instead of const and let in examples
Usage of const and let lead to problems in UI scripts and therefore the
examples should not use them.

Signed-off-by: Florian Hotze <[email protected]>
morph166955 pushed a commit to morph166955/openhab-addons that referenced this pull request Dec 18, 2022
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Ben Rosenblum <[email protected]>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Dec 24, 2022
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Andras Uhrin <[email protected]>
borazslo pushed a commit to borazslo/openhab-mideaac-addon that referenced this pull request Jan 8, 2023
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Jan 6, 2024
The alternative MIME type text/javascript is also used by Nashorn, therefore we add the same extension as for the main MIME type.
The alias is introduced to simplify the usage in SCRIPT transformation profiles.

* Fix syntax problems in the bndtools file
* Add null check to avoid potential NPE
  In some cases during testing, a NPE occured, this should solve it.

Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Andras Uhrin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants