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

chore: merge

...@@ -125,4 +125,5 @@ export interface AppJson { ...@@ -125,4 +125,5 @@ export interface AppJson {
lazyCodeLoading?: 'requiredComponents' | string lazyCodeLoading?: 'requiredComponents' | string
singlePage?: SinglePage singlePage?: SinglePage
restartStrategy?: RestartStrategy restartStrategy?: RestartStrategy
[name: string]: unknown
} }
...@@ -221,6 +221,11 @@ const options = { ...@@ -221,6 +221,11 @@ const options = {
darkmode: false, darkmode: false,
subpackages: true, subpackages: true,
plugins: true, plugins: true,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared';
return appJson;
},
}, },
project: { project: {
filename: projectConfigFilename, filename: projectConfigFilename,
......
...@@ -102,6 +102,11 @@ export const options: UniMiniProgramPluginOptions = { ...@@ -102,6 +102,11 @@ export const options: UniMiniProgramPluginOptions = {
darkmode: false, darkmode: false,
subpackages: true, subpackages: true,
plugins: true, plugins: true,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared'
return appJson
},
}, },
project: { project: {
filename: projectConfigFilename, filename: projectConfigFilename,
......
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
MiniProgramCompilerOptions, MiniProgramCompilerOptions,
initPostcssPlugin, initPostcssPlugin,
parseRpx2UnitOnce, parseRpx2UnitOnce,
AppJson,
} from '@dcloudio/uni-cli-shared' } from '@dcloudio/uni-cli-shared'
import type { import type {
SFCDescriptor, SFCDescriptor,
...@@ -58,6 +59,7 @@ export interface UniMiniProgramPluginOptions { ...@@ -58,6 +59,7 @@ export interface UniMiniProgramPluginOptions {
* 是否支持发行插件 * 是否支持发行插件
*/ */
plugins?: boolean plugins?: boolean
normalize?: (appJson: AppJson) => AppJson
} }
project?: { project?: {
filename: string filename: string
......
...@@ -69,7 +69,8 @@ export function uniPagesJsonPlugin( ...@@ -69,7 +69,8 @@ export function uniPagesJsonPlugin(
if (options.json?.formatAppJson) { if (options.json?.formatAppJson) {
options.json.formatAppJson(appJson, manifestJson, pageJsons) options.json.formatAppJson(appJson, manifestJson, pageJsons)
} }
addMiniProgramAppJson(appJson) const { normalize } = options.app
addMiniProgramAppJson(normalize ? normalize(appJson) : appJson)
Object.keys(pageJsons).forEach((name) => { Object.keys(pageJsons).forEach((name) => {
addMiniProgramPageJson(name, pageJsons[name]) addMiniProgramPageJson(name, pageJsons[name])
}) })
......
...@@ -1413,12 +1413,6 @@ function queueFlush() { ...@@ -1413,12 +1413,6 @@ function queueFlush() {
currentFlushPromise = resolvedPromise.then(flushJobs); currentFlushPromise = resolvedPromise.then(flushJobs);
} }
} }
function invalidateJob(job) {
const i = queue.indexOf(job);
if (i > flushIndex) {
queue.splice(i, 1);
}
}
function queueCb(cb, activeQueue, pendingQueue, index) { function queueCb(cb, activeQueue, pendingQueue, index) {
if (!isArray(cb)) { if (!isArray(cb)) {
if (!activeQueue || if (!activeQueue ||
...@@ -4430,6 +4424,12 @@ function unwrapper(target) { ...@@ -4430,6 +4424,12 @@ function unwrapper(target) {
} }
function defineAsyncComponent(source) { function defineAsyncComponent(source) {
console.error('defineAsyncComponent is unsupported'); console.error('defineAsyncComponent is unsupported');
}
function invalidateJob(job) {
const i = queue.indexOf(job);
if (i > -1) {
queue.splice(i, 1);
}
} }
// import deepCopy from './deepCopy' // import deepCopy from './deepCopy'
......
...@@ -1413,12 +1413,6 @@ function queueFlush() { ...@@ -1413,12 +1413,6 @@ function queueFlush() {
currentFlushPromise = resolvedPromise.then(flushJobs); currentFlushPromise = resolvedPromise.then(flushJobs);
} }
} }
function invalidateJob(job) {
const i = queue.indexOf(job);
if (i > flushIndex) {
queue.splice(i, 1);
}
}
function queueCb(cb, activeQueue, pendingQueue, index) { function queueCb(cb, activeQueue, pendingQueue, index) {
if (!isArray(cb)) { if (!isArray(cb)) {
if (!activeQueue || if (!activeQueue ||
...@@ -4430,6 +4424,12 @@ function unwrapper(target) { ...@@ -4430,6 +4424,12 @@ function unwrapper(target) {
} }
function defineAsyncComponent(source) { function defineAsyncComponent(source) {
console.error('defineAsyncComponent is unsupported'); console.error('defineAsyncComponent is unsupported');
}
function invalidateJob(job) {
const i = queue.indexOf(job);
if (i > -1) {
queue.splice(i, 1);
}
} }
// import deepCopy from './deepCopy' // import deepCopy from './deepCopy'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册