Skip to content

Commit dc48b17

Browse files
committed
Upgrade deps, remove ESLint, use GH actions
1 parent b9c74d4 commit dc48b17

10 files changed

+4302
-3257
lines changed

.eslintrc

-25
This file was deleted.

.github/workflows/test.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [10.x, 12.x]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
- run: npm install --global yarn@1
20+
- run: yarn install
21+
- run: yarn test

.eslintignore .prettierignore

File renamed without changes.

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.travis.yml

-19
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Spencer Elliott
3+
Copyright (c) 2020 Spencer Elliott
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# babel-inline-import-loader
22

33
[![npm version](https://img.shields.io/npm/v/babel-inline-import-loader.svg)](https://www.npmjs.com/package/babel-inline-import-loader)
4-
[![Travis CI Build Status](https://travis-ci.org/elliottsj/combine-loader.svg?branch=master)](https://travis-ci.org/elliottsj/combine-loader)
5-
[![Greenkeeper badge](https://badges.greenkeeper.io/elliottsj/babel-inline-import-loader.svg)](https://greenkeeper.io/)
64

75
A webpack loader enabling files imported by [babel-plugin-inline-import](https://github.com/quadric/babel-plugin-inline-import) to trigger rebuilds when content changes.
86

@@ -58,7 +56,7 @@ module.exports = {
5856
// ...
5957
webpack: (config, { defaultLoaders, dir }) => {
6058
const rulesExceptBabelLoaderRule = config.module.rules.filter(
61-
rule => rule.use !== defaultLoaders.babel
59+
(rule) => rule.use !== defaultLoaders.babel
6260
);
6361

6462
config.module.rules = [
@@ -75,14 +73,14 @@ module.exports = {
7573
...defaultLoaders.babel.options,
7674
// Disable cacheDirectory so that Babel
7775
// always rebuilds dependent modules
78-
cacheDirectory: false
79-
}
80-
}
81-
]
82-
}
76+
cacheDirectory: false,
77+
},
78+
},
79+
],
80+
},
8381
];
8482
return config;
85-
}
83+
},
8684
};
8785
```
8886
@@ -92,14 +90,16 @@ Run `npm start` and open http://localhost:8080/. Edit [example.txt](example/exam
9290
9391
### How does it work?
9492
95-
babel-inline-import-loader depends on [babel-plugin-inline-import#10](https://github.com/Quadric/babel-plugin-inline-import/pull/10), so that a comment block specifying the original module path is included next to the inlined import. For example,
93+
babel-inline-import-loader depends on [babel-plugin-inline-import#10](https://github.com/feats/babel-plugin-inline-import/pull/10), so that a comment block specifying the original module path is included next to the inlined import. For example,
9694
9795
```js
9896
import example from './example.txt';
9997
```
98+
10099
is compiled to
100+
101101
```js
102-
/* babel-plugin-inline-import './example.txt' */const example = 'hello world';
102+
/* babel-plugin-inline-import './example.txt' */ const example = 'hello world';
103103
```
104104
105105
babel-inline-import-loader then parses the value `'./example.txt'` from the comment and includes that file in webpack's dependency graph via [`this.addDependency`](https://webpack.js.org/api/loaders/#this-adddependency).

index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
'use strict';
22

3-
const babylon = require('babylon');
4-
const traverse = require('babel-traverse').default;
5-
const t = require('babel-types');
3+
const parser = require('@babel/parser');
4+
const traverse = require('@babel/traverse').default;
5+
const t = require('@babel/types');
66
const path = require('path');
77

8-
module.exports = function(content) {
9-
const ast = babylon.parse(content, {
8+
module.exports = function (content) {
9+
const ast = parser.parse(content, {
1010
sourceType: 'module',
1111
});
1212
traverse(ast, {
13-
enter: astPath => {
13+
enter: (astPath) => {
1414
const node = astPath.node;
1515
if (!t.isVariableDeclaration(node)) {
1616
return;

package.json

+14-15
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@
77
"author": "Spencer Elliott <[email protected]>",
88
"license": "MIT",
99
"scripts": {
10+
"format:check": "prettier --check .",
11+
"format:write": "prettier --write .",
1012
"jest": "jest",
11-
"lint": "eslint .",
1213
"start": "cd example && webpack-dev-server",
13-
"test": "npm run lint && npm run jest"
14+
"test": "npm run format:check && npm run jest"
1415
},
1516
"dependencies": {
16-
"babel-traverse": "^6.25.0",
17-
"babel-types": "^6.25.0",
18-
"babylon": "^6.17.4"
17+
"@babel/parser": "^7.9.6",
18+
"@babel/traverse": "^7.9.6",
19+
"@babel/types": "^7.9.6"
1920
},
2021
"devDependencies": {
21-
"babel-core": "^6.25.0",
22-
"babel-loader": "^7.1.4",
23-
"babel-plugin-inline-import": "^3.0.0",
24-
"eslint": "^4.2.0",
25-
"eslint-plugin-prettier": "^2.1.2",
26-
"jest": "^23.1.0",
27-
"prettier": "^1.5.3",
28-
"webpack": "^4.12.0",
29-
"webpack-cli": "^3.0.8",
30-
"webpack-dev-server": "^3.1.4"
22+
"@babel/core": "7.9.6",
23+
"babel-loader": "8.1.0",
24+
"babel-plugin-inline-import": "3.0.0",
25+
"jest": "25.5.4",
26+
"prettier": "2.0.5",
27+
"webpack": "4.43.0",
28+
"webpack-cli": "3.3.11",
29+
"webpack-dev-server": "3.10.3"
3130
},
3231
"jest": {
3332
"testEnvironment": "node"

0 commit comments

Comments
 (0)