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

wip(uts): compiler

上级 0d315a3e
import path from 'path'
export const templateDir = path.resolve(__dirname, '../lib/template/')
export function nvueOutDir() {
return path.join(
process.env.UNI_OUTPUT_DIR,
'../.nvue',
'app' +
(process.env.UNI_APP_PLATFORM ? '-' + process.env.UNI_APP_PLATFORM : '')
)
return path.join(process.env.UNI_OUTPUT_DIR, '../.nvue')
}
......@@ -28,8 +28,5 @@ export function getPlatforms() {
}
export function getPlatformDir() {
if (process.env.UNI_PLATFORM === 'app' && process.env.UNI_APP_PLATFORM) {
return process.env.UNI_PLATFORM + '-' + process.env.UNI_APP_PLATFORM
}
return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM
}
......@@ -63,15 +63,6 @@ export function initPreContext(
nvueContext.APP_NVUE = true
nvueContext.APP_PLUS_NVUE = true
if (process.env.UNI_APP_PLATFORM === 'android') {
defaultContext.APP_ANDROID = true
} else if (process.env.UNI_APP_PLATFORM === 'ios') {
defaultContext.APP_IOS = true
} else {
defaultContext.APP_ANDROID = true
defaultContext.APP_IOS = true
}
} else if (platform.startsWith('mp-')) {
defaultContext.MP = true
} else if (platform.startsWith('quickapp-webview')) {
......
import type { Plugin } from 'vite'
import path from 'path'
import { isInHBuilderX, parseVueRequest, preJs } from '@dcloudio/uni-cli-shared'
import { isInHBuilderX, parseVueRequest } from '@dcloudio/uni-cli-shared'
import {
BindingIdentifier,
ClassDeclaration,
......@@ -52,7 +52,7 @@ export function uniUtsV1Plugin(): Plugin {
// 懒加载 uts 编译器
// eslint-disable-next-line no-restricted-globals
const { parse } = require('@dcloudio/uts')
const ast = await parse(preJs(code), { noColor: isInHBuilderX() })
const ast = await parse(code, { noColor: isInHBuilderX() })
code = `
import { initUtsProxyClass, initUtsProxyFunction, initUtsPackageName, initUtsClassName } from '@dcloudio/uni-app'
const name = '${pkg.name}'
......
......@@ -44,15 +44,6 @@ export function uniCopyPlugin({
})
.map((p) => '/' + PUBLIC_DIR + '/' + p)
if (process.env.UNI_APP_PLATFORM === 'android') {
ignorePlatformStaticDirs.push(`/${PUBLIC_DIR}/app-ios`)
} else if (process.env.UNI_APP_PLATFORM === 'ios') {
ignorePlatformStaticDirs.push(`/${PUBLIC_DIR}/app-android`)
} else {
ignorePlatformStaticDirs.push(`/${PUBLIC_DIR}/app-android`)
ignorePlatformStaticDirs.push(`/${PUBLIC_DIR}/app-ios`)
}
const targets: UniViteCopyPluginTarget[] = [
{
src: assets,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册