Commit 1783eda
committed
refactor(package): replace METADATA_EXPORT_LIST and GLOBAL_EXPORT_DICT with typed registries
Migrate two flat package exporter registries to typed dataclass form:
- METADATA_EXPORT_LIST (list of Resource subclasses) -> METADATA_EXPORTS
(List[MetadataExportSpec]). Each spec captures both the metadata_type
('AWS::ServerlessRepo::Application') and the per-property exporter
classes that handle LicenseUrl/ReadmeUrl. Template._export_metadata
now dispatches via a metadata_type lookup instead of a per-class
RESOURCE_TYPE filter.
- GLOBAL_EXPORT_DICT (dict keyed by Fn::Transform) -> GLOBAL_TRANSFORM_EXPORTS
(List[GlobalTransformExportSpec]). Each spec carries a discriminator
callable (e.g. _is_aws_include for matching AWS::Include) plus the
handler. _export_global_artifacts now dispatches through the
discriminator so future Fn::Transform variants can register without
touching the walker.
The typed shape is the contract a follow-up commit will read from to
process AWS::Include before language-extension expansion.1 parent 9ffa5ed commit 1783eda
3 files changed
Lines changed: 131 additions & 21 deletions
File tree
- samcli/lib/package
- tests/unit/lib/package
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
339 | | - | |
| 340 | + | |
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| |||
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
353 | | - | |
| 354 | + | |
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
| |||
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | | - | |
409 | | - | |
| 409 | + | |
| 410 | + | |
410 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
411 | 416 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
| |||
429 | 437 | | |
430 | 438 | | |
431 | 439 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
| 440 | + | |
436 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
437 | 447 | | |
438 | 448 | | |
439 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
717 | 718 | | |
718 | 719 | | |
719 | 720 | | |
720 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
721 | 744 | | |
722 | 745 | | |
723 | 746 | | |
| |||
741 | 764 | | |
742 | 765 | | |
743 | 766 | | |
744 | | - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
1454 | 1455 | | |
1455 | 1456 | | |
1456 | 1457 | | |
| 1458 | + | |
| 1459 | + | |
1457 | 1460 | | |
1458 | 1461 | | |
1459 | 1462 | | |
| |||
1476 | 1479 | | |
1477 | 1480 | | |
1478 | 1481 | | |
1479 | | - | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1480 | 1494 | | |
1481 | 1495 | | |
1482 | 1496 | | |
| |||
1852 | 1866 | | |
1853 | 1867 | | |
1854 | 1868 | | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
1855 | 1874 | | |
1856 | | - | |
| 1875 | + | |
1857 | 1876 | | |
1858 | 1877 | | |
1859 | 1878 | | |
| |||
1970 | 1989 | | |
1971 | 1990 | | |
1972 | 1991 | | |
| 1992 | + | |
1973 | 1993 | | |
1974 | 1994 | | |
1975 | 1995 | | |
| |||
2571 | 2591 | | |
2572 | 2592 | | |
2573 | 2593 | | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
2574 | 2626 | | |
2575 | 2627 | | |
2576 | 2628 | | |
| |||
0 commit comments