Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Serve from Windows with normal '/'s in your require paths #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/stitch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/stitch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ exports.Package = class Package
return callback err if err

for expandedPath in expandedPaths
base = expandedPath + "/"
base = normalize expandedPath + "/"
if sourcePath.indexOf(base) is 0
return callback null, sourcePath.slice base.length
return callback null, sourcePath.slice(base.length).replace(/\\/g, '/')
callback new Error "#{path} isn't in the require path"

compileFile: (path, callback) ->
Expand Down
15 changes: 10 additions & 5 deletions test/test_stitch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,17 @@ module.exports =
test.done()

"paths may be symlinks": (test) ->
test.expect 2
linkPackage.compile (err, sources) ->
test.ok !err
testRequire = load sources
test.ok testRequire("foo/bar/baz")
if process.platform == 'win32'
test.expect 1
test.ok true, "Windows doesn't have symlinks"
test.done()
else
test.expect 2
linkPackage.compile (err, sources) ->
test.ok !err
testRequire = load sources
test.ok testRequire("foo/bar/baz")
test.done()

if stitch.compilers.eco
module.exports["eco compiler"] = (test) ->
Expand Down