diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e502f4..3c56557 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## 1.0.14 - 2021.08.10 +### Added +* Added [Preload Directives Generation](https://vitejs.dev/guide/features.html#preload-directives-generation) that will automatically generate `` directives for entry chunks and their direct imports ([PR#2](https://github.com/nystudio107/craft-plugin-vite/pull/2)) + ## 1.0.13 - 2021.07.14 ### Added * Added a `craft.vite.devServerRunning()` method to allow you to determine if the Vite dev server is running or not from your Twig templates (https://github.com/nystudio107/craft-vite/issues/10) diff --git a/composer.json b/composer.json index 23a0864..258b3a9 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "nystudio107/craft-vite", "description": "Allows the use of the Vite.js next generation frontend tooling with Craft CMS", "type": "craft-plugin", - "version": "1.0.13", + "version": "1.0.14", "keywords": [ "craft", "cms", @@ -23,7 +23,7 @@ ], "require": { "craftcms/cms": "^3.0.0", - "nystudio107/craft-plugin-vite": "^1.0.10" + "nystudio107/craft-plugin-vite": "^1.0.11" }, "autoload": { "psr-4": { diff --git a/docs/docs/index.md b/docs/docs/index.md index 6b065e0..309e6a2 100755 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -65,6 +65,7 @@ return [ 'devServerInternal' => '', 'checkDevServer' => false, 'includeReactRefreshShim' => false, + 'includeModulePreloadShim' => true, 'criticalPath' => '@webroot/dist/criticalcss', 'criticalSuffix' =>'_critical.min.css', ]; @@ -84,6 +85,7 @@ These are completely optional settings that you probably won’t need to change: * **`devServerInternal`** - The internal URL to the dev server, when accessed from the environment in which PHP is executing. This can be the same as `$devServerPublic`, but may be different in containerized or VM setups. ONLY used if `$checkDevServer = true` * **`checkDevServer`** - Should we check for the presence of the dev server by pinging $devServerInternal to make sure it’s running? * **`includeReactRefreshShim`** - whether or not the required [shim for `react-refresh`](https://vitejs.dev/guide/backend-integration.html#backend-integration) should be included when the Vite dev server is running +* **`includeModulePreloadShim`** - whether or not the [shim for `modulepreload-polyfill`](https://vitejs.dev/guide/features.html#preload-directives-generation) should be included to polyfill `` If you’re using the [rollup-plugin-critical](https://github.com/nystudio107/rollup-plugin-critical) to generate [critical CSS](https://nystudio107.com/blog/implementing-critical-css), use these settings: @@ -252,6 +254,59 @@ If you know Docker, option `2` is a good way to go. You can see an example of ho I would generally discourage option `3`, because we want to run our development tools inside of our local development environment, and not on locally on our computer. +### Vite-Processed Assets + +This is cribbed from the [Laravel Vite integration](https://laravel-vite.netlify.app/guide/usage.html#static-assets) docs: + +There is currently an [unsolved issue when referencing assets in files processed by Vite](https://github.com/vitejs/vite/issues/2196), such as a Vue or CSS file. In development, URLs will not be properly rewritten. + +Additionally, there is currently no way to get the path of a Vite-processed asset (eg. an image that was imported in a Vue SFC) from the back-end, since the manifest does not reference the original file path. In most cases, this should not be an issue, as this is not a common use case. + +What you can do is leverage the /public [Public Directory](https://vitejs.dev/guide/assets.html#the-public-directory) for static assets in Vite, so the URLs will not get rewritten. + +The basic problem is if you have a CSS rule like: +```css +background-image: url('/src/img/woof.jpg'); +``` + +...and your local dev runs off of something like `myhost.test` then the image will be referenced as: +``` +/src/img/woof.jpg +``` + +...which then resolves to the current host: +``` +http://myhost.test/src/img/woof.jpg +``` + +...when what you really want is for it to be coming from the Vite dev server: +``` +http://localhost:3000/src/img/woof.jpg +``` + +This is only a problem when you're using Vite with a backend system like Craft CMS, where the host you run the website from is different from where the Vite dev server runs. + +To work around this, you can either put your static assets in your backend system's server root, so they resolve as expected, or you can use this little plugin suggested in [this GitHub issue](https://github.com/vitejs/vite/issues/2394): +```js +plugins: [ + { + name: 'static-asset-fixer', + enforce: 'post', + apply: 'serve', + transform: (code, id) => { + return { + code: code.replace(/\/src\/(.*)\.(svg|jp?g|png|webp)/g, 'http://localhost:3000/src/$1.$2'), + map: null, + } + }, + }, +], +``` + +If the Vite dev server is running, it will rewrite any absolute URLs that are prefixed with `/src/` and end in one of these extensions: `svg|jp?g|png|webp` + +This [issue may be addressed in Vite core](https://github.com/vitejs/vite/pull/4337#issuecomment-885710791) shortly. + ### Other Config Vite uses [esbuild](https://github.com/evanw/esbuild) so it is very fast, and has built-in support for TypeScript and JSX. diff --git a/docs/package-lock.json b/docs/package-lock.json index e6bf011..2c14a7a 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -153,24 +153,24 @@ } }, "@babel/helper-validator-identifier": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz", - "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==", + "version": "7.14.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz", + "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==", "dev": true }, "@babel/parser": { - "version": "7.14.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.7.tgz", - "integrity": "sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA==", + "version": "7.15.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.2.tgz", + "integrity": "sha512-bMJXql1Ss8lFnvr11TZDH4ArtwlAS5NG9qBmdiFW2UHHm6MVoR+GDc5XE2b9K938cyjc9O6/+vjjcffLDtfuDg==", "dev": true }, "@babel/types": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.5.tgz", - "integrity": "sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", + "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.5", + "@babel/helper-validator-identifier": "^7.14.9", "to-fast-properties": "^2.0.0" } }, @@ -504,47 +504,47 @@ "dev": true }, "@vitejs/plugin-vue": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.2.5.tgz", - "integrity": "sha512-GIR31mdXTEfvElmBUaRhDc5v7lfdkEdawWQqJRiaRL/5qKsH+xusukglkvJz5y7+c6dEpxgmvcATv2BbB7+fzQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.4.0.tgz", + "integrity": "sha512-RkqfJHz9wdLKBp5Yi+kQL8BAljdrvPoccQm2PTZc/UcL4EjD11xsv2PPCduYx2oV1a/bpSKA3sD5sxOHFhz+LA==", "dev": true }, "@vue/compiler-core": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.1.4.tgz", - "integrity": "sha512-TnUz+1z0y74O/A4YKAbzsdUfamyHV73MihrEfvettWpm9bQKVoZd1nEmR1cGN9LsXWlwAvVQBetBlWdOjmQO5Q==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.1.tgz", + "integrity": "sha512-UEJf2ZGww5wGVdrWIXIZo04KdJFGPmI2bHRUsBZ3AdyCAqJ5ykRXKOBn1OR1hvA2YzimudOEyHM+DpbBv91Kww==", "dev": true, "requires": { "@babel/parser": "^7.12.0", "@babel/types": "^7.12.0", - "@vue/shared": "3.1.4", + "@vue/shared": "3.2.1", "estree-walker": "^2.0.1", "source-map": "^0.6.1" } }, "@vue/compiler-dom": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.1.4.tgz", - "integrity": "sha512-3tG2ScHkghhUBuFwl9KgyZhrS8CPFZsO7hUDekJgIp5b1OMkROr4AvxHu6rRMl4WkyvYkvidFNBS2VfOnwa6Kw==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.1.tgz", + "integrity": "sha512-tXg8tkPb3j54zNfWqoao9T1JI41yWPz8TROzmif/QNNA46eq8/SRuRsBd36i47GWaz7mh+yg3vOJ87/YBjcMyQ==", "dev": true, "requires": { - "@vue/compiler-core": "3.1.4", - "@vue/shared": "3.1.4" + "@vue/compiler-core": "3.2.1", + "@vue/shared": "3.2.1" } }, "@vue/compiler-sfc": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.1.4.tgz", - "integrity": "sha512-4KDQg60Khy3SgnF+V/TB2NZqzmM4TyGRmzsxqG1SebGdMSecCweFDSlI/F1vDYk6dKiCHgmpoT9A1sLxswkJ0A==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.1.tgz", + "integrity": "sha512-fVLdme5RZVkBt+jxv2LCSRM72o4FX7BR2eu2FpjjEi1kEtUMKBDnjKwGWy7TyhTju0t0CocctyoM+G56vH7NpQ==", "dev": true, "requires": { "@babel/parser": "^7.13.9", "@babel/types": "^7.13.0", "@types/estree": "^0.0.48", - "@vue/compiler-core": "3.1.4", - "@vue/compiler-dom": "3.1.4", - "@vue/compiler-ssr": "3.1.4", - "@vue/shared": "3.1.4", + "@vue/compiler-core": "3.2.1", + "@vue/compiler-dom": "3.2.1", + "@vue/compiler-ssr": "3.2.1", + "@vue/shared": "3.2.1", "consolidate": "^0.16.0", "estree-walker": "^2.0.1", "hash-sum": "^2.0.0", @@ -569,59 +569,59 @@ } }, "@vue/compiler-ssr": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.1.4.tgz", - "integrity": "sha512-Box8fCuCFPp0FuimIswjDkjwiSDCBkHvt/xVALyFkYCiIMWv2eR53fIjmlsnEHhcBuZ+VgRC+UanCTcKvSA1gA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.1.tgz", + "integrity": "sha512-6YAOtQunuEyYlVSjK1F7a7BXi7rxVfiTiJ0Ro7eq0q0MNCFV9Z+sN68lfa/E4ABVb0ledEY/Rt8kL23nwCoTCQ==", "dev": true, "requires": { - "@vue/compiler-dom": "3.1.4", - "@vue/shared": "3.1.4" + "@vue/compiler-dom": "3.2.1", + "@vue/shared": "3.2.1" } }, "@vue/reactivity": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.4.tgz", - "integrity": "sha512-YDlgii2Cr9yAoKVZFzgY4j0mYlVT73986X3e5SPp6ifqckSEoFSUWXZK2Tb53TB/9qO29BEEbspnKD3m3wAwkA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.1.tgz", + "integrity": "sha512-4Lja2KmyiKvuraDed6dXK2A6+r/7x7xGDA7vVR2Aqc8hQVu0+FWeVX+IBfiVOSpbZXFlHLNmCBFkbuWLQSlgxg==", "dev": true, "requires": { - "@vue/shared": "3.1.4" + "@vue/shared": "3.2.1" } }, "@vue/runtime-core": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.1.4.tgz", - "integrity": "sha512-qmVJgJuFxfT7M4qHQ4M6KqhKC66fjuswK+aBivE8dWiZ2rtIGl9gtJGpwqwjQEcKEBTOfvvrtrwBncYArJUO8Q==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.1.tgz", + "integrity": "sha512-IsgelRM/5hYeRhz5+ECi66XvYDdjG2t4lARjHvCXw5s9Q4N6uIbjLMwtLzAWRxYf3/y258BrD+ehxAi943ScJg==", "dev": true, "requires": { - "@vue/reactivity": "3.1.4", - "@vue/shared": "3.1.4" + "@vue/reactivity": "3.2.1", + "@vue/shared": "3.2.1" } }, "@vue/runtime-dom": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.1.4.tgz", - "integrity": "sha512-vbmwgTxku1BU87Kw7r29adv0OIrDXCW0PslOPQT0O/9R5SqcXgS94Yj6zsztDjvghegenwIAPNLlDR1Auh5s+w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.1.tgz", + "integrity": "sha512-bUAHUSe49A5wYdHQ8wsLU1CMPXaG2fRuv2661mx/6Q9+20QxglT3ss8ZeL6AVRu16JNJMcdvTTsNpbnMbVc/lQ==", "dev": true, "requires": { - "@vue/runtime-core": "3.1.4", - "@vue/shared": "3.1.4", + "@vue/runtime-core": "3.2.1", + "@vue/shared": "3.2.1", "csstype": "^2.6.8" } }, "@vue/server-renderer": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.1.4.tgz", - "integrity": "sha512-STyvZLeoQwljTMqA94Zmlo20AEBOdF57nuIz0tw+fsJvkmLt3R9HEngvHPmB0Aht9XnVP9h7oG61/5luhsbfDA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.2.1.tgz", + "integrity": "sha512-Zphh7jjysefw4c4mqy2gDlg5W1MYpYuXPlbv2qnjr4IQHjR/FXQfrqo7U858SOCGXL7sXvx025/BstefP4WBTg==", "dev": true, "requires": { - "@vue/compiler-ssr": "3.1.4", - "@vue/shared": "3.1.4" + "@vue/compiler-ssr": "3.2.1", + "@vue/shared": "3.2.1" } }, "@vue/shared": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.4.tgz", - "integrity": "sha512-6O45kZAmkLvzGLToBxEz4lR2W6kXohCtebV2UxjH9GXjd8X9AhEn68FN9eNanFtWNzvgw1hqd6HkPRVQalqf7Q==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.1.tgz", + "integrity": "sha512-INN92dVBNgd0TW9BqfQQKx/HWGCHhUUbAV5EZ5FgSCiEdwuZsJbGt1mdnaD9IxGhpiyOjP2ClxGG8SFp7ELcWg==", "dev": true }, "accepts": { @@ -782,9 +782,9 @@ } }, "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, "bytes": { @@ -912,9 +912,9 @@ "dev": true }, "colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", + "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", "dev": true }, "compressible": { @@ -1155,9 +1155,9 @@ } }, "esbuild": { - "version": "0.12.15", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.15.tgz", - "integrity": "sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==", + "version": "0.12.19", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.19.tgz", + "integrity": "sha512-5NuT1G6THW7l3fsSCDkcPepn24R0XtyPjKoqKHD8LfhqMXzCdz0mrS9HgO6hIhzVT7zt0T+JGbzCqF5AH8hS9w==", "dev": true }, "escape-html": { @@ -1380,9 +1380,9 @@ } }, "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, "gray-matter": { @@ -1427,6 +1427,15 @@ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, "hash-sum": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-2.0.0.tgz", @@ -1502,12 +1511,13 @@ } }, "is-arguments": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dev": true, "requires": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" } }, "is-arrayish": { @@ -1532,10 +1542,13 @@ } }, "is-date-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.4.tgz", - "integrity": "sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A==", - "dev": true + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-decimal": { "version": "1.0.4", @@ -1604,13 +1617,13 @@ "dev": true }, "is-regex": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", - "integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" + "has-tostringtag": "^1.0.0" } }, "is-unicode-supported": { @@ -1823,9 +1836,9 @@ "dev": true }, "markdown-it": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.1.0.tgz", - "integrity": "sha512-7temG6IFOOxfU0SgzhqR+vr2diuMhyO5uUIEZ3C5NbXhqC9uFUHoU41USYuDFoZRsaY7BEIEei874Z20VMLF6A==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.2.0.tgz", + "integrity": "sha512-Wjws+uCrVQRqOoJvze4HCqkKl1AsSh95iFAeQDwnyfxM09divCBSXlDR1uTvyUP3Grzpn4Ru8GeCxYPM8vkCQg==", "dev": true, "requires": { "argparse": "^2.0.1", @@ -1931,18 +1944,18 @@ "dev": true }, "mime-db": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz", - "integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==", + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", "dev": true }, "mime-types": { - "version": "2.1.31", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz", - "integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==", + "version": "2.1.32", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", "dev": true, "requires": { - "mime-db": "1.48.0" + "mime-db": "1.49.0" } }, "mimic-fn": { @@ -2122,9 +2135,9 @@ } }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -2284,9 +2297,9 @@ } }, "postcss": { - "version": "8.3.5", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", - "integrity": "sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==", + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz", + "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==", "dev": true, "requires": { "colorette": "^1.2.2", @@ -2295,9 +2308,9 @@ } }, "postcss-modules": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/postcss-modules/-/postcss-modules-4.1.3.tgz", - "integrity": "sha512-dBT39hrXe4OAVYJe/2ZuIZ9BzYhOe7t+IhedYeQ2OxKwDpAGlkEN/fR0fGnrbx4BvgbMReRX4hCubYK9cE/pJQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/postcss-modules/-/postcss-modules-4.2.2.tgz", + "integrity": "sha512-/H08MGEmaalv/OU8j6bUKi/kZr2kqGF6huAW8m9UAgOLWtpFdhA14+gPBoymtqyv+D4MLsmqaF2zvIegdCxJXg==", "dev": true, "requires": { "generic-names": "^2.0.1", @@ -2588,9 +2601,9 @@ } }, "rollup": { - "version": "2.53.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.53.1.tgz", - "integrity": "sha512-yiTCvcYXZEulNWNlEONOQVlhXA/hgxjelFSjNcrwAAIfYx/xqjSHwqg/cCaWOyFRKr+IQBaXwt723m8tCaIUiw==", + "version": "2.56.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.2.tgz", + "integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -2730,9 +2743,9 @@ } }, "spdx-license-ids": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz", - "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==", + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", + "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", "dev": true }, "split-lines": { @@ -3282,30 +3295,30 @@ } }, "vite": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-2.4.2.tgz", - "integrity": "sha512-2MifxD2I9fjyDmmEzbULOo3kOUoqX90A58cT6mECxoVQlMYFuijZsPQBuA14mqSwvV3ydUsqnq+BRWXyO9Qa+w==", + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.4.4.tgz", + "integrity": "sha512-m1wK6pFJKmaYA6AeZIUXyiAgUAAJzVXhIMYCdZUpCaFMGps0v0IlNJtbmPvkUhVEyautalajmnW5X6NboUPsnw==", "dev": true, "requires": { "esbuild": "^0.12.8", "fsevents": "~2.3.2", - "postcss": "^8.3.5", + "postcss": "^8.3.6", "resolve": "^1.20.0", "rollup": "^2.38.5" } }, "vitepress": { - "version": "0.15.6", - "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-0.15.6.tgz", - "integrity": "sha512-+knoqxT6V3DAAP6ojXmwsbplqjPvf256xFJfAJdzu4WArJSXGoserPIhtLK7fOFKPQrcb8S6H9RpIshY31/hLg==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-0.16.0.tgz", + "integrity": "sha512-cs/wGYAUuf3y5j31YuaXjM2E9smMHR1XIlBtba56IvmFU6bjrRT6IpDdl+vP2coF+rLjFW5ZsD2UxVRx/RsGrw==", "dev": true, "requires": { "@docsearch/css": "^1.0.0-alpha.28", "@docsearch/js": "^1.0.0-alpha.28", "@types/markdown-it": "^12.0.1", - "@vitejs/plugin-vue": "^1.2.3", - "@vue/compiler-sfc": "^3.1.1", - "@vue/server-renderer": "^3.1.1", + "@vitejs/plugin-vue": "^1.4.0", + "@vue/compiler-sfc": "^3.2.1", + "@vue/server-renderer": "^3.2.1", "chalk": "^4.1.1", "compression": "^1.7.4", "debug": "^4.3.2", @@ -3325,8 +3338,8 @@ "polka": "^0.5.2", "prismjs": "^1.23.0", "sirv": "^1.0.12", - "vite": "^2.3.7", - "vue": "^3.1.1" + "vite": "^2.4.4", + "vue": "^3.2.1" }, "dependencies": { "ansi-styles": { @@ -3339,9 +3352,9 @@ } }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -3360,14 +3373,14 @@ } }, "vue": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.1.4.tgz", - "integrity": "sha512-p8dcdyeCgmaAiZsbLyDkmOLcFGZb/jEVdCLW65V68LRCXTNX8jKsgah2F7OZ/v/Ai2V0Fb1MNO0vz/GFqsPVMA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.1.tgz", + "integrity": "sha512-0jhXluF5mzTAK5bXw/8yq4McvsI8HwEWI4cnQwJeN8NYGRbwh9wwuE4FNv1Kej9pxBB5ajTNsWr0M6DPs5EJZg==", "dev": true, "requires": { - "@vue/compiler-dom": "3.1.4", - "@vue/runtime-dom": "3.1.4", - "@vue/shared": "3.1.4" + "@vue/compiler-dom": "3.2.1", + "@vue/runtime-dom": "3.2.1", + "@vue/shared": "3.2.1" } }, "wcwidth": { diff --git a/src/config.php b/src/config.php index a826a16..95dea76 100755 --- a/src/config.php +++ b/src/config.php @@ -74,6 +74,11 @@ */ 'includeReactRefreshShim' => false, + /** + * @var bool Whether the modulepreload-polyfill shim should be included + */ + 'includeModulePreloadShim' => true, + /** * @var string File system path (or URL) to where the Critical CSS files are stored */ diff --git a/src/models/Settings.php b/src/models/Settings.php index aec0c5f..7f952ff 100755 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -73,6 +73,11 @@ class Settings extends Model */ public $includeReactRefreshShim = false; + /** + * @var bool Whether the modulepreload-polyfill shim should be included + */ + public $includeModulePreloadShim = true; + /** * @var string File system path (or URL) to where the Critical CSS files are stored */ @@ -97,6 +102,7 @@ public function rules() 'useDevServer', 'checkDevServer', 'includeReactRefreshShim', + 'includeModulePreloadShim', ], 'boolean' ],