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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -11,7 +11,7 @@ max_line_length = 80
indent_style = tab
indent_size = 4

[*.{md,yml}]
[*.{md,yaml}]
indent_style = space

[COMMIT_EDITMSG]
Expand Down
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
FND marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 0 additions & 13 deletions .github/dependabot.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/nodejs.yml → .github/workflows/tests.yaml
Expand Up @@ -7,11 +7,12 @@ jobs:
strategy:
matrix:
node-version:
- 10.x
- 12.x
- 14.x
- 16.x
- 17.x
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2.3.0
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
FND marked this conversation as resolved.
Show resolved Hide resolved
with:
node-version: ${{ matrix.node-version }}
- run: npm install-test
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -26,10 +26,10 @@
"node": ">=8"
},
"dependencies": {
"@rollup/plugin-commonjs": "~16.0.0",
"@rollup/plugin-node-resolve": "~10.0.0",
"@rollup/plugin-commonjs": "~21.0.2",
"@rollup/plugin-node-resolve": "~11.2.1",
"faucet-pipeline-core": "^1.4.0",
"rollup": "^2.33.3",
"rollup": "^2.68.0",
"rollup-plugin-cleanup": "~3.2.1"
},
"devDependencies": {
Expand All @@ -38,8 +38,8 @@
"faucet-pipeline-jsmin": "file:pkg/faucet-pipeline-jsmin",
"faucet-pipeline-jsx": "file:pkg/faucet-pipeline-jsx",
"faucet-pipeline-typescript": "file:pkg/faucet-pipeline-typescript",
"json-diff": "^0.5.4",
"mocha": "^8.2.1",
"json-diff": "^0.7.1",
"mocha": "^9.2.1",
"npm-run-all": "^4.1.5",
"release-util-fnd": "^2.0.1"
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/faucet-pipeline-esnext/package.json
Expand Up @@ -13,9 +13,9 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@babel/core": "~7.12.3",
"@babel/preset-env": "~7.12.1",
"@rollup/plugin-babel": "~5.2.1",
"@babel/core": "~7.17.5",
"@babel/preset-env": "~7.16.11",
"@rollup/plugin-babel": "~5.3.0",
"faucet-pipeline-js": "2.1.7"
}
}
2 changes: 1 addition & 1 deletion pkg/faucet-pipeline-jsx/package.json
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "~7.12.5",
"@babel/plugin-transform-react-jsx": "~7.17.3",
"faucet-pipeline-esnext": "2.1.7"
}
}
5 changes: 3 additions & 2 deletions pkg/faucet-pipeline-typescript/package.json
Expand Up @@ -16,8 +16,9 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@rollup/plugin-typescript": "~6.1.0",
"@rollup/plugin-typescript": "~8.3.0",
"faucet-pipeline-js": "2.1.7",
"typescript": "~4.1.2"
"tslib": "~2.3.1",
FND marked this conversation as resolved.
Show resolved Hide resolved
"typescript": "~4.5.5"
}
}
1 change: 0 additions & 1 deletion test/cli/run
Expand Up @@ -25,7 +25,6 @@ end
begin "$root/test_sourcemap"
faucet --sourcemaps
assert_identical_sourcemap "./dist/bundle.js" "./expected.js" "./expected.js.map"
assert_identical_sourcemap "./dist/bundle_esnext.js" "./expected_esnext.js" "./expected_esnext.js.map"
end

begin "$root/test_jsx"
Expand Down
23 changes: 21 additions & 2 deletions test/cli/test_browserslist/expected_legacy.js
Expand Up @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) {
}
}

var Util = function Util() {
function _defineProperties(target, props) {
FND marked this conversation as resolved.
Show resolved Hide resolved
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}

function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}

var Util = /*#__PURE__*/_createClass(function Util() {
_classCallCheck(this, Util);
};
});
var FOO = "lorem ipsum";
var BAR = "dolor sit amet";

Expand Down
2 changes: 1 addition & 1 deletion test/cli/test_bundle_customization/expected_iife.js
Expand Up @@ -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.

4 changes: 2 additions & 2 deletions test/cli/test_bundle_customization/expected_umd.js
Expand Up @@ -2,12 +2,12 @@
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MYLIB = factory());
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

var index = _ => {
console.log("lipsum");
};

return index;

})));
}));
23 changes: 21 additions & 2 deletions test/cli/test_jsx/expected.js
Expand Up @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) {
}
}

var MyComponent = function MyComponent() {
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}

function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}

var MyComponent = /*#__PURE__*/_createClass(function MyComponent() {
_classCallCheck(this, MyComponent);
};
});

