@vc-shell/framework 1.1.45 → 1.1.47
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/CHANGELOG.md +13 -0
- package/core/plugins/modularity/loader.ts +137 -78
- package/dist/assets/042c75b764bc78a7.svg +1 -0
- package/dist/assets/0ba156439a339f2a.svg +1 -0
- package/dist/assets/0be560bfb22d0e72.woff2 +0 -0
- package/dist/assets/0f590f8a94577092.svg +1 -0
- package/dist/assets/0fc5820f8be53a1b.svg +1 -0
- package/dist/assets/10768e2cc79fc60b.svg +1 -0
- package/dist/assets/11b3d25a56fd9a21.woff2 +0 -0
- package/dist/assets/157b8721e0600ea8.svg +1 -0
- package/dist/assets/15e91cdd649cde9a.svg +1 -0
- package/dist/assets/1a3e84b2457f709a.woff +0 -0
- package/dist/assets/1de63eb118636cce.svg +1 -0
- package/dist/assets/1ea01de36eb5491b.svg +1 -0
- package/dist/assets/204eaf512fde2023.svg +1 -0
- package/dist/assets/2088983edf42e153.svg +1 -0
- package/dist/assets/208f810a9321a327.svg +1 -0
- package/dist/assets/21220a9d10e6c558.svg +1 -0
- package/dist/assets/220db345a102045d.woff2 +0 -0
- package/dist/assets/225da11d23968333.svg +1 -0
- package/dist/assets/226f862dd81bdc13.woff2 +0 -0
- package/dist/assets/23a2d53395ddb14f.woff +0 -0
- package/dist/assets/259e6ad461a52ad7.svg +1 -0
- package/dist/assets/261e6dec4d53b9ac.woff +0 -0
- package/dist/assets/262f46a0b6d94bb6.svg +1 -0
- package/dist/assets/2857c513073467da.svg +1 -0
- package/dist/assets/2b3be7889467d98f.woff +0 -0
- package/dist/assets/2d4e6190eec72737.svg +1 -0
- package/dist/assets/2eba973185078bc8.woff +0 -0
- package/dist/assets/327511cd4a7ba7f9.woff +0 -0
- package/dist/assets/334d3f6bc766c516.woff +0 -0
- package/dist/assets/34ff7dd0c2285956.svg +1 -0
- package/dist/assets/3d26b7c1ab78bbe2.woff +0 -0
- package/dist/assets/3f8c4cc8099e34b6.woff2 +0 -0
- package/dist/assets/40a0e53b79ce63c6.woff2 +0 -0
- package/dist/assets/41275bcb979cb650.svg +1 -0
- package/dist/assets/42df4e2d6fa3fd2a.woff2 +0 -0
- package/dist/assets/434f7982590e462f.woff +0 -0
- package/dist/assets/4ae5f23e0ca888e7.woff2 +0 -0
- package/dist/assets/4d7a77b0e5373992.svg +1 -0
- package/dist/assets/4e43c74354534fb3.svg +1 -0
- package/dist/assets/4fe75f5117100705.svg +1 -0
- package/dist/assets/52610491f372cb0c.woff2 +0 -0
- package/dist/assets/52e261a005074e1b.woff +0 -0
- package/dist/assets/5304c3d05a5f9789.woff2 +0 -0
- package/dist/assets/572bb1bb4156a9c1.svg +1 -0
- package/dist/assets/5b3661be8be679d0.woff2 +0 -0
- package/dist/assets/5d96cfcc5bedd917.woff2 +0 -0
- package/dist/assets/6075995d7e74da46.woff2 +0 -0
- package/dist/assets/617c4736236e199e.woff +0 -0
- package/dist/assets/6619e9e10beea0e7.woff2 +0 -0
- package/dist/assets/67230f05dc94a265.svg +1 -0
- package/dist/assets/6798e4dd4add9b48.svg +1 -0
- package/dist/assets/698ec6c722d4cb05.woff2 +0 -0
- package/dist/assets/6a3e73faf406cf33.svg +1 -0
- package/dist/assets/72de3a63bc0b70dd.svg +1 -0
- package/dist/assets/74c6a6ab81bb6340.woff2 +0 -0
- package/dist/assets/74ed5f8a78e71106.svg +1 -0
- package/dist/assets/7ce0c166fd6a1204.woff +0 -0
- package/dist/assets/7d55399c2a7bc985.svg +1 -0
- package/dist/assets/7d970675c69fca1d.woff +0 -0
- package/dist/assets/7eda727273fd98d3.svg +1 -0
- package/dist/assets/7f6ebfd707b76ca2.woff +0 -0
- package/dist/assets/7fa898d213fcc7bc.woff2 +0 -0
- package/dist/assets/861e6b7192b3b6c7.woff +0 -0
- package/dist/assets/8bbcde81ba21ecb2.woff2 +0 -0
- package/dist/assets/8f6657e5e0b8d3e4.woff +0 -0
- package/dist/assets/910b0d99b9e26568.svg +1 -0
- package/dist/assets/91eee1aa81f72683.woff +0 -0
- package/dist/assets/92508f8707159b51.svg +1 -0
- package/dist/assets/9392bf1d591e1abb.svg +1 -0
- package/dist/assets/97e8d4984ba0713a.woff2 +0 -0
- package/dist/assets/9cb83236f6bb7ab1.svg +1 -0
- package/dist/assets/9d37314695c0b68d.woff +0 -0
- package/dist/assets/a18404194e3f9047.svg +1 -0
- package/dist/assets/a2017fe7f0a26510.svg +1 -0
- package/dist/assets/a47034e65dbcc3d7.woff +0 -0
- package/dist/assets/a617e11804bbacb7.woff +0 -0
- package/dist/assets/ab6e7190bb1492d5.woff2 +0 -0
- package/dist/assets/abf88f301a0730f4.svg +1 -0
- package/dist/assets/aed17cb6fdad2ada.woff2 +0 -0
- package/dist/assets/b1a596e31ad1185a.svg +1 -0
- package/dist/assets/b27767411c8427be.woff +0 -0
- package/dist/assets/b291dc35a17511f7.woff +0 -0
- package/dist/assets/b325adcae33bbe7a.svg +1 -0
- package/dist/assets/b372390551ca2fa1.svg +1 -0
- package/dist/assets/b5bb1e8fc975decd.svg +1 -0
- package/dist/assets/b645a4a2181b9dc1.svg +1 -0
- package/dist/assets/b6499ddce0a4ef7d.svg +1 -0
- package/dist/assets/b94421fadd23b0f2.svg +1 -0
- package/dist/assets/bb28fb0f27f1c11b.svg +1 -0
- package/dist/assets/bfbe205759295eca.woff2 +0 -0
- package/dist/assets/ca791c5ca5848a03.svg +1 -0
- package/dist/assets/cb32840ce330103f.woff +0 -0
- package/dist/assets/d084bda16abe8a56.svg +1 -0
- package/dist/assets/d32b129cae2fffd6.svg +1 -0
- package/dist/assets/d35a4c7113315758.woff2 +0 -0
- package/dist/assets/d3f792f54ae4c307.svg +1 -0
- package/dist/assets/d5a5b8630120073d.svg +1 -0
- package/dist/assets/d5f9664ebbfb104b.svg +1 -0
- package/dist/assets/d80b05788e407de7.woff2 +0 -0
- package/dist/assets/d84247b59449dd88.woff2 +0 -0
- package/dist/assets/dd05d43ff0df2fc7.svg +1 -0
- package/dist/assets/e38acaa1757232e0.svg +1 -0
- package/dist/assets/e4a8550f1c7ffe36.svg +1 -0
- package/dist/assets/e5adb5ae3a3698f6.svg +1 -0
- package/dist/assets/e61a1889bac955f4.woff2 +0 -0
- package/dist/assets/e72bb11356af94c7.svg +1 -0
- package/dist/assets/e98196a9f8dcb2f0.svg +1 -0
- package/dist/assets/ebec912a42ad49ff.woff +0 -0
- package/dist/assets/f09d89268e4c0317.svg +1 -0
- package/dist/assets/f276d55184e05a07.woff +0 -0
- package/dist/assets/f5722262b6e7214e.woff2 +0 -0
- package/dist/assets/f7fc8bf46089d8b2.svg +1 -0
- package/dist/assets/fcb1c1ffb5640194.woff +0 -0
- package/dist/assets/fe141d99763f5d2b.woff +0 -0
- package/dist/assets/fed13b0d59903483.svg +1 -0
- package/dist/assets/fed757d2c2344ead.woff2 +0 -0
- package/dist/assets/ffc438f20e79ce73.woff +0 -0
- package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
- package/dist/framework.js +16549 -25875
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
- package/dist/vendor-boolbase-Bgn9I6iN.js +21 -0
- package/dist/vendor-cheerio-CleDsuQZ.js +1053 -0
- package/dist/vendor-cheerio-select-CVkYl3Z-.js +191 -0
- package/dist/vendor-css-select-CtIzVIiG.js +622 -0
- package/dist/vendor-css-what-CZZaquJM.js +267 -0
- package/dist/vendor-cypress-signalr-mock-CdKwIhWw.js +769 -0
- package/dist/vendor-date-fns-CdFbeoHV.js +2989 -0
- package/dist/vendor-dom-serializer-CugO0RdN.js +213 -0
- package/dist/vendor-dom7-wvIUV9pT.js +529 -0
- package/dist/vendor-domelementtype-B3sFIGaC.js +21 -0
- package/dist/vendor-domhandler-CL40eeX9.js +311 -0
- package/dist/vendor-dompurify-eYFoHPwR.js +528 -0
- package/dist/vendor-domutils-D3Y2YQFR.js +386 -0
- package/dist/vendor-entities-v26HW8wW.js +363 -0
- package/dist/vendor-floating-ui-core-C9uEvi1M.js +349 -0
- package/dist/vendor-floating-ui-dom-CZkYGmv4.js +393 -0
- package/dist/vendor-floating-ui-utils-Bx3BTd6_.js +259 -0
- package/dist/vendor-floating-ui-vue-CLOiVYP7.js +107 -0
- package/dist/vendor-headlessui-vue-Dg0Llidi.js +961 -0
- package/dist/vendor-htmlparser2-CXL_uhMI.js +735 -0
- package/dist/vendor-iconify-vue-D4fihzvl.js +1205 -0
- package/dist/vendor-intlify-core-base-Bvt2vJFV.js +1129 -0
- package/dist/vendor-intlify-message-compiler-1VxNzq21.js +945 -0
- package/dist/vendor-intlify-shared-D7kiPMOG.js +130 -0
- package/dist/vendor-iso-639-1-dVGfSUIM.js +781 -0
- package/dist/vendor-linkify-it-LzoUhj6C.js +199 -0
- package/dist/vendor-linkifyjs-DTu7SY_Y.js +705 -0
- package/dist/vendor-lodash-es-CrYlgAi8.js +4816 -0
- package/dist/vendor-markdown-it-4AJoRTAg.js +2263 -0
- package/dist/vendor-markdown-it-task-lists-Byg1-ms9.js +69 -0
- package/dist/vendor-mdurl-DZFDNdqC.js +192 -0
- package/dist/vendor-microsoft-applicationinsights-analytics-js-DA-ctcAL.js +1105 -0
- package/dist/vendor-microsoft-applicationinsights-cfgsync-js-COfRj-2q.js +261 -0
- package/dist/vendor-microsoft-applicationinsights-channel-js-MTPYhH-I.js +1809 -0
- package/dist/vendor-microsoft-applicationinsights-common-CDVnJ6MR.js +1921 -0
- package/dist/vendor-microsoft-applicationinsights-core-js-D7Aicf8S.js +4127 -0
- package/dist/vendor-microsoft-applicationinsights-dependencies-js-CvQWWraU.js +1399 -0
- package/dist/vendor-microsoft-applicationinsights-properties-js-C0Iv1cZE.js +572 -0
- package/dist/vendor-microsoft-applicationinsights-shims-CxtPYiwp.js +43 -0
- package/dist/vendor-microsoft-applicationinsights-web-BRuQAzjU.js +487 -0
- package/dist/vendor-microsoft-dynamicproto-js-DSkQkH3T.js +147 -0
- package/dist/vendor-microsoft-signalr-qIrag5xx.js +1761 -0
- package/dist/vendor-moment-CwOqp704.js +2589 -0
- package/dist/vendor-nevware21-ts-async-FAyg3c9V.js +260 -0
- package/dist/vendor-nevware21-ts-utils-Dy41wRhA.js +853 -0
- package/dist/vendor-nth-check-BE7AeBMg.js +45 -0
- package/dist/vendor-orderedmap-B3SOk52B.js +103 -0
- package/dist/vendor-parse5-DqztJOGh.js +5747 -0
- package/dist/vendor-parse5-htmlparser2-tree-adapter-CNubfdOP.js +143 -0
- package/dist/vendor-popperjs-core-LGjf7Wza.js +905 -0
- package/dist/vendor-prettier-D8C9GG-0.js +4858 -0
- package/dist/vendor-prosemirror-commands-BqYcdumy.js +344 -0
- package/dist/vendor-prosemirror-dropcursor-zknUsW5x.js +86 -0
- package/dist/vendor-prosemirror-gapcursor-DjOZhP78.js +200 -0
- package/dist/vendor-prosemirror-history-l8l3CFac.js +248 -0
- package/dist/vendor-prosemirror-keymap-C17r08p-.js +62 -0
- package/dist/vendor-prosemirror-markdown-WJEDhc-w.js +650 -0
- package/dist/vendor-prosemirror-model-BN5TnJD_.js +2736 -0
- package/dist/vendor-prosemirror-schema-list-CR0gi7aY.js +87 -0
- package/dist/vendor-prosemirror-state-B0bFP8WI.js +821 -0
- package/dist/vendor-prosemirror-tables-B1txTKlC.js +1711 -0
- package/dist/vendor-prosemirror-transform-Bo7kNPme.js +1507 -0
- package/dist/vendor-prosemirror-view--C7TZvmQ.js +3746 -0
- package/dist/vendor-punycode-js-CNI-zL6U.js +133 -0
- package/dist/vendor-rope-sequence-sEGCUMi8.js +100 -0
- package/dist/vendor-semver-BoKYtkQw.js +1021 -0
- package/dist/vendor-ssr-window-D4k3p53c.js +133 -0
- package/dist/vendor-swiper-CMVLTGu0.js +2825 -0
- package/dist/vendor-tippy-js-BGdgwGX-.js +812 -0
- package/dist/vendor-tiptap-core-BRY37Sb2.js +2806 -0
- package/dist/vendor-tiptap-extension-blockquote-CPd5qv-9.js +43 -0
- package/dist/vendor-tiptap-extension-bold-B0GwBNks.js +71 -0
- package/dist/vendor-tiptap-extension-bubble-menu-B0sZZld7.js +128 -0
- package/dist/vendor-tiptap-extension-bullet-list-CQm4ReOu.js +53 -0
- package/dist/vendor-tiptap-extension-code-C8cy6bRj.js +51 -0
- package/dist/vendor-tiptap-extension-code-block-BqTchNEf.js +133 -0
- package/dist/vendor-tiptap-extension-document-Dka1Uu0g.js +9 -0
- package/dist/vendor-tiptap-extension-dropcursor-CFSh-BuE.js +20 -0
- package/dist/vendor-tiptap-extension-floating-menu-H8PB4zeI.js +99 -0
- package/dist/vendor-tiptap-extension-gapcursor-CzwfD_IT.js +24 -0
- package/dist/vendor-tiptap-extension-hard-break-Rm6aVcrK.js +55 -0
- package/dist/vendor-tiptap-extension-heading-CavI6u1v.js +54 -0
- package/dist/vendor-tiptap-extension-history-WEN1_74D.js +35 -0
- package/dist/vendor-tiptap-extension-horizontal-rule-DZkUEL6s.js +58 -0
- package/dist/vendor-tiptap-extension-image-B67_mxGM.js +64 -0
- package/dist/vendor-tiptap-extension-italic-BshxBFou.js +70 -0
- package/dist/vendor-tiptap-extension-link-CJAQIgui.js +262 -0
- package/dist/vendor-tiptap-extension-list-item-DF-iMpqO.js +33 -0
- package/dist/vendor-tiptap-extension-ordered-list-CN8MF-kN.js +71 -0
- package/dist/vendor-tiptap-extension-paragraph-DI577lM5.js +33 -0
- package/dist/vendor-tiptap-extension-placeholder-DwAtlfAF.js +52 -0
- package/dist/vendor-tiptap-extension-strike-CIty09KN.js +61 -0
- package/dist/vendor-tiptap-extension-table-C5nv-GUb.js +213 -0
- package/dist/vendor-tiptap-extension-table-cell-DXbBhJW3.js +40 -0
- package/dist/vendor-tiptap-extension-table-header-rtggsYXA.js +40 -0
- package/dist/vendor-tiptap-extension-table-row-67khjMDt.js +22 -0
- package/dist/vendor-tiptap-extension-text-D1OHb_a1.js +8 -0
- package/dist/vendor-tiptap-extension-underline-IqWixw3m.js +40 -0
- package/dist/vendor-tiptap-markdown-DVxB1hbO.js +825 -0
- package/dist/vendor-tiptap-starter-kit-CPH9gu2X.js +29 -0
- package/dist/vendor-tiptap-vue-3-CkBe4_xM.js +225 -0
- package/dist/vendor-truncate-html-Bx1HJzRq.js +145 -0
- package/dist/vendor-uc-micro-4lbSaZOs.js +17 -0
- package/dist/vendor-vee-validate-i18n-zT8NxX3R.js +93 -0
- package/dist/vendor-vee-validate-rules-DDeNM2Gc.js +314 -0
- package/dist/vendor-vue-currency-input-DxWnS-HB.js +315 -0
- package/dist/vendor-vue-devtools-api-aVYGocXp.js +93 -0
- package/dist/vendor-vue-i18n-DPtOLen3.js +1359 -0
- package/dist/vendor-vue3-application-insights-dAGGfA_M.js +69 -0
- package/dist/vendor-vue3-touch-events-8Pa3HHlV.js +169 -0
- package/dist/vendor-vuepic-vue-datepicker-DglsiNYa.js +4997 -0
- package/dist/vendor-vueuse-components-DtK_mxpP.js +219 -0
- package/dist/vendor-vueuse-core-cB-c7DzH.js +5129 -0
- package/dist/vendor-vueuse-shared-Dg7PMM0z.js +1169 -0
- package/dist/vendor-w3c-keyname-CLxH8j-f.js +92 -0
- package/dist/vendor-whatwg-fetch-l0sNRNKZ.js +1 -0
- package/package.json +5 -4
- package/ui/components/atoms/vc-icon/vc-icon.vue +10 -23
- package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +2 -1
- package/dist/vendor-boolbase-Cp9L0GAZ.js +0 -25
- package/dist/vendor-cheerio-HN9zIPZn.js +0 -3135
- package/dist/vendor-cheerio-select-5Ry0HvBq.js +0 -306
- package/dist/vendor-css-select-DRIZ9kfZ.js +0 -966
- package/dist/vendor-css-what-DuPJ1HEF.js +0 -448
- package/dist/vendor-cypress-signalr-mock-BKdBJpdt.js +0 -778
- package/dist/vendor-date-fns-515YWkk-.js +0 -6724
- package/dist/vendor-dom-serializer-nQMsqjYW.js +0 -286
- package/dist/vendor-dom7-CJLPMwy5.js +0 -941
- package/dist/vendor-domelementtype-CjSzQey5.js +0 -53
- package/dist/vendor-domhandler-9z8cS16a.js +0 -484
- package/dist/vendor-dompurify-CRFzu7ib.js +0 -1336
- package/dist/vendor-domutils-Bc-Opz-v.js +0 -981
- package/dist/vendor-entities-Bfsx4xOQ.js +0 -636
- package/dist/vendor-floating-ui-core-wV8u8QP4.js +0 -511
- package/dist/vendor-floating-ui-dom-DDnRPs17.js +0 -706
- package/dist/vendor-floating-ui-utils-OMIFy1QU.js +0 -296
- package/dist/vendor-floating-ui-vue-D-tCDAMm.js +0 -167
- package/dist/vendor-fontsource-plus-jakarta-sans.css +0 -1
- package/dist/vendor-headlessui-vue-CY9FRgTb.js +0 -83
- package/dist/vendor-htmlparser2-B1dhFPOs.js +0 -1426
- package/dist/vendor-iconify-vue-DfRGgyNu.js +0 -1840
- package/dist/vendor-intlify-core-base-BuknsFQe.js +0 -1876
- package/dist/vendor-intlify-message-compiler-CuOQDWx1.js +0 -1508
- package/dist/vendor-intlify-shared-Cz4YRMuC.js +0 -241
- package/dist/vendor-iso-639-1-BJCk9DvE.js +0 -819
- package/dist/vendor-linkify-it-CKUf4vsc.js +0 -830
- package/dist/vendor-linkifyjs-BfyGgbCh.js +0 -1756
- package/dist/vendor-lodash-es-BySUOlwf.js +0 -18333
- package/dist/vendor-markdown-it-D-apazHa.js +0 -6000
- package/dist/vendor-markdown-it-task-lists-rxMVH6Ku.js +0 -131
- package/dist/vendor-mdurl-BNh2CCgT.js +0 -537
- package/dist/vendor-microsoft-applicationinsights-analytics-js-kG3lLg8X.js +0 -1275
- package/dist/vendor-microsoft-applicationinsights-cfgsync-js-C0uQkiQq.js +0 -591
- package/dist/vendor-microsoft-applicationinsights-channel-js-Dyd_PXA3.js +0 -2153
- package/dist/vendor-microsoft-applicationinsights-common-CfmP1_Qr.js +0 -2470
- package/dist/vendor-microsoft-applicationinsights-core-js-Cq4YSEvZ.js +0 -6589
- package/dist/vendor-microsoft-applicationinsights-dependencies-js-C56OBFr4.js +0 -1510
- package/dist/vendor-microsoft-applicationinsights-properties-js-CBJTBawx.js +0 -761
- package/dist/vendor-microsoft-applicationinsights-shims-CX8sJgar.js +0 -70
- package/dist/vendor-microsoft-applicationinsights-web-pim2ri-g.js +0 -667
- package/dist/vendor-microsoft-dynamicproto-js-CFBBUu9p.js +0 -520
- package/dist/vendor-microsoft-signalr-dUnlRsGm.js +0 -3339
- package/dist/vendor-moment-Mki5YqAR.js +0 -5679
- package/dist/vendor-nevware21-ts-async-CLMApQ9E.js +0 -395
- package/dist/vendor-nevware21-ts-utils-e8v8Jty3.js +0 -1160
- package/dist/vendor-nth-check-Bx8TxtJt.js +0 -157
- package/dist/vendor-orderedmap-dGG6uMFJ.js +0 -137
- package/dist/vendor-parse5-Bt2NhSzR.js +0 -8432
- package/dist/vendor-parse5-htmlparser2-tree-adapter-BUUtKzf8.js +0 -216
- package/dist/vendor-popperjs-core-Cr2byIky.js +0 -1790
- package/dist/vendor-prettier-B4PaeWRQ.js +0 -98
- package/dist/vendor-prosemirror-commands-BH9lWGpW.js +0 -561
- package/dist/vendor-prosemirror-dropcursor-CeyPcxrA.js +0 -146
- package/dist/vendor-prosemirror-gapcursor-U8UoUJII.js +0 -236
- package/dist/vendor-prosemirror-history-BDaJkvNx.js +0 -414
- package/dist/vendor-prosemirror-keymap-BbWvIWmH.js +0 -128
- package/dist/vendor-prosemirror-markdown-gB0PXBbz.js +0 -866
- package/dist/vendor-prosemirror-model-BZu3WVcD.js +0 -3463
- package/dist/vendor-prosemirror-schema-list-Bl9NpKA7.js +0 -158
- package/dist/vendor-prosemirror-state-BvL9Pxph.js +0 -1003
- package/dist/vendor-prosemirror-tables-17qAnviK.js +0 -2159
- package/dist/vendor-prosemirror-transform-CE9VV3qg.js +0 -2156
- package/dist/vendor-prosemirror-view-CU2WTHT7.js +0 -5811
- package/dist/vendor-punycode-js-iAs5RxMf.js +0 -441
- package/dist/vendor-rope-sequence-BdXDKoGt.js +0 -207
- package/dist/vendor-semver-CVLMK-S4.js +0 -2702
- package/dist/vendor-ssr-window-s6OpKa3O.js +0 -150
- package/dist/vendor-swiper-CdiyNHVt.js +0 -5679
- package/dist/vendor-tippy-js-DWFe2TfK.js +0 -1647
- package/dist/vendor-tiptap-core-NfwGfaQk.js +0 -4910
- package/dist/vendor-tiptap-extension-blockquote-jmWBTtsI.js +0 -57
- package/dist/vendor-tiptap-extension-bold-p5frh4ak.js +0 -97
- package/dist/vendor-tiptap-extension-bubble-menu-KUhZSfrs.js +0 -218
- package/dist/vendor-tiptap-extension-bullet-list-COmZRoSB.js +0 -73
- package/dist/vendor-tiptap-extension-code-block-DyTARZss.js +0 -221
- package/dist/vendor-tiptap-extension-code-jVv6CXpX.js +0 -75
- package/dist/vendor-tiptap-extension-document-DssuotYs.js +0 -13
- package/dist/vendor-tiptap-extension-dropcursor-BoO0Qv91.js +0 -26
- package/dist/vendor-tiptap-extension-floating-menu-CrO8CN5w.js +0 -165
- package/dist/vendor-tiptap-extension-gapcursor-KpsWEoMD.js +0 -30
- package/dist/vendor-tiptap-extension-hard-break-ldOzhSvf.js +0 -68
- package/dist/vendor-tiptap-extension-heading-CKz2llX0.js +0 -77
- package/dist/vendor-tiptap-extension-history-DeKZ2VQ9.js +0 -48
- package/dist/vendor-tiptap-extension-horizontal-rule-CAjWRyDS.js +0 -92
- package/dist/vendor-tiptap-extension-image-ZagcEYuk.js +0 -76
- package/dist/vendor-tiptap-extension-italic-CM4xdznY.js +0 -96
- package/dist/vendor-tiptap-extension-link-Z-AMC4Ri.js +0 -414
- package/dist/vendor-tiptap-extension-list-item-BJi5QpXc.js +0 -37
- package/dist/vendor-tiptap-extension-ordered-list-C_TMrfBE.js +0 -97
- package/dist/vendor-tiptap-extension-paragraph-CQw0E0Au.js +0 -39
- package/dist/vendor-tiptap-extension-placeholder-BBNVKfa_.js +0 -66
- package/dist/vendor-tiptap-extension-strike-DUyMYX1Z.js +0 -79
- package/dist/vendor-tiptap-extension-table-cell-CoDIMPA5.js +0 -47
- package/dist/vendor-tiptap-extension-table-header-DvbGHnmw.js +0 -47
- package/dist/vendor-tiptap-extension-table-row-D1uqN5Aj.js +0 -26
- package/dist/vendor-tiptap-extension-table-tKS4MOM4.js +0 -354
- package/dist/vendor-tiptap-extension-text-DtRBhKB2.js +0 -12
- package/dist/vendor-tiptap-extension-underline-DqaSFp_P.js +0 -50
- package/dist/vendor-tiptap-markdown-7-PCADTU.js +0 -1017
- package/dist/vendor-tiptap-starter-kit-CDSV_Zuu.js +0 -88
- package/dist/vendor-tiptap-vue-3-DZg2fjq_.js +0 -268
- package/dist/vendor-truncate-html-3qQY0Djo.js +0 -196
- package/dist/vendor-uc-micro-jjt6LQ65.js +0 -23
- package/dist/vendor-vee-validate-i18n-v_gHjRmD.js +0 -154
- package/dist/vendor-vee-validate-rules-DzV3VY3N.js +0 -536
- package/dist/vendor-vue-currency-input-DGAkEFBO.js +0 -545
- package/dist/vendor-vue-devtools-api-DXYR8qBG.js +0 -169
- package/dist/vendor-vue-i18n-Co752uk3.js +0 -1897
- package/dist/vendor-vue3-application-insights-CYWFCr_J.js +0 -119
- package/dist/vendor-vue3-touch-events-BJEAiSa3.js +0 -416
- package/dist/vendor-vuepic-vue-datepicker-BSWXRSiu.js +0 -5019
- package/dist/vendor-vueuse-components-l1bL12mE.js +0 -339
- package/dist/vendor-vueuse-core-DGcJOmwG.js +0 -7743
- package/dist/vendor-vueuse-shared-_mOXsFuM.js +0 -1568
- package/dist/vendor-w3c-keyname-BOm2dtJm.js +0 -121
|
@@ -1,1508 +0,0 @@
|
|
|
1
|
-
import { l as format, d as assign, u as join, b as isString } from './vendor-intlify-shared-Cz4YRMuC.js';
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* message-compiler v11.1.7
|
|
5
|
-
* (c) 2025 kazuya kawaguchi
|
|
6
|
-
* Released under the MIT License.
|
|
7
|
-
*/
|
|
8
|
-
function createPosition(line, column, offset) {
|
|
9
|
-
return { line, column, offset };
|
|
10
|
-
}
|
|
11
|
-
function createLocation(start, end, source) {
|
|
12
|
-
const loc = { start, end };
|
|
13
|
-
return loc;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const CompileErrorCodes = {
|
|
17
|
-
// tokenizer error codes
|
|
18
|
-
EXPECTED_TOKEN: 1,
|
|
19
|
-
INVALID_TOKEN_IN_PLACEHOLDER: 2,
|
|
20
|
-
UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,
|
|
21
|
-
UNKNOWN_ESCAPE_SEQUENCE: 4,
|
|
22
|
-
INVALID_UNICODE_ESCAPE_SEQUENCE: 5,
|
|
23
|
-
UNBALANCED_CLOSING_BRACE: 6,
|
|
24
|
-
UNTERMINATED_CLOSING_BRACE: 7,
|
|
25
|
-
EMPTY_PLACEHOLDER: 8,
|
|
26
|
-
NOT_ALLOW_NEST_PLACEHOLDER: 9,
|
|
27
|
-
INVALID_LINKED_FORMAT: 10,
|
|
28
|
-
// parser error codes
|
|
29
|
-
MUST_HAVE_MESSAGES_IN_PLURAL: 11,
|
|
30
|
-
UNEXPECTED_EMPTY_LINKED_MODIFIER: 12,
|
|
31
|
-
UNEXPECTED_EMPTY_LINKED_KEY: 13,
|
|
32
|
-
UNEXPECTED_LEXICAL_ANALYSIS: 14,
|
|
33
|
-
// generator error codes
|
|
34
|
-
UNHANDLED_CODEGEN_NODE_TYPE: 15,
|
|
35
|
-
// minifier error codes
|
|
36
|
-
UNHANDLED_MINIFIER_NODE_TYPE: 16
|
|
37
|
-
};
|
|
38
|
-
// Special value for higher-order compilers to pick up the last code
|
|
39
|
-
// to avoid collision of error codes.
|
|
40
|
-
// This should always be kept as the last item.
|
|
41
|
-
const COMPILE_ERROR_CODES_EXTEND_POINT = 17;
|
|
42
|
-
/** @internal */
|
|
43
|
-
const errorMessages = {
|
|
44
|
-
// tokenizer error messages
|
|
45
|
-
[CompileErrorCodes.EXPECTED_TOKEN]: `Expected token: '{0}'`,
|
|
46
|
-
[CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]: `Invalid token in placeholder: '{0}'`,
|
|
47
|
-
[CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]: `Unterminated single quote in placeholder`,
|
|
48
|
-
[CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]: `Unknown escape sequence: \\{0}`,
|
|
49
|
-
[CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]: `Invalid unicode escape sequence: {0}`,
|
|
50
|
-
[CompileErrorCodes.UNBALANCED_CLOSING_BRACE]: `Unbalanced closing brace`,
|
|
51
|
-
[CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]: `Unterminated closing brace`,
|
|
52
|
-
[CompileErrorCodes.EMPTY_PLACEHOLDER]: `Empty placeholder`,
|
|
53
|
-
[CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]: `Not allowed nest placeholder`,
|
|
54
|
-
[CompileErrorCodes.INVALID_LINKED_FORMAT]: `Invalid linked format`,
|
|
55
|
-
// parser error messages
|
|
56
|
-
[CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]: `Plural must have messages`,
|
|
57
|
-
[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]: `Unexpected empty linked modifier`,
|
|
58
|
-
[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]: `Unexpected empty linked key`,
|
|
59
|
-
[CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]: `Unexpected lexical analysis in token: '{0}'`,
|
|
60
|
-
// generator error messages
|
|
61
|
-
[CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE]: `unhandled codegen node type: '{0}'`,
|
|
62
|
-
// minimizer error messages
|
|
63
|
-
[CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE]: `unhandled mimifier node type: '{0}'`
|
|
64
|
-
};
|
|
65
|
-
function createCompileError(code, loc, options = {}) {
|
|
66
|
-
const { domain, messages, args } = options;
|
|
67
|
-
const msg = (process.env.NODE_ENV !== 'production')
|
|
68
|
-
? format((messages || errorMessages)[code] || '', ...(args || []))
|
|
69
|
-
: code;
|
|
70
|
-
const error = new SyntaxError(String(msg));
|
|
71
|
-
error.code = code;
|
|
72
|
-
if (loc) {
|
|
73
|
-
error.location = loc;
|
|
74
|
-
}
|
|
75
|
-
error.domain = domain;
|
|
76
|
-
return error;
|
|
77
|
-
}
|
|
78
|
-
/** @internal */
|
|
79
|
-
function defaultOnError(error) {
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// eslint-disable-next-line no-useless-escape
|
|
84
|
-
const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
|
|
85
|
-
const detectHtmlTag = (source) => RE_HTML_TAG.test(source);
|
|
86
|
-
|
|
87
|
-
const CHAR_SP = ' ';
|
|
88
|
-
const CHAR_CR = '\r';
|
|
89
|
-
const CHAR_LF = '\n';
|
|
90
|
-
const CHAR_LS = String.fromCharCode(0x2028);
|
|
91
|
-
const CHAR_PS = String.fromCharCode(0x2029);
|
|
92
|
-
function createScanner(str) {
|
|
93
|
-
const _buf = str;
|
|
94
|
-
let _index = 0;
|
|
95
|
-
let _line = 1;
|
|
96
|
-
let _column = 1;
|
|
97
|
-
let _peekOffset = 0;
|
|
98
|
-
const isCRLF = (index) => _buf[index] === CHAR_CR && _buf[index + 1] === CHAR_LF;
|
|
99
|
-
const isLF = (index) => _buf[index] === CHAR_LF;
|
|
100
|
-
const isPS = (index) => _buf[index] === CHAR_PS;
|
|
101
|
-
const isLS = (index) => _buf[index] === CHAR_LS;
|
|
102
|
-
const isLineEnd = (index) => isCRLF(index) || isLF(index) || isPS(index) || isLS(index);
|
|
103
|
-
const index = () => _index;
|
|
104
|
-
const line = () => _line;
|
|
105
|
-
const column = () => _column;
|
|
106
|
-
const peekOffset = () => _peekOffset;
|
|
107
|
-
const charAt = (offset) => isCRLF(offset) || isPS(offset) || isLS(offset) ? CHAR_LF : _buf[offset];
|
|
108
|
-
const currentChar = () => charAt(_index);
|
|
109
|
-
const currentPeek = () => charAt(_index + _peekOffset);
|
|
110
|
-
function next() {
|
|
111
|
-
_peekOffset = 0;
|
|
112
|
-
if (isLineEnd(_index)) {
|
|
113
|
-
_line++;
|
|
114
|
-
_column = 0;
|
|
115
|
-
}
|
|
116
|
-
if (isCRLF(_index)) {
|
|
117
|
-
_index++;
|
|
118
|
-
}
|
|
119
|
-
_index++;
|
|
120
|
-
_column++;
|
|
121
|
-
return _buf[_index];
|
|
122
|
-
}
|
|
123
|
-
function peek() {
|
|
124
|
-
if (isCRLF(_index + _peekOffset)) {
|
|
125
|
-
_peekOffset++;
|
|
126
|
-
}
|
|
127
|
-
_peekOffset++;
|
|
128
|
-
return _buf[_index + _peekOffset];
|
|
129
|
-
}
|
|
130
|
-
function reset() {
|
|
131
|
-
_index = 0;
|
|
132
|
-
_line = 1;
|
|
133
|
-
_column = 1;
|
|
134
|
-
_peekOffset = 0;
|
|
135
|
-
}
|
|
136
|
-
function resetPeek(offset = 0) {
|
|
137
|
-
_peekOffset = offset;
|
|
138
|
-
}
|
|
139
|
-
function skipToPeek() {
|
|
140
|
-
const target = _index + _peekOffset;
|
|
141
|
-
while (target !== _index) {
|
|
142
|
-
next();
|
|
143
|
-
}
|
|
144
|
-
_peekOffset = 0;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
index,
|
|
148
|
-
line,
|
|
149
|
-
column,
|
|
150
|
-
peekOffset,
|
|
151
|
-
charAt,
|
|
152
|
-
currentChar,
|
|
153
|
-
currentPeek,
|
|
154
|
-
next,
|
|
155
|
-
peek,
|
|
156
|
-
reset,
|
|
157
|
-
resetPeek,
|
|
158
|
-
skipToPeek
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const EOF = undefined;
|
|
163
|
-
const DOT = '.';
|
|
164
|
-
const LITERAL_DELIMITER = "'";
|
|
165
|
-
const ERROR_DOMAIN$3 = 'tokenizer';
|
|
166
|
-
function createTokenizer(source, options = {}) {
|
|
167
|
-
const location = options.location !== false;
|
|
168
|
-
const _scnr = createScanner(source);
|
|
169
|
-
const currentOffset = () => _scnr.index();
|
|
170
|
-
const currentPosition = () => createPosition(_scnr.line(), _scnr.column(), _scnr.index());
|
|
171
|
-
const _initLoc = currentPosition();
|
|
172
|
-
const _initOffset = currentOffset();
|
|
173
|
-
const _context = {
|
|
174
|
-
currentType: 13 /* TokenTypes.EOF */,
|
|
175
|
-
offset: _initOffset,
|
|
176
|
-
startLoc: _initLoc,
|
|
177
|
-
endLoc: _initLoc,
|
|
178
|
-
lastType: 13 /* TokenTypes.EOF */,
|
|
179
|
-
lastOffset: _initOffset,
|
|
180
|
-
lastStartLoc: _initLoc,
|
|
181
|
-
lastEndLoc: _initLoc,
|
|
182
|
-
braceNest: 0,
|
|
183
|
-
inLinked: false,
|
|
184
|
-
text: ''
|
|
185
|
-
};
|
|
186
|
-
const context = () => _context;
|
|
187
|
-
const { onError } = options;
|
|
188
|
-
function emitError(code, pos, offset, ...args) {
|
|
189
|
-
const ctx = context();
|
|
190
|
-
pos.column += offset;
|
|
191
|
-
pos.offset += offset;
|
|
192
|
-
if (onError) {
|
|
193
|
-
const loc = location ? createLocation(ctx.startLoc, pos) : null;
|
|
194
|
-
const err = createCompileError(code, loc, {
|
|
195
|
-
domain: ERROR_DOMAIN$3,
|
|
196
|
-
args
|
|
197
|
-
});
|
|
198
|
-
onError(err);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function getToken(context, type, value) {
|
|
202
|
-
context.endLoc = currentPosition();
|
|
203
|
-
context.currentType = type;
|
|
204
|
-
const token = { type };
|
|
205
|
-
if (location) {
|
|
206
|
-
token.loc = createLocation(context.startLoc, context.endLoc);
|
|
207
|
-
}
|
|
208
|
-
if (value != null) {
|
|
209
|
-
token.value = value;
|
|
210
|
-
}
|
|
211
|
-
return token;
|
|
212
|
-
}
|
|
213
|
-
const getEndToken = (context) => getToken(context, 13 /* TokenTypes.EOF */);
|
|
214
|
-
function eat(scnr, ch) {
|
|
215
|
-
if (scnr.currentChar() === ch) {
|
|
216
|
-
scnr.next();
|
|
217
|
-
return ch;
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);
|
|
221
|
-
return '';
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
function peekSpaces(scnr) {
|
|
225
|
-
let buf = '';
|
|
226
|
-
while (scnr.currentPeek() === CHAR_SP || scnr.currentPeek() === CHAR_LF) {
|
|
227
|
-
buf += scnr.currentPeek();
|
|
228
|
-
scnr.peek();
|
|
229
|
-
}
|
|
230
|
-
return buf;
|
|
231
|
-
}
|
|
232
|
-
function skipSpaces(scnr) {
|
|
233
|
-
const buf = peekSpaces(scnr);
|
|
234
|
-
scnr.skipToPeek();
|
|
235
|
-
return buf;
|
|
236
|
-
}
|
|
237
|
-
function isIdentifierStart(ch) {
|
|
238
|
-
if (ch === EOF) {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
const cc = ch.charCodeAt(0);
|
|
242
|
-
return ((cc >= 97 && cc <= 122) || // a-z
|
|
243
|
-
(cc >= 65 && cc <= 90) || // A-Z
|
|
244
|
-
cc === 95 // _
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
function isNumberStart(ch) {
|
|
248
|
-
if (ch === EOF) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
const cc = ch.charCodeAt(0);
|
|
252
|
-
return cc >= 48 && cc <= 57; // 0-9
|
|
253
|
-
}
|
|
254
|
-
function isNamedIdentifierStart(scnr, context) {
|
|
255
|
-
const { currentType } = context;
|
|
256
|
-
if (currentType !== 2 /* TokenTypes.BraceLeft */) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
peekSpaces(scnr);
|
|
260
|
-
const ret = isIdentifierStart(scnr.currentPeek());
|
|
261
|
-
scnr.resetPeek();
|
|
262
|
-
return ret;
|
|
263
|
-
}
|
|
264
|
-
function isListIdentifierStart(scnr, context) {
|
|
265
|
-
const { currentType } = context;
|
|
266
|
-
if (currentType !== 2 /* TokenTypes.BraceLeft */) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
peekSpaces(scnr);
|
|
270
|
-
const ch = scnr.currentPeek() === '-' ? scnr.peek() : scnr.currentPeek();
|
|
271
|
-
const ret = isNumberStart(ch);
|
|
272
|
-
scnr.resetPeek();
|
|
273
|
-
return ret;
|
|
274
|
-
}
|
|
275
|
-
function isLiteralStart(scnr, context) {
|
|
276
|
-
const { currentType } = context;
|
|
277
|
-
if (currentType !== 2 /* TokenTypes.BraceLeft */) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
peekSpaces(scnr);
|
|
281
|
-
const ret = scnr.currentPeek() === LITERAL_DELIMITER;
|
|
282
|
-
scnr.resetPeek();
|
|
283
|
-
return ret;
|
|
284
|
-
}
|
|
285
|
-
function isLinkedDotStart(scnr, context) {
|
|
286
|
-
const { currentType } = context;
|
|
287
|
-
if (currentType !== 7 /* TokenTypes.LinkedAlias */) {
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
peekSpaces(scnr);
|
|
291
|
-
const ret = scnr.currentPeek() === "." /* TokenChars.LinkedDot */;
|
|
292
|
-
scnr.resetPeek();
|
|
293
|
-
return ret;
|
|
294
|
-
}
|
|
295
|
-
function isLinkedModifierStart(scnr, context) {
|
|
296
|
-
const { currentType } = context;
|
|
297
|
-
if (currentType !== 8 /* TokenTypes.LinkedDot */) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
peekSpaces(scnr);
|
|
301
|
-
const ret = isIdentifierStart(scnr.currentPeek());
|
|
302
|
-
scnr.resetPeek();
|
|
303
|
-
return ret;
|
|
304
|
-
}
|
|
305
|
-
function isLinkedDelimiterStart(scnr, context) {
|
|
306
|
-
const { currentType } = context;
|
|
307
|
-
if (!(currentType === 7 /* TokenTypes.LinkedAlias */ ||
|
|
308
|
-
currentType === 11 /* TokenTypes.LinkedModifier */)) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
peekSpaces(scnr);
|
|
312
|
-
const ret = scnr.currentPeek() === ":" /* TokenChars.LinkedDelimiter */;
|
|
313
|
-
scnr.resetPeek();
|
|
314
|
-
return ret;
|
|
315
|
-
}
|
|
316
|
-
function isLinkedReferStart(scnr, context) {
|
|
317
|
-
const { currentType } = context;
|
|
318
|
-
if (currentType !== 9 /* TokenTypes.LinkedDelimiter */) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
const fn = () => {
|
|
322
|
-
const ch = scnr.currentPeek();
|
|
323
|
-
if (ch === "{" /* TokenChars.BraceLeft */) {
|
|
324
|
-
return isIdentifierStart(scnr.peek());
|
|
325
|
-
}
|
|
326
|
-
else if (ch === "@" /* TokenChars.LinkedAlias */ ||
|
|
327
|
-
ch === "|" /* TokenChars.Pipe */ ||
|
|
328
|
-
ch === ":" /* TokenChars.LinkedDelimiter */ ||
|
|
329
|
-
ch === "." /* TokenChars.LinkedDot */ ||
|
|
330
|
-
ch === CHAR_SP ||
|
|
331
|
-
!ch) {
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
else if (ch === CHAR_LF) {
|
|
335
|
-
scnr.peek();
|
|
336
|
-
return fn();
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
// other characters
|
|
340
|
-
return isTextStart(scnr, false);
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
const ret = fn();
|
|
344
|
-
scnr.resetPeek();
|
|
345
|
-
return ret;
|
|
346
|
-
}
|
|
347
|
-
function isPluralStart(scnr) {
|
|
348
|
-
peekSpaces(scnr);
|
|
349
|
-
const ret = scnr.currentPeek() === "|" /* TokenChars.Pipe */;
|
|
350
|
-
scnr.resetPeek();
|
|
351
|
-
return ret;
|
|
352
|
-
}
|
|
353
|
-
function isTextStart(scnr, reset = true) {
|
|
354
|
-
const fn = (hasSpace = false, prev = '') => {
|
|
355
|
-
const ch = scnr.currentPeek();
|
|
356
|
-
if (ch === "{" /* TokenChars.BraceLeft */) {
|
|
357
|
-
return hasSpace;
|
|
358
|
-
}
|
|
359
|
-
else if (ch === "@" /* TokenChars.LinkedAlias */ || !ch) {
|
|
360
|
-
return hasSpace;
|
|
361
|
-
}
|
|
362
|
-
else if (ch === "|" /* TokenChars.Pipe */) {
|
|
363
|
-
return !(prev === CHAR_SP || prev === CHAR_LF);
|
|
364
|
-
}
|
|
365
|
-
else if (ch === CHAR_SP) {
|
|
366
|
-
scnr.peek();
|
|
367
|
-
return fn(true, CHAR_SP);
|
|
368
|
-
}
|
|
369
|
-
else if (ch === CHAR_LF) {
|
|
370
|
-
scnr.peek();
|
|
371
|
-
return fn(true, CHAR_LF);
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
const ret = fn();
|
|
378
|
-
reset && scnr.resetPeek();
|
|
379
|
-
return ret;
|
|
380
|
-
}
|
|
381
|
-
function takeChar(scnr, fn) {
|
|
382
|
-
const ch = scnr.currentChar();
|
|
383
|
-
if (ch === EOF) {
|
|
384
|
-
return EOF;
|
|
385
|
-
}
|
|
386
|
-
if (fn(ch)) {
|
|
387
|
-
scnr.next();
|
|
388
|
-
return ch;
|
|
389
|
-
}
|
|
390
|
-
return null;
|
|
391
|
-
}
|
|
392
|
-
function isIdentifier(ch) {
|
|
393
|
-
const cc = ch.charCodeAt(0);
|
|
394
|
-
return ((cc >= 97 && cc <= 122) || // a-z
|
|
395
|
-
(cc >= 65 && cc <= 90) || // A-Z
|
|
396
|
-
(cc >= 48 && cc <= 57) || // 0-9
|
|
397
|
-
cc === 95 || // _
|
|
398
|
-
cc === 36 // $
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
function takeIdentifierChar(scnr) {
|
|
402
|
-
return takeChar(scnr, isIdentifier);
|
|
403
|
-
}
|
|
404
|
-
function isNamedIdentifier(ch) {
|
|
405
|
-
const cc = ch.charCodeAt(0);
|
|
406
|
-
return ((cc >= 97 && cc <= 122) || // a-z
|
|
407
|
-
(cc >= 65 && cc <= 90) || // A-Z
|
|
408
|
-
(cc >= 48 && cc <= 57) || // 0-9
|
|
409
|
-
cc === 95 || // _
|
|
410
|
-
cc === 36 || // $
|
|
411
|
-
cc === 45 // -
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
function takeNamedIdentifierChar(scnr) {
|
|
415
|
-
return takeChar(scnr, isNamedIdentifier);
|
|
416
|
-
}
|
|
417
|
-
function isDigit(ch) {
|
|
418
|
-
const cc = ch.charCodeAt(0);
|
|
419
|
-
return cc >= 48 && cc <= 57; // 0-9
|
|
420
|
-
}
|
|
421
|
-
function takeDigit(scnr) {
|
|
422
|
-
return takeChar(scnr, isDigit);
|
|
423
|
-
}
|
|
424
|
-
function isHexDigit(ch) {
|
|
425
|
-
const cc = ch.charCodeAt(0);
|
|
426
|
-
return ((cc >= 48 && cc <= 57) || // 0-9
|
|
427
|
-
(cc >= 65 && cc <= 70) || // A-F
|
|
428
|
-
(cc >= 97 && cc <= 102)); // a-f
|
|
429
|
-
}
|
|
430
|
-
function takeHexDigit(scnr) {
|
|
431
|
-
return takeChar(scnr, isHexDigit);
|
|
432
|
-
}
|
|
433
|
-
function getDigits(scnr) {
|
|
434
|
-
let ch = '';
|
|
435
|
-
let num = '';
|
|
436
|
-
while ((ch = takeDigit(scnr))) {
|
|
437
|
-
num += ch;
|
|
438
|
-
}
|
|
439
|
-
return num;
|
|
440
|
-
}
|
|
441
|
-
function readText(scnr) {
|
|
442
|
-
let buf = '';
|
|
443
|
-
while (true) {
|
|
444
|
-
const ch = scnr.currentChar();
|
|
445
|
-
if (ch === "{" /* TokenChars.BraceLeft */ ||
|
|
446
|
-
ch === "}" /* TokenChars.BraceRight */ ||
|
|
447
|
-
ch === "@" /* TokenChars.LinkedAlias */ ||
|
|
448
|
-
ch === "|" /* TokenChars.Pipe */ ||
|
|
449
|
-
!ch) {
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
else if (ch === CHAR_SP || ch === CHAR_LF) {
|
|
453
|
-
if (isTextStart(scnr)) {
|
|
454
|
-
buf += ch;
|
|
455
|
-
scnr.next();
|
|
456
|
-
}
|
|
457
|
-
else if (isPluralStart(scnr)) {
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
buf += ch;
|
|
462
|
-
scnr.next();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
buf += ch;
|
|
467
|
-
scnr.next();
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
return buf;
|
|
471
|
-
}
|
|
472
|
-
function readNamedIdentifier(scnr) {
|
|
473
|
-
skipSpaces(scnr);
|
|
474
|
-
let ch = '';
|
|
475
|
-
let name = '';
|
|
476
|
-
while ((ch = takeNamedIdentifierChar(scnr))) {
|
|
477
|
-
name += ch;
|
|
478
|
-
}
|
|
479
|
-
if (scnr.currentChar() === EOF) {
|
|
480
|
-
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
|
|
481
|
-
}
|
|
482
|
-
return name;
|
|
483
|
-
}
|
|
484
|
-
function readListIdentifier(scnr) {
|
|
485
|
-
skipSpaces(scnr);
|
|
486
|
-
let value = '';
|
|
487
|
-
if (scnr.currentChar() === '-') {
|
|
488
|
-
scnr.next();
|
|
489
|
-
value += `-${getDigits(scnr)}`;
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
value += getDigits(scnr);
|
|
493
|
-
}
|
|
494
|
-
if (scnr.currentChar() === EOF) {
|
|
495
|
-
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
|
|
496
|
-
}
|
|
497
|
-
return value;
|
|
498
|
-
}
|
|
499
|
-
function isLiteral(ch) {
|
|
500
|
-
return ch !== LITERAL_DELIMITER && ch !== CHAR_LF;
|
|
501
|
-
}
|
|
502
|
-
function readLiteral(scnr) {
|
|
503
|
-
skipSpaces(scnr);
|
|
504
|
-
// eslint-disable-next-line no-useless-escape
|
|
505
|
-
eat(scnr, `\'`);
|
|
506
|
-
let ch = '';
|
|
507
|
-
let literal = '';
|
|
508
|
-
while ((ch = takeChar(scnr, isLiteral))) {
|
|
509
|
-
if (ch === '\\') {
|
|
510
|
-
literal += readEscapeSequence(scnr);
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
literal += ch;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
const current = scnr.currentChar();
|
|
517
|
-
if (current === CHAR_LF || current === EOF) {
|
|
518
|
-
emitError(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, currentPosition(), 0);
|
|
519
|
-
// TODO: Is it correct really?
|
|
520
|
-
if (current === CHAR_LF) {
|
|
521
|
-
scnr.next();
|
|
522
|
-
// eslint-disable-next-line no-useless-escape
|
|
523
|
-
eat(scnr, `\'`);
|
|
524
|
-
}
|
|
525
|
-
return literal;
|
|
526
|
-
}
|
|
527
|
-
// eslint-disable-next-line no-useless-escape
|
|
528
|
-
eat(scnr, `\'`);
|
|
529
|
-
return literal;
|
|
530
|
-
}
|
|
531
|
-
function readEscapeSequence(scnr) {
|
|
532
|
-
const ch = scnr.currentChar();
|
|
533
|
-
switch (ch) {
|
|
534
|
-
case '\\':
|
|
535
|
-
case `\'`: // eslint-disable-line no-useless-escape
|
|
536
|
-
scnr.next();
|
|
537
|
-
return `\\${ch}`;
|
|
538
|
-
case 'u':
|
|
539
|
-
return readUnicodeEscapeSequence(scnr, ch, 4);
|
|
540
|
-
case 'U':
|
|
541
|
-
return readUnicodeEscapeSequence(scnr, ch, 6);
|
|
542
|
-
default:
|
|
543
|
-
emitError(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE, currentPosition(), 0, ch);
|
|
544
|
-
return '';
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
function readUnicodeEscapeSequence(scnr, unicode, digits) {
|
|
548
|
-
eat(scnr, unicode);
|
|
549
|
-
let sequence = '';
|
|
550
|
-
for (let i = 0; i < digits; i++) {
|
|
551
|
-
const ch = takeHexDigit(scnr);
|
|
552
|
-
if (!ch) {
|
|
553
|
-
emitError(CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE, currentPosition(), 0, `\\${unicode}${sequence}${scnr.currentChar()}`);
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
sequence += ch;
|
|
557
|
-
}
|
|
558
|
-
return `\\${unicode}${sequence}`;
|
|
559
|
-
}
|
|
560
|
-
function isInvalidIdentifier(ch) {
|
|
561
|
-
return (ch !== "{" /* TokenChars.BraceLeft */ &&
|
|
562
|
-
ch !== "}" /* TokenChars.BraceRight */ &&
|
|
563
|
-
ch !== CHAR_SP &&
|
|
564
|
-
ch !== CHAR_LF);
|
|
565
|
-
}
|
|
566
|
-
function readInvalidIdentifier(scnr) {
|
|
567
|
-
skipSpaces(scnr);
|
|
568
|
-
let ch = '';
|
|
569
|
-
let identifiers = '';
|
|
570
|
-
while ((ch = takeChar(scnr, isInvalidIdentifier))) {
|
|
571
|
-
identifiers += ch;
|
|
572
|
-
}
|
|
573
|
-
return identifiers;
|
|
574
|
-
}
|
|
575
|
-
function readLinkedModifier(scnr) {
|
|
576
|
-
let ch = '';
|
|
577
|
-
let name = '';
|
|
578
|
-
while ((ch = takeIdentifierChar(scnr))) {
|
|
579
|
-
name += ch;
|
|
580
|
-
}
|
|
581
|
-
return name;
|
|
582
|
-
}
|
|
583
|
-
function readLinkedRefer(scnr) {
|
|
584
|
-
const fn = (buf) => {
|
|
585
|
-
const ch = scnr.currentChar();
|
|
586
|
-
if (ch === "{" /* TokenChars.BraceLeft */ ||
|
|
587
|
-
ch === "@" /* TokenChars.LinkedAlias */ ||
|
|
588
|
-
ch === "|" /* TokenChars.Pipe */ ||
|
|
589
|
-
ch === "(" /* TokenChars.ParenLeft */ ||
|
|
590
|
-
ch === ")" /* TokenChars.ParenRight */ ||
|
|
591
|
-
!ch) {
|
|
592
|
-
return buf;
|
|
593
|
-
}
|
|
594
|
-
else if (ch === CHAR_SP) {
|
|
595
|
-
return buf;
|
|
596
|
-
}
|
|
597
|
-
else if (ch === CHAR_LF || ch === DOT) {
|
|
598
|
-
buf += ch;
|
|
599
|
-
scnr.next();
|
|
600
|
-
return fn(buf);
|
|
601
|
-
}
|
|
602
|
-
else {
|
|
603
|
-
buf += ch;
|
|
604
|
-
scnr.next();
|
|
605
|
-
return fn(buf);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
return fn('');
|
|
609
|
-
}
|
|
610
|
-
function readPlural(scnr) {
|
|
611
|
-
skipSpaces(scnr);
|
|
612
|
-
const plural = eat(scnr, "|" /* TokenChars.Pipe */);
|
|
613
|
-
skipSpaces(scnr);
|
|
614
|
-
return plural;
|
|
615
|
-
}
|
|
616
|
-
// TODO: We need refactoring of token parsing ...
|
|
617
|
-
function readTokenInPlaceholder(scnr, context) {
|
|
618
|
-
let token = null;
|
|
619
|
-
const ch = scnr.currentChar();
|
|
620
|
-
switch (ch) {
|
|
621
|
-
case "{" /* TokenChars.BraceLeft */:
|
|
622
|
-
if (context.braceNest >= 1) {
|
|
623
|
-
emitError(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER, currentPosition(), 0);
|
|
624
|
-
}
|
|
625
|
-
scnr.next();
|
|
626
|
-
token = getToken(context, 2 /* TokenTypes.BraceLeft */, "{" /* TokenChars.BraceLeft */);
|
|
627
|
-
skipSpaces(scnr);
|
|
628
|
-
context.braceNest++;
|
|
629
|
-
return token;
|
|
630
|
-
case "}" /* TokenChars.BraceRight */:
|
|
631
|
-
if (context.braceNest > 0 &&
|
|
632
|
-
context.currentType === 2 /* TokenTypes.BraceLeft */) {
|
|
633
|
-
emitError(CompileErrorCodes.EMPTY_PLACEHOLDER, currentPosition(), 0);
|
|
634
|
-
}
|
|
635
|
-
scnr.next();
|
|
636
|
-
token = getToken(context, 3 /* TokenTypes.BraceRight */, "}" /* TokenChars.BraceRight */);
|
|
637
|
-
context.braceNest--;
|
|
638
|
-
context.braceNest > 0 && skipSpaces(scnr);
|
|
639
|
-
if (context.inLinked && context.braceNest === 0) {
|
|
640
|
-
context.inLinked = false;
|
|
641
|
-
}
|
|
642
|
-
return token;
|
|
643
|
-
case "@" /* TokenChars.LinkedAlias */:
|
|
644
|
-
if (context.braceNest > 0) {
|
|
645
|
-
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
|
|
646
|
-
}
|
|
647
|
-
token = readTokenInLinked(scnr, context) || getEndToken(context);
|
|
648
|
-
context.braceNest = 0;
|
|
649
|
-
return token;
|
|
650
|
-
default: {
|
|
651
|
-
let validNamedIdentifier = true;
|
|
652
|
-
let validListIdentifier = true;
|
|
653
|
-
let validLiteral = true;
|
|
654
|
-
if (isPluralStart(scnr)) {
|
|
655
|
-
if (context.braceNest > 0) {
|
|
656
|
-
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
|
|
657
|
-
}
|
|
658
|
-
token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));
|
|
659
|
-
// reset
|
|
660
|
-
context.braceNest = 0;
|
|
661
|
-
context.inLinked = false;
|
|
662
|
-
return token;
|
|
663
|
-
}
|
|
664
|
-
if (context.braceNest > 0 &&
|
|
665
|
-
(context.currentType === 4 /* TokenTypes.Named */ ||
|
|
666
|
-
context.currentType === 5 /* TokenTypes.List */ ||
|
|
667
|
-
context.currentType === 6 /* TokenTypes.Literal */)) {
|
|
668
|
-
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
|
|
669
|
-
context.braceNest = 0;
|
|
670
|
-
return readToken(scnr, context);
|
|
671
|
-
}
|
|
672
|
-
if ((validNamedIdentifier = isNamedIdentifierStart(scnr, context))) {
|
|
673
|
-
token = getToken(context, 4 /* TokenTypes.Named */, readNamedIdentifier(scnr));
|
|
674
|
-
skipSpaces(scnr);
|
|
675
|
-
return token;
|
|
676
|
-
}
|
|
677
|
-
if ((validListIdentifier = isListIdentifierStart(scnr, context))) {
|
|
678
|
-
token = getToken(context, 5 /* TokenTypes.List */, readListIdentifier(scnr));
|
|
679
|
-
skipSpaces(scnr);
|
|
680
|
-
return token;
|
|
681
|
-
}
|
|
682
|
-
if ((validLiteral = isLiteralStart(scnr, context))) {
|
|
683
|
-
token = getToken(context, 6 /* TokenTypes.Literal */, readLiteral(scnr));
|
|
684
|
-
skipSpaces(scnr);
|
|
685
|
-
return token;
|
|
686
|
-
}
|
|
687
|
-
if (!validNamedIdentifier && !validListIdentifier && !validLiteral) {
|
|
688
|
-
// TODO: we should be re-designed invalid cases, when we will extend message syntax near the future ...
|
|
689
|
-
token = getToken(context, 12 /* TokenTypes.InvalidPlace */, readInvalidIdentifier(scnr));
|
|
690
|
-
emitError(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER, currentPosition(), 0, token.value);
|
|
691
|
-
skipSpaces(scnr);
|
|
692
|
-
return token;
|
|
693
|
-
}
|
|
694
|
-
break;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
return token;
|
|
698
|
-
}
|
|
699
|
-
// TODO: We need refactoring of token parsing ...
|
|
700
|
-
function readTokenInLinked(scnr, context) {
|
|
701
|
-
const { currentType } = context;
|
|
702
|
-
let token = null;
|
|
703
|
-
const ch = scnr.currentChar();
|
|
704
|
-
if ((currentType === 7 /* TokenTypes.LinkedAlias */ ||
|
|
705
|
-
currentType === 8 /* TokenTypes.LinkedDot */ ||
|
|
706
|
-
currentType === 11 /* TokenTypes.LinkedModifier */ ||
|
|
707
|
-
currentType === 9 /* TokenTypes.LinkedDelimiter */) &&
|
|
708
|
-
(ch === CHAR_LF || ch === CHAR_SP)) {
|
|
709
|
-
emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
|
|
710
|
-
}
|
|
711
|
-
switch (ch) {
|
|
712
|
-
case "@" /* TokenChars.LinkedAlias */:
|
|
713
|
-
scnr.next();
|
|
714
|
-
token = getToken(context, 7 /* TokenTypes.LinkedAlias */, "@" /* TokenChars.LinkedAlias */);
|
|
715
|
-
context.inLinked = true;
|
|
716
|
-
return token;
|
|
717
|
-
case "." /* TokenChars.LinkedDot */:
|
|
718
|
-
skipSpaces(scnr);
|
|
719
|
-
scnr.next();
|
|
720
|
-
return getToken(context, 8 /* TokenTypes.LinkedDot */, "." /* TokenChars.LinkedDot */);
|
|
721
|
-
case ":" /* TokenChars.LinkedDelimiter */:
|
|
722
|
-
skipSpaces(scnr);
|
|
723
|
-
scnr.next();
|
|
724
|
-
return getToken(context, 9 /* TokenTypes.LinkedDelimiter */, ":" /* TokenChars.LinkedDelimiter */);
|
|
725
|
-
default:
|
|
726
|
-
if (isPluralStart(scnr)) {
|
|
727
|
-
token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));
|
|
728
|
-
// reset
|
|
729
|
-
context.braceNest = 0;
|
|
730
|
-
context.inLinked = false;
|
|
731
|
-
return token;
|
|
732
|
-
}
|
|
733
|
-
if (isLinkedDotStart(scnr, context) ||
|
|
734
|
-
isLinkedDelimiterStart(scnr, context)) {
|
|
735
|
-
skipSpaces(scnr);
|
|
736
|
-
return readTokenInLinked(scnr, context);
|
|
737
|
-
}
|
|
738
|
-
if (isLinkedModifierStart(scnr, context)) {
|
|
739
|
-
skipSpaces(scnr);
|
|
740
|
-
return getToken(context, 11 /* TokenTypes.LinkedModifier */, readLinkedModifier(scnr));
|
|
741
|
-
}
|
|
742
|
-
if (isLinkedReferStart(scnr, context)) {
|
|
743
|
-
skipSpaces(scnr);
|
|
744
|
-
if (ch === "{" /* TokenChars.BraceLeft */) {
|
|
745
|
-
// scan the placeholder
|
|
746
|
-
return readTokenInPlaceholder(scnr, context) || token;
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
return getToken(context, 10 /* TokenTypes.LinkedKey */, readLinkedRefer(scnr));
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
if (currentType === 7 /* TokenTypes.LinkedAlias */) {
|
|
753
|
-
emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
|
|
754
|
-
}
|
|
755
|
-
context.braceNest = 0;
|
|
756
|
-
context.inLinked = false;
|
|
757
|
-
return readToken(scnr, context);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
// TODO: We need refactoring of token parsing ...
|
|
761
|
-
function readToken(scnr, context) {
|
|
762
|
-
let token = { type: 13 /* TokenTypes.EOF */ };
|
|
763
|
-
if (context.braceNest > 0) {
|
|
764
|
-
return readTokenInPlaceholder(scnr, context) || getEndToken(context);
|
|
765
|
-
}
|
|
766
|
-
if (context.inLinked) {
|
|
767
|
-
return readTokenInLinked(scnr, context) || getEndToken(context);
|
|
768
|
-
}
|
|
769
|
-
const ch = scnr.currentChar();
|
|
770
|
-
switch (ch) {
|
|
771
|
-
case "{" /* TokenChars.BraceLeft */:
|
|
772
|
-
return readTokenInPlaceholder(scnr, context) || getEndToken(context);
|
|
773
|
-
case "}" /* TokenChars.BraceRight */:
|
|
774
|
-
emitError(CompileErrorCodes.UNBALANCED_CLOSING_BRACE, currentPosition(), 0);
|
|
775
|
-
scnr.next();
|
|
776
|
-
return getToken(context, 3 /* TokenTypes.BraceRight */, "}" /* TokenChars.BraceRight */);
|
|
777
|
-
case "@" /* TokenChars.LinkedAlias */:
|
|
778
|
-
return readTokenInLinked(scnr, context) || getEndToken(context);
|
|
779
|
-
default: {
|
|
780
|
-
if (isPluralStart(scnr)) {
|
|
781
|
-
token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));
|
|
782
|
-
// reset
|
|
783
|
-
context.braceNest = 0;
|
|
784
|
-
context.inLinked = false;
|
|
785
|
-
return token;
|
|
786
|
-
}
|
|
787
|
-
if (isTextStart(scnr)) {
|
|
788
|
-
return getToken(context, 0 /* TokenTypes.Text */, readText(scnr));
|
|
789
|
-
}
|
|
790
|
-
break;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return token;
|
|
794
|
-
}
|
|
795
|
-
function nextToken() {
|
|
796
|
-
const { currentType, offset, startLoc, endLoc } = _context;
|
|
797
|
-
_context.lastType = currentType;
|
|
798
|
-
_context.lastOffset = offset;
|
|
799
|
-
_context.lastStartLoc = startLoc;
|
|
800
|
-
_context.lastEndLoc = endLoc;
|
|
801
|
-
_context.offset = currentOffset();
|
|
802
|
-
_context.startLoc = currentPosition();
|
|
803
|
-
if (_scnr.currentChar() === EOF) {
|
|
804
|
-
return getToken(_context, 13 /* TokenTypes.EOF */);
|
|
805
|
-
}
|
|
806
|
-
return readToken(_scnr, _context);
|
|
807
|
-
}
|
|
808
|
-
return {
|
|
809
|
-
nextToken,
|
|
810
|
-
currentOffset,
|
|
811
|
-
currentPosition,
|
|
812
|
-
context
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
const ERROR_DOMAIN$2 = 'parser';
|
|
817
|
-
// Backslash backslash, backslash quote, uHHHH, UHHHHHH.
|
|
818
|
-
const KNOWN_ESCAPES = /(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;
|
|
819
|
-
function fromEscapeSequence(match, codePoint4, codePoint6) {
|
|
820
|
-
switch (match) {
|
|
821
|
-
case `\\\\`:
|
|
822
|
-
return `\\`;
|
|
823
|
-
// eslint-disable-next-line no-useless-escape
|
|
824
|
-
case `\\\'`:
|
|
825
|
-
// eslint-disable-next-line no-useless-escape
|
|
826
|
-
return `\'`;
|
|
827
|
-
default: {
|
|
828
|
-
const codePoint = parseInt(codePoint4 || codePoint6, 16);
|
|
829
|
-
if (codePoint <= 0xd7ff || codePoint >= 0xe000) {
|
|
830
|
-
return String.fromCodePoint(codePoint);
|
|
831
|
-
}
|
|
832
|
-
// invalid ...
|
|
833
|
-
// Replace them with U+FFFD REPLACEMENT CHARACTER.
|
|
834
|
-
return '�';
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
function createParser(options = {}) {
|
|
839
|
-
const location = options.location !== false;
|
|
840
|
-
const { onError } = options;
|
|
841
|
-
function emitError(tokenzer, code, start, offset, ...args) {
|
|
842
|
-
const end = tokenzer.currentPosition();
|
|
843
|
-
end.offset += offset;
|
|
844
|
-
end.column += offset;
|
|
845
|
-
if (onError) {
|
|
846
|
-
const loc = location ? createLocation(start, end) : null;
|
|
847
|
-
const err = createCompileError(code, loc, {
|
|
848
|
-
domain: ERROR_DOMAIN$2,
|
|
849
|
-
args
|
|
850
|
-
});
|
|
851
|
-
onError(err);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function startNode(type, offset, loc) {
|
|
855
|
-
const node = { type };
|
|
856
|
-
if (location) {
|
|
857
|
-
node.start = offset;
|
|
858
|
-
node.end = offset;
|
|
859
|
-
node.loc = { start: loc, end: loc };
|
|
860
|
-
}
|
|
861
|
-
return node;
|
|
862
|
-
}
|
|
863
|
-
function endNode(node, offset, pos, type) {
|
|
864
|
-
if (location) {
|
|
865
|
-
node.end = offset;
|
|
866
|
-
if (node.loc) {
|
|
867
|
-
node.loc.end = pos;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
function parseText(tokenizer, value) {
|
|
872
|
-
const context = tokenizer.context();
|
|
873
|
-
const node = startNode(3 /* NodeTypes.Text */, context.offset, context.startLoc);
|
|
874
|
-
node.value = value;
|
|
875
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
876
|
-
return node;
|
|
877
|
-
}
|
|
878
|
-
function parseList(tokenizer, index) {
|
|
879
|
-
const context = tokenizer.context();
|
|
880
|
-
const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc
|
|
881
|
-
const node = startNode(5 /* NodeTypes.List */, offset, loc);
|
|
882
|
-
node.index = parseInt(index, 10);
|
|
883
|
-
tokenizer.nextToken(); // skip brach right
|
|
884
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
885
|
-
return node;
|
|
886
|
-
}
|
|
887
|
-
function parseNamed(tokenizer, key) {
|
|
888
|
-
const context = tokenizer.context();
|
|
889
|
-
const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc
|
|
890
|
-
const node = startNode(4 /* NodeTypes.Named */, offset, loc);
|
|
891
|
-
node.key = key;
|
|
892
|
-
tokenizer.nextToken(); // skip brach right
|
|
893
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
894
|
-
return node;
|
|
895
|
-
}
|
|
896
|
-
function parseLiteral(tokenizer, value) {
|
|
897
|
-
const context = tokenizer.context();
|
|
898
|
-
const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc
|
|
899
|
-
const node = startNode(9 /* NodeTypes.Literal */, offset, loc);
|
|
900
|
-
node.value = value.replace(KNOWN_ESCAPES, fromEscapeSequence);
|
|
901
|
-
tokenizer.nextToken(); // skip brach right
|
|
902
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
903
|
-
return node;
|
|
904
|
-
}
|
|
905
|
-
function parseLinkedModifier(tokenizer) {
|
|
906
|
-
const token = tokenizer.nextToken();
|
|
907
|
-
const context = tokenizer.context();
|
|
908
|
-
const { lastOffset: offset, lastStartLoc: loc } = context; // get linked dot loc
|
|
909
|
-
const node = startNode(8 /* NodeTypes.LinkedModifier */, offset, loc);
|
|
910
|
-
if (token.type !== 11 /* TokenTypes.LinkedModifier */) {
|
|
911
|
-
// empty modifier
|
|
912
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER, context.lastStartLoc, 0);
|
|
913
|
-
node.value = '';
|
|
914
|
-
endNode(node, offset, loc);
|
|
915
|
-
return {
|
|
916
|
-
nextConsumeToken: token,
|
|
917
|
-
node
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
// check token
|
|
921
|
-
if (token.value == null) {
|
|
922
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
923
|
-
}
|
|
924
|
-
node.value = token.value || '';
|
|
925
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
926
|
-
return {
|
|
927
|
-
node
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
function parseLinkedKey(tokenizer, value) {
|
|
931
|
-
const context = tokenizer.context();
|
|
932
|
-
const node = startNode(7 /* NodeTypes.LinkedKey */, context.offset, context.startLoc);
|
|
933
|
-
node.value = value;
|
|
934
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
935
|
-
return node;
|
|
936
|
-
}
|
|
937
|
-
function parseLinked(tokenizer) {
|
|
938
|
-
const context = tokenizer.context();
|
|
939
|
-
const linkedNode = startNode(6 /* NodeTypes.Linked */, context.offset, context.startLoc);
|
|
940
|
-
let token = tokenizer.nextToken();
|
|
941
|
-
if (token.type === 8 /* TokenTypes.LinkedDot */) {
|
|
942
|
-
const parsed = parseLinkedModifier(tokenizer);
|
|
943
|
-
linkedNode.modifier = parsed.node;
|
|
944
|
-
token = parsed.nextConsumeToken || tokenizer.nextToken();
|
|
945
|
-
}
|
|
946
|
-
// asset check token
|
|
947
|
-
if (token.type !== 9 /* TokenTypes.LinkedDelimiter */) {
|
|
948
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
949
|
-
}
|
|
950
|
-
token = tokenizer.nextToken();
|
|
951
|
-
// skip brace left
|
|
952
|
-
if (token.type === 2 /* TokenTypes.BraceLeft */) {
|
|
953
|
-
token = tokenizer.nextToken();
|
|
954
|
-
}
|
|
955
|
-
switch (token.type) {
|
|
956
|
-
case 10 /* TokenTypes.LinkedKey */:
|
|
957
|
-
if (token.value == null) {
|
|
958
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
959
|
-
}
|
|
960
|
-
linkedNode.key = parseLinkedKey(tokenizer, token.value || '');
|
|
961
|
-
break;
|
|
962
|
-
case 4 /* TokenTypes.Named */:
|
|
963
|
-
if (token.value == null) {
|
|
964
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
965
|
-
}
|
|
966
|
-
linkedNode.key = parseNamed(tokenizer, token.value || '');
|
|
967
|
-
break;
|
|
968
|
-
case 5 /* TokenTypes.List */:
|
|
969
|
-
if (token.value == null) {
|
|
970
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
971
|
-
}
|
|
972
|
-
linkedNode.key = parseList(tokenizer, token.value || '');
|
|
973
|
-
break;
|
|
974
|
-
case 6 /* TokenTypes.Literal */:
|
|
975
|
-
if (token.value == null) {
|
|
976
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
977
|
-
}
|
|
978
|
-
linkedNode.key = parseLiteral(tokenizer, token.value || '');
|
|
979
|
-
break;
|
|
980
|
-
default: {
|
|
981
|
-
// empty key
|
|
982
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY, context.lastStartLoc, 0);
|
|
983
|
-
const nextContext = tokenizer.context();
|
|
984
|
-
const emptyLinkedKeyNode = startNode(7 /* NodeTypes.LinkedKey */, nextContext.offset, nextContext.startLoc);
|
|
985
|
-
emptyLinkedKeyNode.value = '';
|
|
986
|
-
endNode(emptyLinkedKeyNode, nextContext.offset, nextContext.startLoc);
|
|
987
|
-
linkedNode.key = emptyLinkedKeyNode;
|
|
988
|
-
endNode(linkedNode, nextContext.offset, nextContext.startLoc);
|
|
989
|
-
return {
|
|
990
|
-
nextConsumeToken: token,
|
|
991
|
-
node: linkedNode
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
endNode(linkedNode, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
996
|
-
return {
|
|
997
|
-
node: linkedNode
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
function parseMessage(tokenizer) {
|
|
1001
|
-
const context = tokenizer.context();
|
|
1002
|
-
const startOffset = context.currentType === 1 /* TokenTypes.Pipe */
|
|
1003
|
-
? tokenizer.currentOffset()
|
|
1004
|
-
: context.offset;
|
|
1005
|
-
const startLoc = context.currentType === 1 /* TokenTypes.Pipe */
|
|
1006
|
-
? context.endLoc
|
|
1007
|
-
: context.startLoc;
|
|
1008
|
-
const node = startNode(2 /* NodeTypes.Message */, startOffset, startLoc);
|
|
1009
|
-
node.items = [];
|
|
1010
|
-
let nextToken = null;
|
|
1011
|
-
do {
|
|
1012
|
-
const token = nextToken || tokenizer.nextToken();
|
|
1013
|
-
nextToken = null;
|
|
1014
|
-
switch (token.type) {
|
|
1015
|
-
case 0 /* TokenTypes.Text */:
|
|
1016
|
-
if (token.value == null) {
|
|
1017
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
1018
|
-
}
|
|
1019
|
-
node.items.push(parseText(tokenizer, token.value || ''));
|
|
1020
|
-
break;
|
|
1021
|
-
case 5 /* TokenTypes.List */:
|
|
1022
|
-
if (token.value == null) {
|
|
1023
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
1024
|
-
}
|
|
1025
|
-
node.items.push(parseList(tokenizer, token.value || ''));
|
|
1026
|
-
break;
|
|
1027
|
-
case 4 /* TokenTypes.Named */:
|
|
1028
|
-
if (token.value == null) {
|
|
1029
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
1030
|
-
}
|
|
1031
|
-
node.items.push(parseNamed(tokenizer, token.value || ''));
|
|
1032
|
-
break;
|
|
1033
|
-
case 6 /* TokenTypes.Literal */:
|
|
1034
|
-
if (token.value == null) {
|
|
1035
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));
|
|
1036
|
-
}
|
|
1037
|
-
node.items.push(parseLiteral(tokenizer, token.value || ''));
|
|
1038
|
-
break;
|
|
1039
|
-
case 7 /* TokenTypes.LinkedAlias */: {
|
|
1040
|
-
const parsed = parseLinked(tokenizer);
|
|
1041
|
-
node.items.push(parsed.node);
|
|
1042
|
-
nextToken = parsed.nextConsumeToken || null;
|
|
1043
|
-
break;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
} while (context.currentType !== 13 /* TokenTypes.EOF */ &&
|
|
1047
|
-
context.currentType !== 1 /* TokenTypes.Pipe */);
|
|
1048
|
-
// adjust message node loc
|
|
1049
|
-
const endOffset = context.currentType === 1 /* TokenTypes.Pipe */
|
|
1050
|
-
? context.lastOffset
|
|
1051
|
-
: tokenizer.currentOffset();
|
|
1052
|
-
const endLoc = context.currentType === 1 /* TokenTypes.Pipe */
|
|
1053
|
-
? context.lastEndLoc
|
|
1054
|
-
: tokenizer.currentPosition();
|
|
1055
|
-
endNode(node, endOffset, endLoc);
|
|
1056
|
-
return node;
|
|
1057
|
-
}
|
|
1058
|
-
function parsePlural(tokenizer, offset, loc, msgNode) {
|
|
1059
|
-
const context = tokenizer.context();
|
|
1060
|
-
let hasEmptyMessage = msgNode.items.length === 0;
|
|
1061
|
-
const node = startNode(1 /* NodeTypes.Plural */, offset, loc);
|
|
1062
|
-
node.cases = [];
|
|
1063
|
-
node.cases.push(msgNode);
|
|
1064
|
-
do {
|
|
1065
|
-
const msg = parseMessage(tokenizer);
|
|
1066
|
-
if (!hasEmptyMessage) {
|
|
1067
|
-
hasEmptyMessage = msg.items.length === 0;
|
|
1068
|
-
}
|
|
1069
|
-
node.cases.push(msg);
|
|
1070
|
-
} while (context.currentType !== 13 /* TokenTypes.EOF */);
|
|
1071
|
-
if (hasEmptyMessage) {
|
|
1072
|
-
emitError(tokenizer, CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL, loc, 0);
|
|
1073
|
-
}
|
|
1074
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
1075
|
-
return node;
|
|
1076
|
-
}
|
|
1077
|
-
function parseResource(tokenizer) {
|
|
1078
|
-
const context = tokenizer.context();
|
|
1079
|
-
const { offset, startLoc } = context;
|
|
1080
|
-
const msgNode = parseMessage(tokenizer);
|
|
1081
|
-
if (context.currentType === 13 /* TokenTypes.EOF */) {
|
|
1082
|
-
return msgNode;
|
|
1083
|
-
}
|
|
1084
|
-
else {
|
|
1085
|
-
return parsePlural(tokenizer, offset, startLoc, msgNode);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
function parse(source) {
|
|
1089
|
-
const tokenizer = createTokenizer(source, assign({}, options));
|
|
1090
|
-
const context = tokenizer.context();
|
|
1091
|
-
const node = startNode(0 /* NodeTypes.Resource */, context.offset, context.startLoc);
|
|
1092
|
-
if (location && node.loc) {
|
|
1093
|
-
node.loc.source = source;
|
|
1094
|
-
}
|
|
1095
|
-
node.body = parseResource(tokenizer);
|
|
1096
|
-
if (options.onCacheKey) {
|
|
1097
|
-
node.cacheKey = options.onCacheKey(source);
|
|
1098
|
-
}
|
|
1099
|
-
// assert whether achieved to EOF
|
|
1100
|
-
if (context.currentType !== 13 /* TokenTypes.EOF */) {
|
|
1101
|
-
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, source[context.offset] || '');
|
|
1102
|
-
}
|
|
1103
|
-
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
|
|
1104
|
-
return node;
|
|
1105
|
-
}
|
|
1106
|
-
return { parse };
|
|
1107
|
-
}
|
|
1108
|
-
function getTokenCaption(token) {
|
|
1109
|
-
if (token.type === 13 /* TokenTypes.EOF */) {
|
|
1110
|
-
return 'EOF';
|
|
1111
|
-
}
|
|
1112
|
-
const name = (token.value || '').replace(/\r?\n/gu, '\\n');
|
|
1113
|
-
return name.length > 10 ? name.slice(0, 9) + '…' : name;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function createTransformer(ast, options = {} // eslint-disable-line
|
|
1117
|
-
) {
|
|
1118
|
-
const _context = {
|
|
1119
|
-
ast,
|
|
1120
|
-
helpers: new Set()
|
|
1121
|
-
};
|
|
1122
|
-
const context = () => _context;
|
|
1123
|
-
const helper = (name) => {
|
|
1124
|
-
_context.helpers.add(name);
|
|
1125
|
-
return name;
|
|
1126
|
-
};
|
|
1127
|
-
return { context, helper };
|
|
1128
|
-
}
|
|
1129
|
-
function traverseNodes(nodes, transformer) {
|
|
1130
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
1131
|
-
traverseNode(nodes[i], transformer);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
function traverseNode(node, transformer) {
|
|
1135
|
-
// TODO: if we need pre-hook of transform, should be implemented to here
|
|
1136
|
-
switch (node.type) {
|
|
1137
|
-
case 1 /* NodeTypes.Plural */:
|
|
1138
|
-
traverseNodes(node.cases, transformer);
|
|
1139
|
-
transformer.helper("plural" /* HelperNameMap.PLURAL */);
|
|
1140
|
-
break;
|
|
1141
|
-
case 2 /* NodeTypes.Message */:
|
|
1142
|
-
traverseNodes(node.items, transformer);
|
|
1143
|
-
break;
|
|
1144
|
-
case 6 /* NodeTypes.Linked */: {
|
|
1145
|
-
const linked = node;
|
|
1146
|
-
traverseNode(linked.key, transformer);
|
|
1147
|
-
transformer.helper("linked" /* HelperNameMap.LINKED */);
|
|
1148
|
-
transformer.helper("type" /* HelperNameMap.TYPE */);
|
|
1149
|
-
break;
|
|
1150
|
-
}
|
|
1151
|
-
case 5 /* NodeTypes.List */:
|
|
1152
|
-
transformer.helper("interpolate" /* HelperNameMap.INTERPOLATE */);
|
|
1153
|
-
transformer.helper("list" /* HelperNameMap.LIST */);
|
|
1154
|
-
break;
|
|
1155
|
-
case 4 /* NodeTypes.Named */:
|
|
1156
|
-
transformer.helper("interpolate" /* HelperNameMap.INTERPOLATE */);
|
|
1157
|
-
transformer.helper("named" /* HelperNameMap.NAMED */);
|
|
1158
|
-
break;
|
|
1159
|
-
}
|
|
1160
|
-
// TODO: if we need post-hook of transform, should be implemented to here
|
|
1161
|
-
}
|
|
1162
|
-
// transform AST
|
|
1163
|
-
function transform(ast, options = {} // eslint-disable-line
|
|
1164
|
-
) {
|
|
1165
|
-
const transformer = createTransformer(ast);
|
|
1166
|
-
transformer.helper("normalize" /* HelperNameMap.NORMALIZE */);
|
|
1167
|
-
// traverse
|
|
1168
|
-
ast.body && traverseNode(ast.body, transformer);
|
|
1169
|
-
// set meta information
|
|
1170
|
-
const context = transformer.context();
|
|
1171
|
-
ast.helpers = Array.from(context.helpers);
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
function optimize(ast) {
|
|
1175
|
-
const body = ast.body;
|
|
1176
|
-
if (body.type === 2 /* NodeTypes.Message */) {
|
|
1177
|
-
optimizeMessageNode(body);
|
|
1178
|
-
}
|
|
1179
|
-
else {
|
|
1180
|
-
body.cases.forEach(c => optimizeMessageNode(c));
|
|
1181
|
-
}
|
|
1182
|
-
return ast;
|
|
1183
|
-
}
|
|
1184
|
-
function optimizeMessageNode(message) {
|
|
1185
|
-
if (message.items.length === 1) {
|
|
1186
|
-
const item = message.items[0];
|
|
1187
|
-
if (item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */) {
|
|
1188
|
-
message.static = item.value;
|
|
1189
|
-
delete item.value; // optimization for size
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
else {
|
|
1193
|
-
const values = [];
|
|
1194
|
-
for (let i = 0; i < message.items.length; i++) {
|
|
1195
|
-
const item = message.items[i];
|
|
1196
|
-
if (!(item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */)) {
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1199
|
-
if (item.value == null) {
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
values.push(item.value);
|
|
1203
|
-
}
|
|
1204
|
-
if (values.length === message.items.length) {
|
|
1205
|
-
message.static = join(values);
|
|
1206
|
-
for (let i = 0; i < message.items.length; i++) {
|
|
1207
|
-
const item = message.items[i];
|
|
1208
|
-
if (item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */) {
|
|
1209
|
-
delete item.value; // optimization for size
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
const ERROR_DOMAIN$1 = 'minifier';
|
|
1217
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1218
|
-
function minify(node) {
|
|
1219
|
-
node.t = node.type;
|
|
1220
|
-
switch (node.type) {
|
|
1221
|
-
case 0 /* NodeTypes.Resource */: {
|
|
1222
|
-
const resource = node;
|
|
1223
|
-
minify(resource.body);
|
|
1224
|
-
resource.b = resource.body;
|
|
1225
|
-
delete resource.body;
|
|
1226
|
-
break;
|
|
1227
|
-
}
|
|
1228
|
-
case 1 /* NodeTypes.Plural */: {
|
|
1229
|
-
const plural = node;
|
|
1230
|
-
const cases = plural.cases;
|
|
1231
|
-
for (let i = 0; i < cases.length; i++) {
|
|
1232
|
-
minify(cases[i]);
|
|
1233
|
-
}
|
|
1234
|
-
plural.c = cases;
|
|
1235
|
-
delete plural.cases;
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
case 2 /* NodeTypes.Message */: {
|
|
1239
|
-
const message = node;
|
|
1240
|
-
const items = message.items;
|
|
1241
|
-
for (let i = 0; i < items.length; i++) {
|
|
1242
|
-
minify(items[i]);
|
|
1243
|
-
}
|
|
1244
|
-
message.i = items;
|
|
1245
|
-
delete message.items;
|
|
1246
|
-
if (message.static) {
|
|
1247
|
-
message.s = message.static;
|
|
1248
|
-
delete message.static;
|
|
1249
|
-
}
|
|
1250
|
-
break;
|
|
1251
|
-
}
|
|
1252
|
-
case 3 /* NodeTypes.Text */:
|
|
1253
|
-
case 9 /* NodeTypes.Literal */:
|
|
1254
|
-
case 8 /* NodeTypes.LinkedModifier */:
|
|
1255
|
-
case 7 /* NodeTypes.LinkedKey */: {
|
|
1256
|
-
const valueNode = node;
|
|
1257
|
-
if (valueNode.value) {
|
|
1258
|
-
valueNode.v = valueNode.value;
|
|
1259
|
-
delete valueNode.value;
|
|
1260
|
-
}
|
|
1261
|
-
break;
|
|
1262
|
-
}
|
|
1263
|
-
case 6 /* NodeTypes.Linked */: {
|
|
1264
|
-
const linked = node;
|
|
1265
|
-
minify(linked.key);
|
|
1266
|
-
linked.k = linked.key;
|
|
1267
|
-
delete linked.key;
|
|
1268
|
-
if (linked.modifier) {
|
|
1269
|
-
minify(linked.modifier);
|
|
1270
|
-
linked.m = linked.modifier;
|
|
1271
|
-
delete linked.modifier;
|
|
1272
|
-
}
|
|
1273
|
-
break;
|
|
1274
|
-
}
|
|
1275
|
-
case 5 /* NodeTypes.List */: {
|
|
1276
|
-
const list = node;
|
|
1277
|
-
list.i = list.index;
|
|
1278
|
-
delete list.index;
|
|
1279
|
-
break;
|
|
1280
|
-
}
|
|
1281
|
-
case 4 /* NodeTypes.Named */: {
|
|
1282
|
-
const named = node;
|
|
1283
|
-
named.k = named.key;
|
|
1284
|
-
delete named.key;
|
|
1285
|
-
break;
|
|
1286
|
-
}
|
|
1287
|
-
default:
|
|
1288
|
-
if ((process.env.NODE_ENV !== 'production')) {
|
|
1289
|
-
throw createCompileError(CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE, null, {
|
|
1290
|
-
domain: ERROR_DOMAIN$1,
|
|
1291
|
-
args: [node.type]
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
delete node.type;
|
|
1296
|
-
}
|
|
1297
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1298
|
-
|
|
1299
|
-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
1300
|
-
/// <reference types="source-map-js" />
|
|
1301
|
-
const ERROR_DOMAIN = 'parser';
|
|
1302
|
-
function createCodeGenerator(ast, options) {
|
|
1303
|
-
const { filename, breakLineCode, needIndent: _needIndent } = options;
|
|
1304
|
-
const location = options.location !== false;
|
|
1305
|
-
const _context = {
|
|
1306
|
-
filename,
|
|
1307
|
-
code: '',
|
|
1308
|
-
column: 1,
|
|
1309
|
-
line: 1,
|
|
1310
|
-
offset: 0,
|
|
1311
|
-
map: undefined,
|
|
1312
|
-
breakLineCode,
|
|
1313
|
-
needIndent: _needIndent,
|
|
1314
|
-
indentLevel: 0
|
|
1315
|
-
};
|
|
1316
|
-
if (location && ast.loc) {
|
|
1317
|
-
_context.source = ast.loc.source;
|
|
1318
|
-
}
|
|
1319
|
-
const context = () => _context;
|
|
1320
|
-
function push(code, node) {
|
|
1321
|
-
_context.code += code;
|
|
1322
|
-
}
|
|
1323
|
-
function _newline(n, withBreakLine = true) {
|
|
1324
|
-
const _breakLineCode = withBreakLine ? breakLineCode : '';
|
|
1325
|
-
push(_needIndent ? _breakLineCode + ` `.repeat(n) : _breakLineCode);
|
|
1326
|
-
}
|
|
1327
|
-
function indent(withNewLine = true) {
|
|
1328
|
-
const level = ++_context.indentLevel;
|
|
1329
|
-
withNewLine && _newline(level);
|
|
1330
|
-
}
|
|
1331
|
-
function deindent(withNewLine = true) {
|
|
1332
|
-
const level = --_context.indentLevel;
|
|
1333
|
-
withNewLine && _newline(level);
|
|
1334
|
-
}
|
|
1335
|
-
function newline() {
|
|
1336
|
-
_newline(_context.indentLevel);
|
|
1337
|
-
}
|
|
1338
|
-
const helper = (key) => `_${key}`;
|
|
1339
|
-
const needIndent = () => _context.needIndent;
|
|
1340
|
-
return {
|
|
1341
|
-
context,
|
|
1342
|
-
push,
|
|
1343
|
-
indent,
|
|
1344
|
-
deindent,
|
|
1345
|
-
newline,
|
|
1346
|
-
helper,
|
|
1347
|
-
needIndent
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
|
-
function generateLinkedNode(generator, node) {
|
|
1351
|
-
const { helper } = generator;
|
|
1352
|
-
generator.push(`${helper("linked" /* HelperNameMap.LINKED */)}(`);
|
|
1353
|
-
generateNode(generator, node.key);
|
|
1354
|
-
if (node.modifier) {
|
|
1355
|
-
generator.push(`, `);
|
|
1356
|
-
generateNode(generator, node.modifier);
|
|
1357
|
-
generator.push(`, _type`);
|
|
1358
|
-
}
|
|
1359
|
-
else {
|
|
1360
|
-
generator.push(`, undefined, _type`);
|
|
1361
|
-
}
|
|
1362
|
-
generator.push(`)`);
|
|
1363
|
-
}
|
|
1364
|
-
function generateMessageNode(generator, node) {
|
|
1365
|
-
const { helper, needIndent } = generator;
|
|
1366
|
-
generator.push(`${helper("normalize" /* HelperNameMap.NORMALIZE */)}([`);
|
|
1367
|
-
generator.indent(needIndent());
|
|
1368
|
-
const length = node.items.length;
|
|
1369
|
-
for (let i = 0; i < length; i++) {
|
|
1370
|
-
generateNode(generator, node.items[i]);
|
|
1371
|
-
if (i === length - 1) {
|
|
1372
|
-
break;
|
|
1373
|
-
}
|
|
1374
|
-
generator.push(', ');
|
|
1375
|
-
}
|
|
1376
|
-
generator.deindent(needIndent());
|
|
1377
|
-
generator.push('])');
|
|
1378
|
-
}
|
|
1379
|
-
function generatePluralNode(generator, node) {
|
|
1380
|
-
const { helper, needIndent } = generator;
|
|
1381
|
-
if (node.cases.length > 1) {
|
|
1382
|
-
generator.push(`${helper("plural" /* HelperNameMap.PLURAL */)}([`);
|
|
1383
|
-
generator.indent(needIndent());
|
|
1384
|
-
const length = node.cases.length;
|
|
1385
|
-
for (let i = 0; i < length; i++) {
|
|
1386
|
-
generateNode(generator, node.cases[i]);
|
|
1387
|
-
if (i === length - 1) {
|
|
1388
|
-
break;
|
|
1389
|
-
}
|
|
1390
|
-
generator.push(', ');
|
|
1391
|
-
}
|
|
1392
|
-
generator.deindent(needIndent());
|
|
1393
|
-
generator.push(`])`);
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
function generateResource(generator, node) {
|
|
1397
|
-
if (node.body) {
|
|
1398
|
-
generateNode(generator, node.body);
|
|
1399
|
-
}
|
|
1400
|
-
else {
|
|
1401
|
-
generator.push('null');
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
function generateNode(generator, node) {
|
|
1405
|
-
const { helper } = generator;
|
|
1406
|
-
switch (node.type) {
|
|
1407
|
-
case 0 /* NodeTypes.Resource */:
|
|
1408
|
-
generateResource(generator, node);
|
|
1409
|
-
break;
|
|
1410
|
-
case 1 /* NodeTypes.Plural */:
|
|
1411
|
-
generatePluralNode(generator, node);
|
|
1412
|
-
break;
|
|
1413
|
-
case 2 /* NodeTypes.Message */:
|
|
1414
|
-
generateMessageNode(generator, node);
|
|
1415
|
-
break;
|
|
1416
|
-
case 6 /* NodeTypes.Linked */:
|
|
1417
|
-
generateLinkedNode(generator, node);
|
|
1418
|
-
break;
|
|
1419
|
-
case 8 /* NodeTypes.LinkedModifier */:
|
|
1420
|
-
generator.push(JSON.stringify(node.value), node);
|
|
1421
|
-
break;
|
|
1422
|
-
case 7 /* NodeTypes.LinkedKey */:
|
|
1423
|
-
generator.push(JSON.stringify(node.value), node);
|
|
1424
|
-
break;
|
|
1425
|
-
case 5 /* NodeTypes.List */:
|
|
1426
|
-
generator.push(`${helper("interpolate" /* HelperNameMap.INTERPOLATE */)}(${helper("list" /* HelperNameMap.LIST */)}(${node.index}))`, node);
|
|
1427
|
-
break;
|
|
1428
|
-
case 4 /* NodeTypes.Named */:
|
|
1429
|
-
generator.push(`${helper("interpolate" /* HelperNameMap.INTERPOLATE */)}(${helper("named" /* HelperNameMap.NAMED */)}(${JSON.stringify(node.key)}))`, node);
|
|
1430
|
-
break;
|
|
1431
|
-
case 9 /* NodeTypes.Literal */:
|
|
1432
|
-
generator.push(JSON.stringify(node.value), node);
|
|
1433
|
-
break;
|
|
1434
|
-
case 3 /* NodeTypes.Text */:
|
|
1435
|
-
generator.push(JSON.stringify(node.value), node);
|
|
1436
|
-
break;
|
|
1437
|
-
default:
|
|
1438
|
-
if ((process.env.NODE_ENV !== 'production')) {
|
|
1439
|
-
throw createCompileError(CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE, null, {
|
|
1440
|
-
domain: ERROR_DOMAIN,
|
|
1441
|
-
args: [node.type]
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
// generate code from AST
|
|
1447
|
-
const generate = (ast, options = {}) => {
|
|
1448
|
-
const mode = isString(options.mode) ? options.mode : 'normal';
|
|
1449
|
-
const filename = isString(options.filename)
|
|
1450
|
-
? options.filename
|
|
1451
|
-
: 'message.intl';
|
|
1452
|
-
// prettier-ignore
|
|
1453
|
-
const breakLineCode = options.breakLineCode != null
|
|
1454
|
-
? options.breakLineCode
|
|
1455
|
-
: mode === 'arrow'
|
|
1456
|
-
? ';'
|
|
1457
|
-
: '\n';
|
|
1458
|
-
const needIndent = options.needIndent ? options.needIndent : mode !== 'arrow';
|
|
1459
|
-
const helpers = ast.helpers || [];
|
|
1460
|
-
const generator = createCodeGenerator(ast, {
|
|
1461
|
-
filename,
|
|
1462
|
-
breakLineCode,
|
|
1463
|
-
needIndent
|
|
1464
|
-
});
|
|
1465
|
-
generator.push(mode === 'normal' ? `function __msg__ (ctx) {` : `(ctx) => {`);
|
|
1466
|
-
generator.indent(needIndent);
|
|
1467
|
-
if (helpers.length > 0) {
|
|
1468
|
-
generator.push(`const { ${join(helpers.map(s => `${s}: _${s}`), ', ')} } = ctx`);
|
|
1469
|
-
generator.newline();
|
|
1470
|
-
}
|
|
1471
|
-
generator.push(`return `);
|
|
1472
|
-
generateNode(generator, ast);
|
|
1473
|
-
generator.deindent(needIndent);
|
|
1474
|
-
generator.push(`}`);
|
|
1475
|
-
delete ast.helpers;
|
|
1476
|
-
const { code, map } = generator.context();
|
|
1477
|
-
return {
|
|
1478
|
-
ast,
|
|
1479
|
-
code,
|
|
1480
|
-
map: map ? map.toJSON() : undefined // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1481
|
-
};
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
function baseCompile(source, options = {}) {
|
|
1485
|
-
const assignedOptions = assign({}, options);
|
|
1486
|
-
const jit = !!assignedOptions.jit;
|
|
1487
|
-
const enalbeMinify = !!assignedOptions.minify;
|
|
1488
|
-
const enambeOptimize = assignedOptions.optimize == null ? true : assignedOptions.optimize;
|
|
1489
|
-
// parse source codes
|
|
1490
|
-
const parser = createParser(assignedOptions);
|
|
1491
|
-
const ast = parser.parse(source);
|
|
1492
|
-
if (!jit) {
|
|
1493
|
-
// transform ASTs
|
|
1494
|
-
transform(ast, assignedOptions);
|
|
1495
|
-
// generate javascript codes
|
|
1496
|
-
return generate(ast, assignedOptions);
|
|
1497
|
-
}
|
|
1498
|
-
else {
|
|
1499
|
-
// optimize ASTs
|
|
1500
|
-
enambeOptimize && optimize(ast);
|
|
1501
|
-
// minimize ASTs
|
|
1502
|
-
enalbeMinify && minify(ast);
|
|
1503
|
-
// In JIT mode, no ast transform, no code generation.
|
|
1504
|
-
return { ast, code: '' };
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
export { COMPILE_ERROR_CODES_EXTEND_POINT as C, defaultOnError as a, baseCompile as b, createCompileError as c, detectHtmlTag as d };
|