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

Use index section as resources #707

Open
Tracked by #648
hayatoito opened this issue Dec 16, 2021 · 2 comments
Open
Tracked by #648

Use index section as resources #707

hayatoito opened this issue Dec 16, 2021 · 2 comments

Comments

@hayatoito
Copy link
Collaborator

hayatoito commented Dec 16, 2021

As Bundle Dependencies proposal briefly mentions, it would be nice that a resource listed in the index section of the bundle will be also a target of subresource loading, even if the resource is not mentioned in resources in <script type=webbundle>.

The benefit is: users don't have to list all resources in resources. They have to specify only direct dependencies.

For example, suppose that main.html is:

<script type="webbundle">
{
   source: "a.wbn",
   resources: [....]    # what should be specified?
}
</script>

<link rel="style" href="a.css" />

...

<img src="a.png" />

...

<script type="module" src="a1.js" />

The bundle, a.wbn has the following resources:

URL
./a1.js
./a2.js
./a3.js
./a.png
./a.css

The dependency graph is:

main.html
├── a1.js
│   ├── a2.js
│   └── a3.js
├── a.png
└── a.css

Then, it would be nice that users can specify only the direct dependencies in resources, as follows:

<script type="webbundle">
{
   source: "a.wbn",
   resources: ["a1.js", "a.css", "a.png"]
}
</script>

<link rel="style" href="a.css" />

...

<img src="a.png" />

...

<script type="module" src="a1.js" />

Instead of listing all resources:

<script type="webbundle">
{
   source: "a.wbn",
   resources: ["a1.js", "a2.js", "a3.js", "a.css", "a.png"]
}
</script>

<link rel="style" href="a.css" />

...

<img src="a.png" />

...

<script type="module" src="a1.js" />

We probably want to introduce an optional key in JSON of <script type=webbundle> to enable this behavior of not, however, I'm feeling that this behavior is fine as the default behavior in most cases .

@irori
Copy link
Collaborator

irori commented Dec 16, 2021

I vaguely remember that we considered using bundle's index section instead of letting the page specify the resources or scopes, although I cannot recall why we ended up with current design. The explainer has No declarative scope section for that idea.

@hayatoito
Copy link
Collaborator Author

hayatoito commented Dec 16, 2021

Yeah, as far as I remember vaguely, the discussion in the past assumes "all" or "nothing". Specify all resources or specify nothing.

This issue is proposing a slightly different thing. Specify only the direct dependencies beforehand. Regarding indirect dependencies, we can use index section information, in theory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants