├── .baserc.json ├── .commitlintrc.json ├── .cz.json ├── .devcontainer └── devcontainer.json ├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .github ├── DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md ├── FUNDING.yml ├── labels.yml └── workflows │ ├── build.yml │ ├── deprecated-dependencies.yml │ ├── sync-labels.yml │ └── sync-metadata.yml ├── .gitignore ├── .gitpod.Dockerfile ├── .gitpod.yml ├── .husky └── commit-msg ├── .releaserc.json ├── .renovaterc.json ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── babel.config.json ├── package.json ├── src ├── index.js ├── index.spec.js ├── plugin.js └── plugin.js.template └── yarn.lock /.baserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@dword-design/nuxt-module", 3 | "seeAlso": [ 4 | { "repository": "nuxt-mail", "description": "Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails." }, 5 | { "repository": "nuxt-route-meta", "description": "Adds Nuxt page data to route meta at build time." }, 6 | { "repository": "nuxt-mermaid-string", "description": "Embed a Mermaid diagram in a Nuxt.js app by providing its diagram string." }, 7 | { "repository": "nuxt-content-git", "description": "Additional module for @nuxt/content that replaces or adds createdAt and updatedAt dates based on the git history." }, 8 | { "repository": "nuxt-babel-runtime", "description": "Nuxt CLI that supports babel. Inspired by @nuxt/typescript-runtime." } 9 | ] 10 | } -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@commitlint/config-conventional" 4 | ], 5 | "rules": { 6 | "body-max-line-length": [ 7 | 0 8 | ], 9 | "footer-max-line-length": [ 10 | 0 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.cz.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "cz-conventional-changelog" 3 | } 4 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "features": { 3 | "ghcr.io/devcontainers/features/docker-in-docker:2": {} 4 | }, 5 | "image": "mcr.microsoft.com/devcontainers/javascript-node:1-20", 6 | "updateContentCommand": "yarn --frozen-lockfile" 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@dword-design/eslint-config" 3 | } 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.glb filter=lfs diff=lfs merge=lfs -text 3 | *.jpg filter=lfs diff=lfs merge=lfs -text 4 | *.png filter=lfs diff=lfs merge=lfs -text 5 | *.vsix filter=lfs diff=lfs merge=lfs -text 6 | -------------------------------------------------------------------------------- /.github/DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Deprecated dependencies 3 | labels: maintenance 4 | --- 5 | The following dependencies are deprecated: 6 | 7 | {% for dependency in env.DEPRECATED.split(',') %} 8 | - **{{ dependency }}** 9 | {% endfor %} 10 | 11 | Check out the [build]({{ env.RUN_URL }}) for details. 12 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | - buymeacoffee.com/dword 3 | - paypal.me/SebastianLandwehr 4 | github: dword-design 5 | patreon: dworddesign 6 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | - color: C2E0C6 2 | name: active 3 | - color: C2E0C6 4 | name: blocked 5 | - color: BFD4F2 6 | name: blocking 7 | - color: BFD4F2 8 | name: breaking 9 | - color: BFD4F2 10 | name: important 11 | - color: C2E0C6 12 | name: maintenance 13 | - color: EDEDED 14 | name: released 15 | - color: EDEDED 16 | name: semantic-release 17 | - color: C2E0C6 18 | name: waiting-for 19 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | cancel-existing: 3 | if: "!contains(github.event.head_commit.message, '[skip ci]')" 4 | runs-on: ubuntu-latest 5 | steps: 6 | - env: 7 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 8 | uses: rokroskar/workflow-run-cleanup-action@v0.3.3 9 | release: 10 | needs: test 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | with: 15 | lfs: true 16 | ref: ${{ github.event.pull_request.head.repo.full_name == github.repository && 17 | github.event.pull_request.head.ref || '' }} 18 | - uses: actions/setup-node@v4 19 | with: 20 | node-version: 20 21 | - run: git config --global user.email "actions@github.com" 22 | - run: git config --global user.name "GitHub Actions" 23 | - run: yarn --frozen-lockfile 24 | - run: yarn checkUnknownFiles 25 | - run: yarn lint 26 | - env: 27 | GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | name: Push changed files 30 | run: yarn dw-ci push-changed-files 31 | - env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 34 | if: github.ref == 'refs/heads/master' 35 | name: Release 36 | run: yarn semantic-release 37 | test: 38 | needs: cancel-existing 39 | runs-on: ${{ matrix.os }} 40 | steps: 41 | - uses: actions/checkout@v4 42 | with: 43 | fetch-depth: 0 44 | lfs: true 45 | - uses: actions/setup-node@v4 46 | with: 47 | node-version: ${{ matrix.node }} 48 | - run: yarn --frozen-lockfile 49 | - env: 50 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | run: yarn test 52 | - if: failure() 53 | uses: actions/upload-artifact@v3 54 | with: 55 | name: Image Snapshot Diffs 56 | path: "**/__image_snapshots__/__diff_output__" 57 | - if: matrix.os == 'ubuntu-latest' && matrix.node == 20 58 | uses: codecov/codecov-action@v3 59 | with: 60 | token: ${{ secrets.CODECOV_TOKEN }} 61 | strategy: 62 | matrix: 63 | include: 64 | - node: 18 65 | os: ubuntu-latest 66 | - node: 20 67 | os: ubuntu-latest 68 | - node: 20 69 | os: macos-latest 70 | - node: 20 71 | os: windows-latest 72 | name: build 73 | on: 74 | pull_request: {} 75 | push: 76 | branches: 77 | - master 78 | -------------------------------------------------------------------------------- /.github/workflows/deprecated-dependencies.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | run: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | with: 7 | lfs: true 8 | - continue-on-error: true 9 | id: check-deprecated-js-deps 10 | uses: tinovyatkin/action-check-deprecated-js-deps@v1 11 | - env: 12 | DEPRECATED: ${{ steps.check-deprecated-js-deps.outputs.deprecated }} 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | RUN_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} 15 | id: create-deprecation-issue 16 | if: ${{ steps.check-deprecated-js-deps.outputs.deprecated }} 17 | uses: JasonEtco/create-an-issue@v2 18 | with: 19 | filename: .github/DEPRECATED_DEPENDENCIES_ISSUE_TEMPLATE.md 20 | update_existing: true 21 | - if: ${{ !steps.check-deprecated-js-deps.outputs.deprecated && 22 | steps.create-deprecation-issue.outputs.number }} 23 | uses: peter-evans/close-issue@v3 24 | with: 25 | comment: Auto-closing the issue 26 | issue-number: ${{ steps.create-deprecation-issue.outputs.number }} 27 | - uses: gautamkrishnar/keepalive-workflow@v1 28 | name: deprecated-dependencies 29 | on: 30 | schedule: 31 | - cron: 0 5 * * MON 32 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | build: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | - env: 7 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 8 | uses: micnncim/action-label-syncer@v1 9 | name: sync-labels 10 | on: 11 | push: 12 | branches: 13 | - master 14 | paths: 15 | - .github/labels.yml 16 | - .github/workflows/sync-labels.yml 17 | -------------------------------------------------------------------------------- /.github/workflows/sync-metadata.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | build: 3 | runs-on: ubuntu-latest 4 | steps: 5 | - uses: actions/checkout@v4 6 | - uses: jaid/action-sync-node-meta@v2.0.0 7 | with: 8 | approve: false 9 | commitMessage: "fix: write GitHub metadata to package.json [{changes}]" 10 | githubToken: ${{ secrets.GITHUB_TOKEN }} 11 | - uses: gautamkrishnar/keepalive-workflow@v1 12 | name: sync-metadata 13 | on: 14 | schedule: 15 | - cron: 0 5 * * * 16 | workflow_dispatch: {} 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.env.json 3 | /.nyc_output 4 | /.test.env.json 5 | /coverage 6 | /dist 7 | /node_modules 8 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | # Need to add :latest, otherwise old versions (e.g. of node) are installed 2 | FROM gitpod/workspace-full-vnc:latest 3 | 4 | RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash 5 | RUN sudo apt-get install git-lfs 6 | RUN git lfs install 7 | 8 | # https://www.gitpod.io/docs/languages/javascript 9 | # https://github.com/gitpod-io/gitpod/issues/945 10 | RUN bash -c 'source $HOME/.nvm/nvm.sh && nvm install 20' 11 | RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix 12 | 13 | RUN echo "\nexport PATH=$(yarn global bin):\$PATH" >> /home/gitpod/.bashrc 14 | 15 | RUN yarn global add gitpod-env-per-project @babel/node @babel/core 16 | 17 | RUN sudo apt-get install -y graphviz 18 | 19 | RUN brew install gh 20 | 21 | # Puppeteer dependencies 22 | RUN sudo apt-get update && sudo apt-get install -y libgtk-3-0 libx11-xcb1 libnss3 libxss1 libasound2 libgbm1 libxshmfence1 23 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | tasks: 4 | - before: >- 5 | echo "export 6 | PUPPETEER_CACHE_DIR=/workspace/nuxt-modernizr/node_modules/.cache/puppeteer" 7 | >> /home/gitpod/.bashrc 8 | 9 | echo "export PLAYWRIGHT_BROWSERS_PATH=0" >> /home/gitpod/.bashrc 10 | 11 | gitpod-env-per-project >> /home/gitpod/.bashrc && source 12 | /home/gitpod/.bashrc 13 | init: |- 14 | git config --global user.name "Sebastian Landwehr" 15 | git config diff.lfs.textconv cat 16 | git lfs pull 17 | yarn --frozen-lockfile 18 | vscode: 19 | extensions: 20 | - https://sebastianlandwehr.com/vscode-extensions/karlito40.fix-irregular-whitespace-0.1.1.vsix 21 | - https://sebastianlandwehr.com/vscode-extensions/adrianwilczynski.toggle-hidden-1.0.2.vsix 22 | - octref.vetur@0.33.1 23 | - Tobermory.es6-string-html 24 | - zjcompt.es6-string-javascript 25 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "@semantic-release/commit-analyzer", 4 | "@semantic-release/release-notes-generator", 5 | "@semantic-release/changelog", 6 | "@semantic-release/npm", 7 | "@semantic-release/github", 8 | [ 9 | "@semantic-release/git", 10 | { 11 | "message": "chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" 12 | } 13 | ] 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.renovaterc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | ":semanticCommits", 4 | ":semanticPrefixFix" 5 | ], 6 | "gitIgnoredAuthors": [ 7 | "actions@github.com" 8 | ], 9 | "github-actions": { 10 | "enabled": false 11 | }, 12 | "labels": [ 13 | "maintenance" 14 | ], 15 | "lockFileMaintenance": { 16 | "automerge": true, 17 | "enabled": true, 18 | "semanticCommitType": "chore" 19 | }, 20 | "rangeStrategy": "replace", 21 | "regexManagers": [ 22 | { 23 | "datasourceTemplate": "github-tags", 24 | "fileMatch": [ 25 | "\\.js$" 26 | ], 27 | "matchStrings": [ 28 | "(^|\\s)gitHubAction`(?.*?)@v(?.*?)`" 29 | ], 30 | "versioningTemplate": "npm" 31 | } 32 | ], 33 | "semanticCommitScope": null 34 | } 35 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.tabSize": 2, 3 | "files.autoSave": "off", 4 | "files.exclude": { 5 | ".commitlintrc.json": true, 6 | ".cz.json": true, 7 | ".devcontainer": true, 8 | ".editorconfig": true, 9 | ".eslintrc.json": true, 10 | ".gitattributes": true, 11 | ".github": true, 12 | ".gitignore": true, 13 | ".gitpod.Dockerfile": true, 14 | ".gitpod.yml": true, 15 | ".husky": true, 16 | ".nyc_output": true, 17 | ".releaserc.json": true, 18 | ".renovaterc.json": true, 19 | ".vscode": true, 20 | "CHANGELOG.md": true, 21 | "LICENSE.md": true, 22 | "babel.config.json": true, 23 | "coverage": true, 24 | "dist": true, 25 | "node_modules": true, 26 | "yarn.lock": true 27 | }, 28 | "workbench.editor.enablePreview": false 29 | } 30 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [4.0.1](https://github.com/dword-design/nuxt-modernizr/compare/v4.0.0...v4.0.1) (2024-04-09) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * lock file maintenance ([#134](https://github.com/dword-design/nuxt-modernizr/issues/134)) ([2178e17](https://github.com/dword-design/nuxt-modernizr/commit/2178e1778742848a523e27c881a5732bfa8c33c7)) 7 | 8 | # [4.0.0](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.25...v4.0.0) (2024-02-13) 9 | 10 | 11 | ### Bug Fixes 12 | 13 | * lock file maintenance ([#129](https://github.com/dword-design/nuxt-modernizr/issues/129)) ([a0ad536](https://github.com/dword-design/nuxt-modernizr/commit/a0ad536b1de6ff3425772524b9604ca940928306)) 14 | 15 | 16 | ### BREAKING CHANGES 17 | 18 | * node.js >= 18 19 | 20 | ## [3.0.25](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.24...v3.0.25) (2023-04-29) 21 | 22 | 23 | ### Bug Fixes 24 | 25 | * update dependency nuxt-push-plugins to v2.1.34 ([351dec9](https://github.com/dword-design/nuxt-modernizr/commit/351dec9b33d8c6ef232923142054310eb9430d37)) 26 | 27 | ## [3.0.24](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.23...v3.0.24) (2023-04-26) 28 | 29 | 30 | ### Bug Fixes 31 | 32 | * update dependency @dword-design/puppeteer to v6.0.9 ([b54849b](https://github.com/dword-design/nuxt-modernizr/commit/b54849b47d6e5d2d04122f4a2d2aac6367bbe024)) 33 | 34 | ## [3.0.23](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.22...v3.0.23) (2023-04-22) 35 | 36 | 37 | ### Bug Fixes 38 | 39 | * update dependency nuxt-push-plugins to v2.1.31 ([e3aebbd](https://github.com/dword-design/nuxt-modernizr/commit/e3aebbd656c1ee806b455acfd445eed8c8d8a699)) 40 | 41 | ## [3.0.22](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.21...v3.0.22) (2023-04-22) 42 | 43 | 44 | ### Bug Fixes 45 | 46 | * update dependency nuxt-push-plugins to v2.1.30 ([f8aa51f](https://github.com/dword-design/nuxt-modernizr/commit/f8aa51fb22864c802e249faacc71c7f993b9676d)) 47 | 48 | ## [3.0.21](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.20...v3.0.21) (2023-04-22) 49 | 50 | 51 | ### Bug Fixes 52 | 53 | * update dependency @dword-design/puppeteer to v6.0.8 ([e052e68](https://github.com/dword-design/nuxt-modernizr/commit/e052e689a1f813e03b22c70963356a169ba986bc)) 54 | 55 | ## [3.0.20](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.19...v3.0.20) (2023-04-20) 56 | 57 | 58 | ### Bug Fixes 59 | 60 | * update dependency nuxt-push-plugins to v2.1.29 ([5df7fc2](https://github.com/dword-design/nuxt-modernizr/commit/5df7fc242bd4475a2138013aa23daa5b57f9ffad)) 61 | 62 | ## [3.0.19](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.18...v3.0.19) (2023-04-17) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * update dependency @dword-design/puppeteer to v6.0.7 ([75c9aeb](https://github.com/dword-design/nuxt-modernizr/commit/75c9aeb3f7c1b705e1245c5a3cea2bf9f338e2f4)) 68 | 69 | ## [3.0.18](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.17...v3.0.18) (2023-04-14) 70 | 71 | 72 | ### Bug Fixes 73 | 74 | * update dependency nuxt-push-plugins to v2.1.27 ([d63c9a9](https://github.com/dword-design/nuxt-modernizr/commit/d63c9a93a4741b5f757e215e7718192c462f2963)) 75 | 76 | ## [3.0.17](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.16...v3.0.17) (2023-04-14) 77 | 78 | 79 | ### Bug Fixes 80 | 81 | * update dependency nuxt-push-plugins to v2.1.26 ([6fd9932](https://github.com/dword-design/nuxt-modernizr/commit/6fd99321d9f95d79008f066cf06b27d71d1b91d5)) 82 | 83 | ## [3.0.16](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.15...v3.0.16) (2023-04-14) 84 | 85 | 86 | ### Bug Fixes 87 | 88 | * update dependency @dword-design/puppeteer to v6.0.6 ([026b003](https://github.com/dword-design/nuxt-modernizr/commit/026b003c4a606d7d2d1d2441676df513b5e4352f)) 89 | 90 | ## [3.0.15](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.14...v3.0.15) (2023-04-13) 91 | 92 | 93 | ### Bug Fixes 94 | 95 | * update dependency nuxt-push-plugins to v2.1.25 ([aeb5602](https://github.com/dword-design/nuxt-modernizr/commit/aeb5602a23cbfdee295f6ff9dd1f5ab5e894bb25)) 96 | 97 | ## [3.0.14](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.13...v3.0.14) (2023-04-12) 98 | 99 | 100 | ### Bug Fixes 101 | 102 | * update dependency nuxt-push-plugins to v2.1.24 ([53aed44](https://github.com/dword-design/nuxt-modernizr/commit/53aed44f920daeed1f897902a72b0cca61ae6f38)) 103 | 104 | ## [3.0.13](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.12...v3.0.13) (2023-04-11) 105 | 106 | 107 | ### Bug Fixes 108 | 109 | * update dependency nuxt-push-plugins to v2.1.22 ([fd785d9](https://github.com/dword-design/nuxt-modernizr/commit/fd785d9e60cf90380f3e1c0cee9f21caed203032)) 110 | 111 | ## [3.0.12](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.11...v3.0.12) (2023-04-09) 112 | 113 | 114 | ### Bug Fixes 115 | 116 | * update dependency nuxt-push-plugins to v2.1.17 ([3e68d4a](https://github.com/dword-design/nuxt-modernizr/commit/3e68d4a1937ec62147848a9bf3408e31dd860a9a)) 117 | 118 | ## [3.0.11](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.10...v3.0.11) (2023-04-09) 119 | 120 | 121 | ### Bug Fixes 122 | 123 | * update dependency @dword-design/functions to v4.1.7 ([27ef777](https://github.com/dword-design/nuxt-modernizr/commit/27ef777e7ad8291c382de7b0a37859fac6978882)) 124 | 125 | ## [3.0.10](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.9...v3.0.10) (2023-04-08) 126 | 127 | 128 | ### Bug Fixes 129 | 130 | * update dependency nuxt-push-plugins to v2.1.14 ([e260bce](https://github.com/dword-design/nuxt-modernizr/commit/e260bce5204dd48f29f4125d12d39489011a9f86)) 131 | 132 | ## [3.0.9](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.8...v3.0.9) (2023-04-07) 133 | 134 | 135 | ### Bug Fixes 136 | 137 | * update dependency @dword-design/puppeteer to v6.0.5 ([a662569](https://github.com/dword-design/nuxt-modernizr/commit/a66256915af4af4488136a365c7c0c84b9951814)) 138 | * update dependency nuxt-push-plugins to v2.1.13 ([7c96941](https://github.com/dword-design/nuxt-modernizr/commit/7c969417c0954eb35e973615d7bc092bb7a890fe)) 139 | 140 | ## [3.0.8](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.7...v3.0.8) (2023-03-24) 141 | 142 | 143 | ### Bug Fixes 144 | 145 | * update dependency @dword-design/puppeteer to v6.0.4 ([8fdfb81](https://github.com/dword-design/nuxt-modernizr/commit/8fdfb81dcb6f15554a478ce314413d16edc7bad0)) 146 | 147 | ## [3.0.7](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.6...v3.0.7) (2023-03-21) 148 | 149 | 150 | ### Bug Fixes 151 | 152 | * update dependency nuxt-push-plugins to v2.1.11 ([6ea8840](https://github.com/dword-design/nuxt-modernizr/commit/6ea884021bb8ce5ba1e09ae15bd0ab4b9e3f12f3)) 153 | 154 | ## [3.0.6](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.5...v3.0.6) (2023-03-21) 155 | 156 | 157 | ### Bug Fixes 158 | 159 | * update dependency nuxt-push-plugins to v2.1.10 ([a15ea5b](https://github.com/dword-design/nuxt-modernizr/commit/a15ea5b24eddbd830721447b4288b766ca7b6ea1)) 160 | 161 | ## [3.0.5](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.4...v3.0.5) (2023-03-20) 162 | 163 | 164 | ### Bug Fixes 165 | 166 | * update dependency nuxt-push-plugins to v2.1.9 ([db07eef](https://github.com/dword-design/nuxt-modernizr/commit/db07eefa73d4a0f291956e5606999d2ad724dfc2)) 167 | 168 | ## [3.0.4](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.3...v3.0.4) (2023-03-19) 169 | 170 | 171 | ### Bug Fixes 172 | 173 | * update dependency @dword-design/puppeteer to v6.0.3 ([b1f6278](https://github.com/dword-design/nuxt-modernizr/commit/b1f62782956b1a121133917fe3483216d8af2da0)) 174 | 175 | ## [3.0.3](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.2...v3.0.3) (2023-03-19) 176 | 177 | 178 | ### Bug Fixes 179 | 180 | * update dependency nuxt-push-plugins to v2.1.6 ([0090ff9](https://github.com/dword-design/nuxt-modernizr/commit/0090ff9c0ae81f9c7b2e837972e36dae248df16d)) 181 | 182 | ## [3.0.2](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.1...v3.0.2) (2023-03-19) 183 | 184 | 185 | ### Bug Fixes 186 | 187 | * update dependency nuxt to v2.16.2 ([bcd6216](https://github.com/dword-design/nuxt-modernizr/commit/bcd62166878f5ba68e5f09762bf5ecdb13b855a7)) 188 | * update dependency nuxt to v2.16.3 ([a00d547](https://github.com/dword-design/nuxt-modernizr/commit/a00d547d13cc1db5c71ff5e12bfdec1bbb2e6a19)) 189 | 190 | ## [3.0.1](https://github.com/dword-design/nuxt-modernizr/compare/v3.0.0...v3.0.1) (2023-03-15) 191 | 192 | 193 | ### Bug Fixes 194 | 195 | * update dependency nuxt-push-plugins to v2.1.4 ([e6893db](https://github.com/dword-design/nuxt-modernizr/commit/e6893db19b009e19f40378cefb74d43c116577d7)) 196 | 197 | # [3.0.0](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.10...v3.0.0) (2023-01-07) 198 | 199 | 200 | ### Bug Fixes 201 | 202 | * lock file maintenance ([#84](https://github.com/dword-design/nuxt-modernizr/issues/84)) ([e1fcc1b](https://github.com/dword-design/nuxt-modernizr/commit/e1fcc1ba1cf5f7ff9dd0dd5806e2dc9236d05230)) 203 | 204 | 205 | ### BREAKING CHANGES 206 | 207 | * Drop node 12 support, move to ESM 208 | 209 | ## [2.0.10](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.9...v2.0.10) (2022-01-12) 210 | 211 | 212 | ### Bug Fixes 213 | 214 | * update config files ([0bcf93f](https://github.com/dword-design/nuxt-modernizr/commit/0bcf93f510961e236f489b3d643ecb1e8a0e1edf)) 215 | 216 | ## [2.0.9](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.8...v2.0.9) (2022-01-04) 217 | 218 | 219 | ### Bug Fixes 220 | 221 | * update config files ([0cb946c](https://github.com/dword-design/nuxt-modernizr/commit/0cb946cf4e25ddb83e946c66016f1533c29eb410)) 222 | 223 | ## [2.0.8](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.7...v2.0.8) (2021-07-20) 224 | 225 | 226 | ### Bug Fixes 227 | 228 | * update config files ([5356599](https://github.com/dword-design/nuxt-modernizr/commit/5356599d044ceaf3277c65a3dbe8d83087ca7ed5)) 229 | 230 | ## [2.0.7](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.6...v2.0.7) (2021-07-06) 231 | 232 | 233 | ### Bug Fixes 234 | 235 | * update config files ([9d56e98](https://github.com/dword-design/nuxt-modernizr/commit/9d56e98b07b7d60b1b808165a509be854520e324)) 236 | 237 | ## [2.0.6](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.5...v2.0.6) (2021-06-29) 238 | 239 | 240 | ### Bug Fixes 241 | 242 | * see also ([1c5fd78](https://github.com/dword-design/nuxt-modernizr/commit/1c5fd78b588b3e666b921af4c27c6f696cb23dd1)) 243 | 244 | ## [2.0.5](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.4...v2.0.5) (2021-06-14) 245 | 246 | 247 | ### Bug Fixes 248 | 249 | * update config files ([446ebe8](https://github.com/dword-design/nuxt-modernizr/commit/446ebe8f972c26c575dd4121d5251cf322326e4a)) 250 | 251 | ## [2.0.4](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.3...v2.0.4) (2021-05-28) 252 | 253 | 254 | ### Bug Fixes 255 | 256 | * update config files ([df2e58a](https://github.com/dword-design/nuxt-modernizr/commit/df2e58a47f157ef4bc745abb39530d6488e72178)) 257 | 258 | ## [2.0.3](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.2...v2.0.3) (2021-05-04) 259 | 260 | 261 | ### Bug Fixes 262 | 263 | * update dependency @dword-design/puppeteer to v5 ([#33](https://github.com/dword-design/nuxt-modernizr/issues/33)) ([ed08d1b](https://github.com/dword-design/nuxt-modernizr/commit/ed08d1b0a91e99f540715ba9199f9bc778e39c45)) 264 | 265 | ## [2.0.2](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.1...v2.0.2) (2021-05-04) 266 | 267 | 268 | ### Bug Fixes 269 | 270 | * update dependency @dword-design/functions to v4 ([#32](https://github.com/dword-design/nuxt-modernizr/issues/32)) ([cc7b522](https://github.com/dword-design/nuxt-modernizr/commit/cc7b5220ae14d01c9b971c016ed1b6958b54dfc3)) 271 | * update dependency nuxt-push-plugins to v2 ([#34](https://github.com/dword-design/nuxt-modernizr/issues/34)) ([97c5134](https://github.com/dword-design/nuxt-modernizr/commit/97c51348a71dbdedcede0906bcf98f4934362273)) 272 | 273 | ## [2.0.1](https://github.com/dword-design/nuxt-modernizr/compare/v2.0.0...v2.0.1) (2021-05-04) 274 | 275 | 276 | ### Bug Fixes 277 | 278 | * update dependency fs-extra to v10 ([#35](https://github.com/dword-design/nuxt-modernizr/issues/35)) ([98b84d5](https://github.com/dword-design/nuxt-modernizr/commit/98b84d54fb34a2ede2d355ce40490fdb2edbd532)) 279 | * update dependency with-local-tmp-dir to v4 ([#36](https://github.com/dword-design/nuxt-modernizr/issues/36)) ([5045d72](https://github.com/dword-design/nuxt-modernizr/commit/5045d72b9201344f4bb05e7628618344ed1bf74a)) 280 | 281 | # [2.0.0](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.16...v2.0.0) (2021-05-03) 282 | 283 | 284 | ### Bug Fixes 285 | 286 | * update dependency @dword-design/base to v8 ([#31](https://github.com/dword-design/nuxt-modernizr/issues/31)) ([7319541](https://github.com/dword-design/nuxt-modernizr/commit/7319541d0c1f5ee001b958724a259536ac98afe5)) 287 | 288 | 289 | ### BREAKING CHANGES 290 | 291 | * require Node.js >= 12 292 | 293 | Co-authored-by: Renovate Bot 294 | Co-authored-by: Sebastian Landwehr 295 | Co-authored-by: GitHub Actions 296 | 297 | ## [1.0.16](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.15...v1.0.16) (2021-04-26) 298 | 299 | 300 | ### Bug Fixes 301 | 302 | * update dependency @dword-design/puppeteer to v4 ([#29](https://github.com/dword-design/nuxt-modernizr/issues/29)) ([2b4df90](https://github.com/dword-design/nuxt-modernizr/commit/2b4df9061926e34d22744c937b59245a5c4319a2)) 303 | * update dependency with-local-tmp-dir to v3 ([#27](https://github.com/dword-design/nuxt-modernizr/issues/27)) ([b9f8b8f](https://github.com/dword-design/nuxt-modernizr/commit/b9f8b8f9cb18a55606d231d728fbdc0af951f5d5)) 304 | 305 | ## [1.0.15](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.14...v1.0.15) (2021-04-20) 306 | 307 | 308 | ### Bug Fixes 309 | 310 | * updated package.json[keywords] ([#26](https://github.com/dword-design/nuxt-modernizr/issues/26)) ([ad37f53](https://github.com/dword-design/nuxt-modernizr/commit/ad37f533f22ef75f7095ec88edaa99a6c8d57f5b)) 311 | 312 | ## [1.0.14](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.13...v1.0.14) (2021-04-19) 313 | 314 | 315 | ### Bug Fixes 316 | 317 | * fix deprecated dependency ([#25](https://github.com/dword-design/nuxt-modernizr/issues/25)) ([5c2451f](https://github.com/dword-design/nuxt-modernizr/commit/5c2451f7d2acaff79f82ace6f4484d4e9fc82276)) 318 | 319 | ## [1.0.13](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.12...v1.0.13) (2021-04-12) 320 | 321 | 322 | ### Bug Fixes 323 | 324 | * lock file maintenance ([#17](https://github.com/dword-design/nuxt-modernizr/issues/17)) ([3238098](https://github.com/dword-design/nuxt-modernizr/commit/323809862e2e243ca9c1196987a9fd442f1b0b88)) 325 | 326 | ## [1.0.12](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.11...v1.0.12) (2021-03-31) 327 | 328 | 329 | ### Bug Fixes 330 | 331 | * lock file maintenance ([#14](https://github.com/dword-design/nuxt-modernizr/issues/14)) ([9fa864f](https://github.com/dword-design/nuxt-modernizr/commit/9fa864f13fe78881bec07a200f2241c998d64a3c)) 332 | 333 | ## [1.0.11](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.10...v1.0.11) (2021-03-23) 334 | 335 | 336 | ### Bug Fixes 337 | 338 | * update dependency @dword-design/functions to v3 ([#13](https://github.com/dword-design/nuxt-modernizr/issues/13)) ([c917e5b](https://github.com/dword-design/nuxt-modernizr/commit/c917e5bde75b0922fff4718b13270de4984c894c)) 339 | 340 | ## [1.0.10](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.9...v1.0.10) (2021-03-22) 341 | 342 | 343 | ### Bug Fixes 344 | 345 | * lock file maintenance ([#12](https://github.com/dword-design/nuxt-modernizr/issues/12)) ([bea2b8c](https://github.com/dword-design/nuxt-modernizr/commit/bea2b8c39bf51c6365001231045fdfd7cac6833d)) 346 | 347 | ## [1.0.9](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.8...v1.0.9) (2021-03-17) 348 | 349 | 350 | ### Bug Fixes 351 | 352 | * lock file maintenance ([#11](https://github.com/dword-design/nuxt-modernizr/issues/11)) ([8d6d862](https://github.com/dword-design/nuxt-modernizr/commit/8d6d8622a024be9438d73b569cd72d83d09773e7)) 353 | 354 | ## [1.0.8](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.7...v1.0.8) (2021-03-10) 355 | 356 | 357 | ### Bug Fixes 358 | 359 | * fix syntax ([53c844f](https://github.com/dword-design/nuxt-modernizr/commit/53c844f154b1efac5797fbb837717240933b7437)) 360 | * update usage sample ([7706c1a](https://github.com/dword-design/nuxt-modernizr/commit/7706c1a7869855638b80d427822c6e80086322b7)) 361 | 362 | ## [1.0.7](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.6...v1.0.7) (2021-03-10) 363 | 364 | 365 | ### Bug Fixes 366 | 367 | * update changed files ([62661a2](https://github.com/dword-design/nuxt-modernizr/commit/62661a2d7c4c3d9c688a3eb47401af75e0695dfe)) 368 | * update description ([22c04b5](https://github.com/dword-design/nuxt-modernizr/commit/22c04b59644689e03af685b14614a1f545348d3c)) 369 | 370 | ## [1.0.6](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.5...v1.0.6) (2021-03-09) 371 | 372 | 373 | ### Bug Fixes 374 | 375 | * update dependency @dword-design/puppeteer to v3 ([d30d41d](https://github.com/dword-design/nuxt-modernizr/commit/d30d41d410a6c542eaf154638532b9ce1b8262f1)) 376 | 377 | ## [1.0.5](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.4...v1.0.5) (2021-02-17) 378 | 379 | 380 | ### Bug Fixes 381 | 382 | * update dependency @dword-design/puppeteer to v2 ([b6a3362](https://github.com/dword-design/nuxt-modernizr/commit/b6a33624e707817f097f27d4d43c888fef7d3aff)) 383 | 384 | ## [1.0.4](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.3...v1.0.4) (2021-02-17) 385 | 386 | 387 | ### Bug Fixes 388 | 389 | * upgrades ([4251a2a](https://github.com/dword-design/nuxt-modernizr/commit/4251a2af682a09a6f442763271403b538f4a6b68)) 390 | 391 | ## [1.0.3](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.2...v1.0.3) (2020-12-10) 392 | 393 | 394 | ### Bug Fixes 395 | 396 | * **config:** Update changed files ([6c0fe4f](https://github.com/dword-design/nuxt-modernizr/commit/6c0fe4fa0d6ad960d7043f87e50df271b12f3089)) 397 | 398 | ## [1.0.2](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.1...v1.0.2) (2020-08-23) 399 | 400 | 401 | ### Bug Fixes 402 | 403 | * upgrades ([5f16532](https://github.com/dword-design/nuxt-modernizr/commit/5f1653282dfbaf5d0cbff62374cb90ece159762c)) 404 | 405 | ## [1.0.1](https://github.com/dword-design/nuxt-modernizr/compare/v1.0.0...v1.0.1) (2020-07-27) 406 | 407 | 408 | ### Bug Fixes 409 | 410 | * add tests ([8a9385c](https://github.com/dword-design/nuxt-modernizr/commit/8a9385c06f27bd302a12b02a8331955d1a37217c)) 411 | * doc ([8e867d5](https://github.com/dword-design/nuxt-modernizr/commit/8e867d5a33fd4af8c422643e3a53caaf32d38709)) 412 | * fix deps ([dfcaee4](https://github.com/dword-design/nuxt-modernizr/commit/dfcaee4673be602b9f5f010e71b316d314fc7de7)) 413 | 414 | # 1.0.0 (2020-07-26) 415 | 416 | 417 | ### Bug Fixes 418 | 419 | * add keywords ([ac5b53f](https://github.com/dword-design/nuxt-modernizr/commit/ac5b53f584577f3eccc1dedf9f09aa70f8dc1113)) 420 | * add keywords ([71adadf](https://github.com/dword-design/nuxt-modernizr/commit/71adadf8b665eb8ff7a79627cf553dc36e646355)) 421 | 422 | 423 | ### Features 424 | 425 | * init ([de8fa7f](https://github.com/dword-design/nuxt-modernizr/commit/de8fa7fe935348a858c3720053226ca16fbc1548)) 426 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | Unless stated otherwise all works are: 4 | 5 | Copyright © Sebastian Landwehr 6 | 7 | and licensed under: 8 | 9 | [MIT License](https://opensource.org/license/mit/) 10 | 11 | ## MIT License 12 | 13 | MIT License 14 | 15 | Copyright (c) 16 | 17 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 18 | 19 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # nuxt-modernizr 3 | 4 | 5 | 6 |

7 | 8 | npm version 12 | Linux macOS Windows compatible 13 | Build status 17 | 18 | Coverage status 22 | 23 | Dependency status 24 | Renovate enabled
25 | Open in Gitpod 30 | 31 | Buy Me a Coffee 36 | 37 | PayPal 42 | 43 | Patreon 48 | 49 |

50 | 51 | 52 | 53 | Adds a Modernizr build to your Nuxt.js app. 54 | 55 | 56 | 57 | ## Install 58 | 59 | ```bash 60 | # npm 61 | $ npx nuxi module add nuxt-modernizr 62 | 63 | # Yarn 64 | $ yarn nuxi module add nuxt-modernizr 65 | ``` 66 | 67 | 68 | ## Usage 69 | 70 | Add the module to your Nuxt.js modules list in `nuxt.config.js`: 71 | ```js 72 | export default { 73 | ... 74 | modules: [ 75 | ['nuxt-modernizr', { 76 | 'feature-detects': ['css/scrollbars', 'css/overflow-scrolling'], 77 | options: ['setClasses'], 78 | }], 79 | ], 80 | } 81 | ``` 82 | 83 | Access the `Modernizr` variable in your app: 84 | ```js 85 | if (process.client && Modernizr.cssscrollbar) { 86 | ... 87 | } 88 | ``` 89 | 90 | Note that Modernizr only works client-side, so don't forget to check for client-side via `process.client`. If you use a linter that restricts global variables, you can use `window.Modernizr` instead. 91 | 92 | Because we use a global variable here, it can also be accessed in contributed components that need to access Modernizr. The only requirement is that this module is included in the build. 93 | 94 | ## Options 95 | This module passes the options down to the [modernizr](https://www.npmjs.com/package/modernizr) NPM package. Please refer to this for the available options. 96 | 97 | Directly: 98 | ```js 99 | export default { 100 | ... 101 | modules: [ 102 | ['nuxt-modernizr', { 103 | 'feature-detects': ['css/scrollbars', 'css/overflow-scrolling'], 104 | options: ['setClasses'], 105 | }], 106 | ], 107 | } 108 | ``` 109 | 110 | Top-level: 111 | ```js 112 | export default { 113 | ... 114 | modules: [ 115 | 'nuxt-modernizr', 116 | ], 117 | modernizr: { 118 | 'feature-detects': ['css/scrollbars', 'css/overflow-scrolling'], 119 | options: ['setClasses'], 120 | }, 121 | } 122 | ``` 123 | 124 | ## Contribute 125 | 126 | Are you missing something or want to contribute? Feel free to file an [issue](https://github.com/dword-design/nuxt-modernizr/issues) or a [pull request](https://github.com/dword-design/nuxt-modernizr/pulls)! ⚙️ 127 | 128 | ## Support 129 | 130 | Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here: 131 | 132 |

133 | 134 | Buy Me a Coffee 139 |  If you want to send me a one time donation. The coffee is pretty good 😊.
140 | 141 | PayPal 146 |  Also for one time donations if you like PayPal.
147 | 148 | Patreon 153 |  Here you can support me regularly, which is great so I can steadily work on projects. 154 |

155 | 156 | Thanks a lot for your support! ❤️ 157 | 158 | ## See also 159 | 160 | * [nuxt-mail](https://github.com/dword-design/nuxt-mail): Adds email sending capability to a Nuxt.js app. Adds a server route, an injected variable, and uses nodemailer to send emails. 161 | * [nuxt-route-meta](https://github.com/dword-design/nuxt-route-meta): Adds Nuxt page data to route meta at build time. 162 | * [nuxt-mermaid-string](https://github.com/dword-design/nuxt-mermaid-string): Embed a Mermaid diagram in a Nuxt.js app by providing its diagram string. 163 | * [nuxt-content-git](https://github.com/dword-design/nuxt-content-git): Additional module for @nuxt/content that replaces or adds createdAt and updatedAt dates based on the git history. 164 | * [nuxt-babel-runtime](https://github.com/dword-design/nuxt-babel-runtime): Nuxt CLI that supports babel. Inspired by @nuxt/typescript-runtime. 165 | 166 | ## License 167 | 168 | [MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com) 169 | 170 | -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@dword-design/babel-config" 3 | } 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-modernizr", 3 | "version": "4.0.1", 4 | "description": "Adds a Modernizr build to your Nuxt.js app.", 5 | "keywords": [ 6 | "browser-detection", 7 | "caniuse", 8 | "css", 9 | "feature-detection", 10 | "frontend", 11 | "javascript", 12 | "modernizr", 13 | "npm", 14 | "npm-package", 15 | "nuxt", 16 | "nuxt-module", 17 | "nuxtjs", 18 | "nuxtjs-module", 19 | "webdevelopment" 20 | ], 21 | "repository": "dword-design/nuxt-modernizr", 22 | "funding": "https://github.com/sponsors/dword-design", 23 | "license": "MIT", 24 | "author": "Sebastian Landwehr ", 25 | "type": "module", 26 | "exports": "./dist/index.js", 27 | "main": "dist/index.js", 28 | "files": [ 29 | "dist" 30 | ], 31 | "scripts": { 32 | "checkUnknownFiles": "base checkUnknownFiles", 33 | "commit": "base commit", 34 | "depcheck": "base depcheck", 35 | "dev": "base dev", 36 | "lint": "base lint", 37 | "prepare": "base prepare", 38 | "prepublishOnly": "base prepublishOnly", 39 | "test": "base test" 40 | }, 41 | "dependencies": { 42 | "@nuxt/kit": "^3.10.1", 43 | "modernizr": "^3.11.3", 44 | "nuxt-push-plugins": "^2.1.34" 45 | }, 46 | "devDependencies": { 47 | "@dword-design/base": "^11.0.4", 48 | "@dword-design/base-config-nuxt-module": "^1.0.0", 49 | "@dword-design/functions": "^6.0.0", 50 | "@dword-design/puppeteer": "^7.0.0", 51 | "@dword-design/tester": "^2.0.19", 52 | "@dword-design/tester-plugin-puppeteer": "^3.0.0", 53 | "@dword-design/tester-plugin-tmp-dir": "^2.1.26", 54 | "execa": "^8.0.1", 55 | "fs-extra": "^11.2.0", 56 | "nuxt": "^3.10.1", 57 | "nuxt-dev-ready": "^3.0.0", 58 | "ora": "^8.0.1", 59 | "output-files": "^2.0.32", 60 | "tree-kill-promise": "^3.0.14" 61 | }, 62 | "engines": { 63 | "node": ">=18" 64 | }, 65 | "publishConfig": { 66 | "access": "public" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import { addPluginTemplate, isNuxt3 as isNuxt3Try } from '@nuxt/kit'; 2 | import modernizr from 'modernizr'; 3 | import { createRequire } from 'module'; 4 | import nuxtPushPlugins from 'nuxt-push-plugins'; 5 | import P from 'path'; 6 | 7 | const resolver = createRequire(import.meta.url); 8 | 9 | export default async function (moduleOptions, nuxt) { 10 | let isNuxt3 = true; 11 | 12 | try { 13 | isNuxt3 = isNuxt3Try(); 14 | } catch { 15 | isNuxt3 = false; 16 | } 17 | 18 | nuxt = nuxt || this; 19 | const options = { ...nuxt.options.modernizr, ...moduleOptions }; 20 | const code = await new Promise(resolve => modernizr.build(options, resolve)); 21 | 22 | if (isNuxt3) { 23 | addPluginTemplate({ 24 | filename: P.join('nuxt-modernizr', 'plugin.js'), 25 | getContents: () => `export default defineNuxtPlugin(() => { ${code} })`, 26 | mode: 'client', 27 | }); 28 | } else { 29 | nuxtPushPlugins(nuxt, { 30 | fileName: P.join('nuxt-modernizr', 'plugin.js'), 31 | mode: 'client', 32 | options: code, 33 | src: resolver.resolve('./plugin.js.template'), 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/index.spec.js: -------------------------------------------------------------------------------- 1 | import { endent } from '@dword-design/functions'; 2 | import tester from '@dword-design/tester'; 3 | import testerPluginPuppeteer from '@dword-design/tester-plugin-puppeteer'; 4 | import testerPluginTmpDir from '@dword-design/tester-plugin-tmp-dir'; 5 | import { execaCommand } from 'execa'; 6 | import fs from 'fs-extra'; 7 | import nuxtDevReady from 'nuxt-dev-ready'; 8 | import ora from 'ora'; 9 | import outputFiles from 'output-files'; 10 | import P from 'path'; 11 | import kill from 'tree-kill-promise'; 12 | 13 | export default tester( 14 | { 15 | async nuxt2() { 16 | await outputFiles({ 17 | 'nuxt.config.js': endent` 18 | export default { 19 | modules: [ 20 | [ 21 | '~/../src/index.js', 22 | { 23 | 'feature-detects': ['css/rgba'], 24 | options: ['setClasses'], 25 | }, 26 | ], 27 | ], 28 | } 29 | `, 30 | 'pages/index.vue': endent` 31 | 34 | `, 35 | }); 36 | 37 | await fs.remove('node_modules'); 38 | 39 | await fs.symlink( 40 | P.join('..', 'node_modules', '.cache', 'nuxt2', 'node_modules'), 41 | 'node_modules', 42 | ); 43 | 44 | const nuxt = execaCommand('node_modules/.bin/nuxt dev'); 45 | 46 | try { 47 | await nuxtDevReady(); 48 | await this.page.goto('http://localhost:3000'); 49 | await this.page.waitForSelector('html.rgba'); 50 | 51 | expect( 52 | await this.page.evaluate(() => window.Modernizr.rgba), 53 | ).toBeTruthy(); 54 | } finally { 55 | await kill(nuxt.pid); 56 | } 57 | }, 58 | async valid() { 59 | await outputFiles({ 60 | 'nuxt.config.js': endent` 61 | export default { 62 | modules: [ 63 | [ 64 | '../src/index.js', 65 | { 66 | 'feature-detects': ['css/rgba'], 67 | options: ['setClasses'], 68 | }, 69 | ], 70 | ], 71 | } 72 | `, 73 | 'pages/index.vue': endent` 74 | 77 | `, 78 | }); 79 | 80 | const nuxt = execaCommand('nuxt dev'); 81 | 82 | try { 83 | await nuxtDevReady(); 84 | await this.page.goto('http://localhost:3000'); 85 | await this.page.waitForSelector('html.rgba'); 86 | 87 | expect( 88 | await this.page.evaluate(() => window.Modernizr.rgba), 89 | ).toBeTruthy(); 90 | } finally { 91 | await kill(nuxt.pid); 92 | } 93 | }, 94 | }, 95 | [ 96 | testerPluginTmpDir(), 97 | testerPluginPuppeteer(), 98 | { 99 | before: async () => { 100 | const spinner = ora('Installing Nuxt 2').start(); 101 | 102 | await fs.outputFile( 103 | P.join('node_modules', '.cache', 'nuxt2', 'package.json'), 104 | JSON.stringify({}), 105 | ); 106 | 107 | await execaCommand('yarn add nuxt@^2 @nuxt/content@^1', { 108 | cwd: P.join('node_modules', '.cache', 'nuxt2'), 109 | }); 110 | 111 | spinner.stop(); 112 | }, 113 | }, 114 | ], 115 | ); 116 | -------------------------------------------------------------------------------- /src/plugin.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dword-design/nuxt-modernizr/f2541cdac5d58de659fbee9d03ab02add16d4297/src/plugin.js -------------------------------------------------------------------------------- /src/plugin.js.template: -------------------------------------------------------------------------------- 1 | <%= options %> 2 | --------------------------------------------------------------------------------