In theory it could be <script type=module> (without quotes), hence (["\']?).
Edit: Hmm, (["\']?) doesn't seem to work (for unquoted, quoted is fine).
So maybe something like this would be better:
local _, _, _, script_type = input:find('^%s+type%s*=%s*(["\'])(^["\']+)%1', index)
if script_type == 'text/javascript' or script_type == 'module' then
In theory it could be
<script type=module>
(without quotes), hence(["\']?)
. Edit: Hmm,(["\']?)
doesn't seem to work (for unquoted, quoted is fine).So maybe something like this would be better: