Skip to content

Tweaks the ranges for the patches #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 129 additions & 129 deletions .pnp.js

Large diffs are not rendered by default.

Binary file not shown.
21 changes: 21 additions & 0 deletions .yarn/versions/9fd024b1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
releases:
"@yarnpkg/cli": prerelease
"@yarnpkg/plugin-compat": prerelease

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/core"
- "@yarnpkg/doctor"
2 changes: 1 addition & 1 deletion packages/plugin-compat/extra/fsevents/2.1.2.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/fsevents.js b/fsevents.js
semver exclusivity ^2
semver exclusivity ^2.1
--- a/fsevents.js
+++ b/fsevents.js
@@ -21,5 +21,7 @@ function watch(path, handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ rm -f "$PATCHFILE" && touch "$PATCHFILE"
echo 'export const patch =' \
>> "$PATCHFILE"
git diff --no-index "$TEMP_DIR"/orig "$TEMP_DIR"/patched \
| perl -p -e"s#^--- #semver exclusivity >=3\n--- #" \
| perl -p -e"s#$TEMP_DIR/orig##" \
| perl -p -e"s#$TEMP_DIR/patched##" \
| perl -p -e"s#__spreadArrays#[].concat#" \
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-compat/sources/patches/fsevents.patch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const patch =
"diff --git a/fsevents.js b/fsevents.js\nsemver exclusivity ^1\n--- a/fsevents.js\n+++ b/fsevents.js\n@@ -36,11 +36,15 @@ module.exports.Constants = Native.Constants;\n var defer = global.setImmediate || process.nextTick;\n\n function watch(path) {\n- var fse = new FSEvents(String(path || ''), handler);\n+ var VFS = require('./vfs');\n+ var vfs = new VFS(String(path || ''));\n+\n+ var fse = new FSEvents(vfs.resolvedPath, handler);\n EventEmitter.call(fse);\n return fse;\n\n function handler(path, flags, id) {\n+ path = vfs.transpose(path);\n defer(function() {\n fse.emit('fsevent', path, flags, id);\n var info = getInfo(path, flags);\ndiff --git a/fsevents.js b/fsevents.js\nsemver exclusivity ^2\n--- a/fsevents.js\n+++ b/fsevents.js\n@@ -21,5 +21,7 @@ function watch(path, handler) {\n throw new TypeError(`fsevents argument 2 must be a function and not a ${typeof handler}`);\n }\n\n- let instance = Native.start(path, handler);\n+ let VFS = require('./vfs');\n+ let vfs = new VFS(path);\n+ let instance = Native.start(vfs.resolvedPath, vfs.wrap(handler));\n if (!instance) throw new Error(`could not watch: ${path}`);\ndiff --git a/vfs.js b/vfs.js\nnew file mode 100644\n--- /dev/null\n+++ b/vfs.js\n@@ -0,0 +1,41 @@\n+const path = require(`path`);\n+\n+const NUMBER_REGEXP = /^[0-9]+$/;\n+const VIRTUAL_REGEXP = /^(\\/(?:[^\\/]+\\/)*?\\$\\$virtual)((?:\\/([^\\/]+)(?:\\/([^\\/]+))?)?((?:\\/.*)?))$/;\n+\n+function resolveVirtual(p) {\n+ const match = p.match(VIRTUAL_REGEXP);\n+ if (!match)\n+ return p;\n+\n+ const target = path.dirname(match[1]);\n+ if (!match[3] || !match[4])\n+ return target;\n+\n+ const isnum = NUMBER_REGEXP.test(match[4]);\n+ if (!isnum)\n+ return p;\n+\n+ const depth = Number(match[4]);\n+ const backstep = `../`.repeat(depth);\n+ const subpath = (match[5] || `.`);\n+\n+ return resolveVirtual(path.join(target, backstep, subpath));\n+}\n+\n+module.exports = class FsePnp {\n+ constructor(p) {\n+ this.normalizedPath = path.resolve(p);\n+ this.resolvedPath = resolveVirtual(this.normalizedPath);\n+ }\n+\n+ transpose(p) {\n+ return this.normalizedPath + p.substr(this.resolvedPath.length);\n+ }\n+\n+ wrap(fn) {\n+ return (path, ...args) => {\n+ return fn(this.transpose(path), ...args);\n+ };\n+ }\n+};\n"
"diff --git a/fsevents.js b/fsevents.js\nsemver exclusivity ^1\n--- a/fsevents.js\n+++ b/fsevents.js\n@@ -36,11 +36,15 @@ module.exports.Constants = Native.Constants;\n var defer = global.setImmediate || process.nextTick;\n\n function watch(path) {\n- var fse = new FSEvents(String(path || ''), handler);\n+ var VFS = require('./vfs');\n+ var vfs = new VFS(String(path || ''));\n+\n+ var fse = new FSEvents(vfs.resolvedPath, handler);\n EventEmitter.call(fse);\n return fse;\n\n function handler(path, flags, id) {\n+ path = vfs.transpose(path);\n defer(function() {\n fse.emit('fsevent', path, flags, id);\n var info = getInfo(path, flags);\ndiff --git a/fsevents.js b/fsevents.js\nsemver exclusivity ^2.1\n--- a/fsevents.js\n+++ b/fsevents.js\n@@ -21,5 +21,7 @@ function watch(path, handler) {\n throw new TypeError(`fsevents argument 2 must be a function and not a ${typeof handler}`);\n }\n\n- let instance = Native.start(path, handler);\n+ let VFS = require('./vfs');\n+ let vfs = new VFS(path);\n+ let instance = Native.start(vfs.resolvedPath, vfs.wrap(handler));\n if (!instance) throw new Error(`could not watch: ${path}`);\ndiff --git a/vfs.js b/vfs.js\nnew file mode 100644\n--- /dev/null\n+++ b/vfs.js\n@@ -0,0 +1,41 @@\n+const path = require(`path`);\n+\n+const NUMBER_REGEXP = /^[0-9]+$/;\n+const VIRTUAL_REGEXP = /^(\\/(?:[^\\/]+\\/)*?\\$\\$virtual)((?:\\/([^\\/]+)(?:\\/([^\\/]+))?)?((?:\\/.*)?))$/;\n+\n+function resolveVirtual(p) {\n+ const match = p.match(VIRTUAL_REGEXP);\n+ if (!match)\n+ return p;\n+\n+ const target = path.dirname(match[1]);\n+ if (!match[3] || !match[4])\n+ return target;\n+\n+ const isnum = NUMBER_REGEXP.test(match[4]);\n+ if (!isnum)\n+ return p;\n+\n+ const depth = Number(match[4]);\n+ const backstep = `../`.repeat(depth);\n+ const subpath = (match[5] || `.`);\n+\n+ return resolveVirtual(path.join(target, backstep, subpath));\n+}\n+\n+module.exports = class FsePnp {\n+ constructor(p) {\n+ this.normalizedPath = path.resolve(p);\n+ this.resolvedPath = resolveVirtual(this.normalizedPath);\n+ }\n+\n+ transpose(p) {\n+ return this.normalizedPath + p.substr(this.resolvedPath.length);\n+ }\n+\n+ wrap(fn) {\n+ return (path, ...args) => {\n+ return fn(this.transpose(path), ...args);\n+ };\n+ }\n+};\n"
;
2 changes: 1 addition & 1 deletion packages/plugin-compat/sources/patches/typescript.patch.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11944,7 +11944,7 @@ fsevents@^1.2.2:

"fsevents@patch:fsevents@^1.0.0#builtin<compat/fsevents>, fsevents@patch:fsevents@^1.2.7#builtin<compat/fsevents>":
version: 1.2.7
resolution: "fsevents@patch:fsevents@npm%3A1.2.7#builtin<compat/fsevents>::version=1.2.7&hash=e8cd9e"
resolution: "fsevents@patch:fsevents@npm%3A1.2.7#builtin<compat/fsevents>::version=1.2.7&hash=77dfe6"
dependencies:
nan: ^2.9.2
node-pre-gyp: ^0.10.0
Expand All @@ -11954,7 +11954,7 @@ fsevents@^1.2.2:

"fsevents@patch:fsevents@^1.2.2#builtin<compat/fsevents>":
version: 1.2.6
resolution: "fsevents@patch:fsevents@npm%3A1.2.6#builtin<compat/fsevents>::version=1.2.6&hash=e8cd9e"
resolution: "fsevents@patch:fsevents@npm%3A1.2.6#builtin<compat/fsevents>::version=1.2.6&hash=77dfe6"
dependencies:
nan: ^2.9.2
node-pre-gyp: ^0.10.0
Expand Down Expand Up @@ -24308,11 +24308,11 @@ resolve@^1.10.1:

"typescript@patch:typescript@*#builtin<compat/typescript>, typescript@patch:typescript@^3.7.4#builtin<compat/typescript>":
version: 3.7.4
resolution: "typescript@patch:typescript@npm%3A3.7.4#builtin<compat/typescript>::version=3.7.4&hash=226bd1"
resolution: "typescript@patch:typescript@npm%3A3.7.4#builtin<compat/typescript>::version=3.7.4&hash=273569"
bin:
tsc: ./bin/tsc
tsserver: ./bin/tsserver
checksum: 2/f39de68fea020f03929159a25aefcb7194eb4a5ee85ade1b76733f99f009e3e3d46790778d6b700cd8ad30b0baade750a2f5fafbc71f75c1286b0e637e305aed
checksum: 2/783bad1234fd466f8b481e9d1d6fd2286af993731eb59c23e48a091805b8687cf0d68f992061da0f721b6f09b63e8da7e4f5d9f724c25c91cecbb8f53a643e47
languageName: node
linkType: hard

Expand Down