Skip to content

Commit a2348df

Browse files
author
Stefan Buck
committed
Update all other plugins
1 parent 8ab1ed1 commit a2348df

File tree

33 files changed

+114
-126
lines changed

33 files changed

+114
-126
lines changed

packages/plugin-css/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import relativeFile from '@octolinker/resolver-relative-file';
44
export default {
55
name: 'CSS',
66

7-
resolve({ target, path }) {
7+
resolve(path, [target]) {
88
return [relativeFile({ path, target })];
99
},
1010

packages/plugin-docker/__tests__/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,34 @@ import assert from 'assert';
22
import dockerImage from '../index';
33

44
describe('docker-image', () => {
5+
const path = '/blob/path/dummy';
6+
57
it('resolves foo to https://hub.docker.com/_/foo', () => {
6-
assert.deepEqual(dockerImage.resolve({ target: 'foo' }), [
8+
assert.deepEqual(dockerImage.resolve(path, ['foo']), [
79
'https://hub.docker.com/_/foo',
810
]);
911
});
1012

1113
it('resolves foo:1.2.3 to https://hub.docker.com/_/foo', () => {
12-
assert.deepEqual(dockerImage.resolve({ target: 'foo:1.2.3' }), [
14+
assert.deepEqual(dockerImage.resolve(path, ['foo:1.2.3']), [
1315
'https://hub.docker.com/_/foo',
1416
]);
1517
});
1618

1719
it('resolves foo:1.2.3-alpha to https://hub.docker.com/_/foo', () => {
18-
assert.deepEqual(dockerImage.resolve({ target: 'foo:1.2.3-alpha' }), [
20+
assert.deepEqual(dockerImage.resolve(path, ['foo:1.2.3-alpha']), [
1921
'https://hub.docker.com/_/foo',
2022
]);
2123
});
2224

2325
it('resolves foo/bar to https://hub.docker.com/r/foo/bar', () => {
24-
assert.deepEqual(dockerImage.resolve({ target: 'foo/bar' }), [
26+
assert.deepEqual(dockerImage.resolve(path, ['foo/bar']), [
2527
'https://hub.docker.com/r/foo/bar',
2628
]);
2729
});
2830

2931
it('resolves foo/bar:1.2.3 to https://hub.docker.com/r/foo/bar', () => {
30-
assert.deepEqual(dockerImage.resolve({ target: 'foo/bar:1.2.3' }), [
32+
assert.deepEqual(dockerImage.resolve(path, ['foo/bar:1.2.3']), [
3133
'https://hub.docker.com/r/foo/bar',
3234
]);
3335
});

packages/plugin-docker/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DOCKER_FROM } from '@octolinker/helper-grammar-regex-collection';
33
export default {
44
name: 'Docker',
55

6-
resolve({ target }) {
6+
resolve(path, [target]) {
77
let isOffical = true;
88
const imageName = target.split(':')[0];
99

packages/plugin-dot-net-core/__tests__/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import assert from 'assert';
22
import dotNetCore from '../index';
33

44
describe('dotNetCore', () => {
5+
const path = '/blob/path/dummy';
6+
57
it('resolves Microsoft.NETCore.App to https://www.nuget.org/packages/Microsoft.NETCore.App', () => {
6-
assert.deepEqual(dotNetCore.resolve({ target: 'Microsoft.NETCore.App' }), [
8+
assert.deepEqual(dotNetCore.resolve(path, ['Microsoft.NETCore.App']), [
79
'https://www.nuget.org/packages/Microsoft.NETCore.App',
810
]);
911
});
1012

1113
it('resolves Microsoft.Extensions.Configuration.FileExtensions to https://www.nuget.org/packages/Microsoft.Extensions.Configuration.FileExtensions', () => {
1214
assert.deepEqual(
13-
dotNetCore.resolve({
14-
target: 'Microsoft.Extensions.Configuration.FileExtensions',
15-
}),
15+
dotNetCore.resolve(path, [
16+
'Microsoft.Extensions.Configuration.FileExtensions',
17+
]),
1618
[
1719
'https://www.nuget.org/packages/Microsoft.Extensions.Configuration.FileExtensions',
1820
],

packages/plugin-dot-net-core/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function linkDependency(blob, key, value) {
1515
export default {
1616
name: 'DotNetCore',
1717

18-
resolve({ target }) {
18+
resolve(path, [target]) {
1919
return nugetResolver({ target });
2020
},
2121

packages/plugin-dot-net/__tests__/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ import assert from 'assert';
22
import dotNet from '../index';
33

44
describe('dotNet', () => {
5+
const path = '/blob/path/dummy';
6+
57
it('resolves EntityFramework to https://www.nuget.org/packages/EntityFramework', () => {
6-
assert.deepEqual(dotNet.resolve({ target: 'EntityFramework' }), [
8+
assert.deepEqual(dotNet.resolve(path, ['EntityFramework']), [
79
'https://www.nuget.org/packages/EntityFramework',
810
]);
911
});
1012

1113
it('resolves Stanford.NLP.CoreNLP to https://www.nuget.org/packages/Stanford.NLP.CoreNLP', () => {
12-
assert.deepEqual(dotNet.resolve({ target: 'Stanford.NLP.CoreNLP' }), [
14+
assert.deepEqual(dotNet.resolve(path, ['Stanford.NLP.CoreNLP']), [
1315
'https://www.nuget.org/packages/Stanford.NLP.CoreNLP',
1416
]);
1517
});

packages/plugin-dot-net/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import nugetResolver from '@octolinker/resolver-nuget';
77
export default {
88
name: 'DotNet',
99

10-
resolve({ target }) {
10+
resolve(path, [target]) {
1111
return nugetResolver({ target });
1212
},
1313

packages/plugin-gemfile-manifest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import liveResolverQuery from '@octolinker/resolver-live-query';
44
export default {
55
name: 'Rubygems',
66

7-
resolve({ target }) {
7+
resolve(path, [target]) {
88
return liveResolverQuery({
99
target: target.split('.')[0],
1010
type: 'rubygems',

packages/plugin-go/__tests__/index.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,32 @@ describe('go-universal', () => {
55
const path = 'octo/dog.go';
66

77
it('resolves local file', () => {
8-
assert.deepEqual(goUniversal.resolve({ path, target: '../foo' }), [
8+
assert.deepEqual(goUniversal.resolve(path, ['../foo']), [
99
'{BASE_URL}foo/foo.go',
1010
'{BASE_URL}foo.go',
1111
'{BASE_URL}foo',
1212
]);
1313
});
1414

1515
it('resolves package', () => {
16-
assert.deepEqual(goUniversal.resolve({ path, target: 'foo' }), [
16+
assert.deepEqual(goUniversal.resolve(path, ['foo']), [
1717
'https://foo',
1818
'https://golang.org/pkg/foo',
1919
]);
2020
});
2121

2222
it('resolves github shorthand', () => {
23-
assert.deepEqual(
24-
goUniversal.resolve({ path, target: 'github.com/foo/bar' }),
25-
['{BASE_URL}/foo/bar/blob/master/bar.go', '{BASE_URL}/foo/bar'],
26-
);
23+
assert.deepEqual(goUniversal.resolve(path, ['github.com/foo/bar']), [
24+
'{BASE_URL}/foo/bar/blob/master/bar.go',
25+
'{BASE_URL}/foo/bar',
26+
]);
2727
});
2828

2929
it('resolves github deep link', () => {
30-
assert.deepEqual(
31-
goUniversal.resolve({ path, target: 'github.com/foo/bar/baze' }),
32-
[
33-
'{BASE_URL}/foo/bar/blob/master/baze/baze.go',
34-
'{BASE_URL}/foo/bar/tree/master/baze',
35-
'{BASE_URL}/foo/bar',
36-
],
37-
);
30+
assert.deepEqual(goUniversal.resolve(path, ['github.com/foo/bar/baze']), [
31+
'{BASE_URL}/foo/bar/blob/master/baze/baze.go',
32+
'{BASE_URL}/foo/bar/tree/master/baze',
33+
'{BASE_URL}/foo/bar',
34+
]);
3835
});
3936
});

packages/plugin-go/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function githubUrls(url) {
3636
export default {
3737
name: 'Go',
3838

39-
resolve({ target, path }) {
39+
resolve(path, [target]) {
4040
const isPath = !!target.match(/^\.\.?[\\|\/]?/);
4141

4242
if (isPath) {

packages/plugin-haskell/__tests__/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('haskell', () => {
77
const target = 'Foo.Bar';
88

99
it('resolves links', () => {
10-
assert.deepEqual(Haskell.resolve({ path, target }), [
10+
assert.deepEqual(Haskell.resolve(path, [target]), [
1111
'{BASE_URL}/user/repo/blob/master/src/Foo/Bar.hs',
1212
'{BASE_URL}/user/repo/blob/master/lib/Foo/Bar.hs',
1313
'{BASE_URL}/user/repo/blob/master/Foo/Bar.hs',

packages/plugin-haskell/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import githubSearch from '@octolinker/resolver-github-search';
44
export default {
55
name: 'Haskell',
66

7-
resolve({ path, target }) {
7+
resolve(path, [target]) {
88
const [, user, repo] = path.split('/');
99
const filePath = target.replace(/\./g, '/');
1010
return [

packages/plugin-homebrew-manifest/__tests__/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import homebrew from '../index';
44
describe('homebrew-file', () => {
55
it('resolves a dependency of a homebrew-science formula to both homebrew-science and homebrew-core', () => {
66
assert.deepEqual(
7-
homebrew.resolve({
8-
path:
9-
'/Homebrew/homebrew-science/blob/1acf4f470fc8c87f6bcbf19b721ebcd09c7fb025/octave.rb',
10-
target: 'autoconf',
11-
}),
7+
homebrew.resolve(
8+
'/Homebrew/homebrew-science/blob/1acf4f470fc8c87f6bcbf19b721ebcd09c7fb025/octave.rb',
9+
['autoconf'],
10+
),
1211
[
1312
'{BASE_URL}/Homebrew/homebrew-science/blob/1acf4f470fc8c87f6bcbf19b721ebcd09c7fb025/autoconf.rb',
1413
'https://github.com/Homebrew/homebrew-core/blob/master/Formula/autoconf.rb',

packages/plugin-homebrew-manifest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Ruby from '@octolinker/plugin-ruby';
55
export default {
66
name: 'Homebrew',
77

8-
resolve({ path, target }) {
8+
resolve(path, [target]) {
99
target += '.rb';
1010
return [
1111
relativeFile({ path, target }),

packages/plugin-html/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import relativeFile from '@octolinker/resolver-relative-file';
77
export default {
88
name: 'HTML',
99

10-
resolve({ target, path }) {
10+
resolve(path, [target]) {
1111
return [relativeFile({ path, target })];
1212
},
1313

packages/plugin-java/__tests__/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import assert from 'assert';
22
import Java from '../index';
33

44
describe('Java', () => {
5+
const path = '/blob/path/dummy';
6+
57
it('resolves java core links', () => {
6-
assert.deepEqual(Java.resolve({ target: 'java.util.Foo' }), [
8+
assert.deepEqual(Java.resolve(path, ['java.util.Foo']), [
79
`https://docs.oracle.com/javase/9/docs/api/java/util/Foo.html`,
810
`https://docs.oracle.com/javaee/9/api/java/util/Foo.html`,
911
`https://docs.oracle.com/javase/8/docs/api/java/util/Foo.html`,
@@ -14,7 +16,7 @@ describe('Java', () => {
1416
});
1517

1618
it('resolves community packages', () => {
17-
assert.deepEqual(Java.resolve({ target: 'com.company.app' }), {
19+
assert.deepEqual(Java.resolve(path, ['com.company.app']), {
1820
url: 'https://githublinker.herokuapp.com/q/java/com.company.app',
1921
method: 'GET',
2022
});

packages/plugin-java/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const SUPPORTED_JAVA_VERSIONS = [9, 8, 7];
66
export default {
77
name: 'Java',
88

9-
resolve({ target }) {
9+
resolve(path, [target]) {
1010
const targetAsPath = target.replace(/\./g, '/');
1111
const isBuildIn = !!target.match(/^javax?/);
1212

packages/plugin-javascript/__tests__/index.js

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ import assert from 'assert';
22
import plugin from '../index';
33

44
describe('javascript-universal', () => {
5+
const path = '/blob/path/dummy';
6+
57
it("resolves 'foo/bar.js' like 'foo'", () => {
68
const type = 'npm';
79
assert.deepEqual(
8-
plugin.resolve({ type, target: 'foo/bar.js' }),
9-
plugin.resolve({ type, target: 'foo' }),
10+
plugin.resolve(path, ['foo/bar.js'], { type }),
11+
plugin.resolve(path, ['foo'], { type }),
1012
);
1113
});
1214

1315
it("resolves '@angular/core/bar.js' to '@angular/core'", () => {
1416
const type = 'npm';
1517
assert.deepEqual(
16-
plugin.resolve({ type, target: '@angular/core/bar.js' })[0],
18+
plugin.resolve(path, ['@angular/core/bar.js'], { type })[0],
1719
{
1820
url: 'https://githublinker.herokuapp.com/q/npm/@angular/core',
1921
method: 'GET',
@@ -23,65 +25,50 @@ describe('javascript-universal', () => {
2325

2426
it("resolves 'module' to 'https://nodejs.org/api/modules.html'", () => {
2527
assert.deepEqual(
26-
plugin.resolve({ target: 'module' }),
28+
plugin.resolve(path, ['module']),
2729
'https://nodejs.org/api/modules.html',
2830
);
2931
});
3032

3133
it("resolves './modules/es6.symbol' without stripping .symbol suffix", () => {
32-
assert.deepEqual(
33-
plugin.resolve({
34-
target: './modules/es6.symbol',
35-
path: '',
36-
}),
37-
[
38-
'{BASE_URL}modules/es6.symbol.js',
39-
'{BASE_URL}modules/es6.symbol/index.js',
40-
'{BASE_URL}modules/es6.symbol.jsx',
41-
'{BASE_URL}modules/es6.symbol/index.jsx',
42-
'{BASE_URL}modules/es6.symbol.ts',
43-
'{BASE_URL}modules/es6.symbol/index.ts',
44-
'{BASE_URL}modules/es6.symbol.tsx',
45-
'{BASE_URL}modules/es6.symbol/index.tsx',
46-
'{BASE_URL}modules/es6.symbol.ls',
47-
'{BASE_URL}modules/es6.symbol/index.ls',
48-
'{BASE_URL}modules/es6.symbol.json',
49-
'{BASE_URL}modules/es6.symbol/index.json',
50-
'{BASE_URL}modules/es6.symbol',
51-
],
52-
);
34+
assert.deepEqual(plugin.resolve('', ['./modules/es6.symbol']), [
35+
'{BASE_URL}modules/es6.symbol.js',
36+
'{BASE_URL}modules/es6.symbol/index.js',
37+
'{BASE_URL}modules/es6.symbol.jsx',
38+
'{BASE_URL}modules/es6.symbol/index.jsx',
39+
'{BASE_URL}modules/es6.symbol.ts',
40+
'{BASE_URL}modules/es6.symbol/index.ts',
41+
'{BASE_URL}modules/es6.symbol.tsx',
42+
'{BASE_URL}modules/es6.symbol/index.tsx',
43+
'{BASE_URL}modules/es6.symbol.ls',
44+
'{BASE_URL}modules/es6.symbol/index.ls',
45+
'{BASE_URL}modules/es6.symbol.json',
46+
'{BASE_URL}modules/es6.symbol/index.json',
47+
'{BASE_URL}modules/es6.symbol',
48+
]);
5349
});
5450

5551
it("resolves './modules/es6.symbol.js' like './modules/es6.symbol'", () => {
56-
assert.deepEqual(
57-
plugin.resolve({
58-
target: './modules/es6.symbol.js',
59-
path: '',
60-
}),
61-
[
62-
'{BASE_URL}modules/es6.symbol.js',
63-
'{BASE_URL}modules/es6.symbol/index.js',
64-
'{BASE_URL}modules/es6.symbol.jsx',
65-
'{BASE_URL}modules/es6.symbol/index.jsx',
66-
'{BASE_URL}modules/es6.symbol.ts',
67-
'{BASE_URL}modules/es6.symbol/index.ts',
68-
'{BASE_URL}modules/es6.symbol.tsx',
69-
'{BASE_URL}modules/es6.symbol/index.tsx',
70-
'{BASE_URL}modules/es6.symbol.ls',
71-
'{BASE_URL}modules/es6.symbol/index.ls',
72-
'{BASE_URL}modules/es6.symbol.json',
73-
'{BASE_URL}modules/es6.symbol/index.json',
74-
'{BASE_URL}modules/es6.symbol',
75-
],
76-
);
52+
assert.deepEqual(plugin.resolve('', ['./modules/es6.symbol.js']), [
53+
'{BASE_URL}modules/es6.symbol.js',
54+
'{BASE_URL}modules/es6.symbol/index.js',
55+
'{BASE_URL}modules/es6.symbol.jsx',
56+
'{BASE_URL}modules/es6.symbol/index.jsx',
57+
'{BASE_URL}modules/es6.symbol.ts',
58+
'{BASE_URL}modules/es6.symbol/index.ts',
59+
'{BASE_URL}modules/es6.symbol.tsx',
60+
'{BASE_URL}modules/es6.symbol/index.tsx',
61+
'{BASE_URL}modules/es6.symbol.ls',
62+
'{BASE_URL}modules/es6.symbol/index.ls',
63+
'{BASE_URL}modules/es6.symbol.json',
64+
'{BASE_URL}modules/es6.symbol/index.json',
65+
'{BASE_URL}modules/es6.symbol',
66+
]);
7767
});
7868

7969
it("fallbacks './lib/foo.js' to './src/foo.js'", () => {
8070
assert.deepEqual(
81-
plugin.resolve({
82-
path: '/user/repo/package.json',
83-
target: './lib/foo.js',
84-
}),
71+
plugin.resolve('/user/repo/package.json', ['./lib/foo.js']),
8572
[
8673
'{BASE_URL}/user/repo/lib/foo.js',
8774
'{BASE_URL}/user/repo/src/foo.js',
@@ -127,10 +114,7 @@ describe('javascript-universal', () => {
127114

128115
it("fallbacks './dist/foo.js' to './lib/foo.js' and './src/foo.js'", () => {
129116
assert.deepEqual(
130-
plugin.resolve({
131-
path: '/user/repo/package.json',
132-
target: './dist/foo.js',
133-
}),
117+
plugin.resolve('/user/repo/package.json', ['./dist/foo.js']),
134118
[
135119
'{BASE_URL}/user/repo/dist/foo.js',
136120
'{BASE_URL}/user/repo/lib/foo.js',

0 commit comments

Comments
 (0)