bunchee
Advanced tools
Comparing version 3.9.0 to 3.9.1
@@ -57,3 +57,3 @@ #!/usr/bin/env node | ||
var version = "3.9.0"; | ||
var version = "3.9.1"; | ||
@@ -145,3 +145,3 @@ const helpMessage = ` | ||
async function run(args) { | ||
var _args_external, _env; | ||
var _args_external; | ||
const { source, format, watch, minify, sourcemap, target, runtime, dts, env } = args; | ||
@@ -161,3 +161,3 @@ const cwd = args.cwd || process.cwd(); | ||
sourcemap: sourcemap === false ? false : true, | ||
env: ((_env = env) == null ? void 0 : _env.split(',')) || [] | ||
env: (env == null ? void 0 : env.split(',')) || [] | ||
}; | ||
@@ -164,0 +164,0 @@ if (args.version) { |
@@ -132,2 +132,3 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const hasAvailableExtension = (filename)=>availableExtensions.includes(path__default.default.extname(filename).slice(1)); | ||
const hasCjsExtension = (filename)=>path__default.default.extname(filename) === '.cjs'; | ||
@@ -263,2 +264,4 @@ let hasLoggedTsWarning = false; | ||
const cssTypeSet = new Set(); | ||
// wait for rollup 4 for better support of assertion support https://github.com/rollup/rollup/issues/4818 | ||
// | 'cssAssertionImport' | ||
return { | ||
@@ -438,2 +441,5 @@ name: 'inline-css', | ||
} | ||
if (!isCjsPackage && pkg.main && hasCjsExtension(pkg.main)) { | ||
exit('Cannot export main field with .cjs extension in ESM package, only .mjs and .js extensions are allowed'); | ||
} | ||
// main export '.' from main/module/typings | ||
@@ -559,6 +565,5 @@ const defaultMainExport = constructFullExportCondition({ | ||
function getTypeFilePath(entryFilePath, exportCondition, cwd) { | ||
var _exportCondition; | ||
const name = filenameWithoutExtension(entryFilePath); | ||
const firstDistPath = exportCondition ? Object.values(exportCondition.export)[0] : undefined; | ||
const exportName = ((_exportCondition = exportCondition) == null ? void 0 : _exportCondition.name) || 'index'; | ||
const exportName = (exportCondition == null ? void 0 : exportCondition.name) || 'index'; | ||
return entryFilePath ? name + '.d.ts' : path.resolve(firstDistPath ? path.dirname(firstDistPath) : path.join(cwd, 'dist'), (exportName === '.' ? 'index' : exportName) + '.d.ts'); | ||
@@ -570,5 +575,3 @@ } | ||
format: { | ||
comments: 'some', | ||
wrapFuncArgs: false, | ||
preserveAnnotations: true | ||
comments: 'some' | ||
}, | ||
@@ -593,3 +596,2 @@ mangle: { | ||
function buildInputConfig(entry, pkg, options, cwd, { tsConfigPath, tsCompilerOptions }, dts) { | ||
var _tsCompilerOptions; | ||
const hasNoExternal = options.external === null; | ||
@@ -605,8 +607,6 @@ var _options_external; | ||
const { useTypescript, runtime, target: jscTarget, minify: shouldMinify } = options; | ||
const hasSpecifiedTsTarget = Boolean(((_tsCompilerOptions = tsCompilerOptions) == null ? void 0 : _tsCompilerOptions.target) && tsConfigPath); | ||
const hasSpecifiedTsTarget = Boolean((tsCompilerOptions == null ? void 0 : tsCompilerOptions.target) && tsConfigPath); | ||
const swcParserConfig = { | ||
syntax: useTypescript ? 'typescript' : 'ecmascript', | ||
[useTypescript ? 'tsx' : 'jsx']: true, | ||
privateMethod: true, | ||
classPrivateProperty: true, | ||
exportDefaultFrom: true | ||
@@ -630,3 +630,4 @@ }; | ||
sourceMaps: options.sourcemap, | ||
inlineSourcesContent: false | ||
inlineSourcesContent: false, | ||
isModule: true | ||
}; | ||
@@ -728,3 +729,2 @@ const sizePlugin = sizeCollector.plugin(cwd); | ||
function hasEsmExport(exportPaths, tsCompilerOptions) { | ||
var _tsCompilerOptions; | ||
let hasEsm = false; | ||
@@ -739,3 +739,3 @@ for(const key in exportPaths){ | ||
} | ||
return Boolean(hasEsm || ((_tsCompilerOptions = tsCompilerOptions) == null ? void 0 : _tsCompilerOptions.esModuleInterop)); | ||
return Boolean(hasEsm || (tsCompilerOptions == null ? void 0 : tsCompilerOptions.esModuleInterop)); | ||
} | ||
@@ -913,3 +913,3 @@ function buildOutputConfigs(pkg, exportPaths, options, exportCondition, cwd, { tsCompilerOptions }, dts) { | ||
if (hasWildcard) { | ||
console.warn(`The wildcard export "./*" is experimental and may change or be removed at any time.\n` + 'To open an issue, please visit https://github.com/huozhi/bunchee/issues' + '.\n'); | ||
logger.warn(`The wildcard export "./*" is experimental and may change or be removed at any time.\n` + 'To open an issue, please visit https://github.com/huozhi/bunchee/issues' + '.\n'); | ||
// './foo' -> ['foo']; './foo/bar' -> ['bar'] | ||
@@ -940,3 +940,2 @@ // will contain '*' also but it's not a problem | ||
async function bundle(entryPath, { cwd: _cwd, ...options } = {}) { | ||
var _tsConfig, _tsConfig1, _tsConfig2; | ||
const cwd = path.resolve(process.cwd(), _cwd || ''); | ||
@@ -955,6 +954,6 @@ assignDefault(options, 'format', 'es'); | ||
const tsConfig = await resolveTsConfig(cwd); | ||
const hasTsConfig = Boolean((_tsConfig = tsConfig) == null ? void 0 : _tsConfig.tsConfigPath); | ||
const hasTsConfig = Boolean(tsConfig == null ? void 0 : tsConfig.tsConfigPath); | ||
const defaultTsOptions = { | ||
tsConfigPath: (_tsConfig1 = tsConfig) == null ? void 0 : _tsConfig1.tsConfigPath, | ||
tsCompilerOptions: ((_tsConfig2 = tsConfig) == null ? void 0 : _tsConfig2.tsCompilerOptions) || {} | ||
tsConfigPath: tsConfig == null ? void 0 : tsConfig.tsConfigPath, | ||
tsCompilerOptions: (tsConfig == null ? void 0 : tsConfig.tsCompilerOptions) || {} | ||
}; | ||
@@ -961,0 +960,0 @@ // Handle single entry file |
{ | ||
"name": "bunchee", | ||
"version": "3.9.0", | ||
"version": "3.9.1", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -56,3 +56,3 @@ "bin": { | ||
"@rollup/pluginutils": "^5.0.4", | ||
"@swc/core": "^1.3.82", | ||
"@swc/core": "^1.3.93", | ||
"@swc/helpers": "^0.5.0", | ||
@@ -64,3 +64,3 @@ "arg": "^5.0.2", | ||
"rollup-plugin-dts": "^6.0.1", | ||
"rollup-plugin-swc3": "^0.10.1", | ||
"rollup-plugin-swc3": "^0.10.3", | ||
"rollup-swc-preserve-directives": "^0.5.0", | ||
@@ -82,3 +82,3 @@ "tslib": "^2.5.0" | ||
"@huozhi/testing-package": "1.0.0", | ||
"@swc/jest": "^0.2.22", | ||
"@swc/jest": "^0.2.29", | ||
"@swc/types": "^0.1.5", | ||
@@ -111,3 +111,3 @@ "@types/jest": "29.0.0", | ||
}, | ||
"packageManager": "pnpm@7.24.3" | ||
"packageManager": "pnpm@8.8.0" | ||
} |
@@ -31,3 +31,3 @@ # bunchee | ||
cd ./my-lib && mkdir src | ||
touch ./src/index.js | ||
touch ./src/index.ts | ||
touch package.json | ||
@@ -225,3 +225,3 @@ ``` | ||
The asterisk `*` will be replaced with your entry files, such as: | ||
The asterisk `*` will be replaced with your entry files, such as: | ||
@@ -259,4 +259,22 @@ ``` | ||
> Note: Wildcard Exports currently only supports the exports key `"./*"`, which will match all the available entries. | ||
> Note: Wildcard Exports currently only supports the exports key `"./*"`, which will match all the available entries. | ||
### CSS | ||
`bunchee`` has basic CSS support for pure CSS file imports. It will be bundled into js bundle and insert the style tag into the document head when the bundle is loaded by browser. | ||
```css | ||
/* src/style.css */ | ||
.foo { | ||
color: orange; | ||
} | ||
``` | ||
```tsx | ||
// src/index.tsx | ||
import './style.css' | ||
export const Foo = () => <div className="foo">foo</div> | ||
``` | ||
### TypeScript | ||
@@ -263,0 +281,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
56806
328
1255
Updated@swc/core@^1.3.93
Updatedrollup-plugin-swc3@^0.10.3