mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
- outDir placeholder other than cwd, fix for #83
This commit is contained in:
parent
b9a93eb5d9
commit
d289d3f725
@ -36,7 +36,7 @@ The plugin inherits all compiler options and file lists from your `tsconfig.json
|
||||
* `noResolve`: false
|
||||
* `noEmit`: false
|
||||
* `inlineSourceMap`: false (see [#71](https://github.com/ezolenko/rollup-plugin-typescript2/issues/71))
|
||||
* `outDir`: `process.cwd()`
|
||||
* `outDir`: `./placeholder` in cache root, see [83](https://github.com/ezolenko/rollup-plugin-typescript2/issues/83) and [Microsoft/TypeScript/issues/24715](https://github.com/Microsoft/TypeScript/issues/24715)
|
||||
* `declarationDir`: `process.cwd()` (*only if `useTsconfigDeclarationDir` is false in the plugin options*)
|
||||
* `moduleResolution`: `node` (*`classic` is [deprecated](https://www.typescriptlang.org/docs/handbook/module-resolution.html). It also breaks this plugin, see [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14)*)
|
||||
|
||||
|
||||
2
dist/get-options-overrides.d.ts
vendored
2
dist/get-options-overrides.d.ts
vendored
@ -1,3 +1,3 @@
|
||||
import * as tsTypes from "typescript";
|
||||
import { IOptions } from "./ioptions";
|
||||
export declare function getOptionsOverrides({ useTsconfigDeclarationDir }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions;
|
||||
export declare function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions;
|
||||
|
||||
11
dist/rollup-plugin-typescript2.cjs.js
vendored
11
dist/rollup-plugin-typescript2.cjs.js
vendored
@ -19938,14 +19938,14 @@ function printDiagnostics(context, diagnostics, pretty) {
|
||||
}
|
||||
|
||||
function getOptionsOverrides(_a, tsConfigJson) {
|
||||
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir;
|
||||
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir, cacheRoot = _a.cacheRoot;
|
||||
var overrides = {
|
||||
noEmitHelpers: false,
|
||||
importHelpers: true,
|
||||
noResolve: false,
|
||||
noEmit: false,
|
||||
inlineSourceMap: false,
|
||||
outDir: process.cwd(),
|
||||
outDir: cacheRoot + "/placeholder",
|
||||
moduleResolution: tsModule.ModuleResolutionKind.NodeJs,
|
||||
};
|
||||
var declaration = lodash_1(tsConfigJson, "compilerOptions.declaration", false);
|
||||
@ -20069,7 +20069,7 @@ function typescript(options) {
|
||||
context = new ConsoleContext(pluginOptions.verbosity, "rpt2: ");
|
||||
context.info("typescript version: " + tsModule.version);
|
||||
context.info("tslib version: " + tslibVersion);
|
||||
context.info("rollup-plugin-typescript2 version: 0.14.1");
|
||||
context.info("rollup-plugin-typescript2 version: 0.15.0");
|
||||
context.debug(function () { return "plugin options:\n" + JSON.stringify(pluginOptions, function (key, value) { return key === "typescript" ? "version " + value.version : value; }, 4); });
|
||||
context.debug(function () { return "rollup config:\n" + JSON.stringify(rollupOptions, undefined, 4); });
|
||||
watchMode = process.env.ROLLUP_WATCH === "true";
|
||||
@ -20228,7 +20228,6 @@ function typescript(options) {
|
||||
declarations[key] = dts;
|
||||
});
|
||||
var bundleFile_1 = file ? file : dest; // rollup 0.48+ has 'file' https://github.com/rollup/rollup/issues/1479
|
||||
var baseDeclarationDir_1 = parsedConfig.options.outDir;
|
||||
lodash_2(declarations, function (_a, key) {
|
||||
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
||||
var writeToPath;
|
||||
@ -20239,8 +20238,8 @@ function typescript(options) {
|
||||
else {
|
||||
// Otherwise, take the directory name from the path and make sure it is absolute.
|
||||
var destDirname = path.dirname(bundleFile_1);
|
||||
var destDirectory = path.isAbsolute(bundleFile_1) ? destDirname : path.join(process.cwd(), destDirname);
|
||||
writeToPath = path.join(destDirectory, path.relative(baseDeclarationDir_1, name));
|
||||
var destDirectory = path.isAbsolute(destDirname) ? destDirname : path.join(process.cwd(), destDirname);
|
||||
writeToPath = path.join(destDirectory, path.relative(process.cwd(), name));
|
||||
}
|
||||
context.debug(function () { return safe_5("writing declarations") + " for '" + key + "' to '" + writeToPath + "'"; });
|
||||
// Write the declaration file to disk.
|
||||
|
||||
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
File diff suppressed because one or more lines are too long
11
dist/rollup-plugin-typescript2.es.js
vendored
11
dist/rollup-plugin-typescript2.es.js
vendored
@ -19934,14 +19934,14 @@ function printDiagnostics(context, diagnostics, pretty) {
|
||||
}
|
||||
|
||||
function getOptionsOverrides(_a, tsConfigJson) {
|
||||
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir;
|
||||
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir, cacheRoot = _a.cacheRoot;
|
||||
var overrides = {
|
||||
noEmitHelpers: false,
|
||||
importHelpers: true,
|
||||
noResolve: false,
|
||||
noEmit: false,
|
||||
inlineSourceMap: false,
|
||||
outDir: process.cwd(),
|
||||
outDir: cacheRoot + "/placeholder",
|
||||
moduleResolution: tsModule.ModuleResolutionKind.NodeJs,
|
||||
};
|
||||
var declaration = lodash_1(tsConfigJson, "compilerOptions.declaration", false);
|
||||
@ -20065,7 +20065,7 @@ function typescript(options) {
|
||||
context = new ConsoleContext(pluginOptions.verbosity, "rpt2: ");
|
||||
context.info("typescript version: " + tsModule.version);
|
||||
context.info("tslib version: " + tslibVersion);
|
||||
context.info("rollup-plugin-typescript2 version: 0.14.1");
|
||||
context.info("rollup-plugin-typescript2 version: 0.15.0");
|
||||
context.debug(function () { return "plugin options:\n" + JSON.stringify(pluginOptions, function (key, value) { return key === "typescript" ? "version " + value.version : value; }, 4); });
|
||||
context.debug(function () { return "rollup config:\n" + JSON.stringify(rollupOptions, undefined, 4); });
|
||||
watchMode = process.env.ROLLUP_WATCH === "true";
|
||||
@ -20224,7 +20224,6 @@ function typescript(options) {
|
||||
declarations[key] = dts;
|
||||
});
|
||||
var bundleFile_1 = file ? file : dest; // rollup 0.48+ has 'file' https://github.com/rollup/rollup/issues/1479
|
||||
var baseDeclarationDir_1 = parsedConfig.options.outDir;
|
||||
lodash_2(declarations, function (_a, key) {
|
||||
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
||||
var writeToPath;
|
||||
@ -20235,8 +20234,8 @@ function typescript(options) {
|
||||
else {
|
||||
// Otherwise, take the directory name from the path and make sure it is absolute.
|
||||
var destDirname = dirname(bundleFile_1);
|
||||
var destDirectory = isAbsolute(bundleFile_1) ? destDirname : join(process.cwd(), destDirname);
|
||||
writeToPath = join(destDirectory, relative(baseDeclarationDir_1, name));
|
||||
var destDirectory = isAbsolute(destDirname) ? destDirname : join(process.cwd(), destDirname);
|
||||
writeToPath = join(destDirectory, relative(process.cwd(), name));
|
||||
}
|
||||
context.debug(function () { return safe_5("writing declarations") + " for '" + key + "' to '" + writeToPath + "'"; });
|
||||
// Write the declaration file to disk.
|
||||
|
||||
2
dist/rollup-plugin-typescript2.es.js.map
vendored
2
dist/rollup-plugin-typescript2.es.js.map
vendored
File diff suppressed because one or more lines are too long
18
package-lock.json
generated
18
package-lock.json
generated
@ -1002,21 +1002,13 @@
|
||||
}
|
||||
},
|
||||
"rollup-plugin-typescript2": {
|
||||
"version": "github:ezolenko/rollup-plugin-typescript2#c84d3f76ecc0e50ca6fe63fbf040b8f1f90867cb",
|
||||
"version": "github:ezolenko/rollup-plugin-typescript2#b9a93eb5d90bd6b422b716a06edfe59441a458be",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs-extra": "5.0.0",
|
||||
"resolve": "1.7.1",
|
||||
"rollup-pluginutils": "2.0.1",
|
||||
"tslib": "1.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz",
|
||||
"integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"rollup-pluginutils": {
|
||||
@ -1857,9 +1849,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.8.0.tgz",
|
||||
"integrity": "sha512-ymKWWZJST0/CkgduC2qkzjMOWr4bouhuURNXCn/inEX0L57BnRG6FhX76o7FOnsjHazCjfU2LKeSrlS2sIKQJg=="
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz",
|
||||
"integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw=="
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.10.0",
|
||||
@ -1877,7 +1869,7 @@
|
||||
"minimatch": "3.0.4",
|
||||
"resolve": "1.7.1",
|
||||
"semver": "5.5.0",
|
||||
"tslib": "1.8.0",
|
||||
"tslib": "1.9.2",
|
||||
"tsutils": "2.26.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rollup-plugin-typescript2",
|
||||
"version": "0.14.1",
|
||||
"version": "0.15.0",
|
||||
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",
|
||||
"main": "dist/rollup-plugin-typescript2.cjs.js",
|
||||
"module": "dist/rollup-plugin-typescript2.es.js",
|
||||
|
||||
@ -3,7 +3,7 @@ import * as tsTypes from "typescript";
|
||||
import { IOptions } from "./ioptions";
|
||||
import * as _ from "lodash";
|
||||
|
||||
export function getOptionsOverrides({ useTsconfigDeclarationDir }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions
|
||||
export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions
|
||||
{
|
||||
const overrides = {
|
||||
noEmitHelpers: false,
|
||||
@ -11,7 +11,7 @@ export function getOptionsOverrides({ useTsconfigDeclarationDir }: IOptions, tsC
|
||||
noResolve: false,
|
||||
noEmit: false,
|
||||
inlineSourceMap: false,
|
||||
outDir: process.cwd(),
|
||||
outDir: `${cacheRoot}/placeholder`, // need an outdir that is different from source or tsconfig parsing trips up. https://github.com/Microsoft/TypeScript/issues/24715
|
||||
moduleResolution: tsModule.ModuleResolutionKind.NodeJs,
|
||||
};
|
||||
|
||||
|
||||
@ -316,7 +316,6 @@ export default function typescript(options?: Partial<IOptions>)
|
||||
|
||||
const bundleFile = file ? file : dest; // rollup 0.48+ has 'file' https://github.com/rollup/rollup/issues/1479
|
||||
|
||||
const baseDeclarationDir = parsedConfig.options.outDir;
|
||||
_.each(declarations, ({ name, text, writeByteOrderMark }, key) =>
|
||||
{
|
||||
let writeToPath: string;
|
||||
@ -328,8 +327,8 @@ export default function typescript(options?: Partial<IOptions>)
|
||||
{
|
||||
// Otherwise, take the directory name from the path and make sure it is absolute.
|
||||
const destDirname = dirname(bundleFile);
|
||||
const destDirectory = isAbsolute(bundleFile) ? destDirname : join(process.cwd(), destDirname);
|
||||
writeToPath = join(destDirectory, relative(baseDeclarationDir!, name));
|
||||
const destDirectory = isAbsolute(destDirname) ? destDirname : join(process.cwd(), destDirname);
|
||||
writeToPath = join(destDirectory, relative(process.cwd(), name));
|
||||
}
|
||||
|
||||
context.debug(() => `${blue("writing declarations")} for '${key}' to '${writeToPath}'`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user