netlify / zip-it-and-ship-it

Intelligently prepare Node.js Lambda functions for deployment
https://www.npmjs.com/package/@netlify/zip-it-and-ship-it
MIT License
316 stars 35 forks source link

fix: detect alt version of remix handler #1657

Closed Skn0tt closed 1 year ago

Skn0tt commented 1 year ago

While working on our Remix template, I found that the handler function that was generated for me isn't detected as v2, even though it should. This PR adds a test case for it.

It also adds the most straight-forward fix I found. It has the downside of creating a false-positive (will comment below) about that, but I think that's OK. Ideally though, we find a solution that doesn't require changes to the existing tests.

github-actions[bot] commented 1 year ago

⏱ Benchmark results

Comparing with 5ca965f88059299af4e83bae9ab8583ebcb7ad1a

largeDepsEsbuild: 1.4s

⬆️ 0.16% increase vs. 5ca965f88059299af4e83bae9ab8583ebcb7ad1a

^   2.7s    2.7s    2.7s                                                                                  
│   ┌──┐    ┌──┐    ┌──┐                                    2.6s                                          
│   |  |    |  |    |  |                                    ┌──┐                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│ ──┼──┼────┼──┼────┼──┼────────────────────────────────────┼──┼──────────────────────────────────────────
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |    1.5s    1.5s    1.5s    1.5s    |  |    1.4s    1.5s    1.5s    1.4s    1.4s  
│   |  |    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (1618df80c56c91b8622992f0fd45edf4fea69962): 3.1s - T-29 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 2.7s - T-28 (3092e010ce7fc47cdd0bee843528d13291a40acf): 3.3s - T-27 (cb23207e0c520f207df84e6d6509f24eefc9680e): 3.3s - T-26 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 2.7s - T-25 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 3.2s - T-24 (4b0f947b315ac43d126e652881467f619c323cd7): 2.5s - T-23 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 3.1s - T-22 (0381be519b6fff91a86bdcd19ac3a196a3480515): 3.4s - T-21 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 2.6s - T-20 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 3.1s - T-19 (afaa4efdccf011d985f82719b4dc71ce7f051346): 2.7s - T-18 (390820e5a45277d4233cab6a3dae20079959421a): 2.5s - T-17 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 3.1s - T-16 (97992ee4384e445302377c0ee35281abc8079daf): 3.4s - T-15 (d70673a431723619961dd38778d72ccadc0b0f02): 1.5s - T-14 (cacee3f27337b6876f19648fb4f9101fdffc85fd): 2.7s - T-13 (52a665423de77ef569fa66a02d6291d12ede9667): 3.5s - T-12 (c0b0b7ad9608b0690581741d3dea644fde476dc6): 2.7s - T-11 (15399f431ee0a03a277a25b19ff4b42295ad3d2a): 2.7s - T-10 (ac5532d098d615efe03a55f9f8727523493ce4e2): 2.7s - T-9 (e4d0ba977cbdd88a20495b326bbaf0b1b401234a): 1.5s - T-8 (234379a3595fd8809d8bae0e4017570a3423cbb4): 1.5s - T-7 (5fc5321525756f5106509ded272b8f85e2d806e5): 1.5s - T-6 (fee5d2e190009b066d4d783090c76f9674dcb2b6): 1.5s - T-5 (b8a39b643d2c6101a20683e1a6823e1da188bf5a): 2.6s - T-4 (06ef08f4f96862917783227d488f2e5c9ddb81c5): 1.4s - T-3 (c0a64fc99bc49c9a43370a5056155fe17fbab3a4): 1.5s - T-2 (bcb0388489e28527fa14c0de957a8824c899e4dd): 1.5s - T-1 (5ca965f88059299af4e83bae9ab8583ebcb7ad1a): 1.4s - **T (current commit): 1.4s**

largeDepsNft: 5.6s

⬆️ 2.33% increase vs. 5ca965f88059299af4e83bae9ab8583ebcb7ad1a

