Skip to content

Commit

Permalink
Merge pull request #2826 from jgonggrijp/es-module
Browse files Browse the repository at this point in the history
ES modules exports (implements #2718)
  • Loading branch information
jgonggrijp committed Mar 29, 2020
2 parents 7a3797a + 5187352 commit c49312c
Show file tree
Hide file tree
Showing 20 changed files with 4,217 additions and 1,261 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"browser": true,
"node": true,
"amd": true
},
"parserOptions": {
"ecmaVersion": 3
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules
*.swp
nyc_output
coverage
test-treeshake/*-umd.js
docs/underscore.js
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

* Before sending a pull request for a feature, be sure to have [tests](https://underscorejs.org/test/).

* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/underscore/blob/master/underscore.js).
* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/underscore/blob/master/modules/index.js).

* In your pull request, do not add documentation or re-build the minified `underscore-min.js` file. We'll do those things before cutting a new release.
4 changes: 3 additions & 1 deletion docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"globals": {
"_": true
"_": true,
"parserOptions": {},
"rules": [],
}
}
14 changes: 14 additions & 0 deletions docs/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
input: '../modules/index-all.js',
treeshake: false,
context: 'this',
output: {
file: 'underscore.js',
exports: 'named',
format: 'esm',
legacy: true,
strict: false,
externalLiveBindings: false,
freeze: false,
},
};
12 changes: 12 additions & 0 deletions modules/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
},
"plugins": [
"import"
],
"extends": [
"plugin:import/errors"
]
}
2 changes: 2 additions & 0 deletions modules/index-all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './index-default';
export * from './index';
5 changes: 5 additions & 0 deletions modules/index-default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as allExports from './index';
import { mixin } from './index';

// Add all of the Underscore functions to the wrapper object and return it.
export default mixin(allExports);
Loading

0 comments on commit c49312c

Please sign in to comment.