Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Define dependency detection regex once #3

Open
wants to merge 1 commit into from

1 participant

Greg Brockman
Greg Brockman
gdb commented

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.

Greg Brockman 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

Showing 1 unique commit by 1 author.

Jul 31, 2011
Greg Brockman 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
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  d.js
3  d.js
@@ -91,7 +91,8 @@ function playlist(file, callback) {
91 91 list[file] = true;
92 92
93 93 // Search dependencies of that file
94   - while(match = /(?:^|[^\w-])require *\(\s*['"](\.\/|\.\.|\/)(.*?)['"]\s*\)/g.exec(data)) {
  94 + var requires = /(?:^|[^\w-])require *\(\s*['"](\.\/|\.\.|\/)(.*?)['"]\s*\)/g;
  95 + while(match = requires.exec(data)) {
95 96 deps[path.join(match[1] == '/'? '' : directory , (match[1] != "./"? match[1] : '') + match[2] + '.js')] = true;
96 97 }
97 98 deps = Object.keys(deps);

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.