@rindo/core 1.8.12 → 2.5.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 (608) hide show
  1. package/LICENSE.md +27 -27
  2. package/bin/cli.ts +20 -0
  3. package/bin/rindo +51 -22
  4. package/cli/index.cjs +1263 -0
  5. package/cli/index.d.ts +15 -0
  6. package/cli/index.js +1237 -0
  7. package/cli/package.json +14 -0
  8. package/compiler/lib.d.ts +24 -0
  9. package/compiler/lib.dom.d.ts +20230 -0
  10. package/compiler/lib.dom.iterable.d.ts +351 -0
  11. package/compiler/lib.es2015.collection.d.ts +89 -0
  12. package/compiler/lib.es2015.core.d.ts +517 -0
  13. package/compiler/lib.es2015.d.ts +30 -0
  14. package/compiler/lib.es2015.generator.d.ts +79 -0
  15. package/compiler/lib.es2015.iterable.d.ts +505 -0
  16. package/compiler/lib.es2015.promise.d.ts +150 -0
  17. package/compiler/lib.es2015.proxy.d.ts +41 -0
  18. package/compiler/lib.es2015.reflect.d.ts +123 -0
  19. package/compiler/lib.es2015.symbol.d.ts +48 -0
  20. package/compiler/lib.es2015.symbol.wellknown.d.ts +324 -0
  21. package/compiler/lib.es2016.array.include.d.ts +118 -0
  22. package/compiler/lib.es2016.d.ts +22 -0
  23. package/compiler/lib.es2016.full.d.ts +25 -0
  24. package/compiler/lib.es2017.d.ts +26 -0
  25. package/compiler/lib.es2017.full.d.ts +25 -0
  26. package/compiler/lib.es2017.intl.d.ts +32 -0
  27. package/compiler/lib.es2017.object.d.ts +51 -0
  28. package/compiler/lib.es2017.sharedmemory.d.ts +137 -0
  29. package/compiler/lib.es2017.string.d.ts +47 -0
  30. package/compiler/lib.es2017.typedarrays.d.ts +55 -0
  31. package/compiler/lib.es2018.asyncgenerator.d.ts +79 -0
  32. package/compiler/lib.es2018.asynciterable.d.ts +45 -0
  33. package/compiler/lib.es2018.d.ts +26 -0
  34. package/compiler/lib.es2018.full.d.ts +25 -0
  35. package/compiler/lib.es2018.intl.d.ts +61 -0
  36. package/compiler/lib.es2018.promise.d.ts +32 -0
  37. package/compiler/lib.es2018.regexp.d.ts +39 -0
  38. package/compiler/lib.es2019.array.d.ts +85 -0
  39. package/compiler/lib.es2019.d.ts +25 -0
  40. package/compiler/lib.es2019.full.d.ts +25 -0
  41. package/compiler/lib.es2019.object.d.ts +35 -0
  42. package/compiler/lib.es2019.string.d.ts +33 -0
  43. package/compiler/lib.es2019.symbol.d.ts +26 -0
  44. package/compiler/lib.es2020.bigint.d.ts +728 -0
  45. package/compiler/lib.es2020.d.ts +27 -0
  46. package/compiler/lib.es2020.full.d.ts +25 -0
  47. package/compiler/lib.es2020.intl.d.ts +310 -0
  48. package/compiler/lib.es2020.promise.d.ts +50 -0
  49. package/compiler/lib.es2020.sharedmemory.d.ts +99 -0
  50. package/compiler/lib.es2020.string.d.ts +30 -0
  51. package/compiler/lib.es2020.symbol.wellknown.d.ts +39 -0
  52. package/compiler/lib.es5.d.ts +4435 -0
  53. package/compiler/lib.es6.d.ts +25 -0
  54. package/compiler/lib.esnext.d.ts +25 -0
  55. package/compiler/lib.esnext.full.d.ts +25 -0
  56. package/compiler/lib.esnext.intl.d.ts +32 -0
  57. package/compiler/lib.esnext.promise.d.ts +43 -0
  58. package/compiler/lib.esnext.string.d.ts +35 -0
  59. package/compiler/lib.esnext.weakref.d.ts +75 -0
  60. package/compiler/lib.scripthost.d.ts +327 -0
  61. package/compiler/lib.webworker.d.ts +6042 -0
  62. package/compiler/lib.webworker.importscripts.d.ts +26 -0
  63. package/compiler/lib.webworker.iterable.d.ts +166 -0
  64. package/compiler/package.json +8 -6
  65. package/compiler/rindo.d.ts +95 -0
  66. package/compiler/rindo.js +65051 -6657
  67. package/compiler/rindo.min.js +4 -0
  68. package/dependencies.json +103 -0
  69. package/dev-server/client/app-error.d.ts +18 -0
  70. package/dev-server/client/events.d.ts +6 -0
  71. package/dev-server/client/hmr-components.d.ts +1 -0
  72. package/dev-server/client/hmr-external-styles.d.ts +1 -0
  73. package/dev-server/client/hmr-images.d.ts +1 -0
  74. package/dev-server/client/hmr-inline-styles.d.ts +1 -0
  75. package/dev-server/client/hmr-util.d.ts +9 -0
  76. package/dev-server/client/hmr-window.d.ts +10 -0
  77. package/dev-server/client/index.d.ts +6 -0
  78. package/dev-server/client/index.js +808 -0
  79. package/dev-server/client/logger.d.ts +5 -0
  80. package/dev-server/client/package.json +8 -0
  81. package/dev-server/client/progress.d.ts +3 -0
  82. package/dev-server/client/status.d.ts +4 -0
  83. package/dev-server/connector.html +6 -0
  84. package/dev-server/index.d.ts +3 -0
  85. package/dev-server/index.js +264 -0
  86. package/dev-server/open-in-editor-api.js +1 -0
  87. package/dev-server/package.json +8 -0
  88. package/dev-server/server-process.js +1738 -0
  89. package/dev-server/server-worker-thread.js +39 -0
  90. package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
  91. package/{dist/dev-server → dev-server}/templates/initial-load.html +160 -160
  92. package/dev-server/ws.js +1 -0
  93. package/internal/app-data/index.cjs +90 -0
  94. package/internal/app-data/index.d.ts +4 -0
  95. package/internal/{client/build-conditionals.mjs → app-data/index.js} +25 -21
  96. package/internal/app-data/package.json +15 -0
  97. package/internal/client/css-shim.js +4 -0
  98. package/internal/client/{dom.rindo-client.mjs → dom.js} +73 -137
  99. package/{dist/client/index.mjs → internal/client/index.js} +863 -789
  100. package/internal/client/package.json +8 -0
  101. package/internal/client/patch-browser.js +120 -0
  102. package/internal/client/patch-esm.js +23 -0
  103. package/internal/client/polyfills/core-js.js +11 -10
  104. package/internal/client/polyfills/css-shim.js +1 -656
  105. package/internal/client/polyfills/dom.js +79 -146
  106. package/internal/client/polyfills/es5-html-element.js +1 -18
  107. package/internal/client/polyfills/index.js +34 -35
  108. package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +20 -17
  109. package/internal/hydrate/index.js +1097 -0
  110. package/internal/hydrate/package.json +7 -0
  111. package/internal/hydrate/runner.d.ts +217 -0
  112. package/internal/hydrate/runner.js +777 -0
  113. package/internal/hydrate/shadow-css.js +146 -0
  114. package/internal/index.d.ts +4 -18
  115. package/internal/index.js +1 -1
  116. package/internal/package.json +9 -6
  117. package/internal/rindo-core/index.cjs +1 -0
  118. package/internal/rindo-core/index.d.ts +51 -0
  119. package/internal/rindo-core/index.js +15 -0
  120. package/internal/rindo-ext-modules.d.ts +41 -0
  121. package/internal/rindo-private.d.ts +2128 -0
  122. package/internal/rindo-public-compiler.d.ts +2170 -0
  123. package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
  124. package/internal/rindo-public-runtime.d.ts +1555 -0
  125. package/internal/testing/index.js +1055 -0
  126. package/internal/testing/package.json +7 -0
  127. package/internal/testing/shadow-css.js +146 -0
  128. package/mock-doc/index.cjs +4610 -0
  129. package/mock-doc/index.d.ts +916 -0
  130. package/mock-doc/index.js +4574 -2
  131. package/mock-doc/package.json +15 -10
  132. package/package.json +132 -186
  133. package/readme.md +21 -174
  134. package/screenshot/compare/build/app.css +1 -1
  135. package/screenshot/compare/build/app.esm.js +1 -1
  136. package/screenshot/compare/build/app.js +33 -818
  137. package/screenshot/compare/build/{p-113f7459.js → p-081b0641.js} +1 -1
  138. package/screenshot/compare/build/p-227a1e18.entry.js +1 -0
  139. package/screenshot/compare/build/p-2c298727.entry.js +1 -0
  140. package/screenshot/compare/build/p-5479268c.entry.js +1 -0
  141. package/screenshot/compare/build/p-573ec8a4.entry.js +1 -0
  142. package/screenshot/compare/build/p-6ba08604.entry.js +1 -0
  143. package/screenshot/compare/build/p-6bc63295.entry.js +1 -0
  144. package/screenshot/compare/build/p-7a3759fd.entry.js +1 -0
  145. package/screenshot/compare/build/{p-ejpsp3kx.js → p-7b4e3ba7.js} +1 -1
  146. package/screenshot/compare/build/p-988eb362.css +1 -0
  147. package/screenshot/compare/build/p-9b6a9315.js +1 -0
  148. package/screenshot/compare/build/p-b4cc611c.entry.js +1 -0
  149. package/screenshot/compare/build/p-d1bf53f5.entry.js +1 -0
  150. package/screenshot/compare/build/{p-efb0eac6.js → p-e2efe0df.js} +1 -1
  151. package/screenshot/compare/build/p-e8ca6d97.entry.js +1 -0
  152. package/screenshot/compare/build/p-ec2f13e0.entry.js +1 -0
  153. package/screenshot/compare/build/p-f0b99977.entry.js +1 -0
  154. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -0
  155. package/screenshot/compare/build/p-fbbae598.js +1 -0
  156. package/screenshot/compare/host.config.json +14 -14
  157. package/screenshot/compare/index.html +1 -1
  158. package/{dist/screenshot → screenshot}/connector-base.d.ts +1 -1
  159. package/{dist/screenshot → screenshot}/connector-local.d.ts +1 -1
  160. package/screenshot/connector.js +2 -3
  161. package/{dist/screenshot → screenshot}/index.d.ts +1 -1
  162. package/screenshot/index.js +659 -2
  163. package/screenshot/local-connector.js +2 -3
  164. package/screenshot/package.json +15 -13
  165. package/screenshot/pixel-match.js +62 -49
  166. package/screenshot/screenshot-compare.d.ts +3 -0
  167. package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
  168. package/sys/deno/index.js +1785 -0
  169. package/sys/deno/node-compat.js +2654 -0
  170. package/sys/deno/worker.js +44 -0
  171. package/sys/node/autoprefixer.js +8 -0
  172. package/sys/node/glob.js +1 -0
  173. package/sys/node/graceful-fs.js +1 -0
  174. package/sys/node/index.d.ts +18 -0
  175. package/sys/node/index.js +1386 -2
  176. package/sys/node/node-fetch.js +1 -0
  177. package/sys/node/package.json +8 -5
  178. package/sys/node/prompts.js +1 -0
  179. package/sys/node/worker.js +52 -0
  180. package/{dist/testing → testing}/index.d.ts +5 -6
  181. package/testing/index.js +4017 -2
  182. package/testing/jest/jest-config.d.ts +5 -0
  183. package/{dist/testing → testing}/jest/jest-environment.d.ts +4 -2
  184. package/{dist/testing → testing}/jest/jest-preprocessor.d.ts +1 -0
  185. package/{dist/testing → testing}/jest/jest-runner.d.ts +1 -1
  186. package/{dist/testing → testing}/jest/jest-screenshot.d.ts +1 -1
  187. package/{dist/testing → testing}/jest/jest-serializer.d.ts +1 -1
  188. package/testing/jest-environment.js +3 -3
  189. package/testing/jest-preprocessor.js +3 -3
  190. package/testing/jest-preset.js +32 -40
  191. package/testing/jest-runner.js +3 -3
  192. package/testing/jest-setuptestframework.js +3 -3
  193. package/{dist/testing → testing}/matchers/events.d.ts +9 -1
  194. package/{dist/testing → testing}/matchers/index.d.ts +3 -1
  195. package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
  196. package/testing/mock-fetch.d.ts +11 -0
  197. package/testing/mocks.d.ts +14 -0
  198. package/testing/package.json +8 -6
  199. package/testing/puppeteer/index.d.ts +2 -0
  200. package/{dist/testing → testing}/puppeteer/puppeteer-browser.d.ts +3 -3
  201. package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +18 -18
  202. package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +7 -5
  203. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  204. package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +9 -9
  205. package/testing/puppeteer/puppeteer-page.d.ts +2 -0
  206. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  207. package/testing/reset-build-conditionals.d.ts +2 -0
  208. package/testing/spec-page.d.ts +2 -0
  209. package/testing/test-transpile.d.ts +2 -0
  210. package/{dist/testing → testing}/testing-logger.d.ts +10 -8
  211. package/testing/testing-sys.d.ts +1 -0
  212. package/{dist/testing → testing}/testing-utils.d.ts +3 -2
  213. package/testing/testing.d.ts +2 -0
  214. package/build-conditionals/index.d.ts +0 -2
  215. package/build-conditionals/index.mjs +0 -66
  216. package/build-conditionals/package.json +0 -6
  217. package/compiler/index.js +0 -2
  218. package/dist/cli/index.js +0 -6068
  219. package/dist/client/css-shim-14a9812e.js +0 -656
  220. package/dist/client/css-shim-69821662.js +0 -658
  221. package/dist/client/declarations/rindo.core.d.ts +0 -1347
  222. package/dist/client/dom-68c8fe31.js +0 -139
  223. package/dist/client/dom-af01458a.js +0 -137
  224. package/dist/client/index.js +0 -2937
  225. package/dist/client/polyfills/core-js.js +0 -10
  226. package/dist/client/polyfills/css-shim.js +0 -656
  227. package/dist/client/polyfills/dom.js +0 -146
  228. package/dist/client/polyfills/es5-html-element.js +0 -18
  229. package/dist/client/polyfills/index.js +0 -35
  230. package/dist/client/polyfills/promise.js +0 -9
  231. package/dist/client/polyfills/system.js +0 -6
  232. package/dist/client/shadow-css-6ef31c68.js +0 -386
  233. package/dist/client/shadow-css-8fd1a9e4.js +0 -388
  234. package/dist/compiler/app-core/app-es5-disabled.d.ts +0 -2
  235. package/dist/compiler/app-core/app-polyfills.d.ts +0 -3
  236. package/dist/compiler/app-core/build-conditionals.d.ts +0 -6
  237. package/dist/compiler/app-core/bundle-app-core.d.ts +0 -6
  238. package/dist/compiler/app-core/component-styles.d.ts +0 -4
  239. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +0 -4
  240. package/dist/compiler/app-core/optimize-module.d.ts +0 -7
  241. package/dist/compiler/browser/build-conditionals-client.d.ts +0 -3
  242. package/dist/compiler/browser/compile-options.d.ts +0 -12
  243. package/dist/compiler/browser/compile.d.ts +0 -2
  244. package/dist/compiler/browser/create-compiler.d.ts +0 -14
  245. package/dist/compiler/browser/index.d.ts +0 -11
  246. package/dist/compiler/build/build-ctx.d.ts +0 -74
  247. package/dist/compiler/build/build-finish.d.ts +0 -3
  248. package/dist/compiler/build/build-hmr.d.ts +0 -2
  249. package/dist/compiler/build/build-results.d.ts +0 -2
  250. package/dist/compiler/build/build-stats.d.ts +0 -3
  251. package/dist/compiler/build/build.d.ts +0 -2
  252. package/dist/compiler/build/cache-stats.d.ts +0 -4
  253. package/dist/compiler/build/compiler-build-id.d.ts +0 -6
  254. package/dist/compiler/build/compiler-ctx.d.ts +0 -44
  255. package/dist/compiler/build/init-index-html.d.ts +0 -2
  256. package/dist/compiler/build/validate-files.d.ts +0 -2
  257. package/dist/compiler/build/write-build.d.ts +0 -2
  258. package/dist/compiler/cache.d.ts +0 -22
  259. package/dist/compiler/compiler.d.ts +0 -27
  260. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +0 -3
  261. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +0 -2
  262. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +0 -2
  263. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +0 -2
  264. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +0 -3
  265. package/dist/compiler/component-lazy/generate-cjs.d.ts +0 -3
  266. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +0 -3
  267. package/dist/compiler/component-lazy/generate-esm.d.ts +0 -3
  268. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +0 -3
  269. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +0 -4
  270. package/dist/compiler/component-lazy/generate-system.d.ts +0 -3
  271. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +0 -2
  272. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +0 -2
  273. package/dist/compiler/component-native/update-to-native-component.d.ts +0 -2
  274. package/dist/compiler/config/config-reload.d.ts +0 -3
  275. package/dist/compiler/config/config-utils.d.ts +0 -4
  276. package/dist/compiler/config/validate-config.d.ts +0 -4
  277. package/dist/compiler/config/validate-copy.d.ts +0 -2
  278. package/dist/compiler/config/validate-dev-server.d.ts +0 -2
  279. package/dist/compiler/config/validate-docs.d.ts +0 -2
  280. package/dist/compiler/config/validate-namespace.d.ts +0 -3
  281. package/dist/compiler/config/validate-output-stats.d.ts +0 -2
  282. package/dist/compiler/config/validate-outputs-angular.d.ts +0 -2
  283. package/dist/compiler/config/validate-outputs-custom.d.ts +0 -2
  284. package/dist/compiler/config/validate-outputs-dist-module.d.ts +0 -2
  285. package/dist/compiler/config/validate-outputs-dist.d.ts +0 -2
  286. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +0 -2
  287. package/dist/compiler/config/validate-outputs-www.d.ts +0 -2
  288. package/dist/compiler/config/validate-outputs.d.ts +0 -2
  289. package/dist/compiler/config/validate-paths.d.ts +0 -2
  290. package/dist/compiler/config/validate-plugins.d.ts +0 -2
  291. package/dist/compiler/config/validate-prerender.d.ts +0 -2
  292. package/dist/compiler/config/validate-rollup-config.d.ts +0 -2
  293. package/dist/compiler/config/validate-service-worker.d.ts +0 -2
  294. package/dist/compiler/config/validate-testing.d.ts +0 -2
  295. package/dist/compiler/config/validate-workers.d.ts +0 -2
  296. package/dist/compiler/copy/assets-copy-tasks.d.ts +0 -3
  297. package/dist/compiler/copy/hashed-copy.d.ts +0 -2
  298. package/dist/compiler/copy/local-copy-tasks.d.ts +0 -3
  299. package/dist/compiler/docs/constants.d.ts +0 -2
  300. package/dist/compiler/docs/custom/index.d.ts +0 -2
  301. package/dist/compiler/docs/docs.d.ts +0 -2
  302. package/dist/compiler/docs/generate-doc-data.d.ts +0 -3
  303. package/dist/compiler/docs/json/index.d.ts +0 -3
  304. package/dist/compiler/docs/readme/docs-util.d.ts +0 -13
  305. package/dist/compiler/docs/readme/index.d.ts +0 -3
  306. package/dist/compiler/docs/readme/markdown-css-props.d.ts +0 -2
  307. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +0 -2
  308. package/dist/compiler/docs/readme/markdown-events.d.ts +0 -2
  309. package/dist/compiler/docs/readme/markdown-methods.d.ts +0 -2
  310. package/dist/compiler/docs/readme/markdown-props.d.ts +0 -2
  311. package/dist/compiler/docs/readme/markdown-slots.d.ts +0 -2
  312. package/dist/compiler/docs/readme/markdown-usage.d.ts +0 -6
  313. package/dist/compiler/docs/readme/output-docs.d.ts +0 -3
  314. package/dist/compiler/docs/style-docs.d.ts +0 -2
  315. package/dist/compiler/docs/vscode/index.d.ts +0 -2
  316. package/dist/compiler/entries/component-bundles.d.ts +0 -3
  317. package/dist/compiler/entries/component-graph.d.ts +0 -2
  318. package/dist/compiler/entries/default-bundles.d.ts +0 -3
  319. package/dist/compiler/entries/entry-modules.d.ts +0 -6
  320. package/dist/compiler/entries/resolve-component-dependencies.d.ts +0 -2
  321. package/dist/compiler/events.d.ts +0 -15
  322. package/dist/compiler/fs-watch/fs-watch-init.d.ts +0 -2
  323. package/dist/compiler/fs-watch/fs-watch-log.d.ts +0 -2
  324. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +0 -7
  325. package/dist/compiler/html/inject-module-preloads.d.ts +0 -3
  326. package/dist/compiler/html/inject-sw-script.d.ts +0 -4
  327. package/dist/compiler/html/inline-esm-import.d.ts +0 -2
  328. package/dist/compiler/html/inline-style-sheets.d.ts +0 -2
  329. package/dist/compiler/html/update-global-styles-link.d.ts +0 -2
  330. package/dist/compiler/html/used-components.d.ts +0 -2
  331. package/dist/compiler/html/utils.d.ts +0 -2
  332. package/dist/compiler/html/validate-manifest-json.d.ts +0 -2
  333. package/dist/compiler/index.d.ts +0 -10
  334. package/dist/compiler/index.js +0 -18008
  335. package/dist/compiler/output-targets/empty-dir.d.ts +0 -6
  336. package/dist/compiler/output-targets/index.d.ts +0 -2
  337. package/dist/compiler/output-targets/output-angular.d.ts +0 -4
  338. package/dist/compiler/output-targets/output-app.d.ts +0 -4
  339. package/dist/compiler/output-targets/output-collection.d.ts +0 -3
  340. package/dist/compiler/output-targets/output-copy.d.ts +0 -2
  341. package/dist/compiler/output-targets/output-custom.d.ts +0 -2
  342. package/dist/compiler/output-targets/output-docs.d.ts +0 -2
  343. package/dist/compiler/output-targets/output-hydrate.d.ts +0 -2
  344. package/dist/compiler/output-targets/output-lazy-loader.d.ts +0 -2
  345. package/dist/compiler/output-targets/output-module.d.ts +0 -4
  346. package/dist/compiler/output-targets/output-prerender.d.ts +0 -2
  347. package/dist/compiler/output-targets/output-service-workers.d.ts +0 -2
  348. package/dist/compiler/output-targets/output-types.d.ts +0 -2
  349. package/dist/compiler/output-targets/output-utils.d.ts +0 -54
  350. package/dist/compiler/output-targets/output-www.d.ts +0 -2
  351. package/dist/compiler/plugin/plugin.d.ts +0 -6
  352. package/dist/compiler/prerender/crawl-urls.d.ts +0 -3
  353. package/dist/compiler/prerender/host-config.d.ts +0 -12
  354. package/dist/compiler/prerender/prerender-config.d.ts +0 -2
  355. package/dist/compiler/prerender/prerender-main.d.ts +0 -2
  356. package/dist/compiler/prerender/prerender-queue.d.ts +0 -3
  357. package/dist/compiler/prerender/prerender-template-html.d.ts +0 -2
  358. package/dist/compiler/prerender/prerendered-write-path.d.ts +0 -2
  359. package/dist/compiler/prerender/robots-txt.d.ts +0 -2
  360. package/dist/compiler/prerender/sitemap-xml.d.ts +0 -3
  361. package/dist/compiler/rollup-plugins/component-entry.d.ts +0 -3
  362. package/dist/compiler/rollup-plugins/css-transformer.d.ts +0 -3
  363. package/dist/compiler/rollup-plugins/global-scripts.d.ts +0 -4
  364. package/dist/compiler/rollup-plugins/image-plugin.d.ts +0 -3
  365. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +0 -3
  366. package/dist/compiler/rollup-plugins/loader.d.ts +0 -4
  367. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +0 -5
  368. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +0 -7
  369. package/dist/compiler/rollup-plugins/rindo-client.d.ts +0 -3
  370. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +0 -2
  371. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +0 -3
  372. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +0 -2
  373. package/dist/compiler/service-worker/generate-sw.d.ts +0 -7
  374. package/dist/compiler/service-worker/service-worker-util.d.ts +0 -2
  375. package/dist/compiler/style/cached-styles.d.ts +0 -5
  376. package/dist/compiler/style/component-styles.d.ts +0 -2
  377. package/dist/compiler/style/css-imports.d.ts +0 -9
  378. package/dist/compiler/style/css-to-esm.d.ts +0 -5
  379. package/dist/compiler/style/generate-styles.d.ts +0 -2
  380. package/dist/compiler/style/global-styles.d.ts +0 -3
  381. package/dist/compiler/style/normalize-styles.d.ts +0 -2
  382. package/dist/compiler/style/optimize-css.d.ts +0 -2
  383. package/dist/compiler/style/scope-css.d.ts +0 -3
  384. package/dist/compiler/style/style-utils.d.ts +0 -10
  385. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +0 -3
  386. package/dist/compiler/transformers/add-component-meta-static.d.ts +0 -4
  387. package/dist/compiler/transformers/add-imports.d.ts +0 -3
  388. package/dist/compiler/transformers/collections/add-external-import.d.ts +0 -2
  389. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +0 -2
  390. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +0 -2
  391. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +0 -7
  392. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +0 -2
  393. package/dist/compiler/transformers/component-build-conditionals.d.ts +0 -2
  394. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +0 -3
  395. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +0 -3
  396. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +0 -2
  397. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +0 -3
  398. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +0 -3
  399. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +0 -3
  400. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +0 -4
  401. package/dist/compiler/transformers/component-native/native-component.d.ts +0 -3
  402. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +0 -3
  403. package/dist/compiler/transformers/component-native/native-constructor.d.ts +0 -3
  404. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +0 -3
  405. package/dist/compiler/transformers/component-native/native-static-style.d.ts +0 -3
  406. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +0 -4
  407. package/dist/compiler/transformers/core-runtime-apis.d.ts +0 -30
  408. package/dist/compiler/transformers/create-event.d.ts +0 -3
  409. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +0 -3
  410. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +0 -3
  411. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +0 -10
  412. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +0 -3
  413. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +0 -4
  414. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +0 -6
  415. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +0 -3
  416. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +0 -4
  417. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +0 -3
  418. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +0 -3
  419. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +0 -3
  420. package/dist/compiler/transformers/define-custom-element.d.ts +0 -3
  421. package/dist/compiler/transformers/host-data-transform.d.ts +0 -3
  422. package/dist/compiler/transformers/legacy-props.d.ts +0 -3
  423. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +0 -2
  424. package/dist/compiler/transformers/reserved-public-members.d.ts +0 -3
  425. package/dist/compiler/transformers/rindo-import-path.d.ts +0 -3
  426. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +0 -3
  427. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +0 -3
  428. package/dist/compiler/transformers/static-to-meta/component.d.ts +0 -3
  429. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +0 -2
  430. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +0 -3
  431. package/dist/compiler/transformers/static-to-meta/events.d.ts +0 -3
  432. package/dist/compiler/transformers/static-to-meta/import.d.ts +0 -3
  433. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +0 -3
  434. package/dist/compiler/transformers/static-to-meta/methods.d.ts +0 -3
  435. package/dist/compiler/transformers/static-to-meta/props.d.ts +0 -3
  436. package/dist/compiler/transformers/static-to-meta/states.d.ts +0 -3
  437. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +0 -3
  438. package/dist/compiler/transformers/static-to-meta/styles.d.ts +0 -3
  439. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +0 -3
  440. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +0 -3
  441. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +0 -3
  442. package/dist/compiler/transformers/style-imports.d.ts +0 -3
  443. package/dist/compiler/transformers/transform-utils.d.ts +0 -31
  444. package/dist/compiler/transformers/update-component-class.d.ts +0 -3
  445. package/dist/compiler/transformers/update-rindo-core-import.d.ts +0 -3
  446. package/dist/compiler/transformers/watcher-meta-transform.d.ts +0 -3
  447. package/dist/compiler/transpile/compiler-options.d.ts +0 -4
  448. package/dist/compiler/transpile/transpile-app.d.ts +0 -2
  449. package/dist/compiler/transpile/transpile-module.d.ts +0 -5
  450. package/dist/compiler/transpile/transpile-service.d.ts +0 -3
  451. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +0 -2
  452. package/dist/compiler/transpile/validate-types-main.d.ts +0 -2
  453. package/dist/compiler/types/generate-app-types.d.ts +0 -2
  454. package/dist/compiler/types/generate-component-types.d.ts +0 -8
  455. package/dist/compiler/types/generate-event-types.d.ts +0 -2
  456. package/dist/compiler/types/generate-method-types.d.ts +0 -2
  457. package/dist/compiler/types/generate-prop-types.d.ts +0 -2
  458. package/dist/compiler/types/generate-types.d.ts +0 -2
  459. package/dist/compiler/types/rindo-types.d.ts +0 -3
  460. package/dist/compiler/types/types-utils.d.ts +0 -4
  461. package/dist/compiler/types/update-import-refs.d.ts +0 -11
  462. package/dist/compiler/types/validate-package-json.d.ts +0 -9
  463. package/dist/declarations/assets.d.ts +0 -17
  464. package/dist/declarations/browser-compile.d.ts +0 -47
  465. package/dist/declarations/build-conditionals.d.ts +0 -91
  466. package/dist/declarations/build-events.d.ts +0 -19
  467. package/dist/declarations/build.d.ts +0 -247
  468. package/dist/declarations/cache.d.ts +0 -11
  469. package/dist/declarations/collection-manifest.d.ts +0 -106
  470. package/dist/declarations/collection.d.ts +0 -139
  471. package/dist/declarations/compiler.d.ts +0 -53
  472. package/dist/declarations/component-compiler-meta.d.ts +0 -198
  473. package/dist/declarations/component-constructor.d.ts +0 -61
  474. package/dist/declarations/component-interfaces.d.ts +0 -123
  475. package/dist/declarations/config.d.ts +0 -409
  476. package/dist/declarations/css-var-shim.d.ts +0 -9
  477. package/dist/declarations/decorators.d.ts +0 -150
  478. package/dist/declarations/dev-server.d.ts +0 -135
  479. package/dist/declarations/diagnostics.d.ts +0 -21
  480. package/dist/declarations/entry.d.ts +0 -28
  481. package/dist/declarations/events.d.ts +0 -13
  482. package/dist/declarations/file-system.d.ts +0 -91
  483. package/dist/declarations/fs-watch.d.ts +0 -15
  484. package/dist/declarations/host-element.d.ts +0 -53
  485. package/dist/declarations/hydrate.d.ts +0 -99
  486. package/dist/declarations/in-memory-fs.d.ts +0 -59
  487. package/dist/declarations/index.d.ts +0 -45
  488. package/dist/declarations/jsdoc.d.ts +0 -16
  489. package/dist/declarations/jsx.d.ts +0 -1050
  490. package/dist/declarations/logger.d.ts +0 -25
  491. package/dist/declarations/minify-js.d.ts +0 -11
  492. package/dist/declarations/module.d.ts +0 -35
  493. package/dist/declarations/optimize-css.d.ts +0 -12
  494. package/dist/declarations/output-targets.d.ts +0 -189
  495. package/dist/declarations/plugin.d.ts +0 -23
  496. package/dist/declarations/prerender.d.ts +0 -79
  497. package/dist/declarations/render.d.ts +0 -62
  498. package/dist/declarations/runtime.d.ts +0 -92
  499. package/dist/declarations/screenshots.d.ts +0 -192
  500. package/dist/declarations/server.d.ts +0 -19
  501. package/dist/declarations/style.d.ts +0 -35
  502. package/dist/declarations/system.d.ts +0 -174
  503. package/dist/declarations/testing.d.ts +0 -523
  504. package/dist/declarations/transpile.d.ts +0 -24
  505. package/dist/declarations/types.d.ts +0 -24
  506. package/dist/declarations/vdom.d.ts +0 -55
  507. package/dist/declarations/worker.d.ts +0 -33
  508. package/dist/dev-server/content-type-db.json +0 -1
  509. package/dist/dev-server/index.js +0 -887
  510. package/dist/dev-server/static/app-error.css +0 -257
  511. package/dist/dev-server/static/dev-server-client.html +0 -13
  512. package/dist/hydrate/index.d.ts +0 -101
  513. package/dist/hydrate/index.mjs +0 -1281
  514. package/dist/hydrate/platform.mjs +0 -347
  515. package/dist/index.d.ts +0 -99
  516. package/dist/index.js +0 -1
  517. package/dist/mock-doc/index.d.ts +0 -851
  518. package/dist/mock-doc/index.js +0 -3982
  519. package/dist/mock-doc/index.mjs +0 -3954
  520. package/dist/runtime/index.js +0 -2576
  521. package/dist/runtime/index.mjs +0 -2521
  522. package/dist/runtime/shadow-css-6ef31c68.js +0 -386
  523. package/dist/runtime/shadow-css-8fd1a9e4.js +0 -388
  524. package/dist/screenshot/index.js +0 -520
  525. package/dist/sys/node/graceful-fs.js +0 -975
  526. package/dist/sys/node/index.js +0 -33545
  527. package/dist/sys/node/node-fetch.js +0 -1779
  528. package/dist/sys/node/open-in-editor.js +0 -734
  529. package/dist/sys/node/sys-worker.js +0 -67035
  530. package/dist/sys/node/websocket.js +0 -3728
  531. package/dist/testing/build-conditionals.d.ts +0 -4
  532. package/dist/testing/build-conditionals.js +0 -43
  533. package/dist/testing/core.d.ts +0 -35
  534. package/dist/testing/core.js +0 -52
  535. package/dist/testing/index.js +0 -40511
  536. package/dist/testing/jest/jest-config.d.ts +0 -4
  537. package/dist/testing/mock-fetch.d.ts +0 -46
  538. package/dist/testing/mocks.d.ts +0 -12
  539. package/dist/testing/platform.d.ts +0 -23
  540. package/dist/testing/platform.js +0 -321
  541. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
  542. package/dist/testing/puppeteer/puppeteer-find.d.ts +0 -5
  543. package/dist/testing/puppeteer/puppeteer-page.d.ts +0 -2
  544. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
  545. package/dist/testing/spec-page.d.ts +0 -5
  546. package/dist/testing/task-queue.d.ts +0 -15
  547. package/dist/testing/test-transpile.d.ts +0 -5
  548. package/dist/testing/testing-fs.d.ts +0 -31
  549. package/dist/testing/testing-sys.d.ts +0 -19
  550. package/dist/testing/testing.d.ts +0 -12
  551. package/dist/utils/index.js +0 -1575
  552. package/dist/utils/index.mjs +0 -1511
  553. package/internal/client/css-shim.rindo-client.mjs +0 -656
  554. package/internal/client/index.mjs +0 -2859
  555. package/internal/client/polyfills/promise.js +0 -9
  556. package/internal/images.d.ts +0 -5
  557. package/runtime/package.json +0 -5
  558. package/screenshot/compare/build/p-020f8d73.js +0 -1
  559. package/screenshot/compare/build/p-09qdknbg.system.entry.js +0 -1
  560. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +0 -1
  561. package/screenshot/compare/build/p-168ec2c4.system.js +0 -1
  562. package/screenshot/compare/build/p-2ab1fdf1.system.js +0 -1
  563. package/screenshot/compare/build/p-2pxcsgrj.entry.js +0 -1
  564. package/screenshot/compare/build/p-42fb7034.system.js +0 -1
  565. package/screenshot/compare/build/p-54d9d7c2.system.js +0 -1
  566. package/screenshot/compare/build/p-67c1f911.js +0 -1
  567. package/screenshot/compare/build/p-68613371.system.js +0 -1
  568. package/screenshot/compare/build/p-7dvsjpu0.entry.js +0 -1
  569. package/screenshot/compare/build/p-aa67fb06.js +0 -1
  570. package/screenshot/compare/build/p-aeb3cec1.system.js +0 -1
  571. package/screenshot/compare/build/p-b6e44a24.js +0 -1
  572. package/screenshot/compare/build/p-c1c25b8a.js +0 -1
  573. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +0 -1
  574. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +0 -1
  575. package/screenshot/compare/build/p-dizjz8rg.entry.js +0 -1
  576. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +0 -1
  577. package/screenshot/compare/build/p-e9670d22.system.js +0 -1
  578. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +0 -1
  579. package/screenshot/compare/build/p-ejwcppol.entry.js +0 -1
  580. package/screenshot/compare/build/p-f6612d5d.system.js +0 -1
  581. package/screenshot/compare/build/p-foiivsfc.css +0 -1
  582. package/screenshot/compare/build/p-gpjjyogx.entry.js +0 -1
  583. package/screenshot/compare/build/p-howklem2.system.entry.js +0 -1
  584. package/screenshot/compare/build/p-knv9wvoc.entry.js +0 -1
  585. package/screenshot/compare/build/p-nsqsfhhy.entry.js +0 -1
  586. package/screenshot/compare/build/p-ojt278pp.entry.js +0 -1
  587. package/screenshot/compare/build/p-oywass99.entry.js +0 -1
  588. package/screenshot/compare/build/p-q3ujhub6.entry.js +0 -1
  589. package/screenshot/compare/build/p-qw4xnmxv.entry.js +0 -1
  590. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +0 -1
  591. package/screenshot/compare/build/p-tnjarrex.system.entry.js +0 -1
  592. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +0 -1
  593. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +0 -1
  594. package/screenshot/compare/build/p-w6bnm16k.entry.js +0 -1
  595. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +0 -1
  596. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +0 -1
  597. package/screenshot/compare/build/p-yh170wkt.entry.js +0 -1
  598. package/testing/jest.preprocessor.js +0 -7
  599. /package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
  600. /package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
  601. /package/{dist/sys/node → dev-server}/xdg-open +0 -0
  602. /package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
  603. /package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
  604. /package/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
  605. /package/{dist/testing → testing}/matchers/attributes.d.ts +0 -0
  606. /package/{dist/testing → testing}/matchers/class-list.d.ts +0 -0
  607. /package/{dist/testing → testing}/matchers/html.d.ts +0 -0
  608. /package/{dist/testing → testing}/matchers/text.d.ts +0 -0
