@@ -122,6 +122,9 @@ val Perl6Regex = Regex(
122122val  PhpRegex  =  Regex (
123123 " ^<\\ ?(?:php)?" 
124124)
125+ val  PhpIlluminateRegex  =  Regex (
126+  " (Auth|Bootstrap|Bus|Console|Events|Exceptions|Http|Providers"   + 
127+  " |Support|Testing|Validation)"  )
125128val  PicoLispRegex  =  Regex (
126129 " ^\\ ((de|class|rel|code|data|must)\\ s"  ,
127130 RegexOption .MULTILINE 
@@ -235,6 +238,11 @@ val k8sExp = { buf: String ->
235238 &&  buf.contains(" metadata"  )
236239}
237240
241+ val  bootstrapWebpackExp =  { buf:  String  -> 
242+  //  Handling php projects with bootstrap Webpack.
243+  buf.contains(" /******/ (function(modules) { // webpackBootstrap"  )
244+ }
245+ 238246/* *
239247 * Heuristics to detect a programming language by file extension and content. 
240248 * Inspired by GitHub Liguist heuristics (https://github.com/github/linguist). 
@@ -638,8 +646,11 @@ val HeuristicsMap = mapOf<String, (String, String) -> ExtractorInterface?>(
638646 " jl"   to { _, _ -> 
639647 CommonExtractor (Lang .JULIA )
640648 },
641-  " js"   to { _, _ -> 
642-  JavascriptExtractor ()
649+  " js"   to { buf, _ -> 
650+  if  (bootstrapWebpackExp(buf)) {
651+  null 
652+  }
653+  else  JavascriptExtractor ()
643654 },
644655 " jsx"   to { _, _ -> 
645656 JavascriptExtractor ()
@@ -793,10 +804,13 @@ val HeuristicsMap = mapOf<String, (String, String) -> ExtractorInterface?>(
793804 " pde"   to { _, _ -> 
794805 CommonExtractor (Lang .PROCESSING )
795806 },
796-  " php"   to { buf, _  -> 
807+  " php"   to { buf, path  -> 
797808 if  (buf.contains(" <?hh"  )) {
798809 CommonExtractor (Lang .HACK )
799-  } else  {
810+  } else  if  (PhpIlluminateRegex .containsMatchIn(path)) {
811+  null 
812+  }
813+  else  {
800814 PhpExtractor ()
801815 }
802816 },
0 commit comments