lemanschik / awesome

A Magic Repository Started By a Magic Number enables git tree submodule branch flows.
1 stars 2 forks source link

GraalVM: Improvements #42

Open lemanschik opened 1 year ago

lemanschik commented 1 year ago

Create ES4X Espresso like abstraction

Goals?

Be able to spin up es4x as also expresso workers via es4x. Needed to better guide coders.

Usage inside NodeJS Compatible Enviornment

await import(`./component-manager.js?launch=component:chromium&userdir=${resolvedId}`); // resolvedId => sessionId + url or proc path socket path

// note: launch returns watch
// note: install takes specifier returns resolvedId for fetch
// note: for simplicity each instruction inherited the prev so calling launch => fetch load launch
graal-node import('@component-manager/graal-node').then(({ fetch, load, launch })=>);
node import('@component-manager/node').then(({ fetch, load, launch })=>);
node import('@component-manager/chromium/chromium').then(({ fetch, load, launch }) => );
node import('@component-manager/chromium/puppeteer').then(({ fetch, load, launch }) => );
node import('@component-manager/chromium/playwright').then(({ fetch, load, launch }) => );
fetch(https://raw.githubusercontent.com/puppeteer/puppeteer/main/packages/puppeteer-core/src/revisions.ts).then(({ body })=>body.text().split('chromium: \'')[1].split('\',')[0])

'https://storage.googleapis.com',
'chromium-browser-snapshots/'
const {
 linux: 'Linux_x64',
 linux_x64: 'Linux_x64',
 mac: 'Mac',
 mac_arm: 'Mac_Arm'
 win32: 'Win',
 win64: 'Win_x64',
}
chrome-win, chrome-mac, chrome-linux
{
  chrome: {
    linux: '%s/chromium-browser-snapshots/Linux_x64/%d/%s.zip',
    mac: '%s/chromium-browser-snapshots/Mac/%d/%s.zip',
    mac_arm: '%s/chromium-browser-snapshots/Mac_Arm/%d/%s.zip',
    win32: '%s/chromium-browser-snapshots/Win/%d/%s.zip',
    win64: '%s/chromium-browser-snapshots/Win_x64/%d/%s.zip',
  },
  firefox: {
    linux: '%s/firefox-%s.en-US.%s-x86_64.tar.bz2',
    mac: '%s/firefox-%s.en-US.%s.dmg',
    win32: '%s/firefox-%s.en-US.%s.zip',
    win64: '%s/firefox-%s.en-US.%s.zip',
  },
};

const browserConfig = {
  chrome: {
    host: 'https://storage.googleapis.com',
  },

allign puppeteer and playwrite-chromium launch

If you want to use playwright and puppeteer together you need to use the playwright installer and supply the path to puppeteer.launch you may also want to place a symlink to /opt/google/chrome/chrome or the correct mappings for puppeteer.