From 0345dd09a1fa46f3a3f8e69d4a47dae7f77b93ad Mon Sep 17 00:00:00 2001 From: merceyz Date: Tue, 3 Nov 2020 19:44:09 +0100 Subject: [PATCH 1/2] fix(plugin-compat): update fsevents patch for version 2.2.0 --- .pnp.js | 18 ++-- ... fsevents-patch-5794df231e-e2b8c37934.zip} | Bin ... fsevents-patch-b051797a41-8e4b5f5276.zip} | Bin .yarn/versions/6796d160.yml | 22 +++++ .../extra/fsevents/fsevents-2.2.0.js | 84 ++++++++++++++++++ .../extra/fsevents/gen-fsevents-patch.sh | 17 +++- .../sources/patches/fsevents.patch.ts | 2 +- yarn.lock | 4 +- 8 files changed, 134 insertions(+), 13 deletions(-) rename .yarn/cache/{fsevents-patch-fa4e06e760-e2b8c37934.zip => fsevents-patch-5794df231e-e2b8c37934.zip} (100%) rename .yarn/cache/{fsevents-patch-ad3abc5709-8e4b5f5276.zip => fsevents-patch-b051797a41-8e4b5f5276.zip} (100%) create mode 100644 .yarn/versions/6796d160.yml create mode 100644 packages/plugin-compat/extra/fsevents/fsevents-2.2.0.js diff --git a/.pnp.js b/.pnp.js index 842227c426b5..6c4d89343c56 100755 --- a/.pnp.js +++ b/.pnp.js @@ -13226,7 +13226,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["anymatch", "npm:2.0.0"], ["async-each", "npm:1.0.1"], ["braces", "npm:2.3.2"], - ["fsevents", "patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=127e8e"], + ["fsevents", "patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=11e9ea"], ["glob-parent", "npm:3.1.0"], ["inherits", "npm:2.0.3"], ["is-binary-path", "npm:1.0.1"], @@ -13244,7 +13244,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["chokidar", "npm:3.4.0"], ["anymatch", "npm:3.1.1"], ["braces", "npm:3.0.2"], - ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=127e8e"], + ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=11e9ea"], ["glob-parent", "npm:5.1.0"], ["is-binary-path", "npm:2.1.0"], ["is-glob", "npm:4.0.1"], @@ -17960,19 +17960,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }] ]], ["fsevents", [ - ["patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=127e8e", { - "packageLocation": "./.yarn/unplugged/fsevents-patch-ad3abc5709/node_modules/fsevents/", + ["patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=11e9ea", { + "packageLocation": "./.yarn/unplugged/fsevents-patch-b051797a41/node_modules/fsevents/", "packageDependencies": [ - ["fsevents", "patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=127e8e"], + ["fsevents", "patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=11e9ea"], ["nan", "npm:2.14.0"], ["node-pre-gyp", "npm:0.10.3"] ], "linkType": "HARD", }], - ["patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=127e8e", { - "packageLocation": "./.yarn/unplugged/fsevents-patch-fa4e06e760/node_modules/fsevents/", + ["patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=11e9ea", { + "packageLocation": "./.yarn/unplugged/fsevents-patch-5794df231e/node_modules/fsevents/", "packageDependencies": [ - ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=127e8e"], + ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=11e9ea"], ["node-gyp", "npm:6.0.1"] ], "linkType": "HARD", @@ -23002,7 +23002,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/graceful-fs", "npm:4.1.3"], ["anymatch", "npm:3.1.1"], ["fb-watchman", "npm:2.0.0"], - ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=127e8e"], + ["fsevents", "patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=11e9ea"], ["graceful-fs", "npm:4.2.4"], ["jest-serializer", "npm:26.0.0"], ["jest-util", "npm:26.0.1"], diff --git a/.yarn/cache/fsevents-patch-fa4e06e760-e2b8c37934.zip b/.yarn/cache/fsevents-patch-5794df231e-e2b8c37934.zip similarity index 100% rename from .yarn/cache/fsevents-patch-fa4e06e760-e2b8c37934.zip rename to .yarn/cache/fsevents-patch-5794df231e-e2b8c37934.zip diff --git a/.yarn/cache/fsevents-patch-ad3abc5709-8e4b5f5276.zip b/.yarn/cache/fsevents-patch-b051797a41-8e4b5f5276.zip similarity index 100% rename from .yarn/cache/fsevents-patch-ad3abc5709-8e4b5f5276.zip rename to .yarn/cache/fsevents-patch-b051797a41-8e4b5f5276.zip diff --git a/.yarn/versions/6796d160.yml b/.yarn/versions/6796d160.yml new file mode 100644 index 000000000000..871c19814360 --- /dev/null +++ b/.yarn/versions/6796d160.yml @@ -0,0 +1,22 @@ +releases: + "@yarnpkg/cli": patch + "@yarnpkg/plugin-compat": patch + +declined: + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-node-modules" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/packages/plugin-compat/extra/fsevents/fsevents-2.2.0.js b/packages/plugin-compat/extra/fsevents/fsevents-2.2.0.js new file mode 100644 index 000000000000..9f17e0994fae --- /dev/null +++ b/packages/plugin-compat/extra/fsevents/fsevents-2.2.0.js @@ -0,0 +1,84 @@ +/* + ** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller + ** Licensed under MIT License. + */ + +/* jshint node:true */ +"use strict"; + +if (process.platform !== "darwin") { + throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`); +} + +const Native = require("./fsevents.node"); +const events = Native.constants; + +function watch(path, since, handler) { + if (typeof path !== "string") { + throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`); + } + if ("function" === typeof since && "undefined" === typeof handler) { + handler = since; + since = Native.flags.SinceNow; + } + if (typeof since !== "number") { + throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`); + } + if (typeof handler !== "function") { + throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`); + } + + let VFS = require('./vfs'); + let vfs = new VFS(path); + let instance = Native.start(Native.global, vfs.resolvedPath, since, vfs.wrap(handler)); + if (!instance) throw new Error(`could not watch: ${path}`); + return () => { + const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined); + instance = undefined; + return result; + }; +} + +function getInfo(path, flags) { + return { + path, + flags, + event: getEventType(flags), + type: getFileType(flags), + changes: getFileChanges(flags), + }; +} + +function getFileType(flags) { + if (events.ItemIsFile & flags) return "file"; + if (events.ItemIsDir & flags) return "directory"; + if (events.ItemIsSymlink & flags) return "symlink"; +} +function anyIsTrue(obj) { + for (let key in obj) { + if (obj[key]) return true; + } + return false; +} +function getEventType(flags) { + if (events.ItemRemoved & flags) return "deleted"; + if (events.ItemRenamed & flags) return "moved"; + if (events.ItemCreated & flags) return "created"; + if (events.ItemModified & flags) return "modified"; + if (events.RootChanged & flags) return "root-changed"; + if (events.ItemCloned & flags) return "cloned"; + if (anyIsTrue(flags)) return "modified"; + return "unknown"; +} +function getFileChanges(flags) { + return { + inode: !!(events.ItemInodeMetaMod & flags), + finder: !!(events.ItemFinderInfoMod & flags), + access: !!(events.ItemChangeOwner & flags), + xattrs: !!(events.ItemXattrMod & flags), + }; +} + +exports.watch = watch; +exports.getInfo = getInfo; +exports.constants = events; diff --git a/packages/plugin-compat/extra/fsevents/gen-fsevents-patch.sh b/packages/plugin-compat/extra/fsevents/gen-fsevents-patch.sh index 1161ef90ade8..b7a76a540cbf 100644 --- a/packages/plugin-compat/extra/fsevents/gen-fsevents-patch.sh +++ b/packages/plugin-compat/extra/fsevents/gen-fsevents-patch.sh @@ -7,6 +7,7 @@ cd "$TEMP_DIR" wget https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.11.tgz wget https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz +wget https://registry.yarnpkg.com/fsevents/-/fsevents-2.2.0.tgz tar xvf fsevents-1.2.11.tgz cp -rf package copy @@ -24,16 +25,30 @@ cp "$THIS_DIR"/fsevents-2.1.2.js copy/fsevents.js cp "$THIS_DIR"/vfs.js copy/vfs.js git diff -U2 --src-prefix=a/ --dst-prefix=b/ --ignore-cr-at-eol --ignore-space-change --full-index --no-index package copy > "$THIS_DIR"/fsevents-2.1.2.patch || true +rm -rf package copy + +tar xvf fsevents-2.2.0.tgz +cp -rf package copy + +cp "$THIS_DIR"/fsevents-2.2.0.js copy/fsevents.js +cp "$THIS_DIR"/vfs.js copy/vfs.js +git diff -U2 --src-prefix=a/ --dst-prefix=b/ --ignore-cr-at-eol --ignore-space-change --full-index --no-index package copy > "$THIS_DIR"/fsevents-2.2.0.patch || true + perl -p -i -e 's#a/package/#a/#' "$THIS_DIR"/fsevents-1.2.11.patch perl -p -i -e 's#b/copy/#b/#' "$THIS_DIR"/fsevents-1.2.11.patch perl -p -i -e 's#^--- #semver exclusivity ^1\'$'\n''--- #' "$THIS_DIR"/fsevents-1.2.11.patch perl -p -i -e 's#a/package/#a/#' "$THIS_DIR"/fsevents-2.1.2.patch perl -p -i -e 's#b/copy/#b/#' "$THIS_DIR"/fsevents-2.1.2.patch -perl -p -i -e 's#^--- #semver exclusivity ^2.1\'$'\n''--- #' "$THIS_DIR"/fsevents-2.1.2.patch +perl -p -i -e 's#^--- #semver exclusivity >=2.1 <2.2\'$'\n''--- #' "$THIS_DIR"/fsevents-2.1.2.patch + +perl -p -i -e 's#a/package/#a/#' "$THIS_DIR"/fsevents-2.2.0.patch +perl -p -i -e 's#b/copy/#b/#' "$THIS_DIR"/fsevents-2.2.0.patch +perl -p -i -e 's#^--- #semver exclusivity ^2.2\'$'\n''--- #' "$THIS_DIR"/fsevents-2.2.0.patch cat "$THIS_DIR"/fsevents-1.2.11.patch \ "$THIS_DIR"/fsevents-2.1.2.patch \ + "$THIS_DIR"/fsevents-2.2.0.patch \ > "$TEMP_DIR"/fsevents.patch node "$THIS_DIR/../createPatch.js" "$TEMP_DIR"/fsevents.patch "$THIS_DIR"/../../sources/patches/fsevents.patch.ts diff --git a/packages/plugin-compat/sources/patches/fsevents.patch.ts b/packages/plugin-compat/sources/patches/fsevents.patch.ts index af7bb8036228..8e8a321aab10 100644 --- a/packages/plugin-compat/sources/patches/fsevents.patch.ts +++ b/packages/plugin-compat/sources/patches/fsevents.patch.ts @@ -2,7 +2,7 @@ let patch: string; export function getPatch() { if (typeof patch === `undefined`) - patch = require(`zlib`).brotliDecompressSync(Buffer.from(`G1gUAIzCtr2xMzjJgJA88r/l8s7l9OoQ+WtKxU5uIQ1k15mQ1bamroyXoMKC0yqx44/BZ2Kp0oH6z9/XdLihMONU+ufec9+07fv777XvQJOVjRaHnkmAASXQQzhvDK3lC18lfWMQhmk/hyqMS39FA4d4X8na/QZocXQ3LmObAWWccY/xG5ZSBm6J6brPQ3E9pQ9DGJyhaurt4KyaZ+syHd/CnvYuraXnvJwez3WGhy6s6ecrfJVYeBDArI75wxB2HxweIqw0/gT+qXpDEji4JdFGZ5Do7yg5nV8J1f33B2JUENlw97TRDgNjq3yzyqD4IoFfFgJqt3Ga003n9/+eOFU1KYz99N6eCCDmOTGq8usWP53fU1IK8D0qzI3bK5KkKGgUjkG1dRyJBAC/T4SK5AOiInV6kSnLcQGMDKTOwrPxN8919kVydBmns6kfSdr1DhMISD0Q1qGeqWAowNVB+MlACshFFA8GHqpUTfgPlAi3RRDj6lJGtDcafGRQNymNVsmoKySzioKxwowoUiDaisGalJQCq7cw/5n3ETx7nKiI0iqiVdn885HOYSf2yH4hATXJEesF2nOfqp2bzLO2T2uI0hX/0JwMdac692S4i9/UzJ5PPqsqAVnxooXrvlQ/1ibnqvhIvgBqLWtP+p8kNU8NSlso1fnR6P8ir9txAdrm+XaYQpbns6D5hqqKw6WkVuPP2cNXIXqf22EaIHq/FDSg/sUFz5s4K0JyemiYYFrc5HBiLmmE5qqpIStviMHER2BVSUZlRCUOzCaHkCisRn3ltIMkNegRhip+9sT3nKpPPFIASnM1QVvE25LUteytfyIxhi2C4zcl3oloipwOLj6/qJOtPAPEAnKf105va2Lf3B1CndU2yBIrW2urW8N6wbdSYoBvisT5KlRosuRJcV9TL7dGdNXzUA7aqJSIfGdtxCJi8dK7/dx2uFksGP773q3ioNgRNkUAIS6y+CJBY2U5zV0P/XqaWeE3RYDV//Sv7mgs+kEVZ5ST1tCArNYcidRe9ZudVIfLfzxcpbzIv+Lc3ZvJD1cXzeVNM25FDyRmU2fd1F/bdVAqOWnKk1Q52pkEfMDeVC0GW4Q/lmckM5Z5r7Nz3WlkQcEICtc3JDVTXIl3r9YXggjAkDzU4r4NQehHbLEQ/uINXzYTISLiZQsFICKVpU69ME8bYLnLZlwmBJSZYAehatIhj3gC6Iho0uFsc8w92muCdflw5SouKRfSodbNZoLcxbG48Rc6Ng3mU+TcU65b2pRVwaIO0N0TNYmptsxD5WTDtG5SWskELYsSSoqpH6VNkXxcg3vwQGWaF5XL2XI5GgG6iA6kETJUICJE1GBXQ1TJT1OvRjNQFRutEg8EXZHQEHCYv8fWDiL+o7rWbEBqFvhMEZWL9uQLQqyNLrxq7wfa2P5dXv+PYsQqrih/3/6/5zLNAQ==`, `base64`)).toString(); + patch = require(`zlib`).brotliDecompressSync(Buffer.from(`G7weAByFTVk3Vs7UfHhq4yykgEM7pbW7TI43SG2S5tvGrwHBAzdz+s/npQ6tgEvobvxisrPIadkXeUAJotBn5bDZ5kAhcRqsIHe3F75Walet5hNalwgFDtxb0BiDUjiUQ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eX/lKiwpZ9Ln1tV2Ae7sArvxuVLbJjqJRjW1vFXAyHpvLG+8MJ6T2Ubx5M2KDa2SN6vuIGxJ9WQM9Mk3Q7aCNiZONXllhqq24DmoLbQfW2rYWsOgHWjtOmIQMyMKdiHZDjoyIq5+U700nZ6odJAoYXPQBvFNiQ78d5jaXliBqLTJEqUCwi+LiH2mx92EmNKDsJL74Z613+3lf20pxkV1+erOrjj8pW00vsPaahKUM+05ssd5uwM7K482KWEf3TCwlg/o3e5ngto7qSMz7YteIgCsF1UOcsLk7F7MxWbvrPMY473ew0G+noVL8EPbkmEMftMSeL6HFub/zy+2JQ==`, `base64`)).toString(); return patch; } diff --git a/yarn.lock b/yarn.lock index fba901eddcc8..dff8701e8159 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12859,7 +12859,7 @@ fsevents@^1.2.7: "fsevents@patch:fsevents@^1.2.7#builtin": version: 1.2.7 - resolution: "fsevents@patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=127e8e" + resolution: "fsevents@patch:fsevents@npm%3A1.2.7#builtin::version=1.2.7&hash=11e9ea" dependencies: nan: ^2.9.2 node-pre-gyp: ^0.10.0 @@ -12869,7 +12869,7 @@ fsevents@^1.2.7: "fsevents@patch:fsevents@^2.1.2#builtin, fsevents@patch:fsevents@~2.1.2#builtin": version: 2.1.3 - resolution: "fsevents@patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=127e8e" + resolution: "fsevents@patch:fsevents@npm%3A2.1.3#builtin::version=2.1.3&hash=11e9ea" dependencies: node-gyp: latest checksum: e2b8c379340e21a786d32c653854c8876f94eb1202dd5be378fd42c062bc123aab5051c32bf0011865257c85982c41ded203f9fe8c9f9c8f8c84dc4672abc0e0 From 5ba4da77eb419ce398f36fa6bea6748b8a3ef492 Mon Sep 17 00:00:00 2001 From: merceyz Date: Tue, 3 Nov 2020 19:49:47 +0100 Subject: [PATCH 2/2] chore: remove leftover patch --- packages/plugin-compat/extra/fsevents/2.1.2.patch | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 packages/plugin-compat/extra/fsevents/2.1.2.patch diff --git a/packages/plugin-compat/extra/fsevents/2.1.2.patch b/packages/plugin-compat/extra/fsevents/2.1.2.patch deleted file mode 100644 index a99cf4811bfc..000000000000 --- a/packages/plugin-compat/extra/fsevents/2.1.2.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/fsevents.js b/fsevents.js -semver exclusivity ^2.1 ---- a/fsevents.js -+++ b/fsevents.js -@@ -21,5 +21,7 @@ function watch(path, handler) { - throw new TypeError(`fsevents argument 2 must be a function and not a ${typeof handler}`); - } - -- let instance = Native.start(path, handler); -+ let VFS = require('./vfs'); -+ let vfs = new VFS(path); -+ let instance = Native.start(vfs.resolvedPath, vfs.wrap(handler)); - if (!instance) throw new Error(`could not watch: ${path}`);