var el = createElement(MyComponent, {
type: "dummy"
Expand Down
2 changes: 1 addition & 1 deletion test/cli/test_manifest/expected.json
@@ -1 +1 @@
{"dist/bundle.js":"/assets/dist/bundle-6f9cdfdf5d45a70ad818b45090761ede.js"}
{"dist/bundle.js":"/assets/dist/bundle-7a1db6adc4ef815c9557d95c82779a74.js"}
4 changes: 2 additions & 2 deletions test/cli/test_manifest_uris/expected.json
@@ -1,4 +1,4 @@
{
"dist/foo.js":"/assets/foo-d252bfc59a9fd54bdd04535a90a0be25.js",
"dist/bar.js":"/assets/bar-913a3395880f817dd562e4adccf94168.js"
"dist/foo.js":"/assets/foo-71338920f697ae7208a107c326809bc1.js",
"dist/bar.js":"/assets/bar-0ddcb0327775137fe4fe372149de7e88.js"
}
14 changes: 0 additions & 14 deletions test/cli/test_sourcemap/expected_esnext.js

This file was deleted.

1 change: 0 additions & 1 deletion test/cli/test_sourcemap/expected_esnext.js.map

This file was deleted.

5 changes: 0 additions & 5 deletions test/cli/test_sourcemap/faucet.config.js
Expand Up @@ -7,11 +7,6 @@ module.exports = {
source: "./src/index.js",
target: "./dist/bundle.js",
format: "esm"
}, {
FND marked this conversation as resolved.
Show resolved Hide resolved
source: "./src/index.js",
target: "./dist/bundle_esnext.js",
format: "esm",
esnext: true
}],
plugins: [path.resolve(__dirname, "../../..")]
};
23 changes: 21 additions & 2 deletions test/cli/test_transpilation/expected.js
Expand Up @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) {
}
}

var Util = function Util() {
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}

function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}

var Util = /*#__PURE__*/_createClass(function Util() {
_classCallCheck(this, Util);
};
});
var FOO = "lorem ipsum";
var BAR = "dolor sit amet";

Expand Down
4 changes: 2 additions & 2 deletions test/cli/test_typescript/expected.js
Expand Up @@ -20,7 +20,7 @@ var generateArticle = function (params) {
var title = params.title, authors = params.authors;
if (typeof title !== "string") {
log(LogLevel.Debug, "auto-generating title");
title = title.main + ": " + title.sub;
title = "".concat(title.main, ": ").concat(title.sub);
FND marked this conversation as resolved.
Show resolved Hide resolved
}
return title + "\n" + authors.join(", ");
};
Expand All @@ -32,4 +32,4 @@ generateArticle({
authors: ["foo", "bar"]
});

}());
})();
2 changes: 1 addition & 1 deletion test/unit/expected/virtual_bundle_js1.js
Expand Up @@ -5,4 +5,4 @@ var UTIL = "UTIL";

console.log(UTIL);

}());
})();
2 changes: 1 addition & 1 deletion test/unit/expected/virtual_bundle_js2.js
Expand Up @@ -7,4 +7,4 @@ var MYLIB = "MY-LIB";

console.log(UTIL + MYLIB);

}());
})();
31 changes: 11 additions & 20 deletions test/unit/test_bundling.js
Expand Up @@ -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.

return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}

function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var dist = {exports: {}};

var dist = createCommonjsModule(function (module) {
/* eslint-disable */

(function (module) {
(function(window) {

var MYLIB = "MY-LIB";
Expand All @@ -118,9 +107,11 @@ var MYLIB = "MY-LIB";
}

}());
});
}(dist));

var MYLIB = dist.exports;

console.log("[\\u2026] ".concat(dist)); // eslint-disable-line no-console
console.log("[\\u2026] ".concat(MYLIB)); // eslint-disable-line no-console
`.trim())
/* eslint-enable max-len */
}]);
Expand Down Expand Up @@ -186,7 +177,7 @@ return lib;
assetManager.assertWrites([{
filepath: path.resolve(FIXTURES_DIR, "./dist/bundle.js"),
content: `
define(function () { 'use strict';
define((function () { 'use strict';

var util = "UTIL";

Expand All @@ -196,7 +187,7 @@ var lib = msg => {

return lib;

});
}));
`.trim() + "\n"
}]);
});
Expand Down Expand Up @@ -242,9 +233,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau

var MYLIB__default = /*#__PURE__*/_interopDefaultLegacy(MYLIB);

console.log(\`[…] $\{MYLIB__default['default']}\`); // eslint-disable-line no-console
console.log(\`[…] $\{MYLIB__default["default"]}\`); // eslint-disable-line no-console

}(MYLIB));
})(MYLIB);
`.trim() + "\n"
}]);
});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/util.js
Expand Up @@ -40,7 +40,7 @@ exports.MockAssetManager = class MockAssetManager extends AssetManager {
exports.makeBundle = function makeBundle(code, { compact } = {}) {
if(compact) {
return `
(function(){'use strict';${code}}());
(function(){'use strict';${code}})();
`.trim();
}

Expand All @@ -50,7 +50,7 @@ exports.makeBundle = function makeBundle(code, { compact } = {}) {

${code}

}());
})();
`.trim() + "\n";
};

Expand Down