HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/blog.affstore/node_modules/svelte-preprocess/dist/modules/markup.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformMarkup = exports.parseAttributes = exports.stripTags = exports.createTagRegex = void 0;
/** Create a tag matching regexp. */
function createTagRegex(tagName, flags) {
    return new RegExp(`/<!--[^]*?-->|<${tagName}(\\s[^]*?)?(?:>([^]*?)<\\/${tagName}>|\\/>)`, flags);
}
exports.createTagRegex = createTagRegex;
/** Strip script and style tags from markup. */
function stripTags(markup) {
    return markup
        .replace(createTagRegex('style', 'gi'), '')
        .replace(createTagRegex('script', 'gi'), '');
}
exports.stripTags = stripTags;
/** Transform an attribute string into a key-value object */
function parseAttributes(attributesStr) {
    return attributesStr
        .split(/\s+/)
        .filter(Boolean)
        .reduce((acc, attr) => {
        const [name, value] = attr.split('=');
        // istanbul ignore next
        acc[name] = value ? value.replace(/['"]/g, '') : true;
        return acc;
    }, {});
}
exports.parseAttributes = parseAttributes;
async function transformMarkup({ content, filename }, transformer, options = {}) {
    let { markupTagName = 'template' } = options;
    markupTagName = markupTagName.toLocaleLowerCase();
    const markupPattern = createTagRegex(markupTagName);
    const templateMatch = content.match(markupPattern);
    /** If no <template> was found, run the transformer over the whole thing */
    if (!templateMatch || templateMatch.index == null) {
        return transformer({
            content,
            markup: content,
            attributes: {},
            filename,
            options,
        });
    }
    const [fullMatch, attributesStr = '', templateCode] = templateMatch;
    const attributes = parseAttributes(attributesStr);
    /** Transform the found template code */
    let { code, map, dependencies } = await transformer({
        content: templateCode,
        markup: templateCode,
        attributes,
        filename,
        options,
    });
    code =
        content.slice(0, templateMatch.index) +
            code +
            content.slice(templateMatch.index + fullMatch.length);
    return { code, map, dependencies };
}
exports.transformMarkup = transformMarkup;