Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
199f7e66
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
199f7e66
编写于
8月 04, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(nvue): easycom
上级
ebe593bf
变更
14
展开全部
显示空白变更内容
内联
并排
Showing
14 changed file
with
342 addition
and
185 deletion
+342
-185
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+150
-80
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+39
-39
packages/uni-app-vite/dist/plugin/uni.js
packages/uni-app-vite/dist/plugin/uni.js
+1
-0
packages/uni-app-vite/src/plugin/uni.ts
packages/uni-app-vite/src/plugin/uni.ts
+1
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.js
...module/rules/vueLoader/compilerOptions/modules/easycom.js
+20
-1
packages/uni-cli-nvue/lib/vue-loader/lib/index.js
packages/uni-cli-nvue/lib/vue-loader/lib/index.js
+2
-2
packages/uni-cli-nvue/lib/vue-loader/lib/runtime/componentNormalizer.js
...li-nvue/lib/vue-loader/lib/runtime/componentNormalizer.js
+14
-1
packages/uni-cli-nvue/src/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.ts
...module/rules/vueLoader/compilerOptions/modules/easycom.ts
+21
-1
packages/uni-cli-shared/src/vite/index.ts
packages/uni-cli-shared/src/vite/index.ts
+12
-3
packages/uni-h5-vite/dist/index.js
packages/uni-h5-vite/dist/index.js
+3
-0
packages/uni-h5-vite/src/index.ts
packages/uni-h5-vite/src/index.ts
+3
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+17
-17
packages/vite-plugin-uni/src/utils/plugin.ts
packages/vite-plugin-uni/src/utils/plugin.ts
+37
-2
packages/vite-plugin-uni/src/vue/options.ts
packages/vite-plugin-uni/src/vue/options.ts
+22
-39
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
199f7e66
...
...
@@ -3628,14 +3628,14 @@ var serviceContext = (function (vue) {
});
// let eventReady = false
let index$
2
= 0;
let index$
3
= 0;
let optionsCache = {};
function operateEditor(componentId, pageId, type, options) {
const data = { options };
const needCallOptions = options &&
('success' in options || 'fail' in options || 'complete' in options);
if (needCallOptions) {
const callbackId = String(index$
2
++);
const callbackId = String(index$
3
++);
data.callbackId = callbackId;
optionsCache[callbackId] = options;
}
...
...
@@ -4138,6 +4138,10 @@ var serviceContext = (function (vue) {
};
const API_STOP_BEACON_DISCOVERY = 'stopBeaconDiscovery';
const API_GET_SCREEN_BRIGHTNESS = 'getScreenBrightness';
const API_SET_SCREEN_BRIGHTNESS = 'setScreenBrightness';
const API_SET_KEEP_SCREEN_ON = 'setKeepScreenOn';
const API_CHECK_IS_SUPPORT_SOTER_AUTHENTICATION = 'soterAuthentication';
const API_CHECK_IS_SOTER_ENROLLED_IN_DEVICE = 'checkIsSoterEnrolledInDevice';
const CheckAuthModes = [
...
...
@@ -4222,6 +4226,21 @@ var serviceContext = (function (vue) {
const RemoveStorageProtocol = GetStorageProtocol;
const RemoveStorageSyncProtocol = GetStorageSyncProtocol;
const API_SAVE_FILE = 'saveFile';
const SaveFileOptions = {
formatArgs: {
tempFilePath(savedFilePath, params) {
params.tempFilePath = getRealPath(savedFilePath);
},
},
};
const SaveFileProtocol = {
tempFilePath: {
type: String,
required: true,
},
};
const API_GET_FILE_INFO = 'getFileInfo';
const GetFileInfoOptions = {
formatArgs: {
...
...
@@ -5573,6 +5592,45 @@ var serviceContext = (function (vue) {
});
}, OpenDocumentProtocol, OpenDocumentOptions);
function getFileName(path) {
const array = path.split('/');
return array[array.length - 1];
}
function getExtName(path) {
const array = path.split('.');
return array.length > 1 ? '.' + array[array.length - 1] : '';
}
let index$2 = 0;
const SAVED_DIR = 'uniapp_save';
const SAVE_PATH = `_doc/${SAVED_DIR}`;
function getSavedFileDir(success, fail) {
fail = fail || function () { };
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
// 请求_doc fs
fs.root.getDirectory(SAVED_DIR, {
// 获取文件保存目录对象
create: true,
}, success, fail);
}, fail);
}
const saveFile = defineAsyncApi(API_SAVE_FILE, ({ tempFilePath }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
const fileName = `${Date.now()}${index$2++}${getExtName(tempFilePath)}`;
plus.io.resolveLocalFileSystemURL(tempFilePath, (entry) => {
// 读取临时文件 FileEntry
getSavedFileDir((dir) => {
entry.copyTo(dir, fileName, () => {
// 复制临时文件 FileEntry,为了避免把相册里的文件删除,使用 copy,微信中是要删除临时文件的
const savedFilePath = SAVE_PATH + '/' + fileName;
resolve({
savedFilePath,
});
}, errorCallback);
}, errorCallback);
}, errorCallback);
}, SaveFileProtocol, SaveFileOptions);
const isIOS = plus.os.name === 'iOS';
let config;
/**
...
...
@@ -6687,6 +6745,19 @@ var serviceContext = (function (vue) {
});
});
const getScreenBrightness = defineAsyncApi(API_GET_SCREEN_BRIGHTNESS, (_, { resolve }) => {
const value = plus.screen.getBrightness(false);
resolve({ value });
});
const setScreenBrightness = defineAsyncApi(API_SET_SCREEN_BRIGHTNESS, (options, { resolve }) => {
plus.screen.setBrightness(options.value, false);
resolve();
});
const setKeepScreenOn = defineAsyncApi(API_SET_KEEP_SCREEN_ON, (options, { resolve }) => {
plus.device.setWakelock(!!options.keepScreenOn);
resolve();
});
const getImageInfo = defineAsyncApi(API_GET_IMAGE_INFO, (options, { resolve, reject }) => {
const path = TEMP_PATH + '/download/';
plus.io.getImageInfo(extend(options, {
...
...
@@ -6895,11 +6966,6 @@ var serviceContext = (function (vue) {
plus.gallery.save(options.filePath, warpPlusSuccessCallback(resolve), warpPlusErrorCallback(reject));
}, SaveImageToPhotosAlbumProtocol, SaveImageToPhotosAlbumOptions);
function getFileName(path) {
const array = path.split('/');
return array[array.length - 1];
}
const compressImage$1 = defineAsyncApi(API_COMPRESS_IMAGE, (options, { resolve, reject }) => {
const dst = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(options.src)}`;
plus.zip.compressImage(extend({}, options, {
...
...
@@ -11508,6 +11574,7 @@ var serviceContext = (function (vue) {
getStorageInfo: getStorageInfo,
getFileInfo: getFileInfo$1,
openDocument: openDocument,
saveFile: saveFile,
getSystemInfoSync: getSystemInfoSync,
getSystemInfo: getSystemInfo,
onCompassChange: onCompassChange,
...
...
@@ -11557,6 +11624,9 @@ var serviceContext = (function (vue) {
startSoterAuthentication: startSoterAuthentication,
scanCode: scanCode,
onThemeChange: onThemeChange,
getScreenBrightness: getScreenBrightness,
setScreenBrightness: setScreenBrightness,
setKeepScreenOn: setKeepScreenOn,
getImageInfo: getImageInfo,
getVideoInfo: getVideoInfo,
previewImage: previewImage,
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
199f7e66
此差异已折叠。
点击以展开。
packages/uni-app-vite/dist/plugin/uni.js
浏览文件 @
199f7e66
...
...
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports
.
uniOptions
=
void
0
;
const
uni_shared_1
=
require
(
"
@dcloudio/uni-shared
"
);
exports
.
uniOptions
=
{
copyOptions
:
{
assets
:
[
'
hybrid/html
'
]
},
compilerOptions
:
{
isNativeTag
:
uni_shared_1
.
isServiceNativeTag
,
isCustomElement
:
uni_shared_1
.
isServiceCustomElement
,
...
...
packages/uni-app-vite/src/plugin/uni.ts
浏览文件 @
199f7e66
...
...
@@ -5,6 +5,7 @@ import {
import
{
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
export
const
uniOptions
:
UniVitePlugin
[
'
uni
'
]
=
{
copyOptions
:
{
assets
:
[
'
hybrid/html
'
]
},
compilerOptions
:
{
isNativeTag
:
isServiceNativeTag
,
isCustomElement
:
isServiceCustomElement
,
...
...
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.js
浏览文件 @
199f7e66
...
...
@@ -2,10 +2,29 @@
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createEasycomModule
=
void
0
;
const
uni_shared_1
=
require
(
"
@dcloudio/uni-shared
"
);
const
BUILT_IN_COMPONENTS
=
[
'
App
'
,
'
block
'
,
'
component
'
,
'
transition
'
,
'
transition-group
'
,
'
keep-alive
'
,
'
slot
'
,
'
teleport
'
,
];
function
isComponent
(
tagName
)
{
if
(
BUILT_IN_COMPONENTS
.
includes
(
tagName
))
{
return
false
;
}
if
(
uni_shared_1
.
isBuiltInComponent
(
tagName
))
{
return
false
;
}
return
true
;
}
function
createEasycomModule
()
{
return
{
preTransformNode
(
el
,
options
)
{
if
(
uni_shared_1
.
isBuiltInComponent
(
el
.
tag
)
&&
el
.
tag
!==
'
App
'
)
{
if
(
isComponent
(
el
.
tag
)
)
{
// 挂在 isUnaryTag 上边,可以保证外部访问到
;
(
options
.
isUnaryTag
.
autoComponents
||
...
...
packages/uni-cli-nvue/lib/vue-loader/lib/index.js
浏览文件 @
199f7e66
...
...
@@ -166,8 +166,8 @@ var component = normalizer(
${
hasFunctional
?
`true`
:
`false`
}
,
${
`null`
/* fixed by xxxxxx */
}
,
${
hasScoped
?
JSON
.
stringify
(
id
)
:
`null`
}
,
${
isServer
?
JSON
.
stringify
(
hash
(
request
))
:
`null`
}
${
isShadow
?
`,true`
:
``
}
,
${
isServer
?
JSON
.
stringify
(
hash
(
request
))
:
`null`
}
,
${
isShadow
?
`,true`
:
`
false
`
}
,
components
)
`
.
trim
()
+
`\n`
...
...
packages/uni-cli-nvue/lib/vue-loader/lib/runtime/componentNormalizer.js
浏览文件 @
199f7e66
...
...
@@ -12,13 +12,26 @@ export default function normalizeComponent (
injectStyles
,
scopeId
,
moduleIdentifier
,
/* server only */
shadowMode
/* vue-cli only */
shadowMode
,
/* vue-cli only */
components
,
// fixed by xxxxxx auto components
)
{
// Vue.extend constructor export interop
var
options
=
typeof
scriptExports
===
'
function
'
?
scriptExports
.
options
:
scriptExports
// fixed by xxxxxx auto components
if
(
components
)
{
if
(
!
options
.
components
)
{
options
.
components
=
{}
}
var
hasOwn
=
Object
.
prototype
.
hasOwnProperty
for
(
var
name
in
components
)
{
if
(
hasOwn
.
call
(
components
,
name
)
&&
!
hasOwn
.
call
(
options
.
components
,
name
))
{
options
.
components
[
name
]
=
components
[
name
]
}
}
}
// render functions
if
(
render
)
{
options
.
render
=
render
...
...
packages/uni-cli-nvue/src/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.ts
浏览文件 @
199f7e66
import
{
ASTElement
,
ModuleOptions
}
from
'
vue-template-compiler
'
import
{
isBuiltInComponent
}
from
'
@dcloudio/uni-shared
'
const
BUILT_IN_COMPONENTS
=
[
'
App
'
,
'
block
'
,
'
component
'
,
'
transition
'
,
'
transition-group
'
,
'
keep-alive
'
,
'
slot
'
,
'
teleport
'
,
]
function
isComponent
(
tagName
:
string
)
{
if
(
BUILT_IN_COMPONENTS
.
includes
(
tagName
))
{
return
false
}
if
(
isBuiltInComponent
(
tagName
))
{
return
false
}
return
true
}
export
function
createEasycomModule
()
{
return
{
preTransformNode
(
el
:
ASTElement
,
options
:
any
)
{
if
(
is
BuiltInComponent
(
el
.
tag
)
&&
el
.
tag
!==
'
App
'
)
{
if
(
is
Component
(
el
.
tag
)
)
{
// 挂在 isUnaryTag 上边,可以保证外部访问到
;(
options
.
isUnaryTag
.
autoComponents
||
...
...
packages/uni-cli-shared/src/vite/index.ts
浏览文件 @
199f7e66
import
{
Plugin
}
from
'
vite
'
import
{
ParserOptions
}
from
'
@vue/compiler-core
'
import
{
CompilerOptions
}
from
'
@vue/compiler-sfc
'
import
type
{
Plugin
}
from
'
vite
'
import
type
{
ParserOptions
}
from
'
@vue/compiler-core
'
import
type
{
CompilerOptions
}
from
'
@vue/compiler-sfc
'
import
type
{
Target
}
from
'
rollup-plugin-copy
'
interface
CopyOptions
{
/**
* 静态资源,配置的目录,在 uni_modules 中同样支持
*/
assets
?:
string
[]
targets
?:
readonly
Target
[]
}
export
interface
UniVitePlugin
extends
Plugin
{
uni
?:
{
compilerOptions
?:
{
...
...
@@ -9,6 +17,7 @@ export interface UniVitePlugin extends Plugin {
directiveTransforms
?:
CompilerOptions
[
'
directiveTransforms
'
]
}
transformEvent
?:
Record
<
string
,
string
>
copyOptions
?:
CopyOptions
|
(()
=>
CopyOptions
)
}
}
...
...
packages/uni-h5-vite/dist/index.js
浏览文件 @
199f7e66
...
...
@@ -21,6 +21,9 @@ const transformIndexHtml_1 = require("./transformIndexHtml");
const
UniH5Plugin
=
{
name
:
'
vite:uni-h5
'
,
uni
:
{
copyOptions
:
{
assets
:
[
'
hybrid/html
'
],
},
transformEvent
:
{
tap
:
'
click
'
,
},
...
...
packages/uni-h5-vite/src/index.ts
浏览文件 @
199f7e66
...
...
@@ -18,6 +18,9 @@ import { createTransformIndexHtml } from './transformIndexHtml'
const
UniH5Plugin
:
UniVitePlugin
=
{
name
:
'
vite:uni-h5
'
,
uni
:
{
copyOptions
:
{
assets
:
[
'
hybrid/html
'
],
},
transformEvent
:
{
tap
:
'
click
'
,
},
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
199f7e66
...
...
@@ -786,7 +786,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out = safeAreaInsets;
var out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
...
...
@@ -798,10 +798,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top : 0,
bottom: bottom ? bottom +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom : 0,
left: left ? left +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left : 0,
right: right ? right +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right : 0
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
};
}
function updateCssVar(cssVars) {
...
...
@@ -13347,7 +13347,7 @@ function normalizePageMeta(pageMeta) {
}, pageMeta.pullToRefresh));
const { type, style } = navigationBar;
if (style !== "custom" && type !== "transparent") {
pullToRefresh.offset += NAVBAR_HEIGHT +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
pullToRefresh.offset += NAVBAR_HEIGHT + out.top;
}
pageMeta.pullToRefresh = pullToRefresh;
}
...
...
@@ -15545,7 +15545,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight =
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
const statusBarHeight = out.top;
let osname;
let osversion;
let model;
...
...
@@ -15658,12 +15658,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left,
right: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
bottom: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
width: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
height: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth -
out.left -
out.right,
height: windowHeight -
out.top -
out.bottom
};
const { top: windowTop, bottom: windowBottom } = getWindowOffset();
windowHeight -= windowTop;
...
...
@@ -15683,10 +15683,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
right:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
bottom:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
}
};
});
...
...
packages/vite-plugin-uni/src/utils/plugin.ts
浏览文件 @
199f7e66
import
{
isArray
,
isString
}
from
'
@vue/shared
'
import
path
from
'
path
'
import
{
Plugin
}
from
'
vite
'
import
{
extend
,
isArray
,
isString
}
from
'
@vue/shared
'
import
{
isCustomElement
,
isNativeTag
}
from
'
@dcloudio/uni-shared
'
import
{
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
CompilerOptions
}
from
'
@vue/compiler-sfc
'
interface
PluginConfig
{
id
:
string
...
...
@@ -13,6 +15,39 @@ interface PluginConfig {
}
}
export
function
initPluginUniOptions
(
UniVitePlugins
:
UniVitePlugin
[])
{
const
transformEvent
:
Record
<
string
,
string
>
=
Object
.
create
(
null
)
const
compilerOptions
:
CompilerOptions
=
{
isNativeTag
,
isCustomElement
,
}
UniVitePlugins
.
forEach
((
plugin
)
=>
{
const
{
compilerOptions
:
pluginCompilerOptions
,
transformEvent
:
pluginTransformEvent
,
}
=
plugin
.
uni
||
{}
if
(
pluginCompilerOptions
)
{
if
(
pluginCompilerOptions
.
isNativeTag
)
{
compilerOptions
.
isNativeTag
=
pluginCompilerOptions
.
isNativeTag
}
if
(
pluginCompilerOptions
.
isCustomElement
)
{
compilerOptions
.
isCustomElement
=
pluginCompilerOptions
.
isCustomElement
}
if
(
pluginCompilerOptions
.
directiveTransforms
)
{
compilerOptions
.
directiveTransforms
=
pluginCompilerOptions
.
directiveTransforms
}
}
if
(
pluginTransformEvent
)
{
extend
(
transformEvent
,
pluginTransformEvent
)
}
})
return
{
transformEvent
,
compilerOptions
,
}
}
export
function
initExtraPlugins
(
cliRoot
:
string
,
platform
:
UniApp
.
PLATFORM
)
{
return
initPlugins
(
resolvePlugins
(
cliRoot
,
platform
))
}
...
...
packages/vite-plugin-uni/src/vue/options.ts
浏览文件 @
199f7e66
import
{
extend
,
hasOwn
,
isArray
}
from
'
@vue/shared
'
import
{
ParserOptions
}
from
'
@vue/compiler-core
'
import
{
CompilerOptions
,
SFCTemplateCompileOptions
}
from
'
@vue/compiler-sfc
'
import
{
isCustomElement
,
isNativeTag
}
from
'
@dcloudio/uni-shared
'
import
{
SFCTemplateCompileOptions
}
from
'
@vue/compiler-sfc
'
import
{
isCustomElement
}
from
'
@dcloudio/uni-shared
'
import
{
EXTNAME_VUE_RE
,
parseCompatConfigOnce
,
//
parseCompatConfigOnce,
UniVitePlugin
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
VitePluginUniResolvedOptions
}
from
'
..
'
import
{
transformMatchMedia
}
from
'
./transforms/transformMatchMedia
'
import
{
createTransformEvent
}
from
'
./transforms/transformEvent
'
import
{
initPluginUniOptions
}
from
'
../utils/plugin
'
// import { transformContext } from './transforms/transformContext'
function
createUniVueTransformAssetUrls
(
...
...
@@ -56,41 +55,32 @@ export function initPluginVueOptions(
options
.
base
)
let
isCompilerNativeTag
:
ParserOptions
[
'
isNativeTag
'
]
=
isNativeTag
let
isCompilerCustomElement
:
ParserOptions
[
'
isCustomElement
'
]
=
isCustomElement
let
directiveTransforms
:
CompilerOptions
[
'
directiveTransforms
'
]
const
{
compilerOptions
:
{
isNativeTag
,
isCustomElement
,
directiveTransforms
},
}
=
initPluginUniOptions
(
UniVitePlugins
)
UniVitePlugins
.
forEach
((
plugin
)
=>
{
const
compilerOptions
=
plugin
.
uni
?.
compilerOptions
if
(
compilerOptions
)
{
if
(
compilerOptions
.
isNativeTag
)
{
isCompilerNativeTag
=
compilerOptions
.
isNativeTag
}
if
(
compilerOptions
.
isCustomElement
)
{
isCompilerCustomElement
=
compilerOptions
.
isCustomElement
}
if
(
compilerOptions
.
directiveTransforms
)
{
directiveTransforms
=
compilerOptions
.
directiveTransforms
}
}
})
const
compilerOptions
=
templateOptions
.
compilerOptions
||
(
templateOptions
.
compilerOptions
=
{})
compilerOptions
.
isNativeTag
=
isCompilerNativeTag
compilerOptions
.
isNativeTag
=
isNativeTag
compilerOptions
.
isCustomElement
=
isCustomElement
if
(
directiveTransforms
)
{
compilerOptions
.
directiveTransforms
=
extend
(
compilerOptions
.
directiveTransforms
||
{},
directiveTransforms
)
}
if
(
!
compilerOptions
.
nodeTransforms
)
{
compilerOptions
.
nodeTransforms
=
[]
}
const
compatConfig
=
parseCompatConfigOnce
(
options
.
inputDir
)
compilerOptions
.
compatConfig
=
extend
(
compilerOptions
.
compatConfig
||
{},
compatConfig
)
// const compatConfig = parseCompatConfigOnce(options.inputDir)
compilerOptions
.
isCustomElement
=
isCompilerCustomElement
// compilerOptions.compatConfig = extend(
// compilerOptions.compatConfig || {},
// compatConfig
// )
const
eventOpts
=
UniVitePlugins
.
reduce
<
Record
<
string
,
string
>>
(
(
eventOpts
,
UniVitePlugin
)
=>
{
...
...
@@ -104,15 +94,8 @@ export function initPluginVueOptions(
compilerOptions
.
nodeTransforms
.
unshift
(
transformMatchMedia
)
}
if
(
directiveTransforms
)
{
compilerOptions
.
directiveTransforms
=
extend
(
compilerOptions
.
directiveTransforms
||
{},
directiveTransforms
)
}
// App,MP 平台不支持使用静态节点
compilerOptions
.
hoistStatic
=
false
return
vueOptions
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录