| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert' show JsonEncoder; | 6 import 'dart:convert' show JsonEncoder; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 var bootstrapContent = new StringBuffer('(function() {\n'); | 144 var bootstrapContent = new StringBuffer('(function() {\n'); |
| 145 if (isDebug) { | 145 if (isDebug) { |
| 146 bootstrapContent.write(''' | 146 bootstrapContent.write(''' |
| 147 $_currentDirectoryScript | 147 $_currentDirectoryScript |
| 148 let modulePaths = ${const JsonEncoder.withIndent(" ").convert(modulePaths)}; | 148 let modulePaths = ${const JsonEncoder.withIndent(" ").convert(modulePaths)}; |
| 149 | 149 |
| 150 if(!window.\$dartLoader) { | 150 if(!window.\$dartLoader) { |
| 151 window.\$dartLoader = { | 151 window.\$dartLoader = { |
| 152 moduleIdToUrl: new Map(), | 152 moduleIdToUrl: new Map(), |
| 153 urlToModuleId: new Map(), | 153 urlToModuleId: new Map(), |
| 154 rootDirectories: new Set(), | 154 rootDirectories: new Array(), |
| 155 }; | 155 }; |
| 156 } | 156 } |
| 157 | 157 |
| 158 let customModulePaths = {}; | 158 let customModulePaths = {}; |
| 159 window.\$dartLoader.rootDirectories.add(_currentDirectory); | 159 window.\$dartLoader.rootDirectories.push(_currentDirectory); |
| 160 for (let moduleName of Object.getOwnPropertyNames(modulePaths)) { | 160 for (let moduleName of Object.getOwnPropertyNames(modulePaths)) { |
| 161 let modulePath = modulePaths[moduleName]; | 161 let modulePath = modulePaths[moduleName]; |
| 162 if (modulePath != moduleName) { | 162 if (modulePath != moduleName) { |
| 163 customModulePaths[moduleName] = modulePath; | 163 customModulePaths[moduleName] = modulePath; |
| 164 } | 164 } |
| 165 var src = _currentDirectory + modulePath + '.js'; | 165 var src = _currentDirectory + modulePath + '.js'; |
| 166 if (window.\$dartLoader.moduleIdToUrl.has(moduleName)) { | 166 if (window.\$dartLoader.moduleIdToUrl.has(moduleName)) { |
| 167 continue; | 167 continue; |
| 168 } | 168 } |
| 169 \$dartLoader.moduleIdToUrl.set(moduleName, src); | 169 \$dartLoader.moduleIdToUrl.set(moduleName, src); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } finally { | 430 } finally { |
| 431 for (var id in completers.keys) { | 431 for (var id in completers.keys) { |
| 432 if (!completers[id].isCompleted) { | 432 if (!completers[id].isCompleted) { |
| 433 completers[id].completeError(new AssetNotFoundException(id)); | 433 completers[id].completeError(new AssetNotFoundException(id)); |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 }(); | 437 }(); |
| 438 return futures; | 438 return futures; |
| 439 } | 439 } |
| OLD | NEW |