
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rollup-plugin-inline-ts
Advanced tools
A Rollup plugin to process TypeScript code inside <script lang="ts"> tags.
⚡ A Rollup plugin to process TypeScript code inside <script lang="ts"> tags.
Supports compilation using one of four engines: oxc, swc, esbuild, or typescript.
Only transpile, without type checking and diagnostics.
This plugin requires Node.js v14.16.1+ (LTS recommended).
npm install rollup-plugin-inline-ts --save-dev
npm install oxc-transform --save-dev
npm install @swc/core --save-dev
npm install esbuild --save-dev
npm install typescript --save-dev
Create a rollup.config.js configuration file and import the
plugin:
import inlineTs from 'rollup-plugin-inline-ts';
export default {
// ...
plugins: [
// ...
inlineTs(),
],
};
Example with all available options:
import inlineTs from 'rollup-plugin-inline-ts';
export default {
// ...
plugins: [
// ...
inlineTs({
extensions: ['.html', '.xht'], // Files to process
engine: 'swc', // Transpiler engine
options: { jsc: { parser: { syntax: 'typescript' } } }, // Engine specific options
tsScriptAttr: 'lang="ts"', // Match attribute
jsScriptAttr: '', // Replacement attribute
logPrefix: '[inline-ts]', // Log prefix
debug: false, // Debug logging
}),
],
};
extensionsType: Array<string>
Default: ['.html']
File extensions for <script lang="ts"> blocks processing.
engineType: 'oxc' | 'swc' | 'esbuild' | 'typescript'
Default: 'oxc'
Transpilation engine to use.
optionsType: object (depends on specified engine)
Default: engine-specific
Passed directly to the underlying transpiler.
| Engine | Type | Package | Default |
|---|---|---|---|
oxc | TransformOptions | oxc-transform | {} |
swc | Config | @swc/core | { jsc: { parser: { syntax: 'typescript' } } } |
esbuild | TransformOptions | esbuild | { loader: 'ts' } |
typescript | CompilerOptions | typescript | { target: ts.ScriptTarget.ESNext } |
tsScriptAttrType: string
Default: 'lang="ts"'
Attribute used to detect TypeScript <script> tags.
jsScriptAttrType: string
Default: ''
Attribute to replace tsScriptAttr with after transpilation.
keepComponentImportsType: boolean
Default: true
If set to true, the plugin will preserve import statements for files with extensions listed in the extensions option.
These imports will not be removed as unused during the transformation.
logPrefixType: string
Default: '[inline-ts]'
Prefix for plugin logs.
debugType: boolean
Default: false
Enable debug logging.
.html).<script lang="ts"> blocks.lang attribute.extensions option to avoid them being removed as unused.FAQs
A Rollup plugin to process TypeScript code inside <script lang="ts"> tags.
We found that rollup-plugin-inline-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.