From 4691c652ec3a3fef05461e805b6d51cf158848be Mon Sep 17 00:00:00 2001 From: Kuitos Date: Thu, 25 Nov 2021 11:43:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=20add=20warning=20for=20deprecated?= =?UTF-8?q?=20apis=20(#1836)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🗑 add warning for deprecated apis * 💚 remove 12.x version in ci for compatible --- .github/workflows/ci.yml | 2 +- src/globalState.ts | 4 ++++ src/loader.ts | 11 +++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68ced4f..4402790 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [12.x, 14.x] + node-version: [14.x, 16.x] steps: - uses: actions/checkout@v2 diff --git a/src/globalState.ts b/src/globalState.ts index 6e47cf3..d2709cd 100644 --- a/src/globalState.ts +++ b/src/globalState.ts @@ -20,6 +20,10 @@ function emitGlobal(state: Record, prevState: Record) } export function initGlobalState(state: Record = {}) { + if (process.env.NODE_ENV === 'development') { + console.warn(`[qiankun] globalState tools will be removed in 3.0, pls don't use it!`); + } + if (state === globalState) { console.warn('[qiankun] state has not changed!'); } else { diff --git a/src/loader.ts b/src/loader.ts index 828c7f0..0363017 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -156,8 +156,8 @@ function getRender(appName: string, appContent: string, legacyRender?: HTMLConte const render: ElementRender = ({ element, loading, container }, phase) => { if (legacyRender) { if (process.env.NODE_ENV === 'development') { - console.warn( - '[qiankun] Custom rendering function is deprecated, you can use the container element setting instead!', + console.error( + '[qiankun] Custom rendering function is deprecated and will be removed in 3.0, you can use the container element setting instead!', ); } @@ -275,6 +275,13 @@ export async function loadApp( const appContent = getDefaultTplWrapper(appInstanceId, appName)(template); const strictStyleIsolation = typeof sandbox === 'object' && !!sandbox.strictStyleIsolation; + + if (process.env.NODE_ENV === 'development' && strictStyleIsolation) { + console.warn( + "[qiankun] strictStyleIsolation configuration will be removed in 3.0, pls don't depend on it or use experimentalStyleIsolation instead!", + ); + } + const scopedCSS = isEnableScopedCSS(sandbox); let initialAppWrapperElement: HTMLElement | null = createElement( appContent,