-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 changes #2293
1.0 changes #2293
Conversation
Maybe force migrating to |
ae13e77
to
f2508d8
Compare
I'm also wondering if we should deprecate automatic ".js" extension adding to be put behind an option flag for this release. |
I think extension resolving should be handled only on node resolve plugin side |
@TrySound automatic extension adding is even debatable still for the Node es modules resolution :) |
One thing I noticed is that when the
I would expect the process to abort with an error, if the file option is provided and:
A lot more checking to be done by me, though... |
I can dig this. Has any thought been given to convenience methods to iterate over different types? Something along the type of what you'd find in an AST tree or PostCSS.
Would probably make the previous question moot. Instead of separate arrays, I'd recommend readonly properties that produced an array for each on-demand. Regarding the hook changes; it seems perfectly reasonable. I do still have some catching up to do so take that for what it's worth coming from a very green third party perspective. |
bda5c67
to
141ede3
Compare
53862cf
to
8ecb1e0
Compare
8ecb1e0
to
164b280
Compare
164b280
to
f649f17
Compare
0d209a4
to
0eaf7e8
Compare
68cdff5
to
c98761e
Compare
* 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
* WIP Upgrading to Acorn 6 * Fix rollup-plugin-commonjs issue, remaining type issues and tests
imports as external
This PR is considered to be release candidate status and can be tested by installing rollup via
List of Breaking Changes
transform
,load
,resolveId
,resolveExternal
(note that the corresponding plugin hooks still exist): use the plugin APIentry
: useinput
dest
: useoutput.file
moduleName
: useoutput.name
name
: useoutput.name
extend
: useoutput.extend
globals
: useoutput.globals
indent
: useoutput.indent
noConflict
: useoutput.noConflict
paths
: useoutput.paths
sourcemap
: useoutput.sourcemap
sourceMap
: useoutput.sourcemap
sourceMapFile
: useoutput.sourcemapFile
useStrict
: useoutput.strict
strict
: useoutput.strict
format
: useoutput.format
banner
: useoutput.banner
footer
: useoutput.footer
intro
: useoutput.intro
outro
: useoutput.outro
interop
: useoutput.interop
freeze
: useoutput.freeze
exports
: useoutput.exports
targets
: useoutput
as an arraypureExternalModules
: usetreeshake.pureExternalModules
output.moduleId
: useoutput.amd.id
bundle.generate
andbundle.write
now return a new format:import(...)
will now by default create a new chunk unlessinlineDynamicImports
is set totrue
experimentalCodeSplitting
experimentalDynamicImport
experimentalPreserveModules
option has been renamedpreserveModules
this.watcher
on the plugin context is still possible but considered deprecated and will cause a warning: usewatchChange
insteadtransformBundle
: userenderChunk
transformChunk
: userenderChunk
ongenerate
: usegenerateBundle
onwrite
: usegenerateBundle
Original PR Description
This is a candidate PR for the 1.0 branch which represents the breaking API changes for the 1.0 release. All current deprecations are maintained to make the breaks of this upgrade path as minimal as possible, rather the deprecations for things like
entry
andonwrite
can happen in a later major. In terms of release process there is a lot more than just these API changes as well for a 1.0, so I hope we can continue the wider discussions elsewhere too.Update: This PR now also includes all deprecations from #2409.
Removing experimental flags
The breaking changes here are enabling
experimentalCodeSplitting
on by default, renamingexperimentalPreserveModules
topreserveModules
, and applying the API changes to allow for a single consistent API between single-file builds and code splitting builds.We do this by firstly allowing the
input
to always be used interchangeably as a string, array or object and there are no "special case" concerns - all input types are treated the same.The defaults and validations have been updated to reflect this while allowing the most flexibility:
inlineDynamicImports
is now set to false. Combined with asset emission, this means that all builds now have the possibility of outputting multiple output files.output.file
will continue to work fine.output.dir
is needed.output.dir
for a single file build, this works fine too.CLI changes
The CLI has been updated to support multiple output files for stdout, providing file name headers in colour, something like:
where
./bin/rollup -i test.js -i dep.js -f es
would provide the same output.API Changes
The API has been updated along the following lines:
The main new change here is that the output is an Array of
OutputChunk | OutputAsset
, where each will have afileName
property. Previously this was an object record keyed byfileName
to the chunk or asset. The reason for this is that when running single-file builds,output[0]
is much easier to write than to try and somehow iterate the single fileName property from an object.In addition the output array is carefully ordered - entry points, then common chunks, then assets. output[0] will always correspond to the first input etc in order. Even asset order is maintained to match order of emission.
Questions
While the main API changes are likely roughly in place, this is very much open to discussion and feedback, and then it would be worth keeping this open for a while to test out these changes against the ecosystem before rushing out the release candidate.
Some open-ended ideas of where this API may be inconsistent currently, and some other things that could be possible:
generateBundle
, which is permitted to make modifications. But this still seems part of the flexibility of that hook.result.entries
,result.chunks
andresults.assets
as separate arrays instead of a single combinedresult.output
array. Currently for filtering we haveisAsset
on assets and andisEntry
on chunks to make these distinctions..source
property, while chunks provide a.code
property. Previously assets were direct Buffer or string objects in the record, but now they need their own interfaces. It may be inconsistent to use separate properties here..modules
etc stuff from therollup.rollup
build
return, there could still be a space here for the graph metadata to be reported before the output.onwrite
orongenerate
plugin hooks. Alternatively it may make sense to wait until enough of the plugin ecosystem has upgraded to avoid noise too.