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/quadcode.com/node_modules/svelte-eslint-parser/lib/parser/script.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseScriptWithoutAnalyzeScope = exports.parseScript = void 0;
const analyze_scope_1 = require("./analyze-scope");
const traverse_1 = require("../traverse");
const resolve_parser_1 = require("./resolve-parser");
const parser_object_1 = require("./parser-object");
/**
 * Parse for script
 */
function parseScript(code, attrs, parserOptions = {}) {
    const result = parseScriptWithoutAnalyzeScopeFromVCode(code, attrs, parserOptions);
    if (!result.scopeManager) {
        const scopeManager = (0, analyze_scope_1.analyzeScope)(result.ast, parserOptions);
        result.scopeManager = scopeManager;
    }
    (0, traverse_1.traverseNodes)(result.ast, {
        visitorKeys: result.visitorKeys,
        enterNode(node, parent) {
            node.parent = parent;
            if (node.type === "LabeledStatement" && node.label.name === "$") {
                if ((parent === null || parent === void 0 ? void 0 : parent.type) === "Program") {
                    // Transform node type
                    node.type = "SvelteReactiveStatement";
                }
            }
        },
        leaveNode() {
            //
        },
    });
    return result;
}
exports.parseScript = parseScript;
/**
 * Parse for script without analyze scope
 */
function parseScriptWithoutAnalyzeScope(code, attrs, options) {
    const parser = (0, resolve_parser_1.getParser)(attrs, options.parser);
    const result = (0, parser_object_1.isEnhancedParserObject)(parser)
        ? parser.parseForESLint(code, options)
        : parser.parse(code, options);
    if ("ast" in result && result.ast != null) {
        return result;
    }
    return { ast: result };
}
exports.parseScriptWithoutAnalyzeScope = parseScriptWithoutAnalyzeScope;
/**
 * Parse for script without analyze scope
 */
function parseScriptWithoutAnalyzeScopeFromVCode(code, attrs, options) {
    const result = parseScriptWithoutAnalyzeScope(code, attrs, options);
    result._virtualScriptCode = code;
    return result;
}