-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
1.0 changes #2293
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
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
9c0029a to
a769037
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: useinputdest: useoutput.filemoduleName: useoutput.namename: useoutput.nameextend: useoutput.extendglobals: useoutput.globalsindent: useoutput.indentnoConflict: useoutput.noConflictpaths: useoutput.pathssourcemap: useoutput.sourcemapsourceMap: useoutput.sourcemapsourceMapFile: useoutput.sourcemapFileuseStrict: useoutput.strictstrict: useoutput.strictformat: useoutput.formatbanner: useoutput.bannerfooter: useoutput.footerintro: useoutput.introoutro: useoutput.outrointerop: useoutput.interopfreeze: useoutput.freezeexports: useoutput.exportstargets: useoutputas an arraypureExternalModules: usetreeshake.pureExternalModulesoutput.moduleId: useoutput.amd.idbundle.generateandbundle.writenow return a new format:import(...)will now by default create a new chunk unlessinlineDynamicImportsis set totrueexperimentalCodeSplittingexperimentalDynamicImportexperimentalPreserveModulesoption has been renamedpreserveModulesthis.watcheron the plugin context is still possible but considered deprecated and will cause a warning: usewatchChangeinsteadtransformBundle: userenderChunktransformChunk: userenderChunkongenerate: usegenerateBundleonwrite: usegenerateBundleOriginal 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
entryandonwritecan 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
experimentalCodeSplittingon by default, renamingexperimentalPreserveModulestopreserveModules, 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
inputto 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:
inlineDynamicImportsis now set to false. Combined with asset emission, this means that all builds now have the possibility of outputting multiple output files.output.filewill continue to work fine.output.diris needed.output.dirfor 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 eswould 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 afileNameproperty. Previously this was an object record keyed byfileNameto 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.chunksandresults.assetsas separate arrays instead of a single combinedresult.outputarray. Currently for filtering we haveisAsseton assets and andisEntryon chunks to make these distinctions..sourceproperty, while chunks provide a.codeproperty. 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..modulesetc stuff from therollup.rollupbuildreturn, there could still be a space here for the graph metadata to be reported before the output.onwriteorongenerateplugin hooks. Alternatively it may make sense to wait until enough of the plugin ecosystem has upgraded to avoid noise too.