@rollup/plugin-terser
Advanced tools
Comparing version 0.4.0 to 0.4.3
@@ -14,2 +14,6 @@ 'use strict'; | ||
const taskInfo = Symbol('taskInfo'); | ||
const freeWorker = Symbol('freeWorker'); | ||
const workerPoolWorkerFlag = 'WorkerPoolWorker'; | ||
/** | ||
@@ -28,3 +32,3 @@ * Duck typing worker context. | ||
function runWorker() { | ||
if (worker_threads.isMainThread || !worker_threads.parentPort) { | ||
if (worker_threads.isMainThread || !worker_threads.parentPort || worker_threads.workerData !== workerPoolWorkerFlag) { | ||
return; | ||
@@ -54,5 +58,2 @@ } | ||
const taskInfo = Symbol('taskInfo'); | ||
const freeWorker = Symbol('freeWorker'); | ||
class WorkerPoolTaskInfo extends async_hooks.AsyncResource { | ||
@@ -108,3 +109,5 @@ constructor(callback) { | ||
addNewWorker() { | ||
const worker = new worker_threads.Worker(this.filePath); | ||
const worker = new worker_threads.Worker(this.filePath, { | ||
workerData: workerPoolWorkerFlag | ||
}); | ||
worker.on('message', (result) => { | ||
@@ -111,0 +114,0 @@ var _a; |
@@ -1,2 +0,2 @@ | ||
import { isMainThread, parentPort, Worker } from 'worker_threads'; | ||
import { isMainThread, parentPort, workerData, Worker } from 'worker_threads'; | ||
import { isObject, hasOwnProperty, merge } from 'smob'; | ||
@@ -10,2 +10,6 @@ import { minify } from 'terser'; | ||
const taskInfo = Symbol('taskInfo'); | ||
const freeWorker = Symbol('freeWorker'); | ||
const workerPoolWorkerFlag = 'WorkerPoolWorker'; | ||
/** | ||
@@ -24,3 +28,3 @@ * Duck typing worker context. | ||
function runWorker() { | ||
if (isMainThread || !parentPort) { | ||
if (isMainThread || !parentPort || workerData !== workerPoolWorkerFlag) { | ||
return; | ||
@@ -50,5 +54,2 @@ } | ||
const taskInfo = Symbol('taskInfo'); | ||
const freeWorker = Symbol('freeWorker'); | ||
class WorkerPoolTaskInfo extends AsyncResource { | ||
@@ -104,3 +105,5 @@ constructor(callback) { | ||
addNewWorker() { | ||
const worker = new Worker(this.filePath); | ||
const worker = new Worker(this.filePath, { | ||
workerData: workerPoolWorkerFlag | ||
}); | ||
worker.on('message', (result) => { | ||
@@ -107,0 +110,0 @@ var _a; |
{ | ||
"name": "@rollup/plugin-terser", | ||
"version": "0.4.0", | ||
"version": "0.4.3", | ||
"publishConfig": { | ||
@@ -64,5 +64,5 @@ "access": "public" | ||
"dependencies": { | ||
"serialize-javascript": "^6.0.0", | ||
"smob": "^0.0.6", | ||
"terser": "^5.15.1" | ||
"serialize-javascript": "^6.0.1", | ||
"smob": "^1.0.0", | ||
"terser": "^5.17.4" | ||
}, | ||
@@ -69,0 +69,0 @@ "devDependencies": { |
export const taskInfo = Symbol('taskInfo'); | ||
export const freeWorker = Symbol('freeWorker'); | ||
export const workerPoolWorkerFlag = 'WorkerPoolWorker'; |
@@ -8,3 +8,3 @@ import { AsyncResource } from 'async_hooks'; | ||
import { freeWorker, taskInfo } from './constants'; | ||
import { freeWorker, taskInfo, workerPoolWorkerFlag } from './constants'; | ||
@@ -85,3 +85,5 @@ import type { | ||
private addNewWorker() { | ||
const worker: WorkerWithTaskInfo = new Worker(this.filePath); | ||
const worker: WorkerWithTaskInfo = new Worker(this.filePath, { | ||
workerData: workerPoolWorkerFlag | ||
}); | ||
@@ -88,0 +90,0 @@ worker.on('message', (result) => { |
@@ -1,2 +0,2 @@ | ||
import { isMainThread, parentPort } from 'worker_threads'; | ||
import { isMainThread, parentPort, workerData } from 'worker_threads'; | ||
@@ -7,2 +7,4 @@ import { hasOwnProperty, isObject } from 'smob'; | ||
import { workerPoolWorkerFlag } from './constants'; | ||
import type { WorkerContextSerialized, WorkerOutput } from './type'; | ||
@@ -26,3 +28,3 @@ | ||
export function runWorker() { | ||
if (isMainThread || !parentPort) { | ||
if (isMainThread || !parentPort || workerData !== workerPoolWorkerFlag) { | ||
return; | ||
@@ -29,0 +31,0 @@ } |
import type { Plugin } from 'rollup'; | ||
import type { MinifyOptions } from 'terser'; | ||
export interface Options extends MinifyOptions { | ||
nameCache?: Record<string, any>; | ||
maxWorkers?: number; | ||
} | ||
/** | ||
@@ -10,2 +15,2 @@ * A Rollup plugin to generate a minified output bundle. | ||
*/ | ||
export default function terser(options?: MinifyOptions): Plugin; | ||
export default function terser(options?: Options): Plugin; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28603
731
+ Addedsmob@1.5.0(transitive)
- Removedsmob@0.0.6(transitive)
Updatedserialize-javascript@^6.0.1
Updatedsmob@^1.0.0
Updatedterser@^5.17.4