Commit 292321d
authored
[SPLIT_MODULE] Make getWasmImports return Proxy (emscripten-core#25559)
When `SPLIT_MODULE` is set, this makes the `imports` object returned by
`getWasmImports` itself a Proxy, which redirects property requests
starting with `placeholder` to an inner handler that processes the
second module loading, and process all other property requests to the
original `imports` object itself.
This is a prepration to add multi-split loading functionality to the JS
runtime. In the multi-split mode, we don't have a single seconday module
`[modulename].deferred.wasm`, but instead multiple secondary modules. We
plan to have multiple placeholder namespace (e.g., `placeholder2`,
`placeholder3`, ...) that match those multiple files, and this can't be
hardcoded with one `placeholder` string as we currently do, so having
the `imports` object itself as a `Proxy` provides us flexibility to
handle multiple placeholder namespaces and load correct modules later.
Thanks @tlively for the idea!1 parent c862f75 commit 292321d
File tree
4 files changed
+45
-30
lines changed- src
- test/codesize
4 files changed
+45
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
492 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
493 | 496 | | |
494 | | - | |
| 497 | + | |
495 | 498 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
502 | 510 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
507 | 515 | | |
508 | | - | |
| 516 | + | |
509 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
510 | 521 | | |
| 522 | + | |
511 | 523 | | |
512 | 524 | | |
513 | 525 | | |
| |||
653 | 665 | | |
654 | 666 | | |
655 | 667 | | |
656 | | - | |
| 668 | + | |
657 | 669 | | |
658 | 670 | | |
659 | 671 | | |
660 | 672 | | |
661 | 673 | | |
662 | 674 | | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | 675 | | |
667 | 676 | | |
668 | 677 | | |
669 | 678 | | |
670 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
671 | 684 | | |
672 | 685 | | |
673 | 686 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
453 | 454 | | |
454 | 455 | | |
455 | 456 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
661 | | - | |
| 661 | + | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
| 664 | + | |
| 665 | + | |
665 | 666 | | |
666 | 667 | | |
667 | 668 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
0 commit comments