create-leo-app 0.7.3 → 0.8.4

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 (280) hide show
  1. package/README.md +3 -3
  2. package/dist/index.mjs +38 -38
  3. package/package.json +5 -7
  4. package/template-extension/package.json +4 -4
  5. package/template-nextjs-ts/package.json +9 -9
  6. package/template-node/package.json +2 -2
  7. package/template-node-ts/package.json +5 -5
  8. package/template-offline-public-transaction-ts/package.json +5 -5
  9. package/template-react-leo/README.md +3 -8
  10. package/template-react-leo/package.json +23 -23
  11. package/template-react-leo/vite.config.js +2 -1
  12. package/template-react-managed-worker/README.md +1 -3
  13. package/template-react-managed-worker/package.json +22 -22
  14. package/template-react-managed-worker/vite.config.js +2 -1
  15. package/template-react-ts/README.md +3 -8
  16. package/template-react-ts/package.json +28 -28
  17. package/template-react-ts/vite.config.ts +2 -1
  18. package/template-vanilla/main.js +1 -1
  19. package/template-vanilla/package.json +3 -3
  20. package/template-vanilla/vite.config.js +3 -1
  21. package/template-nextjs-ts/node_modules/@types/node/LICENSE +0 -21
  22. package/template-nextjs-ts/node_modules/@types/node/README.md +0 -15
  23. package/template-nextjs-ts/node_modules/@types/node/assert/strict.d.ts +0 -8
  24. package/template-nextjs-ts/node_modules/@types/node/assert.d.ts +0 -1040
  25. package/template-nextjs-ts/node_modules/@types/node/async_hooks.d.ts +0 -541
  26. package/template-nextjs-ts/node_modules/@types/node/buffer.d.ts +0 -2301
  27. package/template-nextjs-ts/node_modules/@types/node/child_process.d.ts +0 -1544
  28. package/template-nextjs-ts/node_modules/@types/node/cluster.d.ts +0 -578
  29. package/template-nextjs-ts/node_modules/@types/node/console.d.ts +0 -452
  30. package/template-nextjs-ts/node_modules/@types/node/constants.d.ts +0 -19
  31. package/template-nextjs-ts/node_modules/@types/node/crypto.d.ts +0 -4524
  32. package/template-nextjs-ts/node_modules/@types/node/dgram.d.ts +0 -596
  33. package/template-nextjs-ts/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  34. package/template-nextjs-ts/node_modules/@types/node/dns/promises.d.ts +0 -476
  35. package/template-nextjs-ts/node_modules/@types/node/dns.d.ts +0 -864
  36. package/template-nextjs-ts/node_modules/@types/node/dom-events.d.ts +0 -124
  37. package/template-nextjs-ts/node_modules/@types/node/domain.d.ts +0 -170
  38. package/template-nextjs-ts/node_modules/@types/node/events.d.ts +0 -931
  39. package/template-nextjs-ts/node_modules/@types/node/fs/promises.d.ts +0 -1245
  40. package/template-nextjs-ts/node_modules/@types/node/fs.d.ts +0 -4317
  41. package/template-nextjs-ts/node_modules/@types/node/globals.d.ts +0 -503
  42. package/template-nextjs-ts/node_modules/@types/node/globals.global.d.ts +0 -1
  43. package/template-nextjs-ts/node_modules/@types/node/http.d.ts +0 -1908
  44. package/template-nextjs-ts/node_modules/@types/node/http2.d.ts +0 -2418
  45. package/template-nextjs-ts/node_modules/@types/node/https.d.ts +0 -550
  46. package/template-nextjs-ts/node_modules/@types/node/index.d.ts +0 -89
  47. package/template-nextjs-ts/node_modules/@types/node/inspector.d.ts +0 -3696
  48. package/template-nextjs-ts/node_modules/@types/node/module.d.ts +0 -315
  49. package/template-nextjs-ts/node_modules/@types/node/net.d.ts +0 -999
  50. package/template-nextjs-ts/node_modules/@types/node/os.d.ts +0 -495
  51. package/template-nextjs-ts/node_modules/@types/node/package.json +0 -217
  52. package/template-nextjs-ts/node_modules/@types/node/path.d.ts +0 -191
  53. package/template-nextjs-ts/node_modules/@types/node/perf_hooks.d.ts +0 -934
  54. package/template-nextjs-ts/node_modules/@types/node/process.d.ts +0 -1879
  55. package/template-nextjs-ts/node_modules/@types/node/punycode.d.ts +0 -117
  56. package/template-nextjs-ts/node_modules/@types/node/querystring.d.ts +0 -153
  57. package/template-nextjs-ts/node_modules/@types/node/readline/promises.d.ts +0 -150
  58. package/template-nextjs-ts/node_modules/@types/node/readline.d.ts +0 -540
  59. package/template-nextjs-ts/node_modules/@types/node/repl.d.ts +0 -430
  60. package/template-nextjs-ts/node_modules/@types/node/sea.d.ts +0 -153
  61. package/template-nextjs-ts/node_modules/@types/node/stream/consumers.d.ts +0 -12
  62. package/template-nextjs-ts/node_modules/@types/node/stream/promises.d.ts +0 -83
  63. package/template-nextjs-ts/node_modules/@types/node/stream/web.d.ts +0 -521
  64. package/template-nextjs-ts/node_modules/@types/node/stream.d.ts +0 -1707
  65. package/template-nextjs-ts/node_modules/@types/node/string_decoder.d.ts +0 -67
  66. package/template-nextjs-ts/node_modules/@types/node/test.d.ts +0 -1874
  67. package/template-nextjs-ts/node_modules/@types/node/timers/promises.d.ts +0 -97
  68. package/template-nextjs-ts/node_modules/@types/node/timers.d.ts +0 -240
  69. package/template-nextjs-ts/node_modules/@types/node/tls.d.ts +0 -1217
  70. package/template-nextjs-ts/node_modules/@types/node/trace_events.d.ts +0 -197
  71. package/template-nextjs-ts/node_modules/@types/node/tty.d.ts +0 -208
  72. package/template-nextjs-ts/node_modules/@types/node/url.d.ts +0 -952
  73. package/template-nextjs-ts/node_modules/@types/node/util.d.ts +0 -2298
  74. package/template-nextjs-ts/node_modules/@types/node/v8.d.ts +0 -808
  75. package/template-nextjs-ts/node_modules/@types/node/vm.d.ts +0 -924
  76. package/template-nextjs-ts/node_modules/@types/node/wasi.d.ts +0 -181
  77. package/template-nextjs-ts/node_modules/@types/node/worker_threads.d.ts +0 -694
  78. package/template-nextjs-ts/node_modules/@types/node/zlib.d.ts +0 -539
  79. package/template-react-ts/node_modules/@types/node/LICENSE +0 -21
  80. package/template-react-ts/node_modules/@types/node/README.md +0 -15
  81. package/template-react-ts/node_modules/@types/node/assert/strict.d.ts +0 -8
  82. package/template-react-ts/node_modules/@types/node/assert.d.ts +0 -1040
  83. package/template-react-ts/node_modules/@types/node/async_hooks.d.ts +0 -541
  84. package/template-react-ts/node_modules/@types/node/buffer.d.ts +0 -2301
  85. package/template-react-ts/node_modules/@types/node/child_process.d.ts +0 -1544
  86. package/template-react-ts/node_modules/@types/node/cluster.d.ts +0 -578
  87. package/template-react-ts/node_modules/@types/node/console.d.ts +0 -452
  88. package/template-react-ts/node_modules/@types/node/constants.d.ts +0 -19
  89. package/template-react-ts/node_modules/@types/node/crypto.d.ts +0 -4524
  90. package/template-react-ts/node_modules/@types/node/dgram.d.ts +0 -596
  91. package/template-react-ts/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  92. package/template-react-ts/node_modules/@types/node/dns/promises.d.ts +0 -476
  93. package/template-react-ts/node_modules/@types/node/dns.d.ts +0 -864
  94. package/template-react-ts/node_modules/@types/node/dom-events.d.ts +0 -124
  95. package/template-react-ts/node_modules/@types/node/domain.d.ts +0 -170
  96. package/template-react-ts/node_modules/@types/node/events.d.ts +0 -931
  97. package/template-react-ts/node_modules/@types/node/fs/promises.d.ts +0 -1245
  98. package/template-react-ts/node_modules/@types/node/fs.d.ts +0 -4317
  99. package/template-react-ts/node_modules/@types/node/globals.d.ts +0 -503
  100. package/template-react-ts/node_modules/@types/node/globals.global.d.ts +0 -1
  101. package/template-react-ts/node_modules/@types/node/http.d.ts +0 -1908
  102. package/template-react-ts/node_modules/@types/node/http2.d.ts +0 -2418
  103. package/template-react-ts/node_modules/@types/node/https.d.ts +0 -550
  104. package/template-react-ts/node_modules/@types/node/index.d.ts +0 -89
  105. package/template-react-ts/node_modules/@types/node/inspector.d.ts +0 -3696
  106. package/template-react-ts/node_modules/@types/node/module.d.ts +0 -315
  107. package/template-react-ts/node_modules/@types/node/net.d.ts +0 -999
  108. package/template-react-ts/node_modules/@types/node/os.d.ts +0 -495
  109. package/template-react-ts/node_modules/@types/node/package.json +0 -217
  110. package/template-react-ts/node_modules/@types/node/path.d.ts +0 -191
  111. package/template-react-ts/node_modules/@types/node/perf_hooks.d.ts +0 -934
  112. package/template-react-ts/node_modules/@types/node/process.d.ts +0 -1879
  113. package/template-react-ts/node_modules/@types/node/punycode.d.ts +0 -117
  114. package/template-react-ts/node_modules/@types/node/querystring.d.ts +0 -153
  115. package/template-react-ts/node_modules/@types/node/readline/promises.d.ts +0 -150
  116. package/template-react-ts/node_modules/@types/node/readline.d.ts +0 -540
  117. package/template-react-ts/node_modules/@types/node/repl.d.ts +0 -430
  118. package/template-react-ts/node_modules/@types/node/sea.d.ts +0 -153
  119. package/template-react-ts/node_modules/@types/node/stream/consumers.d.ts +0 -12
  120. package/template-react-ts/node_modules/@types/node/stream/promises.d.ts +0 -83
  121. package/template-react-ts/node_modules/@types/node/stream/web.d.ts +0 -521
  122. package/template-react-ts/node_modules/@types/node/stream.d.ts +0 -1707
  123. package/template-react-ts/node_modules/@types/node/string_decoder.d.ts +0 -67
  124. package/template-react-ts/node_modules/@types/node/test.d.ts +0 -1874
  125. package/template-react-ts/node_modules/@types/node/timers/promises.d.ts +0 -97
  126. package/template-react-ts/node_modules/@types/node/timers.d.ts +0 -240
  127. package/template-react-ts/node_modules/@types/node/tls.d.ts +0 -1217
  128. package/template-react-ts/node_modules/@types/node/trace_events.d.ts +0 -197
  129. package/template-react-ts/node_modules/@types/node/tty.d.ts +0 -208
  130. package/template-react-ts/node_modules/@types/node/url.d.ts +0 -952
  131. package/template-react-ts/node_modules/@types/node/util.d.ts +0 -2298
  132. package/template-react-ts/node_modules/@types/node/v8.d.ts +0 -808
  133. package/template-react-ts/node_modules/@types/node/vm.d.ts +0 -924
  134. package/template-react-ts/node_modules/@types/node/wasi.d.ts +0 -181
  135. package/template-react-ts/node_modules/@types/node/worker_threads.d.ts +0 -694
  136. package/template-react-ts/node_modules/@types/node/zlib.d.ts +0 -539
  137. package/template-react-ts/node_modules/diff/CONTRIBUTING.md +0 -39
  138. package/template-react-ts/node_modules/diff/LICENSE +0 -31
  139. package/template-react-ts/node_modules/diff/README.md +0 -207
  140. package/template-react-ts/node_modules/diff/dist/diff.js +0 -1585
  141. package/template-react-ts/node_modules/diff/dist/diff.min.js +0 -38
  142. package/template-react-ts/node_modules/diff/lib/convert/dmp.js +0 -32
  143. package/template-react-ts/node_modules/diff/lib/convert/xml.js +0 -42
  144. package/template-react-ts/node_modules/diff/lib/diff/array.js +0 -45
  145. package/template-react-ts/node_modules/diff/lib/diff/base.js +0 -304
  146. package/template-react-ts/node_modules/diff/lib/diff/character.js +0 -37
  147. package/template-react-ts/node_modules/diff/lib/diff/css.js +0 -41
  148. package/template-react-ts/node_modules/diff/lib/diff/json.js +0 -163
  149. package/template-react-ts/node_modules/diff/lib/diff/line.js +0 -89
  150. package/template-react-ts/node_modules/diff/lib/diff/sentence.js +0 -41
  151. package/template-react-ts/node_modules/diff/lib/diff/word.js +0 -107
  152. package/template-react-ts/node_modules/diff/lib/index.es6.js +0 -1519
  153. package/template-react-ts/node_modules/diff/lib/index.js +0 -216
  154. package/template-react-ts/node_modules/diff/lib/patch/apply.js +0 -243
  155. package/template-react-ts/node_modules/diff/lib/patch/create.js +0 -247
  156. package/template-react-ts/node_modules/diff/lib/patch/merge.js +0 -609
  157. package/template-react-ts/node_modules/diff/lib/patch/parse.js +0 -156
  158. package/template-react-ts/node_modules/diff/lib/util/array.js +0 -32
  159. package/template-react-ts/node_modules/diff/lib/util/distance-iterator.js +0 -57
  160. package/template-react-ts/node_modules/diff/lib/util/params.js +0 -24
  161. package/template-react-ts/node_modules/diff/package.json +0 -73
  162. package/template-react-ts/node_modules/diff/release-notes.md +0 -261
  163. package/template-react-ts/node_modules/diff/runtime.js +0 -3
  164. package/template-react-ts/node_modules/ts-node/LICENSE +0 -21
  165. package/template-react-ts/node_modules/ts-node/README.md +0 -1442
  166. package/template-react-ts/node_modules/ts-node/child-loader.mjs +0 -8
  167. package/template-react-ts/node_modules/ts-node/dist/bin-cwd.d.ts +0 -2
  168. package/template-react-ts/node_modules/ts-node/dist/bin-cwd.js +0 -6
  169. package/template-react-ts/node_modules/ts-node/dist/bin-cwd.js.map +0 -1
  170. package/template-react-ts/node_modules/ts-node/dist/bin-esm.d.ts +0 -2
  171. package/template-react-ts/node_modules/ts-node/dist/bin-esm.js +0 -6
  172. package/template-react-ts/node_modules/ts-node/dist/bin-esm.js.map +0 -1
  173. package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.d.ts +0 -2
  174. package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.js +0 -7
  175. package/template-react-ts/node_modules/ts-node/dist/bin-script-deprecated.js.map +0 -1
  176. package/template-react-ts/node_modules/ts-node/dist/bin-script.d.ts +0 -2
  177. package/template-react-ts/node_modules/ts-node/dist/bin-script.js +0 -6
  178. package/template-react-ts/node_modules/ts-node/dist/bin-script.js.map +0 -1
  179. package/template-react-ts/node_modules/ts-node/dist/bin-transpile.d.ts +0 -2
  180. package/template-react-ts/node_modules/ts-node/dist/bin-transpile.js +0 -6
  181. package/template-react-ts/node_modules/ts-node/dist/bin-transpile.js.map +0 -1
  182. package/template-react-ts/node_modules/ts-node/dist/bin.d.ts +0 -11
  183. package/template-react-ts/node_modules/ts-node/dist/bin.js +0 -581
  184. package/template-react-ts/node_modules/ts-node/dist/bin.js.map +0 -1
  185. package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.d.ts +0 -1
  186. package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.js +0 -19
  187. package/template-react-ts/node_modules/ts-node/dist/child/argv-payload.js.map +0 -1
  188. package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.d.ts +0 -1
  189. package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.js +0 -24
  190. package/template-react-ts/node_modules/ts-node/dist/child/child-entrypoint.js.map +0 -1
  191. package/template-react-ts/node_modules/ts-node/dist/child/child-loader.d.ts +0 -1
  192. package/template-react-ts/node_modules/ts-node/dist/child/child-loader.js +0 -32
  193. package/template-react-ts/node_modules/ts-node/dist/child/child-loader.js.map +0 -1
  194. package/template-react-ts/node_modules/ts-node/dist/child/child-require.d.ts +0 -7
  195. package/template-react-ts/node_modules/ts-node/dist/child/child-require.js +0 -22
  196. package/template-react-ts/node_modules/ts-node/dist/child/child-require.js.map +0 -1
  197. package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.d.ts +0 -1
  198. package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.js +0 -49
  199. package/template-react-ts/node_modules/ts-node/dist/child/spawn-child.js.map +0 -1
  200. package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.d.ts +0 -1
  201. package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.js +0 -29
  202. package/template-react-ts/node_modules/ts-node/dist/cjs-resolve-hooks.js.map +0 -1
  203. package/template-react-ts/node_modules/ts-node/dist/configuration.d.ts +0 -1
  204. package/template-react-ts/node_modules/ts-node/dist/configuration.js +0 -308
  205. package/template-react-ts/node_modules/ts-node/dist/configuration.js.map +0 -1
  206. package/template-react-ts/node_modules/ts-node/dist/esm.d.ts +0 -53
  207. package/template-react-ts/node_modules/ts-node/dist/esm.js +0 -228
  208. package/template-react-ts/node_modules/ts-node/dist/esm.js.map +0 -1
  209. package/template-react-ts/node_modules/ts-node/dist/file-extensions.d.ts +0 -1
  210. package/template-react-ts/node_modules/ts-node/dist/file-extensions.js +0 -133
  211. package/template-react-ts/node_modules/ts-node/dist/file-extensions.js.map +0 -1
  212. package/template-react-ts/node_modules/ts-node/dist/index.d.ts +0 -332
  213. package/template-react-ts/node_modules/ts-node/dist/index.js +0 -953
  214. package/template-react-ts/node_modules/ts-node/dist/index.js.map +0 -1
  215. package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.d.ts +0 -1
  216. package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.js +0 -64
  217. package/template-react-ts/node_modules/ts-node/dist/module-type-classifier.js.map +0 -1
  218. package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.d.ts +0 -1
  219. package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.js +0 -39
  220. package/template-react-ts/node_modules/ts-node/dist/node-module-type-classifier.js.map +0 -1
  221. package/template-react-ts/node_modules/ts-node/dist/repl.d.ts +0 -78
  222. package/template-react-ts/node_modules/ts-node/dist/repl.js +0 -561
  223. package/template-react-ts/node_modules/ts-node/dist/repl.js.map +0 -1
  224. package/template-react-ts/node_modules/ts-node/dist/resolver-functions.d.ts +0 -1
  225. package/template-react-ts/node_modules/ts-node/dist/resolver-functions.js +0 -143
  226. package/template-react-ts/node_modules/ts-node/dist/resolver-functions.js.map +0 -1
  227. package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.d.ts +0 -11
  228. package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.js +0 -218
  229. package/template-react-ts/node_modules/ts-node/dist/transpilers/swc.js.map +0 -1
  230. package/template-react-ts/node_modules/ts-node/dist/transpilers/types.d.ts +0 -35
  231. package/template-react-ts/node_modules/ts-node/dist/transpilers/types.js +0 -3
  232. package/template-react-ts/node_modules/ts-node/dist/transpilers/types.js.map +0 -1
  233. package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.d.ts +0 -63
  234. package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.js +0 -3
  235. package/template-react-ts/node_modules/ts-node/dist/ts-compiler-types.js.map +0 -1
  236. package/template-react-ts/node_modules/ts-node/dist/ts-internals.d.ts +0 -6
  237. package/template-react-ts/node_modules/ts-node/dist/ts-internals.js +0 -321
  238. package/template-react-ts/node_modules/ts-node/dist/ts-internals.js.map +0 -1
  239. package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.d.ts +0 -1
  240. package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.js +0 -100
  241. package/template-react-ts/node_modules/ts-node/dist/ts-transpile-module.js.map +0 -1
  242. package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.d.ts +0 -13
  243. package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.js +0 -3
  244. package/template-react-ts/node_modules/ts-node/dist/tsconfig-schema.js.map +0 -1
  245. package/template-react-ts/node_modules/ts-node/dist/tsconfigs.d.ts +0 -1
  246. package/template-react-ts/node_modules/ts-node/dist/tsconfigs.js +0 -36
  247. package/template-react-ts/node_modules/ts-node/dist/tsconfigs.js.map +0 -1
  248. package/template-react-ts/node_modules/ts-node/dist/util.d.ts +0 -4
  249. package/template-react-ts/node_modules/ts-node/dist/util.js +0 -175
  250. package/template-react-ts/node_modules/ts-node/dist/util.js.map +0 -1
  251. package/template-react-ts/node_modules/ts-node/dist-raw/NODE-LICENSE.md +0 -24
  252. package/template-react-ts/node_modules/ts-node/dist-raw/README.md +0 -36
  253. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-constants.js +0 -4
  254. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-errors.js +0 -82
  255. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-cjs-helpers.js +0 -89
  256. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-cjs-loader.js +0 -593
  257. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-esm-get_format.js +0 -106
  258. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js +0 -962
  259. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-modules-package_json_reader.js +0 -44
  260. package/template-react-ts/node_modules/ts-node/dist-raw/node-internal-repl-await.js +0 -254
  261. package/template-react-ts/node_modules/ts-node/dist-raw/node-internalBinding-fs.js +0 -58
  262. package/template-react-ts/node_modules/ts-node/dist-raw/node-nativemodule.js +0 -9
  263. package/template-react-ts/node_modules/ts-node/dist-raw/node-options.js +0 -103
  264. package/template-react-ts/node_modules/ts-node/dist-raw/node-primordials.js +0 -37
  265. package/template-react-ts/node_modules/ts-node/dist-raw/runmain-hack.js +0 -9
  266. package/template-react-ts/node_modules/ts-node/esm/transpile-only.mjs +0 -8
  267. package/template-react-ts/node_modules/ts-node/esm.mjs +0 -8
  268. package/template-react-ts/node_modules/ts-node/node10/tsconfig.json +0 -3
  269. package/template-react-ts/node_modules/ts-node/node12/tsconfig.json +0 -3
  270. package/template-react-ts/node_modules/ts-node/node14/tsconfig.json +0 -3
  271. package/template-react-ts/node_modules/ts-node/node16/tsconfig.json +0 -3
  272. package/template-react-ts/node_modules/ts-node/package.json +0 -182
  273. package/template-react-ts/node_modules/ts-node/register/files.js +0 -3
  274. package/template-react-ts/node_modules/ts-node/register/index.js +0 -1
  275. package/template-react-ts/node_modules/ts-node/register/transpile-only.js +0 -3
  276. package/template-react-ts/node_modules/ts-node/register/type-check.js +0 -3
  277. package/template-react-ts/node_modules/ts-node/transpilers/swc-experimental.js +0 -1
  278. package/template-react-ts/node_modules/ts-node/transpilers/swc.js +0 -1
  279. package/template-react-ts/node_modules/ts-node/tsconfig.schema.json +0 -183
  280. package/template-react-ts/node_modules/ts-node/tsconfig.schemastore-schema.json +0 -1326
