Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES modules exports (implements #2718) #2826

Merged
merged 19 commits into from
Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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