Skip to content

Commit 40bf7af

Browse files
author
Stefan Buck
committed
Remove first class support for bower
1 parent 17b3964 commit 40bf7af

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

packages/plugin-javascript/__tests__/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('javascript-universal', () => {
1212

1313
it("resolves '@angular/core/bar.js' to '@angular/core'", () => {
1414
const type = 'npm';
15-
expect(plugin.resolve(path, ['@angular/core/bar.js'], { type })[0]).toEqual(
15+
expect(plugin.resolve(path, ['@angular/core/bar.js'], { type })).toEqual(
1616
{ registry: 'npm', target: '@angular/core' },
1717
);
1818
});
Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import { join, dirname, extname } from 'path';
2-
import concatMap from 'concat-map';
1+
import { join, dirname, extname } from "path";
2+
import concatMap from "concat-map";
33
import {
44
REQUIRE,
55
IMPORT,
6-
EXPORT,
7-
} from '@octolinker/helper-grammar-regex-collection';
8-
import liveResolverQuery from '@octolinker/resolver-live-query';
9-
import builtinsDocs from './builtins-docs.js';
6+
EXPORT
7+
} from "@octolinker/helper-grammar-regex-collection";
8+
import liveResolverQuery from "@octolinker/resolver-live-query";
9+
import builtinsDocs from "./builtins-docs.js";
1010

1111
function getTopModuleName(target) {
12-
const isScoped = target.startsWith('@');
12+
const isScoped = target.startsWith("@");
1313
const numComponents = isScoped ? 2 : 1;
1414
const topModuleName = target
15-
.split('/')
15+
.split("/")
1616
.slice(0, numComponents)
17-
.join('/');
17+
.join("/");
1818
return topModuleName;
1919
}
2020

2121
export function javascriptFile({ path, target }) {
2222
const list = [];
23-
const extName = ['.js', '.jsx', '.ts', '.tsx', '.ls', '.json'];
23+
const extName = [".js", ".jsx", ".ts", ".tsx", ".ls", ".json"];
2424
const basePath = join(dirname(path), target);
2525
const pathExt = extname(path);
2626
const fileExt = extname(basePath);
2727

2828
if (extName.includes(fileExt)) {
2929
return javascriptFile({
3030
path,
31-
target: target.replace(fileExt, ''),
31+
target: target.replace(fileExt, "")
3232
});
3333
}
3434

@@ -41,25 +41,25 @@ export function javascriptFile({ path, target }) {
4141
list.push(`/index${ext}`);
4242
});
4343

44-
list.push('');
44+
list.push("");
4545

4646
return concatMap(list, file => {
4747
const origPath = `{BASE_URL}${basePath}${file}`;
4848
const paths = [origPath];
4949

50-
if (origPath.includes('/dist/')) {
51-
paths.push(origPath.replace('/dist/', '/lib/'));
52-
paths.push(origPath.replace('/dist/', '/src/'));
53-
} else if (origPath.includes('/lib/')) {
54-
paths.push(origPath.replace('/lib/', '/src/'));
50+
if (origPath.includes("/dist/")) {
51+
paths.push(origPath.replace("/dist/", "/lib/"));
52+
paths.push(origPath.replace("/dist/", "/src/"));
53+
} else if (origPath.includes("/lib/")) {
54+
paths.push(origPath.replace("/lib/", "/src/"));
5555
}
5656

5757
return paths;
5858
});
5959
}
6060

6161
export default {
62-
name: 'JavaScript',
62+
name: "JavaScript",
6363

6464
resolve(path, [target]) {
6565
const isPath = !!target.match(/^\.\.?[\\|\/]?/);
@@ -73,16 +73,13 @@ export default {
7373
return javascriptFile({ target, path });
7474
}
7575

76-
target = target.replace(/[^\w-.!~*'()@/]/g, '');
76+
target = target.replace(/[^\w-.!~*'()@/]/g, "");
7777

7878
// If the target looks like 'foo/bar.js', pretend it is 'foo' instead. See
7979
// https://github.com/OctoLinker/browser-extension/issues/93
8080
const topModuleName = getTopModuleName(target);
8181

82-
return [
83-
liveResolverQuery({ type: 'npm', target: topModuleName }),
84-
liveResolverQuery({ type: 'bower', target: topModuleName }),
85-
];
82+
return liveResolverQuery({ type: "npm", target: topModuleName });
8683
},
8784

8885
getPattern() {
@@ -92,21 +89,21 @@ export default {
9289
/\.es6$/,
9390
// CoffeeScript
9491
/\.coffee$/,
95-
/\.vue$/,
92+
/\.vue$/
9693
],
9794
githubClasses: [
98-
'type-javascript',
99-
'type-jsx',
100-
'highlight-source-js',
95+
"type-javascript",
96+
"type-jsx",
97+
"highlight-source-js",
10198
// CoffeeScript
102-
'type-coffeescript',
103-
'highlight-source-coffee',
104-
'type-vue',
105-
],
99+
"type-coffeescript",
100+
"highlight-source-coffee",
101+
"type-vue"
102+
]
106103
};
107104
},
108105

109106
getLinkRegexes() {
110107
return [REQUIRE, IMPORT, EXPORT];
111-
},
108+
}
112109
};

0 commit comments

Comments
 (0)