@@ -212,7 +212,7 @@ var AMDLoader;
212212 return '===anonymous' + ( Utilities . NEXT_ANONYMOUS_ID ++ ) + '===' ;
213213 } ;
214214 Utilities . isAnonymousModule = function ( id ) {
215- return / ^ = = = a n o n y m o u s / . test ( id ) ;
215+ return Utilities . startsWith ( id , ' ===anonymous' ) ;
216216 } ;
217217 Utilities . getHighPerformanceTimestamp = function ( ) {
218218 if ( ! this . PERFORMANCE_NOW_PROBED ) {
@@ -811,15 +811,17 @@ var AMDLoader;
811811 errorCode : 'cachedDataRejected' ,
812812 path : cachedDataPath
813813 } ) ;
814- NodeScriptLoader . _runSoon ( function ( ) { return _this . _fs . unlink ( cachedDataPath , function ( err ) {
815- if ( err ) {
816- moduleManager . getConfig ( ) . getOptionsLiteral ( ) . onNodeCachedData ( {
817- errorCode : 'unlink' ,
818- path : cachedDataPath ,
819- detail : err
820- } ) ;
821- }
822- } ) ; } , moduleManager . getConfig ( ) . getOptionsLiteral ( ) . nodeCachedDataWriteDelay ) ;
814+ NodeScriptLoader . _runSoon ( function ( ) {
815+ return _this . _fs . unlink ( cachedDataPath , function ( err ) {
816+ if ( err ) {
817+ moduleManager . getConfig ( ) . getOptionsLiteral ( ) . onNodeCachedData ( {
818+ errorCode : 'unlink' ,
819+ path : cachedDataPath ,
820+ detail : err
821+ } ) ;
822+ }
823+ } ) ;
824+ } , moduleManager . getConfig ( ) . getOptionsLiteral ( ) . nodeCachedDataWriteDelay ) ;
823825 }
824826 else if ( script . cachedDataProduced ) {
825827 // data produced => tell outside world
@@ -828,15 +830,17 @@ var AMDLoader;
828830 length : script . cachedData . length
829831 } ) ;
830832 // data produced => write cache file
831- NodeScriptLoader . _runSoon ( function ( ) { return _this . _fs . writeFile ( cachedDataPath , script . cachedData , function ( err ) {
832- if ( err ) {
833- moduleManager . getConfig ( ) . getOptionsLiteral ( ) . onNodeCachedData ( {
834- errorCode : 'writeFile' ,
835- path : cachedDataPath ,
836- detail : err
837- } ) ;
838- }
839- } ) ; } , moduleManager . getConfig ( ) . getOptionsLiteral ( ) . nodeCachedDataWriteDelay ) ;
833+ NodeScriptLoader . _runSoon ( function ( ) {
834+ return _this . _fs . writeFile ( cachedDataPath , script . cachedData , function ( err ) {
835+ if ( err ) {
836+ moduleManager . getConfig ( ) . getOptionsLiteral ( ) . onNodeCachedData ( {
837+ errorCode : 'writeFile' ,
838+ path : cachedDataPath ,
839+ detail : err
840+ } ) ;
841+ }
842+ } ) ;
843+ } , moduleManager . getConfig ( ) . getOptionsLiteral ( ) . nodeCachedDataWriteDelay ) ;
840844 }
841845 } ;
842846 NodeScriptLoader . _runSoon = function ( callback , minTimeout ) {
@@ -1403,7 +1407,8 @@ var AMDLoader;
14031407 this . _knownModules2 [ moduleId ] = true ;
14041408 var strModuleId = this . _moduleIdProvider . getStrModuleId ( moduleId ) ;
14051409 var paths = this . _config . moduleIdToPaths ( strModuleId ) ;
1406- if ( this . _env . isNode && strModuleId . indexOf ( '/' ) === - 1 ) {
1410+ var scopedPackageRegex = / ^ @ [ ^ \/ ] + \/ [ ^ \/ ] + $ / ; // matches @scope /package-name
1411+ if ( this . _env . isNode && ( strModuleId . indexOf ( '/' ) === - 1 || scopedPackageRegex . test ( strModuleId ) ) ) {
14071412 paths . push ( 'node|' + strModuleId ) ;
14081413 }
14091414 var lastPathIndex = - 1 ;
@@ -1649,6 +1654,9 @@ var AMDLoader;
16491654 RequireFunc . getStats = function ( ) {
16501655 return moduleManager . getLoaderEvents ( ) ;
16511656 } ;
1657+ RequireFunc . define = function ( ) {
1658+ return DefineFunc . apply ( null , arguments ) ;
1659+ } ;
16521660 function init ( ) {
16531661 if ( typeof AMDLoader . global . require !== 'undefined' || typeof require !== 'undefined' ) {
16541662 var _nodeRequire_1 = ( AMDLoader . global . require || require ) ;
0 commit comments