Skip to content

Commit

Permalink
Merge branch 'master' into force-exit
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-theriault-swi committed Nov 1, 2023
2 parents 58bbc53 + fbf806a commit 7765fe5
Show file tree
Hide file tree
Showing 45 changed files with 947 additions and 393 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: 20
Expand Down Expand Up @@ -270,7 +270,7 @@ jobs:
- name: Checkout Commit
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand Down Expand Up @@ -300,8 +300,8 @@ jobs:
uses: codecov/codecov-action@v3
if: matrix.coverage
with:
# It appears adding the token may result in the coverage comment not being added
# token: ${{ secrets.CODECOV_TOKEN }}
# It appears adding the token may result in the coverage comment not being added
# token: ${{ secrets.CODECOV_TOKEN }}
commit_parent: ${{ github.event.pull_request.head.sha }}

publish:
Expand All @@ -324,7 +324,7 @@ jobs:
# Necessary to find the commits included in the release
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repl-artefacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
key: cargo-cache-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: cargo-cache
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache Node Modules
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# rollup changelog

## 4.2.0

_2023-10-31_

### Features

- Run parsing in multiple threads and introduce `parseAstAsync` helper function (#5202)

### Pull Requests

- [#5202](https://github.com/rollup/rollup/pull/5202): perf: introduce `parseAstAsync` and parallelize parsing AST (@sapphi-red)

## 4.1.6

_2023-10-31_

### Bug Fixes

- Fix a bug where emtpy block comments in certain positions could freeze Rollup (#5231)

### Pull Requests

- [#5228](https://github.com/rollup/rollup/pull/5228): build: ensure rust toolchain components for linting are installed (@jerome-benoit)
- [#5231](https://github.com/rollup/rollup/pull/5231): Render emtpy block comments after tree-shaken statements (@lukastaegert)
- [#5232](https://github.com/rollup/rollup/pull/5232): Revert specifying rustfmt and clippy in toolchain file as it breaks REPL build (@lukastaegert)

## 4.1.5

_2023-10-28_

### Bug Fixes

- Fix an issue where actual entries that were also implicit entries could remain implicit (#5220)

### Pull Requests

- [#5209](https://github.com/rollup/rollup/pull/5209): Document Vite workaround for browser build (@curran)
- [#5215](https://github.com/rollup/rollup/pull/5215): chore(deps): update dependency lint-staged to v15 (@renovate[bot])
- [#5216](https://github.com/rollup/rollup/pull/5216): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])
- [#5218](https://github.com/rollup/rollup/pull/5218): Update license plugin (@lukastaegert)
- [#5219](https://github.com/rollup/rollup/pull/5219): Fix error highlight in REPL (@lukastaegert)
- [#5220](https://github.com/rollup/rollup/pull/5220): Fix race condition when emitting implicitly dependent entries (@lukastaegert)
- [#5224](https://github.com/rollup/rollup/pull/5224): chore(deps): update actions/setup-node action to v4 (@renovate[bot])
- [#5225](https://github.com/rollup/rollup/pull/5225): chore(deps): lock file maintenance minor/patch updates (@renovate[bot])

## 4.1.4

_2023-10-16_
Expand Down
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/browser",
"version": "4.1.4",
"version": "4.2.0",
"description": "Next-generation ES module bundler browser build",
"main": "dist/rollup.browser.js",
"module": "dist/es/rollup.browser.js",
Expand Down
10 changes: 10 additions & 0 deletions browser/src/wasm.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
// eslint-disable-next-line import/no-unresolved
export { parse, xxhashBase64Url } from '../../wasm/bindings_wasm.js';

// eslint-disable-next-line import/no-unresolved
import { parse } from '../../wasm/bindings_wasm.js';
export async function parseAsync(
code: string,
allowReturnOutsideFunction: boolean,
_signal?: AbortSignal | undefined | null
) {
return parse(code, allowReturnOutsideFunction);
}
31 changes: 31 additions & 0 deletions docs/javascript-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,34 @@ assert.deepEqual(
}
);
```

There is also an asynchronous version that parses in a different thread in the non-wasm builds of Rollup:

```js
import { parseAstAsync } from 'rollup/parseAst';
import assert from 'node:assert';

assert.deepEqual(
await parseAstAsync('return 42;', { allowReturnOutsideFunction: true }),
{
type: 'Program',
start: 0,
end: 10,
body: [
{
type: 'ReturnStatement',
start: 0,
end: 10,
argument: {
type: 'Literal',
start: 7,
end: 9,
raw: '42',
value: 42
}
}
],
sourceType: 'module'
}
);
```
1 change: 1 addition & 0 deletions native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/* auto-generated by NAPI-RS */

export function parse(code: string, allowReturnOutsideFunction: boolean): Buffer
export function parseAsync(code: string, allowReturnOutsideFunction: boolean, signal?: AbortSignal | undefined | null): Promise<Buffer>
export function xxhashBase64Url(input: Uint8Array): string
3 changes: 2 additions & 1 deletion native.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ If this is important to you, please consider supporting Rollup to make a native

const packageBase = imported.musl && isMusl() ? imported.musl : imported.base;
const localName = `./rollup.${packageBase}.node`;
const { parse, xxhashBase64Url } = require(
const { parse, parseAsync, xxhashBase64Url } = require(
existsSync(join(__dirname, localName)) ? localName : `@rollup/rollup-${packageBase}`
);

module.exports.parse = parse;
module.exports.parseAsync = parseAsync;
module.exports.xxhashBase64Url = xxhashBase64Url;
2 changes: 2 additions & 0 deletions native.wasm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { parse, xxhashBase64Url } = require('./wasm-node/bindings_wasm.js');

exports.parse = parse;
exports.parseAsync = async (code, allowReturnOutsideFunction, _signal) =>
parse(code, allowReturnOutsideFunction);
exports.xxhashBase64Url = xxhashBase64Url;

0 comments on commit 7765fe5

Please sign in to comment.