-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autoBundler normalizes dependency paths in bundle requires (placehold…
…er fix for #45)
- Loading branch information
1 parent
ea38427
commit 7535c16
Showing
7 changed files
with
59 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
RequireJsNet.Compressor/AutoDependency/Transformations/DepsToLowerTransformation.cs
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
RequireJsNet.Compressor/AutoDependency/Transformations/NormalizeDepsTransformation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// RequireJS.NET | ||
// Copyright VeriTech.io | ||
// http://veritech.io | ||
// Dual licensed under the MIT and GPL licenses: | ||
// http://www.opensource.org/licenses/mit-license.php | ||
// http://www.gnu.org/licenses/gpl.html | ||
|
||
using System; | ||
using System.Linq; | ||
using Jint.Parser.Ast; | ||
using RequireJsNet.Compressor.Parsing; | ||
using RequireJsNet.Helpers; | ||
|
||
namespace RequireJsNet.Compressor.Transformations | ||
{ | ||
internal class NormalizeDepsTransformation : IRequireTransformation | ||
{ | ||
public RequireCall RequireCall { get; set; } | ||
|
||
public static NormalizeDepsTransformation Create(RequireCall requireCall) | ||
{ | ||
return new NormalizeDepsTransformation | ||
{ | ||
RequireCall = requireCall | ||
}; | ||
} | ||
|
||
public void Execute(ref string script) | ||
{ | ||
var dependencies = | ||
RequireCall.DependencyArrayNode.Elements.Where(r => r.Type == SyntaxNodes.Literal).Cast<Literal>(); | ||
|
||
foreach (var dependency in dependencies) | ||
{ | ||
var range = new int[] {dependency.Range[0] + 1, dependency.Range[1] - 1}; | ||
|
||
var preDeps = script.Substring(0, range[0]); | ||
var postDeps = script.Substring(range[1], script.Length - range[1]); | ||
var deps = script.Substring(range[0], range[1] - range[0]).ToModuleName(); | ||
script = preDeps + deps + postDeps; | ||
} | ||
} | ||
|
||
public int[] GetAffectedRange() | ||
{ | ||
return RequireCall.DependencyArrayNode.Range; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,9 +54,6 @@ | |
"include": [ | ||
{ | ||
"directory": "\\controllers\\Root\\" | ||
}, | ||
{ | ||
"file": "jquery-1.10.2" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
require(["controllers/root/home/complexLoad", "underscore"], function() { | ||
require(["Controllers/Root/Home/complexLoad", "underscore"], function() { | ||
_.each([1], alert); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters