javascript 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #------------------------------------------------------------------------------
  2. # $File: javascript,v 1.5 2023/01/12 00:02:16 christos Exp $
  3. # javascript: magic for javascript and node.js scripts.
  4. #
  5. 0 string/tw #!/bin/node Node.js script executable
  6. !:mime application/javascript
  7. 0 string/tw #!/usr/bin/node Node.js script executable
  8. !:mime application/javascript
  9. 0 string/tw #!/bin/nodejs Node.js script executable
  10. !:mime application/javascript
  11. 0 string/tw #!/usr/bin/nodejs Node.js script executable
  12. !:mime application/javascript
  13. 0 string/t #!/usr/bin/env\ node Node.js script executable
  14. !:mime application/javascript
  15. 0 string/t #!/usr/bin/env\ nodejs Node.js script executable
  16. !:mime application/javascript
  17. # JavaScript
  18. # The strength is increased to beat the C++ & HTML rules
  19. 0 search "use\x20strict" JavaScript source
  20. !:strength +30
  21. !:mime application/javascript
  22. !:ext js
  23. 0 search 'use\x20strict' JavaScript source
  24. !:strength +30
  25. !:mime application/javascript
  26. !:ext js
  27. 0 regex module(\\.|\\[["'])exports.*= JavaScript source
  28. !:strength +30
  29. !:mime application/javascript
  30. !:ext js
  31. 0 regex \^(const|var|let).*=.*require\\( JavaScript source
  32. !:strength +30
  33. !:mime application/javascript
  34. !:ext js
  35. 0 regex \^export\x20(function|class|default|const|var|let|async)\x20 JavaScript source
  36. !:strength +30
  37. !:mime application/javascript
  38. !:ext js
  39. 0 regex \\((async\x20)?function[(\x20] JavaScript source
  40. !:strength +30
  41. !:mime application/javascript
  42. !:ext js
  43. 0 regex \^(import|export).*\x20from\x20 JavaScript source
  44. !:strength +30
  45. !:mime application/javascript
  46. !:ext js
  47. 0 regex \^(import|export)\x20["']\\./ JavaScript source
  48. !:strength +30
  49. !:mime application/javascript
  50. !:ext js
  51. 0 regex \^require\\(["'] JavaScript source
  52. !:strength +30
  53. !:mime application/javascript
  54. !:ext js
  55. 0 regex typeof.*[!=]== JavaScript source
  56. !:strength +30
  57. !:mime application/javascript
  58. !:ext js
  59. # React Native minified JavaScript
  60. 0 search/128 __BUNDLE_START_TIME__= React Native minified JavaScript
  61. !:strength +30
  62. !:mime application/javascript
  63. !:ext bundle/jsbundle
  64. # Hermes by Facebook https://hermesengine.dev/
  65. # https://github.com/facebook/hermes/blob/master/include/hermes/\
  66. # BCGen/HBC/BytecodeFileFormat.h#L24
  67. 0 lequad 0x1F1903C103BC1FC6 Hermes JavaScript bytecode
  68. >8 lelong x \b, version %d
  69. # v8 JavaScript engine bytecode
  70. # From: Alexandre Iooss <erdnaxe@crans.org>
  71. # URL: https://v8.dev/docs/ignition
  72. # Note: used in bytenode and NW.js protected source code
  73. # V8 bytecode extraction was added in NodeJS v5.7.0 (V8 4.6.85.31).
  74. # Version information is provided for some v8 versions found in NodeJS releases.
  75. 2 uleshort =0xC0DE
  76. >0 ulelong^0xC0DE0000 >0
  77. # Reservation table starts at 40
  78. >>40 ulelong&0xFFFFFF00 =0x80000000
  79. # Stub keys present
  80. >>>24 ulelong >0
  81. >>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
  82. >>>>4 ulelong =0xEE4BF478 version 5.1.281.111,
  83. >>>>4 ulelong =0xC4A0100C version 5.5.372.43,
  84. >>>>8 ulelong x source size: %u bytes,
  85. >>>>12 ulelong x cpu features: %#08X,
  86. >>>>16 ulelong x flag hash: %#08X,
  87. >>>>20 ulelong x %u reservations,
  88. >>>>28 ulelong x payload size: %u bytes,
  89. >>>>32 ulelong x checksum1: %#08X,
  90. >>>>36 ulelong x checksum2: %#08X
  91. # No stub keys
  92. >>>24 ulelong =0
  93. >>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
  94. >>>>4 ulelong =0x54F0AD81 version 6.2.414.46,
  95. >>>>4 ulelong =0X7D1BF182 version 6.2.414.54,
  96. >>>>4 ulelong =0x35BA122E version 6.2.414.77,
  97. >>>>4 ulelong =0X9319F9C2 version 6.2.414.78,
  98. >>>>4 ulelong =0xB1240060 version 6.6.346.32,
  99. >>>>4 ulelong =0x2B757060 version 6.7.288.46,
  100. >>>>4 ulelong =0x09D147AA version 6.7.288.49,
  101. >>>>4 ulelong =0xF4D4F48A version 6.8.275.32,
  102. >>>>4 ulelong =0xD3961326 version 7.0.276.38,
  103. >>>>8 ulelong x source size: %u bytes,
  104. >>>>12 ulelong x cpu features: %#08X,
  105. >>>>16 ulelong x flag hash: %#08X,
  106. >>>>20 ulelong x %u reservations,
  107. >>>>28 ulelong x payload size: %u bytes,
  108. >>>>32 ulelong x checksum1: %#08X,
  109. >>>>36 ulelong x checksum2: %#08X
  110. # Reservation table starts at 32
  111. >>32 ulelong&0xFFFFFF00 =0x80000000
  112. # Second checksum present
  113. >>>28 ulelong >0
  114. >>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
  115. >>>>4 ulelong =0x21DDF627 version 7.4.288.21,
  116. >>>>4 ulelong =0x1FC9FE84 version 7.4.288.27,
  117. >>>>4 ulelong =0x60A99E8B version 7.5.288.22,
  118. >>>>4 ulelong =0x4F665E90 version 7.6.303.29,
  119. >>>>4 ulelong =0xC7ACFCDE version 7.7.299.11,
  120. >>>>4 ulelong =0x7F641D8F version 7.7.299.13,
  121. >>>>4 ulelong =0xFD9A4F2E version 7.8.279.17,
  122. >>>>4 ulelong =0x3A845324 version 7.8.279.23,
  123. >>>>4 ulelong =0xFF52FEAF version 7.9.317.25,
  124. >>>>8 ulelong x source size: %u bytes,
  125. >>>>12 ulelong x flag hash: %#08X,
  126. >>>>16 ulelong x %u reservations,
  127. >>>>20 ulelong x payload size: %u bytes,
  128. >>>>24 ulelong x checksum1: %#08X,
  129. >>>>28 ulelong x checksum2: %#08X
  130. # No second checksum
  131. >>>28 ulelong =0
  132. >>>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
  133. >>>>4 ulelong =0x8725E0F8 version 8.1.307.30,
  134. >>>>4 ulelong =0x09ED1289 version 8.1.307.31,
  135. >>>>4 ulelong =0xA5728C87 version 8.3.110.9,
  136. >>>>4 ulelong =0xB45C5D30 version 8.4.371.23,
  137. >>>>4 ulelong =0xED9C278B version 8.4.371.19,
  138. >>>>4 ulelong =0xD27BFF42 version 8.6.395.16,
  139. >>>>8 ulelong x source size: %u bytes,
  140. >>>>12 ulelong x flag hash: %#08X,
  141. >>>>16 ulelong x %u reservations,
  142. >>>>20 ulelong x payload size: %u bytes,
  143. >>>>24 ulelong x payload checksum: %#08X
  144. # No reservation table and code starts at 24
  145. >>32 ulelong =0
  146. >>>0 ulelong^0xC0DE0000 x v8 bytecode, external reference table size: %u bytes,
  147. >>>4 ulelong =0x9A6F0B0F version 9.0.257.17,
  148. >>>4 ulelong =0x271D5D1E version 9.0.257.24,
  149. >>>4 ulelong =0x4EEA75DF version 9.0.257.25,
  150. >>>4 ulelong =0x80809479 version 9.1.269.36,
  151. >>>4 ulelong =0x55C46F65 version 9.1.269.38,
  152. >>>4 ulelong =0x8A9C758A version 9.2.230.21,
  153. >>>4 ulelong =0x9712F0E1 version 9.3.345.16,
  154. >>>4 ulelong =0x29593715 version 9.4.146.19,
  155. >>>4 ulelong =0xCD991825 version 9.4.146.24,
  156. >>>4 ulelong =0xACDD64EE version 9.4.146.26,
  157. >>>4 ulelong =0xC96B4CD5 version 9.5.172.21,
  158. >>>4 ulelong =0xBCCE4578 version 9.5.172.25,
  159. >>>4 ulelong =0xA2EEA077 version 9.6.180.15,
  160. >>>4 ulelong =0xFD350011 version 10.1.124.8,
  161. >>>4 ulelong =0xBEF4028F version 10.2.154.13,
  162. >>>4 ulelong =0xAF632352 version 10.2.154.4,
  163. >>>8 ulelong x source size: %u bytes,
  164. >>>12 ulelong x flag hash: %#08X,
  165. >>>16 ulelong x payload size: %u bytes,
  166. >>>20 ulelong x payload checksum: %#08X