@rollup/plugin-typescript
Advanced tools
Comparing version 8.3.0 to 8.3.1
# @rollup/plugin-typescript ChangeLog | ||
## v8.3.1 | ||
_2022-02-23_ | ||
### Bugfixes | ||
- fix: allow explicity compilerOptions (#1045) | ||
### Updates | ||
- docs: readme copy/paste mistake (#1086) | ||
## v8.3.0 | ||
@@ -4,0 +16,0 @@ |
@@ -1,2 +0,3 @@ | ||
import path, { resolve as resolve$1, dirname, relative, win32, posix, normalize } from 'path'; | ||
import * as path from 'path'; | ||
import path__default, { resolve as resolve$1, dirname, relative } from 'path'; | ||
import { createFilter } from '@rollup/pluginutils'; | ||
@@ -115,3 +116,5 @@ import * as defaultTs from 'typescript'; | ||
const getPluginOptions = (options) => { | ||
const { cacheDir, exclude, include, filterRoot, transformers, tsconfig, tslib, typescript, outputToFilesystem } = options, compilerOptions = __rest(options, ["cacheDir", "exclude", "include", "filterRoot", "transformers", "tsconfig", "tslib", "typescript", "outputToFilesystem"]); | ||
const { cacheDir, exclude, include, filterRoot, transformers, tsconfig, tslib, typescript, outputToFilesystem, compilerOptions } = options, | ||
// previously was compilerOptions | ||
extra = __rest(options, ["cacheDir", "exclude", "include", "filterRoot", "transformers", "tsconfig", "tslib", "typescript", "outputToFilesystem", "compilerOptions"]); | ||
return { | ||
@@ -123,3 +126,3 @@ cacheDir, | ||
tsconfig, | ||
compilerOptions: compilerOptions, | ||
compilerOptions: Object.assign(Object.assign({}, extra), compilerOptions), | ||
typescript: typescript || defaultTs, | ||
@@ -427,3 +430,3 @@ tslib: tslib || getTsLibPath(), | ||
function normalizePath(fileName) { | ||
return fileName.split(win32.sep).join(posix.sep); | ||
return fileName.split(path.win32.sep).join(path.posix.sep); | ||
} | ||
@@ -436,3 +439,3 @@ async function emitFile({ dir }, outputToFilesystem, context, filePath, fileSource) { | ||
// returning a dot-notated relative path, so the first if-then branch is entered into | ||
const relativePath = dir ? relative(dir, normalizedFilePath) : '..'; | ||
const relativePath = dir ? path.relative(dir, normalizedFilePath) : '..'; | ||
// legal paths do not start with . nor .. : https://github.com/rollup/rollup/issues/3507#issuecomment-616495912 | ||
@@ -444,3 +447,3 @@ if (relativePath.startsWith('..')) { | ||
if (outputToFilesystem !== false) { | ||
await promises.mkdir(dirname(normalizedFilePath), { recursive: true }); | ||
await promises.mkdir(path.dirname(normalizedFilePath), { recursive: true }); | ||
await promises.writeFile(normalizedFilePath, fileSource); | ||
@@ -665,3 +668,3 @@ } | ||
const createFileFolder = (filePath) => { | ||
const folderPath = path.dirname(filePath); | ||
const folderPath = path__default.dirname(filePath); | ||
fs.mkdirSync(folderPath, { recursive: true }); | ||
@@ -675,3 +678,3 @@ }; | ||
cachedFilename(fileName) { | ||
return path.join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1')); | ||
return path__default.join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1')); | ||
} | ||
@@ -767,3 +770,3 @@ /** Emits a file in the cache folder */ | ||
return null; | ||
return normalize(resolved.resolvedFileName); | ||
return path.normalize(resolved.resolvedFileName); | ||
} | ||
@@ -797,3 +800,3 @@ return null; | ||
type: 'asset', | ||
fileName: normalizePath(relative(baseDir, id)), | ||
fileName: normalizePath(path.relative(baseDir, id)), | ||
source: code | ||
@@ -815,2 +818,2 @@ }); | ||
export default typescript; | ||
export { typescript as default }; |
@@ -20,5 +20,3 @@ 'use strict'; | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
get: function () { return e[k]; } | ||
}); | ||
@@ -28,6 +26,7 @@ } | ||
} | ||
n['default'] = e; | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var path__namespace = /*#__PURE__*/_interopNamespace(path); | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
@@ -115,3 +114,3 @@ var defaultTs__namespace = /*#__PURE__*/_interopNamespace(defaultTs); | ||
// ); | ||
const resolveId = (file, opts) => resolve__default['default'].sync(file, opts); | ||
const resolveId = (file, opts) => resolve__default["default"].sync(file, opts); | ||
/** | ||
@@ -146,3 +145,5 @@ * Returns code asynchronously for the tslib helper library. | ||
const getPluginOptions = (options) => { | ||
const { cacheDir, exclude, include, filterRoot, transformers, tsconfig, tslib, typescript, outputToFilesystem } = options, compilerOptions = __rest(options, ["cacheDir", "exclude", "include", "filterRoot", "transformers", "tsconfig", "tslib", "typescript", "outputToFilesystem"]); | ||
const { cacheDir, exclude, include, filterRoot, transformers, tsconfig, tslib, typescript, outputToFilesystem, compilerOptions } = options, | ||
// previously was compilerOptions | ||
extra = __rest(options, ["cacheDir", "exclude", "include", "filterRoot", "transformers", "tsconfig", "tslib", "typescript", "outputToFilesystem", "compilerOptions"]); | ||
return { | ||
@@ -154,3 +155,3 @@ cacheDir, | ||
tsconfig, | ||
compilerOptions: compilerOptions, | ||
compilerOptions: Object.assign(Object.assign({}, extra), compilerOptions), | ||
typescript: typescript || defaultTs__namespace, | ||
@@ -458,3 +459,3 @@ tslib: tslib || getTsLibPath(), | ||
function normalizePath(fileName) { | ||
return fileName.split(path.win32.sep).join(path.posix.sep); | ||
return fileName.split(path__namespace.win32.sep).join(path__namespace.posix.sep); | ||
} | ||
@@ -467,3 +468,3 @@ async function emitFile({ dir }, outputToFilesystem, context, filePath, fileSource) { | ||
// returning a dot-notated relative path, so the first if-then branch is entered into | ||
const relativePath = dir ? path.relative(dir, normalizedFilePath) : '..'; | ||
const relativePath = dir ? path__namespace.relative(dir, normalizedFilePath) : '..'; | ||
// legal paths do not start with . nor .. : https://github.com/rollup/rollup/issues/3507#issuecomment-616495912 | ||
@@ -475,3 +476,3 @@ if (relativePath.startsWith('..')) { | ||
if (outputToFilesystem !== false) { | ||
await fs.promises.mkdir(path.dirname(normalizedFilePath), { recursive: true }); | ||
await fs.promises.mkdir(path__namespace.dirname(normalizedFilePath), { recursive: true }); | ||
await fs.promises.writeFile(normalizedFilePath, fileSource); | ||
@@ -696,4 +697,4 @@ } | ||
const createFileFolder = (filePath) => { | ||
const folderPath = path__default['default'].dirname(filePath); | ||
fs__default['default'].mkdirSync(folderPath, { recursive: true }); | ||
const folderPath = path__default["default"].dirname(filePath); | ||
fs__default["default"].mkdirSync(folderPath, { recursive: true }); | ||
}; | ||
@@ -706,3 +707,3 @@ class TSCache { | ||
cachedFilename(fileName) { | ||
return path__default['default'].join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1')); | ||
return path__default["default"].join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1')); | ||
} | ||
@@ -713,7 +714,7 @@ /** Emits a file in the cache folder */ | ||
createFileFolder(cachedPath); | ||
fs__default['default'].writeFileSync(cachedPath, code); | ||
fs__default["default"].writeFileSync(cachedPath, code); | ||
} | ||
/** Checks if a file is in the cache */ | ||
isCached(fileName) { | ||
return fs__default['default'].existsSync(this.cachedFilename(fileName)); | ||
return fs__default["default"].existsSync(this.cachedFilename(fileName)); | ||
} | ||
@@ -724,3 +725,3 @@ /** Read a file from the cache given the output name*/ | ||
if (this.isCached(fileName)) { | ||
code = fs__default['default'].readFileSync(this.cachedFilename(fileName), { encoding: 'utf-8' }); | ||
code = fs__default["default"].readFileSync(this.cachedFilename(fileName), { encoding: 'utf-8' }); | ||
} | ||
@@ -800,3 +801,3 @@ return code; | ||
return null; | ||
return path.normalize(resolved.resolvedFileName); | ||
return path__namespace.normalize(resolved.resolvedFileName); | ||
} | ||
@@ -830,3 +831,3 @@ return null; | ||
type: 'asset', | ||
fileName: normalizePath(path.relative(baseDir, id)), | ||
fileName: normalizePath(path__namespace.relative(baseDir, id)), | ||
source: code | ||
@@ -833,0 +834,0 @@ }); |
{ | ||
"name": "@rollup/plugin-typescript", | ||
"version": "8.3.0", | ||
"version": "8.3.1", | ||
"publishConfig": { | ||
@@ -62,3 +62,3 @@ "access": "public" | ||
"buble": "^0.20.0", | ||
"rollup": "^2.14.0", | ||
"rollup": "^2.67.3", | ||
"typescript": "^4.2.2" | ||
@@ -65,0 +65,0 @@ }, |
@@ -61,3 +61,3 @@ [npm]: https://img.shields.io/npm/v/@rollup/plugin-typescript | ||
plugins: [ | ||
typescript({lib: ["es5", "es6", "dom"], target: "es5"}) | ||
typescript({ compilerOptions: {lib: ["es5", "es6", "dom"], target: "es5"}}) | ||
] | ||
@@ -176,4 +176,4 @@ } | ||
factory: (typeChecker) => { | ||
// Allow the transformer to get a Program reference in it's factory | ||
return TypeCheckerRequiringTransformerFactory(program); | ||
// Allow the transformer to get a TypeChecker reference in it's factory | ||
return TypeCheckerRequiringTransformerFactory(typeChecker); | ||
} | ||
@@ -257,3 +257,3 @@ } | ||
plugins: [ | ||
typescript({ module: 'CommonJS' }), | ||
typescript({ compilerOptions: { module: 'CommonJS' } }), | ||
commonjs({ extensions: ['.js', '.ts'] }) // the ".ts" extension is required | ||
@@ -288,3 +288,3 @@ ] | ||
acornInjectPlugins: [jsx()], | ||
plugins: [typescript({ jsx: 'preserve' })] | ||
plugins: [typescript({ compilerOptions: { jsx: 'preserve' } })] | ||
}; | ||
@@ -291,0 +291,0 @@ ``` |
@@ -82,2 +82,6 @@ /* eslint-disable no-use-before-define */ | ||
outputToFilesystem?: boolean; | ||
/** | ||
* Pass additional compiler options to the plugin. | ||
*/ | ||
compilerOptions?: PartialCompilerOptions; | ||
} | ||
@@ -84,0 +88,0 @@ |
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
96164
1697