Skip to content

Commit d8301eb

Browse files
committed
deps: bump Rollup peerDep to 3.7.5+, remove tech debt
- 3.7.5 includes rollup/rollup@ffab4cd - which fixes the duplicate error logging upstream and allows us to remove the `buildEnd` workaround - 2.60.0 includes `this.load`, so can remove the `satisfies` check - 2.14.0 includes `this.meta.watchMode`, so can remove the env check - remove deprecated `rollupCommonJSResolveHack` - it hasn't done anything since 6fb0e75 in late 2020 (~2.5 years ago) - and has been formally deprecated since 74f6761 over a year ago - remove `objectHashIgnoreUnknownHack` warning - hasn't been needed for async functions since 9afc8df in early 2020 (~3.5 years ago) - so I think that's a long enough window to now remove the warning - also add a link in the docs to `object-hash` - noticed there wasn't one, despite all the links I added to the docs!
1 parent 68017ae commit d8301eb

File tree

6 files changed

+8
-41
lines changed

6 files changed

+8
-41
lines changed

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ This also allows for passing in different `tsconfig` files depending on your bui
6565

6666
Must be before `rollup-plugin-typescript2` in the plugin list, especially when the `browser: true` option is used (see [#66](https://github.com/ezolenko/rollup-plugin-typescript2/issues/66)).
6767

68-
#### @rollup/plugin-commonjs
69-
70-
See the explanation for `rollupCommonJSResolveHack` option below.
71-
7268
#### @rollup/plugin-babel
7369

7470
This plugin transpiles code, but doesn't change file extensions. `@rollup/plugin-babel` only looks at code with these extensions [by default](https://github.com/rollup/plugins/tree/master/packages/babel#extensions): `.js,.jsx,.es6,.es,.mjs`. To workaround this, add `.ts` and `.tsx` to its list of extensions.
@@ -165,14 +161,10 @@ See [#108](https://github.com/ezolenko/rollup-plugin-typescript2/issues/108)
165161
Bail out on first syntactic or semantic error.
166162
In some cases, setting this to false will result in an exception in Rollup itself (for example, unresolvable imports).
167163

168-
* `rollupCommonJSResolveHack`: false
169-
170-
_Deprecated_. OS native paths are now _always_ used since [`0.30.0`](https://github.com/ezolenko/rollup-plugin-typescript2/releases/0.30.0) (see [#251](https://github.com/ezolenko/rollup-plugin-typescript2/pull/251)), so this no longer has any effect -- as if it is always `true`.
171-
172164
* `objectHashIgnoreUnknownHack`: false
173165

174166
The plugin uses your Rollup config as part of its cache key.
175-
`object-hash` is used to generate a hash, but it can have trouble with some uncommon types of elements.
167+
[`object-hash`](https://github.com/puleos/object-hash) is used to generate a hash, but it can have trouble with some uncommon types of elements.
176168
Setting this option to true will make `object-hash` ignore unknowns, at the cost of not invalidating the cache if ignored elements are changed.
177169

178170
Only enable this option if you need it (e.g. if you get `Error: Unknown object type "xxx"`) and make sure to run with `clean: true` once in a while and definitely before a release.
@@ -238,8 +230,8 @@ Otherwise the plugin should work in watch mode. Make sure to run a normal build
238230
### Requirements
239231

240232
* TypeScript `2.4+`
241-
* Rollup `1.26.3+`
242-
* Node `6.4.0+` (basic ES6 support)
233+
* Rollup `3.7.5+`
234+
* Node `14.18.0+` (Rollup [requirement](https://github.com/rollup/rollup/blob/096ae92972a920dc53c3bbe9b1001ea82a15e86a/package.json#L133))
243235

244236
### Reporting bugs and Contributing
245237

__tests__/fixtures/options.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export function makeOptions(cacheDir: string, cwd: string): IOptions {
1515
cacheRoot: cacheDir,
1616
cwd,
1717
abortOnError: false,
18-
rollupCommonJSResolveHack: false,
1918
typescript: ts,
2019
objectHashIgnoreUnknownHack: false,
2120
tsconfigOverride: null,

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"tslib": "^2.4.0"
4040
},
4141
"peerDependencies": {
42-
"rollup": ">=1.26.3",
42+
"rollup": ">=3.7.5",
4343
"typescript": ">=2.4.0"
4444
},
4545
"devDependencies": {

src/index.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export { RPT2Options }
2828
const typescript: PluginImpl<RPT2Options> = (options) =>
2929
{
3030
let watchMode = false;
31-
let supportsThisLoad = false;
3231
let generateRound = 0;
3332
let rollupOptions: InputOptions;
3433
let context: RollupContext;
@@ -98,7 +97,6 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
9897
include: ["*.ts+(|x)", "**/*.ts+(|x)", "**/*.cts", "**/*.mts"],
9998
exclude: ["*.d.ts", "**/*.d.ts", "**/*.d.cts", "**/*.d.mts"],
10099
abortOnError: true,
101-
rollupCommonJSResolveHack: false,
102100
tsconfig: undefined,
103101
useTsconfigDeclarationDir: false,
104102
tsconfigOverride: {},
@@ -128,7 +126,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
128126
{
129127
context = new RollupContext(pluginOptions.verbosity, pluginOptions.abortOnError, this, "rpt2: ");
130128

131-
watchMode = process.env.ROLLUP_WATCH === "true" || !!this.meta.watchMode; // meta.watchMode was added in 2.14.0 to capture watch via Rollup API (i.e. no env var) (c.f. https://github.com/rollup/rollup/blob/master/CHANGELOG.md#2140)
129+
watchMode = !!this.meta.watchMode;
132130
({ parsedTsConfig: parsedConfig, fileName: tsConfigPath } = parseTsConfig(context, pluginOptions));
133131

134132
// print out all versions and configurations
@@ -142,21 +140,11 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
142140
if (!satisfies(this.meta.rollupVersion, ROLLUP_VERSION_RANGE, { includePrerelease: true }))
143141
context.error(`Installed Rollup version '${this.meta.rollupVersion}' is outside of supported range '${ROLLUP_VERSION_RANGE}'`);
144142

145-
supportsThisLoad = satisfies(this.meta.rollupVersion, ">=2.60.0", { includePrerelease : true }); // this.load is 2.60.0+ only (c.f. https://github.com/rollup/rollup/blob/master/CHANGELOG.md#2600)
146-
if (!supportsThisLoad)
147-
context.warn(() => `${yellow("You are using a Rollup version '<2.60.0'")}. This may result in type-only files being ignored.`);
148-
149143
context.info(`rollup-plugin-typescript2 version: ${RPT2_VERSION}`);
150144
context.debug(() => `plugin options:\n${JSON.stringify(pluginOptions, (key, value) => key === "typescript" ? `version ${(value as typeof tsModule).version}` : value, 4)}`);
151145
context.debug(() => `rollup config:\n${JSON.stringify(rollupOptions, undefined, 4)}`);
152146
context.debug(() => `tsconfig path: ${tsConfigPath}`);
153147

154-
if (pluginOptions.objectHashIgnoreUnknownHack)
155-
context.warn(() => `${yellow("You are using 'objectHashIgnoreUnknownHack' option")}. If you enabled it because of async functions, try disabling it now.`);
156-
157-
if (pluginOptions.rollupCommonJSResolveHack)
158-
context.warn(() => `${yellow("You are using 'rollupCommonJSResolveHack' option")}. This is no longer needed, try disabling it now.`);
159-
160148
if (watchMode)
161149
context.info(`running in watch mode`);
162150

@@ -275,7 +263,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
275263

276264
// handle all type-only imports by resolving + loading all of TS's references
277265
// Rollup can't see these otherwise, because they are "emit-less" and produce no JS
278-
if (result.references && supportsThisLoad) {
266+
if (result.references) {
279267
for (const ref of result.references) {
280268
if (!filter(ref))
281269
continue;
@@ -312,18 +300,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
312300
{
313301
generateRound = 0; // in watch mode, buildEnd resets generate count just before generateBundle for each output
314302

315-
if (err)
316-
{
317-
buildDone();
318-
// workaround: err.stack contains err.message and Rollup prints both, causing duplication, so split out the stack itself if it exists (c.f. https://github.com/ezolenko/rollup-plugin-typescript2/issues/103#issuecomment-1172820658)
319-
const stackOnly = err.stack?.split(err.message)[1];
320-
if (stackOnly)
321-
this.error({ ...err, message: err.message, stack: stackOnly });
322-
else
323-
this.error(err);
324-
}
325-
326-
if (!pluginOptions.check)
303+
if (err || !pluginOptions.check)
327304
return buildDone();
328305

329306
// walkTree once on each cycle when in watch mode

src/ioptions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export interface IOptions
2121
clean: boolean;
2222
cacheRoot: string;
2323
abortOnError: boolean;
24-
rollupCommonJSResolveHack: boolean;
2524
tsconfig?: string;
2625
useTsconfigDeclarationDir: boolean;
2726
typescript: typeof tsModule;

0 commit comments

Comments
 (0)