Skip to content

Commit 5acd1bd

Browse files
committed
this.define code was getting mangled by module name insertion for anonymous modules.
1 parent ac73d45 commit 5acd1bd

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

build/jslib/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ function (lang, logger, file, parse, optimize, pragma,
717717
//avoid issues with some Dojo transition modules that use a
718718
//define(\n//begin v1.x content
719719
//for a comment.
720-
build.anonDefRegExp = /(require\s*\.\s*def|define)\s*\(\s*(\/\/[^\n\r]*[\r\n])?(\[|f|\{)/;
720+
build.anonDefRegExp = /[^\.](require\s*\.\s*def|define)\s*\(\s*(\/\/[^\n\r]*[\r\n])?(\[|f|\{)/;
721721

722722
build.toTransport = function (moduleName, path, contents, layer) {
723723
//If anonymous module, insert the module name.

build/tests/all.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ require({
3131
'env!../../tests/doh/_{env}Runner.js',
3232
'./convert',
3333
'./parse',
34+
'./buildUtils',
3435

3536
//Build tests should be last in case they alter the environment
3637
//in a weird way.

build/tests/buildUtils.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*jslint plusplus: false, strict: false */
2+
/*global load: false, doh: false, define:false */
3+
4+
define(['build'], function (build) {
5+
6+
doh.register("toTransport",
7+
[
8+
function toTransport(t) {
9+
var bad1 = "this.define(field, value, {_resolve: false});",
10+
layer = {
11+
modulesWithNames: {}
12+
};
13+
14+
t.is(bad1, build.toTransport('bad/1', 'bad1', bad1, layer));
15+
}
16+
]
17+
);
18+
doh.run();
19+
});

0 commit comments

Comments
 (0)