| 138 | } |
| 139 | |
| 140 | function resolveConfigPath(config) { |
| 141 | if (BUILT_IN_CONFIG_NAMES.has(config) || OPTIONAL_JIEBA_CONFIGS.has(config) || path.isAbsolute(config)) { |
| 142 | return config; |
| 143 | } |
| 144 | |
| 145 | if (!config.endsWith('.json') && BUILT_IN_CONFIG_STEMS.has(config)) { |
| 146 | return config + '.json'; |
| 147 | } |
| 148 | |
| 149 | if (!config.endsWith('.json') && OPTIONAL_JIEBA_CONFIG_STEMS.has(config)) { |
| 150 | return config + '.json'; |
| 151 | } |
| 152 | |
| 153 | return path.resolve(process.cwd(), config); |
| 154 | } |
| 155 | |
| 156 | function createConverterStream(converter) { |
| 157 | const nativeStream = converter._createConverterStream(); |