Giter Club home page Giter Club logo

Comments (11)

kevinswiber avatar kevinswiber commented on July 19, 2024

It may have to do with having both a split and replace with regular expressions on the same line.

See here: https://github.com/broofa/node-mime/blob/48cbcf979b4d1980098217e275f03da33a311c5e/mime.js#L59

var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

Ah, scratch that. Looks like everything's like getting properly broken into an AST at some point.

There's something unfriendly about the expression itself, I think.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

Currently Googling "JavaScript compatible regular expression C library" with a stern look on my face. :/

I'm hoping the issue is easier to solve than that.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

Sorry for the tweet-style issue commenting. If it does come down to needing a regex engine that's JavaScript compatible... I just remembered a project called Duktape. They have a regex engine.

Site: http://duktape.org
Code: https://github.com/svaarala/duktape/tree/master/src

That may be an option.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

Okay... confirmed this doesn't work in colony, though I didn't try using hsregex directly.

console.log('Hello World'.replace(/\s|l*/g, ''));

In colony, that's an infinite loop.

In Node, it's "HeoWord".

And for the record, it also appears to work properly in Duktape. Here's the gist I used to test it: https://gist.github.com/kevinswiber/d04bd75725713d42eec2

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

As you can read in the description of the issue linked below, I need an independent, JavaScript-compatible regular expression parser for my own needs, but if you were interested in using Duktape's implementation, as well, the author gives some advice here: svaarala/duktape#12 (comment)

Provided I get the time to attempt this, I can always circle back around to Tessel at a later date and see if it plugs in to the runtime nicely. Otherwise, there's likely a quicker fix for this specific issue.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

I think #113 fixes this issue of the infinite loop. However, the express sample is still not running. More info being added to #110.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

The mime module is trying to split its data file contents by line using this regular expression: [\r\n]+. The result of the split is wacky and breaks the module, thereby breaking the Content-Type header returned by Express.

More details here: #110 (comment)

from t1-runtime.

johnnyman727 avatar johnnyman727 commented on July 19, 2024

Just as an update to anyone watching this issue, the Express test no longer goes into an infinite loop but it does not parse paths correctly.

from t1-runtime.

kevinswiber avatar kevinswiber commented on July 19, 2024

This is related to #108. Trouble line: https://github.com/expressjs/parseurl/blob/master/index.js#L17

from t1-runtime.

johnnyman727 avatar johnnyman727 commented on July 19, 2024

Express is hitting some other compat issues. Currently, upon require:

➜  sandbox  tessel run server.js
TESSEL! Connected to TM-00-04-f000da30-005d4344-60782586.
INFO Bundling directory /Users/Jon/Work/technical/sandbox (~710.25 KB)
INFO Deploying bundle (1.13 MB)...
INFO Running script...
[T]: src/colony/lua/colony-js.lua:906: bad argument #2 to 'f' (number expected, got nil)

I'm going to close this issue in favor of more specific Node/JS compat issues.

from t1-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.