OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library web_components.build.html_import_recorder_inliner; | 4 library web_components.build.html_import_recorder_inliner; |
5 | 5 |
6 import 'package:analyzer/analyzer.dart'; | 6 import 'package:analyzer/analyzer.dart'; |
7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
10 import 'package:initialize/transformer.dart'; | 10 import 'package:initialize/transformer.dart'; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 var libPath; | 72 var libPath; |
73 var segments = element.source.uri.pathSegments; | 73 var segments = element.source.uri.pathSegments; |
74 var package = segments[0]; | 74 var package = segments[0]; |
75 if (bootstrapId.package == package && | 75 if (bootstrapId.package == package && |
76 bootstrapId.path.startsWith('${segments[1]}/')) { | 76 bootstrapId.path.startsWith('${segments[1]}/')) { |
77 package = null; | 77 package = null; |
78 libPath = path.url.relative( | 78 libPath = path.url.relative( |
79 path.url.joinAll(segments.getRange(1, segments.length)), | 79 path.url.joinAll(segments.getRange(1, segments.length)), |
80 from: path.url.dirname(path.url.join(bootstrapId.path))); | 80 from: path.url.dirname(path.url.join(bootstrapId.path))); |
81 } else if (segments[1] == 'lib') { | 81 } else if (segments[1] == 'lib') { |
82 libPath = path.url.joinAll(segments.getRange(1, segments.length)); | 82 libPath = path.url.joinAll(segments.getRange(2, segments.length)); |
83 } else { | 83 } else { |
84 logger.error('Unable to import `${element.source.uri.path}` from ' | 84 logger.error('Unable to import `${element.source.uri.path}` from ' |
85 '${bootstrapId}.'); | 85 '${bootstrapId}.'); |
86 return null; | 86 return null; |
87 } | 87 } |
88 | 88 |
89 importPaths | 89 importPaths |
90 .add(normalizeHtmlImportPath(originalImportPath, package, libPath)); | 90 .add(normalizeHtmlImportPath(originalImportPath, package, libPath)); |
91 | 91 |
92 // Don't emit an InitEntry. | 92 // Don't emit an InitEntry. |
93 return null; | 93 return null; |
94 } | 94 } |
95 } | 95 } |
OLD | NEW |