Comparing version 3.0.0-beta.10 to 3.0.0-beta.11
#!/usr/bin/env node | ||
var path = require('path'); | ||
var arg = require('arg'); | ||
require('fs'); | ||
var fs = require('fs'); | ||
@@ -11,2 +11,12 @@ function exit(err) { | ||
const formatDuration = (duration)=>duration >= 1000 ? `${duration / 1000}s` : `${duration}ms`; | ||
function getPackageMeta(cwd) { | ||
const pkgFilePath = path.resolve(cwd, 'package.json'); | ||
let targetPackageJson = {}; | ||
try { | ||
targetPackageJson = JSON.parse(fs.readFileSync(pkgFilePath, { | ||
encoding: 'utf-8' | ||
})); | ||
} catch (_) {} | ||
return targetPackageJson; | ||
} | ||
const logger = { | ||
@@ -24,3 +34,3 @@ log (arg) { | ||
var version = "3.0.0-beta.10"; | ||
var version = "3.0.0-beta.11"; | ||
@@ -76,2 +86,20 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
} | ||
function lintPackage(cwd) { | ||
return _lintPackage.apply(this, arguments); | ||
} | ||
function _lintPackage() { | ||
_lintPackage = _asyncToGenerator(function*(cwd) { | ||
const { publint } = yield import('publint'); | ||
const { printMessage } = yield import('publint/utils'); | ||
const messages = yield publint({ | ||
pkgDir: cwd, | ||
level: 'error' | ||
}); | ||
const pkg = getPackageMeta(cwd); | ||
for (const message of messages){ | ||
console.log(printMessage(message, pkg)); | ||
} | ||
}); | ||
return _lintPackage.apply(this, arguments); | ||
} | ||
function parseCliArgs(argv) { | ||
@@ -150,3 +178,3 @@ let args; | ||
const entry = source ? path.resolve(cwd, source) : ''; | ||
const { bundle } = require('./lib'); | ||
const bundle = require('./lib').bundle; | ||
let timeStart = Date.now(); | ||
@@ -165,5 +193,10 @@ let timeEnd; | ||
const duration = timeEnd - timeStart; | ||
if (!watch) { | ||
logger.log(`✨ Finished in ${formatDuration(duration)}`); | ||
// watching mode | ||
if (watch) { | ||
logger.log(`🔍 Watching assets in ${cwd}...`); | ||
return; | ||
} | ||
// build mode | ||
logger.log(`✨ Finished in ${formatDuration(duration)}`); | ||
yield lintPackage(cwd); | ||
}); | ||
@@ -170,0 +203,0 @@ return _run.apply(this, arguments); |
@@ -472,2 +472,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
// Map './lite' -> './lite.[ext]' | ||
// Return undefined if no match or if it's package.json exports | ||
function getSourcePathFromExportPath(cwd, exportPath) { | ||
@@ -513,3 +514,5 @@ const exts = [ | ||
if (isSingleEntry) { | ||
entryPath = getSourcePathFromExportPath(config.rootDir, '.'); | ||
// Use specified string file path if possible, then fallback to the default behavior entry picking logic | ||
// e.g. "exports": "./dist/index.js" -> use "./index.<ext>" as entry | ||
entryPath = entryPath || getSourcePathFromExportPath(config.rootDir, '.') || ''; | ||
} | ||
@@ -516,0 +519,0 @@ function buildEntryConfig(packageExports, dtsOnly) { |
{ | ||
"name": "bunchee", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -34,2 +34,5 @@ "bin": { | ||
], | ||
"engines": { | ||
"node": ">= 16" | ||
}, | ||
"author": "huozhi (github.com/huozhi)", | ||
@@ -47,2 +50,3 @@ "repository": { | ||
"arg": "5.0.2", | ||
"publint": "0.1.11", | ||
"rollup": "3.15.0", | ||
@@ -67,3 +71,3 @@ "rollup-plugin-dts": "5.1.1", | ||
"react": "18.2.0", | ||
"tsx": "3.12.3", | ||
"tsx": "3.12.6", | ||
"typescript": "4.9.5" | ||
@@ -70,0 +74,0 @@ }, |
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
37504
880
12
+ Addedpublint@0.1.11
+ Addedignore-walk@5.0.1(transitive)
+ Addedmri@1.2.0(transitive)
+ Addednpm-bundled@2.0.1(transitive)
+ Addednpm-normalize-package-bin@2.0.0(transitive)
+ Addednpm-packlist@5.1.3(transitive)
+ Addedpublint@0.1.11(transitive)
+ Addedsade@1.8.1(transitive)