chore: remove "module" from @puppeteer/browsers (#10986)

This commit is contained in:
jrandolf 2023-09-22 04:48:31 -07:00 committed by GitHub
parent 4ca36454c3
commit 86c28edadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 23 deletions

View File

@ -94,7 +94,7 @@ jobs:
env: env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Install dependencies Firefox - name: Install dependencies Firefox
run: node ./node_modules/puppeteer/install.js run: node ./node_modules/puppeteer/install.mjs
env: env:
PUPPETEER_PRODUCT: firefox PUPPETEER_PRODUCT: firefox
- name: Verify issue - name: Verify issue

1
package-lock.json generated
View File

@ -11015,6 +11015,7 @@
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"tools/mocha-runner": { "tools/mocha-runner": {
"name": "@puppeteer/mocha-runner",
"version": "0.1.0", "version": "0.1.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {

View File

@ -8,15 +8,12 @@
"clean": "../../tools/clean.js", "clean": "../../tools/clean.js",
"test": "wireit" "test": "wireit"
}, },
"type": "commonjs",
"bin": "lib/cjs/main-cli.js", "bin": "lib/cjs/main-cli.js",
"main": "./lib/cjs/main.js", "main": "./lib/cjs/main.js",
"module": "./lib/esm/main.js",
"type": "commonjs",
"exports": { "exports": {
".": {
"import": "./lib/esm/main.js", "import": "./lib/esm/main.js",
"require": "./lib/cjs/main.js" "require": "./lib/cjs/main.js"
}
}, },
"wireit": { "wireit": {
"build": { "build": {

View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
/** /**
* Copyright 2017 Google Inc. All rights reserved. * Copyright 2017 Google Inc. All rights reserved.
* *
@ -24,20 +26,18 @@
* necessary. * necessary.
*/ */
const fs = require('fs'); try {
const path = require('path'); const {downloadBrowser} = await (async () => {
try {
// Need to ensure TS is compiled before loading the installer return await import('puppeteer/internal/node/install.js');
if (!fs.existsSync(path.join(__dirname, 'lib'))) { } catch {
console.warn( console.warn(
'Skipping browser installation because the Puppeteer build is not available. Run `npm install` again after you have re-built Puppeteer.' 'Skipping browser installation because the Puppeteer build is not available. Run `npm install` again after you have re-built Puppeteer.'
); );
process.exit(0); process.exit(0);
} }
})();
try {
const {downloadBrowser} = require('puppeteer/internal/node/install.js');
downloadBrowser(); downloadBrowser();
} catch (err) { } catch (error) {
console.warn('Browser download failed', err); console.warn('Browser download failed', error);
} }

View File

@ -37,7 +37,7 @@
"build:docs": "wireit", "build:docs": "wireit",
"build": "wireit", "build": "wireit",
"clean": "../../tools/clean.js", "clean": "../../tools/clean.js",
"postinstall": "node install.js", "postinstall": "node install.mjs",
"prepack": "wireit" "prepack": "wireit"
}, },
"wireit": { "wireit": {
@ -111,7 +111,7 @@
"files": [ "files": [
"lib", "lib",
"src", "src",
"install.js", "install.mjs",
"!*.test.js", "!*.test.js",
"!*.test.d.ts", "!*.test.d.ts",
"!*.test.js.map", "!*.test.js.map",