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

chore: upgrade all dependencies #680

Closed
wants to merge 4 commits into from

Conversation

wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Jul 11, 2020

While I was rewriting the microbundle pipeline I needed preserveEntrySignatures as an option. This isn't available in rollup@1 so I looked at our dependencies and upgraded them through npm update.

In rollup v2, the umd wrapper code has changed to use globalThis as well. This makes the output a little bit bigger.

BREAKING CHANGES

@rollup/plugin-node-resolve

v8.0.0
2020-05-20

Breaking Changes
feat: Add default export (#361)
feat: export defaults (#301)

v7.0.0
2020-01-07

Breaking Changes
feat: dedupe by package name (#99)

@rollup/plugin-node-resolve

v8.0.0
2020-05-20

Breaking Changes
feat: Add default export (#361)
feat: export defaults (#301)

v7.0.0
2020-01-07

Breaking Changes
feat: dedupe by package name (#99)

camelcase

v6.0.0
2020-04-07

Breaking Changes
Require Node.js 10 (#62) 878bc44

kleur

v4.0.0
2020-06-17

Breaking Changes
The minimum Node.js runtime increased from 6.x to 10.x since 10.x is the oldest active LTS version.
If you need to continue supporting Node 6.x, either continue using kleur@3.x or ignore the "engines" constraint of kleur@4.x – its CommonJS files will still execute in a Node 6.x environment.

Rollup

v2.0.0
2020-03-06

Breaking Changes
Rollup now requires at least Node 10 to run, or a sufficiently modern browser (#3346)

The file structure of Rollup's ESM builds has changed:

The main ESM entry point is now at rollup/dist/es/rollup.js instead of rollup/dist/rollup.es.js
The ESM browser build is at rollup/dist/es/rollup.browser.js instead of rollup/dist/rollup.browser.es.js
In general, the ESM builds now follow the same naming scheme as the CJS builds but are located in the rollup/dist/es subfolder instead of rollup/dist (#3391)

The "watch.chokidar" option no longer accepts a boolean value but only an object of parameters that is passed to the bundled Chokidar instance. Chokidar installations by the user will be ignored in favour of the bundled instance (#3331)

Modules that are completely tree-shaken will no longer be listed as part of any chunks in generateBundle

The experimentalOptimizeChunks and chunkGroupingSize options have been removed

acorn plugins can only be used if they accept a passed-in acorn instance instead of importing it themselves. See acornjs/acorn/pull/870#issuecomment-527339830 for what needs to be done to make plugins compatible that do not support this yet (#3391)

Emitted chunks now have the TypeScript type Uint8Array instead of Buffer. A Buffer can still be used, though (#3395)

The TypeScript types no longer use ESTree types for AST nodes but a very generic type that does not contain information specific to certain node types (#3395)

The signature of the writeBundle plugin hook has been changed to match generateBundle: The bundle object is now passed as second parameter instead of first and the first parameter is the output options (#3361)

The following plugin hooks have been removed:

ongenerate: use generateBundle instead
onwrite: use writeBundle instead
transformBundle: use renderChunk instead
transformChunk: use renderChunk instead
You can no longer access this.watcher on the plugin context.

The transform hook can no longer return dependencies.

The treeshake.pureExternalModules option will now show a deprecation warning when used: use treeshake.moduleSideEffects: 'no-external' instead

Using import.meta.ROLLUP_ASSET_URL_<..> and import.meta.ROLLUP_CHUNK_URL_<..> in code will now show warnings: use import.meta.ROLLUP_FILE_URL_<..> instead

The resolveAssetUrl hook will now show a deprecation warning when used: use resolveFileUrl instead

The following plugin context functions will show warnings when used:

this.emitAsset: use this.emitFile
this.emitChunk: use this.emitFile
this.getAssetFileName: use this.getFileName
this.getChunkFileName: use this.getFileName
this.isExternal: use this.resolve
this.resolveId: use this.resolve
Directly adding properties to the bundle object in the generateBundle is deprecated will show a warning (removing properties is allowed, though): Use this.emitFile

Accessing chunk.isAsset on the bundle is deprecated: Use chunk.type === 'asset' instead

The error code for a missing name property when targeting UMD has been changed to MISSING_NAME_OPTION_FOR_IIFE_EXPORT to emphasize this is needed for the IIFE part of UMD (#3393)

rollup-plugin-postcss

v3.0.0
2020-04-21

Breaking Changes
v3 not support rollup v1.
extract relative path based on bundle root.

rollup-plugin-terser

v6.0.0
2020-05-23

Breaking Changes
node.js < v10 support is dropped
rollup < v2 support is dropped
sourcemap option is inferred from rollup options, please remove from your config
include/exclude options are dropped in favour of output plugins, see here

rollup-plugin-typescript2

v0.27.0
2020-03-27

updated dependencies and some type changes

v0.26.0
2020-02-12

#203 Updating object-hash to 2.0.2 with async support.

Updating other dependencies.

tslib

v2.0.0
2020-05-14

This release changes __exportStar and __importStar to use __createBinding which is incompatible with versions of TypeScript older than 3.9 (i.e. 3.8 and below).

src/index.js Outdated Show resolved Hide resolved
Copy link
Owner

@developit developit left a comment

Choose a reason for hiding this comment

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

One of the dep updates is causing modern JS to be used in all bundles. Need to figure out which one....

test/__snapshots__/index.test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/index.test.js.snap Outdated Show resolved Hide resolved
test/__snapshots__/index.test.js.snap Outdated Show resolved Hide resolved
@developit
Copy link
Owner

My guess is that we are using some babel deps that still use the "whitelist" term, which was changed to "allowlist". The changelog makes it seem like this was an internal-only change, but if we have a mix of versions it could cause issues.

@wardpeet
Copy link
Collaborator Author

Yeah, I'm going to update one by one to figure it out :)

@wardpeet wardpeet force-pushed the chore-upgrade-rollup branch 2 times, most recently from 97979c4 to d2a3300 Compare July 12, 2020 20:42
@wardpeet wardpeet marked this pull request as ready for review July 12, 2020 20:45
@wardpeet wardpeet requested a review from developit July 12, 2020 20:46
@wardpeet
Copy link
Collaborator Author

One thing I noticed is that the css chunk keeps changing, it's not deterministic and it seems like moduleIds from rollup is the culprit.

@developit
Copy link
Owner

@wardpeet I wonder if its the CSS Modules identifier generation we're doing custom?

@wardpeet
Copy link
Collaborator Author

wardpeet commented Jul 19, 2020

I've created a PR in postcss-plugin for rollup to fix this issue
egoist/rollup-plugin-postcss#295

I also made an issue in the rollup repository:
rollup/rollup#3682

@jcmonte
Copy link

jcmonte commented Aug 31, 2020

can we roll #711 into this?

@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2020

⚠️ No Changeset found

Latest commit: 291daf1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rblalock
Copy link

rblalock commented Sep 2, 2020

This going to be merged soon? There's a high vulnerability in the rollup-plugin-terser that is fixed in a later version.

@wardpeet
Copy link
Collaborator Author

wardpeet commented Sep 2, 2020

Upstream changes have landed, so it should land relatively soon. I need to find the time to make sure it's 100% working.

@rblalock you can checkout #695. You shouldn't worry to much about the vulnerability as microbundle is only used during build time.

@wardpeet wardpeet force-pushed the chore-upgrade-rollup branch 2 times, most recently from c1cc357 to 90589c3 Compare September 2, 2020 22:00
Copy link
Collaborator Author

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

Everything works except with merging inputs into 1 pass. Multiple inputs are not allowed anymore when using UMD or iife format. It will throw an exception. Users will have to run microbundle twice.

This is a breaking change. I couldn't find a way to disable code-splitting, which leads to this issue.

src/index.js Outdated
Comment on lines 87 to 102
for (let j = 0; j < formats.length; j++) {
steps.push(createConfig(options, options.entries, formats[j], j === 0));
}
Copy link
Collaborator Author

@wardpeet wardpeet Sep 2, 2020

Choose a reason for hiding this comment

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

All entries are moved into 1 rollup pass per format so code-splitting can happen. This is necessary in rollup v2 as without it my bundles wouldn't find the right imports.

Could be that I had something misconfigured 🤷

src/index.js Outdated
Comment on lines 243 to 290
entries.forEach(entry => {
let mainNoExtension = options.output;

if (!pkgMain) {
inputs[basename(mainNoExtension, extname(mainNoExtension))] = entry;
return;
}

let name;
// when we have multiple entries we look for the index file and mark that as our main entry
if (entries.length > 1) {
name = entry.match(/([\\/])index(\.(umd|cjs|es|m))?\.(mjs|[tj]sx?)$/)
? mainNoExtension
: entry;
} else {
name = mainNoExtension;
}

let mainNoExtension = options.output;
if (options.multipleEntries) {
let name = entry.match(/([\\/])index(\.(umd|cjs|es|m))?\.(mjs|[tj]sx?)$/)
? mainNoExtension
: entry;
mainNoExtension = resolve(dirname(mainNoExtension), basename(name));
}
mainNoExtension = mainNoExtension.replace(
/(\.(umd|cjs|es|m))?\.(mjs|[tj]sx?)$/,
'',
);

const mainsByFormat = {};
mainNoExtension = mainNoExtension.replace(
/(\.(umd|cjs|es|m))?\.(mjs|[tj]sx?)$/,
'',
);

mainsByFormat.es = replaceName(
pkg.module && !pkg.module.match(/src\//)
? pkg.module
: pkg['jsnext:main'] || 'x.esm.js',
mainNoExtension,
);
mainsByFormat.modern = replaceName(
(pkg.syntax && pkg.syntax.esmodules) || pkg.esmodule || 'x.modern.js',
mainNoExtension,
);
mainsByFormat.cjs = replaceName(pkg['cjs:main'] || 'x.js', mainNoExtension);
mainsByFormat.umd = replaceName(
pkg['umd:main'] || pkg.unpkg || 'x.umd.js',
mainNoExtension,
);
const mainsByFormat = {};

mainsByFormat.es = replaceName(
pkg.module && !pkg.module.match(/src\//)
? pkg.module
: pkg['jsnext:main'] || 'x.esm.js',
mainNoExtension,
);
mainsByFormat.modern = replaceName(
(pkg.syntax && pkg.syntax.esmodules) || pkg.esmodule || 'x.modern.js',
mainNoExtension,
);
mainsByFormat.cjs = replaceName(pkg['cjs:main'] || 'x.js', mainNoExtension);
mainsByFormat.umd = replaceName(
pkg['umd:main'] || pkg.unpkg || 'x.umd.js',
mainNoExtension,
);

const file = mainsByFormat[format] || mainsByFormat.cjs;
inputs[basename(file, extname(file))] = entry;
});

return mainsByFormat[format] || mainsByFormat.cjs;
return inputs;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This needs some cleanup but this should be done in a separate PR where we decouple more.

@wardpeet wardpeet closed this Oct 13, 2020
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.

Rollup and commonjs plugin Update serialize-javascript dependency
4 participants