mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(puppeteer): export internals (#7991)
Signed-off-by: Randolf Jung <jrandolf@chromium.org> Co-authored-by: Randolf Jung <jrandolf@chromium.org>
This commit is contained in:
parent
1b120b2c36
commit
448118cbdb
10
package.json
10
package.json
@ -5,8 +5,14 @@
|
||||
"type": "commonjs",
|
||||
"main": "./cjs-entry.js",
|
||||
"exports": {
|
||||
"import": "./lib/esm/puppeteer/node.js",
|
||||
"require": "./cjs-entry.js"
|
||||
".": {
|
||||
"import": "./lib/esm/puppeteer/node.js",
|
||||
"require": "./cjs-entry.js"
|
||||
},
|
||||
"./*": {
|
||||
"import": "./*",
|
||||
"require": "./*"
|
||||
}
|
||||
},
|
||||
"types": "lib/types.d.ts",
|
||||
"repository": "github:puppeteer/puppeteer",
|
||||
|
@ -14,6 +14,9 @@ cd $TMPDIR
|
||||
# 3. Requiring Puppeteer from Node works.
|
||||
npm install --loglevel silent "${tarball}"
|
||||
node --eval="require('puppeteer')"
|
||||
node --eval="
|
||||
require('puppeteer/lib/cjs/puppeteer/revisions.js');
|
||||
"
|
||||
ls $TMPDIR/node_modules/puppeteer/.local-chromium/
|
||||
|
||||
# Testing ES module features
|
||||
@ -22,8 +25,9 @@ cd $TMPDIR
|
||||
echo '{"type":"module"}' >>$TMPDIR/package.json
|
||||
npm install --loglevel silent "${tarball}"
|
||||
node --input-type="module" --eval="import puppeteer from 'puppeteer'"
|
||||
ls $TMPDIR/node_modules/puppeteer/.local-chromium/
|
||||
|
||||
node --input-type="module" --eval="
|
||||
import 'puppeteer/lib/esm/puppeteer/revisions.js';
|
||||
"
|
||||
node --input-type="module" --eval="
|
||||
import puppeteer from 'puppeteer';
|
||||
|
||||
@ -35,6 +39,7 @@ import puppeteer from 'puppeteer';
|
||||
await browser.close();
|
||||
})();
|
||||
"
|
||||
ls $TMPDIR/node_modules/puppeteer/.local-chromium/
|
||||
|
||||
# Again for Firefox
|
||||
TMPDIR="$(mktemp -d)"
|
||||
|
@ -25,5 +25,6 @@ delete json.scripts.install;
|
||||
|
||||
json.name = 'puppeteer-core';
|
||||
json.main = './cjs-entry-core.js';
|
||||
json.exports.import = './lib/esm/puppeteer/node-puppeteer-core.js';
|
||||
json.exports['.'].imports = './lib/esm/puppeteer/node-puppeteer-core.js';
|
||||
json.exports['.'].require = './cjs-entry-core.js';
|
||||
fs.writeFileSync(packagePath, JSON.stringify(json, null, ' '));
|
||||
|
Loading…
Reference in New Issue
Block a user