Comparing version 4.4.2 to 4.4.3
@@ -164,3 +164,3 @@ #!/usr/bin/env node | ||
function getTypings(pkg) { | ||
function getPackageTypings(pkg) { | ||
return pkg.types || pkg.typings; | ||
@@ -386,3 +386,3 @@ } | ||
module: pkg.module, | ||
types: getTypings(pkg) | ||
types: getPackageTypings(pkg) | ||
}, packageType); | ||
@@ -558,3 +558,3 @@ if (!isEsmPackage && ((_pathsMap_ = pathsMap['.']) == null ? void 0 : _pathsMap_['require'])) { | ||
var version = "4.4.2"; | ||
var version = "4.4.3"; | ||
@@ -894,3 +894,3 @@ function relativify(path) { | ||
if (watch) { | ||
logger.log(`Watching assets in ${cwd}...`); | ||
logger.log(`Watching project ${cwd}...`); | ||
return; | ||
@@ -897,0 +897,0 @@ } |
@@ -7,2 +7,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
var path = require('path'); | ||
var perf_hooks = require('perf_hooks'); | ||
var require$$0 = require('tty'); | ||
@@ -465,3 +466,3 @@ var module$1 = require('module'); | ||
function getTypings(pkg) { | ||
function getPackageTypings(pkg) { | ||
return pkg.types || pkg.typings; | ||
@@ -687,3 +688,3 @@ } | ||
module: pkg.module, | ||
types: getTypings(pkg) | ||
types: getPackageTypings(pkg) | ||
}, packageType); | ||
@@ -718,3 +719,3 @@ if (!isEsmPackage && ((_pathsMap_ = pathsMap['.']) == null ? void 0 : _pathsMap_['require'])) { | ||
if (typeof value === 'string') { | ||
const types = getTypings(value); | ||
const types = getPackageTypings(value); | ||
exportCondition = { | ||
@@ -795,3 +796,3 @@ [isEsmPackage ? 'import' : 'require']: value, | ||
// return { 'process.env.<key>': '<value>' } | ||
function getBuildEnv(envs, parsedExportCondition) { | ||
function getDefinedInlineVariables(envs, parsedExportCondition) { | ||
if (!envs.includes('NODE_ENV')) { | ||
@@ -816,2 +817,5 @@ envs.push('NODE_ENV'); | ||
} | ||
if (exportConditionNames.has('edge-light')) { | ||
envVars['EdgeRuntime'] = JSON.stringify('edge-runtime'); | ||
} | ||
return envVars; | ||
@@ -851,3 +855,3 @@ } | ||
} | ||
const envValues = getBuildEnv(bundleConfig.env || [], exportCondition); | ||
const inlineDefinedValues = getDefinedInlineVariables(bundleConfig.env || [], exportCondition); | ||
const { useTypeScript } = buildContext; | ||
@@ -904,3 +908,3 @@ const { runtime, target: jscTarget, minify: shouldMinify } = bundleConfig; | ||
} : undefined; | ||
const compositeOptions = tsCompilerOptions.composite && enableIncrementalWithoutBuildInfo ? { | ||
const compositeOptions = tsCompilerOptions.composite ? { | ||
composite: false | ||
@@ -944,3 +948,3 @@ } : undefined; | ||
replace__default.default({ | ||
values: envValues, | ||
values: inlineDefinedValues, | ||
preventAssignment: true | ||
@@ -1515,7 +1519,7 @@ }), | ||
if (!isFromCli) { | ||
await removeOutputDir(rollupConfig.output); | ||
await removeOutputDir(rollupConfig.output, cwd); | ||
} | ||
} | ||
if (options.watch) { | ||
return Promise.resolve(runWatch(rollupConfig)); | ||
return runWatch(rollupConfig); | ||
} | ||
@@ -1569,3 +1573,4 @@ return runBundle(rollupConfig); | ||
const typesJobs = hasTsConfig ? (await buildEntryConfig(options, buildContext, true)).map((rollupConfig)=>bundleOrWatch(rollupConfig)) : []; | ||
const result = await Promise.all(assetsJobs.concat(typesJobs)); | ||
const totalJobs = assetsJobs.concat(typesJobs); | ||
const result = await Promise.all(totalJobs); | ||
if (result.length === 0) { | ||
@@ -1576,2 +1581,4 @@ 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#usage'); | ||
logOutputState(sizeCollector); | ||
} else { | ||
logWatcherBuildTime(result); | ||
} | ||
@@ -1593,25 +1600,41 @@ return result; | ||
const watcher = rollup.watch(watchOptions); | ||
watcher.on('event', (event)=>{ | ||
switch(event.code){ | ||
case 'ERROR': | ||
{ | ||
logError(event.error); | ||
break; | ||
} | ||
case 'START': | ||
{ | ||
break; | ||
} | ||
case 'END': | ||
{ | ||
break; | ||
} | ||
default: | ||
return; | ||
return watcher; | ||
} | ||
function logWatcherBuildTime(result) { | ||
let watcherCounter = 0; | ||
let startTime = 0; | ||
result.map((watcher)=>{ | ||
function start() { | ||
if (startTime === 0) startTime = perf_hooks.performance.now(); | ||
} | ||
function end() { | ||
watcherCounter++; | ||
if (watcherCounter === result.length) { | ||
logger.info(`Build in ${(perf_hooks.performance.now() - startTime).toFixed(2)}ms`); | ||
} | ||
} | ||
watcher.on('event', (event)=>{ | ||
switch(event.code){ | ||
case 'ERROR': | ||
{ | ||
logError(event.error); | ||
break; | ||
} | ||
case 'START': | ||
{ | ||
start(); | ||
break; | ||
} | ||
case 'END': | ||
{ | ||
end(); | ||
break; | ||
} | ||
} | ||
}); | ||
}); | ||
return watcher; | ||
} | ||
async function removeOutputDir(output) { | ||
if (output.dir) await removeDir(output.dir); | ||
async function removeOutputDir(output, cwd) { | ||
const dir = output.dir; | ||
if (dir && dir !== cwd) await removeDir(dir); | ||
} | ||
@@ -1618,0 +1641,0 @@ function runBundle({ input, output }) { |
{ | ||
"name": "bunchee", | ||
"version": "4.4.2", | ||
"version": "4.4.3", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -57,3 +57,3 @@ "bin": "./dist/bin/cli.js", | ||
"@rollup/pluginutils": "^5.1.0", | ||
"@swc/core": "^1.3.102", | ||
"@swc/core": "^1.3.106", | ||
"@swc/helpers": "^0.5.3", | ||
@@ -83,3 +83,3 @@ "arg": "^5.0.2", | ||
"@huozhi/testing-package": "1.0.0", | ||
"@swc/jest": "^0.2.29", | ||
"@swc/jest": "^0.2.31", | ||
"@swc/types": "^0.1.5", | ||
@@ -86,0 +86,0 @@ "@types/clean-css": "^4.2.11", |
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
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
117554
2558
15
Updated@swc/core@^1.3.106