jschardet icon indicating copy to clipboard operation
jschardet copied to clipboard

Update to `[email protected]`

Open bpasero opened this issue 1 year ago • 1 comments

fix https://github.com/aadsm/jschardet/issues/97

👋 We (VS Code) are in the process of moving to ESM (https://github.com/microsoft/vscode/pull/166033) and are running into an issue when loading jschardet.min.js into our node.js environment. The error was no longer reproducible when moving to a newer version of google-closure-compiler, in fact even just the next version v20151216 fixes it.

The error we see is when attempting to load jschardet.min.js with a custom loader we implement to bridge between ESM and CommonJS/AMD. The error is:

TypeError: Cannot read properties of undefined (reading 'iterator')
      at $jscomp.initSymbolIterator (evalmachine.<anonymous>:1:384)
      at $jscomp.makeIterator (evalmachine.<anonymous>:2:42)
      at evalmachine.<anonymous>:164:334
      at new c (evalmachine.<anonymous>:164:465)
      at evalmachine.<anonymous>:662:132
      at 42../constants (evalmachine.<anonymous>:662:395)

There is more context in https://github.com/microsoft/vscode/issues/160416#issuecomment-2211276269 and onward.

I think with newer versions of google-closure-compiler some polyfills are no longer applied that maybe lead to this issue 🤔

Curious why this project has never updated this dependency to a later version. With this PR the latest version is picked and obviously the change in jschardet.min.js is rather large. Is there a way to validate this works in all environments?

bpasero avatar Jul 09 '24 14:07 bpasero

I was able to distill a minimal repro in https://github.com/aadsm/jschardet/issues/97

bpasero avatar Jul 09 '24 18:07 bpasero

@aadsm friendly ping 👋

bpasero avatar Sep 30 '24 18:09 bpasero

Oh wow, I really missed this issue, thanks for pinging. I was actually working on this sometime ago but then other things came up.

aadsm avatar Sep 30 '24 21:09 aadsm

It is now available as [email protected].

aadsm avatar Sep 30 '24 21:09 aadsm

Thanks a bunch!

bpasero avatar Oct 01 '24 05:10 bpasero