-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Enhancement: Add ESM distribution, with
module
property in `packa…
…ge.json` - Refactoring: Add Rollup/Babel/Terser - Build: Have generator file produce consumable source files directly rather than logging to console - Linting: Switch from JSHint to ESLint (using rules, e.g., `indent` and `prefer-const`, in place on other estools project) - Testing: Convert coffeescript test files to ES6 - Testing: Add nyc - Testing: Check unmatched high surrogates and full coverage for AST expressions (further true `isExpression` and `isStatement`'s and false `isProblematicIfStatement`), bringing to 100% coverage - Travis: Drop previous versions for 10, 12, 14
- Loading branch information
Showing
23 changed files
with
1,414 additions
and
1,179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
["@babel/preset-env"] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
dist | ||
|
||
!.eslintrc.js | ||
coverage | ||
|
||
src/es5-identifier.js | ||
src/es6-identifier.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict'; | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
node: true | ||
}, | ||
extends: 'eslint:recommended', | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly' | ||
}, | ||
overrides: [{ | ||
files: '.eslintrc.js', | ||
parserOptions: { | ||
sourceType: 'script' | ||
}, | ||
rules: { | ||
strict: 'error' | ||
} | ||
}, { | ||
files: 'test/**', | ||
globals: { | ||
expect: true | ||
}, | ||
env: { | ||
mocha: true | ||
} | ||
}], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2018 | ||
}, | ||
rules: { | ||
semi: ['error'], | ||
indent: ['error', 4, { SwitchCase: 1 }], | ||
'prefer-const': ['error'], | ||
'no-var': ['error'], | ||
'prefer-destructuring': ['error'], | ||
'object-shorthand': ['error'], | ||
'object-curly-spacing': ['error', 'always'], | ||
quotes: ['error', 'single'], | ||
'quote-props': ['error', 'as-needed'], | ||
'brace-style': ['error', '1tbs', { allowSingleLine: true }], | ||
'prefer-template': ['error'] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "0.10" | ||
- "0.11" | ||
|
||
matrix: | ||
allow_failures: | ||
- node_js: "0.11" | ||
- 10 | ||
- 12 | ||
- 14 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { terser } from 'rollup-plugin-terser'; | ||
|
||
import babel from '@rollup/plugin-babel'; | ||
|
||
/** | ||
* @external RollupConfig | ||
* @type {PlainObject} | ||
* @see {@link https://rollupjs.org/guide/en#big-list-of-options} | ||
*/ | ||
|
||
/** | ||
* @param {PlainObject} [config= {}] | ||
* @param {boolean} [config.minifying=false] | ||
* @param {string} [config.format='umd'] | ||
* @returns {external:RollupConfig} | ||
*/ | ||
function getRollupObject ({ minifying, format = 'umd' } = {}) { | ||
const nonMinified = { | ||
input: 'src/utils.js', | ||
output: { | ||
format, | ||
sourcemap: minifying, | ||
file: `dist/esutils${ | ||
format === 'umd' ? '' : `.${format}` | ||
}${minifying ? '.min' : ''}.js`, | ||
name: 'esutils' | ||
}, | ||
plugins: [ | ||
babel({ | ||
babelHelpers: 'bundled' | ||
}) | ||
] | ||
}; | ||
if (minifying) { | ||
nonMinified.plugins.push(terser()); | ||
} | ||
return nonMinified; | ||
} | ||
|
||
export default [ | ||
getRollupObject({ minifying: true, format: 'umd' }), | ||
getRollupObject({ minifying: false, format: 'umd' }), | ||
getRollupObject({ minifying: true, format: 'esm' }), | ||
getRollupObject({ minifying: false, format: 'esm' }) | ||
]; |
Oops, something went wrong.