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

Add 'tslib.umd.js' to avoid global pollution #52

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
scripts/generator.js
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
scripts
12 changes: 6 additions & 6 deletions CopyrightNotice.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ For JSPM users:
}
```

#### Variants

There are several variants of `tslib` available in this package:

- `tslib.js` - A bundle of all helpers that supports both CommonJS and AMD modules as well as adds global (for use with `<script></script>` tags).
- `tslib.umd.js` - A bundle of all helpers that supports both CommonJS and AMD modules, but does not add global variables.
- `tslib.cjs.js` - A bundle of all helpers that supports only CommonJS (this is the variant used as `"main"` in _package.json_).
- `tslib.amd.js` - A bundle of all helpers that supports only AMD.
- `tslib.es6.js` - A bundle of all helpers that supports ECMAScript module syntax.
- `tslib.global.js` - A bundle of all helpers that only adds globals (for use with `<script></script>` tags).

# Contribute

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"main": "tslib.cjs.js",
"ignore": [
"**/.*",
"node_modules",
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@
"tslib",
"runtime"
],
"scripts": {
"build-generator": "tsc scripts/generator.ts --module commonjs --target es2015",
"build": "npm run build-generator && node scripts/generator.js"
},
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"main": "tslib.cjs.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts"
"typings": "tslib.d.ts",
"devDependencies": {
"@types/node": "^6.0.110",
"typescript": "^2.9.0-dev.20180512"
}
}