提交 94854d3e 编写于 作者: fxy060608's avatar fxy060608

chore: build

......@@ -12,7 +12,6 @@ declare namespace NodeJS {
UNI_CLI_CONTEXT: string
UNI_SUBPACKAGE?: string
UNI_MP_PLUGIN?: 'true'
UNI_MP_UNIAD?: Boolean
UNI_COMPILER_VERSION: string
UNI_COMPILER_VERSION_TYPE: 'a' | 'r'
UNI_HBUILDERX_PLUGINS: string
......
......@@ -10,26 +10,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var initMiniProgramPlugin__default = /*#__PURE__*/_interopDefaultLegacy(initMiniProgramPlugin);
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
const AD_COMPONENTS = [
'uniad',
'ad-rewarded-video',
'ad-fullscreen-video',
'ad-interstitial',
];
function transformAd(node, context) {
if (!uniCliShared.isElementNode(node)) {
return;
}
const adpidProp = compilerCore.findProp(node, 'adpid');
if (node.tag === 'ad' && adpidProp) {
node.tag = 'uniad';
node.tagType = 1 /* COMPONENT */;
}
if (AD_COMPONENTS.indexOf(node.tag) > -1) {
process.env.UNI_MP_UNIAD = true;
}
}
var uniad_app_json = function (appJson) {
if (!appJson.plugins) {
appJson.plugins = {};
......@@ -57,6 +37,31 @@ var uniad_app_json = function (appJson) {
var uniadAppJson = uniad_app_json;
const AD_COMPONENTS = [
'uniad',
'ad-rewarded-video',
'ad-fullscreen-video',
'ad-interstitial',
];
let appJsonUniadFlag = false;
function transformAd(node, context) {
if (!uniCliShared.isElementNode(node)) {
return;
}
const adpidProp = compilerCore.findProp(node, 'adpid');
if (node.tag === 'ad' && adpidProp) {
node.tag = 'uniad';
node.tagType = 1 /* COMPONENT */;
}
if (appJsonUniadFlag) {
return;
}
if (AD_COMPONENTS.indexOf(node.tag) > -1) {
appJsonUniadFlag = true;
uniadAppJson(uniCliShared.findJsonFile('app'));
}
}
var description = "项目配置文件。";
var packOptions = {
ignore: [
......@@ -187,12 +192,6 @@ const options = {
darkmode: true,
subpackages: true,
plugins: true,
normalize(appJson) {
if (process.env.UNI_MP_UNIAD == true) {
uniadAppJson(appJson);
}
return appJson;
},
},
project: {
filename: projectConfigFilename,
......
......@@ -10,8 +10,6 @@ import {
import { UniMiniProgramPluginOptions } from '@dcloudio/uni-mp-vite'
import { transformAd } from './transforms/transformAd'
import uniadAppJson from './uniad.app.json'
import source from './project.config.json'
export const customElements = [
......@@ -100,12 +98,6 @@ export const options: UniMiniProgramPluginOptions = {
darkmode: true,
subpackages: true,
plugins: true,
normalize(appJson) {
if (process.env.UNI_MP_UNIAD == true) {
uniadAppJson(appJson)
}
return appJson
},
},
project: {
filename: projectConfigFilename,
......
import { isElementNode } from '@dcloudio/uni-cli-shared'
import { isElementNode, findJsonFile } from '@dcloudio/uni-cli-shared'
import {
findProp,
RootNode,
......@@ -14,6 +14,10 @@ const AD_COMPONENTS: Array<string> = [
'ad-interstitial',
]
import uniadAppJson from '../uniad.app.json'
let appJsonUniadFlag = false
export function transformAd(
node: RootNode | TemplateChildNode,
context: TransformContext
......@@ -21,12 +25,18 @@ export function transformAd(
if (!isElementNode(node)) {
return
}
const adpidProp = findProp(node, 'adpid')
if (node.tag === 'ad' && adpidProp) {
node.tag = 'uniad'
node.tagType = ElementTypes.COMPONENT
}
if (appJsonUniadFlag) {
return
}
if (AD_COMPONENTS.indexOf(node.tag) > -1) {
process.env.UNI_MP_UNIAD = true
appJsonUniadFlag = true
uniadAppJson(findJsonFile('app'))
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册