pear-shake
Advanced tools
+10
-12
@@ -34,10 +34,3 @@ 'use strict' | ||
| const hosts = [ | ||
| 'darwin-arm64', | ||
| 'darwin-x64', | ||
| 'linux-arm64', | ||
| 'linux-x64', | ||
| 'win32-x64', | ||
| 'win32-x64' | ||
| ] | ||
| const hosts = ['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', 'win32-x64', 'win32-x64'] | ||
@@ -56,2 +49,3 @@ module.exports = class { | ||
| const skips = [] | ||
| const resolutions = [] | ||
@@ -61,9 +55,12 @@ await Promise.all( | ||
| async (entrypoint) => | ||
| await this._traverse(entrypoint, Array.from(defer), files, skips) | ||
| await this._traverse(entrypoint, Array.from(defer), files, skips, resolutions) | ||
| ) // only pass defer by value, files and skips must be passed by reference | ||
| ) | ||
| return { files: [...files], skips } | ||
| const spreadResolutions = resolutions.reduce((acc, r) => { | ||
| return { ...acc, ...r } | ||
| }, {}) | ||
| return { files: [...files], skips, resolutions: spreadResolutions } | ||
| } | ||
| async _traverse(entrypoint, defer, files, skips) { | ||
| async _traverse(entrypoint, defer, files, skips, resolutions) { | ||
| try { | ||
@@ -77,2 +74,3 @@ const bundle = await pack(this._drive, entrypoint, { | ||
| for (const file of Object.keys(bundle.files)) files.add(file) | ||
| resolutions.push(bundle.resolutions) | ||
| } catch (err) { | ||
@@ -87,3 +85,3 @@ if (err.code !== 'MODULE_NOT_FOUND') throw err | ||
| }) | ||
| await this._traverse(entrypoint, defer, files, skips) | ||
| await this._traverse(entrypoint, defer, files, skips, resolutions) | ||
| } | ||
@@ -90,0 +88,0 @@ } |
+2
-2
| { | ||
| "name": "pear-shake", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "main": "index.js", | ||
@@ -23,3 +23,3 @@ "type": "commonjs", | ||
| "prettier": "^3.6.2", | ||
| "prettier-config-holepunch": "^1.0.0", | ||
| "prettier-config-holepunch": "^2.0.0", | ||
| "test-tmp": "^1.4.0" | ||
@@ -26,0 +26,0 @@ }, |
15659
1.5%112
-1.75%