Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Define dependency detection regex once #3

Open
wants to merge 1 commit into from

1 participant

@gdb

On my version of node (0.4.9) redefining it each time through the loop
results in a reset of its state, leading to an infinite loop.

@gdb gdb Define dependency detection regex once
On my version of node (0.4.9) redefining it each time through the loop
results in a reset of its state, leading to an infinite loop.
c9ce4b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 31, 2011
  1. @gdb

    Define dependency detection regex once

    gdb authored
    On my version of node (0.4.9) redefining it each time through the loop
    results in a reset of its state, leading to an infinite loop.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  d.js
View
3  d.js
@@ -91,7 +91,8 @@ function playlist(file, callback) {
list[file] = true;
// Search dependencies of that file
- while(match = /(?:^|[^\w-])require *\(\s*['"](\.\/|\.\.|\/)(.*?)['"]\s*\)/g.exec(data)) {
+ var requires = /(?:^|[^\w-])require *\(\s*['"](\.\/|\.\.|\/)(.*?)['"]\s*\)/g;
+ while(match = requires.exec(data)) {
deps[path.join(match[1] == '/'? '' : directory , (match[1] != "./"? match[1] : '') + match[2] + '.js')] = true;
}
deps = Object.keys(deps);
Something went wrong with that request. Please try again.