Skip to content

Commit

Permalink
- prefix on errors #300
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Mar 5, 2022
1 parent 4e9f8ff commit ff88951
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions dist/rollup-plugin-typescript2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25209,20 +25209,20 @@ function parseTsConfig(context, pluginOptions) {
const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);
throw new Error(`rpt2: failed to open '${fileName}'`);
let loadedConfig = {};
let baseDir = pluginOptions.cwd;
let configFileName;
let pretty = false;
if (fileName) {
const text = tsModule.sys.readFile(fileName);
if (text === undefined)
throw new Error(`failed to read '${fileName}'`);
throw new Error(`rpt2: failed to read '${fileName}'`);
const result = tsModule.parseConfigFileTextToJson(fileName, text);
pretty = lodash$1.get(result.config, "pretty", pretty);
if (result.error !== undefined) {
printDiagnostics(context, convertDiagnostic("config", [result.error]), pretty);
throw new Error(`failed to parse '${fileName}'`);
throw new Error(`rpt2: failed to parse '${fileName}'`);
}
loadedConfig = result.config;
baseDir = path.dirname(fileName);
Expand Down Expand Up @@ -30179,7 +30179,7 @@ const typescript = (options) => {
context.info(`rollup version: ${this.meta.rollupVersion}`);
if (!semver$1.satisfies(tsModule.version, ">=2.4.0", { includePrerelease: true }))
throw new Error(`Installed typescript version '${tsModule.version}' is outside of supported range '>=2.4.0'`);
context.info(`rollup-plugin-typescript2 version: 0.31.2`);
context.info(`rollup-plugin-typescript2 version: 0.31.3`);
context.debug(() => `plugin options:\n${JSON.stringify(pluginOptions, (key, value) => key === "typescript" ? `version ${value.version}` : value, 4)}`);
context.debug(() => `rollup config:\n${JSON.stringify(rollupOptions, undefined, 4)}`);
context.debug(() => `tsconfig path: ${tsConfigPath}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/rollup-plugin-typescript2.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -25178,20 +25178,20 @@ function parseTsConfig(context, pluginOptions) {
const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);
throw new Error(`rpt2: failed to open '${fileName}'`);
let loadedConfig = {};
let baseDir = pluginOptions.cwd;
let configFileName;
let pretty = false;
if (fileName) {
const text = tsModule.sys.readFile(fileName);
if (text === undefined)
throw new Error(`failed to read '${fileName}'`);
throw new Error(`rpt2: failed to read '${fileName}'`);
const result = tsModule.parseConfigFileTextToJson(fileName, text);
pretty = lodash$1.get(result.config, "pretty", pretty);
if (result.error !== undefined) {
printDiagnostics(context, convertDiagnostic("config", [result.error]), pretty);
throw new Error(`failed to parse '${fileName}'`);
throw new Error(`rpt2: failed to parse '${fileName}'`);
}
loadedConfig = result.config;
baseDir = dirname(fileName);
Expand Down Expand Up @@ -30148,7 +30148,7 @@ const typescript = (options) => {
context.info(`rollup version: ${this.meta.rollupVersion}`);
if (!semver$1.satisfies(tsModule.version, ">=2.4.0", { includePrerelease: true }))
throw new Error(`Installed typescript version '${tsModule.version}' is outside of supported range '>=2.4.0'`);
context.info(`rollup-plugin-typescript2 version: 0.31.2`);
context.info(`rollup-plugin-typescript2 version: 0.31.3`);
context.debug(() => `plugin options:\n${JSON.stringify(pluginOptions, (key, value) => key === "typescript" ? `version ${value.version}` : value, 4)}`);
context.debug(() => `rollup config:\n${JSON.stringify(rollupOptions, undefined, 4)}`);
context.debug(() => `tsconfig path: ${tsConfigPath}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.31.2",
"version": "0.31.3",
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",
"main": "dist/rollup-plugin-typescript2.cjs.js",
"module": "dist/rollup-plugin-typescript2.es.js",
Expand Down
6 changes: 3 additions & 3 deletions src/parse-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions)

// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);
throw new Error(`rpt2: failed to open '${fileName}'`);

let loadedConfig: any = {};
let baseDir = pluginOptions.cwd;
Expand All @@ -24,15 +24,15 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions)
{
const text = tsModule.sys.readFile(fileName);
if (text === undefined)
throw new Error(`failed to read '${fileName}'`);
throw new Error(`rpt2: failed to read '${fileName}'`);

const result = tsModule.parseConfigFileTextToJson(fileName, text);
pretty = _.get(result.config, "pretty", pretty);

if (result.error !== undefined)
{
printDiagnostics(context, convertDiagnostic("config", [result.error]), pretty);
throw new Error(`failed to parse '${fileName}'`);
throw new Error(`rpt2: failed to parse '${fileName}'`);
}

loadedConfig = result.config;
Expand Down

0 comments on commit ff88951

Please sign in to comment.