@emailmaker/emailmaker 1.0.1
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/README.md +188 -0
- package/README_eng.md +195 -0
- package/android-chrome-192x192.png +0 -0
- package/android-chrome-512x512.png +0 -0
- package/apple-touch-icon-b.png +0 -0
- package/apple-touch-icon.png +0 -0
- package/asset-manifest.json +207 -0
- package/css.worker.js +2 -0
- package/css.worker.js.LICENSE.txt +6 -0
- package/editor.worker.js +1 -0
- package/emailmaker-esm.js +1 -0
- package/emailmaker.d.ts +978 -0
- package/emailmaker.js +1 -0
- package/favicon-16x16.png +0 -0
- package/favicon-32x32.png +0 -0
- package/favicon-b.ico +0 -0
- package/favicon.ico +0 -0
- package/html.worker.js +2 -0
- package/html.worker.js.LICENSE.txt +14 -0
- package/icon-192.png +0 -0
- package/icon-512.png +0 -0
- package/icon.svg +2 -0
- package/iframe/css/line-awesome/line-awesome.min.css +2 -0
- package/iframe/css/line-awesome/line-awesome.min.css.js +0 -0
- package/iframe/css/sandbox-dark.css +301 -0
- package/iframe/css/sandbox-dark.css.js +0 -0
- package/iframe/css/sandbox-darktheme.css +234 -0
- package/iframe/css/sandbox-darktheme.css.js +0 -0
- package/iframe/css/sandbox-light.css +197 -0
- package/iframe/css/sandbox-light.css.js +0 -0
- package/iframe/css/sandbox.css +1553 -0
- package/iframe/css/sandbox.css.js +0 -0
- package/iframe/css/sandbox.locale.en_en.css +16 -0
- package/iframe/css/sandbox.locale.en_en.css.js +0 -0
- package/iframe/css/sandbox.locale.ru_ru.css +16 -0
- package/iframe/css/sandbox.locale.ru_ru.css.js +0 -0
- package/iframe/fonts/line-awesome/la-solid-900.ttf +0 -0
- package/iframe/fonts/line-awesome/la-solid-900.woff +0 -0
- package/iframe/fonts/line-awesome/la-solid-900.woff2 +0 -0
- package/iframe/iframe-eblock.5ad84761d0d28cf7389f.html +18 -0
- package/iframe/iframe.5ad84761d0d28cf7389f.html +20 -0
- package/iframe/iframe.html +33 -0
- package/iframe/img/drag-insert.svg +5 -0
- package/iframe/img/icon-code.svg +10 -0
- package/iframe/img/icon-img.svg +10 -0
- package/iframe/img/left-arrow.svg +3 -0
- package/iframe/img/loader-1-dark.gif +0 -0
- package/iframe/img/loader-1-light.gif +0 -0
- package/iframe/js/cssbeautify.js +1 -0
- package/iframe/js/csso.min.js +1 -0
- package/iframe/js/emmet-monaco.min.js +2 -0
- package/iframe/js/emmet-monaco.min.js.LICENSE.txt +14 -0
- package/iframe/js/iframeResizer.contentWindow.min.js +2 -0
- package/iframe/js/iframeResizer.contentWindow.min.js.LICENSE.txt +7 -0
- package/iframe/js/sandbox.locale.en_us.js +1 -0
- package/iframe/js/sandbox.locale.ru_ru.js +1 -0
- package/iframe/js/typograf/typograf.all.min.js +2 -0
- package/iframe/js/typograf/typograf.all.min.js.LICENSE.txt +1 -0
- package/iframe/sandbox-eblock.js +1 -0
- package/iframe/sandbox-eblock.js.LICENSE.txt +10 -0
- package/iframe/sandbox.js +1 -0
- package/iframe/sandbox.js.LICENSE.txt +8 -0
- package/images/video-playButtons/youtube_red.png +0 -0
- package/json.worker.js +2 -0
- package/json.worker.js.LICENSE.txt +6 -0
- package/manifest-b.json +16 -0
- package/manifest.json +17 -0
- package/package.json +10 -0
- package/plugin.html +115 -0
- package/plugin_default.html +56 -0
- package/plugin_s.html +31 -0
- package/react/index.d.ts +11 -0
- package/react/index.jsx +34 -0
- package/robots.txt +3 -0
- package/static/css/2859.3f78309e.css +1 -0
- package/static/css/4225.7ff43163.css +1 -0
- package/static/css/4872.36457ae6.css +1 -0
- package/static/css/9002.f81f3603.css +1 -0
- package/static/js/111.cbd98290.chunk.js +2 -0
- package/static/js/111.cbd98290.chunk.js.LICENSE.txt +6 -0
- package/static/js/1115.fb08b320.chunk.js +2 -0
- package/static/js/1115.fb08b320.chunk.js.LICENSE.txt +6 -0
- package/static/js/1247.6885a0da.chunk.js +2 -0
- package/static/js/1247.6885a0da.chunk.js.LICENSE.txt +6 -0
- package/static/js/1375.9309af3d.chunk.js +2 -0
- package/static/js/1375.9309af3d.chunk.js.LICENSE.txt +6 -0
- package/static/js/1727.05b807df.chunk.js +2 -0
- package/static/js/1727.05b807df.chunk.js.LICENSE.txt +6 -0
- package/static/js/1863.7fa7c875.chunk.js +2 -0
- package/static/js/1863.7fa7c875.chunk.js.LICENSE.txt +6 -0
- package/static/js/2095.35960898.chunk.js +2 -0
- package/static/js/2095.35960898.chunk.js.LICENSE.txt +6 -0
- package/static/js/215.184294a2.chunk.js +2 -0
- package/static/js/215.184294a2.chunk.js.LICENSE.txt +6 -0
- package/static/js/2175.7bfdf72e.chunk.js +2 -0
- package/static/js/2175.7bfdf72e.chunk.js.LICENSE.txt +6 -0
- package/static/js/223.86871df9.chunk.js +2 -0
- package/static/js/223.86871df9.chunk.js.LICENSE.txt +6 -0
- package/static/js/255.96cc3f0a.chunk.js +2 -0
- package/static/js/255.96cc3f0a.chunk.js.LICENSE.txt +6 -0
- package/static/js/2777.93e2f4b9.chunk.js +2 -0
- package/static/js/2777.93e2f4b9.chunk.js.LICENSE.txt +6 -0
- package/static/js/2799.a8352a8e.chunk.js +2 -0
- package/static/js/2799.a8352a8e.chunk.js.LICENSE.txt +6 -0
- package/static/js/2807.13d244f7.js +2 -0
- package/static/js/2807.13d244f7.js.LICENSE.txt +51 -0
- package/static/js/2859.b9caeb15.js +1 -0
- package/static/js/2959.37c71ed2.chunk.js +2 -0
- package/static/js/2959.37c71ed2.chunk.js.LICENSE.txt +6 -0
- package/static/js/3.cc80fb69.chunk.js +2 -0
- package/static/js/3.cc80fb69.chunk.js.LICENSE.txt +6 -0
- package/static/js/303.4b451722.chunk.js +2 -0
- package/static/js/303.4b451722.chunk.js.LICENSE.txt +6 -0
- package/static/js/3095.27a8a7ce.chunk.js +2 -0
- package/static/js/3095.27a8a7ce.chunk.js.LICENSE.txt +6 -0
- package/static/js/3116.b4e4c747.chunk.js +2 -0
- package/static/js/3116.b4e4c747.chunk.js.LICENSE.txt +6 -0
- package/static/js/33.7087137f.chunk.js +2 -0
- package/static/js/33.7087137f.chunk.js.LICENSE.txt +6 -0
- package/static/js/3321.3369560d.chunk.js +2 -0
- package/static/js/3321.3369560d.chunk.js.LICENSE.txt +6 -0
- package/static/js/351.800cfa64.chunk.js +2 -0
- package/static/js/351.800cfa64.chunk.js.LICENSE.txt +10 -0
- package/static/js/363.36407050.chunk.js +2 -0
- package/static/js/363.36407050.chunk.js.LICENSE.txt +6 -0
- package/static/js/3756.4539bf2a.chunk.js +2 -0
- package/static/js/3756.4539bf2a.chunk.js.LICENSE.txt +6 -0
- package/static/js/3887.1d2dfdb9.chunk.js +2 -0
- package/static/js/3887.1d2dfdb9.chunk.js.LICENSE.txt +6 -0
- package/static/js/4123.3cb83836.chunk.js +2 -0
- package/static/js/4123.3cb83836.chunk.js.LICENSE.txt +6 -0
- package/static/js/4225.e7602269.js +2 -0
- package/static/js/4225.e7602269.js.LICENSE.txt +8 -0
- package/static/js/4311.af4a59a5.chunk.js +2 -0
- package/static/js/4311.af4a59a5.chunk.js.LICENSE.txt +6 -0
- package/static/js/4459.b6de1b05.chunk.js +2 -0
- package/static/js/4459.b6de1b05.chunk.js.LICENSE.txt +6 -0
- package/static/js/4461.371ffb79.chunk.js +2 -0
- package/static/js/4461.371ffb79.chunk.js.LICENSE.txt +6 -0
- package/static/js/4501.6e4ba4d8.js +2 -0
- package/static/js/4501.6e4ba4d8.js.LICENSE.txt +42 -0
- package/static/js/4791.c9177129.chunk.js +2 -0
- package/static/js/4791.c9177129.chunk.js.LICENSE.txt +6 -0
- package/static/js/4872.a0e5cb2b.js +2 -0
- package/static/js/4872.a0e5cb2b.js.LICENSE.txt +200 -0
- package/static/js/4879.8556f136.chunk.js +2 -0
- package/static/js/4879.8556f136.chunk.js.LICENSE.txt +6 -0
- package/static/js/4932.6c513f63.chunk.js +2 -0
- package/static/js/4932.6c513f63.chunk.js.LICENSE.txt +6 -0
- package/static/js/5051.b9a57eb1.chunk.js +2 -0
- package/static/js/5051.b9a57eb1.chunk.js.LICENSE.txt +6 -0
- package/static/js/5068.5d29e1a9.chunk.js +1 -0
- package/static/js/5227.6c918241.chunk.js +2 -0
- package/static/js/5227.6c918241.chunk.js.LICENSE.txt +6 -0
- package/static/js/5293.7e051b80.chunk.js +2 -0
- package/static/js/5293.7e051b80.chunk.js.LICENSE.txt +6 -0
- package/static/js/5423.bddd4a43.chunk.js +2 -0
- package/static/js/5423.bddd4a43.chunk.js.LICENSE.txt +6 -0
- package/static/js/543.82f27022.chunk.js +2 -0
- package/static/js/543.82f27022.chunk.js.LICENSE.txt +6 -0
- package/static/js/5535.3244c148.chunk.js +2 -0
- package/static/js/5535.3244c148.chunk.js.LICENSE.txt +6 -0
- package/static/js/5613.62288e00.chunk.js +2 -0
- package/static/js/5613.62288e00.chunk.js.LICENSE.txt +6 -0
- package/static/js/5615.6ccde06b.chunk.js +2 -0
- package/static/js/5615.6ccde06b.chunk.js.LICENSE.txt +6 -0
- package/static/js/5693.3d4fe88d.chunk.js +2 -0
- package/static/js/5693.3d4fe88d.chunk.js.LICENSE.txt +6 -0
- package/static/js/5763.37c30999.chunk.js +2 -0
- package/static/js/5763.37c30999.chunk.js.LICENSE.txt +6 -0
- package/static/js/5919.dd3128af.chunk.js +2 -0
- package/static/js/5919.dd3128af.chunk.js.LICENSE.txt +6 -0
- package/static/js/6009.f189e5ae.chunk.js +2 -0
- package/static/js/6009.f189e5ae.chunk.js.LICENSE.txt +6 -0
- package/static/js/6447.cfdb8875.chunk.js +2 -0
- package/static/js/6447.cfdb8875.chunk.js.LICENSE.txt +6 -0
- package/static/js/6639.bbbbe601.chunk.js +2 -0
- package/static/js/6639.bbbbe601.chunk.js.LICENSE.txt +6 -0
- package/static/js/6675.3a2d412d.chunk.js +2 -0
- package/static/js/6675.3a2d412d.chunk.js.LICENSE.txt +6 -0
- package/static/js/6713.b7412fee.chunk.js +2 -0
- package/static/js/6713.b7412fee.chunk.js.LICENSE.txt +6 -0
- package/static/js/6735.a97baca4.chunk.js +2 -0
- package/static/js/6735.a97baca4.chunk.js.LICENSE.txt +6 -0
- package/static/js/6901.40d177c8.chunk.js +1 -0
- package/static/js/6933.74b38c02.chunk.js +2 -0
- package/static/js/6933.74b38c02.chunk.js.LICENSE.txt +6 -0
- package/static/js/6987.76422d40.js +1 -0
- package/static/js/7073.605ee411.chunk.js +2 -0
- package/static/js/7073.605ee411.chunk.js.LICENSE.txt +6 -0
- package/static/js/7119.ca1d70c7.chunk.js +2 -0
- package/static/js/7119.ca1d70c7.chunk.js.LICENSE.txt +6 -0
- package/static/js/7175.5dd62a53.chunk.js +2 -0
- package/static/js/7175.5dd62a53.chunk.js.LICENSE.txt +6 -0
- package/static/js/7241.0040848f.chunk.js +2 -0
- package/static/js/7241.0040848f.chunk.js.LICENSE.txt +6 -0
- package/static/js/7260.df86f79c.chunk.js +2 -0
- package/static/js/7260.df86f79c.chunk.js.LICENSE.txt +6 -0
- package/static/js/7473.703ab781.chunk.js +2 -0
- package/static/js/7473.703ab781.chunk.js.LICENSE.txt +6 -0
- package/static/js/7533.ff47b1c6.chunk.js +2 -0
- package/static/js/7533.ff47b1c6.chunk.js.LICENSE.txt +6 -0
- package/static/js/7567.5b36aa1e.chunk.js +2 -0
- package/static/js/7567.5b36aa1e.chunk.js.LICENSE.txt +6 -0
- package/static/js/7568.abd309a5.chunk.js +2 -0
- package/static/js/7568.abd309a5.chunk.js.LICENSE.txt +6 -0
- package/static/js/7663.9dadc8ad.chunk.js +2 -0
- package/static/js/7663.9dadc8ad.chunk.js.LICENSE.txt +6 -0
- package/static/js/779.7ec500b4.chunk.js +2 -0
- package/static/js/779.7ec500b4.chunk.js.LICENSE.txt +6 -0
- package/static/js/7803.0edbb2ab.chunk.js +2 -0
- package/static/js/7803.0edbb2ab.chunk.js.LICENSE.txt +6 -0
- package/static/js/7855.90402a9a.chunk.js +2 -0
- package/static/js/7855.90402a9a.chunk.js.LICENSE.txt +6 -0
- package/static/js/7878.a2ba845f.chunk.js +2 -0
- package/static/js/7878.a2ba845f.chunk.js.LICENSE.txt +6 -0
- package/static/js/7963.8d0e0875.chunk.js +2 -0
- package/static/js/7963.8d0e0875.chunk.js.LICENSE.txt +6 -0
- package/static/js/7999.0ef327fe.chunk.js +2 -0
- package/static/js/7999.0ef327fe.chunk.js.LICENSE.txt +6 -0
- package/static/js/8287.60007a30.chunk.js +2 -0
- package/static/js/8287.60007a30.chunk.js.LICENSE.txt +6 -0
- package/static/js/8525.164b4ef1.chunk.js +2 -0
- package/static/js/8525.164b4ef1.chunk.js.LICENSE.txt +6 -0
- package/static/js/8614.4df07be3.chunk.js +2 -0
- package/static/js/8614.4df07be3.chunk.js.LICENSE.txt +6 -0
- package/static/js/863.6162bd02.chunk.js +2 -0
- package/static/js/863.6162bd02.chunk.js.LICENSE.txt +6 -0
- package/static/js/8675.4011b507.chunk.js +2 -0
- package/static/js/8675.4011b507.chunk.js.LICENSE.txt +6 -0
- package/static/js/8799.eaf2f1c6.chunk.js +2 -0
- package/static/js/8799.eaf2f1c6.chunk.js.LICENSE.txt +6 -0
- package/static/js/8871.25143e00.chunk.js +2 -0
- package/static/js/8871.25143e00.chunk.js.LICENSE.txt +6 -0
- package/static/js/8991.19d7f941.chunk.js +2 -0
- package/static/js/8991.19d7f941.chunk.js.LICENSE.txt +6 -0
- package/static/js/9002.6c79bc92.js +1 -0
- package/static/js/9059.695b4670.chunk.js +2 -0
- package/static/js/9059.695b4670.chunk.js.LICENSE.txt +6 -0
- package/static/js/9137.564a2d8b.chunk.js +2 -0
- package/static/js/9137.564a2d8b.chunk.js.LICENSE.txt +6 -0
- package/static/js/9199.9d74e16f.chunk.js +2 -0
- package/static/js/9199.9d74e16f.chunk.js.LICENSE.txt +6 -0
- package/static/js/9225.25bc13dc.chunk.js +2 -0
- package/static/js/9225.25bc13dc.chunk.js.LICENSE.txt +6 -0
- package/static/js/9368.cc07f295.js +1 -0
- package/static/js/9503.80f871a1.chunk.js +2 -0
- package/static/js/9503.80f871a1.chunk.js.LICENSE.txt +6 -0
- package/static/js/9541.7d3756bf.js +1 -0
- package/static/js/9655.2e8d4a8e.chunk.js +2 -0
- package/static/js/9655.2e8d4a8e.chunk.js.LICENSE.txt +6 -0
- package/static/js/9823.a7ba133e.chunk.js +2 -0
- package/static/js/9823.a7ba133e.chunk.js.LICENSE.txt +6 -0
- package/static/js/9875.3b739db7.js +2 -0
- package/static/js/9875.3b739db7.js.LICENSE.txt +86 -0
- package/static/js/9935.f14200e3.chunk.js +2 -0
- package/static/js/9935.f14200e3.chunk.js.LICENSE.txt +6 -0
- package/static/js/ant-locale/locale0.bc9eb989.chunk.js +1 -0
- package/static/js/ant-locale/locale1.79afa8d5.chunk.js +1 -0
- package/static/js/ant-locale/locale10.931ba183.chunk.js +1 -0
- package/static/js/ant-locale/locale11.7c905a2e.chunk.js +1 -0
- package/static/js/ant-locale/locale13.8c7e33f9.chunk.js +1 -0
- package/static/js/ant-locale/locale14.a6d2b694.chunk.js +1 -0
- package/static/js/ant-locale/locale15.e521e6c8.chunk.js +1 -0
- package/static/js/ant-locale/locale16.6bf080c9.chunk.js +1 -0
- package/static/js/ant-locale/locale17.8db23aba.chunk.js +1 -0
- package/static/js/ant-locale/locale18.2378252e.chunk.js +1 -0
- package/static/js/ant-locale/locale19.a9518e0a.chunk.js +1 -0
- package/static/js/ant-locale/locale2.49423b7a.chunk.js +1 -0
- package/static/js/ant-locale/locale20.4195bdf5.chunk.js +1 -0
- package/static/js/ant-locale/locale21.479ba0df.chunk.js +1 -0
- package/static/js/ant-locale/locale22.4c3baa93.chunk.js +1 -0
- package/static/js/ant-locale/locale23.58be86ea.chunk.js +1 -0
- package/static/js/ant-locale/locale24.a44b9124.chunk.js +1 -0
- package/static/js/ant-locale/locale25.efe23431.chunk.js +1 -0
- package/static/js/ant-locale/locale26.52c7a0fc.chunk.js +1 -0
- package/static/js/ant-locale/locale27.cc9719d7.chunk.js +1 -0
- package/static/js/ant-locale/locale28.8b89909a.chunk.js +1 -0
- package/static/js/ant-locale/locale3.547b47e0.chunk.js +1 -0
- package/static/js/ant-locale/locale30.fb7b325a.chunk.js +1 -0
- package/static/js/ant-locale/locale31.2700fff5.chunk.js +1 -0
- package/static/js/ant-locale/locale32.27d17521.chunk.js +1 -0
- package/static/js/ant-locale/locale33.3f671b7f.chunk.js +1 -0
- package/static/js/ant-locale/locale34.6eea3a7c.chunk.js +1 -0
- package/static/js/ant-locale/locale35.1c169a8f.chunk.js +1 -0
- package/static/js/ant-locale/locale36.a0f5d209.chunk.js +1 -0
- package/static/js/ant-locale/locale37.d7a93cd8.chunk.js +1 -0
- package/static/js/ant-locale/locale38.a167fb02.chunk.js +1 -0
- package/static/js/ant-locale/locale39.88330df8.chunk.js +1 -0
- package/static/js/ant-locale/locale4.a14d4f60.chunk.js +1 -0
- package/static/js/ant-locale/locale40.26a0f7b4.chunk.js +1 -0
- package/static/js/ant-locale/locale41.2c575f45.chunk.js +1 -0
- package/static/js/ant-locale/locale42.bd705058.chunk.js +1 -0
- package/static/js/ant-locale/locale43.4c318c1e.chunk.js +1 -0
- package/static/js/ant-locale/locale44.ae6fc942.chunk.js +1 -0
- package/static/js/ant-locale/locale45.4fcc0acf.chunk.js +1 -0
- package/static/js/ant-locale/locale46.8d7fca54.chunk.js +1 -0
- package/static/js/ant-locale/locale47.6a8d9ee9.chunk.js +1 -0
- package/static/js/ant-locale/locale48.db4fb3e9.chunk.js +1 -0
- package/static/js/ant-locale/locale49.876e9846.chunk.js +1 -0
- package/static/js/ant-locale/locale5.179f1d8d.chunk.js +1 -0
- package/static/js/ant-locale/locale50.8d63ce0a.chunk.js +1 -0
- package/static/js/ant-locale/locale51.691274b8.chunk.js +1 -0
- package/static/js/ant-locale/locale52.b9a49d71.chunk.js +1 -0
- package/static/js/ant-locale/locale53.7a7722e3.chunk.js +1 -0
- package/static/js/ant-locale/locale54.0c75bb80.chunk.js +1 -0
- package/static/js/ant-locale/locale55.f5c0d904.chunk.js +1 -0
- package/static/js/ant-locale/locale56.bb2a06a4.chunk.js +1 -0
- package/static/js/ant-locale/locale57.648ebc5b.chunk.js +1 -0
- package/static/js/ant-locale/locale58.fd6a6d0e.chunk.js +1 -0
- package/static/js/ant-locale/locale59.05c85397.chunk.js +1 -0
- package/static/js/ant-locale/locale60.23e6b029.chunk.js +1 -0
- package/static/js/ant-locale/locale61.30ad8fdf.chunk.js +1 -0
- package/static/js/ant-locale/locale62.2ba4458e.chunk.js +1 -0
- package/static/js/ant-locale/locale63.e0e3072c.chunk.js +1 -0
- package/static/js/ant-locale/locale64.d9db34fb.chunk.js +1 -0
- package/static/js/ant-locale/locale65.aa10f18f.chunk.js +1 -0
- package/static/js/ant-locale/locale66.586f32ee.chunk.js +1 -0
- package/static/js/ant-locale/locale68.d2a63a32.chunk.js +1 -0
- package/static/js/ant-locale/locale69.b786c422.chunk.js +1 -0
- package/static/js/ant-locale/locale7.e847d0ec.chunk.js +1 -0
- package/static/js/ant-locale/locale70.75d26f29.chunk.js +1 -0
- package/static/js/ant-locale/locale71.e5c07b26.chunk.js +1 -0
- package/static/js/ant-locale/locale8.f139c7f8.chunk.js +1 -0
- package/static/js/ant-locale/locale9.b69465db.chunk.js +1 -0
- package/static/js/emailmaker_core.b4fb2394.js +1 -0
- package/static/js/mergeTags/locale0.d3379239.chunk.js +1 -0
- package/static/js/mergeTags/locale1.9462df85.chunk.js +1 -0
- package/static/media/codicon.f13d28f3.ttf +0 -0
- package/static/media/frame_dark.318d7ed5.png +0 -0
- package/static/media/frame_light.22a9b4ec.png +0 -0
- package/static/media/frame_template_gallery.85693b39.png +0 -0
- package/static/media/icon-border-radius.2a56b93a7711558098a622296b7ae2e1.svg +1 -0
- package/static/media/icon-create-block.0b077f4000bf7907b9ea871d28c7fb1e.svg +1 -0
- package/static/media/typewriter.c11b8204.png +0 -0
- package/translations.pot +3955 -0
- package/ts.worker.js +2 -0
- package/ts.worker.js.LICENSE.txt +21 -0
- package/vite/index.d.ts +11 -0
- package/vite/index.js +136 -0
- package/vite/mime-types.js +179 -0
- package/vite/utils.js +58 -0
- package/webpack/index.d.ts +12 -0
- package/webpack/index.js +109 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
/*!-----------------------------------------------------------------------------
|
|
17
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
+
* Version: 0.34.0(dee69564fa27426c7ebb706c3d2ed3d1acccedfe)
|
|
19
|
+
* Released under the MIT license
|
|
20
|
+
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
21
|
+
*-----------------------------------------------------------------------------*/
|
package/vite/index.d.ts
ADDED
package/vite/index.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const MIME_TYPES = require("./mime-types");
|
|
4
|
+
const { toPascalCase, cleanUrl, normalizePath, copyFolder } = require("./utils");
|
|
5
|
+
|
|
6
|
+
const PACKAGE_PATH = require("./../package.json").name;
|
|
7
|
+
const APP_NAME = PACKAGE_PATH.split("/").pop().replace("-dev", "");
|
|
8
|
+
const ENVIRONMENT_VARIABLE = `${toPascalCase(APP_NAME)}Environment`;
|
|
9
|
+
const PLUGIN_NAME = `${APP_NAME}-vite-plugin`;
|
|
10
|
+
const PACKAGE_ENTRY_NAME = `${APP_NAME}.js`;
|
|
11
|
+
const ESM_PACKAGE_ENTRY_NAME = `${APP_NAME}-esm.js`;
|
|
12
|
+
const DEFAULT_OUTPUT_FOLDER = `/${APP_NAME}`;
|
|
13
|
+
const DEFAULT_MODULES_PATH = "node_modules";
|
|
14
|
+
console.log(PACKAGE_PATH);
|
|
15
|
+
|
|
16
|
+
const IGNORED_PATTERNS = [
|
|
17
|
+
/.*\.npmignore/,
|
|
18
|
+
/.*\.gitignore/,
|
|
19
|
+
/.*\.md$/,
|
|
20
|
+
/.*\.ts$/,
|
|
21
|
+
/.*\.d\.ts$/,
|
|
22
|
+
/.*\.json$/,
|
|
23
|
+
/.*\.ico$/,
|
|
24
|
+
/.*\.pot$/,
|
|
25
|
+
/^.*(?<!iframe\..{1,})\.html$/,
|
|
26
|
+
/vite\\?.*$/,
|
|
27
|
+
/webpack\\?.*$/,
|
|
28
|
+
/react\\?.*$/,
|
|
29
|
+
/robots.txt$/,
|
|
30
|
+
/main\..*\.js$/,
|
|
31
|
+
/.*\\sandbox-eblock.*$/
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const ViteServePlugin = (options) => {
|
|
35
|
+
const rootPath = process.cwd();
|
|
36
|
+
const destPath = path.posix.join(rootPath, options.outputFolder || DEFAULT_OUTPUT_FOLDER);
|
|
37
|
+
return {
|
|
38
|
+
name: PLUGIN_NAME,
|
|
39
|
+
apply: 'serve',
|
|
40
|
+
|
|
41
|
+
transform: (code, id) => {
|
|
42
|
+
id = cleanUrl(id);
|
|
43
|
+
const packageName = `${PACKAGE_PATH.replaceAll("/", "_")}.js`
|
|
44
|
+
return (id.endsWith(packageName) || id.endsWith(ESM_PACKAGE_ENTRY_NAME)) ? `var ${ENVIRONMENT_VARIABLE}= { publicPath: "${options.outputFolder || DEFAULT_OUTPUT_FOLDER}/"}; ${code}` : code;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
configureServer: (server) => {
|
|
48
|
+
server.middlewares.use('/', async (req, res, next) => {
|
|
49
|
+
if (!req.url) {
|
|
50
|
+
next();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const absReqPath = path.posix.join(rootPath, cleanUrl(req.url));
|
|
54
|
+
if (absReqPath.startsWith(destPath)) {
|
|
55
|
+
const sourcePath = path.posix.join(options.modulesPath || DEFAULT_MODULES_PATH, PACKAGE_PATH, absReqPath.replace(destPath, ""));
|
|
56
|
+
if (!IGNORED_PATTERNS.some((pattern) => pattern.test(sourcePath)) && fs.existsSync(sourcePath)) {
|
|
57
|
+
await sendContentByFilePath(sourcePath);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
next()
|
|
62
|
+
|
|
63
|
+
async function sendContentByFilePath(filePath) {
|
|
64
|
+
const handledPath = normalizePath(filePath);
|
|
65
|
+
if (!fs.existsSync(handledPath)) {
|
|
66
|
+
next();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!fs.statSync(handledPath).isFile()) {
|
|
70
|
+
next();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const content = await fs.promises.readFile(handledPath);
|
|
74
|
+
const filePathParts = filePath.split(".");
|
|
75
|
+
const ext = filePathParts.length > 1 ? filePathParts[filePathParts.length - 1] : "";
|
|
76
|
+
res.writeHead(200, {
|
|
77
|
+
'Content-Type': ext && MIME_TYPES[ext] || 'text/plain'
|
|
78
|
+
});
|
|
79
|
+
res.end(content)
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const ViteBuildPlugin = (options) => {
|
|
88
|
+
const publicPath = options.publicPath || "";
|
|
89
|
+
const sourcePath = path.posix.join(options.modulesPath || DEFAULT_MODULES_PATH, PACKAGE_PATH);
|
|
90
|
+
let resolvedConfig = undefined;
|
|
91
|
+
return {
|
|
92
|
+
name: PLUGIN_NAME,
|
|
93
|
+
apply: 'build',
|
|
94
|
+
transform: (code, id) => {
|
|
95
|
+
id = cleanUrl(id);
|
|
96
|
+
if (id.endsWith(PACKAGE_ENTRY_NAME) || id.endsWith(ESM_PACKAGE_ENTRY_NAME)) {
|
|
97
|
+
const dir = path.posix.join(publicPath, options.outputFolder || DEFAULT_OUTPUT_FOLDER);
|
|
98
|
+
return `let ${ENVIRONMENT_VARIABLE}= { publicPath: "${dir}/"}; ${code}`;
|
|
99
|
+
} else {
|
|
100
|
+
return code;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
configResolved(config) {
|
|
104
|
+
resolvedConfig = config
|
|
105
|
+
},
|
|
106
|
+
async closeBundle() {
|
|
107
|
+
const outDir = path.posix.join(
|
|
108
|
+
resolvedConfig.root,
|
|
109
|
+
resolvedConfig.build.outDir
|
|
110
|
+
)
|
|
111
|
+
const destPath = path.posix.join(outDir, options.outputFolder || DEFAULT_OUTPUT_FOLDER);
|
|
112
|
+
|
|
113
|
+
if (!fs.existsSync(sourcePath)) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const stat = await fs.promises.stat(sourcePath)
|
|
119
|
+
|
|
120
|
+
if (stat.isDirectory()) {
|
|
121
|
+
await copyFolder(sourcePath, destPath, (sourcePath) => {
|
|
122
|
+
console.log(`${sourcePath} ${!IGNORED_PATTERNS.some((pattern) => pattern.test(sourcePath))}`);
|
|
123
|
+
return !IGNORED_PATTERNS.some((pattern) => pattern.test(sourcePath));
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const VitePlugin = (options = {}) => {
|
|
133
|
+
return [ViteServePlugin(options), ViteBuildPlugin(options)]
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = VitePlugin;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// File Extension MIME Type
|
|
3
|
+
'abs': 'audio/x-mpeg',
|
|
4
|
+
'ai': 'application/postscript',
|
|
5
|
+
'aif': 'audio/x-aiff',
|
|
6
|
+
'aifc': 'audio/x-aiff',
|
|
7
|
+
'aiff': 'audio/x-aiff',
|
|
8
|
+
'aim': 'application/x-aim',
|
|
9
|
+
'art': 'image/x-jg',
|
|
10
|
+
'asf': 'video/x-ms-asf',
|
|
11
|
+
'asx': 'video/x-ms-asf',
|
|
12
|
+
'au': 'audio/basic',
|
|
13
|
+
'avi': 'video/x-msvideo',
|
|
14
|
+
'avx': 'video/x-rad-screenplay',
|
|
15
|
+
'bcpio': 'application/x-bcpio',
|
|
16
|
+
'bin': 'application/octet-stream',
|
|
17
|
+
'bmp': 'image/bmp',
|
|
18
|
+
'body': 'text/html',
|
|
19
|
+
'cdf': 'application/x-cdf',
|
|
20
|
+
'cer': 'application/pkix-cert',
|
|
21
|
+
'class': 'application/java',
|
|
22
|
+
'cpio': 'application/x-cpio',
|
|
23
|
+
'csh': 'application/x-csh',
|
|
24
|
+
'css': 'text/css',
|
|
25
|
+
'dib': 'image/bmp',
|
|
26
|
+
'doc': 'application/msword',
|
|
27
|
+
'dtd': 'application/xml-dtd',
|
|
28
|
+
'dv': 'video/x-dv',
|
|
29
|
+
'dvi': 'application/x-dvi',
|
|
30
|
+
'eot': 'application/vnd.ms-fontobject',
|
|
31
|
+
'eps': 'application/postscript',
|
|
32
|
+
'etx': 'text/x-setext',
|
|
33
|
+
'exe': 'application/octet-stream',
|
|
34
|
+
'gif': 'image/gif',
|
|
35
|
+
'gtar': 'application/x-gtar',
|
|
36
|
+
'gz': 'application/x-gzip',
|
|
37
|
+
'hdf': 'application/x-hdf',
|
|
38
|
+
'hqx': 'application/mac-binhex40',
|
|
39
|
+
'htc': 'text/x-component',
|
|
40
|
+
'htm': 'text/html',
|
|
41
|
+
'html': 'text/html',
|
|
42
|
+
'ief': 'image/ief',
|
|
43
|
+
'jad': 'text/vnd.sun.j2me.app-descriptor',
|
|
44
|
+
'jar': 'application/java-archive',
|
|
45
|
+
'java': 'text/x-java-source',
|
|
46
|
+
'jnlp': 'application/x-java-jnlp-file',
|
|
47
|
+
'jpe': 'image/jpeg',
|
|
48
|
+
'jpeg': 'image/jpeg',
|
|
49
|
+
'jpg': 'image/jpeg',
|
|
50
|
+
'js': 'application/javascript',
|
|
51
|
+
'jsf': 'text/plain',
|
|
52
|
+
'json': 'application/json',
|
|
53
|
+
'jspf': 'text/plain',
|
|
54
|
+
'kar': 'audio/midi',
|
|
55
|
+
'latex': 'application/x-latex',
|
|
56
|
+
'm3u': 'audio/x-mpegurl',
|
|
57
|
+
'mac': 'image/x-macpaint',
|
|
58
|
+
'man': 'text/troff',
|
|
59
|
+
'mathml': 'application/mathml+xml',
|
|
60
|
+
'me': 'text/troff',
|
|
61
|
+
'mid': 'audio/midi',
|
|
62
|
+
'midi': 'audio/midi',
|
|
63
|
+
'mif': 'application/x-mif',
|
|
64
|
+
'mov': 'video/quicktime',
|
|
65
|
+
'movie': 'video/x-sgi-movie',
|
|
66
|
+
'mp1': 'audio/mpeg',
|
|
67
|
+
'mp2': 'audio/mpeg',
|
|
68
|
+
'mp3': 'audio/mpeg',
|
|
69
|
+
'mp4': 'video/mp4',
|
|
70
|
+
'mpa': 'audio/mpeg',
|
|
71
|
+
'mpe': 'video/mpeg',
|
|
72
|
+
'mpeg': 'video/mpeg',
|
|
73
|
+
'mpega': 'audio/x-mpeg',
|
|
74
|
+
'mpg': 'video/mpeg',
|
|
75
|
+
'mpv2': 'video/mpeg2',
|
|
76
|
+
'ms': 'application/x-wais-source',
|
|
77
|
+
'nc': 'application/x-netcdf',
|
|
78
|
+
'oda': 'application/oda',
|
|
79
|
+
'odb': 'application/vnd.oasis.opendocument.database',
|
|
80
|
+
'odc': 'application/vnd.oasis.opendocument.chart',
|
|
81
|
+
'odf': 'application/vnd.oasis.opendocument.formula',
|
|
82
|
+
'odg': 'application/vnd.oasis.opendocument.graphics',
|
|
83
|
+
'odi': 'application/vnd.oasis.opendocument.image',
|
|
84
|
+
'odm': 'application/vnd.oasis.opendocument.text-master',
|
|
85
|
+
'odp': 'application/vnd.oasis.opendocument.presentation',
|
|
86
|
+
'ods': 'application/vnd.oasis.opendocument.spreadsheet',
|
|
87
|
+
'odt': 'application/vnd.oasis.opendocument.text',
|
|
88
|
+
'otg': 'application/vnd.oasis.opendocument.graphics-template',
|
|
89
|
+
'oth': 'application/vnd.oasis.opendocument.text-web',
|
|
90
|
+
'otp': 'application/vnd.oasis.opendocument.presentation-template',
|
|
91
|
+
'ots': 'application/vnd.oasis.opendocument.spreadsheet-template',
|
|
92
|
+
'ott': 'application/vnd.oasis.opendocument.text-template',
|
|
93
|
+
'ogx': 'application/ogg',
|
|
94
|
+
'ogv': 'video/ogg',
|
|
95
|
+
'oga': 'audio/ogg',
|
|
96
|
+
'ogg': 'audio/ogg',
|
|
97
|
+
'otf': 'application/x-font-opentype',
|
|
98
|
+
'spx': 'audio/ogg',
|
|
99
|
+
'flac': 'audio/flac',
|
|
100
|
+
'anx': 'application/annodex',
|
|
101
|
+
'axa': 'audio/annodex',
|
|
102
|
+
'axv': 'video/annodex',
|
|
103
|
+
'xspf': 'application/xspf+xml',
|
|
104
|
+
'pbm': 'image/x-portable-bitmap',
|
|
105
|
+
'pct': 'image/pict',
|
|
106
|
+
'pdf': 'application/pdf',
|
|
107
|
+
'pgm': 'image/x-portable-graymap',
|
|
108
|
+
'pic': 'image/pict',
|
|
109
|
+
'pict': 'image/pict',
|
|
110
|
+
'pls': 'audio/x-scpls',
|
|
111
|
+
'png': 'image/png',
|
|
112
|
+
'pnm': 'image/x-portable-anymap',
|
|
113
|
+
'pnt': 'image/x-macpaint',
|
|
114
|
+
'ppm': 'image/x-portable-pixmap',
|
|
115
|
+
'ppt': 'application/vnd.ms-powerpoint',
|
|
116
|
+
'pps': 'application/vnd.ms-powerpoint',
|
|
117
|
+
'ps': 'application/postscript',
|
|
118
|
+
'psd': 'image/vnd.adobe.photoshop',
|
|
119
|
+
'qt': 'video/quicktime',
|
|
120
|
+
'qti': 'image/x-quicktime',
|
|
121
|
+
'qtif': 'image/x-quicktime',
|
|
122
|
+
'ras': 'image/x-cmu-raster',
|
|
123
|
+
'rdf': 'application/rdf+xml',
|
|
124
|
+
'rgb': 'image/x-rgb',
|
|
125
|
+
'rm': 'application/vnd.rn-realmedia',
|
|
126
|
+
'roff': 'text/troff',
|
|
127
|
+
'rtf': 'application/rtf',
|
|
128
|
+
'rtx': 'text/richtext',
|
|
129
|
+
'sfnt': 'application/font-sfnt',
|
|
130
|
+
'sh': 'application/x-sh',
|
|
131
|
+
'shar': 'application/x-shar',
|
|
132
|
+
'sit': 'application/x-stuffit',
|
|
133
|
+
'snd': 'audio/basic',
|
|
134
|
+
'src': 'application/x-wais-source',
|
|
135
|
+
'sv4cpio': 'application/x-sv4cpio',
|
|
136
|
+
'sv4crc': 'application/x-sv4crc',
|
|
137
|
+
'svg': 'image/svg+xml',
|
|
138
|
+
'svgz': 'image/svg+xml',
|
|
139
|
+
'swf': 'application/x-shockwave-flash',
|
|
140
|
+
't': 'text/troff',
|
|
141
|
+
'tar': 'application/x-tar',
|
|
142
|
+
'tcl': 'application/x-tcl',
|
|
143
|
+
'tex': 'application/x-tex',
|
|
144
|
+
'texi': 'application/x-texinfo',
|
|
145
|
+
'texinfo': 'application/x-texinfo',
|
|
146
|
+
'tif': 'image/tiff',
|
|
147
|
+
'tiff': 'image/tiff',
|
|
148
|
+
'tr': 'text/troff',
|
|
149
|
+
'tsv': 'text/tab-separated-values',
|
|
150
|
+
'ttf': 'application/x-font-ttf',
|
|
151
|
+
'txt': 'text/plain',
|
|
152
|
+
'ulw': 'audio/basic',
|
|
153
|
+
'ustar': 'application/x-ustar',
|
|
154
|
+
'vxml': 'application/voicexml+xml',
|
|
155
|
+
'xbm': 'image/x-xbitmap',
|
|
156
|
+
'xht': 'application/xhtml+xml',
|
|
157
|
+
'xhtml': 'application/xhtml+xml',
|
|
158
|
+
'xls': 'application/vnd.ms-excel',
|
|
159
|
+
'xml': 'application/xml',
|
|
160
|
+
'xpm': 'image/x-xpixmap',
|
|
161
|
+
'xsl': 'application/xml',
|
|
162
|
+
'xslt': 'application/xslt+xml',
|
|
163
|
+
'xul': 'application/vnd.mozilla.xul+xml',
|
|
164
|
+
'xwd': 'image/x-xwindowdump',
|
|
165
|
+
'vsd': 'application/vnd.visio',
|
|
166
|
+
'wav': 'audio/x-wav',
|
|
167
|
+
'wbmp': 'image/vnd.wap.wbmp',
|
|
168
|
+
'wml': 'text/vnd.wap.wml',
|
|
169
|
+
'wmlc': 'application/vnd.wap.wmlc',
|
|
170
|
+
'wmls': 'text/vnd.wap.wmlsc',
|
|
171
|
+
'wmlscriptc': 'application/vnd.wap.wmlscriptc',
|
|
172
|
+
'wmv': 'video/x-ms-wmv',
|
|
173
|
+
'woff': 'application/font-woff',
|
|
174
|
+
'woff2': 'application/font-woff2',
|
|
175
|
+
'wrl': 'model/vrml',
|
|
176
|
+
'wspolicy': 'application/wspolicy+xml',
|
|
177
|
+
'z': 'application/x-compress',
|
|
178
|
+
'zip': 'application/zip'
|
|
179
|
+
};
|
package/vite/utils.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const os = require("os");
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
mkdir,
|
|
6
|
+
readdir,
|
|
7
|
+
copyFile,
|
|
8
|
+
stat
|
|
9
|
+
} = require("fs").promises;
|
|
10
|
+
|
|
11
|
+
function toPascalCase(string) {
|
|
12
|
+
return `${string}`
|
|
13
|
+
.toLowerCase()
|
|
14
|
+
.replace(new RegExp(/[-_]+/, 'g'), ' ')
|
|
15
|
+
.replace(new RegExp(/[^\w\s]/, 'g'), '')
|
|
16
|
+
.replace(
|
|
17
|
+
new RegExp(/\s+(.)(\w*)/, 'g'),
|
|
18
|
+
($1, $2, $3) => `${$2.toUpperCase() + $3}`
|
|
19
|
+
)
|
|
20
|
+
.replace(new RegExp(/\w/), s => s.toUpperCase());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function slash(p) {
|
|
24
|
+
return p.replace(/\\/g, '/')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const cleanUrl = (url) => {
|
|
28
|
+
const QUERY_RE = /\?.*$/s
|
|
29
|
+
const HASH_RE = /#.*$/s
|
|
30
|
+
return url.replace(HASH_RE, '').replace(QUERY_RE, '')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function normalizePath(id) {
|
|
34
|
+
const isWindows = os.platform() === 'win32'
|
|
35
|
+
return path.posix.normalize(isWindows ? slash(id) : id)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const fileExists = async path => !!(await stat(path).catch(e => false));
|
|
39
|
+
|
|
40
|
+
async function copyFolder(src, dest, filter) {
|
|
41
|
+
if (!await fileExists(dest)) {
|
|
42
|
+
await mkdir(dest);
|
|
43
|
+
}
|
|
44
|
+
const entries = await readdir(src);
|
|
45
|
+
return Promise.all(entries.map(async entry => {
|
|
46
|
+
const srcPath = path.join(src, entry);
|
|
47
|
+
if (filter(srcPath)) {
|
|
48
|
+
const destPath = path.join(dest, entry);
|
|
49
|
+
const _stat = await stat(srcPath);
|
|
50
|
+
if (_stat.isFile()) {
|
|
51
|
+
copyFile(srcPath, destPath);
|
|
52
|
+
} else if (_stat.isDirectory()) {
|
|
53
|
+
copyFolder(srcPath, destPath, filter);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
module.exports = { toPascalCase, cleanUrl, normalizePath, copyFolder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Compiler, WebpackPluginInstance } from "webpack";
|
|
2
|
+
|
|
3
|
+
export type WebpackPluginOptions = {
|
|
4
|
+
outputFolder?: string;
|
|
5
|
+
modulesPath?: string;
|
|
6
|
+
publicPath?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default class WebpackPlugin implements WebpackPluginInstance {
|
|
10
|
+
constructor(options: WebpackPluginOptions);
|
|
11
|
+
apply: (compiler: Compiler) => void;
|
|
12
|
+
}
|
package/webpack/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { javascript } = require("webpack");
|
|
4
|
+
const { ConcatSource, RawSource } = require("webpack-sources");
|
|
5
|
+
|
|
6
|
+
function toPascalCase(string) {
|
|
7
|
+
return `${string}`
|
|
8
|
+
.toLowerCase()
|
|
9
|
+
.replace(new RegExp(/[-_]+/, 'g'), ' ')
|
|
10
|
+
.replace(new RegExp(/[^\w\s]/, 'g'), '')
|
|
11
|
+
.replace(
|
|
12
|
+
new RegExp(/\s+(.)(\w*)/, 'g'),
|
|
13
|
+
($1, $2, $3) => `${$2.toUpperCase() + $3}`
|
|
14
|
+
)
|
|
15
|
+
.replace(new RegExp(/\w/), s => s.toUpperCase());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const PACKAGE_PATH = require("./../package.json").name;
|
|
20
|
+
const APP_NAME = PACKAGE_PATH.split("/").pop().replace("-dev", "");
|
|
21
|
+
const PLUGIN_NAME = `${toPascalCase(APP_NAME)}WebpackPlugin`;
|
|
22
|
+
const PACKAGE_ENTRY_NAME = `${APP_NAME}.js`;
|
|
23
|
+
const DEFAULT_OUTPUT_FOLDER = APP_NAME;
|
|
24
|
+
const DEFAULT_MODULES_PATH = `node_modules`;
|
|
25
|
+
const ESM_PACKAGE_ENTRY_NAME = `${APP_NAME}-esm.js`;
|
|
26
|
+
const ENVIRONMENT_VARIABLE = `${toPascalCase(APP_NAME)}Environment`;
|
|
27
|
+
|
|
28
|
+
const IGNORED_PATTERNS = [
|
|
29
|
+
/.*\.npmignore/,
|
|
30
|
+
/.*\.gitignore/,
|
|
31
|
+
/.*\.md$/,
|
|
32
|
+
/.*\.ts$/,
|
|
33
|
+
/.*\.d\.ts$/,
|
|
34
|
+
/.*\.json$/,
|
|
35
|
+
/.*\.ico$/,
|
|
36
|
+
/.*\.pot$/,
|
|
37
|
+
/^.*(?<!iframe\..{1,})\.html$/,
|
|
38
|
+
/vite\\?.*$/,
|
|
39
|
+
/webpack\\?.*$/,
|
|
40
|
+
/react\\?.*$/,
|
|
41
|
+
/robots.txt$/,
|
|
42
|
+
/main\..*\.js$/,
|
|
43
|
+
/.*\\sandbox-eblock.*$/
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
class WebpackPlugin {
|
|
47
|
+
_outputFolder = DEFAULT_OUTPUT_FOLDER;
|
|
48
|
+
_modulesPath = DEFAULT_MODULES_PATH;
|
|
49
|
+
_publicPath = undefined;
|
|
50
|
+
constructor(options = {}) {
|
|
51
|
+
if (options.outputFolder !== undefined) { this._outputFolder = options.outputFolder; };
|
|
52
|
+
if (options.modulesPath !== undefined) { this._modulesPath = options.modulesPath };
|
|
53
|
+
if (options.publicPath !== undefined) { this._publicPath = options.publicPath };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
addAsset = async (compilation, sourcePath, destPath) => {
|
|
58
|
+
const filePath = path.resolve(compilation.compiler.context, sourcePath);
|
|
59
|
+
if (IGNORED_PATTERNS.some((pattern) => pattern.test(filePath))) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!compilation.getAsset(destPath)) {
|
|
63
|
+
const [stat, data] = await Promise.all([fs.promises.stat(filePath), fs.promises.readFile(filePath)]);
|
|
64
|
+
const { size } = stat;
|
|
65
|
+
const source = new RawSource(data, true);
|
|
66
|
+
compilation.fileDependencies.add(filePath);
|
|
67
|
+
compilation.emitAsset(destPath, source, { size });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
copyFiles = async (compilation, source, destination) => {
|
|
72
|
+
const directoryEntries = await fs.promises.readdir(source, { withFileTypes: true });
|
|
73
|
+
// console.log(destination);
|
|
74
|
+
// await fs.promises.mkdir(destination, { recursive: true });
|
|
75
|
+
return Promise.all(
|
|
76
|
+
directoryEntries.map(async (entry) => {
|
|
77
|
+
const sourcePath = path.join(source, entry.name);
|
|
78
|
+
const destinationPath = path.join(destination, entry.name);
|
|
79
|
+
return entry.isDirectory() ?
|
|
80
|
+
this.copyFiles(compilation, sourcePath, destinationPath) :
|
|
81
|
+
this.addAsset(compilation, sourcePath, destinationPath);
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
apply(compiler) {
|
|
88
|
+
const optionsPublicPath = compiler.options.output.publicPath || "";
|
|
89
|
+
const publicPath = this._publicPath === undefined ? optionsPublicPath : this._publicPath;
|
|
90
|
+
const initFragment = `var ${ENVIRONMENT_VARIABLE} = { publicPath: "${publicPath + (publicPath.endsWith("/") ? "" : "/")}${this._outputFolder}/"};`;
|
|
91
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
92
|
+
compilation.hooks.processAssets.tapAsync({
|
|
93
|
+
name: PLUGIN_NAME,
|
|
94
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
|
|
95
|
+
},
|
|
96
|
+
(_unusedAssets, cb) => this.copyFiles(compilation, path.join(this._modulesPath, PACKAGE_PATH), this._outputFolder).then(() => cb(null), e => cb(e)));
|
|
97
|
+
const hooks = javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
98
|
+
hooks.renderModuleContent.tap(PLUGIN_NAME, (source, module) => {
|
|
99
|
+
const name = module && module.nameForCondition();
|
|
100
|
+
if (typeof name === "string" && (name.indexOf(PACKAGE_ENTRY_NAME) >= 0 || name.indexOf(ESM_PACKAGE_ENTRY_NAME) >= 0)) {
|
|
101
|
+
return new ConcatSource(initFragment, source);
|
|
102
|
+
}
|
|
103
|
+
return source;
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = WebpackPlugin;
|