quickbundle 0.0.0-next-45ab553 → 0.0.0-next-8b15817

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +21 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -259,6 +259,12 @@ const getBuildableExports = ({ standalone })=>{
259
259
  }
260
260
  return output;
261
261
  };
262
+ const getFileOutput = (filePath)=>{
263
+ return {
264
+ dir: dirname(filePath),
265
+ entryFileNames: basename(filePath)
266
+ };
267
+ };
262
268
  const getPlugins = (customPlugins, options)=>{
263
269
  return [
264
270
  !options.standalone && externals({
@@ -284,17 +290,21 @@ const createMainConfig = (entryPoints, options)=>{
284
290
  if (entryPoints.import && entryPoints.default && entryPoints.import !== entryPoints.default) {
285
291
  throw new Error("Both `import` and `default` export fields have been defined but with different values. To preserve proper `default` field resolution on the consumer side (i.e. to target ESM format), make sure to provide the same file path for both fields.");
286
292
  }
293
+ const commonOutputConfig = {
294
+ importAttributesKey: "with",
295
+ sourcemap: sourceMaps
296
+ };
287
297
  const output = [
288
298
  cjsInput && {
289
- file: cjsInput,
299
+ ...commonOutputConfig,
300
+ ...getFileOutput(cjsInput),
290
301
  format: "cjs",
291
- inlineDynamicImports: Boolean(options.standalone),
292
- sourcemap: sourceMaps
302
+ inlineDynamicImports: Boolean(options.standalone)
293
303
  },
294
304
  esmInput && {
295
- file: esmInput,
296
- format: "es",
297
- sourcemap: sourceMaps
305
+ ...commonOutputConfig,
306
+ ...getFileOutput(esmInput),
307
+ format: "es"
298
308
  }
299
309
  ].filter(Boolean);
300
310
  return {
@@ -313,9 +323,7 @@ const createTypesConfig = (entryPoints, options)=>{
313
323
  return {
314
324
  input: entryPoints.source,
315
325
  output: [
316
- {
317
- file: entryPoints.types
318
- }
326
+ getFileOutput(entryPoints.types)
319
327
  ],
320
328
  plugins: getPlugins([
321
329
  nodeResolve({
@@ -355,6 +363,7 @@ const createWatchCommand = (program)=>{
355
363
  });
356
364
  };
357
365
 
366
+ // eslint-disable-next-line sonarjs/cognitive-complexity
358
367
  const build = async (input)=>{
359
368
  process.env.NODE_ENV ??= "production";
360
369
  const { data: configurations } = input;
@@ -371,7 +380,8 @@ const build = async (input)=>{
371
380
  ];
372
381
  const promises = [];
373
382
  for (const outputEntry of outputEntries){
374
- const outputFilePath = outputEntry.file ?? outputEntry.dir;
383
+ const entryFileName = outputEntry.entryFileNames;
384
+ const outputFilePath = join(outputEntry.dir ?? "", typeof entryFileName === "string" ? entryFileName : "");
375
385
  if (!outputFilePath) {
376
386
  throw new Error("Misconfigured file entry point. Make sure to define an `import`, `require`, or `default` field.");
377
387
  }
@@ -590,7 +600,7 @@ const formatSize = (bytes)=>{
590
600
  };
591
601
 
592
602
  var name = "quickbundle";
593
- var version = "0.0.0-next-45ab553";
603
+ var version = "0.0.0-next-8b15817";
594
604
 
595
605
  const createProgram = (...commandBuilders)=>{
596
606
  const program = termost({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "0.0.0-next-45ab553",
3
+ "version": "0.0.0-next-8b15817",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "keywords": [
6
6
  "library",