-
-
Notifications
You must be signed in to change notification settings - Fork 336
fix(resolve): Export generateConfig to fix pnpm module resolution #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,20 @@ import type { PickerRef, SharedTimeProps } from './interface'; | |
| import RangePicker, { type RangePickerProps } from './PickerInput/RangePicker'; | ||
| import Picker, { type BasePickerProps, type PickerProps } from './PickerInput/SinglePicker'; | ||
| import PickerPanel, { type BasePickerPanelProps, type PickerPanelProps } from './PickerPanel'; | ||
| import momentGenerateConfig from './generate/moment'; | ||
| import dayjsGenerateConfig from './generate/dayjs'; | ||
| import dateFnsGenerateConfig from './generate/dateFns'; | ||
| import luxonGenerateConfig from './generate/luxon'; | ||
|
|
||
| export { Picker, RangePicker, PickerPanel }; | ||
| export { | ||
| Picker, | ||
| RangePicker, | ||
| PickerPanel, | ||
| momentGenerateConfig, | ||
| dayjsGenerateConfig, | ||
| dateFnsGenerateConfig, | ||
| luxonGenerateConfig, | ||
| }; | ||
|
Comment on lines
36
to
44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
36
to
44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain导出结构正确,解决了 pnpm 深层导入问题。考虑同时导出 GenerateConfig 类型。 这些导出正确地解决了 issue #949 中提到的 pnpm 模块解析问题。将 generateConfig 助手函数作为公共 API 的一部分导出,使用户可以使用稳定的顶级导入: 但是,TypeScript 用户可能还需要 运行以下脚本检查 GenerateConfig 类型是否已导出: 🏁 Script executed: #!/bin/bash
# 描述:检查 GenerateConfig 类型定义和导出
# 查找 GenerateConfig 类型定义
echo "=== 查找 GenerateConfig 类型定义 ==="
rg -n "type\s+GenerateConfig|interface\s+GenerateConfig" --type ts --type tsx
# 检查当前的类型导出
echo -e "\n=== 检查 src/index.tsx 中的类型导出 ==="
cat src/index.tsx | sed -n '/export type {/,/};/p'
# 搜索 GenerateConfig 在导出语句中的使用
echo -e "\n=== 检查 GenerateConfig 是否已被导出 ==="
rg -n "export.*GenerateConfig" src/index.tsxLength of output: 272 🏁 Script executed: #!/bin/bash
# 重新搜索 GenerateConfig 类型定义,使用正确的文件类型
echo "=== 搜索 GenerateConfig 类型定义 ==="
rg -n "type\s+GenerateConfig|interface\s+GenerateConfig" --type typescript
echo -e "\n=== 检查 GenerateConfig 在源代码中的使用 ==="
rg -n "GenerateConfig" --type typescript -B2 -A2
echo -e "\n=== 查看 src/index.tsx 的完整导出 ==="
cat src/index.tsx | tail -20Length of output: 486 🏁 Script executed: #!/bin/bash
# 搜索 GenerateConfig 类型定义,不使用 --type 标志
echo "=== 查找包含 GenerateConfig 的文件 ==="
fd -e ts -e tsx | head -30 | xargs grep -l "GenerateConfig" 2>/dev/null | head -10
echo -e "\n=== 在找到的文件中搜索 GenerateConfig 定义 ==="
fd -e ts -e tsx -x grep -n "type.*GenerateConfig\|interface.*GenerateConfig\|export.*GenerateConfig" {} \; 2>/dev/null | head -20
echo -e "\n=== 查找 generateConfig 函数的定义 ==="
fd -e ts -e tsx -x grep -n "GenerateConfig\|generateConfig" {} \; 2>/dev/null | grep -E "(export|function|const).*[Gg]enerate" | head -20Length of output: 2789 🏁 Script executed: #!/bin/bash
# 查找 GenerateConfig 的导出位置
echo "=== 查找 GenerateConfig 的定义文件 ==="
find src -name "*.ts" -o -name "*.tsx" | xargs grep -l "export type GenerateConfig" 2>/dev/null
echo -e "\n=== 查看 GenerateConfig 的完整定义 ==="
find src -name "*.ts" -o -name "*.tsx" | xargs grep -A5 "export type GenerateConfig" 2>/dev/null | head -20Length of output: 442 导出结构正确,建议添加 GenerateConfig 类型导出。 这些导出正确地解决了 issue #949 中提到的 pnpm 模块解析问题。将 generateConfig 助手函数作为公共 API 的一部分导出,使用户可以使用稳定的顶级导入: 验证确认 🤖 Prompt for AI Agents |
||
| export type { | ||
| RangePickerProps, | ||
| PickerProps, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve modularity and keep the main entry point (
src/index.tsx) cleaner, consider creating a barrel file (src/generate/index.ts) to aggregate allgenerateConfigexports. This centralizes the generator configurations and simplifies imports.You would first create
src/generate/index.tswith the following content:Then, you can simplify the imports in this file as suggested.