mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
f42336cf83
This PR moves the puppeteer source code into separate mono-repo packages: - `puppeteer` and `puppeteer-core` are now separated into their own packages. - `puppeteer-core` has a new exports called `puppeteer-core/internal` for internal usage. Tests and various tools have been updated to accommodate the migration.
23 lines
624 B
TypeScript
23 lines
624 B
TypeScript
import {createRequire} from 'module';
|
|
import {dirname} from 'path';
|
|
import {fileURLToPath} from 'url';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
let puppeteerDirname: string;
|
|
|
|
try {
|
|
// In some environments, like esbuild, this will throw an error.
|
|
// We suppress the error since the bundled binary is not expected
|
|
// to be used or installed in this case and, therefore, the
|
|
// root directory does not have to be known.
|
|
puppeteerDirname = dirname(require.resolve('./compat'));
|
|
} catch (error) {
|
|
puppeteerDirname = dirname(fileURLToPath(import.meta.url));
|
|
}
|
|
|
|
export {puppeteerDirname};
|