bunchee 5.6.0 → 5.6.1
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.
- package/dist/bin/cli.js +1 -1
- package/dist/index.js +72 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -142,6 +142,67 @@ const runtimeExportConventions = new Set([
|
|
|
142
142
|
// Browser only
|
|
143
143
|
'browser'
|
|
144
144
|
]);
|
|
145
|
+
const runtimeExportConventionsFallback = new Map([
|
|
146
|
+
// ESM only runtime
|
|
147
|
+
[
|
|
148
|
+
'workerd',
|
|
149
|
+
[
|
|
150
|
+
'import',
|
|
151
|
+
'default'
|
|
152
|
+
]
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
'edge-light',
|
|
156
|
+
[
|
|
157
|
+
'import',
|
|
158
|
+
'default'
|
|
159
|
+
]
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
'browser',
|
|
163
|
+
[
|
|
164
|
+
'import',
|
|
165
|
+
'default'
|
|
166
|
+
]
|
|
167
|
+
],
|
|
168
|
+
// it could be CJS or ESM
|
|
169
|
+
[
|
|
170
|
+
'electron',
|
|
171
|
+
[
|
|
172
|
+
'default'
|
|
173
|
+
]
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
'react-server',
|
|
177
|
+
[
|
|
178
|
+
'default'
|
|
179
|
+
]
|
|
180
|
+
],
|
|
181
|
+
[
|
|
182
|
+
'react-native',
|
|
183
|
+
[
|
|
184
|
+
'default'
|
|
185
|
+
]
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
'node',
|
|
189
|
+
[
|
|
190
|
+
'default'
|
|
191
|
+
]
|
|
192
|
+
],
|
|
193
|
+
[
|
|
194
|
+
'deno',
|
|
195
|
+
[
|
|
196
|
+
'default'
|
|
197
|
+
]
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
'bun',
|
|
201
|
+
[
|
|
202
|
+
'default'
|
|
203
|
+
]
|
|
204
|
+
]
|
|
205
|
+
]);
|
|
145
206
|
const optimizeConventions = new Set([
|
|
146
207
|
'development',
|
|
147
208
|
'production'
|
|
@@ -1153,7 +1214,17 @@ function findJsBundlePathCallback({ format, bundlePath, conditionNames }, specia
|
|
|
1153
1214
|
const hasFormatCond = conditionNames.has('import') || conditionNames.has('require');
|
|
1154
1215
|
const isMatchedFormat = hasFormatCond ? conditionNames.has(formatCond) : true;
|
|
1155
1216
|
const isMatchedConditionWithFormat = conditionNames.has(specialCondition) || !conditionNames.has('default') && hasNoSpecialCondition(conditionNames);
|
|
1156
|
-
|
|
1217
|
+
const match = isMatchedConditionWithFormat && !isTypesCondName && hasBundle && isMatchedFormat;
|
|
1218
|
+
if (!match) {
|
|
1219
|
+
const fallback = runtimeExportConventionsFallback.get(specialCondition);
|
|
1220
|
+
if (!fallback) {
|
|
1221
|
+
return false;
|
|
1222
|
+
} else {
|
|
1223
|
+
return fallback.some((name)=>conditionNames.has(name));
|
|
1224
|
+
}
|
|
1225
|
+
} else {
|
|
1226
|
+
return match;
|
|
1227
|
+
}
|
|
1157
1228
|
}
|
|
1158
1229
|
function findTypesFileCallback({ format, bundlePath, conditionNames }) {
|
|
1159
1230
|
const hasCondition = bundlePath != null;
|