Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

fix: improve native module detection #674

Merged
merged 3 commits into from
Sep 27, 2021
Merged

Conversation

eduardoboucas
Copy link
Member

- Summary

Improves the native module detection by:

  • Adding node-gyp to the list of marker modules
  • Looking for the presence of .node files in the files array in package.json

- Test plan

Adjusted existing test.

- A picture of a cute animal (not mandatory but encouraged)

kc0fmcvq1mg41

@eduardoboucas eduardoboucas added the type: bug code to address defects in shipped code label Sep 24, 2021
@github-actions
Copy link
Contributor

⏱ Benchmark results

Comparing with f756b03

largeDepsEsbuild: 12.3s

⬇️ 1.72% decrease vs. f756b03

^                                  13.9s   13.9s                           14.1s   14.2s                  
│  13.6s           13.7s            ┌──┐    ┌──┐                            ┌──┐    ┌──┐   13.5s          
│   ┌──┐    13s     ┌──┐            |  |    |  |                   12.8s    |  |    |  |    ┌──┐          
│ ──┼──┼────┌──┐────┼──┼────────────┼──┼────┼──┼────────────────────┌──┐────┼──┼────┼──┼────┼──┼───12.3s──
│   |  |    |  |    |  |            |  |    |  |   11.4s            |  |    |  |    |  |    |  |    ┌──┐  
│   |  |    |  |    |  |            |  |    |  |    ┌──┐            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |   10.3s    |  |    |  |    |  |   10.1s    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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

largeDepsZisi: 1m 6.3s

⬇️ 1.47% decrease vs. f756b03

^                                 1m 13.5s1m 14.3s                                1m 14.8s                
│ 1m 10.3s        1m 11.6s          ┌──┐    ┌──┐                          1m 10.9s  ┌──┐  1m 11.3s        
│   ┌──┐   1m 8s    ┌──┐            |  |    |  |                  1m 7.8s   ┌──┐    |  |    ┌──┐  1m 6.3s 
│ ──┼──┼────┌──┐────┼──┼────────────┼──┼────┼──┼────────────────────┌──┐────┼──┼────┼──┼────┼──┼────┌──┐──
│   |  |    |  |    |  |            |  |    |  |                    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |            |  |    |  |   57.6s            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |   52.9s    |  |    |  |    ┌──┐   50.8s    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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

)
const { extname } = require('path')

const markerModules = ['bindings', 'nan', 'node-gyp', 'node-gyp-build', 'node-pre-gyp', 'prebuild']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better than a bunch of ||!

@eduardoboucas eduardoboucas merged commit 2de5426 into main Sep 27, 2021
@eduardoboucas eduardoboucas deleted the fix/native-module-detection branch September 27, 2021 10:28
Skn0tt pushed a commit to netlify/build that referenced this pull request May 21, 2024
* fix: add node-gyp to native module detection

* feat: detect modules with native file

* chore: doh
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants