prepare-package 2.0.4 → 2.0.6

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.
package/dist/build.js CHANGED
@@ -66,6 +66,7 @@ async function build(options) {
66
66
 
67
67
  // CJS
68
68
  if (formats.includes('cjs')) {
69
+ const cjsConfig = buildConfig.cjs || {};
69
70
  builds.push({
70
71
  ...shared,
71
72
  outfile: path.join(outputPath, 'index.js'),
@@ -73,6 +74,8 @@ async function build(options) {
73
74
  platform,
74
75
  minify: false,
75
76
  target,
77
+ // Unwrap default export so require() returns the function/class directly
78
+ footer: { js: cjsConfig.footer || 'module.exports=module.exports.default||module.exports;' },
76
79
  });
77
80
  }
78
81
 
@@ -185,6 +188,7 @@ async function createWatchContexts(options) {
185
188
  }
186
189
 
187
190
  if (formats.includes('cjs')) {
191
+ const cjsConfig = buildConfig.cjs || {};
188
192
  builds.push({
189
193
  ...shared,
190
194
  outfile: path.join(outputPath, 'index.js'),
@@ -192,6 +196,8 @@ async function createWatchContexts(options) {
192
196
  platform,
193
197
  minify: false,
194
198
  target,
199
+ // Unwrap default export so require() returns the function/class directly
200
+ footer: { js: cjsConfig.footer || 'module.exports=module.exports.default||module.exports;' },
195
201
  });
196
202
  }
197
203
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const jetpack = require('fs-jetpack');
2
- const fetch = require('wonderful-fetch');
2
+ const fetch = require('wonderful-fetch').default;
3
3
  const path = require('path');
4
4
  const { default: chalk } = require('chalk');
5
5
  const logger = require('./logger');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prepare-package",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "Prepare a Node.js package before being published",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -50,7 +50,7 @@
50
50
  "chokidar": "^5.0.0",
51
51
  "esbuild": "^0.27.4",
52
52
  "fs-jetpack": "^5.1.0",
53
- "wonderful-fetch": "^1.3.4"
53
+ "wonderful-fetch": "^2.0.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "mocha": "^11.7.5"