Skip to content

Commit

Permalink
- enabling ES2022 module (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Jun 20, 2023
1 parent f6db596 commit 59817c4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -53,7 +53,7 @@ This also allows for passing in different `tsconfig` files depending on your bui

### Some compiler options have more than one compatible value

* `module`: defaults to `ES2015`. Other valid values are `ES2020` and `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).
* `module`: defaults to `ES2015`. Other valid values are `ES2020`, `ES2022` and `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).

### Some options need additional configuration on plugin side

Expand Down Expand Up @@ -152,11 +152,11 @@ See [#108](https://github.com/ezolenko/rollup-plugin-typescript2/issues/108)
Path to cache.
Defaults to a folder in `node_modules`.

* `include`: `[ "*.ts+(|x)", "**/*.ts+(|x)" ]`
* `include`: `[ "*.ts+(|x)", "**/*.ts+(|x)", "**/*.cts", "**/*.mts" ]`

By default compiles all `.ts` and `.tsx` files with TypeScript.

* `exclude`: `[ "*.d.ts", "**/*.d.ts" ]`
* `exclude`: `[ "*.d.ts", "**/*.d.ts", "**/*.d.cts", "**/*.d.mts" ]`

But excludes type definitions.

Expand Down
6 changes: 3 additions & 3 deletions dist/rollup-plugin-typescript2.cjs.js
Expand Up @@ -27904,8 +27904,8 @@ function parseTsConfig(context, pluginOptions) {
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
const module = parsedTsConfig.options.module;
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', or 'module: "ESNext"'.`);
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ES2022 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', 'module: "ES2022"', or 'module: "ESNext"'.`);
printDiagnostics(context, convertDiagnostic("config", parsedTsConfig.errors), pretty);
context.debug(`built-in options overrides: ${JSON.stringify(compilerOptionsOverride, undefined, 4)}`);
context.debug(`parsed tsconfig: ${JSON.stringify(parsedTsConfig, undefined, 4)}`);
Expand All @@ -27932,7 +27932,7 @@ catch (e) {
// these use globals during testing and are substituted by rollup-plugin-re during builds
const TS_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__TS_VERSION_RANGE) || ">=2.4.0";
const ROLLUP_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || ">=1.26.3";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.1";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.35.0";
const typescript = (options) => {
let watchMode = false;
let supportsThisLoad = false;
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/rollup-plugin-typescript2.es.js
Expand Up @@ -27875,8 +27875,8 @@ function parseTsConfig(context, pluginOptions) {
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
const module = parsedTsConfig.options.module;
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', or 'module: "ESNext"'.`);
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ES2022 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', 'module: "ES2022"', or 'module: "ESNext"'.`);
printDiagnostics(context, convertDiagnostic("config", parsedTsConfig.errors), pretty);
context.debug(`built-in options overrides: ${JSON.stringify(compilerOptionsOverride, undefined, 4)}`);
context.debug(`parsed tsconfig: ${JSON.stringify(parsedTsConfig, undefined, 4)}`);
Expand All @@ -27903,7 +27903,7 @@ catch (e) {
// these use globals during testing and are substituted by rollup-plugin-re during builds
const TS_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__TS_VERSION_RANGE) || ">=2.4.0";
const ROLLUP_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || ">=1.26.3";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.1";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.35.0";
const typescript = (options) => {
let watchMode = false;
let supportsThisLoad = false;
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
@@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.34.1",
"version": "0.35.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",
Expand Down
4 changes: 2 additions & 2 deletions src/parse-tsconfig.ts
Expand Up @@ -44,8 +44,8 @@ export function parseTsConfig(context: RollupContext, pluginOptions: IOptions)
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);

const module = parsedTsConfig.options.module!;
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', or 'module: "ESNext"'.`);
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ES2020 && module !== tsModule.ModuleKind.ES2022 && module !== tsModule.ModuleKind.ESNext)
context.error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with Rollup, please use 'module: "ES2015"', 'module: "ES2020"', 'module: "ES2022"', or 'module: "ESNext"'.`);

printDiagnostics(context, convertDiagnostic("config", parsedTsConfig.errors), pretty);

Expand Down

0 comments on commit 59817c4

Please sign in to comment.