typenative 0.4.1 → 0.6.0

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 (270) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.github/workflows/npm-publish-github-packages.yml +2 -2
  3. package/CHANGELOG.md +442 -1
  4. package/CONTRIBUTION.md +2 -1
  5. package/README.md +73 -25
  6. package/bin/cli.js +2 -0
  7. package/bin/index.js +75 -5
  8. package/bin/main.js +2 -0
  9. package/bin/node/assert.js +2 -2
  10. package/bin/node/async_hooks.js +1 -1
  11. package/bin/node/buffer.js +16 -5
  12. package/bin/node/child_process.js +7 -7
  13. package/bin/node/cluster.js +3 -3
  14. package/bin/node/core.js +41 -0
  15. package/bin/node/crypto_keys.js +21 -21
  16. package/bin/node/dgram.js +1 -1
  17. package/bin/node/diagnostics_channel.js +3 -3
  18. package/bin/node/dns.js +2 -2
  19. package/bin/node/events.js +18 -13
  20. package/bin/node/fetch.js +2 -2
  21. package/bin/node/fs.js +3 -3
  22. package/bin/node/fs_watch.js +5 -5
  23. package/bin/node/http.js +3 -3
  24. package/bin/node/http2.js +3 -3
  25. package/bin/node/net.js +8 -8
  26. package/bin/node/path.js +17 -3
  27. package/bin/node/process.js +47 -11
  28. package/bin/node/punycode.js +2 -2
  29. package/bin/node/readline.js +1 -1
  30. package/bin/node/registry.js +4 -1
  31. package/bin/node/sqlite.js +6 -6
  32. package/bin/node/stream.js +81 -15
  33. package/bin/node/stream_web.js +10 -10
  34. package/bin/node/system_extra.js +3 -3
  35. package/bin/node/test.js +674 -366
  36. package/bin/node/test_coverage.js +187 -0
  37. package/bin/node/test_report.js +1392 -0
  38. package/bin/node/test_run.js +575 -0
  39. package/bin/node/timers.js +8 -6
  40. package/bin/node/tls.js +5 -5
  41. package/bin/node/url.js +1 -1
  42. package/bin/node/util.js +31 -7
  43. package/bin/node/util_extra.js +7 -7
  44. package/bin/node/webview.js +654 -0
  45. package/bin/node/worker_threads.js +1 -1
  46. package/bin/node/zlib.js +3 -3
  47. package/bin/parse-node.js +6 -2
  48. package/bin/regex_vm.js +2057 -0
  49. package/bin/transpiler.js +32872 -11265
  50. package/bin/typecheck-node.js +2 -1
  51. package/bin/version.js +1 -1
  52. package/conformance.md +515 -345
  53. package/examples/README.md +71 -11
  54. package/examples/angular-templates/README.md +139 -0
  55. package/examples/angular-templates/bench.mjs +173 -0
  56. package/examples/angular-templates/dom-type-globals.d.ts +21 -0
  57. package/examples/angular-templates/dom-type-stubs.ts +21 -0
  58. package/examples/angular-templates/main.ts +135 -0
  59. package/examples/angular-templates/parity.mjs +157 -0
  60. package/examples/angular-templates/run-node.mjs +69 -0
  61. package/examples/angular-templates/vendor/angular/compiler/LICENSE +21 -0
  62. package/examples/desktop-notes/README.md +106 -0
  63. package/examples/desktop-notes/bench.mjs +125 -0
  64. package/examples/desktop-notes/main.ts +131 -0
  65. package/examples/desktop-notes/package-lock.json +726 -0
  66. package/examples/desktop-notes/package.json +9 -0
  67. package/examples/desktop-notes/ui.ts +176 -0
  68. package/examples/dupe-finder/README.md +78 -0
  69. package/examples/dupe-finder/bench.mjs +120 -0
  70. package/examples/dupe-finder/main.ts +87 -0
  71. package/examples/fibonacci/README.md +7 -7
  72. package/examples/hello-world/README.md +6 -6
  73. package/examples/json-server/README.md +19 -18
  74. package/examples/mandelbrot-png/README.md +63 -0
  75. package/examples/mandelbrot-png/bench.mjs +95 -0
  76. package/examples/mandelbrot-png/main.ts +98 -0
  77. package/examples/mandelbrot-png/preview.png +0 -0
  78. package/examples/marked-cli/README.md +160 -0
  79. package/examples/marked-cli/bench.mjs +178 -0
  80. package/examples/marked-cli/main.ts +292 -0
  81. package/examples/marked-cli/parity.mjs +185 -0
  82. package/examples/marked-cli/vendor/marked/LICENSE +44 -0
  83. package/examples/marked-cli/vendor/marked/VENDOR.md +26 -0
  84. package/examples/openai-chat/README.md +148 -0
  85. package/examples/openai-chat/bench.mjs +175 -0
  86. package/examples/openai-chat/main.ts +488 -0
  87. package/examples/react-compiler/README.md +170 -0
  88. package/examples/react-compiler/bench.mjs +181 -0
  89. package/examples/react-compiler/main.ts +158 -0
  90. package/examples/react-compiler/parity.mjs +362 -0
  91. package/examples/react-compiler/run-node.mjs +88 -0
  92. package/examples/react-compiler/vendor/babel/LICENSE +22 -0
  93. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +15 -0
  94. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +51 -0
  95. package/examples/react-compiler/vendor/charcodes/package.json +25 -0
  96. package/examples/react-compiler/vendor/invariant/LICENSE +21 -0
  97. package/examples/react-compiler/vendor/invariant/invariant.cjs +51 -0
  98. package/examples/react-compiler/vendor/invariant/invariant.d.cts +11 -0
  99. package/examples/react-compiler/vendor/invariant/types/LICENSE +21 -0
  100. package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +19 -0
  101. package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +19 -0
  102. package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +19 -0
  103. package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +19 -0
  104. package/examples/react-compiler/vendor/js-tokens/LICENSE +21 -0
  105. package/examples/react-compiler/vendor/js-tokens/index.cjs +23 -0
  106. package/examples/react-compiler/vendor/js-tokens/index.d.cts +13 -0
  107. package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +20 -0
  108. package/examples/react-compiler/vendor/jsesc/jsesc.cjs +337 -0
  109. package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +384 -0
  110. package/examples/react-compiler/vendor/jsesc/types/LICENSE +21 -0
  111. package/examples/react-compiler/vendor/picocolors/LICENSE +15 -0
  112. package/examples/react-compiler/vendor/picocolors/picocolors.cjs +75 -0
  113. package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +5 -0
  114. package/examples/react-compiler/vendor/picocolors/types.d.ts +51 -0
  115. package/examples/react-compiler/vendor/react-compiler/LICENSE +21 -0
  116. package/examples/react-compiler/vendor/stubs/babel-core.ts +31 -0
  117. package/examples/react-compiler/vendor/stubs/debug.ts +18 -0
  118. package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +13 -0
  119. package/examples/react-compiler/vendor/stubs/pretty-format.ts +18 -0
  120. package/examples/react-compiler/vendor/zod/LICENSE +21 -0
  121. package/examples/react-compiler/vendor/zod-validation-error/LICENSE +9 -0
  122. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +5 -0
  123. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +49 -0
  124. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +48 -0
  125. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +50 -0
  126. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +6 -0
  127. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +126 -0
  128. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +39 -0
  129. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +12 -0
  130. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +78 -0
  131. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +2 -0
  132. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +12 -0
  133. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +12 -0
  134. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +131 -0
  135. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +54 -0
  136. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +12 -0
  137. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +40 -0
  138. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +12 -0
  139. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +76 -0
  140. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +76 -0
  141. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +27 -0
  142. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +27 -0
  143. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +13 -0
  144. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +61 -0
  145. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +38 -0
  146. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +20 -0
  147. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +5 -0
  148. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +8 -0
  149. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +11 -0
  150. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +20 -0
  151. package/examples/react-compiler/vendor.mjs +688 -0
  152. package/examples/todo-cli/README.md +69 -0
  153. package/examples/todo-cli/bench.mjs +89 -0
  154. package/examples/todo-cli/main.ts +92 -0
  155. package/examples/yaml-cli/README.md +146 -0
  156. package/examples/yaml-cli/bench.mjs +265 -0
  157. package/examples/yaml-cli/main.ts +29 -0
  158. package/examples/yaml-cli/parity.mjs +156 -0
  159. package/examples/yaml-cli/vendor/yaml/LICENSE +13 -0
  160. package/examples/yaml-cli/vendor/yaml/VENDOR.md +25 -0
  161. package/govendor/github.com/jchv/go-webview2/LICENSE +22 -0
  162. package/govendor/github.com/jchv/go-webview2/README.md +21 -0
  163. package/govendor/github.com/jchv/go-webview2/common.go +84 -0
  164. package/govendor/github.com/jchv/go-webview2/go.mod +3 -0
  165. package/govendor/github.com/jchv/go-webview2/internal/w32/w32.go +194 -0
  166. package/govendor/github.com/jchv/go-webview2/internal/w32/w32_386.go +14 -0
  167. package/govendor/github.com/jchv/go-webview2/internal/w32/w32_64bit.go +15 -0
  168. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_COLOR.go +8 -0
  169. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND.go +9 -0
  170. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_KEY_EVENT_KIND.go +10 -0
  171. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_MOVE_FOCUS_REASON.go +9 -0
  172. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_PHYSICAL_KEY_STATUS.go +10 -0
  173. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_WEB_RESOURCE_CONTEXT.go +23 -0
  174. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventArgs.go +78 -0
  175. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventHandler.go +52 -0
  176. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller.go +132 -0
  177. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller2.go +74 -0
  178. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2CreateCoreWebView2ControllerCompletedHandler.go +48 -0
  179. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventArgs.go +17 -0
  180. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventHandler.go +48 -0
  181. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Settings.go +270 -0
  182. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequest.go +43 -0
  183. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventArgs.go +51 -0
  184. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventHandler.go +48 -0
  185. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceResponse.go +21 -0
  186. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_2.go +21 -0
  187. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_3.go +60 -0
  188. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebViewSettings.go +396 -0
  189. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium.go +361 -0
  190. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_386.go +24 -0
  191. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_amd64.go +22 -0
  192. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_arm64.go +26 -0
  193. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc.go +13 -0
  194. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go17.go +51 -0
  195. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go18.go +16 -0
  196. package/govendor/github.com/jchv/go-webview2/pkg/edge/corewebview2.go +411 -0
  197. package/govendor/github.com/jchv/go-webview2/pkg/edge/guid.go +223 -0
  198. package/govendor/github.com/jchv/go-webview2/webview.go +482 -0
  199. package/govendor/github.com/jchv/go-webview2/webviewloader/README.md +3 -0
  200. package/govendor/github.com/jchv/go-webview2/webviewloader/module.go +153 -0
  201. package/govendor/github.com/jchv/go-webview2/webviewloader/module_386.go +6 -0
  202. package/govendor/github.com/jchv/go-webview2/webviewloader/module_amd64.go +6 -0
  203. package/govendor/github.com/jchv/go-webview2/webviewloader/module_arm64.go +6 -0
  204. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/arm64/WebView2Loader.dll +0 -0
  205. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x64/WebView2Loader.dll +0 -0
  206. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x86/WebView2Loader.dll +0 -0
  207. package/govendor/github.com/jchv/go-winloader/LICENSE.md +7 -0
  208. package/govendor/github.com/jchv/go-winloader/README.md +124 -0
  209. package/govendor/github.com/jchv/go-winloader/common.go +11 -0
  210. package/govendor/github.com/jchv/go-winloader/go.mod +3 -0
  211. package/govendor/github.com/jchv/go-winloader/internal/loader/loader.go +25 -0
  212. package/govendor/github.com/jchv/go-winloader/internal/loader/machine.go +53 -0
  213. package/govendor/github.com/jchv/go-winloader/internal/memloader/cache.go +42 -0
  214. package/govendor/github.com/jchv/go-winloader/internal/memloader/loader.go +253 -0
  215. package/govendor/github.com/jchv/go-winloader/internal/pe/export.go +76 -0
  216. package/govendor/github.com/jchv/go-winloader/internal/pe/format.go +522 -0
  217. package/govendor/github.com/jchv/go-winloader/internal/pe/import.go +106 -0
  218. package/govendor/github.com/jchv/go-winloader/internal/pe/module.go +91 -0
  219. package/govendor/github.com/jchv/go-winloader/internal/pe/reloc.go +177 -0
  220. package/govendor/github.com/jchv/go-winloader/internal/pe/util.go +40 -0
  221. package/govendor/github.com/jchv/go-winloader/internal/vmem/common.go +55 -0
  222. package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_other.go +71 -0
  223. package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_windows.go +179 -0
  224. package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_other.go +17 -0
  225. package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_windows.go +73 -0
  226. package/govendor/github.com/jchv/go-winloader/internal/winloader/loader_windows.go +64 -0
  227. package/govendor/github.com/jchv/go-winloader/internal/winloader/machine_windows.go +32 -0
  228. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_386.go +9 -0
  229. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_amd64.go +9 -0
  230. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_arm64.go +9 -0
  231. package/govendor/github.com/jchv/go-winloader/loader_other.go +24 -0
  232. package/govendor/github.com/jchv/go-winloader/loader_windows.go +33 -0
  233. package/govendor/manifest.txt +3 -1
  234. package/package.json +8 -5
  235. package/performance/README.md +195 -0
  236. package/performance/any-dynamic.ts +21 -0
  237. package/performance/any-record-view.ts +20 -0
  238. package/performance/arr-hof.ts +21 -0
  239. package/performance/arr-push-index.ts +15 -0
  240. package/performance/arr-sort.ts +21 -0
  241. package/performance/async-await.ts +24 -0
  242. package/performance/class-dispatch.ts +52 -0
  243. package/performance/events-emit.ts +27 -0
  244. package/performance/exc-throw-rare.ts +25 -0
  245. package/performance/exc-try-catch.ts +26 -0
  246. package/performance/fn-closures.ts +29 -0
  247. package/performance/fn-recursion-tree.ts +31 -0
  248. package/performance/gen-for-of.ts +46 -0
  249. package/performance/json-roundtrip.ts +27 -0
  250. package/performance/map-delete.ts +24 -0
  251. package/performance/map-string-keys.ts +22 -0
  252. package/performance/num-arith-loop.ts +14 -0
  253. package/performance/num-bitwise.ts +21 -0
  254. package/performance/num-mod-int.ts +16 -0
  255. package/performance/num-to-string.ts +16 -0
  256. package/performance/obj-alloc.ts +32 -0
  257. package/performance/regex-exec.ts +29 -0
  258. package/performance/regex-site.ts +28 -0
  259. package/performance/set-ops.ts +20 -0
  260. package/performance/str-char-scan.ts +35 -0
  261. package/performance/str-concat-plus.ts +18 -0
  262. package/performance/str-concat.ts +24 -0
  263. package/performance/str-short-scan.ts +26 -0
  264. package/performance/str-split-join.ts +23 -0
  265. package/performance/str-template.ts +16 -0
  266. package/performance/union-switch.ts +57 -0
  267. package/tsparser/check.go +2 -1
  268. package/tsparser/main.go +5 -0
  269. package/types/typenative-npm.d.ts +193 -4
  270. package/types/typenative.d.ts +138 -41