@@ -1,593 +0,0 @@
1
- // Copied from several files in node's source code.
2
- // https://github.com/nodejs/node/blob/2d5d77306f6dff9110c1f77fefab25f973415770/lib/internal/modules/cjs/loader.js
3
- // Each function and variable below must have a comment linking to the source in node's github repo.
4
-
5
- 'use strict';
6
-
7
- const {
8
- ArrayIsArray,
9
- ArrayPrototypeIncludes,
10
- ArrayPrototypeJoin,
11
- ArrayPrototypePush,
12
- JSONParse,
13
- ObjectKeys,
14
- RegExpPrototypeTest,
15
- SafeMap,
16
- SafeWeakMap,
17
- StringPrototypeCharCodeAt,
18
- StringPrototypeEndsWith,
19
- StringPrototypeLastIndexOf,
20
- StringPrototypeIndexOf,
21
- StringPrototypeMatch,
22
- StringPrototypeSlice,
23
- StringPrototypeStartsWith,
24
- } = require('./node-primordials');
25
- const { NativeModule } = require('./node-nativemodule');
26
- const { pathToFileURL, fileURLToPath } = require('url');
27
- const fs = require('fs');
28
- const path = require('path');
29
- const { sep } = path;
30
- const { internalModuleStat } = require('./node-internalBinding-fs');
31
- const packageJsonReader = require('./node-internal-modules-package_json_reader');
32
- const {
33
- cjsConditions,
34
- } = require('./node-internal-modules-cjs-helpers');
35
- const { getOptionValue } = require('./node-options');
36
- const preserveSymlinks = getOptionValue('--preserve-symlinks');
37
- const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
38
- const {normalizeSlashes} = require('../dist/util');
39
- const {createErrRequireEsm} = require('./node-internal-errors');
40
- const {
41
- codes: {
42
- ERR_INVALID_MODULE_SPECIFIER,
43
- },
44
- } = require('./node-internal-errors');
45
-
46
- const {
47
- CHAR_FORWARD_SLASH,
48
- } = require('./node-internal-constants');
49
-
50
- const Module = require('module');
51
-
52
- const isWindows = process.platform === 'win32';
53
-
54
- let statCache = null;
55
-
56
- function stat(filename) {
57
- filename = path.toNamespacedPath(filename);
58
- if (statCache !== null) {
59
- const result = statCache.get(filename);
60
- if (result !== undefined) return result;
61
- }
62
- const result = internalModuleStat(filename);
63
- if (statCache !== null && result >= 0) {
64
- // Only set cache when `internalModuleStat(filename)` succeeds.
65
- statCache.set(filename, result);
66
- }
67
- return result;
68
- }
69
-
70
- // Note:
71
- // we cannot get access to node's internal cache, which is populated from
72
- // within node's Module constructor. So the cache here will always be empty.
73
- // It's possible we could approximate our own cache by building it up with
74
- // hacky workarounds, but it's not worth the complexity and flakiness.
75
- const moduleParentCache = new SafeWeakMap();
76
-
77
- // Given a module name, and a list of paths to test, returns the first
78
- // matching file in the following precedence.
79
- //
80
- // require("a.<ext>")
81
- // -> a.<ext>
82
- //
83
- // require("a")
84
- // -> a
85
- // -> a.<ext>
86
- // -> a/index.<ext>
87
-
88
- const packageJsonCache = new SafeMap();
89
-
90
- function readPackage(requestPath) {
91
- const jsonPath = path.resolve(requestPath, 'package.json');
92
-
93
- const existing = packageJsonCache.get(jsonPath);
94
- if (existing !== undefined) return existing;
95
-
96
- const result = packageJsonReader.read(jsonPath);
97
- const json = result.containsKeys === false ? '{}' : result.string;
98
- if (json === undefined) {
99
- packageJsonCache.set(jsonPath, false);
100
- return false;
101
- }
102
-
103
- try {
104
- const parsed = JSONParse(json);
105
- const filtered = {
106
- name: parsed.name,
107
- main: parsed.main,
108
- exports: parsed.exports,
109
- imports: parsed.imports,
110
- type: parsed.type
111
- };
112
- packageJsonCache.set(jsonPath, filtered);
113
- return filtered;
114
- } catch (e) {
115
- e.path = jsonPath;
116
- e.message = 'Error parsing ' + jsonPath + ': ' + e.message;
117
- throw e;
118
- }
119
- }
120
-
121
- function readPackageScope(checkPath) {
122
- const rootSeparatorIndex = StringPrototypeIndexOf(checkPath, sep);
123
- let separatorIndex;
124
- do {
125
- separatorIndex = StringPrototypeLastIndexOf(checkPath, sep);
126
- checkPath = StringPrototypeSlice(checkPath, 0, separatorIndex);
127
- if (StringPrototypeEndsWith(checkPath, sep + 'node_modules'))
128
- return false;
129
- const pjson = readPackage(checkPath + sep);
130
- if (pjson) return {
131
- data: pjson,
132
- path: checkPath,
133
- };
134
- } while (separatorIndex > rootSeparatorIndex);
135
- return false;
136
- }
137
-
138
- /**
139
- * @param {{
140
- * nodeEsmResolver: ReturnType<typeof import('./node-internal-modules-esm-resolve').createResolve>,
141
- * extensions: import('../src/file-extensions').Extensions,
142
- * preferTsExts
143
- * }} opts
144
- */
145
- function createCjsLoader(opts) {
146
- const {nodeEsmResolver, preferTsExts} = opts;
147
- const {replacementsForCjs, replacementsForJs, replacementsForMjs, replacementsForJsx} = opts.extensions;
148
- const {
149
- encodedSepRegEx,
150
- packageExportsResolve,
151
- packageImportsResolve
152
- } = nodeEsmResolver;
153
-
154
- function tryPackage(requestPath, exts, isMain, originalPath) {
155
- // const pkg = readPackage(requestPath)?.main;
156
- const tmp = readPackage(requestPath)
157
- const pkg = tmp != null ? tmp.main : undefined;
158
-
159
- if (!pkg) {
160
- return tryExtensions(path.resolve(requestPath, 'index'), exts, isMain);
161
- }
162
-
163
- const filename = path.resolve(requestPath, pkg);
164
- let actual = tryReplacementExtensions(filename, isMain) ||
165
- tryFile(filename, isMain) ||
166
- tryExtensions(filename, exts, isMain) ||
167
- tryExtensions(path.resolve(filename, 'index'), exts, isMain);
168
- if (actual === false) {
169
- actual = tryExtensions(path.resolve(requestPath, 'index'), exts, isMain);
170
- if (!actual) {
171
- // eslint-disable-next-line no-restricted-syntax
172
- const err = new Error(
173
- `Cannot find module '${filename}'. ` +
174
- 'Please verify that the package.json has a valid "main" entry'
175
- );
176
- err.code = 'MODULE_NOT_FOUND';
177
- err.path = path.resolve(requestPath, 'package.json');
178
- err.requestPath = originalPath;
179
- // TODO(BridgeAR): Add the requireStack as well.
180
- throw err;
181
- } else {
182
- const jsonPath = path.resolve(requestPath, 'package.json');
183
- process.emitWarning(
184
- `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` +
185
- 'Please either fix that or report it to the module author',
186
- 'DeprecationWarning',
187
- 'DEP0128'
188
- );
189
- }
190
- }
191
- return actual;
192
- }
193
-
194
- // In order to minimize unnecessary lstat() calls,
195
- // this cache is a list of known-real paths.
196
- // Set to an empty Map to reset.
197
- const realpathCache = new SafeMap();
198
-
199
- // Check if the file exists and is not a directory
200
- // if using --preserve-symlinks and isMain is false,
201
- // keep symlinks intact, otherwise resolve to the
202
- // absolute realpath.
203
- function tryFile(requestPath, isMain) {
204
- const rc = stat(requestPath);
205
- if (rc !== 0) return;
206
- if (preserveSymlinks && !isMain) {
207
- return path.resolve(requestPath);
208
- }
209
- return toRealPath(requestPath);
210
- }
211
-
212
- function toRealPath(requestPath) {
213
- return fs.realpathSync(requestPath, {
214
- // [internalFS.realpathCacheKey]: realpathCache
215
- });
216
- }
217
-
218
- function statReplacementExtensions(p) {
219
- const lastDotIndex = p.lastIndexOf('.');
220
- if(lastDotIndex >= 0) {
221
- const ext = p.slice(lastDotIndex);
222
- if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') {
223
- const pathnameWithoutExtension = p.slice(0, lastDotIndex);
224
- const replacementExts =
225
- ext === '.js' ? replacementsForJs
226
- : ext === '.jsx' ? replacementsForJsx
227
- : ext === '.mjs' ? replacementsForMjs
228
- : replacementsForCjs;
229
- for (let i = 0; i < replacementExts.length; i++) {
230
- const filename = pathnameWithoutExtension + replacementExts[i];
231
- const rc = stat(filename);
232
- if (rc === 0) {
233
- return [rc, filename];
234
- }
235
- }
236
- }
237
- }
238
- return [stat(p), p];
239
- }
240
- function tryReplacementExtensions(p, isMain) {
241
- const lastDotIndex = p.lastIndexOf('.');
242
- if(lastDotIndex >= 0) {
243
- const ext = p.slice(lastDotIndex);
244
- if (ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs') {
245
- const pathnameWithoutExtension = p.slice(0, lastDotIndex);
246
- const replacementExts =
247
- ext === '.js' ? replacementsForJs
248
- : ext === '.jsx' ? replacementsForJsx
249
- : ext === '.mjs' ? replacementsForMjs
250
- : replacementsForCjs;
251
- for (let i = 0; i < replacementExts.length; i++) {
252
- const filename = tryFile(pathnameWithoutExtension + replacementExts[i], isMain);
253
- if (filename) {
254
- return filename;
255
- }
256
- }
257
- }
258
- }
259
- return false;
260
- }
261
-
262
- // Given a path, check if the file exists with any of the set extensions
263
- function tryExtensions(p, exts, isMain) {
264
- for (let i = 0; i < exts.length; i++) {
265
- const filename = tryFile(p + exts[i], isMain);
266
-
267
- if (filename) {
268
- return filename;
269
- }
270
- }
271
- return false;
272
- }
273
-
274
- function trySelfParentPath(parent) {
275
- if (!parent) return false;
276
-
277
- if (parent.filename) {
278
- return parent.filename;
279
- } else if (parent.id === '<repl>' || parent.id === 'internal/preload') {
280
- try {
281
- return process.cwd() + path.sep;
282
- } catch {
283
- return false;
284
- }
285
- }
286
- }
287
-
288
- function trySelf(parentPath, request) {
289
- if (!parentPath) return false;
290
-
291
- const { data: pkg, path: pkgPath } = readPackageScope(parentPath) || {};
292
- if (!pkg || pkg.exports === undefined) return false;
293
- if (typeof pkg.name !== 'string') return false;
294
-
295
- let expansion;
296
- if (request === pkg.name) {
297
- expansion = '.';
298
- } else if (StringPrototypeStartsWith(request, `${pkg.name}/`)) {
299
- expansion = '.' + StringPrototypeSlice(request, pkg.name.length);
300
- } else {
301
- return false;
302
- }
303
-
304
- try {
305
- return finalizeEsmResolution(packageExportsResolve(
306
- pathToFileURL(pkgPath + '/package.json'), expansion, pkg,
307
- pathToFileURL(parentPath), cjsConditions).resolved, parentPath, pkgPath);
308
- } catch (e) {
309
- if (e.code === 'ERR_MODULE_NOT_FOUND')
310
- throw createEsmNotFoundErr(request, pkgPath + '/package.json');
311
- throw e;
312
- }
313
- }
314
-
315
- // This only applies to requests of a specific form:
316
- // 1. name/.*
317
- // 2. @scope/name/.*
318
- const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/;
319
- function resolveExports(nmPath, request) {
320
- // The implementation's behavior is meant to mirror resolution in ESM.
321
- const { 1: name, 2: expansion = '' } =
322
- StringPrototypeMatch(request, EXPORTS_PATTERN) || [];
323
- if (!name)
324
- return;
325
- const pkgPath = path.resolve(nmPath, name);
326
- const pkg = readPackage(pkgPath);
327
- // if (pkg?.exports != null) {
328
- if (pkg != null && pkg.exports != null) {
329
- try {
330
- return finalizeEsmResolution(packageExportsResolve(
331
- pathToFileURL(pkgPath + '/package.json'), '.' + expansion, pkg, null,
332
- cjsConditions).resolved, null, pkgPath);
333
- } catch (e) {
334
- if (e.code === 'ERR_MODULE_NOT_FOUND')
335
- throw createEsmNotFoundErr(request, pkgPath + '/package.json');
336
- throw e;
337
- }
338
- }
339
- }
340
-
341
- // Backwards compat for old node versions
342
- const hasModulePathCache = !!require('module')._pathCache;
343
- const Module_pathCache = Object.create(null);
344
- const Module_pathCache_get = hasModulePathCache ? (cacheKey) => Module._pathCache[cacheKey] : (cacheKey) => Module_pathCache[cacheKey];
345
- const Module_pathCache_set = hasModulePathCache ? (cacheKey, value) => (Module._pathCache[cacheKey] = value) : (cacheKey) => (Module_pathCache[cacheKey] = value);
346
-
347
- const trailingSlashRegex = /(?:^|\/)\.?\.$/;
348
- const Module_findPath = function _findPath(request, paths, isMain) {
349
- const absoluteRequest = path.isAbsolute(request);
350
- if (absoluteRequest) {
351
- paths = [''];
352
- } else if (!paths || paths.length === 0) {
353
- return false;
354
- }
355
-
356
- const cacheKey = request + '\x00' + ArrayPrototypeJoin(paths, '\x00');
357
- const entry = Module_pathCache_get(cacheKey);
358
- if (entry)
359
- return entry;
360
-
361
- let exts;
362
- let trailingSlash = request.length > 0 &&
363
- StringPrototypeCharCodeAt(request, request.length - 1) ===
364
- CHAR_FORWARD_SLASH;
365
- if (!trailingSlash) {
366
- trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request);
367
- }
368
-
369
- // For each path
370
- for (let i = 0; i < paths.length; i++) {
371
- // Don't search further if path doesn't exist
372
- const curPath = paths[i];
373
- if (curPath && stat(curPath) < 1) continue;
374
-
375
- if (!absoluteRequest) {
376
- const exportsResolved = resolveExports(curPath, request);
377
- if (exportsResolved)
378
- return exportsResolved;
379
- }
380
-
381
- const _basePath = path.resolve(curPath, request);
382
- let filename;
383
-
384
- const [rc, basePath] = statReplacementExtensions(_basePath);
385
- if (!trailingSlash) {
386
- if (rc === 0) { // File.
387
- if (!isMain) {
388
- if (preserveSymlinks) {
389
- filename = path.resolve(basePath);
390
- } else {
391
- filename = toRealPath(basePath);
392
- }
393
- } else if (preserveSymlinksMain) {
394
- // For the main module, we use the preserveSymlinksMain flag instead
395
- // mainly for backward compatibility, as the preserveSymlinks flag
396
- // historically has not applied to the main module. Most likely this
397
- // was intended to keep .bin/ binaries working, as following those
398
- // symlinks is usually required for the imports in the corresponding
399
- // files to resolve; that said, in some use cases following symlinks
400
- // causes bigger problems which is why the preserveSymlinksMain option
401
- // is needed.
402
- filename = path.resolve(basePath);
403
- } else {
404
- filename = toRealPath(basePath);
405
- }
406
- }
407
-
408
- if (!filename) {
409
- // Try it with each of the extensions
410
- if (exts === undefined)
411
- exts = ObjectKeys(Module._extensions);
412
- filename = tryExtensions(basePath, exts, isMain);
413
- }
414
- }
415
-
416
- if (!filename && rc === 1) { // Directory.
417
- // try it with each of the extensions at "index"
418
- if (exts === undefined)
419
- exts = ObjectKeys(Module._extensions);
420
- filename = tryPackage(basePath, exts, isMain, request);
421
- }
422
-
423
- if (filename) {
424
- Module_pathCache_set(cacheKey, filename);
425
- return filename;
426
- }
427
- }
428
-
429
- return false;
430
- };
431
-
432
- const Module_resolveFilename = function _resolveFilename(request, parent, isMain, options) {
433
- if (StringPrototypeStartsWith(request, 'node:') ||
434
- NativeModule.canBeRequiredByUsers(request)) {
435
- return request;
436
- }
437
-
438
- let paths;
439
-
440
- if (typeof options === 'object' && options !== null) {
441
- if (ArrayIsArray(options.paths)) {
442
- const isRelative = StringPrototypeStartsWith(request, './') ||
443
- StringPrototypeStartsWith(request, '../') ||
444
- ((isWindows && StringPrototypeStartsWith(request, '.\\')) ||
445
- StringPrototypeStartsWith(request, '..\\'));
446
-
447
- if (isRelative) {
448
- paths = options.paths;
449
- } else {
450
- const fakeParent = new Module('', null);
451
-
452
- paths = [];
453
-
454
- for (let i = 0; i < options.paths.length; i++) {
455
- const path = options.paths[i];
456
- fakeParent.paths = Module._nodeModulePaths(path);
457
- const lookupPaths = Module._resolveLookupPaths(request, fakeParent);
458
-
459
- for (let j = 0; j < lookupPaths.length; j++) {
460
- if (!ArrayPrototypeIncludes(paths, lookupPaths[j]))
461
- ArrayPrototypePush(paths, lookupPaths[j]);
462
- }
463
- }
464
- }
465
- } else if (options.paths === undefined) {
466
- paths = Module._resolveLookupPaths(request, parent);
467
- } else {
468
- throw new ERR_INVALID_ARG_VALUE('options.paths', options.paths);
469
- }
470
- } else {
471
- paths = Module._resolveLookupPaths(request, parent);
472
- }
473
-
474
- // if (parent?.filename) {
475
- // node 12 hack
476
- if (parent != null && parent.filename) {
477
- if (request[0] === '#') {
478
- const pkg = readPackageScope(parent.filename) || {};
479
-
480
- // if (pkg.data?.imports != null) {
481
- // node 12 hack
482
- if (pkg.data != null && pkg.data.imports != null) {
483
- try {
484
- return finalizeEsmResolution(
485
- packageImportsResolve(request, pathToFileURL(parent.filename),
486
- cjsConditions), parent.filename,
487
- pkg.path);
488
- } catch (e) {
489
- if (e.code === 'ERR_MODULE_NOT_FOUND')
490
- throw createEsmNotFoundErr(request);
491
- throw e;
492
- }
493
- }
494
- }
495
- }
496
-
497
- // Try module self resolution first
498
- const parentPath = trySelfParentPath(parent);
499
- const selfResolved = trySelf(parentPath, request);
500
- if (selfResolved) {
501
- const cacheKey = request + '\x00' +
502
- (paths.length === 1 ? paths[0] : ArrayPrototypeJoin(paths, '\x00'));
503
- Module._pathCache[cacheKey] = selfResolved;
504
- return selfResolved;
505
- }
506
-
507
- // Look up the filename first, since that's the cache key.
508
- const filename = Module._findPath(request, paths, isMain, false);
509
- if (filename) return filename;
510
- const requireStack = [];
511
- for (let cursor = parent;
512
- cursor;
513
- cursor = moduleParentCache.get(cursor)) {
514
- ArrayPrototypePush(requireStack, cursor.filename || cursor.id);
515
- }
516
- let message = `Cannot find module '${request}'`;
517
- if (requireStack.length > 0) {
518
- message = message + '\nRequire stack:\n- ' +
519
- ArrayPrototypeJoin(requireStack, '\n- ');
520
- }
521
- // eslint-disable-next-line no-restricted-syntax
522
- const err = new Error(message);
523
- err.code = 'MODULE_NOT_FOUND';
524
- err.requireStack = requireStack;
525
- throw err;
526
- };
527
-
528
- function finalizeEsmResolution(resolved, parentPath, pkgPath) {
529
- if (RegExpPrototypeTest(encodedSepRegEx, resolved))
530
- throw new ERR_INVALID_MODULE_SPECIFIER(
531
- resolved, 'must not include encoded "/" or "\\" characters', parentPath);
532
- const filename = fileURLToPath(resolved);
533
- const actual = tryReplacementExtensions(filename) || tryFile(filename);
534
- if (actual)
535
- return actual;
536
- const err = createEsmNotFoundErr(filename,
537
- path.resolve(pkgPath, 'package.json'));
538
- throw err;
539
- }
540
-
541
- function createEsmNotFoundErr(request, path) {
542
- // eslint-disable-next-line no-restricted-syntax
543
- const err = new Error(`Cannot find module '${request}'`);
544
- err.code = 'MODULE_NOT_FOUND';
545
- if (path)
546
- err.path = path;
547
- // TODO(BridgeAR): Add the requireStack as well.
548
- return err;
549
- }
550
-
551
-
552
- return {
553
- Module_findPath,
554
- Module_resolveFilename
555
- }
556
-
557
- }
558
-
559
- /**
560
- * copied from Module._extensions['.js']
561
- * https://github.com/nodejs/node/blob/v15.3.0/lib/internal/modules/cjs/loader.js#L1113-L1120
562
- * @param {import('../src/index').Service} service
563
- * @param {NodeJS.Module} module
564
- * @param {string} filename
565
- */
566
- function assertScriptCanLoadAsCJSImpl(service, module, filename) {
567
- const pkg = readPackageScope(filename);
568
-
569
- // ts-node modification: allow our configuration to override
570
- const tsNodeClassification = service.moduleTypeClassifier.classifyModuleByModuleTypeOverrides(normalizeSlashes(filename));
571
- if(tsNodeClassification.moduleType === 'cjs') return;
572
-
573
- // ignore package.json when file extension is ESM-only or CJS-only
574
- // [MUST_UPDATE_FOR_NEW_FILE_EXTENSIONS]
575
- const lastDotIndex = filename.lastIndexOf('.');
576
- const ext = lastDotIndex >= 0 ? filename.slice(lastDotIndex) : '';
577
-
578
- if((ext === '.cts' || ext === '.cjs') && tsNodeClassification.moduleType === 'auto') return;
579
-
580
- // Function require shouldn't be used in ES modules.
581
- if (ext === '.mts' || ext === '.mjs' || tsNodeClassification.moduleType === 'esm' || (pkg && pkg.data && pkg.data.type === 'module')) {
582
- const parentPath = module.parent && module.parent.filename;
583
- const packageJsonPath = pkg ? path.resolve(pkg.path, 'package.json') : null;
584
- throw createErrRequireEsm(filename, parentPath, packageJsonPath);
585
- }
586
- }
587
-
588
-
589
- module.exports = {
590
- createCjsLoader,
591
- assertScriptCanLoadAsCJSImpl,
592
- readPackageScope
593
- };
@@ -1,106 +0,0 @@
1
- // Copied from https://raw.githubusercontent.com/nodejs/node/v15.3.0/lib/internal/modules/esm/get_format.js
2
-
3
- 'use strict';
4
- const {
5
- RegExpPrototypeExec,
6
- StringPrototypeStartsWith,
7
- } = require('./node-primordials');
8
- const { extname } = require('path');
9
- const { getOptionValue } = require('./node-options');
10
-
11
- const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(s => parseInt(s, 10));
12
- const experimentalJsonModules =
13
- nodeMajor > 17
14
- || (nodeMajor === 17 && nodeMinor >= 5)
15
- || (nodeMajor === 16 && nodeMinor >= 15)
16
- || getOptionValue('--experimental-json-modules');
17
- const experimentalWasmModules = getOptionValue('--experimental-wasm-modules');
18
- const { URL, fileURLToPath } = require('url');
19
- const { ERR_UNKNOWN_FILE_EXTENSION } = require('./node-internal-errors').codes;
20
-
21
- const extensionFormatMap = {
22
- '__proto__': null,
23
- '.cjs': 'commonjs',
24
- '.js': 'module',
25
- '.mjs': 'module'
26
- };
27
-
28
- const legacyExtensionFormatMap = {
29
- '__proto__': null,
30
- '.cjs': 'commonjs',
31
- '.js': 'commonjs',
32
- '.json': 'commonjs',
33
- '.mjs': 'module',
34
- '.node': 'commonjs'
35
- };
36
-
37
- if (experimentalWasmModules)
38
- extensionFormatMap['.wasm'] = legacyExtensionFormatMap['.wasm'] = 'wasm';
39
-
40
- if (experimentalJsonModules)
41
- extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json';
42
-
43
- /**
44
- *
45
- * @param {'node' | 'explicit'} [tsNodeExperimentalSpecifierResolution]
46
- * @param {ReturnType<
47
- * typeof import('../dist-raw/node-internal-modules-esm-resolve').createResolve
48
- * >} nodeEsmResolver
49
- */
50
- function createGetFormat(tsNodeExperimentalSpecifierResolution, nodeEsmResolver) {
51
- // const experimentalSpeciferResolution = tsNodeExperimentalSpecifierResolution ?? getOptionValue('--experimental-specifier-resolution');
52
- let experimentalSpeciferResolution = tsNodeExperimentalSpecifierResolution != null ? tsNodeExperimentalSpecifierResolution : getOptionValue('--experimental-specifier-resolution');
53
- const { getPackageType } = nodeEsmResolver;
54
-
55
- /**
56
- * @param {string} url
57
- * @param {{}} context
58
- * @param {any} defaultGetFormatUnused
59
- * @returns {ReturnType<import('../src/esm').NodeLoaderHooksAPI1.GetFormatHook>}
60
- */
61
- function defaultGetFormat(url, context, defaultGetFormatUnused) {
62
- if (StringPrototypeStartsWith(url, 'node:')) {
63
- return { format: 'builtin' };
64
- }
65
- const parsed = new URL(url);
66
- if (parsed.protocol === 'data:') {
67
- const [ , mime ] = RegExpPrototypeExec(
68
- /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/,
69
- parsed.pathname,
70
- ) || [ null, null, null ];
71
- const format = ({
72
- '__proto__': null,
73
- 'text/javascript': 'module',
74
- 'application/json': experimentalJsonModules ? 'json' : null,
75
- 'application/wasm': experimentalWasmModules ? 'wasm' : null
76
- })[mime] || null;
77
- return { format };
78
- } else if (parsed.protocol === 'file:') {
79
- const ext = extname(parsed.pathname);
80
- let format;
81
- if (ext === '.js') {
82
- format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs';
83
- } else {
84
- format = extensionFormatMap[ext];
85
- }
86
- if (!format) {
87
- if (experimentalSpeciferResolution === 'node') {
88
- process.emitWarning(
89
- 'The Node.js specifier resolution in ESM is experimental.',
90
- 'ExperimentalWarning');
91
- format = legacyExtensionFormatMap[ext];
92
- } else {
93
- throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
94
- }
95
- }
96
- return { format: format || null };
97
- }
98
- return { format: null };
99
- }
100
-
101
- return {defaultGetFormat};
102
- }
103
-
104
- module.exports = {
105
- createGetFormat
106
- };