Upgrade @parcel/watcher to 2.5.0 (#14978)

This PR upgrades parcel watcher to 2.5.0.

Closes #14957
Closes #14958 
Closes #14969 
Closes #14970
Closes #14971
This commit is contained in:
Philipp Spiess 2024-11-13 11:38:43 +01:00 • committed by GitHub
parent bc6f7e2232
commit c62422ff4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 396 additions and 165 deletions

View file

@ -63,8 +63,8 @@
"packageManager": "pnpm@9.6.0",
"pnpm": {
"patchedDependencies": {
"@parcel/watcher@2.4.1": "patches/@parcel__watcher@2.4.1.patch",
"lightningcss@1.26.0": "patches/lightningcss@1.26.0.patch"
"lightningcss@1.26.0": "patches/lightningcss@1.26.0.patch",
"@parcel/watcher@2.5.0": "patches/@parcel__watcher@2.5.0.patch"
}
}
}

View file

@ -29,7 +29,7 @@
"access": "public"
},
"dependencies": {
"@parcel/watcher": "^2.4.1",
"@parcel/watcher": "^2.5.0",
"@tailwindcss/node": "workspace:^",
"@tailwindcss/oxide": "workspace:^",
"enhanced-resolve": "^5.17.1",

View file

@ -32,13 +32,13 @@
},
"__notes": "These binary packages must be included so Bun can build the CLI for all supported platforms. We also rely on Lightning CSS and Parcel being patched so Bun can statically analyze the executables.",
"devDependencies": {
"@parcel/watcher-darwin-arm64": "^2.4.2-alpha.0",
"@parcel/watcher-darwin-x64": "^2.4.2-alpha.0",
"@parcel/watcher-linux-arm64-glibc": "^2.4.2-alpha.0",
"@parcel/watcher-linux-arm64-musl": "^2.4.2-alpha.0",
"@parcel/watcher-linux-x64-glibc": "^2.4.2-alpha.0",
"@parcel/watcher-linux-x64-musl": "^2.4.2-alpha.0",
"@parcel/watcher-win32-x64": "^2.4.2-alpha.0",
"@parcel/watcher-darwin-arm64": "^2.5.0",
"@parcel/watcher-darwin-x64": "^2.5.0",
"@parcel/watcher-linux-arm64-glibc": "^2.5.0",
"@parcel/watcher-linux-arm64-musl": "^2.5.0",
"@parcel/watcher-linux-x64-glibc": "^2.5.0",
"@parcel/watcher-linux-x64-musl": "^2.5.0",
"@parcel/watcher-win32-x64": "^2.5.0",
"@types/bun": "^1.1.11",
"bun": "1.1.29",
"lightningcss-darwin-arm64": "^1.25.1",

View file

@ -1,9 +1,10 @@
diff --git a/index.js b/index.js
index 8afb2b1126dcc687b7ff9b631589da252c1f9c22..97975cf342ff8c204b5731840a89b8ea88b0dbbc 100644
index 8afb2b1126dcc687b7ff9b631589da252c1f9c22..f3b1158eb5612235388ff5f5347f6edcbf323090 100644
--- a/index.js
+++ b/index.js
@@ -1,40 +1,26 @@
const {createWrapper} = require('./wrapper');
@@ -1,41 +1,27 @@
-const {createWrapper} = require('./wrapper');
+const { createWrapper } = require('./wrapper')
-let name = `@parcel/watcher-${process.platform}-${process.arch}`;
-if (process.platform === 'linux') {
@ -16,7 +17,7 @@ index 8afb2b1126dcc687b7ff9b631589da252c1f9c22..97975cf342ff8c204b5731840a89b8ea
-}
+function loadPackage() {
+ if (process.platform === 'linux') {
+ let { MUSL, GLIBC, family, familySync } = require("detect-libc");
+ let { MUSL, GLIBC, family, familySync } = require('detect-libc')
+ // Bun polyfills `detect-libc` in compiled binaries. We rely on
+ // detect-libc@1.0.3 but the polyfilled version is 2.x. In detect-libc@2x
+ // there is a `familySync` function that we can use instead.
@ -37,14 +38,14 @@ index 8afb2b1126dcc687b7ff9b631589da252c1f9c22..97975cf342ff8c204b5731840a89b8ea
- handleError(err);
- throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
+ if (family === MUSL) {
+ return require(`@parcel/watcher-${process.platform}-${process.arch}-musl`);
+ return require(`@parcel/watcher-${process.platform}-${process.arch}-musl`)
+ } else if (family === GLIBC) {
+ return require(`@parcel/watcher-${process.platform}-${process.arch}-glibc`);
+ return require(`@parcel/watcher-${process.platform}-${process.arch}-glibc`)
+ } else {
+ throw new Error(`Unsupported libc on: ${process.platform}-${process.arch}`);
+ throw new Error(`Unsupported libc on: ${process.platform}-${process.arch}`)
}
+ } else {
+ return require(`@parcel/watcher-${process.platform}-${process.arch}`);
+ return require(`@parcel/watcher-${process.platform}-${process.arch}`)
}
}
@ -55,7 +56,12 @@ index 8afb2b1126dcc687b7ff9b631589da252c1f9c22..97975cf342ff8c204b5731840a89b8ea
-}
-
-const wrapper = createWrapper(binding);
+const wrapper = createWrapper(loadPackage());
exports.writeSnapshot = wrapper.writeSnapshot;
exports.getEventsSince = wrapper.getEventsSince;
exports.subscribe = wrapper.subscribe;
-exports.writeSnapshot = wrapper.writeSnapshot;
-exports.getEventsSince = wrapper.getEventsSince;
-exports.subscribe = wrapper.subscribe;
-exports.unsubscribe = wrapper.unsubscribe;
+const wrapper = createWrapper(loadPackage())
+exports.writeSnapshot = wrapper.writeSnapshot
+exports.getEventsSince = wrapper.getEventsSince
+exports.subscribe = wrapper.subscribe
+exports.unsubscribe = wrapper.unsubscribe

511
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff