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

hyphenopoly pattern couldn't be loaded #163

Closed
yashha opened this issue Nov 17, 2023 · 6 comments · Fixed by #164
Closed

hyphenopoly pattern couldn't be loaded #163

yashha opened this issue Nov 17, 2023 · 6 comments · Fixed by #164

Comments

@yashha
Copy link
Contributor

yashha commented Nov 17, 2023

Environment

  • Operating System:
  • node --version: v18.16.1
  • npm --version: 9.5.1
  • yarn --version, if using Yarn: 1.22.21
  • percollate --version: 4.0.3

Description

When using percollate programmatically with hyphanation, the patterns can't be loaded dynamically.

It throws following error:

Error: ENOENT: no such file or directory, open '/home/Arbeitsbereich/js/percollate-api/node_modules/percollate/node_modules/hyphenopoly/patterns/de.wasm'
    at Object.openSync (node:fs:601:3)
    at readFileSync (node:fs:469:35)
    at Proxy.loaderSync (file:///home/Arbeitsbereich/js/percollate-api/node_modules/percollate/src/hyphenate.js:13:11)
    at loadHyphenEngine (file:///home/Arbeitsbereich/js/percollate-api/node_modules/hyphenopoly/hyphenopoly.module.js:289:22)
    at file:///home/Arbeitsbereich/js/percollate-api/node_modules/hyphenopoly/hyphenopoly.module.js:680:9
    at Array.forEach (<anonymous>)
    at Object.H.config (file:///home/Arbeitsbereich/js/percollate-api/node_modules/hyphenopoly/hyphenopoly.module.js:658:17)
    at getHypenatorByLang (file:///home/Arbeitsbereich/js/percollate-api/node_modules/percollate/src/hyphenate.js:10:20)
    at hyphenateDom (file:///home/Arbeitsbereich/js/percollate-api/node_modules/percollate/src/hyphenate.js:29:20)
    at file:///home/Arbeitsbereich/js/percollate-api/node_modules/percollate/index.js:344:30 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/Arbeitsbereich/js/percollate-api/node_modules/percollate/node_modules/hyphenopoly/patterns/de.wasm'
}
yashha added a commit to yashha/percollate that referenced this issue Nov 18, 2023
@danburzo
Copy link
Owner

Hi @yashha, thanks for logging this issue. You’re right that looking into node_modules is not the way to go because it doesn’t work when percollate is installed as a dependency. And your solution for addressing this is fine, but I feel like this should be fixed in (or with the help of) Hyphenopoly’s loading API.

I’ll open a discussion there.

@mnater
Copy link

mnater commented Nov 24, 2023

As of version 5.3.0 of Hyphenopoly the loader/loaderSync- function is now called with a second argument receiving import.meta.url.
See https://mnater.github.io/Hyphenopoly/Module.html
I hope this helps with loading the patterns (I haven't tested with percolate myself).
Please feel free to reopen the issue, if not.

Kind regards,
Mathias

@danburzo
Copy link
Owner

Thank you @mnater, we will test it out and let you know. Cheers!

@yashha
Copy link
Contributor Author

yashha commented Nov 25, 2023

@danburzo Updated the PR, looks better now.

danburzo pushed a commit that referenced this issue Nov 25, 2023
* Fixed the loading of the hyphenopoly language patterns, which did not work when using percollate programmatically. (#163)

* Update hyphenopoly after it updated the language loadaing behavior. #163
mnater/Hyphenopoly#207
@danburzo
Copy link
Owner

Brilliant, thanks @yashha!

@danburzo
Copy link
Owner

Deployed in percollate@4.0.4

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 a pull request may close this issue.

3 participants