Skip to content

Commit 5de76e9

Browse files
committed
Switching to esbuild (wip)
1 parent dcde426 commit 5de76e9

File tree

86 files changed

+150
-1548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+150
-1548
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ jobs:
77
strategy:
88
matrix:
99
node-version:
10-
- 10.x
1110
- 12.x
11+
- 14.x
12+
- 16.x
1213
steps:
1314
- uses: actions/checkout@v1
1415
- uses: actions/setup-node@v1

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ faucet-pipeline-js version history
22
==================================
33

44

5+
v3.0.0
6+
------
7+
8+
_unreleased_
9+
10+
* Switch from rollup to esbuild
11+
* Support for TypeScript, JSX and minification built-in (no plugin required)
12+
* ESM is the default output format
13+
* `--compact` defaults to minify, mangle remains opt-in
14+
* Drop support for:
15+
* transpilation to pre-ES6 code
16+
* UMD, CJS and IIFE output format (only ESM is supported)
17+
18+
519
v2.1.6
620
------
721

lib/bundle.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"use strict";
2+
3+
let esbuild = require("esbuild");
4+
let { abort } = require("faucet-pipeline-core/lib/util");
5+
6+
module.exports = class Bundle {
7+
constructor(entryPoint, target, config) {
8+
if(config.format && config.format !== "esm") {
9+
abort(`Unsupported format ${config.format}`);
10+
}
11+
12+
this.entryPoints = [entryPoint];
13+
this.target = target;
14+
this.fingerprint = config.fingerprint;
15+
this.compact = config.compact;
16+
this.jsx = config.jsx;
17+
}
18+
19+
// TODO: skip if files are not relevant
20+
// via: Object.keys(res.metafile.inputs);
21+
async compile(filepaths) {
22+
let result = esbuild.buildSync({
23+
entryPoints: this.entryPoints,
24+
bundle: true,
25+
format: "esm",
26+
write: false,
27+
charset: "utf8",
28+
metafile: true,
29+
minifyWhitespace: !!this.compact,
30+
minifyIdentifiers: this.compact === "mangle",
31+
outdir: "out",
32+
jsxFactory: this.jsx && this.jsx.pragma,
33+
jsxFragment: this.jsx && this.jsx.fragment
34+
});
35+
36+
// TODO: write error if error occurred
37+
// TODO: outputFiles is an array of all files that would have been written
38+
return {
39+
code: result.outputFiles[0].text
40+
};
41+
}
42+
};

lib/bundle/babel.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

lib/bundle/basic.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/bundle/bundler.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

lib/bundle/config.js

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)