@rollup/plugin-typescript
Advanced tools
Comparing version 11.1.2 to 11.1.3
@@ -431,3 +431,3 @@ 'use strict'; | ||
function isCodeOutputFile(name) { | ||
return !isMapOutputFile(name) && !name.endsWith('.d.ts'); | ||
return !isMapOutputFile(name) && !isDeclarationOutputFile(name); | ||
} | ||
@@ -438,5 +438,11 @@ /** | ||
function isMapOutputFile(name) { | ||
return name.endsWith('.map'); | ||
return name.endsWith('ts.map'); | ||
} | ||
/** | ||
* Checks if the given OutputFile represents some declaration | ||
*/ | ||
function isDeclarationOutputFile(name) { | ||
return /\.d\.[cm]?ts$/.test(name); | ||
} | ||
/** | ||
* Returns the content of a filename either from the current | ||
@@ -859,34 +865,32 @@ * typescript compiler instance or from the cached content. | ||
async generateBundle(outputOptions) { | ||
parsedOptions.fileNames.forEach((fileName) => { | ||
const output = findTypescriptOutput(ts, parsedOptions, fileName, emittedFiles, tsCache); | ||
output.declarations.forEach((id) => { | ||
const code = getEmittedFile(id, emittedFiles, tsCache); | ||
if (!code || !parsedOptions.options.declaration) { | ||
return; | ||
} | ||
let baseDir; | ||
if (outputOptions.dir) { | ||
baseDir = outputOptions.dir; | ||
} | ||
else if (outputOptions.file) { | ||
// find common path of output.file and configured declation output | ||
const outputDir = path__namespace.dirname(outputOptions.file); | ||
const configured = path__namespace.resolve(parsedOptions.options.declarationDir || | ||
parsedOptions.options.outDir || | ||
tsconfig || | ||
process.cwd()); | ||
const backwards = path__namespace | ||
.relative(outputDir, configured) | ||
.split(path__namespace.sep) | ||
.filter((v) => v === '..') | ||
.join(path__namespace.sep); | ||
baseDir = path__namespace.normalize(`${outputDir}/${backwards}`); | ||
} | ||
if (!baseDir) | ||
return; | ||
this.emitFile({ | ||
type: 'asset', | ||
fileName: normalizePath(path__namespace.relative(baseDir, id)), | ||
source: code | ||
}); | ||
const declarationAndMapFiles = [...emittedFiles.keys()].filter((fileName) => isDeclarationOutputFile(fileName) || isMapOutputFile(fileName)); | ||
declarationAndMapFiles.forEach((id) => { | ||
const code = getEmittedFile(id, emittedFiles, tsCache); | ||
if (!code || !parsedOptions.options.declaration) { | ||
return; | ||
} | ||
let baseDir; | ||
if (outputOptions.dir) { | ||
baseDir = outputOptions.dir; | ||
} | ||
else if (outputOptions.file) { | ||
// find common path of output.file and configured declation output | ||
const outputDir = path__namespace.dirname(outputOptions.file); | ||
const configured = path__namespace.resolve(parsedOptions.options.declarationDir || | ||
parsedOptions.options.outDir || | ||
tsconfig || | ||
process.cwd()); | ||
const backwards = path__namespace | ||
.relative(outputDir, configured) | ||
.split(path__namespace.sep) | ||
.filter((v) => v === '..') | ||
.join(path__namespace.sep); | ||
baseDir = path__namespace.normalize(`${outputDir}/${backwards}`); | ||
} | ||
if (!baseDir) | ||
return; | ||
this.emitFile({ | ||
type: 'asset', | ||
fileName: normalizePath(path__namespace.relative(baseDir, id)), | ||
source: code | ||
}); | ||
@@ -893,0 +897,0 @@ }); |
@@ -409,3 +409,3 @@ import * as path from 'path'; | ||
function isCodeOutputFile(name) { | ||
return !isMapOutputFile(name) && !name.endsWith('.d.ts'); | ||
return !isMapOutputFile(name) && !isDeclarationOutputFile(name); | ||
} | ||
@@ -416,5 +416,11 @@ /** | ||
function isMapOutputFile(name) { | ||
return name.endsWith('.map'); | ||
return name.endsWith('ts.map'); | ||
} | ||
/** | ||
* Checks if the given OutputFile represents some declaration | ||
*/ | ||
function isDeclarationOutputFile(name) { | ||
return /\.d\.[cm]?ts$/.test(name); | ||
} | ||
/** | ||
* Returns the content of a filename either from the current | ||
@@ -837,34 +843,32 @@ * typescript compiler instance or from the cached content. | ||
async generateBundle(outputOptions) { | ||
parsedOptions.fileNames.forEach((fileName) => { | ||
const output = findTypescriptOutput(ts, parsedOptions, fileName, emittedFiles, tsCache); | ||
output.declarations.forEach((id) => { | ||
const code = getEmittedFile(id, emittedFiles, tsCache); | ||
if (!code || !parsedOptions.options.declaration) { | ||
return; | ||
} | ||
let baseDir; | ||
if (outputOptions.dir) { | ||
baseDir = outputOptions.dir; | ||
} | ||
else if (outputOptions.file) { | ||
// find common path of output.file and configured declation output | ||
const outputDir = path.dirname(outputOptions.file); | ||
const configured = path.resolve(parsedOptions.options.declarationDir || | ||
parsedOptions.options.outDir || | ||
tsconfig || | ||
process.cwd()); | ||
const backwards = path | ||
.relative(outputDir, configured) | ||
.split(path.sep) | ||
.filter((v) => v === '..') | ||
.join(path.sep); | ||
baseDir = path.normalize(`${outputDir}/${backwards}`); | ||
} | ||
if (!baseDir) | ||
return; | ||
this.emitFile({ | ||
type: 'asset', | ||
fileName: normalizePath(path.relative(baseDir, id)), | ||
source: code | ||
}); | ||
const declarationAndMapFiles = [...emittedFiles.keys()].filter((fileName) => isDeclarationOutputFile(fileName) || isMapOutputFile(fileName)); | ||
declarationAndMapFiles.forEach((id) => { | ||
const code = getEmittedFile(id, emittedFiles, tsCache); | ||
if (!code || !parsedOptions.options.declaration) { | ||
return; | ||
} | ||
let baseDir; | ||
if (outputOptions.dir) { | ||
baseDir = outputOptions.dir; | ||
} | ||
else if (outputOptions.file) { | ||
// find common path of output.file and configured declation output | ||
const outputDir = path.dirname(outputOptions.file); | ||
const configured = path.resolve(parsedOptions.options.declarationDir || | ||
parsedOptions.options.outDir || | ||
tsconfig || | ||
process.cwd()); | ||
const backwards = path | ||
.relative(outputDir, configured) | ||
.split(path.sep) | ||
.filter((v) => v === '..') | ||
.join(path.sep); | ||
baseDir = path.normalize(`${outputDir}/${backwards}`); | ||
} | ||
if (!baseDir) | ||
return; | ||
this.emitFile({ | ||
type: 'asset', | ||
fileName: normalizePath(path.relative(baseDir, id)), | ||
source: code | ||
}); | ||
@@ -871,0 +875,0 @@ }); |
{ | ||
"name": "@rollup/plugin-typescript", | ||
"version": "11.1.2", | ||
"version": "11.1.3", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93155
1857