H5-contact/node_modules/@dcloudio/uni-cli-shared/dist/dom2/vue.js

38 lines
1.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initVueTemplateCompilerExtraOptions = void 0;
const path_1 = __importDefault(require("path"));
const utils_1 = require("../utils");
const json_1 = require("../json");
const vue_1 = require("../vue");
function initVueTemplateCompilerExtraOptions(descriptor) {
const filename = (0, utils_1.normalizePath)(descriptor.filename.split('?')[0]);
const relativeFilename = (0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, filename));
const rootScrollView = (0, json_1.parseUniXPageOptions)(filename);
const componentType = rootScrollView || (0, json_1.isUniPageFile)(filename) ? 'page' : 'component';
const isDynamic = process.env.UNI_APP_X_DOM2_DYNAMIC === 'true';
const helper = (0, utils_1.requireUniHelpers)();
return {
root: (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR),
platform: process.env.UNI_UTS_PLATFORM,
componentType,
filename,
relativeFilename,
helper,
enableRootScrollViewTransform: true,
// 仅页面透传 rootScrollView避免非页面组件误触发 ROOT 自动包裹逻辑。
rootScrollView: componentType === 'page' ? rootScrollView : undefined,
scriptCppBlocks: descriptor.scriptCppBlocks,
onVueTemplateCompileLog(type, error) {
return (0, vue_1.onVueTemplateCompileLog)(type, error, descriptor.source, relativeFilename);
},
r: helper.K,
className: helper.GCN(descriptor.filename, process.env.UNI_INPUT_DIR),
inlineRender: !isDynamic && process.env.UNI_UTS_PLATFORM === 'app-android',
};
}
exports.initVueTemplateCompilerExtraOptions = initVueTemplateCompilerExtraOptions;