@rindo/core 1.8.12

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 (463) hide show
  1. package/LICENSE.md +27 -0
  2. package/bin/rindo +22 -0
  3. package/build-conditionals/index.d.ts +2 -0
  4. package/build-conditionals/index.mjs +66 -0
  5. package/build-conditionals/package.json +6 -0
  6. package/compiler/index.js +2 -0
  7. package/compiler/package.json +6 -0
  8. package/compiler/rindo.js +6765 -0
  9. package/dist/cli/index.js +6068 -0
  10. package/dist/client/css-shim-14a9812e.js +656 -0
  11. package/dist/client/css-shim-69821662.js +658 -0
  12. package/dist/client/declarations/rindo.core.d.ts +1347 -0
  13. package/dist/client/dom-68c8fe31.js +139 -0
  14. package/dist/client/dom-af01458a.js +137 -0
  15. package/dist/client/index.js +2937 -0
  16. package/dist/client/index.mjs +2820 -0
  17. package/dist/client/polyfills/core-js.js +10 -0
  18. package/dist/client/polyfills/css-shim.js +656 -0
  19. package/dist/client/polyfills/dom.js +146 -0
  20. package/dist/client/polyfills/es5-html-element.js +18 -0
  21. package/dist/client/polyfills/index.js +35 -0
  22. package/dist/client/polyfills/promise.js +9 -0
  23. package/dist/client/polyfills/system.js +6 -0
  24. package/dist/client/shadow-css-6ef31c68.js +386 -0
  25. package/dist/client/shadow-css-8fd1a9e4.js +388 -0
  26. package/dist/compiler/app-core/app-es5-disabled.d.ts +2 -0
  27. package/dist/compiler/app-core/app-polyfills.d.ts +3 -0
  28. package/dist/compiler/app-core/build-conditionals.d.ts +6 -0
  29. package/dist/compiler/app-core/bundle-app-core.d.ts +6 -0
  30. package/dist/compiler/app-core/component-styles.d.ts +4 -0
  31. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +4 -0
  32. package/dist/compiler/app-core/optimize-module.d.ts +7 -0
  33. package/dist/compiler/browser/build-conditionals-client.d.ts +3 -0
  34. package/dist/compiler/browser/compile-options.d.ts +12 -0
  35. package/dist/compiler/browser/compile.d.ts +2 -0
  36. package/dist/compiler/browser/create-compiler.d.ts +14 -0
  37. package/dist/compiler/browser/index.d.ts +11 -0
  38. package/dist/compiler/build/build-ctx.d.ts +74 -0
  39. package/dist/compiler/build/build-finish.d.ts +3 -0
  40. package/dist/compiler/build/build-hmr.d.ts +2 -0
  41. package/dist/compiler/build/build-results.d.ts +2 -0
  42. package/dist/compiler/build/build-stats.d.ts +3 -0
  43. package/dist/compiler/build/build.d.ts +2 -0
  44. package/dist/compiler/build/cache-stats.d.ts +4 -0
  45. package/dist/compiler/build/compiler-build-id.d.ts +6 -0
  46. package/dist/compiler/build/compiler-ctx.d.ts +44 -0
  47. package/dist/compiler/build/init-index-html.d.ts +2 -0
  48. package/dist/compiler/build/validate-files.d.ts +2 -0
  49. package/dist/compiler/build/write-build.d.ts +2 -0
  50. package/dist/compiler/cache.d.ts +22 -0
  51. package/dist/compiler/compiler.d.ts +27 -0
  52. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +3 -0
  53. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +2 -0
  54. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +2 -0
  55. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +2 -0
  56. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +3 -0
  57. package/dist/compiler/component-lazy/generate-cjs.d.ts +3 -0
  58. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +3 -0
  59. package/dist/compiler/component-lazy/generate-esm.d.ts +3 -0
  60. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +3 -0
  61. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +4 -0
  62. package/dist/compiler/component-lazy/generate-system.d.ts +3 -0
  63. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +2 -0
  64. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +2 -0
  65. package/dist/compiler/component-native/update-to-native-component.d.ts +2 -0
  66. package/dist/compiler/config/config-reload.d.ts +3 -0
  67. package/dist/compiler/config/config-utils.d.ts +4 -0
  68. package/dist/compiler/config/validate-config.d.ts +4 -0
  69. package/dist/compiler/config/validate-copy.d.ts +2 -0
  70. package/dist/compiler/config/validate-dev-server.d.ts +2 -0
  71. package/dist/compiler/config/validate-docs.d.ts +2 -0
  72. package/dist/compiler/config/validate-namespace.d.ts +3 -0
  73. package/dist/compiler/config/validate-output-stats.d.ts +2 -0
  74. package/dist/compiler/config/validate-outputs-angular.d.ts +2 -0
  75. package/dist/compiler/config/validate-outputs-custom.d.ts +2 -0
  76. package/dist/compiler/config/validate-outputs-dist-module.d.ts +2 -0
  77. package/dist/compiler/config/validate-outputs-dist.d.ts +2 -0
  78. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +2 -0
  79. package/dist/compiler/config/validate-outputs-www.d.ts +2 -0
  80. package/dist/compiler/config/validate-outputs.d.ts +2 -0
  81. package/dist/compiler/config/validate-paths.d.ts +2 -0
  82. package/dist/compiler/config/validate-plugins.d.ts +2 -0
  83. package/dist/compiler/config/validate-prerender.d.ts +2 -0
  84. package/dist/compiler/config/validate-rollup-config.d.ts +2 -0
  85. package/dist/compiler/config/validate-service-worker.d.ts +2 -0
  86. package/dist/compiler/config/validate-testing.d.ts +2 -0
  87. package/dist/compiler/config/validate-workers.d.ts +2 -0
  88. package/dist/compiler/copy/assets-copy-tasks.d.ts +3 -0
  89. package/dist/compiler/copy/hashed-copy.d.ts +2 -0
  90. package/dist/compiler/copy/local-copy-tasks.d.ts +3 -0
  91. package/dist/compiler/docs/constants.d.ts +2 -0
  92. package/dist/compiler/docs/custom/index.d.ts +2 -0
  93. package/dist/compiler/docs/docs.d.ts +2 -0
  94. package/dist/compiler/docs/generate-doc-data.d.ts +3 -0
  95. package/dist/compiler/docs/json/index.d.ts +3 -0
  96. package/dist/compiler/docs/readme/docs-util.d.ts +13 -0
  97. package/dist/compiler/docs/readme/index.d.ts +3 -0
  98. package/dist/compiler/docs/readme/markdown-css-props.d.ts +2 -0
  99. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +2 -0
  100. package/dist/compiler/docs/readme/markdown-events.d.ts +2 -0
  101. package/dist/compiler/docs/readme/markdown-methods.d.ts +2 -0
  102. package/dist/compiler/docs/readme/markdown-props.d.ts +2 -0
  103. package/dist/compiler/docs/readme/markdown-slots.d.ts +2 -0
  104. package/dist/compiler/docs/readme/markdown-usage.d.ts +6 -0
  105. package/dist/compiler/docs/readme/output-docs.d.ts +3 -0
  106. package/dist/compiler/docs/style-docs.d.ts +2 -0
  107. package/dist/compiler/docs/vscode/index.d.ts +2 -0
  108. package/dist/compiler/entries/component-bundles.d.ts +3 -0
  109. package/dist/compiler/entries/component-graph.d.ts +2 -0
  110. package/dist/compiler/entries/default-bundles.d.ts +3 -0
  111. package/dist/compiler/entries/entry-modules.d.ts +6 -0
  112. package/dist/compiler/entries/resolve-component-dependencies.d.ts +2 -0
  113. package/dist/compiler/events.d.ts +15 -0
  114. package/dist/compiler/fs-watch/fs-watch-init.d.ts +2 -0
  115. package/dist/compiler/fs-watch/fs-watch-log.d.ts +2 -0
  116. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +7 -0
  117. package/dist/compiler/html/inject-module-preloads.d.ts +3 -0
  118. package/dist/compiler/html/inject-sw-script.d.ts +4 -0
  119. package/dist/compiler/html/inline-esm-import.d.ts +2 -0
  120. package/dist/compiler/html/inline-style-sheets.d.ts +2 -0
  121. package/dist/compiler/html/update-global-styles-link.d.ts +2 -0
  122. package/dist/compiler/html/used-components.d.ts +2 -0
  123. package/dist/compiler/html/utils.d.ts +2 -0
  124. package/dist/compiler/html/validate-manifest-json.d.ts +2 -0
  125. package/dist/compiler/index.d.ts +10 -0
  126. package/dist/compiler/index.js +18008 -0
  127. package/dist/compiler/output-targets/empty-dir.d.ts +6 -0
  128. package/dist/compiler/output-targets/index.d.ts +2 -0
  129. package/dist/compiler/output-targets/output-angular.d.ts +4 -0
  130. package/dist/compiler/output-targets/output-app.d.ts +4 -0
  131. package/dist/compiler/output-targets/output-collection.d.ts +3 -0
  132. package/dist/compiler/output-targets/output-copy.d.ts +2 -0
  133. package/dist/compiler/output-targets/output-custom.d.ts +2 -0
  134. package/dist/compiler/output-targets/output-docs.d.ts +2 -0
  135. package/dist/compiler/output-targets/output-hydrate.d.ts +2 -0
  136. package/dist/compiler/output-targets/output-lazy-loader.d.ts +2 -0
  137. package/dist/compiler/output-targets/output-module.d.ts +4 -0
  138. package/dist/compiler/output-targets/output-prerender.d.ts +2 -0
  139. package/dist/compiler/output-targets/output-service-workers.d.ts +2 -0
  140. package/dist/compiler/output-targets/output-types.d.ts +2 -0
  141. package/dist/compiler/output-targets/output-utils.d.ts +54 -0
  142. package/dist/compiler/output-targets/output-www.d.ts +2 -0
  143. package/dist/compiler/plugin/plugin.d.ts +6 -0
  144. package/dist/compiler/polyfills.d.ts +0 -0
  145. package/dist/compiler/prerender/crawl-urls.d.ts +3 -0
  146. package/dist/compiler/prerender/host-config.d.ts +12 -0
  147. package/dist/compiler/prerender/prerender-config.d.ts +2 -0
  148. package/dist/compiler/prerender/prerender-main.d.ts +2 -0
  149. package/dist/compiler/prerender/prerender-queue.d.ts +3 -0
  150. package/dist/compiler/prerender/prerender-template-html.d.ts +2 -0
  151. package/dist/compiler/prerender/prerendered-write-path.d.ts +2 -0
  152. package/dist/compiler/prerender/robots-txt.d.ts +2 -0
  153. package/dist/compiler/prerender/sitemap-xml.d.ts +3 -0
  154. package/dist/compiler/rollup-plugins/component-entry.d.ts +3 -0
  155. package/dist/compiler/rollup-plugins/css-transformer.d.ts +3 -0
  156. package/dist/compiler/rollup-plugins/global-scripts.d.ts +4 -0
  157. package/dist/compiler/rollup-plugins/image-plugin.d.ts +3 -0
  158. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +3 -0
  159. package/dist/compiler/rollup-plugins/loader.d.ts +4 -0
  160. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +5 -0
  161. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +7 -0
  162. package/dist/compiler/rollup-plugins/rindo-client.d.ts +3 -0
  163. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +2 -0
  164. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +3 -0
  165. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +2 -0
  166. package/dist/compiler/service-worker/generate-sw.d.ts +7 -0
  167. package/dist/compiler/service-worker/service-worker-util.d.ts +2 -0
  168. package/dist/compiler/style/cached-styles.d.ts +5 -0
  169. package/dist/compiler/style/component-styles.d.ts +2 -0
  170. package/dist/compiler/style/css-imports.d.ts +9 -0
  171. package/dist/compiler/style/css-to-esm.d.ts +5 -0
  172. package/dist/compiler/style/generate-styles.d.ts +2 -0
  173. package/dist/compiler/style/global-styles.d.ts +3 -0
  174. package/dist/compiler/style/normalize-styles.d.ts +2 -0
  175. package/dist/compiler/style/optimize-css.d.ts +2 -0
  176. package/dist/compiler/style/scope-css.d.ts +3 -0
  177. package/dist/compiler/style/style-utils.d.ts +10 -0
  178. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +3 -0
  179. package/dist/compiler/transformers/add-component-meta-static.d.ts +4 -0
  180. package/dist/compiler/transformers/add-imports.d.ts +3 -0
  181. package/dist/compiler/transformers/collections/add-external-import.d.ts +2 -0
  182. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +2 -0
  183. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +2 -0
  184. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +7 -0
  185. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +2 -0
  186. package/dist/compiler/transformers/component-build-conditionals.d.ts +2 -0
  187. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +3 -0
  188. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +3 -0
  189. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +2 -0
  190. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +3 -0
  191. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +3 -0
  192. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +3 -0
  193. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +4 -0
  194. package/dist/compiler/transformers/component-native/native-component.d.ts +3 -0
  195. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +3 -0
  196. package/dist/compiler/transformers/component-native/native-constructor.d.ts +3 -0
  197. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +3 -0
  198. package/dist/compiler/transformers/component-native/native-static-style.d.ts +3 -0
  199. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +4 -0
  200. package/dist/compiler/transformers/core-runtime-apis.d.ts +30 -0
  201. package/dist/compiler/transformers/create-event.d.ts +3 -0
  202. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +3 -0
  203. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +3 -0
  204. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +10 -0
  205. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +3 -0
  206. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +4 -0
  207. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +6 -0
  208. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +3 -0
  209. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +4 -0
  210. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +3 -0
  211. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +3 -0
  212. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +3 -0
  213. package/dist/compiler/transformers/define-custom-element.d.ts +3 -0
  214. package/dist/compiler/transformers/host-data-transform.d.ts +3 -0
  215. package/dist/compiler/transformers/legacy-props.d.ts +3 -0
  216. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +2 -0
  217. package/dist/compiler/transformers/reserved-public-members.d.ts +3 -0
  218. package/dist/compiler/transformers/rindo-import-path.d.ts +3 -0
  219. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +3 -0
  220. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +3 -0
  221. package/dist/compiler/transformers/static-to-meta/component.d.ts +3 -0
  222. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +2 -0
  223. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +3 -0
  224. package/dist/compiler/transformers/static-to-meta/events.d.ts +3 -0
  225. package/dist/compiler/transformers/static-to-meta/import.d.ts +3 -0
  226. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +3 -0
  227. package/dist/compiler/transformers/static-to-meta/methods.d.ts +3 -0
  228. package/dist/compiler/transformers/static-to-meta/props.d.ts +3 -0
  229. package/dist/compiler/transformers/static-to-meta/states.d.ts +3 -0
  230. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +3 -0
  231. package/dist/compiler/transformers/static-to-meta/styles.d.ts +3 -0
  232. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +3 -0
  233. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +3 -0
  234. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +3 -0
  235. package/dist/compiler/transformers/style-imports.d.ts +3 -0
  236. package/dist/compiler/transformers/transform-utils.d.ts +31 -0
  237. package/dist/compiler/transformers/update-component-class.d.ts +3 -0
  238. package/dist/compiler/transformers/update-rindo-core-import.d.ts +3 -0
  239. package/dist/compiler/transformers/watcher-meta-transform.d.ts +3 -0
  240. package/dist/compiler/transpile/compiler-options.d.ts +4 -0
  241. package/dist/compiler/transpile/transpile-app.d.ts +2 -0
  242. package/dist/compiler/transpile/transpile-module.d.ts +5 -0
  243. package/dist/compiler/transpile/transpile-service.d.ts +3 -0
  244. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +2 -0
  245. package/dist/compiler/transpile/validate-types-main.d.ts +2 -0
  246. package/dist/compiler/types/generate-app-types.d.ts +2 -0
  247. package/dist/compiler/types/generate-component-types.d.ts +8 -0
  248. package/dist/compiler/types/generate-event-types.d.ts +2 -0
  249. package/dist/compiler/types/generate-method-types.d.ts +2 -0
  250. package/dist/compiler/types/generate-prop-types.d.ts +2 -0
  251. package/dist/compiler/types/generate-types.d.ts +2 -0
  252. package/dist/compiler/types/rindo-types.d.ts +3 -0
  253. package/dist/compiler/types/types-utils.d.ts +4 -0
  254. package/dist/compiler/types/update-import-refs.d.ts +11 -0
  255. package/dist/compiler/types/validate-package-json.d.ts +9 -0
  256. package/dist/declarations/assets.d.ts +17 -0
  257. package/dist/declarations/browser-compile.d.ts +47 -0
  258. package/dist/declarations/build-conditionals.d.ts +91 -0
  259. package/dist/declarations/build-events.d.ts +19 -0
  260. package/dist/declarations/build.d.ts +247 -0
  261. package/dist/declarations/cache.d.ts +11 -0
  262. package/dist/declarations/collection-manifest.d.ts +106 -0
  263. package/dist/declarations/collection.d.ts +139 -0
  264. package/dist/declarations/compiler.d.ts +53 -0
  265. package/dist/declarations/component-compiler-meta.d.ts +198 -0
  266. package/dist/declarations/component-constructor.d.ts +61 -0
  267. package/dist/declarations/component-interfaces.d.ts +123 -0
  268. package/dist/declarations/config.d.ts +409 -0
  269. package/dist/declarations/css-var-shim.d.ts +9 -0
  270. package/dist/declarations/decorators.d.ts +150 -0
  271. package/dist/declarations/dev-server.d.ts +135 -0
  272. package/dist/declarations/diagnostics.d.ts +21 -0
  273. package/dist/declarations/docs.d.ts +101 -0
  274. package/dist/declarations/entry.d.ts +28 -0
  275. package/dist/declarations/events.d.ts +13 -0
  276. package/dist/declarations/file-system.d.ts +91 -0
  277. package/dist/declarations/fs-watch.d.ts +15 -0
  278. package/dist/declarations/host-element.d.ts +53 -0
  279. package/dist/declarations/hydrate.d.ts +99 -0
  280. package/dist/declarations/in-memory-fs.d.ts +59 -0
  281. package/dist/declarations/index.d.ts +45 -0
  282. package/dist/declarations/jsdoc.d.ts +16 -0
  283. package/dist/declarations/jsx.d.ts +1050 -0
  284. package/dist/declarations/logger.d.ts +25 -0
  285. package/dist/declarations/minify-js.d.ts +11 -0
  286. package/dist/declarations/module.d.ts +35 -0
  287. package/dist/declarations/optimize-css.d.ts +12 -0
  288. package/dist/declarations/output-targets.d.ts +189 -0
  289. package/dist/declarations/plugin.d.ts +23 -0
  290. package/dist/declarations/prerender.d.ts +79 -0
  291. package/dist/declarations/render.d.ts +62 -0
  292. package/dist/declarations/runtime.d.ts +92 -0
  293. package/dist/declarations/screenshots.d.ts +192 -0
  294. package/dist/declarations/server.d.ts +19 -0
  295. package/dist/declarations/style.d.ts +35 -0
  296. package/dist/declarations/system.d.ts +174 -0
  297. package/dist/declarations/testing.d.ts +523 -0
  298. package/dist/declarations/transpile.d.ts +24 -0
  299. package/dist/declarations/types.d.ts +24 -0
  300. package/dist/declarations/vdom.d.ts +55 -0
  301. package/dist/declarations/worker.d.ts +33 -0
  302. package/dist/dev-server/content-type-db.json +1 -0
  303. package/dist/dev-server/index.js +887 -0
  304. package/dist/dev-server/static/app-error.css +257 -0
  305. package/dist/dev-server/static/dev-server-client.html +13 -0
  306. package/dist/dev-server/static/favicon.ico +0 -0
  307. package/dist/dev-server/templates/directory-index.html +132 -0
  308. package/dist/dev-server/templates/initial-load.html +160 -0
  309. package/dist/hydrate/index.d.ts +101 -0
  310. package/dist/hydrate/index.mjs +1281 -0
  311. package/dist/hydrate/platform.mjs +347 -0
  312. package/dist/index.d.ts +99 -0
  313. package/dist/index.js +1 -0
  314. package/dist/mock-doc/index.d.ts +851 -0
  315. package/dist/mock-doc/index.js +3982 -0
  316. package/dist/mock-doc/index.mjs +3954 -0
  317. package/dist/runtime/index.js +2576 -0
  318. package/dist/runtime/index.mjs +2521 -0
  319. package/dist/runtime/shadow-css-6ef31c68.js +386 -0
  320. package/dist/runtime/shadow-css-8fd1a9e4.js +388 -0
  321. package/dist/screenshot/connector-base.d.ts +42 -0
  322. package/dist/screenshot/connector-local.d.ts +7 -0
  323. package/dist/screenshot/index.d.ts +3 -0
  324. package/dist/screenshot/index.js +520 -0
  325. package/dist/screenshot/pixel-match.d.ts +1 -0
  326. package/dist/screenshot/screenshot-fs.d.ts +15 -0
  327. package/dist/sys/node/graceful-fs.js +975 -0
  328. package/dist/sys/node/index.js +33545 -0
  329. package/dist/sys/node/node-fetch.js +1779 -0
  330. package/dist/sys/node/open-in-editor.js +734 -0
  331. package/dist/sys/node/sys-worker.js +67035 -0
  332. package/dist/sys/node/visualstudio.vbs +82 -0
  333. package/dist/sys/node/websocket.js +3728 -0
  334. package/dist/sys/node/xdg-open +1066 -0
  335. package/dist/testing/build-conditionals.d.ts +4 -0
  336. package/dist/testing/build-conditionals.js +43 -0
  337. package/dist/testing/core.d.ts +35 -0
  338. package/dist/testing/core.js +52 -0
  339. package/dist/testing/index.d.ts +13 -0
  340. package/dist/testing/index.js +40511 -0
  341. package/dist/testing/jest/jest-config.d.ts +4 -0
  342. package/dist/testing/jest/jest-environment.d.ts +12 -0
  343. package/dist/testing/jest/jest-preprocessor.d.ts +10 -0
  344. package/dist/testing/jest/jest-runner.d.ts +5 -0
  345. package/dist/testing/jest/jest-screenshot.d.ts +2 -0
  346. package/dist/testing/jest/jest-serializer.d.ts +5 -0
  347. package/dist/testing/jest/jest-setup-test-framework.d.ts +1 -0
  348. package/dist/testing/matchers/attributes.d.ts +14 -0
  349. package/dist/testing/matchers/class-list.d.ts +12 -0
  350. package/dist/testing/matchers/events.d.ts +13 -0
  351. package/dist/testing/matchers/html.d.ts +12 -0
  352. package/dist/testing/matchers/index.d.ts +21 -0
  353. package/dist/testing/matchers/screenshot.d.ts +5 -0
  354. package/dist/testing/matchers/text.d.ts +4 -0
  355. package/dist/testing/mock-fetch.d.ts +46 -0
  356. package/dist/testing/mocks.d.ts +12 -0
  357. package/dist/testing/platform.d.ts +23 -0
  358. package/dist/testing/platform.js +321 -0
  359. package/dist/testing/puppeteer/puppeteer-browser.d.ts +6 -0
  360. package/dist/testing/puppeteer/puppeteer-declarations.d.ts +396 -0
  361. package/dist/testing/puppeteer/puppeteer-element.d.ts +65 -0
  362. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  363. package/dist/testing/puppeteer/puppeteer-events.d.ts +21 -0
  364. package/dist/testing/puppeteer/puppeteer-find.d.ts +5 -0
  365. package/dist/testing/puppeteer/puppeteer-page.d.ts +2 -0
  366. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  367. package/dist/testing/spec-page.d.ts +5 -0
  368. package/dist/testing/task-queue.d.ts +15 -0
  369. package/dist/testing/test-transpile.d.ts +5 -0
  370. package/dist/testing/testing-fs.d.ts +31 -0
  371. package/dist/testing/testing-logger.d.ts +23 -0
  372. package/dist/testing/testing-sys.d.ts +19 -0
  373. package/dist/testing/testing-utils.d.ts +5 -0
  374. package/dist/testing/testing.d.ts +12 -0
  375. package/dist/utils/index.js +1575 -0
  376. package/dist/utils/index.mjs +1511 -0
  377. package/internal/client/build-conditionals.mjs +82 -0
  378. package/internal/client/css-shim.rindo-client.mjs +656 -0
  379. package/internal/client/dom.rindo-client.mjs +137 -0
  380. package/internal/client/index.mjs +2859 -0
  381. package/internal/client/polyfills/core-js.js +10 -0
  382. package/internal/client/polyfills/css-shim.js +656 -0
  383. package/internal/client/polyfills/dom.js +146 -0
  384. package/internal/client/polyfills/es5-html-element.js +18 -0
  385. package/internal/client/polyfills/index.js +35 -0
  386. package/internal/client/polyfills/promise.js +9 -0
  387. package/internal/client/polyfills/system.js +6 -0
  388. package/internal/client/shadow-css.rindo-client.mjs +386 -0
  389. package/internal/images.d.ts +5 -0
  390. package/internal/index.d.ts +18 -0
  391. package/internal/index.js +1 -0
  392. package/internal/package.json +6 -0
  393. package/mock-doc/index.js +2 -0
  394. package/mock-doc/package.json +10 -0
  395. package/package.json +186 -0
  396. package/readme.md +174 -0
  397. package/runtime/package.json +5 -0
  398. package/screenshot/compare/assets/favicon.ico +0 -0
  399. package/screenshot/compare/assets/logo.png +0 -0
  400. package/screenshot/compare/build/app.css +1 -0
  401. package/screenshot/compare/build/app.esm.js +1 -0
  402. package/screenshot/compare/build/app.js +818 -0
  403. package/screenshot/compare/build/p-020f8d73.js +1 -0
  404. package/screenshot/compare/build/p-09qdknbg.system.entry.js +1 -0
  405. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +1 -0
  406. package/screenshot/compare/build/p-113f7459.js +1 -0
  407. package/screenshot/compare/build/p-168ec2c4.system.js +1 -0
  408. package/screenshot/compare/build/p-2ab1fdf1.system.js +1 -0
  409. package/screenshot/compare/build/p-2pxcsgrj.entry.js +1 -0
  410. package/screenshot/compare/build/p-42fb7034.system.js +1 -0
  411. package/screenshot/compare/build/p-54d9d7c2.system.js +1 -0
  412. package/screenshot/compare/build/p-67c1f911.js +1 -0
  413. package/screenshot/compare/build/p-68613371.system.js +1 -0
  414. package/screenshot/compare/build/p-7dvsjpu0.entry.js +1 -0
  415. package/screenshot/compare/build/p-aa67fb06.js +1 -0
  416. package/screenshot/compare/build/p-aeb3cec1.system.js +1 -0
  417. package/screenshot/compare/build/p-b6e44a24.js +1 -0
  418. package/screenshot/compare/build/p-c1c25b8a.js +1 -0
  419. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +1 -0
  420. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +1 -0
  421. package/screenshot/compare/build/p-dizjz8rg.entry.js +1 -0
  422. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +1 -0
  423. package/screenshot/compare/build/p-e9670d22.system.js +1 -0
  424. package/screenshot/compare/build/p-efb0eac6.js +1 -0
  425. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +1 -0
  426. package/screenshot/compare/build/p-ejpsp3kx.js +1 -0
  427. package/screenshot/compare/build/p-ejwcppol.entry.js +1 -0
  428. package/screenshot/compare/build/p-f6612d5d.system.js +1 -0
  429. package/screenshot/compare/build/p-foiivsfc.css +1 -0
  430. package/screenshot/compare/build/p-gpjjyogx.entry.js +1 -0
  431. package/screenshot/compare/build/p-howklem2.system.entry.js +1 -0
  432. package/screenshot/compare/build/p-knv9wvoc.entry.js +1 -0
  433. package/screenshot/compare/build/p-nsqsfhhy.entry.js +1 -0
  434. package/screenshot/compare/build/p-ojt278pp.entry.js +1 -0
  435. package/screenshot/compare/build/p-oywass99.entry.js +1 -0
  436. package/screenshot/compare/build/p-q3ujhub6.entry.js +1 -0
  437. package/screenshot/compare/build/p-qw4xnmxv.entry.js +1 -0
  438. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +1 -0
  439. package/screenshot/compare/build/p-tnjarrex.system.entry.js +1 -0
  440. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +1 -0
  441. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +1 -0
  442. package/screenshot/compare/build/p-w6bnm16k.entry.js +1 -0
  443. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +1 -0
  444. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +1 -0
  445. package/screenshot/compare/build/p-yh170wkt.entry.js +1 -0
  446. package/screenshot/compare/host.config.json +15 -0
  447. package/screenshot/compare/index.html +1 -0
  448. package/screenshot/compare/manifest.json +13 -0
  449. package/screenshot/connector.js +3 -0
  450. package/screenshot/index.js +2 -0
  451. package/screenshot/local-connector.js +3 -0
  452. package/screenshot/package.json +13 -0
  453. package/screenshot/pixel-match.js +2660 -0
  454. package/sys/node/index.js +2 -0
  455. package/sys/node/package.json +5 -0
  456. package/testing/index.js +2 -0
  457. package/testing/jest-environment.js +3 -0
  458. package/testing/jest-preprocessor.js +3 -0
  459. package/testing/jest-preset.js +40 -0
  460. package/testing/jest-runner.js +3 -0
  461. package/testing/jest-setuptestframework.js +3 -0
  462. package/testing/jest.preprocessor.js +7 -0
  463. package/testing/package.json +6 -0
