├── test ├── fixtures │ ├── require.coffee │ ├── require_markdown.md │ ├── require.es6 │ ├── require.js │ ├── bower.json │ ├── composer.json │ ├── package.json │ ├── gist.html │ ├── require_markdown.md.html │ ├── require.coffee.html │ ├── require.es6.html │ └── require.js.html ├── test_spy.js ├── test_core.js ├── test_require_markdown.js ├── test_gist.js ├── update_fixtures.sh ├── test_require_coffee.js ├── test_require_markdown_pull.js ├── helper.js ├── test_require_es6.js ├── test_require_pull.js ├── test_require.js ├── test_live-resover.js ├── test_manifest_bower.js ├── test_utils.js ├── test_manifest_composer.js └── test_manifest_package.js ├── .gitignore ├── .travis.yml ├── index.js ├── .editorconfig ├── .jshintrc ├── lib ├── modules │ ├── index.js │ ├── require.js │ └── manifest.js ├── util │ └── util.js ├── core.js ├── update_notifier.js └── live-resolver │ └── index.js ├── .jscsrc ├── package.json ├── gulpfile.js └── README.md /test/fixtures/require.coffee: -------------------------------------------------------------------------------- 1 | require "path" 2 | lodash = require("lodash") 3 | -------------------------------------------------------------------------------- /test/fixtures/require_markdown.md: -------------------------------------------------------------------------------- 1 | 2 | ```js 3 | require('lodash'); 4 | ``` 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | temp/ 3 | coverage/ 4 | npm-debug.log 5 | .DS_Store 6 | .idea 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | env: CI=true 3 | sudo: false 4 | node_js: 5 | - '0.10' 6 | -------------------------------------------------------------------------------- /test/fixtures/require.es6: -------------------------------------------------------------------------------- 1 | import "path"; 2 | import lodash from "lodash"; 3 | import * as dash from "lodash"; 4 | import exp, {pick, omit} from "lodash"; 5 | export * from "url"; 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var injection = require('github-injection'); 4 | var GitHubLinkerCore = require('./lib/core.js'); 5 | 6 | module.exports = function(global, options, cb) { 7 | var instance = new GitHubLinkerCore(global, options); 8 | injection(global, function() { 9 | instance.init(cb); 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /test/test_spy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var helper = require('./helper'); 5 | 6 | describe('spyInject', function() { 7 | 8 | this.timeout(4000); 9 | 10 | before(function(done) { 11 | this.$ = this.result = null; 12 | 13 | helper('bower.json', done); 14 | }); 15 | 16 | it('dom element is present', function() { 17 | $('#js-repo-pjax-container').length.should.equal(1); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /test/test_core.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var core = require('..'); 5 | 6 | describe('core', function() { 7 | var fakeWindow = { 8 | document: { 9 | getElementById: function() {} 10 | } 11 | }; 12 | 13 | it('require argument window', function () { 14 | core.bind(null).should.throw('Missing argument window'); 15 | }); 16 | 17 | it('require option changelog', function () { 18 | core.bind(null, fakeWindow, {version: '1.2.3'}).should.throw('Missing option changelog'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true, 14 | "expr": true, 15 | "globals": { 16 | "describe" : false, 17 | "it" : false, 18 | "before" : false, 19 | "beforeEach" : false, 20 | "after" : false, 21 | "afterEach" : false, 22 | "window" : false, 23 | "location" : false, 24 | "$" : false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/modules/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var async = require('async'); 4 | var _ = require('lodash'); 5 | 6 | module.exports = function(root, options, cb) { 7 | 8 | var InvokeModule = {}; 9 | var modules = { 10 | require: require('./require.js'), 11 | manifest: require('./manifest.js') 12 | }; 13 | 14 | _.each(modules, function(func, key) { 15 | InvokeModule[key] = function(cb) { 16 | func(root, options, cb); 17 | }; 18 | }); 19 | 20 | async.parallel(InvokeModule, function(err, results) { 21 | if (err) { 22 | return cb(err); 23 | } 24 | cb(null, results); 25 | }); 26 | }; 27 | -------------------------------------------------------------------------------- /test/fixtures/require.js: -------------------------------------------------------------------------------- 1 | 2 | require('path'); 3 | require('lodash'); 4 | require('unknown-package-name'); 5 | require('./file.js'); 6 | require('./folder/file.js'); 7 | require('./file-or-folder'); 8 | require('../file.js'); 9 | require('../folder/file.js'); 10 | require('../file-or-folder'); 11 | require('../../file.js'); 12 | require('../../folder/file.js'); 13 | require('../../file-or-folder'); 14 | require('./'); 15 | require('..'); 16 | require('../'); 17 | require('../..'); 18 | require('../../'); 19 | require('.'); 20 | require('...'); 21 | require('/'); 22 | require('matthewmueller/uid'); 23 | require('component/tip@master'); 24 | require('yields/shortcuts@0.0.1:/index.js'); 25 | -------------------------------------------------------------------------------- /lib/util/util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require('lodash'); 4 | 5 | var urlMatch = function(url, lookup) { 6 | 7 | var urlContains = function(indicator) { 8 | url = url.split('#')[0]; 9 | return url.indexOf(indicator) === url.length - indicator.length; 10 | }; 11 | 12 | return _.find(lookup, function(type, urlFragment) { 13 | return urlContains(urlFragment); 14 | }); 15 | }; 16 | 17 | var stripQuotes = function(jqElement) { 18 | return jqElement.text().replace(/"|'/g, '').trim(); 19 | }; 20 | 21 | var showLoader = function($) { 22 | $('.page-context-loader').addClass('is-context-loading'); 23 | }; 24 | 25 | module.exports = { 26 | stripQuotes: stripQuotes, 27 | urlMatch: urlMatch, 28 | showLoader: showLoader, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/core.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require('lodash'); 4 | var updateNotifier = require('./update_notifier'); 5 | var modules = require('./modules'); 6 | var liveResolver = require('./live-resolver'); 7 | 8 | var defaultOptions = { 9 | showUpdateNotification: false, 10 | changelog: undefined 11 | }; 12 | 13 | var GitHubLinkerCore = function(root, options) { 14 | options = options || {}; 15 | 16 | if (!root) { 17 | throw new Error('Missing argument window'); 18 | } 19 | if (!options.changelog) { 20 | throw new Error('Missing option changelog'); 21 | } 22 | 23 | this.root = root; 24 | this.options = _.defaults(options, defaultOptions); 25 | 26 | updateNotifier(this.root, this.options); 27 | }; 28 | 29 | module.exports = GitHubLinkerCore; 30 | 31 | GitHubLinkerCore.prototype.init = function(cb) { 32 | cb = cb || function() {}; 33 | 34 | liveResolver(); 35 | 36 | modules(this.root, this.options, cb); 37 | }; 38 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], 3 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], 4 | "disallowSpaceBeforeBinaryOperators": [",", ":"], 5 | "disallowSpaceAfterBinaryOperators": ["!"], 6 | "requireSpaceBeforeBinaryOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], 7 | "requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], 8 | "disallowImplicitTypeConversion": ["string"], 9 | "disallowKeywords": ["with"], 10 | "disallowMultipleLineBreaks": true, 11 | "disallowKeywordsOnNewLine": ["else"], 12 | "disallowTrailingWhitespace": true, 13 | "requireLineFeedAtFileEnd": true, 14 | "validateIndentation": 2, 15 | "validateQuoteMarks": "'", 16 | "validateJSDoc": { 17 | "checkParamNames": true, 18 | "requireParamTypes": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/fixtures/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-repo", 3 | "description": "My personal playground", 4 | "version": "0.0.1", 5 | "main": "index.js", 6 | "license": "MIT", 7 | "ignore": "", 8 | "keywords": [], 9 | "author": [ 10 | "Stefan Buck (http://stefanbuck.com)" 11 | ], 12 | "homepage": "https://github.com/stefanbuck/playground-repo", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/stefanbuck/playground-repo" 16 | }, 17 | "dependencies": { 18 | "lodash": "2.4.1", 19 | "modernizr": "Modernizr/Modernizr", 20 | "backbone": "jashkenas/backbone#master", 21 | "jquery": "jquery/jquery#1.x-master", 22 | "unknown-package-name": "latest" 23 | }, 24 | "devDependencies": { 25 | "chai": "^1.9.1", 26 | "should": "^3.3.1" 27 | }, 28 | "resolutions": { 29 | "lodash": "2.1.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/test_require_markdown.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('require_markdown.md', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('require_markdown.md', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.require; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(1); 23 | }); 24 | 25 | it('check link replacement', function() { 26 | $('.octo-linker').length.should.equal(1); 27 | }); 28 | 29 | it('https://github.com/lodash/lodash', function() { 30 | var item = _.findWhere(this.result, { 31 | name: 'lodash' 32 | }); 33 | 34 | item.el.data('type').should.equal('npm'); 35 | item.el.data('value').should.equal('lodash'); 36 | }); 37 | 38 | }); 39 | -------------------------------------------------------------------------------- /lib/update_notifier.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var util = require('util'); 4 | 5 | var root; 6 | 7 | function getUser () { 8 | var el = root.document.querySelector('.header .css-truncate-target'); 9 | if (el && el.innerHTML.length) { 10 | return ' ' + el.innerHTML; 11 | } 12 | return ''; 13 | } 14 | 15 | module.exports = function(window, options) { 16 | if (!options.showUpdateNotification) { 17 | return; 18 | } 19 | 20 | root = window; 21 | var $ = root.$; 22 | 23 | if ($('.octo-linker-intro').length > 0) { 24 | return; 25 | } 26 | 27 | var message = 'Hi%s, a new version of the GitHub-Linker extension has been released! %s'; 28 | var changelogLink = 'Read more'; 29 | var messageHTML = util.format(message, getUser(), changelogLink); 30 | 31 | var $intro = $('
' + messageHTML + '
'); 32 | $('.wrapper').prepend($intro); 33 | }; 34 | -------------------------------------------------------------------------------- /test/test_gist.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe.skip('gist', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | this.$ = this.result = null; 13 | 14 | helper('gist', 'https://gist.github.com/petereberlecom/a61cb95f9b28270d86a9', function(_jquery, _result) { 15 | this.$ = _jquery; 16 | this.result = _result.require; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(1); 23 | }); 24 | 25 | it('https://github.com/octo-linker/core', function() { 26 | var item = _.findWhere(this.result, { 27 | name: 'octo-linker-core' 28 | }); 29 | 30 | item.link.should.equal('https://github.com/octo-linker/core'); 31 | 32 | item.el.attr('href').should.equal('https://github.com/octo-linker/core'); 33 | item.el.hasClass('tooltipped').should.be.false; 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /test/update_fixtures.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/bower.json > ./test/fixtures/bower.json.html 4 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/composer.json > ./test/fixtures/composer.json.html 5 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/package.json > ./test/fixtures/package.json.html 6 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/require_markdown.md > ./test/fixtures/require_markdown.md.html 7 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/require.coffee > ./test/fixtures/require.coffee.html 8 | curl https://github.com/octo-linker/core/blob/master/test/fixtures/require.js > ./test/fixtures/require.js.html 9 | 10 | curl https://gist.github.com/petereberlecom/a61cb95f9b28270d86a9 > ./test/fixtures/gist.html 11 | curl https://github.com/octo-linker/core/issues/10 > ./test/fixtures/require_issues.html 12 | curl https://github.com/octo-linker/core/pull/9/files > ./test/fixtures/require_pull.html 13 | -------------------------------------------------------------------------------- /test/test_require_coffee.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('require.coffee', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('require.coffee', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.require; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(2); 23 | }); 24 | 25 | it('http://iojs.org/api/path.html', function() { 26 | var item = _.findWhere(this.result, { 27 | name: 'path' 28 | }); 29 | 30 | item.el.data('type').should.equal('npm'); 31 | item.el.data('value').should.equal('path'); 32 | }); 33 | 34 | it('https://github.com/lodash/lodash', function() { 35 | var item = _.findWhere(this.result, { 36 | name: 'lodash' 37 | }); 38 | 39 | item.el.data('type').should.equal('npm'); 40 | item.el.data('value').should.equal('lodash'); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /test/test_require_markdown_pull.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe.skip('require_markdown pull', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | this.$ = this.result = null; 13 | 14 | helper('require_markdown_pull', 'pull/8/files', function(_jquery, _result) { 15 | this.$ = _jquery; 16 | this.result = _result; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(1); 23 | }); 24 | 25 | it('check link replacement', function() { 26 | this.$('a.octo-linker').length.should.equal(1); 27 | }); 28 | 29 | it('https://github.com/lodash/lodash', function() { 30 | var item = _.findWhere(this.result, { 31 | name: 'lodash' 32 | }); 33 | 34 | item.link.should.equal('https://github.com/lodash/lodash'); 35 | 36 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 37 | item.el.hasClass('tooltipped').should.be.false; 38 | }); 39 | 40 | }); 41 | -------------------------------------------------------------------------------- /test/fixtures/composer.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "playground-repo", 4 | "description": "My personal playground", 5 | "version": "0.0.1", 6 | "type": "library", 7 | "keywords": [], 8 | "homepage": "https://github.com/stefanbuck/playground-repo", 9 | "time": "2014-09-19", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Stefan Buck", 14 | "email": "dev@stefanbuck.com", 15 | "homepage": "http://stefanbuck.com", 16 | "role": "Developer" 17 | } 18 | ], 19 | "support": { 20 | "email": "dev@stefanbuck.com", 21 | "irc": "irc://irc.freenode.org/composer" 22 | }, 23 | "require": { 24 | "php": ">=5.3.2", 25 | "laravel/framework": "~4.2", 26 | "unknown-package-name": "*" 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "~4.0", 30 | "doctrine/dbal": "~2.3" 31 | }, 32 | "conflict": {}, 33 | "replace": {}, 34 | "provide": {}, 35 | "suggest'": { 36 | "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", 37 | "doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var util = require('util'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var env = require('jsdom').env; 7 | var core = require('..'); 8 | 9 | module.exports = function(file, url, done) { 10 | var content, baseUrl, filePath; 11 | baseUrl = 'https://github.com/octo-linker/core/'; 12 | 13 | if (typeof url === 'function') { 14 | done = url; 15 | url = baseUrl + 'blob/master/test/fixtures/' + file; 16 | } 17 | 18 | if (process.env.TEST_ENV === 'remote') { 19 | content = url; 20 | console.log(' remote tests'); 21 | } else { 22 | console.log(' local tests'); 23 | filePath = util.format('./fixtures/%s.html', file); 24 | filePath = path.resolve(__dirname, filePath); 25 | content = fs.readFileSync(filePath, 'utf-8'); 26 | } 27 | 28 | env(content, function(err, window) { 29 | if (err) { 30 | return done(err); 31 | } 32 | global.$ = require('jquery')(window); 33 | 34 | if (process.env.TEST_ENV !== 'remote') { 35 | window.document.location.href = url; 36 | } 37 | 38 | var options = { 39 | showUpdateNotification: false, 40 | changelog: 'https://github.com/octo-linker/chrome-extension/releases', 41 | version: '4.0.0' 42 | }; 43 | 44 | core(window, options, done); 45 | }); 46 | }; 47 | -------------------------------------------------------------------------------- /test/test_require_es6.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('require.es6', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('require.es6', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.require; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(5); 23 | }); 24 | 25 | it('http://iojs.org/api/path.html', function() { 26 | var item = _.findWhere(this.result, { 27 | name: 'path' 28 | }); 29 | 30 | item.el.data('type').should.equal('npm'); 31 | item.el.data('value').should.equal('path'); 32 | }); 33 | 34 | it('https://github.com/lodash/lodash', function() { 35 | var item = _.findWhere(this.result, { 36 | name: 'lodash' 37 | }); 38 | 39 | item.el.data('type').should.equal('npm'); 40 | item.el.data('value').should.equal('lodash'); 41 | }); 42 | 43 | it('http://iojs.org/api/url.html', function() { 44 | var item = _.findWhere(this.result, { 45 | name: 'url' 46 | }); 47 | 48 | item.el.data('type').should.equal('npm'); 49 | item.el.data('value').should.equal('url'); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /test/test_require_pull.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe.skip('require pull', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | this.$ = this.result = null; 13 | 14 | helper('require_pull', 'pull/9/files', function(_jquery, _result) { 15 | this.$ = _jquery; 16 | this.result = _result; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | // TODO Evaluate why this doesn't work 23 | // result.should.have.length(2); 24 | this.result.length.should.equal(2); 25 | }); 26 | 27 | it('http://iojs.org/api/path.html', function() { 28 | var item = _.findWhere(this.result, { 29 | name: 'path' 30 | }); 31 | 32 | item.link.should.equal('http://iojs.org/api/path.html'); 33 | 34 | item.el.attr('href').should.equal('http://iojs.org/api/path.html'); 35 | item.el.hasClass('tooltipped').should.be.false; 36 | }); 37 | 38 | it('https://github.com/lodash/lodash', function() { 39 | var item = _.findWhere(this.result, { 40 | name: 'lodash' 41 | }); 42 | 43 | item.link.should.equal('https://github.com/lodash/lodash'); 44 | 45 | item.el.attr('href').should.equal('https://github.com/lodash/lodash'); 46 | item.el.hasClass('tooltipped').should.be.false; 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /lib/modules/require.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../util/util.js'); 4 | 5 | function supported(root, cb) { 6 | var isGist = !!root.$('.gist-content').length; 7 | var isRepo = !!root.$('.repository-content').length; 8 | 9 | if (isRepo || isGist) { 10 | return cb(null, true); 11 | } 12 | cb(null, false); 13 | } 14 | 15 | function init(root, options, cb) { 16 | var locationUrl = root.location.href; 17 | var $ = root.$; 18 | var $requires, $item, name; 19 | var $link; 20 | var result = []; 21 | 22 | // Search for require dom elements 23 | $requires = $('.pl-c1, .pl-k').filter(function() { 24 | return !!$(this).text().match(/(require|import|export)/); 25 | }).siblings('.pl-s'); 26 | 27 | $requires.each(function(index, item) { 28 | $item = $(item); 29 | 30 | name = utils.stripQuotes($item); 31 | 32 | $link = $(''); 33 | $link.data({ 34 | value: name, 35 | locationUrl: locationUrl, 36 | type: 'npm' 37 | }); 38 | 39 | $item = $item.wrap($link).parent(); 40 | 41 | result.push({ 42 | el: $item, 43 | name: name 44 | }); 45 | }); 46 | 47 | cb(null, result); 48 | } 49 | 50 | module.exports = function(root, options, cb) { 51 | supported(root, function(err, invoke) { 52 | if (err) { 53 | return cb(err); 54 | } 55 | if (!invoke) { 56 | return cb(null); 57 | } 58 | init(root, options, cb); 59 | }); 60 | }; 61 | -------------------------------------------------------------------------------- /test/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "playground-repo", 3 | "description": "My personal playground", 4 | "version": "0.0.1", 5 | "homepage": "https://github.com/stefanbuck/playground-repo", 6 | "bugs": "https://github.com/stefanbuck/playground-repo/issues", 7 | "license": "MIT", 8 | "directories": { 9 | "main": "./main", 10 | "bin": "./bin" 11 | }, 12 | "bin": "./index.js", 13 | "main": "index.js", 14 | "author": { 15 | "name": "Stefan Buck", 16 | "email": "dev@stefanbuck.com", 17 | "url": "http://stefanbuck.com" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/stefanbuck/playground-repo" 22 | }, 23 | "keywords": [], 24 | "dependencies": { 25 | "lodash": "2.4.1", 26 | "request": "^2.40.0", 27 | "modernizr": "Modernizr/Modernizr", 28 | "backbone": "jashkenas/backbone#master", 29 | "jquery": "jquery/jquery#1.x-master", 30 | "unknown-package-name": "latest" 31 | }, 32 | "devDependencies": { 33 | "chai": "^1.9.1", 34 | "gulp": "^3.6.2" 35 | }, 36 | "optionalDependencies": { 37 | "should": "^3.3.1" 38 | }, 39 | "peerDependencies": { 40 | "yo": ">=1.0.0" 41 | }, 42 | "scripts": { 43 | "coveralls": "gulp test && cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 44 | "test": "gulp test" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/test_require.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('require.js', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('require.js', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.require; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(23); 23 | }); 24 | 25 | it('check link replacement', function() { 26 | $('.octo-linker').length.should.equal(23); 27 | }); 28 | 29 | it('http://iojs.org/api/path.html', function() { 30 | var item = _.findWhere(this.result, { 31 | name: 'path' 32 | }); 33 | 34 | item.el.data('type').should.equal('npm'); 35 | item.el.data('value').should.equal('path'); 36 | }); 37 | 38 | it('https://github.com/lodash/lodash', function() { 39 | var item = _.findWhere(this.result, { 40 | name: 'lodash' 41 | }); 42 | 43 | item.el.data('type').should.equal('npm'); 44 | item.el.data('value').should.equal('lodash'); 45 | }); 46 | 47 | it('unknown-package-name', function() { 48 | var item = _.findWhere(this.result, { 49 | name: 'unknown-package-name' 50 | }); 51 | 52 | item.el.data('type').should.equal('npm'); 53 | item.el.data('value').should.equal('unknown-package-name'); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "octo-linker-core", 3 | "description": "The GitHub Linker core", 4 | "version": "1.9.3", 5 | "homepage": "https://github.com/octo-linker/core", 6 | "bugs": "https://github.com/octo-linker/core/issues", 7 | "license": "MIT", 8 | "main": "index.js", 9 | "author": { 10 | "name": "Stefan Buck", 11 | "email": "github@stefanbuck.com", 12 | "url": "http://stefanbuck.com" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/octo-linker/core" 17 | }, 18 | "keywords": [], 19 | "dependencies": { 20 | "async": "^1.4.2", 21 | "builtins": "^1.0.2", 22 | "github-injection": "^0.1.0", 23 | "octo-linker-resolver": "octo-linker/resolver", 24 | "jquery": "^2.1.1", 25 | "lodash": "2.4.1" 26 | }, 27 | "devDependencies": { 28 | "coveralls": "^2.11.1", 29 | "gulp": "^3.8.8", 30 | "gulp-bump": "^0.1.11", 31 | "gulp-istanbul": "^0.5.0", 32 | "gulp-jscs": "^1.1.2", 33 | "gulp-jshint": "^1.8.4", 34 | "gulp-load-plugins": "^0.6.0", 35 | "gulp-mocha": "^1.1.0", 36 | "gulp-plumber": "^0.6.5", 37 | "gulp-util": "^3.0.1", 38 | "jsdom": "^1.5.0", 39 | "jshint-stylish": "^0.4.0", 40 | "should": "^4.0.4", 41 | "sinon": "^1.16.1" 42 | }, 43 | "scripts": { 44 | "test": "npm run test-local && npm run test-remote && cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 45 | "test-local": "gulp test", 46 | "test-remote": "TEST_ENV='remote' gulp test", 47 | "update-fixtures": "./test/update_fixtures.sh" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'); 4 | var plugins = require('gulp-load-plugins')(); 5 | 6 | var paths = { 7 | lint: ['./gulpfile.js', './lib/**/*.js', './index.js'], 8 | watch: ['./gulpfile.js', './lib/**/*.js', './index.js', './test/**/*.js', '!test/{temp,temp/**}'], 9 | tests: ['./test/**/*.js', '!test/{temp,temp/**}', '!test/fixtures/**'], 10 | source: ['./lib/**/*.js', './index.js'] 11 | }; 12 | 13 | var plumberConf = {}; 14 | 15 | if (process.env.CI) { 16 | plumberConf.errorHandler = function(err) { 17 | throw err; 18 | }; 19 | } 20 | 21 | gulp.task('lint', function () { 22 | return gulp.src(paths.lint) 23 | .pipe(plugins.jshint('.jshintrc')) 24 | .pipe(plugins.plumber(plumberConf)) 25 | .pipe(plugins.jscs()) 26 | .pipe(plugins.jshint.reporter('jshint-stylish')); 27 | }); 28 | 29 | gulp.task('istanbul', function (cb) { 30 | gulp.src(paths.source) 31 | .pipe(plugins.istanbul()) // Covering files 32 | .pipe(plugins.istanbul.hookRequire()) // Force `require` to return covered files 33 | .on('finish', function () { 34 | gulp.src(paths.tests, {cwd: __dirname}) 35 | .pipe(plugins.plumber(plumberConf)) 36 | .pipe(plugins.mocha()) 37 | .pipe(plugins.istanbul.writeReports()) // Creating the reports after tests runned 38 | .on('finish', function() { 39 | process.chdir(__dirname); 40 | cb(); 41 | }); 42 | }); 43 | }); 44 | 45 | gulp.task('bump', ['test'], function () { 46 | var bumpType = plugins.util.env.type || 'patch'; // major.minor.patch 47 | 48 | return gulp.src(['./package.json']) 49 | .pipe(plugins.bump({ type: bumpType })) 50 | .pipe(gulp.dest('./')); 51 | }); 52 | 53 | gulp.task('watch', ['istanbul'], function () { 54 | gulp.watch(paths.watch, ['istanbul']); 55 | }); 56 | 57 | gulp.task('test', ['lint', 'istanbul']); 58 | 59 | gulp.task('release', ['bump']); 60 | 61 | gulp.task('default', ['test']); 62 | -------------------------------------------------------------------------------- /test/test_live-resover.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | var sinon = require('sinon'); 7 | 8 | describe('live-resolver.js', function() { 9 | this.timeout(4000); 10 | var openStub; 11 | 12 | before(function(done) { 13 | helper('require.js', function(err, _result) { 14 | if (err) { 15 | return done(err); 16 | } 17 | this.result = _result.require; 18 | openStub = sinon.stub(); 19 | global.open = openStub; 20 | done(); 21 | }.bind(this)); 22 | }); 23 | 24 | afterEach(function() { 25 | openStub.reset(); 26 | }); 27 | 28 | it('https://nodejs.org/api/path.html', function() { 29 | global.$.ajax = function () { 30 | var d = global.$.Deferred(); 31 | d.resolve(); 32 | return d.promise(); 33 | }; 34 | var item = _.findWhere(this.result, { 35 | name: 'path' 36 | }); 37 | 38 | $(item.el).click(); 39 | openStub.args[0][0].should.equal('https://nodejs.org/api/path.html'); 40 | }); 41 | 42 | it('https://www.npmjs.org/package/lodash', function() { 43 | global.$.ajax = function () { 44 | var d = global.$.Deferred(); 45 | d.reject({}); 46 | return d.promise(); 47 | }; 48 | var item = _.findWhere(this.result, { 49 | name: 'lodash' 50 | }); 51 | 52 | item.el.click(); 53 | openStub.args[0][0].should.equal('https://www.npmjs.org/package/lodash'); 54 | }); 55 | 56 | it('https://github.com/foo/lodash', function() { 57 | global.$.ajax = function () { 58 | var d = global.$.Deferred(); 59 | d.resolve({ 60 | url: 'https://github.com/foo/lodash' 61 | }); 62 | return d.promise(); 63 | }; 64 | var item = _.findWhere(this.result, { 65 | name: 'lodash' 66 | }); 67 | 68 | item.el.click(); 69 | openStub.args[0][0].should.equal('https://github.com/foo/lodash'); 70 | }); 71 | 72 | }); 73 | -------------------------------------------------------------------------------- /test/test_manifest_bower.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | // var registries = require('octo-linker-cache'); 7 | 8 | describe('bower.json', function() { 9 | 10 | this.timeout(4000); 11 | 12 | before(function(done) { 13 | helper('bower.json', function(err, _result) { 14 | if (err) { 15 | return done(err); 16 | } 17 | this.result = _result.manifest; 18 | done(); 19 | }.bind(this)); 20 | }); 21 | 22 | it('found dependencies', function() { 23 | this.result.length.should.equal(8); 24 | }); 25 | 26 | it('check order', function() { 27 | this.result.length.should.equal(8); 28 | var pkgNames = ['lodash', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'should', 'lodash']; 29 | _.each(this.result, function(item, index) { 30 | item.name.should.equal( pkgNames[index] ); 31 | }); 32 | }); 33 | 34 | it('check link replacement', function() { 35 | $('.octo-linker').length.should.equal(9); 36 | }); 37 | 38 | it('link https://github.com/lodash/lodash', function() { 39 | var item = _.findWhere(this.result, { 40 | name: 'lodash' 41 | }); 42 | 43 | item.el.data('type').should.equal('bower'); 44 | item.el.data('value').should.equal('lodash'); 45 | }); 46 | 47 | it('link https://github.com/Modernizr/Modernizr', function() { 48 | var item = _.findWhere(this.result, { 49 | name: 'modernizr' 50 | }); 51 | 52 | item.el.data('type').should.equal('bower'); 53 | item.el.data('value').should.equal('modernizr'); 54 | }); 55 | 56 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 57 | var item = _.findWhere(this.result, { 58 | name: 'backbone' 59 | }); 60 | 61 | item.el.data('type').should.equal('bower'); 62 | item.el.data('value').should.equal('backbone'); 63 | }); 64 | 65 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 66 | var item = _.findWhere(this.result, { 67 | name: 'jquery' 68 | }); 69 | 70 | item.el.data('type').should.equal('bower'); 71 | item.el.data('value').should.equal('jquery'); 72 | }); 73 | 74 | it('link http://bower.io/search/?q=unknown-package-name', function() { 75 | var item = _.findWhere(this.result, { 76 | name: 'unknown-package-name' 77 | }); 78 | 79 | item.el.data('type').should.equal('bower'); 80 | item.el.data('value').should.equal('unknown-package-name'); 81 | }); 82 | 83 | it('entry file', function() { 84 | $('.octo-linker[href="index.js"]').length.should.equal(1); 85 | }); 86 | }); 87 | -------------------------------------------------------------------------------- /test/test_utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../lib/util/util'); 4 | 5 | describe('util', function() { 6 | 7 | // describe('manifest.supported', function() { 8 | 9 | // it('package.json', function() { 10 | // manifest.supported('https://github.com/octo-linker/core/blob/master/package.json').should.equal(true); 11 | // }); 12 | 13 | // it('bower.json', function() { 14 | // manifest.supported('https://github.com/octo-linker/core/blob/master/bower.json').should.equal(true); 15 | // }); 16 | 17 | // it('composer.json', function() { 18 | // manifest.supported('https://github.com/octo-linker/core/blob/master/composer.json').should.equal(true); 19 | // }); 20 | 21 | // it('unknown.json', function() { 22 | // manifest.supported('https://github.com/octo-linker/core/blob/master/unknown.json').should.equal(false); 23 | // }); 24 | // }); 25 | 26 | // describe('require.supported', function() { 27 | 28 | // it('file.js', function() { 29 | // reqr.supported('https://github.com/octo-linker/core/blob/master/file.js').should.equal(true); 30 | // }); 31 | 32 | // it('file.coffee', function() { 33 | // reqr.supported('https://github.com/octo-linker/core/blob/master/file.coffee').should.equal(true); 34 | // }); 35 | 36 | // it('file.txt', function() { 37 | // reqr.supported('https://github.com/octo-linker/core/blob/master/file.txt').should.equal(false); 38 | // }); 39 | // }); 40 | 41 | // describe('advanced urls', function() { 42 | 43 | // it('with line marker', function() { 44 | // manifest.supported('https://github.com/octo-linker/core/blob/master/package.json#L1').should.equal(true); 45 | // reqr.supported('https://github.com/octo-linker/core/blob/master/file.js#L1').should.equal(true); 46 | // }); 47 | // }); 48 | 49 | describe('stripQuotes', function() { 50 | it('lodash', function() { 51 | utils.stripQuotes({text: function(){return 'lodash';}}).should.equal('lodash'); 52 | }); 53 | 54 | it('"lodash"', function() { 55 | utils.stripQuotes({text: function(){return '"lodash"';}}).should.equal('lodash'); 56 | }); 57 | 58 | it('\'lodash\'', function() { 59 | utils.stripQuotes({text: function(){return '\'lodash\'';}}).should.equal('lodash'); 60 | }); 61 | 62 | it('"lodash\'', function() { 63 | utils.stripQuotes({text: function(){return '"lodash\'';}}).should.equal('lodash'); 64 | }); 65 | 66 | it(' lodash ', function() { 67 | utils.stripQuotes({text: function(){return ' lodash ';}}).should.equal('lodash'); 68 | }); 69 | }); 70 | 71 | // TODO implement test for 72 | describe('urlMatch', function() {}); 73 | describe('showLoader', function() {}); 74 | }); 75 | -------------------------------------------------------------------------------- /test/test_manifest_composer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('composer.json', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('composer.json', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.manifest; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(7); 23 | }); 24 | 25 | it('check order', function() { 26 | this.result.length.should.equal(7); 27 | var pkgNames = ['php', 'laravel/framework', 'unknown-package-name', 'phpunit/phpunit', 'doctrine/dbal', 'ext-openssl', 'doctrine/dbal']; 28 | _.each(this.result, function(item, index) { 29 | item.name.should.equal( pkgNames[index] ); 30 | }); 31 | }); 32 | 33 | it('check link replacement', function() { 34 | $('.octo-linker').length.should.equal(7); 35 | }); 36 | 37 | describe('require', function() { 38 | 39 | it('link php', function() { 40 | var item = _.findWhere(this.result, { 41 | name: 'php' 42 | }); 43 | 44 | item.el.data('type').should.equal('composer'); 45 | item.el.data('value').should.equal('php'); 46 | }); 47 | 48 | it('link laravel/framework', function() { 49 | var item = _.findWhere(this.result, { 50 | name: 'laravel/framework' 51 | }); 52 | 53 | item.el.data('type').should.equal('composer'); 54 | item.el.data('value').should.equal('laravel/framework'); 55 | }); 56 | 57 | it('link unknown-package-name', function() { 58 | var item = _.findWhere(this.result, { 59 | name: 'unknown-package-name' 60 | }); 61 | 62 | item.el.data('type').should.equal('composer'); 63 | item.el.data('value').should.equal('unknown-package-name'); 64 | }); 65 | }); 66 | 67 | describe('require-dev', function() { 68 | 69 | it('link phpunit/phpunit', function() { 70 | var item = _.findWhere(this.result, { 71 | name: 'phpunit/phpunit' 72 | }); 73 | 74 | item.el.data('type').should.equal('composer'); 75 | item.el.data('value').should.equal('phpunit/phpunit'); 76 | }); 77 | 78 | it('link doctrine/dbal', function() { 79 | var item = _.findWhere(this.result, { 80 | name: 'doctrine/dbal' 81 | }); 82 | 83 | item.el.data('type').should.equal('composer'); 84 | item.el.data('value').should.equal('doctrine/dbal'); 85 | }); 86 | }); 87 | 88 | describe('suggest', function() { 89 | 90 | it('link ext-openssl', function() { 91 | var item = _.findWhere(this.result, { 92 | name: 'ext-openssl' 93 | }); 94 | 95 | item.el.data('type').should.equal('composer'); 96 | item.el.data('value').should.equal('ext-openssl'); 97 | }); 98 | 99 | it('doctrine/dbal', function() { 100 | var item = this.result[this.result.length - 1]; 101 | 102 | item.el.data('type').should.equal('composer'); 103 | item.el.data('value').should.equal('doctrine/dbal'); 104 | }); 105 | }); 106 | }); 107 | -------------------------------------------------------------------------------- /test/test_manifest_package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var assert = require('should'); 4 | var _ = require('lodash'); 5 | var helper = require('./helper'); 6 | 7 | describe('package.json', function() { 8 | 9 | this.timeout(4000); 10 | 11 | before(function(done) { 12 | helper('package.json', function(err, _result) { 13 | if (err) { 14 | return done(err); 15 | } 16 | this.result = _result.manifest; 17 | done(); 18 | }.bind(this)); 19 | }); 20 | 21 | it('found dependencies', function() { 22 | this.result.length.should.equal(10); 23 | }); 24 | 25 | it('check order', function() { 26 | this.result.length.should.equal(10); 27 | var pkgNames = ['lodash', 'request', 'modernizr', 'backbone', 'jquery', 'unknown-package-name', 'chai', 'gulp', 'yo', 'should']; 28 | _.each(this.result, function(item, index) { 29 | item.name.should.equal( pkgNames[index] ); 30 | }); 31 | }); 32 | 33 | it('check link replacement', function() { 34 | $('.octo-linker').length.should.equal(14); 35 | }); 36 | 37 | it('link https://github.com/lodash/lodash', function() { 38 | var item = _.findWhere(this.result, { 39 | name: 'lodash' 40 | }); 41 | 42 | item.el.data('type').should.equal('npm'); 43 | item.el.data('value').should.equal('lodash'); 44 | }); 45 | 46 | it('link https://www.npmjs.org/package/request', function() { 47 | var item = _.findWhere(this.result, { 48 | name: 'request' 49 | }); 50 | 51 | item.el.data('type').should.equal('npm'); 52 | item.el.data('value').should.equal('request'); 53 | }); 54 | 55 | it('link https://github.com/Modernizr/Modernizr', function() { 56 | var item = _.findWhere(this.result, { 57 | name: 'modernizr' 58 | }); 59 | 60 | item.el.data('type').should.equal('npm'); 61 | item.el.data('value').should.equal('modernizr'); 62 | }); 63 | 64 | it('link https://github.com/jashkenas/backbone/tree/master', function() { 65 | var item = _.findWhere(this.result, { 66 | name: 'backbone' 67 | }); 68 | 69 | item.el.data('type').should.equal('npm'); 70 | item.el.data('value').should.equal('backbone'); 71 | }); 72 | 73 | it('link https://github.com/jquery/jquery/tree/1.x-master', function() { 74 | var item = _.findWhere(this.result, { 75 | name: 'jquery' 76 | }); 77 | 78 | item.el.data('type').should.equal('npm'); 79 | item.el.data('value').should.equal('jquery'); 80 | }); 81 | 82 | it('link https://www.npmjs.org/package/unknown-package-name', function() { 83 | var item = _.findWhere(this.result, { 84 | name: 'unknown-package-name' 85 | }); 86 | 87 | item.el.data('type').should.equal('npm'); 88 | item.el.data('value').should.equal('unknown-package-name'); 89 | }); 90 | 91 | it('link directories', function() { 92 | $('.octo-linker[href="./main"]').length.should.equal(1); 93 | $('.octo-linker[href="./bin"]').length.should.equal(1); 94 | }); 95 | 96 | it('entry file', function() { 97 | $('.octo-linker[href="index.js"]').length.should.equal(1); 98 | }); 99 | 100 | it('bin file', function() { 101 | $('.octo-linker[href="./index.js"]').length.should.equal(1); 102 | }); 103 | }); 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### This repository will be merged with [chrome-extension ](https://github.com/octo-linker/chrome-extension) repository soon! 2 | 3 | So please, **open new issues only** [there](https://github.com/octo-linker/chrome-extension/issues)! Thank you. 4 | 5 | # Octo-Linker Core 6 | [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image] [![Coverage Status][coveralls-image]][coveralls-url] 7 | 8 | 9 | This browserify friendly npm module contains everything what the Octo-Linker needs to work. Currently the core is only used by the Octo-Linker [Chrome Extension](https://github.com/octo-linker/chrome-extension). It would be possible to create other Octo-Linker extensions for another browser as well. But this is currently out of scope. By the way, contributes are welcome. Get in touch with me! 10 | 11 | ## Features 12 | 13 | > GitHub.com is constantly under development and therefore, sometimes some features doesn't work. Feel free to open an issue so I can solve it as soon as possible. Thank you. 14 | 15 | 16 | ### Manifest files 17 | 18 | 19 | 20 | Replace dependencies listed in `package.json` `bower.json` or `composer.json` with the related GitHub repository. In this case, you will redirected to https://github.com/sindresorhus/chalk 21 | 22 | ![List prompt](https://dl.dropboxusercontent.com/s/m7bicvnyf4kf37i/manifest_package.png) 23 | 24 | 25 | 26 | It's also possible to click these attributes `main`, `bin` and `directories` in a manifest file to jump to the target file. In this case, you will redirected to https://github.com/yeoman/environment/blob/master/lib/environment.js 27 | 28 | ![List prompt](https://dl.dropboxusercontent.com/s/ph8ap6mkft47l10/manifest_entry.png) 29 | 30 | 31 | 32 | ### Require 33 | 34 | > This feature is not supported on any GitHub page, because it's unfortunately not possible everywhere. 35 | 36 | 37 | This is one of the key features in the GitHub-Linker. It allows you to jump directly to the GitHub repository page of the named package. In this case, you will redirected to https://github.com/sindresorhus/chalk 38 | 39 | ![List prompt](https://dl.dropboxusercontent.com/s/a50aypabfs814ma/require_package.png) 40 | 41 | 42 | 43 | It can handle locale require statements as well. 44 | 45 | ![List prompt](https://dl.dropboxusercontent.com/s/sqpxbrg2dh8ngq5/require_relative.png) 46 | 47 | 48 | 49 | Also relative require statements. 50 | 51 | ![List prompt](https://dl.dropboxusercontent.com/s/tbhbeo98ejsvekt/require_relative1.png) 52 | 53 | 54 | 55 | ## Usage 56 | 57 | 58 | ```javascript 59 | var core = require('octo-linker-core'); 60 | var $ = require('jquery'); 61 | 62 | var options = { 63 | showUpdateNotification: true, 64 | changelog: 'https://github.com/octo-linker/chrome-extension/releases', 65 | version: '1.0.0' 66 | }; 67 | 68 | core(window, options, function(err, result) { 69 | if (err) { 70 | return console.error(err); 71 | } 72 | console.log(result); 73 | }); 74 | 75 | ``` 76 | 77 | 78 | 79 | ## License 80 | 81 | Copyright (c) 2015 Stefan Buck. Licensed under the MIT license. 82 | 83 | 84 | 85 | [travis-url]: https://travis-ci.org/octo-linker/core 86 | [travis-image]: https://travis-ci.org/octo-linker/core.svg?branch=master 87 | [daviddm-url]: https://david-dm.org/octo-linker/core.svg?theme=shields.io 88 | [daviddm-image]: https://david-dm.org/octo-linker/core 89 | [coveralls-url]: https://coveralls.io/r/octo-linker/core 90 | [coveralls-image]: https://coveralls.io/repos/octo-linker/core/badge.png 91 | -------------------------------------------------------------------------------- /lib/live-resolver/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var util = require('util'); 5 | var utils = require('../util/util.js'); 6 | var builtins = require('builtins'); 7 | var glResolve = require('octo-resolver'); 8 | 9 | var LIVE_RESOLVER = 'https://githublinker.herokuapp.com/q/%s/%s'; 10 | var NODEJS_API = 'https://nodejs.org/api/%s.html'; 11 | var NPM_API = 'https://www.npmjs.org/package/%s'; 12 | 13 | var SORRY = 'Can\'t resolve this require for you, sorry.'; 14 | var LOADING = 'Loading ...'; 15 | var RESOLVED = 'Redirecting ...'; 16 | 17 | function loader(urls, options, cb) { 18 | options = options || {}; 19 | options.type = options.type || 'GET'; 20 | if (typeof urls === 'string') { 21 | urls = [urls]; 22 | } 23 | var url = urls.shift(); 24 | 25 | $.ajax({ 26 | type: options.type, 27 | url: url} 28 | ).then(function(body) { 29 | cb(null, body, url); 30 | }).fail(function(xhr) { 31 | if (urls.length) { 32 | return loader(urls, options, cb); 33 | } 34 | cb(xhr); 35 | }); 36 | } 37 | 38 | var getType = function(url) { 39 | var lookup = { 40 | '.js': ['js', 'es6', 'jsx'], 41 | '.jsx': ['js', 'es6', 'jsx'], 42 | '.es6': ['js', 'es6', 'jsx'], 43 | '.coffee': ['coffee'] 44 | }; 45 | return utils.urlMatch(url, lookup); 46 | }; 47 | 48 | function openUrl(url, newWindow) { 49 | var target = '_self'; 50 | if (newWindow) { 51 | target = '_blank'; 52 | } 53 | global.open(url, target); 54 | } 55 | 56 | function clickHandler(e) { 57 | var newWindow = (e.metaKey || e.ctrlKey || e.which === 2); 58 | var $target = $(e.currentTarget); 59 | var data = $target.data(); 60 | if (data.type) { 61 | if (!$target.hasClass('tooltipped')) { 62 | $target.addClass('tooltipped tooltipped-e'); 63 | } 64 | $target.attr('aria-label', LOADING); 65 | 66 | // Redirect to nodejs api 67 | if (data.type === 'npm' && builtins.indexOf(data.value) > -1) { 68 | // https://nodejs.org/api/modules.html, not https://nodejs.org/api/module.html 69 | if (data.value === 'module') { 70 | data.value = 'modules'; 71 | } 72 | return openUrl(util.format(NODEJS_API, data.value), newWindow); 73 | } 74 | 75 | if (data.value === '.' || data.value.indexOf('...') === 0) { 76 | return $target.attr('aria-label', SORRY); 77 | } 78 | 79 | // Get url from static informations 80 | var resolveResult = glResolve(data.value, data.locationUrl); 81 | if (resolveResult) { 82 | var urls = []; 83 | 84 | var fileExtensions = getType(data.locationUrl); 85 | 86 | if (fileExtensions && resolveResult.indexOf('https://github.com') === 0) { 87 | if (!path.extname(resolveResult)) { 88 | fileExtensions.forEach(function(ext){ 89 | urls.push(resolveResult + '.' + ext); 90 | }); 91 | } 92 | fileExtensions.forEach(function(ext){ 93 | urls = urls.concat([ 94 | resolveResult + '/index.' + ext, 95 | resolveResult.replace('blob', 'tree') 96 | ]); 97 | }); 98 | } else { 99 | urls.push(resolveResult); 100 | } 101 | 102 | return loader(urls, {type: 'HEAD'}, function(err, body, url) { 103 | if (err) { 104 | $target.attr('aria-label', SORRY); 105 | return; 106 | } 107 | $target.attr('aria-label', RESOLVED); 108 | openUrl(url, newWindow); 109 | }); 110 | } 111 | 112 | loader(util.format(LIVE_RESOLVER, data.type, data.value), {type: 'GET'}, function(err, body) { 113 | if (err) { 114 | if (data.type === 'npm') { 115 | return openUrl(util.format(NPM_API, data.value), newWindow); 116 | } 117 | $target.attr('aria-label', SORRY); 118 | } 119 | 120 | if (body.url) { 121 | $target.attr('aria-label', RESOLVED); 122 | return openUrl(body.url, newWindow); 123 | } 124 | 125 | $target.attr('aria-label', SORRY); 126 | }); 127 | } 128 | } 129 | 130 | module.exports = function() { 131 | $('body').undelegate('.octo-linker', 'click', clickHandler); 132 | $('body').delegate('.octo-linker', 'click', clickHandler); 133 | }; 134 | -------------------------------------------------------------------------------- /lib/modules/manifest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../util/util.js'); 4 | 5 | var getType = function(url) { 6 | var lookup = { 7 | '/package.json': 'npm', 8 | '/bower.json': 'bower', 9 | '/composer.json': 'composer' 10 | }; 11 | return utils.urlMatch(url, lookup); 12 | }; 13 | 14 | var getRootElement = function($, content) { 15 | return $('span.pl-s').filter(function(){ 16 | var $el = $(this); 17 | return utils.stripQuotes($el) === content && $el.index() === 0; 18 | }); 19 | }; 20 | 21 | var valueToLink = function($, content) { 22 | var $el = getRootElement($, content); 23 | 24 | if ($el && $el.length > 0) { 25 | $el = $el.next('*:not(".octo-linker")'); 26 | 27 | if ($el && $el.length > 0) { 28 | var entryFile = utils.stripQuotes($el); 29 | if (entryFile) { 30 | $el.wrap(''); 31 | } 32 | } 33 | } 34 | }; 35 | 36 | var mainField = function($, type) { 37 | if (type === 'npm' || type === 'bower') { 38 | valueToLink($, 'main'); 39 | } 40 | }; 41 | 42 | var binField = function($, type) { 43 | if (type === 'npm') { 44 | valueToLink($, 'bin'); 45 | } 46 | }; 47 | 48 | var directoriesField = function($) { 49 | var $dirname, $dir; 50 | var $directories = getRootElement($, 'directories'); 51 | 52 | if ($directories && $directories.length > 0) { 53 | $dirname = $directories.closest('tr').next(); 54 | 55 | while ($dirname) { 56 | $dir = $dirname.find('.pl-s').eq(1); 57 | if (!$dir || !$dir.length) { 58 | return; 59 | } 60 | var entryFile = utils.stripQuotes($dir); 61 | if (entryFile) { 62 | $dir.wrap(''); 63 | } 64 | 65 | $dirname = $dirname.next(); 66 | } 67 | } 68 | }; 69 | 70 | var dependencieField = function(root, type) { 71 | var $root, $row, $item, $version, name, version; 72 | var selectors = []; 73 | var $link; 74 | var $ = root.$; 75 | var locationUrl = root.location.href; 76 | 77 | if (type === 'npm') { 78 | selectors = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']; 79 | } else if (type === 'bower') { 80 | selectors = ['dependencies', 'devDependencies', 'resolutions']; 81 | } else if (type === 'composer') { 82 | selectors = ['require', 'require-dev', 'conflict', 'replace', 'provide', 'suggest']; 83 | } 84 | 85 | var result = []; 86 | 87 | selectors.forEach(function(selector) { 88 | $root = getRootElement($, selector); 89 | 90 | if (!$root || $root.length === 0) { 91 | return; 92 | } 93 | 94 | $row = $root.closest('tr').next(); 95 | 96 | while ($row) { 97 | $item = $row.find('.pl-s').eq(0); 98 | $version = $row.find('.pl-s').eq(1); 99 | 100 | if (!$item.length || !$version.length) { 101 | return; 102 | } 103 | 104 | name = utils.stripQuotes($item); 105 | version = utils.stripQuotes($version); 106 | 107 | $link = $(''); 108 | $link.data({ 109 | value: name, 110 | locationUrl: locationUrl, 111 | version: version, 112 | type: type 113 | }); 114 | 115 | $item = $item.wrap($link).parent(); 116 | 117 | result.push({ 118 | el: $item, 119 | version: version, 120 | name: name 121 | }); 122 | 123 | $row = $row.next(); 124 | } 125 | }); 126 | return result; 127 | }; 128 | 129 | function supported(root, cb) { 130 | cb(null, !!getType(root.location.href)); 131 | } 132 | 133 | function init(root, options, cb) { 134 | var url = root.location.href; 135 | var $ = root.$; 136 | 137 | var type = getType(url); 138 | if (type === 'npm') { 139 | directoriesField($); 140 | } 141 | var result = dependencieField(root, type); 142 | // put them below dependencieField to avoid conflict 143 | mainField($, type); 144 | binField($, type); 145 | 146 | cb(null, result); 147 | } 148 | 149 | module.exports = function(root, options, cb) { 150 | supported(root, function(err, invoke) { 151 | if (err) { 152 | return cb(err); 153 | } 154 | if (!invoke) { 155 | return cb(null); 156 | } 157 | init(root, options, cb); 158 | }); 159 | }; 160 | -------------------------------------------------------------------------------- /test/fixtures/gist.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | gist:a61cb95f9b28270d86a9 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 40 | 41 |
42 | 43 | 44 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 |
80 |
81 |
82 |
    83 | 84 |
85 |

86 |
87 |
88 | 89 | 90 | petereberlecom 91 | / 92 | gist:a61cb95f9b28270d86a9 93 |
94 |
95 | Created 96 |
97 |

98 | 99 |
100 | 101 |
102 |
103 | 104 | 105 |
106 |
110 | 111 |
112 |
113 |
114 | 130 |
131 |
132 | 133 |
134 | 135 |
136 |

Embed URL

137 |
138 | 139 | 140 | 141 | 142 |
143 |
144 |

145 | 146 | 147 |
148 |

HTTPS clone URL

149 |
150 | 151 | 152 | 153 | 154 |
155 |
156 | 157 | 158 |
159 |

SSH clone URL

160 |
161 | 162 | 163 | 164 | 165 |
166 |
167 | 168 | 169 |

You can clone with 170 | HTTPS 171 | or SSH. 172 |

173 | 174 | 175 | 176 | 177 | Download Gist 178 |
179 | 180 |
181 | 182 | 183 |
184 | 185 |
186 |
187 | 188 | View gist:a61cb95f9b28270d86a9 189 | 190 |
191 |
192 | 193 | 194 | 195 | 196 |
197 |
198 |
199 | Raw 202 |
203 |
204 |
205 | 208 |
209 | 210 | 211 | 212 | 213 |
214 | 215 | 216 | 219 | 223 | 224 |
217 | 1 218 | 220 |
require('octo-linker-core'); 221 |
222 |
225 |
226 | 227 |
228 |
229 | 230 | 231 |
232 | 233 |
234 | 235 |
236 | 237 |
238 |
239 | Sign up for free 240 | to join this conversation on GitHub. 241 | Already have an account? 242 | Sign in to comment 243 |
244 | 245 | 246 |
247 |
248 |
249 |
250 |
251 |
252 | 253 |
254 |
255 | 256 |
257 |
258 |
259 | 260 |
261 |
262 | 263 | Something went wrong with that request. Please try again. 264 | 265 |
266 |
267 | 268 | 269 | 295 | 296 |
297 |
298 |
299 | 300 |
301 |
303 |
304 |
305 |
306 |
307 | 316 |
317 | 318 | 319 | 320 | 321 | -------------------------------------------------------------------------------- /test/fixtures/require_markdown.md.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | core/require_markdown.md at master · octo-linker/core · GitHub 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Skip to content 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 116 | 117 | 118 | 119 |
120 |
121 |
122 | 123 |
124 |
125 |
126 | 127 | 168 | 169 |

170 | 171 | /core 174 | 175 | 176 | 177 | 178 | 179 |

180 |
181 |
182 | 183 |
184 |
185 |
186 | 187 | 232 | 233 |
234 | 235 |
238 |

HTTPS clone URL

239 |
240 | 242 | 243 | 244 | 245 |
246 |
247 | 248 | 249 |
252 |

Subversion checkout URL

253 |
254 | 256 | 257 | 258 | 259 |
260 |
261 | 262 | 263 | 264 |

You can clone with 265 | HTTPS or Subversion. 266 | 267 | 268 | 269 |

270 | 271 | 272 | 273 | 278 | 279 | Download ZIP 280 | 281 |
282 |
283 | 284 |
285 | 286 | 287 | 288 | 289 | 290 | 291 |
292 | 293 |
294 | 299 | 300 | branch: 301 | master 302 | 303 | 304 | 441 |
442 | 443 |
444 | 449 | 450 | 451 | 452 |
453 | 454 | 457 |
458 | 459 | 460 |
461 |
462 | @stefanbuck 463 | stefanbuck 464 | 465 |
466 | fix require md test 467 |
468 |
469 | 470 |
471 |

472 | 473 | 1 474 | contributor 475 | 476 |

477 | 478 |
479 | 488 |
489 | 490 |
491 |
492 |
493 | 494 |
495 | Raw 496 | Blame 497 | History 498 |
499 | 500 | 501 | 504 | 505 | 508 |
509 | 510 |
511 | 5 lines (3 sloc) 512 | 513 | 0.03 kb 514 |
515 |
516 |
517 |
require('lodash');
518 |
519 |
520 | 521 |
522 | 523 | Jump to Line 524 | 530 | 531 |
532 | 533 |
534 | 535 |
536 |
537 | 538 | 539 |
540 | 541 |
542 | 564 |
565 | 566 | 567 |
568 |
569 |
570 | 571 |
572 |
573 |
574 |
575 |
576 | 585 |
586 | 587 | 588 | 589 | 590 | 591 | 592 |
593 | 594 | 595 | Something went wrong with that request. Please try again. 596 |
597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | -------------------------------------------------------------------------------- /test/fixtures/require.coffee.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | core/require.coffee at master · octo-linker/core · GitHub 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Skip to content 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 116 | 117 | 118 | 119 |
120 |
121 |
122 | 123 |
124 |
125 |
126 | 127 | 168 | 169 |

170 | 171 | /core 174 | 175 | 176 | 177 | 178 | 179 |

180 |
181 |
182 | 183 |
184 |
185 |
186 | 187 | 232 | 233 |
234 | 235 |
238 |

HTTPS clone URL

239 |
240 | 242 | 243 | 244 | 245 |
246 |
247 | 248 | 249 |
252 |

Subversion checkout URL

253 |
254 | 256 | 257 | 258 | 259 |
260 |
261 | 262 | 263 | 264 |

You can clone with 265 | HTTPS or Subversion. 266 | 267 | 268 | 269 |

270 | 271 | 272 | 273 | 278 | 279 | Download ZIP 280 | 281 |
282 |
283 | 284 |
285 | 286 | 287 | 288 | 289 | 290 | 291 |
292 | 293 |
294 | 299 | 300 | branch: 301 | master 302 | 303 | 304 | 441 |
442 | 443 |
444 | 449 | 450 | 451 | 452 |
453 | 454 | 457 |
458 | 459 | 460 |
461 |
462 | @stefanbuck 463 | stefanbuck 464 | 465 |
466 | fix coffee test 467 |
468 |
469 | 470 |
471 |

472 | 473 | 1 474 | contributor 475 | 476 |

477 | 478 |
479 | 488 |
489 | 490 |
491 |
492 |
493 | 494 |
495 | Raw 496 | Blame 497 | History 498 |
499 | 500 | 501 | 504 | 505 | 508 |
509 | 510 |
511 | 3 lines (2 sloc) 512 | 513 | 0.042 kb 514 |
515 |
516 | 517 |
518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 |
require "path"
lodash = require("lodash")
528 | 529 |
530 | 531 |
532 | 533 | Jump to Line 534 | 540 | 541 |
542 | 543 |
544 | 545 |
546 |
547 | 548 | 549 |
550 | 551 |
552 | 574 |
575 | 576 | 577 |
578 |
579 |
580 | 581 |
582 |
583 |
584 |
585 |
586 | 595 |
596 | 597 | 598 | 599 | 600 | 601 | 602 |
603 | 604 | 605 | Something went wrong with that request. Please try again. 606 |
607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | -------------------------------------------------------------------------------- /test/fixtures/require.es6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | core/require.es6 at master · octo-linker/core · GitHub 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Skip to content 74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 128 | 129 | 130 | 131 |
132 |
133 |
134 | 135 |
136 |
137 |
138 | 139 | 140 | 181 | 182 |

183 | 184 | /core 187 | 188 | 189 | 190 | 191 | 192 |

193 |
194 |
195 | 196 |
197 |
198 |
199 | 200 | 244 | 245 |
246 | 247 |
249 |

HTTPS clone URL

250 |
251 | 253 | 254 | 255 | 256 |
257 |
258 | 259 | 260 |
262 |

Subversion checkout URL

263 |
264 | 266 | 267 | 268 | 269 |
270 |
271 | 272 | 273 | 274 |
You can clone with 275 |
or
. 276 | 277 | 278 | 279 |
280 | 281 | 282 | 283 | Clone in Desktop 284 | 285 | 286 | 287 | 288 | 293 | 294 | Download ZIP 295 | 296 |
297 |
298 | 299 |
300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 |
308 | 309 |
310 | 314 | 315 | branch: 316 | master 317 | 318 | 319 | 465 |
466 | 467 |
468 | 473 | 474 | 475 | 476 |
477 | 478 | 481 |
482 | 483 | 484 |
485 |
486 | @eligolding 487 | eligolding 488 | 489 |
490 | Tests for es6 491 |
492 |
493 | 494 |
495 |

496 | 497 | 1 498 | contributor 499 | 500 |

501 | 502 |
503 | 512 |
513 | 514 |
515 |
516 |
517 | 518 |
519 | Raw 520 | Blame 521 | History 522 |
523 | 524 | 528 | 529 | 530 | 531 | 534 | 535 | 538 |
539 | 540 |
541 | 5 lines (4 sloc) 542 | 543 | 0.116 kB 544 |
545 |
546 | 547 | 548 |
549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 |
import "path";
import lodash from "lodash";
import * as dash from "lodash";
import exp, {pick, omit} from "lodash";
export*from "url"
571 | 572 |
573 | 574 |
575 | 576 | Jump to Line 577 | 582 | 583 |
584 | 585 |
586 | 587 |
588 |
589 | 590 | 591 |
592 | 593 |
594 | 617 |
618 | 619 | 620 |
621 |
622 |
623 | 624 |
625 |
626 |
627 |
628 |
629 | 638 |
639 | 640 | 641 | 642 | 643 | 644 | 645 |
646 | 647 | 648 | Something went wrong with that request. Please try again. 649 |
650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | -------------------------------------------------------------------------------- /test/fixtures/require.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | core/require.js at master · octo-linker/core · GitHub 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Skip to content 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 116 | 117 | 118 | 119 |
120 |
121 |
122 | 123 |
124 |
125 |
126 | 127 | 168 | 169 |

170 | 171 | /core 174 | 175 | 176 | 177 | 178 | 179 |

180 |
181 |
182 | 183 |
184 |
185 |
186 | 187 | 232 | 233 |
234 | 235 |
238 |

HTTPS clone URL

239 |
240 | 242 | 243 | 244 | 245 |
246 |
247 | 248 | 249 |
252 |

Subversion checkout URL

253 |
254 | 256 | 257 | 258 | 259 |
260 |
261 | 262 | 263 | 264 |

You can clone with 265 | HTTPS or Subversion. 266 | 267 | 268 | 269 |

270 | 271 | 272 | 273 | 278 | 279 | Download ZIP 280 | 281 |
282 |
283 | 284 |
285 | 286 | 287 | 288 | 289 | 290 | 291 |
292 | 293 |
294 | 299 | 300 | branch: 301 | master 302 | 303 | 304 | 441 |
442 | 443 |
444 | 449 | 450 | 451 | 452 |
453 | 454 | 457 |
458 | 459 | 460 |
461 |
462 | @stefanbuck 463 | stefanbuck 464 | 465 | 468 |
469 | 470 |
471 |

472 | 473 | 1 474 | contributor 475 | 476 |

477 | 478 |
479 | 488 |
489 | 490 |
491 |
492 |
493 | 494 |
495 | Raw 496 | Blame 497 | History 498 |
499 | 500 | 501 | 504 | 505 | 508 |
509 | 510 |
511 | 25 lines (23 sloc) 512 | 513 | 0.561 kb 514 |
515 |
516 | 517 |
518 | 519 | 520 | 521 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 |
522 |
require('path');
require('lodash');
require('unknown-package-name');
require('./file.js');
require('./folder/file.js');
require('./file-or-folder');
require('../file.js');
require('../folder/file.js');
require('../file-or-folder');
require('../../file.js');
require('../../folder/file.js');
require('../../file-or-folder');
require('./');
require('..');
require('../');
require('../..');
require('../../');
require('.');
require('...');
require('/');
require('matthewmueller/uid');
require('component/tip@master');
require('yields/shortcuts@0.0.1:/index.js');
617 | 618 |
619 | 620 |
621 | 622 | Jump to Line 623 | 629 | 630 |
631 | 632 |
633 | 634 |
635 |
636 | 637 | 638 |
639 | 640 |
641 | 663 |
664 | 665 | 666 |
667 |
668 |
669 | 670 |
671 |
672 |
673 |
674 |
675 | 684 |
685 | 686 | 687 | 688 | 689 | 690 | 691 |
692 | 693 | 694 | Something went wrong with that request. Please try again. 695 |
696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | --------------------------------------------------------------------------------