Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a filename to the define call in the module header #383

Open
wants to merge 2 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
7 changes: 4 additions & 3 deletions builder/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,17 @@ function assembleCoreScript() {

function copyModuleScripts() {
modules.forEach(function(moduleFile) {
var moduleCode = fs.readFileSync(srcDir + "modules/" + moduleFile, FILE_ENCODING);
var moduleCode = fs.readFileSync(srcDir + "modules/" + moduleFile, FILE_ENCODING),
filename = path.basename(moduleFile, path.extname(moduleFile));

// Run build directives
moduleCode = moduleCode.replace(/\/\*\s?build:modularizeWithRangyDependency\s?\*\/([\s\S]*?)\/\*\s?build:modularizeEnd\s?\*\//gm, function(match, code) {
//var dependenciesArray = eval(dependencies);
return [
'(function(factory, root) {',
' if (typeof define == "function" && define.amd) {',
' // AMD. Register as an anonymous module with a dependency on Rangy.',
' define(["./rangy-core"], factory);',
' // AMD. Register as a module with a dependency on Rangy.',
' define("' + filename + '", ["./rangy-core"], factory);',
' } else if (typeof module != "undefined" && typeof exports == "object") {',
' // Node/CommonJS style',
' module.exports = factory( require("rangy") );',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rangy",
"description": "A cross-browser DOM range and selection library",
"version": "1.3.1-dev",
"version": "1.3.2",
"author": {
"name": "Tim Down",
"email": "[email protected]",
Expand Down