Skip to content

Conversation

elikoga
Copy link
Contributor

@elikoga elikoga commented May 6, 2025

Closes #1943
Repeat of #1944 with different head branch

Testable by placing "@novnc/novnc": "npm:@elikoga/[email protected]", in package.json

Uses exports in package.json to make sure that old imports still work

This one incorporates the review requests in the previous PR by simply dropping the conversion step using babel.

CI Passes in my repo

@CendioOssman
Copy link
Member

Please don't open a new PR as that means it is more difficult to see all the context. You can just adjust the existing one with your changes.

@elikoga
Copy link
Contributor Author

elikoga commented May 6, 2025

@CendioOssman sadly github does not allow changing the head branch of the PR. Your request is to history-rewrite my original PRs head (master)? I can do that but for me it makes it more difficult to understand the context in the future.

@elikoga
Copy link
Contributor Author

elikoga commented May 7, 2025

image

Yeah I literally can't reopen the other PR or this one.

@samhed samhed reopened this May 12, 2025
@samhed
Copy link
Member

samhed commented May 12, 2025

Continue here then, strange behavior by GitHub..

package.json Outdated
Comment on lines 15 to 26
"exports": {
".": "./core/rfb.js",
"./lib/*": "./core/*.js",
"./lib/*.js": "./core/*.js",
"./core/*": "./core/*.js",
"./core/*.js": "./core/*.js",
"./lib/vendor/*": "./vendor/*.js",
"./lib/vendor/*.js": "./vendor/*.js",
"./vendor/*": "./vendor/*.js",
"./vendor/*.js": "./vendor/*.js",
"./package.json": "./package.json"
},
Copy link
Member

Choose a reason for hiding this comment

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

RFB is our only interface. Do we need anything more than the first line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Those are all unsupported usages of noVNC. I'm not keen on giving any illusion of that being official and stable.

Ideally, we just have:

  "exports": "./core/rfb.js",

Which is the only supported interface at the moment.

The question is what that transition means for people. Given that we are switching from CommonJS to modules, I assume there is some transition work needed anyway? So might be a good idea to do this at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

util/logging.js is clearly also exposed api, otherwise, the provided example vnc.html would not work:

noVNC/vnc.html

Line 53 in 4cb5aa4

import * as Log from './core/util/logging.js';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As are the files under input/key*:

noVNC/app/ui.js

Lines 15 to 17 in 4cb5aa4

import KeyTable from "../core/input/keysym.js";
import keysyms from "../core/input/keysymdef.js";
import Keyboard from "../core/input/keyboard.js";

Copy link
Member

Choose a reason for hiding this comment

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

Exposed is not the same as supported or stable. I.e. you use them at your own risk. We will not consider it a bug if we change them in a way that breaks callers.

For our internal use, that is fine as we can change it at the same time. But external users cannot really do the same safely.

Copy link
Member

Choose a reason for hiding this comment

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

I'm aware this will cause some pain for some users. But that might be the best thing in the long run, as that will force a discussion of what is missing from the official API and needs to be added.

Comment on lines -6 to -10
"directories": {
"lib": "lib",
"doc": "docs",
"test": "tests"
},
Copy link
Member

Choose a reason for hiding this comment

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

Are these not used anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See npm js docs: directories

The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories object. If you look at npm's package.json, you'll see that it has directories for doc, lib, and man.

In the future, this information may be used in other creative ways.

Since this is no longer exported using ComonJS Modules, I am not sure who would use this.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds fair. But let's have a separate commit that explicitly states that these are being removed because they are old and unused.

Can probably put the removal of "browser" in the same commit.

Choose a reason for hiding this comment

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

Hi 👋
Just checking in to see if there are any updates on this thread

@micheldpcarlos
Copy link

Hey! Just wondering if there’s any ETA on when this might get merged. :)
Happy to assist if anything’s needed to move it along. Thanks!

@LeeTeng2001
Copy link

LeeTeng2001 commented Jun 27, 2025

damn nobody use this huh

@CendioOssman
Copy link
Member

@elikoga, is this still on your todo list?

@seandilda
Copy link

damn nobody use this huh

This is still an issue for me. I'm currently having to lock at version 1.5.0 so that I can properly bundle the code.

@jsuchenia
Copy link

jsuchenia commented Jul 9, 2025

damn nobody use this huh

This is still an issue for me. I'm currently having to lock at version 1.5.0 so that I can properly bundle the code.

I think that @elikoga is doing his best to implement a change, you can test his changes from his repo (https://github.com/elikoga/noVNC/tree/switch-to-es-module-publish-and-use-exports) and let here know if that's suitable for you

From a number of projects referencing this broken version (1.6.0 via code builders) - you're not the only one waiting for a fix

@CendioOssman Do you need any help in a validation of a changes here?

@CendioOssman
Copy link
Member

@CendioOssman Do you need any help in a validation of a changes here?

Please do. We don't use the npm version ourselves, so feedback from actual users is very welcome. Including on the proposed adjustments in my reviews.

@jsuchenia
Copy link

@CendioOssman Do you need any help in a validation of a changes here?

Please do. We don't use the npm version ourselves, so feedback from actual users is very welcome. Including on the proposed adjustments in my reviews.

Ok - so I've created a simple project that uses ViteJS and ReactJS (samples in this gist) - and confirmed an issue with 1.6.0 version
Then - I've switched to a branch from this PR - and it's working as expected - no errors and code works fine

So - for web-based apps this change will give a possibility to bundle a code using modern package manages.

What other tests shall I perform?

@GeTOUO
Copy link

GeTOUO commented Jul 30, 2025

这个事项还在推进中吗?是否有一个可供期望的发布时间?目前我也是因为这个问题导致不得不停留在v1.5.0

@elikoga
Copy link
Contributor Author

elikoga commented Jul 30, 2025

这个事项还在推进中吗?是否有一个可供期望的发布时间?目前我也是因为这个问题导致不得不停留在v1.5.0

I am still available to look at it if needed. I do not know when it will be released. Upstream is not directly concerned with keeping npm up to date due to their releasing mechanisms not going through there. 1.5.0 is still completely fine, unless you need one of the newer features.

@GeTOUO
Copy link

GeTOUO commented Jul 30, 2025

这个事项还在推进中吗?是否有一个可供期望的发布时间?目前我也是因为这个问题导致不得不停留在v1.5.0

如果需要,我仍然可以查看它。我不知道什么时候会发布。上游并不直接关注保持 npm 的最新状态,因为它们的发布机制没有通过那里。1.5.0 仍然完全没问题,除非您需要更新的功能之一。

好的,我可以继续使用1.5.0,但还是非常期待这个合并能帮助我升级到1.6.0以上。感谢。

@jsuchenia
Copy link

@CendioOssman What shall we do to merge that mr? It's been few months to merge so simple (and organisational) change?

@CendioOssman CendioOssman force-pushed the switch-to-es-module-publish-and-use-exports branch from a940f34 to fe29dc6 Compare September 15, 2025 13:43
@CendioOssman CendioOssman merged commit 44b7489 into novnc:master Sep 15, 2025
11 checks passed
@CendioOssman
Copy link
Member

I made the last discussed adjustments and merged this. It will momentarily be available from NPM under the "dev" tag. Please have a look and see how it works.

@torchsec-roni
Copy link

Is there another semver release planned soon?

@CendioOssman
Copy link
Member

That's the idea. Hopefully a beta soon.

@ianb-mp
Copy link

ianb-mp commented Sep 18, 2025

I've tested 1.6.0-g44b7489 - lgtm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

noVNC cannot be bundled due to top-level await in browser.js
10 participants