@@ -16,7 +16,7 @@ import 'package:analyzer/src/generated/source.dart';
16
16
import 'package:dartdoc/src/utils.dart' ;
17
17
import 'package:html/dom.dart' show Element, Document;
18
18
import 'package:html/parser.dart' show parse;
19
- import 'package:path/path.dart' as path ;
19
+ import 'package:path/path.dart' as pathLib ;
20
20
21
21
import 'package:tuple/tuple.dart' ;
22
22
import 'src/config.dart' ;
@@ -38,7 +38,7 @@ const String name = 'dartdoc';
38
38
// Update when pubspec version changes.
39
39
const String version = '0.17.1+1' ;
40
40
41
- final String defaultOutDir = path .join ('doc' , 'api' );
41
+ final String defaultOutDir = pathLib .join ('doc' , 'api' );
42
42
43
43
/// Initialize and setup the generators.
44
44
Future <List <Generator >> initGenerators (String url, String relCanonicalPrefix,
@@ -169,7 +169,7 @@ class DartDoc extends PackageBuilder {
169
169
170
170
for (var generator in generators) {
171
171
await generator.generate (packageGraph, outputDir.path);
172
- writtenFiles.addAll (generator.writtenFiles.map (path .normalize));
172
+ writtenFiles.addAll (generator.writtenFiles.map (pathLib .normalize));
173
173
}
174
174
if (config.validateLinks) validateLinks (packageGraph, outputDir.path);
175
175
int warnings = packageGraph.packageWarningCounter.warningCount;
@@ -209,12 +209,12 @@ class DartDoc extends PackageBuilder {
209
209
Set <Warnable > warnOnElements;
210
210
211
211
// Make all paths relative to origin.
212
- if (path .isWithin (origin, warnOn)) {
213
- warnOn = path .relative (warnOn, from: origin);
212
+ if (pathLib .isWithin (origin, warnOn)) {
213
+ warnOn = pathLib .relative (warnOn, from: origin);
214
214
}
215
215
if (referredFrom != null ) {
216
- if (path .isWithin (origin, referredFrom)) {
217
- referredFrom = path .relative (referredFrom, from: origin);
216
+ if (pathLib .isWithin (origin, referredFrom)) {
217
+ referredFrom = pathLib .relative (referredFrom, from: origin);
218
218
}
219
219
// Source paths are always relative.
220
220
if (_hrefs[referredFrom] != null ) {
@@ -245,13 +245,13 @@ class DartDoc extends PackageBuilder {
245
245
246
246
void _doOrphanCheck (
247
247
PackageGraph packageGraph, String origin, Set <String > visited) {
248
- String normalOrigin = path .normalize (origin);
249
- String staticAssets = path .joinAll ([normalOrigin, 'static-assets' , '' ]);
250
- String indexJson = path .joinAll ([normalOrigin, 'index.json' ]);
248
+ String normalOrigin = pathLib .normalize (origin);
249
+ String staticAssets = pathLib .joinAll ([normalOrigin, 'static-assets' , '' ]);
250
+ String indexJson = pathLib .joinAll ([normalOrigin, 'index.json' ]);
251
251
bool foundIndexJson = false ;
252
252
for (FileSystemEntity f
253
253
in new Directory (normalOrigin).listSync (recursive: true )) {
254
- var fullPath = path .normalize (f.path);
254
+ var fullPath = pathLib .normalize (f.path);
255
255
if (f is Directory ) {
256
256
continue ;
257
257
}
@@ -304,8 +304,8 @@ class DartDoc extends PackageBuilder {
304
304
305
305
void _doSearchIndexCheck (
306
306
PackageGraph packageGraph, String origin, Set <String > visited) {
307
- String fullPath = path .joinAll ([origin, 'index.json' ]);
308
- String indexPath = path .joinAll ([origin, 'index.html' ]);
307
+ String fullPath = pathLib .joinAll ([origin, 'index.json' ]);
308
+ String indexPath = pathLib .joinAll ([origin, 'index.html' ]);
309
309
File file = new File ("$fullPath " );
310
310
if (! file.existsSync ()) {
311
311
return null ;
@@ -320,10 +320,10 @@ class DartDoc extends PackageBuilder {
320
320
found.add (indexPath);
321
321
for (Map <String , String > entry in jsonData) {
322
322
if (entry.containsKey ('href' )) {
323
- String entryPath = path .joinAll ([origin, entry['href' ]]);
323
+ String entryPath = pathLib .joinAll ([origin, entry['href' ]]);
324
324
if (! visited.contains (entryPath)) {
325
325
_warn (packageGraph, PackageWarning .brokenLink, entryPath,
326
- path .normalize (origin),
326
+ pathLib .normalize (origin),
327
327
referredFrom: fullPath);
328
328
}
329
329
found.add (entryPath);
@@ -333,7 +333,7 @@ class DartDoc extends PackageBuilder {
333
333
Set <String > missing_from_search = visited.difference (found);
334
334
for (String s in missing_from_search) {
335
335
_warn (packageGraph, PackageWarning .missingFromSearchIndex, s,
336
- path .normalize (origin),
336
+ pathLib .normalize (origin),
337
337
referredFrom: fullPath);
338
338
}
339
339
}
@@ -342,14 +342,14 @@ class DartDoc extends PackageBuilder {
342
342
String pathToCheck,
343
343
[String source, String fullPath]) {
344
344
if (fullPath == null ) {
345
- fullPath = path .joinAll ([origin, pathToCheck]);
346
- fullPath = path .normalize (fullPath);
345
+ fullPath = pathLib .joinAll ([origin, pathToCheck]);
346
+ fullPath = pathLib .normalize (fullPath);
347
347
}
348
348
349
349
Tuple2 stringLinksAndHref = _getStringLinksAndHref (fullPath);
350
350
if (stringLinksAndHref == null ) {
351
351
_warn (packageGraph, PackageWarning .brokenLink, pathToCheck,
352
- path .normalize (origin),
352
+ pathLib .normalize (origin),
353
353
referredFrom: source);
354
354
_onCheckProgress.add (pathToCheck);
355
355
// Remove so that we properly count that the file doesn't exist for
@@ -376,13 +376,13 @@ class DartDoc extends PackageBuilder {
376
376
if (uri == null || ! uri.hasAuthority && ! uri.hasFragment) {
377
377
var full;
378
378
if (baseHref != null ) {
379
- full = '${path .dirname (pathToCheck )}/$baseHref /$href ' ;
379
+ full = '${pathLib .dirname (pathToCheck )}/$baseHref /$href ' ;
380
380
} else {
381
- full = '${path .dirname (pathToCheck )}/$href ' ;
381
+ full = '${pathLib .dirname (pathToCheck )}/$href ' ;
382
382
}
383
- var newPathToCheck = path .normalize (full);
384
- String newFullPath = path .joinAll ([origin, newPathToCheck]);
385
- newFullPath = path .normalize (newFullPath);
383
+ var newPathToCheck = pathLib .normalize (full);
384
+ String newFullPath = pathLib .joinAll ([origin, newPathToCheck]);
385
+ newFullPath = pathLib .normalize (newFullPath);
386
386
if (! visited.contains (newFullPath)) {
387
387
toVisit.add (new Tuple2 (newPathToCheck, newFullPath));
388
388
visited.add (newFullPath);
0 commit comments