Skip to content

Commit

Permalink
Update assetgraph version
Browse files Browse the repository at this point in the history
  • Loading branch information
Munter committed Aug 25, 2016
1 parent 6323015 commit 0adce03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 1 addition & 5 deletions bin/assetviz
Expand Up @@ -73,10 +73,7 @@ if (!rootUrl && inputUrls.length === 1) {
var AssetGraph = require('assetgraph'),
query = AssetGraph.query,
followRelationsQueryObj = query.not({
type: 'HtmlAnchor',
to: {
url: /^https?:/
}
type: 'HtmlAnchor'
}),
assetviz = require('../index.js'),
chalk = require('chalk');
Expand All @@ -92,7 +89,6 @@ new AssetGraph({root: rootUrl})
console.warn(chalk.green(' ✔ ') + asset.url);
}
})
.registerRequireJsConfig()
.loadAssets(inputUrls)
.populate({followRelations: followRelationsQueryObj})
.queue(function fixBaseAssetsOfUnresolvedOutgoingRelationsFromHtmlFragments(assetGraph) {
Expand Down
17 changes: 16 additions & 1 deletion index.js
Expand Up @@ -86,10 +86,25 @@ module.exports = function (config) {

assetGraph.findRelations(undefined, true).forEach(function (relation) {
if (verbose || ('idx' in relation.from && 'idx' in relation.to)) {
var typeString = relationLabelByType[relation.type] || '';
var typeString = relationLabelByType[relation.type] || relation.type;
if (typeof typeString === 'function') {
typeString = typeString(relation);
}

if (typeof relation.to.idx === 'undefined') {
relation.to.idx = idx;
data.assets.push({
path: relation.crossorigin ? relation.to.url : Path.relative(assetGraph.root, relation.to.url),
fileName: (relation.to.url ? relation.to.url : 'i:' + relation.to).replace(/"/g, '\\"'),
type: relation.to.type && relation.to.type.toLowerCase(),
size: 0,
r: 3,
outgoing: 0,
initial: relation.to.isInitial
});
idx += 1;
}

data.assets[relation.from.idx].outgoing += 1;
data.relations.push({
source: relation.from.idx,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -20,10 +20,10 @@
"author": "Peter Müller <munter@fumle.dk>",
"license": "MIT",
"dependencies": {
"assetgraph": "^1.23.1",
"chalk": "1.1.1",
"assetgraph": "^2.14.0",
"chalk": "^1.1.3",
"optimist": "0.6.1",
"urltools": "0.2.0"
"urltools": "^0.2.1"
},
"bin": "./bin/assetviz"
}

0 comments on commit 0adce03

Please sign in to comment.