cellplatform / platform-0.2.0

/sys (shared system modules)
Other
4 stars 2 forks source link

Compiler: multi-entry library support #130

Closed philcockfield closed 1 year ago

philcockfield commented 1 year ago

Includes situating the "Farcaster Client Library" which precipitated thinking through the multi-entry points for libs. https://github.com/farcasterxyz/hub-monorepo/tree/main/packages/hub-web


Multi Entry Lib

For example see: code/compiler.samples/web.lib-1/vite.config.mts

export default Config.vite(import.meta.url, (e) => {
  e.lib({
    entry: {
      index: '/src/index.mts',
      Foo: '/src/logic/Foo.mts',
      Bar: '/src/logic/Bar.mts',
    },
  });
  e.target('web', 'node');
  e.externalDependency(e.ctx.deps.map((d) => d.name));
});

Then the sample imports within: code/compiler.samples/web.lib-2/src/index.mts

Notes

This was a pending task within the Package builder, that was waiting for Vite to support the multi-entry lib configuration passed to Rollup.

The Package builder produces correct {exports} and {typesVersions} entries on the package.json file based on the dist manifest.

philcockfield commented 1 year ago

image image

philcockfield commented 1 year ago
image

path: code/system/sys.net.fc/vite.config.mts

WIP: code-split this large chunk...if possible. Libs involved (suspects):

from within: