Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

rollup-plugin-dts

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-dts - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

39

dist/rollup-plugin-dts.js

@@ -970,18 +970,2 @@ 'use strict';

const tsx = /\.tsx?$/;
// Parse a TypeScript module into an ESTree program.
function transformFile(input) {
const transformer = new Transformer(input);
const { ast, fixups } = transformer.transform();
// NOTE(swatinem):
// hm, typescript generates `export default` without a declare,
// but rollup moves the `export default` to a different place, which leaves
// the function declaration without a `declare`.
// Well luckily both words have the same length, haha :-D
let code = input.getText();
code = code.replace(/(export\s+)default(\s+(function|class))/m, "$1declare$2");
for (const fixup of fixups) {
code = code.slice(0, fixup.range.start) + fixup.identifier + code.slice(fixup.range.end);
}
return { code, ast };
}
const plugin = () => {

@@ -1012,2 +996,22 @@ // There exists one Program object per entry point,

}
// Parse a TypeScript module into an ESTree program.
const typeReferences = new Set();
function transformFile(input) {
for (const ref of input.typeReferenceDirectives) {
typeReferences.add(ref.fileName);
}
const transformer = new Transformer(input);
const { ast, fixups } = transformer.transform();
// NOTE(swatinem):
// hm, typescript generates `export default` without a declare,
// but rollup moves the `export default` to a different place, which leaves
// the function declaration without a `declare`.
// Well luckily both words have the same length, haha :-D
let code = input.getFullText();
code = code.replace(/(export\s+)default(\s+(function|class))/m, "$1declare$2");
for (const fixup of fixups) {
code = code.slice(0, fixup.range.start) + fixup.identifier + code.slice(fixup.range.end);
}
return { code, ast };
}
return {

@@ -1076,5 +1080,6 @@ name: "dts",

renderChunk(code, chunk) {
const pragmas = Array.from(typeReferences, ref => `/// <reference types="${ref}" />\n`).join("");
const source = ts.createSourceFile(chunk.fileName, code, ts.ScriptTarget.Latest, true);
const fixer = new NamespaceFixer(source);
code = fixer.fix();
code = pragmas + fixer.fix();
return { code, map: { mappings: "" } };

@@ -1081,0 +1086,0 @@ },

{
"name": "rollup-plugin-dts",
"version": "1.1.0",
"version": "1.1.1",
"description": "An experiment to generate .d.ts rollup files",

@@ -63,3 +63,3 @@ "keywords": [

"@types/jest": "^24.0.13",
"@types/node": "^12.0.4",
"@types/node": "^12.0.7",
"@types/react": "^16.8.19",

@@ -69,5 +69,5 @@ "esm": "^3.2.25",

"jest": "^24.8.0",
"prettier": "^1.17.1",
"prettier": "^1.18.2",
"react": "^16.8.6",
"rollup": "^1.14.3",
"rollup": "^1.14.5",
"ts-jest": "^24.0.2",

@@ -77,3 +77,3 @@ "typescript": "3.5.1"

"peerDependencies": {
"rollup": "^1.13.1",
"rollup": "^1.14.5",
"typescript": "^3.5.1"

@@ -80,0 +80,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc