Skip to content

Commit

Permalink
feat(rlb): target the Node version defined in the engines.node field (
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer authored Oct 15, 2024
1 parent 36cc2fa commit 7b048b1
Show file tree
Hide file tree
Showing 20 changed files with 401 additions and 221 deletions.
44 changes: 28 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
* [#275]: support for `exports` as a string.

### Changed
* [#234]: **BREAKING CHANGE**: updated dependencies:

| Dependency | Old version | New version |
| ---------- | ----------- | ----------- |
| ⭐ `semver` | N/A | `^7.6.3` |

New dependencies are marked with the "⭐" emoji.
* [#234]: **BREAKING CHANGE**: the transpilation target is now determined by the `engines.node` field in the `package.json` file and default to the `current` version (the one used to run the bundler).


## [0.24.0] – 2024-10-08
### Changed
* [#321]: **BREAKING CHANGE**: updated dependencies:

| Dependency | Old version | New version |
| ---------------------------------------- | ----------- | ----------- |
| `@babel/core` | `^7.24.5` | `^7.25.7` |
| `@babel/plugin-syntax-import-assertions` | `^7.24.1` | `^7.25.7` |
| `@babel/preset-env` | `^7.24.5` | `^7.25.7` |
| ⚠️ `@rollup/plugin-commonjs` | `^25.0.7` | `^28.0.0` |
| ⚠️ `@rollup/plugin-typescript` | `^11.1.6` | `^12.1.0` |
| `globby` | `^14.0.1` | `^14.0.2` |
| `magic-string` | `^0.30.1` | `^0.30.11` |
| ⚠️ `rimraf` | `^5.0.5` | `^6.0.1` |
| `rollup` | `^4.17.2` | `^4.24.0` |
| `rollup-plugin-dts` | `^6.1.0` | `^6.1.1` |
| `tslib` | `^2.6.2` | `^2.7.0` |
| `typescript` | `^5.4.5` | `^5.6.2` |

Dependencies with major version change are marked with the "⚠️" emoji.
| Dependency | Old version | New version |
| ---------------------------------------- | ----------- | ----------- |
| `@babel/core` | `^7.24.5` | `^7.25.7` |
| `@babel/plugin-syntax-import-assertions` | `^7.24.1` | `^7.25.7` |
| `@babel/preset-env` | `^7.24.5` | `^7.25.7` |
| ⚠️ `@rollup/plugin-commonjs` | `^25.0.7` | `^28.0.0` |
| ⚠️ `@rollup/plugin-typescript` | `^11.1.6` | `^12.1.0` |
| `globby` | `^14.0.1` | `^14.0.2` |
| `magic-string` | `^0.30.1` | `^0.30.11` |
| ⚠️ `rimraf` | `^5.0.5` | `^6.0.1` |
| `rollup` | `^4.17.2` | `^4.24.0` |
| `rollup-plugin-dts` | `^6.1.0` | `^6.1.1` |
| `tslib` | `^2.6.2` | `^2.7.0` |
| `typescript` | `^5.4.5` | `^5.6.2` |

Dependencies with major version change are marked with the "⚠️" emoji.
* [#327]: **BREAKING CHANGE**: the value of the `outDir` from the `tsconfig.json` file is overridden to point to the same directory as the one in Rollup's configuration.

### Fixed
Expand Down Expand Up @@ -404,6 +415,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
[#230]: https://github.com/Comandeer/rollup-lib-bundler/issues/230
[#232]: https://github.com/Comandeer/rollup-lib-bundler/issues/232
[#233]: https://github.com/Comandeer/rollup-lib-bundler/issues/233
[#234]: https://github.com/Comandeer/rollup-lib-bundler/issues/234
[#235]: https://github.com/Comandeer/rollup-lib-bundler/issues/235
[#240]: https://github.com/Comandeer/rollup-lib-bundler/issues/240
[#242]: https://github.com/Comandeer/rollup-lib-bundler/issues/242
Expand Down
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ No configuration. Consider it a feature.

## How does it work?

It gets `package.json` from the current working directory, parses it and get neeeded info:
It gets `package.json` from the current working directory, parses it and fetches the neeeded info:

* `name`, `author`, `version` and `license` to create beautiful banner comment,
* `exports.import` for saving ESM bundle.
* `exports.import` to determine where to save ESM bundle (see the ["Supported `exports` syntax"](#supported-exports-syntax) section for more info).

Then the bundling happens. The default entry point for Rollup is `src/index.js`.

Expand Down Expand Up @@ -94,7 +94,7 @@ Each subpath is translated to appropriate file in `src` directory. Basically, `.

As of version 0.19.0 the bundler also automatically omits bundling bundles inside other bundles. If there were an import of the `src/chunk.js` file inside the `src/index.js` file in the above structure, then the `dist/package.(c|m)js` file would contain an import from `dist/chunk.(c|m)js` file instead of the content of the other bundle.

### Supported `exports` syntax
## Supported `exports` syntax

The bundler supports only the subset of the `exports` syntax allowed by the Node.js:

Expand Down Expand Up @@ -137,6 +137,21 @@ The bundler supports only the subset of the `exports` syntax allowed by the Node
}
}
```
## Transpilation

The bundler transpiles all the code with Babel. The transpilation target can be specified with the `engines.node` field in the `package.json` file:

```json
{
"engines": {
"node": "20.1.0"
}
}
```

Any valid [semver syntax](https://semver.npmjs.com/) is supported.

If the `engines.node` field is not specified or it contains invalid version, the bundler fallbacks to the `current` version – so the version of Node that was used to run the bundler.

## TypeScript support

Expand Down
Loading

0 comments on commit 7b048b1

Please sign in to comment.