You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deno is a new JS server environment that was created from ground up in attempt to fix Node.js's drawbacks. It looks like this library somehow confused it with a browser (uses process to distinguish Node and browser probably?) Deno doesn't have process, it has its own Deno object in the global namespace, and it uses ES6 modules and not NPM packages.
Hyperscript is small, compact and relatively self-contained, just like Deno. I think they would play together rather nicely.
(If environment is unknown, each feature should be tested before being used.)
All that being said, Hyperscript predates Deno by quite a bit, back in a time where a JavaScript "client" meant "browser" and "server" meant "Node.js".
@kisik21 Deno doesn't have any DOM support yet, so it would need to provide that feature before something like hyperscript could support it as an environment.
In Node there's html-element used to simulate a minimal DOM enough to make HTML. If the check in L4-5 is changed to detect absence of window.document instead of just window (which Deno has, unlike Node), then one could easily make it work with Deno via a proxy that rewrites requires to ES6 imports (that's how I originally tried to launch this package, and it would've worked if the check didn't failed.
I may try to make a PR in the near future. Something like extending the L5 with var document = typeof w.document === 'undefined' ? require('html-element') : w.document - should probably make it work with Deno after rewriting imports.
should probably make it work with Deno after rewriting imports
@kisik21 It's a little more complicated than that. Neither html-element nor its chain of npm dependencies provide ES modules (they only support CommonJS). Because Deno only supports esm with explicit specifiers, you'd have to refactor every module in every dependency (and dependency of dependency... and so on: all the way to the end of the module graph) to that format.
If you don't want to go that route, you could look at other community modules for DOM in Deno (e.g. https://deno.land/x/deno_dom).
Activity
rschristian commentedon Nov 17, 2020
Hyperscript does not check for
process, it does a standard window check to determine browser vs Node:hyperscript/index.js
Line 4 in 4c0d558
jsejcksn commentedon Jul 22, 2021
This is an older assumption that
windowmeans "browser". Deno also hasglobalThis.window.The next line is where the assumption goes wrong:
hyperscript/index.js
Lines 4 to 5 in 4c0d558
(If environment is unknown, each feature should be tested before being used.)
All that being said, Hyperscript predates Deno by quite a bit, back in a time where a JavaScript "client" meant "browser" and "server" meant "Node.js".
@kisik21 Deno doesn't have any DOM support yet, so it would need to provide that feature before something like hyperscript could support it as an environment.
vikanezrimaya commentedon Jul 23, 2021
In Node there's
html-elementused to simulate a minimal DOM enough to make HTML. If the check in L4-5 is changed to detect absence ofwindow.documentinstead of justwindow(which Deno has, unlike Node), then one could easily make it work with Deno via a proxy that rewritesrequires to ES6 imports (that's how I originally tried to launch this package, and it would've worked if the check didn't failed.I may try to make a PR in the near future. Something like extending the L5 with
var document = typeof w.document === 'undefined' ? require('html-element') : w.document- should probably make it work with Deno after rewriting imports.jsejcksn commentedon Jul 23, 2021
@kisik21 It's a little more complicated than that. Neither
html-elementnor its chain of npm dependencies provide ES modules (they only support CommonJS). Because Deno only supports esm with explicit specifiers, you'd have to refactor every module in every dependency (and dependency of dependency... and so on: all the way to the end of the module graph) to that format.If you don't want to go that route, you could look at other community modules for DOM in Deno (e.g. https://deno.land/x/deno_dom).