Skip to content

Commit

Permalink
bump dependencies
Browse files Browse the repository at this point in the history
+ doc tweaks
  • Loading branch information
chocolateboy committed Jun 8, 2020
1 parent 01f9768 commit 47be6c7
Show file tree
Hide file tree
Showing 7 changed files with 1,976 additions and 2,047 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# http:https://EditorConfig.org
# https:https://EditorConfig.org

# is this the topmost EditorConfig file?
root = true
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http:https://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https:https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http:https://nodejs.org/api/addons.html)
# Compiled binary addons (https:https://nodejs.org/api/addons.html)
build/Release

# Dependency directory
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
cache: yarn
node_js:
- '8'
- '10'
- '12'
- '14'
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://secure.travis-ci.org/chocolateboy/babel-plugin-source-map-support.svg)](http:https://travis-ci.org/chocolateboy/babel-plugin-source-map-support)
[![NPM Version](http:https://img.shields.io/npm/v/babel-plugin-source-map-support.svg)](https://www.npmjs.org/package/babel-plugin-source-map-support)
[![Build Status](https://travis-ci.org/chocolateboy/babel-plugin-source-map-support.svg)](https:https://travis-ci.org/chocolateboy/babel-plugin-source-map-support)
[![NPM Version](https:https://img.shields.io/npm/v/babel-plugin-source-map-support.svg)](https://www.npmjs.org/package/babel-plugin-source-map-support)

<!-- toc -->

Expand Down Expand Up @@ -71,10 +71,10 @@ file(s) of an application, but it no-ops if it has already been loaded, so
there is no harm in registering it in every file.

You probably don't want to use this plugin when compiling code for the web
because you probably don't want to bundle source-maps and the source-map module
in minified code. An easy way to limit the plugin's scope to development/test
builds is to use Babel's [`env` option](https://babeljs.io/docs/usage/babelrc/#env-option)
e.g.:
because you probably don't want to bundle source-maps and the
source-map-support module in minified code. An easy way to limit the plugin's
scope to development/test builds is to use Babel's
[`env` option](https://babeljs.io/docs/usage/babelrc/#env-option), e.g.:

```javascript
{
Expand All @@ -90,8 +90,8 @@ e.g.:
```

Note that source-maps don't need to be inlined in each file. They can be
externalised by using the `{ sourceMaps: true }` option, which adds a link
to the bottom of each file which points to its external source-map e.g.:
externalised by using the `{ sourceMaps: true }` option. This adds a link to
the bottom of each file pointing to its generated source-map, e.g.:

```javascript
{
Expand All @@ -118,8 +118,8 @@ to the bottom of each file which points to its external source-map e.g.:
The following NPM scripts are available:

- build - compile the plugin and save it to the `dist` directory
- build:cjs: build the CommonJS target
- build:esm: build the ESM target
- build:cjs - build the CommonJS target
- build:esm - build the ESM target
- clean - remove the `dist` directory and other build artifacts
- rebuild - clean the build artifacts and recompile the code
- test - rebuild the plugin and run the test suite
Expand Down Expand Up @@ -149,7 +149,7 @@ The following NPM scripts are available:

# COPYRIGHT AND LICENSE

Copyright © 2015-2019 by chocolateboy.
Copyright © 2015-2020 by chocolateboy.

This module is free software; you can redistribute it and/or modify it under the
terms of the [Artistic License 2.0](http:https://www.opensource.org/licenses/artistic-license-2.0.php).
terms of the [Artistic License 2.0](https:https://www.opensource.org/licenses/artistic-license-2.0.php).
24 changes: 10 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,25 @@
"test": "run-s rebuild test:run",
"test:debug": "cross-env NODE_ENV=development run-s test",
"test:prod": "cross-env NODE_ENV=production run-s test",
"test:run": "ava --verbose"
"test:run": "ava --verbose ./test/test.js"
},
"files": [
"dist/"
"dist/index.esm.js",
"dist/index.js"
],
"ava": {
"files": [
"test/*.js"
]
},
"browserslist": "maintained node versions",
"dependencies": {
"@babel/helper-module-imports": "^7.0.0"
"@babel/helper-module-imports": "^7.10.1"
},
"devDependencies": {
"@babel/core": "^7.5.4",
"ava": "^2.2.0",
"bili": "^4.8.0",
"cross-env": "^5.2.0",
"@babel/core": "^7.10.2",
"ava": "^3.8.2",
"bili": "^4.10.1",
"cross-env": "^7.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"prettier": "^2.0.5",
"shx": "^0.3.2",
"source-map-support": "^0.5.12"
"source-map-support": "^0.5.19"
},
"keywords": [
"babel-plugin",
Expand Down
19 changes: 8 additions & 11 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import test from 'ava'
import Fs from 'fs'
import Path from 'path'
import Prettier from 'prettier'
import { promisify } from 'util'
import { transformAsync } from '@babel/core'
const test = require('ava')
const Fs = require('fs')
const Path = require('path')
const Prettier = require('prettier')
const { promisify } = require('util')
const { transformAsync } = require('@babel/core')

const isDev = process.env.NODE_ENV === 'development'
const fixtures = Path.join(__dirname, 'fixtures')
const pluginPath = Path.resolve(__dirname, '..')

// TODO use fs.promises.readFile when node v8 is EOL
const readFileAsync = promisify(Fs.readFile)

function normalize (html) {
return Prettier.format(html.trim(), { parser: 'babel' })
}
Expand All @@ -21,15 +18,15 @@ for (const name of Fs.readdirSync(fixtures)) {
const outputPath = Path.resolve(fixtures, name, 'output.js')

test(name, async t => {
const input = await readFileAsync(inputPath, 'utf8')
const input = await Fs.promises.readFile(inputPath, 'utf8')

const { code } = await transformAsync(input, {
plugins: [pluginPath],
babelrc: false,
})

const got = normalize(code)
const want = normalize(await readFileAsync(outputPath, 'utf8'))
const want = normalize(await Fs.promises.readFile(outputPath, 'utf8'))

if (isDev) {
console.warn(`\n/******************* ${name} *******************/\n`)
Expand Down
Loading

0 comments on commit 47be6c7

Please sign in to comment.