Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0: deprecations #2409

Merged
merged 12 commits into from Sep 7, 2018
Merged

1.0: deprecations #2409

merged 12 commits into from Sep 7, 2018

Conversation

guybedford
Copy link
Contributor

@guybedford guybedford commented Aug 14, 2018

This PR contains:

  • bugfix
  • feature
  • refactor
  • tests
  • documentation
  • metadata

Breaking Changes?

  • yes
  • no

If yes, please describe the breakage.

Please Describe Your Changes

This is another PR for the 1.0 release only (DO NOT MERGE into master).

This removes old deprecations, and creates new deprecations in Rollup for some of the recent API changes as discussed.

It's currently based to the combination of both #2405 and #2406 to ensure both of those deprecation paths are included.

Removed deprecated features:

  • options.load
  • options.resolveId
  • options.entry
  • options.transform
  • options.pureExternalModules
  • options.moduleId
  • Output options as intput options
  • outputOptions.dest
  • outputOptions.moduleId

New deprecations added:

  • transformBundle
  • transformChunk
  • onwrite
  • ongenerate
  • transform dependencies
  • this.watcher in plugins

All of the new deprecations have deprecation warnings and tests.

@guybedford guybedford changed the base branch from watch-events-and-render-chunk-fix to render-chunk-fix August 14, 2018 17:28
@TrySound
Copy link
Member

Transform is repeated twice

@lukastaegert
Copy link
Member

Not 100% sure about "output options as input options".
Pro: It is clear where everything belongs and what it has effects on
Con: Using output options as input options could become a nice way of creating defaults for all outputs.

In any case, the current have-baked approach needed to be removed 👍The question is if we want to reintroduce it properly working for all options? Also maybe in a separate PR?

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Added some comments. Maybe we want to add more urls to warnings as this helps people jump to the docs right away. For wrongly used plugin hooks, a link to the (upcoming?) plugin API section could be great.

@@ -89,8 +89,8 @@ export interface PluginCache {
}

export interface PluginContext {
// TODO deprecate:
watcher: Watcher;
/** @deprecated */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Very good, works nicely in my IDE:
bildschirmfoto 2018-08-15 um 09 04 38

load?: LoadHook;
resolveId?: ResolveIdHook;
resolveExternal?: any;
preferConst?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this one is not documented but I am not sure it should be deprecated. Maybe it should be documented instead? const seems to have a slight performance benefit in certain environments while var has the universal compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agreed.

@@ -102,14 +126,14 @@ export function createPluginDriver(
if (typeof warning === 'string') warning = { message: warning };
if (warning.code) warning.pluginCode = warning.code;
warning.code = 'PLUGIN_WARNING';
warning.plugin = plugin.name || '(anonymous plugin)';
warning.plugin = plugin.name || `Plugin at position ${pidx + 1}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

message: `The ${name} hook used by plugin ${plugin.name ||
`at position ${pidx + 1}`} is deprecated. The ${newName} hook should be used instead.`
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to add a .url with a link to the upcoming plugin API section on the website once it is available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, we could add a link to the big list of options when an unknown option is passed: https://rollupjs.org/guide/en#big-list-of-options

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup I've wanted to add links recently, but couldn't as we don't have documentation on most of the new errors.

Will see if I can work on refactoring some of the logic from batchWarnings to prepare for this sort of thing though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@guybedford
Copy link
Contributor Author

The question is if we want to reintroduce it properly working for all options? Also maybe in a separate PR?

It's good to consider this but note that we have been providing all users with deprecation warnings if not doing this, so that the moment those deprecation paths were created that decision was made to deprecate here as far as I'm concerned. That said, we can certainly reconsider this. Personally I think it's good to be explicit and stick with the model we've set.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@lukastaegert lukastaegert changed the base branch from render-chunk-fix to master August 25, 2018 13:45
@lukastaegert lukastaegert changed the base branch from master to 1.0 September 7, 2018 10:43
# Conflicts:
#	src/rollup/index.ts
#	src/rollup/types.d.ts
#	src/utils/mergeOptions.ts
#	src/utils/pluginDriver.ts
#	src/watch/index.ts
#	test/hooks/index.js
#	test/misc/optionList.js
@lukastaegert lukastaegert merged commit 87dfc29 into 1.0 Sep 7, 2018
@lukastaegert lukastaegert deleted the 1.0-deprecations branch September 7, 2018 12:09
@guybedford guybedford mentioned this pull request Sep 7, 2018
lukastaegert pushed a commit that referenced this pull request Sep 13, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Sep 16, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Sep 17, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Sep 19, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Sep 21, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 3, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 4, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 10, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 28, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 28, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Oct 30, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Nov 17, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Nov 17, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 8, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 11, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 12, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 15, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 20, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 20, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 20, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 23, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 28, 2018
* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations
lukastaegert pushed a commit that referenced this pull request Dec 28, 2018
* Add English docs to repo

* emit watch changes as a plugin hook

* deprecate asset dependencies

* 1.0 API changest status

* watcher interface simplifications

* Add new option errors

* Make sure only valid JS is piped to stdout

* Refine error handling to include dyamic imports

* Fix output sorting

* 1.0: deprecations (#2409)

* emit watch changes as a plugin hook

* fix path require

* deprecate asset dependencies

* renderChunk hook to replace transformChunk

* renderChunk to follow all transformBundle tests, type definition

* 1.0 deprecations

* legacy deprecations

* new deprecation tests

* type fix, output options deprecations

* type fixes

* deprecation deprecations

* Only print file ids in plugin warnings and errors if present

* Upgrading to Acorn 6 (#2486)

* WIP Upgrading to Acorn 6

* Fix rollup-plugin-commonjs issue, remaining type issues and tests

* Sort options list in docs (no content changes)

* Make sure --input option supports named entries as well as default CLI options

* Make preferConst an output option

* Small type fixes

* Externalise acorn

* Allow the `d` alias for the `--dir` option

* Further refine types and make sure returning false from resolveId marks
imports as external

* Thoroughly review and update docs
@Conduitry
Copy link
Contributor

The changelog mentions that returning dependencies from the transform hook has been deprecated in favor of the watchChange hook, which doesn't seem accurate.

The actual deprecation message says to use this.addWatchFile(), which sounds like it would be better - but this function is not currently documented in the guide.

@lukastaegert
Copy link
Member

Thanks! I think things got a little messed up with the watchChange hook and the addWatchFile context function. Looking through these things now.

egoist pushed a commit to egoist/rollup-plugin-postcss that referenced this pull request Jan 22, 2019
@egoist @lmihaidaniel 

Fixes #147

The `onwrite` rollup hook has been deprecated in favor of `generateBundle` in `rollup@1.x.x`. rollup/rollup#2409
bung87 pushed a commit to bung87/rollup-plugin-postcss that referenced this pull request Dec 3, 2019
@egoist @lmihaidaniel 

Fixes egoist#147

The `onwrite` rollup hook has been deprecated in favor of `generateBundle` in `rollup@1.x.x`. rollup/rollup#2409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants