void 0.10.5 → 0.10.7

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 (216) hide show
  1. package/dist/agents-Bmr5tFFb.mjs +1454 -0
  2. package/dist/{auth-cmd-UoCwfDQv.mjs → auth-cmd-DlgNwByu.mjs} +10 -10
  3. package/dist/{better-auth-shared-D0Mbmx5V.mjs → better-auth-shared-BQooDxbw.mjs} +1 -1
  4. package/dist/{better-auth-shared-jkksALri.d.mts → better-auth-shared-BvnM9px6.d.mts} +2 -2
  5. package/dist/{build-cmd-CVyuBHjP.mjs → build-cmd-Br8qL0rA.mjs} +15 -17
  6. package/dist/{cache-ACORQCIq.mjs → cache-wH-mP8UE.mjs} +10 -12
  7. package/dist/{cancel-deploy-Gi8zmoZC.mjs → cancel-deploy-BEBOEgtu.mjs} +16 -18
  8. package/dist/cli/cli.mjs +47 -49
  9. package/dist/{client-BlbnA92X.mjs → client-Cj96iiBH.mjs} +74 -8
  10. package/dist/{config-8dLIngKW.mjs → config-1twldYCW.mjs} +10 -10
  11. package/dist/{config-CbJS4Krx.mjs → config-BdUctCZD.mjs} +4 -4
  12. package/dist/{create-project-LjvkYziS.mjs → create-project-DD9n8Ho-.mjs} +28 -23
  13. package/dist/{db-C00yjN01.mjs → db-DjKE2-A-.mjs} +147 -149
  14. package/dist/{delete-CplfvTgU.mjs → delete-D2kr3Kmk.mjs} +13 -15
  15. package/dist/{deploy-CISNL5uK.mjs → deploy-C4PbkFyE.mjs} +97 -100
  16. package/dist/{discover-ZWuBvt22.mjs → discover-BuVVSAum.mjs} +3 -3
  17. package/dist/{dist-5cGIJHQQ.mjs → dist-BuiRJkTd.mjs} +59 -27
  18. package/dist/{domain-B4HpcgNG.mjs → domain-_luIsM_B.mjs} +14 -16
  19. package/dist/{env-DNMJpeVF.mjs → env-CO5XAS9t.mjs} +23 -25
  20. package/dist/{env-helpers-B_ks681T.d.mts → env-helpers-z4stu8uc.d.mts} +1 -1
  21. package/dist/{env-types-BS8cZead.mjs → env-types-D51bnR-c.mjs} +3 -3
  22. package/dist/{env-validation-BxbtBbjh.mjs → env-validation-CeC2FL66.mjs} +4 -4
  23. package/dist/{fetch-error-C6qffTl2.mjs → fetch-error-Dj3crt0e.mjs} +3 -3
  24. package/dist/{gen-C0pV2gRQ.mjs → gen-Cf79J4aw.mjs} +42 -44
  25. package/dist/{github-cmd-CwtLD1yI.mjs → github-cmd-DnqxyOsb.mjs} +88 -90
  26. package/dist/{handler-B7rCOy21.d.mts → handler-imD0UVDT.d.mts} +4 -5
  27. package/dist/{headers-BNWymgnH.mjs → headers-BwvFGhkx.mjs} +3 -3
  28. package/dist/index.d.mts +3 -3
  29. package/dist/index.mjs +102 -83
  30. package/dist/{init-D58GxCtt.mjs → init-KirOzVDs.mjs} +132 -134
  31. package/dist/link-CUmiosyb.mjs +45 -0
  32. package/dist/{list-CbNNjXTm.mjs → list-3GEw7b6m.mjs} +10 -12
  33. package/dist/{login-CvxxF_9z.mjs → login-DJReaT_Q.mjs} +14 -15
  34. package/dist/{logs-BDZ9AuhM.mjs → logs-D-rQ56Lq.mjs} +9 -11
  35. package/dist/{magic-string.es-C1Fb0uxq.mjs → magic-string.es-ZQjdJFFn.mjs} +3 -3
  36. package/dist/{mcp-C8BjRt_z.mjs → mcp-D7yc0dXY.mjs} +2 -3
  37. package/dist/{node-B07cZs0d.mjs → node-yFFk626c.mjs} +6 -6
  38. package/dist/{package-json-Bg_GJdJB.mjs → package-json-B0NuUWGd.mjs} +1 -1
  39. package/dist/pages/client.d.mts +1 -1
  40. package/dist/pages/client.mjs +2 -1
  41. package/dist/pages/head-client.d.mts +1 -1
  42. package/dist/pages/head.d.mts +1 -1
  43. package/dist/pages/index.d.mts +2 -2
  44. package/dist/pages/index.mjs +5 -5
  45. package/dist/pages/islands-plugin.d.mts +1 -1
  46. package/dist/pages/islands-plugin.mjs +3 -3
  47. package/dist/pages/protocol.d.mts +2 -2
  48. package/dist/pages/protocol.mjs +5 -2
  49. package/dist/{plugin-inference-D04iL1mW.mjs → plugin-inference-CJxi_fWI.mjs} +3 -3
  50. package/dist/{prepare-DUo9q8cM.mjs → prepare-C_cVurhP.mjs} +15 -18
  51. package/dist/{preset-D0My64KQ.mjs → preset-CVvwCeIy.mjs} +4 -4
  52. package/dist/{project-cmd-Dd1gNRdd.mjs → project-cmd-DnU7u9QF.mjs} +13 -14
  53. package/dist/{project-paths-CCMrHYQm.mjs → project-paths-tpdR1mJR.mjs} +2 -2
  54. package/dist/{project-tsconfig-DMBV55K2.mjs → project-tsconfig-D9uSVVpA.mjs} +2 -2
  55. package/dist/{protocol-6UZCowS1.d.mts → protocol-6hTJ04T1.d.mts} +3 -3
  56. package/dist/{resolve-project-D4O1_fZz.mjs → resolve-project-D2HI3TrG.mjs} +2 -2
  57. package/dist/{rollback-DzmCCrFg.mjs → rollback-Yh7bCKob.mjs} +21 -23
  58. package/dist/{route-types-BpSJEW20.mjs → route-types-CfKfhbIg.mjs} +234 -3
  59. package/dist/{runner-BQyKUqAL.mjs → runner-h272wcPj.mjs} +4 -5
  60. package/dist/{runner-pg-EuhrFW3D.mjs → runner-pg-waxJOnBb.mjs} +1 -1
  61. package/dist/runtime/ai.mjs +2 -2
  62. package/dist/runtime/auth.d.mts +1 -1
  63. package/dist/runtime/better-auth-pg.d.mts +1 -1
  64. package/dist/runtime/better-auth-pg.mjs +3 -3
  65. package/dist/runtime/better-auth.d.mts +1 -1
  66. package/dist/runtime/better-auth.mjs +2 -2
  67. package/dist/runtime/client-react.d.mts +2 -2
  68. package/dist/runtime/client-react.mjs +1 -1
  69. package/dist/runtime/client-solid.d.mts +2 -2
  70. package/dist/runtime/client-solid.mjs +1 -1
  71. package/dist/runtime/client-svelte.d.mts +2 -2
  72. package/dist/runtime/client-svelte.mjs +1 -1
  73. package/dist/runtime/client-vue.d.mts +2 -2
  74. package/dist/runtime/client-vue.mjs +1 -1
  75. package/dist/runtime/client.d.mts +2 -2
  76. package/dist/runtime/client.mjs +1 -1
  77. package/dist/runtime/db-pg.d.mts +1 -1
  78. package/dist/runtime/env-helpers.d.mts +1 -1
  79. package/dist/runtime/env-public-client.d.mts +1 -1
  80. package/dist/runtime/env-public-client.mjs +2 -0
  81. package/dist/runtime/env-public.d.mts +3 -4
  82. package/dist/runtime/env-public.mjs +3 -1
  83. package/dist/runtime/env.mjs +1 -1
  84. package/dist/runtime/fetch-stream.d.mts +1 -1
  85. package/dist/runtime/fetch-stream.mjs +1 -1
  86. package/dist/runtime/fetch.d.mts +1 -1
  87. package/dist/runtime/fetch.mjs +1 -1
  88. package/dist/runtime/handler.d.mts +2 -2
  89. package/dist/runtime/handler.mjs +1 -1
  90. package/dist/runtime/isr.mjs +1 -1
  91. package/dist/runtime/live-server.mjs +2 -0
  92. package/dist/runtime/live.d.mts +2 -2
  93. package/dist/runtime/live.mjs +3 -1
  94. package/dist/runtime/migration-handler-pg.mjs +1 -1
  95. package/dist/runtime/migration-handler.mjs +1 -1
  96. package/dist/runtime/remote/index.mjs +11 -1
  97. package/dist/runtime/sandbox.d.mts +1 -4
  98. package/dist/runtime/sandbox.mjs +1 -1
  99. package/dist/runtime/validator.d.mts +1 -1
  100. package/dist/runtime/ws-server.d.mts +2 -2
  101. package/dist/runtime/ws-server.mjs +2 -0
  102. package/dist/runtime/ws.d.mts +3 -3
  103. package/dist/runtime/ws.mjs +2 -0
  104. package/dist/{scan-VCAM1oh3.mjs → scan-Dp_Gyzs3.mjs} +3 -3
  105. package/dist/{scan---8wfN58.mjs → scan-i7Yz54fv.mjs} +26 -8
  106. package/dist/{secret-CMLYWkE-.mjs → secret-u7FRvg8d.mjs} +22 -24
  107. package/dist/{skills-Dl3u05da.mjs → skills-DsdNDtX3.mjs} +6 -7
  108. package/dist/{subcommand-prompt-B8ng0FTS.mjs → subcommand-prompt-DtES-oP6.mjs} +34 -35
  109. package/dist/sveltekit.mjs +1 -1
  110. package/dist/validate-DT7nFMlf.mjs +504 -0
  111. package/dist/{yarn-pnp-WLW2IHUY.mjs → yarn-pnp-CW8LB6g_.mjs} +1 -1
  112. package/package.json +19 -19
  113. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +94 -0
  114. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +32 -11
  115. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +45 -0
  116. package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +5 -5
  117. package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +1 -1
  118. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +1 -1
  119. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +4 -1
  120. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +1 -1
  121. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +1 -0
  122. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +18 -6
  123. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +1 -1
  124. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +35 -0
  125. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +70 -0
  126. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +3 -1
  127. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +11 -7
  128. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +3 -1
  129. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +1 -1
  130. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +141 -26
  131. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +1 -1
  132. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +1 -1
  133. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
  134. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +16 -28
  135. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +16 -0
  136. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +15 -17
  137. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
  138. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +255 -2
  139. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +175 -0
  140. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +70 -5
  141. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
  142. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
  143. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +9 -3
  144. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +63 -11
  145. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
  146. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +27 -3
  147. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
  148. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +8 -0
  149. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +36 -4
  150. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
  151. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
  152. package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +403 -390
  153. package/skills/void/docs/node_modules/void/node_modules/pg/README.md +2 -1
  154. package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +1 -1
  155. package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +1 -0
  156. package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +18 -6
  157. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +1 -1
  158. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +35 -0
  159. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +70 -0
  160. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +3 -1
  161. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +11 -7
  162. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +3 -1
  163. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +1 -1
  164. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +141 -26
  165. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +1 -1
  166. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +1 -1
  167. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
  168. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +16 -28
  169. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +16 -0
  170. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +15 -17
  171. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
  172. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +255 -2
  173. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +175 -0
  174. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +70 -5
  175. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
  176. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
  177. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +9 -3
  178. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +63 -11
  179. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
  180. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +27 -3
  181. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
  182. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +8 -0
  183. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +36 -4
  184. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
  185. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
  186. package/skills/void/docs/reference/cli.md +5 -1
  187. package/dist/agents-MhSzNMiC.mjs +0 -151
  188. package/dist/collect-9rO3JFNM.mjs +0 -55
  189. package/dist/config-hhMYPVRT.mjs +0 -21
  190. package/dist/dist-abzUneor.mjs +0 -1287
  191. package/dist/drizzle-DqstQTGq.mjs +0 -232
  192. package/dist/link-ZFmboqY3.mjs +0 -47
  193. package/dist/output-DeiS4oEX.mjs +0 -139
  194. package/dist/plan-aD3wRDqF.mjs +0 -271
  195. package/dist/project-CH9pdo16.mjs +0 -72
  196. package/dist/project-slug-rX3kTOfY.mjs +0 -10
  197. package/dist/validate-CNWm-PsL.mjs +0 -186
  198. /package/dist/{auth-migrations-BP-hMzYl.mjs → auth-migrations-BTZ-ATvQ.mjs} +0 -0
  199. /package/dist/{auth-Dz2CCn4T.d.mts → auth-qgMlYp7Z.d.mts} +0 -0
  200. /package/dist/{canonical-json-CEyQaVDa.mjs → canonical-json-DuDiiUsQ.mjs} +0 -0
  201. /package/dist/{cf-access-DKDsgwOU.mjs → cf-access-Bqw81xAf.mjs} +0 -0
  202. /package/dist/{defer-C-bdSM_b.mjs → defer-YsYDUoii.mjs} +0 -0
  203. /package/dist/{dotenv-lS94ymhM.mjs → dotenv-D_UbC_vc.mjs} +0 -0
  204. /package/dist/{env-raw-Dtj1UAoK.mjs → env-raw-CoS20LHP.mjs} +0 -0
  205. /package/dist/{fetch-error-B6RaJ-eZ.d.mts → fetch-error-Sp1R4mZv.d.mts} +0 -0
  206. /package/dist/{git-metadata-Ce0AtSZL.mjs → git-metadata-CBKaL0v5.mjs} +0 -0
  207. /package/dist/{head-eOUCWUNy.d.mts → head-nmvOgFjd.d.mts} +0 -0
  208. /package/dist/{log-BdD_Fpms.mjs → log-ChfPKsVd.mjs} +0 -0
  209. /package/dist/{pathe.M-eThtNZ-BrPhGF_K.mjs → pathe.M-eThtNZ-CQzLbt4c.mjs} +0 -0
  210. /package/dist/{pg-CempqvEJ.mjs → pg-J2HbZIkX.mjs} +0 -0
  211. /package/dist/{providers-BJIoduK9.d.mts → providers-BNKRacMr.d.mts} +0 -0
  212. /package/dist/{providers-BwPbdHdi.mjs → providers-CJlNS3kT.mjs} +0 -0
  213. /package/dist/{proxy-M3pxItg2.mjs → proxy-D-3_D-Gl.mjs} +0 -0
  214. /package/dist/{chunk-DJd-R1mw.mjs → rolldown-runtime-DJK8HYOj.mjs} +0 -0
  215. /package/dist/{standard-schema-Cy0lfeWv.d.mts → standard-schema-DJ0HW7QP.d.mts} +0 -0
  216. /package/dist/{types-BodZGegX.d.mts → types-lLjNE9Qp.d.mts} +0 -0
@@ -1,390 +1,403 @@
1
- # ES Module Lexer
2
-
3
- [![Build Status][actions-image]][actions-url]
4
-
5
- A JS module syntax lexer used in [es-module-shims](https://github.com/guybedford/es-module-shims).
6
-
7
- Outputs the list of exports and locations of import specifiers, including dynamic import and import meta handling.
8
-
9
- Supports new syntax features including import attributes and source phase imports.
10
-
11
- A very small single JS file (4KiB gzipped) that includes inlined Web Assembly for very fast source analysis of ECMAScript module syntax only.
12
-
13
- For an example of the performance, Angular 1 (720KiB) is fully parsed in 5ms, in comparison to the fastest JS parser, Acorn which takes over 100ms.
14
-
15
- _Comprehensively handles the JS language grammar while remaining small and fast. - ~10ms per MB of JS cold and ~5ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._
16
-
17
- > [Built with](https://github.com/guybedford/es-module-lexer/blob/main/chompfile.toml) [Chomp](https://chompbuild.com/)
18
-
19
- ### Usage
20
-
21
- ```
22
- npm install es-module-lexer
23
- ```
24
-
25
- See [src/lexer.ts](src/lexer.ts) for the type definitions.
26
-
27
- For use in CommonJS:
28
-
29
- ```js
30
- const { init, parse } = require('es-module-lexer');
31
-
32
- (async () => {
33
- // either await init, or call parse asynchronously
34
- // this is necessary for the Web Assembly boot
35
- await init;
36
-
37
- const source = 'export var p = 5';
38
- const [imports, exports] = parse(source);
39
-
40
- // Returns "p"
41
- source.slice(exports[0].s, exports[0].e);
42
- // Returns "p"
43
- source.slice(exports[0].ls, exports[0].le);
44
- })();
45
- ```
46
-
47
- An ES module version is also available:
48
-
49
- ```js
50
- import { init, parse } from 'es-module-lexer';
51
-
52
- (async () => {
53
- await init;
54
-
55
- const source = `
56
- import { name } from 'mod\\u1011';
57
- import json from './json.json' with { type: 'json' }
58
- export var p = 5;
59
- export function q () {
60
-
61
- };
62
- export { x as 'external name' } from 'external';
63
-
64
- // Comments provided to demonstrate edge cases
65
- import /*comment!*/ ( 'asdf', { with: { type: 'json' }});
66
- import /*comment!*/.meta.asdf;
67
-
68
- // Source phase imports:
69
- import source mod from './mod.wasm';
70
- import.source('./mod.wasm');
71
- `;
72
-
73
- const [imports, exports] = parse(source, 'optional-sourcename');
74
-
75
- // Returns "modထ"
76
- imports[0].n
77
- // Returns "mod\u1011"
78
- source.slice(imports[0].s, imports[0].e);
79
- // "s" = start
80
- // "e" = end
81
-
82
- // Returns "import { name } from 'mod'"
83
- source.slice(imports[0].ss, imports[0].se);
84
- // "ss" = statement start
85
- // "se" = statement end
86
-
87
- // Returns "{ type: 'json' }"
88
- source.slice(imports[1].a, imports[1].se);
89
- // "a" = attribute start, -1 for no import attributes
90
-
91
- // Parsed import attributes are available in `at`
92
- // Returns [['type', 'json']]
93
- imports[1].at;
94
- // Returns 'json'
95
- imports[1].at[0][1];
96
-
97
- // Returns null (no attributes)
98
- imports[0].at;
99
-
100
- // Returns "external"
101
- source.slice(imports[2].s, imports[2].e);
102
-
103
- // Returns "p"
104
- source.slice(exports[0].s, exports[0].e);
105
- // Returns "p"
106
- source.slice(exports[0].ls, exports[0].le);
107
- // Returns "q"
108
- source.slice(exports[1].s, exports[1].e);
109
- // Returns "q"
110
- source.slice(exports[1].ls, exports[1].le);
111
- // Returns "'external name'"
112
- source.slice(exports[2].s, exports[2].e);
113
- // Returns -1
114
- exports[2].ls;
115
- // Returns -1
116
- exports[2].le;
117
-
118
- // Import type is provided by `t` value
119
- // (1 for static, 2, for dynamic)
120
- // Returns true
121
- imports[2].t == 2;
122
-
123
- // Returns "asdf" (only for string literal dynamic imports)
124
- imports[2].n
125
- // Returns "import /*comment!*/ ( 'asdf', { with: { type: 'json' } })"
126
- source.slice(imports[3].ss, imports[3].se);
127
- // Returns "'asdf'"
128
- source.slice(imports[3].s, imports[3].e);
129
- // Returns "( 'asdf', { with: { type: 'json' } })"
130
- source.slice(imports[3].d, imports[3].se);
131
- // Returns "{ with: { type: 'json' } }"
132
- source.slice(imports[3].a, imports[3].se - 1);
133
-
134
- // For non-string dynamic import expressions:
135
- // - n will be undefined
136
- // - a is currently -1 even if there is an import attribute
137
- // - e is currently the character before the closing )
138
-
139
- // For nested dynamic imports, the se value of the outer import is -1 as end tracking does not
140
- // currently support nested dynamic immports
141
-
142
- // import.meta is indicated by imports[3].d === -2
143
- // Returns true
144
- imports[4].d === -2;
145
- // Returns "import /*comment!*/.meta"
146
- source.slice(imports[4].s, imports[4].e);
147
- // ss and se are the same for import meta
148
-
149
- // Returns "'./mod.wasm'"
150
- source.slice(imports[5].s, imports[5].e);
151
-
152
- // Import type 4 and 5 for static and dynamic source phase
153
- imports[5].t === 4;
154
- imports[6].t === 5;
155
- })();
156
- ```
157
-
158
- ### CSP asm.js Build
159
-
160
- The default version of the library uses Wasm and (safe) eval usage for performance and a minimal footprint.
161
-
162
- Neither of these represent security escalation possibilities since there are no execution string injection vectors, but that can still violate existing CSP policies for applications.
163
-
164
- For a version that works with CSP eval disabled, use the `es-module-lexer/js` build:
165
-
166
- ```js
167
- import { parse } from 'es-module-lexer/js';
168
- ```
169
-
170
- Instead of Web Assembly, this uses an asm.js build which is almost as fast as the Wasm version ([see benchmarks below](#benchmarks)).
171
-
172
- ### Import Attributes
173
-
174
- The `a` field provides the index of the start of the `{` attributes bracket, or -1 for no attributes.
175
-
176
- The list of attribute key and value pairs are provided on the `at` field:
177
-
178
- ```js
179
- const [imports] = parse(`
180
- import json from './foo.json' with { type: 'json' };
181
- import './foo.css' with { type: 'css' };
182
- import pkg from 'pkg' with { type: 'json', integrity: 'sha384-...' };
183
- `);
184
-
185
- // Returns [['type', 'json']]
186
- imports[0].at;
187
-
188
- // Returns [['type', 'css']]
189
- imports[1].at;
190
-
191
- // Multiple attributes
192
- // Returns [['type', 'json'], ['integrity', 'sha384-...']]
193
- imports[2].at;
194
- ```
195
-
196
- The `at` field is an array of `[key, value]` tuples, or `null` if there are no attributes.
197
-
198
- Both keys and values support escape sequences:
199
-
200
- ```js
201
- const [imports] = parse(`
202
- import foo from './foo.js' with { "custom-key": "value" };
203
- import bar from './bar.js' with { "key\\nwith\\nnewlines": "value\\twith\\ttabs" };
204
- `);
205
-
206
- // Quoted keys are unquoted
207
- // Returns [['custom-key', 'value']]
208
- imports[0].at;
209
-
210
- // Escape sequences are processed
211
- // Returns [['key\nwith\nnewlines', 'value\twith\ttabs']]
212
- imports[1].at;
213
- ```
214
-
215
- ### Escape Sequences
216
-
217
- To handle escape sequences in specifier strings, the `.n` field of imported specifiers will be provided where possible.
218
-
219
- For dynamic import expressions, this field will be empty if not a valid JS string.
220
-
221
- ### Facade Detection
222
-
223
- Facade modules that only use import / export syntax can be detected via the third return value:
224
-
225
- ```js
226
- const [,, facade] = parse(`
227
- export * from 'external';
228
- import * as ns from 'external2';
229
- export { a as b } from 'external3';
230
- export { ns };
231
- `);
232
- facade === true;
233
- ```
234
-
235
- ### ESM Detection
236
-
237
- Modules that uses ESM syntaxes can be detected via the fourth return value:
238
-
239
- ```js
240
- const [,,, hasModuleSyntax] = parse(`
241
- export {}
242
- `);
243
- hasModuleSyntax === true;
244
- ```
245
-
246
- Dynamic imports are ignored since they can be used in Non-ESM files.
247
-
248
- ```js
249
- const [,,, hasModuleSyntax] = parse(`
250
- import('./foo.js')
251
- `);
252
- hasModuleSyntax === false;
253
- ```
254
-
255
- ### Environment Support
256
-
257
- Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm).
258
-
259
- ### Grammar Support
260
-
261
- * Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators.
262
- * Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking.
263
- * Always correctly parses valid JS source, but may parse invalid JS source without errors.
264
-
265
- ### Limitations
266
-
267
- The lexing approach is designed to deal with the full language grammar including RegEx / division operator ambiguity through backtracking and paren / brace tracking.
268
-
269
- The only limitation to the reduced parser is that the "exports" list may not correctly gather all export identifiers in the following edge cases:
270
-
271
- ```js
272
- // Only "a" is detected as an export, "q" isn't
273
- export var a = 'asdf', q = z;
274
-
275
- // "b" is not detected as an export
276
- export var { a: b } = asdf;
277
- ```
278
-
279
- The above cases are handled gracefully in that the lexer will keep going fine, it will just not properly detect the export names above.
280
-
281
- ### Benchmarks
282
-
283
- Benchmarks can be run with `npm run bench`.
284
-
285
- Current results for a high spec machine:
286
-
287
- #### Wasm Build
288
-
289
- ```
290
- Module load time
291
- > 5ms
292
- Cold Run, All Samples
293
- test/samples/*.js (3123 KiB)
294
- > 18ms
295
-
296
- Warm Runs (average of 25 runs)
297
- test/samples/angular.js (739 KiB)
298
- > 3ms
299
- test/samples/angular.min.js (188 KiB)
300
- > 1ms
301
- test/samples/d3.js (508 KiB)
302
- > 3ms
303
- test/samples/d3.min.js (274 KiB)
304
- > 2ms
305
- test/samples/magic-string.js (35 KiB)
306
- > 0ms
307
- test/samples/magic-string.min.js (20 KiB)
308
- > 0ms
309
- test/samples/rollup.js (929 KiB)
310
- > 4.32ms
311
- test/samples/rollup.min.js (429 KiB)
312
- > 2.16ms
313
-
314
- Warm Runs, All Samples (average of 25 runs)
315
- test/samples/*.js (3123 KiB)
316
- > 14.16ms
317
- ```
318
-
319
- #### JS Build (asm.js)
320
-
321
- ```
322
- Module load time
323
- > 2ms
324
- Cold Run, All Samples
325
- test/samples/*.js (3123 KiB)
326
- > 34ms
327
-
328
- Warm Runs (average of 25 runs)
329
- test/samples/angular.js (739 KiB)
330
- > 3ms
331
- test/samples/angular.min.js (188 KiB)
332
- > 1ms
333
- test/samples/d3.js (508 KiB)
334
- > 3ms
335
- test/samples/d3.min.js (274 KiB)
336
- > 2ms
337
- test/samples/magic-string.js (35 KiB)
338
- > 0ms
339
- test/samples/magic-string.min.js (20 KiB)
340
- > 0ms
341
- test/samples/rollup.js (929 KiB)
342
- > 5ms
343
- test/samples/rollup.min.js (429 KiB)
344
- > 3.04ms
345
-
346
- Warm Runs, All Samples (average of 25 runs)
347
- test/samples/*.js (3123 KiB)
348
- > 17.12ms
349
- ```
350
-
351
- ### Building
352
-
353
- This project uses [Chomp](https://chompbuild.com) for building.
354
-
355
- With Chomp installed, download the WASI SDK 12.0 from https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12.
356
-
357
- - [Linux](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz)
358
- - [Windows (MinGW)](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-mingw.tar.gz)
359
- - [macOS](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz)
360
-
361
- Locate the WASI-SDK as a sibling folder, or customize the path via the `WASI_PATH` environment variable.
362
-
363
- Emscripten emsdk is also assumed to be a sibling folder or via the `EMSDK_PATH` environment variable.
364
-
365
- Example setup:
366
-
367
- ```
368
- git clone https://github.com:guybedford/es-module-lexer
369
- git clone https://github.com/emscripten-core/emsdk
370
- cd emsdk
371
- git checkout 1.40.1-fastcomp
372
- ./emsdk install 1.40.1-fastcomp
373
- cd ..
374
- wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
375
- gunzip wasi-sdk-12.0-linux.tar.gz
376
- tar -xf wasi-sdk-12.0-linux.tar
377
- mv wasi-sdk-12.0-linux.tar wasi-sdk-12.0
378
- cargo install chompbuild
379
- cd es-module-lexer
380
- chomp test
381
- ```
382
-
383
- For the `asm.js` build, git clone `emsdk` from is assumed to be a sibling folder as well.
384
-
385
- ### License
386
-
387
- MIT
388
-
389
- [actions-image]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml/badge.svg
390
- [actions-url]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml
1
+ # ES Module Lexer
2
+
3
+ [![Build Status][actions-image]][actions-url]
4
+
5
+ A JS module syntax lexer used in [es-module-shims](https://github.com/guybedford/es-module-shims).
6
+
7
+ Outputs the list of exports and locations of import specifiers, including dynamic import and import meta handling.
8
+
9
+ Supports new syntax features including import attributes and source phase imports.
10
+
11
+ A very small single JS file (~7KiB gzipped) that includes inlined Web Assembly for very fast source analysis of ECMAScript module syntax only.
12
+
13
+ For an example of the performance, Angular 1 (720KiB) is fully parsed in 5ms, in comparison to the fastest JS parser, Acorn which takes over 100ms.
14
+
15
+ _Comprehensively handles the JS language grammar while remaining small and fast. - ~10ms per MB of JS cold and ~5ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._
16
+
17
+ > [Built with](https://github.com/guybedford/es-module-lexer/blob/main/chompfile.toml) [Chomp](https://chompbuild.com/)
18
+
19
+ ### Usage
20
+
21
+ ```
22
+ npm install es-module-lexer
23
+ ```
24
+
25
+ See [src/lexer.ts](src/lexer.ts) for the type definitions.
26
+
27
+ For use in CommonJS:
28
+
29
+ ```js
30
+ const { init, parse } = require('es-module-lexer');
31
+
32
+ (async () => {
33
+ // either await init, or call parse asynchronously
34
+ // this is necessary for the Web Assembly boot
35
+ await init;
36
+
37
+ const source = 'export var p = 5';
38
+ const [imports, exports] = parse(source);
39
+
40
+ // Returns "p"
41
+ source.slice(exports[0].s, exports[0].e);
42
+ // Returns "p"
43
+ source.slice(exports[0].ls, exports[0].le);
44
+ })();
45
+ ```
46
+
47
+ An ES module version is also available:
48
+
49
+ ```js
50
+ import { init, parse } from 'es-module-lexer';
51
+
52
+ (async () => {
53
+ await init;
54
+
55
+ const source = `
56
+ import { name } from 'mod\\u1011';
57
+ import json from './json.json' with { type: 'json' }
58
+ export var p = 5;
59
+ export function q () {
60
+
61
+ };
62
+ export { x as 'external name' } from 'external';
63
+
64
+ // Comments provided to demonstrate edge cases
65
+ import /*comment!*/ ( 'asdf', { with: { type: 'json' }});
66
+ import /*comment!*/.meta.asdf;
67
+
68
+ // Source phase imports:
69
+ import source mod from './mod.wasm';
70
+ import.source('./mod.wasm');
71
+ `;
72
+
73
+ const [imports, exports] = parse(source, 'optional-sourcename');
74
+
75
+ // Returns "modထ"
76
+ imports[0].n
77
+ // Returns "mod\u1011"
78
+ source.slice(imports[0].s, imports[0].e);
79
+ // "s" = start
80
+ // "e" = end
81
+
82
+ // Returns "import { name } from 'mod'"
83
+ source.slice(imports[0].ss, imports[0].se);
84
+ // "ss" = statement start
85
+ // "se" = statement end
86
+
87
+ // Returns "{ type: 'json' }"
88
+ source.slice(imports[1].a, imports[1].se);
89
+ // "a" = attribute start, -1 for no import attributes
90
+
91
+ // Parsed import attributes are available in `at`
92
+ // Returns [['type', 'json']]
93
+ imports[1].at;
94
+ // Returns 'json'
95
+ imports[1].at[0][1];
96
+
97
+ // Returns null (no attributes)
98
+ imports[0].at;
99
+
100
+ // Returns "external"
101
+ source.slice(imports[2].s, imports[2].e);
102
+
103
+ // Returns "p"
104
+ source.slice(exports[0].s, exports[0].e);
105
+ // Returns "p"
106
+ source.slice(exports[0].ls, exports[0].le);
107
+ // Returns "q"
108
+ source.slice(exports[1].s, exports[1].e);
109
+ // Returns "q"
110
+ source.slice(exports[1].ls, exports[1].le);
111
+
112
+ // "ss" = export statement start (only the start is tracked, not the end)
113
+ // Returns "export"
114
+ source.slice(exports[0].ss, exports[0].ss + 6);
115
+
116
+ // Returns "'external name'"
117
+ source.slice(exports[2].s, exports[2].e);
118
+ // Returns -1
119
+ exports[2].ls;
120
+ // Returns -1
121
+ exports[2].le;
122
+
123
+ // Import type is provided by `t` value
124
+ // (1 for static, 2, for dynamic)
125
+ // Returns true
126
+ imports[2].t == 2;
127
+
128
+ // Returns "asdf" (only for string literal dynamic imports)
129
+ imports[2].n
130
+ // Returns "import /*comment!*/ ( 'asdf', { with: { type: 'json' } })"
131
+ source.slice(imports[3].ss, imports[3].se);
132
+ // Returns "'asdf'"
133
+ source.slice(imports[3].s, imports[3].e);
134
+ // Returns "( 'asdf', { with: { type: 'json' } })"
135
+ source.slice(imports[3].d, imports[3].se);
136
+ // Returns "{ with: { type: 'json' } }"
137
+ source.slice(imports[3].a, imports[3].se - 1);
138
+
139
+ // For non-string dynamic import expressions:
140
+ // - n will be undefined
141
+ // - a is currently -1 even if there is an import attribute
142
+ // - e is currently the character before the closing )
143
+
144
+ // For nested dynamic imports, the se value of the outer import is -1 as end tracking does not
145
+ // currently support nested dynamic immports
146
+
147
+ // import.meta is indicated by imports[3].d === -2
148
+ // Returns true
149
+ imports[4].d === -2;
150
+ // Returns "import /*comment!*/.meta"
151
+ source.slice(imports[4].s, imports[4].e);
152
+ // ss and se are the same for import meta
153
+
154
+ // Returns "'./mod.wasm'"
155
+ source.slice(imports[5].s, imports[5].e);
156
+
157
+ // Import type 4 and 5 for static and dynamic source phase
158
+ imports[5].t === 4;
159
+ imports[6].t === 5;
160
+ })();
161
+ ```
162
+
163
+ ### CSP asm.js Build
164
+
165
+ The default version of the library uses Wasm and (safe) eval usage for performance and a minimal footprint.
166
+
167
+ Neither of these represent security escalation possibilities since there are no execution string injection vectors, but that can still violate existing CSP policies for applications.
168
+
169
+ For a version that works with CSP eval disabled, use the `es-module-lexer/js` build:
170
+
171
+ ```js
172
+ import { parse } from 'es-module-lexer/js';
173
+ ```
174
+
175
+ Instead of Web Assembly, this uses an asm.js build which is almost as fast as the Wasm version ([see benchmarks below](#benchmarks)).
176
+
177
+ ### Minimal Build
178
+
179
+ For size-sensitive embedders, the `es-module-lexer/minimal` build drops certain features to reduce the binary size. This is used for example by [es-module-shims](https://github.com/guybedford/es-module-shims):
180
+
181
+ ```js
182
+ import { parse } from 'es-module-lexer/minimal';
183
+ ```
184
+
185
+ Compared to the full build:
186
+
187
+ * `parse` returns a two-element `[imports, exports]` tuple only - the third and fourth facade and `hasModuleSyntax` booleans are dropped.
188
+ * Imports drop the parsed attribute list `at` (the attribute source remains recoverable via the `a` attributes index).
189
+ * Exports drop the statement start `ss`.
190
+
191
+ All other fields are identical to the full build. For CSP eval disabled support, the equivalent asm.js build is available as `es-module-lexer/minimal/js`.
192
+
193
+ ### Import Attributes
194
+
195
+ The `a` field provides the index of the start of the `{` attributes bracket, or -1 for no attributes.
196
+
197
+ The list of attribute key and value pairs are provided on the `at` field (full build only):
198
+
199
+ ```js
200
+ const [imports] = parse(`
201
+ import json from './foo.json' with { type: 'json' };
202
+ import './foo.css' with { type: 'css' };
203
+ import pkg from 'pkg' with { type: 'json', integrity: 'sha384-...' };
204
+ `);
205
+
206
+ // Returns [['type', 'json']]
207
+ imports[0].at;
208
+
209
+ // Returns [['type', 'css']]
210
+ imports[1].at;
211
+
212
+ // Multiple attributes
213
+ // Returns [['type', 'json'], ['integrity', 'sha384-...']]
214
+ imports[2].at;
215
+ ```
216
+
217
+ The `at` field is an array of `[key, value]` tuples, or `null` if there are no attributes.
218
+
219
+ Both keys and values support escape sequences:
220
+
221
+ ```js
222
+ const [imports] = parse(`
223
+ import foo from './foo.js' with { "custom-key": "value" };
224
+ import bar from './bar.js' with { "key\\nwith\\nnewlines": "value\\twith\\ttabs" };
225
+ `);
226
+
227
+ // Quoted keys are unquoted
228
+ // Returns [['custom-key', 'value']]
229
+ imports[0].at;
230
+
231
+ // Escape sequences are processed
232
+ // Returns [['key\nwith\nnewlines', 'value\twith\ttabs']]
233
+ imports[1].at;
234
+ ```
235
+
236
+ ### Escape Sequences
237
+
238
+ To handle escape sequences in specifier strings, the `.n` field of imported specifiers will be provided where possible.
239
+
240
+ For dynamic import expressions, this field will be empty if not a valid JS string.
241
+
242
+ ### Facade Detection
243
+
244
+ Facade modules that only use import / export syntax can be detected via the third return value (full build only):
245
+
246
+ ```js
247
+ const [,, facade] = parse(`
248
+ export * from 'external';
249
+ import * as ns from 'external2';
250
+ export { a as b } from 'external3';
251
+ export { ns };
252
+ `);
253
+ facade === true;
254
+ ```
255
+
256
+ ### ESM Detection
257
+
258
+ Modules that uses ESM syntaxes can be detected via the fourth return value (full build only):
259
+
260
+ ```js
261
+ const [,,, hasModuleSyntax] = parse(`
262
+ export {}
263
+ `);
264
+ hasModuleSyntax === true;
265
+ ```
266
+
267
+ Dynamic imports are ignored since they can be used in Non-ESM files.
268
+
269
+ ```js
270
+ const [,,, hasModuleSyntax] = parse(`
271
+ import('./foo.js')
272
+ `);
273
+ hasModuleSyntax === false;
274
+ ```
275
+
276
+ ### Environment Support
277
+
278
+ Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm).
279
+
280
+ ### Grammar Support
281
+
282
+ * Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators.
283
+ * Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking.
284
+ * Always correctly parses valid JS source, but may parse invalid JS source without errors.
285
+
286
+ ### Limitations
287
+
288
+ The lexing approach is designed to deal with the full language grammar including RegEx / division operator ambiguity through backtracking and paren / brace tracking.
289
+
290
+ Because it lexes rather than fully parses, the analysis is not a validation pass: valid JS source is always analyzed correctly, but some invalid source is accepted without an error rather than rejected. For example `export const = 1` lexes to an empty exports list instead of throwing. Callers that need to reject invalid source should run a validating parser separately.
291
+
292
+ Multiple exports per declaration (`export var a = 'asdf', q = z`) and renamed destructured exports (`export var { a: b } = asdf`) are detected correctly; earlier versions missed `q` and `b` in these forms.
293
+
294
+ ### Benchmarks
295
+
296
+ Benchmarks can be run with `npm run bench`.
297
+
298
+ Current results for a high spec machine:
299
+
300
+ #### Wasm Build
301
+
302
+ ```
303
+ Module load time
304
+ > 5ms
305
+ Cold Run, All Samples
306
+ test/samples/*.js (3123 KiB)
307
+ > 18ms
308
+
309
+ Warm Runs (average of 25 runs)
310
+ test/samples/angular.js (739 KiB)
311
+ > 3ms
312
+ test/samples/angular.min.js (188 KiB)
313
+ > 1ms
314
+ test/samples/d3.js (508 KiB)
315
+ > 3ms
316
+ test/samples/d3.min.js (274 KiB)
317
+ > 2ms
318
+ test/samples/magic-string.js (35 KiB)
319
+ > 0ms
320
+ test/samples/magic-string.min.js (20 KiB)
321
+ > 0ms
322
+ test/samples/rollup.js (929 KiB)
323
+ > 4.32ms
324
+ test/samples/rollup.min.js (429 KiB)
325
+ > 2.16ms
326
+
327
+ Warm Runs, All Samples (average of 25 runs)
328
+ test/samples/*.js (3123 KiB)
329
+ > 14.16ms
330
+ ```
331
+
332
+ #### JS Build (asm.js)
333
+
334
+ ```
335
+ Module load time
336
+ > 2ms
337
+ Cold Run, All Samples
338
+ test/samples/*.js (3123 KiB)
339
+ > 34ms
340
+
341
+ Warm Runs (average of 25 runs)
342
+ test/samples/angular.js (739 KiB)
343
+ > 3ms
344
+ test/samples/angular.min.js (188 KiB)
345
+ > 1ms
346
+ test/samples/d3.js (508 KiB)
347
+ > 3ms
348
+ test/samples/d3.min.js (274 KiB)
349
+ > 2ms
350
+ test/samples/magic-string.js (35 KiB)
351
+ > 0ms
352
+ test/samples/magic-string.min.js (20 KiB)
353
+ > 0ms
354
+ test/samples/rollup.js (929 KiB)
355
+ > 5ms
356
+ test/samples/rollup.min.js (429 KiB)
357
+ > 3.04ms
358
+
359
+ Warm Runs, All Samples (average of 25 runs)
360
+ test/samples/*.js (3123 KiB)
361
+ > 17.12ms
362
+ ```
363
+
364
+ ### Building
365
+
366
+ This project uses [Chomp](https://chompbuild.com) for building.
367
+
368
+ With Chomp installed, download the WASI SDK 12.0 from https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12.
369
+
370
+ - [Linux](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz)
371
+ - [Windows (MinGW)](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-mingw.tar.gz)
372
+ - [macOS](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz)
373
+
374
+ Locate the WASI-SDK as a sibling folder, or customize the path via the `WASI_PATH` environment variable.
375
+
376
+ Emscripten emsdk is also assumed to be a sibling folder or via the `EMSDK_PATH` environment variable.
377
+
378
+ Example setup:
379
+
380
+ ```
381
+ git clone https://github.com:guybedford/es-module-lexer
382
+ git clone https://github.com/emscripten-core/emsdk
383
+ cd emsdk
384
+ git checkout 1.40.1-fastcomp
385
+ ./emsdk install 1.40.1-fastcomp
386
+ cd ..
387
+ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
388
+ gunzip wasi-sdk-12.0-linux.tar.gz
389
+ tar -xf wasi-sdk-12.0-linux.tar
390
+ mv wasi-sdk-12.0-linux.tar wasi-sdk-12.0
391
+ cargo install chompbuild
392
+ cd es-module-lexer
393
+ chomp test
394
+ ```
395
+
396
+ For the `asm.js` build, git clone `emsdk` from is assumed to be a sibling folder as well.
397
+
398
+ ### License
399
+
400
+ MIT
401
+
402
+ [actions-image]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml/badge.svg
403
+ [actions-url]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml