@rindo/core 1.8.12 → 1.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (545) hide show
  1. package/bin/rindo +53 -19
  2. package/cli/index.cjs.js +524 -0
  3. package/cli/index.d.ts +15 -0
  4. package/cli/index.js +500 -0
  5. package/cli/package.json +9 -0
  6. package/compiler/package.json +8 -6
  7. package/compiler/rindo.d.ts +111 -0
  8. package/compiler/rindo.js +62852 -6655
  9. package/compiler/rindo.min.js +17 -0
  10. package/dependencies.json +80 -0
  11. package/dev-server/client/app-error.d.ts +18 -0
  12. package/dev-server/client/events.d.ts +6 -0
  13. package/dev-server/client/hmr-components.d.ts +1 -0
  14. package/dev-server/client/hmr-external-styles.d.ts +1 -0
  15. package/dev-server/client/hmr-images.d.ts +1 -0
  16. package/dev-server/client/hmr-inline-styles.d.ts +1 -0
  17. package/dev-server/client/hmr-util.d.ts +9 -0
  18. package/dev-server/client/hmr-window.d.ts +10 -0
  19. package/dev-server/client/index.d.ts +6 -0
  20. package/dev-server/client/index.js +785 -0
  21. package/dev-server/client/logger.d.ts +5 -0
  22. package/dev-server/client/package.json +8 -0
  23. package/dev-server/client/progress.d.ts +3 -0
  24. package/dev-server/client/status.d.ts +4 -0
  25. package/dev-server/connector.html +6 -0
  26. package/dev-server/content-type-db.json +1 -0
  27. package/dev-server/index.d.ts +6 -0
  28. package/dev-server/index.js +260 -0
  29. package/dev-server/open-in-editor-api.js +1 -0
  30. package/dev-server/package.json +8 -0
  31. package/dev-server/server-worker.js +1570 -0
  32. package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
  33. package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
  34. package/dev-server/templates/initial-load.html +160 -0
  35. package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
  36. package/dev-server/ws.js +1 -0
  37. package/{dist/sys/node → dev-server}/xdg-open +0 -0
  38. package/internal/app-data/index.cjs.js +88 -0
  39. package/internal/app-data/index.d.ts +3 -0
  40. package/internal/{client/build-conditionals.mjs → app-data/index.js} +24 -21
  41. package/internal/app-data/package.json +9 -0
  42. package/internal/client/css-shim.js +4 -0
  43. package/internal/client/{dom.rindo-client.mjs → dom.js} +73 -137
  44. package/{dist/client/index.mjs → internal/client/index.js} +736 -736
  45. package/internal/client/package.json +7 -0
  46. package/internal/client/patch.js +136 -0
  47. package/internal/client/polyfills/core-js.js +11 -10
  48. package/internal/client/polyfills/css-shim.js +1 -656
  49. package/internal/client/polyfills/dom.js +79 -146
  50. package/internal/client/polyfills/es5-html-element.js +1 -18
  51. package/internal/client/polyfills/index.js +6 -7
  52. package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +14 -17
  53. package/internal/hydrate/index.js +1073 -0
  54. package/internal/hydrate/package.json +7 -0
  55. package/internal/hydrate/runner.d.ts +205 -0
  56. package/internal/hydrate/runner.js +748 -0
  57. package/internal/hydrate/shadow-css.js +146 -0
  58. package/internal/index.d.ts +4 -18
  59. package/internal/index.js +1 -1
  60. package/internal/package.json +8 -6
  61. package/internal/rindo-core/index.d.ts +2 -0
  62. package/{dist → internal/rindo-core}/index.js +0 -0
  63. package/internal/rindo-ext-modules.d.ts +39 -0
  64. package/internal/rindo-private.d.ts +2183 -0
  65. package/internal/rindo-public-compiler.d.ts +2094 -0
  66. package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
  67. package/internal/rindo-public-runtime.d.ts +1552 -0
  68. package/internal/testing/index.js +1032 -0
  69. package/internal/testing/package.json +7 -0
  70. package/internal/testing/shadow-css.js +146 -0
  71. package/mock-doc/index.cjs.js +4500 -0
  72. package/mock-doc/index.d.ts +905 -0
  73. package/mock-doc/index.js +4464 -2
  74. package/mock-doc/package.json +9 -10
  75. package/package.json +84 -137
  76. package/readme.md +3 -82
  77. package/screenshot/compare/build/app.css +1 -1
  78. package/screenshot/compare/build/app.esm.js +1 -1
  79. package/screenshot/compare/build/app.js +27 -812
  80. package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
  81. package/screenshot/compare/build/{p-113f7459.js → p-081b0641.js} +1 -1
  82. package/screenshot/compare/build/p-227a1e18.entry.js +1 -0
  83. package/screenshot/compare/build/p-2c298727.entry.js +1 -0
  84. package/screenshot/compare/build/p-5479268c.entry.js +1 -0
  85. package/screenshot/compare/build/p-573ec8a4.entry.js +1 -0
  86. package/screenshot/compare/build/p-6ba08604.entry.js +1 -0
  87. package/screenshot/compare/build/p-6bc63295.entry.js +1 -0
  88. package/screenshot/compare/build/p-7a3759fd.entry.js +1 -0
  89. package/screenshot/compare/build/{p-ejpsp3kx.js → p-7b4e3ba7.js} +1 -1
  90. package/screenshot/compare/build/p-988eb362.css +1 -0
  91. package/screenshot/compare/build/p-9b6a9315.js +1 -0
  92. package/screenshot/compare/build/p-b4cc611c.entry.js +1 -0
  93. package/screenshot/compare/build/p-d1bf53f5.entry.js +1 -0
  94. package/screenshot/compare/build/{p-efb0eac6.js → p-e2efe0df.js} +1 -1
  95. package/screenshot/compare/build/p-e8ca6d97.entry.js +1 -0
  96. package/screenshot/compare/build/p-ec2f13e0.entry.js +1 -0
  97. package/screenshot/compare/build/p-f0b99977.entry.js +1 -0
  98. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -0
  99. package/screenshot/compare/build/p-fbbae598.js +1 -0
  100. package/screenshot/compare/host.config.json +14 -14
  101. package/screenshot/compare/index.html +1 -1
  102. package/{dist/screenshot → screenshot}/connector-base.d.ts +1 -1
  103. package/{dist/screenshot → screenshot}/connector-local.d.ts +1 -1
  104. package/screenshot/connector.js +2 -3
  105. package/{dist/screenshot → screenshot}/index.d.ts +1 -1
  106. package/screenshot/index.js +642 -2
  107. package/screenshot/local-connector.js +2 -3
  108. package/screenshot/package.json +8 -13
  109. package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
  110. package/screenshot/pixel-match.js +22 -6
  111. package/screenshot/screenshot-compare.d.ts +3 -0
  112. package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
  113. package/sys/node/autoprefixer.js +1 -0
  114. package/sys/node/glob.js +1 -0
  115. package/sys/node/graceful-fs.js +1 -0
  116. package/sys/node/index.d.ts +18 -0
  117. package/sys/node/index.js +1402 -2
  118. package/sys/node/node-fetch.js +1 -0
  119. package/sys/node/package.json +8 -5
  120. package/sys/node/prompts.js +1 -0
  121. package/sys/node/worker.js +33 -0
  122. package/{dist/testing → testing}/index.d.ts +5 -6
  123. package/testing/index.js +3903 -2
  124. package/testing/jest/jest-config.d.ts +92 -0
  125. package/{dist/testing → testing}/jest/jest-environment.d.ts +4 -2
  126. package/{dist/testing → testing}/jest/jest-preprocessor.d.ts +1 -0
  127. package/{dist/testing → testing}/jest/jest-runner.d.ts +1 -1
  128. package/{dist/testing → testing}/jest/jest-screenshot.d.ts +1 -1
  129. package/{dist/testing → testing}/jest/jest-serializer.d.ts +1 -1
  130. package/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
  131. package/testing/jest-environment.js +3 -3
  132. package/testing/jest-preprocessor.js +3 -3
  133. package/testing/jest-preset.js +20 -28
  134. package/testing/jest-runner.js +3 -3
  135. package/testing/jest-setuptestframework.js +3 -3
  136. package/{dist/testing → testing}/matchers/attributes.d.ts +0 -0
  137. package/{dist/testing → testing}/matchers/class-list.d.ts +0 -0
  138. package/{dist/testing → testing}/matchers/events.d.ts +9 -1
  139. package/{dist/testing → testing}/matchers/html.d.ts +0 -0
  140. package/{dist/testing → testing}/matchers/index.d.ts +3 -1
  141. package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
  142. package/{dist/testing → testing}/matchers/text.d.ts +0 -0
  143. package/testing/mock-fetch.d.ts +11 -0
  144. package/testing/mocks.d.ts +14 -0
  145. package/testing/package.json +8 -6
  146. package/testing/puppeteer/index.d.ts +2 -0
  147. package/{dist/testing → testing}/puppeteer/puppeteer-browser.d.ts +2 -2
  148. package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +9 -9
  149. package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +5 -3
  150. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  151. package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +7 -7
  152. package/testing/puppeteer/puppeteer-page.d.ts +2 -0
  153. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  154. package/testing/reset-build-conditionals.d.ts +2 -0
  155. package/testing/spec-page.d.ts +2 -0
  156. package/testing/test-transpile.d.ts +2 -0
  157. package/{dist/testing → testing}/testing-logger.d.ts +10 -8
  158. package/testing/testing-sys.d.ts +1 -0
  159. package/{dist/testing → testing}/testing-utils.d.ts +3 -2
  160. package/testing/testing.d.ts +2 -0
  161. package/build-conditionals/index.d.ts +0 -2
  162. package/build-conditionals/index.mjs +0 -66
  163. package/build-conditionals/package.json +0 -6
  164. package/compiler/index.js +0 -2
  165. package/dist/cli/index.js +0 -6068
  166. package/dist/client/css-shim-14a9812e.js +0 -656
  167. package/dist/client/css-shim-69821662.js +0 -658
  168. package/dist/client/declarations/rindo.core.d.ts +0 -1347
  169. package/dist/client/dom-68c8fe31.js +0 -139
  170. package/dist/client/dom-af01458a.js +0 -137
  171. package/dist/client/index.js +0 -2937
  172. package/dist/client/polyfills/core-js.js +0 -10
  173. package/dist/client/polyfills/css-shim.js +0 -656
  174. package/dist/client/polyfills/dom.js +0 -146
  175. package/dist/client/polyfills/es5-html-element.js +0 -18
  176. package/dist/client/polyfills/index.js +0 -35
  177. package/dist/client/polyfills/promise.js +0 -9
  178. package/dist/client/polyfills/system.js +0 -6
  179. package/dist/client/shadow-css-6ef31c68.js +0 -386
  180. package/dist/client/shadow-css-8fd1a9e4.js +0 -388
  181. package/dist/compiler/app-core/app-es5-disabled.d.ts +0 -2
  182. package/dist/compiler/app-core/app-polyfills.d.ts +0 -3
  183. package/dist/compiler/app-core/build-conditionals.d.ts +0 -6
  184. package/dist/compiler/app-core/bundle-app-core.d.ts +0 -6
  185. package/dist/compiler/app-core/component-styles.d.ts +0 -4
  186. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +0 -4
  187. package/dist/compiler/app-core/optimize-module.d.ts +0 -7
  188. package/dist/compiler/browser/build-conditionals-client.d.ts +0 -3
  189. package/dist/compiler/browser/compile-options.d.ts +0 -12
  190. package/dist/compiler/browser/compile.d.ts +0 -2
  191. package/dist/compiler/browser/create-compiler.d.ts +0 -14
  192. package/dist/compiler/browser/index.d.ts +0 -11
  193. package/dist/compiler/build/build-ctx.d.ts +0 -74
  194. package/dist/compiler/build/build-finish.d.ts +0 -3
  195. package/dist/compiler/build/build-hmr.d.ts +0 -2
  196. package/dist/compiler/build/build-results.d.ts +0 -2
  197. package/dist/compiler/build/build-stats.d.ts +0 -3
  198. package/dist/compiler/build/build.d.ts +0 -2
  199. package/dist/compiler/build/cache-stats.d.ts +0 -4
  200. package/dist/compiler/build/compiler-build-id.d.ts +0 -6
  201. package/dist/compiler/build/compiler-ctx.d.ts +0 -44
  202. package/dist/compiler/build/init-index-html.d.ts +0 -2
  203. package/dist/compiler/build/validate-files.d.ts +0 -2
  204. package/dist/compiler/build/write-build.d.ts +0 -2
  205. package/dist/compiler/cache.d.ts +0 -22
  206. package/dist/compiler/compiler.d.ts +0 -27
  207. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +0 -3
  208. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +0 -2
  209. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +0 -2
  210. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +0 -2
  211. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +0 -3
  212. package/dist/compiler/component-lazy/generate-cjs.d.ts +0 -3
  213. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +0 -3
  214. package/dist/compiler/component-lazy/generate-esm.d.ts +0 -3
  215. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +0 -3
  216. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +0 -4
  217. package/dist/compiler/component-lazy/generate-system.d.ts +0 -3
  218. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +0 -2
  219. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +0 -2
  220. package/dist/compiler/component-native/update-to-native-component.d.ts +0 -2
  221. package/dist/compiler/config/config-reload.d.ts +0 -3
  222. package/dist/compiler/config/config-utils.d.ts +0 -4
  223. package/dist/compiler/config/validate-config.d.ts +0 -4
  224. package/dist/compiler/config/validate-copy.d.ts +0 -2
  225. package/dist/compiler/config/validate-dev-server.d.ts +0 -2
  226. package/dist/compiler/config/validate-docs.d.ts +0 -2
  227. package/dist/compiler/config/validate-namespace.d.ts +0 -3
  228. package/dist/compiler/config/validate-output-stats.d.ts +0 -2
  229. package/dist/compiler/config/validate-outputs-angular.d.ts +0 -2
  230. package/dist/compiler/config/validate-outputs-custom.d.ts +0 -2
  231. package/dist/compiler/config/validate-outputs-dist-module.d.ts +0 -2
  232. package/dist/compiler/config/validate-outputs-dist.d.ts +0 -2
  233. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +0 -2
  234. package/dist/compiler/config/validate-outputs-www.d.ts +0 -2
  235. package/dist/compiler/config/validate-outputs.d.ts +0 -2
  236. package/dist/compiler/config/validate-paths.d.ts +0 -2
  237. package/dist/compiler/config/validate-plugins.d.ts +0 -2
  238. package/dist/compiler/config/validate-prerender.d.ts +0 -2
  239. package/dist/compiler/config/validate-rollup-config.d.ts +0 -2
  240. package/dist/compiler/config/validate-service-worker.d.ts +0 -2
  241. package/dist/compiler/config/validate-testing.d.ts +0 -2
  242. package/dist/compiler/config/validate-workers.d.ts +0 -2
  243. package/dist/compiler/copy/assets-copy-tasks.d.ts +0 -3
  244. package/dist/compiler/copy/hashed-copy.d.ts +0 -2
  245. package/dist/compiler/copy/local-copy-tasks.d.ts +0 -3
  246. package/dist/compiler/docs/constants.d.ts +0 -2
  247. package/dist/compiler/docs/custom/index.d.ts +0 -2
  248. package/dist/compiler/docs/docs.d.ts +0 -2
  249. package/dist/compiler/docs/generate-doc-data.d.ts +0 -3
  250. package/dist/compiler/docs/json/index.d.ts +0 -3
  251. package/dist/compiler/docs/readme/docs-util.d.ts +0 -13
  252. package/dist/compiler/docs/readme/index.d.ts +0 -3
  253. package/dist/compiler/docs/readme/markdown-css-props.d.ts +0 -2
  254. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +0 -2
  255. package/dist/compiler/docs/readme/markdown-events.d.ts +0 -2
  256. package/dist/compiler/docs/readme/markdown-methods.d.ts +0 -2
  257. package/dist/compiler/docs/readme/markdown-props.d.ts +0 -2
  258. package/dist/compiler/docs/readme/markdown-slots.d.ts +0 -2
  259. package/dist/compiler/docs/readme/markdown-usage.d.ts +0 -6
  260. package/dist/compiler/docs/readme/output-docs.d.ts +0 -3
  261. package/dist/compiler/docs/style-docs.d.ts +0 -2
  262. package/dist/compiler/docs/vscode/index.d.ts +0 -2
  263. package/dist/compiler/entries/component-bundles.d.ts +0 -3
  264. package/dist/compiler/entries/component-graph.d.ts +0 -2
  265. package/dist/compiler/entries/default-bundles.d.ts +0 -3
  266. package/dist/compiler/entries/entry-modules.d.ts +0 -6
  267. package/dist/compiler/entries/resolve-component-dependencies.d.ts +0 -2
  268. package/dist/compiler/events.d.ts +0 -15
  269. package/dist/compiler/fs-watch/fs-watch-init.d.ts +0 -2
  270. package/dist/compiler/fs-watch/fs-watch-log.d.ts +0 -2
  271. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +0 -7
  272. package/dist/compiler/html/inject-module-preloads.d.ts +0 -3
  273. package/dist/compiler/html/inject-sw-script.d.ts +0 -4
  274. package/dist/compiler/html/inline-esm-import.d.ts +0 -2
  275. package/dist/compiler/html/inline-style-sheets.d.ts +0 -2
  276. package/dist/compiler/html/update-global-styles-link.d.ts +0 -2
  277. package/dist/compiler/html/used-components.d.ts +0 -2
  278. package/dist/compiler/html/utils.d.ts +0 -2
  279. package/dist/compiler/html/validate-manifest-json.d.ts +0 -2
  280. package/dist/compiler/index.d.ts +0 -10
  281. package/dist/compiler/index.js +0 -18008
  282. package/dist/compiler/output-targets/empty-dir.d.ts +0 -6
  283. package/dist/compiler/output-targets/index.d.ts +0 -2
  284. package/dist/compiler/output-targets/output-angular.d.ts +0 -4
  285. package/dist/compiler/output-targets/output-app.d.ts +0 -4
  286. package/dist/compiler/output-targets/output-collection.d.ts +0 -3
  287. package/dist/compiler/output-targets/output-copy.d.ts +0 -2
  288. package/dist/compiler/output-targets/output-custom.d.ts +0 -2
  289. package/dist/compiler/output-targets/output-docs.d.ts +0 -2
  290. package/dist/compiler/output-targets/output-hydrate.d.ts +0 -2
  291. package/dist/compiler/output-targets/output-lazy-loader.d.ts +0 -2
  292. package/dist/compiler/output-targets/output-module.d.ts +0 -4
  293. package/dist/compiler/output-targets/output-prerender.d.ts +0 -2
  294. package/dist/compiler/output-targets/output-service-workers.d.ts +0 -2
  295. package/dist/compiler/output-targets/output-types.d.ts +0 -2
  296. package/dist/compiler/output-targets/output-utils.d.ts +0 -54
  297. package/dist/compiler/output-targets/output-www.d.ts +0 -2
  298. package/dist/compiler/plugin/plugin.d.ts +0 -6
  299. package/dist/compiler/prerender/crawl-urls.d.ts +0 -3
  300. package/dist/compiler/prerender/host-config.d.ts +0 -12
  301. package/dist/compiler/prerender/prerender-config.d.ts +0 -2
  302. package/dist/compiler/prerender/prerender-main.d.ts +0 -2
  303. package/dist/compiler/prerender/prerender-queue.d.ts +0 -3
  304. package/dist/compiler/prerender/prerender-template-html.d.ts +0 -2
  305. package/dist/compiler/prerender/prerendered-write-path.d.ts +0 -2
  306. package/dist/compiler/prerender/robots-txt.d.ts +0 -2
  307. package/dist/compiler/prerender/sitemap-xml.d.ts +0 -3
  308. package/dist/compiler/rollup-plugins/component-entry.d.ts +0 -3
  309. package/dist/compiler/rollup-plugins/css-transformer.d.ts +0 -3
  310. package/dist/compiler/rollup-plugins/global-scripts.d.ts +0 -4
  311. package/dist/compiler/rollup-plugins/image-plugin.d.ts +0 -3
  312. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +0 -3
  313. package/dist/compiler/rollup-plugins/loader.d.ts +0 -4
  314. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +0 -5
  315. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +0 -7
  316. package/dist/compiler/rollup-plugins/rindo-client.d.ts +0 -3
  317. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +0 -2
  318. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +0 -3
  319. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +0 -2
  320. package/dist/compiler/service-worker/generate-sw.d.ts +0 -7
  321. package/dist/compiler/service-worker/service-worker-util.d.ts +0 -2
  322. package/dist/compiler/style/cached-styles.d.ts +0 -5
  323. package/dist/compiler/style/component-styles.d.ts +0 -2
  324. package/dist/compiler/style/css-imports.d.ts +0 -9
  325. package/dist/compiler/style/css-to-esm.d.ts +0 -5
  326. package/dist/compiler/style/generate-styles.d.ts +0 -2
  327. package/dist/compiler/style/global-styles.d.ts +0 -3
  328. package/dist/compiler/style/normalize-styles.d.ts +0 -2
  329. package/dist/compiler/style/optimize-css.d.ts +0 -2
  330. package/dist/compiler/style/scope-css.d.ts +0 -3
  331. package/dist/compiler/style/style-utils.d.ts +0 -10
  332. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +0 -3
  333. package/dist/compiler/transformers/add-component-meta-static.d.ts +0 -4
  334. package/dist/compiler/transformers/add-imports.d.ts +0 -3
  335. package/dist/compiler/transformers/collections/add-external-import.d.ts +0 -2
  336. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +0 -2
  337. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +0 -2
  338. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +0 -7
  339. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +0 -2
  340. package/dist/compiler/transformers/component-build-conditionals.d.ts +0 -2
  341. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +0 -3
  342. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +0 -3
  343. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +0 -2
  344. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +0 -3
  345. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +0 -3
  346. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +0 -3
  347. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +0 -4
  348. package/dist/compiler/transformers/component-native/native-component.d.ts +0 -3
  349. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +0 -3
  350. package/dist/compiler/transformers/component-native/native-constructor.d.ts +0 -3
  351. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +0 -3
  352. package/dist/compiler/transformers/component-native/native-static-style.d.ts +0 -3
  353. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +0 -4
  354. package/dist/compiler/transformers/core-runtime-apis.d.ts +0 -30
  355. package/dist/compiler/transformers/create-event.d.ts +0 -3
  356. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +0 -3
  357. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +0 -3
  358. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +0 -10
  359. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +0 -3
  360. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +0 -4
  361. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +0 -6
  362. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +0 -3
  363. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +0 -4
  364. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +0 -3
  365. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +0 -3
  366. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +0 -3
  367. package/dist/compiler/transformers/define-custom-element.d.ts +0 -3
  368. package/dist/compiler/transformers/host-data-transform.d.ts +0 -3
  369. package/dist/compiler/transformers/legacy-props.d.ts +0 -3
  370. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +0 -2
  371. package/dist/compiler/transformers/reserved-public-members.d.ts +0 -3
  372. package/dist/compiler/transformers/rindo-import-path.d.ts +0 -3
  373. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +0 -3
  374. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +0 -3
  375. package/dist/compiler/transformers/static-to-meta/component.d.ts +0 -3
  376. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +0 -2
  377. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +0 -3
  378. package/dist/compiler/transformers/static-to-meta/events.d.ts +0 -3
  379. package/dist/compiler/transformers/static-to-meta/import.d.ts +0 -3
  380. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +0 -3
  381. package/dist/compiler/transformers/static-to-meta/methods.d.ts +0 -3
  382. package/dist/compiler/transformers/static-to-meta/props.d.ts +0 -3
  383. package/dist/compiler/transformers/static-to-meta/states.d.ts +0 -3
  384. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +0 -3
  385. package/dist/compiler/transformers/static-to-meta/styles.d.ts +0 -3
  386. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +0 -3
  387. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +0 -3
  388. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +0 -3
  389. package/dist/compiler/transformers/style-imports.d.ts +0 -3
  390. package/dist/compiler/transformers/transform-utils.d.ts +0 -31
  391. package/dist/compiler/transformers/update-component-class.d.ts +0 -3
  392. package/dist/compiler/transformers/update-rindo-core-import.d.ts +0 -3
  393. package/dist/compiler/transformers/watcher-meta-transform.d.ts +0 -3
  394. package/dist/compiler/transpile/compiler-options.d.ts +0 -4
  395. package/dist/compiler/transpile/transpile-app.d.ts +0 -2
  396. package/dist/compiler/transpile/transpile-module.d.ts +0 -5
  397. package/dist/compiler/transpile/transpile-service.d.ts +0 -3
  398. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +0 -2
  399. package/dist/compiler/transpile/validate-types-main.d.ts +0 -2
  400. package/dist/compiler/types/generate-app-types.d.ts +0 -2
  401. package/dist/compiler/types/generate-component-types.d.ts +0 -8
  402. package/dist/compiler/types/generate-event-types.d.ts +0 -2
  403. package/dist/compiler/types/generate-method-types.d.ts +0 -2
  404. package/dist/compiler/types/generate-prop-types.d.ts +0 -2
  405. package/dist/compiler/types/generate-types.d.ts +0 -2
  406. package/dist/compiler/types/rindo-types.d.ts +0 -3
  407. package/dist/compiler/types/types-utils.d.ts +0 -4
  408. package/dist/compiler/types/update-import-refs.d.ts +0 -11
  409. package/dist/compiler/types/validate-package-json.d.ts +0 -9
  410. package/dist/declarations/assets.d.ts +0 -17
  411. package/dist/declarations/browser-compile.d.ts +0 -47
  412. package/dist/declarations/build-conditionals.d.ts +0 -91
  413. package/dist/declarations/build-events.d.ts +0 -19
  414. package/dist/declarations/build.d.ts +0 -247
  415. package/dist/declarations/cache.d.ts +0 -11
  416. package/dist/declarations/collection-manifest.d.ts +0 -106
  417. package/dist/declarations/collection.d.ts +0 -139
  418. package/dist/declarations/compiler.d.ts +0 -53
  419. package/dist/declarations/component-compiler-meta.d.ts +0 -198
  420. package/dist/declarations/component-constructor.d.ts +0 -61
  421. package/dist/declarations/component-interfaces.d.ts +0 -123
  422. package/dist/declarations/config.d.ts +0 -409
  423. package/dist/declarations/css-var-shim.d.ts +0 -9
  424. package/dist/declarations/decorators.d.ts +0 -150
  425. package/dist/declarations/dev-server.d.ts +0 -135
  426. package/dist/declarations/diagnostics.d.ts +0 -21
  427. package/dist/declarations/entry.d.ts +0 -28
  428. package/dist/declarations/events.d.ts +0 -13
  429. package/dist/declarations/file-system.d.ts +0 -91
  430. package/dist/declarations/fs-watch.d.ts +0 -15
  431. package/dist/declarations/host-element.d.ts +0 -53
  432. package/dist/declarations/hydrate.d.ts +0 -99
  433. package/dist/declarations/in-memory-fs.d.ts +0 -59
  434. package/dist/declarations/index.d.ts +0 -45
  435. package/dist/declarations/jsdoc.d.ts +0 -16
  436. package/dist/declarations/jsx.d.ts +0 -1050
  437. package/dist/declarations/logger.d.ts +0 -25
  438. package/dist/declarations/minify-js.d.ts +0 -11
  439. package/dist/declarations/module.d.ts +0 -35
  440. package/dist/declarations/optimize-css.d.ts +0 -12
  441. package/dist/declarations/output-targets.d.ts +0 -189
  442. package/dist/declarations/plugin.d.ts +0 -23
  443. package/dist/declarations/prerender.d.ts +0 -79
  444. package/dist/declarations/render.d.ts +0 -62
  445. package/dist/declarations/runtime.d.ts +0 -92
  446. package/dist/declarations/screenshots.d.ts +0 -192
  447. package/dist/declarations/server.d.ts +0 -19
  448. package/dist/declarations/style.d.ts +0 -35
  449. package/dist/declarations/system.d.ts +0 -174
  450. package/dist/declarations/testing.d.ts +0 -523
  451. package/dist/declarations/transpile.d.ts +0 -24
  452. package/dist/declarations/types.d.ts +0 -24
  453. package/dist/declarations/vdom.d.ts +0 -55
  454. package/dist/declarations/worker.d.ts +0 -33
  455. package/dist/dev-server/content-type-db.json +0 -1
  456. package/dist/dev-server/index.js +0 -887
  457. package/dist/dev-server/static/app-error.css +0 -257
  458. package/dist/dev-server/static/dev-server-client.html +0 -13
  459. package/dist/dev-server/templates/initial-load.html +0 -160
  460. package/dist/hydrate/index.d.ts +0 -101
  461. package/dist/hydrate/index.mjs +0 -1281
  462. package/dist/hydrate/platform.mjs +0 -347
  463. package/dist/index.d.ts +0 -99
  464. package/dist/mock-doc/index.d.ts +0 -851
  465. package/dist/mock-doc/index.js +0 -3982
  466. package/dist/mock-doc/index.mjs +0 -3954
  467. package/dist/runtime/index.js +0 -2576
  468. package/dist/runtime/index.mjs +0 -2521
  469. package/dist/runtime/shadow-css-6ef31c68.js +0 -386
  470. package/dist/runtime/shadow-css-8fd1a9e4.js +0 -388
  471. package/dist/screenshot/index.js +0 -520
  472. package/dist/sys/node/graceful-fs.js +0 -975
  473. package/dist/sys/node/index.js +0 -33545
  474. package/dist/sys/node/node-fetch.js +0 -1779
  475. package/dist/sys/node/open-in-editor.js +0 -734
  476. package/dist/sys/node/sys-worker.js +0 -67035
  477. package/dist/sys/node/websocket.js +0 -3728
  478. package/dist/testing/build-conditionals.d.ts +0 -4
  479. package/dist/testing/build-conditionals.js +0 -43
  480. package/dist/testing/core.d.ts +0 -35
  481. package/dist/testing/core.js +0 -52
  482. package/dist/testing/index.js +0 -40511
  483. package/dist/testing/jest/jest-config.d.ts +0 -4
  484. package/dist/testing/mock-fetch.d.ts +0 -46
  485. package/dist/testing/mocks.d.ts +0 -12
  486. package/dist/testing/platform.d.ts +0 -23
  487. package/dist/testing/platform.js +0 -321
  488. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
  489. package/dist/testing/puppeteer/puppeteer-find.d.ts +0 -5
  490. package/dist/testing/puppeteer/puppeteer-page.d.ts +0 -2
  491. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
  492. package/dist/testing/spec-page.d.ts +0 -5
  493. package/dist/testing/task-queue.d.ts +0 -15
  494. package/dist/testing/test-transpile.d.ts +0 -5
  495. package/dist/testing/testing-fs.d.ts +0 -31
  496. package/dist/testing/testing-sys.d.ts +0 -19
  497. package/dist/testing/testing.d.ts +0 -12
  498. package/dist/utils/index.js +0 -1575
  499. package/dist/utils/index.mjs +0 -1511
  500. package/internal/client/css-shim.rindo-client.mjs +0 -656
  501. package/internal/client/index.mjs +0 -2859
  502. package/internal/client/polyfills/promise.js +0 -9
  503. package/internal/images.d.ts +0 -5
  504. package/runtime/package.json +0 -5
  505. package/screenshot/compare/build/p-020f8d73.js +0 -1
  506. package/screenshot/compare/build/p-09qdknbg.system.entry.js +0 -1
  507. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +0 -1
  508. package/screenshot/compare/build/p-168ec2c4.system.js +0 -1
  509. package/screenshot/compare/build/p-2ab1fdf1.system.js +0 -1
  510. package/screenshot/compare/build/p-2pxcsgrj.entry.js +0 -1
  511. package/screenshot/compare/build/p-42fb7034.system.js +0 -1
  512. package/screenshot/compare/build/p-54d9d7c2.system.js +0 -1
  513. package/screenshot/compare/build/p-67c1f911.js +0 -1
  514. package/screenshot/compare/build/p-68613371.system.js +0 -1
  515. package/screenshot/compare/build/p-7dvsjpu0.entry.js +0 -1
  516. package/screenshot/compare/build/p-aa67fb06.js +0 -1
  517. package/screenshot/compare/build/p-aeb3cec1.system.js +0 -1
  518. package/screenshot/compare/build/p-b6e44a24.js +0 -1
  519. package/screenshot/compare/build/p-c1c25b8a.js +0 -1
  520. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +0 -1
  521. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +0 -1
  522. package/screenshot/compare/build/p-dizjz8rg.entry.js +0 -1
  523. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +0 -1
  524. package/screenshot/compare/build/p-e9670d22.system.js +0 -1
  525. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +0 -1
  526. package/screenshot/compare/build/p-ejwcppol.entry.js +0 -1
  527. package/screenshot/compare/build/p-f6612d5d.system.js +0 -1
  528. package/screenshot/compare/build/p-foiivsfc.css +0 -1
  529. package/screenshot/compare/build/p-gpjjyogx.entry.js +0 -1
  530. package/screenshot/compare/build/p-howklem2.system.entry.js +0 -1
  531. package/screenshot/compare/build/p-knv9wvoc.entry.js +0 -1
  532. package/screenshot/compare/build/p-nsqsfhhy.entry.js +0 -1
  533. package/screenshot/compare/build/p-ojt278pp.entry.js +0 -1
  534. package/screenshot/compare/build/p-oywass99.entry.js +0 -1
  535. package/screenshot/compare/build/p-q3ujhub6.entry.js +0 -1
  536. package/screenshot/compare/build/p-qw4xnmxv.entry.js +0 -1
  537. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +0 -1
  538. package/screenshot/compare/build/p-tnjarrex.system.entry.js +0 -1
  539. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +0 -1
  540. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +0 -1
  541. package/screenshot/compare/build/p-w6bnm16k.entry.js +0 -1
  542. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +0 -1
  543. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +0 -1
  544. package/screenshot/compare/build/p-yh170wkt.entry.js +0 -1
  545. package/testing/jest.preprocessor.js +0 -7