^   8.5s            8.5s                                                                                  
│   ┌──┐    8.2s    ┌──┐                                    8.1s                                          
│   |  |    ┌──┐    |  |                                    ┌──┐                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│ ──┼──┼────┼──┼────┼──┼────────────────────────────────────┼──┼──────────────────────────────────────────
│   |  |    |  |    |  |    5.5s    5.6s    5.6s    5.7s    |  |    5.5s    5.6s    5.5s    5.5s    5.6s  
│   |  |    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (1618df80c56c91b8622992f0fd45edf4fea69962): 10.5s - T-29 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 8.3s - T-28 (3092e010ce7fc47cdd0bee843528d13291a40acf): 11.2s - T-27 (cb23207e0c520f207df84e6d6509f24eefc9680e): 10.1s - T-26 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 8.4s - T-25 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 10s - T-24 (4b0f947b315ac43d126e652881467f619c323cd7): 7.6s - T-23 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 9.8s - T-22 (0381be519b6fff91a86bdcd19ac3a196a3480515): 10.7s - T-21 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 8.1s - T-20 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 9.5s - T-19 (afaa4efdccf011d985f82719b4dc71ce7f051346): 8.5s - T-18 (390820e5a45277d4233cab6a3dae20079959421a): 7.4s - T-17 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 9.8s - T-16 (97992ee4384e445302377c0ee35281abc8079daf): 10.8s - T-15 (d70673a431723619961dd38778d72ccadc0b0f02): 5.5s - T-14 (cacee3f27337b6876f19648fb4f9101fdffc85fd): 8.7s - T-13 (52a665423de77ef569fa66a02d6291d12ede9667): 11.1s - T-12 (c0b0b7ad9608b0690581741d3dea644fde476dc6): 8.5s - T-11 (15399f431ee0a03a277a25b19ff4b42295ad3d2a): 8.2s - T-10 (ac5532d098d615efe03a55f9f8727523493ce4e2): 8.5s - T-9 (e4d0ba977cbdd88a20495b326bbaf0b1b401234a): 5.5s - T-8 (234379a3595fd8809d8bae0e4017570a3423cbb4): 5.6s - T-7 (5fc5321525756f5106509ded272b8f85e2d806e5): 5.6s - T-6 (fee5d2e190009b066d4d783090c76f9674dcb2b6): 5.7s - T-5 (b8a39b643d2c6101a20683e1a6823e1da188bf5a): 8.1s - T-4 (06ef08f4f96862917783227d488f2e5c9ddb81c5): 5.5s - T-3 (c0a64fc99bc49c9a43370a5056155fe17fbab3a4): 5.6s - T-2 (bcb0388489e28527fa14c0de957a8824c899e4dd): 5.5s - T-1 (5ca965f88059299af4e83bae9ab8583ebcb7ad1a): 5.5s - **T (current commit): 5.6s**

largeDepsZisi: 10.4s

⬇️ 0.32% decrease vs. 5ca965f88059299af4e83bae9ab8583ebcb7ad1a

^  16.8s   16.5s   16.7s                                                                                  
│   ┌──┐    ┌──┐    ┌──┐                                   15.8s                                          
│   |  |    |  |    |  |                                    ┌──┐                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│   |  |    |  |    |  |                                    |  |                                          
│ ──┼──┼────┼──┼────┼──┼────────────────────────────────────┼──┼──────────────────────────────────────────
│   |  |    |  |    |  |   10.6s   10.6s   10.6s   10.5s    |  |   10.5s   10.5s   10.5s                  
│   |  |    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐    ┌──┐   10.5s   10.4s  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend - T-30 (1618df80c56c91b8622992f0fd45edf4fea69962): 20.6s - T-29 (0297aa17ec1d9082450a13bac5c33840c9d1d22d): 16.3s - T-28 (3092e010ce7fc47cdd0bee843528d13291a40acf): 20.9s - T-27 (cb23207e0c520f207df84e6d6509f24eefc9680e): 19.9s - T-26 (070a7c95020e1730d327c8bb4ec69a51ef10cabc): 16.5s - T-25 (37bea386468e7aa67974eda9a1a8fbb87c8d48ec): 19.7s - T-24 (4b0f947b315ac43d126e652881467f619c323cd7): 15.1s - T-23 (a7b997238fc578a2c83b921cb2d4c1eab1f93325): 20.1s - T-22 (0381be519b6fff91a86bdcd19ac3a196a3480515): 21.1s - T-21 (af0e46cdbadd228d2cc4876e0cc861e8af14ebef): 16.1s - T-20 (b7fc0822d55c26daee4afbd7f4041ee0d034decb): 19.4s - T-19 (afaa4efdccf011d985f82719b4dc71ce7f051346): 16.2s - T-18 (390820e5a45277d4233cab6a3dae20079959421a): 15.1s - T-17 (a01ecdb7e4b348d7fa71d576ae02f918b897a2df): 20s - T-16 (97992ee4384e445302377c0ee35281abc8079daf): 21.1s - T-15 (d70673a431723619961dd38778d72ccadc0b0f02): 10.4s - T-14 (cacee3f27337b6876f19648fb4f9101fdffc85fd): 17.2s - T-13 (52a665423de77ef569fa66a02d6291d12ede9667): 21.3s - T-12 (c0b0b7ad9608b0690581741d3dea644fde476dc6): 16.8s - T-11 (15399f431ee0a03a277a25b19ff4b42295ad3d2a): 16.5s - T-10 (ac5532d098d615efe03a55f9f8727523493ce4e2): 16.7s - T-9 (e4d0ba977cbdd88a20495b326bbaf0b1b401234a): 10.6s - T-8 (234379a3595fd8809d8bae0e4017570a3423cbb4): 10.6s - T-7 (5fc5321525756f5106509ded272b8f85e2d806e5): 10.6s - T-6 (fee5d2e190009b066d4d783090c76f9674dcb2b6): 10.5s - T-5 (b8a39b643d2c6101a20683e1a6823e1da188bf5a): 15.8s - T-4 (06ef08f4f96862917783227d488f2e5c9ddb81c5): 10.5s - T-3 (c0a64fc99bc49c9a43370a5056155fe17fbab3a4): 10.5s - T-2 (bcb0388489e28527fa14c0de957a8824c899e4dd): 10.5s - T-1 (5ca965f88059299af4e83bae9ab8583ebcb7ad1a): 10.5s - **T (current commit): 10.4s**