expo-gaode-map 2.1.0-beta.0 → 2.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* 可选模块名称常量
|
|
6
6
|
*/
|
|
7
7
|
export declare const OptionalModules: {
|
|
8
|
-
readonly SEARCH: "
|
|
9
|
-
readonly NAVIGATION: "
|
|
10
|
-
readonly ROUTE: "
|
|
11
|
-
readonly GEOCODER: "
|
|
8
|
+
readonly SEARCH: "expo-gaode-map-search";
|
|
9
|
+
readonly NAVIGATION: "expo-gaode-map-navigation";
|
|
10
|
+
readonly ROUTE: "expo-gaode-map-route";
|
|
11
|
+
readonly GEOCODER: "expo-gaode-map-geocoder";
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* 延迟加载可选模块
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* 可选模块名称常量
|
|
6
6
|
*/
|
|
7
7
|
export const OptionalModules = {
|
|
8
|
-
SEARCH: '
|
|
9
|
-
NAVIGATION: '
|
|
10
|
-
ROUTE: '
|
|
11
|
-
GEOCODER: '
|
|
8
|
+
SEARCH: 'expo-gaode-map-search',
|
|
9
|
+
NAVIGATION: 'expo-gaode-map-navigation',
|
|
10
|
+
ROUTE: 'expo-gaode-map-route',
|
|
11
|
+
GEOCODER: 'expo-gaode-map-geocoder',
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* 延迟加载可选模块
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleLoader.js","sourceRoot":"","sources":["../../src/utils/ModuleLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"ModuleLoader.js","sourceRoot":"","sources":["../../src/utils/ModuleLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;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AAC;YACjB,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,EAAE,CAAC;YACpB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;gBAChD,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * 模块检测器 - 用于检测可选模块是否已安装\n */\n\n/**\n * 可选模块名称常量\n */\nexport const OptionalModules = {\n SEARCH: 'expo-gaode-map-search',\n NAVIGATION: 'expo-gaode-map-navigation',\n ROUTE: 'expo-gaode-map-route',\n GEOCODER: 'expo-gaode-map-geocoder',\n} as const;\n\n/**\n * 延迟加载可选模块\n * 使用示例:\n * \n * @example\n * ```typescript\n * import { OptionalModules, lazyLoad } from 'expo-gaode-map';\n * \n * let SearchModule = null;\n * \n * function loadSearch() {\n * if (SearchModule == null) {\n * try {\n * SearchModule = require('expo-gaode-map-search');\n * } catch (error) {\n * console.warn('搜索模块未安装');\n * return null;\n * }\n * }\n * return SearchModule;\n * }\n * \n * // 使用\n * const search = loadSearch();\n * if (search) {\n * const results = await search.searchPOI({ keyword: '餐厅' });\n * }\n * ```\n */\n\n/**\n * 检查必需模块,如果未安装则抛出错误\n * @param moduleName 模块名称\n * @param featureName 功能名称(用于错误提示)\n */\nexport function requireModule(moduleName: string, featureName: string): void {\n console.warn(\n `[expo-gaode-map] 使用 ${featureName} 需要安装 ${moduleName}。\\n` +\n `请运行: npm install ${moduleName}\\n` +\n `然后使用 try-catch 包裹 require('${moduleName}') 来加载`\n );\n}\n\n/**\n * 获取已安装的可选模块列表\n * 注意: 此函数无法在运行时准确检测,仅作为文档说明\n */\nexport function getInstalledModules(): string[] {\n console.warn(\n '[expo-gaode-map] getInstalledModules() 无法在运行时检测。\\n' +\n '请在编译时检查 package.json 中安装的模块'\n );\n return [];\n}\n\n/**\n * 打印已安装模块信息(用于调试)\n */\nexport function printModuleInfo(): void {\n console.log('[expo-gaode-map] 核心模块: 已加载');\n console.log('[expo-gaode-map] 可选模块检测:');\n console.log(' - 使用 try-catch 包裹 require() 来检测可选模块');\n console.log(' - 可用的可选模块:');\n Object.entries(OptionalModules).forEach(([key, value]) => {\n console.log(` - ${key}: ${value}`);\n });\n}\n\n/**\n * 创建延迟加载器\n * \n * @example\n * ```typescript\n * import { createLazyLoader } from 'expo-gaode-map';\n * \n * const loadSearch = createLazyLoader(() => require('expo-gaode-map-search'));\n * \n * // 使用时\n * const SearchModule = loadSearch();\n * if (SearchModule) {\n * const results = await SearchModule.searchPOI({ keyword: '餐厅' });\n * }\n * ```\n */\nexport function createLazyLoader<T>(loader: () => T): () => T | null {\n let cached: T | null = null;\n let attempted = false;\n\n return () => {\n if (!attempted) {\n attempted = true;\n try {\n cached = loader();\n } catch (error) {\n console.warn('[expo-gaode-map] 模块加载失败:', error);\n cached = null;\n }\n }\n return cached;\n };\n}"]}
|
package/package.json
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* 可选模块名称常量
|
|
7
7
|
*/
|
|
8
8
|
export const OptionalModules = {
|
|
9
|
-
SEARCH: '
|
|
10
|
-
NAVIGATION: '
|
|
11
|
-
ROUTE: '
|
|
12
|
-
GEOCODER: '
|
|
9
|
+
SEARCH: 'expo-gaode-map-search',
|
|
10
|
+
NAVIGATION: 'expo-gaode-map-navigation',
|
|
11
|
+
ROUTE: 'expo-gaode-map-route',
|
|
12
|
+
GEOCODER: 'expo-gaode-map-geocoder',
|
|
13
13
|
} as const;
|
|
14
14
|
|
|
15
15
|
/**
|