@@ -0,0 +1,1570 @@
1
+ function _interopDefault(e) {
2
+ return e && "object" == typeof e && "default" in e ? e.default : e;
3
+ }
4
+
5
+ function sendMsg(e, t) {
6
+ e.send(t);
7
+ }
8
+
9
+ function sendError(e, t) {
10
+ const r = {
11
+ error: {
12
+ message: t
13
+ }
14
+ };
15
+ if ("string" == typeof t) r.error.message = t + ""; else if (t) try {
16
+ r.error.message = util__default.inspect(t) + "";
17
+ } catch (t) {}
18
+ sendMsg(e, r);
19
+ }
20
+
21
+ function responseHeaders(e) {
22
+ return Object.assign({}, DEFAULT_HEADERS, e);
23
+ }
24
+
25
+ function getBrowserUrl(e, t, r, s, n) {
26
+ t = "0.0.0.0" === t ? "localhost" : t;
27
+ const o = r && 80 !== r && 443 !== r ? ":" + r : "";
28
+ let i = s;
29
+ return n.startsWith("/") && (n = n.substring(1)), i += n, `${e = e.replace(/\:/g, "")}://${t}${o}${i}`;
30
+ }
31
+
32
+ function getContentType(e, t) {
33
+ const r = t.replace(/^.*[/\\]/, "").toLowerCase(), s = r.replace(/^.*\./, "").toLowerCase(), n = r.length < t.length;
34
+ return (s.length < r.length - 1 || !n) && e.contentTypes[s] || "application/octet-stream";
35
+ }
36
+
37
+ function isDevClient(e) {
38
+ return e.startsWith("/~dev-server");
39
+ }
40
+
41
+ function isDevServerClient(e) {
42
+ return "/~dev-server" === e;
43
+ }
44
+
45
+ function serve500(e, t, r, s, n) {
46
+ try {
47
+ r.writeHead(500, responseHeaders({
48
+ "content-type": "text/plain; charset=utf-8",
49
+ "x-source": n
50
+ })), r.write(util__default.inspect(s)), r.end(), e.logRequests && sendMsg(process, {
51
+ requestLog: {
52
+ method: t.method,
53
+ url: t.url,
54
+ status: 500
55
+ }
56
+ });
57
+ } catch (e) {
58
+ sendError(process, "serve500: " + e);
59
+ }
60
+ }
61
+
62
+ async function serve404(e, t, r, s) {
63
+ try {
64
+ if ("/favicon.ico" === t.pathname) try {
65
+ const t = path.join(e.devServerDir, "static", "favicon.ico");
66
+ r.writeHead(200, responseHeaders({
67
+ "content-type": "image/x-icon",
68
+ "x-source": "favicon: " + s
69
+ }));
70
+ const n = fs.createReadStream(t);
71
+ return n.on("error", e => {
72
+ r.writeHead(404, responseHeaders({
73
+ "content-type": "text/plain; charset=utf-8",
74
+ "x-source": `createReadStream error: ${e}, ${s}`
75
+ })), r.write(util__default.inspect(e)), r.end();
76
+ }), void n.pipe(r);
77
+ } catch (n) {
78
+ serve500(e, t, r, n, s);
79
+ }
80
+ const n = [ "404 File Not Found", "Url: " + t.pathname, "File: " + t.filePath ].join("\n");
81
+ serve404Content(e, t, r, n, s), e.logRequests && sendMsg(process, {
82
+ requestLog: {
83
+ method: t.method,
84
+ url: t.url,
85
+ status: 404
86
+ }
87
+ });
88
+ } catch (n) {
89
+ serve500(e, t, r, n, s);
90
+ }
91
+ }
92
+
93
+ function serve404Content(e, t, r, s, n) {
94
+ try {
95
+ const e = responseHeaders({
96
+ "content-type": "text/plain; charset=utf-8",
97
+ "x-source": n
98
+ });
99
+ r.writeHead(404, e), r.write(s), r.end();
100
+ } catch (s) {
101
+ serve500(e, t, r, s, "serve404Content: " + n);
102
+ }
103
+ }
104
+
105
+ async function serveFile(e, t, r, s) {
106
+ try {
107
+ if (function n(e) {
108
+ const t = e.toLowerCase().trim().split(".").pop();
109
+ return TXT_EXT.includes(t);
110
+ }(r.filePath)) {
111
+ let n = await t.readFile(r.filePath, "utf8");
112
+ e.websocket && function o(e) {
113
+ return (e = e.toLowerCase().trim()).endsWith(".html") || e.endsWith(".htm");
114
+ }(r.filePath) && !isDevServerClient(r.pathname) ? n = function i(e, t, r) {
115
+ var s, n, o;
116
+ const i = function a(e, t, r) {
117
+ let s = e.address, n = e.port;
118
+ return t && (s = t, n = null), getBrowserUrl(null != r ? r : e.protocol, s, n, e.basePath, "/~dev-server");
119
+ }(e, null !== (n = null === (s = t.headers) || void 0 === s ? void 0 : s["x-forwarded-host"]) && void 0 !== n ? n : t.host, null === (o = t.headers) || void 0 === o ? void 0 : o["x-forwarded-proto"]);
120
+ return function l(e, t) {
121
+ return e.includes("</body>") ? e.replace("</body>", t + "</body>") : e.includes("</html>") ? e.replace("</html>", t + "</html>") : `${e}${t}`;
122
+ }(r, `<iframe title="Rindo Dev Server Connector ${version} &#9889;" src="${i}" style="display:block;width:0;height:0;border:0;visibility:hidden" aria-hidden="true"></iframe>`);
123
+ }(e, r, n) : function a(e) {
124
+ return (e = e.toLowerCase().trim()).endsWith(".css");
125
+ }(r.filePath) && (n = function l(e, t) {
126
+ const r = Url.parse(e), s = querystring.parse(r.query), n = s["s-hmr"], o = s["s-hmr-urls"];
127
+ n && o && o.split(",").forEach(e => {
128
+ urlVersionIds.set(e, n);
129
+ });
130
+ const i = /url\((['"]?)(.*)\1\)/gi;
131
+ let a, l = t;
132
+ for (;null !== (a = i.exec(t)); ) {
133
+ const e = a[2], t = Url.parse(e), r = path.basename(t.pathname), s = urlVersionIds.get(r);
134
+ if (!s) continue;
135
+ const n = querystring.parse(t.query);
136
+ n["s-hmr"] = s, t.search = querystring.stringify(n);
137
+ const o = Url.format(t);
138
+ l = l.replace(e, o);
139
+ }
140
+ return l;
141
+ }(r.url, n)), function c(e, t) {
142
+ if (!e.gzip) return !1;
143
+ if ("GET" !== t.method) return !1;
144
+ const r = t.headers && t.headers["accept-encoding"];
145
+ return "string" == typeof r && !!r.includes("gzip");
146
+ }(e, r) ? (s.writeHead(200, responseHeaders({
147
+ "content-type": getContentType(e, r.filePath) + "; charset=utf-8",
148
+ "content-encoding": "gzip",
149
+ vary: "Accept-Encoding"
150
+ })), zlib.gzip(n, {
151
+ level: 9
152
+ }, (e, t) => {
153
+ s.end(t);
154
+ })) : (s.writeHead(200, responseHeaders({
155
+ "content-type": getContentType(e, r.filePath) + "; charset=utf-8",
156
+ "content-length": buffer.Buffer.byteLength(n, "utf8")
157
+ })), s.write(n), s.end());
158
+ } else s.writeHead(200, responseHeaders({
159
+ "content-type": getContentType(e, r.filePath),
160
+ "content-length": r.stats.size
161
+ })), fs.createReadStream(r.filePath).pipe(s);
162
+ e.logRequests && sendMsg(process, {
163
+ requestLog: {
164
+ method: r.method,
165
+ url: r.url,
166
+ status: 200
167
+ }
168
+ });
169
+ } catch (t) {
170
+ serve500(e, r, s, t, "serveFile");
171
+ }
172
+ }
173
+
174
+ async function serveDevClient(e, t, r, s) {
175
+ try {
176
+ if (function n(e) {
177
+ return e === OPEN_IN_EDITOR_URL;
178
+ }(r.pathname)) return async function o(e, t, r, s) {
179
+ let n = 200;
180
+ const o = {};
181
+ try {
182
+ e.editors.length > 0 ? (await async function i(e, t, r, s) {
183
+ const n = Url.parse(r.url).query, o = querystring.parse(n);
184
+ if ("string" == typeof o.file) {
185
+ if (s.file = o.file, null == o.line || isNaN(o.line) || (s.line = parseInt(o.line, 10)),
186
+ ("number" != typeof s.line || s.line < 1) && (s.line = 1), null == o.column || isNaN(o.column) || (s.column = parseInt(o.column, 10)),
187
+ ("number" != typeof s.column || s.column < 1) && (s.column = 1), "string" == typeof o.editor) {
188
+ if (o.editor = o.editor.trim().toLowerCase(), !e.editors.some(e => e.id === o.editor)) return void (s.error = "invalid editor: " + o.editor);
189
+ s.editor = o.editor;
190
+ } else s.editor = e.editors[0].id;
191
+ try {
192
+ const e = await t.stat(s.file);
193
+ s.exists = !!e && e.isFile();
194
+ } catch (e) {
195
+ s.exists = !1;
196
+ }
197
+ } else s.error = "missing file";
198
+ }(e, t, r, o), await async function a(e) {
199
+ if (e.exists && !e.error) try {
200
+ const t = {
201
+ editor: e.editor
202
+ }, r = openInEditorApi.configure(t, t => e.error = t + "");
203
+ if (e.error) return;
204
+ e.open = `${e.file}:${e.line}:${e.column}`, await r.open(e.open);
205
+ } catch (t) {
206
+ e.error = t + "";
207
+ }
208
+ }(o)) : o.error = "no editors available";
209
+ } catch (e) {
210
+ o.error = e + "", n = 500;
211
+ }
212
+ sendMsg(process, {
213
+ requestLog: {
214
+ method: r.method,
215
+ url: r.url,
216
+ status: n
217
+ }
218
+ }), s.writeHead(n, responseHeaders({
219
+ "content-type": "application/json; charset=utf-8"
220
+ })), s.write(JSON.stringify(o, null, 2)), s.end();
221
+ }(e, t, r, s);
222
+ if (isDevServerClient(r.pathname)) return async function i(e, t, r, s) {
223
+ try {
224
+ const n = path.join(e.devServerDir, "connector.html");
225
+ let o = await t.readFile(n, "utf8");
226
+ if ("string" == typeof o) {
227
+ const t = {
228
+ basePath: e.basePath,
229
+ editors: e.editors,
230
+ reloadStrategy: e.reloadStrategy
231
+ };
232
+ o = o.replace("window.__DEV_CLIENT_CONFIG__", JSON.stringify(t)), s.writeHead(200, responseHeaders({
233
+ "content-type": "text/html; charset=utf-8"
234
+ })), s.write(o), s.end();
235
+ } else serve404(e, r, s, "serveDevClientScript");
236
+ } catch (t) {
237
+ serve500(e, r, s, t, "serveDevClientScript");
238
+ }
239
+ }(e, t, r, s);
240
+ if (function a(e) {
241
+ return e === DEV_SERVER_INIT_URL;
242
+ }(r.pathname)) r.filePath = path.join(e.devServerDir, "templates", "initial-load.html"); else {
243
+ const t = r.pathname.replace("/~dev-server/", "");
244
+ r.filePath = path.join(e.devServerDir, "static", t);
245
+ }
246
+ try {
247
+ return r.stats = await t.stat(r.filePath), r.stats ? serveFile(e, t, r, s) : serve404(e, r, s, "serveDevClient no stats");
248
+ } catch (t) {
249
+ return serve404(e, r, s, "serveDevClient stats error " + t);
250
+ }
251
+ } catch (t) {
252
+ return serve500(e, r, s, t, "serveDevClient");
253
+ }
254
+ }
255
+
256
+ function createRequestHandler(e, t) {
257
+ return async function(r, s) {
258
+ try {
259
+ const n = function n(e, t) {
260
+ const r = {
261
+ method: (t.method || "GET").toUpperCase(),
262
+ headers: t.headers,
263
+ acceptHeader: t.headers && "string" == typeof t.headers.accept && t.headers.accept || "",
264
+ url: (t.url || "").trim() || "",
265
+ host: t.headers && "string" == typeof t.headers.host && t.headers.host || null
266
+ }, s = (Url.parse(r.url).pathname || "").replace(/\\/g, "/").split("/");
267
+ return r.pathname = s.map(e => decodeURIComponent(e)).join("/"), r.pathname.length > 0 && !isDevClient(r.pathname) && (r.pathname = "/" + r.pathname.substring(e.basePath.length)),
268
+ r.filePath = normalizePath(path.normalize(path.join(e.root, path.relative("/", r.pathname)))),
269
+ r;
270
+ }(e, r);
271
+ if ("" === n.url) return s.writeHead(302, {
272
+ location: "/"
273
+ }), e.logRequests && sendMsg(process, {
274
+ requestLog: {
275
+ method: n.method,
276
+ url: n.url,
277
+ status: 302
278
+ }
279
+ }), s.end();
280
+ if (isDevClient(n.pathname) && e.websocket) return serveDevClient(e, t, n, s);
281
+ if (function o(e) {
282
+ return e.includes("/~dev-module");
283
+ }(n.pathname)) return async function i(e, t, r) {
284
+ try {
285
+ const s = (await function s(e, t) {
286
+ return new Promise(r => {
287
+ t.resolveId = resolveIds++, msgResolves.set(t.resolveId, r), sendMsg(e, t);
288
+ });
289
+ }(process, {
290
+ compilerRequestPath: t.url
291
+ })).compilerRequestResults;
292
+ if (s) {
293
+ const e = {
294
+ "content-type": "application/javascript; charset=utf-8",
295
+ "content-length": Buffer.byteLength(s.content, "utf8"),
296
+ "x-dev-node-module-id": s.nodeModuleId,
297
+ "x-dev-node-module-version": s.nodeModuleVersion,
298
+ "x-dev-node-module-resolved-path": s.nodeResolvedPath,
299
+ "x-dev-node-module-cache-path": s.cachePath,
300
+ "x-dev-node-module-cache-hit": s.cacheHit
301
+ };
302
+ return r.writeHead(s.status, responseHeaders(e)), r.write(s.content), void r.end();
303
+ }
304
+ return serve404(e, t, r, "serveCompilerRequest");
305
+ } catch (s) {
306
+ return serve500(e, t, r, s, "serveCompilerRequest");
307
+ }
308
+ }(e, n, s);
309
+ if (!function a(e, t) {
310
+ return t.endsWith("/") || (t += "/"), e.endsWith("/") || (e += "/"), t.startsWith(e);
311
+ }(e.basePath, n.url)) return e.logRequests && sendMsg(process, {
312
+ requestLog: {
313
+ method: n.method,
314
+ url: n.url,
315
+ status: 404
316
+ }
317
+ }), serve404Content(e, n, s, "404 File Not Found, base path: " + e.basePath, "invalid basePath");
318
+ try {
319
+ if (n.stats = await t.stat(n.filePath), n.stats) {
320
+ if (n.stats.isFile()) return serveFile(e, t, n, s);
321
+ if (n.stats.isDirectory()) return async function l(e, t, r, s) {
322
+ try {
323
+ const n = path.join(r.filePath, "index.html");
324
+ if (r.stats = await t.stat(n), r.stats && r.stats.isFile()) return r.filePath = n,
325
+ serveFile(e, t, r, s);
326
+ } catch (e) {}
327
+ if (!r.pathname.endsWith("/")) return e.logRequests && sendMsg(process, {
328
+ requestLog: {
329
+ method: r.method,
330
+ url: r.url,
331
+ status: 302
332
+ }
333
+ }), s.writeHead(302, {
334
+ location: r.pathname + "/"
335
+ }), s.end();
336
+ try {
337
+ const n = await t.readdir(r.filePath);
338
+ try {
339
+ if (null == dirTemplate) {
340
+ const r = path.join(e.devServerDir, "templates", "directory-index.html");
341
+ dirTemplate = await t.readFile(r, "utf8");
342
+ }
343
+ const o = await async function n(e, t, r) {
344
+ const s = await async function n(e, t, r) {
345
+ return await Promise.all(r.map(async r => {
346
+ const s = path.basename(r), n = await e.stat(r);
347
+ return {
348
+ name: s,
349
+ pathname: Url.resolve(t, s),
350
+ isDirectory: !(!n || !n.isDirectory())
351
+ };
352
+ }));
353
+ }(e, t, r);
354
+ return "/" !== t && s.unshift({
355
+ isDirectory: !0,
356
+ pathname: "../",
357
+ name: ".."
358
+ }), s.map(e => `\n <li class="${e.isDirectory ? "directory" : "file"}">\n <a href="${e.pathname}">\n <span class="icon"></span>\n <span>${e.name}</span>\n </a>\n </li>`).join("");
359
+ }(t, r.pathname, n), i = dirTemplate.replace("{{title}}", r.pathname).replace("{{nav}}", function o(e) {
360
+ const t = e.split("/");
361
+ t.pop();
362
+ let r = "";
363
+ return t.map((e, t) => (r += e + "/", `<a href="${r}">${0 === t ? "~" : e}</a>`)).join("<span>/</span>") + "<span>/</span>";
364
+ }(r.pathname)).replace("{{files}}", o);
365
+ s.writeHead(200, responseHeaders({
366
+ "content-type": "text/html; charset=utf-8",
367
+ "x-directory-index": r.pathname
368
+ })), s.write(i), s.end(), e.logRequests && sendMsg(process, {
369
+ requestLog: {
370
+ method: r.method,
371
+ url: r.url,
372
+ status: 200
373
+ }
374
+ });
375
+ } catch (t) {
376
+ serve500(e, r, s, t, "serveDirectoryIndex");
377
+ }
378
+ } catch (t) {
379
+ serve404(e, r, s, "serveDirectoryIndex");
380
+ }
381
+ }(e, t, n, s);
382
+ }
383
+ } catch (e) {}
384
+ const o = [ "notfound" ], i = function c(e, t) {
385
+ return !!e.historyApiFallback && ("GET" === t.method && (!!t.acceptHeader.includes("text/html") && !(!e.historyApiFallback.disableDotRule && t.pathname.includes("."))));
386
+ }(e, n);
387
+ if (o.push("validHistoryApi: " + i), i) try {
388
+ const r = path.join(e.root, e.historyApiFallback.index);
389
+ if (o.push("indexFilePath: " + r), n.stats = await t.stat(r), n.stats && n.stats.isFile()) return n.filePath = r,
390
+ serveFile(e, t, n, s);
391
+ } catch (e) {
392
+ o.push("notfound error: " + e);
393
+ }
394
+ return serve404(e, n, s, o.join(", "));
395
+ } catch (t) {
396
+ return serve500(e, r, s, t, "not found error");
397
+ }
398
+ };
399
+ }
400
+
401
+ async function nodeCopyTasks(e, t) {
402
+ const r = {
403
+ diagnostics: [],
404
+ dirPaths: [],
405
+ filePaths: []
406
+ };
407
+ try {
408
+ e = ((e, t = (e => e)) => {
409
+ const r = new Set;
410
+ return e.filter(e => {
411
+ const s = t(e);
412
+ return null == s || !r.has(s) && (r.add(s), !0);
413
+ });
414
+ })((n = await Promise.all(e.map(e => async function r(e, t) {
415
+ return (e => {
416
+ const t = {
417
+ "{": "}",
418
+ "(": ")",
419
+ "[": "]"
420
+ }, r = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/;
421
+ if ("" === e) return !1;
422
+ let s;
423
+ for (;s = r.exec(e); ) {
424
+ if (s[2]) return !0;
425
+ let r = s.index + s[0].length;
426
+ const n = s[1], o = n ? t[n] : null;
427
+ if (n && o) {
428
+ const t = e.indexOf(o, r);
429
+ -1 !== t && (r = t + 1);
430
+ }
431
+ e = e.slice(r);
432
+ }
433
+ return !1;
434
+ })(e.src) ? await async function r(e, t) {
435
+ return (await asyncGlob(e.src, {
436
+ cwd: t,
437
+ nodir: !0
438
+ })).map(r => function s(e, t, r) {
439
+ const s = path.join(e.dest, e.keepDirStructure ? r : path.basename(r));
440
+ return {
441
+ src: path.join(t, r),
442
+ dest: s,
443
+ warn: e.warn,
444
+ keepDirStructure: e.keepDirStructure
445
+ };
446
+ }(e, t, r));
447
+ }(e, t) : [ {
448
+ src: getSrcAbsPath(t, e.src),
449
+ dest: e.keepDirStructure ? path.join(e.dest, e.src) : e.dest,
450
+ warn: e.warn,
451
+ keepDirStructure: e.keepDirStructure
452
+ } ];
453
+ }(e, t))), e = n.flat ? n.flat(1) : n.reduce((e, t) => (e.push(...t), e), [])), e => e.dest);
454
+ const s = [];
455
+ for (;e.length > 0; ) {
456
+ const t = e.splice(0, 100);
457
+ await Promise.all(t.map(e => processCopyTask(r, s, e)));
458
+ }
459
+ const o = function s(e) {
460
+ const t = [];
461
+ return e.forEach(e => {
462
+ !function r(e, t) {
463
+ (t = normalizePath(t)) !== ROOT_DIR && t + "/" !== ROOT_DIR && "" !== t && (e.includes(t) || e.push(t));
464
+ }(t, path.dirname(e.dest));
465
+ }), t.sort((e, t) => {
466
+ const r = e.split("/").length, s = t.split("/").length;
467
+ return r < s ? -1 : r > s ? 1 : e < t ? -1 : e > t ? 1 : 0;
468
+ }), t;
469
+ }(s);
470
+ try {
471
+ await Promise.all(o.map(e => mkdir(e, {
472
+ recursive: !0
473
+ })));
474
+ } catch (e) {}
475
+ for (;s.length > 0; ) {
476
+ const e = s.splice(0, 100);
477
+ await Promise.all(e.map(e => copyFile(e.src, e.dest)));
478
+ }
479
+ } catch (e) {
480
+ catchError(r.diagnostics, e);
481
+ }
482
+ var n;
483
+ return r;
484
+ }
485
+
486
+ function getSrcAbsPath(e, t) {
487
+ return path.isAbsolute(t) ? t : path.join(e, t);
488
+ }
489
+
490
+ async function processCopyTask(e, t, r) {
491
+ try {
492
+ r.src = normalizePath(r.src), r.dest = normalizePath(r.dest), (await stat(r.src)).isDirectory() ? (e.dirPaths.includes(r.dest) || e.dirPaths.push(r.dest),
493
+ await async function s(e, t, r) {
494
+ try {
495
+ const s = await readdir(r.src);
496
+ await Promise.all(s.map(async s => {
497
+ const n = {
498
+ src: path.join(r.src, s),
499
+ dest: path.join(r.dest, s),
500
+ warn: r.warn
501
+ };
502
+ await processCopyTask(e, t, n);
503
+ }));
504
+ } catch (t) {
505
+ catchError(e.diagnostics, t);
506
+ }
507
+ }(e, t, r)) : function n(e) {
508
+ return e = e.trim().toLowerCase(), IGNORE.some(t => e.endsWith(t));
509
+ }(r.src) || (e.filePaths.includes(r.dest) || e.filePaths.push(r.dest), t.push(r));
510
+ } catch (t) {
511
+ !1 !== r.warn && (buildError(e.diagnostics).messageText = t.message);
512
+ }
513
+ }
514
+
515
+ function asyncGlob(e, t) {
516
+ return new Promise((r, s) => {
517
+ (0, glob.glob)(e, t, (e, t) => {
518
+ e ? s(e) : r(t);
519
+ });
520
+ });
521
+ }
522
+
523
+ function semiver(e, t, r) {
524
+ return e = e.split("."), t = t.split("."), fn(e[0], t[0]) || fn(e[1], t[1]) || (t[2] = t.slice(2).join("."),
525
+ (r = /[.-]/.test(e[2] = e.slice(2).join("."))) == /[.-]/.test(t[2]) ? fn(e[2], t[2]) : r ? -1 : 1);
526
+ }
527
+
528
+ async function checkVersion(e, t) {
529
+ try {
530
+ const r = await async function r(e) {
531
+ try {
532
+ const e = await function t() {
533
+ return new Promise(e => {
534
+ fs.readFile(getLastCheckStoragePath(), "utf8", (t, r) => {
535
+ if (!t && isString(r)) try {
536
+ e(JSON.parse(r));
537
+ } catch (e) {}
538
+ e(null);
539
+ });
540
+ });
541
+ }();
542
+ if (null == e) return setLastCheck(), null;
543
+ if (!function r(e, t, s) {
544
+ return t + s < e;
545
+ }(Date.now(), e, 6048e5)) return null;
546
+ const t = setLastCheck(), r = await async function s(e) {
547
+ const t = await Promise.resolve().then((function() {
548
+ return function e(t) {
549
+ if (t && t.__esModule) return t;
550
+ var r = {};
551
+ return t && Object.keys(t).forEach((function(e) {
552
+ var s = Object.getOwnPropertyDescriptor(t, e);
553
+ Object.defineProperty(r, e, s.get ? s : {
554
+ enumerable: !0,
555
+ get: function() {
556
+ return t[e];
557
+ }
558
+ });
559
+ })), r.default = t, r;
560
+ }(require("https"));
561
+ }));
562
+ return new Promise((r, s) => {
563
+ const n = t.request(e, t => {
564
+ if (t.statusCode > 299) return void s(`url: ${e}, staus: ${t.statusCode}`);
565
+ t.once("error", s);
566
+ const n = [];
567
+ t.once("end", () => {
568
+ r(n.join(""));
569
+ }), t.on("data", e => {
570
+ n.push(e);
571
+ });
572
+ });
573
+ n.once("error", s), n.end();
574
+ });
575
+ }("https://registry.npmjs.org/@rindo/core"), s = JSON.parse(r);
576
+ return await t, s["dist-tags"].latest;
577
+ } catch (t) {
578
+ e.debug("getLatestCompilerVersion error: " + t);
579
+ }
580
+ return null;
581
+ }(e);
582
+ if (null != r) return () => {
583
+ semiver(t, r) < 0 ? function s(e, t, r) {
584
+ const s = [ `Update available: ${t} ${ARROW} ${r}`, "To get the latest, please run:", "npm install @rindo/core" ], n = s[0].length, o = [];
585
+ let i = BOX_TOP_LEFT;
586
+ for (;i.length <= n + 2 * PADDING; ) i += BOX_HORIZONTAL;
587
+ i += BOX_TOP_RIGHT, o.push(i), s.forEach(e => {
588
+ let t = BOX_VERTICAL;
589
+ for (let e = 0; e < PADDING; e++) t += " ";
590
+ for (t += e; t.length <= n + 2 * PADDING; ) t += " ";
591
+ t += BOX_VERTICAL, o.push(t);
592
+ });
593
+ let a = BOX_BOTTOM_LEFT;
594
+ for (;a.length <= n + 2 * PADDING; ) a += BOX_HORIZONTAL;
595
+ a += BOX_BOTTOM_RIGHT, o.push(a);
596
+ let l = `\n${INDENT}${o.join("\n" + INDENT)}\n`;
597
+ l = l.replace(t, e.red(t)), l = l.replace(r, e.green(r)), l = l.replace("npm install @rindo/core", e.cyan("npm install @rindo/core")),
598
+ console.log(l);
599
+ }(e, t, r) : console.debug(`${e.cyan("@rindo/core")} version ${e.green(t)} is the latest version`);
600
+ };
601
+ } catch (t) {
602
+ e.debug("unable to load latest compiler version: " + t);
603
+ }
604
+ return noop;
605
+ }
606
+
607
+ function setLastCheck() {
608
+ return new Promise(e => {
609
+ const t = JSON.stringify(Date.now());
610
+ fs.writeFile(getLastCheckStoragePath(), t, () => {
611
+ e();
612
+ });
613
+ });
614
+ }
615
+
616
+ function getLastCheckStoragePath() {
617
+ return path.join(os.tmpdir(), "rindo_last_version_node.json");
618
+ }
619
+
620
+ function getNextWorker(e) {
621
+ const t = e.filter(e => !e.stopped);
622
+ return 0 === t.length ? null : t.sort((e, t) => e.tasks.size < t.tasks.size ? -1 : e.tasks.size > t.tasks.size ? 1 : e.totalTasksAssigned < t.totalTasksAssigned ? -1 : e.totalTasksAssigned > t.totalTasksAssigned ? 1 : 0)[0];
623
+ }
624
+
625
+ async function startDevServerWorker(e, t) {
626
+ let r = !1;
627
+ try {
628
+ const s = function s(e = {}) {
629
+ const t = function r(e = {}) {
630
+ const t = e.process || global.process, r = new Set, s = [], n = os.cpus(), o = n.length, i = os.platform(), a = {
631
+ name: "node",
632
+ version: t.versions.node,
633
+ access: e => new Promise(t => {
634
+ fs.access(e, e => {
635
+ t(!e);
636
+ });
637
+ }),
638
+ accessSync(e) {
639
+ let t = !1;
640
+ try {
641
+ fs.accessSync(e), t = !0;
642
+ } catch (e) {}
643
+ return t;
644
+ },
645
+ addDestory(e) {
646
+ r.add(e);
647
+ },
648
+ removeDestory(e) {
649
+ r.delete(e);
650
+ },
651
+ applyPrerenderGlobalPatch(e) {
652
+ if ("function" != typeof global.fetch) {
653
+ const t = require(path.join(__dirname, "node-fetch.js"));
654
+ global.fetch = (r, s) => {
655
+ if ("string" == typeof r) {
656
+ const n = new URL(r, e.devServerHostUrl).href;
657
+ return t.fetch(n, s);
658
+ }
659
+ return r.url = new URL(r.url, e.devServerHostUrl).href, t.fetch(r, s);
660
+ }, global.Headers = t.Headers, global.Request = t.Request, global.Response = t.Response,
661
+ global.FetchError = t.FetchError;
662
+ }
663
+ e.window.fetch = global.fetch, e.window.Headers = global.Headers, e.window.Request = global.Request,
664
+ e.window.Response = global.Response, e.window.FetchError = global.FetchError;
665
+ },
666
+ checkVersion,
667
+ copyFile: (e, t) => new Promise(r => {
668
+ fs.copyFile(e, t, e => {
669
+ r(!e);
670
+ });
671
+ }),
672
+ createWorkerController(e) {
673
+ const t = path.join(__dirname, "worker.js");
674
+ return new NodeWorkerController(t, e);
675
+ },
676
+ async destroy() {
677
+ const e = [];
678
+ r.forEach(t => {
679
+ try {
680
+ const r = t();
681
+ r && r.then && e.push(r);
682
+ } catch (e) {
683
+ console.error("node sys destroy: " + e);
684
+ }
685
+ }), e.length > 0 && await Promise.all(e), r.clear();
686
+ },
687
+ dynamicImport: e => Promise.resolve((e => ("function" == typeof __webpack_require__ ? __non_webpack_require__ : require)(e))(e)),
688
+ encodeToBase64: e => Buffer.from(e).toString("base64"),
689
+ async ensureDependencies() {
690
+ const e = [];
691
+ let t = null;
692
+ try {
693
+ t = require.resolve("typescript");
694
+ } catch (t) {
695
+ const r = buildError(e);
696
+ r.header = "Unable to find TypeScript", r.messageText = 'Please ensure you install the dependencies first, for example: "npm install"';
697
+ }
698
+ return {
699
+ rindoPath: a.getCompilerExecutingPath(),
700
+ typescriptPath: t,
701
+ diagnostics: e
702
+ };
703
+ },
704
+ async ensureResources() {},
705
+ exit: exit$1,
706
+ getCurrentDirectory: () => normalizePath(t.cwd()),
707
+ getCompilerExecutingPath: () => path.join(__dirname, "..", "..", "compiler", "rindo.js"),
708
+ getDevServerExecutingPath: () => path.join(__dirname, "..", "..", "dev-server", "index.js"),
709
+ getEnvironmentVar: e => process.env[e],
710
+ getLocalModulePath: () => null,
711
+ getRemoteModuleUrl: () => null,
712
+ glob: asyncGlob,
713
+ hardwareConcurrency: o,
714
+ isSymbolicLink: e => new Promise(t => {
715
+ try {
716
+ fs.lstat(e, (e, r) => {
717
+ t(!e && r.isSymbolicLink());
718
+ });
719
+ } catch (e) {
720
+ t(!1);
721
+ }
722
+ }),
723
+ mkdir: (e, t) => new Promise(r => {
724
+ t ? fs.mkdir(e, t, t => {
725
+ r({
726
+ basename: path.basename(e),
727
+ dirname: path.dirname(e),
728
+ path: e,
729
+ newDirs: [],
730
+ error: t
731
+ });
732
+ }) : fs.mkdir(e, t => {
733
+ r({
734
+ basename: path.basename(e),
735
+ dirname: path.dirname(e),
736
+ path: e,
737
+ newDirs: [],
738
+ error: t
739
+ });
740
+ });
741
+ }),
742
+ mkdirSync(e, t) {
743
+ const r = {
744
+ basename: path.basename(e),
745
+ dirname: path.dirname(e),
746
+ path: e,
747
+ newDirs: [],
748
+ error: null
749
+ };
750
+ try {
751
+ fs.mkdirSync(e, t);
752
+ } catch (e) {
753
+ r.error = e;
754
+ }
755
+ return r;
756
+ },
757
+ nextTick: t.nextTick,
758
+ normalizePath,
759
+ onProcessInterrupt: e => {
760
+ s.includes(e) || s.push(e);
761
+ },
762
+ platformPath: path,
763
+ readdir: e => new Promise(t => {
764
+ fs.readdir(e, (r, s) => {
765
+ t(r ? [] : s.map(t => normalizePath(path.join(e, t))));
766
+ });
767
+ }),
768
+ readdirSync(e) {
769
+ try {
770
+ return fs.readdirSync(e).map(t => normalizePath(path.join(e, t)));
771
+ } catch (e) {}
772
+ return [];
773
+ },
774
+ readFile: e => new Promise(t => {
775
+ fs.readFile(e, "utf8", (e, r) => {
776
+ t(r);
777
+ });
778
+ }),
779
+ readFileSync(e) {
780
+ try {
781
+ return fs.readFileSync(e, "utf8");
782
+ } catch (e) {}
783
+ },
784
+ realpath: e => new Promise(t => {
785
+ fs.realpath(e, "utf8", (e, r) => {
786
+ t({
787
+ path: r,
788
+ error: e
789
+ });
790
+ });
791
+ }),
792
+ realpathSync(e) {
793
+ const t = {
794
+ path: void 0,
795
+ error: null
796
+ };
797
+ try {
798
+ t.path = fs.realpathSync(e, "utf8");
799
+ } catch (e) {
800
+ t.error = e;
801
+ }
802
+ return t;
803
+ },
804
+ rename: (e, t) => new Promise(r => {
805
+ fs.rename(e, t, s => {
806
+ r({
807
+ oldPath: e,
808
+ newPath: t,
809
+ error: s,
810
+ oldDirs: [],
811
+ oldFiles: [],
812
+ newDirs: [],
813
+ newFiles: [],
814
+ renamed: [],
815
+ isFile: !1,
816
+ isDirectory: !1
817
+ });
818
+ });
819
+ }),
820
+ resolvePath: e => normalizePath(e),
821
+ rmdir: (e, t) => new Promise(r => {
822
+ t && t.recursive ? fs.rmdir(e, {
823
+ recursive: !0
824
+ }, t => {
825
+ r({
826
+ basename: path.basename(e),
827
+ dirname: path.dirname(e),
828
+ path: e,
829
+ removedDirs: [],
830
+ removedFiles: [],
831
+ error: t
832
+ });
833
+ }) : fs.rmdir(e, t => {
834
+ r({
835
+ basename: path.basename(e),
836
+ dirname: path.dirname(e),
837
+ path: e,
838
+ removedDirs: [],
839
+ removedFiles: [],
840
+ error: t
841
+ });
842
+ });
843
+ }),
844
+ rmdirSync(e, t) {
845
+ try {
846
+ return t && t.recursive ? fs.rmdirSync(e, {
847
+ recursive: !0
848
+ }) : fs.rmdirSync(e), {
849
+ basename: path.basename(e),
850
+ dirname: path.dirname(e),
851
+ path: e,
852
+ removedDirs: [],
853
+ removedFiles: [],
854
+ error: null
855
+ };
856
+ } catch (t) {
857
+ return {
858
+ basename: path.basename(e),
859
+ dirname: path.dirname(e),
860
+ path: e,
861
+ removedDirs: [],
862
+ removedFiles: [],
863
+ error: t
864
+ };
865
+ }
866
+ },
867
+ stat: e => new Promise(t => {
868
+ fs.stat(e, (e, r) => {
869
+ t(e ? void 0 : r);
870
+ });
871
+ }),
872
+ statSync(e) {
873
+ try {
874
+ return fs.statSync(e);
875
+ } catch (e) {}
876
+ },
877
+ tmpdir: () => os.tmpdir(),
878
+ unlink: e => new Promise(t => {
879
+ fs.unlink(e, r => {
880
+ t({
881
+ basename: path.basename(e),
882
+ dirname: path.dirname(e),
883
+ path: e,
884
+ error: r
885
+ });
886
+ });
887
+ }),
888
+ unlinkSync(e) {
889
+ const t = {
890
+ basename: path.basename(e),
891
+ dirname: path.dirname(e),
892
+ path: e,
893
+ error: null
894
+ };
895
+ try {
896
+ fs.unlinkSync(e);
897
+ } catch (e) {
898
+ t.error = e;
899
+ }
900
+ return t;
901
+ },
902
+ writeFile: (e, t) => new Promise(r => {
903
+ fs.writeFile(e, t, t => {
904
+ r({
905
+ path: e,
906
+ error: t
907
+ });
908
+ });
909
+ }),
910
+ writeFileSync(e, t) {
911
+ const r = {
912
+ path: e,
913
+ error: null
914
+ };
915
+ try {
916
+ fs.writeFileSync(e, t);
917
+ } catch (e) {
918
+ r.error = e;
919
+ }
920
+ return r;
921
+ },
922
+ generateContentHash(e, t) {
923
+ let r = crypto.createHash("sha1").update(e).digest("hex").toLowerCase();
924
+ return "number" == typeof t && (r = r.substr(0, t)), Promise.resolve(r);
925
+ },
926
+ copy: nodeCopyTasks,
927
+ details: {
928
+ cpuModel: (Array.isArray(n) && n.length > 0 ? n[0] && n[0].model : "") || "",
929
+ freemem: () => os.freemem(),
930
+ platform: "darwin" === i || "linux" === i ? i : "win32" === i ? "windows" : "",
931
+ release: os.release(),
932
+ totalmem: os.totalmem()
933
+ }
934
+ }, l = new NodeResolveModule;
935
+ return a.lazyRequire = new NodeLazyRequire(l, {
936
+ "@types/jest": [ "24.9.1", "25.2.3" ],
937
+ "@types/puppeteer": [ "1.19.0", "2.0.1" ],
938
+ jest: [ "24.9.0", "26.0.1" ],
939
+ "jest-cli": [ "24.9.0", "26.0.1" ],
940
+ pixelmatch: [ "4.0.2", "4.0.2" ],
941
+ puppeteer: [ "1.19.0", "2.1.1" ],
942
+ "puppeteer-core": [ "1.19.0", "2.1.1" ],
943
+ "workbox-build": [ "4.3.1", "4.3.1" ]
944
+ }), t.on("SIGINT", () => {
945
+ for (;;) {
946
+ const e = s.pop();
947
+ if ("function" != typeof e) break;
948
+ try {
949
+ e();
950
+ } catch (e) {}
951
+ }
952
+ }), a;
953
+ }(e), s = require("typescript"), n = s.sys.watchFile, o = s.sys.watchDirectory;
954
+ return t.watchTimeout = 80, t.events = (() => {
955
+ const e = [], t = t => {
956
+ const r = e.findIndex(e => e.callback === t);
957
+ return r > -1 && (e.splice(r, 1), !0);
958
+ };
959
+ return {
960
+ emit: (t, r) => {
961
+ const s = t.toLowerCase().trim(), n = e.slice();
962
+ for (const e of n) if (null == e.eventName) try {
963
+ e.callback(t, r);
964
+ } catch (e) {
965
+ console.error(e);
966
+ } else if (e.eventName === s) try {
967
+ e.callback(r);
968
+ } catch (e) {
969
+ console.error(e);
970
+ }
971
+ },
972
+ on: (r, s) => {
973
+ if ("function" == typeof r) {
974
+ const s = null, n = r;
975
+ return e.push({
976
+ eventName: s,
977
+ callback: n
978
+ }), () => t(n);
979
+ }
980
+ if ("string" == typeof r && "function" == typeof s) {
981
+ const n = r.toLowerCase().trim(), o = s;
982
+ return e.push({
983
+ eventName: n,
984
+ callback: o
985
+ }), () => t(o);
986
+ }
987
+ return () => !1;
988
+ },
989
+ unsubscribeAll: () => {
990
+ e.length = 0;
991
+ }
992
+ };
993
+ })(), t.watchDirectory = (e, r, s) => {
994
+ const n = o(e, e => {
995
+ e = normalizePath(e), r(e, null);
996
+ }, s), i = () => {
997
+ n.close();
998
+ };
999
+ return t.addDestory(i), {
1000
+ close() {
1001
+ t.removeDestory(i), n.close();
1002
+ }
1003
+ };
1004
+ }, t.watchFile = (e, r) => {
1005
+ const o = n(e, (e, n) => {
1006
+ e = normalizePath(e), n === s.FileWatcherEventKind.Created ? (r(e, "fileAdd"), t.events.emit("fileAdd", e)) : n === s.FileWatcherEventKind.Changed ? (r(e, "fileUpdate"),
1007
+ t.events.emit("fileUpdate", e)) : n === s.FileWatcherEventKind.Deleted && (r(e, "fileDelete"),
1008
+ t.events.emit("fileDelete", e));
1009
+ }), i = () => {
1010
+ o.close();
1011
+ };
1012
+ return t.addDestory(i), {
1013
+ close() {
1014
+ t.removeDestory(i), o.close();
1015
+ }
1016
+ };
1017
+ }, t;
1018
+ }({
1019
+ process: e
1020
+ }), n = [];
1021
+ t.editors = await async function n() {
1022
+ const e = [];
1023
+ try {
1024
+ await Promise.all(Object.keys(openInEditorApi.editors).map(async t => {
1025
+ const r = await async function s(e) {
1026
+ let t = !1;
1027
+ try {
1028
+ await openInEditorApi.editors[e].detect(), t = !0;
1029
+ } catch (e) {}
1030
+ return t;
1031
+ }(t);
1032
+ e.push({
1033
+ id: t,
1034
+ priority: EDITOR_PRIORITY[t],
1035
+ supported: r
1036
+ });
1037
+ }));
1038
+ } catch (e) {}
1039
+ return e.filter(e => e.supported).sort((e, t) => e.priority < t.priority ? -1 : e.priority > t.priority ? 1 : 0).map(e => ({
1040
+ id: e.id,
1041
+ name: EDITORS[e.id]
1042
+ }));
1043
+ }();
1044
+ let o = await async function o(e, t, r) {
1045
+ e.port = await async function s(e, t) {
1046
+ return async function t(r) {
1047
+ return await function s(e, t) {
1048
+ return new Promise((r, s) => {
1049
+ const n = net.createServer().once("error", () => {
1050
+ r(!0);
1051
+ }).once("listening", () => {
1052
+ n.once("close", () => {
1053
+ r(!1);
1054
+ }).close();
1055
+ }).on("error", e => {
1056
+ s(e);
1057
+ }).listen(t, e);
1058
+ });
1059
+ }(e, r) ? t(r + 1) : r;
1060
+ }(t);
1061
+ }(e.address, e.port);
1062
+ const n = createRequestHandler(e, t), o = e.https;
1063
+ let i = o ? https.createServer(o, n) : http.createServer(n);
1064
+ return r.push(() => {
1065
+ i.close(), i = null;
1066
+ }), i;
1067
+ }(t, s, n);
1068
+ t.websocket && function i(e, t, r) {
1069
+ function s() {
1070
+ this.isAlive = !0;
1071
+ }
1072
+ const n = {
1073
+ server: t
1074
+ }, o = new ws.Server(n);
1075
+ o.on("connection", t => {
1076
+ t.on("message", t => {
1077
+ e.send(JSON.parse(t.toString()));
1078
+ }), t.isAlive = !0, t.on("pong", s);
1079
+ });
1080
+ const i = setInterval(() => {
1081
+ o.clients.forEach(e => {
1082
+ if (!e.isAlive) return e.close(1e3);
1083
+ e.isAlive = !1, e.ping(noop);
1084
+ });
1085
+ }, 1e4);
1086
+ e.addListener("message", (function a(e) {
1087
+ if (e) {
1088
+ const t = JSON.stringify(e);
1089
+ o.clients.forEach(e => {
1090
+ e.readyState === e.OPEN && e.send(t);
1091
+ });
1092
+ }
1093
+ })), r.push(() => {
1094
+ clearInterval(i), o.clients.forEach(e => {
1095
+ e.close(1e3);
1096
+ });
1097
+ });
1098
+ }(e, o, n), o.listen(t.port, t.address), sendMsg(e, {
1099
+ serverStarted: {
1100
+ address: t.address,
1101
+ basePath: t.basePath,
1102
+ browserUrl: getBrowserUrl(t.protocol, t.address, t.port, t.basePath, "/"),
1103
+ port: t.port,
1104
+ protocol: t.protocol,
1105
+ root: t.root,
1106
+ initialLoadUrl: getBrowserUrl(t.protocol, t.address, t.port, t.basePath, t.initialLoadUrl || DEV_SERVER_INIT_URL),
1107
+ error: null
1108
+ }
1109
+ }), r = !0;
1110
+ const i = () => {
1111
+ n.forEach(e => {
1112
+ e();
1113
+ }), n.length = 0, o = null, setTimeout(() => {
1114
+ exit$1(0);
1115
+ }, 5e3).unref(), e.removeAllListeners("message");
1116
+ };
1117
+ e.once("SIGINT", i);
1118
+ } catch (t) {
1119
+ r ? sendError(e, t) : sendMsg(e, {
1120
+ serverStarted: {
1121
+ address: null,
1122
+ basePath: null,
1123
+ browserUrl: null,
1124
+ initialLoadUrl: null,
1125
+ port: null,
1126
+ protocol: null,
1127
+ root: null,
1128
+ error: String(t)
1129
+ }
1130
+ });
1131
+ }
1132
+ }
1133
+
1134
+ var fn, exit$1;
1135
+
1136
+ const util = require("util"), util__default = _interopDefault(util), fs = _interopDefault(require("../sys/node/graceful-fs.js")), path = _interopDefault(require("path")), querystring = require("querystring"), Url = require("url"), zlib = require("zlib"), buffer = require("buffer"), openInEditorApi = _interopDefault(require("./open-in-editor-api.js")), net = require("net"), http = require("http"), https = require("https"), glob = _interopDefault(require("../sys/node/glob.js")), os = require("os"), crypto = require("crypto"), cp = require("child_process"), events = require("events"), ws = require("./ws.js"), DEV_SERVER_INIT_URL = "/~dev-server-init", OPEN_IN_EDITOR_URL = "/~dev-server-open-in-editor", version = "0.0.0-dev.20221104122636", msgResolves = new Map;
1137
+
1138
+ let resolveIds = 1;
1139
+
1140
+ const DEFAULT_HEADERS = {
1141
+ "cache-control": "no-cache, no-store, must-revalidate, max-age=0",
1142
+ expires: "0",
1143
+ server: "Rindo Dev Server " + version,
1144
+ date: "Wed, 1 Jan 2000 00:00:00 GMT",
1145
+ "access-control-allow-origin": "*",
1146
+ "access-control-expose-headers": "*"
1147
+ }, TXT_EXT = [ "css", "html", "htm", "js", "json", "svg", "xml" ], IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin), noop = (global.process.platform,
1148
+ IS_NODE_ENV && global.process.platform, process.cwd, process.exit, () => {}), isString = e => "string" == typeof e, buildError = e => {
1149
+ const t = {
1150
+ level: "error",
1151
+ type: "build",
1152
+ header: "Build Error",
1153
+ messageText: "build error",
1154
+ relFilePath: null,
1155
+ absFilePath: null,
1156
+ lines: []
1157
+ };
1158
+ return e && e.push(t), t;
1159
+ }, catchError = (e, t, r) => {
1160
+ const s = {
1161
+ level: "error",
1162
+ type: "build",
1163
+ header: "Build Error",
1164
+ messageText: "build error",
1165
+ relFilePath: null,
1166
+ absFilePath: null,
1167
+ lines: []
1168
+ };
1169
+ return isString(r) ? s.messageText = r : null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.toString() : s.messageText = t.toString()),
1170
+ null == e || shouldIgnoreError(s.messageText) || e.push(s), s;
1171
+ }, shouldIgnoreError = e => e === TASK_CANCELED_MSG, TASK_CANCELED_MSG = "task canceled", normalizePath = e => {
1172
+ if ("string" != typeof e) throw new Error("invalid path to normalize");
1173
+ e = normalizeSlashes(e.trim());
1174
+ const t = pathComponents(e, getRootLength(e)), r = reducePathComponents(t), s = r[0], n = r[1], o = s + r.slice(1).join("/");
1175
+ return "" === o ? "." : "" === s && n && e.includes("/") && !n.startsWith(".") && !n.startsWith("@") ? "./" + o : o;
1176
+ }, normalizeSlashes = e => e.replace(backslashRegExp, "/"), backslashRegExp = /\\/g, reducePathComponents = e => {
1177
+ if (!Array.isArray(e) || 0 === e.length) return [];
1178
+ const t = [ e[0] ];
1179
+ for (let r = 1; r < e.length; r++) {
1180
+ const s = e[r];
1181
+ if (s && "." !== s) {
1182
+ if (".." === s) if (t.length > 1) {
1183
+ if (".." !== t[t.length - 1]) {
1184
+ t.pop();
1185
+ continue;
1186
+ }
1187
+ } else if (t[0]) continue;
1188
+ t.push(s);
1189
+ }
1190
+ }
1191
+ return t;
1192
+ }, getRootLength = e => {
1193
+ const t = getEncodedRootLength(e);
1194
+ return t < 0 ? ~t : t;
1195
+ }, getEncodedRootLength = e => {
1196
+ if (!e) return 0;
1197
+ const t = e.charCodeAt(0);
1198
+ if (47 === t || 92 === t) {
1199
+ if (e.charCodeAt(1) !== t) return 1;
1200
+ const r = e.indexOf(47 === t ? "/" : "\\", 2);
1201
+ return r < 0 ? e.length : r + 1;
1202
+ }
1203
+ if (isVolumeCharacter(t) && 58 === e.charCodeAt(1)) {
1204
+ const t = e.charCodeAt(2);
1205
+ if (47 === t || 92 === t) return 3;
1206
+ if (2 === e.length) return 2;
1207
+ }
1208
+ const r = e.indexOf("://");
1209
+ if (-1 !== r) {
1210
+ const t = r + "://".length, s = e.indexOf("/", t);
1211
+ if (-1 !== s) {
1212
+ const n = e.slice(0, r), o = e.slice(t, s);
1213
+ if ("file" === n && ("" === o || "localhost" === o) && isVolumeCharacter(e.charCodeAt(s + 1))) {
1214
+ const t = getFileUrlVolumeSeparatorEnd(e, s + 2);
1215
+ if (-1 !== t) {
1216
+ if (47 === e.charCodeAt(t)) return ~(t + 1);
1217
+ if (t === e.length) return ~t;
1218
+ }
1219
+ }
1220
+ return ~(s + 1);
1221
+ }
1222
+ return ~e.length;
1223
+ }
1224
+ return 0;
1225
+ }, isVolumeCharacter = e => e >= 97 && e <= 122 || e >= 65 && e <= 90, getFileUrlVolumeSeparatorEnd = (e, t) => {
1226
+ const r = e.charCodeAt(t);
1227
+ if (58 === r) return t + 1;
1228
+ if (37 === r && 51 === e.charCodeAt(t + 1)) {
1229
+ const r = e.charCodeAt(t + 2);
1230
+ if (97 === r || 65 === r) return t + 3;
1231
+ }
1232
+ return -1;
1233
+ }, pathComponents = (e, t) => {
1234
+ const r = e.substring(0, t), s = e.substring(t).split("/"), n = s.length;
1235
+ return n > 0 && !s[n - 1] && s.pop(), [ r, ...s ];
1236
+ }, urlVersionIds = new Map, EDITORS = {
1237
+ atom: "Atom",
1238
+ code: "Code",
1239
+ emacs: "Emacs",
1240
+ idea14ce: "IDEA 14 Community Edition",
1241
+ phpstorm: "PhpStorm",
1242
+ sublime: "Sublime",
1243
+ webstorm: "WebStorm",
1244
+ vim: "Vim",
1245
+ visualstudio: "Visual Studio"
1246
+ }, EDITOR_PRIORITY = {
1247
+ code: 1,
1248
+ atom: 2,
1249
+ sublime: 3,
1250
+ visualstudio: 4,
1251
+ idea14ce: 5,
1252
+ webstorm: 6,
1253
+ phpstorm: 7,
1254
+ vim: 8,
1255
+ emacs: 9
1256
+ };
1257
+
1258
+ let dirTemplate = null;
1259
+
1260
+ const copyFile = util.promisify(fs.copyFile), mkdir = util.promisify(fs.mkdir), readdir = util.promisify(fs.readdir), readFile = util.promisify(fs.readFile), stat = util.promisify(fs.stat), ROOT_DIR = normalizePath(path.resolve("/")), IGNORE = [ ".ds_store", ".gitignore", "desktop.ini", "thumbs.db" ];
1261
+
1262
+ fn = new Intl.Collator(0, {
1263
+ numeric: 1
1264
+ }).compare;
1265
+
1266
+ const ARROW = "→", BOX_TOP_LEFT = "╭", BOX_TOP_RIGHT = "╮", BOX_BOTTOM_LEFT = "╰", BOX_BOTTOM_RIGHT = "╯", BOX_VERTICAL = "│", BOX_HORIZONTAL = "─", PADDING = 2, INDENT = " ";
1267
+
1268
+ exit$1 = function e(t, r) {
1269
+ function s() {
1270
+ n === r.length && process.exit(t);
1271
+ }
1272
+ r || (r = [ process.stdout, process.stderr ]);
1273
+ var n = 0;
1274
+ r.forEach((function(e) {
1275
+ 0 === e.bufferSize ? n++ : e.write("", "utf-8", (function() {
1276
+ n++, s();
1277
+ })), e.write = function() {};
1278
+ })), s(), process.on("exit", (function() {
1279
+ process.exit(t);
1280
+ }));
1281
+ };
1282
+
1283
+ class NodeLazyRequire {
1284
+ constructor(e, t) {
1285
+ this.nodeResolveModule = e, this.lazyDependencies = t, this.moduleData = new Map;
1286
+ }
1287
+ async ensure(e, t, r) {
1288
+ const s = [];
1289
+ let n = !1;
1290
+ const o = r.map(async e => {
1291
+ const r = this.moduleData.get(e);
1292
+ if (r && r.fromDir && r.modulePath) return;
1293
+ const [o, i] = this.lazyDependencies[e];
1294
+ try {
1295
+ const r = this.nodeResolveModule.resolveModule(t, e), s = await async function a(e) {
1296
+ const t = await readFile(e, "utf8");
1297
+ return JSON.parse(t);
1298
+ }(r);
1299
+ if (n = !0, semiver(s.version, o) >= 0) return void this.moduleData.set(e, {
1300
+ fromDir: t,
1301
+ modulePath: path.dirname(r)
1302
+ });
1303
+ } catch (e) {}
1304
+ s.push({
1305
+ moduleId: e,
1306
+ requiredVersionRange: i
1307
+ });
1308
+ });
1309
+ if (await Promise.all(o), 0 === s.length) return Promise.resolve();
1310
+ const i = `Please wait while required dependencies are ${n ? "updated" : "installed"}. This may take a few moments and will only be required for the initial run.`;
1311
+ e.info(e.magenta(i));
1312
+ const a = s.map(e => e.moduleId), l = e.createTimeSpan(`installing dependenc${a.length > 1 ? "ies" : "y"}: ${a.join(", ")}`);
1313
+ try {
1314
+ const r = s.map(e => {
1315
+ let t = e.moduleId;
1316
+ return e.requiredVersionRange && (t += "@" + e.requiredVersionRange), t;
1317
+ });
1318
+ await function c(e, t, r) {
1319
+ return new Promise((s, n) => {
1320
+ const o = [ "install", ...r, "--no-audit", "--save-exact", "--save-dev" ], i = {
1321
+ shell: !0,
1322
+ cwd: t,
1323
+ env: Object.assign({}, process.env)
1324
+ };
1325
+ i.env.NODE_ENV = "development", "debug" === e.getLevel() && o.push("--verbose"),
1326
+ e.debug("npm " + o.join(" ")), e.debug("npm, cwd: " + t);
1327
+ const a = cp.spawn("npm", o, i);
1328
+ let l = "";
1329
+ a.stdout && (a.stdout.setEncoding("utf8"), a.stdout.on("data", e => {
1330
+ l += e;
1331
+ })), a.stderr && (a.stderr.setEncoding("utf8"), a.stderr.on("data", e => {
1332
+ l += e;
1333
+ })), a.once("exit", t => {
1334
+ "debug" === e.getLevel() && e.debug("npm, exit " + t), 0 === t ? s() : n(`failed to install: ${r.join(", ")}${l ? ", " + l : ""}`);
1335
+ });
1336
+ });
1337
+ }(e, t, r), s.forEach(e => {
1338
+ this.moduleData.set(e.moduleId, {
1339
+ fromDir: t,
1340
+ modulePath: null
1341
+ });
1342
+ }), l.finish("installing dependencies finished");
1343
+ } catch (t) {
1344
+ e.error("lazy require failed: " + t);
1345
+ }
1346
+ }
1347
+ require(e) {
1348
+ const t = this.moduleData.get(e);
1349
+ if (!t) throw new Error("lazy required module has not been ensured: " + e);
1350
+ if (!t.modulePath) {
1351
+ const r = this.nodeResolveModule.resolveModule(t.fromDir, e);
1352
+ t.modulePath = path.dirname(r), this.moduleData.set(e, t);
1353
+ }
1354
+ return require(t.modulePath);
1355
+ }
1356
+ getModulePath(e) {
1357
+ const t = this.moduleData.get(e);
1358
+ if (!t) throw new Error("lazy required module has not been ensured: " + e);
1359
+ if (!t.modulePath) {
1360
+ const r = this.nodeResolveModule.resolveModule(t.fromDir, e);
1361
+ t.modulePath = path.dirname(r), this.moduleData.set(e, t);
1362
+ }
1363
+ return t.modulePath;
1364
+ }
1365
+ }
1366
+
1367
+ class NodeResolveModule {
1368
+ constructor() {
1369
+ this.resolveModuleCache = new Map;
1370
+ }
1371
+ resolveModule(e, t, r) {
1372
+ const s = `${e}:${t}`, n = this.resolveModuleCache.get(s);
1373
+ if (n) return n;
1374
+ if (r && r.manuallyResolve) return this.resolveModuleManually(e, t, s);
1375
+ if (t.startsWith("@types/")) return this.resolveTypesModule(e, t, s);
1376
+ const o = require("module");
1377
+ e = path.resolve(e);
1378
+ const i = path.join(e, "noop.js");
1379
+ let a = normalizePath(o._resolveFilename(t, {
1380
+ id: i,
1381
+ filename: i,
1382
+ paths: o._nodeModulePaths(e)
1383
+ }));
1384
+ const l = normalizePath(path.parse(e).root);
1385
+ let c;
1386
+ for (;a !== l; ) if (a = normalizePath(path.dirname(a)), c = path.join(a, "package.json"),
1387
+ fs.existsSync(c)) return this.resolveModuleCache.set(s, c), c;
1388
+ throw new Error(`error loading "${t}" from "${e}"`);
1389
+ }
1390
+ resolveTypesModule(e, t, r) {
1391
+ const s = t.split("/"), n = normalizePath(path.parse(e).root);
1392
+ let o, i = normalizePath(path.join(e, "noop.js"));
1393
+ for (;i !== n; ) if (i = normalizePath(path.dirname(i)), o = path.join(i, "node_modules", s[0], s[1], "package.json"),
1394
+ fs.existsSync(o)) return this.resolveModuleCache.set(r, o), o;
1395
+ throw new Error(`error loading "${t}" from "${e}"`);
1396
+ }
1397
+ resolveModuleManually(e, t, r) {
1398
+ const s = normalizePath(path.parse(e).root);
1399
+ let n, o = normalizePath(path.join(e, "noop.js"));
1400
+ for (;o !== s; ) if (o = normalizePath(path.dirname(o)), n = path.join(o, "node_modules", t, "package.json"),
1401
+ fs.existsSync(n)) return this.resolveModuleCache.set(r, n), n;
1402
+ throw new Error(`error loading "${t}" from "${e}"`);
1403
+ }
1404
+ }
1405
+
1406
+ class NodeWorkerMain extends events.EventEmitter {
1407
+ constructor(e, t) {
1408
+ super(), this.id = e, this.tasks = new Map, this.exitCode = null, this.processQueue = !0,
1409
+ this.sendQueue = [], this.stopped = !1, this.successfulMessage = !1, this.totalTasksAssigned = 0,
1410
+ this.fork(t);
1411
+ }
1412
+ fork(e) {
1413
+ const t = {
1414
+ execArgv: process.execArgv.filter(e => !/^--(debug|inspect)/.test(e)),
1415
+ env: process.env,
1416
+ cwd: process.cwd(),
1417
+ silent: !0
1418
+ };
1419
+ this.childProcess = cp.fork(e, [], t), this.childProcess.stdout.setEncoding("utf8"),
1420
+ this.childProcess.stdout.on("data", e => {
1421
+ console.log(e);
1422
+ }), this.childProcess.stderr.setEncoding("utf8"), this.childProcess.stderr.on("data", e => {
1423
+ console.log(e);
1424
+ }), this.childProcess.on("message", this.receiveFromWorker.bind(this)), this.childProcess.on("error", e => {
1425
+ this.emit("error", e);
1426
+ }), this.childProcess.once("exit", e => {
1427
+ this.exitCode = e, this.emit("exit", e);
1428
+ });
1429
+ }
1430
+ run(e) {
1431
+ this.totalTasksAssigned++, this.tasks.set(e.rindoId, e), this.sendToWorker({
1432
+ rindoId: e.rindoId,
1433
+ args: e.inputArgs
1434
+ });
1435
+ }
1436
+ sendToWorker(e) {
1437
+ this.processQueue ? this.childProcess.send(e, e => {
1438
+ if (!(e && e instanceof Error) && (this.processQueue = !0, this.sendQueue.length > 0)) {
1439
+ const e = this.sendQueue.slice();
1440
+ this.sendQueue = [], e.forEach(e => this.sendToWorker(e));
1441
+ }
1442
+ }) && !/^win/.test(process.platform) || (this.processQueue = !1) : this.sendQueue.push(e);
1443
+ }
1444
+ receiveFromWorker(e) {
1445
+ if (this.successfulMessage = !0, this.stopped) return;
1446
+ const t = this.tasks.get(e.rindoId);
1447
+ t ? (null != e.rindoRtnError ? t.reject(e.rindoRtnError) : t.resolve(e.rindoRtnValue),
1448
+ this.tasks.delete(e.rindoId), this.emit("response", e)) : null != e.rindoRtnError && this.emit("error", e.rindoRtnError);
1449
+ }
1450
+ stop() {
1451
+ this.stopped = !0, this.tasks.forEach(e => e.reject(TASK_CANCELED_MSG)), this.tasks.clear(),
1452
+ this.successfulMessage ? (this.childProcess.send({
1453
+ exit: !0
1454
+ }), setTimeout(() => {
1455
+ null === this.exitCode && this.childProcess.kill("SIGKILL");
1456
+ }, 100)) : this.childProcess.kill("SIGKILL");
1457
+ }
1458
+ }
1459
+
1460
+ class NodeWorkerController extends events.EventEmitter {
1461
+ constructor(e, t) {
1462
+ super(), this.forkModulePath = e, this.workerIds = 0, this.rindoId = 0, this.isEnding = !1,
1463
+ this.taskQueue = [], this.workers = [];
1464
+ const r = os.cpus().length;
1465
+ this.useForkedWorkers = t > 0, this.maxWorkers = Math.max(Math.min(t, r), 2) - 1,
1466
+ this.useForkedWorkers ? this.startWorkers() : this.mainThreadRunner = require(e);
1467
+ }
1468
+ onError(e, t) {
1469
+ if ("ERR_IPC_CHANNEL_CLOSED" === e.code) return this.stopWorker(t);
1470
+ "EPIPE" !== e.code && console.error(e);
1471
+ }
1472
+ onExit(e) {
1473
+ setTimeout(() => {
1474
+ let t = !1;
1475
+ const r = this.workers.find(t => t.id === e);
1476
+ r && (r.tasks.forEach(e => {
1477
+ e.retries++, this.taskQueue.unshift(e), t = !0;
1478
+ }), r.tasks.clear()), this.stopWorker(e), t && this.processTaskQueue();
1479
+ }, 10);
1480
+ }
1481
+ startWorkers() {
1482
+ for (;this.workers.length < this.maxWorkers; ) this.startWorker();
1483
+ }
1484
+ startWorker() {
1485
+ const e = this.workerIds++, t = new NodeWorkerMain(e, this.forkModulePath);
1486
+ t.on("response", this.processTaskQueue.bind(this)), t.once("exit", () => {
1487
+ this.onExit(e);
1488
+ }), t.on("error", t => {
1489
+ this.onError(t, e);
1490
+ }), this.workers.push(t);
1491
+ }
1492
+ stopWorker(e) {
1493
+ const t = this.workers.find(t => t.id === e);
1494
+ if (t) {
1495
+ t.stop();
1496
+ const e = this.workers.indexOf(t);
1497
+ e > -1 && this.workers.splice(e, 1);
1498
+ }
1499
+ }
1500
+ processTaskQueue() {
1501
+ if (!this.isEnding) for (this.useForkedWorkers && this.startWorkers(); this.taskQueue.length > 0; ) {
1502
+ const e = getNextWorker(this.workers);
1503
+ if (!e) break;
1504
+ e.run(this.taskQueue.shift());
1505
+ }
1506
+ }
1507
+ send(...e) {
1508
+ return this.isEnding ? Promise.reject(TASK_CANCELED_MSG) : this.useForkedWorkers ? new Promise((t, r) => {
1509
+ const s = {
1510
+ rindoId: this.rindoId++,
1511
+ inputArgs: e,
1512
+ retries: 0,
1513
+ resolve: t,
1514
+ reject: r
1515
+ };
1516
+ this.taskQueue.push(s), this.processTaskQueue();
1517
+ }) : this.mainThreadRunner[e[0]].apply(null, e.slice(1));
1518
+ }
1519
+ handler(e) {
1520
+ return (...t) => this.send(e, ...t);
1521
+ }
1522
+ cancelTasks() {
1523
+ for (const e of this.workers) e.tasks.forEach(e => e.reject(TASK_CANCELED_MSG)),
1524
+ e.tasks.clear();
1525
+ this.taskQueue.length = 0;
1526
+ }
1527
+ destroy() {
1528
+ if (!this.isEnding) {
1529
+ this.isEnding = !0;
1530
+ for (const e of this.taskQueue) e.reject(TASK_CANCELED_MSG);
1531
+ this.taskQueue.length = 0;
1532
+ const e = this.workers.map(e => e.id);
1533
+ for (const t of e) this.stopWorker(t);
1534
+ }
1535
+ }
1536
+ }
1537
+
1538
+ !function createMessageReceiver(e, t) {
1539
+ e.on("message", e => {
1540
+ if ("number" == typeof e.resolveId) {
1541
+ const t = msgResolves.get(e.resolveId);
1542
+ t && (msgResolves.delete(e.resolveId), t(e));
1543
+ }
1544
+ t(e);
1545
+ });
1546
+ }(process, e => {
1547
+ e.startServer && async function t(e) {
1548
+ try {
1549
+ e.contentTypes = await async function t(e) {
1550
+ const t = path.join(e.devServerDir, "content-type-db.json"), r = util__default.promisify(fs.readFile), s = await r(t, "utf8");
1551
+ return JSON.parse(s);
1552
+ }(e), startDevServerWorker(process, e);
1553
+ } catch (e) {
1554
+ sendMsg(process, {
1555
+ serverStarted: {
1556
+ address: null,
1557
+ basePath: null,
1558
+ browserUrl: null,
1559
+ initialLoadUrl: null,
1560
+ port: null,
1561
+ protocol: null,
1562
+ root: null,
1563
+ error: String(e)
1564
+ }
1565
+ });
1566
+ }
1567
+ }(e.startServer);
1568
+ }), process.on("unhandledRejection", e => {
1569
+ console.log("server worker error", e);
1570
+ });