From c8a5c55b8f04d4d61d73af3da4548a7cf863a6b7 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Fri, 3 Nov 2023 18:51:05 +0100 Subject: [PATCH 01/16] fix(source): added `densities` option --- playground/pages/index.vue | 12 ++++++---- .../pages/tests/image/components/Critical.vue | 3 ++- .../pages/tests/image/components/Lazy.vue | 3 ++- .../tests/picture/components/Critical.vue | 3 ++- .../pages/tests/picture/components/Lazy.vue | 3 ++- .../SpeedkitImage/classes/Source.mjs | 23 ++++++++++++++----- src/runtime/components/SpeedkitVimeo/Base.vue | 10 +++++++- .../components/SpeedkitYoutube/Base.vue | 10 +++++++- 8 files changed, 51 insertions(+), 16 deletions(-) diff --git a/playground/pages/index.vue b/playground/pages/index.vue index 0c41a66a35..8cce5de72d 100644 --- a/playground/pages/index.vue +++ b/playground/pages/index.vue @@ -49,12 +49,14 @@ const stage = { xl: '100vw', xxl: '100vw' }, - media: '(orientation: landscape)' + media: '(orientation: landscape)', + densities: ['x1', 'x2'] }, { src: '/img/stage-portrait.jpg', sizes: { default: '100vw', xxs: '100vw', xs: '100vw' }, - media: '(orientation: portrait)' + media: '(orientation: portrait)', + densities: ['x1', 'x2'] } ] } @@ -86,7 +88,8 @@ const imageTextA = { xxl: '100vw' } } - ] + ], + densities: ['x1', 'x2'] } }; @@ -117,7 +120,8 @@ const imageTextB = { xxl: '100vw' } } - ] + ], + densities: ['x1', 'x2'] } }; diff --git a/playground/pages/tests/image/components/Critical.vue b/playground/pages/tests/image/components/Critical.vue index 7e2b491dba..12e306ceaa 100644 --- a/playground/pages/tests/image/components/Critical.vue +++ b/playground/pages/tests/image/components/Critical.vue @@ -27,7 +27,8 @@ const image = { lg: '100vw', xl: '100vw', xxl: '100vw' - } + }, + densities: ['x1', 'x2'] } }; diff --git a/playground/pages/tests/image/components/Lazy.vue b/playground/pages/tests/image/components/Lazy.vue index 4f0f5e3982..3f3c448bdd 100644 --- a/playground/pages/tests/image/components/Lazy.vue +++ b/playground/pages/tests/image/components/Lazy.vue @@ -26,7 +26,8 @@ const image = { lg: '100vw', xl: '100vw', xxl: '100vw' - } + }, + densities: ['x1', 'x2'] } }; diff --git a/playground/pages/tests/picture/components/Critical.vue b/playground/pages/tests/picture/components/Critical.vue index 642fa66b24..4053faa25a 100644 --- a/playground/pages/tests/picture/components/Critical.vue +++ b/playground/pages/tests/picture/components/Critical.vue @@ -27,7 +27,8 @@ const picture = { lg: '100vw', xl: '100vw', xxl: '100vw' - } + }, + densities: ['x1', 'x2'] } ] }; diff --git a/playground/pages/tests/picture/components/Lazy.vue b/playground/pages/tests/picture/components/Lazy.vue index 211c24d126..ba9274e422 100644 --- a/playground/pages/tests/picture/components/Lazy.vue +++ b/playground/pages/tests/picture/components/Lazy.vue @@ -27,7 +27,8 @@ const picture = { lg: '100vw', xl: '100vw', xxl: '100vw' - } + }, + densities: ['x1', 'x2'] } ] }; diff --git a/src/runtime/components/SpeedkitImage/classes/Source.mjs b/src/runtime/components/SpeedkitImage/classes/Source.mjs index 477acf27df..d68d83f2cf 100644 --- a/src/runtime/components/SpeedkitImage/classes/Source.mjs +++ b/src/runtime/components/SpeedkitImage/classes/Source.mjs @@ -10,9 +10,10 @@ export default class Source { format = null; quality = null; preload = false; - modifiers = {}; - provider = undefined; // https://image.nuxtjs.org/api/optionsproviders - preset = undefined; // https://image.nuxtjs.org/api/optionspresets + modifiers = {}; // https://image.nuxt.com/usage/nuxt-img#modifiers + provider = undefined; // https://image.nuxt.com/usage/nuxt-img#provider + preset = undefined; // https://image.nuxt.com/usage/nuxt-img#preset + densities = undefined; // https://image.nuxt.com/usage/nuxt-img#densities constructor({ src, @@ -25,7 +26,8 @@ export default class Source { preload = false, modifiers = {}, provider = undefined, - preset = undefined + preset = undefined, + densities = undefined }) { this.src = src; this.sizes = sizes; @@ -38,6 +40,7 @@ export default class Source { this.modifiers = modifiers; this.provider = provider; this.preset = preset; + this.densities = densities; } get key() { @@ -65,7 +68,14 @@ export default class Source { } getOptions() { - return { provider: this.provider, preset: this.preset }; + return { + provider: this.provider, + preset: this.preset, + densities: [] + .concat(this.densities || 1) + .map(v => String(v).trim()) + .join(' ') + }; } getMeta(compiledSrc, $speedkit) { @@ -100,7 +110,8 @@ export default class Source { preload: this.preload, modifiers: this.modifiers, provider: this.provider, - preset: this.preset + preset: this.preset, + densities: this.densities }; } diff --git a/src/runtime/components/SpeedkitVimeo/Base.vue b/src/runtime/components/SpeedkitVimeo/Base.vue index 9d71ca1c49..06d65e1743 100644 --- a/src/runtime/components/SpeedkitVimeo/Base.vue +++ b/src/runtime/components/SpeedkitVimeo/Base.vue @@ -85,6 +85,13 @@ export default { xxl: '100vw' }; } + }, + + posterDensities: { + type: [Array, String], + default() { + return ['x1', 'x2']; + } } }, emits: ['playing', 'ready'], @@ -183,7 +190,8 @@ export default { 'vimeo' ), sizes: this.posterSizes, - media: 'all' + media: 'all', + densities: this.posterDensities } ] }; diff --git a/src/runtime/components/SpeedkitYoutube/Base.vue b/src/runtime/components/SpeedkitYoutube/Base.vue index 40a10a5db9..c637c0450b 100644 --- a/src/runtime/components/SpeedkitYoutube/Base.vue +++ b/src/runtime/components/SpeedkitYoutube/Base.vue @@ -85,6 +85,13 @@ export default { xxl: '100vw' }; } + }, + + posterDensities: { + type: [Array, String], + default() { + return ['x1', 'x2']; + } } }, @@ -122,7 +129,8 @@ export default { { src: `/youtube/vi/${this.videoId}/maxresdefault.jpg`, sizes: this.posterSizes, - media: 'all' + media: 'all', + densities: this.posterDensities } ] }; From 8adfa8932fc1aedd6d54858b46ef1c794e404610 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Wed, 8 Nov 2023 19:55:14 +0100 Subject: [PATCH 02/16] fix(source): `@nuxt/image` `densities` definition --- playground/pages/index.vue | 12 ++++-------- playground/pages/tests/image/components/Critical.vue | 3 +-- playground/pages/tests/image/components/Lazy.vue | 3 +-- .../pages/tests/picture/components/Critical.vue | 3 +-- playground/pages/tests/picture/components/Lazy.vue | 3 +-- src/module.mjs | 1 + src/runtime/components/SpeedkitImage/Base.vue | 2 +- .../components/SpeedkitImage/classes/Source.mjs | 7 ++----- src/runtime/components/SpeedkitPicture/Source.vue | 2 +- .../SpeedkitPicture/classes/SourceList.mjs | 2 +- src/runtime/components/SpeedkitVimeo/Base.vue | 6 ++---- src/runtime/components/SpeedkitYoutube/Base.vue | 6 ++---- src/runtime/tmpl/plugin.mjs | 3 ++- src/utils/options.mjs | 1 + 14 files changed, 21 insertions(+), 33 deletions(-) diff --git a/playground/pages/index.vue b/playground/pages/index.vue index 8cce5de72d..0c41a66a35 100644 --- a/playground/pages/index.vue +++ b/playground/pages/index.vue @@ -49,14 +49,12 @@ const stage = { xl: '100vw', xxl: '100vw' }, - media: '(orientation: landscape)', - densities: ['x1', 'x2'] + media: '(orientation: landscape)' }, { src: '/img/stage-portrait.jpg', sizes: { default: '100vw', xxs: '100vw', xs: '100vw' }, - media: '(orientation: portrait)', - densities: ['x1', 'x2'] + media: '(orientation: portrait)' } ] } @@ -88,8 +86,7 @@ const imageTextA = { xxl: '100vw' } } - ], - densities: ['x1', 'x2'] + ] } }; @@ -120,8 +117,7 @@ const imageTextB = { xxl: '100vw' } } - ], - densities: ['x1', 'x2'] + ] } }; diff --git a/playground/pages/tests/image/components/Critical.vue b/playground/pages/tests/image/components/Critical.vue index 12e306ceaa..7e2b491dba 100644 --- a/playground/pages/tests/image/components/Critical.vue +++ b/playground/pages/tests/image/components/Critical.vue @@ -27,8 +27,7 @@ const image = { lg: '100vw', xl: '100vw', xxl: '100vw' - }, - densities: ['x1', 'x2'] + } } }; diff --git a/playground/pages/tests/image/components/Lazy.vue b/playground/pages/tests/image/components/Lazy.vue index 3f3c448bdd..4f0f5e3982 100644 --- a/playground/pages/tests/image/components/Lazy.vue +++ b/playground/pages/tests/image/components/Lazy.vue @@ -26,8 +26,7 @@ const image = { lg: '100vw', xl: '100vw', xxl: '100vw' - }, - densities: ['x1', 'x2'] + } } }; diff --git a/playground/pages/tests/picture/components/Critical.vue b/playground/pages/tests/picture/components/Critical.vue index 4053faa25a..642fa66b24 100644 --- a/playground/pages/tests/picture/components/Critical.vue +++ b/playground/pages/tests/picture/components/Critical.vue @@ -27,8 +27,7 @@ const picture = { lg: '100vw', xl: '100vw', xxl: '100vw' - }, - densities: ['x1', 'x2'] + } } ] }; diff --git a/playground/pages/tests/picture/components/Lazy.vue b/playground/pages/tests/picture/components/Lazy.vue index ba9274e422..211c24d126 100644 --- a/playground/pages/tests/picture/components/Lazy.vue +++ b/playground/pages/tests/picture/components/Lazy.vue @@ -27,8 +27,7 @@ const picture = { lg: '100vw', xl: '100vw', xxl: '100vw' - }, - densities: ['x1', 'x2'] + } } ] }; diff --git a/src/module.mjs b/src/module.mjs index 67fa6ef6ca..855fb6df12 100644 --- a/src/module.mjs +++ b/src/module.mjs @@ -124,6 +124,7 @@ async function addBuildTemplates(nuxt, options) { mode, options: { mode, + densities: options.densities, targetFormats: options.targetFormats, crossorigin: getCrossorigin(options.crossorigin), supportedBrowserDetector, diff --git a/src/runtime/components/SpeedkitImage/Base.vue b/src/runtime/components/SpeedkitImage/Base.vue index a1193d3bb4..e9cb530774 100644 --- a/src/runtime/components/SpeedkitImage/Base.vue +++ b/src/runtime/components/SpeedkitImage/Base.vue @@ -69,7 +69,7 @@ export default { const config = $img.getSizes(source.src, { sizes: source.sizes, modifiers: source.getModifiers(), - ...source.getOptions() + ...source.getOptions($speedkit) }); const meta = ref(null); diff --git a/src/runtime/components/SpeedkitImage/classes/Source.mjs b/src/runtime/components/SpeedkitImage/classes/Source.mjs index d68d83f2cf..cefd2d4374 100644 --- a/src/runtime/components/SpeedkitImage/classes/Source.mjs +++ b/src/runtime/components/SpeedkitImage/classes/Source.mjs @@ -67,14 +67,11 @@ export default class Source { return { ...this.modifiers, format: this.format, quality: this.quality }; } - getOptions() { + getOptions($speedkit) { return { provider: this.provider, preset: this.preset, - densities: [] - .concat(this.densities || 1) - .map(v => String(v).trim()) - .join(' ') + densities: this.densities || $speedkit.densities }; } diff --git a/src/runtime/components/SpeedkitPicture/Source.vue b/src/runtime/components/SpeedkitPicture/Source.vue index 4b9985ef62..21b3a4aad6 100644 --- a/src/runtime/components/SpeedkitPicture/Source.vue +++ b/src/runtime/components/SpeedkitPicture/Source.vue @@ -39,7 +39,7 @@ export default { const config = $img.getSizes(props.source.src, { sizes: props.source.sizes, modifiers: props.source.getModifiers(), - ...props.source.getOptions() + ...props.source.getOptions($speedkit) }); const resolvedCrossorigin = computed(() => { diff --git a/src/runtime/components/SpeedkitPicture/classes/SourceList.mjs b/src/runtime/components/SpeedkitPicture/classes/SourceList.mjs index bb4ccda2d4..425fa4df13 100644 --- a/src/runtime/components/SpeedkitPicture/classes/SourceList.mjs +++ b/src/runtime/components/SpeedkitPicture/classes/SourceList.mjs @@ -84,7 +84,7 @@ export default class SourceList { const config = $img.getSizes(source.src, { sizes: source.sizes, modifiers: source.getModifiers(), - ...source.getOptions() + ...source.getOptions($speedkit) }); return source.getMeta(config.src, $speedkit); }) diff --git a/src/runtime/components/SpeedkitVimeo/Base.vue b/src/runtime/components/SpeedkitVimeo/Base.vue index 06d65e1743..b00b5df27e 100644 --- a/src/runtime/components/SpeedkitVimeo/Base.vue +++ b/src/runtime/components/SpeedkitVimeo/Base.vue @@ -88,10 +88,8 @@ export default { }, posterDensities: { - type: [Array, String], - default() { - return ['x1', 'x2']; - } + type: [String, Number], + default: undefined } }, emits: ['playing', 'ready'], diff --git a/src/runtime/components/SpeedkitYoutube/Base.vue b/src/runtime/components/SpeedkitYoutube/Base.vue index c637c0450b..efdefdfdbe 100644 --- a/src/runtime/components/SpeedkitYoutube/Base.vue +++ b/src/runtime/components/SpeedkitYoutube/Base.vue @@ -88,10 +88,8 @@ export default { }, posterDensities: { - type: [Array, String], - default() { - return ['x1', 'x2']; - } + type: [String, Number], + default: undefined } }, diff --git a/src/runtime/tmpl/plugin.mjs b/src/runtime/tmpl/plugin.mjs index aead275c6f..324adc28b8 100644 --- a/src/runtime/tmpl/plugin.mjs +++ b/src/runtime/tmpl/plugin.mjs @@ -20,7 +20,8 @@ export default defineNuxtPlugin({ getFont: fontList.getFont.bind(fontList), crossorigin: <%= options.crossorigin ? `'${options.crossorigin}'` : null %>, isBrowserSupported: () => isSupportedBrowser(<%= options.supportedBrowserDetector %>), - targetFormats: <%= JSON.stringify(options.targetFormats) %> + targetFormats: <%= JSON.stringify(options.targetFormats) %>, + densities: <%= JSON.stringify(options.densities) %> }); }, diff --git a/src/utils/options.mjs b/src/utils/options.mjs index 0ecf7f8c10..3196ed1b6e 100644 --- a/src/utils/options.mjs +++ b/src/utils/options.mjs @@ -25,6 +25,7 @@ export function getDefaultOptions() { fonts: [], targetFormats: null, + densities: 'x1 x2', /** * IntersectionObserver rootMargin for Compoennts and Assets From 1ef4ff60bfa895cfbe515612b1023e919b5a7d42 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Sat, 11 Nov 2023 13:37:32 +0100 Subject: [PATCH 03/16] docs(update): update speedkit-image `source` --- docs/src/components/speedkit-image.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/src/components/speedkit-image.md b/docs/src/components/speedkit-image.md index 1a0c3e610e..041b15574e 100644 --- a/docs/src/components/speedkit-image.md +++ b/docs/src/components/speedkit-image.md @@ -100,7 +100,8 @@ If `true` the `SpeedkitImage` is initialized. sizes: { … }, modifiers: { … }, preset: { … }, - provider: '' + provider: '', + densities: '' } ```` @@ -148,31 +149,42 @@ This overwrites the global ones of the preset if available. Learn more about `modifiers`: -- +- #### `preset` - Type: `Object` -If a preset is set on a source, the globally defined one is ignored. +If a `preset` is set on a source, the globally defined one is ignored. This means that a separate preset can be specified for each source. Learn more about `preset`: -- +- #### `provider` - Type: `String` -If a provider is set on a source, the globally defined one is ignored. +If a `provider` is set on a source, the globally defined one is ignored. This means that a separate provider can be specified for each source. Learn more about `provider`: -- +- + +#### `densities` + +- Type: `String`, `Number` + - Default: `x1 x2` + +If a `densities` is set on a source, the globally defined one is ignored. + +Learn more about `densities`: + +- ### `alt` From 663318d34ad9b9ec64251b9a8ac9a81fb5e57a8a Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Sun, 12 Nov 2023 17:01:50 +0100 Subject: [PATCH 04/16] fix(webpack): added workaround for ssr styles --- src/hookFunctions/nitro/init.mjs | 166 ++++++++++++++++++++----------- src/module.mjs | 7 -- src/utils.mjs | 6 +- src/utils/options.mjs | 4 +- src/utils/preload.mjs | 16 ++- 5 files changed, 127 insertions(+), 72 deletions(-) diff --git a/src/hookFunctions/nitro/init.mjs b/src/hookFunctions/nitro/init.mjs index b031dead63..f24f1f33f9 100644 --- a/src/hookFunctions/nitro/init.mjs +++ b/src/hookFunctions/nitro/init.mjs @@ -3,79 +3,47 @@ import { basename, dirname, join, resolve } from 'pathe'; import { parseDocument } from 'htmlparser2'; import { load } from 'cheerio'; import { render } from 'dom-serializer'; -import { logger } from '../../utils.mjs'; +import { isWebpackBuild, logger } from '../../utils.mjs'; -export default (nuxt, disableNuxtCritters = true) => +export default (nuxt, options = {}) => nitro => { nitro.hooks.hook('prerender:generate', async route => { + const { manifest, disableNuxtCritters } = { + disableNuxtCritters: true, + ...options + }; + if (!route.fileName?.endsWith('.html') || !route.contents) { return; } + // https://nuxt.com/docs/guide/directory-structure/output + const distNuxt = join( + nuxt.options.buildDir, + 'dist/client', + nuxt.options.app.buildAssetsDir + ); + const document = parseDocument(route.contents); const $ = load(document); + // webpack workaround inline css in ssr + if (isWebpackBuild(nuxt)) { + await addedInlinedCSS($, getCSSFilesFromManifest($, manifest), { + distNuxt, + route + }); + } + $('[rel="modulepreload"][as="script"]').remove(); $('[rel="prefetch"][as="script"]').remove(); + $('[rel="preload"][as="fetch"]').remove(); $('[rel="preload"][as="style"]').remove(); $('[rel="prefetch"][as="style"]').remove(); // embed css files - try { - const css = await Promise.all( - Array.from($('link[rel="stylesheet"]')) - .map(el => $(el)) - .filter($el => !isURL($el.attr('href'))) - .map(async $el => { - const dir = dirname($el.attr('href')); - - // https://nuxt.com/docs/guide/directory-structure/output - const distNuxt = join( - nuxt.options.buildDir, - 'dist/client', - nuxt.options.app.buildAssetsDir - ); - const filepath = join(distNuxt, basename($el.attr('href'))); - const fileContent = await fsPromises.readFile(filepath, 'utf-8'); - - let urls = getUrlValues(fileContent); - urls = prepareUrls(urls, dir); - - if (disableNuxtCritters) { - const css = urls.reduce( - (result, [a, b]) => result.replace(a, b), - fileContent - ); - - $el.remove(); - logger.info( - `Embed CSS File \`${basename($el.attr('href'))}\`; Route: \`${ - route.route - }\`` - ); - return css; - } else { - const matches = fileContent.match( - /\/\*! speedkit-font-faces start \*\/(.*)\/\*! speedkit-font-faces end \*\// - ); - if (matches) { - logger.info( - `Embed Font-Faces CSS \`${basename( - $el.attr('href') - )}\`; Route: \`${route.route}\`` - ); - return matches[1].replace(/url\(.\//g, `url(${dir}/`); - } - } - }) - ); - if (css.length) { - $('head').append(``); - } - } catch (error) { - logger.error("can't embed css file.", error); - } + await prepareLinkStylesheets($, { disableNuxtCritters, distNuxt, route }); route.contents = render(document); }); @@ -106,3 +74,89 @@ function isURL(value) { function isDataURI(value) { return value.startsWith('data:'); } + +async function prepareLinkStylesheets( + $, + { disableNuxtCritters, distNuxt, route } +) { + try { + const css = await Promise.all( + Array.from($('link[rel="stylesheet"]')) + .map(el => $(el)) + .filter($el => !isURL($el.attr('href'))) + .map(async $el => { + const dir = dirname($el.attr('href')); + const filepath = join(distNuxt, basename($el.attr('href'))); + const fileContent = await fsPromises.readFile(filepath, 'utf-8'); + + let urls = getUrlValues(fileContent); + urls = prepareUrls(urls, dir); + + if (disableNuxtCritters) { + const css = urls.reduce( + (result, [a, b]) => result.replace(a, b), + fileContent + ); + + $el.remove(); + logger.info( + `Embed CSS File \`${basename($el.attr('href'))}\`; Route: \`${ + route.route + }\`` + ); + return css; + } else { + const matches = fileContent.match( + /\/\*! speedkit-font-faces start \*\/(.*)\/\*! speedkit-font-faces end \*\// + ); + if (matches) { + logger.info( + `Embed Font-Faces CSS \`${basename( + $el.attr('href') + )}\`; Route: \`${route.route}\`` + ); + return matches[1].replace(/url\(.\//g, `url(${dir}/`); + } + } + }) + ); + if (css.length) { + $('head').append(``); + } + } catch (error) { + logger.error("can't embed css file.", error); + } +} + +function getCSSFilesFromManifest($, manifest) { + const scripts = Array.from($('script[type="module"]')); + return scripts + .map(el => { + return ( + manifest[String(`_${basename($(el).attr('src'))}`)]?.dynamicImports || + [] + ); + }) + .flat() + .filter(file => file.endsWith('.css')) + .map(file => `${basename(file)}`); +} + +async function addedInlinedCSS($, files, { distNuxt, route }) { + const css = await Promise.all( + files.map(async filename => { + // eslint-disable-next-line security/detect-non-literal-fs-filename + const css = await fsPromises.readFile( + join(distNuxt, 'css', filename), + 'utf-8' + ); + logger.info( + `Embed CSS File \`${basename(filename)}\`; Route: \`${route.route}\`` + ); + return css; + }) + ); + if (css.length) { + $('head').append(``); + } +} diff --git a/src/module.mjs b/src/module.mjs index 67fa6ef6ca..f0ebb014fb 100644 --- a/src/module.mjs +++ b/src/module.mjs @@ -50,13 +50,6 @@ export default defineNuxtModule({ setPublicRuntimeConfig(nuxt, moduleOptions); - // TODO: Remove in future - if (isWebpackBuild(nuxt)) { - logger.warn( - `[${MODULE_NAME}]: Webpack build is not usable yet.\nOpen Issues:\n- Inline Styles (\`https://nuxt.com/docs/api/configuration/nuxt-config#inlinessrstyles\`)` - ); - } - if (moduleOptions.detection.performance && nuxt.options.ssr) { if (isWebpackBuild(nuxt)) { nuxt.hook( diff --git a/src/utils.mjs b/src/utils.mjs index aff32166d2..e41711995e 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -39,7 +39,7 @@ function moduleExists(nuxt, moduleName) { export async function addNuxtCritters(nuxt) { if (!moduleExists(nuxt, '@nuxtjs/critters')) { logger.info( - `[${MODULE_NAME}] added module \`@nuxtjs/critters\`, for more configuration learn more at \`https://github.com/nuxt-modules/critters\`` + `Added module \`@nuxtjs/critters\`, for more configuration learn more at \`https://github.com/nuxt-modules/critters\`` ); nuxt.options.critters = defu( { @@ -58,7 +58,7 @@ export async function addNuxtCritters(nuxt) { export async function addNuxtFontaine(nuxt) { if (!moduleExists(nuxt, '@nuxtjs/fontaine')) { logger.info( - `[${MODULE_NAME}] added module \`@nuxtjs/fontaine\`, for more configuration learn more at \`https://github.com/nuxt-modules/fontaine\`` + `Added module \`@nuxtjs/fontaine\`, for more configuration learn more at \`https://github.com/nuxt-modules/fontaine\`` ); await installModule('@nuxtjs/fontaine'); } @@ -67,7 +67,7 @@ export async function addNuxtFontaine(nuxt) { export async function addNuxtImage(nuxt) { if (!moduleExists(nuxt, '@nuxt/image')) { logger.info( - `[${MODULE_NAME}] added module \`@nuxt/image\`, for more configuration learn more at \`https://image.nuxtjs.org/setup#configure\`` + `Added module \`@nuxt/image\`, for more configuration learn more at \`https://image.nuxtjs.org/setup#configure\`` ); await installModule('@nuxt/image'); } diff --git a/src/utils/options.mjs b/src/utils/options.mjs index 0ecf7f8c10..ad16644b5c 100644 --- a/src/utils/options.mjs +++ b/src/utils/options.mjs @@ -1,4 +1,4 @@ -import { MODULE_NAME, logger } from '../utils.mjs'; +import { logger } from '../utils.mjs'; export function getDefaultOptions() { return { @@ -39,7 +39,7 @@ export function getDefaultOptions() { export function deprecationsNotification(options) { if ('loader' in options) { logger.warn( - `[${MODULE_NAME}] Option \`loader\` is deprecated, There is no integrated loader anymore.` + `Option \`loader\` is deprecated, There is no integrated loader anymore.` ); delete options.loader; } diff --git a/src/utils/preload.mjs b/src/utils/preload.mjs index 567083da4e..545b66ced1 100644 --- a/src/utils/preload.mjs +++ b/src/utils/preload.mjs @@ -1,17 +1,25 @@ import initHook from '../hookFunctions/nitro/init.mjs'; -import { isViteBuild } from '../utils.mjs'; +import { isViteBuild, isWebpackBuild, logger } from '../utils.mjs'; export function optimizePreloads(moduleOptions, nuxt) { const disableNuxtCritters = moduleOptions.disableNuxtCritters; + nuxt.options.experimental.inlineSSRStyles = false; if (isViteBuild(nuxt)) { nuxt.options.vite.build.manifest = false; if (disableNuxtCritters) { nuxt.options.vite.build.cssCodeSplit = false; } + } else if (isWebpackBuild(nuxt)) { + nuxt.options.webpack.extractCSS = true; + logger.info(`Use workaround for \`SSR Styles\` in \`Webpack\`.`); } - nuxt.options.experimental.inlineSSRStyles = false; - - nuxt.hook('nitro:init', initHook(nuxt, disableNuxtCritters)); + const hookOptions = { + disableNuxtCritters: + typeof disableNuxtCritters !== 'undefined' ? disableNuxtCritters : true, + manifest: null + }; + nuxt.hook('build:manifest', manifest => (hookOptions.manifest = manifest)); + nuxt.hook('nitro:init', initHook(nuxt, hookOptions)); } From 9f2fb29ba50f405804b64925f36314aca97be66b Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Sun, 12 Nov 2023 17:59:46 +0100 Subject: [PATCH 05/16] chore(lint): added ignore comment --- src/hookFunctions/nitro/init.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hookFunctions/nitro/init.mjs b/src/hookFunctions/nitro/init.mjs index f24f1f33f9..8d83bffc73 100644 --- a/src/hookFunctions/nitro/init.mjs +++ b/src/hookFunctions/nitro/init.mjs @@ -87,6 +87,7 @@ async function prepareLinkStylesheets( .map(async $el => { const dir = dirname($el.attr('href')); const filepath = join(distNuxt, basename($el.attr('href'))); + // eslint-disable-next-line security/detect-non-literal-fs-filename const fileContent = await fsPromises.readFile(filepath, 'utf-8'); let urls = getUrlValues(fileContent); From be9f3e683d71e61c98b573b2fd095c0fcb342e18 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Sun, 12 Nov 2023 23:01:47 +0100 Subject: [PATCH 06/16] fix(module): removed `@nuxt/critters` --- build.config.mjs | 1 - docs/src/guide/options.md | 15 --- package-lock.json | 225 ++++--------------------------- package.json | 1 - src/hookFunctions/nitro/init.mjs | 52 +++---- src/module.mjs | 4 - src/utils.mjs | 19 --- src/utils/options.mjs | 1 - src/utils/preload.mjs | 7 +- 9 files changed, 40 insertions(+), 285 deletions(-) diff --git a/build.config.mjs b/build.config.mjs index a96a13a227..e158ad9e9e 100644 --- a/build.config.mjs +++ b/build.config.mjs @@ -10,7 +10,6 @@ export default { // package '@nuxt/image', - '@nuxtjs/critters', 'browserslist-useragent-regexp', 'cheerio', 'defu', diff --git a/docs/src/guide/options.md b/docs/src/guide/options.md index 5ca978599f..d329dad5a4 100644 --- a/docs/src/guide/options.md +++ b/docs/src/guide/options.md @@ -254,21 +254,6 @@ Global option for the [`IntersectionObserver`](https://developer.mozilla.org/en- | `component` | `String` | yes | [`rootMargin`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin) value for [`SpeedkitHydrate`](/guide/usage#import-components). | `0%` | | `asset` | `String` | yes | [`rootMargin`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin) value for all static ressources (`v-font`, `SpeedkitPicture` & `SpeedkitImage`). | `0%` | -## `disableNuxtCritters` - -- Type: `Boolean` - - Default: `false` - -If set, `@nuxtjs/critters` will not be integrated. - -::: danger -⚠️ Note that CSS is not embedded in the page. -::: - -::: info -For more information: -::: - ## `disableNuxtFontaine` - Type: `Boolean` diff --git a/package-lock.json b/package-lock.json index b0afee6e70..d26a70500f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "license": "MIT", "dependencies": { "@nuxt/image": "1.0.0", - "@nuxtjs/critters": "0.5.1", "@nuxtjs/fontaine": "0.4.1", "browserslist-useragent-regexp": "4.1.0", "cheerio": "1.0.0-rc.12", @@ -4624,92 +4623,6 @@ "integrity": "sha512-KnaMTE6EItz/f2q4Gwg5/rmeKVi79OR58NoYnwDJqCk9ywMtTGbBnBcfoBtN4QbYu0lWXvyMoH2Owxuhe4qI6Q==", "dev": true }, - "node_modules/@nuxtjs/critters": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@nuxtjs/critters/-/critters-0.5.1.tgz", - "integrity": "sha512-TxrPVX51dV6OOhXmgDkYnPefSx3BPoOgPI0mXiGJcg9hD2rpytDJ67YGFDFygL+k2MBBJhELklOApMl1XdTdKQ==", - "dependencies": { - "@nuxt/kit": "3.6.5", - "critters": "0.0.20", - "pathe": "1.1.1" - } - }, - "node_modules/@nuxtjs/critters/node_modules/@nuxt/kit": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/@nuxt/kit/-/kit-3.6.5.tgz", - "integrity": "sha512-uBI5I2Zx6sk+vRHU+nBmifwxg/nyXCGZ1g5hUKrUfgv1ZfiKB8JkN5T9iRoduDOaqbwM6XSnEl1ja73iloDcrw==", - "dependencies": { - "@nuxt/schema": "3.6.5", - "c12": "^1.4.2", - "consola": "^3.2.3", - "defu": "^6.1.2", - "globby": "^13.2.2", - "hash-sum": "^2.0.0", - "ignore": "^5.2.4", - "jiti": "^1.19.1", - "knitwork": "^1.0.0", - "mlly": "^1.4.0", - "pathe": "^1.1.1", - "pkg-types": "^1.0.3", - "scule": "^1.0.0", - "semver": "^7.5.3", - "unctx": "^2.3.1", - "unimport": "^3.0.14", - "untyped": "^1.3.2" - }, - "engines": { - "node": "^14.18.0 || >=16.10.0" - } - }, - "node_modules/@nuxtjs/critters/node_modules/@nuxt/schema": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/@nuxt/schema/-/schema-3.6.5.tgz", - "integrity": "sha512-UPUnMB0W5TZ/Pi1fiF71EqIsPlj8LGZqzhSf8wOeh538KHwxbA9r7cuvEUU92eXRksOZaylbea3fJxZWhOITVw==", - "dependencies": { - "defu": "^6.1.2", - "hookable": "^5.5.3", - "pathe": "^1.1.1", - "pkg-types": "^1.0.3", - "postcss-import-resolver": "^2.0.0", - "std-env": "^3.3.3", - "ufo": "^1.1.2", - "unimport": "^3.0.14", - "untyped": "^1.3.2" - }, - "engines": { - "node": "^14.18.0 || >=16.10.0" - } - }, - "node_modules/@nuxtjs/critters/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@nuxtjs/critters/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@nuxtjs/critters/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/@nuxtjs/eslint-config": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/@nuxtjs/eslint-config/-/eslint-config-12.0.0.tgz", @@ -8152,7 +8065,8 @@ "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true }, "node_modules/cosmiconfig": { "version": "8.3.6", @@ -8228,113 +8142,6 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, - "node_modules/critters": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/critters/-/critters-0.0.20.tgz", - "integrity": "sha512-CImNRorKOl5d8TWcnAz5n5izQ6HFsvz29k327/ELy6UFcmbiZNOsinaKvzv16WZR0P6etfSWYzE47C4/56B3Uw==", - "dependencies": { - "chalk": "^4.1.0", - "css-select": "^5.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.2", - "htmlparser2": "^8.0.2", - "postcss": "^8.4.23", - "pretty-bytes": "^5.3.0" - } - }, - "node_modules/critters/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/critters/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/critters/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/critters/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/critters/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/critters/node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" - } - }, - "node_modules/critters/node_modules/pretty-bytes": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", - "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/critters/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/cross-fetch": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", @@ -9404,6 +9211,7 @@ "version": "0.1.8", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "dev": true, "dependencies": { "prr": "~1.0.1" }, @@ -12007,7 +11815,8 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true }, "node_modules/graphemer": { "version": "1.4.0", @@ -12507,7 +12316,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "devOptional": true }, "node_modules/ini": { "version": "1.3.8", @@ -13100,7 +12910,8 @@ "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true }, "node_modules/isexe": { "version": "2.0.0", @@ -14541,6 +14352,7 @@ "version": "0.5.0", "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", + "dev": true, "dependencies": { "errno": "^0.1.3", "readable-stream": "^2.0.1" @@ -14553,6 +14365,7 @@ "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -14566,12 +14379,14 @@ "node_modules/memory-fs/node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "node_modules/memory-fs/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, "dependencies": { "safe-buffer": "~5.1.0" } @@ -17270,6 +17085,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/postcss-import-resolver/-/postcss-import-resolver-2.0.0.tgz", "integrity": "sha512-y001XYgGvVwgxyxw9J1a5kqM/vtmIQGzx34g0A0Oy44MFcy/ZboZw1hu/iN3VYFjSTRzbvd7zZJJz0Kh0AGkTw==", + "dev": true, "dependencies": { "enhanced-resolve": "^4.1.1" } @@ -17278,6 +17094,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz", "integrity": "sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==", + "dev": true, "dependencies": { "graceful-fs": "^4.1.2", "memory-fs": "^0.5.0", @@ -17291,6 +17108,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", + "dev": true, "engines": { "node": ">=6" } @@ -18291,7 +18109,8 @@ "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "node_modules/promise": { "version": "7.3.1", @@ -18344,7 +18163,8 @@ "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==" + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "dev": true }, "node_modules/psl": { "version": "1.9.0", @@ -22097,7 +21917,8 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "devOptional": true }, "node_modules/validate-npm-package-license": { "version": "3.0.4", diff --git a/package.json b/package.json index 213611979a..8a6a60e144 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ ], "dependencies": { "@nuxt/image": "1.0.0", - "@nuxtjs/critters": "0.5.1", "@nuxtjs/fontaine": "0.4.1", "browserslist-useragent-regexp": "4.1.0", "cheerio": "1.0.0-rc.12", diff --git a/src/hookFunctions/nitro/init.mjs b/src/hookFunctions/nitro/init.mjs index 8d83bffc73..65dbe92333 100644 --- a/src/hookFunctions/nitro/init.mjs +++ b/src/hookFunctions/nitro/init.mjs @@ -5,13 +5,10 @@ import { load } from 'cheerio'; import { render } from 'dom-serializer'; import { isWebpackBuild, logger } from '../../utils.mjs'; -export default (nuxt, options = {}) => +export default (nuxt, options = { manifest: [] }) => nitro => { nitro.hooks.hook('prerender:generate', async route => { - const { manifest, disableNuxtCritters } = { - disableNuxtCritters: true, - ...options - }; + const { manifest } = options; if (!route.fileName?.endsWith('.html') || !route.contents) { return; @@ -43,7 +40,7 @@ export default (nuxt, options = {}) => $('[rel="prefetch"][as="style"]').remove(); // embed css files - await prepareLinkStylesheets($, { disableNuxtCritters, distNuxt, route }); + await prepareLinkStylesheets($, { distNuxt, route }); route.contents = render(document); }); @@ -75,10 +72,7 @@ function isDataURI(value) { return value.startsWith('data:'); } -async function prepareLinkStylesheets( - $, - { disableNuxtCritters, distNuxt, route } -) { +async function prepareLinkStylesheets($, { distNuxt, route }) { try { const css = await Promise.all( Array.from($('link[rel="stylesheet"]')) @@ -93,32 +87,18 @@ async function prepareLinkStylesheets( let urls = getUrlValues(fileContent); urls = prepareUrls(urls, dir); - if (disableNuxtCritters) { - const css = urls.reduce( - (result, [a, b]) => result.replace(a, b), - fileContent - ); - - $el.remove(); - logger.info( - `Embed CSS File \`${basename($el.attr('href'))}\`; Route: \`${ - route.route - }\`` - ); - return css; - } else { - const matches = fileContent.match( - /\/\*! speedkit-font-faces start \*\/(.*)\/\*! speedkit-font-faces end \*\// - ); - if (matches) { - logger.info( - `Embed Font-Faces CSS \`${basename( - $el.attr('href') - )}\`; Route: \`${route.route}\`` - ); - return matches[1].replace(/url\(.\//g, `url(${dir}/`); - } - } + const css = urls.reduce( + (result, [a, b]) => result.replace(a, b), + fileContent + ); + + $el.remove(); + logger.info( + `Embed CSS File \`${basename($el.attr('href'))}\`; Route: \`${ + route.route + }\`` + ); + return css; }) ); if (css.length) { diff --git a/src/module.mjs b/src/module.mjs index dc54498456..a793a86bc3 100644 --- a/src/module.mjs +++ b/src/module.mjs @@ -11,7 +11,6 @@ import FontConfig from './runtime/classes/FontConfig.mjs'; import { DEFAULT_TARGET_FORMATS, MODULE_NAME, - addNuxtCritters, addNuxtFontaine, addNuxtImage, isWebpackBuild, @@ -140,9 +139,6 @@ async function addBuildTemplates(nuxt, options) { } async function addModules(nuxt, moduleOptions) { - if (!moduleOptions.disableNuxtCritters) { - await addNuxtCritters(nuxt); - } if (!moduleOptions.disableNuxtFontaine) { await addNuxtFontaine(nuxt); } diff --git a/src/utils.mjs b/src/utils.mjs index e41711995e..f7a53eae38 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -36,25 +36,6 @@ function moduleExists(nuxt, moduleName) { ); } -export async function addNuxtCritters(nuxt) { - if (!moduleExists(nuxt, '@nuxtjs/critters')) { - logger.info( - `Added module \`@nuxtjs/critters\`, for more configuration learn more at \`https://github.com/nuxt-modules/critters\`` - ); - nuxt.options.critters = defu( - { - config: { - preload: false, - fonts: false - } - }, - nuxt.options.critters - ); - - await installModule('@nuxtjs/critters'); - } -} - export async function addNuxtFontaine(nuxt) { if (!moduleExists(nuxt, '@nuxtjs/fontaine')) { logger.info( diff --git a/src/utils/options.mjs b/src/utils/options.mjs index fd3c646468..f0db98045e 100644 --- a/src/utils/options.mjs +++ b/src/utils/options.mjs @@ -6,7 +6,6 @@ export function getDefaultOptions() { crossorigin: undefined, - disableNuxtCritters: true, // If set, `@nuxtjs/critters` will not be integrated. disableNuxtFontaine: false, // If set, `@nuxtjs/fontaine` will not be integrated. disableNuxtImage: false, // If set, `@nuxt/image` will not be integrated. diff --git a/src/utils/preload.mjs b/src/utils/preload.mjs index 545b66ced1..bcc57ecb86 100644 --- a/src/utils/preload.mjs +++ b/src/utils/preload.mjs @@ -2,22 +2,17 @@ import initHook from '../hookFunctions/nitro/init.mjs'; import { isViteBuild, isWebpackBuild, logger } from '../utils.mjs'; export function optimizePreloads(moduleOptions, nuxt) { - const disableNuxtCritters = moduleOptions.disableNuxtCritters; nuxt.options.experimental.inlineSSRStyles = false; if (isViteBuild(nuxt)) { nuxt.options.vite.build.manifest = false; - if (disableNuxtCritters) { - nuxt.options.vite.build.cssCodeSplit = false; - } + nuxt.options.vite.build.cssCodeSplit = false; } else if (isWebpackBuild(nuxt)) { nuxt.options.webpack.extractCSS = true; logger.info(`Use workaround for \`SSR Styles\` in \`Webpack\`.`); } const hookOptions = { - disableNuxtCritters: - typeof disableNuxtCritters !== 'undefined' ? disableNuxtCritters : true, manifest: null }; nuxt.hook('build:manifest', manifest => (hookOptions.manifest = manifest)); From 70661567953accb9c71c5eaa11ed45690c7ffff6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 04:23:15 +0000 Subject: [PATCH 07/16] chore(deps): update devdependency prettier to v3.1.0 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 793ba9247c..76d322a15b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "postcss-html": "1.5.0", "postcss-nesting": "12.0.1", "postcss-preset-env": "9.3.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "read-pkg": "9.0.0", "serve-static": "1.15.0", "stylelint-config-recess-order": "4.3.0", @@ -18206,9 +18206,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 3277cf0ae2..e408931d2b 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "postcss-html": "1.5.0", "postcss-nesting": "12.0.1", "postcss-preset-env": "9.3.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "read-pkg": "9.0.0", "serve-static": "1.15.0", "stylelint-config-recess-order": "4.3.0", From 6a927d8c33ae350531961f56cb40d936ae5694cd Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Mon, 13 Nov 2023 21:17:56 +0100 Subject: [PATCH 08/16] docs(speedkit-image): update densities option --- docs/src/components/speedkit-image.md | 4 ++-- playground/nuxt.config.mjs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/src/components/speedkit-image.md b/docs/src/components/speedkit-image.md index 041b15574e..fda14ea5b2 100644 --- a/docs/src/components/speedkit-image.md +++ b/docs/src/components/speedkit-image.md @@ -177,8 +177,8 @@ Learn more about `provider`: #### `densities` -- Type: `String`, `Number` - - Default: `x1 x2` +- Type: `String` + - Default: 'x1 x2' If a `densities` is set on a source, the globally defined one is ignored. diff --git a/playground/nuxt.config.mjs b/playground/nuxt.config.mjs index 2b811fc795..4cf5b5dcf9 100644 --- a/playground/nuxt.config.mjs +++ b/playground/nuxt.config.mjs @@ -117,7 +117,8 @@ export default defineNuxtConfig(async () => { }, speedkit: { - // targetFormats: ['jpg|jpeg|png|gif'], + targetFormats: ['jpg|jpeg|png|gif'], + // densities: 'x1 x2', detection: { performance: true, browserSupport: true From 8e50019845e53f5e821052746f85daddd6736ac3 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Mon, 13 Nov 2023 21:39:27 +0100 Subject: [PATCH 09/16] chore(lint): fix lint errors --- .github/workflows/sonar-cloud.yml | 2 +- playground/layouts/default.vue | 4 ++-- playground/pages/index.vue | 20 +++++++++---------- .../pages/tests/speedkit-layer/index.vue | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sonar-cloud.yml b/.github/workflows/sonar-cloud.yml index 298cc898e6..8bc9527ddb 100644 --- a/.github/workflows/sonar-cloud.yml +++ b/.github/workflows/sonar-cloud.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [16] + node: [19] steps: - uses: actions/setup-node@v4 diff --git a/playground/layouts/default.vue b/playground/layouts/default.vue index a75e8ee568..a61608a1be 100644 --- a/playground/layouts/default.vue +++ b/playground/layouts/default.vue @@ -16,8 +16,8 @@ import { useRoute, useHead } from '#app'; import speedkitHydrate from '#speedkit/hydrate'; const InfoLayer = defineAsyncComponent(() => import('@/components/InfoLayer')); -const GithubCorner = speedkitHydrate(() => - import('@/components/elements/GithubCorner') +const GithubCorner = speedkitHydrate( + () => import('@/components/elements/GithubCorner') ); const PageHeader = speedkitHydrate(() => import('@/components/PageHeader')); diff --git a/playground/pages/index.vue b/playground/pages/index.vue index 0c41a66a35..edfa80aa84 100644 --- a/playground/pages/index.vue +++ b/playground/pages/index.vue @@ -16,20 +16,20 @@ import speedkitHydrate from '#speedkit/hydrate'; const ModuleStage = speedkitHydrate(() => import('@/components/modules/Stage')); -const ModuleTextA = speedkitHydrate(() => - import('@/components/modules/TextFontA') +const ModuleTextA = speedkitHydrate( + () => import('@/components/modules/TextFontA') ); -const ModuleImageText = speedkitHydrate(() => - import('@/components/modules/ImageText') +const ModuleImageText = speedkitHydrate( + () => import('@/components/modules/ImageText') ); -const ModuleTextB = speedkitHydrate(() => - import('@/components/modules/TextFontB') +const ModuleTextB = speedkitHydrate( + () => import('@/components/modules/TextFontB') ); -const ModuleVideoYoutube = speedkitHydrate(() => - import('@/components/modules/VideoYoutube') +const ModuleVideoYoutube = speedkitHydrate( + () => import('@/components/modules/VideoYoutube') ); -const ModuleVideoVimeo = speedkitHydrate(() => - import('@/components/modules/VideoVimeo') +const ModuleVideoVimeo = speedkitHydrate( + () => import('@/components/modules/VideoVimeo') ); const stage = { diff --git a/playground/pages/tests/speedkit-layer/index.vue b/playground/pages/tests/speedkit-layer/index.vue index 33d698ec7d..d9c17e1a55 100644 --- a/playground/pages/tests/speedkit-layer/index.vue +++ b/playground/pages/tests/speedkit-layer/index.vue @@ -15,8 +15,8 @@ const ready = ref(false); onMounted(() => (ready.value = true)); -const ComponentImageText = speedkitHydrate(() => - import('@/components/modules/ImageText') +const ComponentImageText = speedkitHydrate( + () => import('@/components/modules/ImageText') ); const imageTextA = { From 2d2623296faa9c2ee6fe01d9d8d0c2167ca5147e Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Mon, 13 Nov 2023 21:41:52 +0100 Subject: [PATCH 10/16] chore(playground): comment targetFormats --- playground/nuxt.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/nuxt.config.mjs b/playground/nuxt.config.mjs index 4cf5b5dcf9..80867e4386 100644 --- a/playground/nuxt.config.mjs +++ b/playground/nuxt.config.mjs @@ -117,7 +117,7 @@ export default defineNuxtConfig(async () => { }, speedkit: { - targetFormats: ['jpg|jpeg|png|gif'], + // targetFormats: ['jpg|jpeg|png|gif'], // densities: 'x1 x2', detection: { performance: true, From 6f8cef21abc36bc7d7256da3a7616c83303282e2 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 13 Nov 2023 20:50:44 +0000 Subject: [PATCH 11/16] chore(release): 3.0.0-next.35 [skip ci] # [3.0.0-next.35](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.34...v3.0.0-next.35) (2023-11-13) ### Bug Fixes * **source:** `@nuxt/image` `densities` definition ([8adfa89](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/8adfa8932fc1aedd6d54858b46ef1c794e404610)) * **source:** added `densities` option ([c8a5c55](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/c8a5c55b8f04d4d61d73af3da4548a7cf863a6b7)) --- CHANGELOG.md | 8 ++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4cc276e6e..32d591c78f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Project Changelog +# [3.0.0-next.35](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.34...v3.0.0-next.35) (2023-11-13) + + +### Bug Fixes + +* **source:** `@nuxt/image` `densities` definition ([8adfa89](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/8adfa8932fc1aedd6d54858b46ef1c794e404610)) +* **source:** added `densities` option ([c8a5c55](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/c8a5c55b8f04d4d61d73af3da4548a7cf863a6b7)) + # [3.0.0-next.34](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.33...v3.0.0-next.34) (2023-11-12) diff --git a/package-lock.json b/package-lock.json index 793ba9247c..db00485255 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nuxt-speedkit", - "version": "3.0.0-next.34", + "version": "3.0.0-next.35", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nuxt-speedkit", - "version": "3.0.0-next.34", + "version": "3.0.0-next.35", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 3277cf0ae2..e66f0758ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-speedkit", - "version": "3.0.0-next.34", + "version": "3.0.0-next.35", "description": "Nuxt Speedkit takes over the Lighthouse performance optimization of your generated website.", "license": "MIT", "contributors": [ From 41b1108289f79da6a96024aa6175d0d93a5018c9 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Wed, 15 Nov 2023 19:40:35 +0100 Subject: [PATCH 12/16] fix(module): added deprecation notifications --- src/module.mjs | 7 ++++++- src/utils/options.mjs | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/module.mjs b/src/module.mjs index a793a86bc3..692c74fdb2 100644 --- a/src/module.mjs +++ b/src/module.mjs @@ -17,7 +17,10 @@ import { logger, setPublicRuntimeConfig } from './utils.mjs'; -import { getDefaultOptions } from './utils/options.mjs'; +import { + deprecationsNotification, + getDefaultOptions +} from './utils/options.mjs'; import { getFontConfigTemplate } from './utils/template.mjs'; import { optimizePreloads } from './utils/preload.mjs'; import { getSupportedBrowserDetector } from './utils/browser.mjs'; @@ -41,6 +44,8 @@ export default defineNuxtModule({ nuxt.options.alias['#speedkit'] = runtimeDir; nuxt.options.build.transpile.push(runtimeDir); + deprecationsNotification(moduleOptions); + await addModules(nuxt, moduleOptions); setPublicRuntimeConfig(nuxt, moduleOptions); diff --git a/src/utils/options.mjs b/src/utils/options.mjs index f0db98045e..6a33d3b11d 100644 --- a/src/utils/options.mjs +++ b/src/utils/options.mjs @@ -40,7 +40,13 @@ export function getDefaultOptions() { export function deprecationsNotification(options) { if ('loader' in options) { logger.warn( - `Option \`loader\` is deprecated, There is no integrated loader anymore.` + 'Option `loader` is deprecated, there is no integrated loader anymore.' + ); + delete options.loader; + } + if ('disableNuxtCritters' in options) { + logger.warn( + 'Option `disableNuxtCritters` is deprecated, there is no integrated critters anymore.' ); delete options.loader; } From 61e5ed0c925776fd8ff22bd8c58a58f443d522ce Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Wed, 15 Nov 2023 19:50:02 +0100 Subject: [PATCH 13/16] ci(docs): added docs to next --- .github/workflows/next.yml | 84 ++++++++++++++++++++++++++++++++++++++ docs/src/public/CNAME | 1 - 2 files changed, 84 insertions(+), 1 deletion(-) delete mode 100644 docs/src/public/CNAME diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index d9ee926c7f..013da51bcb 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -76,3 +76,87 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | npx -p pinst -p @nuxt/module-builder -p semantic-release -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/github semantic-release --provider=github --debug=true + + + install-docs: + needs: semantic-version + if: "!contains(github.event.head_commit.message, 'skip ci')" + name: Install (Docs) + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [19] + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Checkout Repo + uses: actions/checkout@v4 + - name: cache node_modules (Docs) + uses: actions/cache@v3 + id: cache + with: + path: docs/node_modules + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/docs/package-lock.json')) }} + - name: Install Dependencies (Docs) + if: steps.cache.outputs.cache-hit != 'true' + run: cd docs && npm ci + + build-docs: + name: Build (Docs) + needs: install-docs + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [19] + + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Checkout Repo + uses: actions/checkout@v4 + - name: cache docs/node_modules + uses: actions/cache@v3 + id: cache + with: + path: docs/node_modules + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/docs/package-lock.json')) }} + - name: Build + run: | + npm run docs:build + touch docs/.vitepress/dist/.nojekyll + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Archive Production Artifact + uses: actions/upload-artifact@master + with: + name: docsArtifact + path: docs/.vitepress/dist + + deploy-ghpages: + name: Deploy (GH-Pages) + needs: [build-docs] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + node: [19] + steps: + - name: Download Artifact (Docs) + uses: actions/download-artifact@master + with: + name: docsArtifact + path: public/docs + - name: Deploy to GH-Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: public + cname: nuxt-speedkit.grabarzundpartner.dev + keep_files: true diff --git a/docs/src/public/CNAME b/docs/src/public/CNAME deleted file mode 100644 index 2a58383f47..0000000000 --- a/docs/src/public/CNAME +++ /dev/null @@ -1 +0,0 @@ -nuxt-speedkit.grabarzundpartner.dev From b191e85ff2da63f4686e38777a2d3069ace8d9b4 Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Wed, 15 Nov 2023 19:51:59 +0100 Subject: [PATCH 14/16] ci(docs): remove install-docs --- .github/workflows/next.yml | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 013da51bcb..af2a5b5c69 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -77,37 +77,9 @@ jobs: run: | npx -p pinst -p @nuxt/module-builder -p semantic-release -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/github semantic-release --provider=github --debug=true - - install-docs: - needs: semantic-version - if: "!contains(github.event.head_commit.message, 'skip ci')" - name: Install (Docs) - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [19] - - steps: - - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - - name: Checkout Repo - uses: actions/checkout@v4 - - name: cache node_modules (Docs) - uses: actions/cache@v3 - id: cache - with: - path: docs/node_modules - key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/docs/package-lock.json')) }} - - name: Install Dependencies (Docs) - if: steps.cache.outputs.cache-hit != 'true' - run: cd docs && npm ci - build-docs: name: Build (Docs) - needs: install-docs + needs: semantic-version runs-on: ${{ matrix.os }} strategy: From e4ea0dcd524d7c4478a068acd7afede2fe10f04e Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Wed, 15 Nov 2023 20:06:59 +0100 Subject: [PATCH 15/16] ci(docs): fix cache key --- .github/workflows/next.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index af2a5b5c69..14e682e0d0 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -27,8 +27,6 @@ jobs: with: path: | node_modules - ~/.cache/ms-playwright/ - ~\AppData\Local\ms-playwright\ key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} - name: Install Dependencies @@ -97,8 +95,9 @@ jobs: uses: actions/cache@v3 id: cache with: - path: docs/node_modules - key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/docs/package-lock.json')) }} + path: | + node_modules + key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} - name: Build run: | npm run docs:build From f338a7b8c7980aded0fff2c265e27e7cb92d18f8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 15 Nov 2023 19:25:53 +0000 Subject: [PATCH 16/16] chore(release): 3.0.0-next.36 [skip ci] # [3.0.0-next.36](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.35...v3.0.0-next.36) (2023-11-15) ### Bug Fixes * **module:** added deprecation notifications ([41b1108](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/41b1108289f79da6a96024aa6175d0d93a5018c9)) * **module:** removed `@nuxt/critters` ([be9f3e6](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/be9f3e683d71e61c98b573b2fd095c0fcb342e18)) * **webpack:** added workaround for ssr styles ([663318d](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/663318d34ad9b9ec64251b9a8ac9a81fb5e57a8a)) --- CHANGELOG.md | 9 +++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d591c78f..23eefaa71a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Project Changelog +# [3.0.0-next.36](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.35...v3.0.0-next.36) (2023-11-15) + + +### Bug Fixes + +* **module:** added deprecation notifications ([41b1108](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/41b1108289f79da6a96024aa6175d0d93a5018c9)) +* **module:** removed `@nuxt/critters` ([be9f3e6](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/be9f3e683d71e61c98b573b2fd095c0fcb342e18)) +* **webpack:** added workaround for ssr styles ([663318d](https://github.com/GrabarzUndPartner/nuxt-speedkit/commit/663318d34ad9b9ec64251b9a8ac9a81fb5e57a8a)) + # [3.0.0-next.35](https://github.com/GrabarzUndPartner/nuxt-speedkit/compare/v3.0.0-next.34...v3.0.0-next.35) (2023-11-13) diff --git a/package-lock.json b/package-lock.json index c8466282c2..560f26a8e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nuxt-speedkit", - "version": "3.0.0-next.35", + "version": "3.0.0-next.36", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nuxt-speedkit", - "version": "3.0.0-next.35", + "version": "3.0.0-next.36", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index b648b42d0b..887a4c03c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-speedkit", - "version": "3.0.0-next.35", + "version": "3.0.0-next.36", "description": "Nuxt Speedkit takes over the Lighthouse performance optimization of your generated website.", "license": "MIT", "contributors": [