mirror of
https://github.com/hanzoai/puppeteer.git
synced 2026-10-30 14:46:24 +00:00
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2024 Google Inc.
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
import path from 'node:path';
|
|
|
|
import {getBabelOutputPlugin} from '@rollup/plugin-babel';
|
|
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|
|
|
const cwd = process.cwd();
|
|
|
|
export default {
|
|
input: 'lib/puppeteer/puppeteer-core-browser.js',
|
|
output: {
|
|
format: 'iife',
|
|
file: 'lib/es5-iife/puppeteer-core-browser.js',
|
|
name: 'Puppeteer',
|
|
},
|
|
external: (id, parent, isResolved) => {
|
|
if (id.includes('BrowserConnector')) {
|
|
return false;
|
|
}
|
|
if (id.includes('BrowserWebSocketTransport')) {
|
|
return false;
|
|
}
|
|
if (id.includes('node_modules')) {
|
|
return true;
|
|
}
|
|
if (id.includes('@puppeteer/browsers')) {
|
|
return true;
|
|
}
|
|
if (id.startsWith(path.join(cwd, `lib`, `puppeteer`, `bidi`))) {
|
|
return true;
|
|
}
|
|
if (id.startsWith(path.join(cwd, `lib`, `puppeteer`, `node`))) {
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
plugins: [
|
|
nodeResolve({
|
|
browser: true,
|
|
}),
|
|
getBabelOutputPlugin({
|
|
plugins: [
|
|
'@babel/plugin-transform-class-static-block',
|
|
'@babel/plugin-transform-private-methods',
|
|
'@babel/plugin-transform-private-property-in-object',
|
|
'@babel/plugin-transform-class-properties',
|
|
'@babel/plugin-transform-dynamic-import',
|
|
'@babel/plugin-transform-modules-commonjs',
|
|
],
|
|
allowAllFormats: true,
|
|
compact: false,
|
|
}),
|
|
],
|
|
};
|