@@ -0,0 +1,1738 @@
1
+ /*!
2
+ Rindo Dev Server Process v2.5.2 | MIT Licensed | https://rindojs.web.app
3
+ */
4
+ 'use strict';
5
+
6
+ const fs$1 = require('../sys/node/graceful-fs.js');
7
+ const path = require('path');
8
+ const util = require('util');
9
+ const zlib = require('zlib');
10
+ const buffer = require('buffer');
11
+ const openInEditorApi = require('./open-in-editor-api.js');
12
+ const http = require('http');
13
+ const https = require('https');
14
+ const net = require('net');
15
+ const index_js = require('../sys/node/index.js');
16
+ const ws = require('./ws.js');
17
+ const childProcess = require('child_process');
18
+ const fs$2 = require('fs');
19
+ const os = require('os');
20
+
21
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
+
23
+ function _interopNamespace(e) {
24
+ if (e && e.__esModule) return e;
25
+ var n = Object.create(null);
26
+ if (e) {
27
+ Object.keys(e).forEach(function (k) {
28
+ if (k !== 'default') {
29
+ var d = Object.getOwnPropertyDescriptor(e, k);
30
+ Object.defineProperty(n, k, d.get ? d : {
31
+ enumerable: true,
32
+ get: function () {
33
+ return e[k];
34
+ }
35
+ });
36
+ }
37
+ });
38
+ }
39
+ n['default'] = e;
40
+ return Object.freeze(n);
41
+ }
42
+
43
+ const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
44
+ const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
45
+ const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
46
+ const zlib__namespace = /*#__PURE__*/_interopNamespace(zlib);
47
+ const openInEditorApi__default = /*#__PURE__*/_interopDefaultLegacy(openInEditorApi);
48
+ const http__namespace = /*#__PURE__*/_interopNamespace(http);
49
+ const https__namespace = /*#__PURE__*/_interopNamespace(https);
50
+ const net__namespace = /*#__PURE__*/_interopNamespace(net);
51
+ const ws__namespace = /*#__PURE__*/_interopNamespace(ws);
52
+ const childProcess__default = /*#__PURE__*/_interopDefaultLegacy(childProcess);
53
+ const fs__default$1 = /*#__PURE__*/_interopDefaultLegacy(fs$2);
54
+ const os__default = /*#__PURE__*/_interopDefaultLegacy(os);
55
+
56
+ const DEV_SERVER_URL = '/~dev-server';
57
+ const DEV_MODULE_URL = '/~dev-module';
58
+ const DEV_SERVER_INIT_URL = `${DEV_SERVER_URL}-init`;
59
+ const OPEN_IN_EDITOR_URL = `${DEV_SERVER_URL}-open-in-editor`;
60
+
61
+ const contentTypes = {"123":"application/vnd.lotus-1-2-3","1km":"application/vnd.1000minds.decision-model+xml","3dml":"text/vnd.in3d.3dml","3ds":"image/x-3ds","3g2":"video/3gpp2","3gp":"video/3gpp","3gpp":"video/3gpp","3mf":"model/3mf","7z":"application/x-7z-compressed","aab":"application/x-authorware-bin","aac":"audio/x-aac","aam":"application/x-authorware-map","aas":"application/x-authorware-seg","abw":"application/x-abiword","ac":"application/vnd.nokia.n-gage.ac+xml","acc":"application/vnd.americandynamics.acc","ace":"application/x-ace-compressed","acu":"application/vnd.acucobol","acutc":"application/vnd.acucorp","adp":"audio/adpcm","aep":"application/vnd.audiograph","afm":"application/x-font-type1","afp":"application/vnd.ibm.modcap","ahead":"application/vnd.ahead.space","ai":"application/postscript","aif":"audio/x-aiff","aifc":"audio/x-aiff","aiff":"audio/x-aiff","air":"application/vnd.adobe.air-application-installer-package+zip","ait":"application/vnd.dvb.ait","ami":"application/vnd.amiga.ami","amr":"audio/amr","apk":"application/vnd.android.package-archive","apng":"image/apng","appcache":"text/cache-manifest","application":"application/x-ms-application","apr":"application/vnd.lotus-approach","arc":"application/x-freearc","arj":"application/x-arj","asc":"application/pgp-signature","asf":"video/x-ms-asf","asm":"text/x-asm","aso":"application/vnd.accpac.simply.aso","asx":"video/x-ms-asf","atc":"application/vnd.acucorp","atom":"application/atom+xml","atomcat":"application/atomcat+xml","atomdeleted":"application/atomdeleted+xml","atomsvc":"application/atomsvc+xml","atx":"application/vnd.antix.game-component","au":"audio/basic","avi":"video/x-msvideo","avif":"image/avif","aw":"application/applixware","azf":"application/vnd.airzip.filesecure.azf","azs":"application/vnd.airzip.filesecure.azs","azv":"image/vnd.airzip.accelerator.azv","azw":"application/vnd.amazon.ebook","b16":"image/vnd.pco.b16","bat":"application/x-msdownload","bcpio":"application/x-bcpio","bdf":"application/x-font-bdf","bdm":"application/vnd.syncml.dm+wbxml","bdoc":"application/x-bdoc","bed":"application/vnd.realvnc.bed","bh2":"application/vnd.fujitsu.oasysprs","bin":"application/octet-stream","blb":"application/x-blorb","blorb":"application/x-blorb","bmi":"application/vnd.bmi","bmml":"application/vnd.balsamiq.bmml+xml","bmp":"image/x-ms-bmp","book":"application/vnd.framemaker","box":"application/vnd.previewsystems.box","boz":"application/x-bzip2","bpk":"application/octet-stream","bsp":"model/vnd.valve.source.compiled-map","btif":"image/prs.btif","buffer":"application/octet-stream","bz":"application/x-bzip","bz2":"application/x-bzip2","c":"text/x-c","c11amc":"application/vnd.cluetrust.cartomobile-config","c11amz":"application/vnd.cluetrust.cartomobile-config-pkg","c4d":"application/vnd.clonk.c4group","c4f":"application/vnd.clonk.c4group","c4g":"application/vnd.clonk.c4group","c4p":"application/vnd.clonk.c4group","c4u":"application/vnd.clonk.c4group","cab":"application/vnd.ms-cab-compressed","caf":"audio/x-caf","cap":"application/vnd.tcpdump.pcap","car":"application/vnd.curl.car","cat":"application/vnd.ms-pki.seccat","cb7":"application/x-cbr","cba":"application/x-cbr","cbr":"application/x-cbr","cbt":"application/x-cbr","cbz":"application/x-cbr","cc":"text/x-c","cco":"application/x-cocoa","cct":"application/x-director","ccxml":"application/ccxml+xml","cdbcmsg":"application/vnd.contact.cmsg","cdf":"application/x-netcdf","cdfx":"application/cdfx+xml","cdkey":"application/vnd.mediastation.cdkey","cdmia":"application/cdmi-capability","cdmic":"application/cdmi-container","cdmid":"application/cdmi-domain","cdmio":"application/cdmi-object","cdmiq":"application/cdmi-queue","cdx":"chemical/x-cdx","cdxml":"application/vnd.chemdraw+xml","cdy":"application/vnd.cinderella","cer":"application/pkix-cert","cfs":"application/x-cfs-compressed","cgm":"image/cgm","chat":"application/x-chat","chm":"application/vnd.ms-htmlhelp","chrt":"application/vnd.kde.kchart","cif":"chemical/x-cif","cii":"application/vnd.anser-web-certificate-issue-initiation","cil":"application/vnd.ms-artgalry","cjs":"application/node","cla":"application/vnd.claymore","class":"application/java-vm","clkk":"application/vnd.crick.clicker.keyboard","clkp":"application/vnd.crick.clicker.palette","clkt":"application/vnd.crick.clicker.template","clkw":"application/vnd.crick.clicker.wordbank","clkx":"application/vnd.crick.clicker","clp":"application/x-msclip","cmc":"application/vnd.cosmocaller","cmdf":"chemical/x-cmdf","cml":"chemical/x-cml","cmp":"application/vnd.yellowriver-custom-menu","cmx":"image/x-cmx","cod":"application/vnd.rim.cod","coffee":"text/coffeescript","com":"application/x-msdownload","conf":"text/plain","cpio":"application/x-cpio","cpp":"text/x-c","cpt":"application/mac-compactpro","crd":"application/x-mscardfile","crl":"application/pkix-crl","crt":"application/x-x509-ca-cert","crx":"application/x-chrome-extension","cryptonote":"application/vnd.rig.cryptonote","csh":"application/x-csh","csl":"application/vnd.citationstyles.style+xml","csml":"chemical/x-csml","csp":"application/vnd.commonspace","css":"text/css","cst":"application/x-director","csv":"text/csv","cu":"application/cu-seeme","curl":"text/vnd.curl","cww":"application/prs.cww","cxt":"application/x-director","cxx":"text/x-c","dae":"model/vnd.collada+xml","daf":"application/vnd.mobius.daf","dart":"application/vnd.dart","dataless":"application/vnd.fdsn.seed","davmount":"application/davmount+xml","dbf":"application/vnd.dbf","dbk":"application/docbook+xml","dcr":"application/x-director","dcurl":"text/vnd.curl.dcurl","dd2":"application/vnd.oma.dd2+xml","ddd":"application/vnd.fujixerox.ddd","ddf":"application/vnd.syncml.dmddf+xml","dds":"image/vnd.ms-dds","deb":"application/x-debian-package","def":"text/plain","deploy":"application/octet-stream","der":"application/x-x509-ca-cert","dfac":"application/vnd.dreamfactory","dgc":"application/x-dgc-compressed","dic":"text/x-c","dir":"application/x-director","dis":"application/vnd.mobius.dis","disposition-notification":"message/disposition-notification","dist":"application/octet-stream","distz":"application/octet-stream","djv":"image/vnd.djvu","djvu":"image/vnd.djvu","dll":"application/x-msdownload","dmg":"application/x-apple-diskimage","dmp":"application/vnd.tcpdump.pcap","dms":"application/octet-stream","dna":"application/vnd.dna","doc":"application/msword","docm":"application/vnd.ms-word.document.macroenabled.12","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","dot":"application/msword","dotm":"application/vnd.ms-word.template.macroenabled.12","dotx":"application/vnd.openxmlformats-officedocument.wordprocessingml.template","dp":"application/vnd.osgi.dp","dpg":"application/vnd.dpgraph","dra":"audio/vnd.dra","drle":"image/dicom-rle","dsc":"text/prs.lines.tag","dssc":"application/dssc+der","dtb":"application/x-dtbook+xml","dtd":"application/xml-dtd","dts":"audio/vnd.dts","dtshd":"audio/vnd.dts.hd","dump":"application/octet-stream","dvb":"video/vnd.dvb.file","dvi":"application/x-dvi","dwd":"application/atsc-dwd+xml","dwf":"model/vnd.dwf","dwg":"image/vnd.dwg","dxf":"image/vnd.dxf","dxp":"application/vnd.spotfire.dxp","dxr":"application/x-director","ear":"application/java-archive","ecelp4800":"audio/vnd.nuera.ecelp4800","ecelp7470":"audio/vnd.nuera.ecelp7470","ecelp9600":"audio/vnd.nuera.ecelp9600","ecma":"application/ecmascript","edm":"application/vnd.novadigm.edm","edx":"application/vnd.novadigm.edx","efif":"application/vnd.picsel","ei6":"application/vnd.pg.osasli","elc":"application/octet-stream","emf":"image/emf","eml":"message/rfc822","emma":"application/emma+xml","emotionml":"application/emotionml+xml","emz":"application/x-msmetafile","eol":"audio/vnd.digital-winds","eot":"application/vnd.ms-fontobject","eps":"application/postscript","epub":"application/epub+zip","es":"application/ecmascript","es3":"application/vnd.eszigno3+xml","esa":"application/vnd.osgi.subsystem","esf":"application/vnd.epson.esf","et3":"application/vnd.eszigno3+xml","etx":"text/x-setext","eva":"application/x-eva","evy":"application/x-envoy","exe":"application/x-msdownload","exi":"application/exi","exr":"image/aces","ext":"application/vnd.novadigm.ext","ez":"application/andrew-inset","ez2":"application/vnd.ezpix-album","ez3":"application/vnd.ezpix-package","f":"text/x-fortran","f4v":"video/x-f4v","f77":"text/x-fortran","f90":"text/x-fortran","fbs":"image/vnd.fastbidsheet","fcdt":"application/vnd.adobe.formscentral.fcdt","fcs":"application/vnd.isac.fcs","fdf":"application/vnd.fdf","fdt":"application/fdt+xml","fe_launch":"application/vnd.denovo.fcselayout-link","fg5":"application/vnd.fujitsu.oasysgp","fgd":"application/x-director","fh":"image/x-freehand","fh4":"image/x-freehand","fh5":"image/x-freehand","fh7":"image/x-freehand","fhc":"image/x-freehand","fig":"application/x-xfig","fits":"image/fits","flac":"audio/x-flac","fli":"video/x-fli","flo":"application/vnd.micrografx.flo","flv":"video/x-flv","flw":"application/vnd.kde.kivio","flx":"text/vnd.fmi.flexstor","fly":"text/vnd.fly","fm":"application/vnd.framemaker","fnc":"application/vnd.frogans.fnc","fo":"application/vnd.software602.filler.form+xml","for":"text/x-fortran","fpx":"image/vnd.fpx","frame":"application/vnd.framemaker","fsc":"application/vnd.fsc.weblaunch","fst":"image/vnd.fst","ftc":"application/vnd.fluxtime.clip","fti":"application/vnd.anser-web-funds-transfer-initiation","fvt":"video/vnd.fvt","fxp":"application/vnd.adobe.fxp","fxpl":"application/vnd.adobe.fxp","fzs":"application/vnd.fuzzysheet","g2w":"application/vnd.geoplan","g3":"image/g3fax","g3w":"application/vnd.geospace","gac":"application/vnd.groove-account","gam":"application/x-tads","gbr":"application/rpki-ghostbusters","gca":"application/x-gca-compressed","gdl":"model/vnd.gdl","gdoc":"application/vnd.google-apps.document","geo":"application/vnd.dynageo","geojson":"application/geo+json","gex":"application/vnd.geometry-explorer","ggb":"application/vnd.geogebra.file","ggt":"application/vnd.geogebra.tool","ghf":"application/vnd.groove-help","gif":"image/gif","gim":"application/vnd.groove-identity-message","glb":"model/gltf-binary","gltf":"model/gltf+json","gml":"application/gml+xml","gmx":"application/vnd.gmx","gnumeric":"application/x-gnumeric","gph":"application/vnd.flographit","gpx":"application/gpx+xml","gqf":"application/vnd.grafeq","gqs":"application/vnd.grafeq","gram":"application/srgs","gramps":"application/x-gramps-xml","gre":"application/vnd.geometry-explorer","grv":"application/vnd.groove-injector","grxml":"application/srgs+xml","gsf":"application/x-font-ghostscript","gsheet":"application/vnd.google-apps.spreadsheet","gslides":"application/vnd.google-apps.presentation","gtar":"application/x-gtar","gtm":"application/vnd.groove-tool-message","gtw":"model/vnd.gtw","gv":"text/vnd.graphviz","gxf":"application/gxf","gxt":"application/vnd.geonext","gz":"application/gzip","h":"text/x-c","h261":"video/h261","h263":"video/h263","h264":"video/h264","hal":"application/vnd.hal+xml","hbci":"application/vnd.hbci","hbs":"text/x-handlebars-template","hdd":"application/x-virtualbox-hdd","hdf":"application/x-hdf","heic":"image/heic","heics":"image/heic-sequence","heif":"image/heif","heifs":"image/heif-sequence","hej2":"image/hej2k","held":"application/atsc-held+xml","hh":"text/x-c","hjson":"application/hjson","hlp":"application/winhlp","hpgl":"application/vnd.hp-hpgl","hpid":"application/vnd.hp-hpid","hps":"application/vnd.hp-hps","hqx":"application/mac-binhex40","hsj2":"image/hsj2","htc":"text/x-component","htke":"application/vnd.kenameaapp","htm":"text/html","html":"text/html","hvd":"application/vnd.yamaha.hv-dic","hvp":"application/vnd.yamaha.hv-voice","hvs":"application/vnd.yamaha.hv-script","i2g":"application/vnd.intergeo","icc":"application/vnd.iccprofile","ice":"x-conference/x-cooltalk","icm":"application/vnd.iccprofile","ico":"image/x-icon","ics":"text/calendar","ief":"image/ief","ifb":"text/calendar","ifm":"application/vnd.shana.informed.formdata","iges":"model/iges","igl":"application/vnd.igloader","igm":"application/vnd.insors.igm","igs":"model/iges","igx":"application/vnd.micrografx.igx","iif":"application/vnd.shana.informed.interchange","img":"application/octet-stream","imp":"application/vnd.accpac.simply.imp","ims":"application/vnd.ms-ims","in":"text/plain","ini":"text/plain","ink":"application/inkml+xml","inkml":"application/inkml+xml","install":"application/x-install-instructions","iota":"application/vnd.astraea-software.iota","ipfix":"application/ipfix","ipk":"application/vnd.shana.informed.package","irm":"application/vnd.ibm.rights-management","irp":"application/vnd.irepository.package+xml","iso":"application/x-iso9660-image","itp":"application/vnd.shana.informed.formtemplate","its":"application/its+xml","ivp":"application/vnd.immervision-ivp","ivu":"application/vnd.immervision-ivu","jad":"text/vnd.sun.j2me.app-descriptor","jade":"text/jade","jam":"application/vnd.jam","jar":"application/java-archive","jardiff":"application/x-java-archive-diff","java":"text/x-java-source","jhc":"image/jphc","jisp":"application/vnd.jisp","jls":"image/jls","jlt":"application/vnd.hp-jlyt","jng":"image/x-jng","jnlp":"application/x-java-jnlp-file","joda":"application/vnd.joost.joda-archive","jp2":"image/jp2","jpe":"image/jpeg","jpeg":"image/jpeg","jpf":"image/jpx","jpg":"image/jpeg","jpg2":"image/jp2","jpgm":"video/jpm","jpgv":"video/jpeg","jph":"image/jph","jpm":"video/jpm","jpx":"image/jpx","js":"application/javascript","json":"application/json","json5":"application/json5","jsonld":"application/ld+json","jsonml":"application/jsonml+json","jsx":"text/jsx","jxr":"image/jxr","jxra":"image/jxra","jxrs":"image/jxrs","jxs":"image/jxs","jxsc":"image/jxsc","jxsi":"image/jxsi","jxss":"image/jxss","kar":"audio/midi","karbon":"application/vnd.kde.karbon","kdbx":"application/x-keepass2","key":"application/vnd.apple.keynote","kfo":"application/vnd.kde.kformula","kia":"application/vnd.kidspiration","kml":"application/vnd.google-earth.kml+xml","kmz":"application/vnd.google-earth.kmz","kne":"application/vnd.kinar","knp":"application/vnd.kinar","kon":"application/vnd.kde.kontour","kpr":"application/vnd.kde.kpresenter","kpt":"application/vnd.kde.kpresenter","kpxx":"application/vnd.ds-keypoint","ksp":"application/vnd.kde.kspread","ktr":"application/vnd.kahootz","ktx":"image/ktx","ktx2":"image/ktx2","ktz":"application/vnd.kahootz","kwd":"application/vnd.kde.kword","kwt":"application/vnd.kde.kword","lasxml":"application/vnd.las.las+xml","latex":"application/x-latex","lbd":"application/vnd.llamagraphics.life-balance.desktop","lbe":"application/vnd.llamagraphics.life-balance.exchange+xml","les":"application/vnd.hhe.lesson-player","less":"text/less","lgr":"application/lgr+xml","lha":"application/x-lzh-compressed","link66":"application/vnd.route66.link66+xml","list":"text/plain","list3820":"application/vnd.ibm.modcap","listafp":"application/vnd.ibm.modcap","litcoffee":"text/coffeescript","lnk":"application/x-ms-shortcut","log":"text/plain","lostxml":"application/lost+xml","lrf":"application/octet-stream","lrm":"application/vnd.ms-lrm","ltf":"application/vnd.frogans.ltf","lua":"text/x-lua","luac":"application/x-lua-bytecode","lvp":"audio/vnd.lucent.voice","lwp":"application/vnd.lotus-wordpro","lzh":"application/x-lzh-compressed","m13":"application/x-msmediaview","m14":"application/x-msmediaview","m1v":"video/mpeg","m21":"application/mp21","m2a":"audio/mpeg","m2v":"video/mpeg","m3a":"audio/mpeg","m3u":"audio/x-mpegurl","m3u8":"application/vnd.apple.mpegurl","m4a":"audio/x-m4a","m4p":"application/mp4","m4s":"video/iso.segment","m4u":"video/vnd.mpegurl","m4v":"video/x-m4v","ma":"application/mathematica","mads":"application/mads+xml","maei":"application/mmt-aei+xml","mag":"application/vnd.ecowin.chart","maker":"application/vnd.framemaker","man":"text/troff","manifest":"text/cache-manifest","map":"application/json","mar":"application/octet-stream","markdown":"text/markdown","mathml":"application/mathml+xml","mb":"application/mathematica","mbk":"application/vnd.mobius.mbk","mbox":"application/mbox","mc1":"application/vnd.medcalcdata","mcd":"application/vnd.mcd","mcurl":"text/vnd.curl.mcurl","md":"text/markdown","mdb":"application/x-msaccess","mdi":"image/vnd.ms-modi","mdx":"text/mdx","me":"text/troff","mesh":"model/mesh","meta4":"application/metalink4+xml","metalink":"application/metalink+xml","mets":"application/mets+xml","mfm":"application/vnd.mfmp","mft":"application/rpki-manifest","mgp":"application/vnd.osgeo.mapguide.package","mgz":"application/vnd.proteus.magazine","mid":"audio/midi","midi":"audio/midi","mie":"application/x-mie","mif":"application/vnd.mif","mime":"message/rfc822","mj2":"video/mj2","mjp2":"video/mj2","mjs":"application/javascript","mk3d":"video/x-matroska","mka":"audio/x-matroska","mkd":"text/x-markdown","mks":"video/x-matroska","mkv":"video/x-matroska","mlp":"application/vnd.dolby.mlp","mmd":"application/vnd.chipnuts.karaoke-mmd","mmf":"application/vnd.smaf","mml":"text/mathml","mmr":"image/vnd.fujixerox.edmics-mmr","mng":"video/x-mng","mny":"application/x-msmoney","mobi":"application/x-mobipocket-ebook","mods":"application/mods+xml","mov":"video/quicktime","movie":"video/x-sgi-movie","mp2":"audio/mpeg","mp21":"application/mp21","mp2a":"audio/mpeg","mp3":"audio/mpeg","mp4":"video/mp4","mp4a":"audio/mp4","mp4s":"application/mp4","mp4v":"video/mp4","mpc":"application/vnd.mophun.certificate","mpd":"application/dash+xml","mpe":"video/mpeg","mpeg":"video/mpeg","mpg":"video/mpeg","mpg4":"video/mp4","mpga":"audio/mpeg","mpkg":"application/vnd.apple.installer+xml","mpm":"application/vnd.blueice.multipass","mpn":"application/vnd.mophun.application","mpp":"application/vnd.ms-project","mpt":"application/vnd.ms-project","mpy":"application/vnd.ibm.minipay","mqy":"application/vnd.mobius.mqy","mrc":"application/marc","mrcx":"application/marcxml+xml","ms":"text/troff","mscml":"application/mediaservercontrol+xml","mseed":"application/vnd.fdsn.mseed","mseq":"application/vnd.mseq","msf":"application/vnd.epson.msf","msg":"application/vnd.ms-outlook","msh":"model/mesh","msi":"application/x-msdownload","msl":"application/vnd.mobius.msl","msm":"application/octet-stream","msp":"application/octet-stream","msty":"application/vnd.muvee.style","mtl":"model/mtl","mts":"model/vnd.mts","mus":"application/vnd.musician","musd":"application/mmt-usd+xml","musicxml":"application/vnd.recordare.musicxml+xml","mvb":"application/x-msmediaview","mwf":"application/vnd.mfer","mxf":"application/mxf","mxl":"application/vnd.recordare.musicxml","mxmf":"audio/mobile-xmf","mxml":"application/xv+xml","mxs":"application/vnd.triscape.mxs","mxu":"video/vnd.mpegurl","n-gage":"application/vnd.nokia.n-gage.symbian.install","n3":"text/n3","nb":"application/mathematica","nbp":"application/vnd.wolfram.player","nc":"application/x-netcdf","ncx":"application/x-dtbncx+xml","nfo":"text/x-nfo","ngdat":"application/vnd.nokia.n-gage.data","nitf":"application/vnd.nitf","nlu":"application/vnd.neurolanguage.nlu","nml":"application/vnd.enliven","nnd":"application/vnd.noblenet-directory","nns":"application/vnd.noblenet-sealer","nnw":"application/vnd.noblenet-web","npx":"image/vnd.net-fpx","nq":"application/n-quads","nsc":"application/x-conference","nsf":"application/vnd.lotus-notes","nt":"application/n-triples","ntf":"application/vnd.nitf","numbers":"application/vnd.apple.numbers","nzb":"application/x-nzb","oa2":"application/vnd.fujitsu.oasys2","oa3":"application/vnd.fujitsu.oasys3","oas":"application/vnd.fujitsu.oasys","obd":"application/x-msbinder","obgx":"application/vnd.openblox.game+xml","obj":"model/obj","oda":"application/oda","odb":"application/vnd.oasis.opendocument.database","odc":"application/vnd.oasis.opendocument.chart","odf":"application/vnd.oasis.opendocument.formula","odft":"application/vnd.oasis.opendocument.formula-template","odg":"application/vnd.oasis.opendocument.graphics","odi":"application/vnd.oasis.opendocument.image","odm":"application/vnd.oasis.opendocument.text-master","odp":"application/vnd.oasis.opendocument.presentation","ods":"application/vnd.oasis.opendocument.spreadsheet","odt":"application/vnd.oasis.opendocument.text","oga":"audio/ogg","ogex":"model/vnd.opengex","ogg":"audio/ogg","ogv":"video/ogg","ogx":"application/ogg","omdoc":"application/omdoc+xml","onepkg":"application/onenote","onetmp":"application/onenote","onetoc":"application/onenote","onetoc2":"application/onenote","opf":"application/oebps-package+xml","opml":"text/x-opml","oprc":"application/vnd.palm","opus":"audio/ogg","org":"text/x-org","osf":"application/vnd.yamaha.openscoreformat","osfpvg":"application/vnd.yamaha.openscoreformat.osfpvg+xml","osm":"application/vnd.openstreetmap.data+xml","otc":"application/vnd.oasis.opendocument.chart-template","otf":"font/otf","otg":"application/vnd.oasis.opendocument.graphics-template","oth":"application/vnd.oasis.opendocument.text-web","oti":"application/vnd.oasis.opendocument.image-template","otp":"application/vnd.oasis.opendocument.presentation-template","ots":"application/vnd.oasis.opendocument.spreadsheet-template","ott":"application/vnd.oasis.opendocument.text-template","ova":"application/x-virtualbox-ova","ovf":"application/x-virtualbox-ovf","owl":"application/rdf+xml","oxps":"application/oxps","oxt":"application/vnd.openofficeorg.extension","p":"text/x-pascal","p10":"application/pkcs10","p12":"application/x-pkcs12","p7b":"application/x-pkcs7-certificates","p7c":"application/pkcs7-mime","p7m":"application/pkcs7-mime","p7r":"application/x-pkcs7-certreqresp","p7s":"application/pkcs7-signature","p8":"application/pkcs8","pac":"application/x-ns-proxy-autoconfig","pages":"application/vnd.apple.pages","pas":"text/x-pascal","paw":"application/vnd.pawaafile","pbd":"application/vnd.powerbuilder6","pbm":"image/x-portable-bitmap","pcap":"application/vnd.tcpdump.pcap","pcf":"application/x-font-pcf","pcl":"application/vnd.hp-pcl","pclxl":"application/vnd.hp-pclxl","pct":"image/x-pict","pcurl":"application/vnd.curl.pcurl","pcx":"image/x-pcx","pdb":"application/x-pilot","pde":"text/x-processing","pdf":"application/pdf","pem":"application/x-x509-ca-cert","pfa":"application/x-font-type1","pfb":"application/x-font-type1","pfm":"application/x-font-type1","pfr":"application/font-tdpfr","pfx":"application/x-pkcs12","pgm":"image/x-portable-graymap","pgn":"application/x-chess-pgn","pgp":"application/pgp-encrypted","php":"application/x-httpd-php","pic":"image/x-pict","pkg":"application/octet-stream","pki":"application/pkixcmp","pkipath":"application/pkix-pkipath","pkpass":"application/vnd.apple.pkpass","pl":"application/x-perl","plb":"application/vnd.3gpp.pic-bw-large","plc":"application/vnd.mobius.plc","plf":"application/vnd.pocketlearn","pls":"application/pls+xml","pm":"application/x-perl","pml":"application/vnd.ctc-posml","png":"image/png","pnm":"image/x-portable-anymap","portpkg":"application/vnd.macports.portpkg","pot":"application/vnd.ms-powerpoint","potm":"application/vnd.ms-powerpoint.template.macroenabled.12","potx":"application/vnd.openxmlformats-officedocument.presentationml.template","ppam":"application/vnd.ms-powerpoint.addin.macroenabled.12","ppd":"application/vnd.cups-ppd","ppm":"image/x-portable-pixmap","pps":"application/vnd.ms-powerpoint","ppsm":"application/vnd.ms-powerpoint.slideshow.macroenabled.12","ppsx":"application/vnd.openxmlformats-officedocument.presentationml.slideshow","ppt":"application/vnd.ms-powerpoint","pptm":"application/vnd.ms-powerpoint.presentation.macroenabled.12","pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation","pqa":"application/vnd.palm","prc":"application/x-pilot","pre":"application/vnd.lotus-freelance","prf":"application/pics-rules","provx":"application/provenance+xml","ps":"application/postscript","psb":"application/vnd.3gpp.pic-bw-small","psd":"image/vnd.adobe.photoshop","psf":"application/x-font-linux-psf","pskcxml":"application/pskc+xml","pti":"image/prs.pti","ptid":"application/vnd.pvi.ptid1","pub":"application/x-mspublisher","pvb":"application/vnd.3gpp.pic-bw-var","pwn":"application/vnd.3m.post-it-notes","pya":"audio/vnd.ms-playready.media.pya","pyv":"video/vnd.ms-playready.media.pyv","qam":"application/vnd.epson.quickanime","qbo":"application/vnd.intu.qbo","qfx":"application/vnd.intu.qfx","qps":"application/vnd.publishare-delta-tree","qt":"video/quicktime","qwd":"application/vnd.quark.quarkxpress","qwt":"application/vnd.quark.quarkxpress","qxb":"application/vnd.quark.quarkxpress","qxd":"application/vnd.quark.quarkxpress","qxl":"application/vnd.quark.quarkxpress","qxt":"application/vnd.quark.quarkxpress","ra":"audio/x-realaudio","ram":"audio/x-pn-realaudio","raml":"application/raml+yaml","rapd":"application/route-apd+xml","rar":"application/x-rar-compressed","ras":"image/x-cmu-raster","rcprofile":"application/vnd.ipunplugged.rcprofile","rdf":"application/rdf+xml","rdz":"application/vnd.data-vision.rdz","relo":"application/p2p-overlay+xml","rep":"application/vnd.businessobjects","res":"application/x-dtbresource+xml","rgb":"image/x-rgb","rif":"application/reginfo+xml","rip":"audio/vnd.rip","ris":"application/x-research-info-systems","rl":"application/resource-lists+xml","rlc":"image/vnd.fujixerox.edmics-rlc","rld":"application/resource-lists-diff+xml","rm":"application/vnd.rn-realmedia","rmi":"audio/midi","rmp":"audio/x-pn-realaudio-plugin","rms":"application/vnd.jcp.javame.midlet-rms","rmvb":"application/vnd.rn-realmedia-vbr","rnc":"application/relax-ng-compact-syntax","rng":"application/xml","roa":"application/rpki-roa","roff":"text/troff","rp9":"application/vnd.cloanto.rp9","rpm":"application/x-redhat-package-manager","rpss":"application/vnd.nokia.radio-presets","rpst":"application/vnd.nokia.radio-preset","rq":"application/sparql-query","rs":"application/rls-services+xml","rsat":"application/atsc-rsat+xml","rsd":"application/rsd+xml","rsheet":"application/urc-ressheet+xml","rss":"application/rss+xml","rtf":"text/rtf","rtx":"text/richtext","run":"application/x-makeself","rusd":"application/route-usd+xml","s":"text/x-asm","s3m":"audio/s3m","saf":"application/vnd.yamaha.smaf-audio","sass":"text/x-sass","sbml":"application/sbml+xml","sc":"application/vnd.ibm.secure-container","scd":"application/x-msschedule","scm":"application/vnd.lotus-screencam","scq":"application/scvp-cv-request","scs":"application/scvp-cv-response","scss":"text/x-scss","scurl":"text/vnd.curl.scurl","sda":"application/vnd.stardivision.draw","sdc":"application/vnd.stardivision.calc","sdd":"application/vnd.stardivision.impress","sdkd":"application/vnd.solent.sdkm+xml","sdkm":"application/vnd.solent.sdkm+xml","sdp":"application/sdp","sdw":"application/vnd.stardivision.writer","sea":"application/x-sea","see":"application/vnd.seemail","seed":"application/vnd.fdsn.seed","sema":"application/vnd.sema","semd":"application/vnd.semd","semf":"application/vnd.semf","senmlx":"application/senml+xml","sensmlx":"application/sensml+xml","ser":"application/java-serialized-object","setpay":"application/set-payment-initiation","setreg":"application/set-registration-initiation","sfd-hdstx":"application/vnd.hydrostatix.sof-data","sfs":"application/vnd.spotfire.sfs","sfv":"text/x-sfv","sgi":"image/sgi","sgl":"application/vnd.stardivision.writer-global","sgm":"text/sgml","sgml":"text/sgml","sh":"application/x-sh","shar":"application/x-shar","shex":"text/shex","shf":"application/shf+xml","shtml":"text/html","sid":"image/x-mrsid-image","sieve":"application/sieve","sig":"application/pgp-signature","sil":"audio/silk","silo":"model/mesh","sis":"application/vnd.symbian.install","sisx":"application/vnd.symbian.install","sit":"application/x-stuffit","sitx":"application/x-stuffitx","siv":"application/sieve","skd":"application/vnd.koan","skm":"application/vnd.koan","skp":"application/vnd.koan","skt":"application/vnd.koan","sldm":"application/vnd.ms-powerpoint.slide.macroenabled.12","sldx":"application/vnd.openxmlformats-officedocument.presentationml.slide","slim":"text/slim","slm":"text/slim","sls":"application/route-s-tsid+xml","slt":"application/vnd.epson.salt","sm":"application/vnd.stepmania.stepchart","smf":"application/vnd.stardivision.math","smi":"application/smil+xml","smil":"application/smil+xml","smv":"video/x-smv","smzip":"application/vnd.stepmania.package","snd":"audio/basic","snf":"application/x-font-snf","so":"application/octet-stream","spc":"application/x-pkcs7-certificates","spdx":"text/spdx","spf":"application/vnd.yamaha.smaf-phrase","spl":"application/x-futuresplash","spot":"text/vnd.in3d.spot","spp":"application/scvp-vp-response","spq":"application/scvp-vp-request","spx":"audio/ogg","sql":"application/x-sql","src":"application/x-wais-source","srt":"application/x-subrip","sru":"application/sru+xml","srx":"application/sparql-results+xml","ssdl":"application/ssdl+xml","sse":"application/vnd.kodak-descriptor","ssf":"application/vnd.epson.ssf","ssml":"application/ssml+xml","st":"application/vnd.sailingtracker.track","stc":"application/vnd.sun.xml.calc.template","std":"application/vnd.sun.xml.draw.template","stf":"application/vnd.wt.stf","sti":"application/vnd.sun.xml.impress.template","stk":"application/hyperstudio","stl":"model/stl","str":"application/vnd.pg.format","stw":"application/vnd.sun.xml.writer.template","styl":"text/stylus","stylus":"text/stylus","sub":"text/vnd.dvb.subtitle","sus":"application/vnd.sus-calendar","susp":"application/vnd.sus-calendar","sv4cpio":"application/x-sv4cpio","sv4crc":"application/x-sv4crc","svc":"application/vnd.dvb.service","svd":"application/vnd.svd","svg":"image/svg+xml","svgz":"image/svg+xml","swa":"application/x-director","swf":"application/x-shockwave-flash","swi":"application/vnd.aristanetworks.swi","swidtag":"application/swid+xml","sxc":"application/vnd.sun.xml.calc","sxd":"application/vnd.sun.xml.draw","sxg":"application/vnd.sun.xml.writer.global","sxi":"application/vnd.sun.xml.impress","sxm":"application/vnd.sun.xml.math","sxw":"application/vnd.sun.xml.writer","t":"text/troff","t3":"application/x-t3vm-image","t38":"image/t38","taglet":"application/vnd.mynfc","tao":"application/vnd.tao.intent-module-archive","tap":"image/vnd.tencent.tap","tar":"application/x-tar","tcap":"application/vnd.3gpp2.tcap","tcl":"application/x-tcl","td":"application/urc-targetdesc+xml","teacher":"application/vnd.smart.teacher","tei":"application/tei+xml","teicorpus":"application/tei+xml","tex":"application/x-tex","texi":"application/x-texinfo","texinfo":"application/x-texinfo","text":"text/plain","tfi":"application/thraud+xml","tfm":"application/x-tex-tfm","tfx":"image/tiff-fx","tga":"image/x-tga","thmx":"application/vnd.ms-officetheme","tif":"image/tiff","tiff":"image/tiff","tk":"application/x-tcl","tmo":"application/vnd.tmobile-livetv","toml":"application/toml","torrent":"application/x-bittorrent","tpl":"application/vnd.groove-tool-template","tpt":"application/vnd.trid.tpt","tr":"text/troff","tra":"application/vnd.trueapp","trm":"application/x-msterminal","ts":"video/mp2t","tsd":"application/timestamped-data","tsv":"text/tab-separated-values","ttc":"font/collection","ttf":"font/ttf","ttl":"text/turtle","ttml":"application/ttml+xml","twd":"application/vnd.simtech-mindmapper","twds":"application/vnd.simtech-mindmapper","txd":"application/vnd.genomatix.tuxedo","txf":"application/vnd.mobius.txf","txt":"text/plain","u32":"application/x-authorware-bin","u8dsn":"message/global-delivery-status","u8hdr":"message/global-headers","u8mdn":"message/global-disposition-notification","u8msg":"message/global","ubj":"application/ubjson","udeb":"application/x-debian-package","ufd":"application/vnd.ufdl","ufdl":"application/vnd.ufdl","ulx":"application/x-glulx","umj":"application/vnd.umajin","unityweb":"application/vnd.unity","uoml":"application/vnd.uoml+xml","uri":"text/uri-list","uris":"text/uri-list","urls":"text/uri-list","usdz":"model/vnd.usdz+zip","ustar":"application/x-ustar","utz":"application/vnd.uiq.theme","uu":"text/x-uuencode","uva":"audio/vnd.dece.audio","uvd":"application/vnd.dece.data","uvf":"application/vnd.dece.data","uvg":"image/vnd.dece.graphic","uvh":"video/vnd.dece.hd","uvi":"image/vnd.dece.graphic","uvm":"video/vnd.dece.mobile","uvp":"video/vnd.dece.pd","uvs":"video/vnd.dece.sd","uvt":"application/vnd.dece.ttml+xml","uvu":"video/vnd.uvvu.mp4","uvv":"video/vnd.dece.video","uvva":"audio/vnd.dece.audio","uvvd":"application/vnd.dece.data","uvvf":"application/vnd.dece.data","uvvg":"image/vnd.dece.graphic","uvvh":"video/vnd.dece.hd","uvvi":"image/vnd.dece.graphic","uvvm":"video/vnd.dece.mobile","uvvp":"video/vnd.dece.pd","uvvs":"video/vnd.dece.sd","uvvt":"application/vnd.dece.ttml+xml","uvvu":"video/vnd.uvvu.mp4","uvvv":"video/vnd.dece.video","uvvx":"application/vnd.dece.unspecified","uvvz":"application/vnd.dece.zip","uvx":"application/vnd.dece.unspecified","uvz":"application/vnd.dece.zip","vbox":"application/x-virtualbox-vbox","vbox-extpack":"application/x-virtualbox-vbox-extpack","vcard":"text/vcard","vcd":"application/x-cdlink","vcf":"text/x-vcard","vcg":"application/vnd.groove-vcard","vcs":"text/x-vcalendar","vcx":"application/vnd.vcx","vdi":"application/x-virtualbox-vdi","vhd":"application/x-virtualbox-vhd","vis":"application/vnd.visionary","viv":"video/vnd.vivo","vmdk":"application/x-virtualbox-vmdk","vob":"video/x-ms-vob","vor":"application/vnd.stardivision.writer","vox":"application/x-authorware-bin","vrml":"model/vrml","vsd":"application/vnd.visio","vsf":"application/vnd.vsf","vss":"application/vnd.visio","vst":"application/vnd.visio","vsw":"application/vnd.visio","vtf":"image/vnd.valve.source.texture","vtt":"text/vtt","vtu":"model/vnd.vtu","vxml":"application/voicexml+xml","w3d":"application/x-director","wad":"application/x-doom","wadl":"application/vnd.sun.wadl+xml","war":"application/java-archive","wasm":"application/wasm","wav":"audio/x-wav","wax":"audio/x-ms-wax","wbmp":"image/vnd.wap.wbmp","wbs":"application/vnd.criticaltools.wbs+xml","wbxml":"application/vnd.wap.wbxml","wcm":"application/vnd.ms-works","wdb":"application/vnd.ms-works","wdp":"image/vnd.ms-photo","weba":"audio/webm","webapp":"application/x-web-app-manifest+json","webm":"video/webm","webmanifest":"application/manifest+json","webp":"image/webp","wg":"application/vnd.pmi.widget","wgt":"application/widget","wks":"application/vnd.ms-works","wm":"video/x-ms-wm","wma":"audio/x-ms-wma","wmd":"application/x-ms-wmd","wmf":"image/wmf","wml":"text/vnd.wap.wml","wmlc":"application/vnd.wap.wmlc","wmls":"text/vnd.wap.wmlscript","wmlsc":"application/vnd.wap.wmlscriptc","wmv":"video/x-ms-wmv","wmx":"video/x-ms-wmx","wmz":"application/x-msmetafile","woff":"font/woff","woff2":"font/woff2","wpd":"application/vnd.wordperfect","wpl":"application/vnd.ms-wpl","wps":"application/vnd.ms-works","wqd":"application/vnd.wqd","wri":"application/x-mswrite","wrl":"model/vrml","wsc":"message/vnd.wfa.wsc","wsdl":"application/wsdl+xml","wspolicy":"application/wspolicy+xml","wtb":"application/vnd.webturbo","wvx":"video/x-ms-wvx","x32":"application/x-authorware-bin","x3d":"model/x3d+xml","x3db":"model/x3d+fastinfoset","x3dbz":"model/x3d+binary","x3dv":"model/x3d-vrml","x3dvz":"model/x3d+vrml","x3dz":"model/x3d+xml","x_b":"model/vnd.parasolid.transmit.binary","x_t":"model/vnd.parasolid.transmit.text","xaml":"application/xaml+xml","xap":"application/x-silverlight-app","xar":"application/vnd.xara","xav":"application/xcap-att+xml","xbap":"application/x-ms-xbap","xbd":"application/vnd.fujixerox.docuworks.binder","xbm":"image/x-xbitmap","xca":"application/xcap-caps+xml","xcs":"application/calendar+xml","xdf":"application/xcap-diff+xml","xdm":"application/vnd.syncml.dm+xml","xdp":"application/vnd.adobe.xdp+xml","xdssc":"application/dssc+xml","xdw":"application/vnd.fujixerox.docuworks","xel":"application/xcap-el+xml","xenc":"application/xenc+xml","xer":"application/xcap-error+xml","xfdf":"application/vnd.adobe.xfdf","xfdl":"application/vnd.xfdl","xht":"application/xhtml+xml","xhtml":"application/xhtml+xml","xhvml":"application/xv+xml","xif":"image/vnd.xiff","xla":"application/vnd.ms-excel","xlam":"application/vnd.ms-excel.addin.macroenabled.12","xlc":"application/vnd.ms-excel","xlf":"application/xliff+xml","xlm":"application/vnd.ms-excel","xls":"application/vnd.ms-excel","xlsb":"application/vnd.ms-excel.sheet.binary.macroenabled.12","xlsm":"application/vnd.ms-excel.sheet.macroenabled.12","xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlt":"application/vnd.ms-excel","xltm":"application/vnd.ms-excel.template.macroenabled.12","xltx":"application/vnd.openxmlformats-officedocument.spreadsheetml.template","xlw":"application/vnd.ms-excel","xm":"audio/xm","xml":"text/xml","xns":"application/xcap-ns+xml","xo":"application/vnd.olpc-sugar","xop":"application/xop+xml","xpi":"application/x-xpinstall","xpl":"application/xproc+xml","xpm":"image/x-xpixmap","xpr":"application/vnd.is-xpr","xps":"application/vnd.ms-xpsdocument","xpw":"application/vnd.intercon.formnet","xpx":"application/vnd.intercon.formnet","xsd":"application/xml","xsl":"application/xslt+xml","xslt":"application/xslt+xml","xsm":"application/vnd.syncml+xml","xspf":"application/xspf+xml","xul":"application/vnd.mozilla.xul+xml","xvm":"application/xv+xml","xvml":"application/xv+xml","xwd":"image/x-xwindowdump","xyz":"chemical/x-xyz","xz":"application/x-xz","yaml":"text/yaml","yang":"application/yang","yin":"application/yin+xml","yml":"text/yaml","ymp":"text/x-suse-ymp","z1":"application/x-zmachine","z2":"application/x-zmachine","z3":"application/x-zmachine","z4":"application/x-zmachine","z5":"application/x-zmachine","z6":"application/x-zmachine","z7":"application/x-zmachine","z8":"application/x-zmachine","zaz":"application/vnd.zzazz.deck+xml","zip":"application/zip","zir":"application/vnd.zul","zirz":"application/vnd.zul","zmm":"application/vnd.handheld-entertainment+xml"};
62
+
63
+ const version = '2.5.2';
64
+
65
+ function responseHeaders(headers, httpCache = false) {
66
+ headers = { ...DEFAULT_HEADERS, ...headers };
67
+ if (httpCache) {
68
+ headers['cache-control'] = 'max-age=3600';
69
+ delete headers['date'];
70
+ delete headers['expires'];
71
+ }
72
+ return headers;
73
+ }
74
+ const DEFAULT_HEADERS = {
75
+ 'cache-control': 'no-cache, no-store, must-revalidate, max-age=0',
76
+ 'expires': '0',
77
+ 'date': 'Wed, 1 Jan 2000 00:00:00 GMT',
78
+ 'server': 'Rindo Dev Server ' + version,
79
+ 'access-control-allow-origin': '*',
80
+ 'access-control-expose-headers': '*',
81
+ };
82
+ function getBrowserUrl(protocol, address, port, basePath, pathname) {
83
+ address = address === `0.0.0.0` ? `localhost` : address;
84
+ const portSuffix = !port || port === 80 || port === 443 ? '' : ':' + port;
85
+ let path = basePath;
86
+ if (pathname.startsWith('/')) {
87
+ pathname = pathname.substring(1);
88
+ }
89
+ path += pathname;
90
+ protocol = protocol.replace(/\:/g, '');
91
+ return `${protocol}://${address}${portSuffix}${path}`;
92
+ }
93
+ function getDevServerClientUrl(devServerConfig, host, protocol) {
94
+ let address = devServerConfig.address;
95
+ let port = devServerConfig.port;
96
+ if (host) {
97
+ address = host;
98
+ port = null;
99
+ }
100
+ return getBrowserUrl(protocol !== null && protocol !== void 0 ? protocol : devServerConfig.protocol, address, port, devServerConfig.basePath, DEV_SERVER_URL);
101
+ }
102
+ function getContentType(filePath) {
103
+ const last = filePath.replace(/^.*[/\\]/, '').toLowerCase();
104
+ const ext = last.replace(/^.*\./, '').toLowerCase();
105
+ const hasPath = last.length < filePath.length;
106
+ const hasDot = ext.length < last.length - 1;
107
+ return ((hasDot || !hasPath) && contentTypes[ext]) || 'application/octet-stream';
108
+ }
109
+ function isHtmlFile(filePath) {
110
+ filePath = filePath.toLowerCase().trim();
111
+ return filePath.endsWith('.html') || filePath.endsWith('.htm');
112
+ }
113
+ function isCssFile(filePath) {
114
+ filePath = filePath.toLowerCase().trim();
115
+ return filePath.endsWith('.css');
116
+ }
117
+ const TXT_EXT = ['css', 'html', 'htm', 'js', 'json', 'svg', 'xml'];
118
+ function isSimpleText(filePath) {
119
+ const ext = filePath.toLowerCase().trim().split('.').pop();
120
+ return TXT_EXT.includes(ext);
121
+ }
122
+ function isExtensionLessPath(pathname) {
123
+ const parts = pathname.split('/');
124
+ const lastPart = parts[parts.length - 1];
125
+ return !lastPart.includes('.');
126
+ }
127
+ function isSsrStaticDataPath(pathname) {
128
+ const parts = pathname.split('/');
129
+ const fileName = parts[parts.length - 1].split('?')[0];
130
+ return fileName === 'page.state.json';
131
+ }
132
+ function getSsrStaticDataPath(req) {
133
+ const parts = req.url.href.split('/');
134
+ let fileName = parts[parts.length - 1];
135
+ const fileNameParts = fileName.split('?');
136
+ parts.pop();
137
+ let ssrPath = new URL(parts.join('/')).href;
138
+ if (!ssrPath.endsWith('/') && req.headers) {
139
+ const h = new Headers(req.headers);
140
+ if (h.get('referer').endsWith('/')) {
141
+ ssrPath += '/';
142
+ }
143
+ }
144
+ return {
145
+ ssrPath,
146
+ fileName: fileNameParts[0],
147
+ hasQueryString: typeof fileNameParts[1] === 'string' && fileNameParts[1].length > 0,
148
+ };
149
+ }
150
+ function isDevClient(pathname) {
151
+ return pathname.startsWith(DEV_SERVER_URL);
152
+ }
153
+ function isDevModule(pathname) {
154
+ return pathname.includes(DEV_MODULE_URL);
155
+ }
156
+ function isOpenInEditor(pathname) {
157
+ return pathname === OPEN_IN_EDITOR_URL;
158
+ }
159
+ function isInitialDevServerLoad(pathname) {
160
+ return pathname === DEV_SERVER_INIT_URL;
161
+ }
162
+ function isDevServerClient(pathname) {
163
+ return pathname === DEV_SERVER_URL;
164
+ }
165
+ function shouldCompress(devServerConfig, req) {
166
+ if (!devServerConfig.gzip) {
167
+ return false;
168
+ }
169
+ if (req.method !== 'GET') {
170
+ return false;
171
+ }
172
+ const acceptEncoding = req.headers && req.headers['accept-encoding'];
173
+ if (typeof acceptEncoding !== 'string') {
174
+ return false;
175
+ }
176
+ if (!acceptEncoding.includes('gzip')) {
177
+ return false;
178
+ }
179
+ return true;
180
+ }
181
+
182
+ function createServerContext(sys, sendMsg, devServerConfig, buildResultsResolves, compilerRequestResolves) {
183
+ const logRequest = (req, status) => {
184
+ if (devServerConfig) {
185
+ sendMsg({
186
+ requestLog: {
187
+ method: req.method || '?',
188
+ url: req.pathname || '?',
189
+ status,
190
+ },
191
+ });
192
+ }
193
+ };
194
+ const serve500 = (req, res, error, xSource) => {
195
+ try {
196
+ res.writeHead(500, responseHeaders({
197
+ 'content-type': 'text/plain; charset=utf-8',
198
+ 'x-source': xSource,
199
+ }));
200
+ res.write(util__default['default'].inspect(error));
201
+ res.end();
202
+ logRequest(req, 500);
203
+ }
204
+ catch (e) {
205
+ sendMsg({ error: { message: 'serve500: ' + e } });
206
+ }
207
+ };
208
+ const serve404 = (req, res, xSource, content = null) => {
209
+ try {
210
+ if (req.pathname === '/favicon.ico') {
211
+ const defaultFavicon = path__default['default'].join(devServerConfig.devServerDir, 'static', 'favicon.ico');
212
+ res.writeHead(200, responseHeaders({
213
+ 'content-type': 'image/x-icon',
214
+ 'x-source': `favicon: ${xSource}`,
215
+ }));
216
+ const rs = fs__default['default'].createReadStream(defaultFavicon);
217
+ rs.on('error', err => {
218
+ res.writeHead(404, responseHeaders({
219
+ 'content-type': 'text/plain; charset=utf-8',
220
+ 'x-source': `createReadStream error: ${err}, ${xSource}`,
221
+ }));
222
+ res.write(util__default['default'].inspect(err));
223
+ res.end();
224
+ });
225
+ rs.pipe(res);
226
+ return;
227
+ }
228
+ if (content == null) {
229
+ content = ['404 File Not Found', 'Url: ' + req.pathname, 'File: ' + req.filePath].join('\n');
230
+ }
231
+ res.writeHead(404, responseHeaders({
232
+ 'content-type': 'text/plain; charset=utf-8',
233
+ 'x-source': xSource,
234
+ }));
235
+ res.write(content);
236
+ res.end();
237
+ logRequest(req, 400);
238
+ }
239
+ catch (e) {
240
+ serve500(req, res, e, xSource);
241
+ }
242
+ };
243
+ const serve302 = (req, res, pathname = null) => {
244
+ logRequest(req, 302);
245
+ res.writeHead(302, { location: pathname || devServerConfig.basePath || '/' });
246
+ res.end();
247
+ };
248
+ const getBuildResults = () => new Promise((resolve, reject) => {
249
+ if (serverCtx.isServerListening) {
250
+ buildResultsResolves.push({ resolve, reject });
251
+ sendMsg({ requestBuildResults: true });
252
+ }
253
+ else {
254
+ reject('dev server closed');
255
+ }
256
+ });
257
+ const getCompilerRequest = (compilerRequestPath) => new Promise((resolve, reject) => {
258
+ if (serverCtx.isServerListening) {
259
+ compilerRequestResolves.push({
260
+ path: compilerRequestPath,
261
+ resolve,
262
+ reject,
263
+ });
264
+ sendMsg({ compilerRequestPath });
265
+ }
266
+ else {
267
+ reject('dev server closed');
268
+ }
269
+ });
270
+ const serverCtx = {
271
+ connectorHtml: null,
272
+ dirTemplate: null,
273
+ getBuildResults,
274
+ getCompilerRequest,
275
+ isServerListening: false,
276
+ logRequest,
277
+ prerenderConfig: null,
278
+ serve302,
279
+ serve404,
280
+ serve500,
281
+ sys,
282
+ };
283
+ return serverCtx;
284
+ }
285
+
286
+ const noop = () => {
287
+ /* noop*/
288
+ };
289
+ const isFunction = (v) => typeof v === 'function';
290
+ const isString = (v) => typeof v === 'string';
291
+
292
+ const catchError = (diagnostics, err, msg) => {
293
+ const diagnostic = {
294
+ level: 'error',
295
+ type: 'build',
296
+ header: 'Build Error',
297
+ messageText: 'build error',
298
+ relFilePath: null,
299
+ absFilePath: null,
300
+ lines: [],
301
+ };
302
+ if (isString(msg)) {
303
+ diagnostic.messageText = msg;
304
+ }
305
+ else if (err != null) {
306
+ if (err.stack != null) {
307
+ diagnostic.messageText = err.stack.toString();
308
+ }
309
+ else {
310
+ if (err.message != null) {
311
+ diagnostic.messageText = err.message.toString();
312
+ }
313
+ else {
314
+ diagnostic.messageText = err.toString();
315
+ }
316
+ }
317
+ }
318
+ if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
319
+ diagnostics.push(diagnostic);
320
+ }
321
+ return diagnostic;
322
+ };
323
+ const shouldIgnoreError = (msg) => {
324
+ return msg === TASK_CANCELED_MSG;
325
+ };
326
+ const TASK_CANCELED_MSG = `task canceled`;
327
+
328
+ /**
329
+ * Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
330
+ * Forward-slash paths can be used in Windows as long as they're not
331
+ * extended-length paths and don't contain any non-ascii characters.
332
+ * This was created since the path methods in Node.js outputs \\ paths on Windows.
333
+ */
334
+ const normalizePath = (path) => {
335
+ if (typeof path !== 'string') {
336
+ throw new Error(`invalid path to normalize`);
337
+ }
338
+ path = normalizeSlashes(path.trim());
339
+ const components = pathComponents(path, getRootLength(path));
340
+ const reducedComponents = reducePathComponents(components);
341
+ const rootPart = reducedComponents[0];
342
+ const secondPart = reducedComponents[1];
343
+ const normalized = rootPart + reducedComponents.slice(1).join('/');
344
+ if (normalized === '') {
345
+ return '.';
346
+ }
347
+ if (rootPart === '' &&
348
+ secondPart &&
349
+ path.includes('/') &&
350
+ !secondPart.startsWith('.') &&
351
+ !secondPart.startsWith('@')) {
352
+ return './' + normalized;
353
+ }
354
+ return normalized;
355
+ };
356
+ const normalizeSlashes = (path) => path.replace(backslashRegExp, '/');
357
+ const altDirectorySeparator = '\\';
358
+ const urlSchemeSeparator = '://';
359
+ const backslashRegExp = /\\/g;
360
+ const reducePathComponents = (components) => {
361
+ if (!Array.isArray(components) || components.length === 0) {
362
+ return [];
363
+ }
364
+ const reduced = [components[0]];
365
+ for (let i = 1; i < components.length; i++) {
366
+ const component = components[i];
367
+ if (!component)
368
+ continue;
369
+ if (component === '.')
370
+ continue;
371
+ if (component === '..') {
372
+ if (reduced.length > 1) {
373
+ if (reduced[reduced.length - 1] !== '..') {
374
+ reduced.pop();
375
+ continue;
376
+ }
377
+ }
378
+ else if (reduced[0])
379
+ continue;
380
+ }
381
+ reduced.push(component);
382
+ }
383
+ return reduced;
384
+ };
385
+ const getRootLength = (path) => {
386
+ const rootLength = getEncodedRootLength(path);
387
+ return rootLength < 0 ? ~rootLength : rootLength;
388
+ };
389
+ const getEncodedRootLength = (path) => {
390
+ if (!path)
391
+ return 0;
392
+ const ch0 = path.charCodeAt(0);
393
+ // POSIX or UNC
394
+ if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
395
+ if (path.charCodeAt(1) !== ch0)
396
+ return 1; // POSIX: "/" (or non-normalized "\")
397
+ const p1 = path.indexOf(ch0 === 47 /* slash */ ? '/' : altDirectorySeparator, 2);
398
+ if (p1 < 0)
399
+ return path.length; // UNC: "//server" or "\\server"
400
+ return p1 + 1; // UNC: "//server/" or "\\server\"
401
+ }
402
+ // DOS
403
+ if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58 /* colon */) {
404
+ const ch2 = path.charCodeAt(2);
405
+ if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
406
+ return 3; // DOS: "c:/" or "c:\"
407
+ if (path.length === 2)
408
+ return 2; // DOS: "c:" (but not "c:d")
409
+ }
410
+ // URL
411
+ const schemeEnd = path.indexOf(urlSchemeSeparator);
412
+ if (schemeEnd !== -1) {
413
+ const authorityStart = schemeEnd + urlSchemeSeparator.length;
414
+ const authorityEnd = path.indexOf('/', authorityStart);
415
+ if (authorityEnd !== -1) {
416
+ // URL: "file:///", "file://server/", "file://server/path"
417
+ // For local "file" URLs, include the leading DOS volume (if present).
418
+ // Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
419
+ // special case interpreted as "the machine from which the URL is being interpreted".
420
+ const scheme = path.slice(0, schemeEnd);
421
+ const authority = path.slice(authorityStart, authorityEnd);
422
+ if (scheme === 'file' &&
423
+ (authority === '' || authority === 'localhost') &&
424
+ isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
425
+ const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
426
+ if (volumeSeparatorEnd !== -1) {
427
+ if (path.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
428
+ // URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
429
+ return ~(volumeSeparatorEnd + 1);
430
+ }
431
+ if (volumeSeparatorEnd === path.length) {
432
+ // URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
433
+ // but not "file:///c:d" or "file:///c%3ad"
434
+ return ~volumeSeparatorEnd;
435
+ }
436
+ }
437
+ }
438
+ return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
439
+ }
440
+ return ~path.length; // URL: "file://server", "http://server"
441
+ }
442
+ // relative
443
+ return 0;
444
+ };
445
+ const isVolumeCharacter = (charCode) => (charCode >= 97 /* a */ && charCode <= 122 /* z */) ||
446
+ (charCode >= 65 /* A */ && charCode <= 90 /* Z */);
447
+ const getFileUrlVolumeSeparatorEnd = (url, start) => {
448
+ const ch0 = url.charCodeAt(start);
449
+ if (ch0 === 58 /* colon */)
450
+ return start + 1;
451
+ if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
452
+ const ch2 = url.charCodeAt(start + 2);
453
+ if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
454
+ return start + 3;
455
+ }
456
+ return -1;
457
+ };
458
+ const pathComponents = (path, rootLength) => {
459
+ const root = path.substring(0, rootLength);
460
+ const rest = path.substring(rootLength).split('/');
461
+ const restLen = rest.length;
462
+ if (restLen > 0 && !rest[restLen - 1]) {
463
+ rest.pop();
464
+ }
465
+ return [root, ...rest];
466
+ };
467
+
468
+ async function serveFile(devServerConfig, serverCtx, req, res) {
469
+ try {
470
+ if (isSimpleText(req.filePath)) {
471
+ // easy text file, use the internal cache
472
+ let content = await serverCtx.sys.readFile(req.filePath, 'utf8');
473
+ if (devServerConfig.websocket && isHtmlFile(req.filePath) && !isDevServerClient(req.pathname)) {
474
+ // auto inject our dev server script
475
+ content = appendDevServerClientScript(devServerConfig, req, content);
476
+ }
477
+ else if (isCssFile(req.filePath)) {
478
+ content = updateStyleUrls(req.url, content);
479
+ }
480
+ if (shouldCompress(devServerConfig, req)) {
481
+ // let's gzip this well known web dev text file
482
+ res.writeHead(200, responseHeaders({
483
+ 'content-type': getContentType(req.filePath) + '; charset=utf-8',
484
+ 'content-encoding': 'gzip',
485
+ 'vary': 'Accept-Encoding',
486
+ }));
487
+ zlib__namespace.gzip(content, { level: 9 }, (_, data) => {
488
+ res.end(data);
489
+ });
490
+ }
491
+ else {
492
+ // let's not gzip this file
493
+ res.writeHead(200, responseHeaders({
494
+ 'content-type': getContentType(req.filePath) + '; charset=utf-8',
495
+ 'content-length': buffer.Buffer.byteLength(content, 'utf8'),
496
+ }));
497
+ res.write(content);
498
+ res.end();
499
+ }
500
+ }
501
+ else {
502
+ // non-well-known text file or other file, probably best we use a stream
503
+ // but don't bother trying to gzip this file for the dev server
504
+ res.writeHead(200, responseHeaders({
505
+ 'content-type': getContentType(req.filePath),
506
+ 'content-length': req.stats.size,
507
+ }));
508
+ fs__default['default'].createReadStream(req.filePath).pipe(res);
509
+ }
510
+ serverCtx.logRequest(req, 200);
511
+ }
512
+ catch (e) {
513
+ serverCtx.serve500(req, res, e, 'serveFile');
514
+ }
515
+ }
516
+ function updateStyleUrls(url, oldCss) {
517
+ const versionId = url.searchParams.get('s-hmr');
518
+ const hmrUrls = url.searchParams.get('s-hmr-urls');
519
+ if (versionId && hmrUrls) {
520
+ hmrUrls.split(',').forEach(hmrUrl => {
521
+ urlVersionIds.set(hmrUrl, versionId);
522
+ });
523
+ }
524
+ const reg = /url\((['"]?)(.*)\1\)/gi;
525
+ let result;
526
+ let newCss = oldCss;
527
+ while ((result = reg.exec(oldCss)) !== null) {
528
+ const oldUrl = result[2];
529
+ const parsedUrl = new URL(oldUrl, url);
530
+ const fileName = path__default['default'].basename(parsedUrl.pathname);
531
+ const versionId = urlVersionIds.get(fileName);
532
+ if (!versionId) {
533
+ continue;
534
+ }
535
+ parsedUrl.searchParams.set('s-hmr', versionId);
536
+ newCss = newCss.replace(oldUrl, parsedUrl.pathname);
537
+ }
538
+ return newCss;
539
+ }
540
+ const urlVersionIds = new Map();
541
+ function appendDevServerClientScript(devServerConfig, req, content) {
542
+ var _a, _b, _c;
543
+ const devServerClientUrl = getDevServerClientUrl(devServerConfig, (_b = (_a = req.headers) === null || _a === void 0 ? void 0 : _a['x-forwarded-host']) !== null && _b !== void 0 ? _b : req.host, (_c = req.headers) === null || _c === void 0 ? void 0 : _c['x-forwarded-proto']);
544
+ const iframe = `<iframe title="Rindo Dev Server Connector ${version} &#9889;" src="${devServerClientUrl}" style="display:block;width:0;height:0;border:0;visibility:hidden" aria-hidden="true"></iframe>`;
545
+ return appendDevServerClientIframe(content, iframe);
546
+ }
547
+ function appendDevServerClientIframe(content, iframe) {
548
+ if (content.includes('</body>')) {
549
+ return content.replace('</body>', `${iframe}</body>`);
550
+ }
551
+ if (content.includes('</html>')) {
552
+ return content.replace('</html>', `${iframe}</html>`);
553
+ }
554
+ return `${content}${iframe}`;
555
+ }
556
+
557
+ async function serveOpenInEditor(serverCtx, req, res) {
558
+ let status = 200;
559
+ const data = {};
560
+ try {
561
+ const editors = await getEditors();
562
+ if (editors.length > 0) {
563
+ await parseData(editors, serverCtx.sys, req, data);
564
+ await openDataInEditor(data);
565
+ }
566
+ else {
567
+ data.error = `no editors available`;
568
+ }
569
+ }
570
+ catch (e) {
571
+ data.error = e + '';
572
+ status = 500;
573
+ }
574
+ serverCtx.logRequest(req, status);
575
+ res.writeHead(status, responseHeaders({
576
+ 'content-type': 'application/json; charset=utf-8',
577
+ }));
578
+ res.write(JSON.stringify(data, null, 2));
579
+ res.end();
580
+ }
581
+ async function parseData(editors, sys, req, data) {
582
+ const qs = req.searchParams;
583
+ if (!qs.has('file')) {
584
+ data.error = `missing file`;
585
+ return;
586
+ }
587
+ data.file = qs.get('file');
588
+ if (qs.has('line') && !isNaN(qs.get('line'))) {
589
+ data.line = parseInt(qs.get('line'), 10);
590
+ }
591
+ if (typeof data.line !== 'number' || data.line < 1) {
592
+ data.line = 1;
593
+ }
594
+ if (qs.has('column') && !isNaN(qs.get('column'))) {
595
+ data.column = parseInt(qs.get('column'), 10);
596
+ }
597
+ if (typeof data.column !== 'number' || data.column < 1) {
598
+ data.column = 1;
599
+ }
600
+ let editor = qs.get('editor');
601
+ if (typeof editor === 'string') {
602
+ editor = editor.trim().toLowerCase();
603
+ if (editors.some(e => e.id === editor)) {
604
+ data.editor = editor;
605
+ }
606
+ else {
607
+ data.error = `invalid editor: ${editor}`;
608
+ return;
609
+ }
610
+ }
611
+ else {
612
+ data.editor = editors[0].id;
613
+ }
614
+ const stat = await sys.stat(data.file);
615
+ data.exists = stat.isFile;
616
+ }
617
+ async function openDataInEditor(data) {
618
+ if (!data.exists || data.error) {
619
+ return;
620
+ }
621
+ try {
622
+ const opts = {
623
+ editor: data.editor,
624
+ };
625
+ const editor = openInEditorApi__default['default'].configure(opts, err => (data.error = err + ''));
626
+ if (data.error) {
627
+ return;
628
+ }
629
+ data.open = `${data.file}:${data.line}:${data.column}`;
630
+ await editor.open(data.open);
631
+ }
632
+ catch (e) {
633
+ data.error = e + '';
634
+ }
635
+ }
636
+ let editors = null;
637
+ function getEditors() {
638
+ if (!editors) {
639
+ editors = new Promise(async (resolve) => {
640
+ const editors = [];
641
+ try {
642
+ await Promise.all(Object.keys(openInEditorApi__default['default'].editors).map(async (editorId) => {
643
+ const isSupported = await isEditorSupported(editorId);
644
+ editors.push({
645
+ id: editorId,
646
+ priority: EDITOR_PRIORITY[editorId],
647
+ supported: isSupported,
648
+ });
649
+ }));
650
+ }
651
+ catch (e) { }
652
+ resolve(editors
653
+ .filter(e => e.supported)
654
+ .sort((a, b) => {
655
+ if (a.priority < b.priority)
656
+ return -1;
657
+ if (a.priority > b.priority)
658
+ return 1;
659
+ return 0;
660
+ })
661
+ .map(e => {
662
+ return {
663
+ id: e.id,
664
+ name: EDITORS[e.id],
665
+ };
666
+ }));
667
+ });
668
+ }
669
+ return editors;
670
+ }
671
+ async function isEditorSupported(editorId) {
672
+ let isSupported = false;
673
+ try {
674
+ await openInEditorApi__default['default'].editors[editorId].detect();
675
+ isSupported = true;
676
+ }
677
+ catch (e) { }
678
+ return isSupported;
679
+ }
680
+ const EDITORS = {
681
+ atom: 'Atom',
682
+ code: 'Code',
683
+ emacs: 'Emacs',
684
+ idea14ce: 'IDEA 14 Community Edition',
685
+ phpstorm: 'PhpStorm',
686
+ sublime: 'Sublime',
687
+ webstorm: 'WebStorm',
688
+ vim: 'Vim',
689
+ visualstudio: 'Visual Studio',
690
+ };
691
+ const EDITOR_PRIORITY = {
692
+ code: 1,
693
+ atom: 2,
694
+ sublime: 3,
695
+ visualstudio: 4,
696
+ idea14ce: 5,
697
+ webstorm: 6,
698
+ phpstorm: 7,
699
+ vim: 8,
700
+ emacs: 9,
701
+ };
702
+
703
+ async function serveDevClient(devServerConfig, serverCtx, req, res) {
704
+ try {
705
+ if (isOpenInEditor(req.pathname)) {
706
+ return serveOpenInEditor(serverCtx, req, res);
707
+ }
708
+ if (isDevServerClient(req.pathname)) {
709
+ return serveDevClientScript(devServerConfig, serverCtx, req, res);
710
+ }
711
+ if (isInitialDevServerLoad(req.pathname)) {
712
+ req.filePath = path__default['default'].join(devServerConfig.devServerDir, 'templates', 'initial-load.html');
713
+ }
714
+ else {
715
+ const staticFile = req.pathname.replace(DEV_SERVER_URL + '/', '');
716
+ req.filePath = path__default['default'].join(devServerConfig.devServerDir, 'static', staticFile);
717
+ }
718
+ try {
719
+ req.stats = await serverCtx.sys.stat(req.filePath);
720
+ if (req.stats.isFile) {
721
+ return serveFile(devServerConfig, serverCtx, req, res);
722
+ }
723
+ return serverCtx.serve404(req, res, 'serveDevClient not file');
724
+ }
725
+ catch (e) {
726
+ return serverCtx.serve404(req, res, `serveDevClient stats error ${e}`);
727
+ }
728
+ }
729
+ catch (e) {
730
+ return serverCtx.serve500(req, res, e, 'serveDevClient');
731
+ }
732
+ }
733
+ async function serveDevClientScript(devServerConfig, serverCtx, req, res) {
734
+ try {
735
+ if (serverCtx.connectorHtml == null) {
736
+ const filePath = path__default['default'].join(devServerConfig.devServerDir, 'connector.html');
737
+ serverCtx.connectorHtml = serverCtx.sys.readFileSync(filePath, 'utf8');
738
+ if (typeof serverCtx.connectorHtml !== 'string') {
739
+ return serverCtx.serve404(req, res, `serveDevClientScript`);
740
+ }
741
+ const devClientConfig = {
742
+ basePath: devServerConfig.basePath,
743
+ editors: await getEditors(),
744
+ reloadStrategy: devServerConfig.reloadStrategy,
745
+ };
746
+ serverCtx.connectorHtml = serverCtx.connectorHtml.replace('window.__DEV_CLIENT_CONFIG__', JSON.stringify(devClientConfig));
747
+ }
748
+ res.writeHead(200, responseHeaders({
749
+ 'content-type': 'text/html; charset=utf-8',
750
+ }));
751
+ res.write(serverCtx.connectorHtml);
752
+ res.end();
753
+ }
754
+ catch (e) {
755
+ return serverCtx.serve500(req, res, e, `serveDevClientScript`);
756
+ }
757
+ }
758
+
759
+ async function serveDevNodeModule(serverCtx, req, res) {
760
+ try {
761
+ const results = await serverCtx.getCompilerRequest(req.pathname);
762
+ const headers = {
763
+ 'content-type': 'application/javascript; charset=utf-8',
764
+ 'content-length': Buffer.byteLength(results.content, 'utf8'),
765
+ 'x-dev-node-module-id': results.nodeModuleId,
766
+ 'x-dev-node-module-version': results.nodeModuleVersion,
767
+ 'x-dev-node-module-resolved-path': results.nodeResolvedPath,
768
+ 'x-dev-node-module-cache-path': results.cachePath,
769
+ 'x-dev-node-module-cache-hit': results.cacheHit,
770
+ };
771
+ res.writeHead(results.status, responseHeaders(headers));
772
+ res.write(results.content);
773
+ res.end();
774
+ }
775
+ catch (e) {
776
+ serverCtx.serve500(req, res, e, `serveDevNodeModule`);
777
+ }
778
+ }
779
+
780
+ async function serveDirectoryIndex(devServerConfig, serverCtx, req, res) {
781
+ const indexFilePath = path__default['default'].join(req.filePath, 'index.html');
782
+ req.stats = await serverCtx.sys.stat(indexFilePath);
783
+ if (req.stats.isFile) {
784
+ req.filePath = indexFilePath;
785
+ return serveFile(devServerConfig, serverCtx, req, res);
786
+ }
787
+ if (!req.pathname.endsWith('/')) {
788
+ return serverCtx.serve302(req, res, req.pathname + '/');
789
+ }
790
+ try {
791
+ const dirFilePaths = await serverCtx.sys.readDir(req.filePath);
792
+ try {
793
+ if (serverCtx.dirTemplate == null) {
794
+ const dirTemplatePath = path__default['default'].join(devServerConfig.devServerDir, 'templates', 'directory-index.html');
795
+ serverCtx.dirTemplate = serverCtx.sys.readFileSync(dirTemplatePath);
796
+ }
797
+ const files = await getFiles(serverCtx.sys, req.url, dirFilePaths);
798
+ const templateHtml = serverCtx.dirTemplate
799
+ .replace('{{title}}', getTitle(req.pathname))
800
+ .replace('{{nav}}', getName(req.pathname))
801
+ .replace('{{files}}', files);
802
+ serverCtx.logRequest(req, 200);
803
+ res.writeHead(200, responseHeaders({
804
+ 'content-type': 'text/html; charset=utf-8',
805
+ 'x-directory-index': req.pathname,
806
+ }));
807
+ res.write(templateHtml);
808
+ res.end();
809
+ }
810
+ catch (e) {
811
+ return serverCtx.serve500(req, res, e, 'serveDirectoryIndex');
812
+ }
813
+ }
814
+ catch (e) {
815
+ return serverCtx.serve404(req, res, 'serveDirectoryIndex');
816
+ }
817
+ }
818
+ async function getFiles(sys, baseUrl, dirItemNames) {
819
+ const items = await getDirectoryItems(sys, baseUrl, dirItemNames);
820
+ if (baseUrl.pathname !== '/') {
821
+ items.unshift({
822
+ isDirectory: true,
823
+ pathname: '../',
824
+ name: '..',
825
+ });
826
+ }
827
+ return items
828
+ .map(item => {
829
+ return `
830
+ <li class="${item.isDirectory ? 'directory' : 'file'}">
831
+ <a href="${item.pathname}">
832
+ <span class="icon"></span>
833
+ <span>${item.name}</span>
834
+ </a>
835
+ </li>`;
836
+ })
837
+ .join('');
838
+ }
839
+ async function getDirectoryItems(sys, baseUrl, dirFilePaths) {
840
+ const items = await Promise.all(dirFilePaths.map(async (dirFilePath) => {
841
+ const fileName = path__default['default'].basename(dirFilePath);
842
+ const url = new URL(fileName, baseUrl);
843
+ const stats = await sys.stat(dirFilePath);
844
+ const item = {
845
+ name: fileName,
846
+ pathname: url.pathname,
847
+ isDirectory: stats.isDirectory,
848
+ };
849
+ return item;
850
+ }));
851
+ return items;
852
+ }
853
+ function getTitle(pathName) {
854
+ return pathName;
855
+ }
856
+ function getName(pathName) {
857
+ const dirs = pathName.split('/');
858
+ dirs.pop();
859
+ let url = '';
860
+ return (dirs
861
+ .map((dir, index) => {
862
+ url += dir + '/';
863
+ const text = index === 0 ? `~` : dir;
864
+ return `<a href="${url}">${text}</a>`;
865
+ })
866
+ .join('<span>/</span>') + '<span>/</span>');
867
+ }
868
+
869
+ async function ssrPageRequest(devServerConfig, serverCtx, req, res) {
870
+ try {
871
+ let status = 500;
872
+ let content = '';
873
+ const { hydrateApp, srcIndexHtml, diagnostics } = await setupHydrateApp(devServerConfig, serverCtx);
874
+ if (!diagnostics.some(diagnostic => diagnostic.level === 'error')) {
875
+ try {
876
+ const opts = getSsrHydrateOptions(devServerConfig, serverCtx, req.url);
877
+ const ssrResults = await hydrateApp.renderToString(srcIndexHtml, opts);
878
+ diagnostics.push(...ssrResults.diagnostics);
879
+ status = ssrResults.httpStatus;
880
+ content = ssrResults.html;
881
+ }
882
+ catch (e) {
883
+ catchError(diagnostics, e);
884
+ }
885
+ }
886
+ if (diagnostics.some(diagnostic => diagnostic.level === 'error')) {
887
+ content = getSsrErrorContent(diagnostics);
888
+ status = 500;
889
+ }
890
+ if (devServerConfig.websocket) {
891
+ content = appendDevServerClientScript(devServerConfig, req, content);
892
+ }
893
+ serverCtx.logRequest(req, status);
894
+ res.writeHead(status, responseHeaders({
895
+ 'content-type': 'text/html; charset=utf-8',
896
+ 'content-length': Buffer.byteLength(content, 'utf8'),
897
+ }));
898
+ res.write(content);
899
+ res.end();
900
+ }
901
+ catch (e) {
902
+ serverCtx.serve500(req, res, e, `ssrPageRequest`);
903
+ }
904
+ }
905
+ async function ssrStaticDataRequest(devServerConfig, serverCtx, req, res) {
906
+ try {
907
+ const data = {};
908
+ let httpCache = false;
909
+ const { hydrateApp, srcIndexHtml, diagnostics } = await setupHydrateApp(devServerConfig, serverCtx);
910
+ if (!diagnostics.some(diagnostic => diagnostic.level === 'error')) {
911
+ try {
912
+ const { ssrPath, hasQueryString } = getSsrStaticDataPath(req);
913
+ const url = new URL(ssrPath, req.url);
914
+ const opts = getSsrHydrateOptions(devServerConfig, serverCtx, url);
915
+ const ssrResults = await hydrateApp.renderToString(srcIndexHtml, opts);
916
+ diagnostics.push(...ssrResults.diagnostics);
917
+ ssrResults.staticData.forEach(s => {
918
+ if (s.type === 'application/json') {
919
+ data[s.id] = JSON.parse(s.content);
920
+ }
921
+ else {
922
+ data[s.id] = s.content;
923
+ }
924
+ });
925
+ data.components = ssrResults.components.map(c => c.tag).sort();
926
+ httpCache = hasQueryString;
927
+ }
928
+ catch (e) {
929
+ catchError(diagnostics, e);
930
+ }
931
+ }
932
+ if (diagnostics.length > 0) {
933
+ data.diagnostics = diagnostics;
934
+ }
935
+ const status = diagnostics.some(diagnostic => diagnostic.level === 'error') ? 500 : 200;
936
+ const content = JSON.stringify(data);
937
+ serverCtx.logRequest(req, status);
938
+ res.writeHead(status, responseHeaders({
939
+ 'content-type': 'application/json; charset=utf-8',
940
+ 'content-length': Buffer.byteLength(content, 'utf8'),
941
+ }, httpCache && status === 200));
942
+ res.write(content);
943
+ res.end();
944
+ }
945
+ catch (e) {
946
+ serverCtx.serve500(req, res, e, `ssrStaticDataRequest`);
947
+ }
948
+ }
949
+ async function setupHydrateApp(devServerConfig, serverCtx) {
950
+ let srcIndexHtml = null;
951
+ let hydrateApp = null;
952
+ const buildResults = await serverCtx.getBuildResults();
953
+ const diagnostics = [];
954
+ if (serverCtx.prerenderConfig == null && isString(devServerConfig.prerenderConfig)) {
955
+ const compilerPath = path__default['default'].join(devServerConfig.devServerDir, '..', 'compiler', 'rindo.js');
956
+ const compiler = require(compilerPath);
957
+ const prerenderConfigResults = compiler.nodeRequire(devServerConfig.prerenderConfig);
958
+ diagnostics.push(...prerenderConfigResults.diagnostics);
959
+ if (prerenderConfigResults.module && prerenderConfigResults.module.config) {
960
+ serverCtx.prerenderConfig = prerenderConfigResults.module.config;
961
+ }
962
+ }
963
+ if (!isString(buildResults.hydrateAppFilePath)) {
964
+ diagnostics.push({ messageText: `Missing hydrateAppFilePath`, level: `error`, type: `ssr` });
965
+ }
966
+ else if (!isString(devServerConfig.srcIndexHtml)) {
967
+ diagnostics.push({ messageText: `Missing srcIndexHtml`, level: `error`, type: `ssr` });
968
+ }
969
+ else {
970
+ srcIndexHtml = await serverCtx.sys.readFile(devServerConfig.srcIndexHtml);
971
+ if (!isString(srcIndexHtml)) {
972
+ diagnostics.push({
973
+ messageText: `Unable to load src index html: ${devServerConfig.srcIndexHtml}`,
974
+ level: `error`,
975
+ type: `ssr`,
976
+ });
977
+ }
978
+ else {
979
+ // ensure we cleared out node's internal require() cache for this file
980
+ const hydrateAppFilePath = path__default['default'].resolve(buildResults.hydrateAppFilePath);
981
+ // brute force way of clearning node's module cache
982
+ // not using `delete require.cache[id]` since it'll cause memory leaks
983
+ require.cache = {};
984
+ const Module = require('module');
985
+ Module._cache[hydrateAppFilePath] = undefined;
986
+ hydrateApp = require(hydrateAppFilePath);
987
+ }
988
+ }
989
+ return {
990
+ hydrateApp,
991
+ srcIndexHtml,
992
+ diagnostics,
993
+ };
994
+ }
995
+ function getSsrHydrateOptions(devServerConfig, serverCtx, url) {
996
+ const opts = {
997
+ url: url.href,
998
+ addModulePreloads: false,
999
+ approximateLineWidth: 120,
1000
+ inlineExternalStyleSheets: false,
1001
+ minifyScriptElements: false,
1002
+ minifyStyleElements: false,
1003
+ removeAttributeQuotes: false,
1004
+ removeBooleanAttributeQuotes: false,
1005
+ removeEmptyAttributes: false,
1006
+ removeHtmlComments: false,
1007
+ prettyHtml: true,
1008
+ };
1009
+ const prerenderConfig = serverCtx === null || serverCtx === void 0 ? void 0 : serverCtx.prerenderConfig;
1010
+ if (isFunction(prerenderConfig === null || prerenderConfig === void 0 ? void 0 : prerenderConfig.hydrateOptions)) {
1011
+ const userOpts = prerenderConfig.hydrateOptions(url);
1012
+ if (userOpts) {
1013
+ Object.assign(opts, userOpts);
1014
+ }
1015
+ }
1016
+ if (isFunction(serverCtx.sys.applyPrerenderGlobalPatch)) {
1017
+ const orgBeforeHydrate = opts.beforeHydrate;
1018
+ opts.beforeHydrate = (document) => {
1019
+ // patch this new window with the fetch global from node-fetch
1020
+ const devServerBaseUrl = new URL(devServerConfig.browserUrl);
1021
+ const devServerHostUrl = devServerBaseUrl.origin;
1022
+ serverCtx.sys.applyPrerenderGlobalPatch({
1023
+ devServerHostUrl: devServerHostUrl,
1024
+ window: document.defaultView,
1025
+ });
1026
+ if (typeof orgBeforeHydrate === 'function') {
1027
+ return orgBeforeHydrate(document);
1028
+ }
1029
+ };
1030
+ }
1031
+ return opts;
1032
+ }
1033
+ function getSsrErrorContent(diagnostics) {
1034
+ return `<!doctype html>
1035
+ <html>
1036
+ <head>
1037
+ <title>SSR Error</title>
1038
+ <style>
1039
+ body {
1040
+ font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important;
1041
+ }
1042
+ </style>
1043
+ </head>
1044
+ <body>
1045
+ <h1>SSR Dev Error</h1>
1046
+ ${diagnostics.map(diagnostic => `
1047
+ <p>
1048
+ ${diagnostic.messageText}
1049
+ </p>
1050
+ `)}
1051
+ </body>
1052
+ </html>`;
1053
+ }
1054
+
1055
+ function createRequestHandler(devServerConfig, serverCtx) {
1056
+ let userRequestHandler = null;
1057
+ if (typeof devServerConfig.requestListenerPath === 'string') {
1058
+ userRequestHandler = require(devServerConfig.requestListenerPath);
1059
+ }
1060
+ return async function (incomingReq, res) {
1061
+ async function defaultHandler() {
1062
+ try {
1063
+ const req = normalizeHttpRequest(devServerConfig, incomingReq);
1064
+ if (!req.url) {
1065
+ return serverCtx.serve302(req, res);
1066
+ }
1067
+ if (isDevClient(req.pathname) && devServerConfig.websocket) {
1068
+ return serveDevClient(devServerConfig, serverCtx, req, res);
1069
+ }
1070
+ if (isDevModule(req.pathname)) {
1071
+ return serveDevNodeModule(serverCtx, req, res);
1072
+ }
1073
+ if (!isValidUrlBasePath(devServerConfig.basePath, req.url)) {
1074
+ return serverCtx.serve404(req, res, `invalid basePath`, `404 File Not Found, base path: ${devServerConfig.basePath}`);
1075
+ }
1076
+ if (devServerConfig.ssr) {
1077
+ if (isExtensionLessPath(req.url.pathname)) {
1078
+ return ssrPageRequest(devServerConfig, serverCtx, req, res);
1079
+ }
1080
+ if (isSsrStaticDataPath(req.url.pathname)) {
1081
+ return ssrStaticDataRequest(devServerConfig, serverCtx, req, res);
1082
+ }
1083
+ }
1084
+ req.stats = await serverCtx.sys.stat(req.filePath);
1085
+ if (req.stats.isFile) {
1086
+ return serveFile(devServerConfig, serverCtx, req, res);
1087
+ }
1088
+ if (req.stats.isDirectory) {
1089
+ return serveDirectoryIndex(devServerConfig, serverCtx, req, res);
1090
+ }
1091
+ const xSource = ['notfound'];
1092
+ const validHistoryApi = isValidHistoryApi(devServerConfig, req);
1093
+ xSource.push(`validHistoryApi: ${validHistoryApi}`);
1094
+ if (validHistoryApi) {
1095
+ try {
1096
+ const indexFilePath = path__default['default'].join(devServerConfig.root, devServerConfig.historyApiFallback.index);
1097
+ xSource.push(`indexFilePath: ${indexFilePath}`);
1098
+ req.stats = await serverCtx.sys.stat(indexFilePath);
1099
+ if (req.stats.isFile) {
1100
+ req.filePath = indexFilePath;
1101
+ return serveFile(devServerConfig, serverCtx, req, res);
1102
+ }
1103
+ }
1104
+ catch (e) {
1105
+ xSource.push(`notfound error: ${e}`);
1106
+ }
1107
+ }
1108
+ return serverCtx.serve404(req, res, xSource.join(', '));
1109
+ }
1110
+ catch (e) {
1111
+ return serverCtx.serve500(incomingReq, res, e, `not found error`);
1112
+ }
1113
+ }
1114
+ if (typeof userRequestHandler === 'function') {
1115
+ await userRequestHandler(incomingReq, res, defaultHandler);
1116
+ }
1117
+ else {
1118
+ await defaultHandler();
1119
+ }
1120
+ };
1121
+ }
1122
+ function isValidUrlBasePath(basePath, url) {
1123
+ // normalize the paths to always end with a slash for the check
1124
+ let pathname = url.pathname;
1125
+ if (!pathname.endsWith('/')) {
1126
+ pathname += '/';
1127
+ }
1128
+ if (!basePath.endsWith('/')) {
1129
+ basePath += '/';
1130
+ }
1131
+ return pathname.startsWith(basePath);
1132
+ }
1133
+ function normalizeHttpRequest(devServerConfig, incomingReq) {
1134
+ const req = {
1135
+ method: (incomingReq.method || 'GET').toUpperCase(),
1136
+ headers: incomingReq.headers,
1137
+ acceptHeader: (incomingReq.headers && typeof incomingReq.headers.accept === 'string' && incomingReq.headers.accept) || '',
1138
+ host: (incomingReq.headers && typeof incomingReq.headers.host === 'string' && incomingReq.headers.host) || null,
1139
+ url: null,
1140
+ searchParams: null,
1141
+ };
1142
+ const incomingUrl = (incomingReq.url || '').trim() || null;
1143
+ if (incomingUrl) {
1144
+ if (req.host) {
1145
+ req.url = new URL(incomingReq.url, `http://${req.host}`);
1146
+ }
1147
+ else {
1148
+ req.url = new URL(incomingReq.url, `http://dev-rindojs.web.app`);
1149
+ }
1150
+ req.searchParams = req.url.searchParams;
1151
+ }
1152
+ if (req.url) {
1153
+ const parts = req.url.pathname.replace(/\\/g, '/').split('/');
1154
+ req.pathname = parts.map(part => decodeURIComponent(part)).join('/');
1155
+ if (req.pathname.length > 0 && !isDevClient(req.pathname)) {
1156
+ req.pathname = '/' + req.pathname.substring(devServerConfig.basePath.length);
1157
+ }
1158
+ req.filePath = normalizePath(path__default['default'].normalize(path__default['default'].join(devServerConfig.root, path__default['default'].relative('/', req.pathname))));
1159
+ }
1160
+ return req;
1161
+ }
1162
+ function isValidHistoryApi(devServerConfig, req) {
1163
+ if (!devServerConfig.historyApiFallback) {
1164
+ return false;
1165
+ }
1166
+ if (req.method !== 'GET') {
1167
+ return false;
1168
+ }
1169
+ if (!req.acceptHeader.includes('text/html')) {
1170
+ return false;
1171
+ }
1172
+ if (!devServerConfig.historyApiFallback.disableDotRule && req.pathname.includes('.')) {
1173
+ return false;
1174
+ }
1175
+ return true;
1176
+ }
1177
+
1178
+ function createHttpServer(devServerConfig, serverCtx) {
1179
+ // create our request handler
1180
+ const reqHandler = createRequestHandler(devServerConfig, serverCtx);
1181
+ const credentials = devServerConfig.https;
1182
+ return credentials ? https__namespace.createServer(credentials, reqHandler) : http__namespace.createServer(reqHandler);
1183
+ }
1184
+ async function findClosestOpenPort(host, port) {
1185
+ async function t(portToCheck) {
1186
+ const isTaken = await isPortTaken(host, portToCheck);
1187
+ if (!isTaken) {
1188
+ return portToCheck;
1189
+ }
1190
+ return t(portToCheck + 1);
1191
+ }
1192
+ return t(port);
1193
+ }
1194
+ function isPortTaken(host, port) {
1195
+ return new Promise((resolve, reject) => {
1196
+ const tester = net__namespace
1197
+ .createServer()
1198
+ .once('error', () => {
1199
+ resolve(true);
1200
+ })
1201
+ .once('listening', () => {
1202
+ tester
1203
+ .once('close', () => {
1204
+ resolve(false);
1205
+ })
1206
+ .close();
1207
+ })
1208
+ .on('error', (err) => {
1209
+ reject(err);
1210
+ })
1211
+ .listen(port, host);
1212
+ });
1213
+ }
1214
+
1215
+ function createWebSocket(httpServer, onMessageFromClient) {
1216
+ const wsConfig = {
1217
+ server: httpServer,
1218
+ };
1219
+ const wsServer = new ws__namespace.Server(wsConfig);
1220
+ function heartbeat() {
1221
+ this.isAlive = true;
1222
+ }
1223
+ wsServer.on('connection', (ws) => {
1224
+ ws.on('message', data => {
1225
+ // the server process has received a message from the browser
1226
+ // pass the message received from the browser to the main cli process
1227
+ try {
1228
+ onMessageFromClient(JSON.parse(data.toString()));
1229
+ }
1230
+ catch (e) {
1231
+ console.error(e);
1232
+ }
1233
+ });
1234
+ ws.isAlive = true;
1235
+ ws.on('pong', heartbeat);
1236
+ });
1237
+ const pingInternval = setInterval(() => {
1238
+ wsServer.clients.forEach((ws) => {
1239
+ if (!ws.isAlive) {
1240
+ return ws.close(1000);
1241
+ }
1242
+ ws.isAlive = false;
1243
+ ws.ping(noop);
1244
+ });
1245
+ }, 10000);
1246
+ return {
1247
+ sendToBrowser: (msg) => {
1248
+ if (msg && wsServer && wsServer.clients) {
1249
+ const data = JSON.stringify(msg);
1250
+ wsServer.clients.forEach(ws => {
1251
+ if (ws.readyState === ws.OPEN) {
1252
+ ws.send(data);
1253
+ }
1254
+ });
1255
+ }
1256
+ },
1257
+ close: () => {
1258
+ return new Promise((resolve, reject) => {
1259
+ clearInterval(pingInternval);
1260
+ wsServer.clients.forEach(ws => {
1261
+ ws.close(1000);
1262
+ });
1263
+ wsServer.close(err => {
1264
+ if (err) {
1265
+ reject(err);
1266
+ }
1267
+ else {
1268
+ resolve();
1269
+ }
1270
+ });
1271
+ });
1272
+ },
1273
+ };
1274
+ }
1275
+
1276
+ function createCommonjsModule(fn, basedir, module) {
1277
+ return module = {
1278
+ path: basedir,
1279
+ exports: {},
1280
+ require: function (path, base) {
1281
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
1282
+ }
1283
+ }, fn(module, module.exports), module.exports;
1284
+ }
1285
+
1286
+ function commonjsRequire () {
1287
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1288
+ }
1289
+
1290
+ let isDocker;
1291
+
1292
+ function hasDockerEnv() {
1293
+ try {
1294
+ fs__default$1['default'].statSync('/.dockerenv');
1295
+ return true;
1296
+ } catch (_) {
1297
+ return false;
1298
+ }
1299
+ }
1300
+
1301
+ function hasDockerCGroup() {
1302
+ try {
1303
+ return fs__default$1['default'].readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
1304
+ } catch (_) {
1305
+ return false;
1306
+ }
1307
+ }
1308
+
1309
+ var isDocker_1 = () => {
1310
+ if (isDocker === undefined) {
1311
+ isDocker = hasDockerEnv() || hasDockerCGroup();
1312
+ }
1313
+
1314
+ return isDocker;
1315
+ };
1316
+
1317
+ var isWsl_1 = createCommonjsModule(function (module) {
1318
+
1319
+
1320
+
1321
+
1322
+ const isWsl = () => {
1323
+ if (process.platform !== 'linux') {
1324
+ return false;
1325
+ }
1326
+
1327
+ if (os__default['default'].release().toLowerCase().includes('microsoft')) {
1328
+ if (isDocker_1()) {
1329
+ return false;
1330
+ }
1331
+
1332
+ return true;
1333
+ }
1334
+
1335
+ try {
1336
+ return fs__default$1['default'].readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ?
1337
+ !isDocker_1() : false;
1338
+ } catch (_) {
1339
+ return false;
1340
+ }
1341
+ };
1342
+
1343
+ if (process.env.__IS_WSL_TEST__) {
1344
+ module.exports = isWsl;
1345
+ } else {
1346
+ module.exports = isWsl();
1347
+ }
1348
+ });
1349
+
1350
+ var defineLazyProp = (object, propertyName, fn) => {
1351
+ const define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});
1352
+
1353
+ Object.defineProperty(object, propertyName, {
1354
+ configurable: true,
1355
+ enumerable: true,
1356
+ get() {
1357
+ const result = fn();
1358
+ define(result);
1359
+ return result;
1360
+ },
1361
+ set(value) {
1362
+ define(value);
1363
+ }
1364
+ });
1365
+
1366
+ return object;
1367
+ };
1368
+
1369
+ const {promises: fs} = fs__default$1['default'];
1370
+
1371
+
1372
+
1373
+
1374
+ // Path to included `xdg-open`.
1375
+ const localXdgOpenPath = path__default['default'].join(__dirname, 'xdg-open');
1376
+
1377
+ const {platform, arch} = process;
1378
+
1379
+ /**
1380
+ Get the mount point for fixed drives in WSL.
1381
+
1382
+ @inner
1383
+ @returns {string} The mount point.
1384
+ */
1385
+ const getWslDrivesMountPoint = (() => {
1386
+ // Default value for "root" param
1387
+ // according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config
1388
+ const defaultMountPoint = '/mnt/';
1389
+
1390
+ let mountPoint;
1391
+
1392
+ return async function () {
1393
+ if (mountPoint) {
1394
+ // Return memoized mount point value
1395
+ return mountPoint;
1396
+ }
1397
+
1398
+ const configFilePath = '/etc/wsl.conf';
1399
+
1400
+ let isConfigFileExists = false;
1401
+ try {
1402
+ await fs.access(configFilePath, fs.constants.F_OK);
1403
+ isConfigFileExists = true;
1404
+ } catch {}
1405
+
1406
+ if (!isConfigFileExists) {
1407
+ return defaultMountPoint;
1408
+ }
1409
+
1410
+ const configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});
1411
+ const configMountPoint = /root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
1412
+
1413
+ if (!configMountPoint) {
1414
+ return defaultMountPoint;
1415
+ }
1416
+
1417
+ mountPoint = configMountPoint.groups.mountPoint.trim();
1418
+ mountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;
1419
+
1420
+ return mountPoint;
1421
+ };
1422
+ })();
1423
+
1424
+ const pTryEach = async (array, mapper) => {
1425
+ let latestError;
1426
+
1427
+ for (const item of array) {
1428
+ try {
1429
+ return await mapper(item); // eslint-disable-line no-await-in-loop
1430
+ } catch (error) {
1431
+ latestError = error;
1432
+ }
1433
+ }
1434
+
1435
+ throw latestError;
1436
+ };
1437
+
1438
+ const open = async (target, options) => {
1439
+ if (typeof target !== 'string') {
1440
+ throw new TypeError('Expected a `target`');
1441
+ }
1442
+
1443
+ options = {
1444
+ wait: false,
1445
+ background: false,
1446
+ allowNonzeroExitCode: false,
1447
+ ...options
1448
+ };
1449
+
1450
+ if (Array.isArray(options.app)) {
1451
+ return pTryEach(options.app, singleApp => open(target, {
1452
+ ...options,
1453
+ app: singleApp
1454
+ }));
1455
+ }
1456
+
1457
+ let {name: app, arguments: appArguments = []} = options.app || {};
1458
+
1459
+ if (Array.isArray(app)) {
1460
+ return pTryEach(app, appName => open(target, {
1461
+ ...options,
1462
+ app: {
1463
+ name: appName,
1464
+ arguments: appArguments
1465
+ }
1466
+ }));
1467
+ }
1468
+
1469
+ let command;
1470
+ const cliArguments = [];
1471
+ const childProcessOptions = {};
1472
+
1473
+ if (platform === 'darwin') {
1474
+ command = 'open';
1475
+
1476
+ if (options.wait) {
1477
+ cliArguments.push('--wait-apps');
1478
+ }
1479
+
1480
+ if (options.background) {
1481
+ cliArguments.push('--background');
1482
+ }
1483
+
1484
+ if (app) {
1485
+ cliArguments.push('-a', app);
1486
+ }
1487
+ } else if (platform === 'win32' || (isWsl_1 && !isDocker_1())) {
1488
+ const mountPoint = await getWslDrivesMountPoint();
1489
+
1490
+ command = isWsl_1 ?
1491
+ `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` :
1492
+ `${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
1493
+
1494
+ cliArguments.push(
1495
+ '-NoProfile',
1496
+ '-NonInteractive',
1497
+ '–ExecutionPolicy',
1498
+ 'Bypass',
1499
+ '–WindowStyle',
1500
+ 'Hidden',
1501
+ '-EncodedCommand'
1502
+ );
1503
+
1504
+ if (!isWsl_1) {
1505
+ childProcessOptions.windowsVerbatimArguments = true;
1506
+ }
1507
+
1508
+ const encodedArguments = ['Start'];
1509
+
1510
+ if (options.wait) {
1511
+ encodedArguments.push('-Wait');
1512
+ }
1513
+
1514
+ if (app) {
1515
+ // Double quote with double quotes to ensure the inner quotes are passed through.
1516
+ // Inner quotes are delimited for PowerShell interpretation with backticks.
1517
+ encodedArguments.push(`"\`"${app}\`""`, '-ArgumentList');
1518
+ appArguments.unshift(target);
1519
+ } else {
1520
+ encodedArguments.push(`"${target}"`);
1521
+ }
1522
+
1523
+ if (appArguments.length > 0) {
1524
+ appArguments = appArguments.map(arg => `"\`"${arg}\`""`);
1525
+ encodedArguments.push(appArguments.join(','));
1526
+ }
1527
+
1528
+ // Using Base64-encoded command, accepted by PowerShell, to allow special characters.
1529
+ target = Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
1530
+ } else {
1531
+ if (app) {
1532
+ command = app;
1533
+ } else {
1534
+ // When bundled by Webpack, there's no actual package file path and no local `xdg-open`.
1535
+ const isBundled = !__dirname || __dirname === '/';
1536
+
1537
+ // Check if local `xdg-open` exists and is executable.
1538
+ let exeLocalXdgOpen = false;
1539
+ try {
1540
+ await fs.access(localXdgOpenPath, fs.constants.X_OK);
1541
+ exeLocalXdgOpen = true;
1542
+ } catch {}
1543
+
1544
+ const useSystemXdgOpen = process.versions.electron ||
1545
+ platform === 'android' || isBundled || !exeLocalXdgOpen;
1546
+ command = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;
1547
+ }
1548
+
1549
+ if (appArguments.length > 0) {
1550
+ cliArguments.push(...appArguments);
1551
+ }
1552
+
1553
+ if (!options.wait) {
1554
+ // `xdg-open` will block the process unless stdio is ignored
1555
+ // and it's detached from the parent even if it's unref'd.
1556
+ childProcessOptions.stdio = 'ignore';
1557
+ childProcessOptions.detached = true;
1558
+ }
1559
+ }
1560
+
1561
+ cliArguments.push(target);
1562
+
1563
+ if (platform === 'darwin' && appArguments.length > 0) {
1564
+ cliArguments.push('--args', ...appArguments);
1565
+ }
1566
+
1567
+ const subprocess = childProcess__default['default'].spawn(command, cliArguments, childProcessOptions);
1568
+
1569
+ if (options.wait) {
1570
+ return new Promise((resolve, reject) => {
1571
+ subprocess.once('error', reject);
1572
+
1573
+ subprocess.once('close', exitCode => {
1574
+ if (options.allowNonzeroExitCode && exitCode > 0) {
1575
+ reject(new Error(`Exited with code ${exitCode}`));
1576
+ return;
1577
+ }
1578
+
1579
+ resolve(subprocess);
1580
+ });
1581
+ });
1582
+ }
1583
+
1584
+ subprocess.unref();
1585
+
1586
+ return subprocess;
1587
+ };
1588
+
1589
+ function detectArchBinary(binary) {
1590
+ if (typeof binary === 'string') {
1591
+ return binary;
1592
+ }
1593
+
1594
+ const {[arch]: archBinary} = binary;
1595
+
1596
+ if (!archBinary) {
1597
+ throw new Error(`${arch} is not supported`);
1598
+ }
1599
+
1600
+ return archBinary;
1601
+ }
1602
+
1603
+ function detectPlatformBinary({[platform]: platformBinary}, {wsl}) {
1604
+ if (wsl && isWsl_1) {
1605
+ return detectArchBinary(wsl);
1606
+ }
1607
+
1608
+ if (!platformBinary) {
1609
+ throw new Error(`${platform} is not supported`);
1610
+ }
1611
+
1612
+ return detectArchBinary(platformBinary);
1613
+ }
1614
+
1615
+ const apps = {};
1616
+
1617
+ defineLazyProp(apps, 'chrome', () => detectPlatformBinary({
1618
+ darwin: 'google chrome canary',
1619
+ win32: 'chrome',
1620
+ linux: ['google-chrome', 'google-chrome-stable']
1621
+ }, {
1622
+ wsl: {
1623
+ ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
1624
+ x64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe']
1625
+ }
1626
+ }));
1627
+
1628
+ defineLazyProp(apps, 'firefox', () => detectPlatformBinary({
1629
+ darwin: 'firefox',
1630
+ win32: 'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
1631
+ linux: 'firefox'
1632
+ }, {
1633
+ wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
1634
+ }));
1635
+
1636
+ open.apps = apps;
1637
+
1638
+ var open_1 = open;
1639
+
1640
+ async function openInBrowser(opts) {
1641
+ // await open(opts.url, { app: ['google chrome', '--auto-open-devtools-for-tabs'] });
1642
+ await open_1(opts.url);
1643
+ }
1644
+
1645
+ function initServerProcess(sendMsg) {
1646
+ let server = null;
1647
+ let webSocket = null;
1648
+ let serverCtx = null;
1649
+ const buildResultsResolves = [];
1650
+ const compilerRequestResolves = [];
1651
+ const startServer = async (msg) => {
1652
+ const devServerConfig = msg.startServer;
1653
+ devServerConfig.port = await findClosestOpenPort(devServerConfig.address, devServerConfig.port);
1654
+ devServerConfig.browserUrl = getBrowserUrl(devServerConfig.protocol, devServerConfig.address, devServerConfig.port, devServerConfig.basePath, '/');
1655
+ devServerConfig.root = normalizePath(devServerConfig.root);
1656
+ const sys = index_js.createNodeSys({ process });
1657
+ serverCtx = createServerContext(sys, sendMsg, devServerConfig, buildResultsResolves, compilerRequestResolves);
1658
+ server = createHttpServer(devServerConfig, serverCtx);
1659
+ webSocket = devServerConfig.websocket ? createWebSocket(server, sendMsg) : null;
1660
+ server.listen(devServerConfig.port, devServerConfig.address);
1661
+ serverCtx.isServerListening = true;
1662
+ if (devServerConfig.openBrowser) {
1663
+ const initialLoadUrl = getBrowserUrl(devServerConfig.protocol, devServerConfig.address, devServerConfig.port, devServerConfig.basePath, devServerConfig.initialLoadUrl || DEV_SERVER_INIT_URL);
1664
+ openInBrowser({ url: initialLoadUrl });
1665
+ }
1666
+ sendMsg({ serverStarted: devServerConfig });
1667
+ };
1668
+ const closeServer = () => {
1669
+ const promises = [];
1670
+ buildResultsResolves.forEach(r => r.reject('dev server closed'));
1671
+ buildResultsResolves.length = 0;
1672
+ compilerRequestResolves.forEach(r => r.reject('dev server closed'));
1673
+ compilerRequestResolves.length = 0;
1674
+ if (serverCtx) {
1675
+ if (serverCtx.sys) {
1676
+ promises.push(serverCtx.sys.destroy());
1677
+ }
1678
+ }
1679
+ if (webSocket) {
1680
+ promises.push(webSocket.close());
1681
+ webSocket = null;
1682
+ }
1683
+ if (server) {
1684
+ promises.push(new Promise(resolve => {
1685
+ server.close(err => {
1686
+ if (err) {
1687
+ console.error(`close error: ${err}`);
1688
+ }
1689
+ resolve();
1690
+ });
1691
+ }));
1692
+ }
1693
+ Promise.all(promises).finally(() => {
1694
+ sendMsg({
1695
+ serverClosed: true,
1696
+ });
1697
+ });
1698
+ };
1699
+ const receiveMessageFromMain = (msg) => {
1700
+ // the server process received a message from main thread
1701
+ try {
1702
+ if (msg) {
1703
+ if (msg.startServer) {
1704
+ startServer(msg);
1705
+ }
1706
+ else if (msg.closeServer) {
1707
+ closeServer();
1708
+ }
1709
+ else if (msg.compilerRequestResults) {
1710
+ for (let i = compilerRequestResolves.length - 1; i >= 0; i--) {
1711
+ const r = compilerRequestResolves[i];
1712
+ if (r.path === msg.compilerRequestResults.path) {
1713
+ r.resolve(msg.compilerRequestResults);
1714
+ compilerRequestResolves.splice(i, 1);
1715
+ }
1716
+ }
1717
+ }
1718
+ else if (serverCtx) {
1719
+ if (msg.buildResults && !msg.isActivelyBuilding) {
1720
+ buildResultsResolves.forEach(r => r.resolve(msg.buildResults));
1721
+ buildResultsResolves.length = 0;
1722
+ }
1723
+ if (webSocket) {
1724
+ webSocket.sendToBrowser(msg);
1725
+ }
1726
+ }
1727
+ }
1728
+ }
1729
+ catch (e) {
1730
+ sendMsg({
1731
+ error: { message: e + '', stack: (e === null || e === void 0 ? void 0 : e.stack) ? e.stack : null },
1732
+ });
1733
+ }
1734
+ };
1735
+ return receiveMessageFromMain;
1736
+ }
1737
+
1738
+ exports.initServerProcess = initServerProcess;