@@ -0,0 +1,1779 @@
1
+ (function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = 5);
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ([
88
+ /* 0 */
89
+ /***/ (function(module, exports) {
90
+
91
+ module.exports = require("stream");
92
+
93
+ /***/ }),
94
+ /* 1 */
95
+ /***/ (function(module, exports) {
96
+
97
+ module.exports = require("zlib");
98
+
99
+ /***/ }),
100
+ /* 2 */
101
+ /***/ (function(module, exports) {
102
+
103
+ module.exports = require("url");
104
+
105
+ /***/ }),
106
+ /* 3 */
107
+ /***/ (function(module, exports) {
108
+
109
+ module.exports = require("http");
110
+
111
+ /***/ }),
112
+ /* 4 */
113
+ /***/ (function(module, exports) {
114
+
115
+ module.exports = require("https");
116
+
117
+ /***/ }),
118
+ /* 5 */
119
+ /***/ (function(module, exports, __webpack_require__) {
120
+
121
+ const nodeFetch = __webpack_require__(6);
122
+
123
+ exports.fetch = nodeFetch.default;
124
+ exports.Headers = nodeFetch.Headers;
125
+ exports.Request = nodeFetch.Request;
126
+ exports.Response = nodeFetch.Response;
127
+ exports.FetchError = nodeFetch.FetchError;
128
+
129
+
130
+ /***/ }),
131
+ /* 6 */
132
+ /***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
133
+
134
+ "use strict";
135
+ __webpack_require__.r(__webpack_exports__);
136
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Headers", function() { return Headers; });
137
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Request", function() { return Request; });
138
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Response", function() { return Response; });
139
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FetchError", function() { return FetchError; });
140
+ /* harmony import */ var stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
141
+ /* harmony import */ var http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
142
+ /* harmony import */ var url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
143
+ /* harmony import */ var https__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
144
+ /* harmony import */ var zlib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
145
+
146
+
147
+
148
+
149
+
150
+
151
+ // Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
152
+
153
+ // fix for "Readable" isn't a named export issue
154
+ const Readable = stream__WEBPACK_IMPORTED_MODULE_0__.Readable;
155
+
156
+ const BUFFER = Symbol('buffer');
157
+ const TYPE = Symbol('type');
158
+
159
+ class Blob {
160
+ constructor() {
161
+ this[TYPE] = '';
162
+
163
+ const blobParts = arguments[0];
164
+ const options = arguments[1];
165
+
166
+ const buffers = [];
167
+ let size = 0;
168
+
169
+ if (blobParts) {
170
+ const a = blobParts;
171
+ const length = Number(a.length);
172
+ for (let i = 0; i < length; i++) {
173
+ const element = a[i];
174
+ let buffer;
175
+ if (element instanceof Buffer) {
176
+ buffer = element;
177
+ } else if (ArrayBuffer.isView(element)) {
178
+ buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
179
+ } else if (element instanceof ArrayBuffer) {
180
+ buffer = Buffer.from(element);
181
+ } else if (element instanceof Blob) {
182
+ buffer = element[BUFFER];
183
+ } else {
184
+ buffer = Buffer.from(typeof element === 'string' ? element : String(element));
185
+ }
186
+ size += buffer.length;
187
+ buffers.push(buffer);
188
+ }
189
+ }
190
+
191
+ this[BUFFER] = Buffer.concat(buffers);
192
+
193
+ let type = options && options.type !== undefined && String(options.type).toLowerCase();
194
+ if (type && !/[^\u0020-\u007E]/.test(type)) {
195
+ this[TYPE] = type;
196
+ }
197
+ }
198
+ get size() {
199
+ return this[BUFFER].length;
200
+ }
201
+ get type() {
202
+ return this[TYPE];
203
+ }
204
+ text() {
205
+ return Promise.resolve(this[BUFFER].toString());
206
+ }
207
+ arrayBuffer() {
208
+ const buf = this[BUFFER];
209
+ const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
210
+ return Promise.resolve(ab);
211
+ }
212
+ stream() {
213
+ const readable = new Readable();
214
+ readable._read = function () {};
215
+ readable.push(this[BUFFER]);
216
+ readable.push(null);
217
+ return readable;
218
+ }
219
+ toString() {
220
+ return '[object Blob]';
221
+ }
222
+ slice() {
223
+ const size = this.size;
224
+
225
+ const start = arguments[0];
226
+ const end = arguments[1];
227
+ let relativeStart, relativeEnd;
228
+ if (start === undefined) {
229
+ relativeStart = 0;
230
+ } else if (start < 0) {
231
+ relativeStart = Math.max(size + start, 0);
232
+ } else {
233
+ relativeStart = Math.min(start, size);
234
+ }
235
+ if (end === undefined) {
236
+ relativeEnd = size;
237
+ } else if (end < 0) {
238
+ relativeEnd = Math.max(size + end, 0);
239
+ } else {
240
+ relativeEnd = Math.min(end, size);
241
+ }
242
+ const span = Math.max(relativeEnd - relativeStart, 0);
243
+
244
+ const buffer = this[BUFFER];
245
+ const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
246
+ const blob = new Blob([], { type: arguments[2] });
247
+ blob[BUFFER] = slicedBuffer;
248
+ return blob;
249
+ }
250
+ }
251
+
252
+ Object.defineProperties(Blob.prototype, {
253
+ size: { enumerable: true },
254
+ type: { enumerable: true },
255
+ slice: { enumerable: true }
256
+ });
257
+
258
+ Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
259
+ value: 'Blob',
260
+ writable: false,
261
+ enumerable: false,
262
+ configurable: true
263
+ });
264
+
265
+ /**
266
+ * fetch-error.js
267
+ *
268
+ * FetchError interface for operational errors
269
+ */
270
+
271
+ /**
272
+ * Create FetchError instance
273
+ *
274
+ * @param String message Error message for human
275
+ * @param String type Error type for machine
276
+ * @param String systemError For Node.js system error
277
+ * @return FetchError
278
+ */
279
+ function FetchError(message, type, systemError) {
280
+ Error.call(this, message);
281
+
282
+ this.message = message;
283
+ this.type = type;
284
+
285
+ // when err.type is `system`, err.code contains system error code
286
+ if (systemError) {
287
+ this.code = this.errno = systemError.code;
288
+ }
289
+
290
+ // hide custom error implementation details from end-users
291
+ Error.captureStackTrace(this, this.constructor);
292
+ }
293
+
294
+ FetchError.prototype = Object.create(Error.prototype);
295
+ FetchError.prototype.constructor = FetchError;
296
+ FetchError.prototype.name = 'FetchError';
297
+
298
+ let convert;
299
+ try {
300
+ convert = require('encoding').convert;
301
+ } catch (e) {}
302
+
303
+ const INTERNALS = Symbol('Body internals');
304
+
305
+ // fix an issue where "PassThrough" isn't a named export for node <10
306
+ const PassThrough = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
307
+
308
+ /**
309
+ * Body mixin
310
+ *
311
+ * Ref: https://fetch.spec.whatwg.org/#body
312
+ *
313
+ * @param Stream body Readable stream
314
+ * @param Object opts Response options
315
+ * @return Void
316
+ */
317
+ function Body(body) {
318
+ var _this = this;
319
+
320
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
321
+ _ref$size = _ref.size;
322
+
323
+ let size = _ref$size === undefined ? 0 : _ref$size;
324
+ var _ref$timeout = _ref.timeout;
325
+ let timeout = _ref$timeout === undefined ? 0 : _ref$timeout;
326
+
327
+ if (body == null) {
328
+ // body is undefined or null
329
+ body = null;
330
+ } else if (isURLSearchParams(body)) {
331
+ // body is a URLSearchParams
332
+ body = Buffer.from(body.toString());
333
+ } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
334
+ // body is ArrayBuffer
335
+ body = Buffer.from(body);
336
+ } else if (ArrayBuffer.isView(body)) {
337
+ // body is ArrayBufferView
338
+ body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
339
+ } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) ; else {
340
+ // none of the above
341
+ // coerce to string then buffer
342
+ body = Buffer.from(String(body));
343
+ }
344
+ this[INTERNALS] = {
345
+ body,
346
+ disturbed: false,
347
+ error: null
348
+ };
349
+ this.size = size;
350
+ this.timeout = timeout;
351
+
352
+ if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
353
+ body.on('error', function (err) {
354
+ const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);
355
+ _this[INTERNALS].error = error;
356
+ });
357
+ }
358
+ }
359
+
360
+ Body.prototype = {
361
+ get body() {
362
+ return this[INTERNALS].body;
363
+ },
364
+
365
+ get bodyUsed() {
366
+ return this[INTERNALS].disturbed;
367
+ },
368
+
369
+ /**
370
+ * Decode response as ArrayBuffer
371
+ *
372
+ * @return Promise
373
+ */
374
+ arrayBuffer() {
375
+ return consumeBody.call(this).then(function (buf) {
376
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
377
+ });
378
+ },
379
+
380
+ /**
381
+ * Return raw response as Blob
382
+ *
383
+ * @return Promise
384
+ */
385
+ blob() {
386
+ let ct = this.headers && this.headers.get('content-type') || '';
387
+ return consumeBody.call(this).then(function (buf) {
388
+ return Object.assign(
389
+ // Prevent copying
390
+ new Blob([], {
391
+ type: ct.toLowerCase()
392
+ }), {
393
+ [BUFFER]: buf
394
+ });
395
+ });
396
+ },
397
+
398
+ /**
399
+ * Decode response as json
400
+ *
401
+ * @return Promise
402
+ */
403
+ json() {
404
+ var _this2 = this;
405
+
406
+ return consumeBody.call(this).then(function (buffer) {
407
+ try {
408
+ return JSON.parse(buffer.toString());
409
+ } catch (err) {
410
+ return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
411
+ }
412
+ });
413
+ },
414
+
415
+ /**
416
+ * Decode response as text
417
+ *
418
+ * @return Promise
419
+ */
420
+ text() {
421
+ return consumeBody.call(this).then(function (buffer) {
422
+ return buffer.toString();
423
+ });
424
+ },
425
+
426
+ /**
427
+ * Decode response as buffer (non-spec api)
428
+ *
429
+ * @return Promise
430
+ */
431
+ buffer() {
432
+ return consumeBody.call(this);
433
+ },
434
+
435
+ /**
436
+ * Decode response as text, while automatically detecting the encoding and
437
+ * trying to decode to UTF-8 (non-spec api)
438
+ *
439
+ * @return Promise
440
+ */
441
+ textConverted() {
442
+ var _this3 = this;
443
+
444
+ return consumeBody.call(this).then(function (buffer) {
445
+ return convertBody(buffer, _this3.headers);
446
+ });
447
+ }
448
+ };
449
+
450
+ // In browsers, all properties are enumerable.
451
+ Object.defineProperties(Body.prototype, {
452
+ body: { enumerable: true },
453
+ bodyUsed: { enumerable: true },
454
+ arrayBuffer: { enumerable: true },
455
+ blob: { enumerable: true },
456
+ json: { enumerable: true },
457
+ text: { enumerable: true }
458
+ });
459
+
460
+ Body.mixIn = function (proto) {
461
+ for (const name of Object.getOwnPropertyNames(Body.prototype)) {
462
+ // istanbul ignore else: future proof
463
+ if (!(name in proto)) {
464
+ const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
465
+ Object.defineProperty(proto, name, desc);
466
+ }
467
+ }
468
+ };
469
+
470
+ /**
471
+ * Consume and convert an entire Body to a Buffer.
472
+ *
473
+ * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body
474
+ *
475
+ * @return Promise
476
+ */
477
+ function consumeBody() {
478
+ var _this4 = this;
479
+
480
+ if (this[INTERNALS].disturbed) {
481
+ return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
482
+ }
483
+
484
+ this[INTERNALS].disturbed = true;
485
+
486
+ if (this[INTERNALS].error) {
487
+ return Body.Promise.reject(this[INTERNALS].error);
488
+ }
489
+
490
+ let body = this.body;
491
+
492
+ // body is null
493
+ if (body === null) {
494
+ return Body.Promise.resolve(Buffer.alloc(0));
495
+ }
496
+
497
+ // body is blob
498
+ if (isBlob(body)) {
499
+ body = body.stream();
500
+ }
501
+
502
+ // body is buffer
503
+ if (Buffer.isBuffer(body)) {
504
+ return Body.Promise.resolve(body);
505
+ }
506
+
507
+ // istanbul ignore if: should never happen
508
+ if (!(body instanceof stream__WEBPACK_IMPORTED_MODULE_0__)) {
509
+ return Body.Promise.resolve(Buffer.alloc(0));
510
+ }
511
+
512
+ // body is stream
513
+ // get ready to actually consume the body
514
+ let accum = [];
515
+ let accumBytes = 0;
516
+ let abort = false;
517
+
518
+ return new Body.Promise(function (resolve, reject) {
519
+ let resTimeout;
520
+
521
+ // allow timeout on slow response body
522
+ if (_this4.timeout) {
523
+ resTimeout = setTimeout(function () {
524
+ abort = true;
525
+ reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));
526
+ }, _this4.timeout);
527
+ }
528
+
529
+ // handle stream errors
530
+ body.on('error', function (err) {
531
+ if (err.name === 'AbortError') {
532
+ // if the request was aborted, reject with this Error
533
+ abort = true;
534
+ reject(err);
535
+ } else {
536
+ // other errors, such as incorrect content-encoding
537
+ reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));
538
+ }
539
+ });
540
+
541
+ body.on('data', function (chunk) {
542
+ if (abort || chunk === null) {
543
+ return;
544
+ }
545
+
546
+ if (_this4.size && accumBytes + chunk.length > _this4.size) {
547
+ abort = true;
548
+ reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));
549
+ return;
550
+ }
551
+
552
+ accumBytes += chunk.length;
553
+ accum.push(chunk);
554
+ });
555
+
556
+ body.on('end', function () {
557
+ if (abort) {
558
+ return;
559
+ }
560
+
561
+ clearTimeout(resTimeout);
562
+
563
+ try {
564
+ resolve(Buffer.concat(accum, accumBytes));
565
+ } catch (err) {
566
+ // handle streams that have accumulated too much data (issue #414)
567
+ reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));
568
+ }
569
+ });
570
+ });
571
+ }
572
+
573
+ /**
574
+ * Detect buffer encoding and convert to target encoding
575
+ * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding
576
+ *
577
+ * @param Buffer buffer Incoming buffer
578
+ * @param String encoding Target encoding
579
+ * @return String
580
+ */
581
+ function convertBody(buffer, headers) {
582
+ if (typeof convert !== 'function') {
583
+ throw new Error('The package `encoding` must be installed to use the textConverted() function');
584
+ }
585
+
586
+ const ct = headers.get('content-type');
587
+ let charset = 'utf-8';
588
+ let res, str;
589
+
590
+ // header
591
+ if (ct) {
592
+ res = /charset=([^;]*)/i.exec(ct);
593
+ }
594
+
595
+ // no charset in content type, peek at response body for at most 1024 bytes
596
+ str = buffer.slice(0, 1024).toString();
597
+
598
+ // html5
599
+ if (!res && str) {
600
+ res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
601
+ }
602
+
603
+ // html4
604
+ if (!res && str) {
605
+ res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
606
+
607
+ if (res) {
608
+ res = /charset=(.*)/i.exec(res.pop());
609
+ }
610
+ }
611
+
612
+ // xml
613
+ if (!res && str) {
614
+ res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
615
+ }
616
+
617
+ // found charset
618
+ if (res) {
619
+ charset = res.pop();
620
+
621
+ // prevent decode issues when sites use incorrect encoding
622
+ // ref: https://hsivonen.fi/encoding-menu/
623
+ if (charset === 'gb2312' || charset === 'gbk') {
624
+ charset = 'gb18030';
625
+ }
626
+ }
627
+
628
+ // turn raw buffers into a single utf-8 buffer
629
+ return convert(buffer, 'UTF-8', charset).toString();
630
+ }
631
+
632
+ /**
633
+ * Detect a URLSearchParams object
634
+ * ref: https://github.com/bitinn/node-fetch/issues/296#issuecomment-307598143
635
+ *
636
+ * @param Object obj Object to detect by type or brand
637
+ * @return String
638
+ */
639
+ function isURLSearchParams(obj) {
640
+ // Duck-typing as a necessary condition.
641
+ if (typeof obj !== 'object' || typeof obj.append !== 'function' || typeof obj.delete !== 'function' || typeof obj.get !== 'function' || typeof obj.getAll !== 'function' || typeof obj.has !== 'function' || typeof obj.set !== 'function') {
642
+ return false;
643
+ }
644
+
645
+ // Brand-checking and more duck-typing as optional condition.
646
+ return obj.constructor.name === 'URLSearchParams' || Object.prototype.toString.call(obj) === '[object URLSearchParams]' || typeof obj.sort === 'function';
647
+ }
648
+
649
+ /**
650
+ * Check if `obj` is a W3C `Blob` object (which `File` inherits from)
651
+ * @param {*} obj
652
+ * @return {boolean}
653
+ */
654
+ function isBlob(obj) {
655
+ return typeof obj === 'object' && typeof obj.arrayBuffer === 'function' && typeof obj.type === 'string' && typeof obj.stream === 'function' && typeof obj.constructor === 'function' && typeof obj.constructor.name === 'string' && /^(Blob|File)$/.test(obj.constructor.name) && /^(Blob|File)$/.test(obj[Symbol.toStringTag]);
656
+ }
657
+
658
+ /**
659
+ * Clone body given Res/Req instance
660
+ *
661
+ * @param Mixed instance Response or Request instance
662
+ * @return Mixed
663
+ */
664
+ function clone(instance) {
665
+ let p1, p2;
666
+ let body = instance.body;
667
+
668
+ // don't allow cloning a used body
669
+ if (instance.bodyUsed) {
670
+ throw new Error('cannot clone body after it is used');
671
+ }
672
+
673
+ // check that body is a stream and not form-data object
674
+ // note: we can't clone the form-data object without having it as a dependency
675
+ if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__ && typeof body.getBoundary !== 'function') {
676
+ // tee instance body
677
+ p1 = new PassThrough();
678
+ p2 = new PassThrough();
679
+ body.pipe(p1);
680
+ body.pipe(p2);
681
+ // set instance body to teed body and return the other teed body
682
+ instance[INTERNALS].body = p1;
683
+ body = p2;
684
+ }
685
+
686
+ return body;
687
+ }
688
+
689
+ /**
690
+ * Performs the operation "extract a `Content-Type` value from |object|" as
691
+ * specified in the specification:
692
+ * https://fetch.spec.whatwg.org/#concept-bodyinit-extract
693
+ *
694
+ * This function assumes that instance.body is present.
695
+ *
696
+ * @param Mixed instance Any options.body input
697
+ */
698
+ function extractContentType(body) {
699
+ if (body === null) {
700
+ // body is null
701
+ return null;
702
+ } else if (typeof body === 'string') {
703
+ // body is string
704
+ return 'text/plain;charset=UTF-8';
705
+ } else if (isURLSearchParams(body)) {
706
+ // body is a URLSearchParams
707
+ return 'application/x-www-form-urlencoded;charset=UTF-8';
708
+ } else if (isBlob(body)) {
709
+ // body is blob
710
+ return body.type || null;
711
+ } else if (Buffer.isBuffer(body)) {
712
+ // body is buffer
713
+ return null;
714
+ } else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {
715
+ // body is ArrayBuffer
716
+ return null;
717
+ } else if (ArrayBuffer.isView(body)) {
718
+ // body is ArrayBufferView
719
+ return null;
720
+ } else if (typeof body.getBoundary === 'function') {
721
+ // detect form data input from form-data module
722
+ return `multipart/form-data;boundary=${body.getBoundary()}`;
723
+ } else if (body instanceof stream__WEBPACK_IMPORTED_MODULE_0__) {
724
+ // body is stream
725
+ // can't really do much about this
726
+ return null;
727
+ } else {
728
+ // Body constructor defaults other things to string
729
+ return 'text/plain;charset=UTF-8';
730
+ }
731
+ }
732
+
733
+ /**
734
+ * The Fetch Standard treats this as if "total bytes" is a property on the body.
735
+ * For us, we have to explicitly get it with a function.
736
+ *
737
+ * ref: https://fetch.spec.whatwg.org/#concept-body-total-bytes
738
+ *
739
+ * @param Body instance Instance of Body
740
+ * @return Number? Number of bytes, or null if not possible
741
+ */
742
+ function getTotalBytes(instance) {
743
+ const body = instance.body;
744
+
745
+
746
+ if (body === null) {
747
+ // body is null
748
+ return 0;
749
+ } else if (isBlob(body)) {
750
+ return body.size;
751
+ } else if (Buffer.isBuffer(body)) {
752
+ // body is buffer
753
+ return body.length;
754
+ } else if (body && typeof body.getLengthSync === 'function') {
755
+ // detect form data input from form-data module
756
+ if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || // 1.x
757
+ body.hasKnownLength && body.hasKnownLength()) {
758
+ // 2.x
759
+ return body.getLengthSync();
760
+ }
761
+ return null;
762
+ } else {
763
+ // body is stream
764
+ return null;
765
+ }
766
+ }
767
+
768
+ /**
769
+ * Write a Body to a Node.js WritableStream (e.g. http.Request) object.
770
+ *
771
+ * @param Body instance Instance of Body
772
+ * @return Void
773
+ */
774
+ function writeToStream(dest, instance) {
775
+ const body = instance.body;
776
+
777
+
778
+ if (body === null) {
779
+ // body is null
780
+ dest.end();
781
+ } else if (isBlob(body)) {
782
+ body.stream().pipe(dest);
783
+ } else if (Buffer.isBuffer(body)) {
784
+ // body is buffer
785
+ dest.write(body);
786
+ dest.end();
787
+ } else {
788
+ // body is stream
789
+ body.pipe(dest);
790
+ }
791
+ }
792
+
793
+ // expose Promise
794
+ Body.Promise = global.Promise;
795
+
796
+ /**
797
+ * headers.js
798
+ *
799
+ * Headers class offers convenient helpers
800
+ */
801
+
802
+ const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
803
+ const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
804
+
805
+ function validateName(name) {
806
+ name = `${name}`;
807
+ if (invalidTokenRegex.test(name) || name === '') {
808
+ throw new TypeError(`${name} is not a legal HTTP header name`);
809
+ }
810
+ }
811
+
812
+ function validateValue(value) {
813
+ value = `${value}`;
814
+ if (invalidHeaderCharRegex.test(value)) {
815
+ throw new TypeError(`${value} is not a legal HTTP header value`);
816
+ }
817
+ }
818
+
819
+ /**
820
+ * Find the key in the map object given a header name.
821
+ *
822
+ * Returns undefined if not found.
823
+ *
824
+ * @param String name Header name
825
+ * @return String|Undefined
826
+ */
827
+ function find(map, name) {
828
+ name = name.toLowerCase();
829
+ for (const key in map) {
830
+ if (key.toLowerCase() === name) {
831
+ return key;
832
+ }
833
+ }
834
+ return undefined;
835
+ }
836
+
837
+ const MAP = Symbol('map');
838
+ class Headers {
839
+ /**
840
+ * Headers class
841
+ *
842
+ * @param Object headers Response headers
843
+ * @return Void
844
+ */
845
+ constructor() {
846
+ let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
847
+
848
+ this[MAP] = Object.create(null);
849
+
850
+ if (init instanceof Headers) {
851
+ const rawHeaders = init.raw();
852
+ const headerNames = Object.keys(rawHeaders);
853
+
854
+ for (const headerName of headerNames) {
855
+ for (const value of rawHeaders[headerName]) {
856
+ this.append(headerName, value);
857
+ }
858
+ }
859
+
860
+ return;
861
+ }
862
+
863
+ // We don't worry about converting prop to ByteString here as append()
864
+ // will handle it.
865
+ if (init == null) ; else if (typeof init === 'object') {
866
+ const method = init[Symbol.iterator];
867
+ if (method != null) {
868
+ if (typeof method !== 'function') {
869
+ throw new TypeError('Header pairs must be iterable');
870
+ }
871
+
872
+ // sequence<sequence<ByteString>>
873
+ // Note: per spec we have to first exhaust the lists then process them
874
+ const pairs = [];
875
+ for (const pair of init) {
876
+ if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {
877
+ throw new TypeError('Each header pair must be iterable');
878
+ }
879
+ pairs.push(Array.from(pair));
880
+ }
881
+
882
+ for (const pair of pairs) {
883
+ if (pair.length !== 2) {
884
+ throw new TypeError('Each header pair must be a name/value tuple');
885
+ }
886
+ this.append(pair[0], pair[1]);
887
+ }
888
+ } else {
889
+ // record<ByteString, ByteString>
890
+ for (const key of Object.keys(init)) {
891
+ const value = init[key];
892
+ this.append(key, value);
893
+ }
894
+ }
895
+ } else {
896
+ throw new TypeError('Provided initializer must be an object');
897
+ }
898
+ }
899
+
900
+ /**
901
+ * Return combined header value given name
902
+ *
903
+ * @param String name Header name
904
+ * @return Mixed
905
+ */
906
+ get(name) {
907
+ name = `${name}`;
908
+ validateName(name);
909
+ const key = find(this[MAP], name);
910
+ if (key === undefined) {
911
+ return null;
912
+ }
913
+
914
+ return this[MAP][key].join(', ');
915
+ }
916
+
917
+ /**
918
+ * Iterate over all headers
919
+ *
920
+ * @param Function callback Executed for each item with parameters (value, name, thisArg)
921
+ * @param Boolean thisArg `this` context for callback function
922
+ * @return Void
923
+ */
924
+ forEach(callback) {
925
+ let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
926
+
927
+ let pairs = getHeaders(this);
928
+ let i = 0;
929
+ while (i < pairs.length) {
930
+ var _pairs$i = pairs[i];
931
+ const name = _pairs$i[0],
932
+ value = _pairs$i[1];
933
+
934
+ callback.call(thisArg, value, name, this);
935
+ pairs = getHeaders(this);
936
+ i++;
937
+ }
938
+ }
939
+
940
+ /**
941
+ * Overwrite header values given name
942
+ *
943
+ * @param String name Header name
944
+ * @param String value Header value
945
+ * @return Void
946
+ */
947
+ set(name, value) {
948
+ name = `${name}`;
949
+ value = `${value}`;
950
+ validateName(name);
951
+ validateValue(value);
952
+ const key = find(this[MAP], name);
953
+ this[MAP][key !== undefined ? key : name] = [value];
954
+ }
955
+
956
+ /**
957
+ * Append a value onto existing header
958
+ *
959
+ * @param String name Header name
960
+ * @param String value Header value
961
+ * @return Void
962
+ */
963
+ append(name, value) {
964
+ name = `${name}`;
965
+ value = `${value}`;
966
+ validateName(name);
967
+ validateValue(value);
968
+ const key = find(this[MAP], name);
969
+ if (key !== undefined) {
970
+ this[MAP][key].push(value);
971
+ } else {
972
+ this[MAP][name] = [value];
973
+ }
974
+ }
975
+
976
+ /**
977
+ * Check for header name existence
978
+ *
979
+ * @param String name Header name
980
+ * @return Boolean
981
+ */
982
+ has(name) {
983
+ name = `${name}`;
984
+ validateName(name);
985
+ return find(this[MAP], name) !== undefined;
986
+ }
987
+
988
+ /**
989
+ * Delete all header values given name
990
+ *
991
+ * @param String name Header name
992
+ * @return Void
993
+ */
994
+ delete(name) {
995
+ name = `${name}`;
996
+ validateName(name);
997
+ const key = find(this[MAP], name);
998
+ if (key !== undefined) {
999
+ delete this[MAP][key];
1000
+ }
1001
+ }
1002
+
1003
+ /**
1004
+ * Return raw headers (non-spec api)
1005
+ *
1006
+ * @return Object
1007
+ */
1008
+ raw() {
1009
+ return this[MAP];
1010
+ }
1011
+
1012
+ /**
1013
+ * Get an iterator on keys.
1014
+ *
1015
+ * @return Iterator
1016
+ */
1017
+ keys() {
1018
+ return createHeadersIterator(this, 'key');
1019
+ }
1020
+
1021
+ /**
1022
+ * Get an iterator on values.
1023
+ *
1024
+ * @return Iterator
1025
+ */
1026
+ values() {
1027
+ return createHeadersIterator(this, 'value');
1028
+ }
1029
+
1030
+ /**
1031
+ * Get an iterator on entries.
1032
+ *
1033
+ * This is the default iterator of the Headers object.
1034
+ *
1035
+ * @return Iterator
1036
+ */
1037
+ [Symbol.iterator]() {
1038
+ return createHeadersIterator(this, 'key+value');
1039
+ }
1040
+ }
1041
+ Headers.prototype.entries = Headers.prototype[Symbol.iterator];
1042
+
1043
+ Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
1044
+ value: 'Headers',
1045
+ writable: false,
1046
+ enumerable: false,
1047
+ configurable: true
1048
+ });
1049
+
1050
+ Object.defineProperties(Headers.prototype, {
1051
+ get: { enumerable: true },
1052
+ forEach: { enumerable: true },
1053
+ set: { enumerable: true },
1054
+ append: { enumerable: true },
1055
+ has: { enumerable: true },
1056
+ delete: { enumerable: true },
1057
+ keys: { enumerable: true },
1058
+ values: { enumerable: true },
1059
+ entries: { enumerable: true }
1060
+ });
1061
+
1062
+ function getHeaders(headers) {
1063
+ let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';
1064
+
1065
+ const keys = Object.keys(headers[MAP]).sort();
1066
+ return keys.map(kind === 'key' ? function (k) {
1067
+ return k.toLowerCase();
1068
+ } : kind === 'value' ? function (k) {
1069
+ return headers[MAP][k].join(', ');
1070
+ } : function (k) {
1071
+ return [k.toLowerCase(), headers[MAP][k].join(', ')];
1072
+ });
1073
+ }
1074
+
1075
+ const INTERNAL = Symbol('internal');
1076
+
1077
+ function createHeadersIterator(target, kind) {
1078
+ const iterator = Object.create(HeadersIteratorPrototype);
1079
+ iterator[INTERNAL] = {
1080
+ target,
1081
+ kind,
1082
+ index: 0
1083
+ };
1084
+ return iterator;
1085
+ }
1086
+
1087
+ const HeadersIteratorPrototype = Object.setPrototypeOf({
1088
+ next() {
1089
+ // istanbul ignore if
1090
+ if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
1091
+ throw new TypeError('Value of `this` is not a HeadersIterator');
1092
+ }
1093
+
1094
+ var _INTERNAL = this[INTERNAL];
1095
+ const target = _INTERNAL.target,
1096
+ kind = _INTERNAL.kind,
1097
+ index = _INTERNAL.index;
1098
+
1099
+ const values = getHeaders(target, kind);
1100
+ const len = values.length;
1101
+ if (index >= len) {
1102
+ return {
1103
+ value: undefined,
1104
+ done: true
1105
+ };
1106
+ }
1107
+
1108
+ this[INTERNAL].index = index + 1;
1109
+
1110
+ return {
1111
+ value: values[index],
1112
+ done: false
1113
+ };
1114
+ }
1115
+ }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
1116
+
1117
+ Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
1118
+ value: 'HeadersIterator',
1119
+ writable: false,
1120
+ enumerable: false,
1121
+ configurable: true
1122
+ });
1123
+
1124
+ /**
1125
+ * Export the Headers object in a form that Node.js can consume.
1126
+ *
1127
+ * @param Headers headers
1128
+ * @return Object
1129
+ */
1130
+ function exportNodeCompatibleHeaders(headers) {
1131
+ const obj = Object.assign({ __proto__: null }, headers[MAP]);
1132
+
1133
+ // http.request() only supports string as Host header. This hack makes
1134
+ // specifying custom Host header possible.
1135
+ const hostHeaderKey = find(headers[MAP], 'Host');
1136
+ if (hostHeaderKey !== undefined) {
1137
+ obj[hostHeaderKey] = obj[hostHeaderKey][0];
1138
+ }
1139
+
1140
+ return obj;
1141
+ }
1142
+
1143
+ /**
1144
+ * Create a Headers object from an object of headers, ignoring those that do
1145
+ * not conform to HTTP grammar productions.
1146
+ *
1147
+ * @param Object obj Object of headers
1148
+ * @return Headers
1149
+ */
1150
+ function createHeadersLenient(obj) {
1151
+ const headers = new Headers();
1152
+ for (const name of Object.keys(obj)) {
1153
+ if (invalidTokenRegex.test(name)) {
1154
+ continue;
1155
+ }
1156
+ if (Array.isArray(obj[name])) {
1157
+ for (const val of obj[name]) {
1158
+ if (invalidHeaderCharRegex.test(val)) {
1159
+ continue;
1160
+ }
1161
+ if (headers[MAP][name] === undefined) {
1162
+ headers[MAP][name] = [val];
1163
+ } else {
1164
+ headers[MAP][name].push(val);
1165
+ }
1166
+ }
1167
+ } else if (!invalidHeaderCharRegex.test(obj[name])) {
1168
+ headers[MAP][name] = [obj[name]];
1169
+ }
1170
+ }
1171
+ return headers;
1172
+ }
1173
+
1174
+ const INTERNALS$1 = Symbol('Response internals');
1175
+
1176
+ // fix an issue where "STATUS_CODES" aren't a named export for node <10
1177
+ const STATUS_CODES = http__WEBPACK_IMPORTED_MODULE_1__.STATUS_CODES;
1178
+
1179
+ /**
1180
+ * Response class
1181
+ *
1182
+ * @param Stream body Readable stream
1183
+ * @param Object opts Response options
1184
+ * @return Void
1185
+ */
1186
+ class Response {
1187
+ constructor() {
1188
+ let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1189
+ let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1190
+
1191
+ Body.call(this, body, opts);
1192
+
1193
+ const status = opts.status || 200;
1194
+ const headers = new Headers(opts.headers);
1195
+
1196
+ if (body != null && !headers.has('Content-Type')) {
1197
+ const contentType = extractContentType(body);
1198
+ if (contentType) {
1199
+ headers.append('Content-Type', contentType);
1200
+ }
1201
+ }
1202
+
1203
+ this[INTERNALS$1] = {
1204
+ url: opts.url,
1205
+ status,
1206
+ statusText: opts.statusText || STATUS_CODES[status],
1207
+ headers,
1208
+ counter: opts.counter
1209
+ };
1210
+ }
1211
+
1212
+ get url() {
1213
+ return this[INTERNALS$1].url || '';
1214
+ }
1215
+
1216
+ get status() {
1217
+ return this[INTERNALS$1].status;
1218
+ }
1219
+
1220
+ /**
1221
+ * Convenience property representing if the request ended normally
1222
+ */
1223
+ get ok() {
1224
+ return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
1225
+ }
1226
+
1227
+ get redirected() {
1228
+ return this[INTERNALS$1].counter > 0;
1229
+ }
1230
+
1231
+ get statusText() {
1232
+ return this[INTERNALS$1].statusText;
1233
+ }
1234
+
1235
+ get headers() {
1236
+ return this[INTERNALS$1].headers;
1237
+ }
1238
+
1239
+ /**
1240
+ * Clone this response
1241
+ *
1242
+ * @return Response
1243
+ */
1244
+ clone() {
1245
+ return new Response(clone(this), {
1246
+ url: this.url,
1247
+ status: this.status,
1248
+ statusText: this.statusText,
1249
+ headers: this.headers,
1250
+ ok: this.ok,
1251
+ redirected: this.redirected
1252
+ });
1253
+ }
1254
+ }
1255
+
1256
+ Body.mixIn(Response.prototype);
1257
+
1258
+ Object.defineProperties(Response.prototype, {
1259
+ url: { enumerable: true },
1260
+ status: { enumerable: true },
1261
+ ok: { enumerable: true },
1262
+ redirected: { enumerable: true },
1263
+ statusText: { enumerable: true },
1264
+ headers: { enumerable: true },
1265
+ clone: { enumerable: true }
1266
+ });
1267
+
1268
+ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
1269
+ value: 'Response',
1270
+ writable: false,
1271
+ enumerable: false,
1272
+ configurable: true
1273
+ });
1274
+
1275
+ const INTERNALS$2 = Symbol('Request internals');
1276
+
1277
+ // fix an issue where "format", "parse" aren't a named export for node <10
1278
+ const parse_url = url__WEBPACK_IMPORTED_MODULE_2__.parse;
1279
+ const format_url = url__WEBPACK_IMPORTED_MODULE_2__.format;
1280
+
1281
+ const streamDestructionSupported = 'destroy' in stream__WEBPACK_IMPORTED_MODULE_0__.Readable.prototype;
1282
+
1283
+ /**
1284
+ * Check if a value is an instance of Request.
1285
+ *
1286
+ * @param Mixed input
1287
+ * @return Boolean
1288
+ */
1289
+ function isRequest(input) {
1290
+ return typeof input === 'object' && typeof input[INTERNALS$2] === 'object';
1291
+ }
1292
+
1293
+ function isAbortSignal(signal) {
1294
+ const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);
1295
+ return !!(proto && proto.constructor.name === 'AbortSignal');
1296
+ }
1297
+
1298
+ /**
1299
+ * Request class
1300
+ *
1301
+ * @param Mixed input Url or Request instance
1302
+ * @param Object init Custom options
1303
+ * @return Void
1304
+ */
1305
+ class Request {
1306
+ constructor(input) {
1307
+ let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1308
+
1309
+ let parsedURL;
1310
+
1311
+ // normalize input
1312
+ if (!isRequest(input)) {
1313
+ if (input && input.href) {
1314
+ // in order to support Node.js' Url objects; though WHATWG's URL objects
1315
+ // will fall into this branch also (since their `toString()` will return
1316
+ // `href` property anyway)
1317
+ parsedURL = parse_url(input.href);
1318
+ } else {
1319
+ // coerce input to a string before attempting to parse
1320
+ parsedURL = parse_url(`${input}`);
1321
+ }
1322
+ input = {};
1323
+ } else {
1324
+ parsedURL = parse_url(input.url);
1325
+ }
1326
+
1327
+ let method = init.method || input.method || 'GET';
1328
+ method = method.toUpperCase();
1329
+
1330
+ if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {
1331
+ throw new TypeError('Request with GET/HEAD method cannot have body');
1332
+ }
1333
+
1334
+ let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
1335
+
1336
+ Body.call(this, inputBody, {
1337
+ timeout: init.timeout || input.timeout || 0,
1338
+ size: init.size || input.size || 0
1339
+ });
1340
+
1341
+ const headers = new Headers(init.headers || input.headers || {});
1342
+
1343
+ if (inputBody != null && !headers.has('Content-Type')) {
1344
+ const contentType = extractContentType(inputBody);
1345
+ if (contentType) {
1346
+ headers.append('Content-Type', contentType);
1347
+ }
1348
+ }
1349
+
1350
+ let signal = isRequest(input) ? input.signal : null;
1351
+ if ('signal' in init) signal = init.signal;
1352
+
1353
+ if (signal != null && !isAbortSignal(signal)) {
1354
+ throw new TypeError('Expected signal to be an instanceof AbortSignal');
1355
+ }
1356
+
1357
+ this[INTERNALS$2] = {
1358
+ method,
1359
+ redirect: init.redirect || input.redirect || 'follow',
1360
+ headers,
1361
+ parsedURL,
1362
+ signal
1363
+ };
1364
+
1365
+ // node-fetch-only options
1366
+ this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;
1367
+ this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
1368
+ this.counter = init.counter || input.counter || 0;
1369
+ this.agent = init.agent || input.agent;
1370
+ }
1371
+
1372
+ get method() {
1373
+ return this[INTERNALS$2].method;
1374
+ }
1375
+
1376
+ get url() {
1377
+ return format_url(this[INTERNALS$2].parsedURL);
1378
+ }
1379
+
1380
+ get headers() {
1381
+ return this[INTERNALS$2].headers;
1382
+ }
1383
+
1384
+ get redirect() {
1385
+ return this[INTERNALS$2].redirect;
1386
+ }
1387
+
1388
+ get signal() {
1389
+ return this[INTERNALS$2].signal;
1390
+ }
1391
+
1392
+ /**
1393
+ * Clone this request
1394
+ *
1395
+ * @return Request
1396
+ */
1397
+ clone() {
1398
+ return new Request(this);
1399
+ }
1400
+ }
1401
+
1402
+ Body.mixIn(Request.prototype);
1403
+
1404
+ Object.defineProperty(Request.prototype, Symbol.toStringTag, {
1405
+ value: 'Request',
1406
+ writable: false,
1407
+ enumerable: false,
1408
+ configurable: true
1409
+ });
1410
+
1411
+ Object.defineProperties(Request.prototype, {
1412
+ method: { enumerable: true },
1413
+ url: { enumerable: true },
1414
+ headers: { enumerable: true },
1415
+ redirect: { enumerable: true },
1416
+ clone: { enumerable: true },
1417
+ signal: { enumerable: true }
1418
+ });
1419
+
1420
+ /**
1421
+ * Convert a Request to Node.js http request options.
1422
+ *
1423
+ * @param Request A Request instance
1424
+ * @return Object The options object to be passed to http.request
1425
+ */
1426
+ function getNodeRequestOptions(request) {
1427
+ const parsedURL = request[INTERNALS$2].parsedURL;
1428
+ const headers = new Headers(request[INTERNALS$2].headers);
1429
+
1430
+ // fetch step 1.3
1431
+ if (!headers.has('Accept')) {
1432
+ headers.set('Accept', '*/*');
1433
+ }
1434
+
1435
+ // Basic fetch
1436
+ if (!parsedURL.protocol || !parsedURL.hostname) {
1437
+ throw new TypeError('Only absolute URLs are supported');
1438
+ }
1439
+
1440
+ if (!/^https?:$/.test(parsedURL.protocol)) {
1441
+ throw new TypeError('Only HTTP(S) protocols are supported');
1442
+ }
1443
+
1444
+ if (request.signal && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable && !streamDestructionSupported) {
1445
+ throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');
1446
+ }
1447
+
1448
+ // HTTP-network-or-cache fetch steps 2.4-2.7
1449
+ let contentLengthValue = null;
1450
+ if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
1451
+ contentLengthValue = '0';
1452
+ }
1453
+ if (request.body != null) {
1454
+ const totalBytes = getTotalBytes(request);
1455
+ if (typeof totalBytes === 'number') {
1456
+ contentLengthValue = String(totalBytes);
1457
+ }
1458
+ }
1459
+ if (contentLengthValue) {
1460
+ headers.set('Content-Length', contentLengthValue);
1461
+ }
1462
+
1463
+ // HTTP-network-or-cache fetch step 2.11
1464
+ if (!headers.has('User-Agent')) {
1465
+ headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
1466
+ }
1467
+
1468
+ // HTTP-network-or-cache fetch step 2.15
1469
+ if (request.compress && !headers.has('Accept-Encoding')) {
1470
+ headers.set('Accept-Encoding', 'gzip,deflate');
1471
+ }
1472
+
1473
+ let agent = request.agent;
1474
+ if (typeof agent === 'function') {
1475
+ agent = agent(parsedURL);
1476
+ }
1477
+
1478
+ if (!headers.has('Connection') && !agent) {
1479
+ headers.set('Connection', 'close');
1480
+ }
1481
+
1482
+ // HTTP-network fetch step 4.2
1483
+ // chunked encoding is handled by Node.js
1484
+
1485
+ return Object.assign({}, parsedURL, {
1486
+ method: request.method,
1487
+ headers: exportNodeCompatibleHeaders(headers),
1488
+ agent
1489
+ });
1490
+ }
1491
+
1492
+ /**
1493
+ * abort-error.js
1494
+ *
1495
+ * AbortError interface for cancelled requests
1496
+ */
1497
+
1498
+ /**
1499
+ * Create AbortError instance
1500
+ *
1501
+ * @param String message Error message for human
1502
+ * @return AbortError
1503
+ */
1504
+ function AbortError(message) {
1505
+ Error.call(this, message);
1506
+
1507
+ this.type = 'aborted';
1508
+ this.message = message;
1509
+
1510
+ // hide custom error implementation details from end-users
1511
+ Error.captureStackTrace(this, this.constructor);
1512
+ }
1513
+
1514
+ AbortError.prototype = Object.create(Error.prototype);
1515
+ AbortError.prototype.constructor = AbortError;
1516
+ AbortError.prototype.name = 'AbortError';
1517
+
1518
+ // fix an issue where "PassThrough", "resolve" aren't a named export for node <10
1519
+ const PassThrough$1 = stream__WEBPACK_IMPORTED_MODULE_0__.PassThrough;
1520
+ const resolve_url = url__WEBPACK_IMPORTED_MODULE_2__.resolve;
1521
+
1522
+ /**
1523
+ * Fetch function
1524
+ *
1525
+ * @param Mixed url Absolute url or Request instance
1526
+ * @param Object opts Fetch options
1527
+ * @return Promise
1528
+ */
1529
+ function fetch(url, opts) {
1530
+
1531
+ // allow custom promise
1532
+ if (!fetch.Promise) {
1533
+ throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
1534
+ }
1535
+
1536
+ Body.Promise = fetch.Promise;
1537
+
1538
+ // wrap http.request into fetch
1539
+ return new fetch.Promise(function (resolve, reject) {
1540
+ // build request object
1541
+ const request = new Request(url, opts);
1542
+ const options = getNodeRequestOptions(request);
1543
+
1544
+ const send = (options.protocol === 'https:' ? https__WEBPACK_IMPORTED_MODULE_3__ : http__WEBPACK_IMPORTED_MODULE_1__).request;
1545
+ const signal = request.signal;
1546
+
1547
+ let response = null;
1548
+
1549
+ const abort = function abort() {
1550
+ let error = new AbortError('The user aborted a request.');
1551
+ reject(error);
1552
+ if (request.body && request.body instanceof stream__WEBPACK_IMPORTED_MODULE_0__.Readable) {
1553
+ request.body.destroy(error);
1554
+ }
1555
+ if (!response || !response.body) return;
1556
+ response.body.emit('error', error);
1557
+ };
1558
+
1559
+ if (signal && signal.aborted) {
1560
+ abort();
1561
+ return;
1562
+ }
1563
+
1564
+ const abortAndFinalize = function abortAndFinalize() {
1565
+ abort();
1566
+ finalize();
1567
+ };
1568
+
1569
+ // send request
1570
+ const req = send(options);
1571
+ let reqTimeout;
1572
+
1573
+ if (signal) {
1574
+ signal.addEventListener('abort', abortAndFinalize);
1575
+ }
1576
+
1577
+ function finalize() {
1578
+ req.abort();
1579
+ if (signal) signal.removeEventListener('abort', abortAndFinalize);
1580
+ clearTimeout(reqTimeout);
1581
+ }
1582
+
1583
+ if (request.timeout) {
1584
+ req.once('socket', function (socket) {
1585
+ reqTimeout = setTimeout(function () {
1586
+ reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));
1587
+ finalize();
1588
+ }, request.timeout);
1589
+ });
1590
+ }
1591
+
1592
+ req.on('error', function (err) {
1593
+ reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
1594
+ finalize();
1595
+ });
1596
+
1597
+ req.on('response', function (res) {
1598
+ clearTimeout(reqTimeout);
1599
+
1600
+ const headers = createHeadersLenient(res.headers);
1601
+
1602
+ // HTTP fetch step 5
1603
+ if (fetch.isRedirect(res.statusCode)) {
1604
+ // HTTP fetch step 5.2
1605
+ const location = headers.get('Location');
1606
+
1607
+ // HTTP fetch step 5.3
1608
+ const locationURL = location === null ? null : resolve_url(request.url, location);
1609
+
1610
+ // HTTP fetch step 5.5
1611
+ switch (request.redirect) {
1612
+ case 'error':
1613
+ reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect'));
1614
+ finalize();
1615
+ return;
1616
+ case 'manual':
1617
+ // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.
1618
+ if (locationURL !== null) {
1619
+ // handle corrupted header
1620
+ try {
1621
+ headers.set('Location', locationURL);
1622
+ } catch (err) {
1623
+ // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request
1624
+ reject(err);
1625
+ }
1626
+ }
1627
+ break;
1628
+ case 'follow':
1629
+ // HTTP-redirect fetch step 2
1630
+ if (locationURL === null) {
1631
+ break;
1632
+ }
1633
+
1634
+ // HTTP-redirect fetch step 5
1635
+ if (request.counter >= request.follow) {
1636
+ reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));
1637
+ finalize();
1638
+ return;
1639
+ }
1640
+
1641
+ // HTTP-redirect fetch step 6 (counter increment)
1642
+ // Create a new Request object.
1643
+ const requestOpts = {
1644
+ headers: new Headers(request.headers),
1645
+ follow: request.follow,
1646
+ counter: request.counter + 1,
1647
+ agent: request.agent,
1648
+ compress: request.compress,
1649
+ method: request.method,
1650
+ body: request.body,
1651
+ signal: request.signal,
1652
+ timeout: request.timeout
1653
+ };
1654
+
1655
+ // HTTP-redirect fetch step 9
1656
+ if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
1657
+ reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
1658
+ finalize();
1659
+ return;
1660
+ }
1661
+
1662
+ // HTTP-redirect fetch step 11
1663
+ if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {
1664
+ requestOpts.method = 'GET';
1665
+ requestOpts.body = undefined;
1666
+ requestOpts.headers.delete('content-length');
1667
+ }
1668
+
1669
+ // HTTP-redirect fetch step 15
1670
+ resolve(fetch(new Request(locationURL, requestOpts)));
1671
+ finalize();
1672
+ return;
1673
+ }
1674
+ }
1675
+
1676
+ // prepare response
1677
+ res.once('end', function () {
1678
+ if (signal) signal.removeEventListener('abort', abortAndFinalize);
1679
+ });
1680
+ let body = res.pipe(new PassThrough$1());
1681
+
1682
+ const response_options = {
1683
+ url: request.url,
1684
+ status: res.statusCode,
1685
+ statusText: res.statusMessage,
1686
+ headers: headers,
1687
+ size: request.size,
1688
+ timeout: request.timeout,
1689
+ counter: request.counter
1690
+ };
1691
+
1692
+ // HTTP-network fetch step 12.1.1.3
1693
+ const codings = headers.get('Content-Encoding');
1694
+
1695
+ // HTTP-network fetch step 12.1.1.4: handle content codings
1696
+
1697
+ // in following scenarios we ignore compression support
1698
+ // 1. compression support is disabled
1699
+ // 2. HEAD request
1700
+ // 3. no Content-Encoding header
1701
+ // 4. no content response (204)
1702
+ // 5. content not modified response (304)
1703
+ if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {
1704
+ response = new Response(body, response_options);
1705
+ resolve(response);
1706
+ return;
1707
+ }
1708
+
1709
+ // For Node v6+
1710
+ // Be less strict when decoding compressed responses, since sometimes
1711
+ // servers send slightly invalid responses that are still accepted
1712
+ // by common browsers.
1713
+ // Always using Z_SYNC_FLUSH is what cURL does.
1714
+ const zlibOptions = {
1715
+ flush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH,
1716
+ finishFlush: zlib__WEBPACK_IMPORTED_MODULE_4__.Z_SYNC_FLUSH
1717
+ };
1718
+
1719
+ // for gzip
1720
+ if (codings == 'gzip' || codings == 'x-gzip') {
1721
+ body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createGunzip(zlibOptions));
1722
+ response = new Response(body, response_options);
1723
+ resolve(response);
1724
+ return;
1725
+ }
1726
+
1727
+ // for deflate
1728
+ if (codings == 'deflate' || codings == 'x-deflate') {
1729
+ // handle the infamous raw deflate response from old servers
1730
+ // a hack for old IIS and Apache servers
1731
+ const raw = res.pipe(new PassThrough$1());
1732
+ raw.once('data', function (chunk) {
1733
+ // see http://stackoverflow.com/questions/37519828
1734
+ if ((chunk[0] & 0x0F) === 0x08) {
1735
+ body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflate());
1736
+ } else {
1737
+ body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createInflateRaw());
1738
+ }
1739
+ response = new Response(body, response_options);
1740
+ resolve(response);
1741
+ });
1742
+ return;
1743
+ }
1744
+
1745
+ // for br
1746
+ if (codings == 'br' && typeof zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress === 'function') {
1747
+ body = body.pipe(zlib__WEBPACK_IMPORTED_MODULE_4__.createBrotliDecompress());
1748
+ response = new Response(body, response_options);
1749
+ resolve(response);
1750
+ return;
1751
+ }
1752
+
1753
+ // otherwise, use response as-is
1754
+ response = new Response(body, response_options);
1755
+ resolve(response);
1756
+ });
1757
+
1758
+ writeToStream(req, request);
1759
+ });
1760
+ }
1761
+ /**
1762
+ * Redirect code matching
1763
+ *
1764
+ * @param Number code Status code
1765
+ * @return Boolean
1766
+ */
1767
+ fetch.isRedirect = function (code) {
1768
+ return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
1769
+ };
1770
+
1771
+ // expose Promise
1772
+ fetch.Promise = global.Promise;
1773
+
1774
+ /* harmony default export */ __webpack_exports__["default"] = (fetch);
1775
+
1776
+
1777
+
1778
+ /***/ })
1779
+ /******/ ])));