"use strict"
const htmlparser = require("htmlparser2")
const TransformableString = require("./TransformableString")
function iterateScripts(code, options, onChunk) {
if (!code) return
const xmlMode = options.xmlMode
const isJavaScriptMIMEType = options.isJavaScriptMIMEType || (() => true)
let index = 0
let inScript = false
let cdata = []
const chunks = []
function pushChunk(type, end) {
chunks.push({ type, start: index, end, cdata })
cdata = []
index = end
}
const parser = new htmlparser.Parser(
{
onopentag(name, attrs) {
// Test if current tag is a valid