···11+# Contributor Covenant Code of Conduct
22+33+## Our pledge
44+55+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
66+77+## Our standards
88+99+Examples of behavior that contributes to creating a positive environment include:
1010+1111+- Using welcoming and inclusive language
1212+- Being respectful of differing viewpoints and experiences
1313+- Gracefully accepting constructive criticism
1414+- Focusing on what is best for the community
1515+- Showing empathy towards other community members
1616+1717+Examples of unacceptable behavior by participants include:
1818+1919+- The use of sexualized language or imagery and unwelcome sexual attention or advances
2020+- Trolling, insulting/derogatory comments, and personal or political attacks
2121+- Public or private harassment
2222+- Publishing others' private information, such as a physical or electronic address, without explicit permission
2323+- Other conduct which could reasonably be considered inappropriate in a professional setting
2424+2525+## Our responsibilities
2626+2727+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
2828+2929+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
3030+3131+## Scope
3232+3333+This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
3434+3535+## Enforcement
3636+3737+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
3838+3939+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
4040+4141+## Attribution
4242+4343+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
4444+4545+[homepage]: https://www.contributor-covenant.org
4646+4747+For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
+21
LICENCE
···11+MIT License
22+33+Copyright (c) 2021 Daniel Roe
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
···11+---
22+name: "\U0001F41B Bug report"
33+about: Something's not working
44+title: 'fix: '
55+labels: bug
66+assignees: danielroe
77+---
88+99+**🐛 The bug**
1010+What isn't working? Describe what the bug is.
1111+1212+**🛠️ To reproduce**
1313+Steps to reproduce the behavior:
1414+1515+1. Go to '...'
1616+2. Click on '....'
1717+3. Scroll down to '....'
1818+4. See error
1919+2020+I'd be very grateful for a link to a gist or repo that reproduces the bug.
2121+2222+**🌈 Expected behaviour**
2323+What did you expect to happen? Is there a section in the docs about this?
2424+2525+**ℹ️ Additional context**
2626+Add any other context about the problem here.
+17
.github/ISSUE_TEMPLATE/---documentation.md
···11+---
22+name: "\U0001F4DA Documentation"
33+about: How do I ... ?
44+title: 'docs: '
55+labels: documentation
66+assignees: danielroe
77+88+---
99+1010+**📚 Is your documentation request related to a problem? Please describe.**
1111+A clear and concise description of what the problem is. Ex. I feel I should be able to [...] but I can't see how to do it from the docs.
1212+1313+**🔍 Where should you find it?**
1414+What page of the docs do you expect this information to be found on?
1515+1616+**ℹ️ Additional context**
1717+Add any other context or information.
+21
.github/ISSUE_TEMPLATE/---feature-suggestion.md
···11+---
22+name: "\U0001F195 Feature suggestion"
33+about: Suggest an idea
44+title: 'feat: '
55+labels: enhancement
66+assignees: danielroe
77+88+---
99+1010+**🆒 Your use case**
1111+Add a description of your use case, and how this feature would help you.
1212+> Ex. When I do [...] I would expect to be able to do [...]
1313+1414+**🆕 The solution you'd like**
1515+Describe what you want to happen.
1616+1717+**🔍 Alternatives you've considered**
1818+Have you considered any alternative solutions or features?
1919+2020+**ℹ️ Additional info**
2121+Is there any other context you think would be helpful to know?
+16
.github/ISSUE_TEMPLATE/---help-wanted.md
···11+---
22+name: "\U0001F198 Help"
33+about: I need help with ...
44+title: 'help: '
55+labels: help
66+assignees: danielroe
77+---
88+99+**📚 What are you trying to do? Please describe.**
1010+A clear and concise description of your objective. Ex. I'm not sure how to [...].
1111+1212+**🔍 What have you tried?**
1313+Have you looked through the docs? Tried different approaches? The more detail the better.
1414+1515+**ℹ️ Additional context**
1616+Add any other context or information.
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require eslint/bin/eslint.js
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real eslint/bin/eslint.js your application uses
2020+module.exports = absRequire(`eslint/bin/eslint.js`);
+20
.yarn/sdks/eslint/lib/api.js
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require eslint/lib/api.js
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real eslint/lib/api.js your application uses
2020+module.exports = absRequire(`eslint/lib/api.js`);
+20
.yarn/sdks/typescript/bin/tsc
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require typescript/bin/tsc
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real typescript/bin/tsc your application uses
2020+module.exports = absRequire(`typescript/bin/tsc`);
+20
.yarn/sdks/typescript/bin/tsserver
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require typescript/bin/tsserver
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real typescript/bin/tsserver your application uses
2020+module.exports = absRequire(`typescript/bin/tsserver`);
+20
.yarn/sdks/typescript/lib/tsc.js
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require typescript/lib/tsc.js
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real typescript/lib/tsc.js your application uses
2020+module.exports = absRequire(`typescript/lib/tsc.js`);
+111
.yarn/sdks/typescript/lib/tsserver.js
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+const moduleWrapper = tsserver => {
1313+ const {isAbsolute} = require(`path`);
1414+ const pnpApi = require(`pnpapi`);
1515+1616+ const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
1717+ return `${locator.name}@${locator.reference}`;
1818+ }));
1919+2020+ // VSCode sends the zip paths to TS using the "zip://" prefix, that TS
2121+ // doesn't understand. This layer makes sure to remove the protocol
2222+ // before forwarding it to TS, and to add it back on all returned paths.
2323+2424+ function toEditorPath(str) {
2525+ // We add the `zip:` prefix to both `.zip/` paths and virtual paths
2626+ if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || str.match(/\$\$virtual\//))) {
2727+ // We also take the opportunity to turn virtual paths into physical ones;
2828+ // this makes is much easier to work with workspaces that list peer
2929+ // dependencies, since otherwise Ctrl+Click would bring us to the virtual
3030+ // file instances instead of the real ones.
3131+ //
3232+ // We only do this to modules owned by the the dependency tree roots.
3333+ // This avoids breaking the resolution when jumping inside a vendor
3434+ // with peer dep (otherwise jumping into react-dom would show resolution
3535+ // errors on react).
3636+ //
3737+ const resolved = pnpApi.resolveVirtual(str);
3838+ if (resolved) {
3939+ const locator = pnpApi.findPackageLocator(resolved);
4040+ if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
4141+ str = resolved;
4242+ }
4343+ }
4444+4545+ str = str.replace(/\\/g, `/`)
4646+ str = str.replace(/^\/?/, `/`);
4747+4848+ // Absolute VSCode `Uri.fsPath`s need to start with a slash.
4949+ // VSCode only adds it automatically for supported schemes,
5050+ // so we have to do it manually for the `zip` scheme.
5151+ // The path needs to start with a caret otherwise VSCode doesn't handle the protocol
5252+ //
5353+ // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
5454+ //
5555+ if (str.match(/\.zip\//)) {
5656+ str = `${isVSCode ? `^` : ``}zip:${str}`;
5757+ }
5858+ }
5959+6060+ return str;
6161+ }
6262+6363+ function fromEditorPath(str) {
6464+ return process.platform === `win32`
6565+ ? str.replace(/^\^?zip:\//, ``)
6666+ : str.replace(/^\^?zip:/, ``);
6767+ }
6868+6969+ // And here is the point where we hijack the VSCode <-> TS communications
7070+ // by adding ourselves in the middle. We locate everything that looks
7171+ // like an absolute path of ours and normalize it.
7272+7373+ const Session = tsserver.server.Session;
7474+ const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
7575+ let isVSCode = false;
7676+7777+ return Object.assign(Session.prototype, {
7878+ onMessage(/** @type {string} */ message) {
7979+ const parsedMessage = JSON.parse(message)
8080+8181+ if (
8282+ parsedMessage != null &&
8383+ typeof parsedMessage === `object` &&
8484+ parsedMessage.arguments &&
8585+ parsedMessage.arguments.hostInfo === `vscode`
8686+ ) {
8787+ isVSCode = true;
8888+ }
8989+9090+ return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
9191+ return typeof value === `string` ? fromEditorPath(value) : value;
9292+ }));
9393+ },
9494+9595+ send(/** @type {any} */ msg) {
9696+ return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
9797+ return typeof value === `string` ? toEditorPath(value) : value;
9898+ })));
9999+ }
100100+ });
101101+};
102102+103103+if (existsSync(absPnpApiPath)) {
104104+ if (!process.versions.pnp) {
105105+ // Setup the environment to be able to require typescript/lib/tsserver.js
106106+ require(absPnpApiPath).setup();
107107+ }
108108+}
109109+110110+// Defer to the real typescript/lib/tsserver.js your application uses
111111+module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
+20
.yarn/sdks/typescript/lib/typescript.js
···11+#!/usr/bin/env node
22+33+const {existsSync} = require(`fs`);
44+const {createRequire, createRequireFromPath} = require(`module`);
55+const {resolve} = require(`path`);
66+77+const relPnpApiPath = "../../../../.pnp.js";
88+99+const absPnpApiPath = resolve(__dirname, relPnpApiPath);
1010+const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
1111+1212+if (existsSync(absPnpApiPath)) {
1313+ if (!process.versions.pnp) {
1414+ // Setup the environment to be able to require typescript/lib/typescript.js
1515+ require(absPnpApiPath).setup();
1616+ }
1717+}
1818+1919+// Defer to the real typescript/lib/typescript.js your application uses
2020+module.exports = absRequire(`typescript/lib/typescript.js`);