@@ -0,0 +1,156 @@
1
+ // Parity check: Node.js vs the TypeNative build of the yaml CLI.
2
+ //
3
+ // Fetches the yaml-test-suite (tag data-2022-01-17) into .cache/, compiles
4
+ // main.ts to a native binary with the TypeNative CLI from this repo checkout,
5
+ // then feeds every test's in.yaml to both, in each mode: default (re-emit the
6
+ // YAML), --json, valid and lex. stdout, stderr and the exit code must match
7
+ // byte for byte (stack frames aside: see withoutStackFrames). Failures are
8
+ // written to .cache/failures/.
9
+ //
10
+ // Usage: node parity.mjs [filter] (filter: a test id substring or a mode)
11
+
12
+ import { spawn, spawnSync } from 'node:child_process';
13
+ import fs from 'node:fs';
14
+ import os from 'node:os';
15
+ import path from 'node:path';
16
+ import { fileURLToPath } from 'node:url';
17
+
18
+ const here = path.dirname(fileURLToPath(import.meta.url));
19
+ const repoRoot = path.resolve(here, '..', '..');
20
+ const cli = path.join(repoRoot, 'bin', 'cli.js');
21
+ const cache = path.join(here, '.cache');
22
+ const suite = path.join(cache, 'yaml-test-suite');
23
+ const failuresDir = path.join(cache, 'failures');
24
+ const exePath = path.join(cache, process.platform === 'win32' ? 'yaml.exe' : 'yaml');
25
+ const filter = process.argv[2] ?? '';
26
+ const MODES = [
27
+ { name: 'default', args: [] },
28
+ { name: 'json', args: ['--json'] },
29
+ { name: 'valid', args: ['valid'] },
30
+ { name: 'lex', args: ['lex'] }
31
+ ];
32
+
33
+ function run(command, args, options = {}) {
34
+ const result = spawnSync(command, args, { stdio: 'inherit', ...options });
35
+ if (result.status !== 0) {
36
+ console.error(`${command} ${args.join(' ')} failed`);
37
+ process.exit(1);
38
+ }
39
+ }
40
+
41
+ // The corpus: yaml-test-suite's data branch, one directory per test (some
42
+ // with numbered sub-tests), each with an in.yaml
43
+ function fetchSuite() {
44
+ if (fs.existsSync(path.join(suite, '.git')) || fs.existsSync(path.join(suite, '229Q'))) return;
45
+ fs.mkdirSync(cache, { recursive: true });
46
+ console.log('Fetching yaml-test-suite data-2022-01-17 ...');
47
+ run('git', ['clone', '--quiet', '--depth', '1', '--branch', 'data-2022-01-17', 'https://github.com/yaml/yaml-test-suite.git', suite]);
48
+ }
49
+
50
+ function listInputs() {
51
+ const inputs = [];
52
+ const walk = (dir, id) => {
53
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
54
+ if (entry.isDirectory() && entry.name !== '.git') walk(path.join(dir, entry.name), id ? `${id}-${entry.name}` : entry.name);
55
+ else if (entry.name === 'in.yaml') inputs.push({ id, file: path.join(dir, entry.name) });
56
+ }
57
+ };
58
+ walk(suite, '');
59
+ return inputs;
60
+ }
61
+
62
+ function exec(command, args, input) {
63
+ return new Promise((resolve) => {
64
+ const p = spawn(command, args, { cwd: here, stdio: ['pipe', 'pipe', 'pipe'] });
65
+ const stdout = [];
66
+ const stderr = [];
67
+ p.stdout.on('data', (d) => stdout.push(d));
68
+ p.stderr.on('data', (d) => stderr.push(d));
69
+ const timer = setTimeout(() => p.kill('SIGKILL'), 10000);
70
+ p.on('close', (code, signal) => {
71
+ clearTimeout(timer);
72
+ resolve({ code: signal ? signal : code, stdout: Buffer.concat(stdout), stderr: Buffer.concat(stderr) });
73
+ });
74
+ p.stdin.on('error', () => {});
75
+ p.stdin.end(input);
76
+ });
77
+ }
78
+
79
+ // Node prints an error's stack (" at …" lines, the frames of the JS call
80
+ // stack); a native binary has no JS frames to show. The frames are dropped
81
+ // (an inspected error's own properties, which follow the last frame as " {",
82
+ // stay where they are); warnings' process ids differ too
83
+ function withoutStackFrames(buffer) {
84
+ const out = [];
85
+ for (const line of buffer.toString().split('\n')) {
86
+ if (/^ {4}at /.test(line)) {
87
+ if (line.endsWith(' {')) out[out.length - 1] += ' {';
88
+ continue;
89
+ }
90
+ // (and process warnings name the process id)
91
+ out.push(line.replace(/^\(node:\d+\) /, '(node) '));
92
+ }
93
+ return Buffer.from(out.join('\n'));
94
+ }
95
+
96
+ function sameOutput(a, b) {
97
+ return a.code === b.code && a.stdout.equals(b.stdout) && withoutStackFrames(a.stderr).equals(withoutStackFrames(b.stderr));
98
+ }
99
+
100
+ function report(failure) {
101
+ const { id, mode, input, node, native } = failure;
102
+ const text = [
103
+ `# ${id} (${mode})`,
104
+ '## input',
105
+ input.toString(),
106
+ `## node (exit ${node.code})`,
107
+ '### stdout', node.stdout.toString(), '### stderr', node.stderr.toString(),
108
+ `## native (exit ${native.code})`,
109
+ '### stdout', native.stdout.toString(), '### stderr', native.stderr.toString()
110
+ ].join('\n');
111
+ fs.writeFileSync(path.join(failuresDir, `${id}-${mode}.txt`), text);
112
+ }
113
+
114
+ fetchSuite();
115
+ console.log('Compiling main.ts ...');
116
+ run(process.execPath, [cli, '--source', path.join(here, 'main.ts'), '--output', exePath], { cwd: here });
117
+
118
+ const cases = [];
119
+ for (const input of listInputs()) {
120
+ for (const mode of MODES) {
121
+ if (filter && !input.id.includes(filter) && mode.name !== filter) continue;
122
+ cases.push({ ...input, mode });
123
+ }
124
+ }
125
+ fs.rmSync(failuresDir, { recursive: true, force: true });
126
+ fs.mkdirSync(failuresDir, { recursive: true });
127
+
128
+ let next = 0;
129
+ let passed = 0;
130
+ const failed = [];
131
+ async function worker() {
132
+ while (next < cases.length) {
133
+ const c = cases[next++];
134
+ const input = fs.readFileSync(c.file);
135
+ const [node, native] = await Promise.all([
136
+ exec(process.execPath, [path.join(here, 'main.ts'), ...c.mode.args], input),
137
+ exec(exePath, c.mode.args, input)
138
+ ]);
139
+ if (sameOutput(node, native)) passed++;
140
+ else {
141
+ failed.push(`${c.id} (${c.mode.name})`);
142
+ report({ id: c.id, mode: c.mode.name, input, node, native });
143
+ }
144
+ }
145
+ }
146
+ const workers = Math.max(2, Math.min(16, os.availableParallelism()));
147
+ await Promise.all(Array.from({ length: workers }, () => worker()));
148
+
149
+ const rate = cases.length ? ((100 * passed) / cases.length).toFixed(2) : '100.00';
150
+ console.log(`\n${passed}/${cases.length} cases match (${rate}%)`);
151
+ if (failed.length > 0) {
152
+ console.log(`${failed.length} failures (details in .cache/failures/):`);
153
+ for (const f of failed.slice(0, 40)) console.log(` ${f}`);
154
+ if (failed.length > 40) console.log(` … and ${failed.length - 40} more`);
155
+ process.exitCode = 1;
156
+ }
@@ -0,0 +1,13 @@
1
+ Copyright Eemeli Aro <eemeli@gmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Vendored: `yaml`
2
+
3
+ | | |
4
+ | ---------- | ----------------------------------------------------------------------------------- |
5
+ | Upstream | [eemeli/yaml](https://github.com/eemeli/yaml) |
6
+ | Tag | `v3.0.0-2` |
7
+ | Commit | `15aa653fa2b94c4c9041a04964e83b9d794cf345` |
8
+ | License | ISC ([LICENSE](LICENSE)) |
9
+ | Copied | `src/` and `LICENSE`, byte for byte. Upstream's tests, docs and `bin.js` aren't vendored |
10
+
11
+ `bin.js` is ported to [../../main.ts](../../main.ts) instead of vendored. It's a
12
+ JavaScript file that imports the built package, and main.ts makes the same
13
+ `cli()` call from TypeScript.
14
+
15
+ ## Patches
16
+
17
+ None. `src/` is upstream's tree unmodified. To check:
18
+
19
+ ```sh
20
+ git clone --depth 1 --branch v3.0.0-2 https://github.com/eemeli/yaml.git /tmp/yaml
21
+ diff -r /tmp/yaml/src src && diff /tmp/yaml/LICENSE LICENSE
22
+ ```
23
+
24
+ Anything in this tree that TypeNative couldn't compile was fixed in the
25
+ transpiler, never here. Each fix has a probe in [conformance/](../../../../conformance/).
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 John Chadwick
4
+ Some portions Copyright (c) 2017 Serge Zaitsev
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ [![Go](https://github.com/jchv/go-webview2/actions/workflows/go.yml/badge.svg)](https://github.com/jchv/go-webview2/actions/workflows/go.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/jchv/go-webview2)](https://goreportcard.com/report/github.com/jchv/go-webview2) [![Go Reference](https://pkg.go.dev/badge/github.com/jchv/go-webview2.svg)](https://pkg.go.dev/github.com/jchv/go-webview2)
2
+
3
+ # go-webview2
4
+ This package provides an interface for using the Microsoft Edge WebView2 component with Go. It is based on [webview/webview](https://github.com/webview/webview) and provides a compatible API.
5
+
6
+ Please note that this package only supports Windows, since it provides functionality specific to WebView2. If you wish to use this library for Windows, but use webview/webview for all other operating systems, you could use the [go-webview-selector](https://github.com/jchv/go-webview-selector) package instead. However, you will not be able to use WebView2-specific functionality.
7
+
8
+ If you wish to build desktop applications in Go using web technologies, please consider [Wails](https://wails.io/). It uses go-webview2 internally on Windows.
9
+
10
+ ## Demo
11
+ If you are using Windows 10+, the WebView2 runtime should already be installed. If you don't have it installed, you can download and install a copy from Microsoft's website:
12
+
13
+ [WebView2 runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)
14
+
15
+ After that, you should be able to run go-webview2 directly:
16
+
17
+ ```
18
+ go run ./cmd/demo
19
+ ```
20
+
21
+ This will use go-winloader to load an embedded copy of WebView2Loader.dll. If you want, you can also provide a newer version of WebView2Loader.dll in the DLL search path and it should be picked up instead. It can be acquired from the WebView2 SDK (which is permissively licensed.)
@@ -0,0 +1,84 @@
1
+ package webview2
2
+
3
+ import "unsafe"
4
+
5
+ // This is copied from webview/webview.
6
+ // The documentation is included for convenience.
7
+
8
+ // Hint is used to configure window sizing and resizing behavior.
9
+ type Hint int
10
+
11
+ const (
12
+ // HintNone specifies that width and height are default size
13
+ HintNone Hint = iota
14
+
15
+ // HintFixed specifies that window size can not be changed by a user
16
+ HintFixed
17
+
18
+ // HintMin specifies that width and height are minimum bounds
19
+ HintMin
20
+
21
+ // HintMax specifies that width and height are maximum bounds
22
+ HintMax
23
+ )
24
+
25
+ // WebView is the interface for the webview.
26
+ type WebView interface {
27
+
28
+ // Run runs the main loop until it's terminated. After this function exits -
29
+ // you must destroy the webview.
30
+ Run()
31
+
32
+ // Terminate stops the main loop. It is safe to call this function from
33
+ // a background thread.
34
+ Terminate()
35
+
36
+ // Dispatch posts a function to be executed on the main thread. You normally
37
+ // do not need to call this function, unless you want to tweak the native
38
+ // window.
39
+ Dispatch(f func())
40
+
41
+ // Destroy destroys a webview and closes the native window.
42
+ Destroy()
43
+
44
+ // Window returns a native window handle pointer. When using GTK backend the
45
+ // pointer is GtkWindow pointer, when using Cocoa backend the pointer is
46
+ // NSWindow pointer, when using Win32 backend the pointer is HWND pointer.
47
+ Window() unsafe.Pointer
48
+
49
+ // SetTitle updates the title of the native window. Must be called from the UI
50
+ // thread.
51
+ SetTitle(title string)
52
+
53
+ // SetSize updates native window size. See Hint constants.
54
+ SetSize(w int, h int, hint Hint)
55
+
56
+ // Navigate navigates webview to the given URL. URL may be a data URI, i.e.
57
+ // "data:text/text,<html>...</html>". It is often ok not to url-encode it
58
+ // properly, webview will re-encode it for you.
59
+ Navigate(url string)
60
+
61
+ // SetHtml sets the webview HTML directly.
62
+ // The origin of the page is `about:blank`.
63
+ SetHtml(html string)
64
+
65
+ // Init injects JavaScript code at the initialization of the new page. Every
66
+ // time the webview will open a the new page - this initialization code will
67
+ // be executed. It is guaranteed that code is executed before window.onload.
68
+ Init(js string)
69
+
70
+ // Eval evaluates arbitrary JavaScript code. Evaluation happens asynchronously,
71
+ // also the result of the expression is ignored. Use RPC bindings if you want
72
+ // to receive notifications about the results of the evaluation.
73
+ Eval(js string)
74
+
75
+ // Bind binds a callback function so that it will appear under the given name
76
+ // as a global JavaScript function. Internally it uses webview_init().
77
+ // Callback receives a request string and a user-provided argument pointer.
78
+ // Request string is a JSON array of all the arguments passed to the
79
+ // JavaScript function.
80
+ //
81
+ // f must be a function
82
+ // f must return either value and error or just error
83
+ Bind(name string, f interface{}) error
84
+ }
@@ -0,0 +1,3 @@
1
+ module github.com/jchv/go-webview2
2
+
3
+ go 1.16
@@ -0,0 +1,194 @@
1
+ package w32
2
+
3
+ import (
4
+ "syscall"
5
+ "unicode/utf16"
6
+ "unsafe"
7
+
8
+ "golang.org/x/sys/windows"
9
+ )
10
+
11
+ var (
12
+ ole32 = windows.NewLazySystemDLL("ole32")
13
+ Ole32CoInitializeEx = ole32.NewProc("CoInitializeEx")
14
+
15
+ kernel32 = windows.NewLazySystemDLL("kernel32")
16
+ Kernel32GetCurrentThreadID = kernel32.NewProc("GetCurrentThreadId")
17
+
18
+ shlwapi = windows.NewLazySystemDLL("shlwapi")
19
+ shlwapiSHCreateMemStream = shlwapi.NewProc("SHCreateMemStream")
20
+
21
+ user32 = windows.NewLazySystemDLL("user32")
22
+ User32LoadImageW = user32.NewProc("LoadImageW")
23
+ User32GetSystemMetrics = user32.NewProc("GetSystemMetrics")
24
+ User32RegisterClassExW = user32.NewProc("RegisterClassExW")
25
+ User32CreateWindowExW = user32.NewProc("CreateWindowExW")
26
+ User32DestroyWindow = user32.NewProc("DestroyWindow")
27
+ User32ShowWindow = user32.NewProc("ShowWindow")
28
+ User32UpdateWindow = user32.NewProc("UpdateWindow")
29
+ User32SetFocus = user32.NewProc("SetFocus")
30
+ User32GetMessageW = user32.NewProc("GetMessageW")
31
+ User32TranslateMessage = user32.NewProc("TranslateMessage")
32
+ User32DispatchMessageW = user32.NewProc("DispatchMessageW")
33
+ User32DefWindowProcW = user32.NewProc("DefWindowProcW")
34
+ User32GetClientRect = user32.NewProc("GetClientRect")
35
+ User32PostQuitMessage = user32.NewProc("PostQuitMessage")
36
+ User32PostMessageW = user32.NewProc("PostMessageW")
37
+ User32SetWindowTextW = user32.NewProc("SetWindowTextW")
38
+ User32PostThreadMessageW = user32.NewProc("PostThreadMessageW")
39
+ User32GetWindowLongW = user32.NewProc("GetWindowLongW")
40
+ User32GetWindowLongPtrW = user32.NewProc("GetWindowLongPtrW")
41
+ User32SetWindowLongW = user32.NewProc("SetWindowLongW")
42
+ User32SetWindowLongPtrW = user32.NewProc("SetWindowLongPtrW")
43
+ User32AdjustWindowRect = user32.NewProc("AdjustWindowRect")
44
+ User32SetWindowPos = user32.NewProc("SetWindowPos")
45
+ User32IsDialogMessage = user32.NewProc("IsDialogMessage")
46
+ User32GetAncestor = user32.NewProc("GetAncestor")
47
+ )
48
+
49
+ const (
50
+ SM_CXSCREEN = 0
51
+ SM_CYSCREEN = 1
52
+ )
53
+
54
+ const (
55
+ CW_USEDEFAULT = 0x80000000
56
+ )
57
+
58
+ const (
59
+ LR_DEFAULTCOLOR = 0x0000
60
+ LR_MONOCHROME = 0x0001
61
+ LR_LOADFROMFILE = 0x0010
62
+ LR_LOADTRANSPARENT = 0x0020
63
+ LR_DEFAULTSIZE = 0x0040
64
+ LR_VGACOLOR = 0x0080
65
+ LR_LOADMAP3DCOLORS = 0x1000
66
+ LR_CREATEDIBSECTION = 0x2000
67
+ LR_SHARED = 0x8000
68
+ )
69
+
70
+ const (
71
+ SystemMetricsCxIcon = 11
72
+ SystemMetricsCyIcon = 12
73
+ )
74
+
75
+ const (
76
+ SWShow = 5
77
+ )
78
+
79
+ const (
80
+ SWPNoZOrder = 0x0004
81
+ SWPNoActivate = 0x0010
82
+ SWPNoMove = 0x0002
83
+ SWPFrameChanged = 0x0020
84
+ )
85
+
86
+ const (
87
+ WMDestroy = 0x0002
88
+ WMMove = 0x0003
89
+ WMSize = 0x0005
90
+ WMActivate = 0x0006
91
+ WMClose = 0x0010
92
+ WMQuit = 0x0012
93
+ WMGetMinMaxInfo = 0x0024
94
+ WMNCLButtonDown = 0x00A1
95
+ WMMoving = 0x0216
96
+ WMApp = 0x8000
97
+ )
98
+
99
+ const (
100
+ GAParent = 1
101
+ GARoot = 2
102
+ GARootOwner = 3
103
+ )
104
+
105
+ const (
106
+ GWLStyle = -16
107
+ )
108
+
109
+ const (
110
+ WSOverlapped = 0x00000000
111
+ WSMaximizeBox = 0x00010000
112
+ WSThickFrame = 0x00040000
113
+ WSCaption = 0x00C00000
114
+ WSSysMenu = 0x00080000
115
+ WSMinimizeBox = 0x00020000
116
+ WSOverlappedWindow = (WSOverlapped | WSCaption | WSSysMenu | WSThickFrame | WSMinimizeBox | WSMaximizeBox)
117
+ )
118
+
119
+ const (
120
+ WAInactive = 0
121
+ WAActive = 1
122
+ WAActiveClick = 2
123
+ )
124
+
125
+ type WndClassExW struct {
126
+ CbSize uint32
127
+ Style uint32
128
+ LpfnWndProc uintptr
129
+ CnClsExtra int32
130
+ CbWndExtra int32
131
+ HInstance windows.Handle
132
+ HIcon windows.Handle
133
+ HCursor windows.Handle
134
+ HbrBackground windows.Handle
135
+ LpszMenuName *uint16
136
+ LpszClassName *uint16
137
+ HIconSm windows.Handle
138
+ }
139
+
140
+ type Rect struct {
141
+ Left int32
142
+ Top int32
143
+ Right int32
144
+ Bottom int32
145
+ }
146
+
147
+ type MinMaxInfo struct {
148
+ PtReserved Point
149
+ PtMaxSize Point
150
+ PtMaxPosition Point
151
+ PtMinTrackSize Point
152
+ PtMaxTrackSize Point
153
+ }
154
+
155
+ type Point struct {
156
+ X, Y int32
157
+ }
158
+
159
+ type Msg struct {
160
+ Hwnd syscall.Handle
161
+ Message uint32
162
+ WParam uintptr
163
+ LParam uintptr
164
+ Time uint32
165
+ Pt Point
166
+ LPrivate uint32
167
+ }
168
+
169
+ func Utf16PtrToString(p *uint16) string {
170
+ if p == nil {
171
+ return ""
172
+ }
173
+ // Find NUL terminator.
174
+ end := unsafe.Pointer(p)
175
+ n := 0
176
+ for *(*uint16)(end) != 0 {
177
+ end = unsafe.Pointer(uintptr(end) + unsafe.Sizeof(*p))
178
+ n++
179
+ }
180
+ s := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:n:n]
181
+ return string(utf16.Decode(s))
182
+ }
183
+
184
+ func SHCreateMemStream(data []byte) (uintptr, error) {
185
+ ret, _, err := shlwapiSHCreateMemStream.Call(
186
+ uintptr(unsafe.Pointer(&data[0])),
187
+ uintptr(len(data)),
188
+ )
189
+ if ret == 0 {
190
+ return 0, err
191
+ }
192
+
193
+ return ret, nil
194
+ }
@@ -0,0 +1,14 @@
1
+ //go:build windows && 386
2
+ // +build windows,386
3
+
4
+ package w32
5
+
6
+ func GetWindowLong(hwnd uintptr, index int) uintptr {
7
+ ret, _, _ := User32GetWindowLongW.Call(hwnd, uintptr(index))
8
+ return ret
9
+ }
10
+
11
+ func SetWindowLong(hwnd uintptr, index int, newLong uintptr) uintptr {
12
+ ret, _, _ := User32SetWindowLongW.Call(hwnd, uintptr(index), newLong)
13
+ return ret
14
+ }
@@ -0,0 +1,15 @@
1
+ //go:build windows && (amd64 || arm64)
2
+ // +build windows
3
+ // +build amd64 arm64
4
+
5
+ package w32
6
+
7
+ func GetWindowLong(hwnd uintptr, index int) uintptr {
8
+ ret, _, _ := User32GetWindowLongPtrW.Call(hwnd, uintptr(index))
9
+ return ret
10
+ }
11
+
12
+ func SetWindowLong(hwnd uintptr, index int, newLong uintptr) uintptr {
13
+ ret, _, _ := User32SetWindowLongPtrW.Call(hwnd, uintptr(index), newLong)
14
+ return ret
15
+ }
@@ -0,0 +1,8 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_COLOR struct {
4
+ A uint8
5
+ R uint8
6
+ G uint8
7
+ B uint8
8
+ }
@@ -0,0 +1,9 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND uint32
4
+
5
+ const (
6
+ COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY = iota
7
+ COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_ALLOW
8
+ COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND_DENY_CORS
9
+ )
@@ -0,0 +1,10 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_KEY_EVENT_KIND uint32
4
+
5
+ const (
6
+ COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN = 0
7
+ COREWEBVIEW2_KEY_EVENT_KIND_KEY_UP = 1
8
+ COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN = 2
9
+ COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_UP = 3
10
+ )
@@ -0,0 +1,9 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_MOVE_FOCUS_REASON uint32
4
+
5
+ const (
6
+ COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC = 0
7
+ COREWEBVIEW2_MOVE_FOCUS_REASON_NEXT = 1
8
+ COREWEBVIEW2_MOVE_FOCUS_REASON_PREVIOUS = 2
9
+ )
@@ -0,0 +1,10 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_PHYSICAL_KEY_STATUS struct {
4
+ RepeatCount uint32
5
+ ScanCode uint32
6
+ IsExtendedKey bool
7
+ IsMenuKeyDown bool
8
+ WasKeyDown bool
9
+ IsKeyReleased bool
10
+ }
@@ -0,0 +1,23 @@
1
+ package edge
2
+
3
+ type COREWEBVIEW2_WEB_RESOURCE_CONTEXT uint32
4
+
5
+ const (
6
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL = 0
7
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_DOCUMENT = 1
8
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_STYLESHEET = 2
9
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_IMAGE = 3
10
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_MEDIA = 4
11
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_FONT = 5
12
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_SCRIPT = 6
13
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_XML_HTTP_REQUEST = 7
14
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_FETCH = 8
15
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_TEXT_TRACK = 9
16
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_EVENT_SOURCE = 10
17
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_WEBSOCKET = 11
18
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_MANIFEST = 12
19
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_SIGNED_EXCHANGE = 13
20
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_PING = 14
21
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_CSP_VIOLATION_REPORT = 15
22
+ COREWEBVIEW2_WEB_RESOURCE_CONTEXT_OTHER = 16
23
+ )