Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit segmentation support #602

Closed
petermasking opened this issue Jan 16, 2025 · 0 comments · Fixed by #603
Closed

Implicit segmentation support #602

petermasking opened this issue Jan 16, 2025 · 0 comments · Fixed by #603
Assignees
Labels
feature New feature or request

Comments

@petermasking
Copy link
Member

We currently use an explicit segmentation model that treats anything not specified in the segment configuration as a common module. With the addition of support for index files (#572) and fractional segmentation (#597), we can now use index files to re-export from other modules, simplifying segmentation. While this approach works without issues, it is not yet very efficient.

For example, consider two modules with index files that are both in the same segment:

First module

// src/first/a.ts

export async function a()
{
    /* ... */ 
}
// src/first/index.ts

export { a } from './a';

Second module

// src/second/b.ts

import { a } from '../first';

export async function b()
{
    return a();
}
// src/second/index.ts

export { b } from './b';

Segment configuration

{
    "./first": { "a": { "access": "public" } },
    "./second": { "b": { "access": "public" } }
}

In this case, we’d expect function b to import the actual implementation of function a since they are in the same segment. However, this isn’t the case because the src/second/b.ts file itself isn’t segmented; only the index file that re-exports it is. This causes the remote module to be imported, adding unnecessary overhead.

To avoid this, we aim to include re-exported modules from segmented modules in the segmentation process.

@petermasking petermasking self-assigned this Jan 16, 2025
@petermasking petermasking added the feature New feature or request label Jan 16, 2025
petermasking added a commit that referenced this issue Jan 16, 2025
petermasking added a commit that referenced this issue Jan 16, 2025
petermasking added a commit that referenced this issue Jan 16, 2025
@petermasking petermasking linked a pull request Jan 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant