
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
rollup-plugin-typescript
Advanced tools
Seamless integration between Rollup and Typescript.
See rollup-plugin-babel.
npm install --save-dev rollup-plugin-typescript typescript tslib
Note that both typescript
and tslib
are peer dependencies of this plugin that need to be installed separately.
// rollup.config.js
import typescript from 'rollup-plugin-typescript';
export default {
input: './main.ts',
plugins: [
typescript()
]
}
The plugin loads any compilerOptions
from the tsconfig.json
file by default. Passing options to the plugin directly overrides those options:
...
export default {
input: './main.ts',
plugins: [
typescript({lib: ["es5", "es6", "dom"], target: "es5"})
]
}
The following options are unique to rollup-plugin-typescript
:
options.include
and options.exclude
(each a minimatch pattern, or array of minimatch patterns), which determine which files are transpiled by Typescript (all .ts
and .tsx
files by default).
tsconfig
when set to false, ignores any options specified in the config file. If set to a string that corresponds to a file path, the specified file will be used as config file.
typescript
overrides TypeScript used for transpilation:
typescript({
typescript: require('some-fork-of-typescript')
})
tslib
overrides the injected TypeScript helpers with a custom version
typescript({
tslib: require('some-fork-of-tslib')
})
Due to the use of tslib
to inject helpers, this plugin requires at least TypeScript 2.1. See also here.
Though it is not recommended, it is possible to configure this plugin to handle imports of CommonJS files from TypeScript. For this, you need to specify CommonJS
as the module format and add rollup-plugin-commonjs
to transpile the CommonJS output generated by TypeScript to ES Modules so that rollup can process it.
// rollup.config.js
import typescript from 'rollup-plugin-typescript';
import commonjs from 'rollup-plugin-commonjs';
export default {
input: './main.ts',
plugins: [
typescript({module: 'CommonJS'}),
commonjs({extensions: ['.js', '.ts']}) // the ".ts" extension is required
]
}
Note that this will often result in less optimal output.
This plugin will currently not warn for any type violations. This plugin relies on TypeScript's transpileModule function which basically transpiles TypeScript to JavaScript by stripping any type information on a per-file basis. While this is faster than using the language service, no cross-file type checks are possible with this approach.
This also causes issues with emit-less types, see #28.
FAQs
Seamless integration between Rollup and TypeScript.
The npm package rollup-plugin-typescript receives a total of 51,490 weekly downloads. As such, rollup-plugin-typescript popularity was classified as popular.
We found that rollup-plugin-typescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.