Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ jobs:
matrix:
node-version:
- 18.x
- 21.x
- 22.x
- latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install-test
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ faucet-pipeline-js version history
==================================


v3.0.2
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 think we will go for 3.1.0, right?

------

_2025-02-01_

notable changes for end users:

* dropped support for obsolete Node versions; now requires Node v18 or later
* dropped support for undocumented ESM aliases
* reduced number of dependencies

no significant changes for developers


v3.0.1
------

Expand Down
5 changes: 3 additions & 2 deletions lib/bundle/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

let { loadExtension } = require("faucet-pipeline-core/lib/util");

module.exports = function generateTranspiler({ esnext, jsx, exclude }, { browsers }) {
module.exports = async function generateTranspiler({ esnext, jsx, exclude },
{ browsers }) { // eslint-disable-line indent
let settings = {
babelHelpers: "bundled"
};
Expand Down Expand Up @@ -40,7 +41,7 @@ module.exports = function generateTranspiler({ esnext, jsx, exclude }, { browser
settings.plugins = plugins;
}

let babel = loadExtension("@rollup/plugin-babel",
let babel = await loadExtension("@rollup/plugin-babel",
"failed to activate ESNext transpiler", "faucet-pipeline-esnext");
return babel.default(settings);
};
20 changes: 9 additions & 11 deletions lib/bundle/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ let { nodeResolve } = require("@rollup/plugin-node-resolve");

let MODULE_FORMATS = { // maps faucet identifiers to Rollup identifiers
esm: true,
es: "esm", // alias
es6: "esm", // alias
Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly have no idea why we had those aliases in the first place; "esm" probably wasn't firmly established back then? 👴

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, exactly

umd: true,
amd: true,
commonjs: "cjs",
cjs: false, // deprecated in favor of `commonjs`
iife: true
};
let NAMELESS_MODULES = new Set(["es", "amd", "cjs"]); // NB: Rollup identifiers
let NAMELESS_MODULES = new Set(["esm", "amd", "cjs"]); // NB: Rollup identifiers
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be sure: This should always have been "esm" as far as Rollup (not faucet) was concerned?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is my understanding, yes!


module.exports = generateConfig;

Expand Down Expand Up @@ -45,9 +43,9 @@ module.exports = generateConfig;
// * `sourcemaps`, if truthy, activates inline source-map generation
// * `compact`, if truthy, compresses the bundle's code - see `determineCompacting`
// for compression levels, determined by the respective value
function generateConfig({ externals, format, exports, // eslint-disable-next-line indent
esnext, jsx, typescript, // eslint-disable-next-line indent
sourcemaps, compact }, { browsers }) {
async function generateConfig({ externals, format,
exports, esnext, jsx, typescript, // eslint-disable-line indent
sourcemaps, compact }, { browsers }) { // eslint-disable-line indent
let cfg = { sourcemap: sourcemaps };
let plugins = [];
let extensions = [".js"];
Expand Down Expand Up @@ -75,11 +73,11 @@ function generateConfig({ externals, format, exports, // eslint-disable-next-lin
console.error("transpiling JavaScript for", browsers.join(", "));
}

let plugin = generateTranspiler(transpiler, { browsers });
let plugin = await generateTranspiler(transpiler, { browsers });
plugins.push(plugin);
}
if(typescript) {
let ts = loadExtension("@rollup/plugin-typescript",
let ts = await loadExtension("@rollup/plugin-typescript",
"failed to activate TypeScript", "faucet-pipeline-typescript");
extensions.push(".ts");
// TODO: provide defaults and abstractions for low-level options?
Expand All @@ -92,7 +90,7 @@ function generateConfig({ externals, format, exports, // eslint-disable-next-lin
]);
if(compact) {
cfg.compact = true;
plugins = plugins.concat(determineCompacting(compact));
plugins = plugins.concat(await determineCompacting(compact));
}
cfg.plugins = plugins;

Expand Down Expand Up @@ -138,7 +136,7 @@ function determineModuleFormat(format = "esm") {
}
}

function determineCompacting(type = true) {
async function determineCompacting(type = true) {
switch(type) {
case true: // default
case "compact":
Expand All @@ -153,7 +151,7 @@ function determineCompacting(type = true) {
abort(`unknown compacting option ${type}`);
}

let terser = loadExtension("@rollup/plugin-terser",
let terser = await loadExtension("@rollup/plugin-terser",
"failed to activate minification", "faucet-pipeline-jsmin");
return terser(options);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = class Bundle {
return false;
}

return generateBundle(this.entryPoint, this._config, this._cache).
return this._config.
then(config => generateBundle(this.entryPoint, config, this._cache)).
then(({ code, modules, cache }) => {
this._modules = modules;
this._cache = cache;
Expand Down
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline-js",
"version": "3.0.1",
"version": "3.0.2",
"description": "JavaScript module bundling for faucet-pipeline",
"author": "FND",
"contributors": [
Expand All @@ -17,19 +17,19 @@
},
"main": "lib/index.js",
"scripts": {
"test": "npm-run-all lint --parallel test:unit test:cli",
"test": "npm run lint && npm run test:unit && npm run test:cli",
"test:cli": "./test/cli/run",
"test:unit": "mocha test/unit/test_*.js",
"lint": "eslint --cache --ext .js --ext .jsx lib bin/validate-dependencies test/unit samples pkg && echo ✓"
"test:unit": "node --test ./test/unit/test_*.js",
"lint": "eslint --cache --ext .js --ext .jsx ./lib ./bin/validate-dependencies ./test/unit ./samples ./pkg && echo ✓"
},
"engines": {
"node": ">=14"
"node": ">=18"
},
"dependencies": {
"@rollup/plugin-commonjs": "~25.0.7",
"@rollup/plugin-node-resolve": "~15.2.3",
"faucet-pipeline-core": "^2.0.0",
"rollup": "^4.3.0",
"@rollup/plugin-commonjs": "~26.0.3",
"@rollup/plugin-node-resolve": "~16.0.0",
"faucet-pipeline-core": "^2.0.0 || ^3.0.0",
"rollup": "^4.34.0",
"rollup-plugin-cleanup": "~3.2.1"
},
"devDependencies": {
Expand All @@ -39,8 +39,6 @@
"faucet-pipeline-jsx": "file:pkg/faucet-pipeline-jsx",
"faucet-pipeline-typescript": "file:pkg/faucet-pipeline-typescript",
"json-diff": "^1.0.6",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"release-util-fnd": "^3.0.0"
}
}
8 changes: 4 additions & 4 deletions pkg/faucet-pipeline-esnext/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline-esnext",
"version": "3.0.1",
"version": "3.0.2",
"description": "ES6 and beyond for faucet-pipeline",
"author": "FND",
"license": "Apache-2.0",
Expand All @@ -13,9 +13,9 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@babel/core": "~7.23.3",
"@babel/preset-env": "~7.23.3",
"@babel/core": "~7.26.7",
"@babel/preset-env": "~7.26.7",
"@rollup/plugin-babel": "~6.0.4",
"faucet-pipeline-js": "3.0.1"
"faucet-pipeline-js": "3.0.2"
}
}
2 changes: 1 addition & 1 deletion pkg/faucet-pipeline-jsmin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline-jsmin",
"version": "3.0.1",
"version": "3.0.2",
"description": "JavaScript minification for faucet-pipeline",
"author": "FND",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions pkg/faucet-pipeline-jsx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline-jsx",
"version": "3.0.1",
"version": "3.0.2",
"description": "JSX for faucet-pipeline",
"author": "FND",
"license": "Apache-2.0",
Expand All @@ -13,7 +13,7 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "~7.22.15",
"faucet-pipeline-esnext": "3.0.1"
"@babel/plugin-transform-react-jsx": "~7.25.9",
"faucet-pipeline-esnext": "3.0.2"
}
}
10 changes: 5 additions & 5 deletions pkg/faucet-pipeline-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "faucet-pipeline-typescript",
"version": "3.0.1",
"version": "3.0.2",
"description": "TypeScript for faucet-pipeline",
"author": "FND",
"contributors": [
Expand All @@ -16,9 +16,9 @@
"url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues"
},
"dependencies": {
"@rollup/plugin-typescript": "~11.1.5",
"faucet-pipeline-js": "3.0.1",
"tslib": "~2.6.2",
"typescript": "~5.2.2"
"@rollup/plugin-typescript": "~12.1.2",
"faucet-pipeline-js": "3.0.2",
"tslib": "~2.8.1",
"typescript": "~5.7.3"
}
}
38 changes: 5 additions & 33 deletions test/cli/test_browserslist/expected_legacy.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
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, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
function _createClass(e, r, t) {
return Object.defineProperty(e, "prototype", {
writable: false
});
return Constructor;
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}), e;
}

var Util = /*#__PURE__*/_createClass(function Util() {
Expand Down
38 changes: 5 additions & 33 deletions test/cli/test_jsx/expected.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
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, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
function _createClass(e, r, t) {
return Object.defineProperty(e, "prototype", {
writable: false
});
return Constructor;
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}), e;
}

var MyComponent = /*#__PURE__*/_createClass(function MyComponent() {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/test_sourcemap/expected.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 5 additions & 33 deletions test/cli/test_transpilation/expected.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
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, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
function _createClass(e, r, t) {
return Object.defineProperty(e, "prototype", {
writable: false
});
return Constructor;
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}), e;
}

var Util = /*#__PURE__*/_createClass(function Util() {
Expand Down
7 changes: 3 additions & 4 deletions test/unit/test_bundling.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* global describe, it, beforeEach, afterEach */
"use strict";

let { MockAssetManager, makeBundle, FIXTURES_DIR } = require("./util");
let faucetJS = require("../../lib").plugin;
let path = require("path");
let assert = require("assert");
let { describe, it, beforeEach, afterEach } = require("node:test");
let path = require("node:path");
let assert = require("node:assert");

let DEFAULT_OPTIONS = {
browsers: {}
Expand Down
Loading