Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
2616be88
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2616be88
编写于
12月 06, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(nvue): init
上级
e57870f5
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
119 addition
and
81 deletion
+119
-81
packages/shims-node.d.ts
packages/shims-node.d.ts
+1
-1
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+15
-17
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-app-vite/src/index.ts
packages/uni-app-vite/src/index.ts
+6
-1
packages/uni-app-vite/src/nvue/index.ts
packages/uni-app-vite/src/nvue/index.ts
+14
-26
packages/uni-app-vite/src/nvue/plugins/entry.ts
packages/uni-app-vite/src/nvue/plugins/entry.ts
+50
-0
packages/uni-app-vite/src/nvue/rollup/index.ts
packages/uni-app-vite/src/nvue/rollup/index.ts
+2
-1
packages/uni-cli-nvue/src/webpack/index.ts
packages/uni-cli-nvue/src/webpack/index.ts
+2
-14
packages/uni-cli-shared/package.json
packages/uni-cli-shared/package.json
+1
-0
packages/uni-cli-shared/src/index.ts
packages/uni-cli-shared/src/index.ts
+1
-0
packages/uni-cli-shared/src/json/app/index.ts
packages/uni-cli-shared/src/json/app/index.ts
+1
-0
packages/uni-cli-shared/src/json/app/manifest/nvue.ts
packages/uni-cli-shared/src/json/app/manifest/nvue.ts
+3
-0
packages/uni-cli-shared/src/json/app/manifest/uniApp.ts
packages/uni-cli-shared/src/json/app/manifest/uniApp.ts
+1
-1
packages/uni-cli-shared/src/json/app/pages/uniConfig.ts
packages/uni-cli-shared/src/json/app/pages/uniConfig.ts
+1
-1
packages/uni-cli-shared/src/url.ts
packages/uni-cli-shared/src/url.ts
+9
-0
packages/uni-mp-vite/package.json
packages/uni-mp-vite/package.json
+0
-1
packages/uni-mp-vite/src/plugins/entry.ts
packages/uni-mp-vite/src/plugins/entry.ts
+7
-13
pnpm-lock.yaml
pnpm-lock.yaml
+2
-2
未找到文件。
packages/shims-node.d.ts
浏览文件 @
2616be88
...
...
@@ -16,7 +16,7 @@ declare namespace NodeJS {
UNI_COMPILER_VERSION_TYPE
:
'
a
'
|
'
r
'
UNI_HBUILDERX_PLUGINS
:
string
UNI_RENDERER
?:
'
native
'
UNI_NVUE_COMPILER
:
'
uni-app
'
|
'
weex
'
|
'
vue
'
UNI_NVUE_COMPILER
:
'
uni-app
'
|
'
weex
'
|
'
vue
'
|
'
vite
'
UNI_NVUE_STYLE_COMPILER
:
'
uni-app
'
|
'
weex
'
UNI_APP_CODE_SPLITING
?:
'
true
'
UNI_AUTOMATOR_WS_ENDPOINT
?:
string
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
2616be88
...
...
@@ -2663,6 +2663,20 @@ var serviceContext = (function (vue) {
UniServiceJSBridge.unsubscribe(getEventName(reqId));
}
const DEVICE_FREQUENCY = 200;
const NETWORK_TYPES = [
'unknown',
'none',
'ethernet',
'wifi',
'2g',
'3g',
'4g',
'5g',
];
const TEMP_PATH_BASE = '_doc/uniapp_temp';
const TEMP_PATH = `${TEMP_PATH_BASE}_${Date.now()}`;
const EVENT_BACKBUTTON = 'backbutton';
function backbuttonListener() {
uni.navigateBack({
...
...
@@ -9543,8 +9557,6 @@ var serviceContext = (function (vue) {
var pako_1 = pako;
const TEMP_PATH$1 = '';
const API_UPX2PX = 'upx2px';
const Upx2pxProtocol = [
{
...
...
@@ -10850,7 +10862,7 @@ var serviceContext = (function (vue) {
reject();
return;
}
const dirname = `${TEMP_PATH
$1
}/canvas`;
const dirname = `${TEMP_PATH}/canvas`;
operateCanvas(canvasId, pageId, 'toTempFilePath', {
x,
y,
...
...
@@ -13466,20 +13478,6 @@ var serviceContext = (function (vue) {
return resolve(getSystemInfoSync());
});
const DEVICE_FREQUENCY = 200;
const NETWORK_TYPES = [
'unknown',
'none',
'ethernet',
'wifi',
'2g',
'3g',
'4g',
'5g',
];
const TEMP_PATH_BASE = '_doc/uniapp_temp';
const TEMP_PATH = `${TEMP_PATH_BASE}_${Date.now()}`;
let listener$1 = null;
const onCompassChange = (defineOnApi(API_ON_COMPASS, () => {
startCompass();
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
2616be88
此差异已折叠。
点击以展开。
packages/uni-app-vite/src/index.ts
浏览文件 @
2616be88
...
...
@@ -21,6 +21,8 @@ import { uniRenderjsPlugin } from './plugins/renderjs'
import
{
uniStatsPlugin
}
from
'
./plugins/stats
'
import
{
uniEasycomPlugin
}
from
'
./plugins/easycom
'
import
{
uniConfusionPlugin
}
from
'
./plugins/confusion
'
import
{
uniNVuePlugin
}
from
'
./nvue
'
import
{
uniNVueEntryPlugin
}
from
'
./nvue/plugins/entry
'
function
initUniCssScopedPluginFilter
(
inputDir
:
string
...
...
@@ -65,7 +67,10 @@ const filter = initUniCssScopedPluginFilter(process.env.UNI_INPUT_DIR)
if
(
filter
)
{
plugins
.
unshift
(
uniCssScopedPlugin
({
filter
}))
}
if
(
process
.
env
.
UNI_NVUE_COMPILER
!==
'
vue
'
)
{
if
(
process
.
env
.
UNI_NVUE_COMPILER
===
'
vite
'
)
{
plugins
.
push
(
uniNVuePlugin
(
'
pages/demo/demo
'
))
plugins
.
push
(
uniNVueEntryPlugin
())
}
else
if
(
process
.
env
.
UNI_NVUE_COMPILER
!==
'
vue
'
)
{
plugins
.
push
(...
nvuePlugins
)
}
...
...
packages/uni-app-vite/src/nvue/index.ts
浏览文件 @
2616be88
// import { rollup, watch, RollupBuild, RollupOutput, RollupWatcher } from 'rollup'
// let nvueCallCounts = 0
// const nvueBuilds: RollupBuild[] = []
// interface NVueBuildOptions {
// watch?: boolean
// }
// export async function build(
// options: NVueBuildOptions
// ): Promise<RollupOutput | RollupOutput[] | RollupWatcher> {
// nvueCallCounts++
// try {
// return await doBuild()
// } finally {
// nvueCallCounts--
// if (nvueCallCounts <= 0) {
// await Promise.all(nvueBuilds.map((bundle) => bundle.close()))
// nvueBuilds.length = 0
// }
// }
// }
// async function doBuild() {}
import
{
Plugin
}
from
'
vite
'
import
{
createRollupOptions
}
from
'
./rollup
'
export
function
uniNVuePlugin
(
pagePath
:
string
):
Plugin
{
return
{
name
:
'
vite:uni-app-nvue
'
,
config
()
{
return
{
build
:
{
rollupOptions
:
createRollupOptions
(
pagePath
),
},
}
},
}
}
packages/uni-app-vite/src/nvue/plugins/entry.ts
0 → 100644
浏览文件 @
2616be88
import
path
from
'
path
'
import
type
{
Plugin
}
from
'
vite
'
import
{
decodeBase64Url
,
encodeBase64Url
,
normalizePath
,
polyfillCode
,
}
from
'
@dcloudio/uni-cli-shared
'
const
uniNVuePagePrefix
=
'
uniNVuePage://
'
function
isUniNVuePageUrl
(
id
:
string
)
{
return
id
.
startsWith
(
uniNVuePagePrefix
)
}
export
function
createUniNVuePagePath
(
pagePath
:
string
)
{
return
uniNVuePagePrefix
+
encodeBase64Url
(
pagePath
+
'
.nvue
'
)
}
function
parseUniNvuePagePath
(
uniNVuePageUrl
:
string
)
{
return
decodeBase64Url
(
uniNVuePageUrl
.
replace
(
uniNVuePagePrefix
,
''
))
}
export
function
uniNVueEntryPlugin
():
Plugin
{
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
return
{
name
:
'
vite:uni-app-nvue-entry
'
,
enforce
:
'
pre
'
,
resolveId
(
id
)
{
if
(
isUniNVuePageUrl
(
id
))
{
return
id
}
},
load
(
id
)
{
if
(
isUniNVuePageUrl
(
id
))
{
const
filepath
=
normalizePath
(
path
.
resolve
(
inputDir
,
parseUniNvuePagePath
(
id
))
)
this
.
addWatchFile
(
filepath
)
return
{
code
:
`import { createApp } from 'vue'
import App from '
${
filepath
}
'
${
polyfillCode
}
createApp(App).mount('#app')
`
,
}
}
},
}
}
packages/uni-app-vite/src/nvue/rollup/index.ts
浏览文件 @
2616be88
...
...
@@ -2,10 +2,11 @@ import { RollupOptions } from 'rollup'
import
vue
from
'
@vitejs/plugin-vue
'
import
{
EXTNAME_VUE_RE
,
removeExt
}
from
'
@dcloudio/uni-cli-shared
'
import
{
isBuiltInComponent
}
from
'
@dcloudio/uni-shared
'
import
{
createUniNVuePagePath
}
from
'
../plugins/entry
'
export
function
createRollupOptions
(
pagePath
:
string
):
RollupOptions
{
return
{
input
:
pagePath
,
input
:
createUniNVuePagePath
(
pagePath
)
,
context
:
'
global
'
,
external
:
[
'
vue
'
],
preserveEntrySignatures
:
false
,
...
...
packages/uni-cli-nvue/src/webpack/index.ts
浏览文件 @
2616be88
...
...
@@ -7,6 +7,7 @@ import {
normalizePath
,
parsePagesJsonOnce
,
removeExt
,
polyfillCode
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
createConfig
}
from
'
./config
'
...
...
@@ -97,20 +98,7 @@ function genNVueEntryCode(route: string) {
import App from '
${
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
route
)
)}
.nvue?mpType=page'
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
var promise = this.constructor
return this.then(function(value) {
return promise.resolve(callback()).then(function() {
return value
})
}, function(reason) {
return promise.resolve(callback()).then(function() {
throw reason
})
})
}
}
${
polyfillCode
}
App.mpType = 'page'
App.route = '
${
route
}
'
App.el = '#root'
...
...
packages/uni-cli-shared/package.json
浏览文件 @
2616be88
...
...
@@ -27,6 +27,7 @@
"@vue/compiler-dom"
:
"3.2.23"
,
"@vue/compiler-sfc"
:
"3.2.23"
,
"@vue/shared"
:
"3.2.23"
,
"base64url"
:
"^3.0.1"
,
"chalk"
:
"^4.1.1"
,
"chokidar"
:
"^3.5.2"
,
"compare-versions"
:
"^3.6.0"
,
...
...
packages/uni-cli-shared/src/index.ts
浏览文件 @
2616be88
export
*
from
'
./fs
'
export
*
from
'
./mp
'
export
*
from
'
./url
'
export
*
from
'
./env
'
export
*
from
'
./hbx
'
export
*
from
'
./ssr
'
...
...
packages/uni-cli-shared/src/json/app/index.ts
浏览文件 @
2616be88
export
*
from
'
./pages
'
export
*
from
'
./manifest
'
export
{
polyfillCode
}
from
'
./pages/code
'
packages/uni-cli-shared/src/json/app/manifest/nvue.ts
浏览文件 @
2616be88
...
...
@@ -13,6 +13,9 @@ export function getNVueCompiler(manifestJson: Record<string, any>) {
if
(
nvueCompiler
===
'
vue
'
)
{
return
'
vue
'
}
if
(
nvueCompiler
===
'
vite
'
)
{
return
'
vite
'
}
}
return
'
uni-app
'
}
...
...
packages/uni-cli-shared/src/json/app/manifest/uniApp.ts
浏览文件 @
2616be88
...
...
@@ -3,7 +3,7 @@ import { getNVueCompiler, getNVueFlexDirection } from './nvue'
interface
UniAppOptions
{
control
:
'
uni-v3
'
compilerVersion
:
string
nvueCompiler
:
'
uni-app
'
|
'
weex
'
nvueCompiler
:
'
uni-app
'
|
'
weex
'
|
'
vite
'
|
'
vue
'
renderer
:
'
auto
'
nvue
:
{
'
flex-direction
'
:
'
row
'
|
'
row-reverse
'
|
'
column
'
|
'
column-reverse
'
...
...
packages/uni-cli-shared/src/json/app/pages/uniConfig.ts
浏览文件 @
2616be88
...
...
@@ -13,7 +13,7 @@ interface AppUniConfig {
pages
:
string
[]
globalStyle
:
UniApp
.
PagesJsonPageStyle
nvue
:
{
compiler
:
'
uni-app
'
|
'
weex
'
|
'
vue
'
compiler
:
'
uni-app
'
|
'
weex
'
|
'
vue
'
|
'
vite
'
styleCompiler
:
'
weex
'
|
'
uni-app
'
'
flex-direction
'
:
'
row
'
|
'
row-reverse
'
|
'
column
'
|
'
column-reverse
'
}
...
...
packages/uni-cli-shared/src/url.ts
0 → 100644
浏览文件 @
2616be88
import
base64url
from
'
base64url
'
export
function
encodeBase64Url
(
str
:
string
)
{
return
base64url
.
encode
(
str
)
}
export
function
decodeBase64Url
(
str
:
string
)
{
return
base64url
.
decode
(
str
)
}
packages/uni-mp-vite/package.json
浏览文件 @
2616be88
...
...
@@ -26,7 +26,6 @@
"@intlify/shared"
:
"9.1.9"
,
"@intlify/vue-devtools"
:
"9.1.9"
,
"@vue/shared"
:
"3.2.23"
,
"base64url"
:
"^3.0.1"
,
"debug"
:
"^4.3.2"
,
"magic-string"
:
"^0.25.7"
},
...
...
packages/uni-mp-vite/src/plugins/entry.ts
浏览文件 @
2616be88
...
...
@@ -4,35 +4,29 @@ import {
normalizeMiniProgramFilename
,
normalizePath
,
removeExt
,
encodeBase64Url
,
decodeBase64Url
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
Plugin
}
from
'
vite
'
import
base64url
from
'
base64url
'
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
function
encode
(
str
:
string
)
{
return
base64url
.
encode
(
str
)
}
function
decode
(
str
:
string
)
{
return
base64url
.
decode
(
str
)
}
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
const
uniPagePrefix
=
'
uniPage://
'
const
uniComponentPrefix
=
'
uniComponent://
'
export
function
virtualPagePath
(
filepath
:
string
)
{
return
uniPagePrefix
+
encode
(
filepath
)
return
uniPagePrefix
+
encode
Base64Url
(
filepath
)
}
export
function
virtualComponentPath
(
filepath
:
string
)
{
return
uniComponentPrefix
+
encode
(
filepath
)
return
uniComponentPrefix
+
encode
Base64Url
(
filepath
)
}
export
function
parseVirtualPagePath
(
uniPageUrl
:
string
)
{
return
decode
(
uniPageUrl
.
replace
(
uniPagePrefix
,
''
))
return
decode
Base64Url
(
uniPageUrl
.
replace
(
uniPagePrefix
,
''
))
}
export
function
parseVirtualComponentPath
(
uniComponentUrl
:
string
)
{
return
decode
(
uniComponentUrl
.
replace
(
uniComponentPrefix
,
''
))
return
decode
Base64Url
(
uniComponentUrl
.
replace
(
uniComponentPrefix
,
''
))
}
export
function
isUniPageUrl
(
id
:
string
)
{
...
...
pnpm-lock.yaml
浏览文件 @
2616be88
...
...
@@ -363,6 +363,7 @@ importers:
'
@vue/compiler-dom'
:
3.2.23
'
@vue/compiler-sfc'
:
3.2.23
'
@vue/shared'
:
3.2.23
base64url
:
^3.0.1
chalk
:
^4.1.1
chokidar
:
^3.5.2
compare-versions
:
^3.6.0
...
...
@@ -396,6 +397,7 @@ importers:
'
@vue/compiler-dom'
:
3.2.23
'
@vue/compiler-sfc'
:
3.2.23
'
@vue/shared'
:
3.2.23
base64url
:
3.0.1
chalk
:
4.1.2
chokidar
:
3.5.2
compare-versions
:
3.6.0
...
...
@@ -686,7 +688,6 @@ importers:
'
@types/debug'
:
^4.1.7
'
@vue/compiler-sfc'
:
3.2.23
'
@vue/shared'
:
3.2.23
base64url
:
^3.0.1
debug
:
^4.3.2
magic-string
:
^0.25.7
dependencies
:
...
...
@@ -698,7 +699,6 @@ importers:
'
@intlify/shared'
:
9.1.9
'
@intlify/vue-devtools'
:
9.1.9
'
@vue/shared'
:
3.2.23
base64url
:
3.0.1
debug
:
4.3.2
magic-string
:
0.25.7
devDependencies
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录