bunchee
Advanced tools
Comparing version 3.7.2 to 3.8.0
@@ -12,2 +12,17 @@ #!/usr/bin/env node | ||
const logger = { | ||
log (...arg) { | ||
console.log(' ', ...arg); | ||
}, | ||
warn (...arg) { | ||
console.warn(' ⚠️', ...arg); | ||
}, | ||
error (...arg) { | ||
console.error(' ⨯', ...arg); | ||
}, | ||
info (...arg) { | ||
console.log(' ✓', ...arg); | ||
} | ||
}; | ||
function exit(err) { | ||
@@ -31,13 +46,2 @@ logger.error(err); | ||
} | ||
const logger = { | ||
log (arg) { | ||
console.log(arg); | ||
}, | ||
warn (arg) { | ||
console.log('\x1b[33m' + arg + '\x1b[0m'); | ||
}, | ||
error (arg) { | ||
console.error('\x1b[31m' + (arg instanceof Error ? arg.stack : arg) + '\x1b[0m'); | ||
} | ||
}; | ||
async function fileExists(filePath) { | ||
@@ -55,3 +59,3 @@ try { | ||
var version = "3.7.2"; | ||
var version = "3.8.0"; | ||
@@ -154,3 +158,3 @@ const helpMessage = ` | ||
runtime, | ||
external: ((_args_external = args.external) == null ? void 0 : _args_external.split(',')) || [], | ||
external: args.external === null ? null : ((_args_external = args.external) == null ? void 0 : _args_external.split(',')) || [], | ||
watch: !!watch, | ||
@@ -157,0 +161,0 @@ minify: !!minify, |
@@ -12,4 +12,3 @@ import { JscTarget } from '@swc/core'; | ||
sourcemap?: boolean; | ||
external?: string[]; | ||
noExternal?: boolean; | ||
external?: string[] | null; | ||
env?: string[]; | ||
@@ -16,0 +15,0 @@ dts?: boolean; |
@@ -26,3 +26,37 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
function chunkSizeCollector() { | ||
const availableExtensions = [ | ||
'js', | ||
'cjs', | ||
'mjs', | ||
'jsx', | ||
'ts', | ||
'tsx', | ||
'cts', | ||
'mts' | ||
]; | ||
const availableExportConventions = [ | ||
'react-server', | ||
'react-native', | ||
'edge-light' | ||
]; | ||
const availableESExtensionsRegex = /\.(m|c)?[jt]sx?$/; | ||
const dtsExtensionRegex = /\.d\.(m|c)?ts$/; | ||
const SRC = 'src'; | ||
const logger = { | ||
log (...arg) { | ||
console.log(' ', ...arg); | ||
}, | ||
warn (...arg) { | ||
console.warn(' ⚠️', ...arg); | ||
}, | ||
error (...arg) { | ||
console.error(' ⨯', ...arg); | ||
}, | ||
info (...arg) { | ||
console.log(' ✓', ...arg); | ||
} | ||
}; | ||
function createChunkSizeCollector() { | ||
const sizes = new Map(); | ||
@@ -64,22 +98,14 @@ function addSize(name, size) { | ||
} | ||
// This can also be passed down as stats from top level | ||
const sizeCollector = createChunkSizeCollector(); | ||
function logSizeStats() { | ||
const stats = sizeCollector.getSizeStats(); | ||
const maxLength = Math.max(...stats.map(([filename])=>filename.length)); | ||
stats.forEach(([filename, prettiedSize])=>{ | ||
const padding = ' '.repeat(maxLength - filename.length); | ||
const action = dtsExtensionRegex.test(filename) ? 'Typed' : 'Built'; | ||
logger.info(`${action} ${filename}${padding} - ${prettiedSize}`); | ||
}); | ||
} | ||
const availableExtensions = [ | ||
'js', | ||
'cjs', | ||
'mjs', | ||
'jsx', | ||
'ts', | ||
'tsx', | ||
'cts', | ||
'mts' | ||
]; | ||
const availableExportConventions = [ | ||
'react-server', | ||
'react-native', | ||
'edge-light' | ||
]; | ||
const availableESExtensionsRegex = /\.(m|c)?[jt]sx?$/; | ||
const dtsExtensionRegex = /\.d\.(m|c)?ts$/; | ||
const SRC = 'src'; | ||
function exit(err) { | ||
@@ -99,13 +125,2 @@ logger.error(err); | ||
} | ||
const logger = { | ||
log (arg) { | ||
console.log(arg); | ||
}, | ||
warn (arg) { | ||
console.log('\x1b[33m' + arg + '\x1b[0m'); | ||
}, | ||
error (arg) { | ||
console.error('\x1b[31m' + (arg instanceof Error ? arg.stack : arg) + '\x1b[0m'); | ||
} | ||
}; | ||
async function fileExists(filePath) { | ||
@@ -451,4 +466,2 @@ try { | ||
}; | ||
// This can also be passed down as stats from top level | ||
const sizeCollector = chunkSizeCollector(); | ||
function getBuildEnv(envs) { | ||
@@ -469,4 +482,5 @@ if (!envs.includes('NODE_ENV')) { | ||
var _tsCompilerOptions; | ||
const hasNoExternal = options.external === null; | ||
var _options_external; | ||
const externals = options.noExternal ? [] : [ | ||
const externals = hasNoExternal ? [] : [ | ||
pkg.peerDependencies, | ||
@@ -547,3 +561,3 @@ pkg.dependencies, | ||
commonjs__default.default({ | ||
include: /node_modules\// | ||
exclude: options.external || null | ||
}), | ||
@@ -766,12 +780,2 @@ json__default.default(), | ||
function logSizeStats() { | ||
const stats = sizeCollector.getSizeStats(); | ||
const maxLength = Math.max(...stats.map(([filename])=>filename.length)); | ||
stats.forEach(([filename, prettiedSize])=>{ | ||
const padding = ' '.repeat(maxLength - filename.length); | ||
const action = dtsExtensionRegex.test(filename) ? 'Typed' : 'Built'; | ||
logger.log(` ✓ ${action} ${filename}${padding} - ${prettiedSize}`); | ||
}); | ||
} | ||
// TODO: support nested wildcard exportsCondition (e.g. './foo/*') | ||
@@ -911,3 +915,3 @@ const getWildcardExports = (exportsCondition)=>{ | ||
if (result.length === 0) { | ||
console.warn('Warning: The "src" directory does not contain any entry files. ' + 'For proper usage, please refer to the following link: ' + 'https://github.com/huozhi/bunchee?tab=readme-ov-file#usage'); | ||
logger.warn('The "src" directory does not contain any entry files. ' + 'For proper usage, please refer to the following link: ' + 'https://github.com/huozhi/bunchee?tab=readme-ov-file#usage'); | ||
} | ||
@@ -914,0 +918,0 @@ logSizeStats(); |
{ | ||
"name": "bunchee", | ||
"version": "3.7.2", | ||
"version": "3.8.0", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -5,0 +5,0 @@ "bin": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53637
1167