@aussieljk/forkbook 0.0.0-stage → 0.0.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +77 -2
- package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
- package/assets/browser/favicon-wrapper.svg +46 -0
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/builder-vite/iframe.html +99 -0
- package/assets/create/rendererAssets/.eslintrc.json +16 -0
- package/assets/create/rendererAssets/common/Configure.mdx +388 -0
- package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
- package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
- package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
- package/assets/create/rendererAssets/common/assets/assets.png +0 -0
- package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
- package/assets/create/rendererAssets/common/assets/context.png +0 -0
- package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
- package/assets/create/rendererAssets/common/assets/docs.png +0 -0
- package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
- package/assets/create/rendererAssets/common/assets/github.svg +1 -0
- package/assets/create/rendererAssets/common/assets/share.png +0 -0
- package/assets/create/rendererAssets/common/assets/styling.png +0 -0
- package/assets/create/rendererAssets/common/assets/testing.png +0 -0
- package/assets/create/rendererAssets/common/assets/theming.png +0 -0
- package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
- package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
- package/assets/create/rendererAssets/common/button.css +30 -0
- package/assets/create/rendererAssets/common/header.css +32 -0
- package/assets/create/rendererAssets/common/page.css +68 -0
- package/assets/create/templates/react-native/index.expo.js +20 -0
- package/assets/create/templates/react-native/index.js +25 -0
- package/assets/docs/addon-backgrounds.gif +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/highlight.png +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/react-native/metro-env.d.ts +69 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +116 -0
- package/assets/server/base-preview-head.html +494 -0
- package/assets/server/openBrowser.applescript +94 -0
- package/assets/server/template.ejs +87 -0
- package/dist/.build-stamp +0 -0
- package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
- package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
- package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
- package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
- package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
- package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
- package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
- package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
- package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
- package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
- package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
- package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
- package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
- package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
- package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
- package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
- package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
- package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
- package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
- package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
- package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
- package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
- package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
- package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
- package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
- package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
- package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
- package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
- package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
- package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
- package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
- package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
- package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
- package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
- package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
- package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
- package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
- package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
- package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
- package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
- package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
- package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
- package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
- package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
- package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
- package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
- package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
- package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
- package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
- package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
- package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
- package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
- package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
- package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
- package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
- package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
- package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
- package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
- package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
- package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
- package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
- package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
- package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
- package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
- package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
- package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
- package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
- package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
- package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
- package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
- package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
- package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
- package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
- package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
- package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
- package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
- package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
- package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
- package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
- package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
- package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
- package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
- package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
- package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
- package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
- package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
- package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
- package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
- package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
- package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
- package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
- package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
- package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
- package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
- package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
- package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
- package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
- package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
- package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
- package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
- package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
- package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
- package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
- package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
- package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
- package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
- package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
- package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
- package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
- package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
- package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
- package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
- package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
- package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
- package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
- package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
- package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
- package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
- package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
- package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
- package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
- package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
- package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
- package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
- package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
- package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
- package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
- package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
- package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
- package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
- package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
- package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
- package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
- package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
- package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
- package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
- package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
- package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
- package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
- package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
- package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
- package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
- package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
- package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
- package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
- package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
- package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
- package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
- package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
- package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
- package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
- package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
- package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
- package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
- package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
- package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
- package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
- package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
- package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
- package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
- package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
- package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
- package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
- package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
- package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
- package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
- package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
- package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
- package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
- package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
- package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
- package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
- package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
- package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
- package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
- package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
- package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
- package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
- package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
- package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
- package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
- package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
- package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
- package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
- package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
- package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
- package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
- package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
- package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
- package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
- package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
- package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
- package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
- package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
- package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
- package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
- package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
- package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
- package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
- package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
- package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
- package/dist/actions/decorator.d.ts +7 -0
- package/dist/actions/decorator.js +43 -0
- package/dist/actions/index.d.ts +67 -0
- package/dist/actions/index.js +28 -0
- package/dist/addon-a11y/index.d.ts +52 -0
- package/dist/addon-a11y/index.js +16 -0
- package/dist/addon-a11y/manager.js +1429 -0
- package/dist/addon-a11y/preset.js +18 -0
- package/dist/addon-a11y/preview.d.ts +17 -0
- package/dist/addon-a11y/preview.js +15 -0
- package/dist/addon-docs/blocks.d.ts +1061 -0
- package/dist/addon-docs/blocks.js +2461 -0
- package/dist/addon-docs/index.d.ts +236 -0
- package/dist/addon-docs/index.js +16 -0
- package/dist/addon-docs/manager.js +90 -0
- package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
- package/dist/addon-docs/mdx-react-shim.js +2 -0
- package/dist/addon-docs/preset.js +378 -0
- package/dist/addon-docs/preview.d.ts +4 -0
- package/dist/addon-docs/preview.js +7 -0
- package/dist/addon-links/index.d.ts +22 -0
- package/dist/addon-links/index.js +20 -0
- package/dist/addon-links/manager.js +14 -0
- package/dist/addon-links/preview.d.ts +6 -0
- package/dist/addon-links/preview.js +9 -0
- package/dist/addon-links/react/index.d.ts +25 -0
- package/dist/addon-links/react/index.js +52 -0
- package/dist/addon-mcp/preset.js +1345 -0
- package/dist/addon-mcp/preview.js +29 -0
- package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
- package/dist/addon-ondevice-actions/index.d.ts +4 -0
- package/dist/addon-ondevice-actions/index.js +7 -0
- package/dist/addon-ondevice-actions/register.js +7 -0
- package/dist/addon-ondevice-controls/index.d.ts +6 -0
- package/dist/addon-ondevice-controls/index.js +14 -0
- package/dist/addon-ondevice-controls/register.js +10 -0
- package/dist/addon-pseudo-states/index.d.ts +35 -0
- package/dist/addon-pseudo-states/index.js +15 -0
- package/dist/addon-pseudo-states/manager.js +53 -0
- package/dist/addon-pseudo-states/preview.d.ts +9 -0
- package/dist/addon-pseudo-states/preview.js +10 -0
- package/dist/addon-themes/index.d.ts +80 -0
- package/dist/addon-themes/index.js +104 -0
- package/dist/addon-themes/manager.js +97 -0
- package/dist/addon-themes/postinstall.js +33 -0
- package/dist/addon-themes/preview.d.ts +6 -0
- package/dist/addon-themes/preview.js +8 -0
- package/dist/addon-vitest/constants.d.ts +132 -0
- package/dist/addon-vitest/constants.js +66 -0
- package/dist/addon-vitest/index.d.ts +4 -0
- package/dist/addon-vitest/index.js +8 -0
- package/dist/addon-vitest/manager.js +665 -0
- package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
- package/dist/addon-vitest/node/vitest.js +674 -0
- package/dist/addon-vitest/postinstall.js +24 -0
- package/dist/addon-vitest/preset.js +943 -0
- package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
- package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
- package/dist/addon-vitest/vitest-plugin/index.js +463 -0
- package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
- package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
- package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
- package/dist/babel/index.d.ts +2301 -0
- package/dist/babel/index.js +61 -0
- package/dist/backgrounds/index.d.ts +6 -0
- package/dist/backgrounds/index.js +15 -0
- package/dist/bin/core.js +1705 -0
- package/dist/bin/dispatcher.js +43 -0
- package/dist/bin/loader.js +115 -0
- package/dist/builder-vite/index.d.ts +50 -0
- package/dist/builder-vite/index.js +245 -0
- package/dist/builder-vite/preset.js +27 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +352 -0
- package/dist/chunk-B2t1tGRh.d.ts +284 -0
- package/dist/chunk-BCoJQE-f.d.ts +602 -0
- package/dist/chunk-BGkgZp-H.d.ts +214 -0
- package/dist/chunk-BTVrWliM.d.ts +115 -0
- package/dist/chunk-BXLImeLy.d.ts +197 -0
- package/dist/chunk-BfBzpgct.d.ts +916 -0
- package/dist/chunk-Bpi2tz-6.d.ts +511 -0
- package/dist/chunk-BxWufQms.d.ts +142 -0
- package/dist/chunk-C-bavsOH.d.ts +34 -0
- package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
- package/dist/chunk-C6PAgHLT.d.ts +12 -0
- package/dist/chunk-CMeX4WRe.d.ts +179 -0
- package/dist/chunk-Ct9xd6IM.d.ts +65 -0
- package/dist/chunk-CwQKNaYL.d.ts +15 -0
- package/dist/chunk-D7DwV41f.d.ts +3622 -0
- package/dist/chunk-DEVFdzxR.d.ts +253 -0
- package/dist/chunk-DaVb55-_.d.ts +124 -0
- package/dist/chunk-DgRNfmj_.d.ts +40 -0
- package/dist/chunk-DoIGKY33.d.ts +666 -0
- package/dist/chunk-Dr3R0DXk.d.ts +40 -0
- package/dist/chunk-DtHByo32.d.ts +55 -0
- package/dist/chunk-Dw1z1Pki.d.ts +933 -0
- package/dist/chunk-DzuY9DXg.d.ts +79 -0
- package/dist/chunk-FjDVzZTj.d.ts +62 -0
- package/dist/chunk-Kt1tW-D1.d.ts +59 -0
- package/dist/chunk-XP8oHzpE.d.ts +6 -0
- package/dist/chunk-gCX81nOr.d.ts +61 -0
- package/dist/chunk-pcFXCimE.d.ts +741 -0
- package/dist/cli/index.d.ts +1174 -0
- package/dist/cli/index.js +5613 -0
- package/dist/cli/skills/content/index.d.ts +72 -0
- package/dist/cli/skills/content/index.js +335 -0
- package/dist/cli/tools/sdk/child-host.d.ts +61 -0
- package/dist/cli/tools/sdk/child-host.js +131 -0
- package/dist/cli/tools/sdk/index.d.ts +137 -0
- package/dist/cli/tools/sdk/index.js +44 -0
- package/dist/cli-commands/bin/index.js +25 -0
- package/dist/client-logger/index.d.ts +31 -0
- package/dist/client-logger/index.js +63 -0
- package/dist/common/index.d.ts +1103 -0
- package/dist/common/index.js +364 -0
- package/dist/components/index.d.ts +1924 -0
- package/dist/components/index.js +13759 -0
- package/dist/core-events/index.d.ts +155 -0
- package/dist/core-events/index.js +136 -0
- package/dist/core-server/index.d.ts +2200 -0
- package/dist/core-server/index.js +4165 -0
- package/dist/core-server/presets/common-manager.css +170 -0
- package/dist/core-server/presets/common-manager.js +4168 -0
- package/dist/core-server/presets/common-override-preset.js +81 -0
- package/dist/core-server/presets/common-preset.js +2187 -0
- package/dist/create/bin/index.js +23 -0
- package/dist/create/index.js +25 -0
- package/dist/csf/csf-utils.d.ts +2 -0
- package/dist/csf/csf-utils.js +19 -0
- package/dist/csf/index.d.ts +7 -0
- package/dist/csf/index.js +2142 -0
- package/dist/csf-tools/index.d.ts +1157 -0
- package/dist/csf-tools/index.js +736 -0
- package/dist/docs-tools/index.d.ts +197 -0
- package/dist/docs-tools/index.js +61 -0
- package/dist/highlight/index.d.ts +10 -0
- package/dist/highlight/index.js +15 -0
- package/dist/instrumenter/index.d.ts +113 -0
- package/dist/instrumenter/index.js +2595 -0
- package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
- package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
- package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
- package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
- package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
- package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
- package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
- package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
- package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
- package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
- package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
- package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
- package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
- package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
- package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
- package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
- package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
- package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
- package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
- package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
- package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
- package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
- package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
- package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
- package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
- package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
- package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
- package/dist/manager/globals-runtime.js +2 -0
- package/dist/manager/globals.d.ts +23 -0
- package/dist/manager/globals.js +26 -0
- package/dist/manager/manager-stores.d.ts +2 -0
- package/dist/manager/manager-stores.js +19 -0
- package/dist/manager/runtime.js +2 -0
- package/dist/manager-api/index.d.ts +2 -0
- package/dist/manager-api/index.js +3257 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +20 -0
- package/dist/mcp/index.d.ts +270 -0
- package/dist/mcp/index.js +305 -0
- package/dist/mocking-utils/index.d.ts +689 -0
- package/dist/mocking-utils/index.js +521 -0
- package/dist/mocking-utils/mocker-runtime.js +1254 -0
- package/dist/nextjs-vite/config/preview.js +3 -0
- package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
- package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
- package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
- package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
- package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
- package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
- package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
- package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
- package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
- package/dist/nextjs-vite/index.d.ts +92 -0
- package/dist/nextjs-vite/index.js +58 -0
- package/dist/nextjs-vite/node/index.d.ts +6 -0
- package/dist/nextjs-vite/node/index.js +20 -0
- package/dist/nextjs-vite/preset.js +648 -0
- package/dist/nextjs-vite/preview.d.ts +20 -0
- package/dist/nextjs-vite/preview.js +11 -0
- package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
- package/dist/nextjs-vite/vite-plugin/index.js +19 -0
- package/dist/nextjs-vite-plugin/index.d.ts +28 -0
- package/dist/nextjs-vite-plugin/index.js +923 -0
- package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
- package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
- package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
- package/dist/node-logger/index.d.ts +495 -0
- package/dist/node-logger/index.js +42 -0
- package/dist/oxc-parser/index.d.ts +99 -0
- package/dist/oxc-parser/index.js +275 -0
- package/dist/oxc-parser/worker.js +37 -0
- package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
- package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
- package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
- package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
- package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
- package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
- package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
- package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
- package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
- package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
- package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
- package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
- package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
- package/dist/preview/globals.d.ts +16 -0
- package/dist/preview/globals.js +20 -0
- package/dist/preview/runtime.js +6 -0
- package/dist/preview-api/index.d.ts +4 -0
- package/dist/preview-api/index.js +147 -0
- package/dist/preview-errors.d.ts +186 -0
- package/dist/preview-errors.js +56 -0
- package/dist/react/docgen/docgen-worker.js +38 -0
- package/dist/react/entry-preview-argtypes.js +9 -0
- package/dist/react/entry-preview-docs.js +12 -0
- package/dist/react/entry-preview-rsc.js +11 -0
- package/dist/react/entry-preview.js +21 -0
- package/dist/react/index.d.ts +119 -0
- package/dist/react/index.js +26 -0
- package/dist/react/preset.js +301 -0
- package/dist/react/preview.d.ts +2 -0
- package/dist/react/preview.js +11 -0
- package/dist/react-native/bin/get-stories.js +34 -0
- package/dist/react-native/index.d.ts +160 -0
- package/dist/react-native/index.js +1547 -0
- package/dist/react-native/metro/node.d.ts +83 -0
- package/dist/react-native/metro/node.js +21 -0
- package/dist/react-native/metro/withStorybook.d.ts +2269 -0
- package/dist/react-native/metro/withStorybook.js +138 -0
- package/dist/react-native/preview.d.ts +6 -0
- package/dist/react-native/preview.js +20 -0
- package/dist/react-native/scripts/generate.d.ts +22 -0
- package/dist/react-native/scripts/generate.js +18 -0
- package/dist/react-native/stub.js +20 -0
- package/dist/react-native-theming/index.d.ts +175 -0
- package/dist/react-native-theming/index.js +2591 -0
- package/dist/react-native-ui/index.d.ts +130 -0
- package/dist/react-native-ui/index.js +1448 -0
- package/dist/react-native-ui-common/index.d.ts +230 -0
- package/dist/react-native-ui-common/index.js +514 -0
- package/dist/react-vite/index.d.ts +4 -0
- package/dist/react-vite/index.js +8 -0
- package/dist/react-vite/node/index.d.ts +6 -0
- package/dist/react-vite/node/index.js +20 -0
- package/dist/react-vite/preset.d.ts +6 -0
- package/dist/react-vite/preset.js +21 -0
- package/dist/router/index.d.ts +141 -0
- package/dist/router/index.js +1217 -0
- package/dist/server-errors.d.ts +2 -0
- package/dist/server-errors.js +149 -0
- package/dist/shared/open-service/index.d.ts +3 -0
- package/dist/shared/open-service/index.js +115 -0
- package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
- package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
- package/dist/shared/open-service/toolsets/docs/public.js +991 -0
- package/dist/telemetry/index.d.ts +314 -0
- package/dist/telemetry/index.js +103 -0
- package/dist/test/index.d.ts +158 -0
- package/dist/test/index.js +19421 -0
- package/dist/theming/create.d.ts +15 -0
- package/dist/theming/create.js +11 -0
- package/dist/theming/index.d.ts +54 -0
- package/dist/theming/index.js +511 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +48 -0
- package/dist/viewport/index.d.ts +275 -0
- package/dist/viewport/index.js +21 -0
- package/package.json +1054 -4
- package/template/nextjs-vite/cli/.eslintrc.json +6 -0
- package/template/nextjs-vite/cli/js/Button.jsx +42 -0
- package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
- package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
- package/template/nextjs-vite/cli/js/Header.jsx +58 -0
- package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
- package/template/nextjs-vite/cli/js/Page.jsx +68 -0
- package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
- package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
- package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
- package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
- package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
- package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
- package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
- package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
- package/template/react/cli/.eslintrc.json +5 -0
- package/template/react/cli/js/Button.jsx +39 -0
- package/template/react/cli/js/Button.stories.js +49 -0
- package/template/react/cli/js/Header.jsx +56 -0
- package/template/react/cli/js/Header.stories.js +29 -0
- package/template/react/cli/js/Page.jsx +69 -0
- package/template/react/cli/js/Page.stories.js +28 -0
- package/template/react/cli/ts/Button.stories.ts +54 -0
- package/template/react/cli/ts/Button.tsx +37 -0
- package/template/react/cli/ts/Header.stories.ts +34 -0
- package/template/react/cli/ts/Header.tsx +56 -0
- package/template/react/cli/ts/Page.stories.ts +33 -0
- package/template/react/cli/ts/Page.tsx +73 -0
- package/template/react-vite/cli/.eslintrc.json +5 -0
- package/template/react-vite/cli/js/Button.jsx +39 -0
- package/template/react-vite/cli/js/Button.stories.js +49 -0
- package/template/react-vite/cli/js/Header.jsx +56 -0
- package/template/react-vite/cli/js/Header.stories.js +29 -0
- package/template/react-vite/cli/js/Page.jsx +69 -0
- package/template/react-vite/cli/js/Page.stories.js +28 -0
- package/template/react-vite/cli/ts/Button.stories.ts +54 -0
- package/template/react-vite/cli/ts/Button.tsx +37 -0
- package/template/react-vite/cli/ts/Header.stories.ts +34 -0
- package/template/react-vite/cli/ts/Header.tsx +56 -0
- package/template/react-vite/cli/ts/Page.stories.ts +33 -0
- package/template/react-vite/cli/ts/Page.tsx +73 -0
|
@@ -0,0 +1,3767 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ro17f80mg6k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ro17f80mg6k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ro17f80mg6k from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ro17f80mg6k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ro17f80mg6k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Forkbook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
__commonJS,
|
|
14
|
+
__esm,
|
|
15
|
+
__export,
|
|
16
|
+
__toCommonJS
|
|
17
|
+
} from "./chunk-CXRU72ET.js";
|
|
18
|
+
|
|
19
|
+
// ../../node_modules/acorn/dist/acorn.mjs
|
|
20
|
+
var acorn_exports = {};
|
|
21
|
+
__export(acorn_exports, {
|
|
22
|
+
Node: () => Node,
|
|
23
|
+
Parser: () => Parser,
|
|
24
|
+
Position: () => Position,
|
|
25
|
+
SourceLocation: () => SourceLocation,
|
|
26
|
+
TokContext: () => TokContext,
|
|
27
|
+
Token: () => Token,
|
|
28
|
+
TokenType: () => TokenType,
|
|
29
|
+
defaultOptions: () => defaultOptions,
|
|
30
|
+
getLineInfo: () => getLineInfo,
|
|
31
|
+
isIdentifierChar: () => isIdentifierChar,
|
|
32
|
+
isIdentifierStart: () => isIdentifierStart,
|
|
33
|
+
isNewLine: () => isNewLine,
|
|
34
|
+
keywordTypes: () => keywords,
|
|
35
|
+
lineBreak: () => lineBreak,
|
|
36
|
+
lineBreakG: () => lineBreakG,
|
|
37
|
+
nonASCIIwhitespace: () => nonASCIIwhitespace,
|
|
38
|
+
parse: () => parse3,
|
|
39
|
+
parseExpressionAt: () => parseExpressionAt2,
|
|
40
|
+
tokContexts: () => types,
|
|
41
|
+
tokTypes: () => types$1,
|
|
42
|
+
tokenizer: () => tokenizer2,
|
|
43
|
+
version: () => version
|
|
44
|
+
});
|
|
45
|
+
function isInAstralSet(code, set) {
|
|
46
|
+
for (var pos = 65536, i2 = 0; i2 < set.length; i2 += 2) {
|
|
47
|
+
if (pos += set[i2], pos > code)
|
|
48
|
+
return !1;
|
|
49
|
+
if (pos += set[i2 + 1], pos >= code)
|
|
50
|
+
return !0;
|
|
51
|
+
}
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
function isIdentifierStart(code, astral) {
|
|
55
|
+
return code < 65 ? code === 36 : code < 91 ? !0 : code < 97 ? code === 95 : code < 123 ? !0 : code <= 65535 ? code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code)) : astral === !1 ? !1 : isInAstralSet(code, astralIdentifierStartCodes);
|
|
56
|
+
}
|
|
57
|
+
function isIdentifierChar(code, astral) {
|
|
58
|
+
return code < 48 ? code === 36 : code < 58 ? !0 : code < 65 ? !1 : code < 91 ? !0 : code < 97 ? code === 95 : code < 123 ? !0 : code <= 65535 ? code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code)) : astral === !1 ? !1 : isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
59
|
+
}
|
|
60
|
+
function binop(name, prec) {
|
|
61
|
+
return new TokenType(name, { beforeExpr: !0, binop: prec });
|
|
62
|
+
}
|
|
63
|
+
function kw(name, options) {
|
|
64
|
+
return options === void 0 && (options = {}), options.keyword = name, keywords[name] = new TokenType(name, options);
|
|
65
|
+
}
|
|
66
|
+
function isNewLine(code) {
|
|
67
|
+
return code === 10 || code === 13 || code === 8232 || code === 8233;
|
|
68
|
+
}
|
|
69
|
+
function nextLineBreak(code, from, end) {
|
|
70
|
+
end === void 0 && (end = code.length);
|
|
71
|
+
for (var i2 = from; i2 < end; i2++) {
|
|
72
|
+
var next = code.charCodeAt(i2);
|
|
73
|
+
if (isNewLine(next))
|
|
74
|
+
return i2 < end - 1 && next === 13 && code.charCodeAt(i2 + 1) === 10 ? i2 + 2 : i2 + 1;
|
|
75
|
+
}
|
|
76
|
+
return -1;
|
|
77
|
+
}
|
|
78
|
+
function wordsRegexp(words) {
|
|
79
|
+
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
80
|
+
}
|
|
81
|
+
function codePointToString(code) {
|
|
82
|
+
return code <= 65535 ? String.fromCharCode(code) : (code -= 65536, String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320));
|
|
83
|
+
}
|
|
84
|
+
function getLineInfo(input, offset2) {
|
|
85
|
+
for (var line = 1, cur = 0; ; ) {
|
|
86
|
+
var nextBreak = nextLineBreak(input, cur, offset2);
|
|
87
|
+
if (nextBreak < 0)
|
|
88
|
+
return new Position(line, offset2 - cur);
|
|
89
|
+
++line, cur = nextBreak;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function getOptions(opts) {
|
|
93
|
+
var options = {};
|
|
94
|
+
for (var opt in defaultOptions)
|
|
95
|
+
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
|
|
96
|
+
if (options.ecmaVersion === "latest" ? options.ecmaVersion = 1e8 : options.ecmaVersion == null ? (!warnedAboutEcmaVersion && typeof console == "object" && console.warn && (warnedAboutEcmaVersion = !0, console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
97
|
+
Defaulting to 2020, but this will stop working in the future.`)), options.ecmaVersion = 11) : options.ecmaVersion >= 2015 && (options.ecmaVersion -= 2009), options.allowReserved == null && (options.allowReserved = options.ecmaVersion < 5), (!opts || opts.allowHashBang == null) && (options.allowHashBang = options.ecmaVersion >= 14), isArray(options.onToken)) {
|
|
98
|
+
var tokens = options.onToken;
|
|
99
|
+
options.onToken = function(token) {
|
|
100
|
+
return tokens.push(token);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (isArray(options.onComment) && (options.onComment = pushComment(options, options.onComment)), options.sourceType === "commonjs" && options.allowAwaitOutsideFunction)
|
|
104
|
+
throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
105
|
+
return options;
|
|
106
|
+
}
|
|
107
|
+
function pushComment(options, array) {
|
|
108
|
+
return function(block, text, start, end, startLoc, endLoc) {
|
|
109
|
+
var comment = {
|
|
110
|
+
type: block ? "Block" : "Line",
|
|
111
|
+
value: text,
|
|
112
|
+
start,
|
|
113
|
+
end
|
|
114
|
+
};
|
|
115
|
+
options.locations && (comment.loc = new SourceLocation(this, startLoc, endLoc)), options.ranges && (comment.range = [start, end]), array.push(comment);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function functionFlags(async, generator) {
|
|
119
|
+
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
120
|
+
}
|
|
121
|
+
function keywordOpAt(parser, pos) {
|
|
122
|
+
for (var end = pos + 1, stop = Math.min(parser.input.length, pos + 11); end < stop; ) {
|
|
123
|
+
var ch = parser.fullCharCodeAt(end);
|
|
124
|
+
if (!isIdentifierChar(ch, !0))
|
|
125
|
+
break;
|
|
126
|
+
end += ch <= 65535 ? 1 : 2;
|
|
127
|
+
}
|
|
128
|
+
return end === pos + 2 && parser.input.slice(pos, end) === "in" || end === pos + 10 && parser.input.slice(pos, end) === "instanceof";
|
|
129
|
+
}
|
|
130
|
+
function isPrivateNameConflicted(privateNameMap, element) {
|
|
131
|
+
var name = element.key.name, curr = privateNameMap[name], next = "true";
|
|
132
|
+
return element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set") && (next = (element.static ? "s" : "i") + element.kind), curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget" ? (privateNameMap[name] = "true", !1) : curr ? !0 : (privateNameMap[name] = next, !1);
|
|
133
|
+
}
|
|
134
|
+
function checkKeyName(node, name) {
|
|
135
|
+
var computed = node.computed, key = node.key;
|
|
136
|
+
return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name);
|
|
137
|
+
}
|
|
138
|
+
function isLocalVariableAccess(node) {
|
|
139
|
+
return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
|
|
140
|
+
}
|
|
141
|
+
function isPrivateFieldAccess(node) {
|
|
142
|
+
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression);
|
|
143
|
+
}
|
|
144
|
+
function finishNodeAt(node, type, pos, loc) {
|
|
145
|
+
return node.type = type, node.end = pos, this.options.locations && (node.loc.end = loc), this.options.ranges && (node.range[1] = pos), node;
|
|
146
|
+
}
|
|
147
|
+
function buildUnicodeData(ecmaVersion2) {
|
|
148
|
+
var d = data[ecmaVersion2] = {
|
|
149
|
+
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion2] + " " + unicodeGeneralCategoryValues),
|
|
150
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion2]),
|
|
151
|
+
nonBinary: {
|
|
152
|
+
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
153
|
+
Script: wordsRegexp(unicodeScriptValues[ecmaVersion2])
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
d.nonBinary.Script_Extensions = d.nonBinary.Script, d.nonBinary.gc = d.nonBinary.General_Category, d.nonBinary.sc = d.nonBinary.Script, d.nonBinary.scx = d.nonBinary.Script_Extensions;
|
|
157
|
+
}
|
|
158
|
+
function hasProp(obj) {
|
|
159
|
+
for (var _ in obj)
|
|
160
|
+
return !0;
|
|
161
|
+
return !1;
|
|
162
|
+
}
|
|
163
|
+
function isRegularExpressionModifier(ch) {
|
|
164
|
+
return ch === 105 || ch === 109 || ch === 115;
|
|
165
|
+
}
|
|
166
|
+
function isSyntaxCharacter(ch) {
|
|
167
|
+
return ch === 36 || ch >= 40 && ch <= 43 || ch === 46 || ch === 63 || ch >= 91 && ch <= 94 || ch >= 123 && ch <= 125;
|
|
168
|
+
}
|
|
169
|
+
function isRegExpIdentifierStart(ch) {
|
|
170
|
+
return isIdentifierStart(ch, !0) || ch === 36 || ch === 95;
|
|
171
|
+
}
|
|
172
|
+
function isRegExpIdentifierPart(ch) {
|
|
173
|
+
return isIdentifierChar(ch, !0) || ch === 36 || ch === 95 || ch === 8204 || ch === 8205;
|
|
174
|
+
}
|
|
175
|
+
function isControlLetter(ch) {
|
|
176
|
+
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122;
|
|
177
|
+
}
|
|
178
|
+
function isValidUnicode(ch) {
|
|
179
|
+
return ch >= 0 && ch <= 1114111;
|
|
180
|
+
}
|
|
181
|
+
function isCharacterClassEscape(ch) {
|
|
182
|
+
return ch === 100 || ch === 68 || ch === 115 || ch === 83 || ch === 119 || ch === 87;
|
|
183
|
+
}
|
|
184
|
+
function isUnicodePropertyNameCharacter(ch) {
|
|
185
|
+
return isControlLetter(ch) || ch === 95;
|
|
186
|
+
}
|
|
187
|
+
function isUnicodePropertyValueCharacter(ch) {
|
|
188
|
+
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch);
|
|
189
|
+
}
|
|
190
|
+
function isClassSetReservedDoublePunctuatorCharacter(ch) {
|
|
191
|
+
return ch === 33 || ch >= 35 && ch <= 38 || ch >= 42 && ch <= 44 || ch === 46 || ch >= 58 && ch <= 64 || ch === 94 || ch === 96 || ch === 126;
|
|
192
|
+
}
|
|
193
|
+
function isClassSetSyntaxCharacter(ch) {
|
|
194
|
+
return ch === 40 || ch === 41 || ch === 45 || ch === 47 || ch >= 91 && ch <= 93 || ch >= 123 && ch <= 125;
|
|
195
|
+
}
|
|
196
|
+
function isClassSetReservedPunctuator(ch) {
|
|
197
|
+
return ch === 33 || ch === 35 || ch === 37 || ch === 38 || ch === 44 || ch === 45 || ch >= 58 && ch <= 62 || ch === 64 || ch === 96 || ch === 126;
|
|
198
|
+
}
|
|
199
|
+
function isDecimalDigit(ch) {
|
|
200
|
+
return ch >= 48 && ch <= 57;
|
|
201
|
+
}
|
|
202
|
+
function isHexDigit(ch) {
|
|
203
|
+
return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102;
|
|
204
|
+
}
|
|
205
|
+
function hexToInt(ch) {
|
|
206
|
+
return ch >= 65 && ch <= 70 ? 10 + (ch - 65) : ch >= 97 && ch <= 102 ? 10 + (ch - 97) : ch - 48;
|
|
207
|
+
}
|
|
208
|
+
function isOctalDigit(ch) {
|
|
209
|
+
return ch >= 48 && ch <= 55;
|
|
210
|
+
}
|
|
211
|
+
function stringToNumber(str, isLegacyOctalNumericLiteral) {
|
|
212
|
+
return isLegacyOctalNumericLiteral ? parseInt(str, 8) : parseFloat(str.replace(/_/g, ""));
|
|
213
|
+
}
|
|
214
|
+
function stringToBigInt(str) {
|
|
215
|
+
return typeof BigInt != "function" ? null : BigInt(str.replace(/_/g, ""));
|
|
216
|
+
}
|
|
217
|
+
function parse3(input, options) {
|
|
218
|
+
return Parser.parse(input, options);
|
|
219
|
+
}
|
|
220
|
+
function parseExpressionAt2(input, pos, options) {
|
|
221
|
+
return Parser.parseExpressionAt(input, pos, options);
|
|
222
|
+
}
|
|
223
|
+
function tokenizer2(input, options) {
|
|
224
|
+
return Parser.tokenizer(input, options);
|
|
225
|
+
}
|
|
226
|
+
var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars, nonASCIIidentifierStartChars, reservedWords, ecma5AndLessKeywords, keywords$1, keywordRelationalOperator, nonASCIIidentifierStart, nonASCIIidentifier, TokenType, beforeExpr, startsExpr, keywords, types$1, lineBreak, lineBreakG, nonASCIIwhitespace, skipWhiteSpace, ref, hasOwnProperty, toString, hasOwn, isArray, regexpCache, loneSurrogate, Position, SourceLocation, defaultOptions, warnedAboutEcmaVersion, SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, SCOPE_DIRECT_SUPER, SCOPE_CLASS_STATIC_BLOCK, SCOPE_CLASS_FIELD_INIT, SCOPE_SWITCH, SCOPE_VAR, BIND_NONE, BIND_VAR, BIND_LEXICAL, BIND_FUNCTION, BIND_SIMPLE_CATCH, BIND_OUTSIDE, Parser, prototypeAccessors, pp$9, literal, DestructuringErrors, pp$8, loopLabel, switchLabel, empty$1, FUNC_STATEMENT, FUNC_HANGING_STATEMENT, FUNC_NULLABLE_ID, pp$7, TokContext, types, pp$6, pp$5, empty, pp$4, pp$3, Scope, Node, pp$2, scriptValuesAddedInUnicode, ecma9BinaryProperties, ecma10BinaryProperties, ecma11BinaryProperties, ecma12BinaryProperties, ecma13BinaryProperties, ecma14BinaryProperties, unicodeBinaryProperties, ecma14BinaryPropertiesOfStrings, unicodeBinaryPropertiesOfStrings, unicodeGeneralCategoryValues, ecma9ScriptValues, ecma10ScriptValues, ecma11ScriptValues, ecma12ScriptValues, ecma13ScriptValues, ecma14ScriptValues, unicodeScriptValues, data, ecmaVersion, i, list, pp$1, BranchID, RegExpValidationState, CharSetNone, CharSetOk, CharSetString, Token, pp, INVALID_TEMPLATE_ESCAPE_ERROR, version, init_acorn = __esm({
|
|
227
|
+
"../../node_modules/acorn/dist/acorn.mjs"() {
|
|
228
|
+
astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 31, 4, 33, 15, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 7, 0, 259, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 481, 1, 61, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 12, 2, 9, 1, 3, 0, 33, 1, 1357, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239], astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 13, 65, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 18, 21, 18, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 18, 0, 182, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 22, 0, 239, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 111, 6, 206, 13, 310, 2314, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7386, 37, 33, 96, 114, 14, 913, 15, 50, 7710, 3, 2, 6, 2, 1, 2, 296, 10, 0, 30, 2, 3, 0, 15, 4, 8, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 340, 2, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 129, 15, 6, 55, 50, 49, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4382, 2, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489, 39815, 11327], nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05C9\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B53-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1AF0\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65", nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0558\u0559\u0560-\u0588\u058B\u058C\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u208F-\u209F\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DD\uA7E2\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB6C\uAB6D\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC", reservedWords = {
|
|
229
|
+
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
230
|
+
5: "class enum extends super const export import",
|
|
231
|
+
6: "enum",
|
|
232
|
+
strict: "implements interface let package private protected public static yield",
|
|
233
|
+
strictBind: "eval arguments"
|
|
234
|
+
}, ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this", keywords$1 = {
|
|
235
|
+
5: ecma5AndLessKeywords,
|
|
236
|
+
"5module": ecma5AndLessKeywords + " export import",
|
|
237
|
+
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
238
|
+
}, keywordRelationalOperator = /^in(stanceof)?$/, nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"), nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
239
|
+
TokenType = function(label, conf) {
|
|
240
|
+
conf === void 0 && (conf = {}), this.label = label, this.keyword = conf.keyword, this.beforeExpr = !!conf.beforeExpr, this.startsExpr = !!conf.startsExpr, this.isLoop = !!conf.isLoop, this.isAssign = !!conf.isAssign, this.prefix = !!conf.prefix, this.postfix = !!conf.postfix, this.binop = conf.binop || null, this.updateContext = null;
|
|
241
|
+
};
|
|
242
|
+
beforeExpr = { beforeExpr: !0 }, startsExpr = { startsExpr: !0 }, keywords = {};
|
|
243
|
+
types$1 = {
|
|
244
|
+
num: new TokenType("num", startsExpr),
|
|
245
|
+
regexp: new TokenType("regexp", startsExpr),
|
|
246
|
+
string: new TokenType("string", startsExpr),
|
|
247
|
+
name: new TokenType("name", startsExpr),
|
|
248
|
+
privateId: new TokenType("privateId", startsExpr),
|
|
249
|
+
eof: new TokenType("eof"),
|
|
250
|
+
// Punctuation token types.
|
|
251
|
+
bracketL: new TokenType("[", { beforeExpr: !0, startsExpr: !0 }),
|
|
252
|
+
bracketR: new TokenType("]"),
|
|
253
|
+
braceL: new TokenType("{", { beforeExpr: !0, startsExpr: !0 }),
|
|
254
|
+
braceR: new TokenType("}"),
|
|
255
|
+
parenL: new TokenType("(", { beforeExpr: !0, startsExpr: !0 }),
|
|
256
|
+
parenR: new TokenType(")"),
|
|
257
|
+
comma: new TokenType(",", beforeExpr),
|
|
258
|
+
semi: new TokenType(";", beforeExpr),
|
|
259
|
+
colon: new TokenType(":", beforeExpr),
|
|
260
|
+
dot: new TokenType("."),
|
|
261
|
+
question: new TokenType("?", beforeExpr),
|
|
262
|
+
questionDot: new TokenType("?."),
|
|
263
|
+
arrow: new TokenType("=>", beforeExpr),
|
|
264
|
+
template: new TokenType("template"),
|
|
265
|
+
invalidTemplate: new TokenType("invalidTemplate"),
|
|
266
|
+
ellipsis: new TokenType("...", beforeExpr),
|
|
267
|
+
backQuote: new TokenType("`", startsExpr),
|
|
268
|
+
dollarBraceL: new TokenType("${", { beforeExpr: !0, startsExpr: !0 }),
|
|
269
|
+
// Operators. These carry several kinds of properties to help the
|
|
270
|
+
// parser use them properly (the presence of these properties is
|
|
271
|
+
// what categorizes them as operators).
|
|
272
|
+
//
|
|
273
|
+
// `binop`, when present, specifies that this operator is a binary
|
|
274
|
+
// operator, and will refer to its precedence.
|
|
275
|
+
//
|
|
276
|
+
// `prefix` and `postfix` mark the operator as a prefix or postfix
|
|
277
|
+
// unary operator.
|
|
278
|
+
//
|
|
279
|
+
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
|
|
280
|
+
// binary operators with a very low precedence, that should result
|
|
281
|
+
// in AssignmentExpression nodes.
|
|
282
|
+
eq: new TokenType("=", { beforeExpr: !0, isAssign: !0 }),
|
|
283
|
+
assign: new TokenType("_=", { beforeExpr: !0, isAssign: !0 }),
|
|
284
|
+
incDec: new TokenType("++/--", { prefix: !0, postfix: !0, startsExpr: !0 }),
|
|
285
|
+
prefix: new TokenType("!/~", { beforeExpr: !0, prefix: !0, startsExpr: !0 }),
|
|
286
|
+
logicalOR: binop("||", 1),
|
|
287
|
+
logicalAND: binop("&&", 2),
|
|
288
|
+
bitwiseOR: binop("|", 3),
|
|
289
|
+
bitwiseXOR: binop("^", 4),
|
|
290
|
+
bitwiseAND: binop("&", 5),
|
|
291
|
+
equality: binop("==/!=/===/!==", 6),
|
|
292
|
+
relational: binop("</>/<=/>=", 7),
|
|
293
|
+
bitShift: binop("<</>>/>>>", 8),
|
|
294
|
+
plusMin: new TokenType("+/-", { beforeExpr: !0, binop: 9, prefix: !0, startsExpr: !0 }),
|
|
295
|
+
modulo: binop("%", 10),
|
|
296
|
+
star: binop("*", 10),
|
|
297
|
+
slash: binop("/", 10),
|
|
298
|
+
starstar: new TokenType("**", { beforeExpr: !0 }),
|
|
299
|
+
coalesce: binop("??", 1),
|
|
300
|
+
// Keyword token types.
|
|
301
|
+
_break: kw("break"),
|
|
302
|
+
_case: kw("case", beforeExpr),
|
|
303
|
+
_catch: kw("catch"),
|
|
304
|
+
_continue: kw("continue"),
|
|
305
|
+
_debugger: kw("debugger"),
|
|
306
|
+
_default: kw("default", beforeExpr),
|
|
307
|
+
_do: kw("do", { isLoop: !0, beforeExpr: !0 }),
|
|
308
|
+
_else: kw("else", beforeExpr),
|
|
309
|
+
_finally: kw("finally"),
|
|
310
|
+
_for: kw("for", { isLoop: !0 }),
|
|
311
|
+
_function: kw("function", startsExpr),
|
|
312
|
+
_if: kw("if"),
|
|
313
|
+
_return: kw("return", beforeExpr),
|
|
314
|
+
_switch: kw("switch"),
|
|
315
|
+
_throw: kw("throw", beforeExpr),
|
|
316
|
+
_try: kw("try"),
|
|
317
|
+
_var: kw("var"),
|
|
318
|
+
_const: kw("const"),
|
|
319
|
+
_while: kw("while", { isLoop: !0 }),
|
|
320
|
+
_with: kw("with"),
|
|
321
|
+
_new: kw("new", { beforeExpr: !0, startsExpr: !0 }),
|
|
322
|
+
_this: kw("this", startsExpr),
|
|
323
|
+
_super: kw("super", startsExpr),
|
|
324
|
+
_class: kw("class", startsExpr),
|
|
325
|
+
_extends: kw("extends", beforeExpr),
|
|
326
|
+
_export: kw("export"),
|
|
327
|
+
_import: kw("import", startsExpr),
|
|
328
|
+
_null: kw("null", startsExpr),
|
|
329
|
+
_true: kw("true", startsExpr),
|
|
330
|
+
_false: kw("false", startsExpr),
|
|
331
|
+
_in: kw("in", { beforeExpr: !0, binop: 7 }),
|
|
332
|
+
_instanceof: kw("instanceof", { beforeExpr: !0, binop: 7 }),
|
|
333
|
+
_typeof: kw("typeof", { beforeExpr: !0, prefix: !0, startsExpr: !0 }),
|
|
334
|
+
_void: kw("void", { beforeExpr: !0, prefix: !0, startsExpr: !0 }),
|
|
335
|
+
_delete: kw("delete", { beforeExpr: !0, prefix: !0, startsExpr: !0 })
|
|
336
|
+
}, lineBreak = /\r\n?|\n|\u2028|\u2029/, lineBreakG = new RegExp(lineBreak.source, "g");
|
|
337
|
+
nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, ref = Object.prototype, hasOwnProperty = ref.hasOwnProperty, toString = ref.toString, hasOwn = Object.hasOwn || (function(obj, propName) {
|
|
338
|
+
return hasOwnProperty.call(obj, propName);
|
|
339
|
+
}), isArray = Array.isArray || (function(obj) {
|
|
340
|
+
return toString.call(obj) === "[object Array]";
|
|
341
|
+
}), regexpCache = /* @__PURE__ */ Object.create(null);
|
|
342
|
+
loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, Position = function(line, col) {
|
|
343
|
+
this.line = line, this.column = col;
|
|
344
|
+
};
|
|
345
|
+
Position.prototype.offset = function(n) {
|
|
346
|
+
return new Position(this.line, this.column + n);
|
|
347
|
+
};
|
|
348
|
+
SourceLocation = function(p, start, end) {
|
|
349
|
+
this.start = start, this.end = end, p.sourceFile !== null && (this.source = p.sourceFile);
|
|
350
|
+
};
|
|
351
|
+
defaultOptions = {
|
|
352
|
+
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
|
353
|
+
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
|
354
|
+
// (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
|
|
355
|
+
// (the latest version the library supports). This influences
|
|
356
|
+
// support for strict mode, the set of reserved words, and support
|
|
357
|
+
// for new syntax features.
|
|
358
|
+
ecmaVersion: null,
|
|
359
|
+
// `sourceType` indicates the mode the code should be parsed in.
|
|
360
|
+
// Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
|
|
361
|
+
// strict mode and parsing of `import` and `export` declarations.
|
|
362
|
+
sourceType: "script",
|
|
363
|
+
// When set to true, enable strict parsing mode even if `sourceType`
|
|
364
|
+
// is `"script"`.
|
|
365
|
+
strict: !1,
|
|
366
|
+
// `onInsertedSemicolon` can be a callback that will be called when
|
|
367
|
+
// a semicolon is automatically inserted. It will be passed the
|
|
368
|
+
// position of the inserted semicolon as an offset, and if
|
|
369
|
+
// `locations` is enabled, it is given the location as a `{line,
|
|
370
|
+
// column}` object as second argument.
|
|
371
|
+
onInsertedSemicolon: null,
|
|
372
|
+
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
|
|
373
|
+
// trailing commas.
|
|
374
|
+
onTrailingComma: null,
|
|
375
|
+
// By default, reserved words are only enforced if ecmaVersion >= 5.
|
|
376
|
+
// Set `allowReserved` to a boolean value to explicitly turn this on
|
|
377
|
+
// an off. When this option has the value "never", reserved words
|
|
378
|
+
// and keywords can also not be used as property names.
|
|
379
|
+
allowReserved: null,
|
|
380
|
+
// When enabled, a return at the top level is not considered an
|
|
381
|
+
// error.
|
|
382
|
+
allowReturnOutsideFunction: !1,
|
|
383
|
+
// When enabled, import/export statements are not constrained to
|
|
384
|
+
// appearing at the top of the program, and an import.meta expression
|
|
385
|
+
// in a script isn't considered an error.
|
|
386
|
+
allowImportExportEverywhere: !1,
|
|
387
|
+
// By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
|
|
388
|
+
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
|
389
|
+
// but they are still not allowed in non-async functions.
|
|
390
|
+
allowAwaitOutsideFunction: null,
|
|
391
|
+
// When enabled, super identifiers are not constrained to
|
|
392
|
+
// appearing in methods and do not raise an error when they appear elsewhere.
|
|
393
|
+
allowSuperOutsideMethod: null,
|
|
394
|
+
// When enabled, hashbang directive in the beginning of file is
|
|
395
|
+
// allowed and treated as a line comment. Enabled by default when
|
|
396
|
+
// `ecmaVersion` >= 2023.
|
|
397
|
+
allowHashBang: !1,
|
|
398
|
+
// By default, the parser will verify that private properties are
|
|
399
|
+
// only used in places where they are valid and have been declared.
|
|
400
|
+
// Set this to false to turn such checks off.
|
|
401
|
+
checkPrivateFields: !0,
|
|
402
|
+
// When `locations` is on, `loc` properties holding objects with
|
|
403
|
+
// `start` and `end` properties in `{line, column}` form (with
|
|
404
|
+
// line being 1-based and column 0-based) will be attached to the
|
|
405
|
+
// nodes.
|
|
406
|
+
locations: !1,
|
|
407
|
+
// Pass an optional `{line, column}` object to use for the start of
|
|
408
|
+
// the parse. This is mostly useful when using `parseExpressionAt`
|
|
409
|
+
// with `locations: true`, to prevent the parser from having to
|
|
410
|
+
// determine the line position at the start position.
|
|
411
|
+
startLocation: null,
|
|
412
|
+
// A function can be passed as `onToken` option, which will
|
|
413
|
+
// cause Acorn to call that function with object in the same
|
|
414
|
+
// format as tokens returned from `tokenizer().getToken()`. Note
|
|
415
|
+
// that you are not allowed to call the parser from the
|
|
416
|
+
// callback—that will corrupt its internal state.
|
|
417
|
+
onToken: null,
|
|
418
|
+
// A function can be passed as `onComment` option, which will
|
|
419
|
+
// cause Acorn to call that function with `(block, text, start,
|
|
420
|
+
// end)` parameters whenever a comment is skipped. `block` is a
|
|
421
|
+
// boolean indicating whether this is a block (`/* */`) comment,
|
|
422
|
+
// `text` is the content of the comment, and `start` and `end` are
|
|
423
|
+
// character offsets that denote the start and end of the comment.
|
|
424
|
+
// When the `locations` option is on, two more parameters are
|
|
425
|
+
// passed, the full `{line, column}` locations of the start and
|
|
426
|
+
// end of the comments. Note that you are not allowed to call the
|
|
427
|
+
// parser from the callback—that will corrupt its internal state.
|
|
428
|
+
// When this option has an array as value, objects representing the
|
|
429
|
+
// comments are pushed to it.
|
|
430
|
+
onComment: null,
|
|
431
|
+
// Nodes have their start and end characters offsets recorded in
|
|
432
|
+
// `start` and `end` properties (directly on the node, rather than
|
|
433
|
+
// the `loc` object, which holds line/column data. To also add a
|
|
434
|
+
// [semi-standardized][range] `range` property holding a `[start,
|
|
435
|
+
// end]` array with the same numbers, set the `ranges` option to
|
|
436
|
+
// `true`.
|
|
437
|
+
//
|
|
438
|
+
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
|
|
439
|
+
ranges: !1,
|
|
440
|
+
// It is possible to parse multiple files into a single AST by
|
|
441
|
+
// passing the tree produced by parsing the first file as
|
|
442
|
+
// `program` option in subsequent parses. This will add the
|
|
443
|
+
// toplevel forms of the parsed file to the `Program` (top) node
|
|
444
|
+
// of an existing parse tree.
|
|
445
|
+
program: null,
|
|
446
|
+
// When `locations` is on, you can pass this to record the source
|
|
447
|
+
// file in every node's `loc` object.
|
|
448
|
+
sourceFile: null,
|
|
449
|
+
// This value, if given, is stored in every node, whether
|
|
450
|
+
// `locations` is on or off.
|
|
451
|
+
directSourceFile: null,
|
|
452
|
+
// When enabled, parenthesized expressions are represented by
|
|
453
|
+
// (non-standard) ParenthesizedExpression nodes
|
|
454
|
+
preserveParens: !1
|
|
455
|
+
}, warnedAboutEcmaVersion = !1;
|
|
456
|
+
SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
457
|
+
BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5, Parser = function(options, input, startPos) {
|
|
458
|
+
this.options = options = getOptions(options), this.sourceFile = options.sourceFile, this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
459
|
+
var reserved = "";
|
|
460
|
+
options.allowReserved !== !0 && (reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3], options.sourceType === "module" && (reserved += " await")), this.reservedWords = wordsRegexp(reserved);
|
|
461
|
+
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
|
|
462
|
+
this.reservedWordsStrict = wordsRegexp(reservedStrict), this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind), this.input = String(input), this.containsEsc = !1, this.pos = startPos || 0, this.curLine = 1, options.startLocation ? (this.lineStart = this.pos - options.startLocation.column, this.curLine = options.startLocation.line) : startPos ? (this.lineStart = this.input.lastIndexOf(`
|
|
463
|
+
`, startPos - 1) + 1, this.options.locations && (this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length)) : this.lineStart = 0, this.type = types$1.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = options.sourceType === "module", this.strict = this.inModule || options.strict === !0 || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = /* @__PURE__ */ Object.create(null), this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(
|
|
464
|
+
this.options.sourceType === "commonjs" ? SCOPE_FUNCTION : SCOPE_TOP
|
|
465
|
+
), this.regexpState = null, this.privateNameStack = [];
|
|
466
|
+
}, prototypeAccessors = { inFunction: { configurable: !0 }, inGenerator: { configurable: !0 }, inAsync: { configurable: !0 }, canAwait: { configurable: !0 }, allowReturn: { configurable: !0 }, allowSuper: { configurable: !0 }, allowDirectSuper: { configurable: !0 }, treatFunctionsAsVar: { configurable: !0 }, allowNewDotTarget: { configurable: !0 }, allowUsing: { configurable: !0 }, inClassStaticBlock: { configurable: !0 } };
|
|
467
|
+
Parser.prototype.parse = function() {
|
|
468
|
+
var this$1$1 = this, node = this.options.program || this.startNode();
|
|
469
|
+
return this.nextToken(), this.catchStackOverflow(function() {
|
|
470
|
+
return this$1$1.parseTopLevel(node);
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
prototypeAccessors.inFunction.get = function() {
|
|
474
|
+
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
|
|
475
|
+
};
|
|
476
|
+
prototypeAccessors.inGenerator.get = function() {
|
|
477
|
+
return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0;
|
|
478
|
+
};
|
|
479
|
+
prototypeAccessors.inAsync.get = function() {
|
|
480
|
+
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0;
|
|
481
|
+
};
|
|
482
|
+
prototypeAccessors.canAwait.get = function() {
|
|
483
|
+
for (var i2 = this.scopeStack.length - 1; i2 >= 0; i2--) {
|
|
484
|
+
var ref2 = this.scopeStack[i2], flags = ref2.flags;
|
|
485
|
+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT))
|
|
486
|
+
return !1;
|
|
487
|
+
if (flags & SCOPE_FUNCTION)
|
|
488
|
+
return (flags & SCOPE_ASYNC) > 0;
|
|
489
|
+
}
|
|
490
|
+
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
491
|
+
};
|
|
492
|
+
prototypeAccessors.allowReturn.get = function() {
|
|
493
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP);
|
|
494
|
+
};
|
|
495
|
+
prototypeAccessors.allowSuper.get = function() {
|
|
496
|
+
var ref2 = this.currentThisScope(), flags = ref2.flags;
|
|
497
|
+
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
|
|
498
|
+
};
|
|
499
|
+
prototypeAccessors.allowDirectSuper.get = function() {
|
|
500
|
+
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
|
|
501
|
+
};
|
|
502
|
+
prototypeAccessors.treatFunctionsAsVar.get = function() {
|
|
503
|
+
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
504
|
+
};
|
|
505
|
+
prototypeAccessors.allowNewDotTarget.get = function() {
|
|
506
|
+
for (var i2 = this.scopeStack.length - 1; i2 >= 0; i2--) {
|
|
507
|
+
var ref2 = this.scopeStack[i2], flags = ref2.flags;
|
|
508
|
+
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW))
|
|
509
|
+
return !0;
|
|
510
|
+
}
|
|
511
|
+
return !1;
|
|
512
|
+
};
|
|
513
|
+
prototypeAccessors.allowUsing.get = function() {
|
|
514
|
+
var ref2 = this.currentScope(), flags = ref2.flags;
|
|
515
|
+
return !(flags & SCOPE_SWITCH || !this.inModule && flags & SCOPE_TOP);
|
|
516
|
+
};
|
|
517
|
+
prototypeAccessors.inClassStaticBlock.get = function() {
|
|
518
|
+
return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
|
|
519
|
+
};
|
|
520
|
+
Parser.extend = function() {
|
|
521
|
+
for (var plugins = [], len = arguments.length; len--; ) plugins[len] = arguments[len];
|
|
522
|
+
for (var cls = this, i2 = 0; i2 < plugins.length; i2++)
|
|
523
|
+
cls = plugins[i2](cls);
|
|
524
|
+
return cls;
|
|
525
|
+
};
|
|
526
|
+
Parser.parse = function(input, options) {
|
|
527
|
+
return new this(options, input).parse();
|
|
528
|
+
};
|
|
529
|
+
Parser.parseExpressionAt = function(input, pos, options) {
|
|
530
|
+
var parser = new this(options, input, pos);
|
|
531
|
+
return parser.nextToken(), parser.parseExpression();
|
|
532
|
+
};
|
|
533
|
+
Parser.tokenizer = function(input, options) {
|
|
534
|
+
return new this(options, input);
|
|
535
|
+
};
|
|
536
|
+
Object.defineProperties(Parser.prototype, prototypeAccessors);
|
|
537
|
+
pp$9 = Parser.prototype, literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
538
|
+
pp$9.strictDirective = function(start) {
|
|
539
|
+
if (this.options.ecmaVersion < 5)
|
|
540
|
+
return !1;
|
|
541
|
+
for (; ; ) {
|
|
542
|
+
skipWhiteSpace.lastIndex = start, start += skipWhiteSpace.exec(this.input)[0].length;
|
|
543
|
+
var match = literal.exec(this.input.slice(start));
|
|
544
|
+
if (!match)
|
|
545
|
+
return !1;
|
|
546
|
+
if ((match[1] || match[2]) === "use strict") {
|
|
547
|
+
skipWhiteSpace.lastIndex = start + match[0].length;
|
|
548
|
+
var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length, next = this.input.charAt(end);
|
|
549
|
+
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=" || next === "i" && keywordOpAt(this, end));
|
|
550
|
+
}
|
|
551
|
+
start += match[0].length, skipWhiteSpace.lastIndex = start, start += skipWhiteSpace.exec(this.input)[0].length, this.input[start] === ";" && start++;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
pp$9.eat = function(type) {
|
|
555
|
+
return this.type === type ? (this.next(), !0) : !1;
|
|
556
|
+
};
|
|
557
|
+
pp$9.isContextual = function(name) {
|
|
558
|
+
return this.type === types$1.name && this.value === name && !this.containsEsc;
|
|
559
|
+
};
|
|
560
|
+
pp$9.eatContextual = function(name) {
|
|
561
|
+
return this.isContextual(name) ? (this.next(), !0) : !1;
|
|
562
|
+
};
|
|
563
|
+
pp$9.catchStackOverflow = function(f) {
|
|
564
|
+
try {
|
|
565
|
+
return f();
|
|
566
|
+
} catch (e) {
|
|
567
|
+
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
|
|
568
|
+
this.raise(this.start, "Not enough stack space to parse input");
|
|
569
|
+
else
|
|
570
|
+
throw e;
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
pp$9.expectContextual = function(name) {
|
|
574
|
+
this.eatContextual(name) || this.unexpected();
|
|
575
|
+
};
|
|
576
|
+
pp$9.canInsertSemicolon = function() {
|
|
577
|
+
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
|
578
|
+
};
|
|
579
|
+
pp$9.insertSemicolon = function() {
|
|
580
|
+
if (this.canInsertSemicolon())
|
|
581
|
+
return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
582
|
+
};
|
|
583
|
+
pp$9.semicolon = function() {
|
|
584
|
+
!this.eat(types$1.semi) && !this.insertSemicolon() && this.unexpected();
|
|
585
|
+
};
|
|
586
|
+
pp$9.afterTrailingComma = function(tokType, notNext) {
|
|
587
|
+
if (this.type === tokType)
|
|
588
|
+
return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), notNext || this.next(), !0;
|
|
589
|
+
};
|
|
590
|
+
pp$9.expect = function(type) {
|
|
591
|
+
this.eat(type) || this.unexpected();
|
|
592
|
+
};
|
|
593
|
+
pp$9.unexpected = function(pos) {
|
|
594
|
+
this.raise(pos ?? this.start, "Unexpected token");
|
|
595
|
+
};
|
|
596
|
+
DestructuringErrors = function() {
|
|
597
|
+
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
598
|
+
};
|
|
599
|
+
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
600
|
+
if (refDestructuringErrors) {
|
|
601
|
+
refDestructuringErrors.trailingComma > -1 && this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
|
|
602
|
+
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
|
|
603
|
+
parens > -1 && this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
607
|
+
if (!refDestructuringErrors)
|
|
608
|
+
return !1;
|
|
609
|
+
var shorthandAssign = refDestructuringErrors.shorthandAssign, doubleProto = refDestructuringErrors.doubleProto;
|
|
610
|
+
if (!andThrow)
|
|
611
|
+
return shorthandAssign >= 0 || doubleProto >= 0;
|
|
612
|
+
shorthandAssign >= 0 && this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns"), doubleProto >= 0 && this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
|
|
613
|
+
};
|
|
614
|
+
pp$9.checkYieldAwaitInDefaultParams = function() {
|
|
615
|
+
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
616
|
+
};
|
|
617
|
+
pp$9.isSimpleAssignTarget = function(expr) {
|
|
618
|
+
return expr.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(expr.expression) : expr.type === "Identifier" || expr.type === "MemberExpression";
|
|
619
|
+
};
|
|
620
|
+
pp$8 = Parser.prototype;
|
|
621
|
+
pp$8.parseTopLevel = function(node) {
|
|
622
|
+
var exports$1 = /* @__PURE__ */ Object.create(null);
|
|
623
|
+
for (node.body || (node.body = []); this.type !== types$1.eof; ) {
|
|
624
|
+
var stmt = this.parseStatement(null, !0, exports$1);
|
|
625
|
+
node.body.push(stmt);
|
|
626
|
+
}
|
|
627
|
+
if (this.inModule)
|
|
628
|
+
for (var i2 = 0, list2 = Object.keys(this.undefinedExports); i2 < list2.length; i2 += 1) {
|
|
629
|
+
var name = list2[i2];
|
|
630
|
+
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
631
|
+
}
|
|
632
|
+
return this.adaptDirectivePrologue(node.body), this.next(), node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(node, "Program");
|
|
633
|
+
};
|
|
634
|
+
loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
|
|
635
|
+
pp$8.isLet = function(context) {
|
|
636
|
+
if (this.options.ecmaVersion < 6 || !this.isContextual("let"))
|
|
637
|
+
return !1;
|
|
638
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
639
|
+
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
|
|
640
|
+
if (nextCh === 91 || nextCh === 92)
|
|
641
|
+
return !0;
|
|
642
|
+
if (context)
|
|
643
|
+
return !1;
|
|
644
|
+
if (nextCh === 123)
|
|
645
|
+
return !0;
|
|
646
|
+
if (isIdentifierStart(nextCh)) {
|
|
647
|
+
var start = next;
|
|
648
|
+
do
|
|
649
|
+
next += nextCh <= 65535 ? 1 : 2;
|
|
650
|
+
while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)));
|
|
651
|
+
if (nextCh === 92)
|
|
652
|
+
return !0;
|
|
653
|
+
var ident = this.input.slice(start, next);
|
|
654
|
+
if (!keywordRelationalOperator.test(ident))
|
|
655
|
+
return !0;
|
|
656
|
+
}
|
|
657
|
+
return !1;
|
|
658
|
+
};
|
|
659
|
+
pp$8.isAsyncFunction = function() {
|
|
660
|
+
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
|
|
661
|
+
return !1;
|
|
662
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
663
|
+
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, after;
|
|
664
|
+
return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92));
|
|
665
|
+
};
|
|
666
|
+
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
|
|
667
|
+
if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using"))
|
|
668
|
+
return !1;
|
|
669
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
670
|
+
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length;
|
|
671
|
+
if (lineBreak.test(this.input.slice(this.pos, next)))
|
|
672
|
+
return !1;
|
|
673
|
+
if (isAwaitUsing) {
|
|
674
|
+
var usingEndPos = next + 5, after;
|
|
675
|
+
if (this.input.slice(next, usingEndPos) !== "using" || usingEndPos === this.input.length || isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) || after === 92)
|
|
676
|
+
return !1;
|
|
677
|
+
skipWhiteSpace.lastIndex = usingEndPos;
|
|
678
|
+
var skipAfterUsing = skipWhiteSpace.exec(this.input);
|
|
679
|
+
if (next = usingEndPos + skipAfterUsing[0].length, skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next)))
|
|
680
|
+
return !1;
|
|
681
|
+
}
|
|
682
|
+
var ch = this.fullCharCodeAt(next);
|
|
683
|
+
if (!isIdentifierStart(ch) && ch !== 92)
|
|
684
|
+
return !1;
|
|
685
|
+
var idStart = next;
|
|
686
|
+
do
|
|
687
|
+
next += ch <= 65535 ? 1 : 2;
|
|
688
|
+
while (isIdentifierChar(ch = this.fullCharCodeAt(next)));
|
|
689
|
+
if (ch === 92)
|
|
690
|
+
return !0;
|
|
691
|
+
var id = this.input.slice(idStart, next);
|
|
692
|
+
if (keywordRelationalOperator.test(id))
|
|
693
|
+
return !1;
|
|
694
|
+
if (isFor && !isAwaitUsing && id === "of") {
|
|
695
|
+
skipWhiteSpace.lastIndex = next;
|
|
696
|
+
var skipAfterOf = skipWhiteSpace.exec(this.input);
|
|
697
|
+
if (next = next + skipAfterOf[0].length, this.input.charCodeAt(next) !== 61 || // Check for ==, === and => operators
|
|
698
|
+
(ch = this.input.charCodeAt(next + 1)) === 61 || ch === 62)
|
|
699
|
+
return !1;
|
|
700
|
+
}
|
|
701
|
+
return !0;
|
|
702
|
+
};
|
|
703
|
+
pp$8.isAwaitUsing = function(isFor) {
|
|
704
|
+
return this.isUsingKeyword(!0, isFor);
|
|
705
|
+
};
|
|
706
|
+
pp$8.isUsing = function(isFor) {
|
|
707
|
+
return this.isUsingKeyword(!1, isFor);
|
|
708
|
+
};
|
|
709
|
+
pp$8.parseStatement = function(context, topLevel, exports$1) {
|
|
710
|
+
var starttype = this.type, node = this.startNode(), kind;
|
|
711
|
+
switch (this.isLet(context) && (starttype = types$1._var, kind = "let"), starttype) {
|
|
712
|
+
case types$1._break:
|
|
713
|
+
case types$1._continue:
|
|
714
|
+
return this.parseBreakContinueStatement(node, starttype.keyword);
|
|
715
|
+
case types$1._debugger:
|
|
716
|
+
return this.parseDebuggerStatement(node);
|
|
717
|
+
case types$1._do:
|
|
718
|
+
return this.parseDoStatement(node);
|
|
719
|
+
case types$1._for:
|
|
720
|
+
return this.parseForStatement(node);
|
|
721
|
+
case types$1._function:
|
|
722
|
+
return context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6 && this.unexpected(), this.parseFunctionStatement(node, !1, !context);
|
|
723
|
+
case types$1._class:
|
|
724
|
+
return context && this.unexpected(), this.parseClass(node, !0);
|
|
725
|
+
case types$1._if:
|
|
726
|
+
return this.parseIfStatement(node);
|
|
727
|
+
case types$1._return:
|
|
728
|
+
return this.parseReturnStatement(node);
|
|
729
|
+
case types$1._switch:
|
|
730
|
+
return this.parseSwitchStatement(node);
|
|
731
|
+
case types$1._throw:
|
|
732
|
+
return this.parseThrowStatement(node);
|
|
733
|
+
case types$1._try:
|
|
734
|
+
return this.parseTryStatement(node);
|
|
735
|
+
case types$1._const:
|
|
736
|
+
case types$1._var:
|
|
737
|
+
return kind = kind || this.value, context && kind !== "var" && this.unexpected(), this.parseVarStatement(node, kind);
|
|
738
|
+
case types$1._while:
|
|
739
|
+
return this.parseWhileStatement(node);
|
|
740
|
+
case types$1._with:
|
|
741
|
+
return this.parseWithStatement(node);
|
|
742
|
+
case types$1.braceL:
|
|
743
|
+
return this.parseBlock(!0, node);
|
|
744
|
+
case types$1.semi:
|
|
745
|
+
return this.parseEmptyStatement(node);
|
|
746
|
+
case types$1._export:
|
|
747
|
+
case types$1._import:
|
|
748
|
+
if (this.options.ecmaVersion > 10 && starttype === types$1._import) {
|
|
749
|
+
skipWhiteSpace.lastIndex = this.pos;
|
|
750
|
+
var skip = skipWhiteSpace.exec(this.input), next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
|
751
|
+
if (nextCh === 40 || nextCh === 46)
|
|
752
|
+
return this.parseExpressionStatement(node, this.parseExpression());
|
|
753
|
+
}
|
|
754
|
+
return this.options.allowImportExportEverywhere || (topLevel || this.raise(this.start, "'import' and 'export' may only appear at the top level"), this.inModule || this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")), starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
|
|
755
|
+
// If the statement does not start with a statement keyword or a
|
|
756
|
+
// brace, it's an ExpressionStatement or LabeledStatement. We
|
|
757
|
+
// simply start parsing an expression, and afterwards, if the
|
|
758
|
+
// next token is a colon and the expression was a simple
|
|
759
|
+
// Identifier node, we switch to interpreting it as a label.
|
|
760
|
+
default:
|
|
761
|
+
if (this.isAsyncFunction())
|
|
762
|
+
return context && this.unexpected(), this.next(), this.parseFunctionStatement(node, !0, !context);
|
|
763
|
+
var usingKind = this.isAwaitUsing(!1) ? "await using" : this.isUsing(!1) ? "using" : null;
|
|
764
|
+
if (usingKind)
|
|
765
|
+
return this.allowUsing || this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"), context && this.raise(this.start, "Using declaration is not allowed in single-statement positions"), usingKind === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.next(), this.parseVar(node, !1, usingKind), this.semicolon(), this.finishNode(node, "VariableDeclaration");
|
|
766
|
+
var maybeName = this.value, expr = this.parseExpression();
|
|
767
|
+
return starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon) ? this.parseLabeledStatement(node, maybeName, expr, context) : this.parseExpressionStatement(node, expr);
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
771
|
+
var isBreak = keyword === "break";
|
|
772
|
+
this.next(), this.eat(types$1.semi) || this.insertSemicolon() ? node.label = null : this.type !== types$1.name ? this.unexpected() : (node.label = this.parseIdent(), this.semicolon());
|
|
773
|
+
for (var i2 = 0; i2 < this.labels.length; ++i2) {
|
|
774
|
+
var lab = this.labels[i2];
|
|
775
|
+
if ((node.label == null || lab.name === node.label.name) && (lab.kind != null && (isBreak || lab.kind === "loop") || node.label && isBreak))
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
return i2 === this.labels.length && this.raise(node.start, "Unsyntactic " + keyword), this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
|
779
|
+
};
|
|
780
|
+
pp$8.parseDebuggerStatement = function(node) {
|
|
781
|
+
return this.next(), this.semicolon(), this.finishNode(node, "DebuggerStatement");
|
|
782
|
+
};
|
|
783
|
+
pp$8.parseDoStatement = function(node) {
|
|
784
|
+
return this.next(), this.labels.push(loopLabel), node.body = this.parseStatement("do"), this.labels.pop(), this.expect(types$1._while), node.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(types$1.semi) : this.semicolon(), this.finishNode(node, "DoWhileStatement");
|
|
785
|
+
};
|
|
786
|
+
pp$8.parseForStatement = function(node) {
|
|
787
|
+
this.next();
|
|
788
|
+
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
789
|
+
if (this.labels.push(loopLabel), this.enterScope(0), this.expect(types$1.parenL), this.type === types$1.semi)
|
|
790
|
+
return awaitAt > -1 && this.unexpected(awaitAt), this.parseFor(node, null);
|
|
791
|
+
var isLet = this.isLet();
|
|
792
|
+
if (this.type === types$1._var || this.type === types$1._const || isLet) {
|
|
793
|
+
var init$1 = this.startNode(), kind = isLet ? "let" : this.value;
|
|
794
|
+
return this.next(), this.parseVar(init$1, !0, kind), this.finishNode(init$1, "VariableDeclaration"), this.parseForAfterInit(node, init$1, awaitAt);
|
|
795
|
+
}
|
|
796
|
+
var startsWithLet = this.isContextual("let"), isForOf = !1, usingKind = this.isUsing(!0) ? "using" : this.isAwaitUsing(!0) ? "await using" : null;
|
|
797
|
+
if (usingKind) {
|
|
798
|
+
var init$2 = this.startNode();
|
|
799
|
+
return this.next(), usingKind === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.parseVar(init$2, !0, usingKind), this.finishNode(init$2, "VariableDeclaration"), this.parseForAfterInit(node, init$2, awaitAt);
|
|
800
|
+
}
|
|
801
|
+
var containsEsc = this.containsEsc, refDestructuringErrors = new DestructuringErrors(), initPos = this.start, init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(!0, refDestructuringErrors);
|
|
802
|
+
return this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (awaitAt > -1 ? (this.type === types$1._in && this.unexpected(awaitAt), node.await = !0) : isForOf && this.options.ecmaVersion >= 8 && (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (node.await = !1)), startsWithLet && isForOf && this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(init, !1, refDestructuringErrors), this.checkLValPattern(init), this.parseForIn(node, init)) : (this.checkExpressionErrors(refDestructuringErrors, !0), awaitAt > -1 && this.unexpected(awaitAt), this.parseFor(node, init));
|
|
803
|
+
};
|
|
804
|
+
pp$8.parseForAfterInit = function(node, init, awaitAt) {
|
|
805
|
+
return (this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1 ? (this.type === types$1._in ? ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init && this.raise(this.start, "Using declaration is not allowed in for-in loops"), this.options.ecmaVersion >= 9 && awaitAt > -1 && this.unexpected(awaitAt)) : this.options.ecmaVersion >= 9 && (node.await = awaitAt > -1), this.parseForIn(node, init)) : (awaitAt > -1 && this.unexpected(awaitAt), this.parseFor(node, init));
|
|
806
|
+
};
|
|
807
|
+
pp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {
|
|
808
|
+
return this.next(), this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), !1, isAsync);
|
|
809
|
+
};
|
|
810
|
+
pp$8.parseIfStatement = function(node) {
|
|
811
|
+
return this.next(), node.test = this.parseParenExpression(), node.consequent = this.parseStatement("if"), node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null, this.finishNode(node, "IfStatement");
|
|
812
|
+
};
|
|
813
|
+
pp$8.parseReturnStatement = function(node) {
|
|
814
|
+
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(types$1.semi) || this.insertSemicolon() ? node.argument = null : (node.argument = this.parseExpression(), this.semicolon()), this.finishNode(node, "ReturnStatement");
|
|
815
|
+
};
|
|
816
|
+
pp$8.parseSwitchStatement = function(node) {
|
|
817
|
+
this.next(), node.discriminant = this.parseParenExpression(), node.cases = [], this.expect(types$1.braceL), this.labels.push(switchLabel), this.enterScope(SCOPE_SWITCH);
|
|
818
|
+
for (var cur, sawDefault = !1; this.type !== types$1.braceR; )
|
|
819
|
+
if (this.type === types$1._case || this.type === types$1._default) {
|
|
820
|
+
var isCase = this.type === types$1._case;
|
|
821
|
+
cur && this.finishNode(cur, "SwitchCase"), node.cases.push(cur = this.startNode()), cur.consequent = [], this.next(), isCase ? cur.test = this.parseExpression() : (sawDefault && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), sawDefault = !0, cur.test = null), this.expect(types$1.colon);
|
|
822
|
+
} else
|
|
823
|
+
cur || this.unexpected(), cur.consequent.push(this.parseStatement(null));
|
|
824
|
+
return this.exitScope(), cur && this.finishNode(cur, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(node, "SwitchStatement");
|
|
825
|
+
};
|
|
826
|
+
pp$8.parseThrowStatement = function(node) {
|
|
827
|
+
return this.next(), lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), node.argument = this.parseExpression(), this.semicolon(), this.finishNode(node, "ThrowStatement");
|
|
828
|
+
};
|
|
829
|
+
empty$1 = [];
|
|
830
|
+
pp$8.parseCatchClauseParam = function() {
|
|
831
|
+
var param = this.parseBindingAtom(), simple = param.type === "Identifier";
|
|
832
|
+
return this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0), this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL), this.expect(types$1.parenR), param;
|
|
833
|
+
};
|
|
834
|
+
pp$8.parseTryStatement = function(node) {
|
|
835
|
+
if (this.next(), node.block = this.parseBlock(), node.handler = null, this.type === types$1._catch) {
|
|
836
|
+
var clause = this.startNode();
|
|
837
|
+
this.next(), this.eat(types$1.parenL) ? clause.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), clause.param = null, this.enterScope(0)), clause.body = this.parseBlock(!1), this.exitScope(), node.handler = this.finishNode(clause, "CatchClause");
|
|
838
|
+
}
|
|
839
|
+
return node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null, !node.handler && !node.finalizer && this.raise(node.start, "Missing catch or finally clause"), this.finishNode(node, "TryStatement");
|
|
840
|
+
};
|
|
841
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
842
|
+
return this.next(), this.parseVar(node, !1, kind, allowMissingInitializer), this.semicolon(), this.finishNode(node, "VariableDeclaration");
|
|
843
|
+
};
|
|
844
|
+
pp$8.parseWhileStatement = function(node) {
|
|
845
|
+
return this.next(), node.test = this.parseParenExpression(), this.labels.push(loopLabel), node.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(node, "WhileStatement");
|
|
846
|
+
};
|
|
847
|
+
pp$8.parseWithStatement = function(node) {
|
|
848
|
+
return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), node.object = this.parseParenExpression(), node.body = this.parseStatement("with"), this.finishNode(node, "WithStatement");
|
|
849
|
+
};
|
|
850
|
+
pp$8.parseEmptyStatement = function(node) {
|
|
851
|
+
return this.next(), this.finishNode(node, "EmptyStatement");
|
|
852
|
+
};
|
|
853
|
+
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
854
|
+
for (var i$1 = 0, list2 = this.labels; i$1 < list2.length; i$1 += 1) {
|
|
855
|
+
var label = list2[i$1];
|
|
856
|
+
label.name === maybeName && this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
857
|
+
}
|
|
858
|
+
for (var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null, i2 = this.labels.length - 1; i2 >= 0; i2--) {
|
|
859
|
+
var label$1 = this.labels[i2];
|
|
860
|
+
if (label$1.statementStart === node.start)
|
|
861
|
+
label$1.statementStart = this.start, label$1.kind = kind;
|
|
862
|
+
else
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
return this.labels.push({ name: maybeName, kind, statementStart: this.start }), node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label"), this.labels.pop(), node.label = expr, this.finishNode(node, "LabeledStatement");
|
|
866
|
+
};
|
|
867
|
+
pp$8.parseExpressionStatement = function(node, expr) {
|
|
868
|
+
return node.expression = expr, this.semicolon(), this.finishNode(node, "ExpressionStatement");
|
|
869
|
+
};
|
|
870
|
+
pp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {
|
|
871
|
+
for (createNewLexicalScope === void 0 && (createNewLexicalScope = !0), node === void 0 && (node = this.startNode()), node.body = [], this.expect(types$1.braceL), createNewLexicalScope && this.enterScope(0); this.type !== types$1.braceR; ) {
|
|
872
|
+
var stmt = this.parseStatement(null);
|
|
873
|
+
node.body.push(stmt);
|
|
874
|
+
}
|
|
875
|
+
return exitStrict && (this.strict = !1), this.next(), createNewLexicalScope && this.exitScope(), this.finishNode(node, "BlockStatement");
|
|
876
|
+
};
|
|
877
|
+
pp$8.parseFor = function(node, init) {
|
|
878
|
+
return node.init = init, this.expect(types$1.semi), node.test = this.type === types$1.semi ? null : this.parseExpression(), this.expect(types$1.semi), node.update = this.type === types$1.parenR ? null : this.parseExpression(), this.expect(types$1.parenR), node.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(node, "ForStatement");
|
|
879
|
+
};
|
|
880
|
+
pp$8.parseForIn = function(node, init) {
|
|
881
|
+
var isForIn = this.type === types$1._in;
|
|
882
|
+
return this.next(), init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier") && this.raise(
|
|
883
|
+
init.start,
|
|
884
|
+
(isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"
|
|
885
|
+
), node.left = init, node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(), this.expect(types$1.parenR), node.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
|
|
886
|
+
};
|
|
887
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
888
|
+
for (node.declarations = [], node.kind = kind; ; ) {
|
|
889
|
+
var decl = this.startNode();
|
|
890
|
+
if (this.parseVarId(decl, kind), this.eat(types$1.eq) ? decl.init = this.parseMaybeAssign(isFor) : !allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of") ? this.raise(this.lastTokEnd, "Missing initializer in " + kind + " declaration") : !allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : decl.init = null, node.declarations.push(this.finishNode(decl, "VariableDeclarator")), !this.eat(types$1.comma))
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
893
|
+
return node;
|
|
894
|
+
};
|
|
895
|
+
pp$8.parseVarId = function(decl, kind) {
|
|
896
|
+
decl.id = kind === "using" || kind === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, !1);
|
|
897
|
+
};
|
|
898
|
+
FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
|
|
899
|
+
pp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {
|
|
900
|
+
this.initFunction(node), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) && (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT && this.unexpected(), node.generator = this.eat(types$1.star)), this.options.ecmaVersion >= 8 && (node.async = !!isAsync), statement & FUNC_STATEMENT && (node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(), node.id && !(statement & FUNC_HANGING_STATEMENT) && this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION));
|
|
901
|
+
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
902
|
+
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(functionFlags(node.async, node.generator)), statement & FUNC_STATEMENT || (node.id = this.type === types$1.name ? this.parseIdent() : null), this.parseFunctionParams(node), this.parseFunctionBody(node, allowExpressionBody, !1, forInit), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.awaitIdentPos = oldAwaitIdentPos, this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression");
|
|
903
|
+
};
|
|
904
|
+
pp$8.parseFunctionParams = function(node) {
|
|
905
|
+
this.expect(types$1.parenL), node.params = this.parseBindingList(types$1.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
906
|
+
};
|
|
907
|
+
pp$8.parseClass = function(node, isStatement) {
|
|
908
|
+
this.next();
|
|
909
|
+
var oldStrict = this.strict;
|
|
910
|
+
this.strict = !0, this.parseClassId(node, isStatement), this.parseClassSuper(node);
|
|
911
|
+
var privateNameMap = this.enterClassBody(), classBody = this.startNode(), hadConstructor = !1;
|
|
912
|
+
for (classBody.body = [], this.expect(types$1.braceL); this.type !== types$1.braceR; ) {
|
|
913
|
+
var element = this.parseClassElement(node.superClass !== null);
|
|
914
|
+
element && (classBody.body.push(element), element.type === "MethodDefinition" && element.kind === "constructor" ? (hadConstructor && this.raiseRecoverable(element.start, "Duplicate constructor in the same class"), hadConstructor = !0) : element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element) && this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared"));
|
|
915
|
+
}
|
|
916
|
+
return this.strict = oldStrict, this.next(), node.body = this.finishNode(classBody, "ClassBody"), this.exitClassBody(), this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
|
|
917
|
+
};
|
|
918
|
+
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
919
|
+
if (this.eat(types$1.semi))
|
|
920
|
+
return null;
|
|
921
|
+
var ecmaVersion2 = this.options.ecmaVersion, node = this.startNode(), keyName = "", isGenerator = !1, isAsync = !1, kind = "method", isStatic = !1;
|
|
922
|
+
if (this.eatContextual("static")) {
|
|
923
|
+
if (ecmaVersion2 >= 13 && this.eat(types$1.braceL))
|
|
924
|
+
return this.parseClassStaticBlock(node), node;
|
|
925
|
+
this.isClassElementNameStart() || this.type === types$1.star ? isStatic = !0 : keyName = "static";
|
|
926
|
+
}
|
|
927
|
+
if (node.static = isStatic, !keyName && ecmaVersion2 >= 8 && this.eatContextual("async") && ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon() ? isAsync = !0 : keyName = "async"), !keyName && (ecmaVersion2 >= 9 || !isAsync) && this.eat(types$1.star) && (isGenerator = !0), !keyName && !isAsync && !isGenerator) {
|
|
928
|
+
var lastValue = this.value;
|
|
929
|
+
(this.eatContextual("get") || this.eatContextual("set")) && (this.isClassElementNameStart() ? kind = lastValue : keyName = lastValue);
|
|
930
|
+
}
|
|
931
|
+
if (keyName ? (node.computed = !1, node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), node.key.name = keyName, this.finishNode(node.key, "Identifier")) : this.parseClassElementName(node), ecmaVersion2 < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
932
|
+
var isConstructor = !node.static && checkKeyName(node, "constructor"), allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
933
|
+
isConstructor && kind !== "method" && this.raise(node.key.start, "Constructor can't have get/set modifier"), node.kind = isConstructor ? "constructor" : kind, this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
|
|
934
|
+
} else
|
|
935
|
+
this.parseClassField(node);
|
|
936
|
+
return node;
|
|
937
|
+
};
|
|
938
|
+
pp$8.isClassElementNameStart = function() {
|
|
939
|
+
return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword;
|
|
940
|
+
};
|
|
941
|
+
pp$8.parseClassElementName = function(element) {
|
|
942
|
+
this.type === types$1.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), element.computed = !1, element.key = this.parsePrivateIdent()) : this.parsePropertyName(element);
|
|
943
|
+
};
|
|
944
|
+
pp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
945
|
+
var key = method.key;
|
|
946
|
+
method.kind === "constructor" ? (isGenerator && this.raise(key.start, "Constructor can't be a generator"), isAsync && this.raise(key.start, "Constructor can't be an async method")) : method.static && checkKeyName(method, "prototype") && this.raise(key.start, "Classes may not have a static property named prototype");
|
|
947
|
+
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
948
|
+
return method.kind === "get" && value.params.length !== 0 && this.raiseRecoverable(value.start, "getter should have no params"), method.kind === "set" && value.params.length !== 1 && this.raiseRecoverable(value.start, "setter should have exactly one param"), method.kind === "set" && value.params[0].type === "RestElement" && this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"), this.finishNode(method, "MethodDefinition");
|
|
949
|
+
};
|
|
950
|
+
pp$8.parseClassField = function(field) {
|
|
951
|
+
return checkKeyName(field, "constructor") ? this.raise(field.key.start, "Classes can't have a field named 'constructor'") : field.static && checkKeyName(field, "prototype") && this.raise(field.key.start, "Classes can't have a static field named 'prototype'"), this.eat(types$1.eq) ? (this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER), field.value = this.parseMaybeAssign(), this.exitScope()) : field.value = null, this.semicolon(), this.finishNode(field, "PropertyDefinition");
|
|
952
|
+
};
|
|
953
|
+
pp$8.parseClassStaticBlock = function(node) {
|
|
954
|
+
node.body = [];
|
|
955
|
+
var oldLabels = this.labels;
|
|
956
|
+
for (this.labels = [], this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); this.type !== types$1.braceR; ) {
|
|
957
|
+
var stmt = this.parseStatement(null);
|
|
958
|
+
node.body.push(stmt);
|
|
959
|
+
}
|
|
960
|
+
return this.next(), this.exitScope(), this.labels = oldLabels, this.finishNode(node, "StaticBlock");
|
|
961
|
+
};
|
|
962
|
+
pp$8.parseClassId = function(node, isStatement) {
|
|
963
|
+
this.type === types$1.name ? (node.id = this.parseIdent(), isStatement && this.checkLValSimple(node.id, BIND_LEXICAL, !1)) : (isStatement === !0 && this.unexpected(), node.id = null);
|
|
964
|
+
};
|
|
965
|
+
pp$8.parseClassSuper = function(node) {
|
|
966
|
+
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
967
|
+
};
|
|
968
|
+
pp$8.enterClassBody = function() {
|
|
969
|
+
var element = { declared: /* @__PURE__ */ Object.create(null), used: [] };
|
|
970
|
+
return this.privateNameStack.push(element), element.declared;
|
|
971
|
+
};
|
|
972
|
+
pp$8.exitClassBody = function() {
|
|
973
|
+
var ref2 = this.privateNameStack.pop(), declared = ref2.declared, used = ref2.used;
|
|
974
|
+
if (this.options.checkPrivateFields)
|
|
975
|
+
for (var len = this.privateNameStack.length, parent = len === 0 ? null : this.privateNameStack[len - 1], i2 = 0; i2 < used.length; ++i2) {
|
|
976
|
+
var id = used[i2];
|
|
977
|
+
hasOwn(declared, id.name) || (parent ? parent.used.push(id) : this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"));
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
pp$8.parseExportAllDeclaration = function(node, exports$1) {
|
|
981
|
+
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (node.exported = this.parseModuleExportName(), this.checkExport(exports$1, node.exported, this.lastTokStart)) : node.exported = null), this.expectContextual("from"), this.type !== types$1.string && this.unexpected(), node.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (node.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(node, "ExportAllDeclaration");
|
|
982
|
+
};
|
|
983
|
+
pp$8.parseExport = function(node, exports$1) {
|
|
984
|
+
if (this.next(), this.eat(types$1.star))
|
|
985
|
+
return this.parseExportAllDeclaration(node, exports$1);
|
|
986
|
+
if (this.eat(types$1._default))
|
|
987
|
+
return this.checkExport(exports$1, "default", this.lastTokStart), node.declaration = this.parseExportDefaultDeclaration(), this.finishNode(node, "ExportDefaultDeclaration");
|
|
988
|
+
if (this.shouldParseExportStatement())
|
|
989
|
+
node.declaration = this.parseExportDeclaration(node), node.declaration.type === "VariableDeclaration" ? this.checkVariableExport(exports$1, node.declaration.declarations) : this.checkExport(exports$1, node.declaration.id, node.declaration.id.start), node.specifiers = [], node.source = null, this.options.ecmaVersion >= 16 && (node.attributes = []);
|
|
990
|
+
else {
|
|
991
|
+
if (node.declaration = null, node.specifiers = this.parseExportSpecifiers(exports$1), this.eatContextual("from"))
|
|
992
|
+
this.type !== types$1.string && this.unexpected(), node.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (node.attributes = this.parseWithClause());
|
|
993
|
+
else {
|
|
994
|
+
for (var i2 = 0, list2 = node.specifiers; i2 < list2.length; i2 += 1) {
|
|
995
|
+
var spec = list2[i2];
|
|
996
|
+
this.checkUnreserved(spec.local), this.checkLocalExport(spec.local), spec.local.type === "Literal" && this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
997
|
+
}
|
|
998
|
+
node.source = null, this.options.ecmaVersion >= 16 && (node.attributes = []);
|
|
999
|
+
}
|
|
1000
|
+
this.semicolon();
|
|
1001
|
+
}
|
|
1002
|
+
return this.finishNode(node, "ExportNamedDeclaration");
|
|
1003
|
+
};
|
|
1004
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
1005
|
+
return this.parseStatement(null);
|
|
1006
|
+
};
|
|
1007
|
+
pp$8.parseExportDefaultDeclaration = function() {
|
|
1008
|
+
var isAsync;
|
|
1009
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
1010
|
+
var fNode = this.startNode();
|
|
1011
|
+
return this.next(), isAsync && this.next(), this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, !1, isAsync);
|
|
1012
|
+
} else if (this.type === types$1._class) {
|
|
1013
|
+
var cNode = this.startNode();
|
|
1014
|
+
return this.parseClass(cNode, "nullableID");
|
|
1015
|
+
} else {
|
|
1016
|
+
var declaration = this.parseMaybeAssign();
|
|
1017
|
+
return this.semicolon(), declaration;
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
pp$8.checkExport = function(exports$1, name, pos) {
|
|
1021
|
+
exports$1 && (typeof name != "string" && (name = name.type === "Identifier" ? name.name : name.value), hasOwn(exports$1, name) && this.raiseRecoverable(pos, "Duplicate export '" + name + "'"), exports$1[name] = !0);
|
|
1022
|
+
};
|
|
1023
|
+
pp$8.checkPatternExport = function(exports$1, pat) {
|
|
1024
|
+
var type = pat.type;
|
|
1025
|
+
if (type === "Identifier")
|
|
1026
|
+
this.checkExport(exports$1, pat, pat.start);
|
|
1027
|
+
else if (type === "ObjectPattern")
|
|
1028
|
+
for (var i2 = 0, list2 = pat.properties; i2 < list2.length; i2 += 1) {
|
|
1029
|
+
var prop = list2[i2];
|
|
1030
|
+
this.checkPatternExport(exports$1, prop);
|
|
1031
|
+
}
|
|
1032
|
+
else if (type === "ArrayPattern")
|
|
1033
|
+
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
1034
|
+
var elt = list$1[i$1];
|
|
1035
|
+
elt && this.checkPatternExport(exports$1, elt);
|
|
1036
|
+
}
|
|
1037
|
+
else type === "Property" ? this.checkPatternExport(exports$1, pat.value) : type === "AssignmentPattern" ? this.checkPatternExport(exports$1, pat.left) : type === "RestElement" && this.checkPatternExport(exports$1, pat.argument);
|
|
1038
|
+
};
|
|
1039
|
+
pp$8.checkVariableExport = function(exports$1, decls) {
|
|
1040
|
+
if (exports$1)
|
|
1041
|
+
for (var i2 = 0, list2 = decls; i2 < list2.length; i2 += 1) {
|
|
1042
|
+
var decl = list2[i2];
|
|
1043
|
+
this.checkPatternExport(exports$1, decl.id);
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
pp$8.shouldParseExportStatement = function() {
|
|
1047
|
+
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
1048
|
+
};
|
|
1049
|
+
pp$8.parseExportSpecifier = function(exports$1) {
|
|
1050
|
+
var node = this.startNode();
|
|
1051
|
+
return node.local = this.parseModuleExportName(), node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local, this.checkExport(
|
|
1052
|
+
exports$1,
|
|
1053
|
+
node.exported,
|
|
1054
|
+
node.exported.start
|
|
1055
|
+
), this.finishNode(node, "ExportSpecifier");
|
|
1056
|
+
};
|
|
1057
|
+
pp$8.parseExportSpecifiers = function(exports$1) {
|
|
1058
|
+
var nodes = [], first = !0;
|
|
1059
|
+
for (this.expect(types$1.braceL); !this.eat(types$1.braceR); ) {
|
|
1060
|
+
if (first)
|
|
1061
|
+
first = !1;
|
|
1062
|
+
else if (this.expect(types$1.comma), this.afterTrailingComma(types$1.braceR))
|
|
1063
|
+
break;
|
|
1064
|
+
nodes.push(this.parseExportSpecifier(exports$1));
|
|
1065
|
+
}
|
|
1066
|
+
return nodes;
|
|
1067
|
+
};
|
|
1068
|
+
pp$8.parseImport = function(node) {
|
|
1069
|
+
return this.next(), this.type === types$1.string ? (node.specifiers = empty$1, node.source = this.parseExprAtom()) : (node.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected()), this.options.ecmaVersion >= 16 && (node.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(node, "ImportDeclaration");
|
|
1070
|
+
};
|
|
1071
|
+
pp$8.parseImportSpecifier = function() {
|
|
1072
|
+
var node = this.startNode();
|
|
1073
|
+
return node.imported = this.parseModuleExportName(), this.eatContextual("as") ? node.local = this.parseIdent() : (this.checkUnreserved(node.imported), node.local = node.imported), this.checkLValSimple(node.local, BIND_LEXICAL), this.finishNode(node, "ImportSpecifier");
|
|
1074
|
+
};
|
|
1075
|
+
pp$8.parseImportDefaultSpecifier = function() {
|
|
1076
|
+
var node = this.startNode();
|
|
1077
|
+
return node.local = this.parseIdent(), this.checkLValSimple(node.local, BIND_LEXICAL), this.finishNode(node, "ImportDefaultSpecifier");
|
|
1078
|
+
};
|
|
1079
|
+
pp$8.parseImportNamespaceSpecifier = function() {
|
|
1080
|
+
var node = this.startNode();
|
|
1081
|
+
return this.next(), this.expectContextual("as"), node.local = this.parseIdent(), this.checkLValSimple(node.local, BIND_LEXICAL), this.finishNode(node, "ImportNamespaceSpecifier");
|
|
1082
|
+
};
|
|
1083
|
+
pp$8.parseImportSpecifiers = function() {
|
|
1084
|
+
var nodes = [], first = !0;
|
|
1085
|
+
if (this.type === types$1.name && (nodes.push(this.parseImportDefaultSpecifier()), !this.eat(types$1.comma)))
|
|
1086
|
+
return nodes;
|
|
1087
|
+
if (this.type === types$1.star)
|
|
1088
|
+
return nodes.push(this.parseImportNamespaceSpecifier()), nodes;
|
|
1089
|
+
for (this.expect(types$1.braceL); !this.eat(types$1.braceR); ) {
|
|
1090
|
+
if (first)
|
|
1091
|
+
first = !1;
|
|
1092
|
+
else if (this.expect(types$1.comma), this.afterTrailingComma(types$1.braceR))
|
|
1093
|
+
break;
|
|
1094
|
+
nodes.push(this.parseImportSpecifier());
|
|
1095
|
+
}
|
|
1096
|
+
return nodes;
|
|
1097
|
+
};
|
|
1098
|
+
pp$8.parseWithClause = function() {
|
|
1099
|
+
var nodes = [];
|
|
1100
|
+
if (!this.eat(types$1._with))
|
|
1101
|
+
return nodes;
|
|
1102
|
+
this.expect(types$1.braceL);
|
|
1103
|
+
for (var attributeKeys = {}, first = !0; !this.eat(types$1.braceR); ) {
|
|
1104
|
+
if (first)
|
|
1105
|
+
first = !1;
|
|
1106
|
+
else if (this.expect(types$1.comma), this.afterTrailingComma(types$1.braceR))
|
|
1107
|
+
break;
|
|
1108
|
+
var attr = this.parseImportAttribute(), keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
|
|
1109
|
+
hasOwn(attributeKeys, keyName) && this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'"), attributeKeys[keyName] = !0, nodes.push(attr);
|
|
1110
|
+
}
|
|
1111
|
+
return nodes;
|
|
1112
|
+
};
|
|
1113
|
+
pp$8.parseImportAttribute = function() {
|
|
1114
|
+
var node = this.startNode();
|
|
1115
|
+
return node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"), this.expect(types$1.colon), this.type !== types$1.string && this.unexpected(), node.value = this.parseExprAtom(), this.finishNode(node, "ImportAttribute");
|
|
1116
|
+
};
|
|
1117
|
+
pp$8.parseModuleExportName = function() {
|
|
1118
|
+
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
|
|
1119
|
+
var stringLiteral = this.parseLiteral(this.value);
|
|
1120
|
+
return loneSurrogate.test(stringLiteral.value) && this.raise(stringLiteral.start, "An export name cannot include a lone surrogate."), stringLiteral;
|
|
1121
|
+
}
|
|
1122
|
+
return this.parseIdent(!0);
|
|
1123
|
+
};
|
|
1124
|
+
pp$8.adaptDirectivePrologue = function(statements) {
|
|
1125
|
+
for (var i2 = 0; i2 < statements.length && this.isDirectiveCandidate(statements[i2]); ++i2)
|
|
1126
|
+
statements[i2].directive = statements[i2].expression.raw.slice(1, -1);
|
|
1127
|
+
};
|
|
1128
|
+
pp$8.isDirectiveCandidate = function(statement) {
|
|
1129
|
+
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value == "string" && // Reject parenthesized strings.
|
|
1130
|
+
(this.input[statement.start] === '"' || this.input[statement.start] === "'");
|
|
1131
|
+
};
|
|
1132
|
+
pp$7 = Parser.prototype;
|
|
1133
|
+
pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1134
|
+
if (this.options.ecmaVersion >= 6 && node)
|
|
1135
|
+
switch (node.type) {
|
|
1136
|
+
case "Identifier":
|
|
1137
|
+
this.inAsync && node.name === "await" && this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
|
|
1138
|
+
break;
|
|
1139
|
+
case "ObjectPattern":
|
|
1140
|
+
case "ArrayPattern":
|
|
1141
|
+
case "AssignmentPattern":
|
|
1142
|
+
case "RestElement":
|
|
1143
|
+
break;
|
|
1144
|
+
case "ObjectExpression":
|
|
1145
|
+
node.type = "ObjectPattern", refDestructuringErrors && this.checkPatternErrors(refDestructuringErrors, !0);
|
|
1146
|
+
for (var i2 = 0, list2 = node.properties; i2 < list2.length; i2 += 1) {
|
|
1147
|
+
var prop = list2[i2];
|
|
1148
|
+
this.toAssignable(prop, isBinding), prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern") && this.raise(prop.argument.start, "Unexpected token");
|
|
1149
|
+
}
|
|
1150
|
+
break;
|
|
1151
|
+
case "Property":
|
|
1152
|
+
node.kind !== "init" && this.raise(node.key.start, "Object pattern can't contain getter or setter"), this.toAssignable(node.value, isBinding);
|
|
1153
|
+
break;
|
|
1154
|
+
case "ArrayExpression":
|
|
1155
|
+
node.type = "ArrayPattern", refDestructuringErrors && this.checkPatternErrors(refDestructuringErrors, !0), this.toAssignableList(node.elements, isBinding);
|
|
1156
|
+
break;
|
|
1157
|
+
case "SpreadElement":
|
|
1158
|
+
node.type = "RestElement", this.toAssignable(node.argument, isBinding), node.argument.type === "AssignmentPattern" && this.raise(node.argument.start, "Rest elements cannot have a default value");
|
|
1159
|
+
break;
|
|
1160
|
+
case "AssignmentExpression":
|
|
1161
|
+
node.operator !== "=" && this.raise(node.left.end, "Only '=' operator can be used for specifying default value."), node.type = "AssignmentPattern", delete node.operator, this.toAssignable(node.left, isBinding);
|
|
1162
|
+
break;
|
|
1163
|
+
case "ParenthesizedExpression":
|
|
1164
|
+
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
|
|
1165
|
+
break;
|
|
1166
|
+
case "ChainExpression":
|
|
1167
|
+
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
|
|
1168
|
+
break;
|
|
1169
|
+
case "MemberExpression":
|
|
1170
|
+
if (!isBinding)
|
|
1171
|
+
break;
|
|
1172
|
+
default:
|
|
1173
|
+
this.raise(node.start, "Assigning to rvalue");
|
|
1174
|
+
}
|
|
1175
|
+
else refDestructuringErrors && this.checkPatternErrors(refDestructuringErrors, !0);
|
|
1176
|
+
return node;
|
|
1177
|
+
};
|
|
1178
|
+
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
1179
|
+
for (var end = exprList.length, i2 = 0; i2 < end; i2++) {
|
|
1180
|
+
var elt = exprList[i2];
|
|
1181
|
+
elt && this.toAssignable(elt, isBinding);
|
|
1182
|
+
}
|
|
1183
|
+
if (end) {
|
|
1184
|
+
var last = exprList[end - 1];
|
|
1185
|
+
this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier" && this.unexpected(last.argument.start);
|
|
1186
|
+
}
|
|
1187
|
+
return exprList;
|
|
1188
|
+
};
|
|
1189
|
+
pp$7.parseSpread = function(refDestructuringErrors) {
|
|
1190
|
+
var node = this.startNode();
|
|
1191
|
+
return this.next(), node.argument = this.parseMaybeAssign(!1, refDestructuringErrors), this.finishNode(node, "SpreadElement");
|
|
1192
|
+
};
|
|
1193
|
+
pp$7.parseRestBinding = function() {
|
|
1194
|
+
var node = this.startNode();
|
|
1195
|
+
return this.next(), this.options.ecmaVersion === 6 && this.type !== types$1.name && this.unexpected(), node.argument = this.parseBindingAtom(), this.finishNode(node, "RestElement");
|
|
1196
|
+
};
|
|
1197
|
+
pp$7.parseBindingAtom = function() {
|
|
1198
|
+
if (this.options.ecmaVersion >= 6)
|
|
1199
|
+
switch (this.type) {
|
|
1200
|
+
case types$1.bracketL:
|
|
1201
|
+
var node = this.startNode();
|
|
1202
|
+
return this.next(), node.elements = this.parseBindingList(types$1.bracketR, !0, !0), this.finishNode(node, "ArrayPattern");
|
|
1203
|
+
case types$1.braceL:
|
|
1204
|
+
return this.parseObj(!0);
|
|
1205
|
+
}
|
|
1206
|
+
return this.parseIdent();
|
|
1207
|
+
};
|
|
1208
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
|
|
1209
|
+
for (var elts = [], first = !0; !this.eat(close); )
|
|
1210
|
+
if (first ? first = !1 : this.expect(types$1.comma), allowEmpty && this.type === types$1.comma)
|
|
1211
|
+
elts.push(null);
|
|
1212
|
+
else {
|
|
1213
|
+
if (allowTrailingComma && this.afterTrailingComma(close))
|
|
1214
|
+
break;
|
|
1215
|
+
if (this.type === types$1.ellipsis) {
|
|
1216
|
+
var rest = this.parseRestBinding();
|
|
1217
|
+
this.parseBindingListItem(rest), elts.push(rest), this.type === types$1.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.expect(close);
|
|
1218
|
+
break;
|
|
1219
|
+
} else
|
|
1220
|
+
elts.push(this.parseAssignableListItem(allowModifiers));
|
|
1221
|
+
}
|
|
1222
|
+
return elts;
|
|
1223
|
+
};
|
|
1224
|
+
pp$7.parseAssignableListItem = function(allowModifiers) {
|
|
1225
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
|
1226
|
+
return this.parseBindingListItem(elem), elem;
|
|
1227
|
+
};
|
|
1228
|
+
pp$7.parseBindingListItem = function(param) {
|
|
1229
|
+
return param;
|
|
1230
|
+
};
|
|
1231
|
+
pp$7.parseMaybeDefault = function(startPos, startLoc, left) {
|
|
1232
|
+
if (left = left || this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(types$1.eq))
|
|
1233
|
+
return left;
|
|
1234
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
1235
|
+
return node.left = left, node.right = this.parseMaybeAssign(), this.finishNode(node, "AssignmentPattern");
|
|
1236
|
+
};
|
|
1237
|
+
pp$7.checkLValSimple = function(expr, bindingType, checkClashes) {
|
|
1238
|
+
bindingType === void 0 && (bindingType = BIND_NONE);
|
|
1239
|
+
var isBind = bindingType !== BIND_NONE;
|
|
1240
|
+
switch (expr.type) {
|
|
1241
|
+
case "Identifier":
|
|
1242
|
+
this.strict && this.reservedWordsStrictBind.test(expr.name) && this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"), isBind && (bindingType === BIND_LEXICAL && expr.name === "let" && this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"), checkClashes && (hasOwn(checkClashes, expr.name) && this.raiseRecoverable(expr.start, "Argument name clash"), checkClashes[expr.name] = !0), bindingType !== BIND_OUTSIDE && this.declareName(expr.name, bindingType, expr.start));
|
|
1243
|
+
break;
|
|
1244
|
+
case "ChainExpression":
|
|
1245
|
+
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
|
|
1246
|
+
break;
|
|
1247
|
+
case "MemberExpression":
|
|
1248
|
+
isBind && this.raiseRecoverable(expr.start, "Binding member expression");
|
|
1249
|
+
break;
|
|
1250
|
+
case "ParenthesizedExpression":
|
|
1251
|
+
return isBind && this.raiseRecoverable(expr.start, "Binding parenthesized expression"), this.checkLValSimple(expr.expression, bindingType, checkClashes);
|
|
1252
|
+
default:
|
|
1253
|
+
this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue");
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
1257
|
+
switch (bindingType === void 0 && (bindingType = BIND_NONE), expr.type) {
|
|
1258
|
+
case "ObjectPattern":
|
|
1259
|
+
for (var i2 = 0, list2 = expr.properties; i2 < list2.length; i2 += 1) {
|
|
1260
|
+
var prop = list2[i2];
|
|
1261
|
+
this.checkLValInnerPattern(prop, bindingType, checkClashes);
|
|
1262
|
+
}
|
|
1263
|
+
break;
|
|
1264
|
+
case "ArrayPattern":
|
|
1265
|
+
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
|
|
1266
|
+
var elem = list$1[i$1];
|
|
1267
|
+
elem && this.checkLValInnerPattern(elem, bindingType, checkClashes);
|
|
1268
|
+
}
|
|
1269
|
+
break;
|
|
1270
|
+
default:
|
|
1271
|
+
this.checkLValSimple(expr, bindingType, checkClashes);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
1275
|
+
switch (bindingType === void 0 && (bindingType = BIND_NONE), expr.type) {
|
|
1276
|
+
case "Property":
|
|
1277
|
+
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
|
|
1278
|
+
break;
|
|
1279
|
+
case "AssignmentPattern":
|
|
1280
|
+
this.checkLValPattern(expr.left, bindingType, checkClashes);
|
|
1281
|
+
break;
|
|
1282
|
+
case "RestElement":
|
|
1283
|
+
this.checkLValPattern(expr.argument, bindingType, checkClashes);
|
|
1284
|
+
break;
|
|
1285
|
+
default:
|
|
1286
|
+
this.checkLValPattern(expr, bindingType, checkClashes);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
TokContext = function(token, isExpr, preserveSpace, override, generator) {
|
|
1290
|
+
this.token = token, this.isExpr = !!isExpr, this.preserveSpace = !!preserveSpace, this.override = override, this.generator = !!generator;
|
|
1291
|
+
}, types = {
|
|
1292
|
+
b_stat: new TokContext("{", !1),
|
|
1293
|
+
b_expr: new TokContext("{", !0),
|
|
1294
|
+
b_tmpl: new TokContext("${", !1),
|
|
1295
|
+
p_stat: new TokContext("(", !1),
|
|
1296
|
+
p_expr: new TokContext("(", !0),
|
|
1297
|
+
q_tmpl: new TokContext("`", !0, !0, function(p) {
|
|
1298
|
+
return p.tryReadTemplateToken();
|
|
1299
|
+
}),
|
|
1300
|
+
f_stat: new TokContext("function", !1),
|
|
1301
|
+
f_expr: new TokContext("function", !0),
|
|
1302
|
+
f_expr_gen: new TokContext("function", !0, !1, null, !0),
|
|
1303
|
+
f_gen: new TokContext("function", !1, !1, null, !0)
|
|
1304
|
+
}, pp$6 = Parser.prototype;
|
|
1305
|
+
pp$6.initialContext = function() {
|
|
1306
|
+
return [types.b_stat];
|
|
1307
|
+
};
|
|
1308
|
+
pp$6.curContext = function() {
|
|
1309
|
+
return this.context[this.context.length - 1];
|
|
1310
|
+
};
|
|
1311
|
+
pp$6.braceIsBlock = function(prevType) {
|
|
1312
|
+
var parent = this.curContext();
|
|
1313
|
+
return parent === types.f_expr || parent === types.f_stat ? !0 : prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr) ? !parent.isExpr : prevType === types$1._return || prevType === types$1.name && this.exprAllowed ? lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) : prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow ? !0 : prevType === types$1.braceL ? parent === types.b_stat : prevType === types$1._var || prevType === types$1._const || prevType === types$1.name ? !1 : !this.exprAllowed;
|
|
1314
|
+
};
|
|
1315
|
+
pp$6.inGeneratorContext = function() {
|
|
1316
|
+
for (var i2 = this.context.length - 1; i2 >= 1; i2--) {
|
|
1317
|
+
var context = this.context[i2];
|
|
1318
|
+
if (context.token === "function")
|
|
1319
|
+
return context.generator;
|
|
1320
|
+
}
|
|
1321
|
+
return !1;
|
|
1322
|
+
};
|
|
1323
|
+
pp$6.updateContext = function(prevType) {
|
|
1324
|
+
var update, type = this.type;
|
|
1325
|
+
type.keyword && prevType === types$1.dot ? this.exprAllowed = !1 : (update = type.updateContext) ? update.call(this, prevType) : this.exprAllowed = type.beforeExpr;
|
|
1326
|
+
};
|
|
1327
|
+
pp$6.overrideContext = function(tokenCtx) {
|
|
1328
|
+
this.curContext() !== tokenCtx && (this.context[this.context.length - 1] = tokenCtx);
|
|
1329
|
+
};
|
|
1330
|
+
types$1.parenR.updateContext = types$1.braceR.updateContext = function() {
|
|
1331
|
+
if (this.context.length === 1) {
|
|
1332
|
+
this.exprAllowed = !0;
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
var out = this.context.pop();
|
|
1336
|
+
out === types.b_stat && this.curContext().token === "function" && (out = this.context.pop()), this.exprAllowed = !out.isExpr;
|
|
1337
|
+
};
|
|
1338
|
+
types$1.braceL.updateContext = function(prevType) {
|
|
1339
|
+
this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr), this.exprAllowed = !0;
|
|
1340
|
+
};
|
|
1341
|
+
types$1.dollarBraceL.updateContext = function() {
|
|
1342
|
+
this.context.push(types.b_tmpl), this.exprAllowed = !0;
|
|
1343
|
+
};
|
|
1344
|
+
types$1.parenL.updateContext = function(prevType) {
|
|
1345
|
+
var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;
|
|
1346
|
+
this.context.push(statementParens ? types.p_stat : types.p_expr), this.exprAllowed = !0;
|
|
1347
|
+
};
|
|
1348
|
+
types$1.incDec.updateContext = function() {
|
|
1349
|
+
};
|
|
1350
|
+
types$1._function.updateContext = types$1._class.updateContext = function(prevType) {
|
|
1351
|
+
prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat) ? this.context.push(types.f_expr) : this.context.push(types.f_stat), this.exprAllowed = !1;
|
|
1352
|
+
};
|
|
1353
|
+
types$1.colon.updateContext = function() {
|
|
1354
|
+
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
1355
|
+
};
|
|
1356
|
+
types$1.backQuote.updateContext = function() {
|
|
1357
|
+
this.curContext() === types.q_tmpl ? this.context.pop() : this.context.push(types.q_tmpl), this.exprAllowed = !1;
|
|
1358
|
+
};
|
|
1359
|
+
types$1.star.updateContext = function(prevType) {
|
|
1360
|
+
if (prevType === types$1._function) {
|
|
1361
|
+
var index = this.context.length - 1;
|
|
1362
|
+
this.context[index] === types.f_expr ? this.context[index] = types.f_expr_gen : this.context[index] = types.f_gen;
|
|
1363
|
+
}
|
|
1364
|
+
this.exprAllowed = !0;
|
|
1365
|
+
};
|
|
1366
|
+
types$1.name.updateContext = function(prevType) {
|
|
1367
|
+
var allowed = !1;
|
|
1368
|
+
this.options.ecmaVersion >= 6 && prevType !== types$1.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (allowed = !0), this.exprAllowed = allowed;
|
|
1369
|
+
};
|
|
1370
|
+
pp$5 = Parser.prototype;
|
|
1371
|
+
pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
1372
|
+
if (!(this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))) {
|
|
1373
|
+
var key = prop.key, name;
|
|
1374
|
+
switch (key.type) {
|
|
1375
|
+
case "Identifier":
|
|
1376
|
+
name = key.name;
|
|
1377
|
+
break;
|
|
1378
|
+
case "Literal":
|
|
1379
|
+
name = String(key.value);
|
|
1380
|
+
break;
|
|
1381
|
+
default:
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
var kind = prop.kind;
|
|
1385
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1386
|
+
name === "__proto__" && kind === "init" && (propHash.proto && (refDestructuringErrors ? refDestructuringErrors.doubleProto < 0 && (refDestructuringErrors.doubleProto = key.start) : this.raiseRecoverable(key.start, "Redefinition of __proto__ property")), propHash.proto = !0);
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
name = "$" + name;
|
|
1390
|
+
var other = propHash[name];
|
|
1391
|
+
if (other) {
|
|
1392
|
+
var redefinition;
|
|
1393
|
+
kind === "init" ? redefinition = this.strict && other.init || other.get || other.set : redefinition = other.init || other[kind], redefinition && this.raiseRecoverable(key.start, "Redefinition of property");
|
|
1394
|
+
} else
|
|
1395
|
+
other = propHash[name] = {
|
|
1396
|
+
init: !1,
|
|
1397
|
+
get: !1,
|
|
1398
|
+
set: !1
|
|
1399
|
+
};
|
|
1400
|
+
other[kind] = !0;
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
pp$5.parseExpression = function(forInit, refDestructuringErrors) {
|
|
1404
|
+
var this$1$1 = this;
|
|
1405
|
+
return this.catchStackOverflow(function() {
|
|
1406
|
+
var startPos = this$1$1.start, startLoc = this$1$1.startLoc, expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
1407
|
+
if (this$1$1.type === types$1.comma) {
|
|
1408
|
+
var node = this$1$1.startNodeAt(startPos, startLoc);
|
|
1409
|
+
for (node.expressions = [expr]; this$1$1.eat(types$1.comma); )
|
|
1410
|
+
node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors));
|
|
1411
|
+
return this$1$1.finishNode(node, "SequenceExpression");
|
|
1412
|
+
}
|
|
1413
|
+
return expr;
|
|
1414
|
+
});
|
|
1415
|
+
};
|
|
1416
|
+
pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
1417
|
+
if (this.isContextual("yield")) {
|
|
1418
|
+
if (this.inGenerator)
|
|
1419
|
+
return this.parseYield(forInit);
|
|
1420
|
+
this.exprAllowed = !1;
|
|
1421
|
+
}
|
|
1422
|
+
var ownDestructuringErrors = !1, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;
|
|
1423
|
+
refDestructuringErrors ? (oldParenAssign = refDestructuringErrors.parenthesizedAssign, oldTrailingComma = refDestructuringErrors.trailingComma, oldDoubleProto = refDestructuringErrors.doubleProto, refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1) : (refDestructuringErrors = new DestructuringErrors(), ownDestructuringErrors = !0);
|
|
1424
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
1425
|
+
(this.type === types$1.parenL || this.type === types$1.name) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = forInit === "await");
|
|
1426
|
+
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
|
|
1427
|
+
if (afterLeftParse && (left = afterLeftParse.call(this, left, startPos, startLoc)), this.type.isAssign) {
|
|
1428
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
1429
|
+
return node.operator = this.value, this.type === types$1.eq && (left = this.toAssignable(left, !1, refDestructuringErrors)), ownDestructuringErrors || (refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1, refDestructuringErrors.shorthandAssign >= left.start && (refDestructuringErrors.shorthandAssign = -1), refDestructuringErrors.doubleProto >= left.start && (refDestructuringErrors.doubleProto = -1)), this.type === types$1.eq ? this.checkLValPattern(left) : this.checkLValSimple(left), node.left = left, this.next(), node.right = this.parseMaybeAssign(forInit), oldDoubleProto > -1 && (refDestructuringErrors.doubleProto = oldDoubleProto), this.finishNode(node, "AssignmentExpression");
|
|
1430
|
+
} else
|
|
1431
|
+
ownDestructuringErrors && this.checkExpressionErrors(refDestructuringErrors, !0);
|
|
1432
|
+
return oldParenAssign > -1 && (refDestructuringErrors.parenthesizedAssign = oldParenAssign), oldTrailingComma > -1 && (refDestructuringErrors.trailingComma = oldTrailingComma), left;
|
|
1433
|
+
};
|
|
1434
|
+
pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
1435
|
+
var startPos = this.start, startLoc = this.startLoc, expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
1436
|
+
if (this.checkExpressionErrors(refDestructuringErrors))
|
|
1437
|
+
return expr;
|
|
1438
|
+
if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
|
|
1439
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
1440
|
+
return node.test = expr, node.consequent = this.parseMaybeAssign(), this.expect(types$1.colon), node.alternate = this.parseMaybeAssign(forInit), this.finishNode(node, "ConditionalExpression");
|
|
1441
|
+
}
|
|
1442
|
+
return expr;
|
|
1443
|
+
};
|
|
1444
|
+
pp$5.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
1445
|
+
var startPos = this.start, startLoc = this.startLoc, expr = this.parseMaybeUnary(refDestructuringErrors, !1, !1, forInit);
|
|
1446
|
+
return this.checkExpressionErrors(refDestructuringErrors) || expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit);
|
|
1447
|
+
};
|
|
1448
|
+
pp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
1449
|
+
var prec = this.type.binop;
|
|
1450
|
+
if (prec != null && (!forInit || this.type !== types$1._in) && prec > minPrec) {
|
|
1451
|
+
var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND, coalesce = this.type === types$1.coalesce;
|
|
1452
|
+
coalesce && (prec = types$1.logicalAND.binop);
|
|
1453
|
+
var op = this.value;
|
|
1454
|
+
this.next();
|
|
1455
|
+
var startPos = this.start, startLoc = this.startLoc, right = this.parseExprOp(this.parseMaybeUnary(null, !1, !1, forInit), startPos, startLoc, prec, forInit), node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
1456
|
+
return (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit);
|
|
1457
|
+
}
|
|
1458
|
+
return left;
|
|
1459
|
+
};
|
|
1460
|
+
pp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
1461
|
+
right.type === "PrivateIdentifier" && this.raise(right.start, "Private identifier can only be left side of binary expression");
|
|
1462
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
1463
|
+
return node.left = left, node.operator = op, node.right = right, this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
|
|
1464
|
+
};
|
|
1465
|
+
pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {
|
|
1466
|
+
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
1467
|
+
if (this.isContextual("await") && this.canAwait)
|
|
1468
|
+
expr = this.parseAwait(forInit), sawUnary = !0;
|
|
1469
|
+
else if (this.type.prefix) {
|
|
1470
|
+
var node = this.startNode(), update = this.type === types$1.incDec;
|
|
1471
|
+
node.operator = this.value, node.prefix = !0, this.next(), node.argument = this.parseMaybeUnary(null, !0, update, forInit), this.checkExpressionErrors(refDestructuringErrors, !0), update ? this.checkLValSimple(node.argument) : this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument) ? this.raiseRecoverable(node.start, "Deleting local variable in strict mode") : node.operator === "delete" && isPrivateFieldAccess(node.argument) ? this.raiseRecoverable(node.start, "Private fields can not be deleted") : sawUnary = !0, expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
1472
|
+
} else if (!sawUnary && this.type === types$1.privateId)
|
|
1473
|
+
(forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), expr = this.parsePrivateIdent(), this.type !== types$1._in && this.unexpected();
|
|
1474
|
+
else {
|
|
1475
|
+
if (expr = this.parseExprSubscripts(refDestructuringErrors, forInit), this.checkExpressionErrors(refDestructuringErrors))
|
|
1476
|
+
return expr;
|
|
1477
|
+
for (; this.type.postfix && !this.canInsertSemicolon(); ) {
|
|
1478
|
+
var node$1 = this.startNodeAt(startPos, startLoc);
|
|
1479
|
+
node$1.operator = this.value, node$1.prefix = !1, node$1.argument = expr, this.checkLValSimple(expr), this.next(), expr = this.finishNode(node$1, "UpdateExpression");
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar))
|
|
1483
|
+
if (sawUnary)
|
|
1484
|
+
this.unexpected(this.lastTokStart);
|
|
1485
|
+
else
|
|
1486
|
+
return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, !1, !1, forInit), "**", !1);
|
|
1487
|
+
else
|
|
1488
|
+
return expr;
|
|
1489
|
+
};
|
|
1490
|
+
pp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {
|
|
1491
|
+
var startPos = this.start, startLoc = this.startLoc, oldDoubleProto = -1, oldShorthandAssign = -1;
|
|
1492
|
+
refDestructuringErrors && (oldDoubleProto = refDestructuringErrors.doubleProto, oldShorthandAssign = refDestructuringErrors.shorthandAssign, refDestructuringErrors.doubleProto = refDestructuringErrors.shorthandAssign = -1);
|
|
1493
|
+
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
|
|
1494
|
+
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
|
|
1495
|
+
return expr;
|
|
1496
|
+
var result = this.parseSubscripts(expr, startPos, startLoc, !1, forInit);
|
|
1497
|
+
return refDestructuringErrors && (result.end > expr.end && (this.checkExpressionErrors(refDestructuringErrors, !0), refDestructuringErrors.parenthesizedAssign >= result.start && (refDestructuringErrors.parenthesizedAssign = -1), refDestructuringErrors.parenthesizedBind >= result.start && (refDestructuringErrors.parenthesizedBind = -1), refDestructuringErrors.trailingComma >= result.start && (refDestructuringErrors.trailingComma = -1)), oldDoubleProto > -1 && (refDestructuringErrors.doubleProto = oldDoubleProto), oldShorthandAssign > -1 && (refDestructuringErrors.shorthandAssign = oldShorthandAssign)), result;
|
|
1498
|
+
};
|
|
1499
|
+
pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
1500
|
+
for (var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start, optionalChained = !1; ; ) {
|
|
1501
|
+
var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);
|
|
1502
|
+
if (element.optional && (optionalChained = !0), element.end === base.end || element.type === "ArrowFunctionExpression") {
|
|
1503
|
+
if (optionalChained) {
|
|
1504
|
+
var chainNode = this.startNodeAt(startPos, startLoc);
|
|
1505
|
+
chainNode.expression = element, element = this.finishNode(chainNode, "ChainExpression");
|
|
1506
|
+
}
|
|
1507
|
+
return element;
|
|
1508
|
+
}
|
|
1509
|
+
base = element, maybeAsyncArrow = !1;
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
pp$5.shouldParseAsyncArrow = function() {
|
|
1513
|
+
return !this.canInsertSemicolon() && this.eat(types$1.arrow);
|
|
1514
|
+
};
|
|
1515
|
+
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
|
|
1516
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, !0, forInit);
|
|
1517
|
+
};
|
|
1518
|
+
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
1519
|
+
var optionalSupported = this.options.ecmaVersion >= 11, optional = optionalSupported && this.eat(types$1.questionDot);
|
|
1520
|
+
noCalls && optional && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
1521
|
+
var computed = this.eat(types$1.bracketL);
|
|
1522
|
+
if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) {
|
|
1523
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
1524
|
+
node.object = base, computed ? (node.property = this.parseExpression(), this.expect(types$1.bracketR)) : this.type === types$1.privateId && base.type !== "Super" ? node.property = this.parsePrivateIdent() : node.property = this.parseIdent(this.options.allowReserved !== "never"), node.computed = !!computed, optionalSupported && (node.optional = optional), base = this.finishNode(node, "MemberExpression");
|
|
1525
|
+
} else if (!noCalls && this.eat(types$1.parenL)) {
|
|
1526
|
+
var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
1527
|
+
this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0;
|
|
1528
|
+
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, !1, refDestructuringErrors);
|
|
1529
|
+
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow())
|
|
1530
|
+
return this.checkPatternErrors(refDestructuringErrors, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.awaitIdentPos = oldAwaitIdentPos, this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit);
|
|
1531
|
+
this.checkExpressionErrors(refDestructuringErrors, !0), this.yieldPos = oldYieldPos || this.yieldPos, this.awaitPos = oldAwaitPos || this.awaitPos, this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
|
|
1532
|
+
var node$1 = this.startNodeAt(startPos, startLoc);
|
|
1533
|
+
node$1.callee = base, node$1.arguments = exprList, optionalSupported && (node$1.optional = optional), base = this.finishNode(node$1, "CallExpression");
|
|
1534
|
+
} else if (this.type === types$1.backQuote) {
|
|
1535
|
+
(optional || optionalChained) && this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
1536
|
+
var node$2 = this.startNodeAt(startPos, startLoc);
|
|
1537
|
+
node$2.tag = base, node$2.quasi = this.parseTemplate({ isTagged: !0 }), base = this.finishNode(node$2, "TaggedTemplateExpression");
|
|
1538
|
+
}
|
|
1539
|
+
return base;
|
|
1540
|
+
};
|
|
1541
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
1542
|
+
this.type === types$1.slash && this.readRegexp();
|
|
1543
|
+
var node, canBeArrow = this.potentialArrowAt === this.start;
|
|
1544
|
+
switch (this.type) {
|
|
1545
|
+
case types$1._super:
|
|
1546
|
+
return this.allowSuper || this.raise(this.start, "'super' keyword outside a method"), node = this.startNode(), this.next(), this.type === types$1.parenL && !this.allowDirectSuper && this.raise(node.start, "super() call outside constructor of a subclass"), this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL && this.unexpected(), this.finishNode(node, "Super");
|
|
1547
|
+
case types$1._this:
|
|
1548
|
+
return node = this.startNode(), this.next(), this.finishNode(node, "ThisExpression");
|
|
1549
|
+
case types$1.name:
|
|
1550
|
+
var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc, id = this.parseIdent(!1);
|
|
1551
|
+
if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function))
|
|
1552
|
+
return this.overrideContext(types.f_expr), this.parseFunction(this.startNodeAt(startPos, startLoc), 0, !1, !0, forInit);
|
|
1553
|
+
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
1554
|
+
if (this.eat(types$1.arrow))
|
|
1555
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], !1, forInit);
|
|
1556
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc))
|
|
1557
|
+
return id = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(types$1.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], !0, forInit);
|
|
1558
|
+
}
|
|
1559
|
+
return id;
|
|
1560
|
+
case types$1.regexp:
|
|
1561
|
+
var value = this.value;
|
|
1562
|
+
return node = this.parseLiteral(value.value), node.regex = { pattern: value.pattern, flags: value.flags }, node;
|
|
1563
|
+
case types$1.num:
|
|
1564
|
+
case types$1.string:
|
|
1565
|
+
return this.parseLiteral(this.value);
|
|
1566
|
+
case types$1._null:
|
|
1567
|
+
case types$1._true:
|
|
1568
|
+
case types$1._false:
|
|
1569
|
+
return node = this.startNode(), node.value = this.type === types$1._null ? null : this.type === types$1._true, node.raw = this.type.keyword, this.next(), this.finishNode(node, "Literal");
|
|
1570
|
+
case types$1.parenL:
|
|
1571
|
+
var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
|
|
1572
|
+
return refDestructuringErrors && (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr) && (refDestructuringErrors.parenthesizedAssign = start), refDestructuringErrors.parenthesizedBind < 0 && (refDestructuringErrors.parenthesizedBind = start)), expr;
|
|
1573
|
+
case types$1.bracketL:
|
|
1574
|
+
return node = this.startNode(), this.next(), node.elements = this.parseExprList(types$1.bracketR, !0, !0, refDestructuringErrors), this.finishNode(node, "ArrayExpression");
|
|
1575
|
+
case types$1.braceL:
|
|
1576
|
+
return this.overrideContext(types.b_expr), this.parseObj(!1, refDestructuringErrors);
|
|
1577
|
+
case types$1._function:
|
|
1578
|
+
return node = this.startNode(), this.next(), this.parseFunction(node, 0);
|
|
1579
|
+
case types$1._class:
|
|
1580
|
+
return this.parseClass(this.startNode(), !1);
|
|
1581
|
+
case types$1._new:
|
|
1582
|
+
return this.parseNew();
|
|
1583
|
+
case types$1.backQuote:
|
|
1584
|
+
return this.parseTemplate();
|
|
1585
|
+
case types$1._import:
|
|
1586
|
+
return this.options.ecmaVersion >= 11 ? this.parseExprImport(forNew) : this.unexpected();
|
|
1587
|
+
default:
|
|
1588
|
+
return this.parseExprAtomDefault();
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
pp$5.parseExprAtomDefault = function() {
|
|
1592
|
+
this.unexpected();
|
|
1593
|
+
};
|
|
1594
|
+
pp$5.parseExprImport = function(forNew) {
|
|
1595
|
+
var node = this.startNode();
|
|
1596
|
+
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === types$1.parenL && !forNew)
|
|
1597
|
+
return this.parseDynamicImport(node);
|
|
1598
|
+
if (this.type === types$1.dot) {
|
|
1599
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
1600
|
+
return meta.name = "import", node.meta = this.finishNode(meta, "Identifier"), this.parseImportMeta(node);
|
|
1601
|
+
} else
|
|
1602
|
+
this.unexpected();
|
|
1603
|
+
};
|
|
1604
|
+
pp$5.parseDynamicImport = function(node) {
|
|
1605
|
+
if (this.next(), node.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16)
|
|
1606
|
+
this.eat(types$1.parenR) ? node.options = null : (this.expect(types$1.comma), this.afterTrailingComma(types$1.parenR) ? node.options = null : (node.options = this.parseMaybeAssign(), this.eat(types$1.parenR) || (this.expect(types$1.comma), this.afterTrailingComma(types$1.parenR) || this.unexpected())));
|
|
1607
|
+
else if (!this.eat(types$1.parenR)) {
|
|
1608
|
+
var errorPos = this.start;
|
|
1609
|
+
this.eat(types$1.comma) && this.eat(types$1.parenR) ? this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()") : this.unexpected(errorPos);
|
|
1610
|
+
}
|
|
1611
|
+
return this.finishNode(node, "ImportExpression");
|
|
1612
|
+
};
|
|
1613
|
+
pp$5.parseImportMeta = function(node) {
|
|
1614
|
+
this.next();
|
|
1615
|
+
var containsEsc = this.containsEsc;
|
|
1616
|
+
return node.property = this.parseIdent(!0), node.property.name !== "meta" && this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"), containsEsc && this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"), this.finishNode(node, "MetaProperty");
|
|
1617
|
+
};
|
|
1618
|
+
pp$5.parseLiteral = function(value) {
|
|
1619
|
+
var node = this.startNode();
|
|
1620
|
+
return node.value = value, node.raw = this.input.slice(this.start, this.end), node.raw.charCodeAt(node.raw.length - 1) === 110 && (node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, "")), this.next(), this.finishNode(node, "Literal");
|
|
1621
|
+
};
|
|
1622
|
+
pp$5.parseParenExpression = function() {
|
|
1623
|
+
this.expect(types$1.parenL);
|
|
1624
|
+
var val = this.parseExpression();
|
|
1625
|
+
return this.expect(types$1.parenR), val;
|
|
1626
|
+
};
|
|
1627
|
+
pp$5.shouldParseArrow = function(exprList) {
|
|
1628
|
+
return !this.canInsertSemicolon();
|
|
1629
|
+
};
|
|
1630
|
+
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
1631
|
+
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
1632
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1633
|
+
this.next();
|
|
1634
|
+
var innerStartPos = this.start, innerStartLoc = this.startLoc, exprList = [], first = !0, lastIsComma = !1, refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;
|
|
1635
|
+
for (this.yieldPos = 0, this.awaitPos = 0; this.type !== types$1.parenR; )
|
|
1636
|
+
if (first ? first = !1 : this.expect(types$1.comma), allowTrailingComma && this.afterTrailingComma(types$1.parenR, !0)) {
|
|
1637
|
+
lastIsComma = !0;
|
|
1638
|
+
break;
|
|
1639
|
+
} else if (this.type === types$1.ellipsis) {
|
|
1640
|
+
spreadStart = this.start, exprList.push(this.parseParenItem(this.parseRestBinding())), this.type === types$1.comma && this.raiseRecoverable(
|
|
1641
|
+
this.start,
|
|
1642
|
+
"Comma is not permitted after the rest element"
|
|
1643
|
+
);
|
|
1644
|
+
break;
|
|
1645
|
+
} else
|
|
1646
|
+
exprList.push(this.parseMaybeAssign(!1, refDestructuringErrors, this.parseParenItem));
|
|
1647
|
+
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
1648
|
+
if (this.expect(types$1.parenR), canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow))
|
|
1649
|
+
return this.checkPatternErrors(refDestructuringErrors, !1), this.checkYieldAwaitInDefaultParams(), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.parseParenArrowList(startPos, startLoc, exprList, forInit);
|
|
1650
|
+
(!exprList.length || lastIsComma) && this.unexpected(this.lastTokStart), spreadStart && this.unexpected(spreadStart), this.checkExpressionErrors(refDestructuringErrors, !0), this.yieldPos = oldYieldPos || this.yieldPos, this.awaitPos = oldAwaitPos || this.awaitPos, exprList.length > 1 ? (val = this.startNodeAt(innerStartPos, innerStartLoc), val.expressions = exprList, this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc)) : val = exprList[0];
|
|
1651
|
+
} else
|
|
1652
|
+
val = this.parseParenExpression();
|
|
1653
|
+
if (this.options.preserveParens) {
|
|
1654
|
+
var par = this.startNodeAt(startPos, startLoc);
|
|
1655
|
+
return par.expression = val, this.finishNode(par, "ParenthesizedExpression");
|
|
1656
|
+
} else
|
|
1657
|
+
return val;
|
|
1658
|
+
};
|
|
1659
|
+
pp$5.parseParenItem = function(item) {
|
|
1660
|
+
return item;
|
|
1661
|
+
};
|
|
1662
|
+
pp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {
|
|
1663
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, !1, forInit);
|
|
1664
|
+
};
|
|
1665
|
+
empty = [];
|
|
1666
|
+
pp$5.parseNew = function() {
|
|
1667
|
+
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
1668
|
+
var node = this.startNode();
|
|
1669
|
+
if (this.next(), this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
|
|
1670
|
+
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
|
|
1671
|
+
meta.name = "new", node.meta = this.finishNode(meta, "Identifier"), this.next();
|
|
1672
|
+
var containsEsc = this.containsEsc;
|
|
1673
|
+
return node.property = this.parseIdent(!0), node.property.name !== "target" && this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'"), containsEsc && this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"), this.finishNode(node, "MetaProperty");
|
|
1674
|
+
}
|
|
1675
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
1676
|
+
return node.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), startPos, startLoc, !0, !1), node.callee.type === "Super" && this.raiseRecoverable(startPos, "Invalid use of 'super'"), this.eat(types$1.parenL) ? node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, !1) : node.arguments = empty, this.finishNode(node, "NewExpression");
|
|
1677
|
+
};
|
|
1678
|
+
pp$5.parseTemplateElement = function(ref2) {
|
|
1679
|
+
var isTagged = ref2.isTagged, elem = this.startNode();
|
|
1680
|
+
return this.type === types$1.invalidTemplate ? (isTagged || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), elem.value = {
|
|
1681
|
+
raw: this.value.replace(/\r\n?/g, `
|
|
1682
|
+
`),
|
|
1683
|
+
cooked: null
|
|
1684
|
+
}) : elem.value = {
|
|
1685
|
+
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, `
|
|
1686
|
+
`),
|
|
1687
|
+
cooked: this.value
|
|
1688
|
+
}, this.next(), elem.tail = this.type === types$1.backQuote, this.finishNode(elem, "TemplateElement");
|
|
1689
|
+
};
|
|
1690
|
+
pp$5.parseTemplate = function(ref2) {
|
|
1691
|
+
ref2 === void 0 && (ref2 = {});
|
|
1692
|
+
var isTagged = ref2.isTagged;
|
|
1693
|
+
isTagged === void 0 && (isTagged = !1);
|
|
1694
|
+
var node = this.startNode();
|
|
1695
|
+
this.next(), node.expressions = [];
|
|
1696
|
+
var curElt = this.parseTemplateElement({ isTagged });
|
|
1697
|
+
for (node.quasis = [curElt]; !curElt.tail; )
|
|
1698
|
+
this.type === types$1.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(types$1.dollarBraceL), node.expressions.push(this.parseExpression()), this.expect(types$1.braceR), node.quasis.push(curElt = this.parseTemplateElement({ isTagged }));
|
|
1699
|
+
return this.next(), this.finishNode(node, "TemplateLiteral");
|
|
1700
|
+
};
|
|
1701
|
+
pp$5.isAsyncProp = function(prop) {
|
|
1702
|
+
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start));
|
|
1703
|
+
};
|
|
1704
|
+
pp$5.parseObj = function(isPattern, refDestructuringErrors) {
|
|
1705
|
+
var node = this.startNode(), first = !0, propHash = {};
|
|
1706
|
+
for (node.properties = [], this.next(); !this.eat(types$1.braceR); ) {
|
|
1707
|
+
if (first)
|
|
1708
|
+
first = !1;
|
|
1709
|
+
else if (this.expect(types$1.comma), this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR))
|
|
1710
|
+
break;
|
|
1711
|
+
var prop = this.parseProperty(isPattern, refDestructuringErrors);
|
|
1712
|
+
isPattern || this.checkPropClash(prop, propHash, refDestructuringErrors), node.properties.push(prop);
|
|
1713
|
+
}
|
|
1714
|
+
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
|
|
1715
|
+
};
|
|
1716
|
+
pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
1717
|
+
var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;
|
|
1718
|
+
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis))
|
|
1719
|
+
return isPattern ? (prop.argument = this.parseIdent(!1), this.type === types$1.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(prop, "RestElement")) : (prop.argument = this.parseMaybeAssign(!1, refDestructuringErrors), this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0 && (refDestructuringErrors.trailingComma = this.start), this.finishNode(prop, "SpreadElement"));
|
|
1720
|
+
this.options.ecmaVersion >= 6 && (prop.method = !1, prop.shorthand = !1, (isPattern || refDestructuringErrors) && (startPos = this.start, startLoc = this.startLoc), isPattern || (isGenerator = this.eat(types$1.star)));
|
|
1721
|
+
var containsEsc = this.containsEsc;
|
|
1722
|
+
return this.parsePropertyName(prop), !isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop) ? (isAsync = !0, isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star), this.parsePropertyName(prop)) : isAsync = !1, this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc), this.finishNode(prop, "Property");
|
|
1723
|
+
};
|
|
1724
|
+
pp$5.parseGetterSetter = function(prop) {
|
|
1725
|
+
var kind = prop.key.name;
|
|
1726
|
+
this.parsePropertyName(prop), prop.value = this.parseMethod(!1), prop.kind = kind;
|
|
1727
|
+
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
1728
|
+
if (prop.value.params.length !== paramCount) {
|
|
1729
|
+
var start = prop.value.start;
|
|
1730
|
+
prop.kind === "get" ? this.raiseRecoverable(start, "getter should have no params") : this.raiseRecoverable(start, "setter should have exactly one param");
|
|
1731
|
+
} else
|
|
1732
|
+
prop.kind === "set" && prop.value.params[0].type === "RestElement" && this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params");
|
|
1733
|
+
};
|
|
1734
|
+
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
1735
|
+
(isGenerator || isAsync) && this.type === types$1.colon && this.unexpected(), this.eat(types$1.colon) ? (prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, refDestructuringErrors), prop.kind = "init") : this.options.ecmaVersion >= 6 && this.type === types$1.parenL ? (isPattern && this.unexpected(), prop.method = !0, prop.value = this.parseMethod(isGenerator, isAsync), prop.kind = "init") : !isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq ? ((isGenerator || isAsync) && this.unexpected(), this.parseGetterSetter(prop)) : this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier" ? ((isGenerator || isAsync) && this.unexpected(), this.checkUnreserved(prop.key), prop.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = startPos), isPattern ? prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)) : this.type === types$1.eq && refDestructuringErrors ? (refDestructuringErrors.shorthandAssign < 0 && (refDestructuringErrors.shorthandAssign = this.start), prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key))) : prop.value = this.copyNode(prop.key), prop.kind = "init", prop.shorthand = !0) : this.unexpected();
|
|
1736
|
+
};
|
|
1737
|
+
pp$5.parsePropertyName = function(prop) {
|
|
1738
|
+
if (this.options.ecmaVersion >= 6) {
|
|
1739
|
+
if (this.eat(types$1.bracketL))
|
|
1740
|
+
return prop.computed = !0, prop.key = this.parseMaybeAssign(), this.expect(types$1.bracketR), prop.key;
|
|
1741
|
+
prop.computed = !1;
|
|
1742
|
+
}
|
|
1743
|
+
return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
1744
|
+
};
|
|
1745
|
+
pp$5.initFunction = function(node) {
|
|
1746
|
+
node.id = null, this.options.ecmaVersion >= 6 && (node.generator = node.expression = !1), this.options.ecmaVersion >= 8 && (node.async = !1);
|
|
1747
|
+
};
|
|
1748
|
+
pp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {
|
|
1749
|
+
var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
1750
|
+
return this.initFunction(node), this.options.ecmaVersion >= 6 && (node.generator = isGenerator), this.options.ecmaVersion >= 8 && (node.async = !!isAsync), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)), this.expect(types$1.parenL), node.params = this.parseBindingList(types$1.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(node, !1, !0, !1), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.awaitIdentPos = oldAwaitIdentPos, this.finishNode(node, "FunctionExpression");
|
|
1751
|
+
};
|
|
1752
|
+
pp$5.parseArrowExpression = function(node, params, isAsync, forInit) {
|
|
1753
|
+
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
1754
|
+
return this.enterScope(functionFlags(isAsync, !1) | SCOPE_ARROW), this.initFunction(node), this.options.ecmaVersion >= 8 && (node.async = !!isAsync), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, node.params = this.toAssignableList(params, !0), this.parseFunctionBody(node, !0, !1, forInit), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.awaitIdentPos = oldAwaitIdentPos, this.finishNode(node, "ArrowFunctionExpression");
|
|
1755
|
+
};
|
|
1756
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
1757
|
+
var isExpression = isArrowFunction && this.type !== types$1.braceL, oldStrict = this.strict, useStrict = !1;
|
|
1758
|
+
if (isExpression)
|
|
1759
|
+
node.body = this.parseMaybeAssign(forInit), node.expression = !0, this.checkParams(node, !1);
|
|
1760
|
+
else {
|
|
1761
|
+
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
|
|
1762
|
+
(!oldStrict || nonSimple) && (useStrict = this.strictDirective(this.end), useStrict && nonSimple && this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"));
|
|
1763
|
+
var oldLabels = this.labels;
|
|
1764
|
+
this.labels = [], useStrict && (this.strict = !0), this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)), this.strict && node.id && this.checkLValSimple(node.id, BIND_OUTSIDE), node.body = this.parseBlock(!1, void 0, useStrict && !oldStrict), node.expression = !1, this.adaptDirectivePrologue(node.body.body), this.labels = oldLabels;
|
|
1765
|
+
}
|
|
1766
|
+
this.exitScope();
|
|
1767
|
+
};
|
|
1768
|
+
pp$5.isSimpleParamList = function(params) {
|
|
1769
|
+
for (var i2 = 0, list2 = params; i2 < list2.length; i2 += 1) {
|
|
1770
|
+
var param = list2[i2];
|
|
1771
|
+
if (param.type !== "Identifier")
|
|
1772
|
+
return !1;
|
|
1773
|
+
}
|
|
1774
|
+
return !0;
|
|
1775
|
+
};
|
|
1776
|
+
pp$5.checkParams = function(node, allowDuplicates) {
|
|
1777
|
+
for (var nameHash = /* @__PURE__ */ Object.create(null), i2 = 0, list2 = node.params; i2 < list2.length; i2 += 1) {
|
|
1778
|
+
var param = list2[i2];
|
|
1779
|
+
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
|
|
1783
|
+
for (var elts = [], first = !0; !this.eat(close); ) {
|
|
1784
|
+
if (first)
|
|
1785
|
+
first = !1;
|
|
1786
|
+
else if (this.expect(types$1.comma), allowTrailingComma && this.afterTrailingComma(close))
|
|
1787
|
+
break;
|
|
1788
|
+
var elt = void 0;
|
|
1789
|
+
allowEmpty && this.type === types$1.comma ? elt = null : this.type === types$1.ellipsis ? (elt = this.parseSpread(refDestructuringErrors), refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0 && (refDestructuringErrors.trailingComma = this.start)) : elt = this.parseMaybeAssign(!1, refDestructuringErrors), elts.push(elt);
|
|
1790
|
+
}
|
|
1791
|
+
return elts;
|
|
1792
|
+
};
|
|
1793
|
+
pp$5.checkUnreserved = function(ref2) {
|
|
1794
|
+
var start = ref2.start, end = ref2.end, name = ref2.name;
|
|
1795
|
+
if (this.inGenerator && name === "yield" && this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && name === "await" && this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments" && this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (name === "arguments" || name === "await") && this.raise(start, "Cannot use " + name + " in class static initialization block"), this.keywords.test(name) && this.raise(start, "Unexpected keyword '" + name + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(start, end).indexOf("\\") !== -1)) {
|
|
1796
|
+
var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
|
|
1797
|
+
re.test(name) && (!this.inAsync && name === "await" && this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(start, "The keyword '" + name + "' is reserved"));
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
pp$5.parseIdent = function(liberal) {
|
|
1801
|
+
var node = this.parseIdentNode();
|
|
1802
|
+
return this.next(!!liberal), this.finishNode(node, "Identifier"), liberal || (this.checkUnreserved(node), node.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = node.start)), node;
|
|
1803
|
+
};
|
|
1804
|
+
pp$5.parseIdentNode = function() {
|
|
1805
|
+
var node = this.startNode();
|
|
1806
|
+
return this.type === types$1.name ? node.name = this.value : this.type.keyword ? (node.name = this.type.keyword, (node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = types$1.name) : this.unexpected(), node;
|
|
1807
|
+
};
|
|
1808
|
+
pp$5.parsePrivateIdent = function() {
|
|
1809
|
+
var node = this.startNode();
|
|
1810
|
+
return this.type === types$1.privateId ? node.name = this.value : this.unexpected(), this.next(), this.finishNode(node, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(node)), node;
|
|
1811
|
+
};
|
|
1812
|
+
pp$5.parseYield = function(forInit) {
|
|
1813
|
+
this.yieldPos || (this.yieldPos = this.start);
|
|
1814
|
+
var node = this.startNode();
|
|
1815
|
+
return this.next(), this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr ? (node.delegate = !1, node.argument = null) : (node.delegate = this.eat(types$1.star), node.argument = this.parseMaybeAssign(forInit)), this.finishNode(node, "YieldExpression");
|
|
1816
|
+
};
|
|
1817
|
+
pp$5.parseAwait = function(forInit) {
|
|
1818
|
+
this.awaitPos || (this.awaitPos = this.start);
|
|
1819
|
+
var node = this.startNode();
|
|
1820
|
+
return this.next(), node.argument = this.parseMaybeUnary(null, !0, !1, forInit), this.finishNode(node, "AwaitExpression");
|
|
1821
|
+
};
|
|
1822
|
+
pp$4 = Parser.prototype;
|
|
1823
|
+
pp$4.raise = function(pos, message) {
|
|
1824
|
+
var loc = getLineInfo(this.input, pos);
|
|
1825
|
+
message += " (" + loc.line + ":" + loc.column + ")", this.sourceFile && (message += " in " + this.sourceFile);
|
|
1826
|
+
var err = new SyntaxError(message);
|
|
1827
|
+
throw err.pos = pos, err.loc = loc, err.raisedAt = this.pos, err;
|
|
1828
|
+
};
|
|
1829
|
+
pp$4.raiseRecoverable = pp$4.raise;
|
|
1830
|
+
pp$4.curPosition = function() {
|
|
1831
|
+
if (this.options.locations)
|
|
1832
|
+
return new Position(this.curLine, this.pos - this.lineStart);
|
|
1833
|
+
};
|
|
1834
|
+
pp$3 = Parser.prototype, Scope = function(flags) {
|
|
1835
|
+
this.flags = flags, this.var = [], this.lexical = [], this.functions = [];
|
|
1836
|
+
};
|
|
1837
|
+
pp$3.enterScope = function(flags) {
|
|
1838
|
+
this.scopeStack.push(new Scope(flags));
|
|
1839
|
+
};
|
|
1840
|
+
pp$3.exitScope = function() {
|
|
1841
|
+
this.scopeStack.pop();
|
|
1842
|
+
};
|
|
1843
|
+
pp$3.treatFunctionsAsVarInScope = function(scope) {
|
|
1844
|
+
return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP;
|
|
1845
|
+
};
|
|
1846
|
+
pp$3.declareName = function(name, bindingType, pos) {
|
|
1847
|
+
var redeclared = !1;
|
|
1848
|
+
if (bindingType === BIND_LEXICAL) {
|
|
1849
|
+
var scope = this.currentScope();
|
|
1850
|
+
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1, scope.lexical.push(name), this.inModule && scope.flags & SCOPE_TOP && delete this.undefinedExports[name];
|
|
1851
|
+
} else if (bindingType === BIND_SIMPLE_CATCH) {
|
|
1852
|
+
var scope$1 = this.currentScope();
|
|
1853
|
+
scope$1.lexical.push(name);
|
|
1854
|
+
} else if (bindingType === BIND_FUNCTION) {
|
|
1855
|
+
var scope$2 = this.currentScope();
|
|
1856
|
+
this.treatFunctionsAsVar ? redeclared = scope$2.lexical.indexOf(name) > -1 : redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1, scope$2.functions.push(name);
|
|
1857
|
+
} else
|
|
1858
|
+
for (var i2 = this.scopeStack.length - 1; i2 >= 0; --i2) {
|
|
1859
|
+
var scope$3 = this.scopeStack[i2];
|
|
1860
|
+
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
|
|
1861
|
+
redeclared = !0;
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
if (scope$3.var.push(name), this.inModule && scope$3.flags & SCOPE_TOP && delete this.undefinedExports[name], scope$3.flags & SCOPE_VAR)
|
|
1865
|
+
break;
|
|
1866
|
+
}
|
|
1867
|
+
redeclared && this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared");
|
|
1868
|
+
};
|
|
1869
|
+
pp$3.checkLocalExport = function(id) {
|
|
1870
|
+
this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1 && (this.undefinedExports[id.name] = id);
|
|
1871
|
+
};
|
|
1872
|
+
pp$3.currentScope = function() {
|
|
1873
|
+
return this.scopeStack[this.scopeStack.length - 1];
|
|
1874
|
+
};
|
|
1875
|
+
pp$3.currentVarScope = function() {
|
|
1876
|
+
for (var i2 = this.scopeStack.length - 1; ; i2--) {
|
|
1877
|
+
var scope = this.scopeStack[i2];
|
|
1878
|
+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK))
|
|
1879
|
+
return scope;
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
pp$3.currentThisScope = function() {
|
|
1883
|
+
for (var i2 = this.scopeStack.length - 1; ; i2--) {
|
|
1884
|
+
var scope = this.scopeStack[i2];
|
|
1885
|
+
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW))
|
|
1886
|
+
return scope;
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
Node = function(parser, pos, loc) {
|
|
1890
|
+
this.type = "", this.start = pos, this.end = 0, parser.options.locations && (this.loc = new SourceLocation(parser, loc)), parser.options.directSourceFile && (this.sourceFile = parser.options.directSourceFile), parser.options.ranges && (this.range = [pos, 0]);
|
|
1891
|
+
}, pp$2 = Parser.prototype;
|
|
1892
|
+
pp$2.startNode = function() {
|
|
1893
|
+
return new Node(this, this.start, this.startLoc);
|
|
1894
|
+
};
|
|
1895
|
+
pp$2.startNodeAt = function(pos, loc) {
|
|
1896
|
+
return new Node(this, pos, loc);
|
|
1897
|
+
};
|
|
1898
|
+
pp$2.finishNode = function(node, type) {
|
|
1899
|
+
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
|
|
1900
|
+
};
|
|
1901
|
+
pp$2.finishNodeAt = function(node, type, pos, loc) {
|
|
1902
|
+
return finishNodeAt.call(this, node, type, pos, loc);
|
|
1903
|
+
};
|
|
1904
|
+
pp$2.copyNode = function(node) {
|
|
1905
|
+
var newNode = new Node(this, node.start, this.startLoc);
|
|
1906
|
+
for (var prop in node)
|
|
1907
|
+
newNode[prop] = node[prop];
|
|
1908
|
+
return newNode;
|
|
1909
|
+
};
|
|
1910
|
+
scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic", ecma11BinaryProperties = ecma10BinaryProperties, ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict", ecma13BinaryProperties = ecma12BinaryProperties, ecma14BinaryProperties = ecma13BinaryProperties, unicodeBinaryProperties = {
|
|
1911
|
+
9: ecma9BinaryProperties,
|
|
1912
|
+
10: ecma10BinaryProperties,
|
|
1913
|
+
11: ecma11BinaryProperties,
|
|
1914
|
+
12: ecma12BinaryProperties,
|
|
1915
|
+
13: ecma13BinaryProperties,
|
|
1916
|
+
14: ecma14BinaryProperties
|
|
1917
|
+
}, ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji", unicodeBinaryPropertiesOfStrings = {
|
|
1918
|
+
9: "",
|
|
1919
|
+
10: "",
|
|
1920
|
+
11: "",
|
|
1921
|
+
12: "",
|
|
1922
|
+
13: "",
|
|
1923
|
+
14: ecma14BinaryPropertiesOfStrings
|
|
1924
|
+
}, unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", ecma9ScriptValues = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode, unicodeScriptValues = {
|
|
1925
|
+
9: ecma9ScriptValues,
|
|
1926
|
+
10: ecma10ScriptValues,
|
|
1927
|
+
11: ecma11ScriptValues,
|
|
1928
|
+
12: ecma12ScriptValues,
|
|
1929
|
+
13: ecma13ScriptValues,
|
|
1930
|
+
14: ecma14ScriptValues
|
|
1931
|
+
}, data = {};
|
|
1932
|
+
for (i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1)
|
|
1933
|
+
ecmaVersion = list[i], buildUnicodeData(ecmaVersion);
|
|
1934
|
+
pp$1 = Parser.prototype, BranchID = function(parent, base) {
|
|
1935
|
+
this.parent = parent, this.base = base || this;
|
|
1936
|
+
};
|
|
1937
|
+
BranchID.prototype.separatedFrom = function(alt) {
|
|
1938
|
+
for (var self = this; self; self = self.parent)
|
|
1939
|
+
for (var other = alt; other; other = other.parent)
|
|
1940
|
+
if (self.base === other.base && self !== other)
|
|
1941
|
+
return !0;
|
|
1942
|
+
return !1;
|
|
1943
|
+
};
|
|
1944
|
+
BranchID.prototype.sibling = function() {
|
|
1945
|
+
return new BranchID(this.parent, this.base);
|
|
1946
|
+
};
|
|
1947
|
+
RegExpValidationState = function(parser) {
|
|
1948
|
+
this.parser = parser, this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = /* @__PURE__ */ Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
1949
|
+
};
|
|
1950
|
+
RegExpValidationState.prototype.reset = function(start, pattern, flags) {
|
|
1951
|
+
var unicodeSets = flags.indexOf("v") !== -1, unicode = flags.indexOf("u") !== -1;
|
|
1952
|
+
this.start = start | 0, this.source = pattern + "", this.flags = flags, unicodeSets && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = unicode && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = unicode && this.parser.options.ecmaVersion >= 9);
|
|
1953
|
+
};
|
|
1954
|
+
RegExpValidationState.prototype.raise = function(message) {
|
|
1955
|
+
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
|
|
1956
|
+
};
|
|
1957
|
+
RegExpValidationState.prototype.at = function(i2, forceU) {
|
|
1958
|
+
forceU === void 0 && (forceU = !1);
|
|
1959
|
+
var s = this.source, l = s.length;
|
|
1960
|
+
if (i2 >= l)
|
|
1961
|
+
return -1;
|
|
1962
|
+
var c = s.charCodeAt(i2);
|
|
1963
|
+
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i2 + 1 >= l)
|
|
1964
|
+
return c;
|
|
1965
|
+
var next = s.charCodeAt(i2 + 1);
|
|
1966
|
+
return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c;
|
|
1967
|
+
};
|
|
1968
|
+
RegExpValidationState.prototype.nextIndex = function(i2, forceU) {
|
|
1969
|
+
forceU === void 0 && (forceU = !1);
|
|
1970
|
+
var s = this.source, l = s.length;
|
|
1971
|
+
if (i2 >= l)
|
|
1972
|
+
return l;
|
|
1973
|
+
var c = s.charCodeAt(i2), next;
|
|
1974
|
+
return !(forceU || this.switchU) || c <= 55295 || c >= 57344 || i2 + 1 >= l || (next = s.charCodeAt(i2 + 1)) < 56320 || next > 57343 ? i2 + 1 : i2 + 2;
|
|
1975
|
+
};
|
|
1976
|
+
RegExpValidationState.prototype.current = function(forceU) {
|
|
1977
|
+
return forceU === void 0 && (forceU = !1), this.at(this.pos, forceU);
|
|
1978
|
+
};
|
|
1979
|
+
RegExpValidationState.prototype.lookahead = function(forceU) {
|
|
1980
|
+
return forceU === void 0 && (forceU = !1), this.at(this.nextIndex(this.pos, forceU), forceU);
|
|
1981
|
+
};
|
|
1982
|
+
RegExpValidationState.prototype.advance = function(forceU) {
|
|
1983
|
+
forceU === void 0 && (forceU = !1), this.pos = this.nextIndex(this.pos, forceU);
|
|
1984
|
+
};
|
|
1985
|
+
RegExpValidationState.prototype.eat = function(ch, forceU) {
|
|
1986
|
+
return forceU === void 0 && (forceU = !1), this.current(forceU) === ch ? (this.advance(forceU), !0) : !1;
|
|
1987
|
+
};
|
|
1988
|
+
RegExpValidationState.prototype.eatChars = function(chs, forceU) {
|
|
1989
|
+
forceU === void 0 && (forceU = !1);
|
|
1990
|
+
for (var pos = this.pos, i2 = 0, list2 = chs; i2 < list2.length; i2 += 1) {
|
|
1991
|
+
var ch = list2[i2], current2 = this.at(pos, forceU);
|
|
1992
|
+
if (current2 === -1 || current2 !== ch)
|
|
1993
|
+
return !1;
|
|
1994
|
+
pos = this.nextIndex(pos, forceU);
|
|
1995
|
+
}
|
|
1996
|
+
return this.pos = pos, !0;
|
|
1997
|
+
};
|
|
1998
|
+
pp$1.validateRegExpFlags = function(state) {
|
|
1999
|
+
for (var validFlags = state.validFlags, flags = state.flags, u = !1, v = !1, i2 = 0; i2 < flags.length; i2++) {
|
|
2000
|
+
var flag = flags.charAt(i2);
|
|
2001
|
+
validFlags.indexOf(flag) === -1 && this.raise(state.start, "Invalid regular expression flag"), flags.indexOf(flag, i2 + 1) > -1 && this.raise(state.start, "Duplicate regular expression flag"), flag === "u" && (u = !0), flag === "v" && (v = !0);
|
|
2002
|
+
}
|
|
2003
|
+
this.options.ecmaVersion >= 15 && u && v && this.raise(state.start, "Invalid regular expression flag");
|
|
2004
|
+
};
|
|
2005
|
+
pp$1.validateRegExpPattern = function(state) {
|
|
2006
|
+
this.regexp_pattern(state), !state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames) && (state.switchN = !0, this.regexp_pattern(state));
|
|
2007
|
+
};
|
|
2008
|
+
pp$1.regexp_pattern = function(state) {
|
|
2009
|
+
state.pos = 0, state.lastIntValue = 0, state.lastStringValue = "", state.lastAssertionIsQuantifiable = !1, state.numCapturingParens = 0, state.maxBackReference = 0, state.groupNames = /* @__PURE__ */ Object.create(null), state.backReferenceNames.length = 0, state.branchID = null, this.regexp_disjunction(state), state.pos !== state.source.length && (state.eat(
|
|
2010
|
+
41
|
|
2011
|
+
/* ) */
|
|
2012
|
+
) && state.raise("Unmatched ')'"), (state.eat(
|
|
2013
|
+
93
|
|
2014
|
+
/* ] */
|
|
2015
|
+
) || state.eat(
|
|
2016
|
+
125
|
|
2017
|
+
/* } */
|
|
2018
|
+
)) && state.raise("Lone quantifier brackets")), state.maxBackReference > state.numCapturingParens && state.raise("Invalid escape");
|
|
2019
|
+
for (var i2 = 0, list2 = state.backReferenceNames; i2 < list2.length; i2 += 1) {
|
|
2020
|
+
var name = list2[i2];
|
|
2021
|
+
state.groupNames[name] || state.raise("Invalid named capture referenced");
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
pp$1.regexp_disjunction = function(state) {
|
|
2025
|
+
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
2026
|
+
for (trackDisjunction && (state.branchID = new BranchID(state.branchID, null)), this.regexp_alternative(state); state.eat(
|
|
2027
|
+
124
|
|
2028
|
+
/* | */
|
|
2029
|
+
); )
|
|
2030
|
+
trackDisjunction && (state.branchID = state.branchID.sibling()), this.regexp_alternative(state);
|
|
2031
|
+
trackDisjunction && (state.branchID = state.branchID.parent), this.regexp_eatQuantifier(state, !0) && state.raise("Nothing to repeat"), state.eat(
|
|
2032
|
+
123
|
|
2033
|
+
/* { */
|
|
2034
|
+
) && state.raise("Lone quantifier brackets");
|
|
2035
|
+
};
|
|
2036
|
+
pp$1.regexp_alternative = function(state) {
|
|
2037
|
+
for (; state.pos < state.source.length && this.regexp_eatTerm(state); )
|
|
2038
|
+
;
|
|
2039
|
+
};
|
|
2040
|
+
pp$1.regexp_eatTerm = function(state) {
|
|
2041
|
+
return this.regexp_eatAssertion(state) ? (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state) && state.switchU && state.raise("Invalid quantifier"), !0) : (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) ? (this.regexp_eatQuantifier(state), !0) : !1;
|
|
2042
|
+
};
|
|
2043
|
+
pp$1.regexp_eatAssertion = function(state) {
|
|
2044
|
+
var start = state.pos;
|
|
2045
|
+
if (state.lastAssertionIsQuantifiable = !1, state.eat(
|
|
2046
|
+
94
|
|
2047
|
+
/* ^ */
|
|
2048
|
+
) || state.eat(
|
|
2049
|
+
36
|
|
2050
|
+
/* $ */
|
|
2051
|
+
))
|
|
2052
|
+
return !0;
|
|
2053
|
+
if (state.eat(
|
|
2054
|
+
92
|
|
2055
|
+
/* \ */
|
|
2056
|
+
)) {
|
|
2057
|
+
if (state.eat(
|
|
2058
|
+
66
|
|
2059
|
+
/* B */
|
|
2060
|
+
) || state.eat(
|
|
2061
|
+
98
|
|
2062
|
+
/* b */
|
|
2063
|
+
))
|
|
2064
|
+
return !0;
|
|
2065
|
+
state.pos = start;
|
|
2066
|
+
}
|
|
2067
|
+
if (state.eat(
|
|
2068
|
+
40
|
|
2069
|
+
/* ( */
|
|
2070
|
+
) && state.eat(
|
|
2071
|
+
63
|
|
2072
|
+
/* ? */
|
|
2073
|
+
)) {
|
|
2074
|
+
var lookbehind = !1;
|
|
2075
|
+
if (this.options.ecmaVersion >= 9 && (lookbehind = state.eat(
|
|
2076
|
+
60
|
|
2077
|
+
/* < */
|
|
2078
|
+
)), state.eat(
|
|
2079
|
+
61
|
|
2080
|
+
/* = */
|
|
2081
|
+
) || state.eat(
|
|
2082
|
+
33
|
|
2083
|
+
/* ! */
|
|
2084
|
+
))
|
|
2085
|
+
return this.regexp_disjunction(state), state.eat(
|
|
2086
|
+
41
|
|
2087
|
+
/* ) */
|
|
2088
|
+
) || state.raise("Unterminated group"), state.lastAssertionIsQuantifiable = !lookbehind, !0;
|
|
2089
|
+
}
|
|
2090
|
+
return state.pos = start, !1;
|
|
2091
|
+
};
|
|
2092
|
+
pp$1.regexp_eatQuantifier = function(state, noError) {
|
|
2093
|
+
return noError === void 0 && (noError = !1), this.regexp_eatQuantifierPrefix(state, noError) ? (state.eat(
|
|
2094
|
+
63
|
|
2095
|
+
/* ? */
|
|
2096
|
+
), !0) : !1;
|
|
2097
|
+
};
|
|
2098
|
+
pp$1.regexp_eatQuantifierPrefix = function(state, noError) {
|
|
2099
|
+
return state.eat(
|
|
2100
|
+
42
|
|
2101
|
+
/* * */
|
|
2102
|
+
) || state.eat(
|
|
2103
|
+
43
|
|
2104
|
+
/* + */
|
|
2105
|
+
) || state.eat(
|
|
2106
|
+
63
|
|
2107
|
+
/* ? */
|
|
2108
|
+
) || this.regexp_eatBracedQuantifier(state, noError);
|
|
2109
|
+
};
|
|
2110
|
+
pp$1.regexp_eatBracedQuantifier = function(state, noError) {
|
|
2111
|
+
var start = state.pos;
|
|
2112
|
+
if (state.eat(
|
|
2113
|
+
123
|
|
2114
|
+
/* { */
|
|
2115
|
+
)) {
|
|
2116
|
+
var min = 0, max = -1;
|
|
2117
|
+
if (this.regexp_eatDecimalDigits(state) && (min = state.lastIntValue, state.eat(
|
|
2118
|
+
44
|
|
2119
|
+
/* , */
|
|
2120
|
+
) && this.regexp_eatDecimalDigits(state) && (max = state.lastIntValue), state.eat(
|
|
2121
|
+
125
|
|
2122
|
+
/* } */
|
|
2123
|
+
)))
|
|
2124
|
+
return max !== -1 && max < min && !noError && state.raise("numbers out of order in {} quantifier"), !0;
|
|
2125
|
+
state.switchU && !noError && state.raise("Incomplete quantifier"), state.pos = start;
|
|
2126
|
+
}
|
|
2127
|
+
return !1;
|
|
2128
|
+
};
|
|
2129
|
+
pp$1.regexp_eatAtom = function(state) {
|
|
2130
|
+
return this.regexp_eatPatternCharacters(state) || state.eat(
|
|
2131
|
+
46
|
|
2132
|
+
/* . */
|
|
2133
|
+
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state);
|
|
2134
|
+
};
|
|
2135
|
+
pp$1.regexp_eatReverseSolidusAtomEscape = function(state) {
|
|
2136
|
+
var start = state.pos;
|
|
2137
|
+
if (state.eat(
|
|
2138
|
+
92
|
|
2139
|
+
/* \ */
|
|
2140
|
+
)) {
|
|
2141
|
+
if (this.regexp_eatAtomEscape(state))
|
|
2142
|
+
return !0;
|
|
2143
|
+
state.pos = start;
|
|
2144
|
+
}
|
|
2145
|
+
return !1;
|
|
2146
|
+
};
|
|
2147
|
+
pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
2148
|
+
var start = state.pos;
|
|
2149
|
+
if (state.eat(
|
|
2150
|
+
40
|
|
2151
|
+
/* ( */
|
|
2152
|
+
)) {
|
|
2153
|
+
if (state.eat(
|
|
2154
|
+
63
|
|
2155
|
+
/* ? */
|
|
2156
|
+
)) {
|
|
2157
|
+
if (this.options.ecmaVersion >= 16) {
|
|
2158
|
+
var addModifiers = this.regexp_eatModifiers(state), hasHyphen = state.eat(
|
|
2159
|
+
45
|
|
2160
|
+
/* - */
|
|
2161
|
+
);
|
|
2162
|
+
if (addModifiers || hasHyphen) {
|
|
2163
|
+
for (var i2 = 0; i2 < addModifiers.length; i2++) {
|
|
2164
|
+
var modifier = addModifiers.charAt(i2);
|
|
2165
|
+
addModifiers.indexOf(modifier, i2 + 1) > -1 && state.raise("Duplicate regular expression modifiers");
|
|
2166
|
+
}
|
|
2167
|
+
if (hasHyphen) {
|
|
2168
|
+
var removeModifiers = this.regexp_eatModifiers(state);
|
|
2169
|
+
!addModifiers && !removeModifiers && state.current() === 58 && state.raise("Invalid regular expression modifiers");
|
|
2170
|
+
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
|
|
2171
|
+
var modifier$1 = removeModifiers.charAt(i$1);
|
|
2172
|
+
(removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || addModifiers.indexOf(modifier$1) > -1) && state.raise("Duplicate regular expression modifiers");
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
if (state.eat(
|
|
2178
|
+
58
|
|
2179
|
+
/* : */
|
|
2180
|
+
)) {
|
|
2181
|
+
if (this.regexp_disjunction(state), state.eat(
|
|
2182
|
+
41
|
|
2183
|
+
/* ) */
|
|
2184
|
+
))
|
|
2185
|
+
return !0;
|
|
2186
|
+
state.raise("Unterminated group");
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
state.pos = start;
|
|
2190
|
+
}
|
|
2191
|
+
return !1;
|
|
2192
|
+
};
|
|
2193
|
+
pp$1.regexp_eatCapturingGroup = function(state) {
|
|
2194
|
+
if (state.eat(
|
|
2195
|
+
40
|
|
2196
|
+
/* ( */
|
|
2197
|
+
)) {
|
|
2198
|
+
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(state) : state.current() === 63 && state.raise("Invalid group"), this.regexp_disjunction(state), state.eat(
|
|
2199
|
+
41
|
|
2200
|
+
/* ) */
|
|
2201
|
+
))
|
|
2202
|
+
return state.numCapturingParens += 1, !0;
|
|
2203
|
+
state.raise("Unterminated group");
|
|
2204
|
+
}
|
|
2205
|
+
return !1;
|
|
2206
|
+
};
|
|
2207
|
+
pp$1.regexp_eatModifiers = function(state) {
|
|
2208
|
+
for (var modifiers = "", ch = 0; (ch = state.current()) !== -1 && isRegularExpressionModifier(ch); )
|
|
2209
|
+
modifiers += codePointToString(ch), state.advance();
|
|
2210
|
+
return modifiers;
|
|
2211
|
+
};
|
|
2212
|
+
pp$1.regexp_eatExtendedAtom = function(state) {
|
|
2213
|
+
return state.eat(
|
|
2214
|
+
46
|
|
2215
|
+
/* . */
|
|
2216
|
+
) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state);
|
|
2217
|
+
};
|
|
2218
|
+
pp$1.regexp_eatInvalidBracedQuantifier = function(state) {
|
|
2219
|
+
return this.regexp_eatBracedQuantifier(state, !0) && state.raise("Nothing to repeat"), !1;
|
|
2220
|
+
};
|
|
2221
|
+
pp$1.regexp_eatSyntaxCharacter = function(state) {
|
|
2222
|
+
var ch = state.current();
|
|
2223
|
+
return isSyntaxCharacter(ch) ? (state.lastIntValue = ch, state.advance(), !0) : !1;
|
|
2224
|
+
};
|
|
2225
|
+
pp$1.regexp_eatPatternCharacters = function(state) {
|
|
2226
|
+
for (var start = state.pos, ch = 0; (ch = state.current()) !== -1 && !isSyntaxCharacter(ch); )
|
|
2227
|
+
state.advance();
|
|
2228
|
+
return state.pos !== start;
|
|
2229
|
+
};
|
|
2230
|
+
pp$1.regexp_eatExtendedPatternCharacter = function(state) {
|
|
2231
|
+
var ch = state.current();
|
|
2232
|
+
return ch !== -1 && ch !== 36 && !(ch >= 40 && ch <= 43) && ch !== 46 && ch !== 63 && ch !== 91 && ch !== 94 && ch !== 124 ? (state.advance(), !0) : !1;
|
|
2233
|
+
};
|
|
2234
|
+
pp$1.regexp_groupSpecifier = function(state) {
|
|
2235
|
+
if (state.eat(
|
|
2236
|
+
63
|
|
2237
|
+
/* ? */
|
|
2238
|
+
)) {
|
|
2239
|
+
this.regexp_eatGroupName(state) || state.raise("Invalid group");
|
|
2240
|
+
var trackDisjunction = this.options.ecmaVersion >= 16, known = state.groupNames[state.lastStringValue];
|
|
2241
|
+
if (known)
|
|
2242
|
+
if (trackDisjunction)
|
|
2243
|
+
for (var i2 = 0, list2 = known; i2 < list2.length; i2 += 1) {
|
|
2244
|
+
var altID = list2[i2];
|
|
2245
|
+
altID.separatedFrom(state.branchID) || state.raise("Duplicate capture group name");
|
|
2246
|
+
}
|
|
2247
|
+
else
|
|
2248
|
+
state.raise("Duplicate capture group name");
|
|
2249
|
+
trackDisjunction ? (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID) : state.groupNames[state.lastStringValue] = !0;
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
pp$1.regexp_eatGroupName = function(state) {
|
|
2253
|
+
if (state.lastStringValue = "", state.eat(
|
|
2254
|
+
60
|
|
2255
|
+
/* < */
|
|
2256
|
+
)) {
|
|
2257
|
+
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(
|
|
2258
|
+
62
|
|
2259
|
+
/* > */
|
|
2260
|
+
))
|
|
2261
|
+
return !0;
|
|
2262
|
+
state.raise("Invalid capture group name");
|
|
2263
|
+
}
|
|
2264
|
+
return !1;
|
|
2265
|
+
};
|
|
2266
|
+
pp$1.regexp_eatRegExpIdentifierName = function(state) {
|
|
2267
|
+
if (state.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(state)) {
|
|
2268
|
+
for (state.lastStringValue += codePointToString(state.lastIntValue); this.regexp_eatRegExpIdentifierPart(state); )
|
|
2269
|
+
state.lastStringValue += codePointToString(state.lastIntValue);
|
|
2270
|
+
return !0;
|
|
2271
|
+
}
|
|
2272
|
+
return !1;
|
|
2273
|
+
};
|
|
2274
|
+
pp$1.regexp_eatRegExpIdentifierStart = function(state) {
|
|
2275
|
+
var start = state.pos, forceU = this.options.ecmaVersion >= 11, ch = state.current(forceU);
|
|
2276
|
+
return state.advance(forceU), ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU) && (ch = state.lastIntValue), isRegExpIdentifierStart(ch) ? (state.lastIntValue = ch, !0) : (state.pos = start, !1);
|
|
2277
|
+
};
|
|
2278
|
+
pp$1.regexp_eatRegExpIdentifierPart = function(state) {
|
|
2279
|
+
var start = state.pos, forceU = this.options.ecmaVersion >= 11, ch = state.current(forceU);
|
|
2280
|
+
return state.advance(forceU), ch === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU) && (ch = state.lastIntValue), isRegExpIdentifierPart(ch) ? (state.lastIntValue = ch, !0) : (state.pos = start, !1);
|
|
2281
|
+
};
|
|
2282
|
+
pp$1.regexp_eatAtomEscape = function(state) {
|
|
2283
|
+
return this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state) ? !0 : (state.switchU && (state.current() === 99 && state.raise("Invalid unicode escape"), state.raise("Invalid escape")), !1);
|
|
2284
|
+
};
|
|
2285
|
+
pp$1.regexp_eatBackReference = function(state) {
|
|
2286
|
+
var start = state.pos;
|
|
2287
|
+
if (this.regexp_eatDecimalEscape(state)) {
|
|
2288
|
+
var n = state.lastIntValue;
|
|
2289
|
+
if (state.switchU)
|
|
2290
|
+
return n > state.maxBackReference && (state.maxBackReference = n), !0;
|
|
2291
|
+
if (n <= state.numCapturingParens)
|
|
2292
|
+
return !0;
|
|
2293
|
+
state.pos = start;
|
|
2294
|
+
}
|
|
2295
|
+
return !1;
|
|
2296
|
+
};
|
|
2297
|
+
pp$1.regexp_eatKGroupName = function(state) {
|
|
2298
|
+
if (state.eat(
|
|
2299
|
+
107
|
|
2300
|
+
/* k */
|
|
2301
|
+
)) {
|
|
2302
|
+
if (this.regexp_eatGroupName(state))
|
|
2303
|
+
return state.backReferenceNames.push(state.lastStringValue), !0;
|
|
2304
|
+
state.raise("Invalid named reference");
|
|
2305
|
+
}
|
|
2306
|
+
return !1;
|
|
2307
|
+
};
|
|
2308
|
+
pp$1.regexp_eatCharacterEscape = function(state) {
|
|
2309
|
+
return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, !1) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state);
|
|
2310
|
+
};
|
|
2311
|
+
pp$1.regexp_eatCControlLetter = function(state) {
|
|
2312
|
+
var start = state.pos;
|
|
2313
|
+
if (state.eat(
|
|
2314
|
+
99
|
|
2315
|
+
/* c */
|
|
2316
|
+
)) {
|
|
2317
|
+
if (this.regexp_eatControlLetter(state))
|
|
2318
|
+
return !0;
|
|
2319
|
+
state.pos = start;
|
|
2320
|
+
}
|
|
2321
|
+
return !1;
|
|
2322
|
+
};
|
|
2323
|
+
pp$1.regexp_eatZero = function(state) {
|
|
2324
|
+
return state.current() === 48 && !isDecimalDigit(state.lookahead()) ? (state.lastIntValue = 0, state.advance(), !0) : !1;
|
|
2325
|
+
};
|
|
2326
|
+
pp$1.regexp_eatControlEscape = function(state) {
|
|
2327
|
+
var ch = state.current();
|
|
2328
|
+
return ch === 116 ? (state.lastIntValue = 9, state.advance(), !0) : ch === 110 ? (state.lastIntValue = 10, state.advance(), !0) : ch === 118 ? (state.lastIntValue = 11, state.advance(), !0) : ch === 102 ? (state.lastIntValue = 12, state.advance(), !0) : ch === 114 ? (state.lastIntValue = 13, state.advance(), !0) : !1;
|
|
2329
|
+
};
|
|
2330
|
+
pp$1.regexp_eatControlLetter = function(state) {
|
|
2331
|
+
var ch = state.current();
|
|
2332
|
+
return isControlLetter(ch) ? (state.lastIntValue = ch % 32, state.advance(), !0) : !1;
|
|
2333
|
+
};
|
|
2334
|
+
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {
|
|
2335
|
+
forceU === void 0 && (forceU = !1);
|
|
2336
|
+
var start = state.pos, switchU = forceU || state.switchU;
|
|
2337
|
+
if (state.eat(
|
|
2338
|
+
117
|
|
2339
|
+
/* u */
|
|
2340
|
+
)) {
|
|
2341
|
+
if (this.regexp_eatFixedHexDigits(state, 4)) {
|
|
2342
|
+
var lead = state.lastIntValue;
|
|
2343
|
+
if (switchU && lead >= 55296 && lead <= 56319) {
|
|
2344
|
+
var leadSurrogateEnd = state.pos;
|
|
2345
|
+
if (state.eat(
|
|
2346
|
+
92
|
|
2347
|
+
/* \ */
|
|
2348
|
+
) && state.eat(
|
|
2349
|
+
117
|
|
2350
|
+
/* u */
|
|
2351
|
+
) && this.regexp_eatFixedHexDigits(state, 4)) {
|
|
2352
|
+
var trail = state.lastIntValue;
|
|
2353
|
+
if (trail >= 56320 && trail <= 57343)
|
|
2354
|
+
return state.lastIntValue = (lead - 55296) * 1024 + (trail - 56320) + 65536, !0;
|
|
2355
|
+
}
|
|
2356
|
+
state.pos = leadSurrogateEnd, state.lastIntValue = lead;
|
|
2357
|
+
}
|
|
2358
|
+
return !0;
|
|
2359
|
+
}
|
|
2360
|
+
if (switchU && state.eat(
|
|
2361
|
+
123
|
|
2362
|
+
/* { */
|
|
2363
|
+
) && this.regexp_eatHexDigits(state) && state.eat(
|
|
2364
|
+
125
|
|
2365
|
+
/* } */
|
|
2366
|
+
) && isValidUnicode(state.lastIntValue))
|
|
2367
|
+
return !0;
|
|
2368
|
+
switchU && state.raise("Invalid unicode escape"), state.pos = start;
|
|
2369
|
+
}
|
|
2370
|
+
return !1;
|
|
2371
|
+
};
|
|
2372
|
+
pp$1.regexp_eatIdentityEscape = function(state) {
|
|
2373
|
+
if (state.switchU)
|
|
2374
|
+
return this.regexp_eatSyntaxCharacter(state) ? !0 : state.eat(
|
|
2375
|
+
47
|
|
2376
|
+
/* / */
|
|
2377
|
+
) ? (state.lastIntValue = 47, !0) : !1;
|
|
2378
|
+
var ch = state.current();
|
|
2379
|
+
return ch !== 99 && (!state.switchN || ch !== 107) ? (state.lastIntValue = ch, state.advance(), !0) : !1;
|
|
2380
|
+
};
|
|
2381
|
+
pp$1.regexp_eatDecimalEscape = function(state) {
|
|
2382
|
+
state.lastIntValue = 0;
|
|
2383
|
+
var ch = state.current();
|
|
2384
|
+
if (ch >= 49 && ch <= 57) {
|
|
2385
|
+
do
|
|
2386
|
+
state.lastIntValue = 10 * state.lastIntValue + (ch - 48), state.advance();
|
|
2387
|
+
while ((ch = state.current()) >= 48 && ch <= 57);
|
|
2388
|
+
return !0;
|
|
2389
|
+
}
|
|
2390
|
+
return !1;
|
|
2391
|
+
};
|
|
2392
|
+
CharSetNone = 0, CharSetOk = 1, CharSetString = 2;
|
|
2393
|
+
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
2394
|
+
var ch = state.current();
|
|
2395
|
+
if (isCharacterClassEscape(ch))
|
|
2396
|
+
return state.lastIntValue = -1, state.advance(), CharSetOk;
|
|
2397
|
+
var negate = !1;
|
|
2398
|
+
if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 80) || ch === 112)) {
|
|
2399
|
+
state.lastIntValue = -1, state.advance();
|
|
2400
|
+
var result;
|
|
2401
|
+
if (state.eat(
|
|
2402
|
+
123
|
|
2403
|
+
/* { */
|
|
2404
|
+
) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat(
|
|
2405
|
+
125
|
|
2406
|
+
/* } */
|
|
2407
|
+
))
|
|
2408
|
+
return negate && result === CharSetString && state.raise("Invalid property name"), result;
|
|
2409
|
+
state.raise("Invalid property name");
|
|
2410
|
+
}
|
|
2411
|
+
return CharSetNone;
|
|
2412
|
+
};
|
|
2413
|
+
pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
2414
|
+
var start = state.pos;
|
|
2415
|
+
if (this.regexp_eatUnicodePropertyName(state) && state.eat(
|
|
2416
|
+
61
|
|
2417
|
+
/* = */
|
|
2418
|
+
)) {
|
|
2419
|
+
var name = state.lastStringValue;
|
|
2420
|
+
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
2421
|
+
var value = state.lastStringValue;
|
|
2422
|
+
return this.regexp_validateUnicodePropertyNameAndValue(state, name, value), CharSetOk;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
if (state.pos = start, this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
|
2426
|
+
var nameOrValue = state.lastStringValue;
|
|
2427
|
+
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
|
|
2428
|
+
}
|
|
2429
|
+
return CharSetNone;
|
|
2430
|
+
};
|
|
2431
|
+
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
2432
|
+
hasOwn(state.unicodeProperties.nonBinary, name) || state.raise("Invalid property name"), state.unicodeProperties.nonBinary[name].test(value) || state.raise("Invalid property value");
|
|
2433
|
+
};
|
|
2434
|
+
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
2435
|
+
if (state.unicodeProperties.binary.test(nameOrValue))
|
|
2436
|
+
return CharSetOk;
|
|
2437
|
+
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue))
|
|
2438
|
+
return CharSetString;
|
|
2439
|
+
state.raise("Invalid property name");
|
|
2440
|
+
};
|
|
2441
|
+
pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
2442
|
+
var ch = 0;
|
|
2443
|
+
for (state.lastStringValue = ""; isUnicodePropertyNameCharacter(ch = state.current()); )
|
|
2444
|
+
state.lastStringValue += codePointToString(ch), state.advance();
|
|
2445
|
+
return state.lastStringValue !== "";
|
|
2446
|
+
};
|
|
2447
|
+
pp$1.regexp_eatUnicodePropertyValue = function(state) {
|
|
2448
|
+
var ch = 0;
|
|
2449
|
+
for (state.lastStringValue = ""; isUnicodePropertyValueCharacter(ch = state.current()); )
|
|
2450
|
+
state.lastStringValue += codePointToString(ch), state.advance();
|
|
2451
|
+
return state.lastStringValue !== "";
|
|
2452
|
+
};
|
|
2453
|
+
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
2454
|
+
return this.regexp_eatUnicodePropertyValue(state);
|
|
2455
|
+
};
|
|
2456
|
+
pp$1.regexp_eatCharacterClass = function(state) {
|
|
2457
|
+
if (state.eat(
|
|
2458
|
+
91
|
|
2459
|
+
/* [ */
|
|
2460
|
+
)) {
|
|
2461
|
+
var negate = state.eat(
|
|
2462
|
+
94
|
|
2463
|
+
/* ^ */
|
|
2464
|
+
), result = this.regexp_classContents(state);
|
|
2465
|
+
return state.eat(
|
|
2466
|
+
93
|
|
2467
|
+
/* ] */
|
|
2468
|
+
) || state.raise("Unterminated character class"), negate && result === CharSetString && state.raise("Negated character class may contain strings"), !0;
|
|
2469
|
+
}
|
|
2470
|
+
return !1;
|
|
2471
|
+
};
|
|
2472
|
+
pp$1.regexp_classContents = function(state) {
|
|
2473
|
+
return state.current() === 93 ? CharSetOk : state.switchV ? this.regexp_classSetExpression(state) : (this.regexp_nonEmptyClassRanges(state), CharSetOk);
|
|
2474
|
+
};
|
|
2475
|
+
pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
2476
|
+
for (; this.regexp_eatClassAtom(state); ) {
|
|
2477
|
+
var left = state.lastIntValue;
|
|
2478
|
+
if (state.eat(
|
|
2479
|
+
45
|
|
2480
|
+
/* - */
|
|
2481
|
+
) && this.regexp_eatClassAtom(state)) {
|
|
2482
|
+
var right = state.lastIntValue;
|
|
2483
|
+
state.switchU && (left === -1 || right === -1) && state.raise("Invalid character class"), left !== -1 && right !== -1 && left > right && state.raise("Range out of order in character class");
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
pp$1.regexp_eatClassAtom = function(state) {
|
|
2488
|
+
var start = state.pos;
|
|
2489
|
+
if (state.eat(
|
|
2490
|
+
92
|
|
2491
|
+
/* \ */
|
|
2492
|
+
)) {
|
|
2493
|
+
if (this.regexp_eatClassEscape(state))
|
|
2494
|
+
return !0;
|
|
2495
|
+
if (state.switchU) {
|
|
2496
|
+
var ch$1 = state.current();
|
|
2497
|
+
(ch$1 === 99 || isOctalDigit(ch$1)) && state.raise("Invalid class escape"), state.raise("Invalid escape");
|
|
2498
|
+
}
|
|
2499
|
+
state.pos = start;
|
|
2500
|
+
}
|
|
2501
|
+
var ch = state.current();
|
|
2502
|
+
return ch !== 93 ? (state.lastIntValue = ch, state.advance(), !0) : !1;
|
|
2503
|
+
};
|
|
2504
|
+
pp$1.regexp_eatClassEscape = function(state) {
|
|
2505
|
+
var start = state.pos;
|
|
2506
|
+
if (state.eat(
|
|
2507
|
+
98
|
|
2508
|
+
/* b */
|
|
2509
|
+
))
|
|
2510
|
+
return state.lastIntValue = 8, !0;
|
|
2511
|
+
if (state.switchU && state.eat(
|
|
2512
|
+
45
|
|
2513
|
+
/* - */
|
|
2514
|
+
))
|
|
2515
|
+
return state.lastIntValue = 45, !0;
|
|
2516
|
+
if (!state.switchU && state.eat(
|
|
2517
|
+
99
|
|
2518
|
+
/* c */
|
|
2519
|
+
)) {
|
|
2520
|
+
if (this.regexp_eatClassControlLetter(state))
|
|
2521
|
+
return !0;
|
|
2522
|
+
state.pos = start;
|
|
2523
|
+
}
|
|
2524
|
+
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state);
|
|
2525
|
+
};
|
|
2526
|
+
pp$1.regexp_classSetExpression = function(state) {
|
|
2527
|
+
var result = CharSetOk, subResult;
|
|
2528
|
+
if (!this.regexp_eatClassSetRange(state)) if (subResult = this.regexp_eatClassSetOperand(state)) {
|
|
2529
|
+
subResult === CharSetString && (result = CharSetString);
|
|
2530
|
+
for (var start = state.pos; state.eatChars(
|
|
2531
|
+
[38, 38]
|
|
2532
|
+
/* && */
|
|
2533
|
+
); ) {
|
|
2534
|
+
if (state.current() !== 38 && (subResult = this.regexp_eatClassSetOperand(state))) {
|
|
2535
|
+
subResult !== CharSetString && (result = CharSetOk);
|
|
2536
|
+
continue;
|
|
2537
|
+
}
|
|
2538
|
+
state.raise("Invalid character in character class");
|
|
2539
|
+
}
|
|
2540
|
+
if (start !== state.pos)
|
|
2541
|
+
return result;
|
|
2542
|
+
for (; state.eatChars(
|
|
2543
|
+
[45, 45]
|
|
2544
|
+
/* -- */
|
|
2545
|
+
); )
|
|
2546
|
+
this.regexp_eatClassSetOperand(state) || state.raise("Invalid character in character class");
|
|
2547
|
+
if (start !== state.pos)
|
|
2548
|
+
return result;
|
|
2549
|
+
} else
|
|
2550
|
+
state.raise("Invalid character in character class");
|
|
2551
|
+
for (; ; )
|
|
2552
|
+
if (!this.regexp_eatClassSetRange(state)) {
|
|
2553
|
+
if (subResult = this.regexp_eatClassSetOperand(state), !subResult)
|
|
2554
|
+
return result;
|
|
2555
|
+
subResult === CharSetString && (result = CharSetString);
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2558
|
+
pp$1.regexp_eatClassSetRange = function(state) {
|
|
2559
|
+
var start = state.pos;
|
|
2560
|
+
if (this.regexp_eatClassSetCharacter(state)) {
|
|
2561
|
+
var left = state.lastIntValue;
|
|
2562
|
+
if (state.eat(
|
|
2563
|
+
45
|
|
2564
|
+
/* - */
|
|
2565
|
+
) && this.regexp_eatClassSetCharacter(state)) {
|
|
2566
|
+
var right = state.lastIntValue;
|
|
2567
|
+
return left !== -1 && right !== -1 && left > right && state.raise("Range out of order in character class"), !0;
|
|
2568
|
+
}
|
|
2569
|
+
state.pos = start;
|
|
2570
|
+
}
|
|
2571
|
+
return !1;
|
|
2572
|
+
};
|
|
2573
|
+
pp$1.regexp_eatClassSetOperand = function(state) {
|
|
2574
|
+
return this.regexp_eatClassSetCharacter(state) ? CharSetOk : this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state);
|
|
2575
|
+
};
|
|
2576
|
+
pp$1.regexp_eatNestedClass = function(state) {
|
|
2577
|
+
var start = state.pos;
|
|
2578
|
+
if (state.eat(
|
|
2579
|
+
91
|
|
2580
|
+
/* [ */
|
|
2581
|
+
)) {
|
|
2582
|
+
var negate = state.eat(
|
|
2583
|
+
94
|
|
2584
|
+
/* ^ */
|
|
2585
|
+
), result = this.regexp_classContents(state);
|
|
2586
|
+
if (state.eat(
|
|
2587
|
+
93
|
|
2588
|
+
/* ] */
|
|
2589
|
+
))
|
|
2590
|
+
return negate && result === CharSetString && state.raise("Negated character class may contain strings"), result;
|
|
2591
|
+
state.pos = start;
|
|
2592
|
+
}
|
|
2593
|
+
if (state.eat(
|
|
2594
|
+
92
|
|
2595
|
+
/* \ */
|
|
2596
|
+
)) {
|
|
2597
|
+
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
2598
|
+
if (result$1)
|
|
2599
|
+
return result$1;
|
|
2600
|
+
state.pos = start;
|
|
2601
|
+
}
|
|
2602
|
+
return null;
|
|
2603
|
+
};
|
|
2604
|
+
pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
2605
|
+
var start = state.pos;
|
|
2606
|
+
if (state.eatChars(
|
|
2607
|
+
[92, 113]
|
|
2608
|
+
/* \q */
|
|
2609
|
+
)) {
|
|
2610
|
+
if (state.eat(
|
|
2611
|
+
123
|
|
2612
|
+
/* { */
|
|
2613
|
+
)) {
|
|
2614
|
+
var result = this.regexp_classStringDisjunctionContents(state);
|
|
2615
|
+
if (state.eat(
|
|
2616
|
+
125
|
|
2617
|
+
/* } */
|
|
2618
|
+
))
|
|
2619
|
+
return result;
|
|
2620
|
+
} else
|
|
2621
|
+
state.raise("Invalid escape");
|
|
2622
|
+
state.pos = start;
|
|
2623
|
+
}
|
|
2624
|
+
return null;
|
|
2625
|
+
};
|
|
2626
|
+
pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
2627
|
+
for (var result = this.regexp_classString(state); state.eat(
|
|
2628
|
+
124
|
|
2629
|
+
/* | */
|
|
2630
|
+
); )
|
|
2631
|
+
this.regexp_classString(state) === CharSetString && (result = CharSetString);
|
|
2632
|
+
return result;
|
|
2633
|
+
};
|
|
2634
|
+
pp$1.regexp_classString = function(state) {
|
|
2635
|
+
for (var count = 0; this.regexp_eatClassSetCharacter(state); )
|
|
2636
|
+
count++;
|
|
2637
|
+
return count === 1 ? CharSetOk : CharSetString;
|
|
2638
|
+
};
|
|
2639
|
+
pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
2640
|
+
var start = state.pos;
|
|
2641
|
+
if (state.eat(
|
|
2642
|
+
92
|
|
2643
|
+
/* \ */
|
|
2644
|
+
))
|
|
2645
|
+
return this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state) ? !0 : state.eat(
|
|
2646
|
+
98
|
|
2647
|
+
/* b */
|
|
2648
|
+
) ? (state.lastIntValue = 8, !0) : (state.pos = start, !1);
|
|
2649
|
+
var ch = state.current();
|
|
2650
|
+
return ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch) || isClassSetSyntaxCharacter(ch) ? !1 : (state.advance(), state.lastIntValue = ch, !0);
|
|
2651
|
+
};
|
|
2652
|
+
pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
|
|
2653
|
+
var ch = state.current();
|
|
2654
|
+
return isClassSetReservedPunctuator(ch) ? (state.lastIntValue = ch, state.advance(), !0) : !1;
|
|
2655
|
+
};
|
|
2656
|
+
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
2657
|
+
var ch = state.current();
|
|
2658
|
+
return isDecimalDigit(ch) || ch === 95 ? (state.lastIntValue = ch % 32, state.advance(), !0) : !1;
|
|
2659
|
+
};
|
|
2660
|
+
pp$1.regexp_eatHexEscapeSequence = function(state) {
|
|
2661
|
+
var start = state.pos;
|
|
2662
|
+
if (state.eat(
|
|
2663
|
+
120
|
|
2664
|
+
/* x */
|
|
2665
|
+
)) {
|
|
2666
|
+
if (this.regexp_eatFixedHexDigits(state, 2))
|
|
2667
|
+
return !0;
|
|
2668
|
+
state.switchU && state.raise("Invalid escape"), state.pos = start;
|
|
2669
|
+
}
|
|
2670
|
+
return !1;
|
|
2671
|
+
};
|
|
2672
|
+
pp$1.regexp_eatDecimalDigits = function(state) {
|
|
2673
|
+
var start = state.pos, ch = 0;
|
|
2674
|
+
for (state.lastIntValue = 0; isDecimalDigit(ch = state.current()); )
|
|
2675
|
+
state.lastIntValue = 10 * state.lastIntValue + (ch - 48), state.advance();
|
|
2676
|
+
return state.pos !== start;
|
|
2677
|
+
};
|
|
2678
|
+
pp$1.regexp_eatHexDigits = function(state) {
|
|
2679
|
+
var start = state.pos, ch = 0;
|
|
2680
|
+
for (state.lastIntValue = 0; isHexDigit(ch = state.current()); )
|
|
2681
|
+
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch), state.advance();
|
|
2682
|
+
return state.pos !== start;
|
|
2683
|
+
};
|
|
2684
|
+
pp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {
|
|
2685
|
+
if (this.regexp_eatOctalDigit(state)) {
|
|
2686
|
+
var n1 = state.lastIntValue;
|
|
2687
|
+
if (this.regexp_eatOctalDigit(state)) {
|
|
2688
|
+
var n2 = state.lastIntValue;
|
|
2689
|
+
n1 <= 3 && this.regexp_eatOctalDigit(state) ? state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue : state.lastIntValue = n1 * 8 + n2;
|
|
2690
|
+
} else
|
|
2691
|
+
state.lastIntValue = n1;
|
|
2692
|
+
return !0;
|
|
2693
|
+
}
|
|
2694
|
+
return !1;
|
|
2695
|
+
};
|
|
2696
|
+
pp$1.regexp_eatOctalDigit = function(state) {
|
|
2697
|
+
var ch = state.current();
|
|
2698
|
+
return isOctalDigit(ch) ? (state.lastIntValue = ch - 48, state.advance(), !0) : (state.lastIntValue = 0, !1);
|
|
2699
|
+
};
|
|
2700
|
+
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
2701
|
+
var start = state.pos;
|
|
2702
|
+
state.lastIntValue = 0;
|
|
2703
|
+
for (var i2 = 0; i2 < length; ++i2) {
|
|
2704
|
+
var ch = state.current();
|
|
2705
|
+
if (!isHexDigit(ch))
|
|
2706
|
+
return state.pos = start, !1;
|
|
2707
|
+
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch), state.advance();
|
|
2708
|
+
}
|
|
2709
|
+
return !0;
|
|
2710
|
+
};
|
|
2711
|
+
Token = function(p) {
|
|
2712
|
+
this.type = p.type, this.value = p.value, this.start = p.start, this.end = p.end, p.options.locations && (this.loc = new SourceLocation(p, p.startLoc, p.endLoc)), p.options.ranges && (this.range = [p.start, p.end]);
|
|
2713
|
+
}, pp = Parser.prototype;
|
|
2714
|
+
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
2715
|
+
!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new Token(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken();
|
|
2716
|
+
};
|
|
2717
|
+
pp.getToken = function() {
|
|
2718
|
+
return this.next(), new Token(this);
|
|
2719
|
+
};
|
|
2720
|
+
typeof Symbol < "u" && (pp[Symbol.iterator] = function() {
|
|
2721
|
+
var this$1$1 = this;
|
|
2722
|
+
return {
|
|
2723
|
+
next: function() {
|
|
2724
|
+
var token = this$1$1.getToken();
|
|
2725
|
+
return {
|
|
2726
|
+
done: token.type === types$1.eof,
|
|
2727
|
+
value: token
|
|
2728
|
+
};
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
});
|
|
2732
|
+
pp.nextToken = function() {
|
|
2733
|
+
var curContext = this.curContext();
|
|
2734
|
+
if ((!curContext || !curContext.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length)
|
|
2735
|
+
return this.finishToken(types$1.eof);
|
|
2736
|
+
if (curContext.override)
|
|
2737
|
+
return curContext.override(this);
|
|
2738
|
+
this.readToken(this.fullCharCodeAtPos());
|
|
2739
|
+
};
|
|
2740
|
+
pp.readToken = function(code) {
|
|
2741
|
+
return isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 ? this.readWord() : this.getTokenFromCode(code);
|
|
2742
|
+
};
|
|
2743
|
+
pp.fullCharCodeAt = function(pos) {
|
|
2744
|
+
var code = this.input.charCodeAt(pos);
|
|
2745
|
+
if (code <= 55295 || code >= 56320)
|
|
2746
|
+
return code;
|
|
2747
|
+
var next = this.input.charCodeAt(pos + 1);
|
|
2748
|
+
return next <= 56319 || next >= 57344 ? code : (code << 10) + next - 56613888;
|
|
2749
|
+
};
|
|
2750
|
+
pp.fullCharCodeAtPos = function() {
|
|
2751
|
+
return this.fullCharCodeAt(this.pos);
|
|
2752
|
+
};
|
|
2753
|
+
pp.skipBlockComment = function() {
|
|
2754
|
+
var startLoc = this.options.onComment && this.curPosition(), start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
|
|
2755
|
+
if (end === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = end + 2, this.options.locations)
|
|
2756
|
+
for (var nextBreak = void 0, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1; )
|
|
2757
|
+
++this.curLine, pos = this.lineStart = nextBreak;
|
|
2758
|
+
this.options.onComment && this.options.onComment(
|
|
2759
|
+
!0,
|
|
2760
|
+
this.input.slice(start + 2, end),
|
|
2761
|
+
start,
|
|
2762
|
+
this.pos,
|
|
2763
|
+
startLoc,
|
|
2764
|
+
this.curPosition()
|
|
2765
|
+
);
|
|
2766
|
+
};
|
|
2767
|
+
pp.skipLineComment = function(startSkip) {
|
|
2768
|
+
for (var start = this.pos, startLoc = this.options.onComment && this.curPosition(), ch = this.input.charCodeAt(this.pos += startSkip); this.pos < this.input.length && !isNewLine(ch); )
|
|
2769
|
+
ch = this.input.charCodeAt(++this.pos);
|
|
2770
|
+
this.options.onComment && this.options.onComment(
|
|
2771
|
+
!1,
|
|
2772
|
+
this.input.slice(start + startSkip, this.pos),
|
|
2773
|
+
start,
|
|
2774
|
+
this.pos,
|
|
2775
|
+
startLoc,
|
|
2776
|
+
this.curPosition()
|
|
2777
|
+
);
|
|
2778
|
+
};
|
|
2779
|
+
pp.skipSpace = function() {
|
|
2780
|
+
loop: for (; this.pos < this.input.length; ) {
|
|
2781
|
+
var ch = this.input.charCodeAt(this.pos);
|
|
2782
|
+
switch (ch) {
|
|
2783
|
+
case 32:
|
|
2784
|
+
case 160:
|
|
2785
|
+
++this.pos;
|
|
2786
|
+
break;
|
|
2787
|
+
case 13:
|
|
2788
|
+
this.input.charCodeAt(this.pos + 1) === 10 && ++this.pos;
|
|
2789
|
+
case 10:
|
|
2790
|
+
case 8232:
|
|
2791
|
+
case 8233:
|
|
2792
|
+
++this.pos, this.options.locations && (++this.curLine, this.lineStart = this.pos);
|
|
2793
|
+
break;
|
|
2794
|
+
case 47:
|
|
2795
|
+
switch (this.input.charCodeAt(this.pos + 1)) {
|
|
2796
|
+
case 42:
|
|
2797
|
+
this.skipBlockComment();
|
|
2798
|
+
break;
|
|
2799
|
+
case 47:
|
|
2800
|
+
this.skipLineComment(2);
|
|
2801
|
+
break;
|
|
2802
|
+
default:
|
|
2803
|
+
break loop;
|
|
2804
|
+
}
|
|
2805
|
+
break;
|
|
2806
|
+
default:
|
|
2807
|
+
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch)))
|
|
2808
|
+
++this.pos;
|
|
2809
|
+
else
|
|
2810
|
+
break loop;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
pp.finishToken = function(type, val) {
|
|
2815
|
+
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
2816
|
+
var prevType = this.type;
|
|
2817
|
+
this.type = type, this.value = val, this.updateContext(prevType);
|
|
2818
|
+
};
|
|
2819
|
+
pp.readToken_dot = function() {
|
|
2820
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2821
|
+
if (next >= 48 && next <= 57)
|
|
2822
|
+
return this.readNumber(!0);
|
|
2823
|
+
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
2824
|
+
return this.options.ecmaVersion >= 6 && next === 46 && next2 === 46 ? (this.pos += 3, this.finishToken(types$1.ellipsis)) : (++this.pos, this.finishToken(types$1.dot));
|
|
2825
|
+
};
|
|
2826
|
+
pp.readToken_slash = function() {
|
|
2827
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2828
|
+
return this.exprAllowed ? (++this.pos, this.readRegexp()) : next === 61 ? this.finishOp(types$1.assign, 2) : this.finishOp(types$1.slash, 1);
|
|
2829
|
+
};
|
|
2830
|
+
pp.readToken_mult_modulo_exp = function(code) {
|
|
2831
|
+
var next = this.input.charCodeAt(this.pos + 1), size = 1, tokentype = code === 42 ? types$1.star : types$1.modulo;
|
|
2832
|
+
return this.options.ecmaVersion >= 7 && code === 42 && next === 42 && (++size, tokentype = types$1.starstar, next = this.input.charCodeAt(this.pos + 2)), next === 61 ? this.finishOp(types$1.assign, size + 1) : this.finishOp(tokentype, size);
|
|
2833
|
+
};
|
|
2834
|
+
pp.readToken_pipe_amp = function(code) {
|
|
2835
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2836
|
+
if (next === code) {
|
|
2837
|
+
if (this.options.ecmaVersion >= 12) {
|
|
2838
|
+
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
2839
|
+
if (next2 === 61)
|
|
2840
|
+
return this.finishOp(types$1.assign, 3);
|
|
2841
|
+
}
|
|
2842
|
+
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
|
|
2843
|
+
}
|
|
2844
|
+
return next === 61 ? this.finishOp(types$1.assign, 2) : this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
|
|
2845
|
+
};
|
|
2846
|
+
pp.readToken_caret = function() {
|
|
2847
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2848
|
+
return next === 61 ? this.finishOp(types$1.assign, 2) : this.finishOp(types$1.bitwiseXOR, 1);
|
|
2849
|
+
};
|
|
2850
|
+
pp.readToken_plus_min = function(code) {
|
|
2851
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2852
|
+
return next === code ? next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(types$1.incDec, 2) : next === 61 ? this.finishOp(types$1.assign, 2) : this.finishOp(types$1.plusMin, 1);
|
|
2853
|
+
};
|
|
2854
|
+
pp.readToken_lt_gt = function(code) {
|
|
2855
|
+
var next = this.input.charCodeAt(this.pos + 1), size = 1;
|
|
2856
|
+
return next === code ? (size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + size) === 61 ? this.finishOp(types$1.assign, size + 1) : this.finishOp(types$1.bitShift, size)) : next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (next === 61 && (size = 2), this.finishOp(types$1.relational, size));
|
|
2857
|
+
};
|
|
2858
|
+
pp.readToken_eq_excl = function(code) {
|
|
2859
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2860
|
+
return next === 61 ? this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : code === 61 && next === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(types$1.arrow)) : this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
|
|
2861
|
+
};
|
|
2862
|
+
pp.readToken_question = function() {
|
|
2863
|
+
var ecmaVersion2 = this.options.ecmaVersion;
|
|
2864
|
+
if (ecmaVersion2 >= 11) {
|
|
2865
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2866
|
+
if (next === 46) {
|
|
2867
|
+
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
2868
|
+
if (next2 < 48 || next2 > 57)
|
|
2869
|
+
return this.finishOp(types$1.questionDot, 2);
|
|
2870
|
+
}
|
|
2871
|
+
if (next === 63) {
|
|
2872
|
+
if (ecmaVersion2 >= 12) {
|
|
2873
|
+
var next2$1 = this.input.charCodeAt(this.pos + 2);
|
|
2874
|
+
if (next2$1 === 61)
|
|
2875
|
+
return this.finishOp(types$1.assign, 3);
|
|
2876
|
+
}
|
|
2877
|
+
return this.finishOp(types$1.coalesce, 2);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
return this.finishOp(types$1.question, 1);
|
|
2881
|
+
};
|
|
2882
|
+
pp.readToken_numberSign = function() {
|
|
2883
|
+
var ecmaVersion2 = this.options.ecmaVersion, code = 35;
|
|
2884
|
+
if (ecmaVersion2 >= 13 && (++this.pos, code = this.fullCharCodeAtPos(), isIdentifierStart(code, !0) || code === 92))
|
|
2885
|
+
return this.finishToken(types$1.privateId, this.readWord1());
|
|
2886
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
2887
|
+
};
|
|
2888
|
+
pp.getTokenFromCode = function(code) {
|
|
2889
|
+
switch (code) {
|
|
2890
|
+
// The interpretation of a dot depends on whether it is followed
|
|
2891
|
+
// by a digit or another two dots.
|
|
2892
|
+
case 46:
|
|
2893
|
+
return this.readToken_dot();
|
|
2894
|
+
// Punctuation tokens.
|
|
2895
|
+
case 40:
|
|
2896
|
+
return ++this.pos, this.finishToken(types$1.parenL);
|
|
2897
|
+
case 41:
|
|
2898
|
+
return ++this.pos, this.finishToken(types$1.parenR);
|
|
2899
|
+
case 59:
|
|
2900
|
+
return ++this.pos, this.finishToken(types$1.semi);
|
|
2901
|
+
case 44:
|
|
2902
|
+
return ++this.pos, this.finishToken(types$1.comma);
|
|
2903
|
+
case 91:
|
|
2904
|
+
return ++this.pos, this.finishToken(types$1.bracketL);
|
|
2905
|
+
case 93:
|
|
2906
|
+
return ++this.pos, this.finishToken(types$1.bracketR);
|
|
2907
|
+
case 123:
|
|
2908
|
+
return ++this.pos, this.finishToken(types$1.braceL);
|
|
2909
|
+
case 125:
|
|
2910
|
+
return ++this.pos, this.finishToken(types$1.braceR);
|
|
2911
|
+
case 58:
|
|
2912
|
+
return ++this.pos, this.finishToken(types$1.colon);
|
|
2913
|
+
case 96:
|
|
2914
|
+
if (this.options.ecmaVersion < 6)
|
|
2915
|
+
break;
|
|
2916
|
+
return ++this.pos, this.finishToken(types$1.backQuote);
|
|
2917
|
+
case 48:
|
|
2918
|
+
var next = this.input.charCodeAt(this.pos + 1);
|
|
2919
|
+
if (next === 120 || next === 88)
|
|
2920
|
+
return this.readRadixNumber(16);
|
|
2921
|
+
if (this.options.ecmaVersion >= 6) {
|
|
2922
|
+
if (next === 111 || next === 79)
|
|
2923
|
+
return this.readRadixNumber(8);
|
|
2924
|
+
if (next === 98 || next === 66)
|
|
2925
|
+
return this.readRadixNumber(2);
|
|
2926
|
+
}
|
|
2927
|
+
// Anything else beginning with a digit is an integer, octal
|
|
2928
|
+
// number, or float.
|
|
2929
|
+
case 49:
|
|
2930
|
+
case 50:
|
|
2931
|
+
case 51:
|
|
2932
|
+
case 52:
|
|
2933
|
+
case 53:
|
|
2934
|
+
case 54:
|
|
2935
|
+
case 55:
|
|
2936
|
+
case 56:
|
|
2937
|
+
case 57:
|
|
2938
|
+
return this.readNumber(!1);
|
|
2939
|
+
// Quotes produce strings.
|
|
2940
|
+
case 34:
|
|
2941
|
+
case 39:
|
|
2942
|
+
return this.readString(code);
|
|
2943
|
+
// Operators are parsed inline in tiny state machines. '=' (61) is
|
|
2944
|
+
// often referred to. `finishOp` simply skips the amount of
|
|
2945
|
+
// characters it is given as second argument, and returns a token
|
|
2946
|
+
// of the type given by its first argument.
|
|
2947
|
+
case 47:
|
|
2948
|
+
return this.readToken_slash();
|
|
2949
|
+
case 37:
|
|
2950
|
+
case 42:
|
|
2951
|
+
return this.readToken_mult_modulo_exp(code);
|
|
2952
|
+
case 124:
|
|
2953
|
+
case 38:
|
|
2954
|
+
return this.readToken_pipe_amp(code);
|
|
2955
|
+
case 94:
|
|
2956
|
+
return this.readToken_caret();
|
|
2957
|
+
case 43:
|
|
2958
|
+
case 45:
|
|
2959
|
+
return this.readToken_plus_min(code);
|
|
2960
|
+
case 60:
|
|
2961
|
+
case 62:
|
|
2962
|
+
return this.readToken_lt_gt(code);
|
|
2963
|
+
case 61:
|
|
2964
|
+
case 33:
|
|
2965
|
+
return this.readToken_eq_excl(code);
|
|
2966
|
+
case 63:
|
|
2967
|
+
return this.readToken_question();
|
|
2968
|
+
case 126:
|
|
2969
|
+
return this.finishOp(types$1.prefix, 1);
|
|
2970
|
+
case 35:
|
|
2971
|
+
return this.readToken_numberSign();
|
|
2972
|
+
}
|
|
2973
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
|
|
2974
|
+
};
|
|
2975
|
+
pp.finishOp = function(type, size) {
|
|
2976
|
+
var str = this.input.slice(this.pos, this.pos + size);
|
|
2977
|
+
return this.pos += size, this.finishToken(type, str);
|
|
2978
|
+
};
|
|
2979
|
+
pp.readRegexp = function() {
|
|
2980
|
+
for (var escaped, inClass, start = this.pos; ; ) {
|
|
2981
|
+
this.pos >= this.input.length && this.raise(start, "Unterminated regular expression");
|
|
2982
|
+
var ch = this.input.charAt(this.pos);
|
|
2983
|
+
if (lineBreak.test(ch) && this.raise(start, "Unterminated regular expression"), escaped)
|
|
2984
|
+
escaped = !1;
|
|
2985
|
+
else {
|
|
2986
|
+
if (ch === "[")
|
|
2987
|
+
inClass = !0;
|
|
2988
|
+
else if (ch === "]" && inClass)
|
|
2989
|
+
inClass = !1;
|
|
2990
|
+
else if (ch === "/" && !inClass)
|
|
2991
|
+
break;
|
|
2992
|
+
escaped = ch === "\\";
|
|
2993
|
+
}
|
|
2994
|
+
++this.pos;
|
|
2995
|
+
}
|
|
2996
|
+
var pattern = this.input.slice(start, this.pos);
|
|
2997
|
+
++this.pos;
|
|
2998
|
+
var flagsStart = this.pos, flags = this.readWord1();
|
|
2999
|
+
this.containsEsc && this.unexpected(flagsStart);
|
|
3000
|
+
var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
|
|
3001
|
+
state.reset(start, pattern, flags), this.validateRegExpFlags(state), this.validateRegExpPattern(state);
|
|
3002
|
+
var value = null;
|
|
3003
|
+
try {
|
|
3004
|
+
value = new RegExp(pattern, flags);
|
|
3005
|
+
} catch {
|
|
3006
|
+
}
|
|
3007
|
+
return this.finishToken(types$1.regexp, { pattern, flags, value });
|
|
3008
|
+
};
|
|
3009
|
+
pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
3010
|
+
for (var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0, isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48, start = this.pos, total = 0, lastCode = 0, i2 = 0, e = len ?? 1 / 0; i2 < e; ++i2, ++this.pos) {
|
|
3011
|
+
var code = this.input.charCodeAt(this.pos), val = void 0;
|
|
3012
|
+
if (allowSeparators && code === 95) {
|
|
3013
|
+
isLegacyOctalNumericLiteral && this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals"), lastCode === 95 && this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore"), i2 === 0 && this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits"), lastCode = code;
|
|
3014
|
+
continue;
|
|
3015
|
+
}
|
|
3016
|
+
if (code >= 97 ? val = code - 97 + 10 : code >= 65 ? val = code - 65 + 10 : code >= 48 && code <= 57 ? val = code - 48 : val = 1 / 0, val >= radix)
|
|
3017
|
+
break;
|
|
3018
|
+
lastCode = code, total = total * radix + val;
|
|
3019
|
+
}
|
|
3020
|
+
return allowSeparators && lastCode === 95 && this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"), this.pos === start || len != null && this.pos - start !== len ? null : total;
|
|
3021
|
+
};
|
|
3022
|
+
pp.readRadixNumber = function(radix) {
|
|
3023
|
+
var start = this.pos;
|
|
3024
|
+
this.pos += 2;
|
|
3025
|
+
var val = this.readInt(radix);
|
|
3026
|
+
return val == null && this.raise(this.start + 2, "Expected number in radix " + radix), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (val = stringToBigInt(this.input.slice(start, this.pos)), ++this.pos) : isIdentifierStart(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(types$1.num, val);
|
|
3027
|
+
};
|
|
3028
|
+
pp.readNumber = function(startsWithDot) {
|
|
3029
|
+
var start = this.pos;
|
|
3030
|
+
!startsWithDot && this.readInt(10, void 0, !0) === null && this.raise(start, "Invalid number");
|
|
3031
|
+
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
3032
|
+
octal && this.strict && this.raise(start, "Invalid number");
|
|
3033
|
+
var next = this.input.charCodeAt(this.pos);
|
|
3034
|
+
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
|
|
3035
|
+
var val$1 = stringToBigInt(this.input.slice(start, this.pos));
|
|
3036
|
+
return ++this.pos, isIdentifierStart(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(types$1.num, val$1);
|
|
3037
|
+
}
|
|
3038
|
+
octal && /[89]/.test(this.input.slice(start, this.pos)) && (octal = !1), next === 46 && !octal && (++this.pos, this.readInt(10), next = this.input.charCodeAt(this.pos)), (next === 69 || next === 101) && !octal && (next = this.input.charCodeAt(++this.pos), (next === 43 || next === 45) && ++this.pos, this.readInt(10) === null && this.raise(start, "Invalid number")), isIdentifierStart(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
3039
|
+
var val = stringToNumber(this.input.slice(start, this.pos), octal);
|
|
3040
|
+
return this.finishToken(types$1.num, val);
|
|
3041
|
+
};
|
|
3042
|
+
pp.readCodePoint = function() {
|
|
3043
|
+
var ch = this.input.charCodeAt(this.pos), code;
|
|
3044
|
+
if (ch === 123) {
|
|
3045
|
+
this.options.ecmaVersion < 6 && this.unexpected();
|
|
3046
|
+
var codePos = ++this.pos;
|
|
3047
|
+
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, code > 1114111 && this.invalidStringToken(codePos, "Code point out of bounds");
|
|
3048
|
+
} else
|
|
3049
|
+
code = this.readHexChar(4);
|
|
3050
|
+
return code;
|
|
3051
|
+
};
|
|
3052
|
+
pp.readString = function(quote) {
|
|
3053
|
+
for (var out = "", chunkStart = ++this.pos; ; ) {
|
|
3054
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
3055
|
+
var ch = this.input.charCodeAt(this.pos);
|
|
3056
|
+
if (ch === quote)
|
|
3057
|
+
break;
|
|
3058
|
+
ch === 92 ? (out += this.input.slice(chunkStart, this.pos), out += this.readEscapedChar(!1), chunkStart = this.pos) : ch === 8232 || ch === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (isNewLine(ch) && this.raise(this.start, "Unterminated string constant"), ++this.pos);
|
|
3059
|
+
}
|
|
3060
|
+
return out += this.input.slice(chunkStart, this.pos++), this.finishToken(types$1.string, out);
|
|
3061
|
+
};
|
|
3062
|
+
INVALID_TEMPLATE_ESCAPE_ERROR = {};
|
|
3063
|
+
pp.tryReadTemplateToken = function() {
|
|
3064
|
+
this.inTemplateElement = !0;
|
|
3065
|
+
try {
|
|
3066
|
+
this.readTmplToken();
|
|
3067
|
+
} catch (err) {
|
|
3068
|
+
if (err === INVALID_TEMPLATE_ESCAPE_ERROR)
|
|
3069
|
+
this.readInvalidTemplateToken();
|
|
3070
|
+
else
|
|
3071
|
+
throw err;
|
|
3072
|
+
}
|
|
3073
|
+
this.inTemplateElement = !1;
|
|
3074
|
+
};
|
|
3075
|
+
pp.invalidStringToken = function(position, message) {
|
|
3076
|
+
if (this.inTemplateElement && this.options.ecmaVersion >= 9)
|
|
3077
|
+
throw INVALID_TEMPLATE_ESCAPE_ERROR;
|
|
3078
|
+
this.raise(position, message);
|
|
3079
|
+
};
|
|
3080
|
+
pp.readTmplToken = function() {
|
|
3081
|
+
for (var out = "", chunkStart = this.pos; ; ) {
|
|
3082
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
3083
|
+
var ch = this.input.charCodeAt(this.pos);
|
|
3084
|
+
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123)
|
|
3085
|
+
return this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate) ? ch === 36 ? (this.pos += 2, this.finishToken(types$1.dollarBraceL)) : (++this.pos, this.finishToken(types$1.backQuote)) : (out += this.input.slice(chunkStart, this.pos), this.finishToken(types$1.template, out));
|
|
3086
|
+
if (ch === 92)
|
|
3087
|
+
out += this.input.slice(chunkStart, this.pos), out += this.readEscapedChar(!0), chunkStart = this.pos;
|
|
3088
|
+
else if (isNewLine(ch)) {
|
|
3089
|
+
switch (out += this.input.slice(chunkStart, this.pos), ++this.pos, ch) {
|
|
3090
|
+
case 13:
|
|
3091
|
+
this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
3092
|
+
case 10:
|
|
3093
|
+
out += `
|
|
3094
|
+
`;
|
|
3095
|
+
break;
|
|
3096
|
+
default:
|
|
3097
|
+
out += String.fromCharCode(ch);
|
|
3098
|
+
break;
|
|
3099
|
+
}
|
|
3100
|
+
this.options.locations && (++this.curLine, this.lineStart = this.pos), chunkStart = this.pos;
|
|
3101
|
+
} else
|
|
3102
|
+
++this.pos;
|
|
3103
|
+
}
|
|
3104
|
+
};
|
|
3105
|
+
pp.readInvalidTemplateToken = function() {
|
|
3106
|
+
for (; this.pos < this.input.length; this.pos++)
|
|
3107
|
+
switch (this.input[this.pos]) {
|
|
3108
|
+
case "\\":
|
|
3109
|
+
++this.pos;
|
|
3110
|
+
break;
|
|
3111
|
+
case "$":
|
|
3112
|
+
if (this.input[this.pos + 1] !== "{")
|
|
3113
|
+
break;
|
|
3114
|
+
// fall through
|
|
3115
|
+
case "`":
|
|
3116
|
+
return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
|
|
3117
|
+
case "\r":
|
|
3118
|
+
this.input[this.pos + 1] === `
|
|
3119
|
+
` && ++this.pos;
|
|
3120
|
+
// fall through
|
|
3121
|
+
case `
|
|
3122
|
+
`:
|
|
3123
|
+
case "\u2028":
|
|
3124
|
+
case "\u2029":
|
|
3125
|
+
++this.curLine, this.lineStart = this.pos + 1;
|
|
3126
|
+
break;
|
|
3127
|
+
}
|
|
3128
|
+
this.raise(this.start, "Unterminated template");
|
|
3129
|
+
};
|
|
3130
|
+
pp.readEscapedChar = function(inTemplate) {
|
|
3131
|
+
var ch = this.input.charCodeAt(++this.pos);
|
|
3132
|
+
switch (++this.pos, ch) {
|
|
3133
|
+
case 110:
|
|
3134
|
+
return `
|
|
3135
|
+
`;
|
|
3136
|
+
// 'n' -> '\n'
|
|
3137
|
+
case 114:
|
|
3138
|
+
return "\r";
|
|
3139
|
+
// 'r' -> '\r'
|
|
3140
|
+
case 120:
|
|
3141
|
+
return String.fromCharCode(this.readHexChar(2));
|
|
3142
|
+
// 'x'
|
|
3143
|
+
case 117:
|
|
3144
|
+
return codePointToString(this.readCodePoint());
|
|
3145
|
+
// 'u'
|
|
3146
|
+
case 116:
|
|
3147
|
+
return " ";
|
|
3148
|
+
// 't' -> '\t'
|
|
3149
|
+
case 98:
|
|
3150
|
+
return "\b";
|
|
3151
|
+
// 'b' -> '\b'
|
|
3152
|
+
case 118:
|
|
3153
|
+
return "\v";
|
|
3154
|
+
// 'v' -> '\u000b'
|
|
3155
|
+
case 102:
|
|
3156
|
+
return "\f";
|
|
3157
|
+
// 'f' -> '\f'
|
|
3158
|
+
case 13:
|
|
3159
|
+
this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
3160
|
+
// '\r\n'
|
|
3161
|
+
case 10:
|
|
3162
|
+
return this.options.locations && (this.lineStart = this.pos, ++this.curLine), "";
|
|
3163
|
+
case 56:
|
|
3164
|
+
case 57:
|
|
3165
|
+
if (this.strict && this.invalidStringToken(
|
|
3166
|
+
this.pos - 1,
|
|
3167
|
+
"Invalid escape sequence"
|
|
3168
|
+
), inTemplate) {
|
|
3169
|
+
var codePos = this.pos - 1;
|
|
3170
|
+
this.invalidStringToken(
|
|
3171
|
+
codePos,
|
|
3172
|
+
"Invalid escape sequence in template string"
|
|
3173
|
+
);
|
|
3174
|
+
}
|
|
3175
|
+
default:
|
|
3176
|
+
if (ch >= 48 && ch <= 55) {
|
|
3177
|
+
var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0], octal = parseInt(octalStr, 8);
|
|
3178
|
+
return octal > 255 && (octalStr = octalStr.slice(0, -1), octal = parseInt(octalStr, 8)), this.pos += octalStr.length - 1, ch = this.input.charCodeAt(this.pos), (octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate) && this.invalidStringToken(
|
|
3179
|
+
this.pos - 1 - octalStr.length,
|
|
3180
|
+
inTemplate ? "Octal literal in template string" : "Octal literal in strict mode"
|
|
3181
|
+
), String.fromCharCode(octal);
|
|
3182
|
+
}
|
|
3183
|
+
return isNewLine(ch) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(ch);
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
pp.readHexChar = function(len) {
|
|
3187
|
+
var codePos = this.pos, n = this.readInt(16, len);
|
|
3188
|
+
return n === null && this.invalidStringToken(codePos, "Bad character escape sequence"), n;
|
|
3189
|
+
};
|
|
3190
|
+
pp.readWord1 = function() {
|
|
3191
|
+
this.containsEsc = !1;
|
|
3192
|
+
for (var word = "", first = !0, chunkStart = this.pos, astral = this.options.ecmaVersion >= 6; this.pos < this.input.length; ) {
|
|
3193
|
+
var ch = this.fullCharCodeAtPos();
|
|
3194
|
+
if (isIdentifierChar(ch, astral))
|
|
3195
|
+
this.pos += ch <= 65535 ? 1 : 2;
|
|
3196
|
+
else if (ch === 92) {
|
|
3197
|
+
this.containsEsc = !0, word += this.input.slice(chunkStart, this.pos);
|
|
3198
|
+
var escStart = this.pos;
|
|
3199
|
+
this.input.charCodeAt(++this.pos) !== 117 && this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"), ++this.pos;
|
|
3200
|
+
var esc = this.readCodePoint();
|
|
3201
|
+
(first ? isIdentifierStart : isIdentifierChar)(esc, astral) || this.invalidStringToken(escStart, "Invalid Unicode escape"), word += codePointToString(esc), chunkStart = this.pos;
|
|
3202
|
+
} else
|
|
3203
|
+
break;
|
|
3204
|
+
first = !1;
|
|
3205
|
+
}
|
|
3206
|
+
return word + this.input.slice(chunkStart, this.pos);
|
|
3207
|
+
};
|
|
3208
|
+
pp.readWord = function() {
|
|
3209
|
+
var word = this.readWord1(), type = types$1.name;
|
|
3210
|
+
return this.keywords.test(word) && (type = keywords[word]), this.finishToken(type, word);
|
|
3211
|
+
};
|
|
3212
|
+
version = "8.19.0";
|
|
3213
|
+
Parser.acorn = {
|
|
3214
|
+
Parser,
|
|
3215
|
+
version,
|
|
3216
|
+
defaultOptions,
|
|
3217
|
+
Position,
|
|
3218
|
+
SourceLocation,
|
|
3219
|
+
getLineInfo,
|
|
3220
|
+
Node,
|
|
3221
|
+
TokenType,
|
|
3222
|
+
tokTypes: types$1,
|
|
3223
|
+
keywordTypes: keywords,
|
|
3224
|
+
TokContext,
|
|
3225
|
+
tokContexts: types,
|
|
3226
|
+
isIdentifierChar,
|
|
3227
|
+
isIdentifierStart,
|
|
3228
|
+
Token,
|
|
3229
|
+
isNewLine,
|
|
3230
|
+
lineBreak,
|
|
3231
|
+
lineBreakG,
|
|
3232
|
+
nonASCIIwhitespace
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
|
|
3237
|
+
// ../../node_modules/acorn-jsx/xhtml.js
|
|
3238
|
+
var require_xhtml = __commonJS({
|
|
3239
|
+
"../../node_modules/acorn-jsx/xhtml.js"(exports, module) {
|
|
3240
|
+
module.exports = {
|
|
3241
|
+
quot: '"',
|
|
3242
|
+
amp: "&",
|
|
3243
|
+
apos: "'",
|
|
3244
|
+
lt: "<",
|
|
3245
|
+
gt: ">",
|
|
3246
|
+
nbsp: "\xA0",
|
|
3247
|
+
iexcl: "\xA1",
|
|
3248
|
+
cent: "\xA2",
|
|
3249
|
+
pound: "\xA3",
|
|
3250
|
+
curren: "\xA4",
|
|
3251
|
+
yen: "\xA5",
|
|
3252
|
+
brvbar: "\xA6",
|
|
3253
|
+
sect: "\xA7",
|
|
3254
|
+
uml: "\xA8",
|
|
3255
|
+
copy: "\xA9",
|
|
3256
|
+
ordf: "\xAA",
|
|
3257
|
+
laquo: "\xAB",
|
|
3258
|
+
not: "\xAC",
|
|
3259
|
+
shy: "\xAD",
|
|
3260
|
+
reg: "\xAE",
|
|
3261
|
+
macr: "\xAF",
|
|
3262
|
+
deg: "\xB0",
|
|
3263
|
+
plusmn: "\xB1",
|
|
3264
|
+
sup2: "\xB2",
|
|
3265
|
+
sup3: "\xB3",
|
|
3266
|
+
acute: "\xB4",
|
|
3267
|
+
micro: "\xB5",
|
|
3268
|
+
para: "\xB6",
|
|
3269
|
+
middot: "\xB7",
|
|
3270
|
+
cedil: "\xB8",
|
|
3271
|
+
sup1: "\xB9",
|
|
3272
|
+
ordm: "\xBA",
|
|
3273
|
+
raquo: "\xBB",
|
|
3274
|
+
frac14: "\xBC",
|
|
3275
|
+
frac12: "\xBD",
|
|
3276
|
+
frac34: "\xBE",
|
|
3277
|
+
iquest: "\xBF",
|
|
3278
|
+
Agrave: "\xC0",
|
|
3279
|
+
Aacute: "\xC1",
|
|
3280
|
+
Acirc: "\xC2",
|
|
3281
|
+
Atilde: "\xC3",
|
|
3282
|
+
Auml: "\xC4",
|
|
3283
|
+
Aring: "\xC5",
|
|
3284
|
+
AElig: "\xC6",
|
|
3285
|
+
Ccedil: "\xC7",
|
|
3286
|
+
Egrave: "\xC8",
|
|
3287
|
+
Eacute: "\xC9",
|
|
3288
|
+
Ecirc: "\xCA",
|
|
3289
|
+
Euml: "\xCB",
|
|
3290
|
+
Igrave: "\xCC",
|
|
3291
|
+
Iacute: "\xCD",
|
|
3292
|
+
Icirc: "\xCE",
|
|
3293
|
+
Iuml: "\xCF",
|
|
3294
|
+
ETH: "\xD0",
|
|
3295
|
+
Ntilde: "\xD1",
|
|
3296
|
+
Ograve: "\xD2",
|
|
3297
|
+
Oacute: "\xD3",
|
|
3298
|
+
Ocirc: "\xD4",
|
|
3299
|
+
Otilde: "\xD5",
|
|
3300
|
+
Ouml: "\xD6",
|
|
3301
|
+
times: "\xD7",
|
|
3302
|
+
Oslash: "\xD8",
|
|
3303
|
+
Ugrave: "\xD9",
|
|
3304
|
+
Uacute: "\xDA",
|
|
3305
|
+
Ucirc: "\xDB",
|
|
3306
|
+
Uuml: "\xDC",
|
|
3307
|
+
Yacute: "\xDD",
|
|
3308
|
+
THORN: "\xDE",
|
|
3309
|
+
szlig: "\xDF",
|
|
3310
|
+
agrave: "\xE0",
|
|
3311
|
+
aacute: "\xE1",
|
|
3312
|
+
acirc: "\xE2",
|
|
3313
|
+
atilde: "\xE3",
|
|
3314
|
+
auml: "\xE4",
|
|
3315
|
+
aring: "\xE5",
|
|
3316
|
+
aelig: "\xE6",
|
|
3317
|
+
ccedil: "\xE7",
|
|
3318
|
+
egrave: "\xE8",
|
|
3319
|
+
eacute: "\xE9",
|
|
3320
|
+
ecirc: "\xEA",
|
|
3321
|
+
euml: "\xEB",
|
|
3322
|
+
igrave: "\xEC",
|
|
3323
|
+
iacute: "\xED",
|
|
3324
|
+
icirc: "\xEE",
|
|
3325
|
+
iuml: "\xEF",
|
|
3326
|
+
eth: "\xF0",
|
|
3327
|
+
ntilde: "\xF1",
|
|
3328
|
+
ograve: "\xF2",
|
|
3329
|
+
oacute: "\xF3",
|
|
3330
|
+
ocirc: "\xF4",
|
|
3331
|
+
otilde: "\xF5",
|
|
3332
|
+
ouml: "\xF6",
|
|
3333
|
+
divide: "\xF7",
|
|
3334
|
+
oslash: "\xF8",
|
|
3335
|
+
ugrave: "\xF9",
|
|
3336
|
+
uacute: "\xFA",
|
|
3337
|
+
ucirc: "\xFB",
|
|
3338
|
+
uuml: "\xFC",
|
|
3339
|
+
yacute: "\xFD",
|
|
3340
|
+
thorn: "\xFE",
|
|
3341
|
+
yuml: "\xFF",
|
|
3342
|
+
OElig: "\u0152",
|
|
3343
|
+
oelig: "\u0153",
|
|
3344
|
+
Scaron: "\u0160",
|
|
3345
|
+
scaron: "\u0161",
|
|
3346
|
+
Yuml: "\u0178",
|
|
3347
|
+
fnof: "\u0192",
|
|
3348
|
+
circ: "\u02C6",
|
|
3349
|
+
tilde: "\u02DC",
|
|
3350
|
+
Alpha: "\u0391",
|
|
3351
|
+
Beta: "\u0392",
|
|
3352
|
+
Gamma: "\u0393",
|
|
3353
|
+
Delta: "\u0394",
|
|
3354
|
+
Epsilon: "\u0395",
|
|
3355
|
+
Zeta: "\u0396",
|
|
3356
|
+
Eta: "\u0397",
|
|
3357
|
+
Theta: "\u0398",
|
|
3358
|
+
Iota: "\u0399",
|
|
3359
|
+
Kappa: "\u039A",
|
|
3360
|
+
Lambda: "\u039B",
|
|
3361
|
+
Mu: "\u039C",
|
|
3362
|
+
Nu: "\u039D",
|
|
3363
|
+
Xi: "\u039E",
|
|
3364
|
+
Omicron: "\u039F",
|
|
3365
|
+
Pi: "\u03A0",
|
|
3366
|
+
Rho: "\u03A1",
|
|
3367
|
+
Sigma: "\u03A3",
|
|
3368
|
+
Tau: "\u03A4",
|
|
3369
|
+
Upsilon: "\u03A5",
|
|
3370
|
+
Phi: "\u03A6",
|
|
3371
|
+
Chi: "\u03A7",
|
|
3372
|
+
Psi: "\u03A8",
|
|
3373
|
+
Omega: "\u03A9",
|
|
3374
|
+
alpha: "\u03B1",
|
|
3375
|
+
beta: "\u03B2",
|
|
3376
|
+
gamma: "\u03B3",
|
|
3377
|
+
delta: "\u03B4",
|
|
3378
|
+
epsilon: "\u03B5",
|
|
3379
|
+
zeta: "\u03B6",
|
|
3380
|
+
eta: "\u03B7",
|
|
3381
|
+
theta: "\u03B8",
|
|
3382
|
+
iota: "\u03B9",
|
|
3383
|
+
kappa: "\u03BA",
|
|
3384
|
+
lambda: "\u03BB",
|
|
3385
|
+
mu: "\u03BC",
|
|
3386
|
+
nu: "\u03BD",
|
|
3387
|
+
xi: "\u03BE",
|
|
3388
|
+
omicron: "\u03BF",
|
|
3389
|
+
pi: "\u03C0",
|
|
3390
|
+
rho: "\u03C1",
|
|
3391
|
+
sigmaf: "\u03C2",
|
|
3392
|
+
sigma: "\u03C3",
|
|
3393
|
+
tau: "\u03C4",
|
|
3394
|
+
upsilon: "\u03C5",
|
|
3395
|
+
phi: "\u03C6",
|
|
3396
|
+
chi: "\u03C7",
|
|
3397
|
+
psi: "\u03C8",
|
|
3398
|
+
omega: "\u03C9",
|
|
3399
|
+
thetasym: "\u03D1",
|
|
3400
|
+
upsih: "\u03D2",
|
|
3401
|
+
piv: "\u03D6",
|
|
3402
|
+
ensp: "\u2002",
|
|
3403
|
+
emsp: "\u2003",
|
|
3404
|
+
thinsp: "\u2009",
|
|
3405
|
+
zwnj: "\u200C",
|
|
3406
|
+
zwj: "\u200D",
|
|
3407
|
+
lrm: "\u200E",
|
|
3408
|
+
rlm: "\u200F",
|
|
3409
|
+
ndash: "\u2013",
|
|
3410
|
+
mdash: "\u2014",
|
|
3411
|
+
lsquo: "\u2018",
|
|
3412
|
+
rsquo: "\u2019",
|
|
3413
|
+
sbquo: "\u201A",
|
|
3414
|
+
ldquo: "\u201C",
|
|
3415
|
+
rdquo: "\u201D",
|
|
3416
|
+
bdquo: "\u201E",
|
|
3417
|
+
dagger: "\u2020",
|
|
3418
|
+
Dagger: "\u2021",
|
|
3419
|
+
bull: "\u2022",
|
|
3420
|
+
hellip: "\u2026",
|
|
3421
|
+
permil: "\u2030",
|
|
3422
|
+
prime: "\u2032",
|
|
3423
|
+
Prime: "\u2033",
|
|
3424
|
+
lsaquo: "\u2039",
|
|
3425
|
+
rsaquo: "\u203A",
|
|
3426
|
+
oline: "\u203E",
|
|
3427
|
+
frasl: "\u2044",
|
|
3428
|
+
euro: "\u20AC",
|
|
3429
|
+
image: "\u2111",
|
|
3430
|
+
weierp: "\u2118",
|
|
3431
|
+
real: "\u211C",
|
|
3432
|
+
trade: "\u2122",
|
|
3433
|
+
alefsym: "\u2135",
|
|
3434
|
+
larr: "\u2190",
|
|
3435
|
+
uarr: "\u2191",
|
|
3436
|
+
rarr: "\u2192",
|
|
3437
|
+
darr: "\u2193",
|
|
3438
|
+
harr: "\u2194",
|
|
3439
|
+
crarr: "\u21B5",
|
|
3440
|
+
lArr: "\u21D0",
|
|
3441
|
+
uArr: "\u21D1",
|
|
3442
|
+
rArr: "\u21D2",
|
|
3443
|
+
dArr: "\u21D3",
|
|
3444
|
+
hArr: "\u21D4",
|
|
3445
|
+
forall: "\u2200",
|
|
3446
|
+
part: "\u2202",
|
|
3447
|
+
exist: "\u2203",
|
|
3448
|
+
empty: "\u2205",
|
|
3449
|
+
nabla: "\u2207",
|
|
3450
|
+
isin: "\u2208",
|
|
3451
|
+
notin: "\u2209",
|
|
3452
|
+
ni: "\u220B",
|
|
3453
|
+
prod: "\u220F",
|
|
3454
|
+
sum: "\u2211",
|
|
3455
|
+
minus: "\u2212",
|
|
3456
|
+
lowast: "\u2217",
|
|
3457
|
+
radic: "\u221A",
|
|
3458
|
+
prop: "\u221D",
|
|
3459
|
+
infin: "\u221E",
|
|
3460
|
+
ang: "\u2220",
|
|
3461
|
+
and: "\u2227",
|
|
3462
|
+
or: "\u2228",
|
|
3463
|
+
cap: "\u2229",
|
|
3464
|
+
cup: "\u222A",
|
|
3465
|
+
int: "\u222B",
|
|
3466
|
+
there4: "\u2234",
|
|
3467
|
+
sim: "\u223C",
|
|
3468
|
+
cong: "\u2245",
|
|
3469
|
+
asymp: "\u2248",
|
|
3470
|
+
ne: "\u2260",
|
|
3471
|
+
equiv: "\u2261",
|
|
3472
|
+
le: "\u2264",
|
|
3473
|
+
ge: "\u2265",
|
|
3474
|
+
sub: "\u2282",
|
|
3475
|
+
sup: "\u2283",
|
|
3476
|
+
nsub: "\u2284",
|
|
3477
|
+
sube: "\u2286",
|
|
3478
|
+
supe: "\u2287",
|
|
3479
|
+
oplus: "\u2295",
|
|
3480
|
+
otimes: "\u2297",
|
|
3481
|
+
perp: "\u22A5",
|
|
3482
|
+
sdot: "\u22C5",
|
|
3483
|
+
lceil: "\u2308",
|
|
3484
|
+
rceil: "\u2309",
|
|
3485
|
+
lfloor: "\u230A",
|
|
3486
|
+
rfloor: "\u230B",
|
|
3487
|
+
lang: "\u2329",
|
|
3488
|
+
rang: "\u232A",
|
|
3489
|
+
loz: "\u25CA",
|
|
3490
|
+
spades: "\u2660",
|
|
3491
|
+
clubs: "\u2663",
|
|
3492
|
+
hearts: "\u2665",
|
|
3493
|
+
diams: "\u2666"
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
});
|
|
3497
|
+
|
|
3498
|
+
// ../../node_modules/acorn-jsx/index.js
|
|
3499
|
+
var require_acorn_jsx = __commonJS({
|
|
3500
|
+
"../../node_modules/acorn-jsx/index.js"(exports, module) {
|
|
3501
|
+
"use strict";
|
|
3502
|
+
var XHTMLEntities = require_xhtml(), hexNumber = /^[\da-fA-F]+$/, decimalNumber = /^\d+$/, acornJsxMap = /* @__PURE__ */ new WeakMap();
|
|
3503
|
+
function getJsxTokens(acorn) {
|
|
3504
|
+
acorn = acorn.Parser.acorn || acorn;
|
|
3505
|
+
let acornJsx = acornJsxMap.get(acorn);
|
|
3506
|
+
if (!acornJsx) {
|
|
3507
|
+
let tt = acorn.tokTypes, TokContext3 = acorn.TokContext, TokenType3 = acorn.TokenType, tc_oTag = new TokContext3("<tag", !1), tc_cTag = new TokContext3("</tag", !1), tc_expr = new TokContext3("<tag>...</tag>", !0, !0), tokContexts = {
|
|
3508
|
+
tc_oTag,
|
|
3509
|
+
tc_cTag,
|
|
3510
|
+
tc_expr
|
|
3511
|
+
}, tokTypes = {
|
|
3512
|
+
jsxName: new TokenType3("jsxName"),
|
|
3513
|
+
jsxText: new TokenType3("jsxText", { beforeExpr: !0 }),
|
|
3514
|
+
jsxTagStart: new TokenType3("jsxTagStart", { startsExpr: !0 }),
|
|
3515
|
+
jsxTagEnd: new TokenType3("jsxTagEnd")
|
|
3516
|
+
};
|
|
3517
|
+
tokTypes.jsxTagStart.updateContext = function() {
|
|
3518
|
+
this.context.push(tc_expr), this.context.push(tc_oTag), this.exprAllowed = !1;
|
|
3519
|
+
}, tokTypes.jsxTagEnd.updateContext = function(prevType) {
|
|
3520
|
+
let out = this.context.pop();
|
|
3521
|
+
out === tc_oTag && prevType === tt.slash || out === tc_cTag ? (this.context.pop(), this.exprAllowed = this.curContext() === tc_expr) : this.exprAllowed = !0;
|
|
3522
|
+
}, acornJsx = { tokContexts, tokTypes }, acornJsxMap.set(acorn, acornJsx);
|
|
3523
|
+
}
|
|
3524
|
+
return acornJsx;
|
|
3525
|
+
}
|
|
3526
|
+
function getQualifiedJSXName(object) {
|
|
3527
|
+
if (!object)
|
|
3528
|
+
return object;
|
|
3529
|
+
if (object.type === "JSXIdentifier")
|
|
3530
|
+
return object.name;
|
|
3531
|
+
if (object.type === "JSXNamespacedName")
|
|
3532
|
+
return object.namespace.name + ":" + object.name.name;
|
|
3533
|
+
if (object.type === "JSXMemberExpression")
|
|
3534
|
+
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
|
|
3535
|
+
}
|
|
3536
|
+
module.exports = function(options) {
|
|
3537
|
+
return options = options || {}, function(Parser3) {
|
|
3538
|
+
return plugin({
|
|
3539
|
+
allowNamespaces: options.allowNamespaces !== !1,
|
|
3540
|
+
allowNamespacedObjects: !!options.allowNamespacedObjects
|
|
3541
|
+
}, Parser3);
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
Object.defineProperty(module.exports, "tokTypes", {
|
|
3545
|
+
get: function() {
|
|
3546
|
+
return getJsxTokens((init_acorn(), __toCommonJS(acorn_exports))).tokTypes;
|
|
3547
|
+
},
|
|
3548
|
+
configurable: !0,
|
|
3549
|
+
enumerable: !0
|
|
3550
|
+
});
|
|
3551
|
+
function plugin(options, Parser3) {
|
|
3552
|
+
let acorn = Parser3.acorn || (init_acorn(), __toCommonJS(acorn_exports)), acornJsx = getJsxTokens(acorn), tt = acorn.tokTypes, tok = acornJsx.tokTypes, tokContexts = acorn.tokContexts, tc_oTag = acornJsx.tokContexts.tc_oTag, tc_cTag = acornJsx.tokContexts.tc_cTag, tc_expr = acornJsx.tokContexts.tc_expr, isNewLine2 = acorn.isNewLine, isIdentifierStart2 = acorn.isIdentifierStart, isIdentifierChar2 = acorn.isIdentifierChar;
|
|
3553
|
+
return class extends Parser3 {
|
|
3554
|
+
// Expose actual `tokTypes` and `tokContexts` to other plugins.
|
|
3555
|
+
static get acornJsx() {
|
|
3556
|
+
return acornJsx;
|
|
3557
|
+
}
|
|
3558
|
+
// Reads inline JSX contents token.
|
|
3559
|
+
jsx_readToken() {
|
|
3560
|
+
let out = "", chunkStart = this.pos;
|
|
3561
|
+
for (; ; ) {
|
|
3562
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated JSX contents");
|
|
3563
|
+
let ch = this.input.charCodeAt(this.pos);
|
|
3564
|
+
switch (ch) {
|
|
3565
|
+
case 60:
|
|
3566
|
+
// '<'
|
|
3567
|
+
case 123:
|
|
3568
|
+
return this.pos === this.start ? ch === 60 && this.exprAllowed ? (++this.pos, this.finishToken(tok.jsxTagStart)) : this.getTokenFromCode(ch) : (out += this.input.slice(chunkStart, this.pos), this.finishToken(tok.jsxText, out));
|
|
3569
|
+
case 38:
|
|
3570
|
+
out += this.input.slice(chunkStart, this.pos), out += this.jsx_readEntity(), chunkStart = this.pos;
|
|
3571
|
+
break;
|
|
3572
|
+
case 62:
|
|
3573
|
+
// '>'
|
|
3574
|
+
case 125:
|
|
3575
|
+
this.raise(
|
|
3576
|
+
this.pos,
|
|
3577
|
+
"Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + (ch === 62 ? ">" : "}") + '` or `{"' + this.input[this.pos] + '"}`?'
|
|
3578
|
+
);
|
|
3579
|
+
default:
|
|
3580
|
+
isNewLine2(ch) ? (out += this.input.slice(chunkStart, this.pos), out += this.jsx_readNewLine(!0), chunkStart = this.pos) : ++this.pos;
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
jsx_readNewLine(normalizeCRLF) {
|
|
3585
|
+
let ch = this.input.charCodeAt(this.pos), out;
|
|
3586
|
+
return ++this.pos, ch === 13 && this.input.charCodeAt(this.pos) === 10 ? (++this.pos, out = normalizeCRLF ? `
|
|
3587
|
+
` : `\r
|
|
3588
|
+
`) : out = String.fromCharCode(ch), this.options.locations && (++this.curLine, this.lineStart = this.pos), out;
|
|
3589
|
+
}
|
|
3590
|
+
jsx_readString(quote) {
|
|
3591
|
+
let out = "", chunkStart = ++this.pos;
|
|
3592
|
+
for (; ; ) {
|
|
3593
|
+
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
3594
|
+
let ch = this.input.charCodeAt(this.pos);
|
|
3595
|
+
if (ch === quote) break;
|
|
3596
|
+
ch === 38 ? (out += this.input.slice(chunkStart, this.pos), out += this.jsx_readEntity(), chunkStart = this.pos) : isNewLine2(ch) ? (out += this.input.slice(chunkStart, this.pos), out += this.jsx_readNewLine(!1), chunkStart = this.pos) : ++this.pos;
|
|
3597
|
+
}
|
|
3598
|
+
return out += this.input.slice(chunkStart, this.pos++), this.finishToken(tt.string, out);
|
|
3599
|
+
}
|
|
3600
|
+
jsx_readEntity() {
|
|
3601
|
+
let str = "", count = 0, entity, ch = this.input[this.pos];
|
|
3602
|
+
ch !== "&" && this.raise(this.pos, "Entity must start with an ampersand");
|
|
3603
|
+
let startPos = ++this.pos;
|
|
3604
|
+
for (; this.pos < this.input.length && count++ < 10; ) {
|
|
3605
|
+
if (ch = this.input[this.pos++], ch === ";") {
|
|
3606
|
+
str[0] === "#" ? str[1] === "x" ? (str = str.substr(2), hexNumber.test(str) && (entity = String.fromCharCode(parseInt(str, 16)))) : (str = str.substr(1), decimalNumber.test(str) && (entity = String.fromCharCode(parseInt(str, 10)))) : entity = XHTMLEntities[str];
|
|
3607
|
+
break;
|
|
3608
|
+
}
|
|
3609
|
+
str += ch;
|
|
3610
|
+
}
|
|
3611
|
+
return entity || (this.pos = startPos, "&");
|
|
3612
|
+
}
|
|
3613
|
+
// Read a JSX identifier (valid tag or attribute name).
|
|
3614
|
+
//
|
|
3615
|
+
// Optimized version since JSX identifiers can't contain
|
|
3616
|
+
// escape characters and so can be read as single slice.
|
|
3617
|
+
// Also assumes that first character was already checked
|
|
3618
|
+
// by isIdentifierStart in readToken.
|
|
3619
|
+
jsx_readWord() {
|
|
3620
|
+
let ch, start = this.pos;
|
|
3621
|
+
do
|
|
3622
|
+
ch = this.input.charCodeAt(++this.pos);
|
|
3623
|
+
while (isIdentifierChar2(ch) || ch === 45);
|
|
3624
|
+
return this.finishToken(tok.jsxName, this.input.slice(start, this.pos));
|
|
3625
|
+
}
|
|
3626
|
+
// Parse next token as JSX identifier
|
|
3627
|
+
jsx_parseIdentifier() {
|
|
3628
|
+
let node = this.startNode();
|
|
3629
|
+
return this.type === tok.jsxName ? node.name = this.value : this.type.keyword ? node.name = this.type.keyword : this.unexpected(), this.next(), this.finishNode(node, "JSXIdentifier");
|
|
3630
|
+
}
|
|
3631
|
+
// Parse namespaced identifier.
|
|
3632
|
+
jsx_parseNamespacedName() {
|
|
3633
|
+
let startPos = this.start, startLoc = this.startLoc, name = this.jsx_parseIdentifier();
|
|
3634
|
+
if (!options.allowNamespaces || !this.eat(tt.colon)) return name;
|
|
3635
|
+
var node = this.startNodeAt(startPos, startLoc);
|
|
3636
|
+
return node.namespace = name, node.name = this.jsx_parseIdentifier(), this.finishNode(node, "JSXNamespacedName");
|
|
3637
|
+
}
|
|
3638
|
+
// Parses element name in any form - namespaced, member
|
|
3639
|
+
// or single identifier.
|
|
3640
|
+
jsx_parseElementName() {
|
|
3641
|
+
if (this.type === tok.jsxTagEnd) return "";
|
|
3642
|
+
let startPos = this.start, startLoc = this.startLoc, node = this.jsx_parseNamespacedName();
|
|
3643
|
+
for (this.type === tt.dot && node.type === "JSXNamespacedName" && !options.allowNamespacedObjects && this.unexpected(); this.eat(tt.dot); ) {
|
|
3644
|
+
let newNode = this.startNodeAt(startPos, startLoc);
|
|
3645
|
+
newNode.object = node, newNode.property = this.jsx_parseIdentifier(), node = this.finishNode(newNode, "JSXMemberExpression");
|
|
3646
|
+
}
|
|
3647
|
+
return node;
|
|
3648
|
+
}
|
|
3649
|
+
// Parses any type of JSX attribute value.
|
|
3650
|
+
jsx_parseAttributeValue() {
|
|
3651
|
+
switch (this.type) {
|
|
3652
|
+
case tt.braceL:
|
|
3653
|
+
let node = this.jsx_parseExpressionContainer();
|
|
3654
|
+
return node.expression.type === "JSXEmptyExpression" && this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"), node;
|
|
3655
|
+
case tok.jsxTagStart:
|
|
3656
|
+
case tt.string:
|
|
3657
|
+
return this.parseExprAtom();
|
|
3658
|
+
default:
|
|
3659
|
+
this.raise(this.start, "JSX value should be either an expression or a quoted JSX text");
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
|
|
3663
|
+
// and so it should start at the end of last read token (left brace) and finish
|
|
3664
|
+
// at the beginning of the next one (right brace).
|
|
3665
|
+
jsx_parseEmptyExpression() {
|
|
3666
|
+
let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
|
3667
|
+
return this.finishNodeAt(node, "JSXEmptyExpression", this.start, this.startLoc);
|
|
3668
|
+
}
|
|
3669
|
+
// Parses JSX expression enclosed into curly brackets.
|
|
3670
|
+
jsx_parseExpressionContainer() {
|
|
3671
|
+
let node = this.startNode();
|
|
3672
|
+
return this.next(), node.expression = this.type === tt.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(), this.expect(tt.braceR), this.finishNode(node, "JSXExpressionContainer");
|
|
3673
|
+
}
|
|
3674
|
+
// Parses following JSX attribute name-value pair.
|
|
3675
|
+
jsx_parseAttribute() {
|
|
3676
|
+
let node = this.startNode();
|
|
3677
|
+
return this.eat(tt.braceL) ? (this.expect(tt.ellipsis), node.argument = this.parseMaybeAssign(), this.expect(tt.braceR), this.finishNode(node, "JSXSpreadAttribute")) : (node.name = this.jsx_parseNamespacedName(), node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null, this.finishNode(node, "JSXAttribute"));
|
|
3678
|
+
}
|
|
3679
|
+
// Parses JSX opening tag starting after '<'.
|
|
3680
|
+
jsx_parseOpeningElementAt(startPos, startLoc) {
|
|
3681
|
+
let node = this.startNodeAt(startPos, startLoc);
|
|
3682
|
+
node.attributes = [];
|
|
3683
|
+
let nodeName = this.jsx_parseElementName();
|
|
3684
|
+
for (nodeName && (node.name = nodeName); this.type !== tt.slash && this.type !== tok.jsxTagEnd; )
|
|
3685
|
+
node.attributes.push(this.jsx_parseAttribute());
|
|
3686
|
+
return node.selfClosing = this.eat(tt.slash), this.expect(tok.jsxTagEnd), this.finishNode(node, nodeName ? "JSXOpeningElement" : "JSXOpeningFragment");
|
|
3687
|
+
}
|
|
3688
|
+
// Parses JSX closing tag starting after '</'.
|
|
3689
|
+
jsx_parseClosingElementAt(startPos, startLoc) {
|
|
3690
|
+
let node = this.startNodeAt(startPos, startLoc), nodeName = this.jsx_parseElementName();
|
|
3691
|
+
return nodeName && (node.name = nodeName), this.expect(tok.jsxTagEnd), this.finishNode(node, nodeName ? "JSXClosingElement" : "JSXClosingFragment");
|
|
3692
|
+
}
|
|
3693
|
+
// Parses entire JSX element, including it's opening tag
|
|
3694
|
+
// (starting after '<'), attributes, contents and closing tag.
|
|
3695
|
+
jsx_parseElementAt(startPos, startLoc) {
|
|
3696
|
+
let node = this.startNodeAt(startPos, startLoc), children = [], openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc), closingElement = null;
|
|
3697
|
+
if (!openingElement.selfClosing) {
|
|
3698
|
+
contents: for (; ; )
|
|
3699
|
+
switch (this.type) {
|
|
3700
|
+
case tok.jsxTagStart:
|
|
3701
|
+
if (startPos = this.start, startLoc = this.startLoc, this.next(), this.eat(tt.slash)) {
|
|
3702
|
+
closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
|
|
3703
|
+
break contents;
|
|
3704
|
+
}
|
|
3705
|
+
children.push(this.jsx_parseElementAt(startPos, startLoc));
|
|
3706
|
+
break;
|
|
3707
|
+
case tok.jsxText:
|
|
3708
|
+
children.push(this.parseExprAtom());
|
|
3709
|
+
break;
|
|
3710
|
+
case tt.braceL:
|
|
3711
|
+
children.push(this.jsx_parseExpressionContainer());
|
|
3712
|
+
break;
|
|
3713
|
+
default:
|
|
3714
|
+
this.unexpected();
|
|
3715
|
+
}
|
|
3716
|
+
getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name) && this.raise(
|
|
3717
|
+
closingElement.start,
|
|
3718
|
+
"Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">"
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
let fragmentOrElement = openingElement.name ? "Element" : "Fragment";
|
|
3722
|
+
return node["opening" + fragmentOrElement] = openingElement, node["closing" + fragmentOrElement] = closingElement, node.children = children, this.type === tt.relational && this.value === "<" && this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag"), this.finishNode(node, "JSX" + fragmentOrElement);
|
|
3723
|
+
}
|
|
3724
|
+
// Parse JSX text
|
|
3725
|
+
jsx_parseText() {
|
|
3726
|
+
let node = this.parseLiteral(this.value);
|
|
3727
|
+
return node.type = "JSXText", node;
|
|
3728
|
+
}
|
|
3729
|
+
// Parses entire JSX element from current position.
|
|
3730
|
+
jsx_parseElement() {
|
|
3731
|
+
let startPos = this.start, startLoc = this.startLoc;
|
|
3732
|
+
return this.next(), this.jsx_parseElementAt(startPos, startLoc);
|
|
3733
|
+
}
|
|
3734
|
+
parseExprAtom(refShortHandDefaultPos) {
|
|
3735
|
+
return this.type === tok.jsxText ? this.jsx_parseText() : this.type === tok.jsxTagStart ? this.jsx_parseElement() : super.parseExprAtom(refShortHandDefaultPos);
|
|
3736
|
+
}
|
|
3737
|
+
readToken(code) {
|
|
3738
|
+
let context = this.curContext();
|
|
3739
|
+
if (context === tc_expr) return this.jsx_readToken();
|
|
3740
|
+
if (context === tc_oTag || context === tc_cTag) {
|
|
3741
|
+
if (isIdentifierStart2(code)) return this.jsx_readWord();
|
|
3742
|
+
if (code == 62)
|
|
3743
|
+
return ++this.pos, this.finishToken(tok.jsxTagEnd);
|
|
3744
|
+
if ((code === 34 || code === 39) && context == tc_oTag)
|
|
3745
|
+
return this.jsx_readString(code);
|
|
3746
|
+
}
|
|
3747
|
+
return code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33 ? (++this.pos, this.finishToken(tok.jsxTagStart)) : super.readToken(code);
|
|
3748
|
+
}
|
|
3749
|
+
updateContext(prevType) {
|
|
3750
|
+
if (this.type == tt.braceL) {
|
|
3751
|
+
var curContext = this.curContext();
|
|
3752
|
+
curContext == tc_oTag ? this.context.push(tokContexts.b_expr) : curContext == tc_expr ? this.context.push(tokContexts.b_tmpl) : super.updateContext(prevType), this.exprAllowed = !0;
|
|
3753
|
+
} else if (this.type === tt.slash && prevType === tok.jsxTagStart)
|
|
3754
|
+
this.context.length -= 2, this.context.push(tc_cTag), this.exprAllowed = !1;
|
|
3755
|
+
else
|
|
3756
|
+
return super.updateContext(prevType);
|
|
3757
|
+
}
|
|
3758
|
+
};
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
});
|
|
3762
|
+
|
|
3763
|
+
export {
|
|
3764
|
+
Parser,
|
|
3765
|
+
init_acorn,
|
|
3766
|
+
require_acorn_jsx
|
|
3767
|
+
};
|