Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rollup/plugins
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 03c1af0b018b24fa05256ec693820006675db53c
Choose a base ref
...
head repository: rollup/plugins
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d9a127755f5202741c6409d0b568885b6542d308
Choose a head ref
  • 14 commits
  • 32 files changed
  • 3 contributors

Commits on Jan 20, 2023

  1. chore(release): auto-install v3.0.3

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    4e3be03 View commit details
  2. chore(release): buble v1.0.2

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    701b642 View commit details
  3. chore(release): commonjs v24.0.1

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    e62c880 View commit details
  4. chore(release): data-uri v1.0.2

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    f570148 View commit details
  5. chore(release): dsv v3.0.2

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    834eb12 View commit details
  6. chore(release): dynamic-import-vars v2.0.3

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    b0ac26a View commit details
  7. chore(release): eslint v9.0.3

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    28a5319 View commit details
  8. chore(release): graphql v2.0.3

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    e5ded11 View commit details
  9. chore(release): html v1.0.2

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    cd5df11 View commit details
  10. chore(release): image v3.0.2

    Release Workflow committed Jan 20, 2023
    1
    Copy the full SHA
    e75744b View commit details

Commits on Jan 23, 2023

  1. feat(terser): Update WorkerPool to reuse Workers (#1409)

    * Update WorkerPool to reuse Workers
    
    * test number of workers used
    
    * Address feedback
    
    * Fix ESLint warnings
    
    * Use regular `for` loop
    
    * Address feedback
    dasa authored Jan 23, 2023
    1
    Copy the full SHA
    74dbb42 View commit details
  2. chore(release): terser v0.4.0

    Release Workflow committed Jan 23, 2023
    1
    Copy the full SHA
    bc5cf91 View commit details

Commits on Apr 4, 2023

  1. 1
    Copy the full SHA
    9ca975e View commit details
  2. chore(release): alias v4.0.4

    Release Workflow committed Apr 4, 2023
    Copy the full SHA
    d9a1277 View commit details
8 changes: 8 additions & 0 deletions packages/alias/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-alias ChangeLog

## v4.0.4

_2023-04-04_

### Updates

- docs: fix README esm error [#1451](https://github.com/rollup/plugins/pull/1451)

## v4.0.3

_2023-01-20_
2 changes: 1 addition & 1 deletion packages/alias/README.md
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/
```js
import alias from '@rollup/plugin-alias';

module.exports = {
export default {
input: 'src/index.js',
output: {
dir: 'output',
2 changes: 1 addition & 1 deletion packages/alias/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-alias",
"version": "4.0.3",
"version": "4.0.4",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/auto-install/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-auto-install ChangeLog

## v3.0.3

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v3.0.2

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/auto-install/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-auto-install",
"version": "3.0.2",
"version": "3.0.3",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/buble/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-buble ChangeLog

## v1.0.2

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v1.0.1

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/buble/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-buble",
"version": "1.0.1",
"version": "1.0.2",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/commonjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-commonjs ChangeLog

## v24.0.1

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v24.0.0

_2022-12-18_
2 changes: 1 addition & 1 deletion packages/commonjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-commonjs",
"version": "24.0.0",
"version": "24.0.1",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/data-uri/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-data-uri ChangeLog

## v1.0.2

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v1.0.1

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/data-uri/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-data-uri",
"version": "1.0.1",
"version": "1.0.2",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/dsv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-dsv ChangeLog

## v3.0.2

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v3.0.1

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/dsv/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-dsv",
"version": "3.0.1",
"version": "3.0.2",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/dynamic-import-vars/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-dynamic-import-vars ChangeLog

## v2.0.3

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v2.0.2

_2022-12-17_
2 changes: 1 addition & 1 deletion packages/dynamic-import-vars/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-dynamic-import-vars",
"version": "2.0.2",
"version": "2.0.3",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/eslint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-eslint ChangeLog

## v9.0.3

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v9.0.2

_2023-01-13_
2 changes: 1 addition & 1 deletion packages/eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-eslint",
"version": "9.0.2",
"version": "9.0.3",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/graphql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-graphql ChangeLog

## v2.0.3

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v2.0.2

_2022-10-27_
2 changes: 1 addition & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-graphql",
"version": "2.0.2",
"version": "2.0.3",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/html/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-html ChangeLog

## v1.0.2

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v1.0.1

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/html/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-html",
"version": "1.0.1",
"version": "1.0.2",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/image/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-image ChangeLog

## v3.0.2

_2023-01-20_

### Bugfixes

- fix: types should come first in exports [#1403](https://github.com/rollup/plugins/pull/1403)

## v3.0.1

_2022-10-21_
2 changes: 1 addition & 1 deletion packages/image/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-image",
"version": "3.0.1",
"version": "3.0.2",
"publishConfig": {
"access": "public"
},
8 changes: 8 additions & 0 deletions packages/terser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @rollup/plugin-terser ChangeLog

## v0.4.0

_2023-01-23_

### Features

- feat: Update WorkerPool to reuse Workers [#1409](https://github.com/rollup/plugins/pull/1409)

## v0.3.0

_2023-01-06_
2 changes: 1 addition & 1 deletion packages/terser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rollup/plugin-terser",
"version": "0.3.0",
"version": "0.4.0",
"publishConfig": {
"access": "public"
},
2 changes: 2 additions & 0 deletions packages/terser/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const taskInfo = Symbol('taskInfo');
export const freeWorker = Symbol('freeWorker');
27 changes: 23 additions & 4 deletions packages/terser/src/module.ts
Original file line number Diff line number Diff line change
@@ -9,15 +9,23 @@ import { WorkerPool } from './worker-pool';
export default function terser(input: Options = {}) {
const { maxWorkers, ...options } = input;

const workerPool = new WorkerPool({
filePath: fileURLToPath(import.meta.url),
maxWorkers
});
let workerPool: WorkerPool | null | undefined;
let numOfChunks = 0;
let numOfWorkersUsed = 0;

return {
name: 'terser',

async renderChunk(code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) {
if (!workerPool) {
workerPool = new WorkerPool({
filePath: fileURLToPath(import.meta.url),
maxWorkers
});
}

numOfChunks += 1;

const defaultOptions: Options = {
sourceMap: outputOptions.sourcemap === true || typeof outputOptions.sourcemap === 'string'
};
@@ -80,7 +88,18 @@ export default function terser(input: Options = {}) {
return result;
} catch (e) {
return Promise.reject(e);
} finally {
numOfChunks -= 1;
if (numOfChunks === 0) {
numOfWorkersUsed = workerPool.numWorkers;
workerPool.close();
workerPool = null;
}
}
},

get numOfWorkersUsed() {
return numOfWorkersUsed;
}
};
}
11 changes: 11 additions & 0 deletions packages/terser/src/type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { AsyncResource } from 'async_hooks';
import type { Worker } from 'worker_threads';

import type { MinifyOptions } from 'terser';

import type { taskInfo } from './constants';

export interface Options extends MinifyOptions {
nameCache?: Record<string, any>;
maxWorkers?: number;
@@ -12,6 +17,12 @@ export interface WorkerContext {

export type WorkerCallback = (err: Error | null, output?: WorkerOutput) => void;

interface WorkerPoolTaskInfo extends AsyncResource {
done(err: Error | null, result: any): void;
}

export type WorkerWithTaskInfo = Worker & { [taskInfo]?: WorkerPoolTaskInfo | null };

export interface WorkerContextSerialized {
code: string;
options: string;
Loading