@asapjs/socket 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/.pnp.cjs +199 -0
  2. package/dist/socket/index.d.ts.map +1 -1
  3. package/dist/socket/index.js +7 -0
  4. package/dist/socket/index.js.map +1 -1
  5. package/dist/types/index.d.ts +2 -0
  6. package/dist/types/index.d.ts.map +1 -1
  7. package/package.json +3 -1
  8. package/.yarn/cache/@asapjs-core-npm-0.0.9-12cd56a7e9-ef1ef42553.zip +0 -0
  9. package/.yarn/cache/@colors-colors-npm-1.5.0-875af3a8b4-d64d5260be.zip +0 -0
  10. package/.yarn/cache/@dabh-diagnostics-npm-2.0.3-0f2cd64f24-4879600c55.zip +0 -0
  11. package/.yarn/cache/@socket.io-component-emitter-npm-3.1.0-3f778351c2-db069d9542.zip +0 -0
  12. package/.yarn/cache/@types-body-parser-npm-1.19.2-f845b7b538-e17840c7d7.zip +0 -0
  13. package/.yarn/cache/@types-connect-npm-3.4.35-7337eee0a3-fe81351470.zip +0 -0
  14. package/.yarn/cache/@types-cookie-npm-0.4.1-274a704dc6-3275534ed6.zip +0 -0
  15. package/.yarn/cache/@types-cors-npm-2.8.13-4b8ac1068f-7ef197ea19.zip +0 -0
  16. package/.yarn/cache/@types-debug-npm-4.1.7-f54c81f8db-0a7b89d8ed.zip +0 -0
  17. package/.yarn/cache/@types-express-npm-4.17.13-0e12fe9c24-12a2a0e6c4.zip +0 -0
  18. package/.yarn/cache/@types-express-serve-static-core-npm-4.17.28-608d4aa166-826489811a.zip +0 -0
  19. package/.yarn/cache/@types-mime-npm-1.3.2-ea71878ab3-0493368244.zip +0 -0
  20. package/.yarn/cache/@types-ms-npm-0.7.31-ea3b89342b-daadd354ae.zip +0 -0
  21. package/.yarn/cache/@types-node-npm-17.0.23-167849e796-a351755473.zip +0 -0
  22. package/.yarn/cache/@types-node-npm-18.11.17-897ad73ae4-1933afd068.zip +0 -0
  23. package/.yarn/cache/@types-qs-npm-6.9.7-4a3e6ca0d0-7fd6f9c250.zip +0 -0
  24. package/.yarn/cache/@types-range-parser-npm-1.2.4-23d797fbde-b7c0dfd508.zip +0 -0
  25. package/.yarn/cache/@types-serve-static-npm-1.13.10-5434e2c519-eaca858739.zip +0 -0
  26. package/.yarn/cache/@types-validator-npm-13.7.2-a51e56b9bb-e679261dd5.zip +0 -0
  27. package/.yarn/cache/accepts-npm-1.3.8-9a812371c9-50c43d32e7.zip +0 -0
  28. package/.yarn/cache/array-flatten-npm-1.1.1-9d94ad5f1d-a9925bf351.zip +0 -0
  29. package/.yarn/cache/async-npm-3.2.3-e9d6b79c88-c4bee57ab2.zip +0 -0
  30. package/.yarn/cache/balanced-match-npm-1.0.2-a53c126459-9706c088a2.zip +0 -0
  31. package/.yarn/cache/base64id-npm-2.0.0-ef4afeee0a-581b1d37e6.zip +0 -0
  32. package/.yarn/cache/body-parser-npm-1.19.2-33c5bfcb21-7f777ea656.zip +0 -0
  33. package/.yarn/cache/body-parser-npm-1.20.0-1820eff49a-12fffdeac8.zip +0 -0
  34. package/.yarn/cache/brace-expansion-npm-1.1.11-fb95eb05ad-faf34a7bb0.zip +0 -0
  35. package/.yarn/cache/bytes-npm-3.1.2-28b8643004-e4bcd3948d.zip +0 -0
  36. package/.yarn/cache/call-bind-npm-1.0.2-c957124861-f8e31de9d1.zip +0 -0
  37. package/.yarn/cache/color-convert-npm-1.9.3-1fe690075e-fd7a64a17c.zip +0 -0
  38. package/.yarn/cache/color-name-npm-1.1.3-728b7b5d39-09c5d3e33d.zip +0 -0
  39. package/.yarn/cache/color-name-npm-1.1.4-025792b0ea-b044585952.zip +0 -0
  40. package/.yarn/cache/color-npm-3.2.1-568cf1014f-f81220e8b7.zip +0 -0
  41. package/.yarn/cache/color-string-npm-1.9.0-75382c0441-93c6678b84.zip +0 -0
  42. package/.yarn/cache/colorspace-npm-1.1.4-f01655548a-bb3934ef3c.zip +0 -0
  43. package/.yarn/cache/concat-map-npm-0.0.1-85a921b7ee-902a9f5d89.zip +0 -0
  44. package/.yarn/cache/content-disposition-npm-0.5.4-2d93678616-afb9d545e2.zip +0 -0
  45. package/.yarn/cache/content-type-npm-1.0.4-3b1a5ca16b-3d93585fda.zip +0 -0
  46. package/.yarn/cache/cookie-npm-0.4.2-7761894d5f-a00833c998.zip +0 -0
  47. package/.yarn/cache/cookie-signature-npm-1.0.6-93f325f7f0-f4e1b0a98a.zip +0 -0
  48. package/.yarn/cache/cors-npm-2.8.5-c9935a2d12-ced838404c.zip +0 -0
  49. package/.yarn/cache/debug-npm-2.6.9-7d4cb597dc-d2f51589ca.zip +0 -0
  50. package/.yarn/cache/debug-npm-4.3.4-4513954577-3dbad3f94e.zip +0 -0
  51. package/.yarn/cache/depd-npm-1.1.2-b0c8414da7-6b406620d2.zip +0 -0
  52. package/.yarn/cache/depd-npm-2.0.0-b6c51a4b43-abbe19c768.zip +0 -0
  53. package/.yarn/cache/destroy-npm-1.0.4-a2203e01cb-da9ab4961d.zip +0 -0
  54. package/.yarn/cache/destroy-npm-1.2.0-6a511802e2-0acb300b74.zip +0 -0
  55. package/.yarn/cache/dottie-npm-2.0.2-ef16765a8f-046a581803.zip +0 -0
  56. package/.yarn/cache/ee-first-npm-1.1.1-33f8535b39-1b4cac778d.zip +0 -0
  57. package/.yarn/cache/enabled-npm-2.0.0-bf5d96c9d8-9d256d89f4.zip +0 -0
  58. package/.yarn/cache/encodeurl-npm-1.0.2-f8c8454c41-e50e3d508c.zip +0 -0
  59. package/.yarn/cache/engine.io-npm-6.2.1-1486b58c4b-626d7a77f2.zip +0 -0
  60. package/.yarn/cache/engine.io-parser-npm-5.0.4-27a510b395-d4ad0cef6f.zip +0 -0
  61. package/.yarn/cache/escape-html-npm-1.0.3-376c22ee74-6213ca9ae0.zip +0 -0
  62. package/.yarn/cache/etag-npm-1.8.1-54a3b989d9-571aeb3dbe.zip +0 -0
  63. package/.yarn/cache/express-npm-4.17.3-889f836f0d-967e53b74a.zip +0 -0
  64. package/.yarn/cache/fecha-npm-4.2.1-40d84f7733-2699347494.zip +0 -0
  65. package/.yarn/cache/finalhandler-npm-1.1.2-55a75d6b53-617880460c.zip +0 -0
  66. package/.yarn/cache/fn.name-npm-1.1.0-b472333184-e357144f48.zip +0 -0
  67. package/.yarn/cache/forwarded-npm-0.2.0-6473dabe35-fd27e2394d.zip +0 -0
  68. package/.yarn/cache/fresh-npm-0.5.2-ad2bb4c0a2-13ea8b08f9.zip +0 -0
  69. package/.yarn/cache/fs-npm-0.0.1-security-5060b47e87-53c6230e1f.zip +0 -0
  70. package/.yarn/cache/fs.realpath-npm-1.0.0-c8f05d8126-99ddea01a7.zip +0 -0
  71. package/.yarn/cache/function-bind-npm-1.1.1-b56b322ae9-b32fbaebb3.zip +0 -0
  72. package/.yarn/cache/get-intrinsic-npm-1.1.1-7e868745da-a9fe2ca8fa.zip +0 -0
  73. package/.yarn/cache/glob-npm-7.2.0-bb4644d239-78a8ea9423.zip +0 -0
  74. package/.yarn/cache/has-npm-1.0.3-b7f00631c1-b9ad53d53b.zip +0 -0
  75. package/.yarn/cache/has-symbols-npm-1.0.3-1986bff2c4-a054c40c63.zip +0 -0
  76. package/.yarn/cache/http-errors-npm-1.8.1-fb60d9f6ae-d3c7e7e776.zip +0 -0
  77. package/.yarn/cache/http-errors-npm-2.0.0-3f1c503428-9b0a378266.zip +0 -0
  78. package/.yarn/cache/http-npm-0.0.1-security-62a9711fac-c45a4e2771.zip +0 -0
  79. package/.yarn/cache/iconv-lite-npm-0.4.24-c5c4ac6695-bd9f120f5a.zip +0 -0
  80. package/.yarn/cache/inflection-npm-1.13.2-85fd80437c-e7ad055938.zip +0 -0
  81. package/.yarn/cache/inflight-npm-1.0.6-ccedb4b908-f4f76aa072.zip +0 -0
  82. package/.yarn/cache/inherits-npm-2.0.4-c66b3957a0-4a48a73384.zip +0 -0
  83. package/.yarn/cache/ipaddr.js-npm-1.9.1-19ae7878b4-f88d382598.zip +0 -0
  84. package/.yarn/cache/is-arrayish-npm-0.3.2-f856180f79-977e64f54d.zip +0 -0
  85. package/.yarn/cache/is-stream-npm-2.0.1-c802db55e7-b8e05ccdf9.zip +0 -0
  86. package/.yarn/cache/jwt-simple-npm-0.5.6-85a0092e17-fa10ffd655.zip +0 -0
  87. package/.yarn/cache/kuler-npm-2.0.0-19e74c9695-9e10b5a165.zip +0 -0
  88. package/.yarn/cache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip +0 -0
  89. package/.yarn/cache/logform-npm-2.4.0-8b1d55d47a-e75ccccc1a.zip +0 -0
  90. package/.yarn/cache/lru-cache-npm-7.8.0-b7fa238db4-7cc046276b.zip +0 -0
  91. package/.yarn/cache/media-typer-npm-0.3.0-8674f8f0f5-af1b38516c.zip +0 -0
  92. package/.yarn/cache/merge-descriptors-npm-1.0.1-615287aaa8-5abc259d2a.zip +0 -0
  93. package/.yarn/cache/methods-npm-1.1.2-92f6fdb39b-0917ff4041.zip +0 -0
  94. package/.yarn/cache/mime-db-npm-1.52.0-b5371d6fd2-0d99a03585.zip +0 -0
  95. package/.yarn/cache/mime-npm-1.6.0-60ae95038a-fef25e3926.zip +0 -0
  96. package/.yarn/cache/mime-types-npm-2.1.35-dd9ea9f3e2-89a5b7f1de.zip +0 -0
  97. package/.yarn/cache/minimatch-npm-3.1.2-9405269906-c154e56640.zip +0 -0
  98. package/.yarn/cache/moment-npm-2.29.2-7e4b405a08-ee850b5776.zip +0 -0
  99. package/.yarn/cache/moment-timezone-npm-0.5.34-e4fe2d01f6-12a1d3d52e.zip +0 -0
  100. package/.yarn/cache/ms-npm-2.0.0-9e1101a471-0e6a22b8b7.zip +0 -0
  101. package/.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip +0 -0
  102. package/.yarn/cache/ms-npm-2.1.3-81ff3cfac1-aa92de6080.zip +0 -0
  103. package/.yarn/cache/negotiator-npm-0.6.3-9d50e36171-b8ffeb1e26.zip +0 -0
  104. package/.yarn/cache/object-assign-npm-4.1.1-1004ad6dec-fcc6e4ea8c.zip +0 -0
  105. package/.yarn/cache/object-inspect-npm-1.12.0-d064fa559a-2b36d4001a.zip +0 -0
  106. package/.yarn/cache/on-finished-npm-2.3.0-4ce92f72c6-1db595bd96.zip +0 -0
  107. package/.yarn/cache/on-finished-npm-2.4.1-907af70f88-d20929a25e.zip +0 -0
  108. package/.yarn/cache/once-npm-1.4.0-ccf03ef07a-cd0a885013.zip +0 -0
  109. package/.yarn/cache/one-time-npm-1.0.0-aeaad5e524-fd008d7e99.zip +0 -0
  110. package/.yarn/cache/parseurl-npm-1.3.3-1542397e00-407cee8e0a.zip +0 -0
  111. package/.yarn/cache/path-is-absolute-npm-1.0.1-31bc695ffd-060840f92c.zip +0 -0
  112. package/.yarn/cache/path-to-regexp-npm-0.1.7-2605347373-69a14ea24d.zip +0 -0
  113. package/.yarn/cache/pg-connection-string-npm-2.5.0-1ee5de9ab9-a6f3a068f7.zip +0 -0
  114. package/.yarn/cache/proxy-addr-npm-2.0.7-dae6552872-29c6990ce9.zip +0 -0
  115. package/.yarn/cache/qs-npm-6.10.3-172e1a3fb7-0fac5e6c71.zip +0 -0
  116. package/.yarn/cache/qs-npm-6.9.7-3f3fa3ac7b-5bbd263332.zip +0 -0
  117. package/.yarn/cache/range-parser-npm-1.2.1-1a470fa390-0a268d4fea.zip +0 -0
  118. package/.yarn/cache/raw-body-npm-2.4.3-8e0a306e17-d2961fa3c7.zip +0 -0
  119. package/.yarn/cache/raw-body-npm-2.5.1-9dd1d9fff9-5362adff15.zip +0 -0
  120. package/.yarn/cache/readable-stream-npm-3.6.0-23a4a5eb56-d4ea81502d.zip +0 -0
  121. package/.yarn/cache/retry-as-promised-npm-5.0.0-305d61b9d1-4d17e0597f.zip +0 -0
  122. package/.yarn/cache/safe-buffer-npm-5.2.1-3481c8aa9b-b99c4b41fd.zip +0 -0
  123. package/.yarn/cache/safe-stable-stringify-npm-2.3.1-5e1888c3a7-a0a0bad029.zip +0 -0
  124. package/.yarn/cache/safer-buffer-npm-2.1.2-8d5c0b705e-cab8f25ae6.zip +0 -0
  125. package/.yarn/cache/semver-npm-7.3.6-9e6a4b1c17-9845f96b22.zip +0 -0
  126. package/.yarn/cache/send-npm-0.17.2-73a3dbeba6-c28f36deb4.zip +0 -0
  127. package/.yarn/cache/sequelize-npm-6.18.0-8dd1e76012-fc540d165e.zip +0 -0
  128. package/.yarn/cache/sequelize-pool-npm-7.1.0-670df81ecb-b11d06d02d.zip +0 -0
  129. package/.yarn/cache/sequelize-typescript-npm-2.1.3-512be8fd59-e6e2757600.zip +0 -0
  130. package/.yarn/cache/serve-static-npm-1.14.2-3ce50bb5ff-d97f3183b1.zip +0 -0
  131. package/.yarn/cache/setprototypeof-npm-1.2.0-0fedbdcd3a-be18cbbf70.zip +0 -0
  132. package/.yarn/cache/side-channel-npm-1.0.4-e1f38b9e06-351e41b947.zip +0 -0
  133. package/.yarn/cache/simple-swizzle-npm-0.2.2-8dee37fad1-a7f3f2ab5c.zip +0 -0
  134. package/.yarn/cache/socket.io-adapter-npm-2.4.0-36a74a6ea1-a84639946d.zip +0 -0
  135. package/.yarn/cache/socket.io-npm-4.5.4-888fc15f6d-b5456d361b.zip +0 -0
  136. package/.yarn/cache/socket.io-parser-npm-4.2.1-7ef513b498-2582202f22.zip +0 -0
  137. package/.yarn/cache/socketio-jwt-auth-npm-0.1.0-b3fd2c6724-430e9d6cc2.zip +0 -0
  138. package/.yarn/cache/stack-trace-npm-0.0.10-9460b173e1-473036ad32.zip +0 -0
  139. package/.yarn/cache/statuses-npm-1.5.0-f88f91b2e9-c469b9519d.zip +0 -0
  140. package/.yarn/cache/statuses-npm-2.0.1-81d2b97fee-18c7623fdb.zip +0 -0
  141. package/.yarn/cache/string_decoder-npm-1.3.0-2422117fd0-8417646695.zip +0 -0
  142. package/.yarn/cache/text-hex-npm-1.0.0-22389e4d56-1138f68adc.zip +0 -0
  143. package/.yarn/cache/toidentifier-npm-1.0.1-f759712599-952c29e2a8.zip +0 -0
  144. package/.yarn/cache/toposort-class-npm-1.0.1-aefabde69e-c5e3229d48.zip +0 -0
  145. package/.yarn/cache/triple-beam-npm-1.3.0-eda4e2a46c-7d7b77d862.zip +0 -0
  146. package/.yarn/cache/type-is-npm-1.6.18-6dee4d4961-2c8e47675d.zip +0 -0
  147. package/.yarn/cache/typescript-npm-4.6.3-1493ebc82b-255bb26c8c.zip +0 -0
  148. package/.yarn/cache/typescript-patch-587448dd9c-6bf45caf84.zip +0 -0
  149. package/.yarn/cache/unpipe-npm-1.0.0-2ed2a3c2bf-4fa18d8d8d.zip +0 -0
  150. package/.yarn/cache/util-deprecate-npm-1.0.2-e3fe1a219c-474acf1146.zip +0 -0
  151. package/.yarn/cache/utils-merge-npm-1.0.1-363bbdfbca-c810954932.zip +0 -0
  152. package/.yarn/cache/uuid-npm-8.3.2-eca0baba53-5575a8a75c.zip +0 -0
  153. package/.yarn/cache/validator-npm-13.7.0-624277e841-2b83283de1.zip +0 -0
  154. package/.yarn/cache/vary-npm-1.1.2-b49f70ae63-ae0123222c.zip +0 -0
  155. package/.yarn/cache/winston-npm-3.7.2-5336ad5eff-f1f1a860d2.zip +0 -0
  156. package/.yarn/cache/winston-transport-npm-4.5.0-e10bfb2169-a56e5678a8.zip +0 -0
  157. package/.yarn/cache/wkx-npm-0.5.0-fca5152cd8-47b27387de.zip +0 -0
  158. package/.yarn/cache/wrappy-npm-1.0.2-916de4d4b3-159da4805f.zip +0 -0
  159. package/.yarn/cache/ws-npm-8.2.3-03a35b8ad7-c869296ccb.zip +0 -0
  160. package/.yarn/cache/xtend-npm-4.0.2-7f2375736e-ac5dfa738b.zip +0 -0
  161. package/.yarn/install-state.gz +0 -0
  162. package/.yarn/sdks/integrations.yml +0 -5
  163. package/.yarn/sdks/typescript/bin/tsc +0 -20
  164. package/.yarn/sdks/typescript/bin/tsserver +0 -20
  165. package/.yarn/sdks/typescript/lib/tsc.js +0 -20
  166. package/.yarn/sdks/typescript/lib/tsserver.js +0 -223
  167. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -223
  168. package/.yarn/sdks/typescript/lib/typescript.js +0 -20
  169. package/.yarn/sdks/typescript/package.json +0 -6
