xref: /freebsd/contrib/file/magic/Magdir/javascript (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
1
2#------------------------------------------------------------------------------
3# $File: javascript,v 1.4 2022/09/02 08:08:17 christos Exp $
4# javascript:  magic for javascript and node.js scripts.
5#
60	string/w	#!/bin/node		Node.js script text executable
7!:mime application/javascript
80	string/w	#!/usr/bin/node		Node.js script text executable
9!:mime application/javascript
100	string/w	#!/bin/nodejs		Node.js script text executable
11!:mime application/javascript
120	string/w	#!/usr/bin/nodejs	Node.js script text executable
13!:mime application/javascript
140	string		#!/usr/bin/env\ node	Node.js script text executable
15!:mime application/javascript
160	string		#!/usr/bin/env\ nodejs	Node.js script text executable
17!:mime application/javascript
18# Hermes by Facebook https://hermesengine.dev/
19# https://github.com/facebook/hermes/blob/master/include/hermes/\
20# BCGen/HBC/BytecodeFileFormat.h#L24
210	lequad		0x1F1903C103BC1FC6	Hermes JavaScript bytecode
22>8	lelong		x			\b, version %d
23
24# v8 JavaScript engine bytecode
25# From: Alexandre Iooss <erdnaxe@crans.org>
26# URL:	https://v8.dev/docs/ignition
27# Note: used in bytenode and NW.js protected source code
28# V8 bytecode extraction was added in NodeJS v5.7.0 (V8 4.6.85.31).
29# Version information is provided for some v8 versions found in NodeJS releases.
302	uleshort		=0xC0DE
31>0	ulelong^0xC0DE0000	>0
32# Reservation table starts at 40
33>>40	ulelong&0xFFFFFF00	=0x80000000
34# Stub keys present
35>>>24	ulelong			>0
36>>>>0	ulelong^0xC0DE0000	x		v8 bytecode, external reference table size: %u bytes,
37>>>>4	ulelong			=0xEE4BF478	version 5.1.281.111,
38>>>>4	ulelong			=0xC4A0100C	version 5.5.372.43,
39>>>>8	ulelong			x		source size: %u bytes,
40>>>>12	ulelong			x		cpu features: %#08X,
41>>>>16	ulelong			x		flag hash: %#08X,
42>>>>20	ulelong			x		%u reservations,
43>>>>28	ulelong			x		payload size: %u bytes,
44>>>>32	ulelong			x		checksum1: %#08X,
45>>>>36	ulelong			x		checksum2: %#08X
46# No stub keys
47>>>24	ulelong			=0
48>>>>0	ulelong^0xC0DE0000	x		v8 bytecode, external reference table size: %u bytes,
49>>>>4	ulelong			=0x54F0AD81	version 6.2.414.46,
50>>>>4	ulelong			=0X7D1BF182	version 6.2.414.54,
51>>>>4	ulelong			=0x35BA122E	version 6.2.414.77,
52>>>>4	ulelong			=0X9319F9C2	version 6.2.414.78,
53>>>>4	ulelong			=0xB1240060	version 6.6.346.32,
54>>>>4	ulelong			=0x2B757060	version 6.7.288.46,
55>>>>4	ulelong			=0x09D147AA	version 6.7.288.49,
56>>>>4	ulelong			=0xF4D4F48A	version 6.8.275.32,
57>>>>4	ulelong			=0xD3961326	version 7.0.276.38,
58>>>>8	ulelong			x		source size: %u bytes,
59>>>>12	ulelong			x		cpu features: %#08X,
60>>>>16	ulelong			x		flag hash: %#08X,
61>>>>20	ulelong			x		%u reservations,
62>>>>28	ulelong			x		payload size: %u bytes,
63>>>>32	ulelong			x		checksum1: %#08X,
64>>>>36	ulelong			x		checksum2: %#08X
65# Reservation table starts at 32
66>>32	ulelong&0xFFFFFF00	=0x80000000
67# Second checksum present
68>>>28	ulelong			>0
69>>>>0	ulelong^0xC0DE0000	x		v8 bytecode, external reference table size: %u bytes,
70>>>>4	ulelong			=0x21DDF627	version 7.4.288.21,
71>>>>4	ulelong			=0x1FC9FE84	version 7.4.288.27,
72>>>>4	ulelong			=0x60A99E8B	version 7.5.288.22,
73>>>>4	ulelong			=0x4F665E90	version 7.6.303.29,
74>>>>4	ulelong			=0xC7ACFCDE	version 7.7.299.11,
75>>>>4	ulelong			=0x7F641D8F	version 7.7.299.13,
76>>>>4	ulelong			=0xFD9A4F2E	version 7.8.279.17,
77>>>>4	ulelong			=0x3A845324	version 7.8.279.23,
78>>>>4	ulelong			=0xFF52FEAF	version 7.9.317.25,
79>>>>8	ulelong			x		source size: %u bytes,
80>>>>12	ulelong			x		flag hash: %#08X,
81>>>>16	ulelong			x		%u reservations,
82>>>>20	ulelong			x		payload size: %u bytes,
83>>>>24	ulelong			x		checksum1: %#08X,
84>>>>28	ulelong			x		checksum2: %#08X
85# No second checksum
86>>>28	ulelong			=0
87>>>>0	ulelong^0xC0DE0000	x		v8 bytecode, external reference table size: %u bytes,
88>>>>4	ulelong			=0x8725E0F8	version 8.1.307.30,
89>>>>4	ulelong			=0x09ED1289	version 8.1.307.31,
90>>>>4	ulelong			=0xA5728C87	version 8.3.110.9,
91>>>>4	ulelong			=0xB45C5D30	version 8.4.371.23,
92>>>>4	ulelong			=0xED9C278B	version 8.4.371.19,
93>>>>4	ulelong			=0xD27BFF42	version 8.6.395.16,
94>>>>8	ulelong			x		source size: %u bytes,
95>>>>12	ulelong			x		flag hash: %#08X,
96>>>>16	ulelong			x		%u reservations,
97>>>>20	ulelong			x		payload size: %u bytes,
98>>>>24	ulelong			x		payload checksum: %#08X
99# No reservation table and code starts at 24
100>>32	ulelong		=0
101>>>0	ulelong^0xC0DE0000	x		v8 bytecode, external reference table size: %u bytes,
102>>>4	ulelong			=0x9A6F0B0F	version 9.0.257.17,
103>>>4	ulelong			=0x271D5D1E	version 9.0.257.24,
104>>>4	ulelong			=0x4EEA75DF	version 9.0.257.25,
105>>>4	ulelong			=0x80809479	version 9.1.269.36,
106>>>4	ulelong			=0x55C46F65	version 9.1.269.38,
107>>>4	ulelong			=0x8A9C758A	version 9.2.230.21,
108>>>4	ulelong			=0x9712F0E1	version 9.3.345.16,
109>>>4	ulelong			=0x29593715	version 9.4.146.19,
110>>>4	ulelong			=0xCD991825	version 9.4.146.24,
111>>>4	ulelong			=0xACDD64EE	version 9.4.146.26,
112>>>4	ulelong			=0xC96B4CD5	version 9.5.172.21,
113>>>4	ulelong			=0xBCCE4578	version 9.5.172.25,
114>>>4	ulelong			=0xA2EEA077	version 9.6.180.15,
115>>>4	ulelong			=0xFD350011	version 10.1.124.8,
116>>>4	ulelong			=0xBEF4028F	version 10.2.154.13,
117>>>4	ulelong			=0xAF632352	version 10.2.154.4,
118>>>8	ulelong			x		source size: %u bytes,
119>>>12	ulelong			x		flag hash: %#08X,
120>>>16	ulelong			x		payload size: %u bytes,
121>>>20	ulelong			x		payload checksum: %#08X
122