Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
7f435663
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
720
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,发现更多精彩内容 >>
提交
7f435663
编写于
4月 10, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(uni-app-x web): 修复css内使用v-bind无效的Bug
上级
a2ffb69e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
21 deletion
+35
-21
packages/uni-cli-shared/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
...cli-shared/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
+27
-14
packages/uni-cli-shared/package.json
packages/uni-cli-shared/package.json
+2
-0
packages/uni-cli-shared/src/vue/polyfill.ts
packages/uni-cli-shared/src/vue/polyfill.ts
+0
-7
pnpm-lock.yaml
pnpm-lock.yaml
+6
-0
未找到文件。
packages/uni-cli-shared/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
浏览文件 @
7f435663
...
...
@@ -2076,8 +2076,8 @@ function isEmpty(node) {
}
return true;
}
function hmrShouldReload(prevImports, next) {
if (!next.scriptSetup || next.scriptSetup.lang !== "ts" && next.scriptSetup.lang !== "tsx") {
function hmrShouldReload(prevImports, next) {
// fixed by xxxxxx
if (!next.scriptSetup || next.scriptSetup.lang !== "ts" && next.scriptSetup.lang !== "tsx"
&& next.scriptSetup.lang !== "uts"
) {
return false;
}
for (const key in prevImports) {
...
...
@@ -15532,6 +15532,8 @@ class ScriptCompileContext {
const scriptSetupLang = scriptSetup && scriptSetup.lang;
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
// fixed by xxxxxx
this.isUTS = scriptLang === "uts" || scriptSetupLang === "uts"
const customElement = options.customElement;
const filename = this.descriptor.filename;
if (customElement) {
...
...
@@ -15599,8 +15601,8 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
plugins.push("jsx");
} else if (userPlugins) {
userPlugins = userPlugins.filter((p) => p !== "jsx");
}
if (lang === "ts" || lang === "tsx") {
}
// fixed by xxxxxx
if (lang === "ts" || lang === "tsx"
|| lang === 'uts'
) {
plugins.push(["typescript", { dts }], "explicitResourceManagement");
if (!userPlugins || !userPlugins.includes("decorators")) {
plugins.push("decorators-legacy");
...
...
@@ -15708,7 +15710,7 @@ const normalScriptDefaultVar = `__default__`;
function processNormalScript(ctx, scopeId) {
var _a;
const script = ctx.descriptor.script;
if (script.lang && !ctx.isJS && !ctx.isTS) {
if (script.lang && !ctx.isJS && !ctx.isTS
&& !ctx.isUTS
) {
return script;
}
try {
...
...
@@ -15722,6 +15724,17 @@ function processNormalScript(ctx, scopeId) {
const defaultVar = genDefaultAs || normalScriptDefaultVar;
const s = new MagicString(content);
rewriteDefaultAST(scriptAst.body, s, defaultVar);
// fixed by xxxxxx
if(ctx.isUTS) {
scriptAst.body.forEach((node) => {
if (node.type === "ExportDefaultDeclaration") {
if (node.declaration.type === "ObjectExpression") {
s.appendLeft(node.declaration.start, `defineComponent(`);
s.appendRight (node.declaration.end, `)`);
}
}
})
}
content = s.toString();
if (cssVars.length && !((_a = ctx.options.templateOptions) == null ? void 0 : _a.ssr)) {
content += genNormalScriptCssVarsCode(
...
...
@@ -19190,8 +19203,8 @@ function genModelProps(ctx) {
skipCheck && "skipCheck: true"
]);
let decl;
if (runtimeType && options) {
decl = ctx.isTS ? `{ ${codegenOptions}, ...${options} }` : `Object.assign({ ${codegenOptions} }, ${options})`;
if (runtimeType && options) {
// fixed by xxxxxx
decl = ctx.isTS
|| ctx.isUTS
? `{ ${codegenOptions}, ...${options} }` : `Object.assign({ ${codegenOptions} }, ${options})`;
} else {
decl = options || (runtimeType ? `{ ${codegenOptions} }` : "{}");
}
...
...
@@ -19859,8 +19872,8 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
throw new Error(
`[@vue/compiler-sfc] <script> and <script setup> must have the same language type.`
);
}
if (scriptSetupLang && !ctx.isJS && !ctx.isTS) {
}
// fixed by xxxxxx
if (scriptSetupLang && !ctx.isJS && !ctx.isTS
&& !ctx.isUTS
) {
return scriptSetup;
}
const scriptBindings = /* @__PURE__ */ Object.create(null);
...
...
@@ -19888,8 +19901,8 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
ctx.s.move(start, end, 0);
}
function registerUserImport(source2, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
let isUsedInTemplate = needTemplateUsageCheck;
if (needTemplateUsageCheck &&
ctx.isTS
&& sfc.template && !sfc.template.src && !sfc.template.lang) {
let isUsedInTemplate = needTemplateUsageCheck;
// fixed by xxxxxx
if (needTemplateUsageCheck &&
( ctx.isTS || ctx.isUTS )
&& sfc.template && !sfc.template.src && !sfc.template.lang) {
isUsedInTemplate = isImportUsed(local, sfc);
}
ctx.userImports[local] = {
...
...
@@ -20178,7 +20191,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
node
);
}
if (ctx.isTS
) {
if (ctx.isTS
|| ctx.isUTS) { // fixed by xxxxxx
if (node.type.startsWith("TS") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "VariableDeclaration" && node.declare) {
if (node.type !== "TSEnumDeclaration") {
hoistNode(node);
...
...
@@ -20272,7 +20285,7 @@ ${genCssVarsCode(
}
}
if (hasAwait) {
const any =
ctx.isTS ? `: any` : ``;
const any =
(ctx.isTS || ctx.isUTS) ? `: any` : ``; // fixed by xxxxxx
ctx.s.prependLeft(startOffset, `
let __temp${any}, __restore${any}
`);
...
...
@@ -20404,7 +20417,7 @@ return ${returned}
}
const exposeCall = ctx.hasDefineExposeCall || options.inlineTemplate ? `` : ` __expose();
`;
if (ctx.isTS
) {
if (ctx.isTS
|| ctx.isUTS) { // fixed by xxxxxx
const def = (defaultExport ? `
...${normalScriptDefaultVar},` : ``) + (definedOptions ? `
...${definedOptions},` : "");
...
...
packages/uni-cli-shared/package.json
浏览文件 @
7f435663
...
...
@@ -35,6 +35,7 @@
"@vue/compiler-core"
:
"3.4.21"
,
"@vue/compiler-dom"
:
"3.4.21"
,
"@vue/compiler-sfc"
:
"3.4.21"
,
"@vue/compiler-ssr"
:
"3.4.21"
,
"@vue/server-renderer"
:
"3.4.21"
,
"@vue/shared"
:
"3.4.21"
,
"autoprefixer"
:
"^10.4.18"
,
...
...
@@ -61,6 +62,7 @@
"postcss-modules"
:
"^4.3.0"
,
"postcss-selector-parser"
:
"^6.0.6"
,
"resolve"
:
"^1.22.1"
,
"source-map-js"
:
"^1.0.2"
,
"tapable"
:
"^2.2.0"
,
"unplugin-auto-import"
:
"^0.16.7"
,
"xregexp"
:
"3.1.0"
...
...
packages/uni-cli-shared/src/vue/polyfill.ts
浏览文件 @
7f435663
...
...
@@ -20,14 +20,7 @@ function rewriteCompileScriptSetupLang() {
sfc
:
SFCDescriptor
,
options
:
SFCScriptCompileOptions
):
SFCScriptBlock
=>
{
const
originalScriptSetupLang
=
sfc
.
scriptSetup
?.
lang
if
(
originalScriptSetupLang
===
'
uts
'
)
{
sfc
.
scriptSetup
!
.
lang
=
'
ts
'
}
const
result
=
compileScript
(
sfc
,
options
)
if
(
originalScriptSetupLang
===
'
uts
'
)
{
sfc
.
scriptSetup
!
.
lang
=
'
uts
'
}
return
result
}
}
pnpm-lock.yaml
浏览文件 @
7f435663
...
...
@@ -613,6 +613,9 @@ importers:
'
@vue/compiler-sfc'
:
specifier
:
3.4.21
version
:
3.4.21
'
@vue/compiler-ssr'
:
specifier
:
3.4.21
version
:
3.4.21
'
@vue/server-renderer'
:
specifier
:
3.4.21
version
:
3.4.21(vue@3.4.21)
...
...
@@ -691,6 +694,9 @@ importers:
resolve
:
specifier
:
^1.22.1
version
:
1.22.8
source-map-js
:
specifier
:
^1.0.2
version
:
1.2.0
tapable
:
specifier
:
^2.2.0
version
:
2.2.1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录