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

Fix Github Actions #196

Closed
wants to merge 11 commits into from
Closed

Fix Github Actions #196

wants to merge 11 commits into from

Conversation

moonglum
Copy link
Member

@moonglum moonglum commented Feb 21, 2022

Updated the Github Actions, because they were using ancient Node versions. After that, I noticed that some tests are still failing. Some dependencies have changed their output. To decrease duplicated work, I updated all dependencies before doing adjustments. Everything is up to date now except @rollup/plugin-node-resolve, which breaks everything in a non-obvious and non-documented way. So I moved that to "later".

@@ -7,4 +7,4 @@ var index = _ => {

return index;

}());
})();
Copy link
Member Author

Choose a reason for hiding this comment

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

All IIFEs are now )() instead of ())

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, I wonder why (but don't have the heart to research it now)

Copy link
Member Author

Choose a reason for hiding this comment

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

I found the PR that introduced the change: rollup/rollup#4215
You can see it in the blame view here: https://github.com/rollup/rollup/blame/master/test/form/samples/mjs/_expected/iife.js

I don't really see a reason why though.

Copy link
Member Author

Choose a reason for hiding this comment

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

What this PR introduces is the output.generatedCode option which you can use to configure what JS syntax should be used for code generated by rollup (not the code you wrote yourself, but the code around it).

If I add the following to lib/bundle/config.js:

cfg.output = {
  generatedCode: "es2015"
}

Then, the resulting code of test_bundle_customization for IIFE will for example look like this:

--- a/./expected_iife.js
+++ b/./dist/bundle_iife.js
@@ -1,10 +1,5 @@
-var MYLIB = (function () {
-'use strict';
-
-var index = _ => {
+const index = _ => {
        console.log("lipsum");
 };

-return index;
-
-})();
+export { index as default };

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good find - I'd been wondering about modern syntax there for a while; we should keep that in mind for v3.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think we should look at it for 3.0 👍 Not sure if we need an additional option there, or if we determine it from the browserslist. But definitely worth consideration.

test/unit/test_bundling.js Outdated Show resolved Hide resolved
@moonglum moonglum requested a review from FND February 21, 2022 17:55
Copy link
Contributor

@FND FND left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, your comments were very helpful too. Looking good so far!

I might look into the remaining issues myself (plugin-node-resolve, exclude), but don't hold your breath...

@@ -7,4 +7,4 @@ var index = _ => {

return index;

}());
})();
Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, I wonder why (but don't have the heart to research it now)

test/cli/test_sourcemap/faucet.config.js Show resolved Hide resolved
@@ -93,22 +93,11 @@ console.log("[\\u2026] ".concat(util)); // eslint-disable-line no-console
filepath: path.resolve(FIXTURES_DIR, "./dist/bundle.js"),
/* eslint-disable max-len */
content: makeBundle(`
function createCommonjsModule(fn, basedir, module) {
Copy link
Member Author

Choose a reason for hiding this comment

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

So for me this looks like they simplified the generation of CommonJS Modules. Instead of injecting the code to generate the module, instead, they generate the module at built time.

@moonglum
Copy link
Member Author

When updating rollup/plugin-node-resolve from 11.2.1 (which works fine) to 13.0.0 (12 does not exist, it seems to be yanked), we get the following error when compiling:

TypeError: this.resolve is not a function
    at Object.resolveId (node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js:1080:45)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async resolveId (node_modules/rollup/dist/shared/rollup.js:21767:26)
    at async ModuleLoader.resolveId (node_modules/rollup/dist/shared/rollup.js:22067:19)
    at async /home/vagrant/Code/faucet-pipeline-js/node_modules/rollup/dist/shared/rollup.js:22353:42 {
  code: 'PLUGIN_ERROR',
  hook: 'resolveId',
  plugin: 'diskless',
  watchFiles: [
    'diskless:entry_point_1ae80c752ee1690c96fe83ddd2738d49.js'
  ]
}

When updating to 13.1.3 (the latest at point of writing), we get this error instead:

TypeError: Cannot read property 'custom' of undefined
    at Object.resolveId (node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js:1165:83)
    at Object.resolveId (lib/bundle/diskless.js:18:20)
    at /home/vagrant/Code/faucet-pipeline-js/node_modules/rollup/dist/shared/rollup.js:22795:37 {
  code: 'PLUGIN_ERROR',
  hook: 'resolveId',
  plugin: 'diskless',
  watchFiles: [
    'diskless:entry_point_2b1a97035d3d3193e06c2ebe612e7348.js'
  ]
}

@moonglum
Copy link
Member Author

Okay, summing up:

  • When updating node-resolve to 13.X, the CLI test suite as well as the "bundling" unit test pass. The "virtual" unit tests both fail with "Cannot read property 'custom' of undefined".
  • Due to the backtrace, as well as the locallity of test failure, I would assume that this is a failure that occurs from the combination of node-resolve and our "diskless" plugin.
  • The changelog for the version points out a breaking change, but I don't see how it could lead to the error.

As we say in German, right now "bin ich mit meinem Latein am Ende". I don't know enough about both the diskless as well as the node-resolve Plugin. My vote would be:
Let's merge this PR, it is a signficant improvement (updating all our packages to their latest version except one). Then, let's release it (probably as a minor, given that TypeScript and Babel both allow new features?). The issue with node-resolve should be treated separately in its own PR, but this way it doesn't block the release.

What do you think, @FND?

Copy link
Contributor

@FND FND left a comment

Choose a reason for hiding this comment

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

added minor tweaks to CI files (file extensions, aesthetics, actions' versions) - ran out of time for now, so will do an explanatory squash commit and release some other time

.github/dependabot.yaml Show resolved Hide resolved
.github/workflows/tests.yaml Show resolved Hide resolved
@FND
Copy link
Contributor

FND commented Mar 8, 2022

squashed as f3230c7 and released as v2.1.8 - thank you very much!

@FND FND closed this Mar 8, 2022
@FND FND deleted the fix-github-actions branch March 8, 2022 07:16
@moonglum
Copy link
Member Author

moonglum commented Mar 8, 2022

You're welcome 🙇

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

2 participants