From 462b5c39e39838e8e965b2ca4ab688dd7ba930d7 Mon Sep 17 00:00:00 2001 From: jardenliu Date: Sat, 12 Feb 2022 23:38:52 +0800 Subject: [PATCH] docs: update docs --- docs/zh-cn/api.md | 4 ++-- docs/zh-cn/plugins.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/zh-cn/api.md b/docs/zh-cn/api.md index 405783337..bf74110ca 100644 --- a/docs/zh-cn/api.md +++ b/docs/zh-cn/api.md @@ -47,7 +47,7 @@ start (options?: { // 可选,传递给loader的配置项 options?: unknown, // 必填,js处理函数,必须返回code值 - loader?: (code: string, url: string, options: unknown) => string + loader?: (code: string, url: string, options: unknown, info: sourceScriptInfo) => string }> // 子应用插件 @@ -61,7 +61,7 @@ start (options?: { // 可选,传递给loader的配置项 options?: unknown, // 必填,js处理函数,必须返回code值 - loader?: (code: string, url: string, options: unknown) => string + loader?: (code: string, url: string, options: unknown, info: sourceScriptInfo) => string }> } }, diff --git a/docs/zh-cn/plugins.md b/docs/zh-cn/plugins.md index 607519e80..4852bc186 100644 --- a/docs/zh-cn/plugins.md +++ b/docs/zh-cn/plugins.md @@ -20,7 +20,7 @@ microApp.start({ // 可选,传递给loader的配置项 options?: any, // 必填,js处理函数,必须返回code值 - loader?: (code: string, url: string, options: any) => code + loader?: (code: string, url: string, options: any, info: sourceScriptInfo) => code }> // 子应用插件 @@ -34,7 +34,7 @@ microApp.start({ // 可选,传递给loader的配置项 options?: any, // 必填,js处理函数,必须返回code值 - loader?: (code: string, url: string, options: any) => code + loader?: (code: string, url: string, options: any, info: sourceScriptInfo) => code }> } } @@ -52,7 +52,7 @@ microApp.start({ scopeProperties: ['key', 'key', ...], // 可选 escapeProperties: ['key', 'key', ...], // 可选 options: 配置项, // 可选 - loader(code, url, options) { // 必填 + loader(code, url, options, info) { // 必填 console.log('全局插件') return code } @@ -60,7 +60,7 @@ microApp.start({ ], modules: { 'appName1': [{ - loader(code, url, options) { + loader(code, url, options, info) { if (url === 'xxx.js') { code = code.replace('var abc =', 'window.abc =') } @@ -71,7 +71,7 @@ microApp.start({ scopeProperties: ['key', 'key', ...], // 可选 escapeProperties: ['key', 'key', ...], // 可选 options: 配置项, // 可选 - loader(code, url, options) { // 必填 + loader(code, url, options, info) { // 必填 console.log('只适用于appName2的插件') return code }