Files
NapCatQQ/.pnpm-store/v3/files/c9/8793d6267f7a482d6cef7648837ab8e8d34fe7b44acb1b69f3e9ba26dd8ec867310adbb7ad3e582161e7d6cf837a5b062614d17b706c5defd87225d06958e0
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

28 lines
1.2 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.vuePreprocessor = vuePreprocessor;
var preprocessor_1 = require("./preprocessor");
function vuePreprocessor(code, options) {
var _a, _b;
var parse = require('@vue/compiler-sfc').parse;
var descriptor = parse(code).descriptor;
var scriptContent = (_a = descriptor.script) === null || _a === void 0 ? void 0 : _a.content;
var scriptSetupContent = (_b = descriptor.scriptSetup) === null || _b === void 0 ? void 0 : _b.content;
if (!scriptContent && !scriptSetupContent) {
return code;
}
var transformedCode = code;
var replacer = function (content) {
// we pass the second argument as a function to avoid issues with the replacement string
// if string contained special groups (like $&, $`, $', $n, $<n>, etc.) this would produce invalid results
return transformedCode.replace(content, function () { return "\n".concat((0, preprocessor_1.preprocessor)(content, options), "\n"); });
};
if (scriptContent) {
transformedCode = replacer(scriptContent);
}
if (scriptSetupContent) {
transformedCode = replacer(scriptSetupContent);
}
return transformedCode;
}