Binary file
@@ -1,5 +0,0 @@
1
- # This file is automatically generated by @yarnpkg/sdks.
2
- # Manual changes might be lost!
3
-
4
- integrations:
5
- - vscode
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const {existsSync} = require(`fs`);
4
- const {createRequire} = require(`module`);
5
- const {resolve} = require(`path`);
6
-
7
- const relPnpApiPath = "../../../../.pnp.cjs";
8
-
9
- const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
- const absRequire = createRequire(absPnpApiPath);
11
-
12
- if (existsSync(absPnpApiPath)) {
13
- if (!process.versions.pnp) {
14
- // Setup the environment to be able to require typescript/bin/tsc
15
- require(absPnpApiPath).setup();
16
- }
17
- }
18
-
19
- // Defer to the real typescript/bin/tsc your application uses
20
- module.exports = absRequire(`typescript/bin/tsc`);
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const {existsSync} = require(`fs`);
4
- const {createRequire} = require(`module`);
5
- const {resolve} = require(`path`);
6
-
7
- const relPnpApiPath = "../../../../.pnp.cjs";
8
-
9
- const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
- const absRequire = createRequire(absPnpApiPath);
11
-
12
- if (existsSync(absPnpApiPath)) {
13
- if (!process.versions.pnp) {
14
- // Setup the environment to be able to require typescript/bin/tsserver
15
- require(absPnpApiPath).setup();
16
- }
17
- }
18
-
19
- // Defer to the real typescript/bin/tsserver your application uses
20
- module.exports = absRequire(`typescript/bin/tsserver`);
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const {existsSync} = require(`fs`);
4
- const {createRequire} = require(`module`);
5
- const {resolve} = require(`path`);
6
-
7
- const relPnpApiPath = "../../../../.pnp.cjs";
8
-
9
- const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
- const absRequire = createRequire(absPnpApiPath);
11
-
12
- if (existsSync(absPnpApiPath)) {
13
- if (!process.versions.pnp) {
14
- // Setup the environment to be able to require typescript/lib/tsc.js
15
- require(absPnpApiPath).setup();
16
- }
17
- }
18
-
19
- // Defer to the real typescript/lib/tsc.js your application uses
20
- module.exports = absRequire(`typescript/lib/tsc.js`);
@@ -1,223 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const {existsSync} = require(`fs`);
4
- const {createRequire} = require(`module`);
5
- const {resolve} = require(`path`);
6
-
7
- const relPnpApiPath = "../../../../.pnp.cjs";
8
-
9
- const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
- const absRequire = createRequire(absPnpApiPath);
11
-
12
- const moduleWrapper = tsserver => {
13
- if (!process.versions.pnp) {
14
- return tsserver;
15
- }
16
-
17
- const {isAbsolute} = require(`path`);
18
- const pnpApi = require(`pnpapi`);
19
-
20
- const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21
- const isPortal = str => str.startsWith("portal:/");
22
- const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
23
-
24
- const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
25
- return `${locator.name}@${locator.reference}`;
26
- }));
27
-
28
- // VSCode sends the zip paths to TS using the "zip://" prefix, that TS
29
- // doesn't understand. This layer makes sure to remove the protocol
30
- // before forwarding it to TS, and to add it back on all returned paths.
31
-
32
- function toEditorPath(str) {
33
- // We add the `zip:` prefix to both `.zip/` paths and virtual paths
34
- if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
35
- // We also take the opportunity to turn virtual paths into physical ones;
36
- // this makes it much easier to work with workspaces that list peer
37
- // dependencies, since otherwise Ctrl+Click would bring us to the virtual
38
- // file instances instead of the real ones.
39
- //
40
- // We only do this to modules owned by the the dependency tree roots.
41
- // This avoids breaking the resolution when jumping inside a vendor
42
- // with peer dep (otherwise jumping into react-dom would show resolution
43
- // errors on react).
44
- //
45
- const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
46
- if (resolved) {
47
- const locator = pnpApi.findPackageLocator(resolved);
48
- if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
49
- str = resolved;
50
- }
51
- }
52
-
53
- str = normalize(str);
54
-
55
- if (str.match(/\.zip\//)) {
56
- switch (hostInfo) {
57
- // Absolute VSCode `Uri.fsPath`s need to start with a slash.
58
- // VSCode only adds it automatically for supported schemes,
59
- // so we have to do it manually for the `zip` scheme.
60
- // The path needs to start with a caret otherwise VSCode doesn't handle the protocol
61
- //
62
- // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
63
- //
64
- // 2021-10-08: VSCode changed the format in 1.61.
65
- // Before | ^zip:/c:/foo/bar.zip/package.json
66
- // After | ^/zip//c:/foo/bar.zip/package.json
67
- //
68
- // 2022-04-06: VSCode changed the format in 1.66.
69
- // Before | ^/zip//c:/foo/bar.zip/package.json
70
- // After | ^/zip/c:/foo/bar.zip/package.json
71
- //
72
- // 2022-05-06: VSCode changed the format in 1.68
73
- // Before | ^/zip/c:/foo/bar.zip/package.json
74
- // After | ^/zip//c:/foo/bar.zip/package.json
75
- //
76
- case `vscode <1.61`: {
77
- str = `^zip:${str}`;
78
- } break;
79
-
80
- case `vscode <1.66`: {
81
- str = `^/zip/${str}`;
82
- } break;
83
-
84
- case `vscode <1.68`: {
85
- str = `^/zip${str}`;
86
- } break;
87
-
88
- case `vscode`: {
89
- str = `^/zip/${str}`;
90
- } break;
91
-
92
- // To make "go to definition" work,
93
- // We have to resolve the actual file system path from virtual path
94
- // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
95
- case `coc-nvim`: {
96
- str = normalize(resolved).replace(/\.zip\//, `.zip::`);
97
- str = resolve(`zipfile:${str}`);
98
- } break;
99
-
100
- // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
101
- // We have to resolve the actual file system path from virtual path,
102
- // everything else is up to neovim
103
- case `neovim`: {
104
- str = normalize(resolved).replace(/\.zip\//, `.zip::`);
105
- str = `zipfile://${str}`;
106
- } break;
107
-
108
- default: {
109
- str = `zip:${str}`;
110
- } break;
111
- }
112
- }
113
- }
114
-
115
- return str;
116
- }
117
-
118
- function fromEditorPath(str) {
119
- switch (hostInfo) {
120
- case `coc-nvim`: {
121
- str = str.replace(/\.zip::/, `.zip/`);
122
- // The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
123
- // So in order to convert it back, we use .* to match all the thing
124
- // before `zipfile:`
125
- return process.platform === `win32`
126
- ? str.replace(/^.*zipfile:\//, ``)
127
- : str.replace(/^.*zipfile:/, ``);
128
- } break;
129
-
130
- case `neovim`: {
131
- str = str.replace(/\.zip::/, `.zip/`);
132
- // The path for neovim is in format of zipfile:///<pwd>/.yarn/...
133
- return str.replace(/^zipfile:\/\//, ``);
134
- } break;
135
-
136
- case `vscode`:
137
- default: {
138
- return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
139
- } break;
140
- }
141
- }
142
-
143
- // Force enable 'allowLocalPluginLoads'
144
- // TypeScript tries to resolve plugins using a path relative to itself
145
- // which doesn't work when using the global cache
146
- // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
147
- // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
148
- // TypeScript already does local loads and if this code is running the user trusts the workspace
149
- // https://github.com/microsoft/vscode/issues/45856
150
- const ConfiguredProject = tsserver.server.ConfiguredProject;
151
- const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
152
- ConfiguredProject.prototype.enablePluginsWithOptions = function() {
153
- this.projectService.allowLocalPluginLoads = true;
154
- return originalEnablePluginsWithOptions.apply(this, arguments);
155
- };
156
-
157
- // And here is the point where we hijack the VSCode <-> TS communications
158
- // by adding ourselves in the middle. We locate everything that looks
159
- // like an absolute path of ours and normalize it.
160
-
161
- const Session = tsserver.server.Session;
162
- const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
163
- let hostInfo = `unknown`;
164
-
165
- Object.assign(Session.prototype, {
166
- onMessage(/** @type {string | object} */ message) {
167
- const isStringMessage = typeof message === 'string';
168
- const parsedMessage = isStringMessage ? JSON.parse(message) : message;
169
-
170
- if (
171
- parsedMessage != null &&
172
- typeof parsedMessage === `object` &&
173
- parsedMessage.arguments &&
174
- typeof parsedMessage.arguments.hostInfo === `string`
175
- ) {
176
- hostInfo = parsedMessage.arguments.hostInfo;
177
- if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
178
- const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
179
- // The RegExp from https://semver.org/ but without the caret at the start
180
- /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
181
- ) ?? []).map(Number)
182
-
183
- if (major === 1) {
184
- if (minor < 61) {
185
- hostInfo += ` <1.61`;
186
- } else if (minor < 66) {
187
- hostInfo += ` <1.66`;
188
- } else if (minor < 68) {
189
- hostInfo += ` <1.68`;
190
- }
191
- }
192
- }
193
- }
194
-
195
- const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
196
- return typeof value === 'string' ? fromEditorPath(value) : value;
197
- });
198
-
199
- return originalOnMessage.call(
200
- this,
201
- isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
202
- );
203
- },
204
-
205
- send(/** @type {any} */ msg) {
206
- return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
207
- return typeof value === `string` ? toEditorPath(value) : value;
208
- })));
209
- }
210
- });
211
-
212
- return tsserver;
213
- };
214
-
215
- if (existsSync(absPnpApiPath)) {
216
- if (!process.versions.pnp) {
217
- // Setup the environment to be able to require typescript/lib/tsserver.js
218
- require(absPnpApiPath).setup();
219
- }
220
- }
221
-
222
- // Defer to the real typescript/lib/tsserver.js your application uses
223
- module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
@@ -1,223 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const {existsSync} = require(`fs`);
4
- const {createRequire} = require(`module`);
5
- const {resolve} = require(`path`);
6
-
7
- const relPnpApiPath = "../../../../.pnp.cjs";
8
-
9
- const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10
- const absRequire = createRequire(absPnpApiPath);
11
-
12
- const moduleWrapper = tsserver => {
13
- if (!process.versions.pnp) {
14
- return tsserver;
15
- }
16
-
17
- const {isAbsolute} = require(`path`);
18
- const pnpApi = require(`pnpapi`);
19
-
20
- const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21
- const isPortal = str => str.startsWith("portal:/");
22
- const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
23
-
24
- const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
25
- return `${locator.name}@${locator.reference}`;
26
- }));
27
-
28
- // VSCode sends the zip paths to TS using the "zip://" prefix, that TS
29
- // doesn't understand. This layer makes sure to remove the protocol
30
- // before forwarding it to TS, and to add it back on all returned paths.
31
-
32
- function toEditorPath(str) {
33
- // We add the `zip:` prefix to both `.zip/` paths and virtual paths
34
- if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
35
- // We also take the opportunity to turn virtual paths into physical ones;
36
- // this makes it much easier to work with workspaces that list peer
37
- // dependencies, since otherwise Ctrl+Click would bring us to the virtual
38
- // file instances instead of the real ones.
39
- //
40
- // We only do this to modules owned by the the dependency tree roots.
41
- // This avoids breaking the resolution when jumping inside a vendor
42
- // with peer dep (otherwise jumping into react-dom would show resolution
43
- // errors on react).
44
- //
45
- const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
46
- if (resolved) {
47
- const locator = pnpApi.findPackageLocator(resolved);
48
- if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
49
- str = resolved;
50
- }
51
- }
52
-
53
- str = normalize(str);
54
-
55
- if (str.match(/\.zip\//)) {
56
- switch (hostInfo) {
57
- // Absolute VSCode `Uri.fsPath`s need to start with a slash.
58
- // VSCode only adds it automatically for supported schemes,
59
- // so we have to do it manually for the `zip` scheme.
60
- // The path needs to start with a caret otherwise VSCode doesn't handle the protocol
61
- //
62
- // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
63
- //
64
- // 2021-10-08: VSCode changed the format in 1.61.
65
- // Before | ^zip:/c:/foo/bar.zip/package.json
66
- // After | ^/zip//c:/foo/bar.zip/package.json
67
- //
68
- // 2022-04-06: VSCode changed the format in 1.66.
69
- // Before | ^/zip//c:/foo/bar.zip/package.json
70
- // After | ^/zip/c:/foo/bar.zip/package.json
71
- //
72
- // 2022-05-06: VSCode changed the format in 1.68
73
- // Before | ^/zip/c:/foo/bar.zip/package.json
74
- // After | ^/zip//c:/foo/bar.zip/package.json
75
- //
76
- case `vscode <1.61`: {
77
- str = `^zip:${str}`;
78
- } break;
79
-
80
- case `vscode <1.66`: {
81
- str = `^/zip/${str}`;
82
- } break;
83
-
84
- case `vscode <1.68`: {
85
- str = `^/zip${str}`;
86
- } break;
87
-
88
- case `vscode`: {
89
- str = `^/zip/${str}`;
90
- } break;
91
-
92
- // To make "go to definition" work,
93
- // We have to resolve the actual file system path from virtual path
94
- // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
95
- case `coc-nvim`: {
96
- str = normalize(resolved).replace(/\.zip\//, `.zip::`);
97
- str = resolve(`zipfile:${str}`);
98
- } break;
99
-
100
- // Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
101
- // We have to resolve the actual file system path from virtual path,
102
- // everything else is up to neovim
103
- case `neovim`: {
104
- str = normalize(resolved).replace(/\.zip\//, `.zip::`);
105
- str = `zipfile://${str}`;
106
- } break;
107
-
108
- default: {
109
- str = `zip:${str}`;
110
- } break;
111
- }
112
- }
113
- }
114
-
115
- return str;
116
- }
117
-
118
- function fromEditorPath(str) {
119
- switch (hostInfo) {
120
- case `coc-nvim`: {
121
- str = str.replace(/\.zip::/, `.zip/`);
122
- // The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
123
- // So in order to convert it back, we use .* to match all the thing
124
- // before `zipfile:`
125
- return process.platform === `win32`
126
- ? str.replace(/^.*zipfile:\//, ``)
127
- : str.replace(/^.*zipfile:/, ``);
128
- } break;
129
-
130
- case `neovim`: {
131
- str = str.replace(/\.zip::/, `.zip/`);
132
- // The path for neovim is in format of zipfile:///<pwd>/.yarn/...
133
- return str.replace(/^zipfile:\/\//, ``);
134
- } break;
135
-
136
- case `vscode`:
137
- default: {
138
- return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
139
- } break;
140
- }
141
- }
142
-
143
- // Force enable 'allowLocalPluginLoads'
144
- // TypeScript tries to resolve plugins using a path relative to itself
145
- // which doesn't work when using the global cache
146
- // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
147
- // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
148
- // TypeScript already does local loads and if this code is running the user trusts the workspace
149
- // https://github.com/microsoft/vscode/issues/45856
150
- const ConfiguredProject = tsserver.server.ConfiguredProject;
151
- const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
152
- ConfiguredProject.prototype.enablePluginsWithOptions = function() {
153
- this.projectService.allowLocalPluginLoads = true;
154
- return originalEnablePluginsWithOptions.apply(this, arguments);
155
- };
156
-
157
- // And here is the point where we hijack the VSCode <-> TS communications
158
- // by adding ourselves in the middle. We locate everything that looks
159
- // like an absolute path of ours and normalize it.
160
-
161
- const Session = tsserver.server.Session;
162
- const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
163
- let hostInfo = `unknown`;
164
-
165
- Object.assign(Session.prototype, {
166
- onMessage(/** @type {string | object} */ message) {
167
- const isStringMessage = typeof message === 'string';
168
- const parsedMessage = isStringMessage ? JSON.parse(message) : message;
169
-
170
- if (
171
- parsedMessage != null &&
172
- typeof parsedMessage === `object` &&
173
- parsedMessage.arguments &&
174
- typeof parsedMessage.arguments.hostInfo === `string`
175
- ) {
176
- hostInfo = parsedMessage.arguments.hostInfo;
177
- if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
178
- const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
179
- // The RegExp from https://semver.org/ but without the caret at the start
180
- /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
181
- ) ?? []).map(Number)
182
-
183
- if (major === 1) {
184
- if (minor < 61) {
185
- hostInfo += ` <1.61`;
186
- } else if (minor < 66) {
187
- hostInfo += ` <1.66`;
188
- } else if (minor < 68) {
189
- hostInfo += ` <1.68`;
190
- }
191
- }
192
- }
193
- }
194
-
195
- const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
196
- return typeof value === 'string' ? fromEditorPath(value) : value;
197
- });
198
-
199
- return originalOnMessage.call(
200
- this,
201
- isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
202
- );
203
- },
204
-
205
- send(/** @type {any} */ msg) {
206
- return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
207
- return typeof value === `string` ? toEditorPath(value) : value;
208
- })));
209
- }
210
- });
211
-
212
- return tsserver;
213
- };
214
-
215
- if (existsSync(absPnpApiPath)) {
216
- if (!process.versions.pnp) {
217
- // Setup the environment to be able to require typescript/lib/tsserverlibrary.js
218
- require(absPnpApiPath).setup();
219
- }
220
- }
221
-
222
- // Defer to the real typescript/lib/tsserverlibrary.js your application uses
223
- module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));