Skip to content

Commit

Permalink
Introduces UMD headers to the web/ folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Apr 13, 2016
1 parent 1c253e6 commit 006e8fb
Show file tree
Hide file tree
Showing 39 changed files with 836 additions and 281 deletions.
9 changes: 8 additions & 1 deletion external/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ function preprocess(inFilename, outFilename, defines) {
var realPath = fs.realpathSync(inFilename);
var dir = path.dirname(realPath);
try {
preprocess(path.join(dir, file), writeLine, defines);
var fullpath;
if (file.indexOf('$ROOT/') === 0) {
fullpath = path.join(__dirname, '../..',
file.substring('$ROOT/'.length));
} else {
fullpath = path.join(dir, file);
}
preprocess(fullpath, writeLine, defines);
} catch (e) {
if (e.code === 'ENOENT') {
throw new Error('Failed to include "' + file + '" at ' + loc());
Expand Down
7 changes: 4 additions & 3 deletions external/umdutils/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ function validateFile(path, name, context) {
if (name !== umd.amdId) {
error('AMD name does not match module name');
}
if (name.replace(/[_\/]/g, '') !== umd.jsRootName.toLowerCase()) {
if (name.replace(/[_\-\/]/g, '').toLowerCase() !==
umd.jsRootName.toLowerCase()) {
error('root name does not look like module name');
}

Expand All @@ -272,7 +273,7 @@ function validateFile(path, name, context) {
return;
}
i = i.substring('root.'.length);
var j = umd.imports[index];
var j = umd.imports[index].replace(/(_|Lib)$/, '');
var offset = i.toLowerCase().lastIndexOf(j.toLowerCase());
if (offset + j.length !== i.length) {
error('JS import name does not look like corresponding body import ' +
Expand All @@ -281,7 +282,7 @@ function validateFile(path, name, context) {

j = umd.amdImports[index];
if (j) {
if (j.replace(/[_\/]/g, '') !== i.toLowerCase()) {
if (j.replace(/[_\-\/]/g, '').toLowerCase() !== i.toLowerCase()) {
error('JS import name does not look like corresponding AMD import ' +
'name: ' + i + ' vs ' + j);
}
Expand Down
Loading

0 comments on commit 006e8fb

Please sign in to comment.