Skip to content
Snippets Groups Projects
Unverified Commit e075643b authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

chore: bump `bunchee` (#1725)

parent f71b143c
No related branches found
No related tags found
No related merge requests found
Showing
with 19 additions and 153 deletions
......@@ -30,7 +30,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -30,7 +30,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@datastax/astra-db-ts": "^1.4.1",
......
......@@ -59,7 +59,7 @@
"devDependencies": {
"@llamaindex/openai": "workspace:*",
"@types/node": "^22.9.0",
"bunchee": "6.3.4",
"bunchee": "6.4.0",
"dotenv": "^16.4.7",
"vitest": "^2.1.5"
},
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -40,7 +40,7 @@
},
"devDependencies": {
"@llamaindex/openai": "workspace:*",
"bunchee": "6.3.4",
"bunchee": "6.4.0",
"vitest": "^2.1.5"
},
"dependencies": {
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -40,7 +40,7 @@
"devDependencies": {
"@types/pg": "^8.11.8",
"@vercel/postgres": "^0.10.0",
"bunchee": "6.3.4",
"bunchee": "6.4.0",
"pg": "^8.12.0",
"pgvector": "0.2.0",
"postgres": "^3.4.4"
......
......@@ -40,7 +40,7 @@
},
"devDependencies": {
"@llamaindex/openai": "workspace:*",
"bunchee": "6.3.4",
"bunchee": "6.4.0",
"vitest": "^2.1.5"
},
"dependencies": {
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -30,7 +30,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/env": "workspace:*",
......
......@@ -38,7 +38,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/core": "workspace:*",
......
......@@ -30,7 +30,7 @@
"dev": "bunchee --watch"
},
"devDependencies": {
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"dependencies": {
"@llamaindex/openai": "workspace:*"
......
......@@ -212,7 +212,7 @@
"@llamaindex/core": "workspace:*",
"@llamaindex/env": "workspace:*",
"@types/node": "^22.9.0",
"bunchee": "6.3.4",
"bunchee": "6.4.0",
"p-limit": "^6.1.0",
"string-strip-html": "^13.4.8"
},
......
......@@ -85,7 +85,7 @@
"@llamaindex/env": "workspace:*",
"@llamaindex/core": "workspace:*",
"@types/node": "^22.9.0",
"bunchee": "6.3.4"
"bunchee": "6.4.0"
},
"peerDependencies": {
"@llamaindex/env": "workspace:*",
......
diff --git a/dist/bin/cli.js b/dist/bin/cli.js
old mode 100755
new mode 100644
index e74abd6fc8bd1853b82e9b84691d433a5152f6f5..d6c4f2a94346c29c0e65708e91cbfba1bb424998
--- a/dist/bin/cli.js
+++ b/dist/bin/cli.js
@@ -1082,7 +1082,7 @@ Options:
--runtime <runtime> build runtime (nodejs, browser). default: browser
--env <env> inlined process env variables, separate by comma. default: NODE_ENV
--cwd <cwd> specify current working directory
- --sourcemap enable sourcemap generation, default: false
+ --sourcemap enable sourcemap generation
--no-dts do not generate types, default: undefined
--tsconfig path to tsconfig file, default: tsconfig.json
--dts-bundle bundle type declaration files, default: false
@@ -1141,7 +1141,7 @@ async function parseCliArgs(argv) {
description: 'js features target: swc target es versions'
}).option('sourcemap', {
type: 'boolean',
- default: false,
+ default: undefined,
description: 'enable sourcemap generation'
}).option('env', {
type: 'string',
@@ -1196,6 +1196,10 @@ async function parseCliArgs(argv) {
env: args['env'],
tsconfig: args['tsconfig']
};
+ // When minify is enabled, sourcemap should be enabled by default, unless explicitly opted out
+ if (parsedArgs.minify && typeof args['sourcemap'] === 'undefined') {
+ parsedArgs.sourcemap = true;
+ }
return parsedArgs;
}
async function run(args) {
diff --git a/dist/index.js b/dist/index.js
index 66c0eba9bbbb68ec7308e7a7fe528c6a764e09e7..c1301712afee9c637013756b151c1c07b0f066c1 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1308,7 +1308,7 @@ function hasNoSpecialCondition(conditionNames) {
...conditionNames
].every((name)=>!specialExportConventions.has(name));
}
-function findJsBundlePathCallback({ format, bundlePath, conditionNames }, specialCondition) {
+function findJsBundlePathCallback({ format, bundlePath, conditionNames }, specialCondition, defaultFormat) {
const hasBundle = bundlePath != null;
const formatCond = format === 'cjs' ? 'require' : 'import';
const isTypesCondName = conditionNames.has('types');
@@ -1317,8 +1317,9 @@ function findJsBundlePathCallback({ format, bundlePath, conditionNames }, specia
// if there's condition existed, check if the format condition is matched;
// if there's no condition, just return true, assuming format doesn't matter;
const isMatchedFormat = hasFormatCond ? conditionNames.has(formatCond) : true;
+ const isDefaultMatch = conditionNames.size === 1 && conditionNames.has('default') ? defaultFormat === format : true;
const isMatchedConditionWithFormat = conditionNames.has(specialCondition) || !conditionNames.has('default') && hasNoSpecialCondition(conditionNames);
- const match = isMatchedConditionWithFormat && !isTypesCondName && hasBundle && isMatchedFormat;
+ const match = isMatchedConditionWithFormat && !isTypesCondName && hasBundle && isMatchedFormat && isDefaultMatch;
if (!match) {
const fallback = runtimeExportConventionsFallback.get(specialCondition);
if (!fallback) {
@@ -1341,17 +1342,37 @@ function findTypesFileCallback({ format, bundlePath, conditionNames }) {
return isTypesCondName && hasCondition && (formatCond ? conditionNames.has(formatCond) : true);
}
// Alias entry key to dist bundle path
-function aliasEntries({ entry: sourceFilePath, conditionNames, entries, format, dts, cwd }) {
+function aliasEntries({ entry: sourceFilePath, conditionNames, entries, defaultFormat, format, dts, cwd }) {
// <imported source file path>: <relative path to source's bundle>
const sourceToRelativeBundleMap = new Map();
const specialCondition = getSpecialExportTypeFromConditionNames(conditionNames);
for (const [, exportCondition] of Object.entries(entries)){
const exportDistMaps = exportCondition.export;
- const exportMapEntries = Object.entries(exportDistMaps).map(([composedKey, bundlePath])=>({
- conditionNames: new Set(composedKey.split('.')),
+ const exportMapEntries = Object.entries(exportDistMaps).map(([composedKey, bundlePath])=>{
+ const conditionNames = new Set(composedKey.split('.'));
+ return {
+ conditionNames,
bundlePath,
- format
- }));
+ format,
+ isFallback: conditionNames.size === 1 && conditionNames.has('default')
+ };
+ }).sort((a, b)=>{
+ // Always put special condition after the general condition (default, cjs, esm)
+ if (a.conditionNames.has(specialCondition)) {
+ return -1;
+ } else if (b.conditionNames.has(specialCondition)) {
+ return 1;
+ }
+ // Always put default condition at the end.
+ // In the case of cjs resolves default(esm)
+ if (a.isFallback) {
+ return 1;
+ }
+ if (b.isFallback) {
+ return -1;
+ }
+ return 0;
+ });
let matchedBundlePath;
if (dts) {
var _exportMapEntries_find;
@@ -1369,19 +1390,10 @@ function aliasEntries({ entry: sourceFilePath, conditionNames, entries, format,
})) == null ? undefined : _exportMapEntries_find1.bundlePath;
}
} else {
- var _exportMapEntries_sort_find;
- matchedBundlePath = (_exportMapEntries_sort_find = exportMapEntries.sort(// always put special condition after the general condition (default, cjs, esm)
- (a, b)=>{
- if (a.conditionNames.has(specialCondition)) {
- return -1;
- }
- if (b.conditionNames.has(specialCondition)) {
- return 1;
- }
- return 0;
- }).find((item)=>{
- return findJsBundlePathCallback(item, specialCondition);
- })) == null ? undefined : _exportMapEntries_sort_find.bundlePath;
+ var _exportMapEntries_find2;
+ matchedBundlePath = (_exportMapEntries_find2 = exportMapEntries.find((item)=>{
+ return findJsBundlePathCallback(item, specialCondition, defaultFormat);
+ })) == null ? undefined : _exportMapEntries_find2.bundlePath;
}
if (matchedBundlePath) {
if (!sourceToRelativeBundleMap.has(exportCondition.source)) sourceToRelativeBundleMap.set(exportCondition.source, matchedBundlePath);
@@ -1546,6 +1558,7 @@ async function buildInputConfig(entry, bundleConfig, exportCondition, buildConte
entry,
entries,
format: aliasFormat,
+ defaultFormat: isESModulePackage(pkg.type) ? 'esm' : 'cjs',
conditionNames: new Set(currentConditionNames.split('.')),
dts,
cwd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment